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