mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-03 21:15:38 +00:00
Reduce fatigue when casting. Has no effect in the vanilla game due to the GMSTs being 0.
This commit is contained in:
parent
9c5847e2f4
commit
5458207325
1 changed files with 11 additions and 1 deletions
|
@ -2039,6 +2039,15 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
const ESM::Spell* spell = getStore().get<ESM::Spell>().search(selectedSpell);
|
const ESM::Spell* spell = getStore().get<ESM::Spell>().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<ESM::GameSetting>().find("fFatigueSpellBase")->getFloat();
|
||||||
|
static const float fFatigueSpellMult = getStore().get<ESM::GameSetting>().find("fFatigueSpellMult")->getFloat();
|
||||||
|
MWMechanics::DynamicStat<float> 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
|
// Check mana
|
||||||
bool fail = false;
|
bool fail = false;
|
||||||
MWMechanics::DynamicStat<float> magicka = stats.getMagicka();
|
MWMechanics::DynamicStat<float> magicka = stats.getMagicka();
|
||||||
|
@ -2096,7 +2105,8 @@ namespace MWWorld
|
||||||
return;
|
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,
|
actor.getClass().skillUsageSucceeded(actor,
|
||||||
MWMechanics::spellSchoolToSkill(MWMechanics::getSpellSchool(selectedSpell, actor)), 0);
|
MWMechanics::spellSchoolToSkill(MWMechanics::getSpellSchool(selectedSpell, actor)), 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue