Mercurial > mm7
comparison Player.cpp @ 1537:fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
author | Grumpy7 |
---|---|
date | Sat, 07 Sep 2013 05:01:12 +0200 |
parents | e264ce95f27d |
children | d6778b04c12a |
comparison
equal
deleted
inserted
replaced
1536:e264ce95f27d | 1537:fed56133bf8a |
---|---|
4803 return result; | 4803 return result; |
4804 } | 4804 } |
4805 | 4805 |
4806 | 4806 |
4807 //----- (0048FC00) -------------------------------------------------------- | 4807 //----- (0048FC00) -------------------------------------------------------- |
4808 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | 4808 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE inSkill) |
4809 { | 4809 { |
4810 Player *v2; // esi@1 | 4810 int armsMasterBonus; |
4811 int armmaster_skill; // eax@1 | 4811 |
4812 char v4; // di@1 | 4812 armsMasterBonus = 0; |
4813 signed int v5; // ebx@1 | 4813 int armmaster_skill = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); |
4814 unsigned int armaster_mastery; // eax@2 | 4814 if ( armmaster_skill > 0 ) |
4815 unsigned __int8 v7; // sf@5 | 4815 { |
4816 unsigned __int8 v8; // of@5 | 4816 int multiplier = 0; |
4817 PlayerEquipment *v9; // ebx@19 | 4817 if ( inSkill == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
4818 Player *v10; // ecx@20 | 4818 { |
4819 PLAYER_SKILL_TYPE v11; // edi@21 | 4819 multiplier = GetMultiplierForMastery(armmaster_skill, 0, 0, 1, 2); |
4820 int v12; // eax@21 | 4820 } |
4821 int v13; // edi@21 | 4821 else if ( inSkill == CHARACTER_ATTRIBUTE_ATTACK ) |
4822 signed int v15; // esi@25 | 4822 { |
4823 char v16; // al@32 | 4823 multiplier = GetMultiplierForMastery(armmaster_skill, 0, 1, 1, 2); |
4824 int v18; // eax@36 | |
4825 unsigned int v19; // eax@37 | |
4826 unsigned int v20; // edi@40 | |
4827 int v21; // edx@41 | |
4828 int v22; // eax@42 | |
4829 PLAYER_SKILL_TYPE v23; // edi@45 | |
4830 unsigned __int16 v24; // ax@45 | |
4831 unsigned __int16 v25; // bx@45 | |
4832 unsigned int v26; // eax@45 | |
4833 unsigned __int8 v27; // sf@50 | |
4834 unsigned __int8 v28; // of@50 | |
4835 unsigned int v29; // eax@52 | |
4836 int v30; // eax@55 | |
4837 int v31; // eax@58 | |
4838 unsigned int v32; // eax@59 | |
4839 int v33; // eax@65 | |
4840 char v34; // si@65 | |
4841 ITEM_EQUIP_TYPE v35; // edi@69 | |
4842 int v36; // edx@70 | |
4843 int v37; // eax@71 | |
4844 PLAYER_SKILL_TYPE v38; // edi@74 | |
4845 int v39; // eax@74 | |
4846 int v40; // eax@89 | |
4847 char v41; // si@89 | |
4848 int v42; // eax@96 | |
4849 PLAYER_SKILL_TYPE v43; // edx@97 | |
4850 int v44; // eax@97 | |
4851 int v45; // eax@98 | |
4852 int v46; // eax@99 | |
4853 int v47; // eax@100 | |
4854 int v48; // eax@101 | |
4855 int v49; // eax@102 | |
4856 unsigned __int16 v50; // ax@113 | |
4857 char v51; // di@113 | |
4858 unsigned int v52; // eax@113 | |
4859 int v53; // edi@113 | |
4860 signed int i; // ecx@113 | |
4861 unsigned __int16 v55; // ax@118 | |
4862 char v56; // si@118 | |
4863 unsigned int v57; // eax@118 | |
4864 int v58; // esi@121 | |
4865 signed int j; // ecx@121 | |
4866 int base_value; // edi@126 | |
4867 int attrib_modif; // eax@126 | |
4868 signed int v62; // [sp-4h] [bp-30h]@26 | |
4869 signed int v63; // [sp-4h] [bp-30h]@80 | |
4870 int v64; // [sp+Ch] [bp-20h]@104 | |
4871 int v65; // [sp+10h] [bp-1Ch]@104 | |
4872 int v66; // [sp+14h] [bp-18h]@104 | |
4873 int v67; // [sp+18h] [bp-14h]@104 | |
4874 int v68; // [sp+1Ch] [bp-10h]@69 | |
4875 //PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
4876 int skill_bonus; // [sp+24h] [bp-8h]@1 | |
4877 int v71; // [sp+28h] [bp-4h]@1 | |
4878 int a1; // [sp+34h] [bp+8h]@21 | |
4879 int a1a; // [sp+34h] [bp+8h]@74 | |
4880 signed int a1b; // [sp+34h] [bp+8h]@94 | |
4881 int multiplier; | |
4882 int arm_bonus; | |
4883 int lvl_avl[4]; | |
4884 | |
4885 v2 = this; | |
4886 skill_bonus = 0; | |
4887 //v69 = 0; | |
4888 multiplier =0; | |
4889 arm_bonus =0; | |
4890 v71 = 0; | |
4891 armmaster_skill = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); | |
4892 v4 = armmaster_skill; | |
4893 v5 = 1; | |
4894 if ( armmaster_skill ) | |
4895 { | |
4896 armaster_mastery = SkillToMastery(armmaster_skill); | |
4897 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
4898 { | |
4899 if ( armaster_mastery == 4 ) | |
4900 multiplier =2; | |
4901 else if ( armaster_mastery == 3 ) | |
4902 multiplier =1; | |
4903 } | |
4904 else if ( a2 == CHARACTER_ATTRIBUTE_ATTACK ) | |
4905 { | |
4906 if ( armaster_mastery == 4 ) | |
4907 multiplier =2; | |
4908 else if ( armaster_mastery >= 2 ) | |
4909 multiplier =1; | |
4910 } | 4824 } |
4911 arm_bonus=(armmaster_skill&0x3F)*multiplier; | 4825 armsMasterBonus = multiplier * (armmaster_skill & 0x3F); |
4912 } | 4826 } |
4913 | 4827 |
4914 switch(a2) | 4828 switch(inSkill) |
4915 { | 4829 { |
4916 case CHARACTER_ATTRIBUTE_HEALTH: | 4830 case CHARACTER_ATTRIBUTE_HEALTH: |
4917 { | 4831 { |
4918 base_value = pBaseHealthPerLevelByClass[classType]; | 4832 int base_value = pBaseHealthPerLevelByClass[classType]; |
4919 attrib_modif = GetBodybuilding(); | 4833 int attrib_modif = GetBodybuilding(); |
4920 return base_value * attrib_modif; | 4834 return base_value * attrib_modif; |
4921 } | 4835 } |
4922 break; | 4836 break; |
4923 case CHARACTER_ATTRIBUTE_MANA: | 4837 case CHARACTER_ATTRIBUTE_MANA: |
4924 { | 4838 { |
4925 base_value = pBaseManaPerLevelByClass[classType]; | 4839 int base_value = pBaseManaPerLevelByClass[classType]; |
4926 attrib_modif = GetMeditation(); | 4840 int attrib_modif = GetMeditation(); |
4927 return base_value * attrib_modif; | 4841 return base_value * attrib_modif; |
4928 } | 4842 } |
4929 break; | 4843 break; |
4930 case CHARACTER_ATTRIBUTE_AC_BONUS: | 4844 case CHARACTER_ATTRIBUTE_AC_BONUS: |
4931 { | 4845 { |
4932 a1b = 0; | 4846 bool wearingArmor = false; |
4933 v71 = 0; | 4847 bool wearingLeather = false; |
4934 | 4848 unsigned int ACSum = 0; |
4935 for (j=0; j<16; ++j) | 4849 |
4936 { | 4850 for (int j = 0; j < 16; ++j) |
4937 if (pEquipment.pIndices[j]&&(!pOwnItems[ pEquipment.pIndices[j]].Broken())) | 4851 { |
4852 if (pEquipment.pIndices[j] && (!pOwnItems[pEquipment.pIndices[j]].Broken())) | |
4938 { | 4853 { |
4939 int curr_item =pOwnItems[pEquipment.pIndices[j]].uItemID; | 4854 int curr_item = pOwnItems[pEquipment.pIndices[j]].uItemID; |
4940 v44=pItemsTable->pItems[curr_item].uSkillType; | 4855 PLAYER_SKILL_TYPE itemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[curr_item].uSkillType; |
4941 switch (v44) | 4856 int currArmorSkillLevel = GetActualSkillLevel(itemSkillType); |
4857 int multiplier = 0; | |
4858 switch (itemSkillType) | |
4942 { | 4859 { |
4943 case PLAYER_SKILL_STAFF: | 4860 case PLAYER_SKILL_STAFF: |
4944 | 4861 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 0, 1, 1, 1); |
4945 lvl_avl[0]=0; | |
4946 lvl_avl[1]=1; | |
4947 lvl_avl[2]=0; | |
4948 lvl_avl[3]=0; | |
4949 break; | 4862 break; |
4950 case PLAYER_SKILL_SWORD: | 4863 case PLAYER_SKILL_SWORD: |
4951 case PLAYER_SKILL_SPEAR: | 4864 case PLAYER_SKILL_SPEAR: |
4952 lvl_avl[0]=0; | 4865 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 0, 0, 0, 1); |
4953 lvl_avl[1]=0; | |
4954 lvl_avl[2]=0; | |
4955 lvl_avl[3]=1; | |
4956 break; | 4866 break; |
4957 case PLAYER_SKILL_SHIELD: | 4867 case PLAYER_SKILL_SHIELD: |
4958 a1b = 1; | 4868 wearingArmor = true; |
4959 lvl_avl[0]=1; | 4869 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 2, 2); |
4960 lvl_avl[1]=0; | |
4961 lvl_avl[2]=1; | |
4962 lvl_avl[3]=0; | |
4963 break; | 4870 break; |
4964 case PLAYER_SKILL_LEATHER: | 4871 case PLAYER_SKILL_LEATHER: |
4965 v71 = 1; | 4872 wearingLeather = true; |
4966 lvl_avl[0]=1; | 4873 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 2, 2); |
4967 lvl_avl[1]=0; | |
4968 lvl_avl[2]=1; | |
4969 lvl_avl[3]=0; | |
4970 | |
4971 break; | 4874 break; |
4972 case PLAYER_SKILL_CHAIN: | 4875 case PLAYER_SKILL_CHAIN: |
4973 a1b = 1; | 4876 wearingArmor = true; |
4974 lvl_avl[0]=1; | 4877 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 1, 1); |
4975 lvl_avl[1]=0; | |
4976 lvl_avl[2]=0; | |
4977 lvl_avl[3]=0; | |
4978 break; | 4878 break; |
4979 case PLAYER_SKILL_PLATE: | 4879 case PLAYER_SKILL_PLATE: |
4980 a1b = 1; | 4880 wearingArmor = true; |
4981 lvl_avl[0]=1; | 4881 multiplier = GetMultiplierForMastery(currArmorSkillLevel, 1, 1, 1, 1); |
4982 lvl_avl[1]=0; | |
4983 lvl_avl[2]=0; | |
4984 lvl_avl[3]=0; | |
4985 break; | 4882 break; |
4986 default: | |
4987 continue; | |
4988 } | 4883 } |
4989 | 4884 ACSum += multiplier * (currArmorSkillLevel & 0x3F); |
4990 v50= GetActualSkillLevel((PLAYER_SKILL_TYPE)v44); | |
4991 v51 = v50; | |
4992 v52 = SkillToMastery(v50); | |
4993 v53 = v51 & 0x3F; | |
4994 for ( i = 0; i < (signed int)v52; ++i ) | |
4995 { | |
4996 if ( lvl_avl[i] ) | |
4997 skill_bonus += v53; | |
4998 } | |
4999 } | 4885 } |
5000 } | 4886 } |
5001 | 4887 |
5002 lvl_avl[0]=1; | 4888 int dodgeSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE); |
5003 lvl_avl[1]=1; | 4889 int dodgeMastery = SkillToMastery(dodgeSkillLevel); |
5004 lvl_avl[2]=1; | 4890 int multiplier = GetMultiplierForMastery(dodgeSkillLevel, 1, 2, 3, 3); |
5005 lvl_avl[3]=0; | 4891 if ( !wearingArmor && (!wearingLeather || dodgeMastery == 4) ) |
5006 | 4892 { |
5007 v55 = GetActualSkillLevel(PLAYER_SKILL_DODGE); | 4893 ACSum += multiplier * (dodgeSkillLevel & 0x3F); |
5008 v56 = v55; | 4894 } |
5009 v57 = SkillToMastery(v55); | 4895 return ACSum; |
5010 if ( !a1b && (!v71 || v57 == 4) ) | |
5011 { | |
5012 v58 = v56 & 0x3F; | |
5013 for ( j = 0; j < (signed int)v57; ++j ) | |
5014 { | |
5015 if ( lvl_avl[j] ) | |
5016 skill_bonus += v58; | |
5017 } | |
5018 } | |
5019 return skill_bonus; | |
5020 } | 4896 } |
5021 break; | 4897 break; |
5022 case CHARACTER_ATTRIBUTE_ATTACK: | 4898 case CHARACTER_ATTRIBUTE_ATTACK: |
5023 { | 4899 { |
5024 if ( v2->IsUnarmed() == 1 ) | 4900 if ( this->IsUnarmed() ) |
5025 { | 4901 { |
5026 v33 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | 4902 int unarmedSkill = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); |
5027 if (!v33) | 4903 if (!unarmedSkill) |
5028 { | 4904 { |
5029 return 0; | 4905 return 0; |
5030 } | 4906 } |
5031 v34 = SkillToMastery(v33); | 4907 int multiplier = GetMultiplierForMastery(unarmedSkill, 0, 1, 2, 2); |
5032 if (v34 >= 3) | 4908 return armsMasterBonus + multiplier * (unarmedSkill & 0x3F); |
4909 } | |
4910 for (int i = 0; i < 16; ++i) | |
4911 { | |
4912 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
5033 { | 4913 { |
5034 multiplier = 2; | 4914 int currItemIndex = this->pEquipment.pIndices[i] - 1; |
5035 } | 4915 if ( pItemsTable->pItems[currItemIndex].uEquipType <= EQUIP_MAIN_HAND) |
5036 else | |
5037 { | |
5038 multiplier = 1; | |
5039 } | |
5040 v30 = multiplier * (v33 & 0x3F); | |
5041 return arm_bonus + v30; | |
5042 } | |
5043 v35 = (ITEM_EQUIP_TYPE)0; | |
5044 v68 = 0; | |
5045 for (i=0; i<16 ; ++i) | |
5046 { | |
5047 if ( v2->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
5048 { | |
5049 v37 = v2->pEquipment.pIndices[i]-1; | |
5050 if ( pItemsTable->pItems[v37].uEquipType <= EQUIP_MAIN_HAND) | |
5051 break; | |
5052 } | |
5053 } | |
5054 if ( i >= 16 ) | |
5055 return 0; | |
5056 | |
5057 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
5058 a1a = v2->GetActualSkillLevel(v38); | |
5059 if (v38 == PLAYER_SKILL_BLASTER) | |
5060 { | |
5061 v39 = SkillToMastery(a1a); | |
5062 switch (v39) | |
5063 { | |
5064 case 1: multiplier=1; break; | |
5065 case 2: multiplier=2; break; | |
5066 case 3: multiplier=3; break; | |
5067 case 4: multiplier=5; break; | |
5068 } | |
5069 return multiplier * (a1a & 0x3F); | |
5070 } | |
5071 else if (v38 == PLAYER_SKILL_STAFF && v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0) | |
5072 { | |
5073 v40 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5074 if ( SkillToMastery(v40) >= 3 ) | |
5075 multiplier = 2; | |
5076 else | |
5077 multiplier = 1; | |
5078 return multiplier * (v40 & 0x3F) + arm_bonus + (a1a & 0x3F); | |
5079 } | |
5080 else | |
5081 { | |
5082 return arm_bonus + (a1a & 0x3F); | |
5083 } | |
5084 } | |
5085 break; | |
5086 | |
5087 case CHARACTER_ATTRIBUTE_RANGED_ATTACK: | |
5088 { | |
5089 for (int i = 0; i < 16; i++) | |
5090 { | |
5091 if ( v2->HasItemEquipped((ITEM_EQUIP_TYPE)v71) ) | |
5092 { | |
5093 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItemList[v2->pEquipment.pIndices[v71] - 1].uItemID].uSkillType; | |
5094 v12 = this->GetActualSkillLevel(v11); | |
5095 if ( v11 == PLAYER_SKILL_BOW ) | |
5096 { | 4916 { |
5097 return v12 & 0x3F; | 4917 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[currItemIndex].uSkillType; |
5098 } | 4918 int currentItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); |
5099 else if ( v11 == PLAYER_SKILL_BLASTER ) | 4919 if (currItemSkillType == PLAYER_SKILL_BLASTER) |
5100 { | |
5101 v39 = SkillToMastery(a1); | |
5102 switch (v39) | |
5103 { | 4920 { |
5104 case 1: multiplier=1; break; | 4921 int multiplier = GetMultiplierForMastery(currentItemSkillLevel, 1, 2, 3, 5); |
5105 case 2: multiplier=2; break; | 4922 return multiplier * (currentItemSkillLevel & 0x3F); |
5106 case 3: multiplier=3; break; | |
5107 case 4: multiplier=5; break; | |
5108 } | 4923 } |
5109 return multiplier * (v11 & 0x3F); | 4924 else if (currItemSkillType == PLAYER_SKILL_STAFF && this->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0) |
4925 { | |
4926 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
4927 int multiplier = GetMultiplierForMastery(currentItemSkillLevel, 1, 1, 2, 2); | |
4928 return multiplier * (unarmedSkillLevel & 0x3F) + armsMasterBonus + (currentItemSkillLevel & 0x3F); | |
4929 } | |
4930 else | |
4931 { | |
4932 return armsMasterBonus + (currentItemSkillLevel & 0x3F); | |
4933 } | |
5110 } | 4934 } |
5111 } | 4935 } |
5112 } | 4936 } |
5113 return 0; | 4937 return 0; |
5114 } | 4938 } |
5115 break; | 4939 break; |
5116 | 4940 |
4941 case CHARACTER_ATTRIBUTE_RANGED_ATTACK: | |
4942 { | |
4943 for (int i = 0; i < 16; i++) | |
4944 { | |
4945 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4946 { | |
4947 PLAYER_SKILL_TYPE currentItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID].uSkillType; | |
4948 int currentItemSkillLevel = this->GetActualSkillLevel(currentItemSkillType); | |
4949 if ( currentItemSkillType == PLAYER_SKILL_BOW ) | |
4950 { | |
4951 int multiplier = GetMultiplierForMastery(currentItemSkillLevel, 0, 0, 0, 0); | |
4952 return multiplier * (currentItemSkillLevel & 0x3F); | |
4953 } | |
4954 else if ( currentItemSkillType == PLAYER_SKILL_BLASTER ) | |
4955 { | |
4956 int multiplier = GetMultiplierForMastery(currentItemSkillLevel, 1, 2, 3, 5); | |
4957 return multiplier * (currentItemSkillLevel & 0x3F); | |
4958 } | |
4959 } | |
4960 } | |
4961 return 0; | |
4962 } | |
4963 break; | |
4964 | |
5117 case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS: | 4965 case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS: |
5118 { | 4966 { |
5119 if ( v2->IsUnarmed() ) | 4967 if ( this->IsUnarmed() ) |
5120 { | 4968 { |
5121 v18 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | 4969 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); |
5122 if ( !v18 ) | 4970 if ( !unarmedSkillLevel ) |
5123 return 0; | 4971 return 0; |
5124 { | 4972 { |
5125 v39 = SkillToMastery(v18); | 4973 int multiplier = GetMultiplierForMastery(unarmedSkillLevel, 0, 1, 2, 2); |
5126 switch (v39) | 4974 return multiplier * (unarmedSkillLevel & 0x3F); |
4975 } | |
4976 } | |
4977 for (int i = 0; i < 16; i++) | |
4978 { | |
4979 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4980 { | |
4981 int currItemId = this->pInventoryItemList[this->pEquipment.pIndices[i]].uItemID; | |
4982 if ( pItemsTable->pItems[currItemId].uEquipType == EQUIP_MAIN_HAND || pItemsTable->pItems[currItemId].uEquipType == EQUIP_OFF_HAND ) | |
5127 { | 4983 { |
5128 case 1: multiplier=0; break; | 4984 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[currItemId].uSkillType; |
5129 case 2: multiplier=1; break; | 4985 int currItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); |
5130 case 3: multiplier=1; break; | 4986 int baseSkillBonus; |
5131 case 4: multiplier=2; break; | 4987 int multiplier; |
5132 } | 4988 switch (currItemSkillType) |
5133 return multiplier * (v18 & 0x3F); | |
5134 } | |
5135 } | |
5136 v20 = 0; | |
5137 while ( 1 ) | |
5138 { | |
5139 if ( v2->HasItemEquipped((ITEM_EQUIP_TYPE)v20) ) | |
5140 { | |
5141 v22 = this->pInventoryItemList[this->pEquipment.pIndices[v20]].uItemID; | |
5142 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) | |
5143 break; | |
5144 } | |
5145 v20++; | |
5146 if ( (signed int)v20 >= 16 ) | |
5147 return 0; | |
5148 } | |
5149 v71 = 0; | |
5150 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
5151 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
5152 v25 = v24; | |
5153 v26 = SkillToMastery(v24); | |
5154 switch (v23) | |
5155 { | |
5156 case PLAYER_SKILL_STAFF: | |
5157 if ( (signed int)SkillToMastery(v25) >= 4 && v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0) | |
5158 { | |
5159 v31 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5160 if ( v31 ) | |
5161 { | 4989 { |
5162 v32 = SkillToMastery(v31); | 4990 case PLAYER_SKILL_STAFF: |
5163 switch (v32) | 4991 if ( SkillToMastery(currItemSkillLevel) >= 4 && this->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0) |
5164 { | 4992 { |
5165 case 1: multiplier=0; break; | 4993 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); |
5166 case 2: multiplier=1; break; | 4994 int multiplier = GetMultiplierForMastery(unarmedSkillLevel, 0, 1, 2, 2); |
5167 case 3: multiplier=2; break; | 4995 return multiplier * (unarmedSkillLevel & 0x3F); |
5168 case 4: multiplier=2; break; | |
5169 } | 4996 } |
5170 return multiplier * (v31 & 0x3F); | 4997 else |
4998 { | |
4999 return armsMasterBonus; | |
5000 } | |
5001 break; | |
5002 | |
5003 case PLAYER_SKILL_DAGGER: | |
5004 multiplier = GetMultiplierForMastery(currItemSkillLevel, 0, 0, 0, 1); | |
5005 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); | |
5006 return armsMasterBonus + baseSkillBonus; | |
5007 break; | |
5008 case PLAYER_SKILL_SWORD: | |
5009 multiplier = GetMultiplierForMastery(currItemSkillLevel, 0, 0, 0, 0); | |
5010 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); | |
5011 return armsMasterBonus + baseSkillBonus; | |
5012 break; | |
5013 case PLAYER_SKILL_MACE: | |
5014 case PLAYER_SKILL_SPEAR: | |
5015 multiplier = GetMultiplierForMastery(currItemSkillLevel, 0, 1, 1, 1); | |
5016 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); | |
5017 return armsMasterBonus + baseSkillBonus; | |
5018 break; | |
5019 case PLAYER_SKILL_AXE: | |
5020 multiplier = GetMultiplierForMastery(currItemSkillLevel, 0, 0, 1, 1); | |
5021 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); | |
5022 return armsMasterBonus + baseSkillBonus; | |
5023 break; | |
5171 } | 5024 } |
5172 } | 5025 } |
5173 else | 5026 } |
5174 { | 5027 } |
5175 return arm_bonus; | 5028 return 0; |
5176 } | |
5177 break; | |
5178 | |
5179 case PLAYER_SKILL_DAGGER: | |
5180 v29 = SkillToMastery(v25); | |
5181 switch (v29) | |
5182 { | |
5183 case 1: multiplier=0; break; | |
5184 case 2: multiplier=0; break; | |
5185 case 3: multiplier=0; break; | |
5186 case 4: multiplier=1; break; | |
5187 } | |
5188 v30 = multiplier * (v29 & 0x3F); | |
5189 return arm_bonus + v30; | |
5190 break; | |
5191 case PLAYER_SKILL_SWORD: | |
5192 return arm_bonus; | |
5193 break; | |
5194 case PLAYER_SKILL_MACE: | |
5195 case PLAYER_SKILL_SPEAR: | |
5196 v29 = SkillToMastery(v25); | |
5197 switch (v29) | |
5198 { | |
5199 case 1: multiplier=0; break; | |
5200 case 2: multiplier=1; break; | |
5201 case 3: multiplier=1; break; | |
5202 case 4: multiplier=1; break; | |
5203 } | |
5204 v30 = multiplier * (v29 & 0x3F); | |
5205 return arm_bonus + v30; | |
5206 break; | |
5207 case PLAYER_SKILL_AXE: | |
5208 v29 = SkillToMastery(v25); | |
5209 switch (v29) | |
5210 { | |
5211 case 1: multiplier=0; break; | |
5212 case 2: multiplier=0; break; | |
5213 case 3: multiplier=1; break; | |
5214 case 4: multiplier=1; break; | |
5215 } | |
5216 v30 = multiplier * (v29 & 0x3F); | |
5217 return arm_bonus + v30; | |
5218 break; | |
5219 } | |
5220 } | 5029 } |
5221 default: | 5030 default: |
5222 return 0; | 5031 return 0; |
5223 } | 5032 } |
5224 | 5033 } |
5225 } | 5034 |
5226 | 5035 unsigned int Player::GetMultiplierForMastery(unsigned int skillValue, int mult1, int mult2, int mult3, int mult4) |
5036 { | |
5037 int masteryLvl = SkillToMastery(skillValue); | |
5038 switch (masteryLvl) | |
5039 { | |
5040 case 1: return mult1; | |
5041 case 2: return mult2; | |
5042 case 3: return mult3; | |
5043 case 4: return mult4; | |
5044 } | |
5045 assert(false); | |
5046 return 0; | |
5047 } | |
5227 //----- (00490109) -------------------------------------------------------- | 5048 //----- (00490109) -------------------------------------------------------- |
5228 // faces are: 0 1 2 3 human males | 5049 // faces are: 0 1 2 3 human males |
5229 // 4 5 6 7 human females | 5050 // 4 5 6 7 human females |
5230 // 8 9 elf males | 5051 // 8 9 elf males |
5231 // 10 11 elf females | 5052 // 10 11 elf females |