annotate CastSpellInfo.cpp @ 2440:2b10278bc7ac

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