mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 17:19:39 +00:00
Set magic effects that don't support variable durations to use duration of 1
This commit is contained in:
parent
1c2e04747d
commit
610f36f47b
1 changed files with 6 additions and 2 deletions
|
@ -463,7 +463,8 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
else // target.getClass().isActor() == true
|
else // target.getClass().isActor() == true
|
||||||
{
|
{
|
||||||
if (effectIt->mDuration == 0)
|
bool hasDuration = !(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration);
|
||||||
|
if (hasDuration && effectIt->mDuration == 0)
|
||||||
{
|
{
|
||||||
// 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();
|
||||||
|
@ -479,7 +480,10 @@ namespace MWMechanics
|
||||||
ActiveSpells::ActiveEffect effect;
|
ActiveSpells::ActiveEffect effect;
|
||||||
effect.mEffectId = effectIt->mEffectID;
|
effect.mEffectId = effectIt->mEffectID;
|
||||||
effect.mArg = MWMechanics::EffectKey(*effectIt).mArg;
|
effect.mArg = MWMechanics::EffectKey(*effectIt).mArg;
|
||||||
effect.mDuration = static_cast<float>(effectIt->mDuration);
|
if (!hasDuration)
|
||||||
|
effect.mDuration = 1.0f;
|
||||||
|
else
|
||||||
|
effect.mDuration = static_cast<float>(effectIt->mDuration);
|
||||||
effect.mMagnitude = magnitude;
|
effect.mMagnitude = magnitude;
|
||||||
|
|
||||||
targetEffects.add(MWMechanics::EffectKey(*effectIt), MWMechanics::EffectParam(effect.mMagnitude));
|
targetEffects.add(MWMechanics::EffectKey(*effectIt), MWMechanics::EffectParam(effect.mMagnitude));
|
||||||
|
|
Loading…
Reference in a new issue