1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-19 19:41:33 +00:00

Fix being affected by Silence in god mode

This commit is contained in:
scrawl 2017-02-21 15:48:45 +01:00
parent b9740fd2a1
commit eefe1ed1a8

View file

@ -95,8 +95,6 @@ namespace MWMechanics
int actorLuck = stats.getAttribute(ESM::Attribute::Luck).getModified(); int actorLuck = stats.getAttribute(ESM::Attribute::Luck).getModified();
float castChance = (lowestSkill - spell->mData.mCost + castBonus + 0.2f * actorWillpower + 0.1f * actorLuck) * stats.getFatigueTerm(); 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) if (!cap)
return std::max(0.f, castChance); return std::max(0.f, castChance);
@ -816,6 +814,8 @@ namespace MWMechanics
bool fail = false; bool fail = false;
// Check success // Check success
if (!(mCaster == getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState()))
{
float successChance = getSpellSuccessChance(spell, mCaster); float successChance = getSpellSuccessChance(spell, mCaster);
if (Misc::Rng::roll0to99() >= successChance) if (Misc::Rng::roll0to99() >= successChance)
{ {
@ -823,6 +823,7 @@ namespace MWMechanics
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicSkillFail}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicSkillFail}");
fail = true; fail = true;
} }
}
if (fail) if (fail)
{ {