mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 17:45:35 +00:00
Fix particles and magnitudes for (damage) over time effects
This commit is contained in:
parent
ac3c02496c
commit
add6eb9c95
1 changed files with 8 additions and 7 deletions
|
@ -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…
Reference in a new issue