comparison Player.cpp @ 1080:9456f2ed5ff9

getskillbonus continue cleaning
author Gloval
date Sat, 25 May 2013 23:50:56 +0400
parents 48168499f52e
children 7033eb155558
comparison
equal deleted inserted replaced
1077:2210109f280d 1080:9456f2ed5ff9
1083 } 1083 }
1084 1084
1085 PlaySound((PlayerSpeech)25, 0); 1085 PlaySound((PlayerSpeech)25, 0);
1086 break; 1086 break;
1087 case Condition_Sleep: 1087 case Condition_Sleep:
1088 if ( a3 == 1 &&(HasEnchantedItemEquipped(22)||WearsItem(505, 3))) 1088 if ( a3 == 1 &&(HasEnchantedItemEquipped(22)||
1089 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR)))
1089 return 0; 1090 return 0;
1090 break; 1091 break;
1091 1092
1092 case Condition_Fear: 1093 case Condition_Fear:
1093 PlaySound((PlayerSpeech)26, 0); 1094 PlaySound((PlayerSpeech)26, 0);
1096 PlaySound((PlayerSpeech)31, 0); 1097 PlaySound((PlayerSpeech)31, 0);
1097 break; 1098 break;
1098 1099
1099 case Condition_Insane: 1100 case Condition_Insane:
1100 if ( a3 == 1 1101 if ( a3 == 1
1101 && (HasEnchantedItemEquipped(19) || WearsItem(505, 3) || WearsItem(530, 6)) ) 1102 && (HasEnchantedItemEquipped(19) ||
1103 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) ||
1104 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_BELT)) )
1102 return 0; 1105 return 0;
1103 1106
1104 PlaySound((PlayerSpeech)29, 0); 1107 PlaySound((PlayerSpeech)29, 0);
1105 break; 1108 break;
1106 case Condition_Poison1: 1109 case Condition_Poison1:
1113 --pParty->pPartyBuffs[13].uPower; 1116 --pParty->pPartyBuffs[13].uPower;
1114 if ( pParty->pPartyBuffs[13].uPower < 1u ) 1117 if ( pParty->pPartyBuffs[13].uPower < 1u )
1115 pParty->pPartyBuffs[13].Reset(); 1118 pParty->pPartyBuffs[13].Reset();
1116 } 1119 }
1117 if ( HasEnchantedItemEquipped(21) 1120 if ( HasEnchantedItemEquipped(21)
1118 || WearsItem(505, 3) 1121 || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR)
1119 || WearsItem(530, 6) ) 1122 || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_BELT) )
1120 //goto LABEL_76; 1123 //goto LABEL_76;
1121 return 0; 1124 return 0;
1122 } 1125 }
1123 1126
1124 //v23 = 27; 1127 //v23 = 27;
1136 if ( pParty->pPartyBuffs[13].uPower < 1u ) 1139 if ( pParty->pPartyBuffs[13].uPower < 1u )
1137 pParty->pPartyBuffs[13].Reset(); 1140 pParty->pPartyBuffs[13].Reset();
1138 return 0; 1141 return 0;
1139 } 1142 }
1140 1143
1141 if ( HasEnchantedItemEquipped(18) ||WearsItem(505, 3) || WearsItem(530, 6) ) 1144 if ( HasEnchantedItemEquipped(18) ||
1145 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) ||
1146 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_BELT) )
1142 return 0; 1147 return 0;
1143 } 1148 }
1144 PlaySound((PlayerSpeech)28, 0); 1149 PlaySound((PlayerSpeech)28, 0);
1145 break; 1150 break;
1146 case Condition_Paralyzed: 1151 case Condition_Paralyzed:
1152 if ( pParty->pPartyBuffs[13].uPower < 1u ) 1157 if ( pParty->pPartyBuffs[13].uPower < 1u )
1153 pParty->pPartyBuffs[13].Reset(); 1158 pParty->pPartyBuffs[13].Reset();
1154 return 0; 1159 return 0;
1155 } 1160 }
1156 1161
1157 if ( HasEnchantedItemEquipped(20)|| WearsItem(505, 3)|| WearsItem(507, 16)||WearsItem(530, 6)) 1162 if ( HasEnchantedItemEquipped(20)||
1163 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR)||
1164 WearsItem(ITEM_ARTIFACT_GHOULSBANE, EQIUP_ANY)||
1165 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_BELT))
1158 return 0; 1166 return 0;
1159 } 1167 }
1160 break; 1168 break;
1161 case Condition_Unconcious: 1169 case Condition_Unconcious:
1162 PlaySound(SPEECH_32, 0); 1170 PlaySound(SPEECH_32, 0);
1178 sMana = 0; 1186 sMana = 0;
1179 break; 1187 break;
1180 case Condition_Pertified: 1188 case Condition_Pertified:
1181 if ( a3 == 1 1189 if ( a3 == 1
1182 &&((pParty->pPartyBuffs[13].uExpireTime > 0i64) 1190 &&((pParty->pPartyBuffs[13].uExpireTime > 0i64)
1183 || HasEnchantedItemEquipped(23)|| WearsItem(520, 16) || WearsItem(505, 3) || WearsItem(530, 6)) ) 1191 || HasEnchantedItemEquipped(23)||
1192 WearsItem(ITEM_RELIC_KELEBRIM, EQIUP_ANY) ||
1193 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) ||
1194 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_BELT)) )
1184 1195
1185 return 0; 1196 return 0;
1186 PlaySound((PlayerSpeech)34, 0); 1197 PlaySound((PlayerSpeech)34, 0);
1187 break; 1198 break;
1188 case Condition_Eradicated: 1199 case Condition_Eradicated:
3247 //----- (0048D6AA) -------------------------------------------------------- 3258 //----- (0048D6AA) --------------------------------------------------------
3248 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) 3259 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex)
3249 { 3260 {
3250 auto i = pEquipment.pIndices[uEquipIndex]; 3261 auto i = pEquipment.pIndices[uEquipIndex];
3251 if (i) 3262 if (i)
3252 return ~(pInventoryItems[i - 1].uAttributes & ITEM_BROKEN); 3263 return ~(pOwnItems[i - 1].uAttributes & ITEM_BROKEN);
3253 else 3264 else
3254 return false; 3265 return false;
3255 } 3266 }
3256 3267
3257 //----- (0048D6D0) -------------------------------------------------------- 3268 //----- (0048D6D0) --------------------------------------------------------
3258 bool Player::HasEnchantedItemEquipped(int uEnchantment) 3269 bool Player::HasEnchantedItemEquipped(int uEnchantment)
3259 { 3270 {
3260 for (uint i = 0; i < 16; ++i) 3271 for (uint i = 0; i < 16; ++i)
3261 { 3272 {
3262 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && 3273 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) &&
3263 pInventoryItems[i].uSpecEnchantmentType == uEnchantment) 3274 pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment)
3264 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) 3275 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment)
3265 return true; 3276 return true;
3266 } 3277 }
3267 return false; 3278 return false;
3268 } 3279 }
3269 3280
3270 //----- (0048D709) -------------------------------------------------------- 3281 //----- (0048D709) --------------------------------------------------------
3271 bool Player::WearsItem(int a1, signed int a2) 3282 bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type )
3272 { 3283 {
3273 3284
3274 int v6; // esi@5 3285 int v6; // esi@5
3275 3286
3276 if ( a2 >= 16 ) 3287 if ( equip_type >= 16 )
3277 { 3288 {
3278 v6 = 0; 3289 v6 = 0;
3279 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) 3290 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6)
3280 || *(int *)&this->pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != a1 ) 3291 || this->pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != item_id )
3281 { 3292 {
3282 ++v6; 3293 ++v6;
3283 if ( (signed int)v6 >= 16 ) 3294 if ( (signed int)v6 >= 16 )
3284 return 0; 3295 return 0;
3285 } 3296 }
3286 return 1; 3297 return 1;
3287 } 3298 }
3288 if ( HasItemEquipped((ITEM_EQUIP_TYPE)a2) && pInventoryItems[pEquipment.pIndices[a2 - 1]].uItemID == a1 ) 3299 if ( HasItemEquipped(equip_type) && pInventoryItems[pEquipment.pIndices[equip_type - 1]].uItemID == item_id )
3289 return 1; 3300 return 1;
3290 return 0; 3301 return 0;
3291 } 3302 }
3292 3303
3293 //----- (0048D76C) -------------------------------------------------------- 3304 //----- (0048D76C) --------------------------------------------------------
5688 int v65; // [sp+10h] [bp-1Ch]@104 5699 int v65; // [sp+10h] [bp-1Ch]@104
5689 int v66; // [sp+14h] [bp-18h]@104 5700 int v66; // [sp+14h] [bp-18h]@104
5690 int v67; // [sp+18h] [bp-14h]@104 5701 int v67; // [sp+18h] [bp-14h]@104
5691 int v68; // [sp+1Ch] [bp-10h]@69 5702 int v68; // [sp+1Ch] [bp-10h]@69
5692 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 5703 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1
5693 int v70; // [sp+24h] [bp-8h]@1 5704 int skill_bonus; // [sp+24h] [bp-8h]@1
5694 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 5705 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1
5695 int a1; // [sp+34h] [bp+8h]@21 5706 int a1; // [sp+34h] [bp+8h]@21
5696 int a1a; // [sp+34h] [bp+8h]@74 5707 int a1a; // [sp+34h] [bp+8h]@74
5697 signed int a1b; // [sp+34h] [bp+8h]@94 5708 signed int a1b; // [sp+34h] [bp+8h]@94
5698 int multiplier; 5709 int multiplier;
5699 int arm_bonus; 5710 int arm_bonus;
5700 int lvl_avl[4]; 5711 int lvl_avl[4];
5701 5712
5702 v2 = this; 5713 v2 = this;
5703 v70 = 0; 5714 skill_bonus = 0;
5704 v69 = 0; 5715 v69 = 0;
5705 multiplier =0; 5716 multiplier =0;
5706 arm_bonus =0; 5717 arm_bonus =0;
5707 v71 = (ITEM_EQUIP_TYPE)0; 5718 v71 = (ITEM_EQUIP_TYPE)0;
5708 armmaster_skill = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); 5719 armmaster_skill = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER);
5807 v52 = SkillToMastery(v50); 5818 v52 = SkillToMastery(v50);
5808 v53 = v51 & 0x3F; 5819 v53 = v51 & 0x3F;
5809 for ( i = 0; i < (signed int)v52; ++i ) 5820 for ( i = 0; i < (signed int)v52; ++i )
5810 { 5821 {
5811 if ( lvl_avl[i] ) 5822 if ( lvl_avl[i] )
5812 v70 += v53; 5823 skill_bonus += v53;
5813 } 5824 }
5814 5825
5815 } 5826 }
5816 } 5827 }
5817 5828
5827 { 5838 {
5828 v58 = v56 & 0x3F; 5839 v58 = v56 & 0x3F;
5829 for ( j = 0; j < (signed int)v57; ++j ) 5840 for ( j = 0; j < (signed int)v57; ++j )
5830 { 5841 {
5831 if ( lvl_avl[j] ) 5842 if ( lvl_avl[j] )
5832 v70 += v58; 5843 skill_bonus += v58;
5833 } 5844 }
5834 } 5845 }
5835 return v70; 5846 return skill_bonus;
5836 5847
5837 5848
5838 } 5849 }
5839 5850
5851 if (a2 == CHARACTER_ATTRIBUTE_ATTACK)
5852 {
5853
5854 if ( v2->IsUnarmed() == 1 )
5855 {
5856 v33 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
5857 v34 = v33;
5858 if ( !v33 )
5859 return skill_bonus;
5860 if ( SkillToMastery(v33) >= 3 )
5861 multiplier = 2;
5862 else
5863 multiplier=1;
5864 v30 = multiplier * (v34 & 0x3F);
5865 return arm_bonus + v30;
5866 }
5867 v35 = (ITEM_EQUIP_TYPE)0;
5868 v68 = 0;
5869 for (i=0; i<16 ; ++i)
5870 {
5871 if ( v2->HasItemEquipped((ITEM_EQUIP_TYPE)i) )
5872 {
5873 v37 = v2->pEquipment.pIndices[i]-1;
5874 if ( pItemsTable->pItems[v37].uEquipType <= EQUIP_MAIN_HAND)
5875 break;
5876 }
5877 }
5878 if ( i >= 16 )
5879 return skill_bonus;
5880
5881 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType;
5882 a1a = v2->GetActualSkillLevel(v38);
5883 v39= SkillToMastery(a1a);
5884 v71 = (ITEM_EQUIP_TYPE)0;
5885 switch (v38)
5886 {
5887 case PLAYER_SKILL_STAFF:
5888 v71 = (ITEM_EQUIP_TYPE)1;
5889 if ( v39 == 4 )
5890 {
5891 v40 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
5892 v41 = v40;
5893
5894 if ( v40 )
5895 {
5896 if ( SkillToMastery(v40) >= 3 )
5897 multiplier = 2;
5898 else
5899 multiplier=1;
5900 v68 = multiplier * (v41 & 0x3F);
5901 }
5902 }
5903 break;
5904 case PLAYER_SKILL_SWORD:
5905 case PLAYER_SKILL_DAGGER:
5906 case PLAYER_SKILL_AXE:
5907 case PLAYER_SKILL_SPEAR:
5908 case PLAYER_SKILL_MACE:
5909 v71 = (ITEM_EQUIP_TYPE)1;
5910 break;
5911 case PLAYER_SKILL_BLASTER:
5912
5913 switch (v39)
5914 {
5915 case 0: multiplier=1; break;
5916 case 1: multiplier=3; break;
5917 case 3: multiplier=3; break;
5918 case 4: multiplier=5; break;
5919 }
5920 v5 = multiplier;
5921 return v5 * (a1a & 0x3F);
5922 break;
5923 }
5924
5925
5926
5927 v30 = v68 + v71 * (a1a & 0x3F);
5928 return (int)((char *)v69 + v30);
5929
5930 }
5931
5932
5840 if ( a2 != 9 ) 5933 if ( a2 != 9 )
5841 { 5934 {
5842 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) 5935
5843 {
5844 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) 5936 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK )
5845 return v70; 5937 return skill_bonus;
5846 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) 5938 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX )
5847 { 5939 {
5848 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) 5940 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK )
5849 return v70; 5941 return skill_bonus;
5850 v71 = (ITEM_EQUIP_TYPE)0; 5942 v71 = (ITEM_EQUIP_TYPE)0;
5851 v9 = &v2->pEquipment; 5943 v9 = &v2->pEquipment;
5852 while ( 1 ) 5944 while ( 1 )
5853 { 5945 {
5854 if ( v2->HasItemEquipped(v71) ) 5946 if ( v2->HasItemEquipped(v71) )
5864 break; 5956 break;
5865 } 5957 }
5866 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); 5958 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1);
5867 v9 = (PlayerEquipment *)((char *)v9 + 4); 5959 v9 = (PlayerEquipment *)((char *)v9 + 4);
5868 if ( (signed int)v71 >= 16 ) 5960 if ( (signed int)v71 >= 16 )
5869 return v70; 5961 return skill_bonus;
5870 } 5962 }
5871 v14 = a1; 5963 v14 = a1;
5872 v15 = 1; 5964 v15 = 1;
5873 if ( (signed int)SkillToMastery(a1) >= 4 ) 5965 if ( (signed int)SkillToMastery(a1) >= 4 )
5874 { 5966 {
5887 if ( v2->IsUnarmed() ) 5979 if ( v2->IsUnarmed() )
5888 { 5980 {
5889 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); 5981 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
5890 v14 = v18; 5982 v14 = v18;
5891 if ( !v18 ) 5983 if ( !v18 )
5892 return v70; 5984 return skill_bonus;
5893 v15 = 0; 5985 v15 = 0;
5894 v19 = SkillToMastery(v18); 5986 v19 = SkillToMastery(v18);
5895 if ( (signed int)v19 < 3 ) 5987 if ( (signed int)v19 < 3 )
5896 { 5988 {
5897 if ( (signed int)v19 >= 2 ) 5989 if ( (signed int)v19 >= 2 )
5915 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) 6007 if ( pItemsTable->pItems[v22].uEquipType <= 1u )
5916 break; 6008 break;
5917 } 6009 }
5918 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); 6010 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1);
5919 if ( (signed int)v20 >= 16 ) 6011 if ( (signed int)v20 >= 16 )
5920 return v70; 6012 return skill_bonus;
5921 } 6013 }
5922 v71 = (ITEM_EQUIP_TYPE)0; 6014 v71 = (ITEM_EQUIP_TYPE)0;
5923 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; 6015 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType;
5924 LOBYTE(v24) = v2->GetActualSkillLevel(v23); 6016 LOBYTE(v24) = v2->GetActualSkillLevel(v23);
5925 v25 = v24; 6017 v25 = v24;
5977 LABEL_53: 6069 LABEL_53:
5978 if ( !(v27 ^ v28) ) 6070 if ( !(v27 ^ v28) )
5979 v71 = (ITEM_EQUIP_TYPE)1; 6071 v71 = (ITEM_EQUIP_TYPE)1;
5980 goto LABEL_55; 6072 goto LABEL_55;
5981 } 6073 }
5982 if ( v2->IsUnarmed() == 1 ) 6074
5983 { 6075
5984 LOBYTE(v33) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
5985 v34 = v33;
5986 if ( !v33 )
5987 return v70;
5988 if ( (signed int)SkillToMastery(v33) >= 3 )
5989 v5 = 2;
5990 v30 = v5 * (v34 & 0x3F);
5991 return (int)((char *)v69 + v30);
5992 }
5993 v35 = (ITEM_EQUIP_TYPE)0;
5994 v68 = 0;
5995 while ( 1 )
5996 {
5997 if ( v2->HasItemEquipped(v35) )
5998 {
5999 v37 = v2->pInventoryItems[v35].uItemID;
6000 if ( pItemsTable->pItems[v37].uEquipType <= 1u )
6001 break;
6002 }
6003 v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1);
6004 if ( (signed int)v35 >= 16 )
6005 return v70;
6006 }
6007 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType;
6008 LOBYTE(v39) = v2->GetActualSkillLevel(v38);
6009 a1a = v39;
6010 SkillToMastery(v39);
6011 v71 = (ITEM_EQUIP_TYPE)0;
6012 if ( v38 )
6013 {
6014 if ( (signed int)v38 > 0 )
6015 {
6016 if ( (signed int)v38 <= 4 || v38 == 6 )
6017 {
6018 v71 = (ITEM_EQUIP_TYPE)1;
6019 }
6020 else
6021 {
6022 if ( v38 == 7 )
6023 {
6024 if ( (signed int)SkillToMastery(a1a) < 4 )
6025 {
6026 if ( (signed int)SkillToMastery(a1a) < 3 )
6027 {
6028 if ( (signed int)SkillToMastery(a1a) < 2 )
6029 return v5 * (a1a & 0x3F);
6030 v63 = 2;
6031 }
6032 else
6033 {
6034 v63 = 3;
6035 }
6036 }
6037 else
6038 {
6039 v63 = 5;
6040 }
6041 v5 = v63;
6042 return v5 * (a1a & 0x3F);
6043 }
6044 }
6045 }
6046 }
6047 else
6048 {
6049 v71 = (ITEM_EQUIP_TYPE)1;
6050 if ( (signed int)SkillToMastery(a1a) >= 4 )
6051 {
6052 LOBYTE(v40) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
6053 v41 = v40;
6054 if ( v40 )
6055 {
6056 if ( (signed int)SkillToMastery(v40) >= 3 )
6057 v5 = 2;
6058 v68 = v5 * (v41 & 0x3F);
6059 }
6060 }
6061 }
6062 v30 = v68 + v71 * (a1a & 0x3F);
6063 return (int)((char *)v69 + v30);
6064 }
6065 6076
6066 } 6077 }
6067 6078
6068 //----- (00490109) -------------------------------------------------------- 6079 //----- (00490109) --------------------------------------------------------
6069 // faces are: 0 1 2 3 human males 6080 // faces are: 0 1 2 3 human males