Mercurial > mm7
diff Player.cpp @ 1040:4430136083a6
CHARACTER_ATTRIBUTE_ GetItemsBonus
author | Gloval |
---|---|
date | Wed, 22 May 2013 23:52:01 +0400 |
parents | ff2d888f8033 |
children | c5498375832a |
line wrap: on
line diff
--- a/Player.cpp Wed May 22 22:26:31 2013 +0400 +++ b/Player.cpp Wed May 22 23:52:01 2013 +0400 @@ -2915,9 +2915,9 @@ int result; // eax@6 v1 = this; - v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MIN, 0); - v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; - v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; + 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; @@ -2939,9 +2939,9 @@ int result; // eax@6 v1 = this; - v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MAX, 0); - v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; - v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; + 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; @@ -4483,7 +4483,7 @@ int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) { CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 - signed int v4; // eax@1 + // signed int v4; // eax@1 int v5; // edi@1 Player *v6; // ebx@1 Player *v8; // ecx@48 @@ -4544,145 +4544,73 @@ int v63; // [sp+18h] [bp-4h]@101 ItemGen *attra; // [sp+20h] [bp+4h]@101 unsigned int v65; // [sp+24h] [bp+8h]@95 + bool no_skills; v3 = attr; - v4 = 36; v5 = 0; v6 = this; v62 = 0; v61 = 0; + + no_skills=false; switch (attr) - { - case CHARACTER_ATTRIBUTE_LEVEL: - if (HasEnchantedItemEquipped(25)) - return 5; - return 0; - }; - - if ( (signed int)attr > 36 ) - { - switch ( attr ) - { - case 37: - v58 = 15; - goto LABEL_35; - case 38: - v58 = 16; - goto LABEL_35; - case 39: - v58 = 17; - goto LABEL_35; - case 40: - v58 = 18; - goto LABEL_35; - case 41: - v58 = 19; - goto LABEL_35; - case 42: - v58 = 20; - goto LABEL_35; - case 43: - v58 = 25; - goto LABEL_35; - case 44: - v58 = 5; - goto LABEL_35; - case 45: - v58 = 8; - goto LABEL_35; - case 46: - goto LABEL_36; - default: - break; - } - } - else - { - if ( attr == 36 ) - { - v58 = 14; - } - else - { - if ( (signed int)attr > 21 ) { - switch ( attr ) - { - case 22: - v58 = 30; - break; - case 23: - v58 = 31; - break; - case 34: - v58 = 12; - break; - default: - if ( attr != 35 ) - goto LABEL_38; - v58 = 13; - break; - } + case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break; + case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break; + case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break; + case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break; + case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break; + case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break; + case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break; + case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break; + case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break; + case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break; + case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break; + case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break; + case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break; + case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break; + case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break; + case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break; + case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break; + case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break; + case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break; + case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break; + case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break; + default: + no_skills=true; } - else + if (!no_skills) { - switch ( attr ) - { - case 21: - v58 = 33; - break; - case 16: - v58 = 35; - break; - case 17: - v58 = 34; - break; - case 18: - v58 = 29; - break; - case 19: - v58 = 21; - break; - default: - if ( attr != 20 ) - goto LABEL_38; - v58 = 32; - break; - } + if ( !this->pActiveSkills[v58] ) + return 0; } - } -LABEL_35: - v4 = v58; -LABEL_36: - if ( !this->pActiveSkills[v4] ) - return 0; - } -LABEL_38: + if ( (signed int)attr > 28 ) { if ( (signed int)attr < 29 ) return v5 + v62 + v61; - if ( (signed int)attr <= 30 ) + if ( (signed int)attr <= CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS ) { if ( HasItemEquipped(EQUIP_BOW) ) - v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod; + v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uBow-1].uItemID].uDamageMod; return v5 + v62 + v61; } - if ( attr == 31 ) + if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MIN ) { if ( !HasItemEquipped(EQUIP_BOW) ) return v5 + v62 + v61; - v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; + v57 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; v5 = pItemsTable->pItems[v57].uDamageMod; v56 = pItemsTable->pItems[v57].uDamageDice; - goto LABEL_366; - } - if ( attr == 32 ) + v5 += v56; + return v5 + v62 + v61; + } + if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MAX ) { if ( !HasItemEquipped(EQUIP_BOW) ) return v5 + v62 + v61; - v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; + v20 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; LABEL_365: v56 = pItemsTable->pItems[v20].uDamageMod; @@ -5258,7 +5186,7 @@ return v5 + v62 + v61; } } - if ( attr == 28 ) + if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) { if ( IsUnarmed() != 1 ) { @@ -5269,7 +5197,7 @@ { if ( v22 <= 2 ) { - v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; + v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID; if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) { v24 = v23; @@ -5285,11 +5213,18 @@ } } } - if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v28 < 0) || v28 > 2 ) - return v5 + v62 + v61; + + if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) ) + { + + v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); + if ((v28 < 0) || v28 > 2 ) + return v5 + v62 + v61; + } v15 = pItemsTable->pItems[v29].uDamageMod; v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; - goto LABEL_88; + v5 += v15 + v14; + return v5 + v62 + v61 } v59 = 3; LABEL_74: @@ -5298,11 +5233,18 @@ } if ( (signed int)attr < 0 ) return v5 + v62 + v61; - if ( (signed int)attr <= 23 ) + if ( (signed int)attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED ) goto LABEL_95; - if ( (signed int)attr <= 24 ) + if ( attr == CHARACTER_ATTRIBUTE_LEVEL ) + { + if ( !Player::HasEnchantedItemEquipped(25) ) + return v5 + v62 + v61; + v5 = 5; + return v5 + v62 + v61; + } + if ( (signed int)attr <= CHARACTER_ATTRIBUTE_LEVEL ) return v5 + v62 + v61; - if ( (signed int)attr <= 26 ) + if ( (signed int)attr <= CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) { if ( IsUnarmed() == 1 ) { @@ -5315,15 +5257,17 @@ if ( v17 >= 0 ) { if ( v17 <= 2 ) - v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod; + 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 ) return v5 + v62 + v61; - v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uShield - 1]; - goto LABEL_365; - } - if ( attr == 27 ) + v20 = v6->pOwnItems[v6->pEquipment.uShield - 1].uItemID; + v56 = pItemsTable->pItems[v20].uDamageMod; + v5 += v56; + return v5 + v62 + v61; + } + if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MIN ) { if ( IsUnarmed() == 1 ) { @@ -5337,20 +5281,25 @@ { if ( v9 <= 2 ) { - v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + - pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; + v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice + + pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod; if ( !v6->pEquipment.uShield ) { - if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) + if ( pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) ++v5; } } } } - if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v12 < 0) || v12 > 2 ) - return v5 + v62 + v61; - v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageMod; - v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageDice; + + if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND)) + { + v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); + if ((v12 < 0) || v12 > 2 ) + return v5 + v62 + v61; + } + v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod; + v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice; LABEL_88: v5 += v15 + v14; } @@ -6526,43 +6475,43 @@ pStep = StatTable[0][v2].uBaseStep; switch ( eAttribute ) { - case CHARACTER_MIGHT: + case CHARACTER_ATTRIBUTE_STRENGTH: if ( this->uMight <= pBaseValue ) pStep = pDroppedStep; if ( this->uMight - pStep >= uMinValue ) this->uMight -= pStep; break; - case CHARACTER_INTELLIGANCE: + case CHARACTER_ATTRIBUTE_INTELLIGENCE: if ( this->uIntelligence <= pBaseValue ) pStep = pDroppedStep; if ( this->uIntelligence - pStep >= uMinValue ) this->uIntelligence -= pStep; break; - case CHARACTER_WILLPOWER: + case CHARACTER_ATTRIBUTE_WILLPOWER: if ( this->uWillpower <= pBaseValue ) pStep = pDroppedStep; if ( this->uWillpower - pStep >= uMinValue ) this->uWillpower -= pStep; break; - case CHARACTER_ENDURANCE: + case CHARACTER_ATTRIBUTE_ENDURANCE: if ( this->uEndurance <= pBaseValue ) pStep = pDroppedStep; if ( this->uEndurance - pStep >= uMinValue ) this->uEndurance -= pStep; break; - case CHARACTER_ACCURACY: + case CHARACTER_ATTRIBUTE_ACCURACY: if ( this->uAccuracy <= pBaseValue ) pStep = pDroppedStep; if ( this->uAccuracy - pStep >= uMinValue ) this->uAccuracy -= pStep; break; - case CHARACTER_SPEED: + case CHARACTER_ATTRIBUTE_SPEED: if ( this->uSpeed <= pBaseValue ) pStep = pDroppedStep; if ( this->uSpeed - pStep >= uMinValue ) this->uSpeed -= pStep; break; - case CHARACTER_LUCK: + case CHARACTER_ATTRIBUTE_LUCK: if ( this->uLuck <= pBaseValue ) pStep = pDroppedStep; if ( this->uLuck - pStep >= uMinValue )