diff mm7_6.cpp @ 1009:a32318b557c7

CastSpellInfo::_427E01_cast_spell() more clean 2
author zipi
date Sat, 18 May 2013 20:19:38 +0100
parents 8073f9a70e8b
children 9e823ad5eaa6
line wrap: on
line diff
--- a/mm7_6.cpp	Sat May 18 22:41:26 2013 +0400
+++ b/mm7_6.cpp	Sat May 18 20:19:38 2013 +0100
@@ -2410,113 +2410,28 @@
 //----- (00427E01) --------------------------------------------------------
 void CastSpellInfo::_427E01_cast_spell()
 {
-  //int v1; // esi@1
   int v2; // edi@1
   CastSpellInfo *pCastSpell; // ebx@2
-  //signed int v4; // eax@8
-  //__int16 v5; // ax@9
   signed int v6; // eax@14
-  //__int16 v7; // ax@23
-  //__int16 v8; // ax@24
-  //char v9; // al@44
-  //int v10; // eax@45
   unsigned __int16 v11; // cx@45
-  //signed int v12; // ecx@48
-  //int v13; // eax@53
   unsigned __int8 v14; // zf@53
-  //unsigned int v15; // edx@53
-  //signed int v16; // eax@53
-  //Player *v17; // esi@70
-  //int v18; // eax@72
-  //int v19; // eax@74
-  Player *v20; // eax@74
   signed int i; // esi@76
-  //int v22; // eax@88
   __int16 v23; // ax@88
-  //int v24; // ecx@93
-  //int v25; // ecx@94
-  //signed __int64 v26; // qax@100
-  //char *v27; // ecx@100
-  //unsigned __int64 v28; // qax@102
-  int v29; // ecx@105
-  int v30; // ecx@106
-  //int v31; // eax@112
-  //int v32; // eax@112
-  //char *v33; // edx@113
-  //int v34; // eax@121
-  //int v35; // eax@123
-  //int v36; // edx@125
-  //int v37; // eax@129
-  //signed int v38; // edi@129
-  //signed int v39; // eax@129
-  //int v40; // ecx@129
-  //int v41; // eax@129
-  //signed int v42; // eax@129
-  //int *v43; // ecx@129
-  //int v44; // eax@132
-  //int v45; // ecx@132
-  int v46; // eax@132
-  //unsigned int v47; // edx@133
-  //int v48; // eax@137
-  //int v49; // eax@137
-  //int v50; // eax@141
   int v51; // eax@146
   __int16 v52; // ax@153
-  //int v53; // eax@153
   signed __int64 v54; // qax@164
   Actor *v55; // edi@164
-  //stru6 *v56; // eax@165
-  int v57; // eax@169
   signed __int64 v58; // qax@177
   Actor *pActor; // edi@177
   unsigned __int16 v60; // ax@184
   int v61; // ecx@184
-  //int v62; // eax@186
-  int v63; // ecx@187
-  int v64; // ecx@188
   int v65; // ecx@189
-  //const char *v66; // ecx@200
-  //unsigned int v67; // edx@201
-  char v68; // al@207
   ItemGen *v69; // esi@211
   int v70; // ecx@214
   int v71; // ecx@215
-  int v72; // ecx@216
-  //__int16 v73; // ST1C_2@222
-  //__int16 v74; // ST18_2@222
-  //stru6 *v75; // eax@222
-  //int v76; // ecx@223
-  //int v77; // ecx@224
-  //int v78; // ecx@225
-  //int v79; // eax@227
-  //int v80; // eax@232
-  //__int16 v81; // ST18_2@245
-  //stru6 *v82; // eax@245
-  //signed int v83; // edi@245
-  //__int16 v84; // ST18_2@245
-  //stru6 *v85; // eax@245
-  //__int16 v86; // ST18_2@245
-  //stru6 *v87; // eax@245
-  //__int16 v88; // ST18_2@245
-  //stru6 *v89; // eax@245
   double v90; // st7@245
-  //int v91; // eax@250
   Player *v92; // eax@255
-  //__int16 v93; // ST18_2@260
-  //stru6 *v94; // eax@260
-  //__int16 v95; // ST18_2@260
-  //stru6 *v96; // eax@260
-  //__int16 v97; // ST18_2@260
-  //stru6 *v98; // eax@260
-  //__int16 v99; // ST18_2@260
-  //stru6 *v100; // eax@260
-  //int v101; // ecx@261
-  //int v102; // ecx@262
-  //int v103; // ecx@263
-  //int v104; // eax@265
   int v105; // edi@271
-  //__int16 v106; // ST18_2@272
-  //stru6 *v107; // eax@272
   __int16 v108; // ST1C_2@274
   __int16 v109; // ST18_2@274
   stru6 *v110; // eax@274
@@ -2529,91 +2444,25 @@
   int v117; // edx@281
   int v118; // edx@283
   int v119; // edi@286
-  //int v120; // eax@286
-  //int v121; // eax@286
   signed int v122; // eax@286
-  //int v123; // ecx@288
-  //int v124; // ecx@289
-  //int v125; // ecx@290
-  //int v126; // eax@292
   int v127; // eax@296
-  //__int16 v128; // ST18_2@303
-  //stru6 *v129; // eax@303
-  //__int16 v130; // ST18_2@303
-  //stru6 *v131; // eax@303
-  //__int16 v132; // ST18_2@303
-  //stru6 *v133; // eax@303
-  //__int16 v134; // ST18_2@303
-  //stru6 *v135; // eax@303
-  //unsigned __int64 v136; // qax@304
-  //char *v137; // ecx@304
-  //int v138; // ecx@305
   int v139; // ecx@306
-  //int v140; // eax@308
-  //__int16 v141; // ST18_2@311
-  //stru6 *v142; // eax@311
-  //__int16 v143; // ST18_2@311
-  //stru6 *v144; // eax@311
-  //__int16 v145; // ST18_2@311
-  //stru6 *v146; // eax@311
-  //__int16 v147; // ST18_2@311
-  //stru6 *v148; // eax@311
-  int v149; // ecx@312
-  int v150; // ecx@313
   int v151; // ecx@314
-  //signed int v152; // eax@322
   int v153; // ecx@322
   int v154; // eax@322
   int v155; // eax@323
   int v156; // eax@323
-  //int v157; // eax@326
   double v158; // st7@326
   double v159; // st6@326
-  //signed __int64 v160; // qtt@334
-  //int v161; // eax@339
   int v162; // edi@340
-  //int v163; // eax@340
   signed int v164; // eax@340
   signed int v165; // edi@340
-  //stru6 *v166; // eax@340
-  //stru6 *v167; // eax@340
   signed int v168; // edi@343
   int v169; // eax@344
-  //int v170; // ecx@346
-  //int v171; // ecx@347
-  //int v172; // ecx@348
-  //int v173; // edi@350
   signed int v174; // edi@355
-  //__int16 v175; // ST18_2@357
-  //stru6 *v176; // eax@357
-  //__int16 v177; // ST18_2@357
-  //stru6 *v178; // eax@357
-  //__int16 v179; // ST18_2@357
-  //stru6 *v180; // eax@357
-  //__int16 v181; // ST18_2@357
-  //stru6 *v182; // eax@357
-  //signed __int64 v183; // qax@357
-  int v184; // ecx@358
-  int v185; // ecx@359
-  int v186; // ecx@360
-  //int v187; // eax@367
   int v188; // esi@369
   int v189; // edi@369
-  //const char *v190; // ecx@377
   signed int v191; // edi@379
-  int v192; // ecx@382
-  //int v193; // ecx@383
-  //int v194; // ecx@384
-  int v195; // eax@386
-  int v196; // eax@387
-  //__int16 v197; // ST18_2@395
-  //stru6 *v198; // eax@395
-  //__int16 v199; // ST18_2@395
-  //stru6 *v200; // eax@395
-  //__int16 v201; // ST18_2@395
-  //stru6 *v202; // eax@395
-  //__int16 v203; // ST18_2@395
-  //stru6 *v204; // eax@395
   signed int v205; // edi@405
   int v206; // eax@407
   __int16 v207; // cx@407
@@ -2628,27 +2477,13 @@
   double v216; // st7@415
   double v217; // st6@415
   signed __int64 v218; // qtt@423
-  //int v219; // ecx@425
-  //int v220; // ecx@426
-  //int v221; // edi@428
   Player *v222; // edi@434
   char v223; // al@438
-  //int v224; // ecx@442
-  //int v225; // ecx@443
-  //int v226; // eax@451
+
   int v227; // esi@453
   unsigned int v228; // edi@454
   int v229; // edi@466
-  //__int16 v230; // ST18_2@469
-  //stru6 *v231; // eax@469
-  //signed int v232; // esi@469
-  //__int16 v233; // ST18_2@469
-  //stru6 *v234; // eax@469
-  //__int16 v235; // ST18_2@469
-  //stru6 *v236; // eax@469
-  //__int16 v237; // ST18_2@469
-  //stru6 *v238; // eax@469
-  //__int16 v239; // ST1C_2@469
+
   char *v240; // ecx@472
   double v241; // st7@478
   signed __int64 v242; // qax@484
@@ -2682,7 +2517,6 @@
   char *v270; // eax@531
   char v271; // al@531
   char v272; // cf@534
-  //float v273; // esi@541
   char v274; // al@541
   int v275; // edx@544
   int k; // esi@544
@@ -2729,292 +2563,99 @@
   const char *v317; // ecx@617
   Player *v318; // ecx@619
   unsigned int v319; // edi@627
-  //int v320; // ecx@629
-  //int v321; // ecx@630
-  //int v322; // edi@632
   int v323; // edi@635
   char *v324; // eax@635
   Player *v325; // ecx@640
-  //int v326; // eax@643
-  //int v327; // eax@648
   int v328; // ecx@651
   int v329; // ecx@652
   int v330; // edi@654
-  //__int16 v331; // ST18_2@658
-  //stru6 *v332; // eax@658
-  //__int16 v333; // ST18_2@658
-  //stru6 *v334; // eax@658
-  //__int16 v335; // ST18_2@658
-  //stru6 *v336; // eax@658
-  //__int16 v337; // ST18_2@658
-  //stru6 *v338; // eax@658
-  //int v339; // ecx@659
-  //int v340; // ecx@660
-  //int v341; // eax@663
   signed int v342; // edi@668
   signed int v343; // edi@670
   unsigned __int64 v344; // ST08_8@670
-  //__int16 v345; // ST1C_2@671
-  //__int16 v346; // ST18_2@671
-  //stru6 *v347; // eax@671
-  //int v348; // ecx@672
-  //int v349; // ecx@673
-  //int v350; // edi@676
   Player *v351; // edi@680
-  //__int16 v352; // ST18_2@685
-  //stru6 *v353; // eax@685
-  int v354; // ecx@686
-  int v355; // ecx@687
-  int v356; // eax@689
   Player *v357; // edi@694
-  //unsigned __int16 v358; // ST1C_2@695
-  //__int16 v359; // ST18_2@695
-  //stru6 *v360; // eax@695
-  //__int16 v361; // ST1C_2@697
-  //__int16 v362; // ST18_2@697
-  //stru6 *v363; // eax@697
-  int v364; // ecx@698
-  int v365; // ecx@699
-  int v366; // eax@701
-  //stru6 *v367; // eax@704
-  //int v368; // eax@704
   Actor *v369; // edi@705
-  //int v370; // eax@706
-  int v371; // ecx@709
-  int v372; // ecx@710
   int v373; // eax@715
   int v374; // eax@717
-  //Player *v375; // edi@717
   int v376; // eax@717
   Player *v377; // ecx@719
-  int v378; // ecx@721
-  int v379; // ecx@722
-  int v380; // eax@724
   int v381; // edi@727
   int v382; // ecx@727
   Player *v383; // eax@728
   int v384; // eax@733
-  //int v385; // edi@736
-  //signed int v386; // eax@736
-  //Player *v387; // edi@738
   int v388; // edi@740
-  //unsigned __int16 v389; // ST1C_2@740
-  //__int16 v390; // ST18_2@740
-  //stru6 *v391; // eax@740
-  int v392; // ecx@742
-  //int v393; // ecx@743
-  //int v394; // ecx@744
-  //int v395; // edi@747
   int v396; // eax@752
   int v397; // eax@757
   int v398; // eax@757
   int v399; // eax@757
-  //char *v400; // esi@757
-  //Game *v401; // ecx@759
-  //__int16 v402; // ST1C_2@759
-  //__int16 v403; // ST18_2@759
-  //stru6 *v404; // eax@759
-  //int v405; // ecx@761
-  //int v406; // ecx@762
-  //int v407; // edi@765
-  //__int16 v408; // ST1C_2@769
-  //__int16 v409; // ST18_2@769
-  //stru6 *v410; // eax@769
-  //int v411; // ecx@772
-  //int v412; // ecx@773
-  //int v413; // edi@775
-  //__int16 v414; // ST1C_2@781
-  //__int16 v415; // ST18_2@781
-  //stru6 *v416; // eax@781
   int v417; // eax@787
   int v418; // ecx@789
   __int16 v419; // ax@791
   signed int v420; // eax@793
   int v421; // edx@793
   const char *v422; // eax@801
-  int v423; // ecx@808
-  int v424; // ecx@809
-  int v425; // eax@811
   signed int v426; // eax@815
-  //signed int v427; // eax@820
-  int v428; // ecx@825
-  int v429; // ecx@826
-  int v430; // eax@828
-  //stru6 *v431; // eax@831
-  //int v432; // eax@831
   Actor *v433; // edi@832
-  //int v434; // eax@833
   int v435; // ecx@837
-  int v436; // ecx@838
-  //__int16 v437; // ST1C_2@843
-  //__int16 v438; // ST18_2@843
-  //stru6 *v439; // eax@843
   int v440; // eax@843
   int v441; // eax@847
-  //int v442; // ecx@850
-  //int v443; // ecx@851
-  //int v444; // eax@853
   signed int v445; // edi@857
   int v446; // ecx@862
   LevelDecoration *v447; // edi@864
   __int16 v448; // ax@864
   char *v449; // esi@870
   int v450; // eax@870
-  //int v451; // ecx@875
-  //int v452; // ecx@876
-  //int v453; // edi@878
-  //__int16 v454; // ST1C_2@884
-  //__int16 v455; // ST18_2@884
-  //stru6 *v456; // eax@884
-  int v457; // ecx@887
-  int v458; // ecx@888
-  int v459; // eax@890
   signed int v460; // eax@895
   Actor *v461; // eax@897
   unsigned __int16 v462; // cx@897
   signed int v463; // edx@897
-  //int v464; // ecx@905
-  //int v465; // ecx@906
-  //int v466; // edi@909
-  //__int16 v467; // ST1C_2@913
-  //__int16 v468; // ST18_2@913
-  //stru6 *v469; // eax@913
   int v470; // edi@913
   int v471; // eax@917
   int v472; // eax@917
-  //char *v473; // esi@918
-  //__int16 v474; // ST18_2@920
-  //stru6 *v475; // eax@920
-  //__int16 v476; // ST18_2@920
-  //stru6 *v477; // eax@920
-  //__int16 v478; // ST18_2@920
-  //stru6 *v479; // eax@920
-  //__int16 v480; // ST18_2@920
-  //stru6 *v481; // eax@920
-  //__int16 v482; // ST18_2@923
-  //stru6 *v483; // eax@923
-  //__int16 v484; // ST18_2@923
-  //stru6 *v485; // eax@923
-  //__int16 v486; // ST18_2@923
-  //stru6 *v487; // eax@923
-  //__int16 v488; // ST18_2@923
-  //stru6 *v489; // eax@923
-  //__int16 v490; // ST1C_2@924
-  //__int16 v491; // ST18_2@924
-  //stru6 *v492; // eax@924
-  int v493; // ecx@925
-  int v494; // ecx@926
-  //__int16 v495; // ST1C_2@931
-  //__int16 v496; // ST18_2@931
-  //stru6 *v497; // eax@931
   int v498; // edi@931
   int v499; // eax@935
   int v500; // eax@935
   Player *v501; // edi@939
-  //__int16 v502; // ST18_2@940
-  //stru6 *v503; // eax@940
-  //stru6 *v504; // eax@943
   int v505; // eax@943
-  //int v506; // eax@943
   int v507; // edi@944
-  //int v508; // eax@944
   signed int v509; // eax@944
   signed int v510; // edi@944
   Actor *v511; // edi@946
-  //int v512; // eax@946
   SpellBuff *v513; // edi@946
-  int v514; // ecx@950
-  //int v515; // ecx@951
-  int v516; // eax@953
-  //int v517; // eax@956
   Actor *v518; // edx@957
   __int16 v519; // cx@958
-  //int v520; // ecx@968
-  //int v521; // ecx@969
-  //int v522; // eax@971
-  //__int16 v523; // ST18_2@975
-  //stru6 *v524; // eax@975
-  //__int16 v525; // ST18_2@975
-  //stru6 *v526; // eax@975
-  //__int16 v527; // ST18_2@975
-  //stru6 *v528; // eax@975
-  //__int16 v529; // ST18_2@975
-  //stru6 *v530; // eax@975
   int v531; // eax@982
-  //int v532; // eax@982
   int v533; // edi@983
-  //int v534; // eax@983
   signed int v535; // eax@983
   signed int v536; // edi@983
   stru6 *v537; // eax@984
-  int v538; // ecx@985
-  int v539; // ecx@986
-  int v540; // eax@988
-  //__int16 v541; // ST18_2@991
-  //stru6 *v542; // eax@991
-  //__int16 v543; // ST18_2@991
-  //stru6 *v544; // eax@991
-  //__int16 v545; // ST18_2@991
-  //stru6 *v546; // eax@991
-  //__int16 v547; // ST18_2@991
-  //stru6 *v548; // eax@991
   double v549; // st7@991
   unsigned __int16 v550; // di@991
-  int v551; // ecx@993
-  //int v552; // ecx@994
   Player *v553; // edi@1001
-  //__int16 v554; // ST18_2@1002
-  //stru6 *v555; // eax@1002
-  //__int16 v556; // ST18_2@1002
-  //stru6 *v557; // eax@1002
-  //__int16 v558; // ST18_2@1002
-  //stru6 *v559; // eax@1002
-  //__int16 v560; // ST18_2@1002
-  //stru6 *v561; // eax@1002
   unsigned __int16 v562; // di@1005
   signed int v563; // eax@1010
   unsigned int v564; // ecx@1011
   signed int v565; // eax@1012
   Player **v566; // ecx@1012
   int v567; // eax@1012
-  //unsigned __int16 v568; // ST1C_2@1012
-  //__int16 v569; // ST18_2@1012
-  //stru6 *v570; // eax@1012
   Player *v571; // eax@1013
   char *v572; // ecx@1013
-  int v573; // ecx@1017
-  int v574; // ecx@1018
-  int v575; // eax@1020
   signed int v576; // eax@1025
   Player *v577; // eax@1026
   int v578; // eax@1028
   __int16 v579; // ax@1029
-  //int v580; // eax@1031
   int v581; // edi@1031
-  //int v582; // eax@1031
-  //__int16 v583; // ST1C_2@1034
-  //__int16 v584; // ST18_2@1034
   char *v585; // esi@1034
-  //stru6 *v586; // eax@1034
   signed int v587; // eax@1035
-  int v588; // ecx@1036
-  int v589; // ecx@1037
-  int v590; // ecx@1038
   char v591; // al@1048
   int v592; // esi@1052
-  int v593; // ecx@1057
-  //int v594; // ecx@1058
-  //int v595; // eax@1064
   int v596; // esi@1066
   unsigned int v597; // edi@1067
-  int v598; // eax@1079
-  //signed int v599; // eax@1082
   int v600; // edi@1086
   int v601; // edx@1086
   int v602; // eax@1086
   int v603; // ecx@1086
-  //int v604; // eax@1087
-  char *v605; // eax@1089
+  NPCData *pNPCData; // eax@1089
   int v606; // edx@1091
   int v607; // ecx@1100
   __int16 v608; // ax@1102
@@ -3023,71 +2664,34 @@
   unsigned int v611; // eax@1106
   Player *v612; // edi@1106
   DDM_DLV_Header *v613; // eax@1108
-  int v614; // eax@1116
   int v615; // edi@1119
-  //__int16 v616; // ST1C_2@1122
-  //__int16 v617; // ST18_2@1122
-  //stru6 *v618; // eax@1122
   Player *v619; // edi@1123
-  //unsigned __int16 v620; // ST1C_2@1124
-  //__int16 v621; // ST18_2@1124
-  //stru6 *v622; // eax@1124
   signed __int64 v623; // qax@1127
-  //int v624; // eax@1127
   int v625; // edi@1129
-  //int v626; // eax@1129
   signed int v627; // eax@1129
   signed int v628; // edi@1129
   int v629; // ecx@1130
   Player *v630; // eax@1131
   int v631; // eax@1137
-  //int v632; // edi@1140
-  //Player *v633; // eax@1140
-  //signed int v634; // eax@1140
   int v635; // edi@1142
-  //unsigned __int16 v636; // ST1C_2@1142
-  //__int16 v637; // ST18_2@1142
-  //stru6 *v638; // eax@1142
-  //stru6 *v639; // eax@1143
-  int v640; // ecx@1146
-  int v641; // ecx@1147
   int v642; // edi@1156
   int v643; // eax@1156
   int v644; // eax@1156
   signed int v645; // eax@1158
-  //Player *v646; // ebx@1169
-  //int v647; // edi@1169
-  //signed int v648; // ST1C_4@1170
-  //Player *v649; // ecx@1170
-  //unsigned __int64 v650; // [sp-10h] [bp-E94h]@103
-  //unsigned __int16 v651; // [sp-8h] [bp-E8Ch]@100
-  //unsigned __int16 v652; // [sp-8h] [bp-E8Ch]@304
-  //unsigned __int16 v653; // [sp-4h] [bp-E88h]@100
-  //int v654; // [sp-4h] [bp-E88h]@124
-  //unsigned __int16 v655; // [sp-4h] [bp-E88h]@304
   unsigned int v656; // [sp-4h] [bp-E88h]@639
   int v657; // [sp-4h] [bp-E88h]@807
-  //int v658; // [sp+0h] [bp-E84h]@100
   int v659; // [sp+0h] [bp-E84h]@123
   int v660; // [sp+0h] [bp-E84h]@146
   Actor *v661; // [sp+0h] [bp-E84h]@164
-  //int v662; // [sp+0h] [bp-E84h]@304
   unsigned __int64 v663; // [sp+0h] [bp-E84h]@639
   const char *v664; // [sp+0h] [bp-E84h]@802
   int v665; // [sp+0h] [bp-E84h]@807
   int v666; // [sp+4h] [bp-E80h]@12
   PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25
-  //unsigned __int8 v668; // [sp+4h] [bp-E80h]@100
-  //int v669; // [sp+4h] [bp-E80h]@123
-  //Vec3_int_ *v670; // [sp+4h] [bp-E80h]@133
   int v671; // [sp+4h] [bp-E80h]@146
-  //unsigned int v672; // [sp+4h] [bp-E80h]@164
-  //unsigned __int8 v673; // [sp+4h] [bp-E80h]@304
-  //__int16 v674; // [sp+4h] [bp-E80h]@684
   const char *v675; // [sp+4h] [bp-E80h]@800
   int v676; // [sp+4h] [bp-E80h]@807
   int v677; // [sp+4h] [bp-E80h]@861
-  //int v678; // [sp+4h] [bp-E80h]@997
   int v679; // [sp+14h] [bp-E70h]@515
   AIDirection a3; // [sp+C94h] [bp-1F0h]@21
   int v681[4]; // [sp+CB0h] [bp-1D4h]@1137
@@ -3098,29 +2702,14 @@
   int x; // [sp+D20h] [bp-164h]@327
   unsigned __int64 v687; // [sp+D24h] [bp-160h]@327
   Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943
-  //int v689; // [sp+D30h] [bp-154h]@943
-  //int v690; // [sp+D34h] [bp-150h]@943
   Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137
-  //int v692; // [sp+D3Ch] [bp-148h]@137
-  //int v693; // [sp+D40h] [bp-144h]@137
   Vec3_int_ v694; // [sp+D44h] [bp-140h]@982
-  //int v695; // [sp+D48h] [bp-13Ch]@982
-  //int v696; // [sp+D4Ch] [bp-138h]@982
   Vec3_int_ v697; // [sp+D50h] [bp-134h]@129
-  //int v698; // [sp+D54h] [bp-130h]@129
-  //int v699; // [sp+D58h] [bp-12Ch]@129
   Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339
   Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286
-  //int v702; // [sp+D6Ch] [bp-118h]@286
-  //int v703; // [sp+D70h] [bp-114h]@286
   Vec3_int_ v704; // [sp+D74h] [bp-110h]@132
-  //int v705; // [sp+D78h] [bp-10Ch]@132
-  //int v706; // [sp+D7Ch] [bp-108h]@132
   Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127
-  //int v708; // [sp+D84h] [bp-100h]@1127
-  //int v709; // [sp+D88h] [bp-FCh]@1127
   char v710; // [sp+D8Ch] [bp-F8h]@1156
-  //stru277 *v711; // [sp+D90h] [bp-F4h]@1
   __int64 v712; // [sp+D94h] [bp-F0h]@991
   int v713; // [sp+D9Ch] [bp-E8h]@324
   int n; // [sp+DA0h] [bp-E4h]@1
@@ -3131,12 +2720,10 @@
   signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53
   char *y; // [sp+DD4h] [bp-B0h]@325
   int v721; // [sp+DD8h] [bp-ACh]@163
-  //SpriteObject a1; // [sp+DDCh] [bp-A8h]@1
   int v723; // [sp+E4Ch] [bp-38h]@1
   ItemGen *_this; // [sp+E50h] [bp-34h]@23
   float v725; // [sp+E54h] [bp-30h]@23
   Player *v726; // [sp+E58h] [bp-2Ch]@131
-  //int v726b;
   float v727; // [sp+E5Ch] [bp-28h]@1
   unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53
   Player *pPlayer; // [sp+E64h] [bp-20h]@8
@@ -3149,14 +2736,8 @@
   signed int a2; // [sp+E7Ch] [bp-8h]@14
   int amount; // [sp+E80h] [bp-4h]@1
 
-  //auto ecx0 = this;
-
-  //v711 = ecx0;
-
   SpriteObject pSpellSprite; // [sp+DDCh] [bp-A8h]@1
-  //SpriteObject::SpriteObject(&a1);
-
-  //v1 = 0;
+
   v2 = 0;
   amount = 0;
   LODWORD(v733) = 0;
@@ -3645,11 +3226,11 @@
 				++pTurnEngine->field_1C;
 			LODWORD(v727) = 1;
 			break;
-      }
+		}
 		case SPELL_LIGHT_SUNRAY:
 		{
 			if ( uCurrentlyLoadedLevelType == LEVEL_Indoor
-				|| uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) )
+				|| uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 21) )
 			{
 				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
 				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
@@ -3835,37 +3416,16 @@
 		}
 		case SPELL_FIRE_FIRE_AURA:
 		{
-			v63 = v731 - 1;
-			if ( !v63 )
-			{
-				amount = 10;
-				LODWORD(v733) = 3600 * v2;
-			}
-			else
-			{
-			v64 = v63 - 1;
-			if ( !v64 )
-			{
-				amount = 11;
-				LODWORD(v733) = 3600 * v2;
-			}
-			else
-			{
-			v65 = v64 - 1;
-			if ( !v65 )
-			{
-				amount = 12;
-//	LABEL_195:
-				LODWORD(v733) = 3600 * v2;
-			}
-			else if ( v65 == 1 )
-			{
-				LODWORD(v733) = 0;
-				amount = 12;
-			}
-			}
-			}
-//	LABEL_196:
+			switch (v731)
+			{
+				case 1: LODWORD(v733) = 3600 * v2; amount = 10; break;
+				case 2: LODWORD(v733) = 3600 * v2; amount = 11; break;
+				case 3: LODWORD(v733) = 3600 * v2; amount = 12; break;
+				case 4: LODWORD(v733) = 0; amount = 12; break;
+				default:
+				assert(false);
+			}
+			
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
 			v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2];
