Mercurial > mm7
changeset 1875:1d9e4b50bc7c
Actor::_43B3E0_CalcDamage cleaned up, fixed actor buff enums and added 2 values
author | Grumpy7 |
---|---|
date | Thu, 17 Oct 2013 08:55:28 +0200 |
parents | a6276dda8804 |
children | 2070d01ccfae |
files | Actor.cpp Actor.h Player.cpp |
diffstat | 3 files changed, 58 insertions(+), 72 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Thu Oct 17 07:57:01 2013 +0200 +++ b/Actor.cpp Thu Oct 17 08:55:28 2013 +0200 @@ -1347,25 +1347,25 @@ case 1: if ( a3 ) { - pOtherOverlayList->_4418B6(904, v4, 0, (sub_43AE12(a3) * 65536.0), 0); + pOtherOverlayList->_4418B6(904, v4, 0, (int)(sub_43AE12(a3) * 65536.0), 0); } return; case 2: if ( a3 ) { - pOtherOverlayList->_4418B6(905, v4, 0, (sub_43AE12(a3) * 65536.0), 0); + pOtherOverlayList->_4418B6(905, v4, 0, (int)(sub_43AE12(a3) * 65536.0), 0); } return; case 3: if ( a3 ) { - pOtherOverlayList->_4418B6(906, v4, 0, (sub_43AE12(a3) * 65536.0), 0); + pOtherOverlayList->_4418B6(906, v4, 0, (int)(sub_43AE12(a3) * 65536.0), 0); } return; case 4: if ( a3 ) { - pOtherOverlayList->_4418B6(907, v4, 0, (sub_43AE12(a3) * 65536.0), 0); + pOtherOverlayList->_4418B6(907, v4, 0, (int)(sub_43AE12(a3) * 65536.0), 0); } return; case 5: @@ -1393,13 +1393,12 @@ } //----- (0043B3E0) -------------------------------------------------------- -int Actor::_43B3E0_CalcDamage(Actor *a1, signed int a2) +int Actor::_43B3E0_CalcDamage(Actor *a1, signed int dmgSource) { signed int v2; // ebp@1 int v3; // eax@9 signed int v4; // edi@9 int v5; // esi@9 - int v6; // ebx@11 unsigned __int16 v8; // si@21 int v9; // edi@21 signed int v10; // eax@23 @@ -1407,61 +1406,47 @@ v2 = 0; v11 = 0; - if ( a2 ) + + switch( dmgSource ) { - if ( a2 == 1 ) - { + case 0: + if ( a1->pActorBuffs[14].uExpireTime > 0 ) + v2 = a1->pActorBuffs[14].uPower; + if ( a1->pActorBuffs[18].uExpireTime > 0 && a1->pActorBuffs[18].uPower > v2 ) + v2 = a1->pActorBuffs[18].uPower; + if ( a1->pActorBuffs[21].uExpireTime > 0 ) + v2 += a1->pActorBuffs[21].uPower; + v3 = a1->pMonsterInfo.uAttack1DamageDiceRolls; + v4 = a1->pMonsterInfo.uAttack1DamageDiceSides; + v5 = a1->pMonsterInfo.uAttack1DamageBonus; + break; + case 1: v3 = a1->pMonsterInfo.uAttack2DamageDiceRolls; v4 = a1->pMonsterInfo.uAttack2DamageDiceSides; v5 = a1->pMonsterInfo.uAttack2DamageBonus; - } - else - { - if ( a2 <= 1 ) - return 0; - if ( a2 <= 3 ) - { - if ( a2 == 2 ) - { - v8 = a1->pMonsterInfo.uSpellSkillAndMastery1; - v9 = a1->pMonsterInfo.uSpell1ID; - } - else - { - v8 = a1->pMonsterInfo.uSpellSkillAndMastery2; - v9 = a1->pMonsterInfo.uSpell2ID; - } - v10 = SkillToMastery(v8); - return _43AFE3_calc_spell_damage(v9, v8 & 0x3F, v10, 0); - } - if ( a2 != 4 ) - return 0; + break; + case 2: + v8 = a1->pMonsterInfo.uSpellSkillAndMastery1; + v9 = a1->pMonsterInfo.uSpell1ID; + v10 = SkillToMastery(v8); + return _43AFE3_calc_spell_damage(v9, v8 & 0x3F, v10, 0); + break; + case 3: + v8 = a1->pMonsterInfo.uSpellSkillAndMastery2; + v9 = a1->pMonsterInfo.uSpell2ID; + v10 = SkillToMastery(v8); + return _43AFE3_calc_spell_damage(v9, v8 & 0x3F, v10, 0); + break; + case 4: v3 = a1->pMonsterInfo.uSpecialAbilityDamageDiceRolls; v4 = a1->pMonsterInfo.uSpecialAbilityDamageDiceSides; v5 = a1->pMonsterInfo.uSpecialAbilityDamageDiceBonus; - } + default: + return 0; } - else + for ( int i = 0; i < v3; i++) { - if ( (signed __int64)a1->pActorBuffs[14].uExpireTime > 0 ) - v2 = a1->pActorBuffs[14].uPower; - if ( (signed __int64)a1->pActorBuffs[18].uExpireTime > 0 && a1->pActorBuffs[18].uPower > v2 ) - v2 = a1->pActorBuffs[18].uPower; - if ( (signed __int64)a1->pActorBuffs[21].uExpireTime > 0 ) - v2 += a1->pActorBuffs[21].uPower; - v3 = a1->pMonsterInfo.uAttack1DamageDiceRolls; - v4 = a1->pMonsterInfo.uAttack1DamageDiceSides; - v5 = a1->pMonsterInfo.uAttack1DamageBonus; - } - if ( v3 > 0 ) - { - v6 = v3; - do - { - --v6; - v11 += rand() % v4 + 1; - } - while ( v6 ); + v11 += rand() % v4 + 1; } return v11 + v5 + v2; }
--- a/Actor.h Thu Oct 17 07:57:01 2013 +0200 +++ b/Actor.h Thu Oct 17 08:55:28 2013 +0200 @@ -45,20 +45,21 @@ ACTOR_BUFF_AFRAID = 4, ACTOR_BUFF_STONED = 5, ACTOR_BUFF_PARALYZED = 6, - - ACTOR_BUFF_BERSERK = 8, - - ACTOR_BUFF_FATE = 10, - ACTOR_BUFF_ENSLAVED = 11, - ACTOR_BUFF_DAY_OF_PROTECTION = 12, - ACTOR_BUFF_HOUR_OF_POWER = 13, - ACTOR_BUFF_SHIELD = 14, - ACTOR_BUFF_STONESKIN = 15, - ACTOR_BUFF_BLESS = 16, - ACTOR_BUFF_HEROISM = 17, - ACTOR_BUFF_HASTE = 18, - ACTOR_BUFF_PAIN_REFLECTION = 19, - ACTOR_BUFF_PAIN_HAMMERHANDS = 20, + ACTOR_BUFF_SLOWED = 7, + ACTOR_BUFF_SOMETHING_THAT_HALVES_AC = 8, + ACTOR_BUFF_BERSERK = 9, + ACTOR_BUFF_MASS_DISTORTION = 10, + ACTOR_BUFF_FATE = 11, + ACTOR_BUFF_ENSLAVED = 12, + ACTOR_BUFF_DAY_OF_PROTECTION = 13, + ACTOR_BUFF_HOUR_OF_POWER = 14, + ACTOR_BUFF_SHIELD = 15, + ACTOR_BUFF_STONESKIN = 16, + ACTOR_BUFF_BLESS = 17, + ACTOR_BUFF_HEROISM = 18, + ACTOR_BUFF_HASTE = 19, + ACTOR_BUFF_PAIN_REFLECTION = 20, + ACTOR_BUFF_PAIN_HAMMERHANDS = 21, };
--- a/Player.cpp Thu Oct 17 07:57:01 2013 +0200 +++ b/Player.cpp Thu Oct 17 08:55:28 2013 +0200 @@ -7246,7 +7246,7 @@ //----- (00439FCB) -------------------------------------------------------- -void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int element, Vec3_int_ *pPos, unsigned int a4) +void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int dmgSource, Vec3_int_ *pPos, unsigned int a4) { Player *playerPtr; // ebx@3 Actor *actorPtr; // esi@3 @@ -7297,7 +7297,7 @@ } } pAudioPlayer->PlaySound(soundToPlay, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); - int dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, element); + int dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, dmgSource); if ( actorPtr->pActorBuffs[3].uExpireTime > 0 ) { __int16 spellPower = actorPtr->pActorBuffs[3].uPower; @@ -7305,7 +7305,7 @@ dmgToReceive /= (signed int)spellPower; } int damageType; - switch (element) + switch (dmgSource) { case 0: damageType = actorPtr->pMonsterInfo.uAttack1Type; break; @@ -7437,7 +7437,7 @@ if ( a4 == -1 ) a4 = stru_50C198.which_player_would_attack(actorPtr); Player *playerPtr = &pParty->pPlayers[a4]; - int dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, element); + int dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, dmgSource); unsigned __int16 spriteType = v37->uType; if ( v37->uType == 545 ) { @@ -7492,7 +7492,7 @@ dmgToReceive /= (signed int)spellPower; } int damageType; - switch(element) + switch(dmgSource) { case 0: damageType = actorPtr->pMonsterInfo.uAttack1Type; @@ -7553,7 +7553,7 @@ } } } - if ( !element + if ( !dmgSource && !(dword_6BE368_debug_settings_2 & 0x10) && actorPtr->pMonsterInfo.uSpecialAttackType && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackLevel )