changeset 1974:0f62a2b8bd0a

stru319::_4273BB moved to Actor::_4273BB, renamed to _4273BB_DoesHitOtherActor
author Grumpy7
date Sat, 26 Oct 2013 00:41:13 -0700
parents f708aaeb635b
children c22dd8b6c3f4
files Actor.cpp Actor.h mm7_5.cpp mm7_6.cpp
diffstat 4 files changed, 34 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Sat Oct 26 00:36:01 2013 -0700
+++ b/Actor.cpp	Sat Oct 26 00:41:13 2013 -0700
@@ -4372,4 +4372,36 @@
   if (this->pMonsterInfo.uAttack2Chance && rand() % 100 < this->pMonsterInfo.uAttack2Chance)
     return ABILITY_ATTACK2;
   return ABILITY_ATTACK1;
+}
+
+
+
+//----- (004273BB) --------------------------------------------------------
+bool Actor::_4273BB_DoesHitOtherActor( Actor *defender, int a3, int a4 )
+{
+  signed int v6; // ebx@1
+  signed int v7; // esi@1
+  int armorSum; // ebx@10
+  signed int a2a; // [sp+18h] [bp+Ch]@1
+
+  v6 = defender->pMonsterInfo.uAC;
+  v7 = 0;
+  a2a = 0;
+  if ( defender->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime > 0 )
+    v6 /= 2;
+  if ( defender->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 )
+    v7 = defender->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uPower;
+  if ( defender->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime > 0 && defender->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower > v7 )
+    v7 = defender->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower;
+  armorSum = v7 + v6;
+  if ( this->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 )
+    a2a = this->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uPower;
+  if ( this->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime > 0 && this->pActorBuffs[ACTOR_BUFF_BLESS].uPower > a2a )
+    a2a = this->pActorBuffs[ACTOR_BUFF_BLESS].uPower;
+  if ( this->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime > 0 )
+  {
+    a2a += this->pActorBuffs[ACTOR_BUFF_FATE].uPower;
+    this->pActorBuffs[ACTOR_BUFF_FATE].Reset();
+  }
+  return rand() % (armorSum + 2 * this->pMonsterInfo.uLevel + 10) + a2a + 1 > armorSum + 5;
 }
\ No newline at end of file
--- a/Actor.h	Sat Oct 26 00:36:01 2013 -0700
+++ b/Actor.h	Sat Oct 26 00:41:13 2013 -0700
@@ -14,7 +14,6 @@
 {
   int which_player_to_attack(struct Actor *pActor);
   int PlayerHitOrMiss(struct Player *pPlayer, struct Actor *pActor, int a3, int a4);
-  bool _4273BB(struct Actor *pActor, struct Actor *a2, int a3, int a4);
   bool ActorHitOrMiss(struct Actor *pActor, struct Player *pPlayer);
   int _427546(int a2);
   int CalcMagicalDamageToActor(struct Actor *pActor, int a2, signed int a3);
@@ -255,6 +254,7 @@
   void LootActor();
   bool _427102_IsOkToCastSpell(signed int a2);
   ABILITY_INDEX special_ability_use_check(int a2);
+  bool _4273BB_DoesHitOtherActor(Actor *defender, int a3, int a4);
 
   char pActorName[32];
   signed __int16 sNPC_ID;
--- a/mm7_5.cpp	Sat Oct 26 00:36:01 2013 -0700
+++ b/mm7_5.cpp	Sat Oct 26 00:41:13 2013 -0700
@@ -440,7 +440,7 @@
       v7->uLastCharacterIDToHit = v17;
       if ( v9 )
         BYTE2(v7->uAttributes) |= 2u;
-      v6 = stru_50C198._4273BB(v8, v7, v4, 0);
+      v6 = v8->_4273BB_DoesHitOtherActor(v7, v4, 0);
       if ( v6 )
       {
         v10 = (unsigned int)v8->_43B3E0_CalcDamage(a4);
--- a/mm7_6.cpp	Sat Oct 26 00:36:01 2013 -0700
+++ b/mm7_6.cpp	Sat Oct 26 00:41:13 2013 -0700
@@ -105,36 +105,6 @@
   return result;
 }
 
-//----- (004273BB) --------------------------------------------------------
-bool stru319::_4273BB(Actor *attacker, Actor *defender, int a3, int a4)
-{
-  signed int v6; // ebx@1
-  signed int v7; // esi@1
-  int armorSum; // ebx@10
-  signed int a2a; // [sp+18h] [bp+Ch]@1
-
-  v6 = defender->pMonsterInfo.uAC;
-  v7 = 0;
-  a2a = 0;
-  if ( defender->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime > 0 )
-    v6 /= 2;
-  if ( defender->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 )
-    v7 = defender->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uPower;
-  if ( defender->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime > 0 && defender->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower > v7 )
-    v7 = defender->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower;
-  armorSum = v7 + v6;
-  if ( attacker->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 )
-    a2a = attacker->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uPower;
-  if ( attacker->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime > 0 && attacker->pActorBuffs[ACTOR_BUFF_BLESS].uPower > a2a )
-    a2a = attacker->pActorBuffs[ACTOR_BUFF_BLESS].uPower;
-  if ( attacker->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime > 0 )
-  {
-    a2a += attacker->pActorBuffs[ACTOR_BUFF_FATE].uPower;
-    attacker->pActorBuffs[ACTOR_BUFF_FATE].Reset();
-  }
-  return rand() % (armorSum + 2 * attacker->pMonsterInfo.uLevel + 10) + a2a + 1 > armorSum + 5;
-}
-
 //----- (004274AD) --------------------------------------------------------
 bool stru319::ActorHitOrMiss(Actor *pActor, Player *pPlayer)
 {