@@ -3905,33 +3465,23 @@
 		}
 		case SPELL_BODY_REGENERATION:
 		{
-		v70 = v731 - 1;
-		LODWORD(v733) = 3600 * v2;
-		if ( v70 && (v71 = v70 - 1) != 0 )
-		{
-			v72 = v71 - 1;
-			if ( v72 )
-			{
-			if ( v72 == 1 )
-				amount = 10;
-			}
-			else
-			{
-			amount = 3;
-			}
-		}
-		else
-		{
-			amount = 1;
-		}
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
+			switch (v731)
+			{
+				case 1: LODWORD(v733) = 3600 * v2; amount = 1; break;
+				case 2: LODWORD(v733) = 3600 * v2; amount = 1; break;
+				case 3: LODWORD(v733) = 3600 * v2; amount = 3; break;
+				case 4: LODWORD(v733) = 3600 * v2; amount = 10; break;
+				default:
+				assert(false);
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
+
+			pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v733 * 4.2666669), v731, amount, 0, 0);
+			LODWORD(v727) = 1;
 			break;
-
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-
-		pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v733 * 4.2666669), v731, amount, 0, 0);
-		LODWORD(v727) = 1;
-		break;
 		}
 		case SPELL_FIRE_PROTECTION_FROM_FIRE:
 		case SPELL_AIR_PROTECTION_FROM_AIR:
@@ -3940,61 +3490,61 @@
 		case SPELL_MIND_PROTECTION_FROM_MIND:
 		case SPELL_BODY_PROTECTION_FROM_BODY:
 		{
-        LODWORD(v733) = 3600 * v2;
-		if ( v731 > 0 && v731 <= 4)
-		{
-	        amount = v731 * v2;
-        }		
-//LABEL_232:
-        //v80 = v3->spellnum;
-        switch (pCastSpell->spellnum)
-        {
-          case SPELL_FIRE_PROTECTION_FROM_FIRE:
-            LODWORD(v725) = PARTY_BUFF_RESIST_FIRE;
-            break;
-          case SPELL_AIR_PROTECTION_FROM_AIR:
-            LODWORD(v725) = PARTY_BUFF_RESIST_AIR;
-            break;
-          case SPELL_WATER_PROTECTION_FROM_WATER:
-            LODWORD(v725) = PARTY_BUFF_RESIST_WATER;
-            break;
-          case SPELL_EARTH_PROTECTION_FROM_EARTH:
-            LODWORD(v725) = PARTY_BUFF_RESIST_EARTH;
-            break;
-          case SPELL_MIND_PROTECTION_FROM_MIND:
-            LODWORD(v725) = PARTY_BUFF_RESIST_MIND;
-            break;
-          case SPELL_BODY_PROTECTION_FROM_BODY:
-            LODWORD(v725) = PARTY_BUFF_RESIST_BODY;
-            break;
-          default:
-            assert(false);
-            continue;
-        }
-        if ( !pPlayer->CanCastSpell(uRequiredMana) )
-          break;
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
-        v90 = (double)(signed int)v733 * 4.2666669;
-        pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0);
-        LODWORD(v727) = 1;
-        break;
+			switch (v731)
+			{
+				case 1: 
+				case 2: 
+				case 3: 
+				case 4: LODWORD(v733) = 3600 * v2; amount = v731 * v2; break;
+				default:
+				assert(false);
+			}
+
+			switch (pCastSpell->spellnum)
+			{
+			  case SPELL_FIRE_PROTECTION_FROM_FIRE:
+				LODWORD(v725) = PARTY_BUFF_RESIST_FIRE;
+				break;
+			  case SPELL_AIR_PROTECTION_FROM_AIR:
+				LODWORD(v725) = PARTY_BUFF_RESIST_AIR;
+				break;
+			  case SPELL_WATER_PROTECTION_FROM_WATER:
+				LODWORD(v725) = PARTY_BUFF_RESIST_WATER;
+				break;
+			  case SPELL_EARTH_PROTECTION_FROM_EARTH:
+				LODWORD(v725) = PARTY_BUFF_RESIST_EARTH;
+				break;
+			  case SPELL_MIND_PROTECTION_FROM_MIND:
+				LODWORD(v725) = PARTY_BUFF_RESIST_MIND;
+				break;
+			  case SPELL_BODY_PROTECTION_FROM_BODY:
+				LODWORD(v725) = PARTY_BUFF_RESIST_BODY;
+				break;
+			  default:
+				assert(false);
+				continue;
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+			  break;
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
+			v90 = (double)(signed int)v733 * 4.2666669;
+			pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0);
+			LODWORD(v727) = 1;
+			break;
 		}
 		case SPELL_FIRE_HASTE:
 		{
-			if ( v731 == 1 || v731 == 2 )
-			{
-				LODWORD(v733) = 60 * (v2 + 60);
-			}
-			else if ( v731 == 3 )
-			{
-				LODWORD(v733) = 180 * (v2 + 20);
-			}
-			else if ( v731 == 4 )
-			{
-				LODWORD(v733) = 240 * (v2 + 15);
+			switch (v731)
+			{
+				case 1: LODWORD(v733) = 60 * (v2 + 60); break;
+				case 2: LODWORD(v733) = 60 * (v2 + 60); break;
+				case 3: LODWORD(v733) = 180 * (v2 + 20); break;
+				case 4: LODWORD(v733) = 240 * (v2 + 15); break;
+				default:
+				assert(false);
 			}
 			if ( pPlayer->CanCastSpell(uRequiredMana) )
 			{
@@ -4021,19 +3571,15 @@
 		}
 		case SPELL_SPIRIT_BLESS:
 		{
-			if ( v731 == 1 || v731 == 2 )
-			{
-				LODWORD(v733) = 300 * (v2 + 12);
-			}
-			else if ( v731 == 3 )
-			{
-				LODWORD(v733) = 900 * (v2 + 4);
-			}
-			else if ( v731 == 4 )
-			{
-				LODWORD(v733) = 3600 * (v2 + 1);
-			}
-//	LABEL_269:
+			switch (v731)
+			{
+				case 1: LODWORD(v733) = 300 * (v2 + 12); break;
+				case 2: LODWORD(v733) = 300 * (v2 + 12); break;
+				case 3: LODWORD(v733) = 900 * (v2 + 4); break;
+				case 4: LODWORD(v733) = 3600 * (v2 + 1); break;
+				default:
+				assert(false);
+			}
 			amount = v2 + 5;
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
@@ -4051,13 +3597,13 @@
 				//v651 = 1;
 				//v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
 				//v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS];
-	//LABEL_103:
-			//HIDWORD(v650) = HIDWORD(v28);
-	//LABEL_104:
-			//LODWORD(v650) = v28;
-			pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), 1, amount, v111, 0);
-			LODWORD(v727) = 1;
-			break;
+		//LABEL_103:
+				//HIDWORD(v650) = HIDWORD(v28);
+		//LABEL_104:
+				//LODWORD(v650) = v28;
+				pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), 1, amount, v111, 0);
+				LODWORD(v727) = 1;
+				break;
 			}
 			v105 = 0;
 			v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
@@ -4088,54 +3634,54 @@
 				v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z);
 				if ( v113 < v721 )
 				{
-				v116 = v113;
-				v113 = v721;
-				v114 = v116;
+					v116 = v113;
+					v113 = v721;
+					v114 = v116;
 				}
 				if ( v113 < (signed int)v115 )
 				{
-				v117 = v113;
-				v113 = (int)v115;
-				v115 = v117;
+					v117 = v113;
+					v113 = (int)v115;
+					v115 = v117;
 				}
 				if ( v114 < (signed int)v115 )
 				{
-				v118 = v115;
-				v115 = v114;
-				v114 = v118;
+					v118 = v115;
+					v115 = v114;
+					v114 = v118;
 				}
 				_this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113);
 				if ( (double)(signed int)this <= 307.2 )
 				{
-				v701.x = 0;
-				v701.y = 0;
-				v701.z = 0;
-				pSpellSprite.stru_24.Reset();
-				v119 = HIDWORD(v733);
-				pSpellSprite.spell_id = *(int *)HIDWORD(v733);
-				pSpellSprite.spell_level = v723;
-				pSpellSprite.spell_skill = v731;
-				pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-				pSpellSprite.uAttributes = 0;
-				pSpellSprite.uSectorID = 0;
-				pSpellSprite.uSpriteFrameID = 0;
-				pSpellSprite.field_60_distance_related_prolly_lod = 0;
-				pSpellSprite.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2));
-				pSpellSprite.uFacing = 0;
-				pSpellSprite.uSoundID = *(short *)(v119 + 16);
-				pSpellSprite.vPosition.x = v112->vPosition.x;
-				pSpellSprite.vPosition.y = v112->vPosition.y;
-				pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548);
-				pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2);
-				v122 = pSpellSprite.Create(0, 0, 0, 0);
-				DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701);
-				LODWORD(v727) = 1;
+					v701.x = 0;
+					v701.y = 0;
+					v701.z = 0;
+					pSpellSprite.stru_24.Reset();
+					v119 = HIDWORD(v733);
+					pSpellSprite.spell_id = *(int *)HIDWORD(v733);
+					pSpellSprite.spell_level = v723;
+					pSpellSprite.spell_skill = v731;
+					pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+					pSpellSprite.uAttributes = 0;
+					pSpellSprite.uSectorID = 0;
+					pSpellSprite.uSpriteFrameID = 0;
+					pSpellSprite.field_60_distance_related_prolly_lod = 0;
+					pSpellSprite.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2));
+					pSpellSprite.uFacing = 0;
+					pSpellSprite.uSoundID = *(short *)(v119 + 16);
+					pSpellSprite.vPosition.x = v112->vPosition.x;
+					pSpellSprite.vPosition.y = v112->vPosition.y;
+					pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548);
+					pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2);
+					v122 = pSpellSprite.Create(0, 0, 0, 0);
+					DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701);
+					LODWORD(v727) = 1;
 				}
 				else
 				{
-				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u);
-				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-				*(int *)HIDWORD(v733) = 0;
+					ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u);
+					pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+					*(int *)HIDWORD(v733) = 0;
 				}
 				pCastSpell = (CastSpellInfo *)HIDWORD(v733);
 			}
