comparison 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
comparison
equal deleted inserted replaced
1008:446175a32a15 1009:a32318b557c7
2408 } 2408 }
2409 2409
2410 //----- (00427E01) -------------------------------------------------------- 2410 //----- (00427E01) --------------------------------------------------------
2411 void CastSpellInfo::_427E01_cast_spell() 2411 void CastSpellInfo::_427E01_cast_spell()
2412 { 2412 {
2413 //int v1; // esi@1
2414 int v2; // edi@1 2413 int v2; // edi@1
2415 CastSpellInfo *pCastSpell; // ebx@2 2414 CastSpellInfo *pCastSpell; // ebx@2
2416 //signed int v4; // eax@8
2417 //__int16 v5; // ax@9
2418 signed int v6; // eax@14 2415 signed int v6; // eax@14
2419 //__int16 v7; // ax@23
2420 //__int16 v8; // ax@24
2421 //char v9; // al@44
2422 //int v10; // eax@45
2423 unsigned __int16 v11; // cx@45 2416 unsigned __int16 v11; // cx@45
2424 //signed int v12; // ecx@48
2425 //int v13; // eax@53
2426 unsigned __int8 v14; // zf@53 2417 unsigned __int8 v14; // zf@53
2427 //unsigned int v15; // edx@53
2428 //signed int v16; // eax@53
2429 //Player *v17; // esi@70
2430 //int v18; // eax@72
2431 //int v19; // eax@74
2432 Player *v20; // eax@74
2433 signed int i; // esi@76 2418 signed int i; // esi@76
2434 //int v22; // eax@88
2435 __int16 v23; // ax@88 2419 __int16 v23; // ax@88
2436 //int v24; // ecx@93
2437 //int v25; // ecx@94
2438 //signed __int64 v26; // qax@100
2439 //char *v27; // ecx@100
2440 //unsigned __int64 v28; // qax@102
2441 int v29; // ecx@105
2442 int v30; // ecx@106
2443 //int v31; // eax@112
2444 //int v32; // eax@112
2445 //char *v33; // edx@113
2446 //int v34; // eax@121
2447 //int v35; // eax@123
2448 //int v36; // edx@125
2449 //int v37; // eax@129
2450 //signed int v38; // edi@129
2451 //signed int v39; // eax@129
2452 //int v40; // ecx@129
2453 //int v41; // eax@129
2454 //signed int v42; // eax@129
2455 //int *v43; // ecx@129
2456 //int v44; // eax@132
2457 //int v45; // ecx@132
2458 int v46; // eax@132
2459 //unsigned int v47; // edx@133
2460 //int v48; // eax@137
2461 //int v49; // eax@137
2462 //int v50; // eax@141
2463 int v51; // eax@146 2420 int v51; // eax@146
2464 __int16 v52; // ax@153 2421 __int16 v52; // ax@153
2465 //int v53; // eax@153
2466 signed __int64 v54; // qax@164 2422 signed __int64 v54; // qax@164
2467 Actor *v55; // edi@164 2423 Actor *v55; // edi@164
2468 //stru6 *v56; // eax@165
2469 int v57; // eax@169
2470 signed __int64 v58; // qax@177 2424 signed __int64 v58; // qax@177
2471 Actor *pActor; // edi@177 2425 Actor *pActor; // edi@177
2472 unsigned __int16 v60; // ax@184 2426 unsigned __int16 v60; // ax@184
2473 int v61; // ecx@184 2427 int v61; // ecx@184
2474 //int v62; // eax@186
2475 int v63; // ecx@187
2476 int v64; // ecx@188
2477 int v65; // ecx@189 2428 int v65; // ecx@189
2478 //const char *v66; // ecx@200
2479 //unsigned int v67; // edx@201
2480 char v68; // al@207
2481 ItemGen *v69; // esi@211 2429 ItemGen *v69; // esi@211
2482 int v70; // ecx@214 2430 int v70; // ecx@214
2483 int v71; // ecx@215 2431 int v71; // ecx@215
2484 int v72; // ecx@216
2485 //__int16 v73; // ST1C_2@222
2486 //__int16 v74; // ST18_2@222
2487 //stru6 *v75; // eax@222
2488 //int v76; // ecx@223
2489 //int v77; // ecx@224
2490 //int v78; // ecx@225
2491 //int v79; // eax@227
2492 //int v80; // eax@232
2493 //__int16 v81; // ST18_2@245
2494 //stru6 *v82; // eax@245
2495 //signed int v83; // edi@245
2496 //__int16 v84; // ST18_2@245
2497 //stru6 *v85; // eax@245
2498 //__int16 v86; // ST18_2@245
2499 //stru6 *v87; // eax@245
2500 //__int16 v88; // ST18_2@245
2501 //stru6 *v89; // eax@245
2502 double v90; // st7@245 2432 double v90; // st7@245
2503 //int v91; // eax@250
2504 Player *v92; // eax@255 2433 Player *v92; // eax@255
2505 //__int16 v93; // ST18_2@260
2506 //stru6 *v94; // eax@260
2507 //__int16 v95; // ST18_2@260
2508 //stru6 *v96; // eax@260
2509 //__int16 v97; // ST18_2@260
2510 //stru6 *v98; // eax@260
2511 //__int16 v99; // ST18_2@260
2512 //stru6 *v100; // eax@260
2513 //int v101; // ecx@261
2514 //int v102; // ecx@262
2515 //int v103; // ecx@263
2516 //int v104; // eax@265
2517 int v105; // edi@271 2434 int v105; // edi@271
2518 //__int16 v106; // ST18_2@272
2519 //stru6 *v107; // eax@272
2520 __int16 v108; // ST1C_2@274 2435 __int16 v108; // ST1C_2@274
2521 __int16 v109; // ST18_2@274 2436 __int16 v109; // ST18_2@274
2522 stru6 *v110; // eax@274 2437 stru6 *v110; // eax@274
2523 int v111; // eax@274 2438 int v111; // eax@274
2524 Actor *v112; // esi@278 2439 Actor *v112; // esi@278
2527 unsigned int v115; // ecx@278 2442 unsigned int v115; // ecx@278
2528 int v116; // edx@279 2443 int v116; // edx@279
2529 int v117; // edx@281 2444 int v117; // edx@281
2530 int v118; // edx@283 2445 int v118; // edx@283
2531 int v119; // edi@286 2446 int v119; // edi@286
2532 //int v120; // eax@286
2533 //int v121; // eax@286
2534 signed int v122; // eax@286 2447 signed int v122; // eax@286
2535 //int v123; // ecx@288
2536 //int v124; // ecx@289
2537 //int v125; // ecx@290
2538 //int v126; // eax@292
2539 int v127; // eax@296 2448 int v127; // eax@296
2540 //__int16 v128; // ST18_2@303
2541 //stru6 *v129; // eax@303
2542 //__int16 v130; // ST18_2@303
2543 //stru6 *v131; // eax@303
2544 //__int16 v132; // ST18_2@303
2545 //stru6 *v133; // eax@303
2546 //__int16 v134; // ST18_2@303
2547 //stru6 *v135; // eax@303
2548 //unsigned __int64 v136; // qax@304
2549 //char *v137; // ecx@304
2550 //int v138; // ecx@305
2551 int v139; // ecx@306 2449 int v139; // ecx@306
2552 //int v140; // eax@308
2553 //__int16 v141; // ST18_2@311
2554 //stru6 *v142; // eax@311
2555 //__int16 v143; // ST18_2@311
2556 //stru6 *v144; // eax@311
2557 //__int16 v145; // ST18_2@311
2558 //stru6 *v146; // eax@311
2559 //__int16 v147; // ST18_2@311
2560 //stru6 *v148; // eax@311
2561 int v149; // ecx@312
2562 int v150; // ecx@313
2563 int v151; // ecx@314 2450 int v151; // ecx@314
2564 //signed int v152; // eax@322
2565 int v153; // ecx@322 2451 int v153; // ecx@322
2566 int v154; // eax@322 2452 int v154; // eax@322
2567 int v155; // eax@323 2453 int v155; // eax@323
2568 int v156; // eax@323 2454 int v156; // eax@323
2569 //int v157; // eax@326
2570 double v158; // st7@326 2455 double v158; // st7@326
2571 double v159; // st6@326 2456 double v159; // st6@326
2572 //signed __int64 v160; // qtt@334
2573 //int v161; // eax@339
2574 int v162; // edi@340 2457 int v162; // edi@340
2575 //int v163; // eax@340
2576 signed int v164; // eax@340 2458 signed int v164; // eax@340
2577 signed int v165; // edi@340 2459 signed int v165; // edi@340
2578 //stru6 *v166; // eax@340
2579 //stru6 *v167; // eax@340
2580 signed int v168; // edi@343 2460 signed int v168; // edi@343
2581 int v169; // eax@344 2461 int v169; // eax@344
2582 //int v170; // ecx@346
2583 //int v171; // ecx@347
2584 //int v172; // ecx@348
2585 //int v173; // edi@350
2586 signed int v174; // edi@355 2462 signed int v174; // edi@355
2587 //__int16 v175; // ST18_2@357
2588 //stru6 *v176; // eax@357
2589 //__int16 v177; // ST18_2@357
2590 //stru6 *v178; // eax@357
2591 //__int16 v179; // ST18_2@357
2592 //stru6 *v180; // eax@357
2593 //__int16 v181; // ST18_2@357
2594 //stru6 *v182; // eax@357
2595 //signed __int64 v183; // qax@357
2596 int v184; // ecx@358
2597 int v185; // ecx@359
2598 int v186; // ecx@360
2599 //int v187; // eax@367
2600 int v188; // esi@369 2463 int v188; // esi@369
2601 int v189; // edi@369 2464 int v189; // edi@369
2602 //const char *v190; // ecx@377
2603 signed int v191; // edi@379 2465 signed int v191; // edi@379
2604 int v192; // ecx@382
2605 //int v193; // ecx@383
2606 //int v194; // ecx@384
2607 int v195; // eax@386
2608 int v196; // eax@387
2609 //__int16 v197; // ST18_2@395
2610 //stru6 *v198; // eax@395
2611 //__int16 v199; // ST18_2@395
2612 //stru6 *v200; // eax@395
2613 //__int16 v201; // ST18_2@395
2614 //stru6 *v202; // eax@395
2615 //__int16 v203; // ST18_2@395
2616 //stru6 *v204; // eax@395
2617 signed int v205; // edi@405 2466 signed int v205; // edi@405
2618 int v206; // eax@407 2467 int v206; // eax@407
2619 __int16 v207; // cx@407 2468 __int16 v207; // cx@407
2620 int v208; // eax@411 2469 int v208; // eax@411
2621 signed int v209; // ecx@412 2470 signed int v209; // ecx@412
2626 int v214; // eax@413 2475 int v214; // eax@413
2627 int v215; // eax@415 2476 int v215; // eax@415
2628 double v216; // st7@415 2477 double v216; // st7@415
2629 double v217; // st6@415 2478 double v217; // st6@415
2630 signed __int64 v218; // qtt@423 2479 signed __int64 v218; // qtt@423
2631 //int v219; // ecx@425
2632 //int v220; // ecx@426
2633 //int v221; // edi@428
2634 Player *v222; // edi@434 2480 Player *v222; // edi@434
2635 char v223; // al@438 2481 char v223; // al@438
2636 //int v224; // ecx@442 2482
2637 //int v225; // ecx@443
2638 //int v226; // eax@451
2639 int v227; // esi@453 2483 int v227; // esi@453
2640 unsigned int v228; // edi@454 2484 unsigned int v228; // edi@454
2641 int v229; // edi@466 2485 int v229; // edi@466
2642 //__int16 v230; // ST18_2@469 2486
2643 //stru6 *v231; // eax@469
2644 //signed int v232; // esi@469
2645 //__int16 v233; // ST18_2@469
2646 //stru6 *v234; // eax@469
2647 //__int16 v235; // ST18_2@469
2648 //stru6 *v236; // eax@469
2649 //__int16 v237; // ST18_2@469
2650 //stru6 *v238; // eax@469
2651 //__int16 v239; // ST1C_2@469
2652 char *v240; // ecx@472 2487 char *v240; // ecx@472
2653 double v241; // st7@478 2488 double v241; // st7@478
2654 signed __int64 v242; // qax@484 2489 signed __int64 v242; // qax@484
2655 char *v243; // ecx@484 2490 char *v243; // ecx@484
2656 char *v244; // eax@488 2491 char *v244; // eax@488
2680 int v268; // eax@524 2515 int v268; // eax@524
2681 int v269; // eax@526 2516 int v269; // eax@526
2682 char *v270; // eax@531 2517 char *v270; // eax@531
2683 char v271; // al@531 2518 char v271; // al@531
2684 char v272; // cf@534 2519 char v272; // cf@534
2685 //float v273; // esi@541
2686 char v274; // al@541 2520 char v274; // al@541
2687 int v275; // edx@544 2521 int v275; // edx@544
2688 int k; // esi@544 2522 int k; // esi@544
2689 int v277; // edx@548 2523 int v277; // edx@548
2690 int v278; // ecx@548 2524 int v278; // ecx@548
2727 int j; // esi@607 2561 int j; // esi@607
2728 unsigned int v316; // eax@613 2562 unsigned int v316; // eax@613
2729 const char *v317; // ecx@617 2563 const char *v317; // ecx@617
2730 Player *v318; // ecx@619 2564 Player *v318; // ecx@619
2731 unsigned int v319; // edi@627 2565 unsigned int v319; // edi@627
2732 //int v320; // ecx@629
2733 //int v321; // ecx@630
2734 //int v322; // edi@632
2735 int v323; // edi@635 2566 int v323; // edi@635
2736 char *v324; // eax@635 2567 char *v324; // eax@635
2737 Player *v325; // ecx@640 2568 Player *v325; // ecx@640
2738 //int v326; // eax@643
2739 //int v327; // eax@648
2740 int v328; // ecx@651 2569 int v328; // ecx@651
2741 int v329; // ecx@652 2570 int v329; // ecx@652
2742 int v330; // edi@654 2571 int v330; // edi@654
2743 //__int16 v331; // ST18_2@658
2744 //stru6 *v332; // eax@658
2745 //__int16 v333; // ST18_2@658
2746 //stru6 *v334; // eax@658
2747 //__int16 v335; // ST18_2@658
2748 //stru6 *v336; // eax@658
2749 //__int16 v337; // ST18_2@658
2750 //stru6 *v338; // eax@658
2751 //int v339; // ecx@659
2752 //int v340; // ecx@660
2753 //int v341; // eax@663
2754 signed int v342; // edi@668 2572 signed int v342; // edi@668
2755 signed int v343; // edi@670 2573 signed int v343; // edi@670
2756 unsigned __int64 v344; // ST08_8@670 2574 unsigned __int64 v344; // ST08_8@670
2757 //__int16 v345; // ST1C_2@671
2758 //__int16 v346; // ST18_2@671
2759 //stru6 *v347; // eax@671
2760 //int v348; // ecx@672
2761 //int v349; // ecx@673
2762 //int v350; // edi@676
2763 Player *v351; // edi@680 2575 Player *v351; // edi@680
2764 //__int16 v352; // ST18_2@685
2765 //stru6 *v353; // eax@685
2766 int v354; // ecx@686
2767 int v355; // ecx@687
2768 int v356; // eax@689
2769 Player *v357; // edi@694 2576 Player *v357; // edi@694
2770 //unsigned __int16 v358; // ST1C_2@695
2771 //__int16 v359; // ST18_2@695
2772 //stru6 *v360; // eax@695
2773 //__int16 v361; // ST1C_2@697
2774 //__int16 v362; // ST18_2@697
2775 //stru6 *v363; // eax@697
2776 int v364; // ecx@698
2777 int v365; // ecx@699
2778 int v366; // eax@701
2779 //stru6 *v367; // eax@704
2780 //int v368; // eax@704
2781 Actor *v369; // edi@705 2577 Actor *v369; // edi@705
2782 //int v370; // eax@706
2783 int v371; // ecx@709
2784 int v372; // ecx@710
2785 int v373; // eax@715 2578 int v373; // eax@715
2786 int v374; // eax@717 2579 int v374; // eax@717
2787 //Player *v375; // edi@717
2788 int v376; // eax@717 2580 int v376; // eax@717
2789 Player *v377; // ecx@719 2581 Player *v377; // ecx@719
2790 int v378; // ecx@721
2791 int v379; // ecx@722
2792 int v380; // eax@724
2793 int v381; // edi@727 2582 int v381; // edi@727
2794 int v382; // ecx@727 2583 int v382; // ecx@727
2795 Player *v383; // eax@728 2584 Player *v383; // eax@728
2796 int v384; // eax@733 2585 int v384; // eax@733
2797 //int v385; // edi@736
2798 //signed int v386; // eax@736
2799 //Player *v387; // edi@738
2800 int v388; // edi@740 2586 int v388; // edi@740
2801 //unsigned __int16 v389; // ST1C_2@740
2802 //__int16 v390; // ST18_2@740
2803 //stru6 *v391; // eax@740
2804 int v392; // ecx@742
2805 //int v393; // ecx@743
2806 //int v394; // ecx@744
2807 //int v395; // edi@747
2808 int v396; // eax@752 2587 int v396; // eax@752
2809 int v397; // eax@757 2588 int v397; // eax@757
2810 int v398; // eax@757 2589 int v398; // eax@757
2811 int v399; // eax@757 2590 int v399; // eax@757
2812 //char *v400; // esi@757
2813 //Game *v401; // ecx@759
2814 //__int16 v402; // ST1C_2@759
2815 //__int16 v403; // ST18_2@759
2816 //stru6 *v404; // eax@759
2817 //int v405; // ecx@761
2818 //int v406; // ecx@762
2819 //int v407; // edi@765
2820 //__int16 v408; // ST1C_2@769
2821 //__int16 v409; // ST18_2@769
2822 //stru6 *v410; // eax@769
2823 //int v411; // ecx@772
2824 //int v412; // ecx@773
2825 //int v413; // edi@775
2826 //__int16 v414; // ST1C_2@781
2827 //__int16 v415; // ST18_2@781
2828 //stru6 *v416; // eax@781
2829 int v417; // eax@787 2591 int v417; // eax@787
2830 int v418; // ecx@789 2592 int v418; // ecx@789
2831 __int16 v419; // ax@791 2593 __int16 v419; // ax@791
2832 signed int v420; // eax@793 2594 signed int v420; // eax@793
2833 int v421; // edx@793 2595 int v421; // edx@793
2834 const char *v422; // eax@801 2596 const char *v422; // eax@801
2835 int v423; // ecx@808
2836 int v424; // ecx@809
2837 int v425; // eax@811
2838 signed int v426; // eax@815 2597 signed int v426; // eax@815
2839 //signed int v427; // eax@820
2840 int v428; // ecx@825
2841 int v429; // ecx@826
2842 int v430; // eax@828
2843 //stru6 *v431; // eax@831
2844 //int v432; // eax@831
2845 Actor *v433; // edi@832 2598 Actor *v433; // edi@832
2846 //int v434; // eax@833
2847 int v435; // ecx@837 2599 int v435; // ecx@837
2848 int v436; // ecx@838
2849 //__int16 v437; // ST1C_2@843
2850 //__int16 v438; // ST18_2@843
2851 //stru6 *v439; // eax@843
2852 int v440; // eax@843 2600 int v440; // eax@843
2853 int v441; // eax@847 2601 int v441; // eax@847
2854 //int v442; // ecx@850
2855 //int v443; // ecx@851
2856 //int v444; // eax@853
2857 signed int v445; // edi@857 2602 signed int v445; // edi@857
2858 int v446; // ecx@862 2603 int v446; // ecx@862
2859 LevelDecoration *v447; // edi@864 2604 LevelDecoration *v447; // edi@864
2860 __int16 v448; // ax@864 2605 __int16 v448; // ax@864
2861 char *v449; // esi@870 2606 char *v449; // esi@870
2862 int v450; // eax@870 2607 int v450; // eax@870
2863 //int v451; // ecx@875
2864 //int v452; // ecx@876
2865 //int v453; // edi@878
2866 //__int16 v454; // ST1C_2@884
2867 //__int16 v455; // ST18_2@884
2868 //stru6 *v456; // eax@884
2869 int v457; // ecx@887
2870 int v458; // ecx@888
2871 int v459; // eax@890
2872 signed int v460; // eax@895 2608 signed int v460; // eax@895
2873 Actor *v461; // eax@897 2609 Actor *v461; // eax@897
2874 unsigned __int16 v462; // cx@897 2610 unsigned __int16 v462; // cx@897
2875 signed int v463; // edx@897 2611 signed int v463; // edx@897
2876 //int v464; // ecx@905
2877 //int v465; // ecx@906
2878 //int v466; // edi@909
2879 //__int16 v467; // ST1C_2@913
2880 //__int16 v468; // ST18_2@913
2881 //stru6 *v469; // eax@913
2882 int v470; // edi@913 2612 int v470; // edi@913
2883 int v471; // eax@917 2613 int v471; // eax@917
2884 int v472; // eax@917 2614 int v472; // eax@917
2885 //char *v473; // esi@918
2886 //__int16 v474; // ST18_2@920
2887 //stru6 *v475; // eax@920
2888 //__int16 v476; // ST18_2@920
2889 //stru6 *v477; // eax@920
2890 //__int16 v478; // ST18_2@920
2891 //stru6 *v479; // eax@920
2892 //__int16 v480; // ST18_2@920
2893 //stru6 *v481; // eax@920
2894 //__int16 v482; // ST18_2@923
2895 //stru6 *v483; // eax@923
2896 //__int16 v484; // ST18_2@923
2897 //stru6 *v485; // eax@923
2898 //__int16 v486; // ST18_2@923
2899 //stru6 *v487; // eax@923
2900 //__int16 v488; // ST18_2@923
2901 //stru6 *v489; // eax@923
2902 //__int16 v490; // ST1C_2@924
2903 //__int16 v491; // ST18_2@924
2904 //stru6 *v492; // eax@924
2905 int v493; // ecx@925
2906 int v494; // ecx@926
2907 //__int16 v495; // ST1C_2@931
2908 //__int16 v496; // ST18_2@931
2909 //stru6 *v497; // eax@931
2910 int v498; // edi@931 2615 int v498; // edi@931
2911 int v499; // eax@935 2616 int v499; // eax@935
2912 int v500; // eax@935 2617 int v500; // eax@935
2913 Player *v501; // edi@939 2618 Player *v501; // edi@939
2914 //__int16 v502; // ST18_2@940
2915 //stru6 *v503; // eax@940
2916 //stru6 *v504; // eax@943
2917 int v505; // eax@943 2619 int v505; // eax@943
2918 //int v506; // eax@943
2919 int v507; // edi@944 2620 int v507; // edi@944
2920 //int v508; // eax@944
2921 signed int v509; // eax@944 2621 signed int v509; // eax@944
2922 signed int v510; // edi@944 2622 signed int v510; // edi@944
2923 Actor *v511; // edi@946 2623 Actor *v511; // edi@946
2924 //int v512; // eax@946
2925 SpellBuff *v513; // edi@946 2624 SpellBuff *v513; // edi@946
2926 int v514; // ecx@950
2927 //int v515; // ecx@951
2928 int v516; // eax@953
2929 //int v517; // eax@956
2930 Actor *v518; // edx@957 2625 Actor *v518; // edx@957
2931 __int16 v519; // cx@958 2626 __int16 v519; // cx@958
2932 //int v520; // ecx@968
2933 //int v521; // ecx@969
2934 //int v522; // eax@971
2935 //__int16 v523; // ST18_2@975
2936 //stru6 *v524; // eax@975
2937 //__int16 v525; // ST18_2@975
2938 //stru6 *v526; // eax@975
2939 //__int16 v527; // ST18_2@975
2940 //stru6 *v528; // eax@975
2941 //__int16 v529; // ST18_2@975
2942 //stru6 *v530; // eax@975
2943 int v531; // eax@982 2627 int v531; // eax@982
2944 //int v532; // eax@982
2945 int v533; // edi@983 2628 int v533; // edi@983
2946 //int v534; // eax@983
2947 signed int v535; // eax@983 2629 signed int v535; // eax@983
2948 signed int v536; // edi@983 2630 signed int v536; // edi@983
2949 stru6 *v537; // eax@984 2631 stru6 *v537; // eax@984
2950 int v538; // ecx@985
2951 int v539; // ecx@986
2952 int v540; // eax@988
2953 //__int16 v541; // ST18_2@991
2954 //stru6 *v542; // eax@991
2955 //__int16 v543; // ST18_2@991
2956 //stru6 *v544; // eax@991
2957 //__int16 v545; // ST18_2@991
2958 //stru6 *v546; // eax@991
2959 //__int16 v547; // ST18_2@991
2960 //stru6 *v548; // eax@991
2961 double v549; // st7@991 2632 double v549; // st7@991
2962 unsigned __int16 v550; // di@991 2633 unsigned __int16 v550; // di@991
2963 int v551; // ecx@993
2964 //int v552; // ecx@994
2965 Player *v553; // edi@1001 2634 Player *v553; // edi@1001
2966 //__int16 v554; // ST18_2@1002
2967 //stru6 *v555; // eax@1002
2968 //__int16 v556; // ST18_2@1002
2969 //stru6 *v557; // eax@1002
2970 //__int16 v558; // ST18_2@1002
2971 //stru6 *v559; // eax@1002
2972 //__int16 v560; // ST18_2@1002
2973 //stru6 *v561; // eax@1002
2974 unsigned __int16 v562; // di@1005 2635 unsigned __int16 v562; // di@1005
2975 signed int v563; // eax@1010 2636 signed int v563; // eax@1010
2976 unsigned int v564; // ecx@1011 2637 unsigned int v564; // ecx@1011
2977 signed int v565; // eax@1012 2638 signed int v565; // eax@1012
2978 Player **v566; // ecx@1012 2639 Player **v566; // ecx@1012
2979 int v567; // eax@1012 2640 int v567; // eax@1012
2980 //unsigned __int16 v568; // ST1C_2@1012
2981 //__int16 v569; // ST18_2@1012
2982 //stru6 *v570; // eax@1012
2983 Player *v571; // eax@1013 2641 Player *v571; // eax@1013
2984 char *v572; // ecx@1013 2642 char *v572; // ecx@1013
2985 int v573; // ecx@1017
2986 int v574; // ecx@1018
2987 int v575; // eax@1020
2988 signed int v576; // eax@1025 2643 signed int v576; // eax@1025
2989 Player *v577; // eax@1026 2644 Player *v577; // eax@1026
2990 int v578; // eax@1028 2645 int v578; // eax@1028
2991 __int16 v579; // ax@1029 2646 __int16 v579; // ax@1029
2992 //int v580; // eax@1031
2993 int v581; // edi@1031 2647 int v581; // edi@1031
2994 //int v582; // eax@1031
2995 //__int16 v583; // ST1C_2@1034
2996 //__int16 v584; // ST18_2@1034
2997 char *v585; // esi@1034 2648 char *v585; // esi@1034
2998 //stru6 *v586; // eax@1034
2999 signed int v587; // eax@1035 2649 signed int v587; // eax@1035
3000 int v588; // ecx@1036
3001 int v589; // ecx@1037
3002 int v590; // ecx@1038
3003 char v591; // al@1048 2650 char v591; // al@1048
3004 int v592; // esi@1052 2651 int v592; // esi@1052
3005 int v593; // ecx@1057
3006 //int v594; // ecx@1058
3007 //int v595; // eax@1064
3008 int v596; // esi@1066 2652 int v596; // esi@1066
3009 unsigned int v597; // edi@1067 2653 unsigned int v597; // edi@1067
3010 int v598; // eax@1079
3011 //signed int v599; // eax@1082
3012 int v600; // edi@1086 2654 int v600; // edi@1086
3013 int v601; // edx@1086 2655 int v601; // edx@1086
3014 int v602; // eax@1086 2656 int v602; // eax@1086
3015 int v603; // ecx@1086 2657 int v603; // ecx@1086
3016 //int v604; // eax@1087 2658 NPCData *pNPCData; // eax@1089
3017 char *v605; // eax@1089
3018 int v606; // edx@1091 2659 int v606; // edx@1091
3019 int v607; // ecx@1100 2660 int v607; // ecx@1100
3020 __int16 v608; // ax@1102 2661 __int16 v608; // ax@1102
3021 signed int v609; // eax@1104 2662 signed int v609; // eax@1104
3022 int v610; // edi@1106 2663 int v610; // edi@1106
3023 unsigned int v611; // eax@1106 2664 unsigned int v611; // eax@1106
3024 Player *v612; // edi@1106 2665 Player *v612; // edi@1106
3025 DDM_DLV_Header *v613; // eax@1108 2666 DDM_DLV_Header *v613; // eax@1108
3026 int v614; // eax@1116
3027 int v615; // edi@1119 2667 int v615; // edi@1119
3028 //__int16 v616; // ST1C_2@1122
3029 //__int16 v617; // ST18_2@1122
3030 //stru6 *v618; // eax@1122
3031 Player *v619; // edi@1123 2668 Player *v619; // edi@1123
3032 //unsigned __int16 v620; // ST1C_2@1124
3033 //__int16 v621; // ST18_2@1124
3034 //stru6 *v622; // eax@1124
3035 signed __int64 v623; // qax@1127 2669 signed __int64 v623; // qax@1127
3036 //int v624; // eax@1127
3037 int v625; // edi@1129 2670 int v625; // edi@1129
3038 //int v626; // eax@1129
3039 signed int v627; // eax@1129 2671 signed int v627; // eax@1129
3040 signed int v628; // edi@1129 2672 signed int v628; // edi@1129
3041 int v629; // ecx@1130 2673 int v629; // ecx@1130
3042 Player *v630; // eax@1131 2674 Player *v630; // eax@1131
3043 int v631; // eax@1137 2675 int v631; // eax@1137
3044 //int v632; // edi@1140
3045 //Player *v633; // eax@1140
3046 //signed int v634; // eax@1140
3047 int v635; // edi@1142 2676 int v635; // edi@1142
3048 //unsigned __int16 v636; // ST1C_2@1142
3049 //__int16 v637; // ST18_2@1142
3050 //stru6 *v638; // eax@1142
3051 //stru6 *v639; // eax@1143
3052 int v640; // ecx@1146
3053 int v641; // ecx@1147
3054 int v642; // edi@1156 2677 int v642; // edi@1156
3055 int v643; // eax@1156 2678 int v643; // eax@1156
3056 int v644; // eax@1156 2679 int v644; // eax@1156
3057 signed int v645; // eax@1158 2680 signed int v645; // eax@1158
3058 //Player *v646; // ebx@1169
3059 //int v647; // edi@1169
3060 //signed int v648; // ST1C_4@1170
3061 //Player *v649; // ecx@1170
3062 //unsigned __int64 v650; // [sp-10h] [bp-E94h]@103
3063 //unsigned __int16 v651; // [sp-8h] [bp-E8Ch]@100
3064 //unsigned __int16 v652; // [sp-8h] [bp-E8Ch]@304
3065 //unsigned __int16 v653; // [sp-4h] [bp-E88h]@100
3066 //int v654; // [sp-4h] [bp-E88h]@124
3067 //unsigned __int16 v655; // [sp-4h] [bp-E88h]@304
3068 unsigned int v656; // [sp-4h] [bp-E88h]@639 2681 unsigned int v656; // [sp-4h] [bp-E88h]@639
3069 int v657; // [sp-4h] [bp-E88h]@807 2682 int v657; // [sp-4h] [bp-E88h]@807
3070 //int v658; // [sp+0h] [bp-E84h]@100
3071 int v659; // [sp+0h] [bp-E84h]@123 2683 int v659; // [sp+0h] [bp-E84h]@123
3072 int v660; // [sp+0h] [bp-E84h]@146 2684 int v660; // [sp+0h] [bp-E84h]@146
3073 Actor *v661; // [sp+0h] [bp-E84h]@164 2685 Actor *v661; // [sp+0h] [bp-E84h]@164
3074 //int v662; // [sp+0h] [bp-E84h]@304
3075 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639 2686 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639
3076 const char *v664; // [sp+0h] [bp-E84h]@802 2687 const char *v664; // [sp+0h] [bp-E84h]@802
3077 int v665; // [sp+0h] [bp-E84h]@807 2688 int v665; // [sp+0h] [bp-E84h]@807
3078 int v666; // [sp+4h] [bp-E80h]@12 2689 int v666; // [sp+4h] [bp-E80h]@12
3079 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 2690 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25
3080 //unsigned __int8 v668; // [sp+4h] [bp-E80h]@100
3081 //int v669; // [sp+4h] [bp-E80h]@123
3082 //Vec3_int_ *v670; // [sp+4h] [bp-E80h]@133
3083 int v671; // [sp+4h] [bp-E80h]@146 2691 int v671; // [sp+4h] [bp-E80h]@146
3084 //unsigned int v672; // [sp+4h] [bp-E80h]@164
3085 //unsigned __int8 v673; // [sp+4h] [bp-E80h]@304
3086 //__int16 v674; // [sp+4h] [bp-E80h]@684
3087 const char *v675; // [sp+4h] [bp-E80h]@800 2692 const char *v675; // [sp+4h] [bp-E80h]@800
3088 int v676; // [sp+4h] [bp-E80h]@807 2693 int v676; // [sp+4h] [bp-E80h]@807
3089 int v677; // [sp+4h] [bp-E80h]@861 2694 int v677; // [sp+4h] [bp-E80h]@861
3090 //int v678; // [sp+4h] [bp-E80h]@997
3091 int v679; // [sp+14h] [bp-E70h]@515 2695 int v679; // [sp+14h] [bp-E70h]@515
3092 AIDirection a3; // [sp+C94h] [bp-1F0h]@21 2696 AIDirection a3; // [sp+C94h] [bp-1F0h]@21
3093 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 2697 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137
3094 int v682[4]; // [sp+CC0h] [bp-1C4h]@731 2698 int v682[4]; // [sp+CC0h] [bp-1C4h]@731
3095 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 2699 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791
3096 int v684; // [sp+D04h] [bp-180h]@416 2700 int v684; // [sp+D04h] [bp-180h]@416
3097 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 2701 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416
3098 int x; // [sp+D20h] [bp-164h]@327 2702 int x; // [sp+D20h] [bp-164h]@327
3099 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 2703 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327
3100 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943 2704 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943
3101 //int v689; // [sp+D30h] [bp-154h]@943
3102 //int v690; // [sp+D34h] [bp-150h]@943
3103 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137 2705 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137
3104 //int v692; // [sp+D3Ch] [bp-148h]@137
3105 //int v693; // [sp+D40h] [bp-144h]@137
3106 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982 2706 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982
3107 //int v695; // [sp+D48h] [bp-13Ch]@982
3108 //int v696; // [sp+D4Ch] [bp-138h]@982
3109 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129 2707 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129
3110 //int v698; // [sp+D54h] [bp-130h]@129
3111 //int v699; // [sp+D58h] [bp-12Ch]@129
3112 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339 2708 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339
3113 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286 2709 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286
3114 //int v702; // [sp+D6Ch] [bp-118h]@286
3115 //int v703; // [sp+D70h] [bp-114h]@286
3116 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 2710 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132
3117 //int v705; // [sp+D78h] [bp-10Ch]@132
3118 //int v706; // [sp+D7Ch] [bp-108h]@132
3119 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 2711 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127
3120 //int v708; // [sp+D84h] [bp-100h]@1127
3121 //int v709; // [sp+D88h] [bp-FCh]@1127
3122 char v710; // [sp+D8Ch] [bp-F8h]@1156 2712 char v710; // [sp+D8Ch] [bp-F8h]@1156
3123 //stru277 *v711; // [sp+D90h] [bp-F4h]@1
3124 __int64 v712; // [sp+D94h] [bp-F0h]@991 2713 __int64 v712; // [sp+D94h] [bp-F0h]@991
3125 int v713; // [sp+D9Ch] [bp-E8h]@324 2714 int v713; // [sp+D9Ch] [bp-E8h]@324
3126 int n; // [sp+DA0h] [bp-E4h]@1 2715 int n; // [sp+DA0h] [bp-E4h]@1
3127 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 2716 AIDirection v715; // [sp+DA4h] [bp-E0h]@21
3128 int v716; // [sp+DC0h] [bp-C4h]@272 2717 int v716; // [sp+DC0h] [bp-C4h]@272
3129 __int64 v717; // [sp+DC4h] [bp-C0h]@271 2718 __int64 v717; // [sp+DC4h] [bp-C0h]@271
3130 float v718; // [sp+DCCh] [bp-B8h]@176 2719 float v718; // [sp+DCCh] [bp-B8h]@176
3131 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 2720 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53
3132 char *y; // [sp+DD4h] [bp-B0h]@325 2721 char *y; // [sp+DD4h] [bp-B0h]@325
3133 int v721; // [sp+DD8h] [bp-ACh]@163 2722 int v721; // [sp+DD8h] [bp-ACh]@163
3134 //SpriteObject a1; // [sp+DDCh] [bp-A8h]@1
3135 int v723; // [sp+E4Ch] [bp-38h]@1 2723 int v723; // [sp+E4Ch] [bp-38h]@1
3136 ItemGen *_this; // [sp+E50h] [bp-34h]@23 2724 ItemGen *_this; // [sp+E50h] [bp-34h]@23
3137 float v725; // [sp+E54h] [bp-30h]@23 2725 float v725; // [sp+E54h] [bp-30h]@23
3138 Player *v726; // [sp+E58h] [bp-2Ch]@131 2726 Player *v726; // [sp+E58h] [bp-2Ch]@131
3139 //int v726b;
3140 float v727; // [sp+E5Ch] [bp-28h]@1 2727 float v727; // [sp+E5Ch] [bp-28h]@1
3141 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 2728 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53
3142 Player *pPlayer; // [sp+E64h] [bp-20h]@8 2729 Player *pPlayer; // [sp+E64h] [bp-20h]@8
3143 int v730; // [sp+E68h] [bp-1Ch]@53 2730 int v730; // [sp+E68h] [bp-1Ch]@53
3144 Player *v730b; 2731 Player *v730b;
3147 signed int v732; // [sp+E70h] [bp-14h]@325 2734 signed int v732; // [sp+E70h] [bp-14h]@325
3148 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 2735 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1
3149 signed int a2; // [sp+E7Ch] [bp-8h]@14 2736 signed int a2; // [sp+E7Ch] [bp-8h]@14
3150 int amount; // [sp+E80h] [bp-4h]@1 2737 int amount; // [sp+E80h] [bp-4h]@1
3151 2738
3152 //auto ecx0 = this;
3153
3154 //v711 = ecx0;
3155
3156 SpriteObject pSpellSprite; // [sp+DDCh] [bp-A8h]@1 2739 SpriteObject pSpellSprite; // [sp+DDCh] [bp-A8h]@1
3157 //SpriteObject::SpriteObject(&a1); 2740
3158
3159 //v1 = 0;
3160 v2 = 0; 2741 v2 = 0;
3161 amount = 0; 2742 amount = 0;
3162 LODWORD(v733) = 0; 2743 LODWORD(v733) = 0;
3163 v723 = 0; 2744 v723 = 0;
3164 v727 = 0.0; 2745 v727 = 0.0;
3643 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; 3224 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
3644 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) 3225 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
3645 ++pTurnEngine->field_1C; 3226 ++pTurnEngine->field_1C;
3646 LODWORD(v727) = 1; 3227 LODWORD(v727) = 1;
3647 break; 3228 break;
3648 } 3229 }
3649 case SPELL_LIGHT_SUNRAY: 3230 case SPELL_LIGHT_SUNRAY:
3650 { 3231 {
3651 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor 3232 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor
3652 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) 3233 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 21) )
3653 { 3234 {
3654 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed 3235 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
3655 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 3236 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
3656 pCastSpell->spellnum = 0; 3237 pCastSpell->spellnum = 0;
3657 continue; 3238 continue;
3833 LODWORD(v727) = 1; 3414 LODWORD(v727) = 1;
3834 break; 3415 break;
3835 } 3416 }
3836 case SPELL_FIRE_FIRE_AURA: 3417 case SPELL_FIRE_FIRE_AURA:
3837 { 3418 {
3838 v63 = v731 - 1; 3419 switch (v731)
3839 if ( !v63 ) 3420 {
3840 { 3421 case 1: LODWORD(v733) = 3600 * v2; amount = 10; break;
3841 amount = 10; 3422 case 2: LODWORD(v733) = 3600 * v2; amount = 11; break;
3842 LODWORD(v733) = 3600 * v2; 3423 case 3: LODWORD(v733) = 3600 * v2; amount = 12; break;
3843 } 3424 case 4: LODWORD(v733) = 0; amount = 12; break;
3844 else 3425 default:
3845 { 3426 assert(false);
3846 v64 = v63 - 1; 3427 }
3847 if ( !v64 ) 3428
3848 {
3849 amount = 11;
3850 LODWORD(v733) = 3600 * v2;
3851 }
3852 else
3853 {
3854 v65 = v64 - 1;
3855 if ( !v65 )
3856 {
3857 amount = 12;
3858 // LABEL_195:
3859 LODWORD(v733) = 3600 * v2;
3860 }
3861 else if ( v65 == 1 )
3862 {
3863 LODWORD(v733) = 0;
3864 amount = 12;
3865 }
3866 }
3867 }
3868 // LABEL_196:
3869 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3429 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3870 break; 3430 break;
3871 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; 3431 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2];
3872 auto _itm = &pItemsTable->pItems[v730c->uItemID]; 3432 auto _itm = &pItemsTable->pItems[v730c->uItemID];
3873 v730c->UpdateTempBonus(pParty->uTimePlayed); 3433 v730c->UpdateTempBonus(pParty->uTimePlayed);
3903 pCastSpell->spellnum = 0; 3463 pCastSpell->spellnum = 0;
3904 continue; 3464 continue;
3905 } 3465 }
3906 case SPELL_BODY_REGENERATION: 3466 case SPELL_BODY_REGENERATION:
3907 { 3467 {
3908 v70 = v731 - 1; 3468 switch (v731)
3909 LODWORD(v733) = 3600 * v2; 3469 {
3910 if ( v70 && (v71 = v70 - 1) != 0 ) 3470 case 1: LODWORD(v733) = 3600 * v2; amount = 1; break;
3911 { 3471 case 2: LODWORD(v733) = 3600 * v2; amount = 1; break;
3912 v72 = v71 - 1; 3472 case 3: LODWORD(v733) = 3600 * v2; amount = 3; break;
3913 if ( v72 ) 3473 case 4: LODWORD(v733) = 3600 * v2; amount = 10; break;
3914 { 3474 default:
3915 if ( v72 == 1 ) 3475 assert(false);
3916 amount = 10; 3476 }
3917 } 3477 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3918 else 3478 break;
3919 { 3479
3920 amount = 3; 3480 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
3921 } 3481
3922 } 3482 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);
3923 else 3483 LODWORD(v727) = 1;
3924 {
3925 amount = 1;
3926 }
3927 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3928 break; 3484 break;
3929
3930 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
3931
3932 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);
3933 LODWORD(v727) = 1;
3934 break;
3935 } 3485 }
3936 case SPELL_FIRE_PROTECTION_FROM_FIRE: 3486 case SPELL_FIRE_PROTECTION_FROM_FIRE:
3937 case SPELL_AIR_PROTECTION_FROM_AIR: 3487 case SPELL_AIR_PROTECTION_FROM_AIR:
3938 case SPELL_WATER_PROTECTION_FROM_WATER: 3488 case SPELL_WATER_PROTECTION_FROM_WATER:
3939 case SPELL_EARTH_PROTECTION_FROM_EARTH: 3489 case SPELL_EARTH_PROTECTION_FROM_EARTH:
3940 case SPELL_MIND_PROTECTION_FROM_MIND: 3490 case SPELL_MIND_PROTECTION_FROM_MIND:
3941 case SPELL_BODY_PROTECTION_FROM_BODY: 3491 case SPELL_BODY_PROTECTION_FROM_BODY:
3942 { 3492 {
3943 LODWORD(v733) = 3600 * v2; 3493 switch (v731)
3944 if ( v731 > 0 && v731 <= 4) 3494 {
3945 { 3495 case 1:
3946 amount = v731 * v2; 3496 case 2:
3947 } 3497 case 3:
3948 //LABEL_232: 3498 case 4: LODWORD(v733) = 3600 * v2; amount = v731 * v2; break;
3949 //v80 = v3->spellnum; 3499 default:
3950 switch (pCastSpell->spellnum) 3500 assert(false);
3951 { 3501 }
3952 case SPELL_FIRE_PROTECTION_FROM_FIRE: 3502
3953 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; 3503 switch (pCastSpell->spellnum)
3954 break; 3504 {
3955 case SPELL_AIR_PROTECTION_FROM_AIR: 3505 case SPELL_FIRE_PROTECTION_FROM_FIRE:
3956 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; 3506 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE;
3957 break; 3507 break;
3958 case SPELL_WATER_PROTECTION_FROM_WATER: 3508 case SPELL_AIR_PROTECTION_FROM_AIR:
3959 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; 3509 LODWORD(v725) = PARTY_BUFF_RESIST_AIR;
3960 break; 3510 break;
3961 case SPELL_EARTH_PROTECTION_FROM_EARTH: 3511 case SPELL_WATER_PROTECTION_FROM_WATER:
3962 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; 3512 LODWORD(v725) = PARTY_BUFF_RESIST_WATER;
3963 break; 3513 break;
3964 case SPELL_MIND_PROTECTION_FROM_MIND: 3514 case SPELL_EARTH_PROTECTION_FROM_EARTH:
3965 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; 3515 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH;
3966 break; 3516 break;
3967 case SPELL_BODY_PROTECTION_FROM_BODY: 3517 case SPELL_MIND_PROTECTION_FROM_MIND:
3968 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; 3518 LODWORD(v725) = PARTY_BUFF_RESIST_MIND;
3969 break; 3519 break;
3970 default: 3520 case SPELL_BODY_PROTECTION_FROM_BODY:
3971 assert(false); 3521 LODWORD(v725) = PARTY_BUFF_RESIST_BODY;
3972 continue; 3522 break;
3973 } 3523 default:
3974 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3524 assert(false);
3975 break; 3525 continue;
3976 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); 3526 }
3977 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); 3527 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3978 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); 3528 break;
3979 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); 3529 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
3980 v90 = (double)(signed int)v733 * 4.2666669; 3530 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
3981 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); 3531 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
3982 LODWORD(v727) = 1; 3532 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
3983 break; 3533 v90 = (double)(signed int)v733 * 4.2666669;
3534 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0);
3535 LODWORD(v727) = 1;
3536 break;
3984 } 3537 }
3985 case SPELL_FIRE_HASTE: 3538 case SPELL_FIRE_HASTE:
3986 { 3539 {
3987 if ( v731 == 1 || v731 == 2 ) 3540 switch (v731)
3988 { 3541 {
3989 LODWORD(v733) = 60 * (v2 + 60); 3542 case 1: LODWORD(v733) = 60 * (v2 + 60); break;
3990 } 3543 case 2: LODWORD(v733) = 60 * (v2 + 60); break;
3991 else if ( v731 == 3 ) 3544 case 3: LODWORD(v733) = 180 * (v2 + 20); break;
3992 { 3545 case 4: LODWORD(v733) = 240 * (v2 + 15); break;
3993 LODWORD(v733) = 180 * (v2 + 20); 3546 default:
3994 } 3547 assert(false);
3995 else if ( v731 == 4 )
3996 {
3997 LODWORD(v733) = 240 * (v2 + 15);
3998 } 3548 }
3999 if ( pPlayer->CanCastSpell(uRequiredMana) ) 3549 if ( pPlayer->CanCastSpell(uRequiredMana) )
4000 { 3550 {
4001 v92 = pParty->pPlayers;//[0].pConditions[1]; 3551 v92 = pParty->pPlayers;//[0].pConditions[1];
4002 LODWORD(v727) = 1; 3552 LODWORD(v727) = 1;
4019 } 3569 }
4020 break; 3570 break;
4021 } 3571 }
4022 case SPELL_SPIRIT_BLESS: 3572 case SPELL_SPIRIT_BLESS:
4023 { 3573 {
4024 if ( v731 == 1 || v731 == 2 ) 3574 switch (v731)
4025 { 3575 {
4026 LODWORD(v733) = 300 * (v2 + 12); 3576 case 1: LODWORD(v733) = 300 * (v2 + 12); break;
4027 } 3577 case 2: LODWORD(v733) = 300 * (v2 + 12); break;
4028 else if ( v731 == 3 ) 3578 case 3: LODWORD(v733) = 900 * (v2 + 4); break;
4029 { 3579 case 4: LODWORD(v733) = 3600 * (v2 + 1); break;
4030 LODWORD(v733) = 900 * (v2 + 4); 3580 default:
4031 } 3581 assert(false);
4032 else if ( v731 == 4 ) 3582 }
4033 {
4034 LODWORD(v733) = 3600 * (v2 + 1);
4035 }
4036 // LABEL_269:
4037 amount = v2 + 5; 3583 amount = v2 + 5;
4038 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3584 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4039 break; 3585 break;
4040 if ( v731 == 1 ) 3586 if ( v731 == 1 )
4041 { 3587 {
4049 //v658 = v111; 3595 //v658 = v111;
4050 //v653 = amount; 3596 //v653 = amount;
4051 //v651 = 1; 3597 //v651 = 1;
4052 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); 3598 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
4053 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; 3599 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS];
4054 //LABEL_103: 3600 //LABEL_103:
4055 //HIDWORD(v650) = HIDWORD(v28); 3601 //HIDWORD(v650) = HIDWORD(v28);
4056 //LABEL_104: 3602 //LABEL_104:
4057 //LODWORD(v650) = v28; 3603 //LODWORD(v650) = v28;
4058 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); 3604 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);
4059 LODWORD(v727) = 1; 3605 LODWORD(v727) = 1;
4060 break; 3606 break;
4061 } 3607 }
4062 v105 = 0; 3608 v105 = 0;
4063 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); 3609 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
4064 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; 3610 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1];
4065 do 3611 do
4086 _this = (ItemGen *)v113; 3632 _this = (ItemGen *)v113;
4087 v114 = v721; 3633 v114 = v721;
4088 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z); 3634 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z);
4089 if ( v113 < v721 ) 3635 if ( v113 < v721 )
4090 { 3636 {
4091 v116 = v113; 3637 v116 = v113;
4092 v113 = v721; 3638 v113 = v721;
4093 v114 = v116; 3639 v114 = v116;
4094 } 3640 }
4095 if ( v113 < (signed int)v115 ) 3641 if ( v113 < (signed int)v115 )
4096 { 3642 {
4097 v117 = v113; 3643 v117 = v113;
4098 v113 = (int)v115; 3644 v113 = (int)v115;
4099 v115 = v117; 3645 v115 = v117;
4100 } 3646 }
4101 if ( v114 < (signed int)v115 ) 3647 if ( v114 < (signed int)v115 )
4102 { 3648 {
4103 v118 = v115; 3649 v118 = v115;
4104 v115 = v114; 3650 v115 = v114;
4105 v114 = v118; 3651 v114 = v118;
4106 } 3652 }
4107 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113); 3653 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113);
4108 if ( (double)(signed int)this <= 307.2 ) 3654 if ( (double)(signed int)this <= 307.2 )
4109 { 3655 {
4110 v701.x = 0; 3656 v701.x = 0;
4111 v701.y = 0; 3657 v701.y = 0;
4112 v701.z = 0; 3658 v701.z = 0;
4113 pSpellSprite.stru_24.Reset(); 3659 pSpellSprite.stru_24.Reset();
4114 v119 = HIDWORD(v733); 3660 v119 = HIDWORD(v733);
4115 pSpellSprite.spell_id = *(int *)HIDWORD(v733); 3661 pSpellSprite.spell_id = *(int *)HIDWORD(v733);
4116 pSpellSprite.spell_level = v723; 3662 pSpellSprite.spell_level = v723;
4117 pSpellSprite.spell_skill = v731; 3663 pSpellSprite.spell_skill = v731;
4118 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 3664 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
4119 pSpellSprite.uAttributes = 0; 3665 pSpellSprite.uAttributes = 0;
4120 pSpellSprite.uSectorID = 0; 3666 pSpellSprite.uSectorID = 0;
4121 pSpellSprite.uSpriteFrameID = 0; 3667 pSpellSprite.uSpriteFrameID = 0;
4122 pSpellSprite.field_60_distance_related_prolly_lod = 0; 3668 pSpellSprite.field_60_distance_related_prolly_lod = 0;
4123 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); 3669 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2));
4124 pSpellSprite.uFacing = 0; 3670 pSpellSprite.uFacing = 0;
4125 pSpellSprite.uSoundID = *(short *)(v119 + 16); 3671 pSpellSprite.uSoundID = *(short *)(v119 + 16);
4126 pSpellSprite.vPosition.x = v112->vPosition.x; 3672 pSpellSprite.vPosition.x = v112->vPosition.x;
4127 pSpellSprite.vPosition.y = v112->vPosition.y; 3673 pSpellSprite.vPosition.y = v112->vPosition.y;
4128 pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); 3674 pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548);
4129 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2); 3675 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2);
4130 v122 = pSpellSprite.Create(0, 0, 0, 0); 3676 v122 = pSpellSprite.Create(0, 0, 0, 0);
4131 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); 3677 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701);
4132 LODWORD(v727) = 1; 3678 LODWORD(v727) = 1;
4133 } 3679 }
4134 else 3680 else
4135 { 3681 {
4136 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); 3682 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u);
4137 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 3683 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4138 *(int *)HIDWORD(v733) = 0; 3684 *(int *)HIDWORD(v733) = 0;
4139 } 3685 }
4140 pCastSpell = (CastSpellInfo *)HIDWORD(v733); 3686 pCastSpell = (CastSpellInfo *)HIDWORD(v733);
4141 } 3687 }
4142 break; 3688 break;
4143 } 3689 }
4144 case SPELL_AIR_SHIELD: 3690 case SPELL_AIR_SHIELD:
4145 case SPELL_EARTH_STONESKIN: 3691 case SPELL_EARTH_STONESKIN:
4146 case SPELL_SPIRIT_HEROISM: 3692 case SPELL_SPIRIT_HEROISM:
4147 { 3693 {
4148 if( v731 == 1 || v731 == 2 ) 3694 switch (v731)
4149 { 3695 {
4150 LODWORD(v733) = 300 * (v2 + 12); 3696 case 1: LODWORD(v733) = 300 * (v2 + 12); break;
4151 } 3697 case 2: LODWORD(v733) = 300 * (v2 + 12); break;
4152 else if ( v731 == 3 ) 3698 case 3: LODWORD(v733) = 900 * (v2 + 4); break;
4153 { 3699 case 4: LODWORD(v733) = 3600 * (v2 + 1); break;
4154 LODWORD(v733) = 900 * (v2 + 4); 3700 default:
4155 } 3701 assert(false);
4156 else if ( v731 == 4 ) 3702 }
4157 {
4158 LODWORD(v733) = 3600 * (v2 + 1);
4159 }
4160
4161 // LABEL_296:
4162 v127 = pCastSpell->spellnum; 3703 v127 = pCastSpell->spellnum;
4163 if ( v127 == 17 ) 3704 if ( v127 == 17 )
4164 { 3705 {
4165 amount = 0; 3706 amount = 0;
4166 LODWORD(v725) = 14; 3707 LODWORD(v725) = 14;
4167 } 3708 }
4168 else 3709 else
4169 { 3710 {
4170 if ( v127 == 38 ) 3711 if ( v127 == 38 )
4171 { 3712 {
4172 LODWORD(v725) = 15; 3713 LODWORD(v725) = 15;
4173 amount = v2 + 5; 3714 amount = v2 + 5;
4174 } 3715 }
4175 else 3716 else
4176 { 3717 {
4177 if ( v127 != 51 ) 3718 if ( v127 != 51 )
4178 continue; 3719 continue;
4179 LODWORD(v725) = 9; 3720 LODWORD(v725) = 9;
4180 amount = v2 + 5; 3721 amount = v2 + 5;
4181 } 3722 }
4182 } 3723 }
4183 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3724 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4184 break; 3725 break;
4185 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); 3726 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
4210 LODWORD(v727) = 1; 3751 LODWORD(v727) = 1;
4211 break; 3752 break;
4212 } 3753 }
4213 case SPELL_FIRE_METEOR_SHOWER: 3754 case SPELL_FIRE_METEOR_SHOWER:
4214 { 3755 {
4215 v149 = v731 - 1; 3756 //v149 = v731 - 1;
4216 if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) 3757 //if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 )
3758 if ( v731 == 4 )
4217 { 3759 {
4218 if ( v151 == 1 ) 3760 if ( v151 == 1 )
4219 _this = (ItemGen *)20; 3761 _this = (ItemGen *)20;
4220 } 3762 }
4221 else 3763 else
4257 *(float *)&v732 = (double)v713; 3799 *(float *)&v732 = (double)v713;
4258 v730 = LODWORD(v725) == 3 ? a2 : 0; 3800 v730 = LODWORD(v725) == 3 ? a2 : 0;
4259 auto _this_cpy = (int)_this; 3801 auto _this_cpy = (int)_this;
4260 do 3802 do
4261 { 3803 {
4262 //v157 = rand(); 3804 //v157 = rand();
4263 v158 = (double)SLODWORD(v718); 3805 v158 = (double)SLODWORD(v718);
4264 v718 = v158; 3806 v718 = v158;
4265 v159 = (double)v721; 3807 v159 = (double)v721;
4266 *(float *)&v721 = v159; 3808 *(float *)&v721 = v159;
4267 a2 = rand() % 1000; 3809 a2 = rand() % 1000;
4268 *((float *)&v733 + 1) = (double)(rand() % 1000) + *(float *)&y - *(float *)&v732; 3810 *((float *)&v733 + 1) = (double)(rand() % 1000) + *(float *)&y - *(float *)&v732;
4269 //v725 = v159 * v159; 3811 //v725 = v159 * v159;
4270 *(float *)&_this = v158 * v158; 3812 *(float *)&_this = v158 * v158;
4271 //if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) 3813 //if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 )
4272 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v159 * v159) <= 1.0 ) 3814 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v159 * v159) <= 1.0 )
4273 { 3815 {
4274 LODWORD(v687) = 0; 3816 LODWORD(v687) = 0;
4275 HIDWORD(v687) = 0; 3817 HIDWORD(v687) = 0;
4276 } 3818 }
4277 else 3819 else
4278 { 3820 {
4279 //x = (signed __int64)sqrt(*(float *)&_this + v725); 3821 //x = (signed __int64)sqrt(*(float *)&_this + v725);
4280 x = (signed __int64)sqrt(*(float *)&_this + v159 * v159); 3822 x = (signed __int64)sqrt(*(float *)&_this + v159 * v159);
4281 v687 = __PAIR__( 3823 v687 = __PAIR__(
4282 stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)), 3824 stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)),
4283 stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721)); 3825 stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721));
4284 } 3826 }
4285 pSpellSprite.stru_24.Reset(); 3827 pSpellSprite.stru_24.Reset();
4286 pSpellSprite.spell_id = pCastSpell->spellnum; 3828 pSpellSprite.spell_id = pCastSpell->spellnum;
4287 pSpellSprite.spell_level = v2; 3829 pSpellSprite.spell_level = v2;
4288 pSpellSprite.spell_skill = v731; 3830 pSpellSprite.spell_skill = v731;
4289 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 3831 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
4290 pSpellSprite.uAttributes = 0; 3832 pSpellSprite.uAttributes = 0;
4291 pSpellSprite.vPosition.x = uRequiredMana; 3833 pSpellSprite.vPosition.x = uRequiredMana;
4292 pSpellSprite.vPosition.y = LODWORD(v727); 3834 pSpellSprite.vPosition.y = LODWORD(v727);
4293 pSpellSprite.uSectorID = 0; 3835 pSpellSprite.uSectorID = 0;
4294 pSpellSprite.vPosition.z = a2 + v713; 3836 pSpellSprite.vPosition.z = a2 + v713;
4295 pSpellSprite.uSpriteFrameID = 0; 3837 pSpellSprite.uSpriteFrameID = 0;
4296 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 3838 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
4297 pSpellSprite.spell_target_pid = v730; 3839 pSpellSprite.spell_target_pid = v730;
4298 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); 3840 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500);
4299 pSpellSprite.uFacing = v687; 3841 pSpellSprite.uFacing = v687;
4300 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 3842 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
4301 if ( pParty->bTurnBasedModeOn == 1 ) 3843 if ( pParty->bTurnBasedModeOn == 1 )
4302 pSpellSprite.uAttributes = 4; 3844 pSpellSprite.uAttributes = 4;
4303 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 3845 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1
4304 && pParty->bTurnBasedModeOn == 1 ) 3846 && pParty->bTurnBasedModeOn == 1 )
4305 ++pTurnEngine->field_1C; 3847 ++pTurnEngine->field_1C;
4306 LODWORD(v718) = rand() % 1024 - 512; 3848 LODWORD(v718) = rand() % 1024 - 512;
4307 //v160 = rand(); 3849 //v160 = rand();
4308 v14 = _this_cpy-- == 1; 3850 v14 = _this_cpy-- == 1;
4309 v721 = (unsigned __int64)(rand() % 1024) - 512; 3851 v721 = (unsigned __int64)(rand() % 1024) - 512;
4310 } 3852 }
4311 while ( !v14 ); 3853 while ( !v14 );
4312 } 3854 }
4313 LODWORD(v727) = 1; 3855 LODWORD(v727) = 1;
4314 break; 3856 break;
4315 } 3857 }
4316 case SPELL_FIRE_INFERNO: 3858 case SPELL_FIRE_INFERNO:
4317 { 3859 {
4318 //v67 = 2; 3860 //v67 = 2;
4319 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) 3861 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
4320 { 3862 {
4321 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! 3863 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors!
4322 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 3864 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4323 pCastSpell->spellnum = 0; 3865 pCastSpell->spellnum = 0;
4324 continue; 3866 continue;
4325 } 3867 }
4326 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3868 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3869 break;
3870 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
3871 v700.z = 0;
3872 v700.y = 0;
3873 v700.x = 0;
3874 pSpellSprite.stru_24.Reset();
3875 pSpellSprite.spell_id = pCastSpell->spellnum;
3876 pSpellSprite.spell_level = v2;
3877 pSpellSprite.spell_skill = v731;
3878 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
3879 pSpellSprite.uAttributes = 0;
3880 pSpellSprite.uSectorID = 0;
3881 pSpellSprite.uSpriteFrameID = 0;
3882 pSpellSprite.field_60_distance_related_prolly_lod = 0;
3883 pSpellSprite.uFacing = 0;
3884 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
3885 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
3886 a2 = 0;
3887 if ( (signed int)_v726 > 0 )
3888 {
3889 do
3890 {
3891 v162 = dword_50BF30[a2];
3892 pSpellSprite.vPosition.x = pActors[v162].vPosition.x;
3893 pSpellSprite.vPosition.y = pActors[v162].vPosition.y;
3894 pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548);
3895 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
3896 v164 = pSpellSprite.Create(0, 0, 0, 0);
3897 v165 = a2;
3898 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700);
3899 pGame->GetStru6()->_4A81CA(&pSpellSprite);
3900 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u);
3901 a2 = v165 + 1;
3902 }
3903 while ( v165 + 1 < (signed int)_v726 );
3904 }
3905 LODWORD(v727) = 1;
4327 break; 3906 break;
4328 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); 3907 }
4329 v700.z = 0;
4330 v700.y = 0;
4331 v700.x = 0;
4332 pSpellSprite.stru_24.Reset();
4333 pSpellSprite.spell_id = pCastSpell->spellnum;
4334 pSpellSprite.spell_level = v2;
4335 pSpellSprite.spell_skill = v731;
4336 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
4337 pSpellSprite.uAttributes = 0;
4338 pSpellSprite.uSectorID = 0;
4339 pSpellSprite.uSpriteFrameID = 0;
4340 pSpellSprite.field_60_distance_related_prolly_lod = 0;
4341 pSpellSprite.uFacing = 0;
4342 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
4343 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
4344 a2 = 0;
4345 if ( (signed int)_v726 > 0 )
4346 {
4347 do
4348 {
4349 v162 = dword_50BF30[a2];
4350 pSpellSprite.vPosition.x = pActors[v162].vPosition.x;
4351 pSpellSprite.vPosition.y = pActors[v162].vPosition.y;
4352 pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548);
4353 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
4354 v164 = pSpellSprite.Create(0, 0, 0, 0);
4355 v165 = a2;
4356 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700);
4357 pGame->GetStru6()->_4A81CA(&pSpellSprite);
4358 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u);
4359 a2 = v165 + 1;
4360 }
4361 while ( v165 + 1 < (signed int)_v726 );
4362 }
4363 LODWORD(v727) = 1;
4364 break;
4365 }
4366
4367 case SPELL_AIR_WIZARD_EYE: 3908 case SPELL_AIR_WIZARD_EYE:
4368 { 3909 {
4369 LODWORD(v733) = 3600 * v2; 3910 LODWORD(v733) = 3600 * v2;
4370 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3911 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4371 break; 3912 break;
4372 v168 = 0; 3913 v168 = 0;
4373 do 3914 do
4385 { 3926 {
4386 switch (v731) 3927 switch (v731)
4387 { 3928 {
4388 case 1: LODWORD(v733) = 300 * v2; break; 3929 case 1: LODWORD(v733) = 300 * v2; break;
4389 case 2: LODWORD(v733) = 600 * v2; break; 3930 case 2: LODWORD(v733) = 600 * v2; break;
4390 case 3: 3931 case 3: LODWORD(v733) = 3600 * v2; break;
4391 case 4: LODWORD(v733) = 3600 * v2; break; 3932 case 4: LODWORD(v733) = 3600 * v2; break;
4392 default: 3933 default:
4393 assert(false); 3934 assert(false);
4394 } 3935 }
4395 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3936 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4449 if ( pSpellSprite.Create( 3990 if ( pSpellSprite.Create(
4450 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), 3991 (signed __int16)(v188 + LOWORD(v715.uYawAngle)),
4451 v715.uPitchAngle, 3992 v715.uPitchAngle,
4452 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 3993 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
4453 pCastSpell->uPlayerID + 1) != -1 3994 pCastSpell->uPlayerID + 1) != -1
4454 && pParty->bTurnBasedModeOn == 1 ) 3995 && pParty->bTurnBasedModeOn == 1 )
4455 ++pTurnEngine->field_1C; 3996 + +pTurnEngine->field_1C;
4456 v188 += _v726 / (amount - 1); 3997 v188 += _v726 / (amount - 1);
4457 } 3998 }
4458 LODWORD(v727) = 1; 3999 LODWORD(v727) = 1;
4459 break; 4000 break;
4460 } 4001 }
4520 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed 4061 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
4521 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 4062 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4522 break; 4063 break;
4523 } 4064 }
4524 LODWORD(v733) = 3600 * v2; 4065 LODWORD(v733) = 3600 * v2;
4525 if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) ) 4066 if ( v731 == 1 || v731 == 2 || v731 == 3 )
4526 amount = 1; 4067 amount = 1;
4068 else
4069 amount = 0;
4527 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 4070 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4528 break; 4071 break;
4529 v205 = 0; 4072 v205 = 0;
4530 do 4073 do
4531 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); 4074 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536);
4587 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y; 4130 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y;
4588 *(float *)&v721 = v217 * v217; 4131 *(float *)&v721 = v217 * v217;
4589 //*(float *)&v726 = v216 * v216; 4132 //*(float *)&v726 = v216 * v216;
4590 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 ) 4133 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 )
4591 { 4134 {
4592 LODWORD(v685) = 0; 4135 LODWORD(v685) = 0;
4593 HIDWORD(v685) = 0; 4136 HIDWORD(v685) = 0;
4594 } 4137 }
4595 else 4138 else
4596 { 4139 {
4597 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); 4140 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721);
4598 v685 = __PAIR__( 4141 v685 = __PAIR__(
4599 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), 4142 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)),
4600 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); 4143 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana));
4601 } 4144 }
4602 pSpellSprite.stru_24.Reset(); 4145 pSpellSprite.stru_24.Reset();
4603 pSpellSprite.spell_id = pCastSpell->spellnum; 4146 pSpellSprite.spell_id = pCastSpell->spellnum;
4604 pSpellSprite.spell_level = v2; 4147 pSpellSprite.spell_level = v2;
4605 pSpellSprite.spell_skill = v731; 4148 pSpellSprite.spell_skill = v731;
4671 LODWORD(v727) = 1; 4214 LODWORD(v727) = 1;
4672 break; 4215 break;
4673 } 4216 }
4674 case SPELL_WATER_POISON_SPRAY: 4217 case SPELL_WATER_POISON_SPRAY:
4675 { 4218 {
4676 if ( v731 == 1 ) 4219 switch (v731)
4677 amount = 1; 4220 {
4678 else if ( v731 == 2 ) 4221 case 1: amount = 1; break;
4679 amount = 3; 4222 case 2: amount = 3; break;
4680 else if ( v731 == 3 ) 4223 case 3: amount = 5; break;
4681 amount = 5; 4224 case 4: amount = 7; break;
4682 else if ( v731 == 4 ) 4225 default:
4683 amount = 7; 4226 assert(false);
4227 }
4684 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 4228 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4685 break; 4229 break;
4686 HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; 4230 HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
4687 if ( amount == 1 ) 4231 if ( amount == 1 )
4688 { 4232 {
4729 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 4273 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
4730 pSpellSprite.spell_target_pid = a2; 4274 pSpellSprite.spell_target_pid = a2;
4731 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); 4275 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
4732 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 4276 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
4733 if ( pParty->bTurnBasedModeOn == 1 ) 4277 if ( pParty->bTurnBasedModeOn == 1 )
4734 LOBYTE(pSpellSprite.uAttributes) |= 4u; 4278 LOBYTE(pSpellSprite.uAttributes) |= 4u;
4735 v227 = SHIDWORD(v733) / -2; 4279 v227 = SHIDWORD(v733) / -2;
4736 y = (char *)(SHIDWORD(v733) / 2); 4280 y = (char *)(SHIDWORD(v733) / 2);
4737 if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 ) 4281 if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 )
4738 { 4282 {
4739 v228 = v715.uYawAngle; 4283 v228 = v715.uYawAngle;
4740 do 4284 do
4741 { 4285 {
4742 pSpellSprite.uFacing = v227 + v228; 4286 pSpellSprite.uFacing = v227 + v228;
4743 if ( pSpellSprite.Create( 4287 if ( pSpellSprite.Create(
4744 v227 + v228, 4288 v227 + v228,
4745 v715.uPitchAngle, 4289 v715.uPitchAngle,
4746 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 4290 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
4747 pCastSpell->uPlayerID + 1) != -1 4291 pCastSpell->uPlayerID + 1) != -1
4748 && pParty->bTurnBasedModeOn == 1 ) 4292 && pParty->bTurnBasedModeOn == 1 )
4749 ++pTurnEngine->field_1C; 4293 ++pTurnEngine->field_1C;
4750 v227 += SHIDWORD(v733) / (amount - 1); 4294 v227 += SHIDWORD(v733) / (amount - 1);
4751 } 4295 }
4752 while ( v227 <= (signed int)y ); 4296 while ( v227 <= (signed int)y );
4753 } 4297 }
4754 } 4298 }
4755 LODWORD(v727) = 1; 4299 LODWORD(v727) = 1;
4756 break; 4300 break;
4757 } 4301 }
4758 case SPELL_WATER_WATER_WALK: 4302 case SPELL_WATER_WATER_WALK:
4759 { 4303 {
4760 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) 4304 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() )
4761 { 4305 {
4762 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed 4306 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
4763 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 4307 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4308 break;
4309 }
4310 if ( v731 == 2 || v731 != 3 && v731 != 4 )
4311 v229 = 600 * v2;
4312 else
4313 v229 = 3600 * v2;
4314 LODWORD(v733) = v229;
4315 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4316 break;
4317 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536);
4318 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
4319 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
4320 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
4321 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
4322
4323 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(
4324 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335),
4325 v731,
4326 amount,
4327 v716,
4328 pCastSpell->uPlayerID + 1);
4329 if ( v731 == 4 )
4330 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1;
4331 LODWORD(v727) = 1;
4764 break; 4332 break;
4765 } 4333 }
4766 if ( v731 == 2 || v731 != 3 && v731 != 4 ) 4334 case SPELL_WATER_RECHARGE_ITEM:
4767 v229 = 600 * v2; 4335 {
4768 else 4336 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4769 v229 = 3600 * v2; 4337 break;
4770 LODWORD(v733) = v229; 4338 v240 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2];
4771 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 4339 y = v240;
4340 if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 )
4341 {
4342 dword_50C9D0 = 113;
4343 dword_50C9D4 = 0;
4344 dword_50C9D8 = 1;
4345
4346 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
4347 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4348 pCastSpell->spellnum = 0;
4349 continue;
4350 }
4351 if ( v731 == 1 || v731 == 2 )
4352 {
4353 v241 = (double)v723 * 0.0099999998 + 0.5;
4354 }
4355 else if ( v731 == 3 )
4356 {
4357 v241 = (double)v723 * 0.0099999998 + 0.69999999;
4358 }
4359 else if ( v731 == 4 )
4360 {
4361 v241 = (double)v723 * 0.0099999998 + 0.80000001;
4362 }
4363 else
4364 {
4365 v241 = 0.0;
4366 }
4367 if ( v241 > 1.0 )
4368 v241 = 1.0;
4369 //LABEL_484:
4370 v732 = (unsigned __int8)v240[25];
4371 v242 = (signed __int64)((double)v732 * v241);
4372 v243 = y;
4373 y[25] = v242;
4374 *((int *)v243 + 4) = (unsigned __int8)v242;
4375 if ( (unsigned __int8)v242 <= 0 )
4376 {
4377 *(int *)v243 = 0;
4378 dword_50C9D0 = 113;
4379 dword_50C9D4 = 0;
4380 dword_50C9D8 = 1;
4381 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u);
4382 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4383 pCastSpell->spellnum = 0;
4384 v2 = v723;
4385 continue;
4386 }
4387 *((int *)v243 + 5) |= 0x40u;
4388 _50C9A8_item_enchantment_timer = 256;
4389 LODWORD(v727) = 1;
4772 break; 4390 break;
4773 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); 4391 }
4774 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
4775 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
4776 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
4777 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
4778
4779 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(
4780 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335),
4781 v731,
4782 amount,
4783 v716,
4784 pCastSpell->uPlayerID + 1);
4785 if ( v731 == 4 )
4786 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1;
4787 LODWORD(v727) = 1;
4788 break;
4789 }
4790 case SPELL_WATER_RECHARGE_ITEM:
4791 {
4792 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4793 break;
4794 v240 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2];
4795 y = v240;
4796 if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 )
4797 {
4798 dword_50C9D0 = 113;
4799 dword_50C9D4 = 0;
4800 dword_50C9D8 = 1;
4801
4802 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
4803 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4804 pCastSpell->spellnum = 0;
4805 continue;
4806 }
4807 if ( v731 == 1 || v731 == 2 )
4808 {
4809 v241 = (double)v723 * 0.0099999998 + 0.5;
4810 }
4811 else if ( v731 == 3 )
4812 {
4813 v241 = (double)v723 * 0.0099999998 + 0.69999999;
4814 }
4815 else if ( v731 == 4 )
4816 {
4817 v241 = (double)v723 * 0.0099999998 + 0.80000001;
4818 }
4819 else
4820 {
4821 v241 = 0.0;
4822 }
4823 if ( v241 > 1.0 )
4824 v241 = 1.0;
4825 //LABEL_484:
4826 v732 = (unsigned __int8)v240[25];
4827 v242 = (signed __int64)((double)v732 * v241);
4828 v243 = y;
4829 y[25] = v242;
4830 *((int *)v243 + 4) = (unsigned __int8)v242;
4831 if ( (unsigned __int8)v242 <= 0 )
4832 {
4833 *(int *)v243 = 0;
4834 dword_50C9D0 = 113;
4835 dword_50C9D4 = 0;
4836 dword_50C9D8 = 1;
4837 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u);
4838 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4839 pCastSpell->spellnum = 0;
4840 v2 = v723;
4841 continue;
4842 }
4843 *((int *)v243 + 5) |= 0x40u;
4844 _50C9A8_item_enchantment_timer = 256;
4845 LODWORD(v727) = 1;
4846 break;
4847 }
4848 case SPELL_WATER_ENCHANT_ITEM: 4392 case SPELL_WATER_ENCHANT_ITEM:
4849 { 4393 {
4850 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 4394 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4851 break; 4395 break;
4852 uRequiredMana = 0; 4396 uRequiredMana = 0;
4853 HIDWORD(v733) = 10 * v2; 4397 HIDWORD(v733) = 10 * v2;
4854 v730 = 1; 4398 v730 = 1;
4855 v244 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; 4399 v244 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2];
4856 if ( v731 == 1 ) 4400 if ( v731 == 1 )
4857 { 4401 {
4858 v245 = (int)&v244[36 * a2 + 532]; 4402 v245 = (int)&v244[36 * a2 + 532];
4859 v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName; 4403 v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName;
4860 v311 = __OFSUB__(*(int *)v245, 134); 4404 v311 = __OFSUB__(*(int *)v245, 134);
4861 v14 = *(int *)v245 == 134; 4405 v14 = *(int *)v245 == 134;
4862 v310 = *(int *)v245 - 134 < 0; 4406 v310 = *(int *)v245 - 134 < 0;
4863 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * *(int *)v245 + 4; 4407 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * *(int *)v245 + 4;
4864 if ( (unsigned __int8)(v310 ^ v311) | v14 ) 4408 if ( (unsigned __int8)(v310 ^ v311) | v14 )
4865 {
4866 if ( *(int *)&v244[36 * a2 + 544] == 0 )
4867 {
4868 if ( *(int *)&v244[36 * a2 + 536] == 0 )
4869 { 4409 {
4870 if ( *(int *)&v244[36 * a2 + 540] == 0 ) 4410 if ( *(int *)&v244[36 * a2 + 544] == 0 )
4871 {
4872 v312 = v309[28];
4873 if ( v312 )
4874 { 4411 {
4875 if ( v312 != 1 ) 4412 if ( *(int *)&v244[36 * a2 + 536] == 0 )
4876 {
4877 if ( v312 != 2 )
4878 { 4413 {
4879 _this = (ItemGen *)&v244[36 * a2 + 552]; 4414 if ( *(int *)&v244[36 * a2 + 540] == 0 )
4880 if ( !(v244[36 * a2 + 552] & 2) )
4881 {
4882 if ( ((ItemGen *)v245)->GetValue() < 0x1C2 )
4883 { 4415 {
4884 uRequiredMana = 1; 4416 v312 = v309[28];
4885 v730 = 0; 4417 if ( v312 )
4886 }
4887 if ( rand() % 100 >= SHIDWORD(v733) )
4888 uRequiredMana = 1;
4889 if (!uRequiredMana)
4890 {
4891 v313 = *(char *)(LODWORD(v725) + 28);
4892 if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 )
4893 {
4894 v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType];
4895 *(int *)(v245 + 4) = 0;
4896 for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
4897 + 1];
4898 ;
4899 j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
4900 + 1] )
4901 { 4418 {
4902 ++*(int *)(v245 + 4); 4419 if ( v312 != 1 )
4903 if ( j >= v314 ) 4420 {
4904 break; 4421 if ( v312 != 2 )
4422 {
4423 _this = (ItemGen *)&v244[36 * a2 + 552];
4424 if ( !(v244[36 * a2 + 552] & 2) )
4425 {
4426 if ( ((ItemGen *)v245)->GetValue() < 0x1C2 )
4427 {
4428 uRequiredMana = 1;
4429 v730 = 0;
4430 }
4431 if ( rand() % 100 >= SHIDWORD(v733) )
4432 uRequiredMana = 1;
4433 if (!uRequiredMana)
4434 {
4435 v313 = *(char *)(LODWORD(v725) + 28);
4436 if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 )
4437 {
4438 v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType];
4439 *(int *)(v245 + 4) = 0;
4440 for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
4441 + 1];
4442 ;
4443 j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
4444 + 1] )
4445 {
4446 ++*(int *)(v245 + 4);
4447 if ( j >= v314 )
4448 break;
4449 }
4450 v254 = rand();
4451 v255 = 10;//pItemsTable->field_116D8[17];
4452 v256 = 10;//pItemsTable->field_116D8[16];
4453 //LABEL_611:
4454 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1);
4455 //LABEL_612:
4456 _this->uItemID |= 0x20u;
4457
4458 _50C9A8_item_enchantment_timer = 256;
4459 LODWORD(v727) = 1;
4460 break;
4461 }
4462 }
4463 else
4464 {
4465 //LABEL_613:
4466 v316 = _this->uItemID;
4467 if ( !(BYTE1(v316) & 2) )
4468 {
4469 LOBYTE(v316) = v316 | 2;
4470 _this->uItemID = v316;
4471 }
4472 }
4473 }
4474 }
4475 }
4905 } 4476 }
4906 v254 = rand();
4907 v255 = 10;//pItemsTable->field_116D8[17];
4908 v256 = 10;//pItemsTable->field_116D8[16];
4909 //LABEL_611:
4910 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1);
4911 //LABEL_612:
4912 _this->uItemID |= 0x20u;
4913
4914 _50C9A8_item_enchantment_timer = 256;
4915 LODWORD(v727) = 1;
4916 break;
4917 }
4918 }
4919 else
4920 {
4921 //LABEL_613:
4922 v316 = _this->uItemID;
4923 if ( !(BYTE1(v316) & 2) )
4924 {
4925 LOBYTE(v316) = v316 | 2;
4926 _this->uItemID = v316;
4927 }
4928 } 4477 }
4929 } 4478 }
4479 }
4480 }
4481 //LABEL_616:
4482 if ( LODWORD(v727) == 0 )
4483 {
4484 v317 = pGlobalTXT_LocalizationStrings[428];
4485 if ( v730 == 0 )
4486 v317 = pGlobalTXT_LocalizationStrings[585];
4487 ShowStatusBarString(v317, 2u);
4488 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4489 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
4490 pCastSpell->spellnum = 0;
4491 v318->PlaySound(SPEECH_43, 0);
4492 }
4493 }
4494 else if ( v731 == 2 )
4495 {
4496 v289 = (ItemGen *)&v244[36 * a2 + 532];
4497 _this = v289;
4498 v290 = v289->uItemID;
4499 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4;
4500 if ( v290 > 134
4501 || _this->uSpecEnchantmentType != 0
4502 || _this->uEnchantmentType != 0
4503 || _this->_bonus_strength != 0
4504 || (v291 = pItemsTable->pItems[v290].uEquipType) == 0
4505 || v291 == 1
4506 || v291 == 2
4507 || _this->Broken())
4508 {
4509 if ( LODWORD(v727) == 0 )
4510 {
4511 v317 = pGlobalTXT_LocalizationStrings[428];
4512 if ( v730 == 0 )
4513 v317 = pGlobalTXT_LocalizationStrings[585];
4514 ShowStatusBarString(v317, 2u);
4515 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4516 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
4517 pCastSpell->spellnum = 0;
4518 v318->PlaySound(SPEECH_43, 0);
4519 }
4520 break;
4521 }
4522 if ( _this->GetValue() < 0x1C2 )
4523 uRequiredMana = 1;
4524 if ( rand() % 100 >= SHIDWORD(v733) )
4525 uRequiredMana = 1;
4526 if ( uRequiredMana != 0 )
4527 {
4528 dword_50C9D0 = 113;
4529 dword_50C9D4 = 0;
4530 dword_50C9D8 = 1;
4531
4532 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
4533 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4534 pCastSpell->spellnum = 0;
4535 continue;
4536 }
4537 v292 = *(char *)(LODWORD(v725) + 28);
4538 if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) )
4539 {
4540 v2 = v723;
4541 //v1 = 0;
4542
4543 dword_50C9D0 = 113;
4544 dword_50C9D4 = 0;
4545 dword_50C9D8 = 1;
4546
4547 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
4548 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4549 pCastSpell->spellnum = 0;
4550 continue;
4551 }
4552 if ( rand() % 100 >= 80 )
4553 {
4554 v297 = pItemsTable->pSpecialEnchantments_count;
4555 v294 = _this;
4556 v298 = 0;
4557 v725 = 0.0;
4558 HIDWORD(v733) = 0;
4559 if ( pItemsTable->pSpecialEnchantments_count > 0 )
4560 {
4561 v730 = (int)&v679;
4562 do
4563 {
4564 v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement);
4565 if ( !v299 || v299 == 1 )
4566 {
4567 v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]
4568 + v298 * 28);
4569 LODWORD(v725) += v300;
4570 if ( v300 )
4571 {
4572 v301 = v730;
4573 v730 += 4;
4574 *(int *)v301 = HIDWORD(v733);
4575 }
4576 }
4577 ++HIDWORD(v733);
4578 ++v298;
4579 }
4580 while ( SHIDWORD(v733) < v297 );
4581 }
4582 v302 = rand() % SLODWORD(v725);
4583 v303 = v679;
4584 v294->uSpecEnchantmentType = v679;
4585 v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4];
4586 v305 = v302 + 1;
4587 if ( v304 < v305 )
4588 {
4589 for ( jj = &v679; ; jj = (int *)v732 )
4590 {
4591 v307 = (int)(jj + 1);
4592 v732 = v307;
4593 v308 = *(int *)v307;
4594 v294->uSpecEnchantmentType = v308;
4595 v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4];
4596 if ( v304 >= v305 )
4597 break;
4930 } 4598 }
4931 } 4599 }
4600 ++v294->uSpecEnchantmentType;
4601 }
4602 else
4603 {
4604 v293 = rand();
4605 v294 = _this;
4606 v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType];
4607 _this->uEnchantmentType = 0;
4608 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1];
4609 ;
4610 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType
4611 + 1] )
4612 {
4613 ++v294->uEnchantmentType;
4614 if ( kk >= v295 )
4615 break;
4932 } 4616 }
4617 v294->_bonus_strength = 10//pItemsTable->field_116D8[18]
4618 + rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1);
4933 } 4619 }
4934 } 4620 v294->uAttributes |= 0x20u;
4935 } 4621 _50C9A8_item_enchantment_timer = 256;
4936 } 4622 LODWORD(v727) = 1;
4937 //LABEL_616: 4623 }
4938 if ( LODWORD(v727) == 0 ) 4624 else if ( v731 == 3 )
4939 {
4940 v317 = pGlobalTXT_LocalizationStrings[428];
4941 if ( v730 == 0 )
4942 v317 = pGlobalTXT_LocalizationStrings[585];
4943 ShowStatusBarString(v317, 2u);
4944 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4945 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
4946 pCastSpell->spellnum = 0;
4947 v318->PlaySound(SPEECH_43, 0);
4948 }
4949 break;
4950 }
4951 if ( v731 != 2 )
4952 {
4953 if ( v731 == 3 )
4954 { 4625 {
4955 v245 = (int)&v244[36 * a2 + 532]; 4626 v245 = (int)&v244[36 * a2 + 532];
4956 v269 = *(int *)v245; 4627 v269 = *(int *)v245;
4957 if ( *(int *)v245 > 134 4628 if ( *(int *)v245 > 134
4958 || *(int *)(v245 + 12) != 0 4629 || *(int *)(v245 + 12) != 0
5068 v282 = rand() % SLODWORD(v725); 4739 v282 = rand() % SLODWORD(v725);
5069 v283 = v679; 4740 v283 = v679;
5070 *(int *)(v245 + 12) = v679; 4741 *(int *)(v245 + 12) = v679;
5071 v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; 4742 v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4];
5072 v285 = v282 + 1; 4743 v285 = v282 + 1;
5073 if ( v284 < v285 ) 4744 if ( v284 < v285 )
5074 { 4745 {
5075 for ( l = &v679; ; l = (int *)v732 ) 4746 for ( l = &v679; ; l = (int *)v732 )
5076 { 4747 {
5077 v287 = (int)(l + 1); 4748 v287 = (int)(l + 1);
5078 v732 = v287; 4749 v732 = v287;
5079 v288 = *(int *)v287; 4750 v288 = *(int *)v287;
5080 *(int *)(v245 + 12) = v288; 4751 *(int *)(v245 + 12) = v288;
5081 v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType 4752 v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
5082 + 4]; 4753 + 4];
5083 if ( v284 >= v285 ) 4754 if ( v284 >= v285 )
5084 break; 4755 break;
5085 } 4756 }
5086 } 4757 }
5087 ++*(int *)(v245 + 12); 4758 ++*(int *)(v245 + 12);
5088 _this->uItemID |= 0x20u; 4759 _this->uItemID |= 0x20u;
5089 4760
5090 _50C9A8_item_enchantment_timer = 256; 4761 _50C9A8_item_enchantment_timer = 256;
5091 LODWORD(v727) = 1; 4762 LODWORD(v727) = 1;
5092 break; 4763 break;
5093 } 4764 }
5094 } 4765 }
5095 else 4766 else if ( v731 == 4 )
5096 { 4767 {
5097 __debugbreak(); // v726 is most probably the caster, filled in case 54 4768 __debugbreak(); // v726 is most probably the caster, filled in case 54
5098 if ( v731 != 4 4769 if ( v731 != 4
5099 || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134) 4770 || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134)
5100 || v726->pInventoryItems[a2].uSpecEnchantmentType != 0 4771 || v726->pInventoryItems[a2].uSpecEnchantmentType != 0
5132 if (uRequiredMana) 4803 if (uRequiredMana)
5133 { 4804 {
5134 v316 = _this->uItemID; 4805 v316 = _this->uItemID;
5135 if ( !(BYTE1(v316) & 2) ) 4806 if ( !(BYTE1(v316) & 2) )
5136 { 4807 {
5137 LOBYTE(v316) = v316 | 2; 4808 LOBYTE(v316) = v316 | 2;
5138 _this->uItemID = v316; 4809 _this->uItemID = v316;
5139 } 4810 }
5140 if ( LODWORD(v727) == 0 ) 4811 if ( LODWORD(v727) == 0 )
5141 { 4812 {
5142 v317 = pGlobalTXT_LocalizationStrings[428]; 4813 v317 = pGlobalTXT_LocalizationStrings[428];
5143 if ( v730 == 0 ) 4814 if ( v730 == 0 )
5155 if ( v251 == 0 | v251 == 1 | v251 == 2 | v251 == 3 | v251 == 4 | v251 == 5 | v251 == 6 | v251 == 7 | v251 == 8 | v251 == 9 | v251 == 10 | v251 == 11 ) 4826 if ( v251 == 0 | v251 == 1 | v251 == 2 | v251 == 3 | v251 == 4 | v251 == 5 | v251 == 6 | v251 == 7 | v251 == 8 | v251 == 9 | v251 == 10 | v251 == 11 )
5156 { 4827 {
5157 if ( rand() % 100 < 80 4828 if ( rand() % 100 < 80
5158 && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) ) 4829 && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) )
5159 { 4830 {
5160 v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; 4831 v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType];
5161 *(int *)(v245 + 4) = 0; 4832 *(int *)(v245 + 4) = 0;
5162 for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; 4833 for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1];
5163 ; 4834 ;
5164 m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType 4835 m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
5165 + 1] ) 4836 + 1] )
5166 { 4837 {
5167 ++*(int *)(v245 + 4); 4838 ++*(int *)(v245 + 4);
5168 if ( m >= v252 ) 4839 if ( m >= v252 )
5169 break; 4840 break;
5170 } 4841 }
5171 v254 = rand(); 4842 v254 = rand();
5172 v255 = 10;// pItemsTable->field_116D8[21]; 4843 v255 = 10;// pItemsTable->field_116D8[21];
5173 v256 = 10;//pItemsTable->field_116D8[20]; 4844 v256 = 10;//pItemsTable->field_116D8[20];
5174 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); 4845 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1);
5175 _this->uItemID |= 0x20u; 4846 _this->uItemID |= 0x20u;
5176 4847
5177 _50C9A8_item_enchantment_timer = 256; 4848 _50C9A8_item_enchantment_timer = 256;
5178 LODWORD(v727) = 1; 4849 LODWORD(v727) = 1;
5220 v268 = *(int *)v267; 4891 v268 = *(int *)v267;
5221 *(int *)(v245 + 12) = v268; 4892 *(int *)(v245 + 12) = v268;
5222 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType 4893 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
5223 + 4]; 4894 + 4];
5224 if ( v264 >= v265 ) 4895 if ( v264 >= v265 )
5225 break; 4896 break;
5226 } 4897 }
5227 } 4898 }
5228 ++*(int *)(v245 + 12); 4899 ++*(int *)(v245 + 12);
5229 _this->uItemID |= 0x20u; 4900 _this->uItemID |= 0x20u;
5230 4901
5231 _50C9A8_item_enchantment_timer = 256; 4902 _50C9A8_item_enchantment_timer = 256;
5232 LODWORD(v727) = 1; 4903 LODWORD(v727) = 1;
5233 break; 4904 break;
5234 } 4905 }
5235 } 4906 }
5236 //v1 = 0; 4907 else
5237 if ( LODWORD(v727) == 0 ) 4908 {
5238 { 4909 if ( LODWORD(v727) == 0 )
5239 v317 = pGlobalTXT_LocalizationStrings[428]; 4910 {
5240 if ( v730 == 0 ) 4911 v317 = pGlobalTXT_LocalizationStrings[428];
5241 v317 = pGlobalTXT_LocalizationStrings[585]; 4912 if ( v730 == 0 )
5242 ShowStatusBarString(v317, 2u); 4913 v317 = pGlobalTXT_LocalizationStrings[585];
4914 ShowStatusBarString(v317, 2u);
4915 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4916 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
4917 pCastSpell->spellnum = 0;
4918 v318->PlaySound(SPEECH_43, 0);
4919 }
4920 }
4921 break;
4922 }
4923 case SPELL_WATER_TOWN_PORTAL:
4924 {
4925 amount = 10 * v2;
4926 if ( pPlayer->sMana < (signed int)uRequiredMana )
4927 break;
4928 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 )
4929 {
4930 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
5243 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 4931 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5244 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5245 pCastSpell->spellnum = 0; 4932 pCastSpell->spellnum = 0;
5246 v318->PlaySound(SPEECH_43, 0); 4933 continue;
5247 } 4934 }
5248 break; 4935 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID);
5249 } 4936 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0);
5250 v289 = (ItemGen *)&v244[36 * a2 + 532];
5251 _this = v289;
5252 v290 = v289->uItemID;
5253 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4;
5254 if ( v290 > 134
5255 || _this->uSpecEnchantmentType != 0
5256 || _this->uEnchantmentType != 0
5257 || _this->_bonus_strength != 0
5258 || (v291 = pItemsTable->pItems[v290].uEquipType) == 0
5259 || v291 == 1
5260 || v291 == 2
5261 || _this->Broken())
5262 {
5263 if ( LODWORD(v727) == 0 )
5264 {
5265 v317 = pGlobalTXT_LocalizationStrings[428];
5266 if ( v730 == 0 )
5267 v317 = pGlobalTXT_LocalizationStrings[585];
5268 ShowStatusBarString(v317, 2u);
5269 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5270 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5271 pCastSpell->spellnum = 0;
5272 v318->PlaySound(SPEECH_43, 0);
5273 }
5274 break;
5275 }
5276 if ( _this->GetValue() < 0x1C2 )
5277 uRequiredMana = 1;
5278 if ( rand() % 100 >= SHIDWORD(v733) )
5279 uRequiredMana = 1;
5280 if ( uRequiredMana != 0 )
5281 {
5282 dword_50C9D0 = 113;
5283 dword_50C9D4 = 0;
5284 dword_50C9D8 = 1;
5285
5286 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
5287 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5288 pCastSpell->spellnum = 0;
5289 continue;
5290 }
5291 v292 = *(char *)(LODWORD(v725) + 28);
5292 if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) )
5293 {
5294 v2 = v723;
5295 //v1 = 0;
5296
5297 dword_50C9D0 = 113;
5298 dword_50C9D4 = 0;
5299 dword_50C9D8 = 1;
5300
5301 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
5302 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5303 pCastSpell->spellnum = 0;
5304 continue;
5305 }
5306 if ( rand() % 100 >= 80 )
5307 {
5308 v297 = pItemsTable->pSpecialEnchantments_count;
5309 v294 = _this;
5310 v298 = 0;
5311 v725 = 0.0;
5312 HIDWORD(v733) = 0;
5313 if ( pItemsTable->pSpecialEnchantments_count > 0 )
5314 {
5315 v730 = (int)&v679;
5316 do
5317 {
5318 v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement);
5319 if ( !v299 || v299 == 1 )
5320 {
5321 v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]
5322 + v298 * 28);
5323 LODWORD(v725) += v300;
5324 if ( v300 )
5325 {
5326 v301 = v730;
5327 v730 += 4;
5328 *(int *)v301 = HIDWORD(v733);
5329 }
5330 }
5331 ++HIDWORD(v733);
5332 ++v298;
5333 }
5334 while ( SHIDWORD(v733) < v297 );
5335 }
5336 v302 = rand() % SLODWORD(v725);
5337 v303 = v679;
5338 v294->uSpecEnchantmentType = v679;
5339 v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4];
5340 v305 = v302 + 1;
5341 if ( v304 < v305 )
5342 {
5343 for ( jj = &v679; ; jj = (int *)v732 )
5344 {
5345 v307 = (int)(jj + 1);
5346 v732 = v307;
5347 v308 = *(int *)v307;
5348 v294->uSpecEnchantmentType = v308;
5349 v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4];
5350 if ( v304 >= v305 )
5351 break;
5352 }
5353 }
5354 ++v294->uSpecEnchantmentType;
5355 }
5356 else
5357 {
5358 v293 = rand();
5359 v294 = _this;
5360 v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType];
5361 _this->uEnchantmentType = 0;
5362 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1];
5363 ;
5364 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType
5365 + 1] )
5366 {
5367 ++v294->uEnchantmentType;
5368 if ( kk >= v295 )
5369 break;
5370 }
5371 v294->_bonus_strength = 10//pItemsTable->field_116D8[18]
5372 + rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1);
5373 }
5374 v294->uAttributes |= 0x20u;
5375 _50C9A8_item_enchantment_timer = 256;
5376 LODWORD(v727) = 1;
5377 break;
5378 }
5379 case SPELL_WATER_TOWN_PORTAL:
5380 {
5381 amount = 10 * v2;
5382 if ( pPlayer->sMana < (signed int)uRequiredMana )
5383 break;
5384 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 )
5385 {
5386 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
5387 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5388 pCastSpell->spellnum = 0;
5389 continue;
5390 }
5391 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID);
5392 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0);
5393 LODWORD(v727) = 1;
5394 break;
5395 }
5396 case SPELL_WATER_LLOYDS_BEACON:
5397 {
5398 LODWORD(v733) = 604800 * v2;
5399 if ( !_strcmpi(pCurrentMapName, "d05.blv") )
5400 {
5401 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
5402 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5403 pCastSpell->spellnum = 0;
5404 continue;
5405 }
5406 v319 = uRequiredMana;
5407 if ( pPlayer->sMana >= (signed int)uRequiredMana )
5408 {
5409 pEventTimer->Pause();
5410 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0);
5411 qword_506350 = (signed int)v733;
5412 _506348_current_lloyd_playerid = pCastSpell->uPlayerID;
5413 ::uRequiredMana = v319;
5414 ::sRecoveryTime = sRecoveryTime;
5415 dword_50633C = pCastSpell->sound_id;
5416 dword_506338 = pCastSpell->spellnum;
5417 LOBYTE(pCastSpell->field_8) |= 0x20u;
5418 }
5419 break;
5420 }
5421 case SPELL_EARTH_STONE_TO_FLESH:
5422 {
5423 __debugbreak(); // missing GM ?
5424 if ( v731 == 1 || v731 == 2)
5425 amount = 3600 * v2;
5426 if ( v731 == 3 )
5427 amount = 86400 * v2;
5428 //LABEL_634:
5429 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5430 break;
5431 v323 = pCastSpell->uPlayerID_2;
5432 v324 = (char *)&pParty->pPlayers[v323].pConditions[15];
5433 if ( !pParty->pPlayers[v323].pConditions[15] )
5434 {
5435 LODWORD(v727) = 1; 4937 LODWORD(v727) = 1;
5436 break; 4938 break;
5437 } 4939 }
5438 if ( v731 == 4 ) 4940 case SPELL_WATER_LLOYDS_BEACON:
5439 { 4941 {
5440 *(int *)v324 = 0; 4942 LODWORD(v733) = 604800 * v2;
5441 *((int *)v324 + 1) = 0; 4943 if ( !_strcmpi(pCurrentMapName, "d05.blv") )
4944 {
4945 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
4946 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4947 pCastSpell->spellnum = 0;
4948 continue;
4949 }
4950 v319 = uRequiredMana;
4951 if ( pPlayer->sMana >= (signed int)uRequiredMana )
4952 {
4953 pEventTimer->Pause();
4954 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0);
4955 qword_506350 = (signed int)v733;
4956 _506348_current_lloyd_playerid = pCastSpell->uPlayerID;
4957 ::uRequiredMana = v319;
4958 ::sRecoveryTime = sRecoveryTime;
4959 dword_50633C = pCastSpell->sound_id;
4960 dword_506338 = pCastSpell->spellnum;
4961 LOBYTE(pCastSpell->field_8) |= 0x20u;
4962 }
4963 break;
4964 }
4965 case SPELL_EARTH_STONE_TO_FLESH:
4966 {
4967 __debugbreak(); // missing GM ?
4968 switch (v731)
4969 {
4970 case 1: amount = 3600 * v2; break;
4971 case 2: amount = 3600 * v2; break;
4972 case 3: amount = 86400 * v2; break;
4973 case 4: break;
4974 default:
4975 assert(false);
4976 }
4977 //LABEL_634:
4978 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4979 break;
4980 v323 = pCastSpell->uPlayerID_2;
4981 v324 = (char *)&pParty->pPlayers[v323].pConditions[15];
4982 if ( !pParty->pPlayers[v323].pConditions[15] )
4983 {
4984 LODWORD(v727) = 1;
4985 break;
4986 }
4987 if ( v731 == 4 )
4988 {
4989 *(int *)v324 = 0;
4990 *((int *)v324 + 1) = 0;
4991 LODWORD(v727) = 1;
4992 break;
4993 }
4994 v732 = amount << 7;
4995 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
4996 v656 = 15;
4997 v325 = &pParty->pPlayers[v323];
4998 v325->DiscardConditionIfLastsLongerThan(v656, v663);
5442 LODWORD(v727) = 1; 4999 LODWORD(v727) = 1;
5443 break; 5000 break;
5444 } 5001 }
5445 v732 = amount << 7;
5446 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
5447 v656 = 15;
5448 v325 = &pParty->pPlayers[v323];
5449 v325->DiscardConditionIfLastsLongerThan(v656, v663);
5450 LODWORD(v727) = 1;
5451 break;
5452 }
5453 case SPELL_EARTH_ROCK_BLAST: 5002 case SPELL_EARTH_ROCK_BLAST:
5454 { 5003 {
5455 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5004 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5456 break; 5005 break;
5457 pSpellSprite.stru_24.Reset(); 5006 pSpellSprite.stru_24.Reset();
5458 pSpellSprite.spell_id = pCastSpell->spellnum; 5007 pSpellSprite.spell_id = pCastSpell->spellnum;
5459 pSpellSprite.spell_level = v2; 5008 pSpellSprite.spell_level = v2;
5460 pSpellSprite.spell_skill = v731; 5009 pSpellSprite.spell_skill = v731;
5461 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 5010 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
5462 pSpellSprite.vPosition.y = pParty->vPosition.y; 5011 pSpellSprite.vPosition.y = pParty->vPosition.y;
5463 pSpellSprite.vPosition.x = pParty->vPosition.x; 5012 pSpellSprite.vPosition.x = pParty->vPosition.x;
5464 pSpellSprite.uAttributes = 0; 5013 pSpellSprite.uAttributes = 0;
5465 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; 5014 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
5466 pSpellSprite.uSectorID = pIndoor->GetSector( 5015 pSpellSprite.uSectorID = pIndoor->GetSector(
5467 pParty->vPosition.x, 5016 pParty->vPosition.x,
5468 pParty->vPosition.y, 5017 pParty->vPosition.y,
5469 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); 5018 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
5470 pSpellSprite.uSpriteFrameID = 0; 5019 pSpellSprite.uSpriteFrameID = 0;
5471 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 5020 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
5472 pSpellSprite.spell_target_pid = a2; 5021 pSpellSprite.spell_target_pid = a2;
5473 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); 5022 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
5474 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); 5023 pSpellSprite.uFacing = LOWORD(pParty->sRotationY);
5475 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 5024 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
5476 if ( pParty->bTurnBasedModeOn == 1 ) 5025 if ( pParty->bTurnBasedModeOn == 1 )
5477 LOBYTE(pSpellSprite.uAttributes) |= 4u; 5026 LOBYTE(pSpellSprite.uAttributes) |= 4u;
5478 5027
5479 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; 5028 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
5480 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) 5029 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
5481 ++pTurnEngine->field_1C; 5030 ++pTurnEngine->field_1C;
5482 LODWORD(v727) = 1;
5483 break;
5484 }
5485 case SPELL_EARTH_DEATH_BLOSSOM:
5486 {
5487 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
5488 {
5489 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
5490 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5491 pCastSpell->spellnum = 0;
5492 continue;
5493 }
5494 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5495 break;
5496 pSpellSprite.uType = 4090;
5497 pSpellSprite.stru_24.Reset();
5498 pSpellSprite.spell_id = pCastSpell->spellnum;
5499 pSpellSprite.spell_level = v2;
5500 pSpellSprite.spell_skill = v731;
5501 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
5502 pSpellSprite.vPosition.x = pParty->vPosition.x;
5503 pSpellSprite.vPosition.y = pParty->vPosition.y;
5504 pSpellSprite.uAttributes = 0;
5505 pSpellSprite.uSectorID = 0;
5506 pSpellSprite.uSpriteFrameID = 0;
5507 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
5508 pSpellSprite.field_60_distance_related_prolly_lod = 0;
5509 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
5510 pSpellSprite.spell_target_pid = a2;
5511 pSpellSprite.uFacing = LOWORD(pParty->sRotationY);
5512 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
5513 if ( pParty->bTurnBasedModeOn == 1 )
5514 pSpellSprite.uAttributes = 4;
5515
5516 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
5517 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 )
5518 ++pTurnEngine->field_1C;
5519 LODWORD(v727) = 1;
5520 break;
5521 }
5522 case SPELL_SPIRIT_DETECT_LIFE:
5523 {
5524 v328 = v731 - 2;
5525 if ( v328 )
5526 {
5527 v329 = v328 - 1;
5528 if ( v329 && v329 != 1 )
5529 v330 = 600 * v2;
5530 else
5531 v330 = 3600 * v2;
5532 }
5533 else
5534 {
5535 v330 = 1800 * v2;
5536 }
5537 LODWORD(v733) = v330;
5538 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5539 break;
5540 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
5541 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
5542 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
5543 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
5544
5545 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);
5546 LODWORD(v727) = 1;
5547 break;
5548 }
5549 case SPELL_SPIRIT_FATE:
5550 {
5551 LODWORD(v733) = 300;
5552 if ( v731 == 1 )
5553 amount = v2;
5554 else if( v731 == 2 )
5555 amount = 2 * v2;
5556 else if( v731 == 3 )
5557 amount = 4 * v2;
5558 else if( v731 == 4)
5559 amount = 6 * v2;
5560 //LABEL_667:
5561 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5562 break;
5563 v342 = pCastSpell->spell_target_pid;
5564 if ( v342 == 0 )
5565 {
5566 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5567
5568 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0);
5569 LODWORD(v727) = 1; 5031 LODWORD(v727) = 1;
5570 break; 5032 break;
5571 } 5033 }
5572 if (PID_TYPE(v342) == OBJECT_Actor) 5034 case SPELL_EARTH_DEATH_BLOSSOM:
5573 { 5035 {
5574 v343 = PID_ID(v342); 5036 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
5575 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32); 5037 {
5576 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280; 5038 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
5577 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0); 5039 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5578 BYTE2(pActors[v343].uAttributes) |= 8u; 5040 pCastSpell->spellnum = 0;
5579 //v672 = 0; 5041 continue;
5580 v661 = &pActors[v343]; 5042 }
5581 //LABEL_165: 5043 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5582 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0); 5044 break;
5583 } 5045 pSpellSprite.uType = 4090;
5584 LODWORD(v727) = 1; 5046 pSpellSprite.stru_24.Reset();
5585 break; 5047 pSpellSprite.spell_id = pCastSpell->spellnum;
5586 } 5048 pSpellSprite.spell_level = v2;
5587 case SPELL_SPIRIT_REMOVE_CURSE: 5049 pSpellSprite.spell_skill = v731;
5588 { 5050 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
5589 if ( v731 == 1 || v731 == 2 ) 5051 pSpellSprite.vPosition.x = pParty->vPosition.x;
5590 amount = 3600 * v2; 5052 pSpellSprite.vPosition.y = pParty->vPosition.y;
5591 else if( v731 == 3) 5053 pSpellSprite.uAttributes = 0;
5592 amount = 86400 * v2; 5054 pSpellSprite.uSectorID = 0;
5593 else if ( v731 == 4 ) 5055 pSpellSprite.uSpriteFrameID = 0;
5594 amount = 0; 5056 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
5595 //LABEL_679: 5057 pSpellSprite.field_60_distance_related_prolly_lod = 0;
5596 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5058 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
5597 break; 5059 pSpellSprite.spell_target_pid = a2;
5598 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; 5060 pSpellSprite.uFacing = LOWORD(pParty->sRotationY);
5599 if ( !v351->pConditions[0] ) 5061 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
5600 { 5062 if ( pParty->bTurnBasedModeOn == 1 )
5601 LODWORD(v727) = 1; 5063 pSpellSprite.uAttributes = 4;
5602 break; 5064
5603 } 5065 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
5604 if ( v731 == 4 ) 5066 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 )
5605 { 5067 ++pTurnEngine->field_1C;
5606 LODWORD(v351->pConditions[0]) = 0;
5607 HIDWORD(v351->pConditions[0]) = 0;
5608 }
5609 else
5610 {
5611 v732 = amount << 7;
5612 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
5613 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) )
5614 {
5615 LODWORD(v727) = 1; 5068 LODWORD(v727) = 1;
5616 break; 5069 break;
5617 } 5070 }
5618 } 5071 case SPELL_SPIRIT_DETECT_LIFE:
5619 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); 5072 {
5620 LODWORD(v727) = 1; 5073 v328 = v731 - 2;
5621 break; 5074 if ( v328 )
5622 } 5075 {
5623 case SPELL_SPIRIT_PRESERVATION: 5076 v329 = v328 - 1;
5624 { 5077 if ( v329 && v329 != 1 )
5625 v354 = v731 - 2; 5078 v330 = 600 * v2;
5626 if ( v354 && (v355 = v354 - 1) != 0 && v355 == 1 ) 5079 else
5627 v356 = 900 * (v2 + 4); 5080 v330 = 3600 * v2;
5628 else
5629 v356 = 300 * (v2 + 12);
5630 LODWORD(v733) = v356;
5631 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5632 break;
5633 if ( v731 == 1 || v731 == 2 )
5634 {
5635 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5636
5637 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);
5638 LODWORD(v727) = 1;
5639 break;
5640 }
5641 a2 = 0;
5642 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
5643 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11];
5644 do
5645 {
5646 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
5647 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0);
5648 ++a2;
5649 ++v357;// = (SpellBuff *)((char *)v357 + 6972);
5650 }
5651 while ( v357 <= &pParty->pPlayers[3] );
5652 LODWORD(v727) = 1;
5653 break;
5654 }
5655 case SPELL_SPIRIT_TURN_UNDEAD:
5656 {
5657 v364 = v731 - 2;
5658 if ( !v364 || (v365 = v364 - 1) != 0 && v365 != 1 )
5659 v366 = 60 * (v2 + 3);
5660 else
5661 v366 = 300 * v2 + 180;
5662 LODWORD(v733) = v366;
5663 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5664 break;
5665 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
5666 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u);
5667 ++pSpellSprite.uType;
5668 pSpellSprite.stru_24.Reset();
5669 pSpellSprite.spell_id = pCastSpell->spellnum;
5670 pSpellSprite.spell_level = v2;
5671 pSpellSprite.spell_skill = v731;
5672 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
5673 pSpellSprite.uAttributes = 0;
5674 pSpellSprite.uSectorID = 0;
5675 pSpellSprite.uSpriteFrameID = 0;
5676 pSpellSprite.field_60_distance_related_prolly_lod = 0;
5677 pSpellSprite.uFacing = 0;
5678 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
5679 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
5680 for ( a2 = 0; a2 < (signed int)_v726; ++a2 )
5681 {
5682 v369 = &pActors[dword_50BF30[a2]];
5683 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
5684 {
5685 pSpellSprite.vPosition.x = v369->vPosition.x;
5686 pSpellSprite.vPosition.y = v369->vPosition.y;
5687 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548);
5688
5689 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
5690 pSpellSprite.Create(0, 0, 0, 0);
5691 v369->pActorBuffs[4].Apply(
5692 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335),
5693 v731, 0, 0, 0);
5694 }
5695 }
5696 LODWORD(v727) = 1;
5697 }
5698 break;
5699
5700 case SPELL_SPIRIT_RAISE_DEAD:
5701 {
5702 v371 = v731 - 2;
5703 if ( v371 && (v372 = v371 - 1) != 0 && v372 == 1 )
5704 amount = 0;
5705 else
5706 amount = 86400 * v2;
5707 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5708 break;
5709 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536);
5710 v373 = pCastSpell->uPlayerID_2;
5711 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) )
5712 {
5713 LODWORD(v727) = 1;
5714 break;
5715 }
5716 v14 = v731 == 4;
5717 pParty->pPlayers[v373].sHealth = 1;
5718 if ( v14 )
5719 {
5720 v374 = pCastSpell->uPlayerID_2;
5721 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0;
5722 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0;
5723 v376 = pCastSpell->uPlayerID_2;
5724 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0;
5725 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0;
5726 }
5727 else
5728 {
5729 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
5730 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
5731 0xEu,
5732 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5733 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
5734 0xDu,
5735 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5736 }
5737 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5738 v377->SetCondition(1, 0);
5739 LODWORD(v727) = 1;
5740 break;
5741 }
5742 case SPELL_SPIRIT_SHARED_LIFE:
5743 {
5744 v378 = v731 - 2;
5745 if ( v378 && (v379 = v378 - 1) != 0 && v379 == 1 )
5746 v380 = 4 * v2;
5747 else
5748 v380 = 3 * v2;
5749 amount = v380;
5750 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5751 break;
5752 v381 = 0;
5753 HIDWORD(v733) = amount;
5754 v730 = 0;
5755 v382 = 1;
5756 do
5757 {
5758 v383 = pPlayers[v382];
5759 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] )
5760 v682[v381++] = v382;
5761 ++v382;
5762 }
5763 while ( v382 <= 4 );
5764 v384 = 0;
5765 v730 = v381;
5766 if ( v381 > 0 )
5767 {
5768 do
5769 HIDWORD(v733) += pPlayers[v682[v384++]]->sHealth;
5770 while ( v384 < v381 );
5771 }
5772 v732 = (signed __int64)((double)SHIDWORD(v733) / (double)v730);
5773 HIDWORD(v733) = 0;
5774 if ( v381 > 0 )
5775 {
5776 do
5777 {
5778 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]];
5779 v726 = pPlayers[v682[HIDWORD(v733)]];
5780 v726->sHealth = v732;
5781 //v386 = v726->GetMaxHealth();
5782 if ( v726->sHealth > v726->GetMaxHealth())
5783 v726->sHealth = v726->GetMaxHealth();
5784 if ( v726->sHealth > 0 )
5785 {
5786 v726->pConditions[Player::Condition_Unconcious] = 0;
5787 }
5788 v388 = HIDWORD(v733);
5789
5790 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1);
5791 HIDWORD(v733) = v388 + 1;
5792 }
5793 while ( v388 + 1 < v730 );
5794 }
5795 LODWORD(v727) = 1;
5796 break;
5797 }
5798 case SPELL_SPIRIT_RESSURECTION:
5799 {
5800 v392 = v731 - 1;
5801 if ( v731 == 1 )
5802 amount = 180 * v2;
5803 else if ( v731 == 2 )
5804 amount = 10800 * v2;
5805 else if ( v731 == 3 )
5806 amount = 259200 * v2;
5807 else if ( v731 == 4 )
5808 amount = 0;
5809 //LABEL_751:
5810 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5811 break;
5812 v396 = pCastSpell->uPlayerID_2;
5813 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16])
5814 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) )
5815 {
5816 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) )
5817 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0);
5818 if ( v731 == 4 )
5819 {
5820 v397 = pCastSpell->uPlayerID_2;
5821 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
5822 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
5823 v398 = pCastSpell->uPlayerID_2;
5824 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
5825 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
5826 v399 = pCastSpell->uPlayerID_2;
5827 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
5828 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
5829 } 5081 }
5830 else 5082 else
5831 { 5083 {
5832 *(float *)&a2 = (double)(amount << 7) * 0.033333335; 5084 v330 = 1800 * v2;
5833 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, 5085 }
5834 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); 5086 LODWORD(v733) = v330;
5835 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, 5087 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5836 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); 5088 break;
5837 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, 5089 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
5838 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); 5090 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
5839 } 5091 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
5840 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1); 5092 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
5841 5093
5842 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1; 5094 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);
5843
5844 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5845 }
5846 LODWORD(v727) = 1;
5847 break;
5848 }
5849 case SPELL_MIND_CURE_PARALYSIS:
5850 {
5851 if ( v731 == 1 || v731 == 2 )
5852 amount = 3600 * v2;
5853 else if ( v731 == 4 )
5854 amount = 0;
5855 else if( v731 == 3 )
5856 amount = 86400 * v2;
5857 //LABEL_768:
5858 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5859 break;
5860
5861 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5862 v323 = pCastSpell->uPlayerID_2;
5863 v324 = (char *)&pParty->pPlayers[v323].pConditions[12];
5864 if ( !pParty->pPlayers[v323].pConditions[12] )
5865 {
5866 LODWORD(v727) = 1;
5867 break;
5868 }
5869 if ( v731 == 4 )
5870 {
5871 *(int *)v324 = 0;
5872 *((int *)v324 + 1) = 0;
5873 LODWORD(v727) = 1; 5095 LODWORD(v727) = 1;
5874 break; 5096 break;
5875 } 5097 }
5876 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); 5098 case SPELL_SPIRIT_FATE:
5877 v656 = 12; 5099 {
5878 v325 = &pParty->pPlayers[v323]; 5100 switch (v731)
5879 v325->DiscardConditionIfLastsLongerThan(v656, v663); 5101 {
5880 LODWORD(v727) = 1; 5102 case 1: amount = 1 * v2; break;
5881 break; 5103 case 2: amount = 2 * v2; break;
5882 } 5104 case 3: amount = 4 * v2; break;
5883 case SPELL_MIND_REMOVE_FEAR: 5105 case 4: amount = 6 * v2; break;
5884 { 5106 default:
5885 if( v731 == 1) 5107 assert(false);
5886 amount = 180 * v2; 5108 }
5887 else if( v731 == 2 ) 5109 LODWORD(v733) = 300;
5888 amount = 3600 * v2; 5110 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5889 else if( v731 == 3) 5111 break;
5890 amount = 86400 * v2; 5112 v342 = pCastSpell->spell_target_pid;
5891 else if( v731 == 4 ) 5113 if ( v342 == 0 )
5892 amount = 0; 5114 {
5893 //LABEL_780: 5115 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5894 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5116
5895 break; 5117 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0);
5896 5118 LODWORD(v727) = 1;
5897 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); 5119 break;
5898 v323 = pCastSpell->uPlayerID_2; 5120 }
5899 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; 5121 if (PID_TYPE(v342) == OBJECT_Actor)
5900 if ( !pParty->pPlayers[v323].pConditions[3] ) 5122 {
5901 { 5123 v343 = PID_ID(v342);
5902 LODWORD(v727) = 1; 5124 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32);
5903 break; 5125 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280;
5904 } 5126 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0);
5905 if ( v731 == 4 ) 5127 BYTE2(pActors[v343].uAttributes) |= 8u;
5906 { 5128 //v672 = 0;
5907 *(int *)v324 = 0; 5129 v661 = &pActors[v343];
5908 *((int *)v324 + 1) = 0; 5130 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0);
5131 }
5909 LODWORD(v727) = 1; 5132 LODWORD(v727) = 1;
5910 break; 5133 break;
5911 } 5134 }
5912 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); 5135 case SPELL_SPIRIT_REMOVE_CURSE:
5913 v656 = 3; 5136 {
5914 v325 = &pParty->pPlayers[v323]; 5137 switch (v731)
5915 v325->DiscardConditionIfLastsLongerThan(v656, v663); 5138 {
5916 LODWORD(v727) = 1; 5139 case 1: amount = 3600 * v2; break;
5917 break; 5140 case 2: amount = 3600 * v2; break;
5141 case 3: amount = 86400 * v2; break;
5142 case 4: amount = 0; break;
5143 default:
5144 assert(false);
5145 }
5146 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5147 break;
5148 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5149 if ( !v351->pConditions[0] )
5150 {
5151 LODWORD(v727) = 1;
5152 break;
5153 }
5154 if ( v731 == 4 )
5155 {
5156 LODWORD(v351->pConditions[0]) = 0;
5157 HIDWORD(v351->pConditions[0]) = 0;
5158 }
5159 else
5160 {
5161 v732 = amount << 7;
5162 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
5163 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) )
5164 {
5165 LODWORD(v727) = 1;
5166 break;
5167 }
5168 }
5169 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5170 LODWORD(v727) = 1;
5171 break;
5172 }
5173 case SPELL_SPIRIT_PRESERVATION:
5174 {
5175 if ( v731 == 4 )
5176 LODWORD(v733) = 900 * (v2 + 4);
5177 else
5178 LODWORD(v733) = 300 * (v2 + 12);
5179 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5180 break;
5181 if ( v731 == 1 || v731 == 2 )
5182 {
5183 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5184 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);
5185 LODWORD(v727) = 1;
5186 break;
5187 }
5188 a2 = 0;
5189 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
5190 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11];
5191 do
5192 {
5193 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
5194 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0);
5195 ++a2;
5196 ++v357;// = (SpellBuff *)((char *)v357 + 6972);
5197 }
5198 while ( v357 <= &pParty->pPlayers[3] );
5199 LODWORD(v727) = 1;
5200 break;
5201 }
5202 case SPELL_SPIRIT_TURN_UNDEAD:
5203 {
5204 if ( v731 == 1 || v731 == 2)
5205 LODWORD(v733) = 60 * (v2 + 3);
5206 else
5207 LODWORD(v733) = 300 * v2 + 180;
5208 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5209 break;
5210 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
5211 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u);
5212 ++pSpellSprite.uType;
5213 pSpellSprite.stru_24.Reset();
5214 pSpellSprite.spell_id = pCastSpell->spellnum;
5215 pSpellSprite.spell_level = v2;
5216 pSpellSprite.spell_skill = v731;
5217 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
5218 pSpellSprite.uAttributes = 0;
5219 pSpellSprite.uSectorID = 0;
5220 pSpellSprite.uSpriteFrameID = 0;
5221 pSpellSprite.field_60_distance_related_prolly_lod = 0;
5222 pSpellSprite.uFacing = 0;
5223 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
5224 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
5225 for ( a2 = 0; a2 < (signed int)_v726; ++a2 )
5226 {
5227 v369 = &pActors[dword_50BF30[a2]];
5228 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
5229 {
5230 pSpellSprite.vPosition.x = v369->vPosition.x;
5231 pSpellSprite.vPosition.y = v369->vPosition.y;
5232 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548);
5233
5234 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
5235 pSpellSprite.Create(0, 0, 0, 0);
5236 v369->pActorBuffs[4].Apply(
5237 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335),
5238 v731, 0, 0, 0);
5239 }
5240 }
5241 LODWORD(v727) = 1;
5242 break;
5243 }
5244 case SPELL_SPIRIT_RAISE_DEAD:
5245 {
5246 if ( v731 == 4 )
5247 amount = 0;
5248 else
5249 amount = 86400 * v2;
5250 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5251 break;
5252 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536);
5253 v373 = pCastSpell->uPlayerID_2;
5254 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) )
5255 {
5256 LODWORD(v727) = 1;
5257 break;
5258 }
5259 v14 = v731 == 4;
5260 pParty->pPlayers[v373].sHealth = 1;
5261 if ( v14 )
5262 {
5263 v374 = pCastSpell->uPlayerID_2;
5264 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0;
5265 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0;
5266 v376 = pCastSpell->uPlayerID_2;
5267 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0;
5268 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0;
5269 }
5270 else
5271 {
5272 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
5273 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
5274 0xEu,
5275 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5276 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
5277 0xDu,
5278 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5279 }
5280 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5281 v377->SetCondition(1, 0);
5282 LODWORD(v727) = 1;
5283 break;
5284 }
5285 case SPELL_SPIRIT_SHARED_LIFE:
5286 {
5287 if ( v731 == 4 )
5288 amount = 4 * v2;
5289 else
5290 amount = 3 * v2;
5291 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5292 break;
5293 v381 = 0;
5294 HIDWORD(v733) = amount;
5295 v730 = 0;
5296 v382 = 1;
5297 do
5298 {
5299 v383 = pPlayers[v382];
5300 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] )
5301 v682[v381++] = v382;
5302 ++v382;
5303 }
5304 while ( v382 <= 4 );
5305 v384 = 0;
5306 v730 = v381;
5307 if ( v381 > 0 )
5308 {
5309 do
5310 HIDWORD(v733) += pPlayers[v682[v384++]]->sHealth;
5311 while ( v384 < v381 );
5312 }
5313 v732 = (signed __int64)((double)SHIDWORD(v733) / (double)v730);
5314 HIDWORD(v733) = 0;
5315 if ( v381 > 0 )
5316 {
5317 do
5318 {
5319 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]];
5320 v726 = pPlayers[v682[HIDWORD(v733)]];
5321 v726->sHealth = v732;
5322 //v386 = v726->GetMaxHealth();
5323 if ( v726->sHealth > v726->GetMaxHealth())
5324 v726->sHealth = v726->GetMaxHealth();
5325 if ( v726->sHealth > 0 )
5326 {
5327 v726->pConditions[Player::Condition_Unconcious] = 0;
5328 }
5329 v388 = HIDWORD(v733);
5330
5331 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1);
5332 HIDWORD(v733) = v388 + 1;
5333 }
5334 while ( v388 + 1 < v730 );
5335 }
5336 LODWORD(v727) = 1;
5337 break;
5338 }
5339 case SPELL_SPIRIT_RESSURECTION:
5340 {
5341 switch (v731)
5342 {
5343 case 1: amount = 180 * v2; break;
5344 case 2: amount = 10800 * v2; break;
5345 case 3: amount = 259200 * v2; break;
5346 case 4: amount = 0; break;
5347 default:
5348 assert(false);
5349 }
5350 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5351 break;
5352 v396 = pCastSpell->uPlayerID_2;
5353 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16])
5354 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) )
5355 {
5356 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) )
5357 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0);
5358 if ( v731 == 4 )
5359 {
5360 v397 = pCastSpell->uPlayerID_2;
5361 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
5362 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
5363 v398 = pCastSpell->uPlayerID_2;
5364 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
5365 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
5366 v399 = pCastSpell->uPlayerID_2;
5367 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
5368 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
5369 }
5370 else
5371 {
5372 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
5373 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u,
5374 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5375 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu,
5376 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5377 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu,
5378 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5379 }
5380 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1);
5381 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1;
5382 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5383 }
5384 LODWORD(v727) = 1;
5385 break;
5386 }
5387 case SPELL_MIND_CURE_PARALYSIS:
5388 {
5389 switch (v731)
5390 {
5391 case 1: amount = 3600 * v2; break;
5392 case 2: amount = 3600 * v2; break;
5393 case 3: amount = 86400 * v2; break;
5394 case 4: amount = 0; break;
5395 default:
5396 assert(false);
5397 }
5398 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5399 break;
5400
5401 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5402 v323 = pCastSpell->uPlayerID_2;
5403 v324 = (char *)&pParty->pPlayers[v323].pConditions[12];
5404 if ( !pParty->pPlayers[v323].pConditions[12] )
5405 {
5406 LODWORD(v727) = 1;
5407 break;
5408 }
5409 if ( v731 == 4 )
5410 {
5411 *(int *)v324 = 0;
5412 *((int *)v324 + 1) = 0;
5413 LODWORD(v727) = 1;
5414 break;
5415 }
5416 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
5417 v656 = 12;
5418 v325 = &pParty->pPlayers[v323];
5419 v325->DiscardConditionIfLastsLongerThan(v656, v663);
5420 LODWORD(v727) = 1;
5421 break;
5422 }
5423 case SPELL_MIND_REMOVE_FEAR:
5424 {
5425 switch (v731)
5426 {
5427 case 1: amount = 180 * v2; break;
5428 case 2: amount = 3600 * v2; break;
5429 case 3: amount = 86400 * v2; break;
5430 case 4: amount = 0; break;
5431 default:
5432 assert(false);
5433 }
5434
5435 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5436 break;
5437
5438 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5439 v323 = pCastSpell->uPlayerID_2;
5440 v324 = (char *)&pParty->pPlayers[v323].pConditions[3];
5441 if ( !pParty->pPlayers[v323].pConditions[3] )
5442 {
5443 LODWORD(v727) = 1;
5444 break;
5445 }
5446 if ( v731 == 4 )
5447 {
5448 *(int *)v324 = 0;
5449 *((int *)v324 + 1) = 0;
5450 LODWORD(v727) = 1;
5451 break;
5452 }
5453 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
5454 v656 = 3;
5455 v325 = &pParty->pPlayers[v323];
5456 v325->DiscardConditionIfLastsLongerThan(v656, v663);
5457 LODWORD(v727) = 1;
5458 break;
5918 } 5459 }
5919 case SPELL_MIND_TELEPATHY: 5460 case SPELL_MIND_TELEPATHY:
5920 { 5461 {
5921 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5462 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5922 break; 5463 break;
5957 if ( v420 >= 4 ) 5498 if ( v420 >= 4 )
5958 break; 5499 break;
5959 } 5500 }
5960 if ( v420 < 4 ) 5501 if ( v420 < 4 )
5961 { 5502 {
5962 memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683)); 5503 memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683));
5963 v2 = v723; 5504 v2 = v723;
5964 //v1 = 0; 5505 //v1 = 0;
5965 } 5506 }
5966 } 5507 }
5967 // LABEL_799: 5508 // LABEL_799:
5968 if ( HIDWORD(v733) != 0 ) 5509 if ( HIDWORD(v733) != 0 )
5969 { 5510 {
6053 LODWORD(v727) = 1; 5594 LODWORD(v727) = 1;
6054 break; 5595 break;
6055 } 5596 }
6056 case SPELL_MIND_BERSERK: 5597 case SPELL_MIND_BERSERK:
6057 { 5598 {
6058 v423 = v731 - 2; 5599 switch (v731)
6059 if ( !v423 ) 5600 {
6060 v425 = 300 * v2; 5601 case 1: amount = 300 * v2; break;
6061 else 5602 case 2: amount = 300 * v2; break;
6062 { 5603 case 3: amount = 600 * v2; break;
6063 v424 = v423 - 1; 5604 case 4: amount = 3600; break;
6064 if ( v424 ) 5605 default:
6065 { 5606 assert(false);
6066 if ( v424 == 1 ) 5607 }
6067 v425 = 3600 * v2;
6068 else
6069 //LABEL_813:
6070 v425 = 300 * v2;
6071 }
6072 else
6073 {
6074 v425 = 600 * v2;
6075 }
6076 }
6077 amount = v425;
6078 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5608 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6079 break; 5609 break;
6080 v426 = PID_ID(a2); 5610 v426 = PID_ID(a2);
6081 if (PID_TYPE(a2) != OBJECT_Actor) 5611 if (PID_TYPE(a2) != OBJECT_Actor)
6082 { 5612 {
6173 LODWORD(v727) = 1; 5703 LODWORD(v727) = 1;
6174 break; 5704 break;
6175 } 5705 }
6176 case SPELL_MIND_MASS_FEAR: 5706 case SPELL_MIND_MASS_FEAR:
6177 { 5707 {
6178 v428 = v731 - 2;
6179 if ( v428 && (v429 = v428 - 1) != 0 && v429 == 1 )
6180 v430 = 300 * v2;
6181 else
6182 v430 = 180 * v2;
6183 amount = v430;
6184 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6185 break;
6186 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
6187 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u);
6188 ++pSpellSprite.uType;
6189 pSpellSprite.stru_24.Reset();
6190 pSpellSprite.spell_id = pCastSpell->spellnum;
6191 pSpellSprite.spell_level = v2;
6192 pSpellSprite.spell_skill = v731;
6193 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
6194 pSpellSprite.uAttributes = 0;
6195 pSpellSprite.uSectorID = 0;
6196 pSpellSprite.uSpriteFrameID = 0;
6197 pSpellSprite.field_60_distance_related_prolly_lod = 0;
6198 pSpellSprite.uFacing = 0;
6199 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
6200 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
6201 for ( a2 = 0; a2 < (signed int)_v726; ++a2 )
6202 {
6203 v433 = &pActors[dword_50BF30[a2]];
6204 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
6205 break;
6206 pSpellSprite.vPosition.x = v433->vPosition.x;
6207 pSpellSprite.vPosition.y = v433->vPosition.y;
6208 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548);
6209
6210 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
6211 pSpellSprite.Create(0, 0, 0, 0);
6212 if ( stru_50C198.GetMagicalResistance(v433, 7u) )
6213 {
6214 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335),
6215 v731, 0, 0, 0);
6216 }
6217 }
6218 LODWORD(v727) = 1;
6219 break;
6220 }
6221
6222 case SPELL_MIND_CURE_INSANITY:
6223 {
6224 v435 = v731 - 2;
6225 if ( v435 && (v436 = v435 - 1) != 0 && v436 == 1 )
6226 amount = 0;
6227 else
6228 amount = 86400 * v2;
6229 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6230 break;
6231
6232 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
6233 v440 = pCastSpell->uPlayerID_2;
6234 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) )
6235 {
6236 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) )
6237 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0);
6238 if ( v731 == 4 ) 5708 if ( v731 == 4 )
6239 { 5709 amount = 300 * v2;
6240 v441 = pCastSpell->uPlayerID_2;
6241 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0;
6242 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0;
6243 }
6244 else 5710 else
6245 { 5711 amount = 180 * v2;
6246 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, 5712 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6247 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); 5713 break;
6248 } 5714 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
6249 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; 5715 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u);
6250 //LABEL_720: 5716 ++pSpellSprite.uType;
6251 v377->SetCondition(1, 0); 5717 pSpellSprite.stru_24.Reset();
6252 } 5718 pSpellSprite.spell_id = pCastSpell->spellnum;
6253 LODWORD(v727) = 1; 5719 pSpellSprite.spell_level = v2;
6254 break; 5720 pSpellSprite.spell_skill = v731;
6255 } 5721 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
6256 case SPELL_EARTH_TELEKINESIS: 5722 pSpellSprite.uAttributes = 0;
6257 { 5723 pSpellSprite.uSectorID = 0;
6258 if ( v731 == 1 || v731 == 2 ) 5724 pSpellSprite.uSpriteFrameID = 0;
6259 amount = 2 * v2; 5725 pSpellSprite.field_60_distance_related_prolly_lod = 0;
6260 else if( v731 == 3 ) 5726 pSpellSprite.uFacing = 0;
6261 amount = 3 * v2; 5727 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
6262 else if ( v731 == 4 ) 5728 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
6263 amount = 4 * v2; 5729 for ( a2 = 0; a2 < (signed int)_v726; ++a2 )
6264 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5730 {
6265 break; 5731 v433 = &pActors[dword_50BF30[a2]];
6266 v445 = PID_ID(a2); 5732 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
6267 if (PID_TYPE(a2) == OBJECT_Item) 5733 break;
6268 { 5734 pSpellSprite.vPosition.x = v433->vPosition.x;
6269 v449 = (char *)&pSpriteObjects[v445].stru_24; 5735 pSpellSprite.vPosition.y = v433->vPosition.y;
6270 v450 = *(int *)v449; 5736 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548);
6271 if ( pItemsTable->pItems[v450].uEquipType == 18 ) 5737
6272 { 5738 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
6273 party_finds_gold(*((int *)v449 + 3), 0); 5739 pSpellSprite.Create(0, 0, 0, 0);
6274 viewparams->bRedrawGameUI = 1; 5740 if ( stru_50C198.GetMagicalResistance(v433, 7u) )
6275 }
6276 else
6277 {
6278 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName);
6279 ShowStatusBarString(pTmpBuf2, 2u);
6280 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) )
6281 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24);
6282 }
6283 SpriteObject::OnInteraction(v445);
6284 }
6285 else
6286 {
6287 if (PID_TYPE(a2) == OBJECT_Actor)
6288 {
6289 stru_50C198.LootActor(&pActors[v445]);
6290 }
6291 else
6292 {
6293 if (PID_TYPE(a2) != OBJECT_Decoration)
6294 {
6295 if (PID_TYPE(a2) != OBJECT_BModel)
6296 { 5741 {
6297 LODWORD(v727) = 1; 5742 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335),
6298 break; 5743 v731, 0, 0, 0);
6299 } 5744 }
6300 dword_507CD8 = 1; 5745 }
6301 v677 = 1;
6302 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
6303 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID;
6304 else
6305 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID;
6306
6307 EventProcessor(v446, a2, v677);
6308 LODWORD(v727) = 1;
6309 break;
6310 }
6311 v447 = &pLevelDecorations[v445];
6312 dword_507CD8 = 1;
6313 v448 = v447->field_16_event_id;
6314 if (v448)
6315 {
6316 v677 = 1;
6317 v446 = v448;
6318 EventProcessor(v446, a2, v677);
6319 LODWORD(v727) = 1;
6320 break;
6321 }
6322 if ( v447->IsInteractive() )
6323 {
6324 activeLevelDecoration = v447;
6325 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1);
6326 activeLevelDecoration = NULL;
6327 }
6328 }
6329 }
6330 LODWORD(v727) = 1;
6331 break;
6332 }
6333 case SPELL_BODY_CURE_WEAKNESS:
6334 {
6335 if ( v731 == 1 )
6336 amount = 180 * v2;
6337 else if( v731 == 2 )
6338 amount = 3600 * v2;
6339 else if( v731 == 3 )
6340 amount = 86400 * v2;
6341 else if ( v731 == 4 )
6342 amount = 0;
6343 //LABEL_883:
6344 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6345 break;
6346
6347 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
6348 v323 = pCastSpell->uPlayerID_2;
6349 v324 = (char *)&pParty->pPlayers[v323].pConditions[1];
6350 if ( !pParty->pPlayers[v323].pConditions[1] )
6351 {
6352 LODWORD(v727) = 1; 5746 LODWORD(v727) = 1;
6353 break; 5747 break;
6354 } 5748 }
6355 if ( v731 == 4 ) 5749 case SPELL_MIND_CURE_INSANITY:
6356 { 5750 {
6357 *(int *)v324 = 0; 5751 v435 = v731 - 2;
6358 *((int *)v324 + 1) = 0; 5752 if ( v731 == 4 )
5753 amount = 0;
5754 else
5755 amount = 86400 * v2;
5756 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5757 break;
5758
5759 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5760 v440 = pCastSpell->uPlayerID_2;
5761 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) )
5762 {
5763 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) )
5764 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0);
5765 if ( v731 == 4 )
5766 {
5767 v441 = pCastSpell->uPlayerID_2;
5768 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0;
5769 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0;
5770 }
5771 else
5772 {
5773 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u,
5774 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
5775 }
5776 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5777 v377->SetCondition(1, 0);
5778 }
6359 LODWORD(v727) = 1; 5779 LODWORD(v727) = 1;
6360 break; 5780 break;
6361 } 5781 }
6362 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); 5782 case SPELL_EARTH_TELEKINESIS:
6363 v656 = 1; 5783 {
6364 v325 = &pParty->pPlayers[v323]; 5784 switch (v731)
6365 v325->DiscardConditionIfLastsLongerThan(v656, v663); 5785 {
6366 LODWORD(v727) = 1; 5786 case 1: amount = 2 * v2; break;
6367 break; 5787 case 2: amount = 2 * v2; break;
6368 } 5788 case 3: amount = 3 * v2; break;
6369 case SPELL_BODY_FIRST_AID: 5789 case 4: amount = 4 * v2; break;
6370 { 5790 default:
6371 v457 = v731 - 2; 5791 assert(false);
6372 if ( v457 ) 5792 }
6373 { 5793 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6374 v458 = v457 - 1; 5794 break;
6375 if ( v458 ) 5795 v445 = PID_ID(a2);
6376 { 5796 if (PID_TYPE(a2) == OBJECT_Item)
6377 if ( v458 == 1 ) 5797 {
6378 v459 = 5 * v2 + 5; 5798 v449 = (char *)&pSpriteObjects[v445].stru_24;
5799 v450 = *(int *)v449;
5800 if ( pItemsTable->pItems[v450].uEquipType == 18 )
5801 {
5802 party_finds_gold(*((int *)v449 + 3), 0);
5803 viewparams->bRedrawGameUI = 1;
5804 }
5805 else
5806 {
5807 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName);
5808 ShowStatusBarString(pTmpBuf2, 2u);
5809 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) )
5810 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24);
5811 }
5812 SpriteObject::OnInteraction(v445);
5813 }
6379 else 5814 else
6380 v459 = 2 * v2 + 5; 5815 {
6381 } 5816 if (PID_TYPE(a2) == OBJECT_Actor)
6382 else
6383 {
6384 v459 = 4 * v2 + 5;
6385 }
6386 }
6387 else
6388 {
6389 v459 = 3 * v2 + 5;
6390 }
6391 amount = v459;
6392 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6393 break;
6394 v460 = pCastSpell->spell_target_pid;
6395 if (!v460)
6396 {
6397 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount);
6398 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
6399 }
6400 else
6401 {
6402 if (PID_TYPE(v460) == OBJECT_Actor)
6403 {
6404 v461 = &pActors[PID_ID(v460)];
6405 v462 = v461->uAIState;
6406 v463 = v461->pMonsterInfo.uHP;
6407 if ( v462 != 5 )
6408 {
6409 if ( v462 != 4 )
6410 { 5817 {
6411 if ( v462 != 19 ) 5818 stru_50C198.LootActor(&pActors[v445]);
5819 }
5820 else
6412 { 5821 {
6413 if ( v462 != 11 ) 5822 if (PID_TYPE(a2) != OBJECT_Decoration)
6414 { 5823 {
6415 v461->sCurrentHP += amount; 5824 if (PID_TYPE(a2) != OBJECT_BModel)
6416 if ( v461->sCurrentHP > v463 ) 5825 {
6417 v461->sCurrentHP = v463; 5826 LODWORD(v727) = 1;
5827 break;
5828 }
5829 dword_507CD8 = 1;
5830 v677 = 1;
5831 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
5832 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID;
5833 else
5834 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID;
5835 EventProcessor(v446, a2, v677);
5836 LODWORD(v727) = 1;
5837 break;
5838 }
5839 v447 = &pLevelDecorations[v445];
5840 dword_507CD8 = 1;
5841 v448 = v447->field_16_event_id;
5842 if (v448)
5843 {
5844 v677 = 1;
5845 v446 = v448;
5846 EventProcessor(v446, a2, v677);
5847 LODWORD(v727) = 1;
5848 break;
5849 }
5850 if ( v447->IsInteractive() )
5851 {
5852 activeLevelDecoration = v447;
5853 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1);
5854 activeLevelDecoration = NULL;
6418 } 5855 }
6419 } 5856 }
6420 } 5857 }
6421 }
6422 }
6423 }
6424 LODWORD(v727) = 1;
6425 break;
6426 }
6427 case SPELL_BODY_CURE_POISON:
6428 {
6429 if ( v731 == 1 || v731 == 2 )
6430 amount = 3600 * v2;
6431 else if( v731 == 3)
6432 amount = 86400 * v2;
6433 else if ( v731 == 4 )
6434 amount = 0;
6435 //LABEL_912:
6436 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6437 break;
6438
6439 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
6440 v470 = pCastSpell->uPlayerID_2;
6441 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6]))
6442 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8]))
6443 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) )
6444 {
6445 LODWORD(v727) = 1; 5858 LODWORD(v727) = 1;
6446 break; 5859 break;
6447 } 5860 }
6448 if ( v731 == 4 ) 5861 case SPELL_BODY_CURE_WEAKNESS:
6449 { 5862 {
6450 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; 5863 switch (v731)
6451 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; 5864 {
6452 v471 = pCastSpell->uPlayerID_2; 5865 case 1: amount = 180 * v2; break;
6453 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; 5866 case 2: amount = 3600 * v2; break;
6454 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; 5867 case 3: amount = 86400 * v2; break;
6455 v472 = pCastSpell->uPlayerID_2; 5868 case 4: amount = 0; break;
6456 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; 5869 default:
6457 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; 5870 assert(false);
5871 }
5872 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5873 break;
5874
5875 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5876 v323 = pCastSpell->uPlayerID_2;
5877 v324 = (char *)&pParty->pPlayers[v323].pConditions[1];
5878 if ( !pParty->pPlayers[v323].pConditions[1] )
5879 {
5880 LODWORD(v727) = 1;
5881 break;
5882 }
5883 if ( v731 == 4 )
5884 {
5885 *(int *)v324 = 0;
5886 *((int *)v324 + 1) = 0;
5887 LODWORD(v727) = 1;
5888 break;
5889 }
5890 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
5891 v656 = 1;
5892 v325 = &pParty->pPlayers[v323];
5893 v325->DiscardConditionIfLastsLongerThan(v656, v663);
6458 LODWORD(v727) = 1; 5894 LODWORD(v727) = 1;
6459 break; 5895 break;
6460 } 5896 }
6461 *(float *)&a2 = (double)(amount << 7) * 0.033333335; 5897 case SPELL_BODY_FIRST_AID:
6462 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( 5898 {
6463 6u, 5899 switch (v731)
6464 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); 5900 {
6465 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 5901 case 1: amount = 2 * v2 + 5; break;
6466 8u, 5902 case 2: amount = 3 * v2 + 5; break;
6467 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); 5903 case 3: amount = 4 * v2 + 5; break;
6468 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); 5904 case 4: amount = 5 * v2 + 5; break;
6469 v656 = 10; 5905 default:
6470 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; 5906 assert(false);
6471 v325->DiscardConditionIfLastsLongerThan(v656, v663); 5907 }
6472 LODWORD(v727) = 1; 5908 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6473 break; 5909 break;
6474 } 5910 v460 = pCastSpell->spell_target_pid;
6475 case SPELL_BODY_PROTECTION_FROM_MAGIC: 5911 if (!v460)
6476 { 5912 {
6477 amount = v2; 5913 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount);
6478 LODWORD(v733) = 3600 * v2; 5914 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
6479 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5915 }
6480 break; 5916 else
6481 5917 {
6482 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); 5918 if (PID_TYPE(v460) == OBJECT_Actor)
6483 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); 5919 {
6484 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); 5920 v461 = &pActors[PID_ID(v460)];
6485 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); 5921 v462 = v461->uAIState;
6486 5922 v463 = v461->pMonsterInfo.uHP;
6487 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); 5923 if ( v462 != 5 )
5924 {
5925 if ( v462 != 4 )
5926 {
5927 if ( v462 != 19 )
5928 {
5929 if ( v462 != 11 )
5930 {
5931 v461->sCurrentHP += amount;
5932 if ( v461->sCurrentHP > v463 )
5933 v461->sCurrentHP = v463;
5934 }
5935 }
5936 }
5937 }
5938 }
5939 }
6488 LODWORD(v727) = 1; 5940 LODWORD(v727) = 1;
6489 break; 5941 break;
6490 } 5942 }
6491 case SPELL_BODY_HAMMERHANDS: 5943 case SPELL_BODY_CURE_POISON:
6492 { 5944 {
6493 LODWORD(v733) = 3600 * v2; 5945 switch (v731)
6494 amount = v2; 5946 {
6495 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5947 case 1: amount = 3600 * v2; break;
5948 case 2: amount = 3600 * v2; break;
5949 case 3: amount = 86400 * v2; break;
5950 case 4: amount = 0; break;
5951 default:
5952 assert(false);
5953 }
5954 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5955 break;
5956
5957 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5958 v470 = pCastSpell->uPlayerID_2;
5959 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6]))
5960 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8]))
5961 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) )
5962 {
5963 LODWORD(v727) = 1;
5964 break;
5965 }
5966 if ( v731 == 4 )
5967 {
5968 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0;
5969 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0;
5970 v471 = pCastSpell->uPlayerID_2;
5971 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0;
5972 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0;
5973 v472 = pCastSpell->uPlayerID_2;
5974 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0;
5975 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0;
5976 LODWORD(v727) = 1;
5977 break;
5978 }
5979 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
5980 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan(
5981 6u,
5982 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5983 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
5984 8u,
5985 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5986 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
5987 v656 = 10;
5988 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5989 v325->DiscardConditionIfLastsLongerThan(v656, v663);
5990 LODWORD(v727) = 1;
6496 break; 5991 break;
6497 if ( v731 == 4 ) 5992 }
6498 { 5993 case SPELL_BODY_PROTECTION_FROM_MAGIC:
5994 {
5995 amount = v2;
5996 LODWORD(v733) = 3600 * v2;
5997 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5998 break;
5999
6499 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); 6000 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
6500 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); 6001 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
6501 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); 6002 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
6502 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); 6003 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
6503 v732 = (int)v733 << 7; 6004
6504 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); 6005 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0);
6505 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
6506 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
6507 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
6508
6509 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0);
6510 LODWORD(v727) = 1; 6006 LODWORD(v727) = 1;
6511 break; 6007 break;
6512 } 6008 }
6513 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); 6009 case SPELL_BODY_HAMMERHANDS:
6514 6010 {
6515 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); 6011 LODWORD(v733) = 3600 * v2;
6012 amount = v2;
6013 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6014 break;
6015 if ( v731 == 4 )
6016 {
6017 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
6018 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
6019 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
6020 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
6021 v732 = (int)v733 << 7;
6022 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
6023 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
6024 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
6025 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
6026
6027 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0);
6028 LODWORD(v727) = 1;
6029 break;
6030 }
6031 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
6032
6033 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);
6516 LODWORD(v727) = 1; 6034 LODWORD(v727) = 1;
6517 break; 6035 break;
6518 } 6036 }
6519 case SPELL_BODY_CURE_DISEASE: 6037 case SPELL_BODY_CURE_DISEASE:
6520 { 6038 {
6521 v493 = v731 - 2; 6039 if ( v731 == 4 )
6522 if ( v493 && (v494 = v493 - 1) != 0 && v494 == 1 ) 6040 amount = 0;
6523 amount = 0; 6041 else
6524 else 6042 amount = 86400 * v2;
6525 amount = 86400 * v2; 6043 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6526 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6044 break;
6527 break; 6045
6528 6046 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
6529 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); 6047 v498 = pCastSpell->uPlayerID_2;
6530 v498 = pCastSpell->uPlayerID_2; 6048 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7]))
6531 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) 6049 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9]))
6532 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) 6050 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) )
6533 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) 6051 {
6534 { 6052 LODWORD(v727) = 1;
6053 break;
6054 }
6055 if ( v731 == 4 )
6056 {
6057 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0;
6058 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0;
6059 v499 = pCastSpell->uPlayerID_2;
6060 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0;
6061 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0;
6062 v500 = pCastSpell->uPlayerID_2;
6063 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0;
6064 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0;
6065 }
6066 else
6067 {
6068 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
6069 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan(
6070 7u,
6071 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
6072 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
6073 9u,
6074 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
6075 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
6076 v656 = 11;
6077 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
6078 v325->DiscardConditionIfLastsLongerThan(v656, v663);
6079 }
6535 LODWORD(v727) = 1; 6080 LODWORD(v727) = 1;
6536 break; 6081 break;
6537 } 6082 }
6538 if ( v731 == 4 ) 6083 case SPELL_BODY_POWER_CURE:
6539 { 6084 {
6540 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; 6085 amount = 5 * v2 + 10;
6541 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; 6086 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6542 v499 = pCastSpell->uPlayerID_2; 6087 break;
6543 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; 6088 v501 = pParty->pPlayers;
6544 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; 6089 int v1 = 0;
6545 v500 = pCastSpell->uPlayerID_2; 6090 do
6546 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; 6091 {
6547 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; 6092 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1);
6548 } 6093 v501->Heal(amount);
6549 else 6094 ++v501;
6550 { 6095 ++v1;
6551 *(float *)&a2 = (double)(amount << 7) * 0.033333335; 6096 }
6552 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( 6097 while ( (signed int)v501 < (signed int)pParty->pHirelings );
6553 7u,
6554 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
6555 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
6556 9u,
6557 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
6558 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
6559 v656 = 11;
6560 //LABEL_937:
6561 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
6562 //LABEL_641:
6563 v325->DiscardConditionIfLastsLongerThan(v656, v663);
6564 }
6565 LODWORD(v727) = 1; 6098 LODWORD(v727) = 1;
6566 break; 6099 break;
6567 } 6100 }
6568 case SPELL_BODY_POWER_CURE: 6101 case SPELL_LIGHT_DISPEL_MAGIC:
6569 { 6102 {
6570 amount = 5 * v2 + 10; 6103 sRecoveryTime -= v2;
6571 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6104 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6572 break; 6105 break;
6573 v501 = pParty->pPlayers; 6106
6574 int v1 = 0; 6107 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u);
6575 do 6108 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096);
6576 { 6109 ++pSpellSprite.uType;
6577 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1); 6110 HIDWORD(v733) = v505;
6578 v501->Heal(amount); 6111 v688.x = 0;
6579 ++v501; 6112 v688.y = 0;
6580 ++v1; 6113 v688.z = 0;
6581 } 6114 pSpellSprite.stru_24.Reset();
6582 while ( (signed int)v501 < (signed int)pParty->pHirelings ); 6115 pSpellSprite.spell_id = pCastSpell->spellnum;
6116 pSpellSprite.spell_level = v2;
6117 pSpellSprite.spell_skill = v731;
6118 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
6119 pSpellSprite.uAttributes = 0;
6120 pSpellSprite.uSectorID = 0;
6121 pSpellSprite.uSpriteFrameID = 0;
6122 pSpellSprite.field_60_distance_related_prolly_lod = 0;
6123 pSpellSprite.uFacing = 0;
6124 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
6125 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
6126 a2 = 0;
6127 if ( SHIDWORD(v733) > 0 )
6128 {
6129 do
6130 {
6131 v507 = dword_50BF30[a2];
6132 pSpellSprite.vPosition.x = pActors[v507].vPosition.x;
6133 pSpellSprite.vPosition.y = pActors[v507].vPosition.y;
6134 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548);
6135 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
6136 v509 = pSpellSprite.Create(0, 0, 0, 0);
6137 v510 = a2;
6138 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688);
6139 a2 = v510 + 1;
6140 }
6141 while ( v510 + 1 < SHIDWORD(v733) );
6142 }
6143 for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 )
6144 {
6145 v511 = &pActors[dword_50BF30[a2]];
6146 pSpellSprite.vPosition.x = v511->vPosition.x;
6147 pSpellSprite.vPosition.y = v511->vPosition.y;
6148 pSpellSprite.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548);
6149 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
6150 pSpellSprite.Create(0, 0, 0, 0);
6151 v513 = v511->pActorBuffs;
6152 for (int _v726 = 22; _v726 != 0; --_v726)
6153 {
6154 v513->Reset();
6155 ++v513;
6156 }
6157 }
6583 LODWORD(v727) = 1; 6158 LODWORD(v727) = 1;
6584 break; 6159 break;
6585 } 6160 }
6586 case SPELL_LIGHT_DISPEL_MAGIC: 6161 case SPELL_LIGHT_SUMMON_ELEMENTAL:
6587 { 6162 {
6588 sRecoveryTime -= v2; 6163 switch (v731)
6589 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6164 {
6590 break; 6165 case 1: v733 = 300 * v2; amount = 1; break;
6591 6166 case 2: v733 = 300 * v2; amount = 1; break;
6592 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); 6167 case 3: v733 = 900 * v2; amount = 3; break;
6593 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); 6168 case 4: v733 = 900 * v2; amount = 5; break;
6594 ++pSpellSprite.uType; 6169 default:
6595 HIDWORD(v733) = v505; 6170 assert(false);
6596 v688.x = 0; 6171 }
6597 v688.y = 0; 6172 //v733 = __PAIR__(0, v516);
6598 v688.z = 0; 6173
6599 pSpellSprite.stru_24.Reset(); 6174 if ( (signed int)uNumActors > 0 )
6600 pSpellSprite.spell_id = pCastSpell->spellnum; 6175 {
6601 pSpellSprite.spell_level = v2; 6176 v518 = pActors;//[0].uAIState;
6602 pSpellSprite.spell_skill = v731; 6177 auto _v726 = uNumActors;
6603 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 6178 do
6604 pSpellSprite.uAttributes = 0; 6179 {
6605 pSpellSprite.uSectorID = 0; 6180 v519 = v518->uAIState;
6606 pSpellSprite.uSpriteFrameID = 0; 6181 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID )
6607 pSpellSprite.field_60_distance_related_prolly_lod = 0; 6182 ++HIDWORD(v733);
6608 pSpellSprite.uFacing = 0; 6183 ++v518;
6609 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 6184 --_v726;
6610 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 6185 }
6611 a2 = 0; 6186 while ( _v726 != 0 );
6612 if ( SHIDWORD(v733) > 0 ) 6187 }
6613 { 6188 if ( SHIDWORD(v733) >= amount )
6614 do 6189 {
6615 { 6190 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters!
6616 v507 = dword_50BF30[a2]; 6191 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6617 pSpellSprite.vPosition.x = pActors[v507].vPosition.x; 6192 pCastSpell->spellnum = 0;
6618 pSpellSprite.vPosition.y = pActors[v507].vPosition.y; 6193 continue;
6619 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); 6194 }
6620 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); 6195 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6621 v509 = pSpellSprite.Create(0, 0, 0, 0); 6196 break;
6622 v510 = a2; 6197 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733);
6623 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688);
6624 a2 = v510 + 1;
6625 }
6626 while ( v510 + 1 < SHIDWORD(v733) );
6627 }
6628 for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 )
6629 {
6630 v511 = &pActors[dword_50BF30[a2]];
6631 pSpellSprite.vPosition.x = v511->vPosition.x;
6632 pSpellSprite.vPosition.y = v511->vPosition.y;
6633 pSpellSprite.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548);
6634 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
6635 pSpellSprite.Create(0, 0, 0, 0);
6636 v513 = v511->pActorBuffs;
6637 for (int _v726 = 22; _v726 != 0; --_v726)
6638 {
6639 v513->Reset();
6640 ++v513;
6641 }
6642 }
6643 LODWORD(v727) = 1; 6198 LODWORD(v727) = 1;
6644 break; 6199 break;
6645 } 6200 }
6646 case SPELL_LIGHT_SUMMON_ELEMENTAL:
6647 {
6648 v514 = v731 - 2;
6649 if ( v731 == 1 || v731 == 2 )
6650 {
6651 v516 = 300 * v2;
6652 amount = 1;
6653 }
6654 else if( v731 == 3 )
6655 {
6656 v516 = 900 * v2;
6657 amount = 3;
6658 }
6659 else if ( v731 == 4 )
6660 {
6661 v516 = 900 * v2;
6662 amount = 5;
6663 }
6664 v733 = __PAIR__(0, v516);
6665
6666 if ( (signed int)uNumActors > 0 )
6667 {
6668 v518 = pActors;//[0].uAIState;
6669 auto _v726 = uNumActors;
6670 do
6671 {
6672 v519 = v518->uAIState;
6673 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID )
6674 ++HIDWORD(v733);
6675 ++v518;
6676 --_v726;
6677 }
6678 while ( _v726 != 0 );
6679 }
6680 if ( SHIDWORD(v733) >= amount )
6681 {
6682 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters!
6683 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6684 pCastSpell->spellnum = 0;
6685 continue;
6686 }
6687 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6688 break;
6689 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733);
6690 LODWORD(v727) = 1;
6691 break;
6692 }
6693 case SPELL_LIGHT_DAY_OF_THE_GODS: 6201 case SPELL_LIGHT_DAY_OF_THE_GODS:
6694 { 6202 {
6695 if ( v731 == 1 || v731 == 2 ) 6203 switch (v731)
6696 { 6204 {
6697 LODWORD(v733) = 10800 * v2; 6205 case 1: LODWORD(v733) = 10800 * v2; amount = 3 * v2 + 10; break;
6698 amount = 3 * v2 + 10; 6206 case 2: LODWORD(v733) = 10800 * v2; amount = 3 * v2 + 10; break;
6699 } 6207 case 3: LODWORD(v733) = 14400 * v2; amount = 4 * v2 + 10; break;
6700 else if( v731 == 3 ) 6208 case 4: LODWORD(v733) = 18000 * v2; amount = 5 * v2 + 10; break;
6701 { 6209 default:
6702 LODWORD(v733) = 14400 * v2; 6210 assert(false);
6703 amount = 4 * v2 + 10; 6211 }
6704 } 6212 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6705 else if ( v731 == 4 ) 6213 break;
6706 { 6214
6707 LODWORD(v733) = 18000 * v2;
6708 amount = 5 * v2 + 10;
6709 }
6710 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6711 break;
6712
6713 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
6714 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
6715 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
6716 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
6717
6718 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0);
6719 LODWORD(v727) = 1;
6720 break;
6721 }
6722 case SPELL_LIGHT_PRISMATIC_LIGHT:
6723 {
6724 //v67 = 2;
6725 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
6726 {
6727 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors!
6728 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6729 pCastSpell->spellnum = 0;
6730 continue;
6731 }
6732 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6733 break;
6734 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096);
6735 ++pSpellSprite.uType;
6736 v694.x = 0;
6737 v694.y = 0;
6738 v694.z = 0;
6739 pSpellSprite.stru_24.Reset();
6740 pSpellSprite.spell_id = pCastSpell->spellnum;
6741 pSpellSprite.spell_level = v2;
6742 pSpellSprite.spell_skill = v731;
6743 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
6744 pSpellSprite.uAttributes = 0;
6745 pSpellSprite.uSectorID = 0;
6746 pSpellSprite.uSpriteFrameID = 0;
6747 pSpellSprite.field_60_distance_related_prolly_lod = 0;
6748 pSpellSprite.uFacing = 0;
6749 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
6750 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
6751 a2 = 0;
6752 if ( (signed int)v531 > 0 )
6753 {
6754 do
6755 {
6756 v533 = dword_50BF30[a2];
6757 pSpellSprite.vPosition.x = pActors[v533].vPosition.x;
6758 pSpellSprite.vPosition.y = pActors[v533].vPosition.y;
6759 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548);
6760 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
6761 v535 = pSpellSprite.Create(0, 0, 0, 0);
6762 v536 = a2;
6763 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694);
6764 a2 = v536 + 1;
6765 }
6766 while ( v536 + 1 < (signed int)v531 );
6767 }
6768 v537 = pGame->GetStru6();
6769 pGame->GetStru6()->_4A8BFC();
6770 LODWORD(v727) = 1;
6771 break;
6772 }
6773 case SPELL_LIGHT_DAY_OF_PROTECTION:
6774 {
6775 v538 = v731 - 2;
6776 if ( v538 && (v539 = v538 - 1) != 0 && v539 == 1 )
6777 {
6778 amount = 5 * v2;
6779 v540 = 18000 * v2;
6780 }
6781 else
6782 {
6783 amount = 4 * v2;
6784 v540 = 14400 * v2;
6785 }
6786 v730 = v540;
6787 LODWORD(v733) = v540;
6788 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6789 break;
6790
6791 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
6792 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
6793 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
6794 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
6795
6796 v732 = v730 << 7;
6797 v549 = (double)(v730 << 7) * 0.033333335;
6798 *((float *)&v733 + 1) = v549;
6799 v712 = (signed __int64)v549;
6800 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0);
6801 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
6802 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
6803 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
6804 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
6805 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
6806 v550 = v2 + 5;
6807 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(
6808 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)),
6809 v731,
6810 v550, 0, 0);
6811
6812 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0);
6813 LODWORD(v727) = 1;
6814 break;
6815 }
6816
6817 case SPELL_LIGHT_HOUR_OF_POWER:
6818 {
6819 v551 = v731 - 2;
6820 if ( v731 == 1 || v731 == 2 )
6821 {
6822 HIDWORD(v733) = 4;
6823 amount = 4;
6824 }
6825 else if( v731 == 3 )
6826 {
6827 HIDWORD(v733) = 12;
6828 amount = 12;
6829 }
6830 else if( v731 == 4 )
6831 {
6832 amount = 15;
6833 HIDWORD(v733) = 20;
6834 }
6835 //LABEL_1000:
6836 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6837 break;
6838 y = (char *)(60 * (v2 * HIDWORD(v733) + 60));
6839 v732 = (300 * amount * v2 + 60) << 7;
6840 v730 = v2 + 5;
6841 int _v726 = 0;
6842 v553 = pParty->pPlayers;//[0].pConditions[1];
6843 *((float *)&v733 + 1) = (double)v732 * 0.033333335;
6844 do
6845 {
6846 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); 6215 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
6847 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); 6216 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
6848 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); 6217 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
6849 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); 6218 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
6850 6219
6851 //((SpellBuff *)(v553 + 6056))->Apply( 6220 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0);
6852 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0);
6853 if ( *(_QWORD *)v553 )
6854 _v726 = 1;
6855 ++v553;
6856 }
6857 while ( v553 <= &pParty->pPlayers[3] );
6858 v562 = v731;
6859 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0);
6860 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, 0, 0, 0);
6861 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, v730, 0, 0);
6862 if (!_v726)
6863 {
6864 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);
6865 }
6866 LODWORD(v727) = 1; 6221 LODWORD(v727) = 1;
6867 break; 6222 break;
6868 } 6223 }
6869 6224 case SPELL_LIGHT_PRISMATIC_LIGHT:
6870 6225 {
6871 case SPELL_LIGHT_DIVINE_INTERVENTION: 6226 //v67 = 2;
6872 { 6227 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
6873 amount = 3; 6228 {
6874 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) 6229 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors!
6875 { 6230 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6876 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed 6231 pCastSpell->spellnum = 0;
6877 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 6232 continue;
6878 pCastSpell->spellnum = 0; 6233 }
6879 continue; 6234 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6880 } 6235 break;
6881 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6236 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096);
6882 break; 6237 ++pSpellSprite.uType;
6883 a2 = 0; 6238 v694.x = 0;
6884 _this = (ItemGen *)&pPlayers[1]; 6239 v694.y = 0;
6885 do 6240 v694.z = 0;
6886 { 6241 pSpellSprite.stru_24.Reset();
6887 v563 = 0; 6242 pSpellSprite.spell_id = pCastSpell->spellnum;
6888 do 6243 pSpellSprite.spell_level = v2;
6889 { 6244 pSpellSprite.spell_skill = v731;
6890 v564 = _this->uItemID; 6245 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
6891 *(int *)(v563 + _this->uItemID) = 0; 6246 pSpellSprite.uAttributes = 0;
6892 v563 += 8; 6247 pSpellSprite.uSectorID = 0;
6893 *(int *)(v563 + v564 - 4) = 0; 6248 pSpellSprite.uSpriteFrameID = 0;
6894 } 6249 pSpellSprite.field_60_distance_related_prolly_lod = 0;
6895 while ( v563 <= 128 ); 6250 pSpellSprite.uFacing = 0;
6896 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); 6251 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
6897 v566 = (Player **)_this; 6252 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
6898 *(int *)(_this->uItemID + 6460) = v565; 6253 a2 = 0;
6899 v567 = (*v566)->GetMaxMana(); 6254 if ( (signed int)v531 > 0 )
6900 *(int *)(_this->uItemID + 6464) = v567; 6255 {
6901 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); 6256 do
6902 ++a2; 6257 {
6903 _this = (ItemGen *)((char *)_this + 4); 6258 v533 = dword_50BF30[a2];
6904 } 6259 pSpellSprite.vPosition.x = pActors[v533].vPosition.x;
6905 while ( (signed int)this < (signed int)&qword_A750D8 ); 6260 pSpellSprite.vPosition.y = pActors[v533].vPosition.y;
6906 v571 = pPlayer; 6261 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548);
6907 v572 = (char *)&pPlayer->sAgeModifier; 6262 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
6908 if ( pPlayer->sAgeModifier + 10 >= 120 ) 6263 v535 = pSpellSprite.Create(0, 0, 0, 0);
6909 *(short *)v572 = 120; 6264 v536 = a2;
6910 else 6265 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694);
6911 *(short *)v572 = pPlayer->sAgeModifier + 10; 6266 a2 = v536 + 1;
6912 sRecoveryTime += -5 * v2; 6267 }
6913 ++v571->uNumDivineInterventionCastsThisDay; 6268 while ( v536 + 1 < (signed int)v531 );
6269 }
6270 v537 = pGame->GetStru6();
6271 pGame->GetStru6()->_4A8BFC();
6914 LODWORD(v727) = 1; 6272 LODWORD(v727) = 1;
6915 break; 6273 break;
6916 } 6274 }
6917 case SPELL_DARK_REANIMATE: 6275 case SPELL_LIGHT_DAY_OF_PROTECTION:
6918 { 6276 {
6919 v573 = v731 - 2; 6277 switch (v731)
6920 if ( v573 ) 6278 {
6921 { 6279 case 1: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break;
6922 v574 = v573 - 1; 6280 case 2: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break;
6923 if ( v574 ) 6281 case 3: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break;
6924 { 6282 case 4: LODWORD(v733) = 18000 * v2; amount = 5 * v2; break;
6925 if ( v574 == 1 ) 6283 default:
6926 v575 = 5 * v2; 6284 assert(false);
6927 else 6285 }
6928 v575 = 2 * v2; 6286 v730 = LODWORD(v733);
6929 } 6287 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6930 else 6288 break;
6931 { 6289
6932 v575 = 4 * v2; 6290 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
6933 } 6291 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
6934 } 6292 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
6935 else 6293 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
6936 { 6294
6937 v575 = 3 * v2; 6295 v732 = v730 << 7;
6938 } 6296 v549 = (double)(v730 << 7) * 0.033333335;
6939 amount = v575; 6297 *((float *)&v733 + 1) = v549;
6940 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6298 v712 = (signed __int64)v549;
6941 break; 6299 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0);
6942 v576 = pCastSpell->spell_target_pid; 6300 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
6943 if (!v576) 6301 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
6944 { 6302 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
6945 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; 6303 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
6946 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); 6304 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
6947 if ( *((_QWORD *)v585 + 14) ) 6305 v550 = v2 + 5;
6948 { 6306 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(
6949 ((Player *)v585)->SetCondition(0x11u, 1); 6307 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)),
6950 v587 = ((Player *)v585)->GetSexByVoice(); 6308 v731,
6951 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23); 6309 v550, 0, 0);
6952 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; 6310
6953 } 6311 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0);
6954 break;
6955 }
6956 v577 = (Player *)(PID_ID(v576));
6957 //v726 = v577;
6958 if ( v577 == (Player *)-1 )
6959 {
6960 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists!
6961 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6962 pCastSpell->spellnum = 0;
6963 continue;
6964 }
6965 v578 = (int)&pActors[(int)v577];
6966 v721 = v578;
6967 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 )
6968 {
6969 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
6970 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6971 pCastSpell->spellnum = 0;
6972 continue;
6973 }
6974 ++pSpellSprite.uType;
6975 pSpellSprite.stru_24.Reset();
6976 pSpellSprite.spell_id = pCastSpell->spellnum;
6977 pSpellSprite.spell_level = v2;
6978 pSpellSprite.spell_skill = v731;
6979 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
6980 pSpellSprite.uAttributes = 0;
6981 pSpellSprite.uSectorID = 0;
6982 pSpellSprite.uSpriteFrameID = 0;
6983 pSpellSprite.field_60_distance_related_prolly_lod = 0;
6984 v581 = v721;
6985 pSpellSprite.uFacing = 0;
6986 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
6987 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
6988 pSpellSprite.vPosition.x = *(short *)(v721 + 142);
6989 pSpellSprite.vPosition.y = *(short *)(v721 + 144);
6990 v732 = *(short *)(v721 + 138);
6991 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
6992 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577);
6993 pSpellSprite.Create(0, 0, 0, 0);
6994 if ( *(char *)(v581 + 52) > amount )
6995 break;
6996 Actor::Resurrect((unsigned int)v577);
6997 *(char *)(v581 + 61) = 0;
6998 *(char *)(v581 + 53) = 0;
6999 *(char *)(v581 + 54) = 0;
7000 *(char *)(v581 + 55) = 0;
7001 *(char *)(v581 + 56) = 0;
7002 *(char *)(v581 + 57) = 0;
7003 *(int *)(v581 + 712) = 9999;
7004 *(char *)(v581 + 38) &= 0xF7u;
7005 *(int *)(v581 + 708) = 0;
7006 ((SpellBuff *)(v581 + 356))->Reset();
7007 ((SpellBuff *)(v581 + 228))->Reset();
7008 ((SpellBuff *)(v581 + 404))->Reset();
7009 if ( *(short *)(v581 + 40) > 10 * amount )
7010 *(short *)(v581 + 40) = 10 * amount;
7011 LODWORD(v727) = 1; 6312 LODWORD(v727) = 1;
7012 break; 6313 break;
7013 } 6314 }
7014 case SPELL_DARK_VAMPIRIC_WEAPON: 6315 case SPELL_LIGHT_HOUR_OF_POWER:
7015 { 6316 {
7016 v588 = v731 - 1; 6317 switch (v731)
7017 amount = 16; 6318 {
7018 if ( v588 && (v589 = v588 - 1) != 0 && (v590 = v589 - 1) != 0 ) 6319 case 1: LODWORD(v733) = 4; amount = 4; break;
7019 { 6320 case 2: LODWORD(v733) = 4; amount = 4; break;
7020 if ( v590 == 1 ) 6321 case 3: LODWORD(v733) = 12; amount = 12; break;
7021 LODWORD(v733) = 0; 6322 case 4: LODWORD(v733) = 20; amount = 15; break;
7022 } 6323 default:
7023 else 6324 assert(false);
7024 { 6325 }
7025 LODWORD(v733) = 3600 * v2; 6326 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7026 } 6327 break;
7027 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6328 y = (char *)(60 * (v2 * HIDWORD(v733) + 60));
7028 break; 6329 v732 = (300 * amount * v2 + 60) << 7;
7029 __debugbreak(); 6330 v730 = v2 + 5;
7030 HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; 6331 int _v726 = 0;
7031 v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName; 6332 v553 = pParty->pPlayers;//[0].pConditions[1];
7032 ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed); 6333 *((float *)&v733 + 1) = (double)v732 * 0.033333335;
7033 if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65
7034 || *(char *)(HIDWORD(v733) + 20) & 2
7035 || *(int *)(HIDWORD(v733) + 12) != 0
7036 || *(int *)(HIDWORD(v733) + 4) != 0
7037 || (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2
7038 || pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) )
7039 {
7040 dword_50C9D0 = 113;
7041 dword_50C9D4 = 0;
7042 dword_50C9D8 = 1;
7043
7044 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
7045 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
7046 pCastSpell->spellnum = 0;
7047 continue;
7048 }
7049 v592 = HIDWORD(v733);
7050 v14 = v731 == 4;
7051 *(int *)(HIDWORD(v733) + 12) = 16;
7052 if ( !v14 )
7053 {
7054 v732 = (int)v733 << 7;
7055 *(_QWORD *)(v592 + 28) = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
7056 *(int *)(v592 + 20) |= 8u;
7057 }
7058 *(char *)(v592 + 20) |= 0x80u;
7059 _50C9A8_item_enchantment_timer = 256;
7060 LODWORD(v727) = 1;
7061 break;
7062 }
7063 case SPELL_DARK_SHARPMETAL:
7064 {
7065 v593 = v731 - 2;
7066 if( v731 == 1 || v731 == 2 )
7067 amount = 5;
7068 else if( v731 == 3 )
7069 amount = 7;
7070 else if( v731 == 4 )
7071 amount = 9;
7072 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7073 break;
7074 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360);
7075 pSpellSprite.stru_24.Reset();
7076 pSpellSprite.spell_id = pCastSpell->spellnum;
7077 pSpellSprite.spell_level = v2;
7078 pSpellSprite.spell_skill = v731;
7079 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
7080 pSpellSprite.vPosition.x = pParty->vPosition.x;
7081 pSpellSprite.vPosition.y = pParty->vPosition.y;
7082 pSpellSprite.uAttributes = 0;
7083 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
7084 pSpellSprite.uSectorID = pIndoor->GetSector(
7085 pParty->vPosition.x,
7086 pParty->vPosition.y,
7087 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2);
7088 pSpellSprite.uSpriteFrameID = 0;
7089 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
7090 pSpellSprite.spell_target_pid = a2;
7091 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
7092 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
7093 if ( pParty->bTurnBasedModeOn == 1 )
7094 LOBYTE(pSpellSprite.uAttributes) |= 4u;
7095 v596 = (signed int)_v726 / -2;
7096 y = (char *)((signed int)_v726 / 2);
7097 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 )
7098 {
7099 v597 = v715.uYawAngle;
7100 do 6334 do
7101 { 6335 {
7102 pSpellSprite.uFacing = v596 + v597; 6336 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
7103 if ( pSpellSprite.Create( 6337 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
7104 v596 + v597, 6338 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
7105 v715.uPitchAngle, 6339 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
7106 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 6340
7107 pCastSpell->uPlayerID + 1) != -1 6341 //((SpellBuff *)(v553 + 6056))->Apply(
7108 && pParty->bTurnBasedModeOn == 1 ) 6342 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0);
7109 ++pTurnEngine->field_1C; 6343 if ( *(_QWORD *)v553 )
7110 v596 += _v726 / (amount - 1); 6344 _v726 = 1;
7111 } 6345 ++v553;
7112 while ( v596 <= (signed int)y ); 6346 }
7113 } 6347 while ( v553 <= &pParty->pPlayers[3] );
6348 v562 = v731;
6349 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0);
6350 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, 0, 0, 0);
6351 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, v730, 0, 0);
6352 if (!_v726)
6353 {
6354 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);
6355 }
7114 LODWORD(v727) = 1; 6356 LODWORD(v727) = 1;
7115 break; 6357 break;
7116 } 6358 }
7117 6359 case SPELL_LIGHT_DIVINE_INTERVENTION:
7118 case SPELL_DARK_CONTROL_UNDEAD: 6360 {
7119 { 6361 amount = 3;
7120 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6362 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u )
7121 break;
7122 if ( v731 == 1 || v731 == 2 )
7123 {
7124 v598 = 180 * v2;
7125 LODWORD(v733) = v598;
7126 }
7127 else if ( v731 == 3 )
7128 {
7129 v598 = 300 * v2;
7130 LODWORD(v733) = v598;
7131 }
7132 else if ( v731 == 4 )
7133 LODWORD(v733) = 29030400;
7134 // LABEL_1082:
7135 if (PID_TYPE(a2) != OBJECT_Actor)
7136 {
7137 LODWORD(v727) = 1;
7138 break;
7139 }
7140 v730 = 836 * PID_ID(a2);
7141 if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
7142 break;
7143 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) )
7144 { 6363 {
7145 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed 6364 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
7146 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 6365 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
7147 pCastSpell->spellnum = 0; 6366 pCastSpell->spellnum = 0;
7148 continue; 6367 continue;
7149 } 6368 }
7150 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); 6369 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7151 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); 6370 break;
7152 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), 6371 a2 = 0;
6372 _this = (ItemGen *)&pPlayers[1];
6373 do
6374 {
6375 v563 = 0;
6376 do
6377 {
6378 v564 = _this->uItemID;
6379 *(int *)(v563 + _this->uItemID) = 0;
6380 v563 += 8;
6381 *(int *)(v563 + v564 - 4) = 0;
6382 }
6383 while ( v563 <= 128 );
6384 v565 = ((Player *)_this->uItemID)->GetMaxHealth();
6385 v566 = (Player **)_this;
6386 *(int *)(_this->uItemID + 6460) = v565;
6387 v567 = (*v566)->GetMaxMana();
6388 *(int *)(_this->uItemID + 6464) = v567;
6389 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
6390 ++a2;
6391 _this = (ItemGen *)((char *)_this + 4);
6392 }
6393 while ( (signed int)this < (signed int)&qword_A750D8 );
6394 v571 = pPlayer;
6395 v572 = (char *)&pPlayer->sAgeModifier;
6396 if ( pPlayer->sAgeModifier + 10 >= 120 )
6397 *(short *)v572 = 120;
6398 else
6399 *(short *)v572 = pPlayer->sAgeModifier + 10;
6400 sRecoveryTime += -5 * v2;
6401 ++v571->uNumDivineInterventionCastsThisDay;
6402 LODWORD(v727) = 1;
6403 break;
6404 }
6405 case SPELL_DARK_REANIMATE:
6406 {
6407 switch (v731)
6408 {
6409 case 1: amount = 2 * v2; break;
6410 case 2: amount = 3 * v2; break;
6411 case 3: amount = 4 * v2; break;
6412 case 4: amount = 5 * v2; break;
6413 default:
6414 assert(false);
6415 }
6416 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6417 break;
6418 v576 = pCastSpell->spell_target_pid;
6419 if (!v576)
6420 {
6421 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2];
6422 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
6423 if ( *((_QWORD *)v585 + 14) )
6424 {
6425 ((Player *)v585)->SetCondition(0x11u, 1);
6426 v587 = ((Player *)v585)->GetSexByVoice();
6427 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23);
6428 *((_QWORD *)v585 + 17) = pParty->uTimePlayed;
6429 }
6430 break;
6431 }
6432 v577 = (Player *)(PID_ID(v576));
6433 //v726 = v577;
6434 if ( v577 == (Player *)-1 )
6435 {
6436 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists!
6437 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6438 pCastSpell->spellnum = 0;
6439 continue;
6440 }
6441 v578 = (int)&pActors[(int)v577];
6442 v721 = v578;
6443 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 )
6444 {
6445 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
6446 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6447 pCastSpell->spellnum = 0;
6448 continue;
6449 }
6450 ++pSpellSprite.uType;
6451 pSpellSprite.stru_24.Reset();
6452 pSpellSprite.spell_id = pCastSpell->spellnum;
6453 pSpellSprite.spell_level = v2;
6454 pSpellSprite.spell_skill = v731;
6455 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
6456 pSpellSprite.uAttributes = 0;
6457 pSpellSprite.uSectorID = 0;
6458 pSpellSprite.uSpriteFrameID = 0;
6459 pSpellSprite.field_60_distance_related_prolly_lod = 0;
6460 v581 = v721;
6461 pSpellSprite.uFacing = 0;
6462 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
6463 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
6464 pSpellSprite.vPosition.x = *(short *)(v721 + 142);
6465 pSpellSprite.vPosition.y = *(short *)(v721 + 144);
6466 v732 = *(short *)(v721 + 138);
6467 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
6468 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577);
6469 pSpellSprite.Create(0, 0, 0, 0);
6470 if ( *(char *)(v581 + 52) > amount )
6471 break;
6472 Actor::Resurrect((unsigned int)v577);
6473 *(char *)(v581 + 61) = 0;
6474 *(char *)(v581 + 53) = 0;
6475 *(char *)(v581 + 54) = 0;
6476 *(char *)(v581 + 55) = 0;
6477 *(char *)(v581 + 56) = 0;
6478 *(char *)(v581 + 57) = 0;
6479 *(int *)(v581 + 712) = 9999;
6480 *(char *)(v581 + 38) &= 0xF7u;
6481 *(int *)(v581 + 708) = 0;
6482 ((SpellBuff *)(v581 + 356))->Reset();
6483 ((SpellBuff *)(v581 + 228))->Reset();
6484 ((SpellBuff *)(v581 + 404))->Reset();
6485 if ( *(short *)(v581 + 40) > 10 * amount )
6486 *(short *)(v581 + 40) = 10 * amount;
6487 LODWORD(v727) = 1;
6488 break;
6489 }
6490 case SPELL_DARK_VAMPIRIC_WEAPON:
6491 {
6492 amount = 16;
6493 if ( v731 == 4 )
6494 {
6495 LODWORD(v733) = 0;
6496 }
6497 else
6498 {
6499 LODWORD(v733) = 3600 * v2;
6500 }
6501 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6502 break;
6503 __debugbreak();
6504 HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040;
6505 v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName;
6506 ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed);
6507 if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65
6508 || *(char *)(HIDWORD(v733) + 20) & 2
6509 || *(int *)(HIDWORD(v733) + 12) != 0
6510 || *(int *)(HIDWORD(v733) + 4) != 0
6511 || (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2
6512 || pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) )
6513 {
6514 dword_50C9D0 = 113;
6515 dword_50C9D4 = 0;
6516 dword_50C9D8 = 1;
6517
6518 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
6519 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6520 pCastSpell->spellnum = 0;
6521 continue;
6522 }
6523 v592 = HIDWORD(v733);
6524 v14 = v731 == 4;
6525 *(int *)(HIDWORD(v733) + 12) = 16;
6526 if ( !v14 )
6527 {
6528 v732 = (int)v733 << 7;
6529 *(_QWORD *)(v592 + 28) = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
6530 *(int *)(v592 + 20) |= 8u;
6531 }
6532 *(char *)(v592 + 20) |= 0x80u;
6533 _50C9A8_item_enchantment_timer = 256;
6534 LODWORD(v727) = 1;
6535 break;
6536 }
6537 case SPELL_DARK_SHARPMETAL:
6538 {
6539 switch (v731)
6540 {
6541 case 1: amount = 5; break;
6542 case 2: amount = 5; break;
6543 case 3: amount = 7; break;
6544 case 4: amount = 9; break;
6545 default:
6546 assert(false);
6547 }
6548 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6549 break;
6550 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360);
6551 pSpellSprite.stru_24.Reset();
6552 pSpellSprite.spell_id = pCastSpell->spellnum;
6553 pSpellSprite.spell_level = v2;
6554 pSpellSprite.spell_skill = v731;
6555 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
6556 pSpellSprite.vPosition.x = pParty->vPosition.x;
6557 pSpellSprite.vPosition.y = pParty->vPosition.y;
6558 pSpellSprite.uAttributes = 0;
6559 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
6560 pSpellSprite.uSectorID = pIndoor->GetSector(
6561 pParty->vPosition.x,
6562 pParty->vPosition.y,
6563 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2);
6564 pSpellSprite.uSpriteFrameID = 0;
6565 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
6566 pSpellSprite.spell_target_pid = a2;
6567 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
6568 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
6569 if ( pParty->bTurnBasedModeOn == 1 )
6570 LOBYTE(pSpellSprite.uAttributes) |= 4u;
6571 v596 = (signed int)_v726 / -2;
6572 y = (char *)((signed int)_v726 / 2);
6573 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 )
6574 {
6575 v597 = v715.uYawAngle;
6576 do
6577 {
6578 pSpellSprite.uFacing = v596 + v597;
6579 if ( pSpellSprite.Create(
6580 v596 + v597,
6581 v715.uPitchAngle,
6582 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
6583 pCastSpell->uPlayerID + 1) != -1
6584 && pParty->bTurnBasedModeOn == 1 )
6585 ++pTurnEngine->field_1C;
6586 v596 += _v726 / (amount - 1);
6587 }
6588 while ( v596 <= (signed int)y );
6589 }
6590 LODWORD(v727) = 1;
6591 break;
6592 }
6593 case SPELL_DARK_CONTROL_UNDEAD:
6594 {
6595 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6596 break;
6597 switch (v731)
6598 {
6599 case 1: LODWORD(v733) = 180 * v2; break;
6600 case 2: LODWORD(v733) = 180 * v2; break;
6601 case 3: LODWORD(v733) = 300 * v2; break;
6602 case 4: LODWORD(v733) = 29030400; break;
6603 default:
6604 assert(false);
6605 }
6606 if (PID_TYPE(a2) != OBJECT_Actor)
6607 {
6608 LODWORD(v727) = 1;
6609 break;
6610 }
6611 pActor = &pActors[PID_ID(a2)];
6612 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
6613 break;
6614 if ( !stru_50C198.GetMagicalResistance(pActor, 0xAu) )
6615 {
6616 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
6617 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6618 pCastSpell->spellnum = 0;
6619 continue;
6620 }
6621 pActor->pActorBuffs[9].Reset();
6622 pActor->pActorBuffs[1].Reset();
6623 pActor->pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335),
7153 v731, 0, 0, 0); 6624 v731, 0, 0, 0);
7154 pSpellSprite.stru_24.Reset(); 6625 pSpellSprite.stru_24.Reset();
7155 pSpellSprite.spell_id = pCastSpell->spellnum; 6626 pSpellSprite.spell_id = pCastSpell->spellnum;
7156 pSpellSprite.spell_level = v2; 6627 pSpellSprite.spell_level = v2;
7157 pSpellSprite.spell_skill = v731; 6628 pSpellSprite.spell_skill = v731;
7158 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 6629 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
7159 v61 = PID_ID(a2); 6630
7160 // LABEL_1086: 6631 v600 = pActor->vPosition.y;
7161 v600 = pActors[v61].vPosition.y; 6632 v601 = pActor->vPosition.x;
7162 v601 = pActors[v61].vPosition.x;
7163 pSpellSprite.uObjectDescID = v60; 6633 pSpellSprite.uObjectDescID = v60;
7164 pSpellSprite.vPosition.x = v601; 6634 pSpellSprite.vPosition.x = v601;
7165 v602 = pActors[v61].uActorHeight; 6635 v602 = pActor->uActorHeight;
7166 v603 = pActors[v61].vPosition.z; 6636 v603 = pActor->vPosition.z;
7167 pSpellSprite.vPosition.y = v600; 6637 pSpellSprite.vPosition.y = v600;
7168 v676 = v603 + v602; 6638 v676 = v603 + v602;
7169 v665 = v600; 6639 v665 = v600;
7170 pSpellSprite.vPosition.z = v603 + v602; 6640 pSpellSprite.vPosition.z = v603 + v602;
7171 v657 = v601; 6641 v657 = v601;
7172 // LABEL_1087:
7173 pSpellSprite.uAttributes = 0; 6642 pSpellSprite.uAttributes = 0;
7174 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); 6643 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676);
7175 pSpellSprite.uSpriteFrameID = 0; 6644 pSpellSprite.uSpriteFrameID = 0;
7176 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 6645 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
7177 pSpellSprite.spell_target_pid = a2; 6646 pSpellSprite.spell_target_pid = a2;
7188 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6657 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7189 break; 6658 break;
7190 HIDWORD(v733) = 0; 6659 HIDWORD(v733) = 0;
7191 memset(&achieved_awards, 0, 4000); 6660 memset(&achieved_awards, 0, 4000);
7192 _this = 0; 6661 _this = 0;
7193 v605 = (char *)pParty->pHirelings; 6662 pNPCData = pParty->pHirelings;
7194 do 6663 do
7195 { 6664 {
7196 if ( *(int *)v605) 6665 if ( pNPCData->pName != 0)
7197 { 6666 {
7198 v606 = HIDWORD(v733)++; 6667 v606 = HIDWORD(v733)++;
7199 achieved_awards[v606] = (AwardType)(int)((char *)&_this->uItemID + 1); 6668 achieved_awards[v606] = (AwardType)(int)((char *)&_this->uItemID + 1);
7200 } 6669 }
7201 _this = (ItemGen *)((char *)_this + 1); 6670 _this = (ItemGen *)((char *)_this + 1);
7202 v605 += 76; 6671 ++pNPCData;
7203 } 6672 }
7204 while ( (signed int)v605 < (signed int)&pParty->pPickedItem ); 6673 while ( pNPCData <= &pParty->pHirelings[1] );
7205 _this = 0; 6674 _this = 0;
7206 if ( (signed int)pNPCStats->uNumNewNPCs > 0) 6675 if ( (signed int)pNPCStats->uNumNewNPCs > 0)
7207 { 6676 {
7208 v730 = (int)pNPCStats->pNewNPCData; 6677 pNPCData = pNPCStats->pNewNPCData;
7209 __debugbreak(); // data offset 6678 __debugbreak(); // data offset
7210 HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152; 6679 HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152;
7211 do 6680 do
7212 { 6681 {
7213 if ( *(char *)(v730 + 8) & 0x80 6682 if ( pNPCData->uFlags & 0x80
7214 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName)) 6683 && (!pParty->pHirelings[0].pName || strcmp(pNPCData->pName, pParty->pHirelings[0].pName))
7215 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) ) 6684 && (!pParty->pHirelings[1].pName || strcmp(pNPCData->pName, pParty->pHirelings[1].pName)) )
7216 { 6685 {
7217 v607 = HIDWORD(v733); 6686 v607 = HIDWORD(v733);
7218 HIDWORD(v733) += 4; 6687 HIDWORD(v733) += 4;
7219 *(int *)v607 = (int)_this + 3; 6688 *(int *)v607 = (int)_this + 3;
7220 } 6689 }
7221 _this = (ItemGen *)((char *)_this + 1); 6690 _this = (ItemGen *)((char *)_this + 1);
7222 v730 += 76; 6691 ++pNPCData;
7223 } 6692 }
7224 while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); 6693 while ( (signed int)_this < (signed int)pNPCStats->uNumNewNPCs );
7225 } 6694 }
7226 v608 = pCastSpell->uPlayerID_2; 6695 v608 = pCastSpell->uPlayerID_2;
7227 if ( v608 != 4 && v608 != 5 6696 if ( v608 != 4 && v608 != 5
7228 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) 6697 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0)
7229 || v609 >= 3 ) 6698 || v609 >= 3 )
7234 continue; 6703 continue;
7235 } 6704 }
7236 v610 = 76 * v609; 6705 v610 = 76 * v609;
7237 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; 6706 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0;
7238 v611 = pIconsFrameTable->FindIcon("spell96"); 6707 v611 = pIconsFrameTable->FindIcon("spell96");
7239 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); 6708 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611);
7240 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; 6709 pParty->pHirelings[v609-1].evt_B = pIconsFrameTable->GetIconAnimLength(v611);
6710 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1;
6711 pParty->pHirelings[v609-1].field_24 = 1;
6712
7241 v612 = pParty->pPlayers; 6713 v612 = pParty->pPlayers;
7242 do 6714 do
7243 { 6715 {
7244 v612->sHealth = v612->GetMaxHealth(); 6716 v612->sHealth = v612->GetMaxHealth();
7245 v612->sMana = v612->GetMaxMana(); 6717 v612->sMana = v612->GetMaxMana();
7255 LODWORD(v727) = 1; 6727 LODWORD(v727) = 1;
7256 break; 6728 break;
7257 } 6729 }
7258 case SPELL_DARK_PAIN_REFLECTION: 6730 case SPELL_DARK_PAIN_REFLECTION:
7259 { 6731 {
7260 if ( v731 > 0 && v731 <= 4 ) 6732 switch (v731)
7261 { 6733 {
7262 if ( v731 <= 3 ) 6734 case 1: LODWORD(v733) = 300 * (v2 + 12); break;
7263 { 6735 case 2: LODWORD(v733) = 300 * (v2 + 12); break;
7264 v614 = 300 * (v2 + 12); 6736 case 3: LODWORD(v733) = 300 * (v2 + 12); break;
7265 } 6737 case 4: LODWORD(v733) = 900 * (v2 + 4); break;
7266 if ( v731 == 4 ) 6738 default:
7267 { 6739 assert(false);
7268 v614 = 900 * (v2 + 4); 6740 }
7269 } 6741 amount = v2 + 5;
7270 LODWORD(v733) = v614;
7271 }
7272 v615 = v2 + 5;
7273 amount = v615;
7274 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6742 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7275 break; 6743 break;
7276 if ( v731 != 3 && v731 != 4 ) 6744 if ( v731 != 3 && v731 != 4 )
7277 { 6745 {
7278 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); 6746 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
7279
7280 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); 6747 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);
7281 LODWORD(v727) = 1; 6748 LODWORD(v727) = 1;
7282 break; 6749 break;
7283 } 6750 }
7284 a2 = 0; 6751 a2 = 0;
7371 v726->sHealth = v726->GetMaxHealth(); 6838 v726->sHealth = v726->GetMaxHealth();
7372 v635 = HIDWORD(v733); 6839 v635 = HIDWORD(v733);
7373 6840
7374 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733)); 6841 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733));
7375 HIDWORD(v733) = v635 + 1; 6842 HIDWORD(v733) = v635 + 1;
7376 } 6843 }
7377 while ( v635 + 1 < v730 ); 6844 while ( v635 + 1 < v730 );
7378 } 6845 }
7379 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); 6846 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u);
7380 LODWORD(v727) = 1; 6847 LODWORD(v727) = 1;
7381 break; 6848 break;
7382 } 6849 }
7383
7384 case SPELL_DARK_ARMAGEDDON: 6850 case SPELL_DARK_ARMAGEDDON:
7385 { 6851 {
7386 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) 6852 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
7387 { 6853 {
7388 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! 6854 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors!
7389 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 6855 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
7390 pCastSpell->spellnum = 0; 6856 pCastSpell->spellnum = 0;
7391 continue; 6857 continue;
7392 } 6858 }
7393 v640 = v731 - 2; 6859 if ( v731 == 4)
7394 if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) 6860 amount = 4;
6861 else
7395 amount = 3; 6862 amount = 3;
7396 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) 6863 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 )
7397 { 6864 {
7398 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed 6865 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
7399 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 6866 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);