diff Actor.cpp @ 1857:f357e4cbd169

Actor::AI_SpellAttack moved spells into a huge case
author Grumpy7
date Mon, 14 Oct 2013 00:58:05 +0200
parents 656962b05d32
children d7c028a6a084
line wrap: on
line diff
--- a/Actor.cpp	Mon Oct 14 00:46:09 2013 +0200
+++ b/Actor.cpp	Mon Oct 14 00:58:05 2013 +0200
@@ -404,296 +404,245 @@
       }
       return;
       break;
-  }
+
 
-  if ( uSpellID <= 47 )
-  {
-    if ( uSpellID != 47 )
-    {
-      if ( uSpellID <= 18 )
+    case 5:
+      if (masteryLevel == 0)
+      {
+        v39 = 0;
+      }
+      else if (masteryLevel == 1 || masteryLevel == 2)
+      {
+        v39 = 60 * (realPoints + 60);
+      }
+      else if (masteryLevel == 3 )
       {
-        if ( uSpellID != 5 )
-        {
-          if ( uSpellID != 9 )
-          {
-            if ( uSpellID != 11 )
-            {
-              if ( uSpellID != 15 )
-              {
-                if ( uSpellID != 17 )
-                  return;
+        v39 = 180 * (realPoints + 20);
+      }
+      else if (masteryLevel == 4 ) 
+      {
+        v39 = 240 * (realPoints + 15);
+      }
+      v5->pActorBuffs[19].Apply(
+        pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335),
+        masteryLevel,
+        0,
+        0,
+        0);
+      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFF3C1Eu);
+      v40 = 8 * LODWORD(v120);
+      LOBYTE(v40) = PID(OBJECT_Actor,LOBYTE(v120));
+      v99 = v40;
+      v98 = (SoundID)10040;
+      pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+      return;
 
-                if (masteryLevel == 0)
-                {
-                  v8 = 0;
-                }
-                else if (masteryLevel == 1 || masteryLevel == 2)
-                {
-                  v9 = 300 * realPoints;
-                  v8 = v9 + 3840;
-                }
-                else if (masteryLevel == 3 )
-                {
-                  v9 = 900 * realPoints;
-                  v8 = v9 + 3840;
-                }
-                else if (masteryLevel == 4 ) 
-                {
-                  v8 = 3600 * (realPoints + 64);
-                }
-                v5->pActorBuffs[15].Apply(
-                  pParty->uTimePlayed + (signed int)(signed __int64)((double)(v8 << 7) * 0.033333335),
-                  masteryLevel,
-                  0,
-                  0,
-                  0);
-                return;
-              }
-              if (masteryLevel <= 1)
-                v10 = 3;
-              else if (masteryLevel == 2 )
-                v10 = 5;
-              else if (masteryLevel == 3 )
-                v10 = 7;
-              else if (masteryLevel == 4 ) 
-                v10 = 9;
-              spellnuma = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
-              a1.uType = stru_4E3ACC[15].uType;
-              v118 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v10 - 1);
-              v11 = 0;
-              for (unsigned int i = 0; i < pObjectList->uNumObjects; i++)
-              {
-                if (stru_4E3ACC[15].uType == pObjectList->pObjects[i].uObjectID)
-                {
-                  v11 = i;
-                  break;
-                }
-              }
-              a1.uObjectDescID = v11;
-              a1.stru_24.Reset();
-              a1.spell_id = SPELL_AIR_SPARKS;
-              v13 = v5->vPosition.x;
-              v14 = v5->vPosition.y;
-              a1.spell_level = uSkillLevel;
-              a1.vPosition.x = v13;
-              v15 = v5->vPosition.z + ((signed int)v5->uActorHeight >> 1);
-              v16 = v117;
-              v17 = LOWORD(v117->uYawAngle);
-              a1.spell_skill = 0;
-              a1.vPosition.y = v14;
-              a1.vPosition.z = v15;
-              a1.uFacing = v17;
-              a1.uSoundID = 0;
-              a1.uAttributes = 0;
-              a1.uSectorID = pIndoor->GetSector(v13, v14, v15);
-              a1.spell_caster_pid = PID(OBJECT_Actor, LODWORD(v120));
-              a1.uSpriteFrameID = 0;
-              a1.spell_target_pid = 0;
-              a1.field_60_distance_related_prolly_lod = 3;
-              v19 = spellnuma / -2;
-              a1a = spellnuma / 2;
-              if ( spellnuma / -2 > spellnuma / 2 )
-              {
-                v20 = spellnuma / 2;
-              }
-              else
-              {
-                do
-                {
-                  a1.uFacing = v19 + LOWORD(v16->uYawAngle);
-                  v20 = a1.Create(
-                          (signed __int16)a1.uFacing,
-                          v16->uPitchAngle,
-                          pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
-                          0);
-                  v19 += v118;
-                }
-                while ( v19 <= a1a );
-              }
-              if ( v20 != -1 )
-              {
-                v21 = 8 * v20;
-                LOBYTE(v21) = v21 | 2;
-                v99 = v21;
-                v22 = (SoundID)word_4EE088_sound_ids[15];
-                v98 = v22;
-                pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
-                return;
-              }
-              return;
+    case 9:
+      if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
+        return;
+      v118 = pParty->vPosition.z;
+      v111 = pParty->vPosition.x;
+      v114 = pParty->vPosition.z + 2500;
+      v113 = pParty->vPosition.y;
+      v23 = 8;
+      if (masteryLevel == 2)
+        v23 = 10;
+      else if (masteryLevel == 3)
+        v23 = 12;
+      else if (masteryLevel == 4)
+        v23 = 14;
+      v119 = 0.0;
+      spellnumb = 0;
+      if ( v23 > 0 )
+      {
+        v24 = (double)v118;
+        v118 = v23;
+        v112 = v24;
+        v116 = PID(OBJECT_Actor,LODWORD(v120));
+        do
+        {
+          v26 = rand();
+          v27 = (double)spellnumb;
+          v110 = v27;
+          v28 = (double)SLODWORD(v119);
+          v30 = v26 % 1000;
+          v25 = (double)v114;
+          spellnumc = (double)(v26 % 1000) + v112 - v25;
+          v120 = v28 * v28;
+          v119 = v27 * v27;
+          if ( sqrt(spellnumc * spellnumc + v119 + v120) <= 1.0 )
+          {
+            v32 = 0;
+            pitch = 0;
+          }
+          else
+          {
+            v31 = (signed __int64)sqrt(v119 + v120);
+            v29 = v28;
+            v32 = stru_5C6E00->Atan2((signed __int64)v110, (signed __int64)v29);
+            pitch = stru_5C6E00->Atan2(v31, (signed __int64)spellnumc);
+          }
+          a1.stru_24.Reset();
+          a1.uType = stru_4E3ACC[9].uType;
+          v34 = 0;
+          for (int i = 0; i < pObjectList->uNumObjects; i++)
+          {
+            if (pObjectList->pObjects[i].uObjectID == a1.uType)
+            {
+              v34 = i;
+              break;
             }
           }
-          if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
-            return;
-          v118 = pParty->vPosition.z;
-          v111 = pParty->vPosition.x;
-          v114 = pParty->vPosition.z + 2500;
-          v113 = pParty->vPosition.y;
-          v23 = 8;
-          if (masteryLevel == 2)
-            v23 = 10;
-          else if (masteryLevel == 3)
-            v23 = 12;
-          else if (masteryLevel == 4)
-            v23 = 14;
-          v119 = 0.0;
-          spellnumb = 0;
-          if ( v23 > 0 )
+          a1.uObjectDescID = v34;
+          a1.spell_level = uSkillLevel;
+          a1.vPosition.x = v111;
+          a1.vPosition.y = v113;
+          a1.vPosition.z = v30 + v114;
+          a1.spell_id = SPELL_FIRE_METEOR_SHOWER;
+          a1.spell_skill = 0;
+          a1.uAttributes = 0;
+          a1.uSectorID = 0;
+          a1.uSpriteFrameID = 0;
+          a1.spell_caster_pid = v116;
+          a1.spell_target_pid = 0;
+          a1.field_60_distance_related_prolly_lod = stru_50C198._427546(v30 + 2500);
+          a1.uFacing = v32;
+          a1.uSoundID = 0;
+          v35 = v117->uDistance;
+          LODWORD(v119) = v117->uDistance;
+          if ((double)v119 < 307.2 )
+            a1.field_60_distance_related_prolly_lod = 0;
+          else if ( v119 < 1024 )
+            a1.field_60_distance_related_prolly_lod = 1;
+          else if ( v119 < 2560 )
+            a1.field_60_distance_related_prolly_lod = 2;
+          else 
+            a1.field_60_distance_related_prolly_lod = 3;
+          a1.field_61 = 2;
+          v36 = a1.Create(
+            v32,
+            pitch,
+            pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
+            0);
+          if ( v36 != -1 )
           {
-            v24 = (double)v118;
-            v118 = v23;
-            v112 = v24;
-            v116 = PID(OBJECT_Actor,LODWORD(v120));
-            do
-            {
-              v26 = rand();
-              v27 = (double)spellnumb;
-              v110 = v27;
-              v28 = (double)SLODWORD(v119);
-              v30 = v26 % 1000;
-              v25 = (double)v114;
-              spellnumc = (double)(v26 % 1000) + v112 - v25;
-              v120 = v28 * v28;
-              v119 = v27 * v27;
-              if ( sqrt(spellnumc * spellnumc + v119 + v120) <= 1.0 )
-              {
-                v32 = 0;
-                pitch = 0;
-              }
-              else
-              {
-                v31 = (signed __int64)sqrt(v119 + v120);
-                v29 = v28;
-                v32 = stru_5C6E00->Atan2((signed __int64)v110, (signed __int64)v29);
-                pitch = stru_5C6E00->Atan2(v31, (signed __int64)spellnumc);
-              }
-              a1.stru_24.Reset();
-              a1.uType = stru_4E3ACC[9].uType;
-              v34 = 0;
-              for (int i = 0; i < pObjectList->uNumObjects; i++)
-              {
-                if (pObjectList->pObjects[i].uObjectID == a1.uType)
-                {
-                  v34 = i;
-                  break;
-                }
-              }
-              a1.uObjectDescID = v34;
-              a1.spell_level = uSkillLevel;
-              a1.vPosition.x = v111;
-              a1.vPosition.y = v113;
-              a1.vPosition.z = v30 + v114;
-              a1.spell_id = SPELL_FIRE_METEOR_SHOWER;
-              a1.spell_skill = 0;
-              a1.uAttributes = 0;
-              a1.uSectorID = 0;
-              a1.uSpriteFrameID = 0;
-              a1.spell_caster_pid = v116;
-              a1.spell_target_pid = 0;
-              a1.field_60_distance_related_prolly_lod = stru_50C198._427546(v30 + 2500);
-              a1.uFacing = v32;
-              a1.uSoundID = 0;
-              v35 = v117->uDistance;
-              LODWORD(v119) = v117->uDistance;
-              if ((double)v119 < 307.2 )
-                a1.field_60_distance_related_prolly_lod = 0;
-              else if ( v119 < 1024 )
-                a1.field_60_distance_related_prolly_lod = 1;
-              else if ( v119 < 2560 )
-                a1.field_60_distance_related_prolly_lod = 2;
-              else 
-                a1.field_60_distance_related_prolly_lod = 3;
-              a1.field_61 = 2;
-              v36 = a1.Create(
-                      v32,
-                      pitch,
-                      pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
-                      0);
-              if ( v36 != -1 )
-              {
-                v37 = 8 * v36;
-                LOBYTE(v37) = v37 | 2;
-                pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[9], v37, 0, -1, 0, 0, 0, 0);
-              }
-              spellnumb = rand() % 1024 - 512;
-              v38 = rand();
-              v49 = v118-- == 1;
-              LODWORD(v119) = (unsigned __int64)(v38 % 1024) - 512;
-            }
-            while ( !v49 );
+            v37 = 8 * v36;
+            LOBYTE(v37) = v37 | 2;
+            pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[9], v37, 0, -1, 0, 0, 0, 0);
           }
-          return;
-        }
-
-        if (masteryLevel == 0)
-        {
-          v39 = 0;
+          spellnumb = rand() % 1024 - 512;
+          v38 = rand();
+          v49 = v118-- == 1;
+          LODWORD(v119) = (unsigned __int64)(v38 % 1024) - 512;
         }
-        else if (masteryLevel == 1 || masteryLevel == 2)
+        while ( !v49 );
+      }
+      return;
+      break;
+
+    case 15:
+      if (masteryLevel <= 1)
+        v10 = 3;
+      else if (masteryLevel == 2 )
+        v10 = 5;
+      else if (masteryLevel == 3 )
+        v10 = 7;
+      else if (masteryLevel == 4 ) 
+        v10 = 9;
+      spellnuma = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
+      a1.uType = stru_4E3ACC[15].uType;
+      v118 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v10 - 1);
+      v11 = 0;
+      for (unsigned int i = 0; i < pObjectList->uNumObjects; i++)
+      {
+        if (stru_4E3ACC[15].uType == pObjectList->pObjects[i].uObjectID)
         {
-          v39 = 60 * (realPoints + 60);
-        }
-        else if (masteryLevel == 3 )
-        {
-          v39 = 180 * (realPoints + 20);
+          v11 = i;
+          break;
         }
-        else if (masteryLevel == 4 ) 
+      }
+      a1.uObjectDescID = v11;
+      a1.stru_24.Reset();
+      a1.spell_id = SPELL_AIR_SPARKS;
+      v13 = v5->vPosition.x;
+      v14 = v5->vPosition.y;
+      a1.spell_level = uSkillLevel;
+      a1.vPosition.x = v13;
+      v15 = v5->vPosition.z + ((signed int)v5->uActorHeight >> 1);
+      v16 = v117;
+      v17 = LOWORD(v117->uYawAngle);
+      a1.spell_skill = 0;
+      a1.vPosition.y = v14;
+      a1.vPosition.z = v15;
+      a1.uFacing = v17;
+      a1.uSoundID = 0;
+      a1.uAttributes = 0;
+      a1.uSectorID = pIndoor->GetSector(v13, v14, v15);
+      a1.spell_caster_pid = PID(OBJECT_Actor, LODWORD(v120));
+      a1.uSpriteFrameID = 0;
+      a1.spell_target_pid = 0;
+      a1.field_60_distance_related_prolly_lod = 3;
+      v19 = spellnuma / -2;
+      a1a = spellnuma / 2;
+      if ( spellnuma / -2 > spellnuma / 2 )
+      {
+        v20 = spellnuma / 2;
+      }
+      else
+      {
+        do
         {
-          v39 = 240 * (realPoints + 15);
+          a1.uFacing = v19 + LOWORD(v16->uYawAngle);
+          v20 = a1.Create(
+            (signed __int16)a1.uFacing,
+            v16->uPitchAngle,
+            pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
+            0);
+          v19 += v118;
         }
-        v5->pActorBuffs[19].Apply(
-          pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335),
-          masteryLevel,
-          0,
-          0,
-          0);
-        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFF3C1Eu);
-        v40 = 8 * LODWORD(v120);
-        LOBYTE(v40) = PID(OBJECT_Actor,LOBYTE(v120));
-        v99 = v40;
-        v98 = (SoundID)10040;
+        while ( v19 <= a1a );
+      }
+      if ( v20 != -1 )
+      {
+        v21 = 8 * v20;
+        LOBYTE(v21) = v21 | 2;
+        v99 = v21;
+        v22 = (SoundID)word_4EE088_sound_ids[15];
+        v98 = v22;
         pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
         return;
       }
