diff mm7_5.cpp @ 2059:f9698295c0bd

AttackerInfo, MerchandiseTest
author Ritor1
date Sun, 01 Dec 2013 23:43:03 +0600
parents b7485a6502f2
children 259df09dfb50
line wrap: on
line diff
--- a/mm7_5.cpp	Sun Dec 01 20:14:32 2013 +0600
+++ b/mm7_5.cpp	Sun Dec 01 23:43:03 2013 +0600
@@ -55,12 +55,12 @@
 //----- (00438F8F) --------------------------------------------------------
 void area_of_effect__damage_evaluate()
 {
-  int v2; // ecx@3
+  int attacker_type; // ecx@3
   signed int v3; // eax@3
-  unsigned int victim_id; // edi@6
-  int victim_type; // eax@6
+  unsigned int target_id; // edi@6
+  int target_type; // eax@6
   int v10; // edi@8
-  Vec3_int_ agressor_coord; // ST04_12@9
+  Vec3_int_ attacker_coord; // ST04_12@9
   int v12; // ST0C_4@10
   int v15; // edx@15
   int v19; // edi@15
@@ -71,149 +71,145 @@
   int v32; // eax@29
   int v33; // ST24_4@29
   SpriteObject *v36; // [sp+0h] [bp-28h]@0
-  int agressor_id; // [sp+10h] [bp-18h]@1
+  int attacker_id; // [sp+10h] [bp-18h]@1
   int v44; // [sp+14h] [bp-14h]@15
-  Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2
+  //Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2
   int a1; // [sp+20h] [bp-8h]@8
   int v48; // [sp+24h] [bp-4h]@8
 
-  if ( AgressorAtackInfo.count > 0 )
+
+  for ( attacker_id = 0; attacker_id < AttackerInfo.count; ++attacker_id )
   {
-    pVelocity = &AgressorAtackInfo.vec_4B4;
-    for ( agressor_id = 0; agressor_id < AgressorAtackInfo.count; ++agressor_id )
-    {
-      v2 = PID_TYPE(AgressorAtackInfo.pIDs[agressor_id]);
-      v3 = PID_ID(AgressorAtackInfo.pIDs[agressor_id]);
+    attacker_type = PID_TYPE(AttackerInfo.pIDs[attacker_id]);
+    v3 = PID_ID(AttackerInfo.pIDs[attacker_id]);
 
-      if ( v2 == 2 )
-      {
-        v36 = &pSpriteObjects[v3];
-        v2 = PID_TYPE(pSpriteObjects[v3].spell_caster_pid);
-        v3 = PID_ID(pSpriteObjects[v3].spell_caster_pid);
-      }
+    if ( attacker_type == 2 )
+    {
+      v36 = &pSpriteObjects[v3];
+      attacker_type = PID_TYPE(pSpriteObjects[v3].spell_caster_pid);
+      v3 = PID_ID(pSpriteObjects[v3].spell_caster_pid);
+    }
 
-      if ( AgressorAtackInfo.field_3EC[agressor_id] & 1 )
+    if ( AttackerInfo.field_3EC[attacker_id] & 1 )
+    {
+      target_id = PID_ID(ai_near_actors_targets_pid[v3]);
+      target_type = PID_TYPE(ai_near_actors_targets_pid[v3]) - 3;
+      if ( target_type )
       {
-        victim_id = PID_ID(ai_near_actors_targets_pid[v3]);
-        victim_type = PID_TYPE(ai_near_actors_targets_pid[v3]) - 3;
-        if ( victim_type )
+        if ( target_type == 1 )//party damage from monsters(повреждения группе от монстров)
         {
-          if ( victim_type == 1 )//party damage from monsters(повреждения группе от монстров)
+          v10 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id];
+          a1 = pParty->vPosition.x - AttackerInfo.pXs[attacker_id];
+          v48 = v10;
+          if ( a1 * a1 + v10 * v10
+             + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AttackerInfo.pZs[attacker_id]))
+             * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AttackerInfo.pZs[attacker_id]))
+             < (unsigned int)((AttackerInfo.field_324[attacker_id] + 32) * (AttackerInfo.field_324[attacker_id] + 32)) )
           {
-            v10 = pParty->vPosition.y - AgressorAtackInfo.pYs[agressor_id];
-            a1 = pParty->vPosition.x - AgressorAtackInfo.pXs[agressor_id];
-            v48 = v10;
-            if ( a1 * a1 + v10 * v10
-               + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AgressorAtackInfo.pZs[agressor_id]))
-               * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AgressorAtackInfo.pZs[agressor_id]))
-               < (unsigned int)((AgressorAtackInfo.field_324[agressor_id] + 32) * (AgressorAtackInfo.field_324[agressor_id] + 32)) )
-            {
-              agressor_coord.x = AgressorAtackInfo.pXs[agressor_id];
-              agressor_coord.y = AgressorAtackInfo.pYs[agressor_id];
-              agressor_coord.z = AgressorAtackInfo.pZs[agressor_id];
-              if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, agressor_coord) )
-                DamagePlayerFromMonster(AgressorAtackInfo.pIDs[agressor_id], AgressorAtackInfo.field_450[agressor_id], pVelocity, stru_50C198.which_player_to_attack(&pActors[v3]));
-            }
+            attacker_coord.x = AttackerInfo.pXs[attacker_id];
+            attacker_coord.y = AttackerInfo.pYs[attacker_id];
+            attacker_coord.z = AttackerInfo.pZs[attacker_id];
+            if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, attacker_coord) )
+              DamagePlayerFromMonster(AttackerInfo.pIDs[attacker_id], AttackerInfo.field_450[attacker_id], &AttackerInfo.vec_4B4[attacker_id], stru_50C198.which_player_to_attack(&pActors[v3]));
           }
         }
