From 5458207325d10092bd3645f3ef2f66c379985ea6 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 14 Nov 2013 18:41:34 +0100 Subject: [PATCH] Reduce fatigue when casting. Has no effect in the vanilla game due to the GMSTs being 0. --- apps/openmw/mwworld/worldimp.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 577345c46..e98c965f9 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -2039,6 +2039,15 @@ namespace MWWorld { const ESM::Spell* spell = getStore().get().search(selectedSpell); + // Reduce fatigue (note that in the vanilla game, both GMSTs are 0, and there's no fatigue loss) + static const float fFatigueSpellBase = getStore().get().find("fFatigueSpellBase")->getFloat(); + static const float fFatigueSpellMult = getStore().get().find("fFatigueSpellMult")->getFloat(); + MWMechanics::DynamicStat fatigue = stats.getFatigue(); + const float normalizedEncumbrance = actor.getClass().getEncumbrance(actor) / actor.getClass().getCapacity(actor); + float fatigueLoss = spell->mData.mCost * (fFatigueSpellBase + normalizedEncumbrance * fFatigueSpellMult); + fatigue.setCurrent(std::max(0.f, fatigue.getCurrent() - fatigueLoss)); + stats.setFatigue(fatigue); + // Check mana bool fail = false; MWMechanics::DynamicStat magicka = stats.getMagicka(); @@ -2096,7 +2105,8 @@ namespace MWWorld return; } - if (actor == getPlayer().getPlayer()) + // Note: F_Always spells don't contribute to skill progress + if (actor == getPlayer().getPlayer() && !(spell->mData.mFlags & ESM::Spell::F_Always)) actor.getClass().skillUsageSucceeded(actor, MWMechanics::spellSchoolToSkill(MWMechanics::getSpellSchool(selectedSpell, actor)), 0);