-      if ( uSpellID != 38 )
-      {
-        if ( uSpellID != 46 )
-          return;
+      return;
+      break;
 
-        if (masteryLevel == 0)
-        {
-          v42 = 0;
-        }
-        else if (masteryLevel == 1 || masteryLevel == 2)
-        {
-          v41 = 300 * realPoints;
-          v42 = v41 + 3840;
-        }
-        else if (masteryLevel == 3 )
-        {
-          v41 = 900 * realPoints;
-          v42 = v41 + 3840;
-        }
-        else if (masteryLevel == 4 ) 
-        {
-          v41 = 1200 * realPoints;
-          v42 = v41 + 3840;
-        }
-        v5->pActorBuffs[17].Apply(
-          pParty->uTimePlayed + (signed int)(signed __int64)((double)(v42 << 7) * 0.033333335),
-          masteryLevel,
-          realPoints + 5,
-          0,
-          0);
-        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
-        v43 = 8 * LODWORD(v120);
-        LOBYTE(v43) = PID(OBJECT_Actor,LOBYTE(v120));
-        v99 = v43;
-        v98 = (SoundID)14010;
-        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
-        return;
+    case 17:
+      if (masteryLevel == 0)
+      {
+        v8 = 0;
+      }
+      else if (masteryLevel == 1 || masteryLevel == 2)
+      {
+        v9 = 300 * realPoints;
+        v8 = v9 + 3840;
       }
+      else if (masteryLevel == 3 )
+      {
+        v9 = 900 * realPoints;
+        v8 = v9 + 3840;
+      }
+      else if (masteryLevel == 4 ) 
+      {
+        v8 = 3600 * (realPoints + 64);
+      }
+      v5->pActorBuffs[15].Apply(
+        pParty->uTimePlayed + (signed int)(signed __int64)((double)(v8 << 7) * 0.033333335),
+        masteryLevel,
+        0,
+        0,
+        0);
+      return;
 
+    case 38:
       if (masteryLevel == 0)
       {
         v44 = 0;
@@ -725,37 +674,134 @@
       v98 = (SoundID)13040;
       pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
       return;
-    }
+
+    case 46:
+      if (masteryLevel == 0)
+      {
+        v42 = 0;
+      }
+      else if (masteryLevel == 1 || masteryLevel == 2)
+      {
+        v41 = 300 * realPoints;
+        v42 = v41 + 3840;
+      }
+      else if (masteryLevel == 3 )
+      {
+        v41 = 900 * realPoints;
+        v42 = v41 + 3840;
+      }
+      else if (masteryLevel == 4 ) 
+      {
+        v41 = 1200 * realPoints;
+        v42 = v41 + 3840;
+      }
+      v5->pActorBuffs[17].Apply(
+        pParty->uTimePlayed + (signed int)(signed __int64)((double)(v42 << 7) * 0.033333335),
+        masteryLevel,
+        realPoints + 5,
+        0,
+        0);
+      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
+      v43 = 8 * LODWORD(v120);
+      LOBYTE(v43) = PID(OBJECT_Actor,LOBYTE(v120));
+      v99 = v43;
+      v98 = (SoundID)14010;
+      pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+      return;
+      break;
+
+    case 47:
+      if (masteryLevel == 0)
+      {
+        LOWORD(v48) = 0;
+      }
+      else if (masteryLevel == 1 || masteryLevel == 2)
+      {
+        v48 = 2 * realPoints + 40;
+      }
+      else if (masteryLevel == 3 )
+      {
+        v48 = 3 * realPoints + 60;
+      }
+      else if (masteryLevel == 4 ) 
+      {
+        LOWORD(v48) = 2 * (3 * realPoints + 60);
+      }
+      v5->pActorBuffs[11].Apply(pParty->uTimePlayed + 1280, masteryLevel, v48, 0, 0);
+      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
+      v50 = 8 * LODWORD(v120);
+      LOBYTE(v50) = PID(OBJECT_Actor,LOBYTE(v120));
+      v99 = v50;
+      v98 = (SoundID)14020;
+      pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+      return;
 
-    if (masteryLevel == 0)
-    {
-      LOWORD(v48) = 0;
-    }
-    else if (masteryLevel == 1 || masteryLevel == 2)
-    {
-      v48 = 2 * realPoints + 40;
-    }
-    else if (masteryLevel == 3 )
-    {
-      v48 = 3 * realPoints + 60;
-    }
-    else if (masteryLevel == 4 ) 
-    {
-      LOWORD(v48) = 2 * (3 * realPoints + 60);
-    }
-    v5->pActorBuffs[11].Apply(pParty->uTimePlayed + 1280, masteryLevel, v48, 0, 0);
-    pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
-    v50 = 8 * LODWORD(v120);
-    LOBYTE(v50) = PID(OBJECT_Actor,LOBYTE(v120));
-    v99 = v50;
-    v98 = (SoundID)14020;
-    pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
-    return;
-  }
-  if ( uSpellID <= 80 )
-  {
-    if ( uSpellID == 80 )
-    {
+    case 51:
+      if (masteryLevel == 0)
+      {
+        v54 = 0;
+      }
+      else if (masteryLevel == 1 || masteryLevel == 2)
+      {
+        v53 = 300 * realPoints;
+        v54 = v53 + 3840;
+      }
+      else if (masteryLevel == 3 )
+      {
+        v53 = 900 * realPoints;
+        v54 = v53 + 3840;
+      }
+      else if (masteryLevel == 4 ) 
+      {
+        v53 = 1200 * realPoints;
+        v54 = v53 + 3840;
+      }
+      v5->pActorBuffs[18].Apply(
+        pParty->uTimePlayed + (signed int)(signed __int64)((double)(v54 << 7) * 0.033333335),
+        masteryLevel,
+        realPoints + 5,
+        0,
+        0);
+      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
+      v55 = 8 * LODWORD(v120);
+      LOBYTE(v55) = PID(OBJECT_Actor,LOBYTE(v120));
+      v99 = v55;
+      v98 = (SoundID)14060;
+      pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+      return;
+
+    case 73:
+      if ( (signed int)masteryLevel <= 0 || (signed int)masteryLevel > 4 )
+        v51 = 0;
+      else
+        v51 = 3600 * realPoints;
+      v5->pActorBuffs[21].Apply(
+        pParty->uTimePlayed + (signed int)(signed __int64)((double)(v51 << 7) * 0.033333335),
+        masteryLevel,
+        realPoints,
+        0,
+        0);
+      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xA81376u);
+      v52 = 8 * LODWORD(v120);
+      LOBYTE(v52) = PID(OBJECT_Actor,LOBYTE(v120));
+      v99 = v52;
+      v98 = (SoundID)16060;
+      pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+      return;
+
+    case 77:
+      v5->sCurrentHP += 5 * realPoints + 10;
+      if ( v5->sCurrentHP >= (signed int)v5->pMonsterInfo.uHP )
+        v5->sCurrentHP = LOWORD(v5->pMonsterInfo.uHP);
+      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xA81376u);
+      v50 = 8 * LODWORD(v120);
+      LOBYTE(v50) = PID(OBJECT_Actor,LOBYTE(v120));
+      v99 = v50;
+      v98 = (SoundID)14020;
+      pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+      return;
+
+    case 80:
       for (int i = 0; i < 20; i++ )
       {
         pParty->pPartyBuffs[i].Reset();
@@ -785,251 +831,176 @@
       v98 = v22;
       pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
       return;
-    }
-    if ( uSpellID != 51 )
-    {
-      if ( uSpellID == 73 )
+
+    case 85:
+      if (masteryLevel == 0)
+      {
+        LOWORD(realPoints) = uSkillLevel;
+        v96 = 0;
+      }
+      else if (masteryLevel == 1 || masteryLevel == 2)
+      {
+        v96 = 300 * realPoints + 3840;
+      }
+      else if (masteryLevel == 3 )
+      {
+        LOWORD(realPoints) = 3 * realPoints;
+        v96 = 900 * (uSkillLevel & 0x3F) + 3840;
+      }
+      else if (masteryLevel == 4 ) 
+      {
+        v96 = 1200 * realPoints + 3840;
+        LOWORD(realPoints) = 4 * realPoints;
+      }
+      v5->pActorBuffs[13].Apply(
+        pParty->uTimePlayed + (signed int)(signed __int64)((double)(v96 << 7) * 0.033333335),
+        masteryLevel,
+        realPoints,
+        0,
+        0);
+      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu);
+      v97 = 8 * LODWORD(v120);
+      LOBYTE(v97) = PID(OBJECT_Actor,LOBYTE(v120));
+      v99 = v97;
+      v98 = (SoundID)17070;
+      pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+      return;
+
+    case 86:
+      if (masteryLevel == 0)
+      {
+        v94 = 0;
+      } 
+      else if (masteryLevel == 1 || masteryLevel == 2)
+      {
+        v93 = 300 * realPoints;
+        v94 = v93 + 3840;
+      }
+      else if (masteryLevel == 3)
+      {
+        v93 = 900 * realPoints;
+        v94 = v93 + 3840;
+      }
+      else // if (v7 == 4)
       {
-        if ( (signed int)masteryLevel <= 0 || (signed int)masteryLevel > 4 )
-          v51 = 0;
-        else
-          v51 = 3600 * realPoints;
-        v5->pActorBuffs[21].Apply(
-          pParty->uTimePlayed + (signed int)(signed __int64)((double)(v51 << 7) * 0.033333335),
-          masteryLevel,
-          realPoints,
-          0,
-          0);
-        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xA81376u);
-        v52 = 8 * LODWORD(v120);
-        LOBYTE(v52) = PID(OBJECT_Actor,LOBYTE(v120));
-        v99 = v52;
-        v98 = (SoundID)16060;
-        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
-        return;
+        v93 = 1200 * realPoints;
+        v94 = v93 + 3840;
+      }
+      v5->pActorBuffs[14].Apply(
+        pParty->uTimePlayed + (signed int)(signed __int64)((double)(v94 << 7) * 0.033333335),
+        masteryLevel,
+        realPoints + 5,
+        0,
+        0);
+      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu);
+      v95 = 8 * LODWORD(v120);
+      LOBYTE(v95) = PID(OBJECT_Actor,LOBYTE(v120));
+      v99 = v95;
+      v98 = (SoundID)17080;
+      pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+      return;
+
+    case 93:
+      v70 = 3;
+      if (masteryLevel == 2)
+        v108 = 5;
+      else if (masteryLevel == 3)
+        v108 = 7;
+      else if (masteryLevel == 4)
+        v108 = 9;
+
+      spellnume = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
+      a1.uType = stru_4E3ACC[SPELL_DARK_SHARPMETAL].uType;
+      v116 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v70 - 1);
+      v71 = 0;
+      for (int i = 0; i < pObjectList->uNumObjects; i++)
+      {
+        if (pObjectList->pObjects[i].uObjectID == stru_4E3ACC[SPELL_DARK_SHARPMETAL].uType)
+        {
+          v71 = i;
+          break;
+        }
       }
