Mercurial > mm7
changeset 1595:a52a01aaf439
Player::GetBaseResistance cleanup, setting default parameter to Player::GetItemsBonus
author | Grumpy7 |
---|---|
date | Tue, 10 Sep 2013 03:25:15 +0200 |
parents | c0238b60d0f2 |
children | 061f0e5a284d |
files | Player.cpp Player.h mm7_4.cpp |
diffstat | 3 files changed, 99 insertions(+), 120 deletions(-) [+] |
line wrap: on
line diff
--- a/Player.cpp Sun Sep 08 08:10:09 2013 +0200 +++ b/Player.cpp Tue Sep 10 03:25:15 2013 +0200 @@ -1406,49 +1406,49 @@ //----- (0048C855) -------------------------------------------------------- int Player::GetBaseStrength() { - return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); + return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH); } //----- (0048C86C) -------------------------------------------------------- int Player::GetBaseIntelligence() { - return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); + return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE); } //----- (0048C883) -------------------------------------------------------- int Player::GetBaseWillpower() { - return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); + return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER); } //----- (0048C89A) -------------------------------------------------------- int Player::GetBaseEndurance() { - return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); + return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE); } //----- (0048C8B1) -------------------------------------------------------- int Player::GetBaseAccuracy() { - return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); + return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY); } //----- (0048C8C8) -------------------------------------------------------- int Player::GetBaseSpeed() { - return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); + return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED); } //----- (0048C8DF) -------------------------------------------------------- int Player::GetBaseLuck() { - return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); + return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK); } //----- (0048C8F6) -------------------------------------------------------- int Player::GetBaseLevel() { - return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); + return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL); } //----- (0048C90D) -------------------------------------------------------- @@ -1456,7 +1456,7 @@ { return uLevel + sLevelModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + - GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL); } //----- (0048C93C) -------------------------------------------------------- @@ -1527,7 +1527,7 @@ auto uConditionMult = pConditionAttributeModifier[attrId][GetMajorConditionIdx()]; int magicBonus = GetMagicalBonus(attrId); - int itemBonus = GetItemsBonus(attrId, 0); + int itemBonus = GetItemsBonus(attrId); return uConditionMult * uAgeingMultiplier * this->*attrValue / 100 / 100 + magicBonus + itemBonus @@ -1560,7 +1560,7 @@ v2 = GetActualMight(); v3 = GetParameterBonus(v2); - v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; + v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN) + v3; v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; if ( result < 1 ) @@ -1580,7 +1580,7 @@ v2 = GetActualMight(); v3 = GetParameterBonus(v2); - v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; + v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX) + v3; v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; v6 = this->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; result = 1; @@ -1700,7 +1700,7 @@ { v4 = GetActualAccuracy(); v5 = GetParameterBonus(v4); - v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; + v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v5; v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; v3 = this->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; } @@ -1719,7 +1719,7 @@ int v4; // edi@1 int result; // eax@6 - v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0); + v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN); v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; if ( v4 >= 1 ) @@ -1737,7 +1737,7 @@ int v4; // edi@1 int result; // eax@6 - v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0); + v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX); v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; if ( v4 >= 1 ) @@ -1813,8 +1813,8 @@ } else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) { - min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); - max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); + min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, true); + max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, true); } else { @@ -1853,8 +1853,8 @@ } else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) { - min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); - max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); + min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, true); + max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, true); } else { @@ -2261,7 +2261,7 @@ broke_armor = sHealth <= -10; if ( sHealth < 1 ) // { - if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1) + if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) >= 1) || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 ) { SetCondUnconsciousWithBlockCheck(false); @@ -2725,7 +2725,7 @@ multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 1.0f, 1.0f, 1.0f); } - armour_recovery = base_armour_recovery * multiplier; + armour_recovery = (uint)(base_armour_recovery * multiplier); } uint shield_recovery = 0; @@ -2736,7 +2736,7 @@ uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; float multiplier = GetArmorRecoveryMultiplierFromSkillLevel(skill_type, 1.0f, 0, 0, 0); - shield_recovery = shield_base_recovery * multiplier; + shield_recovery = (uint)(shield_base_recovery * multiplier); } uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()), @@ -2804,6 +2804,8 @@ case 3: return mult3; break; case 4: return mult4; break; } + Error("Unexpected input value: %d", armour_skill_type); + return 0; } //----- (0048E4F8) -------------------------------------------------------- @@ -2818,7 +2820,7 @@ v6 = uFullHealthBonus + pBaseHealthByClass[classType / 4] + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) - + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; + + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH) + v4; return max(1, v6); } @@ -2833,7 +2835,6 @@ int v7; // esi@6 int v8; // esi@6 int v9; // esi@6 - int result; // eax@7 switch (classType) { @@ -2882,7 +2883,7 @@ break; } v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); - v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; + v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA) + v7; v9 = uFullManaBonus + pBaseManaByClass[classType / 4] + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) @@ -2897,11 +2898,10 @@ int v3; // esi@1 int v4; // esi@1 int v5; // esi@1 - int result; // eax@2 v2 = GetActualSpeed(); v3 = GetParameterBonus(v2); - v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; + v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v3; v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; return max(0, v5); } @@ -2914,11 +2914,10 @@ int v4; // esi@1 int v5; // esi@1 int v6; // esi@1 - int result; // eax@2 v2 = GetActualSpeed(); v3 = GetParameterBonus(v2); - v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; + v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v3; v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; v6 = this->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; return max(0, v6); @@ -2927,7 +2926,7 @@ //----- (0048E6DC) -------------------------------------------------------- unsigned int Player::GetBaseAge() { - return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; + return (unsigned int)(((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year); } //----- (0048E72C) -------------------------------------------------------- @@ -2939,68 +2938,48 @@ //----- (0048E73F) -------------------------------------------------------- int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) { - Player *v2; // ebx@1 - signed int v3; // esi@1 - enum CHARACTER_RACE v4; // eax@1 - signed int v5; // edi@8 - char v6; // zf@9 int v7; // esi@20 - int result; // eax@21 - signed int v9; // [sp-4h] [bp-10h]@11 - - v2 = this; - v3 = 0; - v4 = GetRace(); - if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) - { - v5 = 0; - goto LABEL_16; - } - if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) - { - v5 = 1; -LABEL_16: - v6 = v4 == 2; - goto LABEL_17; - } - if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) - { - v6 = v4 == 3; - v5 = 2; - goto LABEL_17; - } - if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) - { - v5 = 3; - v6 = v4 == 3; - goto LABEL_17; - } - if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) - { - v5 = 7; - if ( v4 != 1 ) - goto LABEL_20; - v9 = 10; -LABEL_19: - v3 = v9; - goto LABEL_20; - } - if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) - { - v5 = 8; - v6 = v4 == 0; -LABEL_17: - if ( !v6 ) - goto LABEL_20; - v9 = 5; - goto LABEL_19; - } - v5 = 0; -LABEL_20: - v7 = GetItemsBonus(a2, 0) + v3; - if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) - result = v7 + *(&v2->sResFireBase + v5); - return result; + + int racialBonus = 0; + + __int16* resStat; + + switch (a2) + { + case CHARACTER_ATTRIBUTE_RESIST_FIRE: + resStat = &sResFireBase; + if (IsRaceGoblin()) + racialBonus = 5; + break; + case CHARACTER_ATTRIBUTE_RESIST_AIR: + resStat = &sResAirBase; + if (IsRaceGoblin()) + racialBonus = 5; + break; + case CHARACTER_ATTRIBUTE_RESIST_WATER: + resStat = &sResWaterBase; + if (IsRaceDwarf()) + racialBonus = 5; + break; + case CHARACTER_ATTRIBUTE_RESIST_EARTH: + resStat = &sResEarthBase; + if (IsRaceDwarf()) + racialBonus = 5; + break; + case CHARACTER_ATTRIBUTE_RESIST_MIND: + resStat = &sResMindBase; + if (IsRaceElf()) + racialBonus = 10; + break; + case CHARACTER_ATTRIBUTE_RESIST_BODY: + case CHARACTER_ATTRIBUTE_RESIST_SPIRIT: + resStat = &sResBodyBase; + if (IsRaceHuman()) + racialBonus = 5; + break; + } + v7 = GetItemsBonus(a2) + racialBonus; + return v7 + *resStat; } //----- (0048E7D0) -------------------------------------------------------- @@ -3069,7 +3048,7 @@ v9 = 10; } LABEL_28: - v7 = GetItemsBonus(a2, 0); + v7 = GetItemsBonus(a2); result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); if ( v3->classType == PLAYER_CLASS_LICH ) { @@ -3177,7 +3156,7 @@ } //----- (0048EAAE) -------------------------------------------------------- -int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) +int Player::GetItemsBonus( enum CHARACTER_ATTRIBUTE_TYPE attr, bool getOnlyMainHandDmg /*= false*/ ) { CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 // signed int v4; // eax@1 @@ -3910,7 +3889,7 @@ } } - if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) ) + if ( getOnlyMainHandDmg || !v6->HasItemEquipped(EQUIP_OFF_HAND) ) { v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); @@ -3956,7 +3935,7 @@ v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uMainHand-1].uItemID].uDamageMod; } } - if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) + if ( getOnlyMainHandDmg || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) return v5 + v62 + v61; v20 = v6->pOwnItems[v6->pEquipment.uShield - 1].uItemID; v56 = pItemsTable->pItems[v20].uDamageMod; @@ -3988,7 +3967,7 @@ } } - if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND)) + if ( getOnlyMainHandDmg || !v6->HasItemEquipped(EQUIP_OFF_HAND)) { v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); if ((v12 < 0) || v12 > 2 ) @@ -4116,7 +4095,7 @@ bonus_value = 6; if ( CheckHiredNPCSpeciality(Sage) ) bonus_value += 6; - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID); } break; @@ -4126,7 +4105,7 @@ bonus_value = 2; if ( CheckHiredNPCSpeciality(Weaponsmaster) ) bonus_value += 3; - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER); } break; @@ -4134,7 +4113,7 @@ { if (CheckHiredNPCSpeciality(Burglar)) bonus_value = 8; - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING); } break; @@ -4145,7 +4124,7 @@ bonus_value = 4; if ( CheckHiredNPCSpeciality(Apothecary) ) bonus_value += 8; - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY); } break; @@ -4157,7 +4136,7 @@ bonus_value += 15; if ( CheckHiredNPCSpeciality(Scholar) ) bonus_value += 5; - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING); } break; @@ -4165,7 +4144,7 @@ { if (CheckHiredNPCSpeciality(Monk) ) bonus_value = 2; - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED); } break; @@ -4173,15 +4152,15 @@ { if ( CheckHiredNPCSpeciality(Monk) ) bonus_value = 2; - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE); } break; case PLAYER_SKILL_BOW: - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW); break; case PLAYER_SKILL_SHIELD: - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD); break; case PLAYER_SKILL_EARTH: @@ -4193,7 +4172,7 @@ bonus_value += 4; if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) bonus_value += 3; - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH); break; case PLAYER_SKILL_FIRE: if ( CheckHiredNPCSpeciality(Apprentice) ) @@ -4204,7 +4183,7 @@ bonus_value += 4; if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) bonus_value += 3; - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE); break; case PLAYER_SKILL_AIR: if ( CheckHiredNPCSpeciality(Apprentice) ) @@ -4215,7 +4194,7 @@ bonus_value += 4; if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) bonus_value += 3; - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR); break; case PLAYER_SKILL_WATER: if ( CheckHiredNPCSpeciality(Apprentice) ) @@ -4226,7 +4205,7 @@ bonus_value += 4; if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) bonus_value += 3; - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER); break; case PLAYER_SKILL_SPIRIT: if ( CheckHiredNPCSpeciality(Acolyte2) ) @@ -4235,7 +4214,7 @@ bonus_value += 3; if ( CheckHiredNPCSpeciality(Prelate) ) bonus_value += 4; - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT); break; case PLAYER_SKILL_MIND: if ( CheckHiredNPCSpeciality(Acolyte2) ) @@ -4244,7 +4223,7 @@ bonus_value += 3; if ( CheckHiredNPCSpeciality(Prelate) ) bonus_value += 4; - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND); break; case PLAYER_SKILL_BODY: if ( CheckHiredNPCSpeciality(Acolyte2) ) @@ -4253,14 +4232,14 @@ bonus_value += 3; if ( CheckHiredNPCSpeciality(Prelate) ) bonus_value += 4; - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY); break; case PLAYER_SKILL_LIGHT: - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT); break; case PLAYER_SKILL_DARK: { - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK); } break; @@ -4287,10 +4266,10 @@ break; case PLAYER_SKILL_ITEM_ID: - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID); break; case PLAYER_SKILL_MEDITATION: - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION); break; case PLAYER_SKILL_TRAP_DISARM: { @@ -4300,7 +4279,7 @@ bonus_value += 6; if ( CheckHiredNPCSpeciality(Burglar) ) bonus_value += 8; - bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); + bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM); } break; }
--- a/Player.h Sun Sep 08 08:10:09 2013 +0200 +++ b/Player.h Tue Sep 10 03:25:15 2013 +0200 @@ -519,7 +519,7 @@ unsigned int GetMajorConditionIdx(); int GetParameterBonus(int player_parameter); int _48EA46_calc_special_bonus_by_items(int a2); - int GetItemsBonus(enum CHARACTER_ATTRIBUTE_TYPE attr, int a3); + int GetItemsBonus(enum CHARACTER_ATTRIBUTE_TYPE attr, bool a3 = false); int GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2); int GetActualSkillLevel(PLAYER_SKILL_TYPE uSkillType); int GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2);
--- a/mm7_4.cpp Sun Sep 08 08:10:09 2013 +0200 +++ b/mm7_4.cpp Tue Sep 10 03:25:15 2013 +0200 @@ -877,7 +877,7 @@ v21->pConditions[13] = pParty->uTimePlayed; if ( v35 < 1 ) { - if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 + if ( v21->sHealth + v21->uEndurance + v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) >= 1 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) { v21->pConditions[13] = pParty->uTimePlayed; @@ -1166,7 +1166,7 @@ if ( (*v62)->uTimeToRecovery ) v21->Recover(a2a); v22 = v21->sHealth; - if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1 + if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) + v22 + v21->uEndurance >= 1 || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) { if ( v22 < 1 )