annotate CastSpellInfo.cpp @ 2203:4bfee77e900d

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