comparison Player.cpp @ 1656:56847118d50c

DamagePlayerFromMonster continuing cleanup, part 2
author Grumpy7
date Wed, 18 Sep 2013 09:06:28 +0200
parents d25389b91029
children 51a74615d956
comparison
equal deleted inserted replaced
1650:b0a2b8525483 1656:56847118d50c
7507 int v39; // esi@77 7507 int v39; // esi@77
7508 int v40; // eax@77 7508 int v40; // eax@77
7509 int v41; // eax@77 7509 int v41; // eax@77
7510 int v42; // eax@78 7510 int v42; // eax@78
7511 Player *v43; // eax@81 7511 Player *v43; // eax@81
7512 Actor *v44; // esi@82 7512 //Actor *actorPtr; // esi@82
7513 Player *v45; // edi@84 7513 Player *v45; // edi@84
7514 unsigned __int16 v46; // ax@84 7514 unsigned __int16 v46; // ax@84
7515 int v47; // ebx@105 7515 int v47; // ebx@105
7516 int v48; // eax@107 7516 int v48; // eax@107
7517 unsigned __int16 v49; // ax@116 7517 unsigned __int16 v49; // ax@116
7519 unsigned __int16 v51; // ax@124 7519 unsigned __int16 v51; // ax@124
7520 char v52; // bl@124 7520 char v52; // bl@124
7521 int v53; // eax@128 7521 int v53; // eax@128
7522 signed int v54; // eax@134 7522 signed int v54; // eax@134
7523 unsigned __int16 v55; // cx@137 7523 unsigned __int16 v55; // cx@137
7524 signed int v56; // eax@139 7524 signed int recvdMagicDmg; // eax@139
7525 int v57; // eax@144 7525 int v57; // eax@144
7526 float v58; // ST18_4@148 7526 float v58; // ST18_4@148
7527 double v59; // st7@148 7527 double v59; // st7@148
7528 float v60; // ST08_4@148 7528 float v60; // ST08_4@148
7529 double v61; // st7@148 7529 double v61; // st7@148
7535 signed int v67; // ecx@164 7535 signed int v67; // ecx@164
7536 signed int v68; // eax@170 7536 signed int v68; // eax@170
7537 int v69; // ecx@170 7537 int v69; // ecx@170
7538 int v70; // eax@171 7538 int v70; // eax@171
7539 enum SoundID v71; // [sp+20h] [bp-34h]@12 7539 enum SoundID v71; // [sp+20h] [bp-34h]@12
7540 int v72; // [sp+30h] [bp-24h]@164 7540 int v72[4]; // [sp+30h] [bp-24h]@164
7541 double v73; // [sp+40h] [bp-14h]@72 7541 double v73; // [sp+40h] [bp-14h]@72
7542 signed int v74; // [sp+44h] [bp-10h]@1 7542 signed int v74; // [sp+44h] [bp-10h]@1
7543 unsigned int v75; // [sp+48h] [bp-Ch]@3 7543 int healthBeforeRecvdDamage; // [sp+48h] [bp-Ch]@3
7544 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1 7544 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1
7545 int v77; // [sp+50h] [bp-4h]@26 7545 int dmgToReceive; // [sp+50h] [bp-4h]@26
7546 signed int a4a; // [sp+60h] [bp+Ch]@162 7546 signed int a4a; // [sp+60h] [bp+Ch]@162
7547 Player *a4b; // [sp+60h] [bp+Ch]@168 7547 Player *a4b; // [sp+60h] [bp+Ch]@168
7548 7548
7549 v4 = PID_ID(uObjID); 7549 v4 = PID_ID(uObjID);
7550 v5 = PID_TYPE(uObjID) - 2; 7550 v5 = PID_TYPE(uObjID) - 2;
7552 uActorID = v4; 7552 uActorID = v4;
7553 if ( v5 ) 7553 if ( v5 )
7554 { 7554 {
7555 playerPtr = &pParty->pPlayers[a4]; 7555 playerPtr = &pParty->pPlayers[a4];
7556 actorPtr = &pActors[v4]; 7556 actorPtr = &pActors[v4];
7557 v75 = playerPtr->sHealth; 7557 healthBeforeRecvdDamage = playerPtr->sHealth;
7558 if ( v5 != 1 || !stru_50C198.ActorHitOrMiss(actorPtr, playerPtr) ) 7558 if ( v5 != 1 || !stru_50C198.ActorHitOrMiss(actorPtr, playerPtr) )
7559 return; 7559 return;
7560 v8 = playerPtr->pEquipment.uArmor; 7560 v8 = playerPtr->pEquipment.uArmor;
7561 if ( !v8 7561 if ( !v8
7562 || playerPtr->pInventoryItemList[v8 - 1].IsBroken() 7562 || playerPtr->pInventoryItemList[v8 - 1].IsBroken()
7585 case 2 : v17 = (SoundID)107; break; 7585 case 2 : v17 = (SoundID)107; break;
7586 case 3 : v17 = (SoundID)45; break; 7586 case 3 : v17 = (SoundID)45; break;
7587 } 7587 }
7588 } 7588 }
7589 pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); 7589 pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0);
7590 v18 = Actor::_43B3E0_CalcDamage(actorPtr, v74); 7590 dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, v74);
7591 v19 = HIDWORD(actorPtr->pActorBuffs[3].uExpireTime) == 0; 7591 if ( actorPtr->pActorBuffs[3].uExpireTime > 0 )
7592 v20 = SHIDWORD(actorPtr->pActorBuffs[3].uExpireTime) < 0;
7593 v77 = v18;
7594 if ( !v20 && (!(v20 | v19) || LODWORD(actorPtr->pActorBuffs[3].uExpireTime) > 0) )
7595 { 7592 {
7596 v21 = actorPtr->pActorBuffs[3].uPower; 7593 v21 = actorPtr->pActorBuffs[3].uPower;
7597 if ( v21 ) 7594 if ( v21 )
7598 v77 /= (signed int)v21; 7595 dmgToReceive /= (signed int)v21;
7599 } 7596 }
7600 switch (v74) 7597 switch (v74)
7601 { 7598 {
7602 case 0: v22 = actorPtr->pMonsterInfo.uAttack1Type; 7599 case 0: v22 = actorPtr->pMonsterInfo.uAttack1Type;
7603 break; 7600 break;
7615 case 5: v22 = 4; //yes, the original just assigned the value 4 7612 case 5: v22 = 4; //yes, the original just assigned the value 4
7616 break; 7613 break;
7617 } 7614 }
7618 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) 7615 if ( !(dword_6BE368_debug_settings_2 & 0x10) )
7619 { 7616 {
7620 v24 = playerPtr->ReceiveDamage(v77, (DAMAGE_TYPE)v22); 7617 v24 = playerPtr->ReceiveDamage(dmgToReceive, (DAMAGE_TYPE)v22);
7621 if ( SHIDWORD(playerPtr->pPlayerBuffs[10].uExpireTime) >= 0 7618 if ( playerPtr->pPlayerBuffs[10].uExpireTime > 0 )
7622 && (SHIDWORD(playerPtr->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(playerPtr->pPlayerBuffs[10].uExpireTime)) )
7623 { 7619 {
7624 v25 = actorPtr->uAIState; 7620 v25 = actorPtr->uAIState;
7625 if ( v25 != Dying && v25 != Dead) 7621 if ( v25 != Dying && v25 != Dead)
7626 { 7622 {
7627 v26 = stru_50C198.CalcMagicalDamageToActor(actorPtr, v22, v24); 7623 v26 = stru_50C198.CalcMagicalDamageToActor(actorPtr, v22, v24);
7628 actorPtr->sCurrentHP -= v26; 7624 actorPtr->sCurrentHP -= v26;
7629 if ( v26 ) 7625 if ( v26 >= 0 )
7630 { 7626 {
7631 if ( actorPtr->sCurrentHP >= 1 ) 7627 if ( actorPtr->sCurrentHP >= 1 )
7632 { 7628 {
7633 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); 7629 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0);
7634 Actor::AggroSurroundingPeasants(uActorID, 1); 7630 Actor::AggroSurroundingPeasants(uActorID, 1);
7635 } 7631 }
7636 else 7632 else
7637 { 7633 {
7638 if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 ) 7634 if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pRenderer->pRenderD3D && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS)
7639 { 7635 {
7640 v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius; 7636 v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius;
7641 if ( pRenderer->pRenderD3D ) 7637 pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, v27, 0, 0);
7642 {
7643 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
7644 {
7645 pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, v27, 0, 0);
7646 }
7647 }
7648 } 7638 }
7649 Actor::Die(uActorID); 7639 Actor::Die(uActorID);
7650 Actor::ApplyFineForKillingPeasant(uActorID); 7640 Actor::ApplyFineForKillingPeasant(uActorID);
7651 Actor::AggroSurroundingPeasants(uActorID, 1); 7641 Actor::AggroSurroundingPeasants(uActorID, 1);
7652 if ( actorPtr->pMonsterInfo.uExp ) 7642 if ( actorPtr->pMonsterInfo.uExp )
7660 } 7650 }
7661 } 7651 }
7662 if ( !(dword_6BE368_debug_settings_2 & 0x10) 7652 if ( !(dword_6BE368_debug_settings_2 & 0x10)
7663 && actorPtr->pMonsterInfo.uSpecialAttack 7653 && actorPtr->pMonsterInfo.uSpecialAttack
7664 && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackType ) 7654 && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackType )
7655 {
7665 playerPtr->_48DCF6(actorPtr->pMonsterInfo.uSpecialAttack, actorPtr); 7656 playerPtr->_48DCF6(actorPtr->pMonsterInfo.uSpecialAttack, actorPtr);
7657 }
7666 } 7658 }
7667 if ( !pParty->bTurnBasedModeOn ) 7659 if ( !pParty->bTurnBasedModeOn )
7668 { 7660 {
7669 v35 = playerPtr->GetActualEndurance(); 7661 v35 = playerPtr->GetActualEndurance();
7670 v36 = (double)(20 - playerPtr->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; 7662 v36 = (20 - playerPtr->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333;
7671 playerPtr->SetRecoveryTime((signed __int64)v36); 7663 playerPtr->SetRecoveryTime(v36);
7672 } 7664 }
7673 if ( v77 ) 7665 int yellThreshold = playerPtr->GetMaxHealth() * 0.25;
7674 { 7666 if ( yellThreshold < playerPtr->sHealth && yellThreshold >= healthBeforeRecvdDamage && playerPtr->sHealth > 0 )
7675 v73 = (double)(signed int)v75; 7667 {
7676 if ( (double)playerPtr->GetMaxHealth() * 0.25 < v73 ) 7668 playerPtr->PlaySound(SPEECH_48, 0);
7677 {
7678 if ( playerPtr->sHealth > 0 )
7679 {
7680 if ( (double)playerPtr->GetMaxHealth() * 0.25 >= (double)playerPtr->sHealth )
7681 playerPtr->PlaySound(SPEECH_48, 0);
7682 }
7683 }
7684 } 7669 }
7685 viewparams->bRedrawGameUI = 1; 7670 viewparams->bRedrawGameUI = 1;
7686 return; 7671 return;
7687 } 7672 }
7688 else 7673 else
7696 if ( !v41 ) 7681 if ( !v41 )
7697 goto LABEL_80; 7682 goto LABEL_80;
7698 v42 = v41 - 1; 7683 v42 = v41 - 1;
7699 if ( !v42 ) 7684 if ( !v42 )
7700 { 7685 {
7701 v44 = &pActors[v39]; 7686 actorPtr = &pActors[v39];
7702 if ( a4 == -1 ) 7687 if ( a4 == -1 )
7703 a4 = stru_50C198.which_player_would_attack(v44); 7688 a4 = stru_50C198.which_player_would_attack(actorPtr);
7704 v45 = &pParty->pPlayers[a4]; 7689 v45 = &pParty->pPlayers[a4];
7705 v77 = Actor::_43B3E0_CalcDamage(v44, v74); 7690 dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, v74);
7706 v46 = v37->uType; 7691 v46 = v37->uType;
7707 if ( v37->uType == 545 ) 7692 if ( v37->uType == 545 )
7708 { 7693 {
7709 LOBYTE(v51) = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED); 7694 v51 = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
7710 v52 = v51; 7695 if ( SkillToMastery(v51) >= 4 && rand() % 100 < (v51 & 0x3F) )
7711 if ( (signed int)SkillToMastery(v51) >= 4 && rand() % 100 < (v52 & 0x3F) )
7712 { 7696 {
7713 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], v45->pName); 7697 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], v45->pName);
7714 ShowStatusBarString(pTmpBuf.data(), 2u); 7698 ShowStatusBarString(pTmpBuf.data(), 2u);
7715 v45->PlaySound(SPEECH_6, 0); 7699 v45->PlaySound(SPEECH_6, 0);
7716 return; 7700 return;
7728 && v46 != 520 7712 && v46 != 520
7729 && v46 != 535 7713 && v46 != 535
7730 && v46 != 540 ) 7714 && v46 != 540 )
7731 goto LABEL_115; 7715 goto LABEL_115;
7732 } 7716 }
7733 if ( !stru_50C198.ActorHitOrMiss(v44, v45) ) 7717 if ( !stru_50C198.ActorHitOrMiss(actorPtr, v45) )
7734 return; 7718 return;
7735 if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 ) 7719 if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 )
7736 v77 >>= 1; 7720 dmgToReceive >>= 1;
7737 if ( v45->HasEnchantedItemEquipped(36) ) 7721 if ( v45->HasEnchantedItemEquipped(36) )
7738 v77 >>= 1; 7722 dmgToReceive >>= 1;
7739 if ( v45->HasEnchantedItemEquipped(69) ) 7723 if ( v45->HasEnchantedItemEquipped(69) )
7740 v77 >>= 1; 7724 dmgToReceive >>= 1;
7741 if ( v45->HasItemEquipped(EQUIP_ARMOUR) 7725 if ( v45->HasItemEquipped(EQUIP_ARMOUR)
7742 && v45->pInventoryItemList[v45->pEquipment.uArmor-1].uItemID == ITEM_ARTIFACT_GOVERNORS_ARMOR ) 7726 && v45->pInventoryItemList[v45->pEquipment.uArmor-1].uItemID == ITEM_ARTIFACT_GOVERNORS_ARMOR )
7743 v77 >>= 1; 7727 dmgToReceive >>= 1;
7744 if ( v45->HasItemEquipped(EQUIP_MAIN_HAND)) 7728 if ( v45->HasItemEquipped(EQUIP_MAIN_HAND))
7745 { 7729 {
7746 v48 = v45->pInventoryItemList[v45->pEquipment.uMainHand - 1].uItemID; 7730 v48 = v45->pInventoryItemList[v45->pEquipment.uMainHand - 1].uItemID;
7747 if ( v48 == ITEM_RELIC_KELEBRIM || v48 == ITEM_ARTIFACT_ELFBANE || (v45->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) 7731 if ( v48 == ITEM_RELIC_KELEBRIM || v48 == ITEM_ARTIFACT_ELFBANE || (v45->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4))
7748 v77 >>= 1; 7732 dmgToReceive >>= 1;
7749 } 7733 }
7750 if ( v45->HasItemEquipped(EQUIP_OFF_HAND)) 7734 if ( v45->HasItemEquipped(EQUIP_OFF_HAND))
7751 { 7735 {
7752 v48 = v45->pInventoryItemList[v45->pEquipment.uShield - 1].uItemID; 7736 v48 = v45->pInventoryItemList[v45->pEquipment.uShield - 1].uItemID;
7753 if ( v48 == ITEM_RELIC_KELEBRIM || v48 == ITEM_ARTIFACT_ELFBANE || (v45->GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) 7737 if ( v48 == ITEM_RELIC_KELEBRIM || v48 == ITEM_ARTIFACT_ELFBANE || (v45->GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4))
7754 v77 >>= 1; 7738 dmgToReceive >>= 1;
7755 } 7739 }
7756 LABEL_115: 7740 LABEL_115:
7757 if ( (signed __int64)v44->pActorBuffs[3].uExpireTime > 0 ) 7741 if ( actorPtr->pActorBuffs[3].uExpireTime > 0 )
7758 { 7742 {
7759 v49 = v44->pActorBuffs[3].uPower; 7743 v49 = actorPtr->pActorBuffs[3].uPower;
7760 if ( v49 ) 7744 if ( v49 )
7761 v77 /= (signed int)v49; 7745 dmgToReceive /= (signed int)v49;
7762 } 7746 }
7763 if ( !v74 ) 7747 switch(v47)
7764 { 7748 {
7765 v50 = v44->pMonsterInfo.uAttack1Type; 7749 case 0:
7766 goto LABEL_133; 7750 v50 = actorPtr->pMonsterInfo.uAttack1Type;
7767 } 7751 break;
7768 if ( v74 == 1 ) 7752 case 1:
7769 { 7753 v50 = actorPtr->pMonsterInfo.uAttack2Type;
7770 v50 = v44->pMonsterInfo.uAttack2Type; 7754 break;
7771 goto LABEL_133; 7755 case 2:
7772 } 7756 v53 = actorPtr->pMonsterInfo.uSpell1ID;
7773 if ( v74 == 2 ) 7757 v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool);
7774 { 7758 break;
7775 v53 = v44->pMonsterInfo.uSpell1ID; 7759 case 3:
7776 } 7760 v53 = actorPtr->pMonsterInfo.uSpell2ID;
7777 else 7761 v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool);
7778 { 7762 break;
7779 if ( v74 != 3 ) 7763 case 4:
7764 v50 = actorPtr->pMonsterInfo.field_3C_some_special_attack;
7765 break;
7766 case 5:
7767 v50 = 4;
7768 break;
7769 }
7770 if ( !(dword_6BE368_debug_settings_2 & 0x10) )
7771 {
7772 v54 = v45->ReceiveDamage(dmgToReceive, (DAMAGE_TYPE)v50);
7773 if ( v45->pPlayerBuffs[10].uExpireTime > 0 )
7780 { 7774 {
7781 if ( v74 == 4 ) 7775 v55 = actorPtr->uAIState;
7782 v50 = v44->pMonsterInfo.field_3C_some_special_attack; 7776 if ( v55 != Dying && v55 != Dead)
7783 else
7784 v50 = 4;
7785 LABEL_133:
7786 if ( !(dword_6BE368_debug_settings_2 & 0x10) )
7787 { 7777 {
7788 v54 = v45->ReceiveDamage(v77, (DAMAGE_TYPE)v50); 7778 recvdMagicDmg = stru_50C198.CalcMagicalDamageToActor(actorPtr, v50, v54);
7789 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 ) 7779 actorPtr->sCurrentHP -= recvdMagicDmg;
7780 if ( recvdMagicDmg >= 0 )
7790 { 7781 {
7791 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) ) 7782 if ( actorPtr->sCurrentHP >= 1 )
7792 { 7783 {
7793 v55 = v44->uAIState; 7784 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0);
7794 if ( v55 != Dying && v55 != Dead) 7785 Actor::AggroSurroundingPeasants(uActorID, 1);
7786 }
7787 else
7788 {
7789 if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pRenderer->pRenderD3D && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
7795 { 7790 {
7796 v56 = stru_50C198.CalcMagicalDamageToActor(v44, v50, v54); 7791 v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius;
7797 v44->sCurrentHP -= v56; 7792 pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, v57, 0, 0);
7798 if ( v56 )
7799 {
7800 if ( v44->sCurrentHP >= 1 )
7801 {
7802 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0);
7803 Actor::AggroSurroundingPeasants(uActorID, 1);
7804 }
7805 else
7806 {
7807 if ( pMonsterStats->pInfos[v44->pMonsterInfo.uID].bQuestMonster & 1 )
7808 {
7809 v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v44->uActorRadius : v44->uActorRadius;
7810 if ( pRenderer->pRenderD3D )
7811 {
7812 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
7813 {
7814 pDecalBuilder->AddBloodsplat(v44->vPosition.x, v44->vPosition.y, v44->vPosition.z, 1.0, 0.0, 0.0, v57, 0, 0);
7815 }
7816 }
7817 }
7818 Actor::Die(uActorID);
7819 Actor::ApplyFineForKillingPeasant(uActorID);
7820 Actor::AggroSurroundingPeasants(uActorID, 1);
7821 if ( v44->pMonsterInfo.uExp )
7822 GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp);
7823 v64 = SPEECH_51;
7824 if ( rand() % 100 < 20 )
7825 v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1;
7826 v45->PlaySound((PlayerSpeech)v64, 0);
7827 }
7828 }
7829 } 7793 }
7794 Actor::Die(uActorID);
7795 Actor::ApplyFineForKillingPeasant(uActorID);
7796 Actor::AggroSurroundingPeasants(uActorID, 1);
7797 if ( actorPtr->pMonsterInfo.uExp )
7798 GivePartyExp(pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].uExp);
7799 v64 = SPEECH_51;
7800 if ( rand() % 100 < 20 )
7801 v64 = ((signed int)actorPtr->pMonsterInfo.uHP >= 100) + 1;
7802 v45->PlaySound((PlayerSpeech)v64, 0);
7830 } 7803 }
7831 } 7804 }
7832 } 7805 }
7833 if ( !v74
7834 && !(dword_6BE368_debug_settings_2 & 0x10)
7835 && v44->pMonsterInfo.uSpecialAttack
7836 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType )
7837 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44);
7838 if ( !pParty->bTurnBasedModeOn )
7839 {
7840 v65 = v45->GetActualEndurance();
7841 v66 = (double)(20 - v45->GetParameterBonus(v65))
7842 * flt_6BE3A4_debug_recmod1
7843 * 2.133333333333333;
7844 v45->SetRecoveryTime((signed __int64)v66);
7845 }
7846 return;
7847 } 7806 }
7848 v53 = v44->pMonsterInfo.uSpell2ID; 7807 }
7849 } 7808 if ( !v74
7850 v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool); 7809 && !(dword_6BE368_debug_settings_2 & 0x10)
7851 goto LABEL_133; 7810 && actorPtr->pMonsterInfo.uSpecialAttack
7811 && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackType )
7812 v45->_48DCF6(actorPtr->pMonsterInfo.uSpecialAttack, actorPtr);
7813 if ( !pParty->bTurnBasedModeOn )
7814 {
7815 v65 = v45->GetActualEndurance();
7816 v66 = (double)(20 - v45->GetParameterBonus(v65))
7817 * flt_6BE3A4_debug_recmod1
7818 * 2.133333333333333;
7819 v45->SetRecoveryTime((signed __int64)v66);
7820 }
7821 return;
7852 } 7822 }
7853 if ( v42 != 1 ) 7823 if ( v42 != 1 )
7854 return; 7824 return;
7855 LABEL_80: 7825 LABEL_80:
7856 if ( a4 != -1 ) 7826 if ( a4 != -1 )
7857 { 7827 {
7858 v43 = &pParty->pPlayers[a4]; 7828 v43 = &pParty->pPlayers[a4];
7859 LABEL_168: 7829 }
7830 else
7831 {
7832 v74 = 0;
7833 for (int i = 1; i <= 4; i++)
7834 {
7835 v72[v74] = i;
7836 v74++;
7837 }
7838 if ( v74 )
7839 {
7840 v43 = &pParty->pPlayers[v72[rand() % v74]];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552];
7841 }
7842 }
7860 a4b = v43; 7843 a4b = v43;
7861 if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) 7844 if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW)
7862 { 7845 {
7863 v70 = v43->GetMaxHealth(); 7846 v70 = v43->GetMaxHealth();
7864 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70); 7847 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70);
7875 qword_A750D8 = 256i64; 7858 qword_A750D8 = 256i64;
7876 PlayerSpeechID = SPEECH_44; 7859 PlayerSpeechID = SPEECH_44;
7877 uSpeakingCharacter = uActorID + 1; 7860 uSpeakingCharacter = uActorID + 1;
7878 } 7861 }
7879 return; 7862 return;
7880 }
7881 v74 = 0;
7882 a4a = 1;
7883 do
7884 {
7885 if ( pPlayers[a4a]->CanAct() )
7886 {
7887 v67 = v74++;
7888 *(&v72 + v67) = a4a;
7889 }
7890 ++a4a;
7891 }
7892 while ( a4a <= 4 );
7893 if ( v74 )
7894 {
7895 v43 = &pParty->pPlayers[*(&v72+rand()%v74)-1];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552];
7896 goto LABEL_168;
7897 } 7863 }
7898 } 7864 }
7899 } 7865 }
7900 //----- (00421EA6) -------------------------------------------------------- 7866 //----- (00421EA6) --------------------------------------------------------
7901 void OnInventoryLeftClick() 7867 void OnInventoryLeftClick()