comparison Player.cpp @ 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 351b4ff10ac1
children 2070d01ccfae
comparison
equal deleted inserted replaced
1874:a6276dda8804 1875:1d9e4b50bc7c
7244 } 7244 }
7245 7245
7246 7246
7247 7247
7248 //----- (00439FCB) -------------------------------------------------------- 7248 //----- (00439FCB) --------------------------------------------------------
7249 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int element, Vec3_int_ *pPos, unsigned int a4) 7249 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int dmgSource, Vec3_int_ *pPos, unsigned int a4)
7250 { 7250 {
7251 Player *playerPtr; // ebx@3 7251 Player *playerPtr; // ebx@3
7252 Actor *actorPtr; // esi@3 7252 Actor *actorPtr; // esi@3
7253 int spellId; // eax@38 7253 int spellId; // eax@38
7254 signed int recvdMagicDmg; // eax@139 7254 signed int recvdMagicDmg; // eax@139
7295 case 3 : soundToPlay = (SoundID)45; break; 7295 case 3 : soundToPlay = (SoundID)45; break;
7296 default: Error("Unexpected sound value"); 7296 default: Error("Unexpected sound value");
7297 } 7297 }
7298 } 7298 }
7299 pAudioPlayer->PlaySound(soundToPlay, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); 7299 pAudioPlayer->PlaySound(soundToPlay, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0);
7300 int dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, element); 7300 int dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, dmgSource);
7301 if ( actorPtr->pActorBuffs[3].uExpireTime > 0 ) 7301 if ( actorPtr->pActorBuffs[3].uExpireTime > 0 )
7302 { 7302 {
7303 __int16 spellPower = actorPtr->pActorBuffs[3].uPower; 7303 __int16 spellPower = actorPtr->pActorBuffs[3].uPower;
7304 if ( spellPower ) 7304 if ( spellPower )
7305 dmgToReceive /= (signed int)spellPower; 7305 dmgToReceive /= (signed int)spellPower;
7306 } 7306 }
7307 int damageType; 7307 int damageType;
7308 switch (element) 7308 switch (dmgSource)
7309 { 7309 {
7310 case 0: damageType = actorPtr->pMonsterInfo.uAttack1Type; 7310 case 0: damageType = actorPtr->pMonsterInfo.uAttack1Type;
7311 break; 7311 break;
7312 case 1: damageType = actorPtr->pMonsterInfo.uAttack2Type; 7312 case 1: damageType = actorPtr->pMonsterInfo.uAttack2Type;
7313 break; 7313 break;
7435 { 7435 {
7436 Actor *actorPtr = &pActors[uActorID]; 7436 Actor *actorPtr = &pActors[uActorID];
7437 if ( a4 == -1 ) 7437 if ( a4 == -1 )
7438 a4 = stru_50C198.which_player_would_attack(actorPtr); 7438 a4 = stru_50C198.which_player_would_attack(actorPtr);
7439 Player *playerPtr = &pParty->pPlayers[a4]; 7439 Player *playerPtr = &pParty->pPlayers[a4];
7440 int dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, element); 7440 int dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, dmgSource);
7441 unsigned __int16 spriteType = v37->uType; 7441 unsigned __int16 spriteType = v37->uType;
7442 if ( v37->uType == 545 ) 7442 if ( v37->uType == 545 )
7443 { 7443 {
7444 __int16 skillLevel = playerPtr->GetActualSkillLevel(PLAYER_SKILL_UNARMED); 7444 __int16 skillLevel = playerPtr->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
7445 if ( SkillToMastery(skillLevel) >= 4 && rand() % 100 < (skillLevel & 0x3F) ) 7445 if ( SkillToMastery(skillLevel) >= 4 && rand() % 100 < (skillLevel & 0x3F) )
7490 int spellPower = actorPtr->pActorBuffs[3].uPower; 7490 int spellPower = actorPtr->pActorBuffs[3].uPower;
7491 if ( spellPower ) 7491 if ( spellPower )
7492 dmgToReceive /= (signed int)spellPower; 7492 dmgToReceive /= (signed int)spellPower;
7493 } 7493 }
7494 int damageType; 7494 int damageType;
7495 switch(element) 7495 switch(dmgSource)
7496 { 7496 {
7497 case 0: 7497 case 0:
7498 damageType = actorPtr->pMonsterInfo.uAttack1Type; 7498 damageType = actorPtr->pMonsterInfo.uAttack1Type;
7499 break; 7499 break;
7500 case 1: 7500 case 1:
7551 } 7551 }
7552 } 7552 }
7553 } 7553 }
7554 } 7554 }
7555 } 7555 }
7556 if ( !element 7556 if ( !dmgSource
7557 && !(dword_6BE368_debug_settings_2 & 0x10) 7557 && !(dword_6BE368_debug_settings_2 & 0x10)
7558 && actorPtr->pMonsterInfo.uSpecialAttackType 7558 && actorPtr->pMonsterInfo.uSpecialAttackType
7559 && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackLevel ) 7559 && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackLevel )
7560 { 7560 {
7561 playerPtr->ReceiveSpecialAttackEffect(actorPtr->pMonsterInfo.uSpecialAttackType, actorPtr); 7561 playerPtr->ReceiveSpecialAttackEffect(actorPtr->pMonsterInfo.uSpecialAttackType, actorPtr);