Mercurial > mm7
comparison Player.cpp @ 1549:5a3afcaa6717
Player::CalculateMeleeDamageTo removed labels, ifdowhile patterns changed to for cycles, magic numbers to enum values, fixing gibbet being only undead slaying
author | Grumpy7 |
---|---|
date | Sat, 07 Sep 2013 09:16:55 +0200 |
parents | 778916dfa666 |
children | cdb7fafede0c |
comparison
equal
deleted
inserted
replaced
1548:2ae7139dde11 | 1549:5a3afcaa6717 |
---|---|
1902 v4 = 0; | 1902 v4 = 0; |
1903 v5 = this; | 1903 v5 = this; |
1904 v34 = 0; | 1904 v34 = 0; |
1905 v32 = 0; | 1905 v32 = 0; |
1906 v28 = 0; | 1906 v28 = 0; |
1907 if ( IsUnarmed() == 1 ) | 1907 if ( IsUnarmed() ) |
1908 { | 1908 { |
1909 v32 = rand() % 3 + 1; | 1909 v32 = rand() % 3 + 1; |
1910 LABEL_61: | 1910 LABEL_61: |
1911 v34 = v4; | 1911 v34 = v4; |
1912 goto LABEL_62; | 1912 } |
1913 } | 1913 else |
1914 { | |
1914 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | 1915 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
1915 { | 1916 { |
1916 v6 = (ItemGen *)&v5->pInventoryItemList[v5->pEquipment.uMainHand-1]; | 1917 v6 = &this->pInventoryItemList[v5->pEquipment.uMainHand-1]; |
1917 v7 = v6->uItemID; | 1918 v7 = v6->uItemID; |
1918 v8 = v6->uItemID; | 1919 v9 = pItemsTable->pItems[v7].uDamageDice; |
1919 v9 = pItemsTable->pItems[v8].uDamageDice; | 1920 if ( pItemsTable->pItems[v7].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uShield ) |
1920 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uShield ) | |
1921 ++v9; | 1921 ++v9; |
1922 v30 = pItemsTable->pItems[v8].uDamageRoll; | 1922 v30 = pItemsTable->pItems[v7].uDamageRoll; |
1923 if ( v9 > 0 ) | 1923 for (int i = 0; i < v9; i++) |
1924 { | |
1925 v33 = v9; | |
1926 do | |
1927 { | 1924 { |
1928 v10 = rand(); | 1925 v10 = rand(); |
1929 v11 = v33-- == 1; | |
1930 v28 += v10 % v30 + 1; | 1926 v28 += v10 % v30 + 1; |
1931 } | 1927 } |
1932 while ( !v11 ); | 1928 v12 = pItemsTable->pItems[v7].uDamageMod + v28; |
1933 } | 1929 if ( uTargetActorID > 0) |
1934 v12 = pItemsTable->pItems[v8].uDamageMod + v28; | 1930 { |
1935 if ( !uTargetActorID ) | |
1936 goto LABEL_28; | |
1937 v13 = v6->uSpecEnchantmentType; | 1931 v13 = v6->uSpecEnchantmentType; |
1938 if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) | 1932 if ( MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_UNDEAD) && (v13 == 64 || v7 == ITEM_ARTIFACT_GHOULSBANE || v7 == ITEM_ARTIFACT_GIBBET || v7 == ITEM_RELIC_JUSTICE) ) |
1939 { | |
1940 v14 = (MONSTER_SUPERTYPE)1; | |
1941 } | |
1942 else | |
1943 { | |
1944 if ( v13 == 39 ) | |
1945 { | |
1946 v26 = MONSTER_SUPERTYPE_KREEGAN; | |
1947 } | |
1948 else | |
1949 { | |
1950 if ( v13 == 40 ) | |
1951 { | 1933 { |
1952 v26 = MONSTER_SUPERTYPE_DRAGON; | 1934 v12 *= 2; |
1953 } | 1935 } |
1954 else | 1936 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_KREEGAN) && ( v13 == 39 || v7 == ITEM_ARTIFACT_GIBBET)) |
1955 { | 1937 { |
1956 if ( v13 == 63 || v7 == 517 ) | 1938 v12 *= 2; |
1957 { | 1939 } |
1958 v26 = MONSTER_SUPERTYPE_ELF; | 1940 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_DRAGON) && ( v13 == 40 || v7 == ITEM_ARTIFACT_GIBBET)) |
1959 } | 1941 { |
1960 else | 1942 v12 *= 2; |
1961 { | 1943 } |
1962 if ( v13 != 65 ) | 1944 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_TITAN) && ( v13 == 65 )) |
1963 { | 1945 { |
1964 LABEL_28: | 1946 v12 *= 2; |
1947 } | |
1948 } | |
1965 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 | 1949 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 |
1966 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 | 1950 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 |
1967 && rand() % 100 < 10 ) | 1951 && rand() % 100 < 10 ) |
1968 v12 *= 3; | 1952 v12 *= 3; |
1969 v32 = v12; | 1953 v32 = v12; |
1970 goto LABEL_33; | 1954 } |
1971 } | |
1972 v26 = MONSTER_SUPERTYPE_TITAN; | |
1973 } | |
1974 } | |
1975 } | |
1976 v14 = v26; | |
1977 } | |
1978 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) | |
1979 v12 *= 2; | |
1980 goto LABEL_28; | |
1981 } | |
1982 LABEL_33: | |
1983 v29 = 0; | 1955 v29 = 0; |
1984 if ( !a3 ) | 1956 if ( !a3 ) |
1985 { | 1957 { |
1986 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | 1958 if ( v5->HasItemEquipped(EQUIP_OFF_HAND) ) |
1987 { | 1959 { |
1988 v15 = (ItemGen *)&v5->pInventoryItemList[v5->pEquipment.uShield - 1]; | 1960 v15 = (ItemGen *)&v5->pInventoryItemList[v5->pEquipment.uShield - 1]; |
1989 v16 = v15->uItemID; | 1961 v16 = v15->uItemID; |
1990 v17 = v15->uItemID; | 1962 if ( pItemsTable->pItems[v16].uEquipType != EQUIP_SHIELD ) |
1991 if ( pItemsTable->pItems[v17].uEquipType != 4 ) | |
1992 { | |
1993 v31 = pItemsTable->pItems[v17].uDamageRoll; | |
1994 if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) | |
1995 { | 1963 { |
1996 v35 = pItemsTable->pItems[v17].uDamageDice; | 1964 v31 = pItemsTable->pItems[v16].uDamageRoll; |
1997 do | 1965 v35 = pItemsTable->pItems[v16].uDamageDice; |
1966 for (int i = 0; i < v35; i++) | |
1998 { | 1967 { |
1999 v18 = rand() % v31; | 1968 v10 = rand(); |
2000 v11 = v35-- == 1; | 1969 v29 += v10 % v31 + 1; |
2001 v29 += v18 + 1; | |
2002 } | 1970 } |
2003 while ( !v11 ); | 1971 v4 = pItemsTable->pItems[v16].uDamageMod + v29; |
2004 } | 1972 if ( uTargetActorID > 0) |
2005 v4 = pItemsTable->pItems[v17].uDamageMod + v29; | 1973 { |
2006 if ( !uTargetActorID ) | |
2007 goto LABEL_57; | |
2008 v19 = v15->uSpecEnchantmentType; | 1974 v19 = v15->uSpecEnchantmentType; |
2009 if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) | 1975 if ( MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_UNDEAD) && (v19 == 64 || v16 == ITEM_ARTIFACT_GHOULSBANE || v16 == ITEM_ARTIFACT_GIBBET || v16 == ITEM_RELIC_JUSTICE) ) |
2010 { | 1976 { |
2011 v20 = (MONSTER_SUPERTYPE)1; | 1977 v4 *= 2; |
2012 } | 1978 } |
2013 else | 1979 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_KREEGAN) && ( v19 == 39 || v16 == ITEM_ARTIFACT_GIBBET)) |
2014 { | 1980 { |
2015 if ( v19 == 39 ) | 1981 v4 *= 2; |
2016 { | 1982 } |
2017 v27 = MONSTER_SUPERTYPE_KREEGAN; | 1983 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_DRAGON) && ( v19 == 40 || v16 == ITEM_ARTIFACT_GIBBET)) |
1984 { | |
1985 v4 *= 2; | |
1986 } | |
1987 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_TITAN) && ( v19 == 65 )) | |
1988 { | |
1989 v4 *= 2; | |
1990 } | |
2018 } | 1991 } |
2019 else | |
2020 { | |
2021 if ( v19 == 40 ) | |
2022 { | |
2023 v27 = MONSTER_SUPERTYPE_DRAGON; | |
2024 } | |
2025 else | |
2026 { | |
2027 if ( v19 == 63 || v16 == 517 ) | |
2028 { | |
2029 v27 = MONSTER_SUPERTYPE_ELF; | |
2030 } | |
2031 else | |
2032 { | |
2033 if ( v19 != 65 ) | |
2034 { | |
2035 LABEL_57: | |
2036 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER | 1992 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER |
2037 && SkillToMastery(v5->pActiveSkills[2] >= 3u) | 1993 && SkillToMastery(v5->pActiveSkills[2] >= 3u) |
2038 && rand() % 100 < 10 ) | 1994 && rand() % 100 < 10 ) |
2039 v4 *= 3; | 1995 v4 *= 3; |
2040 goto LABEL_61; | |
2041 } | |
2042 v27 = MONSTER_SUPERTYPE_TITAN; | |
2043 } | |
2044 } | |
2045 } | |
2046 v20 = v27; | |
2047 } | 1996 } |
2048 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) | 1997 } |
2049 v4 *= 2; | 1998 } |
2050 goto LABEL_57; | 1999 } |
2051 } | |
2052 } | |
2053 } | |
2054 LABEL_62: | |
2055 v21 = v32 + v34; | 2000 v21 = v32 + v34; |
2056 if ( !a2 ) | 2001 if ( !a2 ) |
2057 { | 2002 { |
2058 v22 = GetActualMight(); | 2003 v22 = GetActualMight(); |
2059 v23 = GetParameterBonus(v22); | 2004 v23 = GetParameterBonus(v22); |
5371 return (PLAYER_SKILL_TYPE)i; | 5316 return (PLAYER_SKILL_TYPE)i; |
5372 ++counter; | 5317 ++counter; |
5373 } | 5318 } |
5374 } | 5319 } |
5375 | 5320 |
5376 assert(false); | 5321 return (PLAYER_SKILL_TYPE)37; |
5377 } | 5322 } |
5378 | 5323 |
5379 | 5324 |
5380 | 5325 |
5381 //----- (0049048D) -------------------------------------------------------- | 5326 //----- (0049048D) -------------------------------------------------------- |