Core/StatSystem: Fixed possible crash when calculating health bonus from stamina

Closes #8595
Closes #8620
This commit is contained in:
Shauren
2012-12-10 11:50:17 +01:00
parent b28d1ec531
commit bd51d033f6
+4 -2
View File
@@ -215,13 +215,15 @@ void Player::UpdateArmor()
float Player::GetHealthBonusFromStamina()
{
// Taken from PaperDollFrame.lua - 4.3.4.15595
gtOCTHpPerStaminaEntry const* hpBase = sGtOCTHpPerStaminaStore.LookupEntry((getClass() - 1) * GT_MAX_LEVEL + getLevel() - 1);
float ratio = 10.0f;
if (gtOCTHpPerStaminaEntry const* hpBase = sGtOCTHpPerStaminaStore.LookupEntry((getClass() - 1) * GT_MAX_LEVEL + getLevel() - 1))
ratio = hpBase->ratio;
float stamina = GetStat(STAT_STAMINA);
float baseStam = std::min(20.0f, stamina);
float moreStam = stamina - baseStam;
return baseStam + moreStam * hpBase->ratio;
return baseStam + moreStam * ratio;
}
float Player::GetManaBonusFromIntellect()