@@ -4145,20 +3691,15 @@
 		case SPELL_EARTH_STONESKIN:
 		case SPELL_SPIRIT_HEROISM:
 		{
-			if( v731 == 1 || v731 == 2 )
-			{
-				LODWORD(v733) = 300 * (v2 + 12);
-			}
-			else if ( v731 == 3 )
-			{
-				LODWORD(v733) = 900 * (v2 + 4);
-			}
-			else if ( v731 == 4 )
-			{
-				LODWORD(v733) = 3600 * (v2 + 1);
-			}
-
-//	LABEL_296:
+			switch (v731)
+			{
+				case 1: LODWORD(v733) = 300 * (v2 + 12); break;
+				case 2: LODWORD(v733) = 300 * (v2 + 12); break;
+				case 3: LODWORD(v733) = 900 * (v2 + 4); break;
+				case 4: LODWORD(v733) = 3600 * (v2 + 1); break;
+				default:
+				assert(false);
+			}
 			v127 = pCastSpell->spellnum;
 			if ( v127 == 17 )
 			{
@@ -4169,15 +3710,15 @@
 			{
 				if ( v127 == 38 )
 				{
-				LODWORD(v725) = 15;
-				amount = v2 + 5;
+					LODWORD(v725) = 15;
+					amount = v2 + 5;
 				}
 				else
 				{
-				if ( v127 != 51 )
-					continue;
-				LODWORD(v725) = 9;
-				amount = v2 + 5;
+					if ( v127 != 51 )
+						continue;
+					LODWORD(v725) = 9;
+					amount = v2 + 5;
 				}
 			}
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
@@ -4212,8 +3753,9 @@
 		}
 		case SPELL_FIRE_METEOR_SHOWER:
 		{
-			v149 = v731 - 1;
-			if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 )
+			//v149 = v731 - 1;
+			//if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 )
+			if ( v731 == 4 )
 			{
 				if ( v151 == 1 )
 				_this = (ItemGen *)20;
@@ -4259,54 +3801,54 @@
 				auto _this_cpy = (int)_this;
 				do
 				{
-				//v157 = rand();
-				v158 = (double)SLODWORD(v718);
-				v718 = v158;
-				v159 = (double)v721;
-				*(float *)&v721 = v159;
-				a2 = rand() % 1000;
-				*((float *)&v733 + 1) = (double)(rand() % 1000) + *(float *)&y - *(float *)&v732;
-				//v725 = v159 * v159;
-				*(float *)&_this = v158 * v158;
-				//if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 )
-				if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v159 * v159) <= 1.0 )
-				{
-					LODWORD(v687) = 0;
-					HIDWORD(v687) = 0;
-				}
-				else
-				{
-					//x = (signed __int64)sqrt(*(float *)&_this + v725);
-					x = (signed __int64)sqrt(*(float *)&_this + v159 * v159);
-					v687 = __PAIR__(
-							stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)),
-							stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721));
-				}
-				pSpellSprite.stru_24.Reset();
-				pSpellSprite.spell_id = pCastSpell->spellnum;
-				pSpellSprite.spell_level = v2;
-				pSpellSprite.spell_skill = v731;
-				pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-				pSpellSprite.uAttributes = 0;
-				pSpellSprite.vPosition.x = uRequiredMana;
-				pSpellSprite.vPosition.y = LODWORD(v727);
-				pSpellSprite.uSectorID = 0;
-				pSpellSprite.vPosition.z = a2 + v713;
-				pSpellSprite.uSpriteFrameID = 0;
-				pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
-				pSpellSprite.spell_target_pid = v730;
-				pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500);
-				pSpellSprite.uFacing = v687;
-				pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
-				if ( pParty->bTurnBasedModeOn == 1 )
-					pSpellSprite.uAttributes = 4;
-				if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1
-					&& pParty->bTurnBasedModeOn == 1 )
-					++pTurnEngine->field_1C;
-				LODWORD(v718) = rand() % 1024 - 512;
-				//v160 = rand();
-				v14 = _this_cpy-- == 1;
-				v721 = (unsigned __int64)(rand() % 1024) - 512;
+					//v157 = rand();
+					v158 = (double)SLODWORD(v718);
+					v718 = v158;
+					v159 = (double)v721;
+					*(float *)&v721 = v159;
+					a2 = rand() % 1000;
+					*((float *)&v733 + 1) = (double)(rand() % 1000) + *(float *)&y - *(float *)&v732;
+					//v725 = v159 * v159;
+					*(float *)&_this = v158 * v158;
+					//if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 )
+					if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v159 * v159) <= 1.0 )
+					{
+						LODWORD(v687) = 0;
+						HIDWORD(v687) = 0;
+					}
+					else
+					{
+						//x = (signed __int64)sqrt(*(float *)&_this + v725);
+						x = (signed __int64)sqrt(*(float *)&_this + v159 * v159);
+						v687 = __PAIR__(
+								stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)),
+								stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721));
+					}
+					pSpellSprite.stru_24.Reset();
+					pSpellSprite.spell_id = pCastSpell->spellnum;
+					pSpellSprite.spell_level = v2;
+					pSpellSprite.spell_skill = v731;
+					pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+					pSpellSprite.uAttributes = 0;
+					pSpellSprite.vPosition.x = uRequiredMana;
+					pSpellSprite.vPosition.y = LODWORD(v727);
+					pSpellSprite.uSectorID = 0;
+					pSpellSprite.vPosition.z = a2 + v713;
+					pSpellSprite.uSpriteFrameID = 0;
+					pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+					pSpellSprite.spell_target_pid = v730;
+					pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500);
+					pSpellSprite.uFacing = v687;
+					pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+					if ( pParty->bTurnBasedModeOn == 1 )
+						pSpellSprite.uAttributes = 4;
+					if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1
+						&& pParty->bTurnBasedModeOn == 1 )
+						++pTurnEngine->field_1C;
+					LODWORD(v718) = rand() % 1024 - 512;
+					//v160 = rand();
+					v14 = _this_cpy-- == 1;
+					v721 = (unsigned __int64)(rand() % 1024) - 512;
 				}
 				while ( !v14 );
 			}
@@ -4315,57 +3857,56 @@
 		}
 		case SPELL_FIRE_INFERNO:
 		{
-		//v67 = 2;
-		if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
-		{
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors!
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
+			//v67 = 2;
+			if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
+			{
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors!
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				pCastSpell->spellnum = 0;
+				continue;
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
+			v700.z = 0;
+			v700.y = 0;
+			v700.x = 0;
+			pSpellSprite.stru_24.Reset();
+			pSpellSprite.spell_id = pCastSpell->spellnum;
+			pSpellSprite.spell_level = v2;
+			pSpellSprite.spell_skill = v731;
+			pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.uSectorID = 0;
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.field_60_distance_related_prolly_lod = 0;
+			pSpellSprite.uFacing = 0;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			a2 = 0;
+			if ( (signed int)_v726 > 0 )
+			{
+				do
+				{
+					v162 = dword_50BF30[a2];
+					pSpellSprite.vPosition.x = pActors[v162].vPosition.x;
+					pSpellSprite.vPosition.y = pActors[v162].vPosition.y;
+					pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548);
+					pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
+					v164 = pSpellSprite.Create(0, 0, 0, 0);
+					v165 = a2;
+					DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700);
+					pGame->GetStru6()->_4A81CA(&pSpellSprite);
+					pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u);
+					a2 = v165 + 1;
+				}
+				while ( v165 + 1 < (signed int)_v726 );
+			}
+			LODWORD(v727) = 1;
 			break;
-		auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
-		v700.z = 0;
-		v700.y = 0;
-		v700.x = 0;
-		pSpellSprite.stru_24.Reset();
-		pSpellSprite.spell_id = pCastSpell->spellnum;
-		pSpellSprite.spell_level = v2;
-		pSpellSprite.spell_skill = v731;
-		pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-		pSpellSprite.uAttributes = 0;
-		pSpellSprite.uSectorID = 0;
-		pSpellSprite.uSpriteFrameID = 0;
-		pSpellSprite.field_60_distance_related_prolly_lod = 0;
-		pSpellSprite.uFacing = 0;
-		pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
-		pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
-		a2 = 0;
-		if ( (signed int)_v726 > 0 )
+		}
+		case SPELL_AIR_WIZARD_EYE:
 		{
-			do
-			{
-			v162 = dword_50BF30[a2];
-			pSpellSprite.vPosition.x = pActors[v162].vPosition.x;
-			pSpellSprite.vPosition.y = pActors[v162].vPosition.y;
-			pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548);
-			pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
-			v164 = pSpellSprite.Create(0, 0, 0, 0);
-			v165 = a2;
-			DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700);
-			pGame->GetStru6()->_4A81CA(&pSpellSprite);
-			pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u);
-			a2 = v165 + 1;
-			}
-			while ( v165 + 1 < (signed int)_v726 );
-		}
-		LODWORD(v727) = 1;
-		break;
-		}
-
-		case SPELL_AIR_WIZARD_EYE:
-			{
 			LODWORD(v733) = 3600 * v2;
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
@@ -4387,7 +3928,7 @@
 			{
 				case 1: LODWORD(v733) = 300 * v2; break;
 				case 2: LODWORD(v733) = 600 * v2; break;
-				case 3: 
+				case 3: LODWORD(v733) = 3600 * v2; break;
 				case 4: LODWORD(v733) = 3600 * v2; break;
 				default:
 				assert(false);
@@ -4451,8 +3992,8 @@
 						v715.uPitchAngle,
 						pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
 						pCastSpell->uPlayerID + 1) != -1
-				&& pParty->bTurnBasedModeOn == 1 )
-				++pTurnEngine->field_1C;
+						&& pParty->bTurnBasedModeOn == 1 )
+				+	+pTurnEngine->field_1C;
 				v188 += _v726 / (amount - 1);
 			}
 			LODWORD(v727) = 1;
@@ -4522,8 +4063,10 @@
 				break;
 			}
 			LODWORD(v733) = 3600 * v2;
-			if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) )
+			if ( v731 == 1 || v731 == 2 || v731 == 3 )
 				amount = 1;
+			else
+				amount = 0;
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
 			v205 = 0;
@@ -4589,15 +4132,15 @@
 				//*(float *)&v726 = v216 * v216;
 				if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 )
 				{
-				LODWORD(v685) = 0;
-				HIDWORD(v685) = 0;
+					LODWORD(v685) = 0;
+					HIDWORD(v685) = 0;
 				}
 				else
 				{
-				v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721);
-				v685 = __PAIR__(
-							stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)),
-							stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana));
+					v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721);
+					v685 = __PAIR__(
+								stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)),
+								stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana));
 				}
 				pSpellSprite.stru_24.Reset();
 				pSpellSprite.spell_id = pCastSpell->spellnum;
@@ -4673,14 +4216,15 @@
 		}
 		case SPELL_WATER_POISON_SPRAY:
 		{
-			if ( v731 == 1 )
-				amount = 1;
-			else if ( v731 == 2 )
-				amount = 3;
-			else if ( v731 == 3 )
-				amount = 5;
-			else if ( v731 == 4 )
-				amount = 7;
+			switch (v731)
+			{
+				case 1: amount = 1; break;
+				case 2: amount = 3; break;
+				case 3: amount = 5; break;
+				case 4: amount = 7; break;
+				default:
+				assert(false);
+			}
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
 			HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
@@ -4731,226 +4275,353 @@
 				pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
 				pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
 				if ( pParty->bTurnBasedModeOn == 1 )
-				LOBYTE(pSpellSprite.uAttributes) |= 4u;
+					LOBYTE(pSpellSprite.uAttributes) |= 4u;
 				v227 = SHIDWORD(v733) / -2;
 				y = (char *)(SHIDWORD(v733) / 2);
 				if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 )
 				{
-				v228 = v715.uYawAngle;
-				do
-				{
-					pSpellSprite.uFacing = v227 + v228;
-					if ( pSpellSprite.Create(
-							v227 + v228,
-							v715.uPitchAngle,
-							pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
-							pCastSpell->uPlayerID + 1) != -1
-					&& pParty->bTurnBasedModeOn == 1 )
-					++pTurnEngine->field_1C;
-					v227 += SHIDWORD(v733) / (amount - 1);
-				}
-				while ( v227 <= (signed int)y );
+					v228 = v715.uYawAngle;
+					do
+					{
+						pSpellSprite.uFacing = v227 + v228;
+						if ( pSpellSprite.Create(
+								v227 + v228,
+								v715.uPitchAngle,
+								pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
+								pCastSpell->uPlayerID + 1) != -1
+								&& pParty->bTurnBasedModeOn == 1 )
+							++pTurnEngine->field_1C;
+						v227 += SHIDWORD(v733) / (amount - 1);
+					}
+					while ( v227 <= (signed int)y );
 				}
 			}
 			LODWORD(v727) = 1;
 			break;
 		}
 		case SPELL_WATER_WATER_WALK:
-			{
-		if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() )
+		{
+			if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() )
+			{
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2);  // Spell failed
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				break;
+			}
+			if ( v731 == 2 || v731 != 3 && v731 != 4 )
+				v229 = 600 * v2;
+			else
+				v229 = 3600 * v2;
+			LODWORD(v733) = v229;
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536);
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
+
+			pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(
+				pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335),
+				v731,
+				amount,
+				v716,
+				pCastSpell->uPlayerID + 1);
+			if ( v731 == 4 )
+				pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1;
+			LODWORD(v727) = 1;
+			break;
+		}
+		case SPELL_WATER_RECHARGE_ITEM:
 		{
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2);  // Spell failed
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			v240 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2];
+			y = v240;
+			if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 )
+			{
+				dword_50C9D0 = 113;
+				dword_50C9D4 = 0;
+				dword_50C9D8 = 1;
+
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2);  // Spell failed
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				pCastSpell->spellnum = 0;
+				continue;
+			}
+			if ( v731 == 1 || v731 == 2 )
+			{
+				v241 = (double)v723 * 0.0099999998 + 0.5;
+			}
+			else if ( v731 == 3 )
+			{
+				v241 = (double)v723 * 0.0099999998 + 0.69999999;
+			}
+			else if ( v731 == 4 )
+			{
+				v241 = (double)v723 * 0.0099999998 + 0.80000001;
+			}
+			else
+			{
+				v241 = 0.0;
+			}
+			if ( v241 > 1.0 )
+				v241 = 1.0;
+	//LABEL_484:
+			v732 = (unsigned __int8)v240[25];
+			v242 = (signed __int64)((double)v732 * v241);
+			v243 = y;
+			y[25] = v242;
+			*((int *)v243 + 4) = (unsigned __int8)v242;
+			if ( (unsigned __int8)v242 <= 0 )
+			{
+				*(int *)v243 = 0;
+				dword_50C9D0 = 113;
+				dword_50C9D4 = 0;
+				dword_50C9D8 = 1;
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u);
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				pCastSpell->spellnum = 0;
+				v2 = v723;
+				continue;
+			}
+			*((int *)v243 + 5) |= 0x40u;
+			_50C9A8_item_enchantment_timer = 256;
+			LODWORD(v727) = 1;
 			break;
 		}
-		if ( v731 == 2 || v731 != 3 && v731 != 4 )
-			v229 = 600 * v2;
-		else
-			v229 = 3600 * v2;
-		LODWORD(v733) = v229;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
-
-		pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(
-			pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335),
-			v731,
-			amount,
-			v716,
-			pCastSpell->uPlayerID + 1);
-		if ( v731 == 4 )
-			pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1;
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_WATER_RECHARGE_ITEM:
-			{
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		v240 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2];
-		y = v240;
-		if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 )
-		{
-			dword_50C9D0 = 113;
-			dword_50C9D4 = 0;
-			dword_50C9D8 = 1;
-
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2);  // Spell failed
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		if ( v731 == 1 || v731 == 2 )
-		{
-			v241 = (double)v723 * 0.0099999998 + 0.5;
-		}
-		else if ( v731 == 3 )
-		{
-			v241 = (double)v723 * 0.0099999998 + 0.69999999;
-		}
-		else if ( v731 == 4 )
-		{
-			v241 = (double)v723 * 0.0099999998 + 0.80000001;
-		}
-		else
-		{
-			v241 = 0.0;
-		}
-		if ( v241 > 1.0 )
-			v241 = 1.0;
-//LABEL_484:
-		v732 = (unsigned __int8)v240[25];
-		v242 = (signed __int64)((double)v732 * v241);
-		v243 = y;
-		y[25] = v242;
-		*((int *)v243 + 4) = (unsigned __int8)v242;
-		if ( (unsigned __int8)v242 <= 0 )
+		case SPELL_WATER_ENCHANT_ITEM:
 		{
-			*(int *)v243 = 0;
-			dword_50C9D0 = 113;
-			dword_50C9D4 = 0;
-			dword_50C9D8 = 1;
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u);
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			v2 = v723;
-			continue;
-		}
-		*((int *)v243 + 5) |= 0x40u;
-					_50C9A8_item_enchantment_timer = 256;
-					LODWORD(v727) = 1;
-					break;
-			}
-		case SPELL_WATER_ENCHANT_ITEM:
-			{
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		uRequiredMana = 0;
-		HIDWORD(v733) = 10 * v2;
-		v730 = 1;
-		v244 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2];
-		if ( v731 == 1 )
-		{
-			v245 = (int)&v244[36 * a2 + 532];
-			v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName;
-			v311 = __OFSUB__(*(int *)v245, 134);
-			v14 = *(int *)v245 == 134;
-			v310 = *(int *)v245 - 134 < 0;
-			LODWORD(v725) = (int)(char *)&pItemsTable + 48 * *(int *)v245 + 4;
-			if ( (unsigned __int8)(v310 ^ v311) | v14 )
-			{
-			if ( *(int *)&v244[36 * a2 + 544] == 0 )
-			{
-				if ( *(int *)&v244[36 * a2 + 536] == 0 )
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			uRequiredMana = 0;
+			HIDWORD(v733) = 10 * v2;
+			v730 = 1;
+			v244 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2];
+			if ( v731 == 1 )
+			{
+				v245 = (int)&v244[36 * a2 + 532];
+				v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName;
+				v311 = __OFSUB__(*(int *)v245, 134);
+				v14 = *(int *)v245 == 134;
+				v310 = *(int *)v245 - 134 < 0;
+				LODWORD(v725) = (int)(char *)&pItemsTable + 48 * *(int *)v245 + 4;
+				if ( (unsigned __int8)(v310 ^ v311) | v14 )
 				{
-				if ( *(int *)&v244[36 * a2 + 540] == 0 )
-				{
-					v312 = v309[28];
-					if ( v312 )
+					if ( *(int *)&v244[36 * a2 + 544] == 0 )
 					{
-					if ( v312 != 1 )
-					{
-						if ( v312 != 2 )
+						if ( *(int *)&v244[36 * a2 + 536] == 0 )
 						{
-						_this = (ItemGen *)&v244[36 * a2 + 552];
-						if ( !(v244[36 * a2 + 552] & 2) )
-						{
-							if ( ((ItemGen *)v245)->GetValue() < 0x1C2 )
+							if ( *(int *)&v244[36 * a2 + 540] == 0 )
 							{
-							uRequiredMana = 1;
-							v730 = 0;
-							}
-							if ( rand() % 100 >= SHIDWORD(v733) )
-							uRequiredMana = 1;
-							if (!uRequiredMana)
-							{
-							v313 = *(char *)(LODWORD(v725) + 28);
-							if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 )
-							{
-								v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType];
-								*(int *)(v245 + 4) = 0;
-								for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
-																			+ 1];
-									;
-									j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
-																								+ 1] )
+								v312 = v309[28];
+								if ( v312 )
 								{
-								++*(int *)(v245 + 4);
-								if ( j >= v314 )
-									break;
+									if ( v312 != 1 )
+									{
+										if ( v312 != 2 )
+										{
+											_this = (ItemGen *)&v244[36 * a2 + 552];
+											if ( !(v244[36 * a2 + 552] & 2) )
+											{
+												if ( ((ItemGen *)v245)->GetValue() < 0x1C2 )
+												{
+													uRequiredMana = 1;
+													v730 = 0;
+												}
+												if ( rand() % 100 >= SHIDWORD(v733) )
+													uRequiredMana = 1;
+												if (!uRequiredMana)
+												{
+													v313 = *(char *)(LODWORD(v725) + 28);
+													if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 )
+													{
+														v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType];
+														*(int *)(v245 + 4) = 0;
+														for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
+																									+ 1];
+															;
+															j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
+																														+ 1] )
+														{
+															++*(int *)(v245 + 4);
+															if ( j >= v314 )
+																break;
+														}
+														v254 = rand();
+														v255 = 10;//pItemsTable->field_116D8[17];
+														v256 = 10;//pItemsTable->field_116D8[16];
+						//LABEL_611:
+														*(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1);
+						//LABEL_612:
+														_this->uItemID |= 0x20u;
+
+														_50C9A8_item_enchantment_timer = 256;
+														LODWORD(v727) = 1;
+														break;
+													}
+												}
+												else
+												{
+						//LABEL_613:					
+													v316 = _this->uItemID;
+													if ( !(BYTE1(v316) & 2) )
+													{
+														LOBYTE(v316) = v316 | 2;
+														_this->uItemID = v316;
+													}
+												}
+											}
+										}
+									}
 								}
-								v254 = rand();
-								v255 = 10;//pItemsTable->field_116D8[17];
-								v256 = 10;//pItemsTable->field_116D8[16];
-//LABEL_611:
-								*(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1);
-//LABEL_612:
-								_this->uItemID |= 0x20u;
-
-								_50C9A8_item_enchantment_timer = 256;
-								LODWORD(v727) = 1;
-								break;
-							}
-							}
-							else
-							{
-//LABEL_613:					
-							v316 = _this->uItemID;
-							if ( !(BYTE1(v316) & 2) )
-							{
-							LOBYTE(v316) = v316 | 2;
-							_this->uItemID = v316;
-							}
 							}
 						}
