From 610f36f47b1e2ac02f7c7f919c8fe9b0932e2247 Mon Sep 17 00:00:00 2001 From: Allofich Date: Fri, 14 Oct 2016 00:05:21 +0900 Subject: [PATCH] Set magic effects that don't support variable durations to use duration of 1 --- apps/openmw/mwmechanics/spellcasting.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index 6ab7c6699..aaed6712e 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -463,7 +463,8 @@ namespace MWMechanics } 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 bool wasDead = target.getClass().getCreatureStats(target).isDead(); @@ -479,7 +480,10 @@ namespace MWMechanics ActiveSpells::ActiveEffect effect; effect.mEffectId = effectIt->mEffectID; effect.mArg = MWMechanics::EffectKey(*effectIt).mArg; - effect.mDuration = static_cast(effectIt->mDuration); + if (!hasDuration) + effect.mDuration = 1.0f; + else + effect.mDuration = static_cast(effectIt->mDuration); effect.mMagnitude = magnitude; targetEffects.add(MWMechanics::EffectKey(*effectIt), MWMechanics::EffectParam(effect.mMagnitude));