From 675bd094624b2d43c0a6db55aa4e090f1a9404d3 Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 13 Oct 2016 20:16:13 +0900 Subject: [PATCH 1/3] Change several instant effects to be non-instant (Fixes #2054) --- apps/openmw/mwmechanics/spellcasting.cpp | 55 ++++++++++-------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index 1fc800a7c..6ab7c6699 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -463,8 +463,7 @@ namespace MWMechanics } else // target.getClass().isActor() == true { - bool hasDuration = !(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration); - if (hasDuration && effectIt->mDuration == 0) + if (effectIt->mDuration == 0) { // duration 0 means apply full magnitude instantly bool wasDead = target.getClass().getCreatureStats(target).isDead(); @@ -610,36 +609,8 @@ namespace MWMechanics return true; } } - else if (target.getClass().isActor()) + else if (target.getClass().isActor() && target == getPlayer()) { - switch (effectId) - { - case ESM::MagicEffect::CurePoison: - target.getClass().getCreatureStats(target).getActiveSpells().purgeEffect(ESM::MagicEffect::Poison); - return true; - case ESM::MagicEffect::CureParalyzation: - target.getClass().getCreatureStats(target).getActiveSpells().purgeEffect(ESM::MagicEffect::Paralyze); - return true; - case ESM::MagicEffect::CureCommonDisease: - target.getClass().getCreatureStats(target).getSpells().purgeCommonDisease(); - return true; - case ESM::MagicEffect::CureBlightDisease: - target.getClass().getCreatureStats(target).getSpells().purgeBlightDisease(); - return true; - case ESM::MagicEffect::CureCorprusDisease: - target.getClass().getCreatureStats(target).getSpells().purgeCorprusDisease(); - return true; - case ESM::MagicEffect::Dispel: - target.getClass().getCreatureStats(target).getActiveSpells().purgeAll(magnitude); - return true; - case ESM::MagicEffect::RemoveCurse: - target.getClass().getCreatureStats(target).getSpells().purgeCurses(); - return true; - } - - if (target != getPlayer()) - return false; - MWRender::Animation* anim = MWBase::Environment::get().getWorld()->getAnimation(mCaster); if (effectId == ESM::MagicEffect::DivineIntervention) @@ -662,7 +633,6 @@ namespace MWMechanics anim->addEffect("meshes\\" + fx->mModel, -1); return true; } - else if (effectId == ESM::MagicEffect::Mark) { MWBase::Environment::get().getWorld()->getPlayer().markPosition( @@ -1149,6 +1119,27 @@ namespace MWMechanics break; } + case ESM::MagicEffect::CurePoison: + actor.getClass().getCreatureStats(actor).getActiveSpells().purgeEffect(ESM::MagicEffect::Poison); + break; + case ESM::MagicEffect::CureParalyzation: + actor.getClass().getCreatureStats(actor).getActiveSpells().purgeEffect(ESM::MagicEffect::Paralyze); + break; + case ESM::MagicEffect::CureCommonDisease: + actor.getClass().getCreatureStats(actor).getSpells().purgeCommonDisease(); + break; + case ESM::MagicEffect::CureBlightDisease: + actor.getClass().getCreatureStats(actor).getSpells().purgeBlightDisease(); + break; + case ESM::MagicEffect::CureCorprusDisease: + actor.getClass().getCreatureStats(actor).getSpells().purgeCorprusDisease(); + break; + case ESM::MagicEffect::Dispel: + actor.getClass().getCreatureStats(actor).getActiveSpells().purgeAll(magnitude); + break; + case ESM::MagicEffect::RemoveCurse: + actor.getClass().getCreatureStats(actor).getSpells().purgeCurses(); + break; } if (receivedMagicDamage && actor == getPlayer()) From 1c2e04747d3b7157b3950f393a4a575c39c6a381 Mon Sep 17 00:00:00 2001 From: Allofich Date: Thu, 13 Oct 2016 20:20:39 +0900 Subject: [PATCH 2/3] Remove stray line --- apps/openmw/mwdialogue/dialoguemanagerimp.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index 14210099f..ee6e24938 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -448,8 +448,7 @@ namespace MWDialogue { MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Dialogue); - // Clamp permanent disposition change so that final disposition doesn't go below 0 (could happen with intimidate) - + // Clamp permanent disposition change so that final disposition doesn't go below 0 (could happen with intimidate) float curDisp = static_cast(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor, false)); if (curDisp + mPermanentDispositionChange < 0) mPermanentDispositionChange = -curDisp; From 610f36f47b1e2ac02f7c7f919c8fe9b0932e2247 Mon Sep 17 00:00:00 2001 From: Allofich Date: Fri, 14 Oct 2016 00:05:21 +0900 Subject: [PATCH 3/3] 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));