-      if ( uSpellID == 77 )
+      a1.uObjectDescID = v71;
+      a1.stru_24.Reset();
+      a1.spell_id = SPELL_DARK_SHARPMETAL;
+      v73 = v5->vPosition.x;
+      v74 = v5->vPosition.y;
+      a1.spell_level = uSkillLevel;
+      a1.vPosition.x = v73;
+      v75 = v5->vPosition.z + ((signed int)v5->uActorHeight >> 1);
+      v76 = v117;
+      v77 = LOWORD(v117->uYawAngle);
+      a1.spell_skill = 0;
+      a1.vPosition.y = v74;
+      a1.vPosition.z = v75;
+      a1.uFacing = v77;
+      a1.uSoundID = 0;
+      a1.uAttributes = 0;
+      a1.uSectorID = pIndoor->GetSector(v73, v74, v75);
+      a1.spell_caster_pid = PID(OBJECT_Actor, LODWORD(v120));
+      a1.uSpriteFrameID = 0;
+      a1.spell_target_pid = 0;
+      a1.field_60_distance_related_prolly_lod = 3;
+      a1c = spellnume / -2;
+      if ( spellnume / -2 > spellnume / 2 )
       {
-        v5->sCurrentHP += 5 * realPoints + 10;
-        if ( v5->sCurrentHP >= (signed int)v5->pMonsterInfo.uHP )
-          v5->sCurrentHP = LOWORD(v5->pMonsterInfo.uHP);
-        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xA81376u);
-        v50 = 8 * LODWORD(v120);
-        LOBYTE(v50) = PID(OBJECT_Actor,LOBYTE(v120));
-        v99 = v50;
-        v98 = (SoundID)14020;
+        v80 = spellnume / -2;
+      }
+      else
+      {
+        do
+        {
+          v79 = v76->uYawAngle;
+          a1.uFacing = a1c + LOWORD(v76->uYawAngle);
+          v80 = a1.Create(
+            v79,
+            v76->uPitchAngle,
+            pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
+            0);
+          a1c += v116;
+        }
+        while ( a1c <= spellnume / 2 );
+      }
+      if ( v80 != -1 )
+      {
+        v81 = 8 * v80;
+        LOBYTE(v81) = v81 | 2;
+        v99 = v81;
+        v22 = (SoundID)word_4EE088_sound_ids[93];
+        v98 = v22;
         pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
         return;
       }