-        else//Actor damage from monsters(повреждение местного жителя)
+      }
+      else//Actor damage from monsters(повреждение местного жителя)
+      {
+        if ( SHIDWORD(pActors[target_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) > 0
+          || SHIDWORD(pActors[target_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) >= 0
+           && LODWORD(pActors[target_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime)
+          || pActors[target_id].CanAct() )
         {
-          if ( SHIDWORD(pActors[victim_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) > 0
-            || SHIDWORD(pActors[victim_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) >= 0
-             && LODWORD(pActors[victim_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime)
-            || pActors[victim_id].CanAct() )
+          v15 = pActors[target_id].vPosition.y - AttackerInfo.pYs[attacker_id];
+          a1 = pActors[target_id].vPosition.x - AttackerInfo.pXs[attacker_id];
+          v44 = pActors[target_id].vPosition.z;
+          v19 = AttackerInfo.pYs[attacker_id] + pActors[target_id].uActorRadius;
+          v48 = v15;
+          if ( a1 * a1 + v15 * v15 + (pActors[target_id].vPosition.z + (pActors[target_id].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id])
+           * (pActors[target_id].vPosition.z + (pActors[target_id].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id]) < (unsigned int)(v19 * v19) )
           {
-            v15 = pActors[victim_id].vPosition.y - AgressorAtackInfo.pYs[agressor_id];
-            a1 = pActors[victim_id].vPosition.x - AgressorAtackInfo.pXs[agressor_id];
-            v44 = pActors[victim_id].vPosition.z;
-            v19 = AgressorAtackInfo.pYs[agressor_id] + pActors[victim_id].uActorRadius;
-            v48 = v15;
-            if ( a1 * a1 + v15 * v15 + (pActors[victim_id].vPosition.z + (pActors[victim_id].uActorHeight >> 1) - AgressorAtackInfo.pZs[agressor_id])
-             * (pActors[victim_id].vPosition.z + (pActors[victim_id].uActorHeight >> 1) - AgressorAtackInfo.pZs[agressor_id]) < (unsigned int)(v19 * v19) )
+            attacker_coord.x = AttackerInfo.pXs[attacker_id];
+            attacker_coord.y = AttackerInfo.pYs[attacker_id];
+            attacker_coord.z = AttackerInfo.pZs[attacker_id];
+            if ( sub_407A1C(pActors[target_id].vPosition.x, pActors[target_id].vPosition.y, pActors[target_id].vPosition.z + 50, attacker_coord) )
             {
-              agressor_coord.x = AgressorAtackInfo.pXs[agressor_id];
-              agressor_coord.y = AgressorAtackInfo.pYs[agressor_id];
-              agressor_coord.z = AgressorAtackInfo.pZs[agressor_id];
-              if ( sub_407A1C(pActors[victim_id].vPosition.x, pActors[victim_id].vPosition.y, pActors[victim_id].vPosition.z + 50, agressor_coord) )
-              {
-                Vec3_int_::Normalize(&a1, &v48, &v44);
-                pVelocity->x = a1;
-                pVelocity->y = v48;
-                pVelocity->z = v44;
-                ActorDamageFromMonster(AgressorAtackInfo.pIDs[agressor_id], victim_id, pVelocity, AgressorAtackInfo.field_450[agressor_id]);
-              }
+              Vec3_int_::Normalize(&a1, &v48, &v44);
+              AttackerInfo.vec_4B4[attacker_id].x = a1;
+              AttackerInfo.vec_4B4[attacker_id].y = v48;
+              AttackerInfo.vec_4B4[attacker_id].z = v44;
+              ActorDamageFromMonster(AttackerInfo.pIDs[attacker_id], target_id, &AttackerInfo.vec_4B4[attacker_id], AttackerInfo.field_450[attacker_id]);
             }
           }
         }
       }
-      else //damage from spells(повреждения от заклов(метеоритный дождь))
-      {
-        v23 = pParty->vPosition.y - AgressorAtackInfo.pYs[agressor_id];
-        v24 = ((signed int)pParty->uPartyHeight >> 1) - AgressorAtackInfo.pZs[agressor_id];
-        a1 = pParty->vPosition.x - AgressorAtackInfo.pXs[agressor_id];
-        v48 = v23;
-        if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((AgressorAtackInfo.field_324[agressor_id] + 32) * (AgressorAtackInfo.field_324[agressor_id] + 32)) )
-        {//party damage (повреждения группе)
-          agressor_coord.x = AgressorAtackInfo.pXs[agressor_id];
-          agressor_coord.y = AgressorAtackInfo.pYs[agressor_id];
-          agressor_coord.z = AgressorAtackInfo.pZs[agressor_id];
-          if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, agressor_coord) )
+    }
+    else //damage from spells(повреждения от заклов(метеоритный дождь))
+    {
+      v23 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id];
+      v24 = ((signed int)pParty->uPartyHeight >> 1) - AttackerInfo.pZs[attacker_id];
+      a1 = pParty->vPosition.x - AttackerInfo.pXs[attacker_id];
+      v48 = v23;
+      if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((AttackerInfo.field_324[attacker_id] + 32) * (AttackerInfo.field_324[attacker_id] + 32)) )
+      {//party damage (повреждения группе)
+        attacker_coord.x = AttackerInfo.pXs[attacker_id];
+        attacker_coord.y = AttackerInfo.pYs[attacker_id];
+        attacker_coord.z = AttackerInfo.pZs[attacker_id];
+        if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, attacker_coord) )
+        {
+          for ( uint i = 0; i < 4; ++i )
           {
-            for ( uint i = 0; i < 4; ++i )
-            {
-              if ( !(HIDWORD(pParty->pPlayers[i].pConditions[Condition_Dead]) | LODWORD(pParty->pPlayers[i].pConditions[Condition_Dead]))
-                && !pParty->pPlayers[i].pConditions[Condition_Pertified] && !pParty->pPlayers[i].pConditions[Condition_Eradicated] )
-                DamagePlayerFromMonster(AgressorAtackInfo.pIDs[agressor_id], AgressorAtackInfo.field_450[agressor_id], pVelocity, i);
-            }
+            if ( !(HIDWORD(pParty->pPlayers[i].pConditions[Condition_Dead]) | LODWORD(pParty->pPlayers[i].pConditions[Condition_Dead]))
+              && !pParty->pPlayers[i].pConditions[Condition_Pertified] && !pParty->pPlayers[i].pConditions[Condition_Eradicated] )
+              DamagePlayerFromMonster(AttackerInfo.pIDs[attacker_id], AttackerInfo.field_450[attacker_id], &AttackerInfo.vec_4B4[attacker_id], i);
           }
         }
-        if ( (signed int)uNumActors > 0 )
-        {//actors damage(повреждения другим участникам)
-          for ( int actorID = 0; (signed int)actorID < (signed int)uNumActors; ++actorID )
+      }
+      if ( (signed int)uNumActors > 0 )
+      {//actors damage(повреждения другим участникам)
+        for ( int actorID = 0; (signed int)actorID < (signed int)uNumActors; ++actorID )
+        {
+          if ( pActors[actorID].CanAct() )
           {
-            if ( pActors[actorID].CanAct() )
+            v30 = pActors[actorID].vPosition.y - AttackerInfo.pYs[attacker_id];
+            a1 = pActors[actorID].vPosition.x - AttackerInfo.pXs[attacker_id];
+            v31 = pActors[actorID].vPosition.z;
+            v48 = v30;
+            v44 = pActors[actorID].vPosition.z;
+            v32 = (pActors[actorID].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id];
+            v33 = pActors[actorID].uActorRadius + AttackerInfo.pYs[attacker_id];
+            if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) )
             {
-              v30 = pActors[actorID].vPosition.y - AgressorAtackInfo.pYs[agressor_id];
-              a1 = pActors[actorID].vPosition.x - AgressorAtackInfo.pXs[agressor_id];
-              v31 = pActors[actorID].vPosition.z;
-              v48 = v30;
-              v44 = pActors[actorID].vPosition.z;
-              v32 = (pActors[actorID].uActorHeight >> 1) - AgressorAtackInfo.pZs[agressor_id];
-              v33 = pActors[actorID].uActorRadius + AgressorAtackInfo.pYs[agressor_id];
-              if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) )
+              attacker_coord.x = AttackerInfo.pXs[attacker_id];
+              attacker_coord.y = AttackerInfo.pYs[attacker_id];
+              attacker_coord.z = AttackerInfo.pZs[attacker_id];
+              if ( sub_407A1C(pActors[actorID].vPosition.x, pActors[actorID].vPosition.y, pActors[actorID].vPosition.z + 50, attacker_coord) )
               {
-                agressor_coord.x = AgressorAtackInfo.pXs[agressor_id];
-                agressor_coord.y = AgressorAtackInfo.pYs[agressor_id];
-                agressor_coord.z = AgressorAtackInfo.pZs[agressor_id];
-                if ( sub_407A1C(pActors[actorID].vPosition.x, pActors[actorID].vPosition.y, pActors[actorID].vPosition.z + 50, agressor_coord) )
+                Vec3_int_::Normalize(&a1, &v48, &v44);
+                AttackerInfo.vec_4B4[attacker_id].x = a1;
+                AttackerInfo.vec_4B4[attacker_id].y = v48;
+                AttackerInfo.vec_4B4[attacker_id].z = v44;
+                switch ( attacker_type )
                 {
-                  Vec3_int_::Normalize(&a1, &v48, &v44);
-                  pVelocity->x = a1;
-                  pVelocity->y = v48;
-                  pVelocity->z = v44;
-                  switch ( v2 )
-                  {
-                    case OBJECT_Player:
-                      DamageMonsterFromParty(AgressorAtackInfo.pIDs[agressor_id], actorID, pVelocity);
-                      break;
-                    case OBJECT_Actor:
-                      if ( v36 && pActors[v3].GetActorsRelation(&pActors[actorID]) )
-                        ActorDamageFromMonster(AgressorAtackInfo.pIDs[agressor_id], actorID, pVelocity, v36->field_61);
-                      break;
-                    case OBJECT_Item:
-                      sub_43B057(AgressorAtackInfo.pIDs[agressor_id], actorID, pVelocity);
-                      break;
-                  }
+                  case OBJECT_Player:
+                    DamageMonsterFromParty(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id]);
+                    break;
+                  case OBJECT_Actor:
+                    if ( v36 && pActors[v3].GetActorsRelation(&pActors[actorID]) )
+                      ActorDamageFromMonster(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id], v36->field_61);
+                    break;
+                  case OBJECT_Item:
+                    sub_43B057(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id]);
+                    break;
                 }
               }
             }
           }
         }
       }
