diff Player.cpp @ 1533:a2e1174c428b

Player::GetSkillBonus fixing indentation
author Grumpy7
date Fri, 06 Sep 2013 03:36:08 +0200
parents a109bb203e28
children d4bc1cb9d953
line wrap: on
line diff
--- a/Player.cpp	Thu Sep 05 18:05:50 2013 +0600
+++ b/Player.cpp	Fri Sep 06 03:36:08 2013 +0200
@@ -4806,9 +4806,6 @@
 //----- (0048FC00) --------------------------------------------------------
 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2)
 {
- 
-
-
   Player *v2; // esi@1
   int armmaster_skill; // eax@1
   char v4; // di@1
@@ -4900,21 +4897,20 @@
     if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS )
     {
       if ( armaster_mastery == 4 )
-          multiplier =2;
+        multiplier =2;
       else if ( armaster_mastery == 3 )
-          multiplier =1;
+        multiplier =1;
     }
     else if ( a2 == CHARACTER_ATTRIBUTE_ATTACK )
     {
-    if ( armaster_mastery == 4 )
+      if ( armaster_mastery == 4 )
         multiplier =2;
-    else if ( armaster_mastery >= 2 )
+      else if ( armaster_mastery >= 2 )
         multiplier =1;
     } 
     arm_bonus=(armmaster_skill&0x3F)*multiplier;
   }
  
-  
   if ( a2 == CHARACTER_ATTRIBUTE_HEALTH )
   {
     base_value = pBaseHealthPerLevelByClass[classType];
@@ -4928,328 +4924,319 @@
     return base_value * attrib_modif;
   }
   if ( a2 == CHARACTER_ATTRIBUTE_AC_BONUS )
