Mercurial > mm7
changeset 1594:c0238b60d0f2
Player::GetMaxHealth, GetBaseAC, GetActualAC minor cleanups
author | Grumpy7 |
---|---|
date | Sun, 08 Sep 2013 08:10:09 +0200 |
parents | 5658d0f3b5ee |
children | a52a01aaf439 |
files | Player.cpp |
diffstat | 1 files changed, 4 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/Player.cpp Sun Sep 08 08:01:05 2013 +0200 +++ b/Player.cpp Sun Sep 08 08:10:09 2013 +0200 @@ -2778,7 +2778,6 @@ weapon_enchantment_recovery_reduction = 20; } - int recovery = weapon_recovery + armour_recovery + shield_recovery @@ -2820,9 +2819,7 @@ + pBaseHealthByClass[classType / 4] + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; - if (v6 <= 0) - return 1; - return v6; + return max(1, v6); } //----- (0048E565) -------------------------------------------------------- @@ -2896,29 +2893,22 @@ //----- (0048E656) -------------------------------------------------------- int Player::GetBaseAC() { - Player *v1; // edi@1 int v2; // eax@1 int v3; // esi@1 int v4; // esi@1 int v5; // esi@1 int result; // eax@2 - v1 = this; v2 = GetActualSpeed(); v3 = GetParameterBonus(v2); v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; - if ( v5 >= 1 ) - result = v5; - else - result = 0; - return result; + return max(0, v5); } //----- (0048E68F) -------------------------------------------------------- int Player::GetActualAC() { - Player *v1; // edi@1 int v2; // eax@1 int v3; // esi@1 int v4; // esi@1 @@ -2926,17 +2916,12 @@ int v6; // esi@1 int result; // eax@2 - v1 = this; v2 = GetActualSpeed(); v3 = GetParameterBonus(v2); v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; - v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; - if ( v6 >= 1 ) - result = v6; - else - result = 0; - return result; + v6 = this->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; + return max(0, v6); } //----- (0048E6DC) --------------------------------------------------------