mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-21 09:39:56 +00:00
Support fatigue below zero for the Drain effect (Fixes #2430)
This commit is contained in:
parent
3d5c1d1190
commit
36e1b6cc48
@ -547,7 +547,9 @@ namespace MWMechanics
|
||||
{
|
||||
DynamicStat<float> stat = creatureStats.getDynamic(i);
|
||||
stat.setModifier(effects.get(ESM::MagicEffect::FortifyHealth+i).getMagnitude() -
|
||||
effects.get(ESM::MagicEffect::DrainHealth+i).getMagnitude());
|
||||
effects.get(ESM::MagicEffect::DrainHealth+i).getMagnitude(),
|
||||
// Fatigue can be decreased below zero meaning the actor will be knocked out
|
||||
i == 2);
|
||||
|
||||
|
||||
float currentDiff = creatureStats.getMagicEffects().get(ESM::MagicEffect::RestoreHealth+i).getMagnitude()
|
||||
|
@ -170,10 +170,10 @@ namespace MWMechanics
|
||||
}
|
||||
|
||||
/// Change modified relatively.
|
||||
void modify (const T& diff)
|
||||
void modify (const T& diff, bool allowCurrentDecreaseBelowZero=false)
|
||||
{
|
||||
mStatic.modify (diff);
|
||||
setCurrent (getCurrent()+diff);
|
||||
setCurrent (getCurrent()+diff, allowCurrentDecreaseBelowZero);
|
||||
}
|
||||
|
||||
void setCurrent (const T& value, bool allowDecreaseBelowZero = false)
|
||||
@ -198,11 +198,11 @@ namespace MWMechanics
|
||||
}
|
||||
}
|
||||
|
||||
void setModifier (const T& modifier)
|
||||
void setModifier (const T& modifier, bool allowCurrentDecreaseBelowZero=false)
|
||||
{
|
||||
T diff = modifier - mStatic.getModifier();
|
||||
mStatic.setModifier (modifier);
|
||||
setCurrent (getCurrent()+diff);
|
||||
setCurrent (getCurrent()+diff, allowCurrentDecreaseBelowZero);
|
||||
}
|
||||
|
||||
void writeState (ESM::StatState<T>& state) const
|
||||
|
Loading…
x
Reference in New Issue
Block a user