mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-21 04:39:42 +00:00
Allow fatigue stat to become negative when fatigue damages are taken
This commit is contained in:
parent
77a2179d1e
commit
fc8bd1aacb
3 changed files with 19 additions and 7 deletions
|
@ -199,7 +199,7 @@ namespace MWClass
|
|||
else
|
||||
{
|
||||
MWMechanics::DynamicStat<float> fatigue(getCreatureStats(ptr).getFatigue());
|
||||
fatigue.setCurrent(fatigue.getCurrent() - damage);
|
||||
fatigue.setCurrent(fatigue.getCurrent() - damage, true);
|
||||
getCreatureStats(ptr).setFatigue(fatigue);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -669,7 +669,7 @@ namespace MWClass
|
|||
else
|
||||
{
|
||||
MWMechanics::DynamicStat<float> fatigue(getCreatureStats(ptr).getFatigue());
|
||||
fatigue.setCurrent(fatigue.getCurrent() - damage);
|
||||
fatigue.setCurrent(fatigue.getCurrent() - damage, true);
|
||||
getCreatureStats(ptr).setFatigue(fatigue);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,14 +162,26 @@ namespace MWMechanics
|
|||
setCurrent (getCurrent()+diff);
|
||||
}
|
||||
|
||||
void setCurrent (const T& value)
|
||||
void setCurrent (const T& value, bool allowDecreaseBelowZero = false)
|
||||
{
|
||||
mCurrent = value;
|
||||
if (value > mCurrent)
|
||||
{
|
||||
// increase
|
||||
mCurrent = value;
|
||||
|
||||
if (mCurrent<0)
|
||||
if (mCurrent > getModified())
|
||||
mCurrent = getModified();
|
||||
}
|
||||
else if (value > 0 || allowDecreaseBelowZero)
|
||||
{
|
||||
// allowed decrease
|
||||
mCurrent = value;
|
||||
}
|
||||
else if (mCurrent > 0)
|
||||
{
|
||||
// capped decrease
|
||||
mCurrent = 0;
|
||||
else if (mCurrent>getModified())
|
||||
mCurrent = getModified();
|
||||
}
|
||||
}
|
||||
|
||||
void setModifier (const T& modifier)
|
||||
|
|
Loading…
Reference in a new issue