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