From a42069823734b4ddd162e6e6740cccb539826a25 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 17 Nov 2013 23:34:52 +0100 Subject: [PATCH] Don't try to absorb or reflect for self casted spells --- apps/openmw/mwmechanics/spellcasting.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index 00ca82c5af..1498a34aac 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -59,7 +59,8 @@ namespace MWMechanics // Try absorbing if it's a spell // NOTE: Vanilla does this once per effect source instead of adding the % from all sources together, not sure // if that is worth replicating. - if (const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().search (mId)) + const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().search (mId); + if (spell && caster != target) { int absorb = target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::SpellAbsorption).mMagnitude; int roll = std::rand()/ (static_cast (RAND_MAX) + 1) * 100; // [0, 99] @@ -78,7 +79,7 @@ namespace MWMechanics } // Try reflecting - if (!reflected && magnitudeMult > 0) + if (!reflected && magnitudeMult > 0 && caster != target) { int reflect = target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::Reflect).mMagnitude; int roll = std::rand()/ (static_cast (RAND_MAX) + 1) * 100; // [0, 99] @@ -434,9 +435,8 @@ namespace MWMechanics if (roll > x) { // "X has no effect on you" - std::string message = MWBase::Environment::get().getWorld()->getStore().get().find("#{sNotifyMessage50}")->getString(); + std::string message = MWBase::Environment::get().getWorld()->getStore().get().find("sNotifyMessage50")->getString(); message = boost::str(boost::format(message) % ingredient->mName); - MWBase::Environment::get().getWindowManager()->messageBox(message); return false; }