Merge branch 'over_time' into 'master'

Fix particles and magnitudes for (damage) over time effects

See merge request OpenMW/openmw!1298
pull/3186/head
psi29a 3 years ago
commit 00b28d2665

@ -806,6 +806,7 @@ bool applyMagicEffect(const MWWorld::Ptr& target, const MWWorld::Ptr& caster, Ac
}
if(effect.mMagnitude == 0)
{
effect.mMagnitude = oldMagnitude;
effect.mFlags |= ESM::ActiveEffect::Flag_Applied | ESM::ActiveEffect::Flag_Remove;
effect.mTimeLeft -= dt;
return false;
@ -1027,15 +1028,15 @@ void onMagicEffectRemoved(const MWWorld::Ptr& target, ActiveSpells::ActiveSpellP
{
if(!(effect.mFlags & ESM::ActiveEffect::Flag_Applied))
return;
const auto world = MWBase::Environment::get().getWorld();
auto& magnitudes = target.getClass().getCreatureStats(target).getMagicEffects();
const auto* magicEffect = world->getStore().get<ESM::MagicEffect>().find(effect.mEffectId);
if(magicEffect->mData.mFlags & ESM::MagicEffect::Flags::AppliedOnce)
magnitudes.add(EffectKey(effect.mEffectId, effect.mArg), EffectParam(-effect.mMagnitude));
magnitudes.add(EffectKey(effect.mEffectId, effect.mArg), EffectParam(-effect.mMagnitude));
removeMagicEffect(target, spellParams, effect);
auto anim = world->getAnimation(target);
if(anim)
anim->removeEffect(effect.mEffectId);
if(magnitudes.get(effect.mEffectId).getMagnitude() <= 0.f)
{
auto anim = MWBase::Environment::get().getWorld()->getAnimation(target);
if(anim)
anim->removeEffect(effect.mEffectId);
}
}
}

Loading…
Cancel
Save