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