+
+    case 95:
+      if (masteryLevel == 0)
+        v68 = 0;
+      else if (masteryLevel == 1 || (masteryLevel == 2) || (masteryLevel == 3))
+      {
+        v67 = 900 * realPoints;
+        v68 = v67 + 3840;
+      }
+      else
+      {
+        v67 = 300 * realPoints;
+        v68 = v67 + 3840;
+      }
+      v5->pActorBuffs[20].Apply(
+        pParty->uTimePlayed + (signed int)(signed __int64)((double)(v68 << 7) * 0.033333335),
+        masteryLevel,
+        0,
+        0,
+        0);
+      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0x7E7E7Eu);
+      v69 = 8 * LODWORD(v120);
+      LOBYTE(v69) = PID(OBJECT_Actor,LOBYTE(v120));
+      v99 = v69;
+      v98 = (SoundID)18060;
+      pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
       return;
-    }
-    if (masteryLevel == 0)
-    {
-      v54 = 0;
-    }
-    else if (masteryLevel == 1 || masteryLevel == 2)
-    {
-      v53 = 300 * realPoints;
-      v54 = v53 + 3840;
-    }
-    else if (masteryLevel == 3 )
-    {
-      v53 = 900 * realPoints;
-      v54 = v53 + 3840;
-    }
-    else if (masteryLevel == 4 ) 
-    {
-      v53 = 1200 * realPoints;
-      v54 = v53 + 3840;
-    }
-    v5->pActorBuffs[18].Apply(
-      pParty->uTimePlayed + (signed int)(signed __int64)((double)(v54 << 7) * 0.033333335),
-      masteryLevel,
-      realPoints + 5,
-      0,
-      0);
-    pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
-    v55 = 8 * LODWORD(v120);
-    LOBYTE(v55) = PID(OBJECT_Actor,LOBYTE(v120));
-    v99 = v55;
-    v98 = (SoundID)14060;
-    pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
-    return;
-  }
-  if ( uSpellID == 85 )
-  {
-    if (masteryLevel == 0)
-    {
-      LOWORD(realPoints) = uSkillLevel;
-      v96 = 0;
-    }
-    else if (masteryLevel == 1 || masteryLevel == 2)
-    {
-      v96 = 300 * realPoints + 3840;
-    }
-    else if (masteryLevel == 3 )
-    {
-      LOWORD(realPoints) = 3 * realPoints;
-      v96 = 900 * (uSkillLevel & 0x3F) + 3840;
-    }
-    else if (masteryLevel == 4 ) 
-    {
-      v96 = 1200 * realPoints + 3840;
-      LOWORD(realPoints) = 4 * realPoints;
-    }
-    v5->pActorBuffs[13].Apply(
-      pParty->uTimePlayed + (signed int)(signed __int64)((double)(v96 << 7) * 0.033333335),
-      masteryLevel,
-      realPoints,
-      0,
-      0);
-    pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu);
-    v97 = 8 * LODWORD(v120);
-    LOBYTE(v97) = PID(OBJECT_Actor,LOBYTE(v120));
-    v99 = v97;
-    v98 = (SoundID)17070;
-    pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
-    return;
-  }
-  if ( uSpellID == 86 )
-  {
-    if (masteryLevel == 0)
-    {
-      v94 = 0;
-    } 
-    else if (masteryLevel == 1 || masteryLevel == 2)
-    {
-      v93 = 300 * realPoints;
-      v94 = v93 + 3840;
-    }
-    else if (masteryLevel == 3)
-    {
-      v93 = 900 * realPoints;
-      v94 = v93 + 3840;
-    }
-    else // if (v7 == 4)
-    {
-      v93 = 1200 * realPoints;
-      v94 = v93 + 3840;
-    }
-    v5->pActorBuffs[14].Apply(
-      pParty->uTimePlayed + (signed int)(signed __int64)((double)(v94 << 7) * 0.033333335),
-      masteryLevel,
-      realPoints + 5,
-      0,
-      0);
-    pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu);
-    v95 = 8 * LODWORD(v120);
-    LOBYTE(v95) = PID(OBJECT_Actor,LOBYTE(v120));
-    v99 = v95;
-    v98 = (SoundID)17080;
-    pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
-    return;
-  }
-  if ( uSpellID != 93 )
-  {
-    if ( uSpellID != 95 )
-    {
-      return;
-    }
-    if (masteryLevel == 0)
-      v68 = 0;
-    else if (masteryLevel == 1 || (masteryLevel == 2) || (masteryLevel == 3))
-    {
-      v67 = 900 * realPoints;
-      v68 = v67 + 3840;
-    }
-    else
-    {
-      v67 = 300 * realPoints;
-      v68 = v67 + 3840;
-    }
-    v5->pActorBuffs[20].Apply(
-      pParty->uTimePlayed + (signed int)(signed __int64)((double)(v68 << 7) * 0.033333335),
-      masteryLevel,
-      0,
-      0,
-      0);
-    pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0x7E7E7Eu);
-    v69 = 8 * LODWORD(v120);
-    LOBYTE(v69) = PID(OBJECT_Actor,LOBYTE(v120));
-    v99 = v69;
-    v98 = (SoundID)18060;
-    pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
-    return;
   }
 
