Mercurial > mm7
diff Player.cpp @ 1551:a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
author | Grumpy7 |
---|---|
date | Sat, 07 Sep 2013 10:04:37 +0200 |
parents | cdb7fafede0c |
children | d253172de469 |
line wrap: on
line diff
--- a/Player.cpp Sat Sep 07 09:45:09 2013 +0200 +++ b/Player.cpp Sat Sep 07 10:04:37 2013 +0200 @@ -2030,9 +2030,8 @@ } //----- (0048D1FE) -------------------------------------------------------- -bool Player::CalculateRangedDamageTo(int a2) -{ - Player *v2; // ebx@1 +int Player::CalculateRangedDamageTo( int a2 ) +{ bool result; // eax@1 ItemGen *v4; // ebx@2 unsigned int v5; // edi@2 @@ -2040,62 +2039,41 @@ char v8; // zf@4 int v9; // esi@5 int v10; // ebx@6 - enum MONSTER_SUPERTYPE v11; // edx@7 - unsigned __int16 v12; // ax@19 - MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 - Player *v14; // [sp+4h] [bp-10h]@1 signed int v15; // [sp+8h] [bp-Ch]@2 - int v16; // [sp+Ch] [bp-8h]@3 int v17; // [sp+10h] [bp-4h]@1 v17 = 0; - v2 = this; - v14 = this; - result = HasItemEquipped(EQUIP_BOW); - if ( !result ) - return result; - v4 = (ItemGen *)&v2->pInventoryItemList[v2->pEquipment.uBow-1]; + if ( !HasItemEquipped(EQUIP_BOW) ) + return 0; + v4 = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uBow-1]; v5 = v4->uItemID; v15 = pItemsTable->pItems[v5].uDamageRoll; - if ( (signed int)pItemsTable->pItems[v5].uDamageDice > 0 ) - { - for( int i = 0; i < pItemsTable->pItems[v5].uDamageDice; i++ ) - { - v7 = rand() % v15; - v17 += v7 + 1; - } + for( int i = 0; i < pItemsTable->pItems[v5].uDamageDice; i++ ) + { + int v7 = rand() % v15; + v17 += v7 + 1; } v9 = pItemsTable->pItems[v5].uDamageMod + v17; if ( a2 ) { v10 = v4->uSpecEnchantmentType; - if ( v10 == 64 ) - { - v11 = MONSTER_SUPERTYPE_UNDEAD; - goto LABEL_17; - } - if ( v10 == 39 ) - { - v13 = MONSTER_SUPERTYPE_KREEGAN; - goto LABEL_16; - } - if ( v10 == 40 ) - { - v13 = MONSTER_SUPERTYPE_DRAGON; - goto LABEL_16; - } - if ( v10 == 63 ) - { - v13 = MONSTER_SUPERTYPE_ELF; -LABEL_16: - v11 = v13; -LABEL_17: - if ( MonsterStats::BelongsToSupertype(a2, v11) ) - v9 *= 2; - goto LABEL_19; - } - } -LABEL_19: + if ( v10 == 64 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_UNDEAD)) + { + v9 *= 2; + } + else if ( v10 == 39 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_KREEGAN)) + { + v9 *= 2; + } + else if ( v10 == 40 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_DRAGON)) + { + v9 *= 2; + } + else if ( v10 == 63 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_ELF)) + { + v9 *= 2; + } + } return v9 + this->GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS); }