Mercurial > mm7
changeset 2301:df24d11208df
stru319::DoesDmgTypeDoDamage moved to Actor class
author | Grumpy7 |
---|---|
date | Sun, 16 Mar 2014 20:28:44 +0100 |
parents | 4c3f91554be8 |
children | 2b65eb263ceb |
files | Actor.cpp Actor.h CastSpellInfo.cpp SpriteObject.cpp mm7_2.cpp mm7_6.cpp |
diffstat | 6 files changed, 61 insertions(+), 60 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Sun Mar 16 19:58:02 2014 +0100 +++ b/Actor.cpp Sun Mar 16 20:28:44 2014 +0100 @@ -3643,7 +3643,7 @@ && uDamageAmount != 0 ) player->ReceiveDamage(uDamageAmount, attackElement); int knockbackValue = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP; - if ( (player->GetSpecialItemBonus(24) || hit_will_stun) && stru_50C198.DoesDmgTypeDoDamage(pMonster, DMGT_EARTH) ) + if ( (player->GetSpecialItemBonus(24) || hit_will_stun) && pMonster->DoesDmgTypeDoDamage(DMGT_EARTH) ) { extraRecoveryTime = 20; knockbackValue = 10; @@ -3657,7 +3657,7 @@ ShowStatusBarString(pTmpBuf.data(), 2u); } } - if ( hit_will_paralyze && pMonster->CanAct() && stru_50C198.DoesDmgTypeDoDamage(pMonster, DMGT_EARTH)) + if ( hit_will_paralyze && pMonster->CanAct() && pMonster->DoesDmgTypeDoDamage(DMGT_EARTH)) { v43 = player->GetActualSkillLevel(PLAYER_SKILL_MACE); v45 = SkillToMastery(v43); @@ -4246,6 +4246,54 @@ result = 0; return result; } + +//----- (00427662) -------------------------------------------------------- +bool Actor::DoesDmgTypeDoDamage(DAMAGE_TYPE uType) +{ + signed int resist; // esi@2 + bool result; // eax@13 + + switch ( uType ) + { + case 0: + resist = this->pMonsterInfo.uResFire; + break; + case 1: + resist = this->pMonsterInfo.uResAir; + break; + case 2: + resist = this->pMonsterInfo.uResWater; + break; + case 3: + resist = this->pMonsterInfo.uResEarth; + break; + case 4: + resist = this->pMonsterInfo.uResPhysical; + break; + case 6: + resist = this->pMonsterInfo.uResSpirit; + break; + case 7: + resist = this->pMonsterInfo.uResMind; + case 8: + resist = this->pMonsterInfo.uResBody; + break; + case 9: + resist = this->pMonsterInfo.uResLight; + break; + case 10: + resist = this->pMonsterInfo.uResDark; + break; + default: + return 1; + } + if ( resist < 200 ) + result = rand() % ((this->pMonsterInfo.uLevel >> 2) + resist + 30) < 30; + else + result = 0; + return result; +} + //----- (00448A98) -------------------------------------------------------- void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle) {
--- a/Actor.h Sun Mar 16 19:58:02 2014 +0100 +++ b/Actor.h Sun Mar 16 20:28:44 2014 +0100 @@ -14,7 +14,6 @@ { int which_player_to_attack(struct Actor *pActor); int _427546(int a2); - bool DoesDmgTypeDoDamage(struct Actor *pActor, unsigned int uType); int FindClosestActor(int a2, int a3, int a4); char field_0; @@ -237,6 +236,7 @@ bool _4273BB_DoesHitOtherActor(Actor *defender, int a3, int a4); bool ActorHitOrMiss(Player *pPlayer); int CalcMagicalDamageToActor(DAMAGE_TYPE dmgType, signed int incomingDmg); + bool DoesDmgTypeDoDamage(DAMAGE_TYPE uType); char pActorName[32]; signed __int16 sNPC_ID;
--- a/CastSpellInfo.cpp Sun Mar 16 19:58:02 2014 +0100 +++ b/CastSpellInfo.cpp Sun Mar 16 20:28:44 2014 +0100 @@ -439,7 +439,7 @@ mon_id = PID_ID(a2); if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - if ( stru_50C198.DoesDmgTypeDoDamage(&pActors[mon_id], 3) ) + if ( pActors[mon_id].DoesDmgTypeDoDamage((DAMAGE_TYPE)3) ) { pActors[mon_id].pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); v704.x = 0; @@ -622,7 +622,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; mon_id = PID_ID(a2); - if (PID_TYPE(a2) == OBJECT_Actor && stru_50C198.DoesDmgTypeDoDamage(&pActors[mon_id], 9) ) + if (PID_TYPE(a2) == OBJECT_Actor && pActors[mon_id].DoesDmgTypeDoDamage((DAMAGE_TYPE)9) ) { Actor::AI_Stand(PID_ID(a2), 4, 0x80, 0); pActors[mon_id].pActorBuffs[ACTOR_BUFF_PARALYZED].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)23040 * spell_level * 0.033333335), skill_level, 0, 0, 0); @@ -649,7 +649,7 @@ break; //v721 = 836 * PID_ID(a2); mon_id = PID_ID(a2); - if (PID_TYPE(a2) == OBJECT_Actor && stru_50C198.DoesDmgTypeDoDamage(&pActors[mon_id], 3) ) + if (PID_TYPE(a2) == OBJECT_Actor && pActors[mon_id].DoesDmgTypeDoDamage((DAMAGE_TYPE)3) ) { pActors[mon_id].pActorBuffs[ACTOR_BUFF_SLOWED].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)23040 * spell_level * 0.033333335), skill_level, amount, 0, 0); pActors[mon_id].uAttributes |= 0x80000; @@ -663,7 +663,7 @@ v61 = PID_ID(a2); if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - if ( stru_50C198.DoesDmgTypeDoDamage(&pActors[v61], 7) ) + if ( pActors[v61].DoesDmgTypeDoDamage((DAMAGE_TYPE)7) ) { uint power = 300 * spell_level; if ( skill_level == 2 ) @@ -2219,7 +2219,7 @@ if (PID_TYPE(a2) == OBJECT_Actor) { //v730 = 836 * mon_id; - if ( stru_50C198.DoesDmgTypeDoDamage(&pActors[mon_id], 7) ) + if ( pActors[mon_id].DoesDmgTypeDoDamage((DAMAGE_TYPE)7) ) { pActors[mon_id].pActorBuffs[ACTOR_BUFF_CHARM].Reset(); pActors[mon_id].pActorBuffs[ACTOR_BUFF_ENSLAVED].Reset(); @@ -2259,7 +2259,7 @@ //v730 = 836 * mon_id; if ( MonsterStats::BelongsToSupertype(pActors[mon_id].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) break; - if ( stru_50C198.DoesDmgTypeDoDamage(&pActors[mon_id], 7) ) + if ( pActors[mon_id].DoesDmgTypeDoDamage((DAMAGE_TYPE)7) ) { pActors[mon_id].pActorBuffs[ACTOR_BUFF_BERSERK].Reset(); pActors[mon_id].pActorBuffs[ACTOR_BUFF_CHARM].Reset(); @@ -2320,7 +2320,7 @@ pSpellSprite.vPosition.z = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.z - (unsigned int)(signed __int64)((double)pActors[_50BF30_actors_in_viewport_ids[a2]].uActorHeight * -0.8); pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]); pSpellSprite.Create(0, 0, 0, 0); - if ( stru_50C198.DoesDmgTypeDoDamage(&pActors[_50BF30_actors_in_viewport_ids[a2]], 7) ) + if ( pActors[_50BF30_actors_in_viewport_ids[a2]].DoesDmgTypeDoDamage((DAMAGE_TYPE)7) ) { pActors[_50BF30_actors_in_viewport_ids[a2]].pActorBuffs[ACTOR_BUFF_AFRAID].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), skill_level, 0, 0, 0); @@ -3006,7 +3006,7 @@ mon_id = PID_ID(a2); if ( !MonsterStats::BelongsToSupertype(pActors[mon_id].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) break; - if ( !stru_50C198.DoesDmgTypeDoDamage(&pActors[mon_id], 10) ) + if ( !pActors[mon_id].DoesDmgTypeDoDamage((DAMAGE_TYPE)10) ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
--- a/SpriteObject.cpp Sun Mar 16 19:58:02 2014 +0100 +++ b/SpriteObject.cpp Sun Mar 16 20:28:44 2014 +0100 @@ -1032,7 +1032,7 @@ if ( v11 >= v7 * v7 + v9 * v9 + v10 * v10 ) { - if ( stru_50C198.DoesDmgTypeDoDamage(&pActors[i], 0xAu) ) + if ( pActors[i].DoesDmgTypeDoDamage((DAMAGE_TYPE)0xAu) ) { pActors[i].pActorBuffs[this->spell_id].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(this->spell_level << 7) * 0.033333335), this->spell_skill, 4, 0, 0);
--- a/mm7_2.cpp Sun Mar 16 19:58:02 2014 +0100 +++ b/mm7_2.cpp Sun Mar 16 20:28:44 2014 +0100 @@ -4343,7 +4343,7 @@ if ( pSpriteObjects[uLayingItemID].uType != 9030 || v152 != 4 ) { v108 = v139; - if ( stru_50C198.DoesDmgTypeDoDamage(&pActors[v139], v107) ) + if ( pActors[v139].DoesDmgTypeDoDamage((DAMAGE_TYPE)v107) ) { v138 = 0; if ( pSpriteObjects[uLayingItemID].uType == 8030 )
--- a/mm7_6.cpp Sun Mar 16 19:58:02 2014 +0100 +++ b/mm7_6.cpp Sun Mar 16 20:28:44 2014 +0100 @@ -59,53 +59,6 @@ return result; } -//----- (00427662) -------------------------------------------------------- -bool stru319::DoesDmgTypeDoDamage(Actor *pActor, unsigned int uType) -{ - signed int resist; // esi@2 - bool result; // eax@13 - - switch ( uType ) - { - case 0: - resist = pActor->pMonsterInfo.uResFire; - break; - case 1: - resist = pActor->pMonsterInfo.uResAir; - break; - case 2: - resist = pActor->pMonsterInfo.uResWater; - break; - case 3: - resist = pActor->pMonsterInfo.uResEarth; - break; - case 4: - resist = pActor->pMonsterInfo.uResPhysical; - break; - case 6: - resist = pActor->pMonsterInfo.uResSpirit; - break; - case 7: - resist = pActor->pMonsterInfo.uResMind; - case 8: - resist = pActor->pMonsterInfo.uResBody; - break; - case 9: - resist = pActor->pMonsterInfo.uResLight; - break; - case 10: - resist = pActor->pMonsterInfo.uResDark; - break; - default: - return 1; - } - if ( resist < 200 ) - result = rand() % (signed int)(((unsigned int)pActor->pMonsterInfo.uLevel >> 2) + resist + 30) < 30; - else - result = 0; - return result; -} - //----- (0042EB8D) -------------------------------------------------------- void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) {