-      {
-      a1b = 0;
-      v71 = (ITEM_EQUIP_TYPE)0;
-     
-      for (j=0; j<16; ++j) 
-          {
-           if (pEquipment.pIndices[j]&&(!pOwnItems[ pEquipment.pIndices[j]].Broken()))
-               {
-               int curr_item =pOwnItems[pEquipment.pIndices[j]].uItemID;
-               v44=pItemsTable->pItems[curr_item].uSkillType;
-               switch (v44)
-                   {
-
-               case PLAYER_SKILL_STAFF:
-                   
-                   lvl_avl[0]=0;
-                   lvl_avl[1]=1;
-                   lvl_avl[2]=0;
-                   lvl_avl[3]=0;
-                   break;
-               case PLAYER_SKILL_SWORD:
-               case PLAYER_SKILL_SPEAR:
-                   lvl_avl[0]=0;
-                   lvl_avl[1]=0;
-                   lvl_avl[2]=0;
-                   lvl_avl[3]=1;
-                   break;
-               case PLAYER_SKILL_SHIELD:
-                    a1b = 1;
-                   lvl_avl[0]=1;
-                   lvl_avl[1]=0;
-                   lvl_avl[2]=1;
-                   lvl_avl[3]=0;
-                   break;
-               case PLAYER_SKILL_LEATHER:
-                   v71 = (ITEM_EQUIP_TYPE)1;
-                   lvl_avl[0]=1;
-                   lvl_avl[1]=0;
-                   lvl_avl[2]=1;
-                   lvl_avl[3]=0;
-
-                   break;
-               case PLAYER_SKILL_CHAIN:
-                    a1b = 1;
-                   lvl_avl[0]=1;
-                   lvl_avl[1]=0;
-                   lvl_avl[2]=0;
-                   lvl_avl[3]=0;
-                   break;
-               case PLAYER_SKILL_PLATE:
-                     a1b = 1; 
-                   lvl_avl[0]=1;
-                   lvl_avl[1]=0;
-                   lvl_avl[2]=0;
-                   lvl_avl[3]=0;
-                   break;
-               default:
-                   continue;
-                   }
-
-               v50= GetActualSkillLevel((PLAYER_SKILL_TYPE)v44);
-               v51 = v50;
-               v52 = SkillToMastery(v50);
-               v53 = v51 & 0x3F;
-               for ( i = 0; i < (signed int)v52; ++i )
-                   {
-                   if ( lvl_avl[i] )
-                       skill_bonus += v53;
-                   }
-
-               }
-          }
-
-      lvl_avl[0]=1;
-      lvl_avl[1]=1;
-      lvl_avl[2]=1;
-      lvl_avl[3]=0;
-
-      v55 = GetActualSkillLevel(PLAYER_SKILL_DODGE);
-      v56 = v55;
-      v57 = SkillToMastery(v55);
-      if ( !a1b && (!v71 || v57 == 4) )
-          {
-          v58 = v56 & 0x3F;
-          for ( j = 0; j < (signed int)v57; ++j )
-              {
-              if ( lvl_avl[j] )
-                  skill_bonus += v58;
-              }
-          }
-      return skill_bonus;
-
-    
-      }
-
-  if (a2 == CHARACTER_ATTRIBUTE_ATTACK)
-  {
-
-  if ( v2->IsUnarmed() == 1 )
-      {
+  {
+    a1b = 0;
+    v71 = (ITEM_EQUIP_TYPE)0;
+
+    for (j=0; j<16; ++j) 
+    {
+      if (pEquipment.pIndices[j]&&(!pOwnItems[ pEquipment.pIndices[j]].Broken()))
+      {
+        int curr_item =pOwnItems[pEquipment.pIndices[j]].uItemID;
+        v44=pItemsTable->pItems[curr_item].uSkillType;
+        switch (v44)
+        {
+        case PLAYER_SKILL_STAFF:
+
+          lvl_avl[0]=0;
+          lvl_avl[1]=1;
+          lvl_avl[2]=0;
+          lvl_avl[3]=0;
+          break;
+        case PLAYER_SKILL_SWORD:
+        case PLAYER_SKILL_SPEAR:
+          lvl_avl[0]=0;
+          lvl_avl[1]=0;
+          lvl_avl[2]=0;
+          lvl_avl[3]=1;
+          break;
+        case PLAYER_SKILL_SHIELD:
+          a1b = 1;
+          lvl_avl[0]=1;
+          lvl_avl[1]=0;
+          lvl_avl[2]=1;
+          lvl_avl[3]=0;
+          break;
+        case PLAYER_SKILL_LEATHER:
+          v71 = (ITEM_EQUIP_TYPE)1;
+          lvl_avl[0]=1;
+          lvl_avl[1]=0;
+          lvl_avl[2]=1;
+          lvl_avl[3]=0;
+
+          break;
+        case PLAYER_SKILL_CHAIN:
+          a1b = 1;
+          lvl_avl[0]=1;
+          lvl_avl[1]=0;
+          lvl_avl[2]=0;
+          lvl_avl[3]=0;
+          break;
+        case PLAYER_SKILL_PLATE:
+          a1b = 1; 
+          lvl_avl[0]=1;
+          lvl_avl[1]=0;
+          lvl_avl[2]=0;
+          lvl_avl[3]=0;
+          break;
+        default:
+          continue;
+        }
+
+        v50= GetActualSkillLevel((PLAYER_SKILL_TYPE)v44);
+        v51 = v50;
+        v52 = SkillToMastery(v50);
+        v53 = v51 & 0x3F;
+        for ( i = 0; i < (signed int)v52; ++i )
+        {
+          if ( lvl_avl[i] )
+            skill_bonus += v53;
+        }
+      }
+    }
+
+    lvl_avl[0]=1;
+    lvl_avl[1]=1;
+    lvl_avl[2]=1;
+    lvl_avl[3]=0;
+
+    v55 = GetActualSkillLevel(PLAYER_SKILL_DODGE);
+    v56 = v55;
+    v57 = SkillToMastery(v55);
+    if ( !a1b && (!v71 || v57 == 4) )
+    {
+      v58 = v56 & 0x3F;
+      for ( j = 0; j < (signed int)v57; ++j )
+      {
+        if ( lvl_avl[j] )
+          skill_bonus += v58;
+      }
+    }
+    return skill_bonus;
+  }
+
+	if (a2 == CHARACTER_ATTRIBUTE_ATTACK)
+  {
+    if ( v2->IsUnarmed() == 1 )
+    {
       v33 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
       v34 = v33;
       if ( !v33 )
-          return skill_bonus;
+        return skill_bonus;
       if ( SkillToMastery(v33) >= 3 )
-          multiplier = 2;
+        multiplier = 2;
       else 
-          multiplier=1;
+        multiplier=1;
       v30 = multiplier * (v34 & 0x3F);
       return arm_bonus + v30;
-      }
-  v35 = (ITEM_EQUIP_TYPE)0;
-  v68 = 0;
-  for (i=0; i<16 ; ++i)
-      {
+    }
+    v35 = (ITEM_EQUIP_TYPE)0;
+    v68 = 0;
+    for (i=0; i<16 ; ++i)
+    {
       if ( v2->HasItemEquipped((ITEM_EQUIP_TYPE)i) )
-          {
-          v37 = v2->pEquipment.pIndices[i]-1;
-          if ( pItemsTable->pItems[v37].uEquipType <= EQUIP_MAIN_HAND)
-              break;
-          }
-      }
-  if ( i >= 16 )
+      {
+        v37 = v2->pEquipment.pIndices[i]-1;
+        if ( pItemsTable->pItems[v37].uEquipType <= EQUIP_MAIN_HAND)
+          break;
+      }
+    }
+    if ( i >= 16 )
       return skill_bonus;
-  
-  v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType;
-  a1a = v2->GetActualSkillLevel(v38);
-  v39=  SkillToMastery(a1a);
-  v71 = (ITEM_EQUIP_TYPE)0;
-  switch (v38)
-      {
-  case PLAYER_SKILL_STAFF:
+
+    v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType;
+    a1a = v2->GetActualSkillLevel(v38);
+    v39=  SkillToMastery(a1a);
+    v71 = (ITEM_EQUIP_TYPE)0;
+    switch (v38)
+    {
+    case PLAYER_SKILL_STAFF:
       v71 = (ITEM_EQUIP_TYPE)1;
       if ( v39 == 4 )
-          {
-          v40 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
-          v41 = v40;
-
-          if ( v40 )
-              {
-              if ( SkillToMastery(v40) >= 3 )
-                  multiplier = 2;
-              else 
-                  multiplier=1;
-              v68 = multiplier * (v41 & 0x3F);
-              }
-          }
+      {
+        v40 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
+        v41 = v40;
+
+        if ( v40 )
+        {
+          if ( SkillToMastery(v40) >= 3 )
+            multiplier = 2;
+          else 
+            multiplier=1;
+          v68 = multiplier * (v41 & 0x3F);
+        }
+      }
       break;
-  case PLAYER_SKILL_SWORD:
-  case PLAYER_SKILL_DAGGER:
-  case PLAYER_SKILL_AXE:
-  case PLAYER_SKILL_SPEAR:
-  case PLAYER_SKILL_MACE:
-            v71 = (ITEM_EQUIP_TYPE)1;
-        break;
-  case PLAYER_SKILL_BLASTER:
+    case PLAYER_SKILL_SWORD:
+    case PLAYER_SKILL_DAGGER:
+    case PLAYER_SKILL_AXE:
+    case PLAYER_SKILL_SPEAR:
+    case PLAYER_SKILL_MACE:
+      v71 = (ITEM_EQUIP_TYPE)1;
+      break;
+    case PLAYER_SKILL_BLASTER:
 
       switch (v39)
-          {
+      {
       case 0: multiplier=1; break;
       case 1: multiplier=3; break;
       case 3: multiplier=3; break;
       case 4: multiplier=5; break;
-          }
+      }
       v5 = multiplier;
       return v5 * (a1a & 0x3F);
       break;
-      }
-
-
-  
-  v30 = v68 + v71 * (a1a & 0x3F);
-  return (int)((char *)v69 + v30);
-
-  }
-
-
-  if ( a2 != 9 )
-  {
-   
-      if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK )
+    }
+
+    v30 = v68 + v71 * (a1a & 0x3F);
+    return (int)((char *)v69 + v30);
+  }
+
+
+	if ( a2 != 9 )
+  {
+    if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK )
+      return skill_bonus;
+    if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX )
+    {
+      if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK )
         return skill_bonus;
