diff Player.cpp @ 1605:434b796cdfd3

Player::GetMagicalBonus cleaned up, identified a few player only effect spells used in mm6
author Grumpy7
date Sat, 14 Sep 2013 06:46:12 +0200
parents 4b79ff62df3a
children 8e3c6d7631f1
line wrap: on
line diff
--- a/Player.cpp	Sat Sep 14 06:04:18 2013 +0200
+++ b/Player.cpp	Sat Sep 14 06:46:12 2013 +0200
@@ -2764,7 +2764,7 @@
   }
 
   uint hasteRecoveryReduction = 0;
-  if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0 || pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0 )
+  if (pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime > 0 || pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0 )
     hasteRecoveryReduction = 25;
 
   uint weapon_enchantment_recovery_reduction = 0;
@@ -3393,99 +3393,77 @@
 //----- (0048F73C) --------------------------------------------------------
 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2)
 {
-  int result; // eax@1
-  int v3; // eax@4
-  int v4; // ecx@5
-
-  switch (a2)
-  {
-    case CHARACTER_ATTRIBUTE_LEVEL: return 0;
-  }
-
-  result = 0;
-  if ( (signed int)a2 > 10 )
-  {
-    if ( (signed int)a2 <= 15 )
-    {
-      switch ( a2 )
-      {
-        case CHARACTER_ATTRIBUTE_RESIST_BODY:
-          v3 = this->pPlayerBuffs[2].uPower;
-          v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower;
-          break;
-        case CHARACTER_ATTRIBUTE_RESIST_AIR:
-          v3 = this->pPlayerBuffs[0].uPower;
-          v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower;
-          break;
-        case CHARACTER_ATTRIBUTE_RESIST_WATER:
-          v3 = this->pPlayerBuffs[22].uPower;
-          v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower;
-          break;
-        case CHARACTER_ATTRIBUTE_RESIST_EARTH:
-          v3 = this->pPlayerBuffs[3].uPower;
-          v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower;
-          break;
-        default:
-          if ( a2 != 14 )
-            return result;
-          v3 = this->pPlayerBuffs[9].uPower;
-          v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower;
-          break;
-      }
-      return v4 + v3;
-    }
-    if ( a2 != CHARACTER_ATTRIBUTE_ATTACK )
-    {
-      if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS )
-      {
-        v3 = this->pPlayerBuffs[8].uPower;
-        v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower;
-        return v4 + v3;
-      }
-      if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK )
-        return result;
-    }
-    return this->pPlayerBuffs[1].uPower;
-  }
-  if ( a2 == 10 )
-  {
-    v3 = this->pPlayerBuffs[5].uPower;
-    v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower;
-    return v4 + v3;
-  }
+  int v3 = 0; // eax@4
+  int v4 = 0; // ecx@5
+
   switch ( a2 )
   {
+    case CHARACTER_ATTRIBUTE_RESIST_FIRE:
+      v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_FIRE].uPower;
+      v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower;
+      break;
+    case CHARACTER_ATTRIBUTE_RESIST_AIR:
+      v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_AIR].uPower;
+      v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower;
+      break;
+    case CHARACTER_ATTRIBUTE_RESIST_BODY:
+      v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_BODY].uPower;
+      v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower;
+      break;
+    case CHARACTER_ATTRIBUTE_RESIST_WATER:
+      v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_WATER].uPower;
+      v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower;
+      break;
+    case CHARACTER_ATTRIBUTE_RESIST_EARTH:
+      v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_EARTH].uPower;
+      v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower;
+      break;
+    case CHARACTER_ATTRIBUTE_RESIST_MIND:
+      v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_MIND].uPower;
+      v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower;
+      break;
+    case CHARACTER_ATTRIBUTE_ATTACK:
+    case CHARACTER_ATTRIBUTE_RANGED_ATTACK:
+      v3 = this->pPlayerBuffs[PLAYER_BUFF_BLESS].uPower;  //only player effect spell in both VI and VII
+      break;
+    case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS:
+      v3 = this->pPlayerBuffs[PLAYER_BUFF_HEROISM].uPower;
+      v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower;
+      break;
     case CHARACTER_ATTRIBUTE_STRENGTH:
-      v3 = pPlayerBuffs[19].uPower;
-      goto LABEL_5;
+      v3 = pPlayerBuffs[PLAYER_BUFF_STRENGTH].uPower;
+      v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
+      break;
     case CHARACTER_ATTRIBUTE_INTELLIGENCE:
-      v3 = pPlayerBuffs[17].uPower;
-      goto LABEL_5;
+      v3 = pPlayerBuffs[PLAYER_BUFF_INTELLIGENCE].uPower;
+      v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
+      break;
     case CHARACTER_ATTRIBUTE_WILLPOWER:
-      v3 = pPlayerBuffs[20].uPower;
-      goto LABEL_5;
+      v3 = pPlayerBuffs[PLAYER_BUFF_WILLPOWER].uPower;
+      v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
+      break;
     case CHARACTER_ATTRIBUTE_ENDURANCE:
-      v3 = pPlayerBuffs[16].uPower;
-      goto LABEL_5;
+      v3 = pPlayerBuffs[PLAYER_BUFF_ENDURANCE].uPower;
+      v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
+      break;
     case CHARACTER_ATTRIBUTE_ACCURACY:
-      v3 = pPlayerBuffs[15].uPower;
-      goto LABEL_5;
+      v3 = pPlayerBuffs[PLAYER_BUFF_ACCURACY].uPower;
+      v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
+      break;
     case CHARACTER_ATTRIBUTE_SPEED:
-      v3 = pPlayerBuffs[21].uPower;
-      goto LABEL_5;
+      v3 = pPlayerBuffs[PLAYER_BUFF_SPEED].uPower;
+      v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
+      break;
     case CHARACTER_ATTRIBUTE_LUCK:
-      v3 = pPlayerBuffs[18].uPower;
-LABEL_5:
+      v3 = pPlayerBuffs[PLAYER_BUFF_LUCK].uPower;
       v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
-      return v4 + v3;
+      break;
     case CHARACTER_ATTRIBUTE_AC_BONUS:
-      v3 = this->pPlayerBuffs[14].uPower;
+      v3 = this->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uPower;
       v4 = pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].uPower;
-      return v4 + v3;
-    default:
-      return result;
-  }
-  return result;
+      break;
+  }
+  return v3 + v4;
 }
 
 //----- (0048F882) --------------------------------------------------------