-						}
-					}
 					}
 				}
+	//LABEL_616:
+				if ( LODWORD(v727) == 0 )
+				{
+					v317 = pGlobalTXT_LocalizationStrings[428];
+					if ( v730 == 0 )
+						v317 = pGlobalTXT_LocalizationStrings[585];
+					ShowStatusBarString(v317, 2u);
+					pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+					v318 =  &pParty->pPlayers[pCastSpell->uPlayerID_2];
+					pCastSpell->spellnum = 0;
+					v318->PlaySound(SPEECH_43, 0);
 				}
 			}
-			}
-//LABEL_616:
-			if ( LODWORD(v727) == 0 )
-			{
-				v317 = pGlobalTXT_LocalizationStrings[428];
-				if ( v730 == 0 )
-					v317 = pGlobalTXT_LocalizationStrings[585];
-				ShowStatusBarString(v317, 2u);
-				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-				v318 =  &pParty->pPlayers[pCastSpell->uPlayerID_2];
-				pCastSpell->spellnum = 0;
-				v318->PlaySound(SPEECH_43, 0);
-			}
-			break;
-		}
-		if ( v731 != 2 )
-		{
-			if ( v731 == 3 )
+			else if ( v731 == 2 )
+			{
+				v289 = (ItemGen *)&v244[36 * a2 + 532];
+				_this = v289;
+				v290 = v289->uItemID;
+				LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4;
+				if ( v290 > 134
+					|| _this->uSpecEnchantmentType != 0
+					|| _this->uEnchantmentType != 0
+					|| _this->_bonus_strength != 0
+					|| (v291 = pItemsTable->pItems[v290].uEquipType) == 0
+					|| v291 == 1
+					|| v291 == 2
+					|| _this->Broken())
+				{
+					if ( LODWORD(v727) == 0 )
+					{
+						v317 = pGlobalTXT_LocalizationStrings[428];
+						if ( v730 == 0 )
+							v317 = pGlobalTXT_LocalizationStrings[585];
+						ShowStatusBarString(v317, 2u);
+						pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+						v318 =  &pParty->pPlayers[pCastSpell->uPlayerID_2];
+						pCastSpell->spellnum = 0;
+						v318->PlaySound(SPEECH_43, 0);
+					}
+					break;
+				}
+				if ( _this->GetValue() < 0x1C2 )
+					uRequiredMana = 1;
+				if ( rand() % 100 >= SHIDWORD(v733) )
+					uRequiredMana = 1;
+				if ( uRequiredMana != 0 )
+				{
+					dword_50C9D0 = 113;
+					dword_50C9D4 = 0;
+					dword_50C9D8 = 1;
+
+					ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+					pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+					pCastSpell->spellnum = 0;
+					continue;
+				}
+				v292 = *(char *)(LODWORD(v725) + 28);
+				if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) )
+				{
+					v2 = v723;
+					//v1 = 0;
+
+					dword_50C9D0 = 113;
+					dword_50C9D4 = 0;
+					dword_50C9D8 = 1;
+
+					ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+					pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+					pCastSpell->spellnum = 0;
+					continue;
+				}
+				if ( rand() % 100 >= 80 )
+				{
+					v297 = pItemsTable->pSpecialEnchantments_count;
+					v294 = _this;
+					v298 = 0;
+					v725 = 0.0;
+					HIDWORD(v733) = 0;
+					if ( pItemsTable->pSpecialEnchantments_count > 0 )
+					{
+						v730 = (int)&v679;
+						do
+						{
+							v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement);
+							if ( !v299 || v299 == 1 )
+							{
+								v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]
+										+ v298 * 28);
+								LODWORD(v725) += v300;
+								if ( v300 )
+								{
+									v301 = v730;
+									v730 += 4;
+									*(int *)v301 = HIDWORD(v733);
+								}
+							}
+							++HIDWORD(v733);
+							++v298;
+						}
+						while ( SHIDWORD(v733) < v297 );
+					}
+					v302 = rand() % SLODWORD(v725);
+					v303 = v679;
+					v294->uSpecEnchantmentType = v679;
+					v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4];
+					v305 = v302 + 1;
+					if ( v304 < v305 )
+					{
+						for ( jj = &v679; ; jj = (int *)v732 )
+						{
+							v307 = (int)(jj + 1);
+							v732 = v307;
+							v308 = *(int *)v307;
+							v294->uSpecEnchantmentType = v308;
+							v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4];
+							if ( v304 >= v305 )
+								break;
+						}
+					}
+					++v294->uSpecEnchantmentType;
+				}
+				else
+				{
+					v293 = rand();
+					v294 = _this;
+					v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType];
+					_this->uEnchantmentType = 0;
+					for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1];
+						;
+						kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType
+																					+ 1] )
+					{
+						++v294->uEnchantmentType;
+						if ( kk >= v295 )
+							break;
+					}
+					v294->_bonus_strength = 10//pItemsTable->field_116D8[18]
+										+ rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1);
+				}
+				v294->uAttributes |= 0x20u;
+				_50C9A8_item_enchantment_timer = 256;
+				LODWORD(v727) = 1;
+			}
+			else if ( v731 == 3 )
 			{
 				v245 = (int)&v244[36 * a2 + 532];
 				v269 = *(int *)v245;
@@ -5070,20 +4741,20 @@
 					*(int *)(v245 + 12) = v679;
 					v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4];
 					v285 = v282 + 1;
-																		if ( v284 < v285 )
-				{
-				for ( l = &v679; ; l = (int *)v732 )
-				{
-					v287 = (int)(l + 1);
-					v732 = v287;
-					v288 = *(int *)v287;
-					*(int *)(v245 + 12) = v288;
-					v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
-																		+ 4];
-					if ( v284 >= v285 )
-					break;
-				}
-				}
+					if ( v284 < v285 )
+					{
+						for ( l = &v679; ; l = (int *)v732 )
+						{
+							v287 = (int)(l + 1);
+							v732 = v287;
+							v288 = *(int *)v287;
+							*(int *)(v245 + 12) = v288;
+							v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
+																				+ 4];
+							if ( v284 >= v285 )
+							break;
+						}
+					}
 					++*(int *)(v245 + 12);
 					_this->uItemID |= 0x20u;
 
@@ -5092,7 +4763,7 @@
 					break;
 				}
 			}
-			else
+			else if ( v731 == 4 )
 			{
 				__debugbreak(); // v726 is most probably the caster, filled in case 54
 				if ( v731 != 4
@@ -5134,8 +4805,8 @@
 					v316 = _this->uItemID;
 					if ( !(BYTE1(v316) & 2) )
 					{
-					LOBYTE(v316) = v316 | 2;
-					_this->uItemID = v316;
+						LOBYTE(v316) = v316 | 2;
+						_this->uItemID = v316;
 					}
 					if ( LODWORD(v727) == 0 )
 					{
@@ -5157,20 +4828,20 @@
 					if ( rand() % 100 < 80
 					&& !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) )
 					{
-					v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType];
-					*(int *)(v245 + 4) = 0;
-					for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1];
-							;
-							m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
-																						+ 1] )
-					{
-						++*(int *)(v245 + 4);
-						if ( m >= v252 )
-						break;
-					}
-					v254 = rand();
-					v255 = 10;// pItemsTable->field_116D8[21];
-					v256 =  10;//pItemsTable->field_116D8[20];
+						v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType];
+						*(int *)(v245 + 4) = 0;
+						for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1];
+								;
+								m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
+																							+ 1] )
+						{
+							++*(int *)(v245 + 4);
+							if ( m >= v252 )
+								break;
+						}
+						v254 = rand();
+						v255 = 10;// pItemsTable->field_116D8[21];
+						v256 =  10;//pItemsTable->field_116D8[20];
 						*(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1);
 						_this->uItemID |= 0x20u;
 
@@ -5222,7 +4893,7 @@
 							v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
 																				+ 4];
 							if ( v264 >= v265 )
-							break;
+								break;
 						}
 					}
 					++*(int *)(v245 + 12);
@@ -5233,688 +4904,558 @@
 					break;
 				}
 			}
-			//v1 = 0;
-			if ( LODWORD(v727) == 0 )
-			{
-				v317 = pGlobalTXT_LocalizationStrings[428];
-				if ( v730 == 0 )
-					v317 = pGlobalTXT_LocalizationStrings[585];
-				ShowStatusBarString(v317, 2u);
-				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-				v318 =  &pParty->pPlayers[pCastSpell->uPlayerID_2];
-				pCastSpell->spellnum = 0;
-				v318->PlaySound(SPEECH_43, 0);
+			else
+			{
+				if ( LODWORD(v727) == 0 )
+				{
+					v317 = pGlobalTXT_LocalizationStrings[428];
+					if ( v730 == 0 )
+						v317 = pGlobalTXT_LocalizationStrings[585];
+					ShowStatusBarString(v317, 2u);
+					pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+					v318 =  &pParty->pPlayers[pCastSpell->uPlayerID_2];
+					pCastSpell->spellnum = 0;
+					v318->PlaySound(SPEECH_43, 0);
+				}
 			}
 			break;
 		}
-		v289 = (ItemGen *)&v244[36 * a2 + 532];
-		_this = v289;
-		v290 = v289->uItemID;
-		LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4;
-		if ( v290 > 134
-			|| _this->uSpecEnchantmentType != 0
-			|| _this->uEnchantmentType != 0
-			|| _this->_bonus_strength != 0
-			|| (v291 = pItemsTable->pItems[v290].uEquipType) == 0
-			|| v291 == 1
-			|| v291 == 2
-			|| _this->Broken())
+		case SPELL_WATER_TOWN_PORTAL:
+		{
+			amount = 10 * v2;
+			if ( pPlayer->sMana < (signed int)uRequiredMana )
+				break;
+			if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 )
+			{
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				pCastSpell->spellnum = 0;
+				continue;
+			}
+			town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID);
+			pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0);
+			LODWORD(v727) = 1;
+			break;
+		}
+		case SPELL_WATER_LLOYDS_BEACON:
 		{
-			if ( LODWORD(v727) == 0 )
-			{
-				v317 = pGlobalTXT_LocalizationStrings[428];
-				if ( v730 == 0 )
-					v317 = pGlobalTXT_LocalizationStrings[585];
-				ShowStatusBarString(v317, 2u);
+			LODWORD(v733) = 604800 * v2;
+			if ( !_strcmpi(pCurrentMapName, "d05.blv") )
+			{
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
 				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-				v318 =  &pParty->pPlayers[pCastSpell->uPlayerID_2];
 				pCastSpell->spellnum = 0;
-				v318->PlaySound(SPEECH_43, 0);
+				continue;
+			}
+			v319 = uRequiredMana;
+			if ( pPlayer->sMana >= (signed int)uRequiredMana )
+			{
+				pEventTimer->Pause();
+				pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0);
+				qword_506350 = (signed int)v733;
+				_506348_current_lloyd_playerid = pCastSpell->uPlayerID;
+				::uRequiredMana = v319;
+				::sRecoveryTime = sRecoveryTime;
+				dword_50633C = pCastSpell->sound_id;
+				dword_506338 = pCastSpell->spellnum;
+				LOBYTE(pCastSpell->field_8) |= 0x20u;
 			}
 			break;
 		}
-		if ( _this->GetValue() < 0x1C2 )
-			uRequiredMana = 1;
-		if ( rand() % 100 >= SHIDWORD(v733) )
-			uRequiredMana = 1;
-		if ( uRequiredMana != 0 )
-		{
-			dword_50C9D0 = 113;
-			dword_50C9D4 = 0;
-			dword_50C9D8 = 1;
-
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		v292 = *(char *)(LODWORD(v725) + 28);
-		if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) )
-		{
-			v2 = v723;
-			//v1 = 0;
-
-			dword_50C9D0 = 113;
-			dword_50C9D4 = 0;
-			dword_50C9D8 = 1;
-
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		if ( rand() % 100 >= 80 )
+		case SPELL_EARTH_STONE_TO_FLESH:
 		{
-			v297 = pItemsTable->pSpecialEnchantments_count;
-			v294 = _this;
-			v298 = 0;
-			v725 = 0.0;
-			HIDWORD(v733) = 0;
-			if ( pItemsTable->pSpecialEnchantments_count > 0 )
-			{
-			v730 = (int)&v679;
-			do
-			{
-				v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement);
-				if ( !v299 || v299 == 1 )
-				{
-				v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]
-						+ v298 * 28);
-				LODWORD(v725) += v300;
-				if ( v300 )
-				{
-					v301 = v730;
-					v730 += 4;
-					*(int *)v301 = HIDWORD(v733);
-				}
-				}
-				++HIDWORD(v733);
-				++v298;
-			}
-			while ( SHIDWORD(v733) < v297 );
-			}
-			v302 = rand() % SLODWORD(v725);
-			v303 = v679;
-			v294->uSpecEnchantmentType = v679;
-			v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4];
-			v305 = v302 + 1;
-			if ( v304 < v305 )
-			{
-			for ( jj = &v679; ; jj = (int *)v732 )
-			{
-				v307 = (int)(jj + 1);
-				v732 = v307;
-				v308 = *(int *)v307;
-				v294->uSpecEnchantmentType = v308;
-				v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4];
-				if ( v304 >= v305 )
+			__debugbreak(); // missing GM ?
+			switch (v731)
+			{
+				case 1: amount = 3600 * v2; break;
+				case 2: amount = 3600 * v2; break;
+				case 3: amount = 86400 * v2; break;
+				case 4: break;
+				default:
+				assert(false);
+			}
+	//LABEL_634:
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
-			}
-			}
-			++v294->uSpecEnchantmentType;
+			v323 = pCastSpell->uPlayerID_2;
+			v324 = (char *)&pParty->pPlayers[v323].pConditions[15];
+			if ( !pParty->pPlayers[v323].pConditions[15] )
+			{
+				LODWORD(v727) = 1;
+				break;
+			}
+			if ( v731 == 4 )
+			{
+				*(int *)v324 = 0;
+				*((int *)v324 + 1) = 0;
+				LODWORD(v727) = 1;
+				break;
+			}
+			v732 = amount << 7;
+			v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
+			v656 = 15;
+			v325 = &pParty->pPlayers[v323];
+			v325->DiscardConditionIfLastsLongerThan(v656, v663);
+			LODWORD(v727) = 1;
+			break;
 		}
-		else
-		{
-			v293 = rand();
-			v294 = _this;
-			v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType];
-			_this->uEnchantmentType = 0;
-			for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1];
-				;
-				kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType
-																			+ 1] )
-			{
-			++v294->uEnchantmentType;
-			if ( kk >= v295 )
-				break;
-			}
-			v294->_bonus_strength = 10//pItemsTable->field_116D8[18]
-								+ rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1);
-		}
-		v294->uAttributes |= 0x20u;
-		_50C9A8_item_enchantment_timer = 256;
-		LODWORD(v727) = 1;
-		break;
-		}
-		case SPELL_WATER_TOWN_PORTAL:
-			{
-		amount = 10 * v2;
-		if ( pPlayer->sMana < (signed int)uRequiredMana )
-			break;
-		if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 )
+		case SPELL_EARTH_ROCK_BLAST:
 		{
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID);
-		pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0);
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_WATER_LLOYDS_BEACON:
-			{
-		LODWORD(v733) = 604800 * v2;
-		if ( !_strcmpi(pCurrentMapName, "d05.blv") )
-		{
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		v319 = uRequiredMana;
-		if ( pPlayer->sMana >= (signed int)uRequiredMana )
-		{
-			pEventTimer->Pause();
-			pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0);
-			qword_506350 = (signed int)v733;
-			_506348_current_lloyd_playerid = pCastSpell->uPlayerID;
-			::uRequiredMana = v319;
-			::sRecoveryTime = sRecoveryTime;
-			dword_50633C = pCastSpell->sound_id;
-			dword_506338 = pCastSpell->spellnum;
-			LOBYTE(pCastSpell->field_8) |= 0x20u;
-		}
-		break;
-			}
-		case SPELL_EARTH_STONE_TO_FLESH:
-			{
-		__debugbreak(); // missing GM ?
-		if ( v731 == 1 || v731 == 2)
-			amount = 3600 * v2;
-		if ( v731 == 3 )
-			amount = 86400 * v2;
-//LABEL_634:
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		v323 = pCastSpell->uPlayerID_2;
-		v324 = (char *)&pParty->pPlayers[v323].pConditions[15];
-		if ( !pParty->pPlayers[v323].pConditions[15] )
-		{
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			pSpellSprite.stru_24.Reset();
+			pSpellSprite.spell_id = pCastSpell->spellnum;
+			pSpellSprite.spell_level = v2;
+			pSpellSprite.spell_skill = v731;
+			pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+			pSpellSprite.vPosition.y = pParty->vPosition.y;
+			pSpellSprite.vPosition.x = pParty->vPosition.x;
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
+			pSpellSprite.uSectorID = pIndoor->GetSector(
+								pParty->vPosition.x,
+								pParty->vPosition.y,
+								pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.spell_target_pid = a2;
+			pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
+			pSpellSprite.uFacing = LOWORD(pParty->sRotationY);
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			if ( pParty->bTurnBasedModeOn == 1 )
+				LOBYTE(pSpellSprite.uAttributes) |= 4u;
+
+			v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
+			if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
+				++pTurnEngine->field_1C;
 			LODWORD(v727) = 1;
 			break;
 		}
-		if ( v731 == 4 )
+		case SPELL_EARTH_DEATH_BLOSSOM:
 		{
-			*(int *)v324 = 0;
-			*((int *)v324 + 1) = 0;
+			if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
+			{
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				pCastSpell->spellnum = 0;
+				continue;
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			pSpellSprite.uType = 4090;
+			pSpellSprite.stru_24.Reset();
+			pSpellSprite.spell_id = pCastSpell->spellnum;
+			pSpellSprite.spell_level = v2;
+			pSpellSprite.spell_skill = v731;
+			pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+			pSpellSprite.vPosition.x = pParty->vPosition.x;
+			pSpellSprite.vPosition.y = pParty->vPosition.y;
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.uSectorID = 0;
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
+			pSpellSprite.field_60_distance_related_prolly_lod = 0;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.spell_target_pid = a2;
+			pSpellSprite.uFacing = LOWORD(pParty->sRotationY);
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			if ( pParty->bTurnBasedModeOn == 1 )
+				pSpellSprite.uAttributes = 4;
+
+			v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
+			if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 )
+				++pTurnEngine->field_1C;
+			LODWORD(v727) = 1;
+			break;
+		}
+		case SPELL_SPIRIT_DETECT_LIFE:
+		{
+			v328 = v731 - 2;
+			if ( v328 )
+			{
+				v329 = v328 - 1;
+				if ( v329 && v329 != 1 )
+					v330 = 600 * v2;
+				else
+					v330 = 3600 * v2;
+			}
+			else
+			{
+				v330 = 1800 * v2;
+			}
+			LODWORD(v733) = v330;
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
+
+			pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0);
 			LODWORD(v727) = 1;
 			break;
 		}
-		v732 = amount << 7;
-		v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
-		v656 = 15;
-		v325 = &pParty->pPlayers[v323];
-		v325->DiscardConditionIfLastsLongerThan(v656, v663);
-		LODWORD(v727) = 1;
-		break;
-		}
-		case SPELL_EARTH_ROCK_BLAST:
-			{
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		pSpellSprite.stru_24.Reset();
-		pSpellSprite.spell_id = pCastSpell->spellnum;
-		pSpellSprite.spell_level = v2;
-		pSpellSprite.spell_skill = v731;
-		pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-		pSpellSprite.vPosition.y = pParty->vPosition.y;
-		pSpellSprite.vPosition.x = pParty->vPosition.x;
-		pSpellSprite.uAttributes = 0;
-		pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
-		pSpellSprite.uSectorID = pIndoor->GetSector(
-							pParty->vPosition.x,
-							pParty->vPosition.y,
-							pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
-		pSpellSprite.uSpriteFrameID = 0;
-		pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
-		pSpellSprite.spell_target_pid = a2;
-		pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
-		pSpellSprite.uFacing = LOWORD(pParty->sRotationY);
-		pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
-		if ( pParty->bTurnBasedModeOn == 1 )
-			LOBYTE(pSpellSprite.uAttributes) |= 4u;
-
-		v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
-			if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
-			++pTurnEngine->field_1C;
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_EARTH_DEATH_BLOSSOM:
-			{
-		if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
+		case SPELL_SPIRIT_FATE:
 		{
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
+			switch (v731)
+			{
+				case 1: amount = 1 * v2; break;
+				case 2: amount = 2 * v2; break;
+				case 3: amount = 4 * v2; break;
+				case 4: amount = 6 * v2; break;
+				default:
+				assert(false);
+			}
+			LODWORD(v733) = 300;
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			v342 = pCastSpell->spell_target_pid;
+			if ( v342 == 0 )
+			{
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
+
+				pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0);
+				LODWORD(v727) = 1;
+				break;
+			}
+			if (PID_TYPE(v342) == OBJECT_Actor)
+			{
+				v343 = PID_ID(v342);
+				HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32);
+				LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280;
+				pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0);
+				BYTE2(pActors[v343].uAttributes) |= 8u;
+				//v672 = 0;
+				v661 = &pActors[v343];
+				pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0);
+			}
+			LODWORD(v727) = 1;
 			break;
