changeset 1536:e264ce95f27d

Player:GetSkillBonus cleanup, undoing part of previous changeset to better track file modifications
author Grumpy7
date Sat, 07 Sep 2013 04:15:06 +0200
parents a18076b22fb7
children fed56133bf8a
files Player.cpp
diffstat 1 files changed, 42 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/Player.cpp	Sat Sep 07 04:13:22 2013 +0200
+++ b/Player.cpp	Sat Sep 07 04:15:06 2013 +0200
@@ -5148,16 +5148,27 @@
       }
       v71 = 0;
       v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType;
-      v25 = v2->GetActualSkillLevel(v23);
-      v26 = SkillToMastery(v25);
+      LOBYTE(v24) = v2->GetActualSkillLevel(v23);
+      v25 = v24;
+      v26 = SkillToMastery(v24);
       switch (v23)
       {
         case PLAYER_SKILL_STAFF:
           if ( (signed int)SkillToMastery(v25) >= 4 && v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0)
           {
             v31 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
-            multiplier = GetMultiplierForMastery(v31, 0, 1, 2, 2);
-            return multiplier * (v31 & 0x3F);
+            if ( v31 )
+            {
+              v32 = SkillToMastery(v31);
+              switch (v32)
+              {
+              case 1: multiplier=0; break;
+              case 2: multiplier=1; break;
+              case 3: multiplier=2; break;
+              case 4: multiplier=2; break;
+              }
+              return multiplier * (v31 & 0x3F);
+            }
           }
           else
           {
@@ -5166,7 +5177,14 @@
           break;
 
         case PLAYER_SKILL_DAGGER:
-          multiplier = GetMultiplierForMastery(v25, 0, 0, 0, 1);
+          v29 = SkillToMastery(v25);
+          switch (v29)
+          {
+            case 1: multiplier=0; break;
+            case 2: multiplier=0; break;
+            case 3: multiplier=0; break;
+            case 4: multiplier=1; break;
+          }
           v30 = multiplier * (v29 & 0x3F);
           return arm_bonus + v30;
           break;
@@ -5175,12 +5193,26 @@
           break;
         case PLAYER_SKILL_MACE:
         case PLAYER_SKILL_SPEAR:
-          multiplier = GetMultiplierForMastery(v25, 0, 1, 1, 1);
+          v29 = SkillToMastery(v25);
+          switch (v29)
+          {
+            case 1: multiplier=0; break;
+            case 2: multiplier=1; break;
+            case 3: multiplier=1; break;
+            case 4: multiplier=1; break;
+          }
           v30 = multiplier * (v29 & 0x3F);
           return arm_bonus + v30;
           break;
         case PLAYER_SKILL_AXE:
-          multiplier = GetMultiplierForMastery(v25, 0, 0, 1, 1);
+          v29 = SkillToMastery(v25);
+          switch (v29)
+          {
+            case 1: multiplier=0; break;
+            case 2: multiplier=0; break;
+            case 3: multiplier=1; break;
+            case 4: multiplier=1; break;
+          }
           v30 = multiplier * (v29 & 0x3F);
           return arm_bonus + v30;
           break;
@@ -5189,19 +5221,9 @@
   default:
     return 0;
   }
-}
-
-unsigned int Player::GetMultiplierForMastery(unsigned int skillValue, int mult1, int mult2, int mult3, int mult4)
-{
-  int masteryLvl = SkillToMastery(skillValue);
-  switch (masteryLvl)
-  {
-    case 1: return mult1;
-    case 2: return mult2;
-    case 3: return mult3;
-    case 4: return mult4;
-  }
-}
+    
+}
+
 //----- (00490109) --------------------------------------------------------
 // faces are:  0  1  2  3   human males
 //             4  5  6  7   human females