Mercurial > mm7
diff Player.cpp @ 1539:5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
author | Grumpy7 |
---|---|
date | Sat, 07 Sep 2013 05:18:32 +0200 |
parents | d6778b04c12a |
children | c4ab816fcc5e 778916dfa666 |
line wrap: on
line diff
--- a/Player.cpp Sat Sep 07 05:06:15 2013 +0200 +++ b/Player.cpp Sat Sep 07 05:18:32 2013 +0200 @@ -2108,9 +2108,6 @@ v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0); v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; - v5 = v1->pActiveSkills[5]; - if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) - v4 += v1->pActiveSkills[5] & 0x3F; if ( v4 >= 1 ) result = v4; else @@ -2132,9 +2129,6 @@ v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0); v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; - v5 = v1->pActiveSkills[5]; - if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) - v4 += v1->pActiveSkills[5] & 0x3F; if ( v4 >= 1 ) result = v4; else @@ -4827,67 +4821,82 @@ switch(inSkill) { + case CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS: + if (HasItemEquipped(EQUIP_BOW)) + { + int bowSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE); + int multiplier = GetMultiplierForMastery(bowSkillLevel, 0, 0, 0, 1); + return multiplier * (bowSkillLevel & 0x3F); + } + return 0; + break; case CHARACTER_ATTRIBUTE_HEALTH: - int base_value = pBaseHealthPerLevelByClass[classType]; - int attrib_modif = GetBodybuilding(); - return base_value * attrib_modif; + { + int base_value = pBaseHealthPerLevelByClass[classType]; + int attrib_modif = GetBodybuilding(); + return base_value * attrib_modif; + } break; case CHARACTER_ATTRIBUTE_MANA: - int base_value = pBaseManaPerLevelByClass[classType]; - int attrib_modif = GetMeditation(); - return base_value * attrib_modif; + { + int base_value = pBaseManaPerLevelByClass[classType]; + int attrib_modif = GetMeditation(); + return base_value * attrib_modif; + } break; case CHARACTER_ATTRIBUTE_AC_BONUS: - bool wearingArmor = false; - bool wearingLeather = false; - unsigned int ACSum = 0; - - for (int j = 0; j < 16; ++j) - { - if (pEquipment.pIndices[j] && (!pOwnItems[pEquipment.pIndices[j]].Broken())) - { - int curr_item = pOwnItems[pEquipment.pIndices[j]].uItemID; - PLAYER_SKILL_TYPE itemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[curr_item].uSkillType; - int currArmorSkillLevel = GetActualSkillLevel(itemSkillType); - int multiplier = 0; - switch (itemSkillType) + { + bool wearingArmor = false; + bool wearingLeather = false; + unsigned int ACSum = 0; + + for (int j = 0; j < 16; ++j) + { + if (pEquipment.pIndices[j] && (!pOwnItems[pEquipment.pIndices[j]].Broken())) { - case PLAYER_SKILL_STAFF: - multiplier = GetMultiplierForMastery(currArmorSkillLevel, 0, 1, 1, 1); - break; - case PLAYER_SKILL_SWORD: - case PLAYER_SKILL_SPEAR: - multiplier = GetMultiplierForMastery(currArmorSkillLevel, 0, 0, 0, 1); - break; - case PLAYER_SKILL_SHIELD: - wearingArmor = true; - multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 2, 2); - break; - case PLAYER_SKILL_LEATHER: - wearingLeather = true; - multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 2, 2); - break; - case PLAYER_SKILL_CHAIN: - wearingArmor = true; - multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 1, 1); - break; - case PLAYER_SKILL_PLATE: - wearingArmor = true; - multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 1, 1); - break; + int curr_item = pOwnItems[pEquipment.pIndices[j]].uItemID; + PLAYER_SKILL_TYPE itemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[curr_item].uSkillType; + int currArmorSkillLevel = GetActualSkillLevel(itemSkillType); + int multiplier = 0; + switch (itemSkillType) + { + case PLAYER_SKILL_STAFF: + multiplier = GetMultiplierForMastery(currArmorSkillLevel, 0, 1, 1, 1); + break; + case PLAYER_SKILL_SWORD: + case PLAYER_SKILL_SPEAR: + multiplier = GetMultiplierForMastery(currArmorSkillLevel, 0, 0, 0, 1); + break; + case PLAYER_SKILL_SHIELD: + wearingArmor = true; + multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 2, 2); + break; + case PLAYER_SKILL_LEATHER: + wearingLeather = true; + multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 2, 2); + break; + case PLAYER_SKILL_CHAIN: + wearingArmor = true; + multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 1, 1); + break; + case PLAYER_SKILL_PLATE: + wearingArmor = true; + multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 1, 1); + break; + } + ACSum += multiplier * (currArmorSkillLevel & 0x3F); } - ACSum += multiplier * (currArmorSkillLevel & 0x3F); - } - } - - int dodgeSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE); - int dodgeMastery = SkillToMastery(dodgeSkillLevel); - int multiplier = GetMultiplierForMastery(dodgeSkillLevel, 1, 2, 3, 3); - if ( !wearingArmor && (!wearingLeather || dodgeMastery == 4) ) - { - ACSum += multiplier * (dodgeSkillLevel & 0x3F); - } - return ACSum; + } + + int dodgeSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE); + int dodgeMastery = SkillToMastery(dodgeSkillLevel); + int multiplier = GetMultiplierForMastery(dodgeSkillLevel, 1, 2, 3, 3); + if ( !wearingArmor && (!wearingLeather || dodgeMastery == 4) ) + { + ACSum += multiplier * (dodgeSkillLevel & 0x3F); + } + return ACSum; + } break; case CHARACTER_ATTRIBUTE_ATTACK: if ( this->IsUnarmed() )