-		pSpellSprite.uType = 4090;
-		pSpellSprite.stru_24.Reset();
-		pSpellSprite.spell_id = pCastSpell->spellnum;
-		pSpellSprite.spell_level = v2;
-		pSpellSprite.spell_skill = v731;
-		pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-		pSpellSprite.vPosition.x = pParty->vPosition.x;
-		pSpellSprite.vPosition.y = pParty->vPosition.y;
-		pSpellSprite.uAttributes = 0;
-		pSpellSprite.uSectorID = 0;
-		pSpellSprite.uSpriteFrameID = 0;
-		pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
-		pSpellSprite.field_60_distance_related_prolly_lod = 0;
-		pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
-		pSpellSprite.spell_target_pid = a2;
-		pSpellSprite.uFacing = LOWORD(pParty->sRotationY);
-		pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
-		if ( pParty->bTurnBasedModeOn == 1 )
-			pSpellSprite.uAttributes = 4;
-
-		v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
-			if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 )
-			++pTurnEngine->field_1C;
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_SPIRIT_DETECT_LIFE:
-			{
-		v328 = v731 - 2;
-		if ( v328 )
+		}
+		case SPELL_SPIRIT_REMOVE_CURSE:
 		{
-			v329 = v328 - 1;
-			if ( v329 && v329 != 1 )
-			v330 = 600 * v2;
+			switch (v731)
+			{
+				case 1: amount = 3600 * v2; break;
+				case 2: amount = 3600 * v2; break;
+				case 3: amount = 86400 * v2; break;
+				case 4: amount = 0; break;
+				default:
+				assert(false);
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
+			if ( !v351->pConditions[0] )
+			{
+				LODWORD(v727) = 1;
+				break;
+			}
+			if ( v731 == 4 )
+			{
+				LODWORD(v351->pConditions[0]) = 0;
+				HIDWORD(v351->pConditions[0]) = 0;
+			}
 			else
-			v330 = 3600 * v2;
-		}
-		else
-		{
-			v330 = 1800 * v2;
-		}
-		LODWORD(v733) = v330;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
-
-			pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0);
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_SPIRIT_FATE:
-			{
-		LODWORD(v733) = 300;
-		if ( v731 == 1 )
-			amount = v2;
-		else if( v731 == 2 )
-			amount = 2 * v2;
-		else if( v731 == 3 )
-			amount = 4 * v2;
-		else if( v731 == 4)
-			amount = 6 * v2;
-//LABEL_667:
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		v342 = pCastSpell->spell_target_pid;
-		if ( v342 == 0 )
-		{
+			{
+				v732 = amount << 7;
+				v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
+				if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) )
+				{
+					LODWORD(v727) = 1;
+					break;
+				}
+			}
 			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-
-			pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0);
 			LODWORD(v727) = 1;
 			break;
 		}
-		if (PID_TYPE(v342) == OBJECT_Actor)
+		case SPELL_SPIRIT_PRESERVATION:
 		{
-			v343 = PID_ID(v342);
-			HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32);
-			LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280;
-			pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0);
-			BYTE2(pActors[v343].uAttributes) |= 8u;
-			//v672 = 0;
-			v661 = &pActors[v343];
-//LABEL_165:
-			pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0);
-		}
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_SPIRIT_REMOVE_CURSE:
-			{
-		if ( v731 == 1 || v731 == 2 )
-			amount = 3600 * v2;
-		else if( v731 == 3)
-			amount = 86400 * v2;
-		else if ( v731 == 4 )
-			amount = 0;
-//LABEL_679:
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
-		if ( !v351->pConditions[0] )
-		{
-		LODWORD(v727) = 1;
-		break;
-		}
-		if ( v731 == 4 )
-		{
-			LODWORD(v351->pConditions[0]) = 0;
-			HIDWORD(v351->pConditions[0]) = 0;
-		}
-		else
-		{
-			v732 = amount << 7;
-			v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
-			if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) )
-			{
+			if ( v731 == 4 )
+				LODWORD(v733) = 900 * (v2 + 4);
+			else
+				LODWORD(v733) = 300 * (v2 + 12);
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			if ( v731 == 1 || v731 == 2 )
+			{
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
+				pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0);
+				LODWORD(v727) = 1;
+				break;
+			}
+			a2 = 0;
+			v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
+			v357 = pParty->pPlayers;//[0].pPlayerBuffs[11];
+			do
+			{
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
+				v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0);
+				++a2;
+				++v357;// = (SpellBuff *)((char *)v357 + 6972);
+			}
+			while ( v357 <= &pParty->pPlayers[3] );
 			LODWORD(v727) = 1;
 			break;
-			}
 		}
-			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_SPIRIT_PRESERVATION:
-			{
-		v354 = v731 - 2;
-		if ( v354 && (v355 = v354 - 1) != 0 && v355 == 1 )
-			v356 = 900 * (v2 + 4);
-		else
-			v356 = 300 * (v2 + 12);
-		LODWORD(v733) = v356;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		if ( v731 == 1 || v731 == 2 )
-		{
-			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-
-			pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0);
-		LODWORD(v727) = 1;
-		break;
-		}
-		a2 = 0;
-		v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
-		v357 = pParty->pPlayers;//[0].pPlayerBuffs[11];
-		do
-		{
-			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
-			v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0);
-			++a2;
-			++v357;// = (SpellBuff *)((char *)v357 + 6972);
-		}
-		while ( v357 <= &pParty->pPlayers[3] );
-		LODWORD(v727) = 1;
-		break;
-			}
 		case SPELL_SPIRIT_TURN_UNDEAD:
 		{
-		v364 = v731 - 2;
-		if ( !v364 || (v365 = v364 - 1) != 0 && v365 != 1 )
-			v366 = 60 * (v2 + 3);
-		else
-			v366 = 300 * v2 + 180;
-		LODWORD(v733) = v366;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
+			if ( v731 == 1 || v731 == 2)
+				LODWORD(v733) = 60 * (v2 + 3);
+			else
+				LODWORD(v733) = 300 * v2 + 180;
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
+			pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u);
+			++pSpellSprite.uType;
+			pSpellSprite.stru_24.Reset();
+			pSpellSprite.spell_id = pCastSpell->spellnum;
+			pSpellSprite.spell_level = v2;
+			pSpellSprite.spell_skill = v731;
+			pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.uSectorID = 0;
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.field_60_distance_related_prolly_lod = 0;
+			pSpellSprite.uFacing = 0;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			for ( a2 = 0; a2 < (signed int)_v726; ++a2 )
+			{
+				v369 = &pActors[dword_50BF30[a2]];
+				if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
+				{
+					pSpellSprite.vPosition.x = v369->vPosition.x;
+					pSpellSprite.vPosition.y = v369->vPosition.y;
+					pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548);
+
+					pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
+					pSpellSprite.Create(0, 0, 0, 0);
+					v369->pActorBuffs[4].Apply(
+						pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335),
+						v731, 0, 0, 0);
+				}
+			}
+			LODWORD(v727) = 1;
 			break;
-		auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
-		pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u);
-		++pSpellSprite.uType;
-		pSpellSprite.stru_24.Reset();
-		pSpellSprite.spell_id = pCastSpell->spellnum;
-		pSpellSprite.spell_level = v2;
-		pSpellSprite.spell_skill = v731;
-		pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-		pSpellSprite.uAttributes = 0;
-		pSpellSprite.uSectorID = 0;
-		pSpellSprite.uSpriteFrameID = 0;
-		pSpellSprite.field_60_distance_related_prolly_lod = 0;
-		pSpellSprite.uFacing = 0;
-		pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
-		pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
-		for ( a2 = 0; a2 < (signed int)_v726; ++a2 )
-		{
-			v369 = &pActors[dword_50BF30[a2]];
-			if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
-			{
-			pSpellSprite.vPosition.x = v369->vPosition.x;
-			pSpellSprite.vPosition.y = v369->vPosition.y;
-			pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548);
-
-			pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
-			pSpellSprite.Create(0, 0, 0, 0);
-			v369->pActorBuffs[4].Apply(
-				pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335),
-				v731, 0, 0, 0);
-			}
-		}
-		LODWORD(v727) = 1;
-		}
-		break;
-
-		case SPELL_SPIRIT_RAISE_DEAD:
-			{
-		v371 = v731 - 2;
-		if ( v371 && (v372 = v371 - 1) != 0 && v372 == 1 )
-			amount = 0;
-		else
-			amount = 86400 * v2;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536);
-		v373 = pCastSpell->uPlayerID_2;
-		if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) )
-		{
-		LODWORD(v727) = 1;
-		break;
-		}
-		v14 = v731 == 4;
-		pParty->pPlayers[v373].sHealth = 1;
-		if ( v14 )
-		{
-			v374 = pCastSpell->uPlayerID_2;
-			LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0;
-			HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0;
-			v376 = pCastSpell->uPlayerID_2;
-			LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0;
-			HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0;
-		}
-		else
-		{
-			*(float *)&a2 = (double)(amount << 7) * 0.033333335;
-			pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
-			0xEu,
-			(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
-			pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
-			0xDu,
-			(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
 		}
-		v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
-		v377->SetCondition(1, 0);
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_SPIRIT_SHARED_LIFE:
-			{
-		v378 = v731 - 2;
-		if ( v378 && (v379 = v378 - 1) != 0 && v379 == 1 )
-			v380 = 4 * v2;
-		else
-			v380 = 3 * v2;
-		amount = v380;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		v381 = 0;
-		HIDWORD(v733) = amount;
-		v730 = 0;
-		v382 = 1;
-		do
-		{
-			v383 = pPlayers[v382];
-			if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] )
-			v682[v381++] = v382;
-			++v382;
-		}
-		while ( v382 <= 4 );
-		v384 = 0;
-		v730 = v381;
-		if ( v381 > 0 )
-		{
-			do
-			HIDWORD(v733) += pPlayers[v682[v384++]]->sHealth;
-			while ( v384 < v381 );
-		}
-		v732 = (signed __int64)((double)SHIDWORD(v733) / (double)v730);
-		HIDWORD(v733) = 0;
-		if ( v381 > 0 )
+		case SPELL_SPIRIT_RAISE_DEAD:
 		{
-			do
-			{
-			//v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]];
-			v726 = pPlayers[v682[HIDWORD(v733)]];
-			v726->sHealth = v732;
-			//v386 = v726->GetMaxHealth();
-			if ( v726->sHealth > v726->GetMaxHealth())
-				v726->sHealth = v726->GetMaxHealth();
-			if ( v726->sHealth > 0 )
-			{
-				v726->pConditions[Player::Condition_Unconcious] = 0;
-			}
-			v388 = HIDWORD(v733);
-
-			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1);
-			HIDWORD(v733) = v388 + 1;
-			}
-			while ( v388 + 1 < v730 );
-		}
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_SPIRIT_RESSURECTION:
-			{
-		v392 = v731 - 1;
-		if ( v731 == 1 )
-			amount = 180 * v2;
-		else if ( v731 == 2 )
-			amount = 10800 * v2;
-		else if ( v731 == 3 )
-			amount = 259200 * v2;
-		else if ( v731 == 4 )
-			amount = 0;
-//LABEL_751:
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		v396 = pCastSpell->uPlayerID_2;
-		if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16])
-			|| HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) )
-		{
-			if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) )
-			pParty->pPlayers[v396].PlaySound(SPEECH_25, 0);
 			if ( v731 == 4 )
-			{
-			v397 = pCastSpell->uPlayerID_2;
-			LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
-			HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
-			v398 = pCastSpell->uPlayerID_2;
-			LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
-			HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
-			v399 = pCastSpell->uPlayerID_2;
-			LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
-			HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
+				amount = 0;
+			else
+				amount = 86400 * v2;
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536);
+			v373 = pCastSpell->uPlayerID_2;
+			if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) )
+			{
+				LODWORD(v727) = 1;
+				break;
+			}
+			v14 = v731 == 4;
+			pParty->pPlayers[v373].sHealth = 1;
+			if ( v14 )
+			{
+				v374 = pCastSpell->uPlayerID_2;
+				LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0;
+				HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0;
+				v376 = pCastSpell->uPlayerID_2;
+				LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0;
+				HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0;
 			}
 			else
 			{
-			*(float *)&a2 = (double)(amount << 7) * 0.033333335;
-			pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u,
-				(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
-			pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu,
-				(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
-			pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu,
+				*(float *)&a2 = (double)(amount << 7) * 0.033333335;
+				pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
+				0xEu,
 				(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
-			}
-			pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1);
-
-			pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1;
-
-			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-		}
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_MIND_CURE_PARALYSIS:
-			{
-		if ( v731 == 1 || v731 == 2 )
-			amount = 3600 * v2;
-		else if ( v731 == 4 )
-			amount = 0;
-		else if( v731 == 3 )
-			amount = 86400 * v2;
-//LABEL_768:
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-		v323 = pCastSpell->uPlayerID_2;
-		v324 = (char *)&pParty->pPlayers[v323].pConditions[12];
-		if ( !pParty->pPlayers[v323].pConditions[12] )
-		{
-		LODWORD(v727) = 1;
-		break;
-		}
-		if ( v731 == 4 )
-		{
-			*(int *)v324 = 0;
-			*((int *)v324 + 1) = 0;
+				pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
+				0xDu,
+				(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
+			}
+			v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
+			v377->SetCondition(1, 0);
 			LODWORD(v727) = 1;
 			break;
 		}
-		v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
-		v656 = 12;
-		v325 = &pParty->pPlayers[v323];
-		v325->DiscardConditionIfLastsLongerThan(v656, v663);
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_MIND_REMOVE_FEAR:
+		case SPELL_SPIRIT_SHARED_LIFE:
 		{
-			if( v731 == 1)
-				amount = 180 * v2;
-			else if( v731 == 2 )
-				amount = 3600 * v2;
-			else if( v731 == 3)
-				amount = 86400 * v2;
-			else if( v731 == 4 )
-				amount = 0;
-//LABEL_780:
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-		v323 = pCastSpell->uPlayerID_2;
-		v324 = (char *)&pParty->pPlayers[v323].pConditions[3];
-		if ( !pParty->pPlayers[v323].pConditions[3] )
-		{
-		LODWORD(v727) = 1;
-		break;
-		}
-		if ( v731 == 4 )
-		{
-			*(int *)v324 = 0;
-			*((int *)v324 + 1) = 0;
+			if ( v731 == 4 )
+				amount = 4 * v2;
+			else
+				amount = 3 * v2;
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			v381 = 0;
+			HIDWORD(v733) = amount;
+			v730 = 0;
+			v382 = 1;
+			do
+			{
+				v383 = pPlayers[v382];
+				if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] )
+				v682[v381++] = v382;
+				++v382;
+			}
+			while ( v382 <= 4 );
+			v384 = 0;
+			v730 = v381;
+			if ( v381 > 0 )
+			{
+				do
+					HIDWORD(v733) += pPlayers[v682[v384++]]->sHealth;
+				while ( v384 < v381 );
+			}
+			v732 = (signed __int64)((double)SHIDWORD(v733) / (double)v730);
+			HIDWORD(v733) = 0;
+			if ( v381 > 0 )
+			{
+				do
+				{
+					//v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]];
+					v726 = pPlayers[v682[HIDWORD(v733)]];
+					v726->sHealth = v732;
+					//v386 = v726->GetMaxHealth();
+					if ( v726->sHealth > v726->GetMaxHealth())
+						v726->sHealth = v726->GetMaxHealth();
+					if ( v726->sHealth > 0 )
+					{
+						v726->pConditions[Player::Condition_Unconcious] = 0;
+					}
+					v388 = HIDWORD(v733);
+
+					pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1);
+					HIDWORD(v733) = v388 + 1;
+				}
+				while ( v388 + 1 < v730 );
+			}
 			LODWORD(v727) = 1;
 			break;
 		}
