mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-02 12:06:41 +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
|
else
|
||||||
{
|
{
|
||||||
MWMechanics::DynamicStat<float> fatigue(getCreatureStats(ptr).getFatigue());
|
MWMechanics::DynamicStat<float> fatigue(getCreatureStats(ptr).getFatigue());
|
||||||
fatigue.setCurrent(fatigue.getCurrent() - damage);
|
fatigue.setCurrent(fatigue.getCurrent() - damage, true);
|
||||||
getCreatureStats(ptr).setFatigue(fatigue);
|
getCreatureStats(ptr).setFatigue(fatigue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -669,7 +669,7 @@ namespace MWClass
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MWMechanics::DynamicStat<float> fatigue(getCreatureStats(ptr).getFatigue());
|
MWMechanics::DynamicStat<float> fatigue(getCreatureStats(ptr).getFatigue());
|
||||||
fatigue.setCurrent(fatigue.getCurrent() - damage);
|
fatigue.setCurrent(fatigue.getCurrent() - damage, true);
|
||||||
getCreatureStats(ptr).setFatigue(fatigue);
|
getCreatureStats(ptr).setFatigue(fatigue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,14 +162,26 @@ namespace MWMechanics
|
||||||
setCurrent (getCurrent()+diff);
|
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;
|
mCurrent = 0;
|
||||||
else if (mCurrent>getModified())
|
}
|
||||||
mCurrent = getModified();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setModifier (const T& modifier)
|
void setModifier (const T& modifier)
|
||||||
|
|
Loading…
Reference in a new issue