Mercurial > mm7
comparison 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 |
comparison
equal
deleted
inserted
replaced
1550:cdb7fafede0c | 1551:a9e8d2a7abb5 |
---|---|
2028 result = 0; | 2028 result = 0; |
2029 return result; | 2029 return result; |
2030 } | 2030 } |
2031 | 2031 |
2032 //----- (0048D1FE) -------------------------------------------------------- | 2032 //----- (0048D1FE) -------------------------------------------------------- |
2033 bool Player::CalculateRangedDamageTo(int a2) | 2033 int Player::CalculateRangedDamageTo( int a2 ) |
2034 { | 2034 { |
2035 Player *v2; // ebx@1 | |
2036 bool result; // eax@1 | 2035 bool result; // eax@1 |
2037 ItemGen *v4; // ebx@2 | 2036 ItemGen *v4; // ebx@2 |
2038 unsigned int v5; // edi@2 | 2037 unsigned int v5; // edi@2 |
2039 int v7; // edx@4 | 2038 int v7; // edx@4 |
2040 char v8; // zf@4 | 2039 char v8; // zf@4 |
2041 int v9; // esi@5 | 2040 int v9; // esi@5 |
2042 int v10; // ebx@6 | 2041 int v10; // ebx@6 |
2043 enum MONSTER_SUPERTYPE v11; // edx@7 | |
2044 unsigned __int16 v12; // ax@19 | |
2045 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 | |
2046 Player *v14; // [sp+4h] [bp-10h]@1 | |
2047 signed int v15; // [sp+8h] [bp-Ch]@2 | 2042 signed int v15; // [sp+8h] [bp-Ch]@2 |
2048 int v16; // [sp+Ch] [bp-8h]@3 | |
2049 int v17; // [sp+10h] [bp-4h]@1 | 2043 int v17; // [sp+10h] [bp-4h]@1 |
2050 | 2044 |
2051 v17 = 0; | 2045 v17 = 0; |
2052 v2 = this; | 2046 if ( !HasItemEquipped(EQUIP_BOW) ) |
2053 v14 = this; | 2047 return 0; |
2054 result = HasItemEquipped(EQUIP_BOW); | 2048 v4 = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uBow-1]; |
2055 if ( !result ) | |
2056 return result; | |
2057 v4 = (ItemGen *)&v2->pInventoryItemList[v2->pEquipment.uBow-1]; | |
2058 v5 = v4->uItemID; | 2049 v5 = v4->uItemID; |
2059 v15 = pItemsTable->pItems[v5].uDamageRoll; | 2050 v15 = pItemsTable->pItems[v5].uDamageRoll; |
2060 if ( (signed int)pItemsTable->pItems[v5].uDamageDice > 0 ) | 2051 for( int i = 0; i < pItemsTable->pItems[v5].uDamageDice; i++ ) |
2061 { | 2052 { |
2062 for( int i = 0; i < pItemsTable->pItems[v5].uDamageDice; i++ ) | 2053 int v7 = rand() % v15; |
2063 { | 2054 v17 += v7 + 1; |
2064 v7 = rand() % v15; | |
2065 v17 += v7 + 1; | |
2066 } | |
2067 } | 2055 } |
2068 v9 = pItemsTable->pItems[v5].uDamageMod + v17; | 2056 v9 = pItemsTable->pItems[v5].uDamageMod + v17; |
2069 if ( a2 ) | 2057 if ( a2 ) |
2070 { | 2058 { |
2071 v10 = v4->uSpecEnchantmentType; | 2059 v10 = v4->uSpecEnchantmentType; |
2072 if ( v10 == 64 ) | 2060 if ( v10 == 64 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_UNDEAD)) |
2073 { | 2061 { |
2074 v11 = MONSTER_SUPERTYPE_UNDEAD; | 2062 v9 *= 2; |
2075 goto LABEL_17; | 2063 } |
2076 } | 2064 else if ( v10 == 39 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_KREEGAN)) |
2077 if ( v10 == 39 ) | 2065 { |
2078 { | 2066 v9 *= 2; |
2079 v13 = MONSTER_SUPERTYPE_KREEGAN; | 2067 } |
2080 goto LABEL_16; | 2068 else if ( v10 == 40 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_DRAGON)) |
2081 } | 2069 { |
2082 if ( v10 == 40 ) | 2070 v9 *= 2; |
2083 { | 2071 } |
2084 v13 = MONSTER_SUPERTYPE_DRAGON; | 2072 else if ( v10 == 63 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_ELF)) |
2085 goto LABEL_16; | 2073 { |
2086 } | 2074 v9 *= 2; |
2087 if ( v10 == 63 ) | 2075 } |
2088 { | 2076 } |
2089 v13 = MONSTER_SUPERTYPE_ELF; | |
2090 LABEL_16: | |
2091 v11 = v13; | |
2092 LABEL_17: | |
2093 if ( MonsterStats::BelongsToSupertype(a2, v11) ) | |
2094 v9 *= 2; | |
2095 goto LABEL_19; | |
2096 } | |
2097 } | |
2098 LABEL_19: | |
2099 return v9 + this->GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS); | 2077 return v9 + this->GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS); |
2100 } | 2078 } |
2101 | 2079 |
2102 //----- (0048D2EA) -------------------------------------------------------- | 2080 //----- (0048D2EA) -------------------------------------------------------- |
2103 char *Player::GetMeleeDamageString() | 2081 char *Player::GetMeleeDamageString() |