forked from teamnwah/openmw-tes3coop
Move some levelup logic from mwgui to mwmechanics
This commit is contained in:
parent
7837dcdc19
commit
2a0644a7c3
3 changed files with 18 additions and 13 deletions
|
@ -173,12 +173,7 @@ namespace MWGui
|
||||||
attribute.setBase(100);
|
attribute.setBase(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
// "When you gain a level, in addition to increasing three primary attributes, your Health
|
creatureStats.levelUp();
|
||||||
// will automatically increase by 10% of your Endurance attribute. If you increased Endurance this level,
|
|
||||||
// the Health increase is calculated from the increased Endurance"
|
|
||||||
creatureStats.increaseLevelHealthBonus (creatureStats.getAttribute(ESM::Attribute::Endurance).getBase() * 0.1f);
|
|
||||||
|
|
||||||
creatureStats.setLevel (creatureStats.getLevel()+1);
|
|
||||||
pcStats.levelUp ();
|
pcStats.levelUp ();
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Levelup);
|
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Levelup);
|
||||||
|
|
|
@ -18,16 +18,26 @@ namespace MWMechanics
|
||||||
mAiSettings[i] = 0;
|
mAiSettings[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatureStats::increaseLevelHealthBonus (float value)
|
|
||||||
{
|
|
||||||
mLevelHealthBonus += value;
|
|
||||||
}
|
|
||||||
|
|
||||||
float CreatureStats::getLevelHealthBonus () const
|
float CreatureStats::getLevelHealthBonus () const
|
||||||
{
|
{
|
||||||
return mLevelHealthBonus;
|
return mLevelHealthBonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreatureStats::levelUp()
|
||||||
|
{
|
||||||
|
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||||
|
|
||||||
|
const int endurance = getAttribute(ESM::Attribute::Endurance).getBase();
|
||||||
|
|
||||||
|
// "When you gain a level, in addition to increasing three primary attributes, your Health
|
||||||
|
// will automatically increase by 10% of your Endurance attribute. If you increased Endurance this level,
|
||||||
|
// the Health increase is calculated from the increased Endurance"
|
||||||
|
mLevelHealthBonus += endurance * gmst.find("fLevelUpHealthEndMult")->getFloat();
|
||||||
|
|
||||||
|
mLevel++;
|
||||||
|
}
|
||||||
|
|
||||||
const AiSequence& CreatureStats::getAiSequence() const
|
const AiSequence& CreatureStats::getAiSequence() const
|
||||||
{
|
{
|
||||||
return mAiSequence;
|
return mAiSequence;
|
||||||
|
|
|
@ -95,10 +95,10 @@ namespace MWMechanics
|
||||||
float getFatigueTerm() const;
|
float getFatigueTerm() const;
|
||||||
///< Return effective fatigue
|
///< Return effective fatigue
|
||||||
|
|
||||||
// small hack to allow the fact that Health permanently increases by 10% of endurance on each level up
|
|
||||||
void increaseLevelHealthBonus(float value);
|
|
||||||
float getLevelHealthBonus() const;
|
float getLevelHealthBonus() const;
|
||||||
|
|
||||||
|
void levelUp();
|
||||||
|
|
||||||
bool isDead() const;
|
bool isDead() const;
|
||||||
|
|
||||||
bool hasDied() const;
|
bool hasDied() const;
|
||||||
|
|
Loading…
Reference in a new issue