Mercurial > mm7
changeset 1605:434b796cdfd3
Player::GetMagicalBonus cleaned up, identified a few player only effect spells used in mm6
author | Grumpy7 |
---|---|
date | Sat, 14 Sep 2013 06:46:12 +0200 |
parents | 4b79ff62df3a |
children | aaefada3e1d8 8e3c6d7631f1 |
files | Player.cpp Player.h UI/UiGame.cpp |
diffstat | 3 files changed, 95 insertions(+), 102 deletions(-) [+] |
line wrap: on
line diff
--- a/Player.cpp Sat Sep 14 06:04:18 2013 +0200 +++ b/Player.cpp Sat Sep 14 06:46:12 2013 +0200 @@ -2764,7 +2764,7 @@ } uint hasteRecoveryReduction = 0; - if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0 || pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0 ) + if (pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime > 0 || pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0 ) hasteRecoveryReduction = 25; uint weapon_enchantment_recovery_reduction = 0; @@ -3393,99 +3393,77 @@ //----- (0048F73C) -------------------------------------------------------- int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) { - int result; // eax@1 - int v3; // eax@4 - int v4; // ecx@5 - - switch (a2) - { - case CHARACTER_ATTRIBUTE_LEVEL: return 0; - } - - result = 0; - if ( (signed int)a2 > 10 ) - { - if ( (signed int)a2 <= 15 ) - { - switch ( a2 ) - { - case CHARACTER_ATTRIBUTE_RESIST_BODY: - v3 = this->pPlayerBuffs[2].uPower; - v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower; - break; - case CHARACTER_ATTRIBUTE_RESIST_AIR: - v3 = this->pPlayerBuffs[0].uPower; - v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower; - break; - case CHARACTER_ATTRIBUTE_RESIST_WATER: - v3 = this->pPlayerBuffs[22].uPower; - v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower; - break; - case CHARACTER_ATTRIBUTE_RESIST_EARTH: - v3 = this->pPlayerBuffs[3].uPower; - v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower; - break; - default: - if ( a2 != 14 ) - return result; - v3 = this->pPlayerBuffs[9].uPower; - v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower; - break; - } - return v4 + v3; - } - if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) - { - if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) - { - v3 = this->pPlayerBuffs[8].uPower; - v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower; - return v4 + v3; - } - if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) - return result; - } - return this->pPlayerBuffs[1].uPower; - } - if ( a2 == 10 ) - { - v3 = this->pPlayerBuffs[5].uPower; - v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower; - return v4 + v3; - } + int v3 = 0; // eax@4 + int v4 = 0; // ecx@5 + switch ( a2 ) { + case CHARACTER_ATTRIBUTE_RESIST_FIRE: + v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_FIRE].uPower; + v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower; + break; + case CHARACTER_ATTRIBUTE_RESIST_AIR: + v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_AIR].uPower; + v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower; + break; + case CHARACTER_ATTRIBUTE_RESIST_BODY: + v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_BODY].uPower; + v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower; + break; + case CHARACTER_ATTRIBUTE_RESIST_WATER: + v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_WATER].uPower; + v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower; + break; + case CHARACTER_ATTRIBUTE_RESIST_EARTH: + v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_EARTH].uPower; + v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower; + break; + case CHARACTER_ATTRIBUTE_RESIST_MIND: + v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_MIND].uPower; + v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower; + break; + case CHARACTER_ATTRIBUTE_ATTACK: + case CHARACTER_ATTRIBUTE_RANGED_ATTACK: + v3 = this->pPlayerBuffs[PLAYER_BUFF_BLESS].uPower; //only player effect spell in both VI and VII + break; + case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS: + v3 = this->pPlayerBuffs[PLAYER_BUFF_HEROISM].uPower; + v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower; + break; case CHARACTER_ATTRIBUTE_STRENGTH: - v3 = pPlayerBuffs[19].uPower; - goto LABEL_5; + v3 = pPlayerBuffs[PLAYER_BUFF_STRENGTH].uPower; + v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; + break; case CHARACTER_ATTRIBUTE_INTELLIGENCE: - v3 = pPlayerBuffs[17].uPower; - goto LABEL_5; + v3 = pPlayerBuffs[PLAYER_BUFF_INTELLIGENCE].uPower; + v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; + break; case CHARACTER_ATTRIBUTE_WILLPOWER: - v3 = pPlayerBuffs[20].uPower; - goto LABEL_5; + v3 = pPlayerBuffs[PLAYER_BUFF_WILLPOWER].uPower; + v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; + break; case CHARACTER_ATTRIBUTE_ENDURANCE: - v3 = pPlayerBuffs[16].uPower; - goto LABEL_5; + v3 = pPlayerBuffs[PLAYER_BUFF_ENDURANCE].uPower; + v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; + break; case CHARACTER_ATTRIBUTE_ACCURACY: - v3 = pPlayerBuffs[15].uPower; - goto LABEL_5; + v3 = pPlayerBuffs[PLAYER_BUFF_ACCURACY].uPower; + v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; + break; case CHARACTER_ATTRIBUTE_SPEED: - v3 = pPlayerBuffs[21].uPower; - goto LABEL_5; + v3 = pPlayerBuffs[PLAYER_BUFF_SPEED].uPower; + v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; + break; case CHARACTER_ATTRIBUTE_LUCK: - v3 = pPlayerBuffs[18].uPower; -LABEL_5: + v3 = pPlayerBuffs[PLAYER_BUFF_LUCK].uPower; v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; - return v4 + v3; + break; case CHARACTER_ATTRIBUTE_AC_BONUS: - v3 = this->pPlayerBuffs[14].uPower; + v3 = this->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uPower; v4 = pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].uPower; - return v4 + v3; - default: - return result; - } - return result; + break; + } + return v3 + v4; } //----- (0048F882) --------------------------------------------------------
--- a/Player.h Sat Sep 14 06:04:18 2013 +0200 +++ b/Player.h Sat Sep 14 06:46:12 2013 +0200 @@ -5,17 +5,32 @@ - -#define PLAYER_BUFF_BLESS 1 -#define PLAYER_BUFF_FATE 4 -#define PLAYER_BUFF_HAMMERHANDS 6 -#define PLAYER_BUFF_7 7 -#define PLAYER_BUFF_8 8 -#define PLAYER_BUFF_PAIN_REFLECTION 10 -#define PLAYER_BUFF_PRESERVATION 11 -#define PLAYER_BUFF_REGENERATION 12 -#define PLAYER_BUFF_13 13 -#define PLAYER_BUFF_14 14 +enum PLAYER_BUFFS +{ + PLAYER_BUFF_RESIST_AIR = 0, + PLAYER_BUFF_BLESS = 1, + PLAYER_BUFF_RESIST_BODY = 2, + PLAYER_BUFF_RESIST_EARTH = 3, + PLAYER_BUFF_FATE = 4, + PLAYER_BUFF_RESIST_FIRE = 3, + PLAYER_BUFF_HAMMERHANDS = 6, + PLAYER_BUFF_HASTE = 7, + PLAYER_BUFF_HEROISM = 8, + PLAYER_BUFF_RESIST_MIND = 9, + PLAYER_BUFF_PAIN_REFLECTION = 10, + PLAYER_BUFF_PRESERVATION = 11, + PLAYER_BUFF_REGENERATION = 12, + PLAYER_BUFF_13 = 13, + PLAYER_BUFF_STONESKIN = 14, + PLAYER_BUFF_ACCURACY = 15, + PLAYER_BUFF_ENDURANCE = 16, + PLAYER_BUFF_INTELLIGENCE = 17, + PLAYER_BUFF_LUCK = 18, + PLAYER_BUFF_STRENGTH = 19, + PLAYER_BUFF_WILLPOWER = 20, + PLAYER_BUFF_SPEED = 21, + PLAYER_BUFF_RESIST_WATER = 22 +}; #define PLAYER_GUILD_BITS__SPIRIT_MEMBERSHIP 58
--- a/UI/UiGame.cpp Sat Sep 14 06:04:18 2013 +0200 +++ b/UI/UiGame.cpp Sat Sep 14 06:46:12 2013 +0200 @@ -1742,9 +1742,9 @@ pRenderer->_4A6E7E(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); else pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); - if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_7].uExpireTime - | pPlayer->pPlayerBuffs[PLAYER_BUFF_8].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_13].uExpireTime - | pPlayer->pPlayerBuffs[PLAYER_BUFF_14].uExpireTime ) + if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_HEROISM].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_13].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uExpireTime ) sub_441A4E(i); continue; } @@ -1755,9 +1755,9 @@ pRenderer->_4A6E7E(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); else pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); - if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_7].uExpireTime - | pPlayer->pPlayerBuffs[PLAYER_BUFF_8].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_13].uExpireTime - | pPlayer->pPlayerBuffs[PLAYER_BUFF_14].uExpireTime ) + if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_HEROISM].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_13].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uExpireTime ) sub_441A4E(i); continue; } @@ -1782,9 +1782,9 @@ pRenderer->_4A6E7E(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); else pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); - if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_7].uExpireTime - | pPlayer->pPlayerBuffs[PLAYER_BUFF_8].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_13].uExpireTime - | pPlayer->pPlayerBuffs[PLAYER_BUFF_14].uExpireTime ) + if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_HEROISM].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_13].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uExpireTime ) sub_441A4E(i); continue; }