-		v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
-		v656 = 3;
-		v325 = &pParty->pPlayers[v323];
-		v325->DiscardConditionIfLastsLongerThan(v656, v663);
-		LODWORD(v727) = 1;
-		break;
+		case SPELL_SPIRIT_RESSURECTION:
+		{
+			switch (v731)
+			{
+				case 1: amount = 180 * v2; break;
+				case 2: amount = 10800 * v2; break;
+				case 3: amount = 259200 * v2; break;
+				case 4: amount = 0; break;
+				default:
+				assert(false);
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			v396 = pCastSpell->uPlayerID_2;
+			if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16])
+				|| HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) )
+			{
+				if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) )
+					pParty->pPlayers[v396].PlaySound(SPEECH_25, 0);
+				if ( v731 == 4 )
+				{
+					v397 = pCastSpell->uPlayerID_2;
+					LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
+					HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
+					v398 = pCastSpell->uPlayerID_2;
+					LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
+					HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
+					v399 = pCastSpell->uPlayerID_2;
+					LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
+					HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
+				}
+				else
+				{
+					*(float *)&a2 = (double)(amount << 7) * 0.033333335;
+					pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u,
+						(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
+					pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu,
+						(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
+					pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu,
+						(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
+				}
+				pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1);
+				pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1;
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
+			}
+			LODWORD(v727) = 1;
+			break;
+		}
+		case SPELL_MIND_CURE_PARALYSIS:
+		{
+			switch (v731)
+			{
+				case 1: amount = 3600 * v2; break;
+				case 2: amount = 3600 * v2; break;
+				case 3: amount = 86400 * v2; break;
+				case 4: amount = 0; break;
+				default:
+				assert(false);
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
+			v323 = pCastSpell->uPlayerID_2;
+			v324 = (char *)&pParty->pPlayers[v323].pConditions[12];
+			if ( !pParty->pPlayers[v323].pConditions[12] )
+			{
+				LODWORD(v727) = 1;
+				break;
+			}
+			if ( v731 == 4 )
+			{
+				*(int *)v324 = 0;
+				*((int *)v324 + 1) = 0;
+				LODWORD(v727) = 1;
+				break;
+			}
+			v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
+			v656 = 12;
+			v325 = &pParty->pPlayers[v323];
+			v325->DiscardConditionIfLastsLongerThan(v656, v663);
+			LODWORD(v727) = 1;
+			break;
+		}
+		case SPELL_MIND_REMOVE_FEAR:
+		{
+			switch (v731)
+			{
+				case 1: amount = 180 * v2; break;
+				case 2: amount = 3600 * v2; break;
+				case 3: amount = 86400 * v2; break;
+				case 4: amount = 0; break;
+				default:
+				assert(false);
+			}
+
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
+			v323 = pCastSpell->uPlayerID_2;
+			v324 = (char *)&pParty->pPlayers[v323].pConditions[3];
+			if ( !pParty->pPlayers[v323].pConditions[3] )
+			{
+				LODWORD(v727) = 1;
+				break;
+			}
+			if ( v731 == 4 )
+			{
+				*(int *)v324 = 0;
+				*((int *)v324 + 1) = 0;
+				LODWORD(v727) = 1;
+				break;
+			}
+			v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
+			v656 = 3;
+			v325 = &pParty->pPlayers[v323];
+			v325->DiscardConditionIfLastsLongerThan(v656, v663);
+			LODWORD(v727) = 1;
+			break;
 		}
 		case SPELL_MIND_TELEPATHY:
 		{
@@ -5959,9 +5500,9 @@
 				}
 				if ( v420 < 4 )
 				{
-				memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683));
-				v2 = v723;
-				//v1 = 0;
+					memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683));
+					v2 = v723;
+					//v1 = 0;
 				}
 			}
 //	LABEL_799:
@@ -6055,26 +5596,15 @@
 		}
 		case SPELL_MIND_BERSERK:
 		{
-			v423 = v731 - 2;
-			if ( !v423 )
-				v425 = 300 * v2;
-			else
-			{
-				v424 = v423 - 1;
-				if ( v424 )
-				{
-					if ( v424 == 1 )
-						v425 = 3600 * v2;
-					else
-//LABEL_813:
-						v425 = 300 * v2;
-				}
-				else
-				{
-					v425 = 600 * v2;
-				}
-			}
-			amount = v425;
+			switch (v731)
+			{
+				case 1: amount = 300 * v2; break;
+				case 2: amount = 300 * v2; break;
+				case 3: amount = 600 * v2; break;
+				case 4: amount = 3600; break;
+				default:
+				assert(false);
+			}
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
 			v426 = PID_ID(a2);
@@ -6175,1001 +5705,940 @@
 		}
 		case SPELL_MIND_MASS_FEAR:
 		{
-		v428 = v731 - 2;
-		if ( v428 && (v429 = v428 - 1) != 0 && v429 == 1 )
-			v430 = 300 * v2;
-		else
-			v430 = 180 * v2;
-		amount = v430;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
-		pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u);
-		++pSpellSprite.uType;
-		pSpellSprite.stru_24.Reset();
-		pSpellSprite.spell_id = pCastSpell->spellnum;
-		pSpellSprite.spell_level = v2;
-		pSpellSprite.spell_skill = v731;
-		pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-		pSpellSprite.uAttributes = 0;
-		pSpellSprite.uSectorID = 0;
-		pSpellSprite.uSpriteFrameID = 0;
-		pSpellSprite.field_60_distance_related_prolly_lod = 0;
-		pSpellSprite.uFacing = 0;
-		pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
-		pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
-		for ( a2 = 0; a2 < (signed int)_v726; ++a2 )
-		{
-			v433 = &pActors[dword_50BF30[a2]];
-			if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
+			if ( v731 == 4 )
+				amount = 300 * v2;
+			else
+				amount = 180 * v2;
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
+			pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u);
+			++pSpellSprite.uType;
+			pSpellSprite.stru_24.Reset();
+			pSpellSprite.spell_id = pCastSpell->spellnum;
+			pSpellSprite.spell_level = v2;
+			pSpellSprite.spell_skill = v731;
+			pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.uSectorID = 0;
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.field_60_distance_related_prolly_lod = 0;
+			pSpellSprite.uFacing = 0;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			for ( a2 = 0; a2 < (signed int)_v726; ++a2 )
+			{
+				v433 = &pActors[dword_50BF30[a2]];
+				if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
+					break;
+				pSpellSprite.vPosition.x = v433->vPosition.x;
+				pSpellSprite.vPosition.y = v433->vPosition.y;
+				pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548);
+
+				pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
+				pSpellSprite.Create(0, 0, 0, 0);
+				if ( stru_50C198.GetMagicalResistance(v433, 7u) )
+				{
+					v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335),
+						v731, 0, 0, 0);
+				}
+			}
+			LODWORD(v727) = 1;
 			break;
-			pSpellSprite.vPosition.x = v433->vPosition.x;
-			pSpellSprite.vPosition.y = v433->vPosition.y;
-			pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548);
-
-			pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
-			pSpellSprite.Create(0, 0, 0, 0);
-			if ( stru_50C198.GetMagicalResistance(v433, 7u) )
-			{
-			v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335),
-				v731, 0, 0, 0);
-			}
-		}
-		LODWORD(v727) = 1;
-		break;
-		}
-
-		case SPELL_MIND_CURE_INSANITY:
-			{
-		v435 = v731 - 2;
-		if ( v435 && (v436 = v435 - 1) != 0 && v436 == 1 )
-			amount = 0;
-		else
-			amount = 86400 * v2;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-		v440 = pCastSpell->uPlayerID_2;
-		if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) )
-		{
-			if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) )
-			pParty->pPlayers[v440].PlaySound(SPEECH_25, 0);
-			if ( v731 == 4 )
-			{
-			v441 = pCastSpell->uPlayerID_2;
-			LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0;
-			HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0;
-			}
-			else
-			{
-			pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u,
-				(signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
-			}
-			v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
-//LABEL_720:
-			v377->SetCondition(1, 0);
 		}
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_EARTH_TELEKINESIS:
-			{
-		if ( v731 == 1 || v731 == 2 )
-			amount = 2 * v2;
-		else if( v731 == 3 )
-			amount = 3 * v2;
-		else if ( v731 == 4 )
-			amount = 4 * v2;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		v445 = PID_ID(a2);
-		if (PID_TYPE(a2) == OBJECT_Item)
+		case SPELL_MIND_CURE_INSANITY:
 		{
-			v449 = (char *)&pSpriteObjects[v445].stru_24;
-			v450 = *(int *)v449;
-			if ( pItemsTable->pItems[v450].uEquipType == 18 )
-			{
-			party_finds_gold(*((int *)v449 + 3), 0);
-			viewparams->bRedrawGameUI = 1;
-			}
+			v435 = v731 - 2;
+			if ( v731 == 4 )
+				amount = 0;
 			else
-			{
-			sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName);
-			ShowStatusBarString(pTmpBuf2, 2u);
-			if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) )
-				pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24);
-			}
-			SpriteObject::OnInteraction(v445);
-		}
-		else
-		{
-			if (PID_TYPE(a2) == OBJECT_Actor)
-			{
-			stru_50C198.LootActor(&pActors[v445]);
-			}
-			else
-			{
-			if (PID_TYPE(a2) != OBJECT_Decoration)
-			{
-				if (PID_TYPE(a2) != OBJECT_BModel)
+				amount = 86400 * v2;
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
+			v440 = pCastSpell->uPlayerID_2;
+			if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) )
+			{
+				if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) )
+					pParty->pPlayers[v440].PlaySound(SPEECH_25, 0);
+				if ( v731 == 4 )
 				{
-				LODWORD(v727) = 1;
-				break;
+					v441 = pCastSpell->uPlayerID_2;
+					LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0;
+					HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0;
 				}
-				dword_507CD8 = 1;
-				v677 = 1;
-				if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
-				v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID;
 				else
-				v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID;
-
-				EventProcessor(v446, a2, v677);
-				LODWORD(v727) = 1;
-				break;
-			}
-			v447 = &pLevelDecorations[v445];
-			dword_507CD8 = 1;
-			v448 = v447->field_16_event_id;
-			if (v448)
-			{
-				v677 = 1;
-				v446 = v448;
-				EventProcessor(v446, a2, v677);
-				LODWORD(v727) = 1;
-				break;
-			}
-			if ( v447->IsInteractive() )
-			{
-				activeLevelDecoration = v447;
-				EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1);
-				activeLevelDecoration = NULL;
-			}
-			}
-		}
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_BODY_CURE_WEAKNESS:
-			{
-		if ( v731 == 1 )
-			amount = 180 * v2;
-		else if( v731 == 2 )
-			amount = 3600 * v2;
-		else if( v731 == 3 )
-			amount = 86400 * v2;
-		else if ( v731 == 4 )
-			amount = 0;
-//LABEL_883:
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-		v323 = pCastSpell->uPlayerID_2;
-		v324 = (char *)&pParty->pPlayers[v323].pConditions[1];
-		if ( !pParty->pPlayers[v323].pConditions[1] )
-		{
+				{
+					pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u,
+						(signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
+				}
+				v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
+				v377->SetCondition(1, 0);
+			}
 			LODWORD(v727) = 1;
 			break;
 		}
-		if ( v731 == 4 )
+		case SPELL_EARTH_TELEKINESIS:
 		{
-			*(int *)v324 = 0;
-			*((int *)v324 + 1) = 0;
+			switch (v731)
+			{
+				case 1: amount = 2 * v2; break;
+				case 2: amount = 2 * v2; break;
+				case 3: amount = 3 * v2; break;
+				case 4: amount = 4 * v2; break;
+				default:
+				assert(false);
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			v445 = PID_ID(a2);
+			if (PID_TYPE(a2) == OBJECT_Item)
+			{
+				v449 = (char *)&pSpriteObjects[v445].stru_24;
+				v450 = *(int *)v449;
+				if ( pItemsTable->pItems[v450].uEquipType == 18 )
+				{
+					party_finds_gold(*((int *)v449 + 3), 0);
+					viewparams->bRedrawGameUI = 1;
+				}
+				else
+				{
+					sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName);
+					ShowStatusBarString(pTmpBuf2, 2u);
+					if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) )
+						pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24);
+				}
+				SpriteObject::OnInteraction(v445);
+			}
+			else
+			{
+				if (PID_TYPE(a2) == OBJECT_Actor)
+				{
+					stru_50C198.LootActor(&pActors[v445]);
+				}
+				else
+				{
+					if (PID_TYPE(a2) != OBJECT_Decoration)
+					{
+						if (PID_TYPE(a2) != OBJECT_BModel)
+						{
+							LODWORD(v727) = 1;
+							break;
+						}
+						dword_507CD8 = 1;
+						v677 = 1;
+						if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
+							v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID;
+						else
+							v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID;
+						EventProcessor(v446, a2, v677);
+						LODWORD(v727) = 1;
+						break;
+					}
+					v447 = &pLevelDecorations[v445];
+					dword_507CD8 = 1;
+					v448 = v447->field_16_event_id;
+					if (v448)
+					{
+						v677 = 1;
+						v446 = v448;
+						EventProcessor(v446, a2, v677);
+						LODWORD(v727) = 1;
+						break;
+					}
+					if ( v447->IsInteractive() )
+					{
+						activeLevelDecoration = v447;
+						EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1);
+						activeLevelDecoration = NULL;
+					}
+				}
+			}
 			LODWORD(v727) = 1;
 			break;
 		}
-		v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
-		v656 = 1;
-		v325 = &pParty->pPlayers[v323];
-		v325->DiscardConditionIfLastsLongerThan(v656, v663);
-		LODWORD(v727) = 1;
-		break;
-		}
-		case SPELL_BODY_FIRST_AID:
-			{
-		v457 = v731 - 2;
-		if ( v457 )
-		{
-			v458 = v457 - 1;
-			if ( v458 )
-			{
-			if ( v458 == 1 )
-				v459 = 5 * v2 + 5;
-			else
-				v459 = 2 * v2 + 5;
-			}
-			else
-			{
-			v459 = 4 * v2 + 5;
-			}
-		}
-		else
-		{
-			v459 = 3 * v2 + 5;
-		}
-		amount = v459;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		v460 = pCastSpell->spell_target_pid;
-		if (!v460)
-		{
-			pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount);
-			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-		}
-		else
+		case SPELL_BODY_CURE_WEAKNESS:
 		{
-			if (PID_TYPE(v460) == OBJECT_Actor)
-			{
-			v461 = &pActors[PID_ID(v460)];
-			v462 = v461->uAIState;
-			v463 = v461->pMonsterInfo.uHP;
-			if ( v462 != 5 )
-			{
-				if ( v462 != 4 )
-				{
-				if ( v462 != 19 )
-				{
-					if ( v462 != 11 )
-					{
-					v461->sCurrentHP += amount;
-					if ( v461->sCurrentHP > v463 )
-						v461->sCurrentHP = v463;
-					}
-				}
-				}
-			}
-			}
-		}
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_BODY_CURE_POISON:
-			{
-		if ( v731 == 1 || v731 == 2 )
-			amount = 3600 * v2;
-		else if( v731 == 3)
-			amount = 86400 * v2;
-		else if ( v731 == 4 )
-			amount = 0;
-//LABEL_912:
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-		v470 = pCastSpell->uPlayerID_2;
-		if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6]))
-			&& !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8]))
-			&& !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) )
-		{
+			switch (v731)
+			{
+				case 1: amount = 180 * v2; break;
+				case 2: amount = 3600 * v2; break;
+				case 3: amount = 86400 * v2; break;
+				case 4: amount = 0; break;
+				default:
+				assert(false);
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
+			v323 = pCastSpell->uPlayerID_2;
+			v324 = (char *)&pParty->pPlayers[v323].pConditions[1];
+			if ( !pParty->pPlayers[v323].pConditions[1] )
+			{
+				LODWORD(v727) = 1;
+				break;
+			}
+			if ( v731 == 4 )
+			{
+				*(int *)v324 = 0;
+				*((int *)v324 + 1) = 0;
+				LODWORD(v727) = 1;
+				break;
+			}
+			v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
+			v656 = 1;
+			v325 = &pParty->pPlayers[v323];
+			v325->DiscardConditionIfLastsLongerThan(v656, v663);
 			LODWORD(v727) = 1;
 			break;
 		}
-		if ( v731 == 4 )
+		case SPELL_BODY_FIRST_AID:
 		{
-			LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0;
-			HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0;
-			v471 = pCastSpell->uPlayerID_2;
-			LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0;
-			HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0;
-			v472 = pCastSpell->uPlayerID_2;
-			LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0;
-			HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0;
+			switch (v731)
+			{
+				case 1: amount = 2 * v2 + 5; break;
+				case 2: amount = 3 * v2 + 5; break;
+				case 3: amount = 4 * v2 + 5; break;
+				case 4: amount = 5 * v2 + 5; break;
+				default:
+				assert(false);
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			v460 = pCastSpell->spell_target_pid;
+			if (!v460)
+			{
+				pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount);
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
+			}
+			else
+			{
+				if (PID_TYPE(v460) == OBJECT_Actor)
+				{
+					v461 = &pActors[PID_ID(v460)];
+					v462 = v461->uAIState;
+					v463 = v461->pMonsterInfo.uHP;
+					if ( v462 != 5 )
+					{
+						if ( v462 != 4 )
+						{
+							if ( v462 != 19 )
+							{
+								if ( v462 != 11 )
+								{
+									v461->sCurrentHP += amount;
+									if ( v461->sCurrentHP > v463 )
+										v461->sCurrentHP = v463;
+								}
+							}
+						}
+					}
+				}
+			}
 			LODWORD(v727) = 1;
 			break;
 		}
-		*(float *)&a2 = (double)(amount << 7) * 0.033333335;
-		pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan(
-			6u,
-			(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
-		pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
-			8u,
-			(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
-		v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
-		v656 = 10;
-		v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
-		v325->DiscardConditionIfLastsLongerThan(v656, v663);
-		LODWORD(v727) = 1;
-		break;
+		case SPELL_BODY_CURE_POISON:
+		{
+			switch (v731)
+			{
+				case 1: amount = 3600 * v2; break;
+				case 2: amount = 3600 * v2; break;
+				case 3: amount = 86400 * v2; break;
+				case 4: amount = 0; break;
+				default:
+				assert(false);
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
+			v470 = pCastSpell->uPlayerID_2;
+			if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6]))
+				&& !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8]))
+				&& !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) )
+			{
+				LODWORD(v727) = 1;
+				break;
+			}
+			if ( v731 == 4 )
+			{
+				LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0;
+				HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0;
+				v471 = pCastSpell->uPlayerID_2;
+				LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0;
+				HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0;
+				v472 = pCastSpell->uPlayerID_2;
+				LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0;
+				HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0;
+				LODWORD(v727) = 1;
+				break;
+			}
+			*(float *)&a2 = (double)(amount << 7) * 0.033333335;
+			pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan(
+				6u,
+				(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
+			pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
+				8u,
+				(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
+			v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
+			v656 = 10;
+			v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
+			v325->DiscardConditionIfLastsLongerThan(v656, v663);
+			LODWORD(v727) = 1;
+			break;
 		}
 		case SPELL_BODY_PROTECTION_FROM_MAGIC:
-			{
-		amount = v2;
-		LODWORD(v733) = 3600 * v2;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
-
-		pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0);
-			LODWORD(v727) = 1;
-			break;
-			}
-		case SPELL_BODY_HAMMERHANDS:
-			{
-		LODWORD(v733) = 3600 * v2;
-		amount = v2;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		if ( v731 == 4 )
 		{
+			amount = v2;
+			LODWORD(v733) = 3600 * v2;
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+
 			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
 			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
 			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
 			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
-			v732 = (int)v733 << 7;
-			v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
-			pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
-			pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
-			pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
-
-			pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0);
+
+			pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0);
 			LODWORD(v727) = 1;
 			break;
 		}
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-
-		pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, v2, 0);
-			LODWORD(v727) = 1;
-			break;
-			}
-		case SPELL_BODY_CURE_DISEASE:
-			{
-		v493 = v731 - 2;
-		if ( v493 && (v494 = v493 - 1) != 0 && v494 == 1 )
-			amount = 0;
-		else
-			amount = 86400 * v2;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-		v498 = pCastSpell->uPlayerID_2;
-		if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7]))
-			&& !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9]))
-			&& !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) )
+		case SPELL_BODY_HAMMERHANDS:
 		{
+			LODWORD(v733) = 3600 * v2;
+			amount = v2;
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			if ( v731 == 4 )
+			{
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
+				v732 = (int)v733 << 7;
+				v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
+				pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
+				pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
+				pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
+
+				pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0);
+				LODWORD(v727) = 1;
+				break;
+			}
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
+
+			pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, v2, 0);
 			LODWORD(v727) = 1;
 			break;
 		}
