mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-02 12:36:42 +00:00
Issue #356: added function for fatigue term calculation
This commit is contained in:
parent
677158c477
commit
9dcf8939e9
2 changed files with 23 additions and 0 deletions
|
@ -1,5 +1,12 @@
|
||||||
#include "creaturestats.hpp"
|
#include "creaturestats.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <components/esm_store/store.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
CreatureStats::CreatureStats()
|
CreatureStats::CreatureStats()
|
||||||
|
@ -55,4 +62,17 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
return mAiSequence;
|
return mAiSequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CreatureStats::getFatigueTerm() const
|
||||||
|
{
|
||||||
|
int max = getFatigue().getModified();
|
||||||
|
int current = getFatigue().getCurrent();
|
||||||
|
|
||||||
|
float normalised = max==0 ? 1 : std::max (0.0f, static_cast<float> (current)/max);
|
||||||
|
|
||||||
|
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
|
return store.gameSettings.find ("fFatigueBase")->getFloat()
|
||||||
|
- store.gameSettings.find ("fFatigueMult")->getFloat() * (1-normalised);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,9 @@ namespace MWMechanics
|
||||||
const AiSequence& getAiSequence() const;
|
const AiSequence& getAiSequence() const;
|
||||||
|
|
||||||
AiSequence& getAiSequence();
|
AiSequence& getAiSequence();
|
||||||
|
|
||||||
|
float getFatigueTerm() const;
|
||||||
|
///< Return effective fatigue
|
||||||
};
|
};
|
||||||
|
|
||||||
// Inline const getters
|
// Inline const getters
|
||||||
|
|
Loading…
Reference in a new issue