-      if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX )
-      {
-        if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK )
+      v71 = (ITEM_EQUIP_TYPE)0;
+      v9 = &v2->pEquipment;
+      while ( 1 )
+      {
+        if ( v2->HasItemEquipped(v71) )
+        {
+          v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItemList[*(_DWORD *)v9].uItemID].uEquipType;
+          LOBYTE(v12) = this->GetActualSkillLevel(v11);
+          a1 = v12;
+          SkillToMastery(v12);
+          v13 = v11 - 5;
+          if ( !v13 )
+            return a1 & 0x3F;
+          if ( v13 == 2 )
+            break;
+        }
+        v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1);
+        v9 = (PlayerEquipment *)((char *)v9 + 4);
+        if ( (signed int)v71 >= 16 )
           return skill_bonus;
-        v71 = (ITEM_EQUIP_TYPE)0;
-        v9 = &v2->pEquipment;
-        while ( 1 )
+      }
+      v14 = a1;
+      v15 = 1;
+      if ( (signed int)SkillToMastery(a1) >= 4 )
+      {
+        v62 = 5;
+        goto LABEL_31;
+      }
+      if ( (signed int)SkillToMastery(a1) >= 3 )
+      {
+        v62 = 3;
+        goto LABEL_31;
+      }
+      if ( (signed int)SkillToMastery(a1) < 2 )
+        goto LABEL_32;
+      goto LABEL_30;
+    }
+    if ( v2->IsUnarmed() )
+    {
+      LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
+      v14 = v18;
+      if ( !v18 )
+        return skill_bonus;
+      v15 = 0;
+      v19 = SkillToMastery(v18);
+      if ( (signed int)v19 < 3 )
+      {
+        if ( (signed int)v19 >= 2 )
+          v15 = 1;
+LABEL_32:
+        v16 = v14;
+        return v15 * (v16 & 0x3F);
+      }
+LABEL_30:
+      v62 = 2;
+LABEL_31:
+      v15 = v62;
+      goto LABEL_32;
+    }
+    v20 = (ITEM_EQUIP_TYPE)0;
+    while ( 1 )
+    {
+      if ( v2->HasItemEquipped(v20) )
+      {
+        v22 = this->pInventoryItemList[this->pEquipment.pIndices[v20]].uItemID;
+        if ( pItemsTable->pItems[v22].uEquipType <= 1u )
+          break;
+      }
+      v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1);
+      if ( (signed int)v20 >= 16 )
+        return skill_bonus;
+    }
+    v71 = (ITEM_EQUIP_TYPE)0;
+    v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType;
+    LOBYTE(v24) = v2->GetActualSkillLevel(v23);
+    v25 = v24;
+    v26 = SkillToMastery(v24);
+    if ( !v23 )
+    {
+      if ( (signed int)SkillToMastery(v25) >= 4 )
+      {
+        LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
+        LOBYTE(v25) = v31;
+        if ( v31 )
         {
-          if ( v2->HasItemEquipped(v71) )
+          v15 = 0;
+          v32 = SkillToMastery(v31);
+          if ( (signed int)v32 < 3 )
           {
-            v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItemList[*(_DWORD *)v9].uItemID].uEquipType;
-            LOBYTE(v12) = this->GetActualSkillLevel(v11);
-            a1 = v12;
-            SkillToMastery(v12);
-            v13 = v11 - 5;
-            if ( !v13 )
-              return a1 & 0x3F;
-            if ( v13 == 2 )
-              break;
+            if ( (signed int)v32 >= 2 )
+              v15 = 1;
           }
-          v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1);
-          v9 = (PlayerEquipment *)((char *)v9 + 4);
-          if ( (signed int)v71 >= 16 )
-            return skill_bonus;
-        }
-        v14 = a1;
-        v15 = 1;
-        if ( (signed int)SkillToMastery(a1) >= 4 )
-        {
-          v62 = 5;
-          goto LABEL_31;
-        }
-        if ( (signed int)SkillToMastery(a1) >= 3 )
-        {
-          v62 = 3;
-          goto LABEL_31;
-        }
-        if ( (signed int)SkillToMastery(a1) < 2 )
-          goto LABEL_32;
-        goto LABEL_30;
-      }
-      if ( v2->IsUnarmed() )
-      {
-        LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
-        v14 = v18;
-        if ( !v18 )
-          return skill_bonus;
-        v15 = 0;
-        v19 = SkillToMastery(v18);
-        if ( (signed int)v19 < 3 )
-        {
-          if ( (signed int)v19 >= 2 )
-            v15 = 1;
-LABEL_32:
-          v16 = v14;
+          else
+          {
+            v15 = 2;
+          }
+          v16 = v25;
           return v15 * (v16 & 0x3F);
         }
-LABEL_30:
-        v62 = 2;
-LABEL_31:
-        v15 = v62;
-        goto LABEL_32;
-      }
-      v20 = (ITEM_EQUIP_TYPE)0;
-      while ( 1 )
-      {
-        if ( v2->HasItemEquipped(v20) )
-        {
-          v22 = this->pInventoryItemList[this->pEquipment.pIndices[v20]].uItemID;
-          if ( pItemsTable->pItems[v22].uEquipType <= 1u )
-            break;
-        }
-        v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1);
-        if ( (signed int)v20 >= 16 )
-          return skill_bonus;
-      }
-      v71 = (ITEM_EQUIP_TYPE)0;
-      v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType;
-      LOBYTE(v24) = v2->GetActualSkillLevel(v23);
-      v25 = v24;
-      v26 = SkillToMastery(v24);
-      if ( !v23 )
-      {
-        if ( (signed int)SkillToMastery(v25) >= 4 )
+      }
+      goto LABEL_55;
+    }
+    if ( v23 == PLAYER_SKILL_DAGGER )
+    {
+      v29 = SkillToMastery(v25);
+      v28 = __OFSUB__(v29, 4);
+      v27 = ((v29 - 4) & 0x80000000u) != 0;
+    }
+    else
+    {
+      if ( v23 <= PLAYER_SKILL_DAGGER )
+        goto LABEL_55;
+      if ( v23 > PLAYER_SKILL_SPEAR )
+      {
+        if ( v23 == PLAYER_SKILL_MACE )
         {
-          LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
-          LOBYTE(v25) = v31;
-          if ( v31 )
-          {
-            v15 = 0;
-            v32 = SkillToMastery(v31);
-            if ( (signed int)v32 < 3 )
-            {
-              if ( (signed int)v32 >= 2 )
-                v15 = 1;
-            }
-            else
-            {
-              v15 = 2;
-            }
-            v16 = v25;
-            return v15 * (v16 & 0x3F);
-          }
+          v28 = __OFSUB__(v26, 2);
+          v27 = v26 - 2 < 0;
+          goto LABEL_53;
         }
-        goto LABEL_55;
-      }
-      if ( v23 == PLAYER_SKILL_DAGGER )
-      {
-        v29 = SkillToMastery(v25);
-        v28 = __OFSUB__(v29, 4);
-        v27 = ((v29 - 4) & 0x80000000u) != 0;
-      }
-      else
-      {
-        if ( v23 <= PLAYER_SKILL_DAGGER )
-          goto LABEL_55;
-        if ( v23 > PLAYER_SKILL_SPEAR )
-        {
-          if ( v23 == PLAYER_SKILL_MACE )
-          {
-            v28 = __OFSUB__(v26, 2);
-            v27 = v26 - 2 < 0;
-            goto LABEL_53;
-          }
 LABEL_55:
-          v30 = v71 * (v25 & 0x3F);
-          return (int)((char *)v69 + v30);
-        }
-        v28 = __OFSUB__(v26, 3);
-        v27 = v26 - 3 < 0;
-      }
+        v30 = v71 * (v25 & 0x3F);
+        return (int)((char *)v69 + v30);
+      }
+      v28 = __OFSUB__(v26, 3);
+      v27 = v26 - 3 < 0;
+    }
 LABEL_53:
-      if ( !(v27 ^ v28) )
-        v71 = (ITEM_EQUIP_TYPE)1;
-      goto LABEL_55;
-    }
+    if ( !(v27 ^ v28) )
+      v71 = (ITEM_EQUIP_TYPE)1;
+    goto LABEL_55;
+  }
     
   
-    assert(false && "Unknown attribute!");
-    return 0;
+  assert(false && "Unknown attribute!");
+  return 0;
 }
 
 //----- (00490109) --------------------------------------------------------