-		if ( v731 == 4 )
-		{
-			LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0;
-			HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0;
-			v499 = pCastSpell->uPlayerID_2;
-			LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0;
-			HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0;
-			v500 = pCastSpell->uPlayerID_2;
-			LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0;
-			HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0;
-		}
-		else
+		case SPELL_BODY_CURE_DISEASE:
 		{
-			*(float *)&a2 = (double)(amount << 7) * 0.033333335;
-			pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan(
-			7u,
-			(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
-			pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
-			9u,
-			(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
-			v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
-			v656 = 11;
-//LABEL_937:
-			v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
-//LABEL_641:
-			v325->DiscardConditionIfLastsLongerThan(v656, v663);
-		}
+			if ( v731 == 4 )
+				amount = 0;
+			else
+				amount = 86400 * v2;
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
+			v498 = pCastSpell->uPlayerID_2;
+			if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7]))
+				&& !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9]))
+				&& !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) )
+			{
+				LODWORD(v727) = 1;
+				break;
+			}
+			if ( v731 == 4 )
+			{
+				LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0;
+				HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0;
+				v499 = pCastSpell->uPlayerID_2;
+				LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0;
+				HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0;
+				v500 = pCastSpell->uPlayerID_2;
+				LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0;
+				HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0;
+			}
+			else
+			{
+				*(float *)&a2 = (double)(amount << 7) * 0.033333335;
+				pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan(
+				7u,
+				(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
+				pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
+				9u,
+				(signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
+				v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
+				v656 = 11;
+				v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
+				v325->DiscardConditionIfLastsLongerThan(v656, v663);
+			}
 			LODWORD(v727) = 1;
 			break;
-			}
+		}
 		case SPELL_BODY_POWER_CURE:
 		{
-		amount = 5 * v2 + 10;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		v501 = pParty->pPlayers;
-		int v1 = 0;
-		do
-		{
-			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1);
-			v501->Heal(amount);
-			++v501;
-			++v1;
-		}
-		while ( (signed int)v501 < (signed int)pParty->pHirelings );
+			amount = 5 * v2 + 10;
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			v501 = pParty->pPlayers;
+			int v1 = 0;
+			do
+			{
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1);
+				v501->Heal(amount);
+				++v501;
+				++v1;
+			}
+			while ( (signed int)v501 < (signed int)pParty->pHirelings );
 			LODWORD(v727) = 1;
 			break;
 		}
 		case SPELL_LIGHT_DISPEL_MAGIC:
-			{
-		sRecoveryTime -= v2;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-
-		pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u);
-		v505 = sub_46A6AC((int)dword_50BF30, 100, 4096);
-		++pSpellSprite.uType;
-		HIDWORD(v733) = v505;
-		v688.x = 0;
-		v688.y = 0;
-		v688.z = 0;
-		pSpellSprite.stru_24.Reset();
-		pSpellSprite.spell_id = pCastSpell->spellnum;
-		pSpellSprite.spell_level = v2;
-		pSpellSprite.spell_skill = v731;
-		pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-		pSpellSprite.uAttributes = 0;
-		pSpellSprite.uSectorID = 0;
-		pSpellSprite.uSpriteFrameID = 0;
-		pSpellSprite.field_60_distance_related_prolly_lod = 0;
-		pSpellSprite.uFacing = 0;
-		pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
-		pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
-		a2 = 0;
-		if ( SHIDWORD(v733) > 0 )
 		{
-			do
-			{
-			v507 = dword_50BF30[a2];
-			pSpellSprite.vPosition.x = pActors[v507].vPosition.x;
-			pSpellSprite.vPosition.y = pActors[v507].vPosition.y;
-			pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548);
-			pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
-			v509 = pSpellSprite.Create(0, 0, 0, 0);
-			v510 = a2;
-			DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688);
-			a2 = v510 + 1;
-			}
-			while ( v510 + 1 < SHIDWORD(v733) );
-		}
-		for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 )
-		{
-			v511 = &pActors[dword_50BF30[a2]];
-			pSpellSprite.vPosition.x = v511->vPosition.x;
-			pSpellSprite.vPosition.y = v511->vPosition.y;
-			pSpellSprite.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548);
-			pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
-			pSpellSprite.Create(0, 0, 0, 0);
-			v513 = v511->pActorBuffs;
-			for (int _v726 = 22; _v726 != 0; --_v726)
-			{
-			v513->Reset();
-			++v513;
-			}
-		}
-			LODWORD(v727) = 1;
-			break;
-			}
-		case SPELL_LIGHT_SUMMON_ELEMENTAL:
-			{
-		v514 = v731 - 2;
-		if ( v731 == 1 || v731 == 2 )
-		{
-			v516 = 300 * v2;
-			amount = 1;
-		}
-		else if( v731 == 3 )
-		{
-			v516 = 900 * v2;
-			amount = 3;
-		}
-		else if ( v731 == 4 )
-			{
-			v516 = 900 * v2;
-			amount = 5;
-			}
-		v733 = __PAIR__(0, v516);
-
-		if ( (signed int)uNumActors > 0 )
-		{
-			v518 = pActors;//[0].uAIState;
-			auto _v726 = uNumActors;
-			do
-			{
-			v519 = v518->uAIState;
-			if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID )
-				++HIDWORD(v733);
-			++v518;
-			--_v726;
-			}
-			while ( _v726 != 0 );
-		}
-		if ( SHIDWORD(v733) >= amount )
-		{
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2);  // This character can't summon any more monsters!
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733);
-			LODWORD(v727) = 1;
-			break;
-			}
-		case SPELL_LIGHT_DAY_OF_THE_GODS:
-			{
-		if ( v731 == 1 || v731 == 2 )
-		{
-			LODWORD(v733) = 10800 * v2;
-			amount = 3 * v2 + 10;
-		}
-		else if( v731 == 3 )
-		{
-			LODWORD(v733) = 14400 * v2;
-			amount = 4 * v2 + 10;
-		}
-		else if ( v731 == 4 )
-		{
-			LODWORD(v733) = 18000 * v2;
-			amount = 5 * v2 + 10;
-		}
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
-
-		pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0);
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_LIGHT_PRISMATIC_LIGHT:
-			{
-		//v67 = 2;
-		if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
-		{
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2);  // Can't cast Prismatic Light outdoors!
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		v531 = sub_46A6AC((int)dword_50BF30, 100, 4096);
-		++pSpellSprite.uType;
-		v694.x = 0;
-		v694.y = 0;
-		v694.z = 0;
-		pSpellSprite.stru_24.Reset();
-		pSpellSprite.spell_id = pCastSpell->spellnum;
-		pSpellSprite.spell_level = v2;
-		pSpellSprite.spell_skill = v731;
-		pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-		pSpellSprite.uAttributes = 0;
-		pSpellSprite.uSectorID = 0;
-		pSpellSprite.uSpriteFrameID = 0;
-		pSpellSprite.field_60_distance_related_prolly_lod = 0;
-		pSpellSprite.uFacing = 0;
-		pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
-		pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
-		a2 = 0;
-		if ( (signed int)v531 > 0 )
-		{
-			do
-			{
-			v533 = dword_50BF30[a2];
-			pSpellSprite.vPosition.x = pActors[v533].vPosition.x;
-			pSpellSprite.vPosition.y = pActors[v533].vPosition.y;
-			pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548);
-			pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
-			v535 = pSpellSprite.Create(0, 0, 0, 0);
-			v536 = a2;
-			DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694);
-			a2 = v536 + 1;
-			}
-			while ( v536 + 1 < (signed int)v531 );
-		}
-		v537 = pGame->GetStru6();
-		pGame->GetStru6()->_4A8BFC();
-			LODWORD(v727) = 1;
-			break;
-			}
-		case SPELL_LIGHT_DAY_OF_PROTECTION:
-		{
-		v538 = v731 - 2;
-		if ( v538 && (v539 = v538 - 1) != 0 && v539 == 1 )
-		{
-			amount = 5 * v2;
-			v540 = 18000 * v2;
-		}
-		else
-		{
-			amount = 4 * v2;
-			v540 = 14400 * v2;
-		}
-		v730 = v540;
-		LODWORD(v733) = v540;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
-		pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
-
-		v732 = v730 << 7;
-		v549 = (double)(v730 << 7) * 0.033333335;
-		*((float *)&v733 + 1) = v549;
-		v712 = (signed __int64)v549;
-		pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0);
-		pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
-		pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
-		pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
-		pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
-		pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
-		v550 = v2 + 5;
-		pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(
-			(signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)),
-			v731,
-			v550, 0, 0);
-
-		pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0);
+			sRecoveryTime -= v2;
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+
+			pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u);
+			v505 = sub_46A6AC((int)dword_50BF30, 100, 4096);
+			++pSpellSprite.uType;
+			HIDWORD(v733) = v505;
+			v688.x = 0;
+			v688.y = 0;
+			v688.z = 0;
+			pSpellSprite.stru_24.Reset();
+			pSpellSprite.spell_id = pCastSpell->spellnum;
+			pSpellSprite.spell_level = v2;
+			pSpellSprite.spell_skill = v731;
+			pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.uSectorID = 0;
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.field_60_distance_related_prolly_lod = 0;
+			pSpellSprite.uFacing = 0;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			a2 = 0;
+			if ( SHIDWORD(v733) > 0 )
+			{
+				do
+				{
+					v507 = dword_50BF30[a2];
+					pSpellSprite.vPosition.x = pActors[v507].vPosition.x;
+					pSpellSprite.vPosition.y = pActors[v507].vPosition.y;
+					pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548);
+					pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
+					v509 = pSpellSprite.Create(0, 0, 0, 0);
+					v510 = a2;
+					DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688);
+					a2 = v510 + 1;
+				}
+				while ( v510 + 1 < SHIDWORD(v733) );
+			}
+			for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 )
+			{
+				v511 = &pActors[dword_50BF30[a2]];
+				pSpellSprite.vPosition.x = v511->vPosition.x;
+				pSpellSprite.vPosition.y = v511->vPosition.y;
+				pSpellSprite.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548);
+				pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
+				pSpellSprite.Create(0, 0, 0, 0);
+				v513 = v511->pActorBuffs;
+				for (int _v726 = 22; _v726 != 0; --_v726)
+				{
+					v513->Reset();
+					++v513;
+				}
+			}
 			LODWORD(v727) = 1;
 			break;
 		}
-
-		case SPELL_LIGHT_HOUR_OF_POWER:
-		{
-		v551 = v731 - 2;
-		if ( v731 == 1 || v731 == 2 )
+		case SPELL_LIGHT_SUMMON_ELEMENTAL:
 		{
-			HIDWORD(v733) = 4;
-			amount = 4;
-		}
-		else if( v731 == 3 )
-		{
-			HIDWORD(v733) = 12;
-			amount = 12;
+			switch (v731)
+			{
+				case 1: v733 = 300 * v2; amount = 1; break;
+				case 2: v733 = 300 * v2; amount = 1; break;
+				case 3: v733 = 900 * v2; amount = 3; break;
+				case 4: v733 = 900 * v2; amount = 5; break;
+				default:
+				assert(false);
+			}
+			//v733 = __PAIR__(0, v516);
+
+			if ( (signed int)uNumActors > 0 )
+			{
+				v518 = pActors;//[0].uAIState;
+				auto _v726 = uNumActors;
+				do
+				{
+					v519 = v518->uAIState;
+					if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID )
+						++HIDWORD(v733);
+					++v518;
+					--_v726;
+				}
+				while ( _v726 != 0 );
+			}
+			if ( SHIDWORD(v733) >= amount )
+			{
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2);  // This character can't summon any more monsters!
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				pCastSpell->spellnum = 0;
+				continue;
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733);
+			LODWORD(v727) = 1;
+			break;
 		}
-		else if( v731 == 4 )
+		case SPELL_LIGHT_DAY_OF_THE_GODS:
 		{
-			amount = 15;
-			HIDWORD(v733) = 20;
-		}
-//LABEL_1000:
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		y = (char *)(60 * (v2 * HIDWORD(v733) + 60));
-		v732 = (300 * amount * v2 + 60) << 7;
-		v730 = v2 + 5;
-		int _v726 = 0;
-		v553 = pParty->pPlayers;//[0].pConditions[1];
-		*((float *)&v733 + 1) = (double)v732 * 0.033333335;
-		do
-		{
+			switch (v731)
+			{
+				case 1: LODWORD(v733) = 10800 * v2; amount = 3 * v2 + 10; break;
+				case 2: LODWORD(v733) = 10800 * v2; amount = 3 * v2 + 10; break;
+				case 3: LODWORD(v733) = 14400 * v2; amount = 4 * v2 + 10; break;
+				case 4: LODWORD(v733) = 18000 * v2; amount = 5 * v2 + 10; break;
+				default:
+				assert(false);
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+
 			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
 			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
 			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
 			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
 
-			//((SpellBuff *)(v553 + 6056))->Apply(
-			v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0);
-			if ( *(_QWORD *)v553 )
-			_v726 = 1;
-			++v553;
+			pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0);
+			LODWORD(v727) = 1;
+			break;
 		}
-		while ( v553 <= &pParty->pPlayers[3] );
-		v562 = v731;
-		pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0);
-		pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, 0, 0, 0);
-		pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, v730, 0, 0);
-		if (!_v726)
+		case SPELL_LIGHT_PRISMATIC_LIGHT:
 		{
-			pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply((signed __int64)((double)(signed int)((int)y << 7) * 0.033333335 + (double)(signed __int64)pParty->uTimePlayed), v562, v730, 0, 0);
-		}
+			//v67 = 2;
+			if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
+			{
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2);  // Can't cast Prismatic Light outdoors!
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				pCastSpell->spellnum = 0;
+				continue;
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			v531 = sub_46A6AC((int)dword_50BF30, 100, 4096);
+			++pSpellSprite.uType;
+			v694.x = 0;
+			v694.y = 0;
+			v694.z = 0;
+			pSpellSprite.stru_24.Reset();
+			pSpellSprite.spell_id = pCastSpell->spellnum;
+			pSpellSprite.spell_level = v2;
+			pSpellSprite.spell_skill = v731;
+			pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.uSectorID = 0;
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.field_60_distance_related_prolly_lod = 0;
+			pSpellSprite.uFacing = 0;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			a2 = 0;
+			if ( (signed int)v531 > 0 )
+			{
+				do
+				{
+					v533 = dword_50BF30[a2];
+					pSpellSprite.vPosition.x = pActors[v533].vPosition.x;
+					pSpellSprite.vPosition.y = pActors[v533].vPosition.y;
+					pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548);
+					pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
+					v535 = pSpellSprite.Create(0, 0, 0, 0);
+					v536 = a2;
+					DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694);
+					a2 = v536 + 1;
+				}
+				while ( v536 + 1 < (signed int)v531 );
+			}
+			v537 = pGame->GetStru6();
+			pGame->GetStru6()->_4A8BFC();
 			LODWORD(v727) = 1;
 			break;
 		}
-
-
-		case SPELL_LIGHT_DIVINE_INTERVENTION:
-			{
-		amount = 3;
-		if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u )
-		{
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		a2 = 0;
-		_this = (ItemGen *)&pPlayers[1];
-		do
-		{
-			v563 = 0;
-			do
-			{
-			v564 = _this->uItemID;
-			*(int *)(v563 + _this->uItemID) = 0;
-			v563 += 8;
-			*(int *)(v563 + v564 - 4) = 0;
-			}
-			while ( v563 <= 128 );
-			v565 = ((Player *)_this->uItemID)->GetMaxHealth();
-			v566 = (Player **)_this;
-			*(int *)(_this->uItemID + 6460) = v565;
-			v567 = (*v566)->GetMaxMana();
-			*(int *)(_this->uItemID + 6464) = v567;
-			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
-			++a2;
-			_this = (ItemGen *)((char *)_this + 4);
-		}
-		while ( (signed int)this < (signed int)&qword_A750D8 );
-		v571 = pPlayer;
-		v572 = (char *)&pPlayer->sAgeModifier;
-		if ( pPlayer->sAgeModifier + 10 >= 120 )
-			*(short *)v572 = 120;
-		else
-			*(short *)v572 = pPlayer->sAgeModifier + 10;
-		sRecoveryTime += -5 * v2;
-		++v571->uNumDivineInterventionCastsThisDay;
-			LODWORD(v727) = 1;
-			break;
-			}
-		case SPELL_DARK_REANIMATE:
-			{
-		v573 = v731 - 2;
-		if ( v573 )
-		{
-			v574 = v573 - 1;
-			if ( v574 )
-			{
-			if ( v574 == 1 )
-				v575 = 5 * v2;
-			else
-				v575 = 2 * v2;
-			}
-			else
-			{
-			v575 = 4 * v2;
-			}
-		}
-		else
-		{
-			v575 = 3 * v2;
-		}
-		amount = v575;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		v576 = pCastSpell->spell_target_pid;
-		if (!v576)
-		{
-			v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2];
-			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-			if ( *((_QWORD *)v585 + 14) )
-			{
-			((Player *)v585)->SetCondition(0x11u, 1);
-			v587 = ((Player *)v585)->GetSexByVoice();
-			ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23);
-			*((_QWORD *)v585 + 17) = pParty->uTimePlayed;
-			}
-			break;
-		}
-		v577 = (Player *)(PID_ID(v576));
-		//v726 = v577;
-		if ( v577 == (Player *)-1 )
-		{
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2);  // No valid target exists!
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		v578 = (int)&pActors[(int)v577];
-		v721 = v578;
-		if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 )
+		case SPELL_LIGHT_DAY_OF_PROTECTION:
 		{
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		++pSpellSprite.uType;
-		pSpellSprite.stru_24.Reset();
-		pSpellSprite.spell_id = pCastSpell->spellnum;
-		pSpellSprite.spell_level = v2;
-		pSpellSprite.spell_skill = v731;
-		pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-		pSpellSprite.uAttributes = 0;
-		pSpellSprite.uSectorID = 0;
-		pSpellSprite.uSpriteFrameID = 0;
-		pSpellSprite.field_60_distance_related_prolly_lod = 0;
-		v581 = v721;
-		pSpellSprite.uFacing = 0;
-		pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
-		pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
-		pSpellSprite.vPosition.x = *(short *)(v721 + 142);
-		pSpellSprite.vPosition.y = *(short *)(v721 + 144);
-		v732 = *(short *)(v721 + 138);
-		pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
-		pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577);
-		pSpellSprite.Create(0, 0, 0, 0);
-		if ( *(char *)(v581 + 52) > amount )
-			break;
-		Actor::Resurrect((unsigned int)v577);
-		*(char *)(v581 + 61) = 0;
-		*(char *)(v581 + 53) = 0;
-		*(char *)(v581 + 54) = 0;
-		*(char *)(v581 + 55) = 0;
-		*(char *)(v581 + 56) = 0;
-		*(char *)(v581 + 57) = 0;
-		*(int *)(v581 + 712) = 9999;
-		*(char *)(v581 + 38) &= 0xF7u;
-		*(int *)(v581 + 708) = 0;
-		((SpellBuff *)(v581 + 356))->Reset();
-		((SpellBuff *)(v581 + 228))->Reset();
-		((SpellBuff *)(v581 + 404))->Reset();
-		if ( *(short *)(v581 + 40) > 10 * amount )
-			*(short *)(v581 + 40) = 10 * amount;
-			LODWORD(v727) = 1;
-			break;
-			}
-		case SPELL_DARK_VAMPIRIC_WEAPON:
-			{
-		v588 = v731 - 1;
-		amount = 16;
-		if ( v588 && (v589 = v588 - 1) != 0 && (v590 = v589 - 1) != 0 )
-		{
-			if ( v590 == 1 )
-			LODWORD(v733) = 0;
-		}
-		else
-		{
-			LODWORD(v733) = 3600 * v2;
-		}
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		__debugbreak();
-		HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040;
-		v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName;
-		((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed);
-		if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65
-			|| *(char *)(HIDWORD(v733) + 20) & 2
-			|| *(int *)(HIDWORD(v733) + 12) != 0
-			|| *(int *)(HIDWORD(v733) + 4) != 0
-			|| (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2
-			|| pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) )
-		{
-			dword_50C9D0 = 113;
-			dword_50C9D4 = 0;
-			dword_50C9D8 = 1;
-
-			ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
-			pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
-			pCastSpell->spellnum = 0;
-			continue;
-		}
-		v592 = HIDWORD(v733);
-		v14 = v731 == 4;
-		*(int *)(HIDWORD(v733) + 12) = 16;
-		if ( !v14 )
-		{
-			v732 = (int)v733 << 7;
-			*(_QWORD *)(v592 + 28) = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
-			*(int *)(v592 + 20) |= 8u;
-		}
-		*(char *)(v592 + 20) |= 0x80u;
-		_50C9A8_item_enchantment_timer = 256;
-		LODWORD(v727) = 1;
-		break;
-			}
-		case SPELL_DARK_SHARPMETAL:
-		{
-		v593 = v731 - 2;
-		if( v731 == 1 || v731 == 2 )
-			amount = 5;
-		else if( v731 == 3 )
-			amount = 7;
-		else if( v731 == 4 )
-			amount = 9;
-		if ( !pPlayer->CanCastSpell(uRequiredMana) )
-			break;
-		auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360);
-		pSpellSprite.stru_24.Reset();
-		pSpellSprite.spell_id = pCastSpell->spellnum;
-		pSpellSprite.spell_level = v2;
-		pSpellSprite.spell_skill = v731;
-		pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-		pSpellSprite.vPosition.x = pParty->vPosition.x;
-		pSpellSprite.vPosition.y = pParty->vPosition.y;
-		pSpellSprite.uAttributes = 0;
-		pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
-		pSpellSprite.uSectorID = pIndoor->GetSector(
-							pParty->vPosition.x,
-							pParty->vPosition.y,
-							pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2);
-		pSpellSprite.uSpriteFrameID = 0;
-		pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
-		pSpellSprite.spell_target_pid = a2;
-		pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
-		pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
-		if ( pParty->bTurnBasedModeOn == 1 )
-			LOBYTE(pSpellSprite.uAttributes) |= 4u;
-		v596 = (signed int)_v726 / -2;
-		y = (char *)((signed int)_v726 / 2);
-		if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 )
-		{
-			v597 = v715.uYawAngle;
-			do
-			{
-			pSpellSprite.uFacing = v596 + v597;
-			if ( pSpellSprite.Create(
-					v596 + v597,
-					v715.uPitchAngle,
-					pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
-					pCastSpell->uPlayerID + 1) != -1
-				&& pParty->bTurnBasedModeOn == 1 )
-				++pTurnEngine->field_1C;
-			v596 += _v726 / (amount - 1);
-			}
-			while ( v596 <= (signed int)y );
-		}
+			switch (v731)
+			{
+				case 1: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break;
+				case 2: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break;
+				case 3: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break;
+				case 4: LODWORD(v733) = 18000 * v2; amount = 5 * v2; break;
+				default:
+				assert(false);
+			}
+			v730 = LODWORD(v733);
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
+			pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
+
+			v732 = v730 << 7;
+			v549 = (double)(v730 << 7) * 0.033333335;
+			*((float *)&v733 + 1) = v549;
+			v712 = (signed __int64)v549;
+			pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0);
+			pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
+			pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
+			pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
+			pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
+			pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
+			v550 = v2 + 5;
+			pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(
+				(signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)),
+				v731,
+				v550, 0, 0);
+
+			pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0);
 			LODWORD(v727) = 1;
 			break;
 		}
