annotate CastSpellInfo.cpp @ 2189:0e2bee275f60

CastSpell continue
author Ritor1
date Wed, 29 Jan 2014 17:26:24 +0600
parents 0ae56373cc35
children 0acbf1f82c70
rev   line source
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
1 #include "CastSpellInfo.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
2 #include "Actor.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3 #include "Party.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
4 #include "mm7_data.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
5 #include "MM7.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
6 #include "BSPModel.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
7 #include "Mouse.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
8 #include "stru6.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
9 #include "Game.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
10 #include "GUIWindow.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
11 #include "GUIFont.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
12 #include "AudioPlayer.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
13 #include "Outdoor.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
14 #include "Overlays.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
15 #include "Events.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
16 #include "Viewport.h"
2037
7a9477135943 Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents: 1980
diff changeset
17 #include "OurMath.h"
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
18 #include "SpriteObject.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
19 #include "ObjectList.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
20 #include "stru123.h"
2044
28cb79ae2f6f Time.h rename
Ritor1
parents: 2037
diff changeset
21 #include "Timer.h"
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
22 #include "IconFrameTable.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
23 #include "Awards.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
24 #include "TurnEngine.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
25 #include "texts.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
26 #include "LOD.h"
1828
35c1e4ff6ba7 party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents: 1793
diff changeset
27 #include "Level/Decoration.h"
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
28
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
29 const size_t CastSpellInfoCount = 10;
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
30 std::array<CastSpellInfo, CastSpellInfoCount> pCastSpellInfo;
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
31
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
32 //----- (00427E01) --------------------------------------------------------
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
33 void CastSpellInfoHelpers::_427E01_cast_spell()
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
34 {
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
35 int spell_level; // edi@1
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
36 CastSpellInfo *pCastSpell; // ebx@2
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
37 signed int v6; // eax@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
38 unsigned __int16 v11; // cx@45
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
39 signed int i; // esi@76
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
40 __int16 v23; // ax@88
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
41 signed __int64 v54; // qax@164
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
42 signed __int64 v58; // qax@177
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
43 Actor *pActor; // edi@177
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
44 unsigned __int16 v60; // ax@184
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
45 int v61; // ecx@184
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
46 double v90; // st7@245
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
47 Player *v92; // eax@255
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
48 int v105; // edi@271
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
49 int v111; // eax@274
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
50 Actor *v112; // esi@278
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
51 int dist_X; // eax@278
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
52 int new_dist_Y;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
53 int dist_Z;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
54 int v114; // ebx@278
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
55 unsigned int v115; // ecx@278
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
56 int v116; // edx@279
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
57 int v117; // edx@281
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
58 int v118; // edx@283
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
59 signed int v122; // eax@286
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
60 int v127; // eax@296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
61 int v153; // ecx@322
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
62 int v154; // eax@322
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
63 int v155; // eax@323
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
64 int v156; // eax@323
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
65 int v162; // edi@340
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
66 signed int v164; // eax@340
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
67 signed int v165; // edi@340
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
68 signed int v168; // edi@343
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
69 int v169; // eax@344
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
70 signed int v174; // edi@355
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
71 int v188; // esi@369
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
72 int v189; // edi@369
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
73 signed int v191; // edi@379
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
74 signed int v205; // edi@405
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
75 int v206; // eax@407
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
76 __int16 v207; // cx@407
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
77 int v208; // eax@411
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
78 signed int v209; // ecx@412
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
79 int v210; // edx@412
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
80 signed int v211; // ecx@412
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
81 int v212; // eax@413
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
82 int v213; // eax@413
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
83 int v214; // eax@413
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
84 int v215; // eax@415
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
85 double v216; // st7@415
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
86 double v217; // st6@415
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
87 signed __int64 v218; // qtt@423
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
88 char v223; // al@438
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
89 int v227; // esi@453
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
90 unsigned int v228; // edi@454
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
91 int v229; // edi@466
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
92 ItemGen *v240; // ecx@472
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
93 double v241; // st7@478
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
94 ItemGen *v245; // edi@492
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
95 int v254; // eax@513
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
96 int v255; // esi@513
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
97 int v256; // ecx@513
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
98 int v257; // edx@514
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
99 int v258; // ecx@514
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
100 char v259; // al@516
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
101 int v260; // eax@518
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
102 int v261; // esi@519
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
103 int v262; // edx@521
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
104 int *v263; // ecx@521
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
105 int v264; // esi@521
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
106 int v265; // edx@521
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
107 int *ii; // eax@522
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
108 int v267; // eax@524
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
109 int v268; // eax@524
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
110 char v271; // al@531
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
111 int v277; // edx@548
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
112 int v278; // ecx@548
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
113 char v279; // al@550
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
114 int v280; // eax@552
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
115 int *v281; // esi@553
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
116 int v282; // edx@555
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
117 int *v283; // ecx@555
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
118 int v284; // esi@555
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
119 int v285; // edx@555
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
120 int *l; // eax@556
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
121 ItemGen *v294; // esi@575
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
122 int v295; // edx@575
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
123 int kk; // edi@575
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
124 char v313; // al@606pGame->GetStru6()
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
125 const char *v317; // ecx@617
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
126 Player *v318; // ecx@619
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
127 unsigned int v319; // edi@627
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
128 int v323; // edi@635
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
129 char *v324; // eax@635
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
130 Player *v325; // ecx@640
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
131 int v328; // ecx@651
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
132 int v329; // ecx@652
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
133 int v330; // edi@654
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
134 signed int v342; // edi@668
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
135 signed int v343; // edi@670
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
136 unsigned __int64 v344; // ST08_8@670
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
137 Player *v351; // edi@680
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
138 Player *v357; // edi@694
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
139 Actor *v369; // edi@705
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
140 int v373; // eax@715
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
141 int v374; // eax@717
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
142 int v376; // eax@717
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
143 Player *v377; // ecx@719
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
144 int v381; // edi@727
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
145 int v382; // ecx@727
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
146 Player *v383; // eax@728
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
147 int v384; // eax@733
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
148 int v388; // edi@740
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
149 int v396; // eax@752
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
150 int v397; // eax@757
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
151 int v398; // eax@757
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
152 int v399; // eax@757
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
153 Actor *v417; // eax@787
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
154 int v418; // ecx@789
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
155 __int16 v419; // ax@791
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
156 signed int v420; // eax@793
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
157 ItemGen *v421; // edx@793
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
158 const char *v422; // eax@801
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
159 signed int v426; // eax@815
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
160 Actor *v433; // edi@832
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
161 int v435; // ecx@837
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
162 int v440; // eax@843
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
163 int v441; // eax@847
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
164 signed int v445; // edi@857
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
165 __int16 v448; // ax@864
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
166 char *v449; // esi@870
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
167 int v450; // eax@870
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
168 signed int v460; // eax@895
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
169 Actor *v461; // eax@897
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
170 unsigned __int16 v462; // cx@897
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
171 signed int v463; // edx@897
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
172 int v470; // edi@913
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
173 int v471; // eax@917
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
174 int v472; // eax@917
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
175 int v498; // edi@931
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
176 int v499; // eax@935
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
177 int v500; // eax@935
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
178 Player *v501; // edi@939
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
179 int v505; // eax@943
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
180 int v507; // edi@944
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
181 signed int v509; // eax@944
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
182 Actor *v518; // edx@957
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
183 __int16 v519; // cx@958
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
184 int v531; // eax@982
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
185 int v533; // edi@983
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
186 signed int v535; // eax@983
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
187 signed int v536; // edi@983
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
188 stru6 *v537; // eax@984
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
189 double v549; // st7@991
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
190 unsigned __int16 v550; // di@991
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
191 Player *v553; // edi@1001
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
192 unsigned __int16 v562; // di@1005
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
193 signed int v563; // eax@1010
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
194 unsigned int v564; // ecx@1011
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
195 signed int v565; // eax@1012
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
196 Player **v566; // ecx@1012
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
197 int v567; // eax@1012
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
198 Player *v571; // eax@1013
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
199 char *v572; // ecx@1013
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
200 signed int v576; // eax@1025
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
201 Player *v577; // eax@1026
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
202 int v578; // eax@1028
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
203 __int16 v579; // ax@1029
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
204 int v581; // edi@1031
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
205 char *v585; // esi@1034
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
206 signed int v587; // eax@1035
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
207 char v591; // al@1048
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
208 ItemGen *v592; // esi@1052
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
209 int v596; // esi@1066
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
210 unsigned int v597; // edi@1067
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
211 NPCData *pNPCData; // eax@1089
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
212 int v606; // edx@1091
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
213 AwardType *v607; // ecx@1100
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
214 __int16 v608; // ax@1102
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
215 signed int v609; // eax@1104
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
216 int v610; // edi@1106
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
217 unsigned int v611; // eax@1106
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
218 Player *v612; // edi@1106
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
219 DDM_DLV_Header *v613; // eax@1108
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
220 int v615; // edi@1119
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
221 Player *v619; // edi@1123
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
222 signed __int64 v623; // qax@1127
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
223 int v625; // edi@1129
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
224 signed int v627; // eax@1129
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
225 signed int v628; // edi@1129
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
226 int v629; // ecx@1130
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
227 Player *v630; // eax@1131
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
228 int v631; // eax@1137
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
229 int v635; // edi@1142
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
230 int v642; // edi@1156
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
231 int v643; // eax@1156
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
232 int v644; // eax@1156
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
233 signed int v645; // eax@1158
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
234 unsigned int v656; // [sp-4h] [bp-E88h]@639
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
235 int v659; // [sp+0h] [bp-E84h]@123
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
236 Actor *v661; // [sp+0h] [bp-E84h]@164
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
237 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
238 const char *v664; // [sp+0h] [bp-E84h]@802
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
239 int v666; // [sp+4h] [bp-E80h]@12
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
240 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
241 int v675; // [sp+4h] [bp-E80h]@800
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
242 int v679[800]; // [sp+14h] [bp-E70h]@515
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
243 AIDirection a3; // [sp+C94h] [bp-1F0h]@21
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
244 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
245 int v682[4]; // [sp+CC0h] [bp-1C4h]@731
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
246 //ItemGen v683; // [sp+CD0h] [bp-1B4h]@791
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
247 int v684; // [sp+D04h] [bp-180h]@416
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
248 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
249 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
250 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
251 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
252 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
253 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
254 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
255 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
256 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
257 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
258 int v710; // [sp+D8Ch] [bp-F8h]@1156
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
259 __int64 v712; // [sp+D94h] [bp-F0h]@991
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
260 int v713; // [sp+D9Ch] [bp-E8h]@324
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
261 int n; // [sp+DA0h] [bp-E4h]@1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
262 AIDirection v715; // [sp+DA4h] [bp-E0h]@21
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
263 __int64 v717; // [sp+DC4h] [bp-C0h]@271
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
264 float v718; // [sp+DCCh] [bp-B8h]@176
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
265 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
266 char *y; // [sp+DD4h] [bp-B0h]@325
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
267 int v721;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
268 int mon_id;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
269 int dist_Y; // [sp+DD8h] [bp-ACh]@163
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
270 int v723; // [sp+E4Ch] [bp-38h]@1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
271 ItemGen *_this; // [sp+E50h] [bp-34h]@23
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
272 float v725; // [sp+E54h] [bp-30h]@23
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
273 int buff_resist;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
274 Player *v726; // [sp+E58h] [bp-2Ch]@131
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
275 float v727; // [sp+E5Ch] [bp-28h]@1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
276 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
277 Player *pPlayer; // [sp+E64h] [bp-20h]@8
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
278 int v730; // [sp+E68h] [bp-1Ch]@53
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
279 Player *v730b;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
280 ItemGen *v730c;
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
281 int skill_level; // [sp+E6Ch] [bp-18h]@48
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
282 signed int v732; // [sp+E70h] [bp-14h]@325
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
283 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
284 int duration;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
285 signed int a2; // [sp+E7Ch] [bp-8h]@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
286 int amount; // [sp+E80h] [bp-4h]@1
2183
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
287 int obj_type;
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
288 ItemDesc* _item;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
289
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
290 SpriteObject pSpellSprite; // [sp+DDCh] [bp-A8h]@1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
291
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
292 spell_level = 0;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
293 amount = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
294 LODWORD(v733) = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
295 v723 = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
296 v727 = 0.0;
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
297 for(n = 0; n < CastSpellInfoCount; ++n)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
298 {
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
299 pCastSpell = &pCastSpellInfo[n];
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
300 HIDWORD(v733) = (int)pCastSpell;
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
301 if ( pCastSpell->uSpellID == 0 )
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
302 continue;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
303
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
304 if (pParty->Invisible())
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
305 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
306
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
307 if ( pCastSpell->uFlags & 0x3CA )
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
308 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
309 if ( !pParty->pPlayers[pCastSpell->uPlayerID].CanAct() )
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
310 _427D48();
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
311 continue;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
312 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
313 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
314
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
315 a2 = pCastSpell->spell_target_pid;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
316 if (!pCastSpell->spell_target_pid)
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
317 {
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
318 if (pCastSpell->uSpellID == SPELL_LIGHT_DESTROY_UNDEAD ||
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
319 pCastSpell->uSpellID == SPELL_SPIRIT_TURN_UNDEAD ||
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
320 pCastSpell->uSpellID == SPELL_DARK_CONTROL_UNDEAD )
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
321 v666 = 1;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
322 else
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
323 v666 = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
324
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
325 a2 = stru_50C198.FindClosestActor(5120, 1, v666);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
326 v6 = pMouse->uPointingObjectID;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
327 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
328 a2 = pMouse->uPointingObjectID;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
329 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
330
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
331
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
332 pSpellSprite.uType = stru_4E3ACC[pCastSpell->uSpellID].uType;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
333 if (pSpellSprite.uType)
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
334 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
335 if (PID_TYPE(a2) == OBJECT_Actor)
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
336 {
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1906
diff changeset
337 Actor::GetDirectionInfo(PID(OBJECT_Player, pCastSpell->uPlayerID + 1), a2, &v715, 0);
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
338 spell_level = v723;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
339 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
340 else
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
341 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
342 v715.uYawAngle = pParty->sRotationY;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
343 v715.uPitchAngle = pParty->sRotationX;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
344 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
345 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
346
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
347 LODWORD(v725) = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
348 _this = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
349 if (pCastSpell->forced_spell_skill_level)
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
350 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
351 v11 = pCastSpell->forced_spell_skill_level;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
352 v723 = v11 & 0x3F; // 6 bytes
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
353 spell_level = v723;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
354 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
355 else
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
356 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
357 //v667 = PLAYER_SKILL_STAFF;
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
358 if (pCastSpell->uSpellID < SPELL_AIR_WIZARD_EYE)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
359 v667 = PLAYER_SKILL_FIRE;
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
360 else if (pCastSpell->uSpellID < SPELL_WATER_AWAKEN)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
361 v667 = PLAYER_SKILL_AIR;
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
362 else if (pCastSpell->uSpellID < SPELL_EARTH_STUN)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
363 v667 = PLAYER_SKILL_WATER;
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
364 else if (pCastSpell->uSpellID < SPELL_SPIRIT_DETECT_LIFE)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
365 v667 = PLAYER_SKILL_EARTH;
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
366 else if (pCastSpell->uSpellID < SPELL_MIND_REMOVE_FEAR)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
367 v667 = PLAYER_SKILL_SPIRIT;
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
368 else if (pCastSpell->uSpellID < SPELL_BODY_CURE_WEAKNESS)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
369 v667 = PLAYER_SKILL_MIND;
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
370 else if (pCastSpell->uSpellID < SPELL_LIGHT_LIGHT_BOLT)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
371 v667 = PLAYER_SKILL_BODY;
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
372 else if (pCastSpell->uSpellID < SPELL_DARK_REANIMATE)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
373 v667 = PLAYER_SKILL_LIGHT;
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
374 else if (pCastSpell->uSpellID < SPELL_BOW_ARROW)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
375 v667 = PLAYER_SKILL_DARK;
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
376 else if (pCastSpell->uSpellID == SPELL_BOW_ARROW)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
377 v667 = PLAYER_SKILL_BOW;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
378 else assert(false && "Unknown spell");
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
379
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
380 LODWORD(v725) = v667;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
381 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F;
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
382 spell_level = v723;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
383 v11 = pPlayer->pActiveSkills[LODWORD(v725)];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
384 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
385
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
386 skill_level = SkillToMastery(v11);
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
387
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
388 if (pCastSpell->forced_spell_skill_level)
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
389 uRequiredMana = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
390 else
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
391 uRequiredMana = pSpellDatas[pCastSpell->uSpellID].mana_per_skill[skill_level - 1];
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
392 sRecoveryTime = pSpellDatas[pCastSpell->uSpellID].recovery_per_skill[skill_level - 1];
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
393
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
394 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 ||
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
395 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0)
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
396 uRequiredMana = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
397
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
398 if (pCastSpell->uSpellID < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
399 {
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
400 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2); // "Not enough spell points"
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
401 pCastSpell->uSpellID = 0;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
402 continue;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
403 }
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
404 v730 = pCastSpell->uSpellID;
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
405 if (pPlayer->IsCursed() && pCastSpell->uSpellID < SPELL_BOW_ARROW && rand() % 100 < 50)//
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
406 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
407 if (!pParty->bTurnBasedModeOn)
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
408 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
409 else
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
410 {
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
411 pParty->pTurnBasedPlayerRecoveryTimes[pCastSpellInfo[n].uPlayerID] = 100;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
412 pPlayer->SetRecoveryTime(sRecoveryTime);
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1362
diff changeset
413 pTurnEngine->ApplyPlayerAction();
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
414 }
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
415 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // "Spell failed"
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
416 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
417 pCastSpellInfo[n].uSpellID = 0;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
418 pPlayer->sMana -= uRequiredMana;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
419 return;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
420 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
421
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
422 switch ( pCastSpell->uSpellID )
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
423 {
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
424 case SPELL_101:
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
425 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow");
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
426 case SPELL_BOW_ARROW://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
427 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
428 amount = 1;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
429 if ( SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
430 amount = 2;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
431 sRecoveryTime = pPlayer->GetAttackRecoveryTime(true);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
432 pSpellSprite.stru_24.Reset();
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
433 pSpellSprite.spell_level = spell_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
434 pSpellSprite.spell_id = pCastSpell->uSpellID;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
435 pSpellSprite.spell_skill = skill_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
436 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
437 if ( pPlayer->WearsItem(ITEM_ARTEFACT_ULLYSES, EQUIP_BOW) )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
438 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
439 pSpellSprite.vPosition.x = pParty->vPosition.x;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
440 pSpellSprite.vPosition.y = pParty->vPosition.y;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
441 pSpellSprite.uAttributes = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
442 pSpellSprite.uSpriteFrameID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
443 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
444 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
445 pSpellSprite.spell_target_pid = a2;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
446 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
447 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
448 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
449 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID];
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
450 memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItemList[pPlayer->pEquipment.uBow-1], sizeof(pSpellSprite.stru_24));
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
451 pSpellSprite.uAttributes = 256;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
452 if ( pParty->bTurnBasedModeOn == 1 )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
453 pSpellSprite.uAttributes = 260;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
454 for ( i = 0; i < amount; ++i )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
455 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
456 if ( i )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
457 pSpellSprite.vPosition.z += 32;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
458 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
459 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
460 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
461 ++pTurnEngine->pending_actions;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
462 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
463 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
464 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
465 case SPELL_LASER_PROJECTILE://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
466 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
467 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
468 pSpellSprite.stru_24.Reset();
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
469 pSpellSprite.spell_id = pCastSpell->uSpellID;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
470 pSpellSprite.spell_level = v723;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
471 pSpellSprite.spell_skill = skill_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
472 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
473 pSpellSprite.vPosition.x = pParty->vPosition.x;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
474 pSpellSprite.vPosition.y = pParty->vPosition.y;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
475 pSpellSprite.uAttributes = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
476 pSpellSprite.uSpriteFrameID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
477 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
478 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
479 pSpellSprite.spell_target_pid = a2;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
480 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
481 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
482 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
483 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID];
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
484 memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItemList[pPlayer->pEquipment.uMainHand - 1],sizeof(pSpellSprite.stru_24));
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
485 // &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
486 // * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], );
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
487 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
488 HIBYTE(pSpellSprite.uAttributes) |= 1;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
489 if ( pParty->bTurnBasedModeOn == 1 )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
490 LOBYTE(pSpellSprite.uAttributes) |= 4;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
491 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
492 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
493 ++pTurnEngine->pending_actions;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
494 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
495 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
496 case SPELL_FIRE_TORCH_LIGHT://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
497 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
498 switch (skill_level)
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
499 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
500 case 1: amount = 2; break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
501 case 2: amount = 3; break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
502 case 3:
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
503 case 4: amount = 4; break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
504 default:
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
505 assert(false);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
506 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
507 if ( !pPlayer->CanCastSpell(uRequiredMana) )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
508 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
509 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * spell_level * 4.2666669), skill_level, amount, 0, 0);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
510 LODWORD(v727) = 1;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
511 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
512 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
513 case SPELL_FIRE_FIRE_SPIKE://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
514 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
515 switch (skill_level)
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
516 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
517 case 1: amount = 3; break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
518 case 2: amount = 5; break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
519 case 3: amount = 7; break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
520 case 4: amount = 9; break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
521 default:
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
522 assert(false);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
523 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
524 int _v733 = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
525 for (uint i = 0; i < uNumSpriteObjects; ++i)
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
526 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
527 SpriteObject* object = &pSpriteObjects[i];
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
528 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID))
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
529 ++_v733;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
530 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
531 if ( _v733 > amount )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
532 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
533 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
534 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
535 pCastSpell->uSpellID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
536 continue;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
537 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
538 if ( !pPlayer->CanCastSpell(uRequiredMana) )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
539 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
540 pSpellSprite.stru_24.Reset();
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
541 pSpellSprite.spell_id = pCastSpell->uSpellID;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
542 pSpellSprite.spell_level = spell_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
543 pSpellSprite.spell_skill = skill_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
544 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
545 pSpellSprite.vPosition.y = pParty->vPosition.y;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
546 pSpellSprite.vPosition.x = pParty->vPosition.x;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
547 pSpellSprite.uAttributes = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
548 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
549 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
550 pSpellSprite.uSpriteFrameID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
551 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
552 pSpellSprite.spell_target_pid = a2;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
553 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
554 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
555 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
556 if ( pParty->bTurnBasedModeOn == 1 )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
557 LOBYTE(pSpellSprite.uAttributes) |= 4;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
558 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
559 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
560 ++pTurnEngine->pending_actions;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
561 LODWORD(v727) = 1;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
562 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
563 }
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
564 case SPELL_AIR_IMPLOSION://
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
565 {
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
566 mon_id = PID_ID(a2);
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
567 if ( !pPlayer->CanCastSpell(uRequiredMana) )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
568 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
569 if (!a2)
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
570 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
571 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
572 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
573 pCastSpell->uSpellID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
574 continue;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
575 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
576 if (PID_TYPE(a2) == OBJECT_Actor)
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
577 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
578 v697.x = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
579 v697.y = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
580 v697.z = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
581 pSpellSprite.stru_24.Reset();
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
582 pSpellSprite.spell_id = pCastSpell->uSpellID;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
583 pSpellSprite.spell_level = spell_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
584 pSpellSprite.spell_skill = skill_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
585 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
586 pSpellSprite.uAttributes = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
587 pSpellSprite.uSectorID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
588 pSpellSprite.uSpriteFrameID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
589 pSpellSprite.field_60_distance_related_prolly_lod = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
590 pSpellSprite.uFacing = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
591 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
592 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
593 pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
594 pSpellSprite.vPosition.z = pActors[mon_id].vPosition.z;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
595 pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
596 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, mon_id);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
597 DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), mon_id, &v697);
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
598 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
599 LODWORD(v727) = 1;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
600 break;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
601 }
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
602 case SPELL_EARTH_MASS_DISTORTION://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
603 {
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
604 mon_id = PID_ID(a2);
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
605 if ( !pPlayer->CanCastSpell(uRequiredMana) )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
606 break;
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
607 if ( stru_50C198.GetMagicalResistance(&pActors[mon_id], 3) )
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
608 {
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
609 pActors[mon_id].pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0);
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
610 v704.x = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
611 v704.y = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
612 v704.z = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
613 pSpellSprite.stru_24.Reset();
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
614 pSpellSprite.spell_id = pCastSpell->uSpellID;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
615 pSpellSprite.spell_level = spell_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
616 pSpellSprite.spell_skill = skill_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
617 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
618 pSpellSprite.uAttributes = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
619 pSpellSprite.uSectorID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
620 pSpellSprite.uSpriteFrameID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
621 pSpellSprite.field_60_distance_related_prolly_lod = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
622 pSpellSprite.uFacing = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
623 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
624 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
625 pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
626 pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
627 pSpellSprite.vPosition.z = pActors[mon_id].vPosition.z;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
628 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, mon_id);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
629 DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), mon_id, &v704);
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
630 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
631 LODWORD(v727) = 1;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
632 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
633 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
634 case SPELL_LIGHT_DESTROY_UNDEAD://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
635 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
636 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor)
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
637 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
638 //v730 = a2 >> 3;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
639 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)];
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
640 v691.x = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
641 v691.y = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
642 v691.z = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
643 pSpellSprite.stru_24.Reset();
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
644 pSpellSprite.spell_id = pCastSpell->uSpellID;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
645 pSpellSprite.spell_level = spell_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
646 pSpellSprite.spell_skill = skill_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
647 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
648 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
649 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
650 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
651 pSpellSprite.uAttributes = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
652 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
653 pSpellSprite.uSpriteFrameID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
654 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
655 pSpellSprite.spell_target_pid = a2;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
656 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
657 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
658 pSpellSprite.uAttributes |= 0x80u;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
659 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
660 int obj_id = pSpellSprite.Create(0, 0, 0, 0);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
661 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
662 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
663 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
664 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
665 pCastSpell->uSpellID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
666 continue;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
667 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
668 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
669 LODWORD(v727) = 1;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
670 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
671 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
672 case SPELL_FIRE_FIRE_BOLT://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
673 case SPELL_FIRE_FIREBALL://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
674 case SPELL_FIRE_INCINERATE://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
675 case SPELL_AIR_LIGHNING_BOLT://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
676 case SPELL_WATER_ICE_BOLT://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
677 case SPELL_WATER_ICE_BLAST://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
678 case SPELL_EARTH_STUN://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
679 case SPELL_EARTH_DEADLY_SWARM://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
680 case SPELL_MIND_MIND_BLAST://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
681 case SPELL_MIND_PSYCHIC_SHOCK://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
682 case SPELL_BODY_HARM://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
683 case SPELL_LIGHT_LIGHT_BOLT://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
684 case SPELL_DARK_DRAGON_BREATH://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
685 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
686 if ( !pPlayer->CanCastSpell(uRequiredMana) )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
687 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
688 pSpellSprite.stru_24.Reset();
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
689 pSpellSprite.spell_id = pCastSpell->uSpellID;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
690 pSpellSprite.spell_level = spell_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
691 pSpellSprite.spell_skill = skill_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
692 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
693 pSpellSprite.vPosition.y = pParty->vPosition.y;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
694 pSpellSprite.vPosition.x = pParty->vPosition.x;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
695 pSpellSprite.uAttributes = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
696 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
697 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
698 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
699 else
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
700 pSpellSprite.uSectorID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
701 pSpellSprite.uSpriteFrameID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
702 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
703 pSpellSprite.spell_target_pid = a2;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
704 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
705 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
706 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
707 if ( pParty->bTurnBasedModeOn == 1 )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
708 LOBYTE(pSpellSprite.uAttributes) |= 4;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
709 if ( pCastSpell->uSpellID == SPELL_AIR_LIGHNING_BOLT )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
710 LOBYTE(pSpellSprite.uAttributes) |= 0x40;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
711 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
712 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
713 ++pTurnEngine->pending_actions;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
714 LODWORD(v727) = 1;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
715 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
716 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
717 case SPELL_WATER_ACID_BURST://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
718 case SPELL_EARTH_BLADES://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
719 case SPELL_BODY_FLYING_FIST://
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
720 case SPELL_DARK_TOXIC_CLOUD://-
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
721 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
722 if ( !pPlayer->CanCastSpell(uRequiredMana) )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
723 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
724 pSpellSprite.stru_24.Reset();
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
725 pSpellSprite.spell_id = pCastSpell->uSpellID;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
726 pSpellSprite.spell_level = spell_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
727 pSpellSprite.spell_skill = skill_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
728 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
729 pSpellSprite.uAttributes = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
730 pSpellSprite.vPosition.x = pParty->vPosition.x;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
731 pSpellSprite.vPosition.y = pParty->vPosition.y;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
732 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
733 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
734 pSpellSprite.uSpriteFrameID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
735 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
736 pSpellSprite.spell_target_pid = a2;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
737 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
738 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
739 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
740 if ( pParty->bTurnBasedModeOn == 1 )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
741 LOBYTE(pSpellSprite.uAttributes) |= 4;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
742 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
743 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
744 ++pTurnEngine->pending_actions;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
745 LODWORD(v727) = 1;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
746 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
747 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
748 case SPELL_LIGHT_SUNRAY://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
749 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
750 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
751 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 21) )//
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
752 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
753 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
754 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
755 pCastSpell->uSpellID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
756 continue;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
757 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
758 if ( pPlayer->CanCastSpell(uRequiredMana) )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
759 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
760 pSpellSprite.stru_24.Reset();
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
761 pSpellSprite.spell_id = pCastSpell->uSpellID;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
762 pSpellSprite.spell_skill = skill_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
763 pSpellSprite.spell_level = spell_level;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
764 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
765 pSpellSprite.uAttributes = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
766 pSpellSprite.vPosition.x = pParty->vPosition.x;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
767 pSpellSprite.vPosition.y = pParty->vPosition.y;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
768 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
769 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
770 pSpellSprite.uSpriteFrameID = 0;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
771 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
772 pSpellSprite.spell_target_pid = a2;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
773 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
774 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
775 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
776 if ( pParty->bTurnBasedModeOn == 1 )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
777 LOBYTE(pSpellSprite.uAttributes) |= 4;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
778 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
779 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
780 ++pTurnEngine->pending_actions;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
781 LODWORD(v727) = 1;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
782 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
783 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
784 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
785 case SPELL_LIGHT_PARALYZE://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
786 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
787 if ( !pPlayer->CanCastSpell(uRequiredMana) )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
788 break;
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
789 mon_id = PID_ID(a2);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
790 if (PID_TYPE(a2) == OBJECT_Actor && stru_50C198.GetMagicalResistance(&pActors[mon_id], 9) )
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
791 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
792 Actor::AI_Stand(PID_ID(a2), 4, 0x80, 0);
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
793 pActors[mon_id].pActorBuffs[ACTOR_BUFF_PARALYZED].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)23040 * spell_level * 0.033333335), skill_level, 0, 0, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
794 pActors[mon_id].uAttributes |= 0x80000;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
795 pActors[mon_id].vVelocity.x = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
796 pActors[mon_id].vVelocity.y = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
797 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0);
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
798 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
799 LODWORD(v727) = 1;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
800 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
801 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
802 case SPELL_EARTH_SLOW://
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
803 {
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
804 switch (skill_level)
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
805 {
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
806 case 1: LODWORD(v733) = 180 * spell_level; amount = 2; break;//LODWORD(v733)???
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
807 case 2: LODWORD(v733) = 300 * spell_level; amount = 2; break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
808 case 3: LODWORD(v733) = 300 * spell_level; amount = 4; break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
809 case 4: LODWORD(v733) = 300 * spell_level; amount = 8; break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
810 default:
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
811 assert(false);
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
812 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
813 if ( !pPlayer->CanCastSpell(uRequiredMana) )
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
814 break;
2181
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
815 //v721 = 836 * PID_ID(a2);
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
816 mon_id = PID_ID(a2);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
817 if (PID_TYPE(a2) == OBJECT_Actor && stru_50C198.GetMagicalResistance(&pActors[mon_id], 3) )
2181
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
818 {
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
819 pActors[mon_id].pActorBuffs[ACTOR_BUFF_SLOWED].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)23040 * spell_level * 0.033333335), skill_level, amount, 0, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
820 pActors[mon_id].uAttributes |= 0x80000;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
821 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0);
2181
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
822 }
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
823 LODWORD(v727) = 1;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
824 break;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
825 }
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
826 case SPELL_MIND_CHARM://
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
827 {
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
828 v61 = PID_ID(a2);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
829 if ( !pPlayer->CanCastSpell(uRequiredMana) )
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
830 break;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
831 if ( stru_50C198.GetMagicalResistance(&pActors[v61], 7) )
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
832 {
2181
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
833 uint power = 300 * spell_level;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
834 if ( skill_level == 2 )
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
835 power = 600 * spell_level;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
836 else if ( skill_level == 3 )
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
837 power = 29030400;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
838
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
839 pActors[v61].pActorBuffs[ACTOR_BUFF_BERSERK].Reset();
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
840 pActors[v61].pActorBuffs[ACTOR_BUFF_ENSLAVED].Reset();
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
841 pActors[v61].pActorBuffs[ACTOR_BUFF_CHARM].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), skill_level, 0, 0, 0);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
842 pSpellSprite.stru_24.Reset();
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
843 pSpellSprite.spell_id = pCastSpell->uSpellID;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
844 pSpellSprite.spell_level = spell_level;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
845 pSpellSprite.spell_skill = skill_level;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
846 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
847 pSpellSprite.vPosition.x = pActors[v61].vPosition.x;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
848 pSpellSprite.vPosition.y = pActors[v61].vPosition.y;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
849 pSpellSprite.vPosition.z = pActors[v61].vPosition.z + pActors[v61].uActorHeight;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
850 pSpellSprite.uAttributes = 0;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
851 pSpellSprite.uSectorID = pIndoor->GetSector(pActors[v61].vPosition.x, pActors[v61].vPosition.y, pSpellSprite.vPosition.z);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
852 pSpellSprite.uSpriteFrameID = 0;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
853 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
854 pSpellSprite.spell_target_pid = a2;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
855 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
856 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
857 LOBYTE(pSpellSprite.uAttributes) |= 0x80u;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
858 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
859 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
2179
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
860 }
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
861 LODWORD(v727) = 1;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
862 break;
f0b5ca2dfb73 _427E01_cast_spell continue
Ritor1
parents: 2155
diff changeset
863 }
2181
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
864 case SPELL_DARK_SHRINKING_RAY://
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
865 {
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
866 if ( !pPlayer->CanCastSpell(uRequiredMana) )
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
867 break;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
868 pSpellSprite.stru_24.Reset();
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
869 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
870 pSpellSprite.vPosition.x = pParty->vPosition.x;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
871 pSpellSprite.vPosition.y = pParty->vPosition.y;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
872 pSpellSprite.uAttributes = 0;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
873 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
874 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
875 pSpellSprite.uSpriteFrameID = 0;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
876 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
877 pSpellSprite.spell_target_pid = a2;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
878 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
879 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
880 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
881 pSpellSprite.spell_skill = skill_level;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
882 pSpellSprite.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
883 pSpellSprite.spell_level = 300 * spell_level;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
884 if ( pParty->bTurnBasedModeOn == 1 )
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
885 LOBYTE(pSpellSprite.uAttributes) |= 4;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
886 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
887 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
888 ++pTurnEngine->pending_actions;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
889 LODWORD(v727) = 1;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
890 break;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
891 }
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
892 case SPELL_FIRE_FIRE_AURA: //
2181
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
893 {
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
894 switch (skill_level)
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
895 {
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
896 case 1: duration = 3600 * spell_level; amount = 10; break; //
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
897 case 2: duration = 3600 * spell_level; amount = 11; break; //
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
898 case 3: duration = 3600 * spell_level; amount = 12; break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
899 case 4: duration = 0; amount = 12; break;
2181
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
900 default:
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
901 assert(false);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
902 }
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
903 if ( !pPlayer->CanCastSpell(uRequiredMana) )
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
904 break;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
905 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2];
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
906 _item = &pItemsTable->pItems[v730c->uItemID];
2181
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
907 v730c->UpdateTempBonus(pParty->uTimePlayed);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
908 if ( v730c->uItemID < 64 || v730c->uItemID > 65
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
909 && !v730c->IsBroken()
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
910 && !v730c->uSpecEnchantmentType
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
911 && !v730c->uEnchantmentType
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
912 && ( _item->uEquipType == EQUIP_SINGLE_HANDED || _item->uEquipType == EQUIP_TWO_HANDED || _item->uEquipType == EQUIP_BOW)
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
913 && !pItemsTable->IsMaterialNonCommon(v730c) )
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
914 {
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
915 v730c->uSpecEnchantmentType = amount;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
916 if ( skill_level != 4 )
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
917 {
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
918 v730c->uExpireTime = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335);
2181
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
919 v730c->uAttributes |= ITEM_TEMP_BONUS;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
920 }
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
921 v730c->uAttributes |= ITEM_AURA_EFFECT_RED;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
922 _50C9A8_item_enchantment_timer = 256;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
923 LODWORD(v727) = 1;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
924 break;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
925 }
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
926 _50C9D0_AfterEnchClickEventId = 113;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
927 _50C9D4_AfterEnchClickEventSecondParam = 0;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
928 _50C9D8_AfterEnchClickEventTimeout = 1;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
929 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
930 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
931 pCastSpell->uSpellID = 0;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
932 continue;
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
933 }
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
934 case SPELL_BODY_REGENERATION://
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
935 {
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
936 switch (skill_level)
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
937 {
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
938 case 1: amount = 1; break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
939 case 2: amount = 1; break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
940 case 3: amount = 3; break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
941 case 4: amount = 10; break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
942 default:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
943 assert(false);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
944 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
945 if ( !pPlayer->CanCastSpell(uRequiredMana) )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
946 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
947 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
948 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(3600 * spell_level) * 4.2666669), skill_level, amount, 0, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
949 LODWORD(v727) = 1;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
950 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
951 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
952 case SPELL_FIRE_PROTECTION_FROM_FIRE://
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
953 case SPELL_AIR_PROTECTION_FROM_AIR://
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
954 case SPELL_WATER_PROTECTION_FROM_WATER://
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
955 case SPELL_EARTH_PROTECTION_FROM_EARTH://
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
956 case SPELL_MIND_PROTECTION_FROM_MIND://
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
957 case SPELL_BODY_PROTECTION_FROM_BODY://
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
958 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
959 switch (skill_level)
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
960 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
961 case 1:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
962 case 2:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
963 case 3:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
964 case 4: amount = skill_level * spell_level; break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
965 default:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
966 assert(false);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
967 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
968 switch (pCastSpell->uSpellID)
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
969 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
970 case SPELL_FIRE_PROTECTION_FROM_FIRE:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
971 buff_resist = PARTY_BUFF_RESIST_FIRE;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
972 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
973 case SPELL_AIR_PROTECTION_FROM_AIR:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
974 buff_resist = PARTY_BUFF_RESIST_AIR;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
975 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
976 case SPELL_WATER_PROTECTION_FROM_WATER:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
977 buff_resist = PARTY_BUFF_RESIST_WATER;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
978 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
979 case SPELL_EARTH_PROTECTION_FROM_EARTH:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
980 buff_resist = PARTY_BUFF_RESIST_EARTH;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
981 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
982 case SPELL_MIND_PROTECTION_FROM_MIND:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
983 buff_resist = PARTY_BUFF_RESIST_MIND;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
984 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
985 case SPELL_BODY_PROTECTION_FROM_BODY:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
986 buff_resist = PARTY_BUFF_RESIST_BODY;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
987 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
988 default:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
989 assert(false);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
990 continue;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
991 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
992 if ( !pPlayer->CanCastSpell(uRequiredMana) )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
993 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
994 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
995 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
996 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
997 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
998 //v90 = (double)(signed int)(3600 * spell_level) * 4.2666669;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
999 pParty->pPartyBuffs[buff_resist].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(3600 * spell_level) * 4.2666669), skill_level, amount, 0, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1000 LODWORD(v727) = 1;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1001 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1002 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1003 case SPELL_FIRE_HASTE://
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1004 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1005 switch (skill_level)
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1006 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1007 case 1: duration = 60 * (spell_level + 60); break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1008 case 2: duration = 60 * (spell_level + 60); break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1009 case 3: duration = 180 * (spell_level + 20); break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1010 case 4: duration = 240 * (spell_level + 15); break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1011 default:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1012 assert(false);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1013 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1014 if ( pPlayer->CanCastSpell(uRequiredMana) )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1015 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1016 LODWORD(v727) = 1;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1017 for ( uint pl_id = 0; pl_id < 4; pl_id++ )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1018 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1019 if ( pParty->pPlayers[pl_id].pConditions[Condition_Weak] )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1020 LODWORD(v727) = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1021 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1022 if (LODWORD(v727))
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1023 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1024 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1025 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1026 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1027 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1028 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1029 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1030 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1031 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1032 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1033 case SPELL_SPIRIT_BLESS://
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1034 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1035 switch (skill_level)
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1036 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1037 case 1: duration = 300 * (spell_level + 12); break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1038 case 2: duration = 300 * (spell_level + 12); break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1039 case 3: duration = 900 * (spell_level + 4); break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1040 case 4: duration = 3600 * (spell_level + 1); break;
2181
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
1041 default:
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
1042 assert(false);
17b3e40daedc _427E01_cast_spell continue
Ritor1
parents: 2179
diff changeset
1043 }
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1044 amount = spell_level + 5;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1045 if ( !pPlayer->CanCastSpell(uRequiredMana) )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1046 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1047 if ( skill_level == 1 )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1048 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1049 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1050 v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1051 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed +
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1052 (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), 1, amount, v111, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1053 LODWORD(v727) = 1;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1054 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1055 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1056 for ( uint pl_id = 0; pl_id < 4; pl_id++ )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1057 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1058 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1059 v111 = pOtherOverlayList->_4418B1(10000, pl_id + 310, 0, 65536);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1060 pParty->pPlayers[pl_id].pPlayerBuffs[1].Apply(pParty->uTimePlayed +
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1061 (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, v111, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1062 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1063 LODWORD(v727) = 1;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1064 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1065 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1066 case SPELL_SPIRIT_SPIRIT_LASH://
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1067 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1068 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor)
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1069 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1070 int mon_id = PID_ID(a2);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1071 dist_X = abs(pActors[mon_id].vPosition.x - pParty->vPosition.x);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1072 dist_Y = abs(pActors[mon_id].vPosition.y - pParty->vPosition.y);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1073 dist_Z = abs(pActors[mon_id].vPosition.z - pParty->vPosition.z);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1074 int count = dist_X;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1075 new_dist_Y = dist_Y;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1076 if ( dist_X < dist_Y )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1077 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1078 v116 = dist_X;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1079 dist_X = dist_Y;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1080 new_dist_Y = v116;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1081 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1082 if ( dist_X < dist_Z )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1083 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1084 v117 = dist_X;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1085 dist_X = dist_Z;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1086 dist_Z = v117;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1087 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1088 if ( new_dist_Y < dist_Z )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1089 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1090 v118 = dist_Z;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1091 dist_Z = new_dist_Y;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1092 new_dist_Y = v118;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1093 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1094 count = ((unsigned int)(11 * new_dist_Y) >> 5) + (dist_Z >> 2) + dist_X;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1095 if ( (double)count <= 307.2 )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1096 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1097 v701.x = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1098 v701.y = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1099 v701.z = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1100 pSpellSprite.stru_24.Reset();
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1101 pSpellSprite.spell_id = pCastSpell->uSpellID;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1102 pSpellSprite.spell_level = v723;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1103 pSpellSprite.spell_skill = skill_level;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1104 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1105 pSpellSprite.uAttributes = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1106 pSpellSprite.uSectorID = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1107 pSpellSprite.uSpriteFrameID = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1108 pSpellSprite.field_60_distance_related_prolly_lod = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1109 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1110 pSpellSprite.uFacing = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1111 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1112 pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1113 pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1114 pSpellSprite.vPosition.z = pActors[mon_id].vPosition.z - (unsigned int)(signed __int64)((double)pActors[mon_id].uActorHeight * -0.8);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1115 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1116 DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), mon_id, &v701);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1117 LODWORD(v727) = 1;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1118 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1119 else
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1120 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1121 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2);//" !!!"
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1122 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1123 pCastSpell->uSpellID = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1124 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1125 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1126 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1127 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1128 case SPELL_AIR_SHIELD://
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1129 case SPELL_EARTH_STONESKIN://
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1130 case SPELL_SPIRIT_HEROISM://
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1131 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1132 switch (skill_level)
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1133 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1134 case 1: duration = 300 * (spell_level + 12); break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1135 case 2: duration = 300 * (spell_level + 12); break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1136 case 3: duration = 900 * (spell_level + 4); break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1137 case 4: duration = 3600 * (spell_level + 1); break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1138 default:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1139 assert(false);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1140 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1141 switch (pCastSpell->uSpellID)
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1142 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1143 case SPELL_AIR_SHIELD:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1144 amount = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1145 buff_resist = PARTY_BUFF_SHIELD;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1146 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1147 case SPELL_EARTH_STONESKIN:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1148 amount = spell_level + 5;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1149 buff_resist = PARTY_BUFF_STONE_SKIN;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1150 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1151 case SPELL_SPIRIT_HEROISM:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1152 amount = spell_level + 5;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1153 buff_resist = PARTY_BUFF_HEROISM;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1154 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1155 default:
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1156 assert(false);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1157 continue;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1158 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1159 if ( !pPlayer->CanCastSpell(uRequiredMana) )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1160 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1161 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1162 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1163 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1164 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1165 pParty->pPartyBuffs[buff_resist].Apply(pParty->uTimePlayed +
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1166 (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1167 LODWORD(v727) = 1;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1168 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1169 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1170 case SPELL_FIRE_IMMOLATION://
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1171 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1172 if ( skill_level == 4 )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1173 duration = 600 * spell_level;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1174 else
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1175 duration = 60 * spell_level;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1176 if ( !pPlayer->CanCastSpell(uRequiredMana) )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1177 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1178 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1179 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1180 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1181 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1182 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed +
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1183 (signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, spell_level, 0, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1184 LODWORD(v727) = 1;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1185 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1186 }
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1187 case SPELL_FIRE_METEOR_SHOWER://
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1188 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1189 //if (skill_level < 3)//
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1190 //break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1191 int meteor_num;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1192 if ( skill_level == 4 )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1193 meteor_num = 20;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1194 else
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1195 meteor_num = 16;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1196 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1197 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1198 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors!
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1199 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1200 pCastSpell->uSpellID = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1201 continue;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1202 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1203 if ( !pPlayer->CanCastSpell(uRequiredMana) )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1204 break;
2183
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1205 obj_type = PID_TYPE(a2);
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1206 mon_id = PID_ID(a2);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1207 if (obj_type == OBJECT_Actor)// .,
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1208 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1209 dist_X = pActors[mon_id].vPosition.x;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1210 dist_Y = pActors[mon_id].vPosition.y;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1211 dist_Z = pActors[mon_id].vPosition.z;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1212 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1213 else
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1214 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1215 dist_X = pParty->vPosition.x + fixpoint_mul(2048, stru_5C6E00->Cos(pParty->sRotationY));
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1216 dist_Y = pParty->vPosition.y + fixpoint_mul(2048, stru_5C6E00->Sin(pParty->sRotationY));
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1217 dist_Z = pParty->vPosition.z;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1218 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1219 unsigned __int64 k = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1220 int j = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1221 if ( meteor_num > 0 )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1222 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1223 v730 = obj_type == OBJECT_Actor ? a2 : 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1224 for ( meteor_num; meteor_num; meteor_num-- )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1225 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1226 a2 = rand() % 1000;
2183
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1227 if ( sqrt(((double)a2 - 2500) * ((double)a2 - 2500) + j * j + k * k) <= 1.0 )
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1228 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1229 LODWORD(v687) = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1230 HIDWORD(v687) = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1231 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1232 else
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1233 {
2183
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1234 HIDWORD(v687) = stru_5C6E00->Atan2((signed __int64)sqrt((float)(j * j + k * k)), (double)a2 - 2500);
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1235 LODWORD(v687) = stru_5C6E00->Atan2(j, k);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1236 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1237 pSpellSprite.stru_24.Reset();
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1238 pSpellSprite.spell_id = pCastSpell->uSpellID;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1239 pSpellSprite.spell_level = spell_level;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1240 pSpellSprite.spell_skill = skill_level;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1241 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1242 pSpellSprite.uAttributes = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1243 pSpellSprite.vPosition.x = dist_X;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1244 pSpellSprite.vPosition.y = dist_Y;
2183
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1245 pSpellSprite.vPosition.z = a2 + dist_Z;
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1246 pSpellSprite.uSectorID = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1247 pSpellSprite.uSpriteFrameID = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1248 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1249 pSpellSprite.spell_target_pid = v730;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1250 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1251 pSpellSprite.uFacing = v687;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1252 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1253 if ( pParty->bTurnBasedModeOn == 1 )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1254 pSpellSprite.uAttributes = 4;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1255 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 && pParty->bTurnBasedModeOn == 1 )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1256 ++pTurnEngine->pending_actions;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1257 j = rand() % 1024 - 512;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1258 k = rand() % 1024 - 512;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1259 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1260 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1261 LODWORD(v727) = 1;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1262 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1263 }
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1264 case SPELL_FIRE_INFERNO://
2182
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1265 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1266 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1267 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1268 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors!
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1269 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1270 pCastSpell->uSpellID = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1271 continue;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1272 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1273 if ( !pPlayer->CanCastSpell(uRequiredMana) )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1274 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1275 int mon_num = pRenderer->_466_GetActorsInViewport(4096);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1276 v700.x = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1277 v700.y = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1278 v700.z = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1279 pSpellSprite.stru_24.Reset();
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1280 pSpellSprite.spell_id = pCastSpell->uSpellID;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1281 pSpellSprite.spell_level = spell_level;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1282 pSpellSprite.spell_skill = skill_level;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1283 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1284 pSpellSprite.uAttributes = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1285 pSpellSprite.uSectorID = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1286 pSpellSprite.uSpriteFrameID = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1287 pSpellSprite.field_60_distance_related_prolly_lod = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1288 pSpellSprite.uFacing = 0;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1289 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1290 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1291 for ( uint i = 0; i < mon_num; i++ )
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1292 {
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1293 pSpellSprite.vPosition.x = pActors[_50BF30_actors_in_viewport_ids[i]].vPosition.x;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1294 pSpellSprite.vPosition.y = pActors[_50BF30_actors_in_viewport_ids[i]].vPosition.y;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1295 pSpellSprite.vPosition.z = pActors[_50BF30_actors_in_viewport_ids[i]].vPosition.z - (unsigned int)(signed __int64)((double)pActors[_50BF30_actors_in_viewport_ids[i]].uActorHeight * -0.8);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1296 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[i]);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1297 DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), _50BF30_actors_in_viewport_ids[i], &v700);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1298 pGame->GetStru6()->_4A81CA(&pSpellSprite);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1299 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1E, 0x40);
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1300 }
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1301 LODWORD(v727) = 1;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1302 break;
e1e4a8a20b5f _46А6АС_GetActorsInViewport
Ritor1
parents: 2181
diff changeset
1303 }
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1304 case SPELL_AIR_WIZARD_EYE://
2183
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1305 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1306 duration = 3600 * spell_level;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1307 if ( !pPlayer->CanCastSpell(uRequiredMana) )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1308 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1309 for ( uint pl_id = 0; pl_id < 4; pl_id++ )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1310 v169 = pOtherOverlayList->_4418B1(2000, pl_id + 100, 0, 65536);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1311 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, v169, 0);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1312 LODWORD(v727) = 1;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1313 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1314 }
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1315 case SPELL_AIR_FEATHER_FALL:// ()
2183
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1316 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1317 switch (skill_level)
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1318 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1319 case 1: duration = 300 * spell_level; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1320 case 2: duration = 600 * spell_level; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1321 case 3: duration = 3600 * spell_level; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1322 case 4: duration = 3600 * spell_level; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1323 default:
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1324 assert(false);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1325 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1326 if ( !pPlayer->CanCastSpell(uRequiredMana) )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1327 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1328 for ( uint pl_id = 0; pl_id < 4; pl_id++ )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1329 pOtherOverlayList->_4418B1(2010, pl_id + 100, 0, 65536);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1330 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1331 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1332 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1333 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
1334
2183
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1335 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(pParty->uTimePlayed +
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1336 (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1337 LODWORD(v727) = 1;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1338 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1339 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1340 case SPELL_AIR_SPARKS://
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1341 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1342 switch (skill_level)
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1343 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1344 case 1: amount = 3; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1345 case 2: amount = 5; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1346 case 3: amount = 7; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1347 case 4: amount = 9; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1348 default:
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1349 assert(false);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1350 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1351 if ( !pPlayer->CanCastSpell(uRequiredMana) )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1352 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1353 int _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1354 pSpellSprite.stru_24.Reset();
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1355 pSpellSprite.spell_id = pCastSpell->uSpellID;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1356 pSpellSprite.spell_level = spell_level;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1357 pSpellSprite.spell_skill = skill_level;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1358 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1359 pSpellSprite.vPosition.y = pParty->vPosition.y;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1360 pSpellSprite.vPosition.x = pParty->vPosition.x;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1361 pSpellSprite.uAttributes = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1362 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1363 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y,
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1364 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1365 pSpellSprite.uSpriteFrameID = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1366 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1367 pSpellSprite.spell_target_pid = a2;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1368 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1369 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1370 if ( pParty->bTurnBasedModeOn == 1 )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1371 LOBYTE(pSpellSprite.uAttributes) |= 4;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1372 v188 = (signed int)_v726 / -2;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1373 v189 = (signed int)_v726 / 2;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1374 while ( v188 <= v189 )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1375 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1376 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1377 if ( pSpellSprite.Create((signed __int16)(v188 + LOWORD(v715.uYawAngle)), v715.uPitchAngle,
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1378 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, pCastSpell->uPlayerID + 1) != -1
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1379 && pParty->bTurnBasedModeOn == 1 )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1380 ++pTurnEngine->pending_actions;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1381 v188 += _v726 / (amount - 1);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1382 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1383 LODWORD(v727) = 1;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1384 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1385 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1386 case SPELL_AIR_JUMP://
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1387 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1388 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING)
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1389 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1390 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne!
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1391 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1392 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1393 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1394 if ( !pPlayer->CanCastSpell(uRequiredMana) )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1395 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1396 for ( uint pl_id = 0; pl_id < 4; pl_id++ )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1397 pOtherOverlayList->_4418B1(2040, pl_id + 100, 0, 65536);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1398 pParty->uFlags |= 0x100;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1399 pParty->uFallSpeed = 1000;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1400 LODWORD(v727) = 1;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1401 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1402 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1403 case SPELL_AIR_INVISIBILITY://
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1404 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1405 switch (skill_level)
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1406 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1407 case 1: duration = 600 * spell_level; amount = spell_level; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1408 case 2: duration = 600 * spell_level; amount = 2 * spell_level; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1409 case 3: duration = 600 * spell_level; amount = 3 * spell_level; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1410 case 4: duration = 3600 * spell_level; amount = 4 * spell_level; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1411 default:
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1412 assert(false);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1413 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1414 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW))
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1415 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1416 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby!
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1417 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1418 pCastSpell->uSpellID = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1419 continue;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1420 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1421 if ( pPlayer->CanCastSpell(uRequiredMana) )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1422 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1423 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1424 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1425 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1426 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1427 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed +
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1428 (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1429 LODWORD(v727) = 1;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1430 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1431 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1432 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1433 case SPELL_AIR_FLY://
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1434 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1435 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1436 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1437 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors!
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1438 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1439 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1440 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1441 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1442 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1443 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1444 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1445 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1446 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1447 if ( skill_level == 1 || skill_level == 2 || skill_level == 3 )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1448 amount = 1;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1449 else
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1450 amount = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1451 if ( !pPlayer->CanCastSpell(uRequiredMana) )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1452 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1453 for ( uint pl_id = 0; pl_id < 4; pl_id++)
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1454 pOtherOverlayList->_4418B1(2090, pl_id + 100, 0, 65536);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1455 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1456 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)(3600 * spell_level) << 7)
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1457 * 0.033333335), skill_level, amount, v206, pCastSpell->uPlayerID + 1);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1458 LODWORD(v727) = 1;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1459 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1460 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1461 case SPELL_AIR_STARBURST://
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1462 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1463 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1464 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1465 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors!
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1466 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1467 pCastSpell->uSpellID = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1468 continue;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1469 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1470 if ( !pPlayer->CanCastSpell(uRequiredMana) )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1471 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1472 obj_type = PID_TYPE(a2);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1473 mon_id = PID_ID(a2);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1474 if ( obj_type == OBJECT_Actor )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1475 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1476 dist_X = pActors[mon_id].vPosition.x;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1477 dist_Y = pActors[mon_id].vPosition.y;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1478 dist_Z = pActors[mon_id].vPosition.z;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1479 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1480 else
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1481 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1482 dist_X = pParty->vPosition.x + fixpoint_mul(2048, stru_5C6E00->Cos(pParty->sRotationY));
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1483 dist_Y = pParty->vPosition.y + fixpoint_mul(2048, stru_5C6E00->Sin(pParty->sRotationY));
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1484 dist_Z = pParty->vPosition.z;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1485 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1486 unsigned __int64 k = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1487 int j = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1488 v730 = obj_type == OBJECT_Actor ? a2 : 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1489 for ( uint star_num = 20; star_num; star_num-- )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1490 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1491 a2 = rand() % 1000;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1492 if ( sqrt(((double)a2 + (double)dist_Z - (double)(dist_Z + 2500)) * ((double)a2 + (double)dist_Z - (double)(dist_Z + 2500))
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1493 + j * j + k * k) <= 1.0 )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1494 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1495 LODWORD(v685) = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1496 HIDWORD(v685) = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1497 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1498 else
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1499 {
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1500 HIDWORD(v685) = stru_5C6E00->Atan2((signed __int64)sqrt((float)(j * j + k * k)), ((double)a2 + (double)dist_Z - (double)(dist_Z + 2500)));
2183
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1501 LODWORD(v685) = stru_5C6E00->Atan2(j, k);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1502 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1503 pSpellSprite.stru_24.Reset();
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1504 pSpellSprite.spell_id = pCastSpell->uSpellID;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1505 pSpellSprite.spell_level = spell_level;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1506 pSpellSprite.spell_skill = skill_level;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1507 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1508 pSpellSprite.uAttributes = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1509 pSpellSprite.vPosition.x = dist_X;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1510 pSpellSprite.vPosition.y = dist_Y;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1511 pSpellSprite.vPosition.z = (int)(a2 + (dist_Z + 2500));
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1512 pSpellSprite.uSectorID = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1513 pSpellSprite.uSpriteFrameID = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1514 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1515 pSpellSprite.spell_target_pid = v730;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1516 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1517 pSpellSprite.uFacing = v685;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1518 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1519 if ( pParty->bTurnBasedModeOn == 1 )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1520 pSpellSprite.uAttributes = 4;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1521 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1522 && pParty->bTurnBasedModeOn == 1 )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1523 ++pTurnEngine->pending_actions;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1524 j = rand() % 1024 - 512;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1525 k = rand() % 1024 - 512;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1526 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1527 LODWORD(v727) = 1;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1528 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1529 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1530 case SPELL_WATER_AWAKEN://
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1531 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1532 switch (skill_level)
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1533 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1534 case 1: amount = 180 * spell_level; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1535 case 2: amount = 3600 * spell_level; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1536 case 3: amount = 86400 * spell_level; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1537 case 4: amount = 0; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1538 default:
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1539 assert(false);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1540 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1541 if ( !pPlayer->CanCastSpell(uRequiredMana) )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1542 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1543 for( int i=0; i < 4; i++ )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1544 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1545 if ( skill_level == 4 )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1546 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1547 if ( pParty->pPlayers[i].pConditions[Condition_Sleep] )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1548 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1549 pParty->pPlayers[i].pConditions[Condition_Sleep] = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1550 pParty->pPlayers[i].PlaySound(SPEECH_103, 0);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1551 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1552 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1553 else
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1554 {
2185
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1555 if ( pParty->pPlayers[i].DiscardConditionIfLastsLongerThan(Condition_Sleep, pParty->uTimePlayed -
2183
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1556 (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)) )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1557 pParty->pPlayers[i].PlaySound(SPEECH_103, 0);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1558 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1559 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1560 LODWORD(v727) = 1;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1561 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1562 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1563 case SPELL_WATER_POISON_SPRAY://
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1564 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1565 switch (skill_level)
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1566 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1567 case 1: amount = 1; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1568 case 2: amount = 3; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1569 case 3: amount = 5; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1570 case 4: amount = 7; break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1571 default:
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1572 assert(false);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1573 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1574 if ( !pPlayer->CanCastSpell(uRequiredMana) )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1575 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1576 signed int _v733 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1577 if ( amount == 1 )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1578 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1579 pSpellSprite.stru_24.Reset();
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1580 pSpellSprite.spell_id = pCastSpell->uSpellID;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1581 pSpellSprite.spell_skill = skill_level;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1582 pSpellSprite.spell_level = spell_level;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1583 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1584 pSpellSprite.uAttributes = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1585 pSpellSprite.vPosition.x = pParty->vPosition.x;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1586 pSpellSprite.vPosition.y = pParty->vPosition.y;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1587 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1588 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1589 pSpellSprite.uSpriteFrameID = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1590 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1591 pSpellSprite.spell_target_pid = a2;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1592 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1593 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1594 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1595 if ( pParty->bTurnBasedModeOn == 1 )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1596 LOBYTE(pSpellSprite.uAttributes) |= 4;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1597 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1598 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1599 ++pTurnEngine->pending_actions;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1600 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1601 else
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1602 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1603 pSpellSprite.stru_24.Reset();
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1604 pSpellSprite.spell_id = pCastSpell->uSpellID;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1605 pSpellSprite.spell_level = spell_level;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1606 pSpellSprite.spell_skill = skill_level;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1607 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1608 pSpellSprite.vPosition.y = pParty->vPosition.y;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1609 pSpellSprite.vPosition.x = pParty->vPosition.x;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1610 pSpellSprite.uAttributes = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1611 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1612 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1613 pSpellSprite.uSpriteFrameID = 0;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1614 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1615 pSpellSprite.spell_target_pid = a2;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1616 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1617 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1618 if ( pParty->bTurnBasedModeOn == 1 )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1619 LOBYTE(pSpellSprite.uAttributes) |= 4;
2189
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
1620 v188 = _v733 / -2;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
1621 v189 = _v733 / 2;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
1622 if ( v188 <= v189 )
2183
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1623 {
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1624 do
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1625 {
2189
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
1626 pSpellSprite.uFacing = v188 + v715.uYawAngle;
2183
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1627 if ( pSpellSprite.Create(pSpellSprite.uFacing, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1628 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1629 ++pTurnEngine->pending_actions;
2189
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
1630 v188 += _v733 / (amount - 1);
2183
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1631 }
2189
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
1632 while ( v188 <= v189 );
2183
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1633 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1634 }
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1635 LODWORD(v727) = 1;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1636 break;
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1637 }
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1638 case SPELL_WATER_WATER_WALK://
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1639 {
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1640 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() )
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1641 {
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1642 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1643 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1644 break;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1645 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1646 switch (skill_level)
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1647 {
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1648 case 1: //break;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1649 case 2: duration = 600 * spell_level; break;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1650 case 3:
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1651 case 4: duration = 3600 * spell_level; break;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1652 default:
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1653 assert(false);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1654 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1655 if ( !pPlayer->CanCastSpell(uRequiredMana) )
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1656 break;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1657 v169 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1658 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1659 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1660 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1661 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1662 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(duration << 7) * 0.033333335),
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1663 skill_level, amount, v169, pCastSpell->uPlayerID + 1);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1664 if ( skill_level == 4 )
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1665 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1666 LODWORD(v727) = 1;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1667 break;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1668 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1669 case SPELL_WATER_RECHARGE_ITEM://
2183
172cfb4ee150 CastSpell
Ritor1
parents: 2182
diff changeset
1670 {
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1671 if ( !pPlayer->CanCastSpell(uRequiredMana) )
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1672 break;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1673 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2];
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1674 if ( v730c->GetItemEquipType() != 12 || v730c->uAttributes & 2 )
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1675 {
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1676 _50C9D0_AfterEnchClickEventId = 113;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1677 _50C9D4_AfterEnchClickEventSecondParam = 0;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1678 _50C9D8_AfterEnchClickEventTimeout = 1;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1679 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1680 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1681 pCastSpell->uSpellID = 0;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1682 continue;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1683 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1684 if ( skill_level == 1 || skill_level == 2 )
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1685 v241 = (double)v723 * 0.0099999998 + 0.5;//50 %
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1686 else if ( skill_level == 3 )
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1687 v241 = (double)v723 * 0.0099999998 + 0.69999999;//30 %
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1688 else if ( skill_level == 4 )
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1689 v241 = (double)v723 * 0.0099999998 + 0.80000001;//20 %
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1690 else
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1691 v241 = 0.0;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1692 if ( v241 > 1.0 )
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1693 v241 = 1.0;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1694 int uNewCharges = v730c->uMaxCharges * v241;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1695 v730c->uMaxCharges = uNewCharges;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1696 v730c->uNumCharges = uNewCharges;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1697 if ( uNewCharges <= 0 )
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1698 {
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1699 v730c = 0;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1700 _50C9D0_AfterEnchClickEventId = 113;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1701 _50C9D4_AfterEnchClickEventSecondParam = 0;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1702 _50C9D8_AfterEnchClickEventTimeout = 1;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1703 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2);// !!!
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1704 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1705 pCastSpell->uSpellID = 0;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1706 spell_level = v723;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1707 continue;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1708 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1709 v730c->uAttributes |= 0x40u;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1710 _50C9A8_item_enchantment_timer = 256;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1711 LODWORD(v727) = 1;
1682
3c451fd02fcf OnInventoryLeftClick cleanup
Grumpy7
parents: 1643
diff changeset
1712 break;
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1713 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1714 case SPELL_WATER_ENCHANT_ITEM://
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1715 {
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1716 if ( !pPlayer->CanCastSpell(uRequiredMana) )
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1717 break;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1718 uRequiredMana = 0;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1719 amount = 10 * spell_level;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1720 bool item_not_broken = true;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1721 int rnd = rand() % 100;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1722 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID_2];
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1723 v245 = &pPlayer->pInventoryItemList[a2];
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1724 ItemDesc *_v725 = &pItemsTable->pItems[v245->uItemID];
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1725 if ((skill_level == 1 || skill_level == 2 /*&& _v725->uEquipType > EQUIP_BOW*/ || skill_level == 3 || skill_level == 4) &&
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1726 v245->uItemID <= 134 &&
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1727 v245->uSpecEnchantmentType == 0 && v245->uEnchantmentType == 0 &&
2185
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1728 v245->m_enchantmentStrength== 0 && !v245->IsBroken() ) //
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1729 {
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1730 if ( (v245->GetValue() < 450 && ( skill_level == 1 || skill_level == 2 ))
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1731 || (v245->GetValue() < 450 && (skill_level == 3|| skill_level == 4 ) && _v725->uEquipType >= EQUIP_SINGLE_HANDED && _v725->uEquipType <= EQUIP_BOW)
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1732 || (v245->GetValue() < 250 && (skill_level == 3 || skill_level == 4 )&& _v725->uEquipType > EQUIP_BOW) )//
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1733 {
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1734 if ( !(v245->uAttributes & 0x200) )//
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1735 {
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1736 v245->uAttributes |= 2;//
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1737 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1738 item_not_broken = false;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1739 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1740 else
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1741 {
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1742 if ( rnd >= 10 * spell_level )//
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1743 {
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1744 if ( !(v245->uAttributes & 0x200) )//
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1745 v245->uAttributes |= 2;//
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1746 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1747 else
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1748 {
2185
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1749 if ( (rnd < 80 && (skill_level == 3 || skill_level == 4 )) || v245->GetValue() < 450 || (v245->GetValue() < 250
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1750 && (skill_level == 3 || skill_level == 4) && _v725->uEquipType >= EQUIP_SINGLE_HANDED && _v725->uEquipType <= EQUIP_BOW))
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1751 {
2185
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1752 v313 = _v725->uEquipType;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1753 if ( _v725->uEquipType >= EQUIP_ARMOUR && _v725->uEquipType <= EQUIP_AMULET )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1754 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1755 v295 = rand() % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType];
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1756 /*v245->uEnchantmentType = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1757 __debugbreak(); // castspellinfo.cpp(1971): warning C4700: uninitialized local variable 'v294' used
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1758 for ( kk = pItemsTable->pEnchantments[0].to_item[v245->GetItemEquipType() + 1];
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1759 ;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1760 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[v245->GetItemEquipType() + 1] )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1761 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1762 ++v245->uEnchantmentType;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1763 if ( kk >= v295 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1764 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1765 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1766 v255 = 10;//pItemsTable->field_116D8[17];
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1767 v256 = 10;//pItemsTable->field_116D8[16];
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1768 v245->m_enchantmentStrength = v256 + rand() % (v255 - v256 + 1);*/
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1769 v245->uEnchantmentType = v295;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1770 v245->m_enchantmentStrength = pItemsTable->pEnchantments[v295].to_item[_v725->uEquipType - EQUIP_ARMOUR];
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1771 v245->uAttributes |= 0x20u;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1772 _50C9A8_item_enchantment_timer = 256;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1773 LODWORD(v727) = 1;
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1774 break;
2185
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1775 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1776 else if ( skill_level == 3 || skill_level == 4)//
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1777 {
2185
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1778 v258 = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1779 v725 = 0.0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1780 int _v733;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1781 if ( pItemsTable->pSpecialEnchantments_count > 0 )
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1782 {
2185
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1783 v730 = (int)&v679;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1784 for ( _v733 = 0; _v733 < pItemsTable->pSpecialEnchantments_count; ++_v733 )
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1785 {
2185
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1786 v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1787 if ( !v259 || v259 == 1 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1788 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1789 v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[v245->GetItemEquipType() + 4] + v258 * 28);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1790 LODWORD(v725) += v260;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1791 if ( v260 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1792 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1793 v261 = v730;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1794 v730 += 4;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1795 *(int *)v261 = _v733;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1796 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1797 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1798 ++v258;
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1799 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1800 }
2185
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1801 v262 = rand() % SLODWORD(v725);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1802 v263 = v679;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1803 v245->uSpecEnchantmentType = v679[0];
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1804 v264 = pItemsTable->pSpecialEnchantments[*v263].to_item_apply[v245->GetItemEquipType() + 4];
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1805 v265 = v262 + 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1806 if ( v264 < v265 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1807 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1808 for ( ii = v679; ; ii = (int *)v732 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1809 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1810 v267 = (int)(ii + 1);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1811 v732 = v267;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1812 v268 = *(int *)v267;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1813 *(int *)(v245 + 12) = v268;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1814 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[v245->GetItemEquipType() + 4];
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1815 if ( v264 >= v265 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1816 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1817 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1818 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1819 v278 = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1820 v725 = 0.0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1821 if ( pItemsTable->pSpecialEnchantments_count > 0 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1822 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1823 int *_v730 = v679;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1824 for ( _v733 = 0; _v733 < pItemsTable->pSpecialEnchantments_count; ++_v733 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1825 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1826 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278].pBonusStatement);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1827 if ( !v279 || v279 == 1 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1828 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1829 v280 = *(&pItemsTable->pSpecialEnchantments[v278].to_item_apply[v245->GetItemEquipType()]);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1830 _v733 += v280;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1831 if ( v280 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1832 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1833 v281 = _v730;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1834 ++_v730;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1835 *v281 = _v733;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1836 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1837 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1838 ++v278;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1839 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1840 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1841 v282 = rand() % _v733;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1842 v283 = v679;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1843 v245->uSpecEnchantmentType = v679[0];
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1844 v284 = pItemsTable->pSpecialEnchantments[*v283].to_item_apply[v245->GetItemEquipType() ];
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1845 v285 = v282 + 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1846 for ( l = v679; v284 < v285; ++l )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1847 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1848 v245->uSpecEnchantmentType = *(l+1);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1849 v284 += pItemsTable->pSpecialEnchantments[*(l+1)].to_item_apply[v245->GetItemEquipType()];
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1850 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1851 ++v245->uSpecEnchantmentType;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1852 v245->uAttributes |= 0x20u;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1853 _50C9A8_item_enchantment_timer = 256;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1854 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1855 break;
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1856 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1857 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1858 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1859 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1860 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1861 if ( LODWORD(v727) == 0 )
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1862 {
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1863 v317 = pGlobalTXT_LocalizationStrings[428];// !!!
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1864 if ( item_not_broken == false )
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1865 v317 = pGlobalTXT_LocalizationStrings[585];//
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1866 ShowStatusBarString(v317, 2);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1867 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1868 //v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1869 pCastSpell->uSpellID = 0;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1870 pParty->pPlayers[pCastSpell->uPlayerID_2].PlaySound(SPEECH_43, 0);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1871 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1872 break;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1873 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1874 case SPELL_WATER_TOWN_PORTAL://
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1875 {
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1876 amount = 10 * spell_level;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1877 if ( pPlayer->sMana < (signed int)uRequiredMana )
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1878 break;
2185
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1879 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && skill_level != 4
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1880 || rand() % 100 >= amount && skill_level != 4 )
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1881 {
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1882 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1883 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1884 pCastSpell->uSpellID = 0;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1885 continue;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1886 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1887 town_portal_caster_id = pCastSpell->uPlayerID;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1888 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1889 LODWORD(v727) = 1;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1890 break;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1891 }
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1892 case SPELL_WATER_LLOYDS_BEACON://
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1893 {
2185
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1894 if ( !_stricmp(pCurrentMapName, "d05.blv") ) // Arena
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1895 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1896 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1897 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1898 pCastSpell->uSpellID = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1899 continue;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1900 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1901 if ( pPlayer->sMana >= (signed int)uRequiredMana )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1902 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1903 pEventTimer->Pause();
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1904 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1905 lloyds_beacon_spell_level = (signed int)(604800 * spell_level);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1906 _506348_current_lloyd_playerid = pCastSpell->uPlayerID;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1907 ::uRequiredMana = uRequiredMana;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1908 ::sRecoveryTime = sRecoveryTime;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1909 lloyds_beacon_sound_id = pCastSpell->sound_id;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1910 lloyds_beacon_spell_id = pCastSpell->uSpellID;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1911 pCastSpell->uFlags |= 0x20u;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1912 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1913 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1914 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1915 case SPELL_EARTH_STONE_TO_FLESH:
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1916 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1917 switch (skill_level)
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1918 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1919 case 1: amount = 3600 * spell_level; break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1920 case 2: amount = 3600 * spell_level; break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1921 case 3: amount = 86400 * spell_level; break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1922 case 4: break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1923 default:
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1924 assert(false);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1925 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1926 if ( !pPlayer->CanCastSpell(uRequiredMana) )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1927 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1928 if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Pertified] )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1929 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1930 if ( skill_level == 4 )//for GM
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1931 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1932 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Pertified] = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1933 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1934 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1935 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1936 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
1937 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Pertified, v663);
2185
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1938 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1939 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1940 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1941 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1942 case SPELL_EARTH_ROCK_BLAST://
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1943 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1944 if ( !pPlayer->CanCastSpell(uRequiredMana) )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1945 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1946 pSpellSprite.stru_24.Reset();
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1947 pSpellSprite.spell_id = pCastSpell->uSpellID;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1948 pSpellSprite.spell_level = spell_level;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1949 pSpellSprite.spell_skill = skill_level;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1950 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1951 pSpellSprite.vPosition.y = pParty->vPosition.y;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1952 pSpellSprite.vPosition.x = pParty->vPosition.x;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1953 pSpellSprite.uAttributes = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1954 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1955 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1956 pSpellSprite.uSpriteFrameID = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1957 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1958 pSpellSprite.spell_target_pid = a2;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1959 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1960 pSpellSprite.uFacing = LOWORD(pParty->sRotationY);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1961 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1962 if ( pParty->bTurnBasedModeOn == 1 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1963 LOBYTE(pSpellSprite.uAttributes) |= 4;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1964 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1965 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1966 && pParty->bTurnBasedModeOn == 1 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1967 ++pTurnEngine->pending_actions;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1968 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1969 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1970 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1971 case SPELL_EARTH_DEATH_BLOSSOM: //
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1972 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1973 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1974 {
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1975 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1976 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1977 pCastSpell->uSpellID = 0;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1978 continue;
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2183
diff changeset
1979 }
2185
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1980 if ( !pPlayer->CanCastSpell(uRequiredMana) )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1981 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1982 pSpellSprite.uType = 4090;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1983 pSpellSprite.stru_24.Reset();
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1984 pSpellSprite.spell_id = pCastSpell->uSpellID;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1985 pSpellSprite.spell_level = spell_level;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1986 pSpellSprite.spell_skill = skill_level;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1987 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1988 pSpellSprite.vPosition.x = pParty->vPosition.x;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1989 pSpellSprite.vPosition.y = pParty->vPosition.y;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1990 pSpellSprite.uAttributes = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1991 pSpellSprite.uSectorID = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1992 pSpellSprite.uSpriteFrameID = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1993 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1994 pSpellSprite.field_60_distance_related_prolly_lod = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1995 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1996 pSpellSprite.spell_target_pid = a2;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1997 pSpellSprite.uFacing = LOWORD(pParty->sRotationY);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1998 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
1999 if ( pParty->bTurnBasedModeOn == 1 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2000 pSpellSprite.uAttributes = 4;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2001 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2002 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2003 && pParty->bTurnBasedModeOn == 1 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2004 ++pTurnEngine->pending_actions;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2005 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2006 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2007 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2008 case SPELL_SPIRIT_DETECT_LIFE: //
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2009 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2010 switch (skill_level)
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2011 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2012 case 1: amount = 600 * spell_level; break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2013 case 2: amount = 1800 * spell_level; break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2014 case 3:
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2015 case 4: amount = 3600 * spell_level; break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2016 default:
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2017 assert(false);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2018 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2019 if ( !pPlayer->CanCastSpell(uRequiredMana) )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2020 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2021 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2022 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2023 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2024 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2025 pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].Apply(pParty->uTimePlayed +
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2026 (signed int)(signed __int64)((double)(signed int)((int)amount << 7) * 0.033333335), skill_level, 0, 0, 0);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2027 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2028 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2029 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2030 case SPELL_SPIRIT_FATE://
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2031 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2032 switch (skill_level)
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2033 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2034 case 1: amount = spell_level; break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2035 case 2: amount = 2 * spell_level; break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2036 case 3: amount = 4 * spell_level; break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2037 case 4: amount = 6 * spell_level; break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2038 default:
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2039 assert(false);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2040 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2041 //LODWORD(v733) = 300;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2042 if ( !pPlayer->CanCastSpell(uRequiredMana) )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2043 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2044 if ( pCastSpell->spell_target_pid == 0 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2045 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2046 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2047 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, skill_level, amount, 0, 0);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2048 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2049 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2050 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2051 if (PID_TYPE(pCastSpell->spell_target_pid) == OBJECT_Actor)
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2052 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2053 mon_id = PID_ID(pCastSpell->spell_target_pid);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2054 pActors[mon_id].pActorBuffs[ACTOR_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, skill_level, amount, 0, 0);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2055 pActors[mon_id].uAttributes |= 0x80000;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2056 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2057 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2058 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2059 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2060 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2061 case SPELL_SPIRIT_REMOVE_CURSE://
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2062 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2063 switch (skill_level)
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2064 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2065 case 1: amount = 3600 * spell_level; break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2066 case 2: amount = 3600 * spell_level; break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2067 case 3: amount = 86400 * spell_level; break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2068 case 4: amount = 0; break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2069 default:
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2070 assert(false);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2071 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2072 if ( !pPlayer->CanCastSpell(uRequiredMana) )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2073 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2074 if ( !pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Cursed] )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2075 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2076 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2077 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2078 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2079 if ( skill_level == 4 )//GM
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2080 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Cursed] = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2081 else
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2082 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2083 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(0,
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2084 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2085 if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Cursed] )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2086 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2087 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2088 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2089 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2090 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2091 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2092 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2093 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2094 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2095 case SPELL_SPIRIT_PRESERVATION://
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2096 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2097 if ( skill_level == 4 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2098 duration = 900 * (spell_level + 4);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2099 else
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2100 duration = 300 * (spell_level + 12);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2101 if ( !pPlayer->CanCastSpell(uRequiredMana) )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2102 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2103 if ( skill_level == 1 || skill_level == 2 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2104 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2105 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2106 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed +
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2107 (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2108 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2109 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2110 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2111 for ( uint pl_id = 0; pl_id < 4; pl_id++ )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2112 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2113 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2114 pParty->pPlayers[pl_id].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed +
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2115 (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2116 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2117 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2118 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2119 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2120 case SPELL_SPIRIT_TURN_UNDEAD://
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2121 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2122 if ( skill_level == 1 || skill_level == 2)
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2123 duration = 60 * (spell_level + 3);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2124 else
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2125 duration = 300 * spell_level + 180;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2126 if ( !pPlayer->CanCastSpell(uRequiredMana) )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2127 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2128 int mon_num = pRenderer->_466_GetActorsInViewport(4096);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2129 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFF, 192);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2130 ++pSpellSprite.uType;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2131 pSpellSprite.stru_24.Reset();
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2132 pSpellSprite.spell_id = pCastSpell->uSpellID;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2133 pSpellSprite.spell_level = spell_level;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2134 pSpellSprite.spell_skill = skill_level;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2135 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2136 pSpellSprite.uAttributes = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2137 pSpellSprite.uSectorID = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2138 pSpellSprite.uSpriteFrameID = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2139 pSpellSprite.field_60_distance_related_prolly_lod = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2140 pSpellSprite.uFacing = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2141 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2142 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2143 for ( a2 = 0; a2 < mon_num; ++a2 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2144 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2145 if ( MonsterStats::BelongsToSupertype(pActors[_50BF30_actors_in_viewport_ids[a2]].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2146 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2147 pSpellSprite.vPosition.x = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.x;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2148 pSpellSprite.vPosition.y = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.y;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2149 pSpellSprite.vPosition.z = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.z - (unsigned int)(signed __int64)((double)pActors[_50BF30_actors_in_viewport_ids[a2]].uActorHeight * -0.8);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2150 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2151 pSpellSprite.Create(0, 0, 0, 0);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2152 pActors[_50BF30_actors_in_viewport_ids[a2]].pActorBuffs[ACTOR_BUFF_AFRAID].Apply(pParty->uTimePlayed +
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2153 (signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2154 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2155 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2156 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2157 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2158 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2159 case SPELL_SPIRIT_RAISE_DEAD://
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2160 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2161 if ( skill_level == 4 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2162 amount = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2163 else
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2164 amount = 86400 * spell_level;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2165 if ( !pPlayer->CanCastSpell(uRequiredMana) )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2166 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2167 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2168 if ( !pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Dead] )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2169 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2170 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2171 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2172 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2173 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2174 if ( skill_level == 4 )
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2175 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2176 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Dead] = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2177 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Unconcious] = 0;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2178 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2179 else
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2180 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2181 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Dead,
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2182 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2183 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Unconcious,
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2184 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2185 }
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2186 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(Condition_Weak, 0);
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2187 LODWORD(v727) = 1;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2188 break;
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2189 }
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2190 case SPELL_SPIRIT_SHARED_LIFE://
2185
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2191 {
385040580292 CastSpell continue
Ritor1
parents: 2184
diff changeset
2192 if ( skill_level == 4 )
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2193 amount = 4 * spell_level;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2194 else
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2195 amount = 3 * spell_level;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2196 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2197 break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2198 int active_pl_num = 0;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2199 signed int shared_life_count = amount;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2200 int mean_life = 0;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2201 int pl_array[4];
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2202 for ( uint pl_id = 1; pl_id <= 4; pl_id++ )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2203 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2204 if ( !pPlayers[pl_id]->pConditions[Condition_Dead] && !pPlayers[pl_id]->pConditions[Condition_Pertified]
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2205 && !pPlayers[pl_id]->pConditions[Condition_Eradicated] )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2206 pl_array[active_pl_num++] = pl_id;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2207 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2208 for ( uint i = 0; i < active_pl_num; i++ )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2209 shared_life_count += pPlayers[pl_array[i]]->sHealth;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2210 mean_life = (signed __int64)((double)shared_life_count / (double)active_pl_num);
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2211 for ( uint i = 0; i < active_pl_num; i++ )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2212 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2213 pPlayers[pl_array[i]]->sHealth = mean_life;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2214 if ( pPlayers[pl_array[i]]->sHealth > pPlayers[pl_array[i]]->GetMaxHealth())
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2215 pPlayers[pl_array[i]]->sHealth = pPlayers[pl_array[i]]->GetMaxHealth();
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2216 if ( pPlayers[pl_array[i]]->sHealth > 0 )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2217 pPlayers[pl_array[i]]->SetUnconcious(0);
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2218 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_array[i] - 1);
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2219 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2220 LODWORD(v727) = 1;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2221 break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2222 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2223 case SPELL_SPIRIT_RESSURECTION://
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2224 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2225 switch (skill_level)
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2226 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2227 case 1: amount = 180 * spell_level; break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2228 case 2: amount = 10800 * spell_level; break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2229 case 3: amount = 259200 * spell_level; break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2230 case 4: amount = 0; break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2231 default:
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2232 assert(false);
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2233 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2234 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2235 break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2236 if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Eradicated]
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2237 || pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Dead] )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2238 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2239 if ( !(pParty->pPlayers[v396].pConditions[Condition_Weak]) )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2240 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0);
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2241 if ( skill_level == 4 )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2242 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2243 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Eradicated] = 0;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2244 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Dead] = 0;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2245 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Unconcious] = 0;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2246 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2247 else
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2248 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2249 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( Condition_Eradicated,
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2250 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2251 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( Condition_Dead,
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2252 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2253 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( Condition_Unconcious,
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2254 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2255 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2256 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(Condition_Weak, 1);
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2257 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2258 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2259 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2260 LODWORD(v727) = 1;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2261 break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2262 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2263 case SPELL_MIND_CURE_PARALYSIS://
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2264 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2265 switch (skill_level)
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2266 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2267 case 1: amount = 3600 * spell_level; break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2268 case 2: amount = 3600 * spell_level; break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2269 case 3: amount = 86400 * spell_level; break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2270 case 4: amount = 0; break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2271 default:
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2272 assert(false);
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2273 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2274 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2275 break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2276 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2277 if ( !pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Paralyzed] )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2278 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2279 LODWORD(v727) = 1;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2280 break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2281 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2282 if ( skill_level == 4 )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2283 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2284 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Paralyzed] = 0;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2285 LODWORD(v727) = 1;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2286 break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2287 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2288 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Paralyzed,
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2289 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2290 LODWORD(v727) = 1;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2291 break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2292 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2293 case SPELL_MIND_REMOVE_FEAR://
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2294 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2295 switch (skill_level)
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2296 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2297 case 1: amount = 180 * spell_level; break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2298 case 2: amount = 3600 * spell_level; break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2299 case 3: amount = 86400 * spell_level; break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2300 case 4: amount = 0; break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2301 default:
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2302 assert(false);
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2303 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2304 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2305 break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2306 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2307 if ( !pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Fear] )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2308 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2309 LODWORD(v727) = 1;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2310 break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2311 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2312 if ( skill_level == 4 )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2313 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2314 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Fear] = 0;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2315 LODWORD(v727) = 1;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2316 break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2317 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2318 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Fear,
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2319 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2320 LODWORD(v727) = 1;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2321 break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2322 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2323 case SPELL_MIND_TELEPATHY://
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2324 {
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2325 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2326 break;
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2327 if (PID_TYPE(a2) == OBJECT_Actor)
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2328 {
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2329 mon_id = PID_ID(a2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2330 if ( !(pActors[mon_id].uAttributes & 0x800000) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2331 pActors[mon_id].SetRandomGoldIfTheresNoItem();
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2332 int gold_num = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2333 if ( pItemsTable->pItems[pActors[mon_id].array_000234[3].uItemID].uEquipType == EQUIP_GOLD )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2334 gold_num = pActors[mon_id].array_000234[3].uSpecEnchantmentType;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2335 ItemGen item;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2336 item.Reset();
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2337 if (pActors[mon_id].uCarriedItemID)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2338 item.uItemID = pActors[mon_id].uCarriedItemID;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2339 else
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2340 {
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2341 for ( uint i = 0; i < 4; ++i )
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2342 {
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2343 if ( pActors[mon_id].array_000234[i].uItemID > 0 && pItemsTable->pItems[pActors[mon_id].array_000234[i].uItemID].uEquipType != EQUIP_GOLD )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2344 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2345 memcpy(&item, &pActors[mon_id].array_000234[i], sizeof(item));
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2346 spell_level = v723;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2347 }
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2348 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2349 }
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2350 if ( gold_num > 0 )
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2351 {
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2352 if (item.uItemID)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2353 sprintf(pTmpBuf2.data(), "(%s), and %d gold", item.GetDisplayName(), gold_num);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2354 else
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2355 sprintf(pTmpBuf2.data(), "%d gold", gold_num);
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2356 }
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2357 else
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2358 {
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2359 if (item.uItemID)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2360 sprintf(pTmpBuf2.data(), "(%s)", item.GetDisplayName());
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2361 else
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2362 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2363 strcpy(pTmpBuf2.data(), "nothing");
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2364 ShowStatusBarString(pTmpBuf2.data(), 2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2365 }
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2366 }
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2367 ShowStatusBarString(pTmpBuf2.data(), 2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2368 pSpellSprite.stru_24.Reset();
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2369 pSpellSprite.spell_id = pCastSpell->uSpellID;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2370 pSpellSprite.spell_level = spell_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2371 pSpellSprite.spell_skill = skill_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2372 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2373 pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2374 pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2375 pSpellSprite.vPosition.z = pActors[mon_id].uActorHeight;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2376 pSpellSprite.uAttributes = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2377 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2378 pSpellSprite.uSpriteFrameID = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2379 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2380 pSpellSprite.spell_target_pid = a2;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2381 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2382 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2383 LOBYTE(pSpellSprite.uAttributes) |= 0x80;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2384 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2385 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2386 }
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2387 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2388 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2389 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2390 case SPELL_MIND_BERSERK://
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2391 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2392 switch (skill_level)
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2393 {
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2394 case 1: amount = 300 * spell_level; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2395 case 2: amount = 300 * spell_level; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2396 case 3: amount = 600 * spell_level; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2397 case 4: amount = 3600; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2398 default:
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2399 assert(false);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2400 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2401 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2402 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2403 mon_id = PID_ID(a2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2404 if (PID_TYPE(a2) == OBJECT_Actor)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2405 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2406 //v730 = 836 * mon_id;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2407 if ( stru_50C198.GetMagicalResistance(&pActors[mon_id], 7) )
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2408 {
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2409 pActors[mon_id].pActorBuffs[ACTOR_BUFF_CHARM].Reset();
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2410 pActors[mon_id].pActorBuffs[ACTOR_BUFF_ENSLAVED].Reset();
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2411 pActors[mon_id].pActorBuffs[ACTOR_BUFF_BERSERK].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), skill_level, 0, 0, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2412 pActors[mon_id].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2413 }
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2414 pSpellSprite.stru_24.Reset();
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2415 pSpellSprite.spell_id = pCastSpell->uSpellID;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2416 pSpellSprite.spell_level = spell_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2417 pSpellSprite.spell_skill = skill_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2418 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2419 pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2420 pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2421 pSpellSprite.vPosition.z = pActors[mon_id].vPosition.z + pActors[mon_id].uActorHeight;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2422 pSpellSprite.uAttributes = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2423 pSpellSprite.uSectorID = pIndoor->GetSector(pActors[mon_id].vPosition.x, pActors[mon_id].vPosition.y, pSpellSprite.vPosition.z);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2424 pSpellSprite.uSpriteFrameID = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2425 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2426 pSpellSprite.spell_target_pid = a2;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2427 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2428 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2429 LOBYTE(pSpellSprite.uAttributes) |= 0x80;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2430 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2431 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2432 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2433 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2434 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2435 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2436 case SPELL_MIND_ENSLAVE://
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2437 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2438 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2439 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2440 amount = 600 * spell_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2441 if (PID_TYPE(a2) == OBJECT_Actor)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2442 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2443 mon_id = PID_ID(a2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2444 //v730 = 836 * mon_id;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2445 if ( MonsterStats::BelongsToSupertype(pActors[mon_id].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2446 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2447 if ( stru_50C198.GetMagicalResistance(&pActors[mon_id], 7) )
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2448 {
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2449 pActors[mon_id].pActorBuffs[ACTOR_BUFF_BERSERK].Reset();
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2450 pActors[mon_id].pActorBuffs[ACTOR_BUFF_CHARM].Reset();
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2451 pActors[mon_id].pActorBuffs[ACTOR_BUFF_ENSLAVED].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335),
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2452 skill_level, 0, 0, 0);
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2453 }
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2454 pSpellSprite.stru_24.Reset();
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2455 pSpellSprite.spell_id = pCastSpell->uSpellID;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2456 pSpellSprite.spell_level = spell_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2457 pSpellSprite.spell_skill = skill_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2458 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2459 pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2460 pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2461 pSpellSprite.vPosition.z = pActors[mon_id].vPosition.z + pActors[mon_id].uActorHeight;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2462 pSpellSprite.uAttributes = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2463 pSpellSprite.uSectorID = pIndoor->GetSector(pActors[mon_id].vPosition.x, pActors[mon_id].vPosition.y, pSpellSprite.vPosition.z);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2464 pSpellSprite.uSpriteFrameID = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2465 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2466 pSpellSprite.spell_target_pid = a2;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2467 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2468 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2469 LOBYTE(pSpellSprite.uAttributes) |= 0x80;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2470 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2471 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2472 }
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2473 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2474 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2475 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2476 case SPELL_MIND_MASS_FEAR://
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2477 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2478 if ( skill_level == 4 )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2479 amount = 300 * spell_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2480 else
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2481 amount = 180 * spell_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2482 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2483 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2484 int mon_num = pRenderer->_466_GetActorsInViewport(4096);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2485 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0A, 192);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2486 ++pSpellSprite.uType;
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2487 pSpellSprite.stru_24.Reset();
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2488 pSpellSprite.spell_id = pCastSpell->uSpellID;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2489 pSpellSprite.spell_level = spell_level;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2490 pSpellSprite.spell_skill = skill_level;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2491 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2492 pSpellSprite.uAttributes = 0;
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2493 pSpellSprite.uSectorID = 0;
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2494 pSpellSprite.uSpriteFrameID = 0;
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2495 pSpellSprite.field_60_distance_related_prolly_lod = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2496 pSpellSprite.uFacing = 0;
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2497 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2498 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2499 for ( a2 = 0; a2 < mon_num; ++a2 )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2500 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2501 if ( MonsterStats::BelongsToSupertype(pActors[_50BF30_actors_in_viewport_ids[a2]].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2502 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2503 pSpellSprite.vPosition.x = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.x;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2504 pSpellSprite.vPosition.y = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.y;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2505 pSpellSprite.vPosition.z = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.z - (unsigned int)(signed __int64)((double)pActors[_50BF30_actors_in_viewport_ids[a2]].uActorHeight * -0.8);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2506 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2507 pSpellSprite.Create(0, 0, 0, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2508 if ( stru_50C198.GetMagicalResistance(&pActors[_50BF30_actors_in_viewport_ids[a2]], 7) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2509 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2510 pActors[_50BF30_actors_in_viewport_ids[a2]].pActorBuffs[ACTOR_BUFF_AFRAID].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335),
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2511 skill_level, 0, 0, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2512 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2513 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2514 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2515 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2516 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2517 case SPELL_MIND_CURE_INSANITY://
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2518 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2519 if ( skill_level == 4 )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2520 amount = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2521 else
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2522 amount = 86400 * spell_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2523 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2524 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2525 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2526 if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Insane] )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2527 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2528 if ( !(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Weak]) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2529 pParty->pPlayers[pCastSpell->uPlayerID_2].PlaySound(SPEECH_25, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2530 if ( skill_level == 4 )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2531 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Insane] = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2532 else
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2533 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Insane,
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2534 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2535 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(Condition_Weak, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2536 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2537 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2538 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2539 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2540 case SPELL_EARTH_TELEKINESIS://
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2541 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2542 switch (skill_level)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2543 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2544 case 1: amount = 2 * spell_level; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2545 case 2: amount = 2 * spell_level; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2546 case 3: amount = 3 * spell_level; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2547 case 4: amount = 4 * spell_level; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2548 default:
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2549 assert(false);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2550 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2551 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2552 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2553 int obj_id = PID_ID(a2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2554 if (PID_TYPE(a2) == OBJECT_Item)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2555 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2556 if ( pItemsTable->pItems[pSpriteObjects[obj_id].stru_24.uItemID].uEquipType == EQUIP_GOLD )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2557 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2558 pParty->PartyFindsGold(pSpriteObjects[obj_id].stru_24.uSpecEnchantmentType, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2559 viewparams->bRedrawGameUI = true;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2560 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2561 else
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2562 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2563 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[pSpriteObjects[obj_id].stru_24.uItemID].pUnidentifiedName);// ^Pv[%s]!
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2564 ShowStatusBarString(pTmpBuf2.data(), 2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2565 if ( !pParty->AddItemToParty(&pSpriteObjects[obj_id].stru_24) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2566 pParty->SetHoldingItem(&pSpriteObjects[obj_id].stru_24);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2567 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2568 SpriteObject::OnInteraction(obj_id);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2569 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2570 if (PID_TYPE(a2) == OBJECT_Actor)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2571 pActors[obj_id].LootActor();
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2572 if (PID_TYPE(a2) == OBJECT_Decoration)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2573 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2574 OpenedTelekinesis = true;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2575 if ( pLevelDecorations[obj_id].uEventID )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2576 EventProcessor(pLevelDecorations[obj_id].uEventID, a2, 1);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2577 if ( pLevelDecorations[pSpriteObjects[obj_id].stru_24.uItemID].IsInteractive() )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2578 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2579 activeLevelDecoration = &pLevelDecorations[obj_id];
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2580 EventProcessor(stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[obj_id]._idx_in_stru123 - 75] + 380, 0, 1);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2581 activeLevelDecoration = NULL;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2582 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2583 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2584 if (PID_TYPE(a2) == OBJECT_BModel)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2585 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2586 OpenedTelekinesis = true;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2587 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2588 v448 = pIndoor->pFaceExtras[pIndoor->pFaces[obj_id].uFaceExtraID].uEventID;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2589 else
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2590 v448 = pOutdoor->pBModels[a2 >> 9].pFaces[obj_id & 0x3F].sCogTriggeredID;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2591 EventProcessor(v448, a2, 1);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2592 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2593 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2594 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2595 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2596 case SPELL_BODY_CURE_WEAKNESS://
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2597 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2598 switch (skill_level)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2599 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2600 case 1: amount = 180 * spell_level; break;//3 *
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2601 case 2: amount = 3600 * spell_level; break;//1 *
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2602 case 3: amount = 86400 * spell_level; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2603 case 4: amount = 0; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2604 default:
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2605 assert(false);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2606 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2607 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2608 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2609 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2610 if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Weak] )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2611 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2612 if ( skill_level == 4 )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2613 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2614 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Weak] = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2615 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2616 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2617 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2618 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Weak,
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2619 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2620 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2621 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2622 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2623 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2624 case SPELL_BODY_FIRST_AID://
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2625 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2626 switch (skill_level)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2627 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2628 case 1: amount = 2 * spell_level + 5; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2629 case 2: amount = 3 * spell_level + 5; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2630 case 3: amount = 4 * spell_level + 5; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2631 case 4: amount = 5 * spell_level + 5; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2632 default:
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2633 assert(false);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2634 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2635 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2636 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2637 if ( !pCastSpell->spell_target_pid )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2638 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2639 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2640 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2641 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2642 if (PID_TYPE(pCastSpell->spell_target_pid) == OBJECT_Actor)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2643 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2644 mon_id = PID_ID(pCastSpell->spell_target_pid);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2645 if ( pActors[mon_id].uAIState != Dead && pActors[mon_id].uAIState != Dying && pActors[mon_id].uAIState != Disabled
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2646 && pActors[mon_id].uAIState != Removed )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2647 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2648 pActors[mon_id].sCurrentHP += amount;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2649 if ( pActors[mon_id].sCurrentHP > pActors[mon_id].pMonsterInfo.uHP )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2650 pActors[mon_id].sCurrentHP = pActors[mon_id].pMonsterInfo.uHP;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2651 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2652 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2653 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2654 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2655 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2656 case SPELL_BODY_CURE_POISON:// ()
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2657 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2658 switch (skill_level)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2659 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2660 case 1: amount = 3600 * spell_level; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2661 case 2: amount = 3600 * spell_level; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2662 case 3: amount = 86400 * spell_level; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2663 case 4: amount = 0; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2664 default:
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2665 assert(false);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2666 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2667 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2668 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2669 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2670 if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Weak]
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2671 || pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Medium]
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2672 || pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Severe] )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2673 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2674 if ( skill_level == 4 )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2675 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2676 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Weak] = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2677 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Medium] = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2678 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Severe] = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2679 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2680 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2681 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2682 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Poison_Weak, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2683 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Poison_Medium, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2684 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Poison_Severe, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2685 }
2186
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2686 LODWORD(v727) = 1;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2687 break;
7a517c9a1d5b CastSpell continue
Ritor1
parents: 2185
diff changeset
2688 }
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2689 case SPELL_BODY_PROTECTION_FROM_MAGIC://
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2690 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2691 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2692 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2693 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2694 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2695 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2696 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2697 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed +
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2698 (signed __int64)((double)(signed int)((int)(3600 * spell_level) << 7) * 0.033333335), skill_level, spell_level, 0, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2699 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2700 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2701 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2702 case SPELL_BODY_HAMMERHANDS://-
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2703 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2704 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2705 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2706 if ( skill_level == 4 )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2707 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2708 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2709 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2710 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2711 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2712 for ( uint pl_id = 0; pl_id < 4; pl_id++)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2713 pParty->pPlayers[pl_id].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed +
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2714 (signed int)(signed __int64)((double)(signed int)((int)(3600 * spell_level) << 7) * 0.033333335), 4, spell_level, spell_level, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2715 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2716 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2717 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2718 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2719 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed +
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2720 (signed int)(signed __int64)((double)(signed int)((int)(3600 * spell_level) << 7) * 0.033333335), skill_level, spell_level, spell_level, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2721 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2722 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2723 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2724 case SPELL_BODY_CURE_DISEASE://
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2725 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2726 if ( skill_level == 4 )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2727 amount = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2728 else
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2729 amount = 86400 * spell_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2730 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2731 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2732 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2733 if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Disease_Weak]
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2734 || pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Disease_Medium]
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2735 || pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Disease_Severe] )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2736 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2737 if ( skill_level == 4 )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2738 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2739 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Disease_Weak] = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2740 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Disease_Medium] = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2741 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Disease_Severe] = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2742 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2743 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Disease_Weak,
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2744 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2745 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Disease_Medium,
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2746 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2747 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Disease_Severe,
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2748 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2749 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2750 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2751 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2752 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2753 case SPELL_BODY_POWER_CURE://
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2754 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2755 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2756 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2757 for ( uint pl_id = 0; pl_id < 4; ++pl_id )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2758 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2759 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2760 pParty->pPlayers[pl_id].Heal(5 * spell_level + 10);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2761 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2762 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2763 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2764 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2765 case SPELL_LIGHT_DISPEL_MAGIC://
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2766 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2767 sRecoveryTime -= spell_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2768 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2769 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2770 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0A, 192);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2771 int mon_num = pRenderer->_466_GetActorsInViewport(4096);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2772 ++pSpellSprite.uType;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2773 v688.x = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2774 v688.y = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2775 v688.z = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2776 pSpellSprite.stru_24.Reset();
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2777 pSpellSprite.spell_id = pCastSpell->uSpellID;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2778 pSpellSprite.spell_level = spell_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2779 pSpellSprite.spell_skill = skill_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2780 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2781 pSpellSprite.uAttributes = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2782 pSpellSprite.uSectorID = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2783 pSpellSprite.uSpriteFrameID = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2784 pSpellSprite.field_60_distance_related_prolly_lod = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2785 pSpellSprite.uFacing = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2786 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2787 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2788 for ( a2 = 0; a2 < mon_num; ++a2 )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2789 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2790 pSpellSprite.vPosition.x = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.x;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2791 pSpellSprite.vPosition.y = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.y;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2792 pSpellSprite.vPosition.z = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.z -
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2793 (unsigned int)(signed __int64)((double)pActors[_50BF30_actors_in_viewport_ids[a2]].uActorHeight * -0.8);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2794 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2795 DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), _50BF30_actors_in_viewport_ids[a2], &v688);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2796 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2797 for ( a2 = 0; a2 < mon_num; ++a2 )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2798 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2799 pSpellSprite.vPosition.x = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.x;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2800 pSpellSprite.vPosition.y = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.y;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2801 pSpellSprite.vPosition.z = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.z -
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2802 (unsigned int)(signed __int64)((double)pActors[_50BF30_actors_in_viewport_ids[a2]].uActorHeight * -0.8);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2803 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2804 pSpellSprite.Create(0, 0, 0, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2805 for (int i = 0; i < 22; ++i)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2806 pActors[_50BF30_actors_in_viewport_ids[a2]].pActorBuffs[i].Reset();
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2807 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2808 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2809 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2810 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2811 case SPELL_LIGHT_SUMMON_ELEMENTAL://
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2812 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2813 switch (skill_level)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2814 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2815 case 1: v733 = 300 * spell_level; amount = 1; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2816 case 2: v733 = 300 * spell_level; amount = 1; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2817 case 3: v733 = 900 * spell_level; amount = 3; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2818 case 4: v733 = 900 * spell_level; amount = 5; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2819 default:
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2820 assert(false);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2821 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2822 int mon_num = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2823 for ( uint mon_id = 0; mon_id < uNumActors; mon_id++ )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2824 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2825 if ( pActors[mon_id].uAIState != Dead && pActors[mon_id].uAIState != Removed && pActors[mon_id].uAIState != Disabled
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2826 && PID(OBJECT_Player, pCastSpell->uPlayerID) == pActors[mon_id].uSummonerID )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2827 ++mon_num;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2828 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2829 if ( mon_num >= amount )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2830 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2831 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters!
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2832 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2833 pCastSpell->uSpellID = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2834 continue;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2835 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2836 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2837 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2838 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, skill_level, v733);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2839 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2840 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2841 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2842 case SPELL_LIGHT_DAY_OF_THE_GODS://
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2843 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2844 switch (skill_level)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2845 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2846 case 1: duration = 10800 * spell_level; amount = 3 * spell_level + 10; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2847 case 2: duration = 10800 * spell_level; amount = 3 * spell_level + 10; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2848 case 3: duration = 14400 * spell_level; amount = 4 * spell_level + 10; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2849 case 4: duration = 18000 * spell_level; amount = 5 * spell_level + 10; break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2850 default:
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2851 assert(false);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2852 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2853 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2854 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2855 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2856 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2857 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2858 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2859 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed +
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2860 (signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2861 LODWORD(v727) = 1;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2862 break;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2863 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2864 case SPELL_LIGHT_PRISMATIC_LIGHT://
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2865 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2866 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2867 {
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2868 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors!
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2869 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2870 pCastSpell->uSpellID = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2871 continue;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2872 }
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2873 if ( !pPlayer->CanCastSpell(uRequiredMana) )
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2874 break;
2188
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2875 int mon_num = pRenderer->_466_GetActorsInViewport(4096);
2187
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2876 ++pSpellSprite.uType;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2877 v694.x = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2878 v694.y = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2879 v694.z = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2880 pSpellSprite.stru_24.Reset();
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2881 pSpellSprite.spell_id = pCastSpell->uSpellID;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2882 pSpellSprite.spell_level = spell_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2883 pSpellSprite.spell_skill = skill_level;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2884 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2885 pSpellSprite.uAttributes = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2886 pSpellSprite.uSectorID = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2887 pSpellSprite.uSpriteFrameID = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2888 pSpellSprite.field_60_distance_related_prolly_lod = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2889 pSpellSprite.uFacing = 0;
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2890 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
9856c2f8f918 CastSpell continue
Ritor1
parents: 2186
diff changeset
2891 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
2188
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2892 for ( uint mon_id = 0; mon_id < mon_num; mon_id++ )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2893 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2894 pSpellSprite.vPosition.x = pActors[_50BF30_actors_in_viewport_ids[mon_id]].vPosition.x;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2895 pSpellSprite.vPosition.y = pActors[_50BF30_actors_in_viewport_ids[mon_id]].vPosition.y;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2896 pSpellSprite.vPosition.z = pActors[_50BF30_actors_in_viewport_ids[mon_id]].vPosition.z -
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2897 (unsigned int)(signed __int64)((double)pActors[_50BF30_actors_in_viewport_ids[mon_id]].uActorHeight * -0.8);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2898 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[mon_id]);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2899 DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), _50BF30_actors_in_viewport_ids[mon_id], &v694);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2900 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2901 //v537 = pGame->GetStru6();
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2902 pGame->GetStru6()->_4A8BFC();
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2903 LODWORD(v727) = 1;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2904 break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2905 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2906 case SPELL_LIGHT_DAY_OF_PROTECTION://
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2907 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2908 switch (skill_level)
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2909 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2910 case 1: duration = 14400 * spell_level; amount = 4 * spell_level; break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2911 case 2: duration = 14400 * spell_level; amount = 4 * spell_level; break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2912 case 3: duration = 14400 * spell_level; amount = 4 * spell_level; break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2913 case 4: duration = 18000 * spell_level; amount = 5 * spell_level; break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2914 default:
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2915 assert(false);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2916 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2917 if ( !pPlayer->CanCastSpell(uRequiredMana) )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2918 break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2919 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2920 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2921 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2922 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2923 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed +
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2924 (signed __int64)((double)(duration << 7) * 0.033333335), skill_level, amount, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2925 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed +
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2926 (signed __int64)((double)(duration << 7) * 0.033333335), skill_level, amount, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2927 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed +
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2928 (signed __int64)((double)(duration << 7) * 0.033333335), skill_level, amount, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2929 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed +
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2930 (signed __int64)((double)(duration << 7) * 0.033333335), skill_level, amount, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2931 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed +
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2932 (signed __int64)((double)(duration << 7) * 0.033333335), skill_level, amount, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2933 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed +
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2934 (signed __int64)((double)(duration << 7) * 0.033333335), skill_level, amount, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2935 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(pParty->uTimePlayed +
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2936 (signed __int64)((double)(duration << 7) * 0.033333335), skill_level, spell_level + 5, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2937 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed +
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2938 (signed __int64)((double)(duration << 7) * 0.033333335), skill_level, spell_level + 5, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2939 LODWORD(v727) = 1;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2940 break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2941 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2942 case SPELL_LIGHT_HOUR_OF_POWER: //
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2943 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2944 switch (skill_level)
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2945 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2946 case 1: duration = 4; amount = 4; break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2947 case 2: duration = 4; amount = 4; break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2948 case 3: duration = 12; amount = 12; break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2949 case 4: duration = 20; amount = 15; break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2950 default:
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2951 assert(false);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2952 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2953 if ( !pPlayer->CanCastSpell(uRequiredMana) )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2954 break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2955 bool player_weak = false;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2956 for ( uint pl_id = 0; pl_id < 4; pl_id++ )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2957 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2958 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2959 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2960 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2961 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2962 pParty->pPlayers[pl_id].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed +
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2963 (signed __int64)((double)((300 * amount * spell_level + 60) << 7) * 0.033333335), skill_level, spell_level + 5, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2964 if ( pParty->pPlayers[pl_id].pConditions[Condition_Weak] )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2965 player_weak = true;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2966 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2967 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply(pParty->uTimePlayed +
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2968 (signed __int64)((double)((300 * amount * spell_level + 60) << 7) * 0.033333335), skill_level, spell_level + 5, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2969 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply(pParty->uTimePlayed +
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2970 (signed __int64)((double)((300 * amount * spell_level + 60) << 7) * 0.033333335), skill_level, 0, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2971 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply(pParty->uTimePlayed +
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2972 (signed __int64)((double)((300 * amount * spell_level + 60) << 7) * 0.033333335), skill_level, spell_level + 5, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2973 if ( !player_weak )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2974 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed +
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2975 (signed __int64)((double)((60 * (spell_level * duration + 60)) << 7) * 0.033333335), skill_level, spell_level + 5, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2976 LODWORD(v727) = 1;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2977 break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2978 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2979 case SPELL_LIGHT_DIVINE_INTERVENTION://
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2980 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2981 //amount = 3;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2982 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3 )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2983 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2984 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2985 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2986 pCastSpell->uSpellID = 0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2987 continue;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2988 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2989 if ( !pPlayer->CanCastSpell(uRequiredMana) )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2990 break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2991 for ( uint pl_id = 0; pl_id < 4; pl_id++ )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2992 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2993 for ( uint buff_id = 0; buff_id <= 19; buff_id++ )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2994 pParty->pPlayers[pl_id].pConditions[buff_id] = 0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2995 pParty->pPlayers[pl_id].sHealth = pParty->pPlayers[pl_id].GetMaxHealth();
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2996 pParty->pPlayers[pl_id].sMana = pParty->pPlayers[pl_id].GetMaxMana();
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2997 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2998 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
2999 if ( pPlayer->sAgeModifier + 10 >= 120 )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3000 pPlayer->sAgeModifier = 120;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3001 else
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3002 pPlayer->sAgeModifier = pPlayer->sAgeModifier + 10;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3003 sRecoveryTime += -5 * spell_level;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3004 ++pPlayer->uNumDivineInterventionCastsThisDay;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3005 LODWORD(v727) = 1;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3006 break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3007 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3008 case SPELL_DARK_REANIMATE: //
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3009 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3010 switch (skill_level)
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3011 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3012 case 1: amount = 2 * spell_level; break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3013 case 2: amount = 3 * spell_level; break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3014 case 3: amount = 4 * spell_level; break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3015 case 4: amount = 5 * spell_level; break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3016 default:
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3017 assert(false);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3018 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3019 if ( !pPlayer->CanCastSpell(uRequiredMana) )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3020 break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3021 if (!pCastSpell->spell_target_pid)
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3022 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3023 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3024 if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Dead] )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3025 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3026 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(Condition_Zombie, 1);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3027 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (pParty->pPlayers[pCastSpell->uPlayerID_2].GetSexByVoice() != 0) + 23);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3028 pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Zombie] = pParty->uTimePlayed;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3029 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3030 break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3031 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3032 mon_id = PID_ID(pCastSpell->spell_target_pid);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3033 if ( mon_id == -1 )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3034 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3035 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists!
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3036 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3037 pCastSpell->uSpellID = 0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3038 continue;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3039 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3040 if ( pActors[mon_id].sCurrentHP > 0
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3041 || pActors[mon_id].uAIState != Dead && pActors[mon_id].uAIState != Dying )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3042 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3043 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3044 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3045 pCastSpell->uSpellID = 0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3046 continue;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3047 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3048 ++pSpellSprite.uType;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3049 pSpellSprite.stru_24.Reset();
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3050 pSpellSprite.spell_id = pCastSpell->uSpellID;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3051 pSpellSprite.spell_level = spell_level;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3052 pSpellSprite.spell_skill = skill_level;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3053 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3054 pSpellSprite.uAttributes = 0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3055 pSpellSprite.uSectorID = 0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3056 pSpellSprite.uSpriteFrameID = 0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3057 pSpellSprite.field_60_distance_related_prolly_lod = 0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3058 pSpellSprite.uFacing = 0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3059 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3060 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3061 pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3062 pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3063 pSpellSprite.vPosition.z = pActors[mon_id].vPosition.z -
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3064 (unsigned int)(signed __int64)((double)pActors[mon_id].uActorHeight * -0.8);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3065 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, mon_id);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3066 pSpellSprite.Create(0, 0, 0, 0);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3067 if ( pActors[mon_id].pMonsterInfo.uLevel > amount )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3068 break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3069 Actor::Resurrect(mon_id);
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3070 pActors[mon_id].pMonsterInfo.uHostilityType = (MonsterInfo::HostilityRadius)0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3071 pActors[mon_id].pMonsterInfo.uTreasureDropChance = 0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3072 pActors[mon_id].pMonsterInfo.uTreasureDiceRolls = 0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3073 pActors[mon_id].pMonsterInfo.uTreasureDiceSides = 0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3074 pActors[mon_id].pMonsterInfo.uTreasureLevel = 0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3075 pActors[mon_id].pMonsterInfo.uTreasureType = 0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3076 pActors[mon_id].uAlly = 9999;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3077 pActors[mon_id].uAttributes &= 0xF70000;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3078 pActors[mon_id].uGroup = 0;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3079 pActors[mon_id].pActorBuffs[ACTOR_BUFF_BERSERK].Reset();
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3080 pActors[mon_id].pActorBuffs[ACTOR_BUFF_CHARM].Reset();
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3081 pActors[mon_id].pActorBuffs[ACTOR_BUFF_ENSLAVED].Reset();
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3082 if ( pActors[mon_id].sCurrentHP > 10 * amount )
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3083 pActors[mon_id].sCurrentHP = 10 * amount;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3084 LODWORD(v727) = 1;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3085 break;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3086 }
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3087 case SPELL_DARK_VAMPIRIC_WEAPON:// -
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3088 {
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3089 amount = 16;
0ae56373cc35 CastSpell continue
Ritor1
parents: 2187
diff changeset
3090 if ( skill_level == 4 )
2189
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3091 duration = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3092 else
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3093 duration = 3600 * spell_level;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3094 if ( !pPlayer->CanCastSpell(uRequiredMana) )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3095 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3096 ItemGen *item = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2];
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3097 item->UpdateTempBonus(pParty->uTimePlayed);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3098 if ( item->uItemID >= 64 && item->uItemID <= 65//blasters
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3099 || LOBYTE(item->uAttributes) & 2
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3100 || item->uSpecEnchantmentType != 0
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3101 || item->uEnchantmentType != 0
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3102 || pItemsTable->pItems[item->uItemID].uEquipType != EQUIP_SINGLE_HANDED
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3103 && pItemsTable->pItems[item->uItemID].uEquipType != EQUIP_TWO_HANDED
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3104 && pItemsTable->pItems[item->uItemID].uEquipType != EQUIP_BOW
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3105 || pItemsTable->IsMaterialNonCommon(item) )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3106 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3107 _50C9D0_AfterEnchClickEventId = 113;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3108 _50C9D4_AfterEnchClickEventSecondParam = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3109 _50C9D8_AfterEnchClickEventTimeout = 1;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3110 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3111 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3112 pCastSpell->uSpellID = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3113 continue;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3114 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3115 item->uSpecEnchantmentType = 16;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3116 if ( skill_level != 4 )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3117 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3118 item->uExpireTime = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3119 item->uAttributes |= 8;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3120 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3121 LOBYTE(item->uAttributes) |= 0x80;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3122 _50C9A8_item_enchantment_timer = 256;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3123 LODWORD(v727) = 1;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3124 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3125 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3126 case SPELL_DARK_SHARPMETAL://
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3127 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3128 switch (skill_level)
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3129 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3130 case 1: amount = 5; break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3131 case 2: amount = 5; break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3132 case 3: amount = 7; break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3133 case 4: amount = 9; break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3134 default:
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3135 assert(false);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3136 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3137 if ( !pPlayer->CanCastSpell(uRequiredMana) )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3138 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3139 signed int _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3140 pSpellSprite.stru_24.Reset();
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3141 pSpellSprite.spell_id = pCastSpell->uSpellID;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3142 pSpellSprite.spell_level = spell_level;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3143 pSpellSprite.spell_skill = skill_level;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3144 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3145 pSpellSprite.vPosition.x = pParty->vPosition.x;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3146 pSpellSprite.vPosition.y = pParty->vPosition.y;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3147 pSpellSprite.uAttributes = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3148 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3149 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y,
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3150 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3151 pSpellSprite.uSpriteFrameID = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3152 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3153 pSpellSprite.spell_target_pid = a2;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3154 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3155 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3156 if ( pParty->bTurnBasedModeOn == 1 )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3157 LOBYTE(pSpellSprite.uAttributes) |= 4;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3158 v188 = (signed int)_v726 / -2;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3159 v189 = (signed int)_v726 / 2;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3160 if ( v188 <= v189 )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3161 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3162 do
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3163 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3164 pSpellSprite.uFacing = v188 + v715.uYawAngle;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3165 if ( pSpellSprite.Create(pSpellSprite.uFacing, v715.uPitchAngle,
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3166 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, pCastSpell->uPlayerID + 1) != -1
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3167 && pParty->bTurnBasedModeOn == 1 )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3168 ++pTurnEngine->pending_actions;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3169 v188 += _v726 / (amount - 1);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3170 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3171 while ( v188 <= v189 );
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3172 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3173 LODWORD(v727) = 1;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3174 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3175 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3176 case SPELL_DARK_CONTROL_UNDEAD://
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3177 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3178 if ( !pPlayer->CanCastSpell(uRequiredMana) )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3179 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3180 switch (skill_level)
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3181 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3182 case 1: duration = 180 * spell_level; break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3183 case 2: duration = 180 * spell_level; break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3184 case 3: duration = 300 * spell_level; break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3185 case 4: duration = 29030400; break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3186 default:
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3187 assert(false);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3188 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3189 if (PID_TYPE(a2) == OBJECT_Actor)
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3190 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3191 mon_id = PID_ID(a2);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3192 if ( !MonsterStats::BelongsToSupertype(pActors[mon_id].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3193 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3194 if ( !stru_50C198.GetMagicalResistance(&pActors[mon_id], 10) )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3195 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3196 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3197 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3198 pCastSpell->uSpellID = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3199 continue;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3200 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3201 pActors[mon_id].pActorBuffs[ACTOR_BUFF_BERSERK].Reset();
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3202 pActors[mon_id].pActorBuffs[ACTOR_BUFF_CHARM].Reset();
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3203 pActors[mon_id].pActorBuffs[ACTOR_BUFF_ENSLAVED].Apply(pParty->uTimePlayed +
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3204 (signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3205 pSpellSprite.stru_24.Reset();
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3206 pSpellSprite.spell_id = pCastSpell->uSpellID;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3207 pSpellSprite.spell_level = spell_level;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3208 pSpellSprite.spell_skill = skill_level;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3209 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3210 pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3211 pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3212 pSpellSprite.vPosition.z = pActors[mon_id].vPosition.z + pActors[mon_id].uActorHeight;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3213 pSpellSprite.uAttributes = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3214 pSpellSprite.uSectorID = pIndoor->GetSector(pActors[mon_id].vPosition.x, pActors[mon_id].vPosition.y, pSpellSprite.vPosition.z);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3215 pSpellSprite.uSpriteFrameID = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3216 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3217 pSpellSprite.spell_target_pid = a2;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3218 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3219 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3220 LOBYTE(pSpellSprite.uAttributes) |= 0x80;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3221 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3222 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3223 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3224 LODWORD(v727) = 1;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3225 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3226 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3227 case SPELL_DARK_SACRIFICE://
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3228 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3229 if ( !pPlayer->CanCastSpell(uRequiredMana) )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3230 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3231 int _v733 = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3232 memset(&achieved_awards, 0, 4000);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3233 //pNPCData = pParty->pHirelings.data();
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3234 for ( uint npc_id = 0; npc_id < 2; npc_id++ )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3235 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3236 if ( pParty->pHirelings[npc_id].pName != 0)
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3237 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3238 //v606 = _v733++;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3239 achieved_awards[_v733++] = (AwardType)(npc_id + 1);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3240 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3241 //++i;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3242 //++pNPCData;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3243 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3244 //while ( pNPCData <= &pParty->pHirelings[1] );
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3245
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3246 if ( (signed int)pNPCStats->uNumNewNPCs > 0)
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3247 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3248 //pNPCData = pNPCStats->pNewNPCData;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3249 //__debugbreak(); // data offset
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3250 //AwardType *_v734 = &achieved_awards[_v733];
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3251 for ( int npc_id = 0; npc_id < pNPCStats->uNumNewNPCs; ++npc_id )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3252 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3253 if ( pNPCStats->pNewNPCData[npc_id].uFlags & 0x80//hired()
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3254 && (!pParty->pHirelings[0].pName
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3255 || strcmp(pNPCStats->pNewNPCData[npc_id].pName, pParty->pHirelings[0].pName))
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3256 && (!pParty->pHirelings[1].pName
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3257 || strcmp(pNPCStats->pNewNPCData[npc_id].pName, pParty->pHirelings[1].pName)) )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3258 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3259 //v607 = _v734;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3260 //++_v734;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3261 achieved_awards[_v733++] = (AwardType)(npc_id + 3);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3262 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3263 //++pNPCData;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3264 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3265 //while ( );
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3266 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3267 //v608 = pCastSpell->uPlayerID_2;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3268 //v609 = (signed int)*(&pFontCChar + pCastSpell->uPlayerID_2 + pParty->hirelingScrollPosition);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3269 if ( pCastSpell->uPlayerID_2 != 4 && pCastSpell->uPlayerID_2 != 5
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3270 || achieved_awards[_v733 - 2] <= 0 || achieved_awards[_v733 - 2] >= 3 )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3271 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3272 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3273 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3274 pCastSpell->uSpellID = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3275 continue;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3276 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3277 //v610 = 76 * achieved_awards[_v733];
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3278 //*((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3279 pParty->pHirelings[achieved_awards[_v733 - 2]].pName = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3280 //v611 = pIconsFrameTable->FindIcon("spell96");
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3281 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3282 pParty->pHirelings[achieved_awards[_v733 - 2]].uPortraitID = pIconsFrameTable->GetIconAnimLength(pIconsFrameTable->FindIcon("spell96"));
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3283 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3284 //pParty->pHirelings[achieved_awards[_v733 - 2]].evt_A = 1;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3285 for ( uint pl_id = 0; pl_id < 4; pl_id++ )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3286 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3287 pParty->pPlayers[pl_id].sHealth = pParty->pPlayers[pl_id].GetMaxHealth();
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3288 pParty->pPlayers[pl_id].sMana = pParty->pPlayers[pl_id].GetMaxMana();
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3289 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3290 v613 = &pOutdoor->ddm;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3291 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor)
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3292 v613 = &pIndoor->dlv;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3293 v613->uReputation += 15;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3294 if ( v613->uReputation > 10000 )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3295 v613->uReputation = 10000;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3296 LODWORD(v727) = 1;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3297 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3298 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3299 case SPELL_DARK_PAIN_REFLECTION://
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3300 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3301 switch (skill_level)
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3302 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3303 case 1: duration = 300 * (spell_level + 12); break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3304 case 2: duration = 300 * (spell_level + 12); break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3305 case 3: duration = 300 * (spell_level + 12); break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3306 case 4: duration = 900 * (spell_level + 4); break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3307 default:
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3308 assert(false);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3309 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3310 amount = spell_level + 5;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3311 if ( !pPlayer->CanCastSpell(uRequiredMana) )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3312 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3313 if ( skill_level != 3 && skill_level != 4 )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3314 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3315 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3316 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed +
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3317 (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3318 LODWORD(v727) = 1;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3319 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3320 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3321 for ( uint pl_id = 0; pl_id < 4; pl_id++ )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3322 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3323 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3324 pParty->pPlayers[pl_id].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed +
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3325 (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3326 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3327 LODWORD(v727) = 1;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3328 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3329 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3330 case SPELL_DARK_SOULDRINKER://
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3331 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3332 if ( !pPlayer->CanCastSpell(uRequiredMana) )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3333 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3334 pGame->GetIndoorCamera();
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3335 int mon_num = pRenderer->_466_GetActorsInViewport((signed __int64)pGame->pIndoorCameraD3D->GetPickDepth());
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3336 v707.x = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3337 v707.y = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3338 v707.z = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3339 pSpellSprite.stru_24.Reset();
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3340 pSpellSprite.spell_id = pCastSpell->uSpellID;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3341 pSpellSprite.spell_level = spell_level;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3342 pSpellSprite.spell_skill = skill_level;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3343 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3344 pSpellSprite.uAttributes = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3345 pSpellSprite.uSectorID = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3346 pSpellSprite.uSpriteFrameID = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3347 pSpellSprite.field_60_distance_related_prolly_lod = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3348 pSpellSprite.uFacing = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3349 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3350 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3351 amount = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3352 if ( mon_num > 0 )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3353 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3354 amount = (mon_num * (7 * spell_level + 25));
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3355 for ( uint mon_id = 0; mon_id < mon_num; mon_id++ )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3356 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3357 pSpellSprite.vPosition.x = pActors[_50BF30_actors_in_viewport_ids[mon_id]].vPosition.x;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3358 pSpellSprite.vPosition.y = pActors[_50BF30_actors_in_viewport_ids[mon_id]].vPosition.y;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3359 pSpellSprite.vPosition.z = pActors[_50BF30_actors_in_viewport_ids[mon_id]].vPosition.z -
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3360 (unsigned int)(signed __int64)((double)pActors[_50BF30_actors_in_viewport_ids[mon_id]].uActorHeight * -0.8);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3361 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[mon_id]);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3362 DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), _50BF30_actors_in_viewport_ids[mon_id], &v707);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3363 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3364 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3365 int pl_num = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3366 int pl_array[4];
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3367 for ( uint pl_id = 1; pl_id <= 4; ++pl_id )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3368 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3369 if ( !pPlayers[pl_id]->pConditions[Condition_Sleep] && !pPlayers[pl_id]->pConditions[Condition_Paralyzed]
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3370 && !pPlayers[pl_id]->pConditions[Condition_Unconcious] && !pPlayers[pl_id]->pConditions[Condition_Dead]
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3371 && !pPlayers[pl_id]->pConditions[Condition_Pertified] && !pPlayers[pl_id]->pConditions[Condition_Eradicated] )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3372 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3373 pl_array[pl_num++] = pl_id;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3374 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3375 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3376 for ( uint j = 0; j < pl_num; j++ )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3377 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3378 pPlayers[pl_array[j]]->sHealth += (signed __int64)((double)(signed int)amount / (double)pl_num);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3379 if ( pPlayers[pl_array[j]]->sHealth > pPlayers[pl_array[j]]->GetMaxHealth())
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3380 pPlayers[pl_array[j]]->sHealth = pPlayers[pl_array[j]]->GetMaxHealth();
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3381 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_array[j]);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3382 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3383 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 64);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3384 LODWORD(v727) = 1;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3385 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3386 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3387 case SPELL_DARK_ARMAGEDDON://
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3388 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3389 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3390 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3391 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors!
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3392 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3393 pCastSpell->uSpellID = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3394 continue;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3395 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3396 if ( skill_level == 4)
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3397 amount = 4;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3398 else
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3399 amount = 3;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3400 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3401 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3402 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3403 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3404 pCastSpell->uSpellID = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3405 continue;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3406 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3407 if ( !pPlayer->CanCastSpell(uRequiredMana) )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3408 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3409 pParty->armageddon_timer = 256;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3410 pParty->armageddonDamage = spell_level;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3411 ++pPlayer->uNumArmageddonCasts;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3412 if ( pParty->bTurnBasedModeOn == 1 )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3413 ++pTurnEngine->pending_actions;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3414 for ( uint i = 0; i < 50; i++ )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3415 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3416 v642 = rand() % 4096 - 2048;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3417 v643 = rand();
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3418 v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, pParty->vPosition.y + (v643 % 4096 - 2048), &v710, 0);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3419 sub_42F7EB_DropItemAt(4070, v642 + pParty->vPosition.x, pParty->vPosition.y + (v643 % 4096 - 2048), v732 + 16, rand() % 500 + 500, 1, 0, 0, 0);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3420 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3421 LODWORD(v727) = 1;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3422 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3423 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3424 default:
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3425 break;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3426 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3427 if ( pCastSpell->uFlags & 0x20 )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3428 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3429 if ( v727 != 0.0 )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3430 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->uSpellID], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3431 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3432 else
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3433 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3434 if ( sRecoveryTime < 0 )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3435 sRecoveryTime = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3436 if ( pParty->bTurnBasedModeOn )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3437 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3438 //v645 = sRecoveryTime;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3439 pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3440 pPlayer->SetRecoveryTime(sRecoveryTime);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3441 if ( !some_active_character )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3442 pTurnEngine->ApplyPlayerAction();
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3443 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3444 else
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3445 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333));
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3446 if ( v727 != 0.0 )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3447 {
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3448 pPlayer->PlaySound(SPEECH_49, 0);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3449 if ( v727 != 0.0 )
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3450 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->uSpellID], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0);
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3451 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3452 }
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3453 pCastSpell->uSpellID = 0;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3454 spell_level = v723;
0e2bee275f60 CastSpell continue
Ritor1
parents: 2188
diff changeset
3455 continue;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3456 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3457
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3458 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3459 //----- (00427DA0) --------------------------------------------------------
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
3460 size_t PushCastSpellInfo(uint16_t uSpellID, uint16_t uPlayerID, __int16 skill_level, uint16_t uFlags, int spell_sound_id)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3461 {
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3462 for (size_t i = 0; i < CastSpellInfoCount; i++)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3463 {
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
3464 if (!pCastSpellInfo[i].uSpellID)
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1420
diff changeset
3465 {
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
3466 pCastSpellInfo[i].uSpellID = uSpellID;
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3467 pCastSpellInfo[i].uPlayerID = uPlayerID;
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
3468 if (uFlags & 0x10)
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3469 pCastSpellInfo[i].uPlayerID_2 = uPlayerID;
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3470 pCastSpellInfo[i].field_6 = 0;
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3471 pCastSpellInfo[i].spell_target_pid = 0;
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
3472 pCastSpellInfo[i].uFlags = uFlags;
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3473 pCastSpellInfo[i].forced_spell_skill_level = skill_level;
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3474 pCastSpellInfo[i].sound_id = spell_sound_id;
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1420
diff changeset
3475 return i;
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1420
diff changeset
3476 }
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3477 }
1429
c7489dd19f88 BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents: 1420
diff changeset
3478 return -1;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3479 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3480 //----- (00427D48) --------------------------------------------------------
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3481 void CastSpellInfoHelpers::_427D48()
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3482 {
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3483 for (size_t i = 0; i < CastSpellInfoCount; i++)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3484 {
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
3485 if (pCastSpellInfo[i].uSpellID && pCastSpellInfo[i].uFlags & 0x3CA)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3486 {
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
3487 pCastSpellInfo[i].uSpellID = 0;
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3488 pGUIWindow_Settings->Release();
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3489 pGUIWindow_Settings = 0;
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3490 pMouse->SetCursorBitmap("MICON1");
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3491 GameUI_Footer_TimeLeft = 0;
1682
3c451fd02fcf OnInventoryLeftClick cleanup
Grumpy7
parents: 1643
diff changeset
3492 _50C9A0_IsEnchantingInProgress = 0;
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3493 back_to_game();
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3494 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3495 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3496 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3497 //----- (0042777D) --------------------------------------------------------
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3498 void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6)
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3499 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3500 //bool result; // eax@2
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3501 //__int16 v6; // bx@4
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3502 //Player *v7; // eax@4
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3503 //char v8; // zf@12
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3504 unsigned __int16 v9; // cx@16
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3505 unsigned int v10; // eax@18
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3506 unsigned __int8 v11; // sf@18
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3507 unsigned __int8 v12; // of@18
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3508 unsigned __int16 v13; // cx@21
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3509 unsigned int v14; // eax@23
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3510 //stru277 *v15; // esi@27
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3511 //stru277 *v16; // eax@28
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3512 //GUIWindow *v17; // eax@43
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3513 //GUIWindow *v18; // [sp-30h] [bp-48h]@44
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3514 //unsigned int v19; // [sp-2Ch] [bp-44h]@44
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3515 //unsigned int v20; // [sp-28h] [bp-40h]@44
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3516 //unsigned int v21; // [sp-24h] [bp-3Ch]@44
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3517 //unsigned int v22; // [sp-20h] [bp-38h]@44
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3518 //int v23; // [sp-1Ch] [bp-34h]@44
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3519 //int v24; // [sp-18h] [bp-30h]@44
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3520 //unsigned int v25; // [sp-14h] [bp-2Ch]@43
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3521 //unsigned int v26; // [sp-10h] [bp-28h]@43
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3522 //unsigned __int8 v27; // [sp-Ch] [bp-24h]@43
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3523 //char *v28; // [sp-8h] [bp-20h]@43
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3524 //Texture *v29; // [sp-4h] [bp-1Ch]@43
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3525 //__int16 a3a; // [sp+10h] [bp-8h]@1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3526 //__int16 a2a; // [sp+14h] [bp-4h]@1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3527
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3528 //a3a = uPlayerID;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3529 //a2a = a1;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3530
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3531 //if ( pParty->bTurnBasedModeOn != 1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3532 // || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3533 if (pParty->bTurnBasedModeOn)
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3534 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1326
diff changeset
3535 if (pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3536 return;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3537 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3538
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3539
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3540 //v6 = a5;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3541 //v7 = &pParty->pPlayers[uPlayerID];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3542 assert(uPlayerID < 4);
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1975
diff changeset
3543 Player* player = &pParty->pPlayers[uPlayerID];
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3544 if ( !(a5 & 0x10) )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3545 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3546 switch ( a1 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3547 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3548 case SPELL_SPIRIT_FATE:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3549 case SPELL_BODY_FIRST_AID:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3550 case SPELL_DARK_REANIMATE:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3551 //HIBYTE(v6) = HIBYTE(a5) | 1;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3552 a5 |= 0x0100;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3553 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3554
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3555 case SPELL_FIRE_FIRE_AURA:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3556 case SPELL_WATER_RECHARGE_ITEM:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3557 case SPELL_WATER_ENCHANT_ITEM:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3558 case SPELL_DARK_VAMPIRIC_WEAPON:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3559 //LOBYTE(v6) = a5 | 0x80;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3560 a5 |= 0x0080;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3561 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3562
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3563 case SPELL_FIRE_FIRE_BOLT:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3564 case SPELL_FIRE_FIREBALL:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3565 case SPELL_FIRE_INCINERATE:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3566 case SPELL_AIR_LIGHNING_BOLT:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3567 case SPELL_AIR_IMPLOSION:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3568 case SPELL_WATER_POISON_SPRAY:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3569 case SPELL_WATER_ICE_BOLT:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3570 case SPELL_WATER_ACID_BURST:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3571 case SPELL_WATER_ICE_BLAST:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3572 case SPELL_EARTH_STUN:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3573 case SPELL_EARTH_SLOW:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3574 case SPELL_EARTH_DEADLY_SWARM:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3575 case SPELL_EARTH_BLADES:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3576 case SPELL_EARTH_MASS_DISTORTION:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3577 case SPELL_SPIRIT_SPIRIT_LASH:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3578 case SPELL_MIND_MIND_BLAST:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3579 case SPELL_MIND_CHARM:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3580 case SPELL_MIND_PSYCHIC_SHOCK:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3581 case SPELL_BODY_HARM:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3582 case SPELL_BODY_FLYING_FIST:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3583 case SPELL_LIGHT_LIGHT_BOLT:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3584 case SPELL_LIGHT_DESTROY_UNDEAD:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3585 case SPELL_LIGHT_SUNRAY:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3586 case SPELL_DARK_TOXIC_CLOUD:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3587 case SPELL_DARK_SHRINKING_RAY:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3588 case SPELL_DARK_SHARPMETAL:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3589 case SPELL_DARK_DRAGON_BREATH:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3590 if ( !a6 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3591 a5 |= 0x0008;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3592 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3593 case SPELL_MIND_TELEPATHY:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3594 case SPELL_MIND_BERSERK:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3595 case SPELL_MIND_ENSLAVE:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3596 case SPELL_LIGHT_PARALYZE:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3597 case SPELL_DARK_CONTROL_UNDEAD:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3598 //LABEL_9:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3599 //v6 = a5 | 8;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3600 a5 |= 0x0008;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3601 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3602
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3603 case SPELL_EARTH_TELEKINESIS:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3604 a5 |= 0x0040;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3605 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3606
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3607 case SPELL_SPIRIT_BLESS:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3608 if (a4 && ~a4 & 0x01C0)
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3609 //goto LABEL_25;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3610 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3611 a5 |= 0x0002;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3612 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3613 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3614 else if ((player->pActiveSkills[PLAYER_SKILL_SPIRIT] & 0x1C0) == 0)
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3615 //goto LABEL_25;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3616 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3617 a5 |= 0x0002;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3618 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3619 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3620 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3621
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3622 case SPELL_SPIRIT_PRESERVATION:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3623 v9 = a4;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3624 if ( !a4 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3625 v9 = player->pActiveSkills[PLAYER_SKILL_SPIRIT];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3626 //goto LABEL_18;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3627 v10 = SkillToMastery(v9);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3628 v12 = __OFSUB__(v10, 3);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3629 v11 = ((v10 - 3) & 0x80000000u) != 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3630 //goto LABEL_24;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3631 if ( v11 ^ v12 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3632 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3633 a5 |= 0x0002;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3634 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3635 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3636 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3637
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3638 case SPELL_DARK_PAIN_REFLECTION:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3639 v9 = a4;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3640 if ( !a4 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3641 v9 = player->pActiveSkills[PLAYER_SKILL_DARK];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3642 //LABEL_18:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3643 v10 = SkillToMastery(v9);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3644 v12 = __OFSUB__(v10, 3);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3645 v11 = ((v10 - 3) & 0x80000000u) != 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3646 //goto LABEL_24;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3647 if ( v11 ^ v12 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3648 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3649 a5 |= 0x0002;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3650 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3651 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3652 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3653
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3654 case SPELL_BODY_HAMMERHANDS:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3655 v13 = a4;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3656 if ( !a4 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3657 v13 = player->pActiveSkills[PLAYER_SKILL_BODY];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3658 v14 = SkillToMastery(v13);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3659 v12 = __OFSUB__(v14, 4);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3660 v11 = ((v14 - 4) & 0x80000000u) != 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3661 //LABEL_24:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3662 if ( v11 ^ v12 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3663 //goto LABEL_25;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3664 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3665 a5 |= 0x0002;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3666 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3667 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3668 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3669
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3670 case SPELL_EARTH_STONE_TO_FLESH:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3671 case SPELL_SPIRIT_REMOVE_CURSE:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3672 case SPELL_SPIRIT_RAISE_DEAD:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3673 case SPELL_SPIRIT_RESSURECTION:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3674 case SPELL_MIND_REMOVE_FEAR:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3675 case SPELL_MIND_CURE_PARALYSIS:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3676 case SPELL_MIND_CURE_INSANITY:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3677 case SPELL_BODY_CURE_WEAKNESS:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3678 case SPELL_BODY_REGENERATION:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3679 case SPELL_BODY_CURE_POISON:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3680 case SPELL_BODY_CURE_DISEASE:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3681 //LABEL_25:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3682 //v6 = a5 | 2;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3683 a5 |= 0x0002;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3684 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3685
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3686 case SPELL_DARK_SACRIFICE:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3687 //HIBYTE(v6) = HIBYTE(a5) | 2;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3688 a5 |= 0x0200;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3689 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3690 default:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3691 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3692 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3693 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3694
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3695
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3696 if (a5 & 0x3CA)
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3697 {
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3698 for (uint i = 0; i < CastSpellInfoCount; ++i)
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
3699 if (pCastSpellInfo[i].uFlags & 0x3CA)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3700 {
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
3701 pCastSpellInfo[i].uSpellID = 0;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3702 break;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3703 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3704 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3705
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3706 for (uint i = 0; i < CastSpellInfoCount; ++i)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3707 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1975
diff changeset
3708 CastSpellInfo* spell = &pCastSpellInfo[i];
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
3709 if (!spell->uSpellID)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3710 continue;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3711
1519
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
3712 spell->uSpellID = 0;
4c787c28ddce Clean CastSpellInfo. (2)
yoctozepto
parents: 1517
diff changeset
3713 if (spell->uFlags & 0x3CA)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3714 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3715 pGUIWindow_Settings->Release();
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3716 pGUIWindow_Settings = nullptr;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3717 pMouse->SetCursorBitmap("MICON1");
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3718 GameUI_Footer_TimeLeft = 0;
1682
3c451fd02fcf OnInventoryLeftClick cleanup
Grumpy7
parents: 1643
diff changeset
3719 _50C9A0_IsEnchantingInProgress = 0;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3720 back_to_game();
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3721 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3722 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3723
1517
c3da3c2985b8 Clean CastSpellInfo. (1)
yoctozepto
parents: 1514
diff changeset
3724 int result = PushCastSpellInfo(a1, uPlayerID, a4, a5, a6);
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3725 if ( result != -1 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3726 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3727 if ( a5 & 2 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3728 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3729 if ( pGUIWindow_Settings )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3730 return;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3731 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3732 pGUIWindow_Settings->CreateButton(52, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 0, 49, "", 0);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3733 pGUIWindow_Settings->CreateButton(165, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 1, 50, "", 0);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3734 pGUIWindow_Settings->CreateButton(280, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 2, 51, "", 0);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3735 pGUIWindow_Settings->CreateButton(390, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 3, 52, "", 0);
1829
e4e27261d84e sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents: 1828
diff changeset
3736 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3737 return;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3738 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3739 if ( a5 & 8 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3740 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3741 if ( pGUIWindow_Settings )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3742 return;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3743
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3744 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3745 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Shoot_Monster, 0, 0, "", 0);
1829
e4e27261d84e sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents: 1828
diff changeset
3746 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3747 return;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3748 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3749 if ( a5 & 0x40 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3750 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3751 if ( pGUIWindow_Settings )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3752 return;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3753
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3754 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
1326
e70fe5d77928 UIMSG_CastSpell_Telekinesis
Ritor1
parents: 1296
diff changeset
3755 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Telekinesis, 0, 0, "", 0);
1829
e4e27261d84e sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents: 1828
diff changeset
3756 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3757 return;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3758 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3759 if ( (char)a5 < 0 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3760 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3761 if ( pGUIWindow_Settings )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3762 return;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3763 ++pIcons_LOD->uTexturePacksCount;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3764 if ( !pIcons_LOD->uNumPrevLoadedFiles )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3765 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
1455
bfe342ae0c1f DrawPaperdoll cleaning
Ritor1
parents: 1450
diff changeset
3766 pGUIWindow_Settings = pCastSpellInfo[result].GetCastSpellInInventoryWindow();
1682
3c451fd02fcf OnInventoryLeftClick cleanup
Grumpy7
parents: 1643
diff changeset
3767 _50C9A0_IsEnchantingInProgress = 1;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3768 some_active_character = uActiveCharacter;
1829
e4e27261d84e sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents: 1828
diff changeset
3769 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3770 return;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3771 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3772 if ( HIBYTE(a5) & 1 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3773 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3774 if ( pGUIWindow_Settings )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3775 return;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3776 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3777 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 0, 0x31u, "", 0);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3778 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 1, 0x32u, "", 0);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3779 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 2, 0x33u, "", 0);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3780 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 3, 0x34u, "", 0);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3781 pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Monster_Improvement, 0, 0, "", NULL);
1829
e4e27261d84e sub_421B2C_PlaceInInventory_or_DropPickedItem to Party::sub_421B2C_PlaceInInventory_or_DropPickedItem
Grumpy7
parents: 1828
diff changeset
3782 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3783 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3784 if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3785 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3786 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3787 pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178,
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3788 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth,
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3789 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight,
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3790 1, 0, UIMSG_ScrollNPCPanel, 0, 0, "",
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3791 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3792 pBtn_NPCRight = pGUIWindow_Settings->CreateButton(626, 178,
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3793 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth,
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3794 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight,
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3795 1, 0, UIMSG_ScrollNPCPanel, 1, 0, "",
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3796 pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3797 pGUIWindow_Settings->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 4, 0x35u, "", 0);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3798 pGUIWindow_Settings->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 5, 0x36u, "", 0);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3799 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3800 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3801 }