# HG changeset patch # User Grumpy7 # Date 1378620609 -7200 # Node ID c0238b60d0f2ff7f77e588be6ff9cd4307614e81 # Parent 5658d0f3b5ee33b26d193e7416b04b7411693a3e Player::GetMaxHealth, GetBaseAC, GetActualAC minor cleanups diff -r 5658d0f3b5ee -r c0238b60d0f2 Player.cpp --- 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) --------------------------------------------------------