-
-		case SPELL_DARK_CONTROL_UNDEAD:
+		case SPELL_LIGHT_HOUR_OF_POWER:
 		{
+			switch (v731)
+			{
+				case 1: LODWORD(v733) = 4; amount = 4; break;
+				case 2: LODWORD(v733) = 4; amount = 4; break;
+				case 3: LODWORD(v733) = 12; amount = 12; break;
+				case 4: LODWORD(v733) = 20; amount = 15; break;
+				default:
+				assert(false);
+			}
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
-			if ( v731 == 1 || v731 == 2 )
-			{
-				v598 = 180 * v2;
-				LODWORD(v733) = v598;
-			}
-			else if ( v731 == 3 )
-			{
-				v598 = 300 * v2;
-				LODWORD(v733) = v598;
-			}
-			else if ( v731 == 4 )
-				LODWORD(v733) = 29030400;
-//	LABEL_1082:
-			if (PID_TYPE(a2) != OBJECT_Actor)
-			{
-				LODWORD(v727) = 1;
-				break;
-			}
-			v730 = 836 * PID_ID(a2);
-			if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
-				break;
-			if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) )
+			y = (char *)(60 * (v2 * HIDWORD(v733) + 60));
+			v732 = (300 * amount * v2 + 60) << 7;
+			v730 = v2 + 5;
+			int _v726 = 0;
+			v553 = pParty->pPlayers;//[0].pConditions[1];
+			*((float *)&v733 + 1) = (double)v732 * 0.033333335;
+			do
+			{
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
+
+				//((SpellBuff *)(v553 + 6056))->Apply(
+				v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0);
+				if ( *(_QWORD *)v553 )
+					_v726 = 1;
+				++v553;
+			}
+			while ( v553 <= &pParty->pPlayers[3] );
+			v562 = v731;
+			pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0);
+			pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, 0, 0, 0);
+			pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, v730, 0, 0);
+			if (!_v726)
+			{
+				pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply((signed __int64)((double)(signed int)((int)y << 7) * 0.033333335 + (double)(signed __int64)pParty->uTimePlayed), v562, v730, 0, 0);
+			}
+			LODWORD(v727) = 1;
+			break;
+		}
+		case SPELL_LIGHT_DIVINE_INTERVENTION:
+		{
+			amount = 3;
+			if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u )
 			{
 				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
 				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
 				pCastSpell->spellnum = 0;
 				continue;
 			}
-			pActors[PID_ID(a2)].pActorBuffs[9].Reset();
-			pActors[PID_ID(a2)].pActorBuffs[1].Reset();
-			pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335),
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			a2 = 0;
+			_this = (ItemGen *)&pPlayers[1];
+			do
+			{
+				v563 = 0;
+				do
+				{
+					v564 = _this->uItemID;
+					*(int *)(v563 + _this->uItemID) = 0;
+					v563 += 8;
+					*(int *)(v563 + v564 - 4) = 0;
+				}
+				while ( v563 <= 128 );
+				v565 = ((Player *)_this->uItemID)->GetMaxHealth();
+				v566 = (Player **)_this;
+				*(int *)(_this->uItemID + 6460) = v565;
+				v567 = (*v566)->GetMaxMana();
+				*(int *)(_this->uItemID + 6464) = v567;
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
+				++a2;
+				_this = (ItemGen *)((char *)_this + 4);
+			}
+			while ( (signed int)this < (signed int)&qword_A750D8 );
+			v571 = pPlayer;
+			v572 = (char *)&pPlayer->sAgeModifier;
+			if ( pPlayer->sAgeModifier + 10 >= 120 )
+				*(short *)v572 = 120;
+			else
+				*(short *)v572 = pPlayer->sAgeModifier + 10;
+			sRecoveryTime += -5 * v2;
+			++v571->uNumDivineInterventionCastsThisDay;
+			LODWORD(v727) = 1;
+			break;
+		}
+		case SPELL_DARK_REANIMATE:
+		{
+			switch (v731)
+			{
+				case 1: amount = 2 * v2; break;
+				case 2: amount = 3 * v2; break;
+				case 3: amount = 4 * v2; break;
+				case 4: amount = 5 * v2; break;
+				default:
+				assert(false);
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			v576 = pCastSpell->spell_target_pid;
+			if (!v576)
+			{
+				v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2];
+				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
+				if ( *((_QWORD *)v585 + 14) )
+				{
+				((Player *)v585)->SetCondition(0x11u, 1);
+				v587 = ((Player *)v585)->GetSexByVoice();
+				ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23);
+				*((_QWORD *)v585 + 17) = pParty->uTimePlayed;
+				}
+				break;
+			}
+			v577 = (Player *)(PID_ID(v576));
+			//v726 = v577;
+			if ( v577 == (Player *)-1 )
+			{
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2);  // No valid target exists!
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				pCastSpell->spellnum = 0;
+				continue;
+			}
+			v578 = (int)&pActors[(int)v577];
+			v721 = v578;
+			if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 )
+			{
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				pCastSpell->spellnum = 0;
+				continue;
+			}
+			++pSpellSprite.uType;
+			pSpellSprite.stru_24.Reset();
+			pSpellSprite.spell_id = pCastSpell->spellnum;
+			pSpellSprite.spell_level = v2;
+			pSpellSprite.spell_skill = v731;
+			pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.uSectorID = 0;
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.field_60_distance_related_prolly_lod = 0;
+			v581 = v721;
+			pSpellSprite.uFacing = 0;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			pSpellSprite.vPosition.x = *(short *)(v721 + 142);
+			pSpellSprite.vPosition.y = *(short *)(v721 + 144);
+			v732 = *(short *)(v721 + 138);
+			pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
+			pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577);
+			pSpellSprite.Create(0, 0, 0, 0);
+			if ( *(char *)(v581 + 52) > amount )
+				break;
+			Actor::Resurrect((unsigned int)v577);
+			*(char *)(v581 + 61) = 0;
+			*(char *)(v581 + 53) = 0;
+			*(char *)(v581 + 54) = 0;
+			*(char *)(v581 + 55) = 0;
+			*(char *)(v581 + 56) = 0;
+			*(char *)(v581 + 57) = 0;
+			*(int *)(v581 + 712) = 9999;
+			*(char *)(v581 + 38) &= 0xF7u;
+			*(int *)(v581 + 708) = 0;
+			((SpellBuff *)(v581 + 356))->Reset();
+			((SpellBuff *)(v581 + 228))->Reset();
+			((SpellBuff *)(v581 + 404))->Reset();
+			if ( *(short *)(v581 + 40) > 10 * amount )
+				*(short *)(v581 + 40) = 10 * amount;
+			LODWORD(v727) = 1;
+			break;
+		}
+		case SPELL_DARK_VAMPIRIC_WEAPON:
+		{
+			amount = 16;
+			if ( v731 == 4 )
+			{
+				LODWORD(v733) = 0;
+			}
+			else
+			{
+				LODWORD(v733) = 3600 * v2;
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			__debugbreak();
+			HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040;
+			v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName;
+			((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed);
+			if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65
+				|| *(char *)(HIDWORD(v733) + 20) & 2
+				|| *(int *)(HIDWORD(v733) + 12) != 0
+				|| *(int *)(HIDWORD(v733) + 4) != 0
+				|| (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2
+				|| pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) )
+			{
+				dword_50C9D0 = 113;
+				dword_50C9D4 = 0;
+				dword_50C9D8 = 1;
+
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				pCastSpell->spellnum = 0;
+				continue;
+			}
+			v592 = HIDWORD(v733);
+			v14 = v731 == 4;
+			*(int *)(HIDWORD(v733) + 12) = 16;
+			if ( !v14 )
+			{
+				v732 = (int)v733 << 7;
+				*(_QWORD *)(v592 + 28) = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
+				*(int *)(v592 + 20) |= 8u;
+			}
+			*(char *)(v592 + 20) |= 0x80u;
+			_50C9A8_item_enchantment_timer = 256;
+			LODWORD(v727) = 1;
+			break;
+		}
+		case SPELL_DARK_SHARPMETAL:
+		{
+			switch (v731)
+			{
+				case 1: amount = 5; break;
+				case 2: amount = 5; break;
+				case 3: amount = 7; break;
+				case 4: amount = 9; break;
+				default:
+				assert(false);
+			}
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360);
+			pSpellSprite.stru_24.Reset();
+			pSpellSprite.spell_id = pCastSpell->spellnum;
+			pSpellSprite.spell_level = v2;
+			pSpellSprite.spell_skill = v731;
+			pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
+			pSpellSprite.vPosition.x = pParty->vPosition.x;
+			pSpellSprite.vPosition.y = pParty->vPosition.y;
+			pSpellSprite.uAttributes = 0;
+			pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
+			pSpellSprite.uSectorID = pIndoor->GetSector(
+								pParty->vPosition.x,
+								pParty->vPosition.y,
+								pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2);
+			pSpellSprite.uSpriteFrameID = 0;
+			pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
+			pSpellSprite.spell_target_pid = a2;
+			pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
+			pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
+			if ( pParty->bTurnBasedModeOn == 1 )
+				LOBYTE(pSpellSprite.uAttributes) |= 4u;
+			v596 = (signed int)_v726 / -2;
+			y = (char *)((signed int)_v726 / 2);
+			if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 )
+			{
+				v597 = v715.uYawAngle;
+				do
+				{
+					pSpellSprite.uFacing = v596 + v597;
+					if ( pSpellSprite.Create(
+							v596 + v597,
+							v715.uPitchAngle,
+							pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
+							pCastSpell->uPlayerID + 1) != -1
+							&& pParty->bTurnBasedModeOn == 1 )
+						++pTurnEngine->field_1C;
+					v596 += _v726 / (amount - 1);
+				}
+				while ( v596 <= (signed int)y );
+			}
+			LODWORD(v727) = 1;
+			break;
+		}
+		case SPELL_DARK_CONTROL_UNDEAD:
+		{
+			if ( !pPlayer->CanCastSpell(uRequiredMana) )
+				break;
+			switch (v731)
+			{
+				case 1: LODWORD(v733) = 180 * v2; break;
+				case 2: LODWORD(v733) = 180 * v2; break;
+				case 3: LODWORD(v733) = 300 * v2; break;
+				case 4: LODWORD(v733) = 29030400; break;
+				default:
+				assert(false);
+			}
+			if (PID_TYPE(a2) != OBJECT_Actor)
+			{
+				LODWORD(v727) = 1;
+				break;
+			}
+			pActor = &pActors[PID_ID(a2)];
+			if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
+				break;
+			if ( !stru_50C198.GetMagicalResistance(pActor, 0xAu) )
+			{
+				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
+				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
+				pCastSpell->spellnum = 0;
+				continue;
+			}
+			pActor->pActorBuffs[9].Reset();
+			pActor->pActorBuffs[1].Reset();
+			pActor->pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335),
 				v731, 0, 0, 0);
 			pSpellSprite.stru_24.Reset();
 			pSpellSprite.spell_id = pCastSpell->spellnum;
 			pSpellSprite.spell_level = v2;
 			pSpellSprite.spell_skill = v731;
 			v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-			v61 = PID_ID(a2);
-//	LABEL_1086:
-			v600 = pActors[v61].vPosition.y;
-			v601 = pActors[v61].vPosition.x;
+			
+			v600 = pActor->vPosition.y;
+			v601 = pActor->vPosition.x;
 			pSpellSprite.uObjectDescID = v60;
 			pSpellSprite.vPosition.x = v601;
-			v602 = pActors[v61].uActorHeight;
-			v603 = pActors[v61].vPosition.z;
+			v602 = pActor->uActorHeight;
+			v603 = pActor->vPosition.z;
 			pSpellSprite.vPosition.y = v600;
 			v676 = v603 + v602;
 			v665 = v600;
 			pSpellSprite.vPosition.z = v603 + v602;
 			v657 = v601;
-//	LABEL_1087:
 			pSpellSprite.uAttributes = 0;
 			pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676);
 			pSpellSprite.uSpriteFrameID = 0;
@@ -7190,38 +6659,38 @@
 			HIDWORD(v733) = 0;
 			memset(&achieved_awards, 0, 4000);
 			_this = 0;
-			v605 = (char *)pParty->pHirelings;
+			pNPCData = pParty->pHirelings;
 			do
 			{
-				if ( *(int *)v605)
+				if ( pNPCData->pName != 0)
 				{
 					v606 = HIDWORD(v733)++;
 					achieved_awards[v606] = (AwardType)(int)((char *)&_this->uItemID + 1);
 				}
 				_this = (ItemGen *)((char *)_this + 1);
-				v605 += 76;
-			}
-			while ( (signed int)v605 < (signed int)&pParty->pPickedItem );
+				++pNPCData;
+			}
+			while ( pNPCData <= &pParty->pHirelings[1] );
 			_this = 0;
 			if ( (signed int)pNPCStats->uNumNewNPCs > 0)
 			{
-				v730 = (int)pNPCStats->pNewNPCData;
+				pNPCData = pNPCStats->pNewNPCData;
 				__debugbreak(); // data offset
 				HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152;
 				do
 				{
-					if ( *(char *)(v730 + 8) & 0x80
-						&& (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName))
-						&& (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) )
+					if ( pNPCData->uFlags & 0x80
+						&& (!pParty->pHirelings[0].pName || strcmp(pNPCData->pName, pParty->pHirelings[0].pName))
+						&& (!pParty->pHirelings[1].pName || strcmp(pNPCData->pName, pParty->pHirelings[1].pName)) )
 					{
 						v607 = HIDWORD(v733);
 						HIDWORD(v733) += 4;
 						*(int *)v607 = (int)_this + 3;
 					}
 					_this = (ItemGen *)((char *)_this + 1);
-					v730 += 76;
+					++pNPCData;
 				}
-				while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs );
+				while ( (signed int)_this < (signed int)pNPCStats->uNumNewNPCs );
 			}
 			v608 = pCastSpell->uPlayerID_2;
 			if ( v608 != 4 && v608 != 5
@@ -7236,8 +6705,11 @@
 			v610 = 76 * v609;
 			*((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0;
 			v611 = pIconsFrameTable->FindIcon("spell96");
-			*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611);
-			*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1;
+			//*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611);
+			pParty->pHirelings[v609-1].evt_B = pIconsFrameTable->GetIconAnimLength(v611);
+			//*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1;
+			pParty->pHirelings[v609-1].field_24 = 1;
+
 			v612 = pParty->pPlayers;
 			do
 			{
@@ -7257,26 +6729,21 @@
 		}
 		case SPELL_DARK_PAIN_REFLECTION:
 		{
-			if ( v731 > 0 && v731 <= 4 )
-			{
-				if ( v731 <= 3 )
-				{
-					v614 = 300 * (v2 + 12);
-				}
-				if ( v731 == 4 )
-				{
-					v614 = 900 * (v2 + 4);
-				}
-				LODWORD(v733) = v614;
-			}
-			v615 = v2 + 5;
-			amount = v615;
+			switch (v731)
+			{
+				case 1: LODWORD(v733) = 300 * (v2 + 12); break;
+				case 2: LODWORD(v733) = 300 * (v2 + 12); break;
+				case 3: LODWORD(v733) = 300 * (v2 + 12); break;
+				case 4: LODWORD(v733) = 900 * (v2 + 4); break;
+				default:
+				assert(false);
+			}
+			amount = v2 + 5;
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
 			if ( v731 != 3 && v731 != 4 )
 			{
 				pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
-
 				pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v615, v716, 0);
 				LODWORD(v727) = 1;
 				break;
@@ -7373,14 +6840,13 @@
 
 					pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733));
 					HIDWORD(v733) = v635 + 1;
-					}
-					while ( v635 + 1 < v730 );
+				}
+				while ( v635 + 1 < v730 );
 			}
 			pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u);
 			LODWORD(v727) = 1;
 			break;
 		}
-
 		case SPELL_DARK_ARMAGEDDON:
 		{
 			if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
@@ -7390,8 +6856,9 @@
 				pCastSpell->spellnum = 0;
 				continue;
 			}
-			v640 = v731 - 2;
-			if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) )
+			if ( v731 == 4)
+				amount = 4;
+			else
 				amount = 3;
 			if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 )
 			{