diff Actor.cpp @ 1974:0f62a2b8bd0a

stru319::_4273BB moved to Actor::_4273BB, renamed to _4273BB_DoesHitOtherActor
author Grumpy7
date Sat, 26 Oct 2013 00:41:13 -0700
parents 3ef25d06b9b0
children c1c74df0a33e
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