From eefe1ed1a8aee482c0b7aa6d6e901404eb788391 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 21 Feb 2017 15:48:45 +0100 Subject: [PATCH] Fix being affected by Silence in god mode --- apps/openmw/mwmechanics/spellcasting.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index ffb31d70d..d2532db12 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -95,8 +95,6 @@ namespace MWMechanics int actorLuck = stats.getAttribute(ESM::Attribute::Luck).getModified(); float castChance = (lowestSkill - spell->mData.mCost + castBonus + 0.2f * actorWillpower + 0.1f * actorLuck) * stats.getFatigueTerm(); - if (MWBase::Environment::get().getWorld()->getGodModeState() && actor == getPlayer()) - castChance = 100; if (!cap) return std::max(0.f, castChance); @@ -816,12 +814,15 @@ namespace MWMechanics bool fail = false; // Check success - float successChance = getSpellSuccessChance(spell, mCaster); - if (Misc::Rng::roll0to99() >= successChance) + if (!(mCaster == getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState())) { - if (mCaster == getPlayer()) - MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicSkillFail}"); - fail = true; + float successChance = getSpellSuccessChance(spell, mCaster); + if (Misc::Rng::roll0to99() >= successChance) + { + if (mCaster == getPlayer()) + MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicSkillFail}"); + fail = true; + } } if (fail)