Mercurial > mm7
comparison 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 |
comparison
equal
deleted
inserted
replaced
1538:d6778b04c12a | 1539:5cf28ec7322d |
---|---|
2106 | 2106 |
2107 v1 = this; | 2107 v1 = this; |
2108 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0); | 2108 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0); |
2109 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | 2109 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; |
2110 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; | 2110 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; |
2111 v5 = v1->pActiveSkills[5]; | |
2112 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2113 v4 += v1->pActiveSkills[5] & 0x3F; | |
2114 if ( v4 >= 1 ) | 2111 if ( v4 >= 1 ) |
2115 result = v4; | 2112 result = v4; |
2116 else | 2113 else |
2117 result = 0; | 2114 result = 0; |
2118 return result; | 2115 return result; |
2130 | 2127 |
2131 v1 = this; | 2128 v1 = this; |
2132 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0); | 2129 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0); |
2133 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | 2130 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; |
2134 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; | 2131 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; |
2135 v5 = v1->pActiveSkills[5]; | |
2136 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2137 v4 += v1->pActiveSkills[5] & 0x3F; | |
2138 if ( v4 >= 1 ) | 2132 if ( v4 >= 1 ) |
2139 result = v4; | 2133 result = v4; |
2140 else | 2134 else |
2141 result = 0; | 2135 result = 0; |
2142 return result; | 2136 return result; |
4825 armsMasterBonus = multiplier * (armmaster_skill & 0x3F); | 4819 armsMasterBonus = multiplier * (armmaster_skill & 0x3F); |
4826 } | 4820 } |
4827 | 4821 |
4828 switch(inSkill) | 4822 switch(inSkill) |
4829 { | 4823 { |
4824 case CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS: | |
4825 if (HasItemEquipped(EQUIP_BOW)) | |
4826 { | |
4827 int bowSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
4828 int multiplier = GetMultiplierForMastery(bowSkillLevel, 0, 0, 0, 1); | |
4829 return multiplier * (bowSkillLevel & 0x3F); | |
4830 } | |
4831 return 0; | |
4832 break; | |
4830 case CHARACTER_ATTRIBUTE_HEALTH: | 4833 case CHARACTER_ATTRIBUTE_HEALTH: |
4831 int base_value = pBaseHealthPerLevelByClass[classType]; | 4834 { |
4832 int attrib_modif = GetBodybuilding(); | 4835 int base_value = pBaseHealthPerLevelByClass[classType]; |
4833 return base_value * attrib_modif; | 4836 int attrib_modif = GetBodybuilding(); |
4837 return base_value * attrib_modif; | |
4838 } | |
4834 break; | 4839 break; |
4835 case CHARACTER_ATTRIBUTE_MANA: | 4840 case CHARACTER_ATTRIBUTE_MANA: |
4836 int base_value = pBaseManaPerLevelByClass[classType]; | 4841 { |
4837 int attrib_modif = GetMeditation(); | 4842 int base_value = pBaseManaPerLevelByClass[classType]; |
4838 return base_value * attrib_modif; | 4843 int attrib_modif = GetMeditation(); |
4844 return base_value * attrib_modif; | |
4845 } | |
4839 break; | 4846 break; |
4840 case CHARACTER_ATTRIBUTE_AC_BONUS: | 4847 case CHARACTER_ATTRIBUTE_AC_BONUS: |
4841 bool wearingArmor = false; | 4848 { |
4842 bool wearingLeather = false; | 4849 bool wearingArmor = false; |
4843 unsigned int ACSum = 0; | 4850 bool wearingLeather = false; |
4844 | 4851 unsigned int ACSum = 0; |
4845 for (int j = 0; j < 16; ++j) | 4852 |
4846 { | 4853 for (int j = 0; j < 16; ++j) |
4847 if (pEquipment.pIndices[j] && (!pOwnItems[pEquipment.pIndices[j]].Broken())) | 4854 { |
4848 { | 4855 if (pEquipment.pIndices[j] && (!pOwnItems[pEquipment.pIndices[j]].Broken())) |
4849 int curr_item = pOwnItems[pEquipment.pIndices[j]].uItemID; | |
4850 PLAYER_SKILL_TYPE itemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[curr_item].uSkillType; | |
4851 int currArmorSkillLevel = GetActualSkillLevel(itemSkillType); | |
4852 int multiplier = 0; | |
4853 switch (itemSkillType) | |
4854 { | 4856 { |
4855 case PLAYER_SKILL_STAFF: | 4857 int curr_item = pOwnItems[pEquipment.pIndices[j]].uItemID; |
4856 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 0, 1, 1, 1); | 4858 PLAYER_SKILL_TYPE itemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[curr_item].uSkillType; |
4857 break; | 4859 int currArmorSkillLevel = GetActualSkillLevel(itemSkillType); |
4858 case PLAYER_SKILL_SWORD: | 4860 int multiplier = 0; |
4859 case PLAYER_SKILL_SPEAR: | 4861 switch (itemSkillType) |
4860 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 0, 0, 0, 1); | 4862 { |
4861 break; | 4863 case PLAYER_SKILL_STAFF: |
4862 case PLAYER_SKILL_SHIELD: | 4864 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 0, 1, 1, 1); |
4863 wearingArmor = true; | 4865 break; |
4864 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 2, 2); | 4866 case PLAYER_SKILL_SWORD: |
4865 break; | 4867 case PLAYER_SKILL_SPEAR: |
4866 case PLAYER_SKILL_LEATHER: | 4868 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 0, 0, 0, 1); |
4867 wearingLeather = true; | 4869 break; |
4868 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 2, 2); | 4870 case PLAYER_SKILL_SHIELD: |
4869 break; | 4871 wearingArmor = true; |
4870 case PLAYER_SKILL_CHAIN: | 4872 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 2, 2); |
4871 wearingArmor = true; | 4873 break; |
4872 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 1, 1); | 4874 case PLAYER_SKILL_LEATHER: |
4873 break; | 4875 wearingLeather = true; |
4874 case PLAYER_SKILL_PLATE: | 4876 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 2, 2); |
4875 wearingArmor = true; | 4877 break; |
4876 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 1, 1); | 4878 case PLAYER_SKILL_CHAIN: |
4877 break; | 4879 wearingArmor = true; |
4880 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 1, 1); | |
4881 break; | |
4882 case PLAYER_SKILL_PLATE: | |
4883 wearingArmor = true; | |
4884 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 1, 1); | |
4885 break; | |
4886 } | |
4887 ACSum += multiplier * (currArmorSkillLevel & 0x3F); | |
4878 } | 4888 } |
4879 ACSum += multiplier * (currArmorSkillLevel & 0x3F); | 4889 } |
4880 } | 4890 |
4881 } | 4891 int dodgeSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE); |
4882 | 4892 int dodgeMastery = SkillToMastery(dodgeSkillLevel); |
4883 int dodgeSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE); | 4893 int multiplier = GetMultiplierForMastery(dodgeSkillLevel, 1, 2, 3, 3); |
4884 int dodgeMastery = SkillToMastery(dodgeSkillLevel); | 4894 if ( !wearingArmor && (!wearingLeather || dodgeMastery == 4) ) |
4885 int multiplier = GetMultiplierForMastery(dodgeSkillLevel, 1, 2, 3, 3); | 4895 { |
4886 if ( !wearingArmor && (!wearingLeather || dodgeMastery == 4) ) | 4896 ACSum += multiplier * (dodgeSkillLevel & 0x3F); |
4887 { | 4897 } |
4888 ACSum += multiplier * (dodgeSkillLevel & 0x3F); | 4898 return ACSum; |
4889 } | 4899 } |
4890 return ACSum; | |
4891 break; | 4900 break; |
4892 case CHARACTER_ATTRIBUTE_ATTACK: | 4901 case CHARACTER_ATTRIBUTE_ATTACK: |
4893 if ( this->IsUnarmed() ) | 4902 if ( this->IsUnarmed() ) |
4894 { | 4903 { |
4895 int unarmedSkill = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | 4904 int unarmedSkill = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); |