1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 18:19:55 +00:00

Fix Tribunal/BM summon effects not working

This commit is contained in:
scrawl 2015-01-22 04:12:08 +01:00
parent e203127952
commit 378e91545d
4 changed files with 16 additions and 6 deletions

View file

@ -23,7 +23,7 @@ namespace ESSImport
if (esm.isNextSub("LVCR"))
{
// occurs on leveled creature spawner references
// probably some identifier for the the creature that has been spawned?
// probably some identifier for the creature that has been spawned?
unsigned char lvcr;
esm.getHT(lvcr);
//std::cout << "LVCR: " << (int)lvcr << std::endl;

View file

@ -472,9 +472,7 @@ namespace MWMechanics
applyInstantEffect(target, caster, EffectKey(*effectIt), magnitude);
// Re-casting a summon effect will remove the creature from previous castings of that effect.
if (effectIt->mEffectID >= ESM::MagicEffect::SummonScamp
&& effectIt->mEffectID <= ESM::MagicEffect::SummonStormAtronach
&& !target.isEmpty() && target.getClass().isActor())
if (isSummoningEffect(effectIt->mEffectID) && !target.isEmpty() && target.getClass().isActor())
{
CreatureStats& targetStats = target.getClass().getCreatureStats(target);
std::map<CreatureStats::SummonKey, int>::iterator found = targetStats.getSummonedCreatureMap().find(std::make_pair(effectIt->mEffectID, mId));
@ -956,4 +954,13 @@ namespace MWMechanics
return static_cast<int>((result < 1) ? 1 : result);
}
bool isSummoningEffect(int effectId)
{
return ((effectId >= ESM::MagicEffect::SummonScamp
&& effectId <= ESM::MagicEffect::SummonStormAtronach)
|| effectId == ESM::MagicEffect::SummonCenturionSphere
|| (effectId >= ESM::MagicEffect::SummonFabricant
&& effectId <= ESM::MagicEffect::SummonCreature05));
}
}

View file

@ -22,6 +22,8 @@ namespace MWMechanics
ESM::Skill::SkillEnum spellSchoolToSkill(int school);
bool isSummoningEffect(int effectId);
/**
* @param spell spell to cast
* @param actor calculate spell success chance for this actor (depends on actor's skills)

View file

@ -5,6 +5,8 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwmechanics/spellcasting.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/manualref.hpp"
@ -51,8 +53,7 @@ namespace MWMechanics
void UpdateSummonedCreatures::visit(EffectKey key, const std::string &sourceName, const std::string &sourceId, int casterActorId, float magnitude, float remainingTime, float totalTime)
{
if (key.mId >= ESM::MagicEffect::SummonScamp
&& key.mId <= ESM::MagicEffect::SummonStormAtronach && magnitude > 0)
if (isSummoningEffect(key.mId) && magnitude > 0)
{
mActiveEffects.insert(std::make_pair(key.mId, sourceId));
}