Calculate NPC health on loading instead of updating it continually

Only NPC with auto-calculated stats are concerned.
This commit is contained in:
Emanuel Guevel 2013-07-20 14:52:17 +02:00
parent 074e241c32
commit 7837dcdc19
2 changed files with 4 additions and 4 deletions

View file

@ -109,6 +109,10 @@ namespace
creatureStats.getAttribute(attribute).setBase ( std::min(creatureStats.getAttribute(attribute).getBase()
+ static_cast<int>((level-1) * modifierSum+0.5), 100) );
}
int strength = creatureStats.getAttribute(ESM::Attribute::Strength).getBase();
int endurance = creatureStats.getAttribute(ESM::Attribute::Endurance).getBase();
creatureStats.setHealth(static_cast<int> (0.5 * (strength + endurance)) + creatureStats.getLevelHealthBonus());
}
}

View file

@ -76,10 +76,6 @@ namespace MWMechanics
double magickaFactor =
creatureStats.getMagicEffects().get (EffectKey (ESM::MagicEffect::FortifyMaximumMagicka)).mMagnitude * 0.1 + 0.5;
DynamicStat<float> health = creatureStats.getHealth();
health.setBase (static_cast<int> (0.5 * (strength + endurance)) + creatureStats.getLevelHealthBonus ());
creatureStats.setHealth (health);
DynamicStat<float> magicka = creatureStats.getMagicka();
magicka.setBase (static_cast<int> (intelligence + magickaFactor * intelligence));
creatureStats.setMagicka (magicka);