-      ++pVelocity;
     }
   }
-  AgressorAtackInfo.count = 0;
+  AttackerInfo.count = 0;
 }
 
 
@@ -339,13 +335,13 @@
 }
 
 //----- (0043B1B0) --------------------------------------------------------
-void ActorDamageFromMonster(signed int agressor_id, unsigned int actor_id, Vec3_int_ *pVelocity, signed int a4)
+void ActorDamageFromMonster(signed int attacker_id, unsigned int actor_id, Vec3_int_ *pVelocity, signed int a4)
 {
   int v4; // ebx@1
   //SpriteObject *v5; // eax@2
   int v6; // eax@3
-  Actor *v7; // esi@4
-  Actor *v8; // edi@4
+  //Actor *v7; // esi@4
+  //Actor *v8; // edi@4
   char v9; // zf@5
   __int64 v10; // qax@8
   signed __int16 v11; // cx@9
@@ -357,81 +353,79 @@
   int v18; // [sp+20h] [bp+Ch]@34
 
   v4 = 0;
-  v17 = agressor_id;
-  if ( PID_TYPE(agressor_id) == OBJECT_Item)
+  v17 = attacker_id;
+  if ( PID_TYPE(attacker_id) == OBJECT_Item)
   {
-    v4 = pSpriteObjects[PID_ID(agressor_id)].field_60_distance_related_prolly_lod;
-    v17 = pSpriteObjects[PID_ID(agressor_id)].spell_caster_pid;
+    v4 = pSpriteObjects[PID_ID(attacker_id)].field_60_distance_related_prolly_lod;
+    v17 = pSpriteObjects[PID_ID(attacker_id)].spell_caster_pid;
   }
   if ( PID_TYPE(v17) == OBJECT_Actor)
   {
-    v7 = &pActors[actor_id];
-    v8 = &pActors[PID_ID(v17)];
     v6 = pActors[actor_id].IsNotAlive();
     if ( !v6 )
     {
-      v9 = v7->uAIState == 7;
-      v7->uLastCharacterIDToHit = v17;
+      v9 = pActors[actor_id].uAIState == 7;
+      pActors[actor_id].uLastCharacterIDToHit = v17;
       if ( v9 )
-        BYTE2(v7->uAttributes) |= 2u;
-      v6 = v8->_4273BB_DoesHitOtherActor(v7, v4, 0);
+        BYTE2(pActors[actor_id].uAttributes) |= 2u;
+      v6 = pActors[PID_ID(v17)]._4273BB_DoesHitOtherActor(&pActors[actor_id], v4, 0);
       if ( v6 )
       {
-        v10 = (unsigned int)v8->_43B3E0_CalcDamage(a4);
-        if ( (signed __int64)v8->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0 )
+        v10 = (unsigned int)pActors[PID_ID(v17)]._43B3E0_CalcDamage(a4);
+        if ( (signed __int64)pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0 )
         {
-          v11 = v8->pActorBuffs[ACTOR_BUFF_SHRINK].uPower;
+          v11 = pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower;
           if ( v11 )
             v10 = (signed int)v10 / (unsigned __int16)v11;
         }
-        if ( SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) >= SHIDWORD(v10)
-          && (SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > SHIDWORD(v10)
-           || LODWORD(v7->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > HIDWORD(v10)) )
+        if ( SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) >= SHIDWORD(v10)
+          && (SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > SHIDWORD(v10)
+           || LODWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > HIDWORD(v10)) )
           LODWORD(v10) = 0;
         if ( a4 != HIDWORD(v10) )
         {
           if ( a4 - HIDWORD(v10) == 1 )
           {
-            v12 = v8->pMonsterInfo.uAttack2Type;
-            if ( SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) >= SHIDWORD(v10)
-              && (SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > SHIDWORD(v10)
-               || LODWORD(v7->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > HIDWORD(v10)) )
+            v12 = pActors[PID_ID(v17)].pMonsterInfo.uAttack2Type;
+            if ( SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) >= SHIDWORD(v10)
+              && (SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > SHIDWORD(v10)
+               || LODWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > HIDWORD(v10)) )
               LODWORD(v10) = (signed int)v10 >> 1;
             goto LABEL_30;
           }
           if ( a4 - HIDWORD(v10) == 2 )
           {
-            v13 = v7->pMonsterInfo.uSpell1ID;
+            v13 = pActors[actor_id].pMonsterInfo.uSpell1ID;
           }
           else
           {
             if ( a4 - HIDWORD(v10) != 3 )
             {
               if ( a4 - HIDWORD(v10) == 4 )
-                v12 = v8->pMonsterInfo.field_3C_some_special_attack;
+                v12 = pActors[PID_ID(v17)].pMonsterInfo.field_3C_some_special_attack;
               else
                 v12 = 4;
 LABEL_30:
-              v14 = stru_50C198.CalcMagicalDamageToActor(v7, v12, v10);
-              v7->sCurrentHP -= v14;
+              v14 = stru_50C198.CalcMagicalDamageToActor(&pActors[actor_id], v12, v10);
+              pActors[actor_id].sCurrentHP -= v14;
               if ( v14 )
               {
-                if ( v7->sCurrentHP > 0 )
+                if ( pActors[actor_id].sCurrentHP > 0 )
                   Actor::AI_Stun(actor_id, v17, 0);
                 else
                   Actor::Die(actor_id);
                 Actor::AggroSurroundingPeasants(actor_id, 0);
-                v18 = 20 * v14 / (signed int)v7->pMonsterInfo.uHP;
-                if ( 20 * v14 / (signed int)v7->pMonsterInfo.uHP > 10 )
+                v18 = 20 * v14 / (signed int)pActors[actor_id].pMonsterInfo.uHP;
+                if ( 20 * v14 / (signed int)pActors[actor_id].pMonsterInfo.uHP > 10 )
                   v18 = 10;
-                if ( !MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) )
+                if ( !MonsterStats::BelongsToSupertype(pActors[actor_id].pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) )
                 {
                   pVelocity->x = (unsigned __int64)(v18 * (signed __int64)pVelocity->x) >> 16;
                   pVelocity->y = (unsigned __int64)(v18 * (signed __int64)pVelocity->y) >> 16;
                   pVelocity->z = (unsigned __int64)(v18 * (signed __int64)pVelocity->z) >> 16;
-                  v7->vVelocity.x = 50 * LOWORD(pVelocity->x);
-                  v7->vVelocity.y = 50 * LOWORD(pVelocity->y);
-                  v7->vVelocity.z = 50 * LOWORD(pVelocity->z);
+                  pActors[actor_id].vVelocity.x = 50 * LOWORD(pVelocity->x);
+                  pActors[actor_id].vVelocity.y = 50 * LOWORD(pVelocity->y);
+                  pActors[actor_id].vVelocity.z = 50 * LOWORD(pVelocity->z);
                 }
                 Actor::AddBloodsplatOnDamageOverlay(actor_id, 1, v14);
               }
@@ -441,12 +435,12 @@
               }
               return;
             }
-            v13 = v7->pMonsterInfo.uSpell2ID;
+            v13 = pActors[actor_id].pMonsterInfo.uSpell2ID;
           }
           v12 = LOBYTE(pSpellStats->pInfos[v13].uSchool);
           goto LABEL_30;
         }
-        v12 = v8->pMonsterInfo.uAttack1Type;
+        v12 = pActors[PID_ID(v17)].pMonsterInfo.uAttack1Type;
         goto LABEL_30;
       }
     }