-  v70 = 3;
-  if (masteryLevel == 2)
-    v108 = 5;
-  else if (masteryLevel == 3)
-    v108 = 7;
-  else if (masteryLevel == 4)
-    v108 = 9;
-
-  spellnume = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
-  a1.uType = stru_4E3ACC[SPELL_DARK_SHARPMETAL].uType;
-  v116 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v70 - 1);
-  v71 = 0;
-  for (int i = 0; i < pObjectList->uNumObjects; i++)
-  {
-    if (pObjectList->pObjects[i].uObjectID == stru_4E3ACC[SPELL_DARK_SHARPMETAL].uType)
-    {
-      v71 = i;
-      break;
-    }
-  }
-  a1.uObjectDescID = v71;
-  a1.stru_24.Reset();
-  a1.spell_id = SPELL_DARK_SHARPMETAL;
-  v73 = v5->vPosition.x;
-  v74 = v5->vPosition.y;
-  a1.spell_level = uSkillLevel;
-  a1.vPosition.x = v73;
-  v75 = v5->vPosition.z + ((signed int)v5->uActorHeight >> 1);
-  v76 = v117;
-  v77 = LOWORD(v117->uYawAngle);
-  a1.spell_skill = 0;
-  a1.vPosition.y = v74;
-  a1.vPosition.z = v75;
-  a1.uFacing = v77;
-  a1.uSoundID = 0;
-  a1.uAttributes = 0;
-  a1.uSectorID = pIndoor->GetSector(v73, v74, v75);
-  a1.spell_caster_pid = PID(OBJECT_Actor, LODWORD(v120));
-  a1.uSpriteFrameID = 0;
-  a1.spell_target_pid = 0;
-  a1.field_60_distance_related_prolly_lod = 3;
-  a1c = spellnume / -2;
-  if ( spellnume / -2 > spellnume / 2 )
-  {
-    v80 = spellnume / -2;
-  }
-  else
-  {
-    do
-    {
-      v79 = v76->uYawAngle;
-      a1.uFacing = a1c + LOWORD(v76->uYawAngle);
-      v80 = a1.Create(
-              v79,
-              v76->uPitchAngle,
-              pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
-              0);
-      a1c += v116;
-    }
-    while ( a1c <= spellnume / 2 );
-  }
-  if ( v80 != -1 )
-  {
-    v81 = 8 * v80;
-    LOBYTE(v81) = v81 | 2;
-    v99 = v81;
-    v22 = (SoundID)word_4EE088_sound_ids[93];
-    v98 = v22;
-    pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
-    return;
-  }
 }
 
 //----- (0043ABB0) --------------------------------------------------------