|
|
@ -545,10 +545,10 @@ namespace MWMechanics
|
|
|
|
|
|
|
|
|
|
|
|
void Actors::restoreDynamicStats (const MWWorld::Ptr& ptr, bool sleep)
|
|
|
|
void Actors::restoreDynamicStats (const MWWorld::Ptr& ptr, bool sleep)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (ptr.getClass().getCreatureStats(ptr).isDead())
|
|
|
|
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats (ptr);
|
|
|
|
|
|
|
|
if (stats.isDead())
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats (ptr);
|
|
|
|
|
|
|
|
const MWWorld::Store<ESM::GameSetting>& settings = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
|
|
|
const MWWorld::Store<ESM::GameSetting>& settings = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
|
|
|
|
|
|
|
|
|
|
|
if (sleep)
|
|
|
|
if (sleep)
|
|
|
@ -565,12 +565,6 @@ namespace MWMechanics
|
|
|
|
stats.setMagicka(stat);
|
|
|
|
stats.setMagicka(stat);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int endurance = stats.getAttribute (ESM::Attribute::Endurance).getModified ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float normalizedEncumbrance = ptr.getClass().getNormalizedEncumbrance(ptr);
|
|
|
|
|
|
|
|
if (normalizedEncumbrance > 1)
|
|
|
|
|
|
|
|
normalizedEncumbrance = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Current fatigue can be above base value due to a fortify effect.
|
|
|
|
// Current fatigue can be above base value due to a fortify effect.
|
|
|
|
// In that case stop here and don't try to restore.
|
|
|
|
// In that case stop here and don't try to restore.
|
|
|
|
DynamicStat<float> fatigue = stats.getFatigue();
|
|
|
|
DynamicStat<float> fatigue = stats.getFatigue();
|
|
|
@ -582,6 +576,12 @@ namespace MWMechanics
|
|
|
|
float fFatigueReturnMult = settings.find("fFatigueReturnMult")->mValue.getFloat ();
|
|
|
|
float fFatigueReturnMult = settings.find("fFatigueReturnMult")->mValue.getFloat ();
|
|
|
|
float fEndFatigueMult = settings.find("fEndFatigueMult")->mValue.getFloat ();
|
|
|
|
float fEndFatigueMult = settings.find("fEndFatigueMult")->mValue.getFloat ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int endurance = stats.getAttribute (ESM::Attribute::Endurance).getModified ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float normalizedEncumbrance = ptr.getClass().getNormalizedEncumbrance(ptr);
|
|
|
|
|
|
|
|
if (normalizedEncumbrance > 1)
|
|
|
|
|
|
|
|
normalizedEncumbrance = 1;
|
|
|
|
|
|
|
|
|
|
|
|
float x = fFatigueReturnBase + fFatigueReturnMult * (1 - normalizedEncumbrance);
|
|
|
|
float x = fFatigueReturnBase + fFatigueReturnMult * (1 - normalizedEncumbrance);
|
|
|
|
x *= fEndFatigueMult * endurance;
|
|
|
|
x *= fEndFatigueMult * endurance;
|
|
|
|
|
|
|
|
|
|
|
@ -1667,7 +1667,8 @@ namespace MWMechanics
|
|
|
|
if (iter->first.getClass().getCreatureStats(iter->first).isDead())
|
|
|
|
if (iter->first.getClass().getCreatureStats(iter->first).isDead())
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
restoreDynamicStats(iter->first, sleep);
|
|
|
|
if (!sleep || iter->first == player)
|
|
|
|
|
|
|
|
restoreDynamicStats(iter->first, sleep);
|
|
|
|
|
|
|
|
|
|
|
|
if ((!iter->first.getRefData().getBaseNode()) ||
|
|
|
|
if ((!iter->first.getRefData().getBaseNode()) ||
|
|
|
|
(playerPos - iter->first.getRefData().getPosition().asVec3()).length2() > sqrAiProcessingDistance)
|
|
|
|
(playerPos - iter->first.getRefData().getPosition().asVec3()).length2() > sqrAiProcessingDistance)
|
|
|
|