Add zero-duration spells effects to effect list (bug #3533)

pull/540/head
Andrei Kortunov 6 years ago
parent 1cfc1f9bdb
commit 8de3383612

@ -17,6 +17,7 @@
Bug #3249: Fixed revert function not updating views properly Bug #3249: Fixed revert function not updating views properly
Bug #3374: Touch spells not hitting kwama foragers Bug #3374: Touch spells not hitting kwama foragers
Bug #3486: [Mod] NPC Commands does not work Bug #3486: [Mod] NPC Commands does not work
Bug #3533: GetSpellEffects should detect effects with zero duration
Bug #3591: Angled hit distance too low Bug #3591: Angled hit distance too low
Bug #3629: DB assassin attack never triggers creature spawning Bug #3629: DB assassin attack never triggers creature spawning
Bug #3876: Landscape texture painting is misaligned Bug #3876: Landscape texture painting is misaligned

@ -509,9 +509,18 @@ namespace MWMechanics
} }
else // target.getClass().isActor() == true else // target.getClass().isActor() == true
{ {
ActiveSpells::ActiveEffect effect;
effect.mEffectId = effectIt->mEffectID;
effect.mArg = MWMechanics::EffectKey(*effectIt).mArg;
effect.mMagnitude = magnitude;
bool hasDuration = !(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration); bool hasDuration = !(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration);
if (hasDuration && effectIt->mDuration == 0) if (hasDuration && effectIt->mDuration == 0)
{ {
// We still should add effect to list to allow GetSpellEffects to detect this spell
effect.mDuration = 0.f;
appliedLastingEffects.push_back(effect);
// duration 0 means apply full magnitude instantly // duration 0 means apply full magnitude instantly
bool wasDead = target.getClass().getCreatureStats(target).isDead(); bool wasDead = target.getClass().getCreatureStats(target).isDead();
effectTick(target.getClass().getCreatureStats(target), target, EffectKey(*effectIt), magnitude); effectTick(target.getClass().getCreatureStats(target), target, EffectKey(*effectIt), magnitude);
@ -522,18 +531,15 @@ namespace MWMechanics
} }
else else
{ {
// add to list of active effects, to apply in next frame
ActiveSpells::ActiveEffect effect;
effect.mEffectId = effectIt->mEffectID;
effect.mArg = MWMechanics::EffectKey(*effectIt).mArg;
if (!hasDuration) if (!hasDuration)
effect.mDuration = 1.0f; effect.mDuration = 1.0f;
else else
effect.mDuration = static_cast<float>(effectIt->mDuration); effect.mDuration = static_cast<float>(effectIt->mDuration);
effect.mMagnitude = magnitude;
targetEffects.add(MWMechanics::EffectKey(*effectIt), MWMechanics::EffectParam(effect.mMagnitude)); targetEffects.add(MWMechanics::EffectKey(*effectIt), MWMechanics::EffectParam(effect.mMagnitude));
// add to list of active effects, to apply in next frame
appliedLastingEffects.push_back(effect); appliedLastingEffects.push_back(effect);
// Unequip all items, if a spell with the ExtraSpell effect was casted // Unequip all items, if a spell with the ExtraSpell effect was casted

Loading…
Cancel
Save