2499
|
1 #define _CRTDBG_MAP_ALLOC
|
2567
|
2 #define _CRT_SECURE_NO_WARNINGS
|
2499
|
3 #include <stdlib.h>
|
|
4 #include <crtdbg.h>
|
|
5 #include <stdlib.h>
|
2541
|
6
|
|
7 #include "Engine/Engine.h"
|
2567
|
8 #include "Engine/LOD.h"
|
|
9 #include "Engine/texts.h"
|
|
10 #include "Engine/stru6.h"
|
|
11 #include "Engine/Graphics/Overlays.h"
|
|
12 #include "Engine/Graphics/Indoor.h"
|
|
13 #include "Engine/Objects/SpriteObject.h"
|
|
14 #include "Engine/Objects/ObjectList.h"
|
|
15 #include "Engine/Objects/Actor.h"
|
2499
|
16
|
|
17 #include "Spells.h"
|
|
18 #include "../Party.h"
|
|
19 #include "../OurMath.h"
|
2567
|
20
|
2502
|
21 #include "Media/Audio/AudioPlayer.h"
|
2499
|
22
|
|
23
|
2566
|
24 std::array<TownPortalData, 6> TownPortalList = // 4ECBB8
|
2499
|
25 {{
|
|
26 {Vec3_int_(-5121, 2107, 1), 1536, 0, 21, 0},
|
|
27 {Vec3_int_(-15148, -10240, 1473), 0, 0, 4, 0},
|
|
28 {Vec3_int_(-10519, 5375, 753), 512, 0, 3, 0},
|
|
29 {Vec3_int_(3114, -11055, 513), 0, 0, 10, 0},
|
|
30 {Vec3_int_(-158, 7624, 1), 512, 0, 7, 0},
|
|
31 {Vec3_int_(-1837, -4247, 65), 65, 0, 8, 0}
|
|
32 }} ;
|
|
33
|
2566
|
34 struct SpellStats *pSpellStats = nullptr;
|
2499
|
35
|
|
36
|
2566
|
37 std::array<stru324_spell_id_to_sprite_mapping, 103> spell_sprite_mapping = // 4E3ACC
|
2499
|
38 {{
|
2566
|
39 { SPRITE_SPELL_0, 0 },
|
|
40 { SPRITE_SPELL_FIRE_TORCH_LIGHT, 0 },
|
|
41 { SPRITE_SPELL_FIRE_FIRE_BOLT, 0 },
|
|
42 { SPRITE_SPELL_FIRE_PROTECTION_FROM_FIRE, 0 },
|
|
43 { SPRITE_SPELL_FIRE_FIRE_AURA, 0 },
|
|
44 { SPRITE_SPELL_FIRE_HASTE, 0 },
|
|
45 { SPRITE_SPELL_FIRE_FIREBALL, 0 },
|
|
46 { SPRITE_SPELL_FIRE_FIRE_SPIKE, 0 },
|
|
47 { SPRITE_SPELL_FIRE_IMMOLATION, 0 },
|
|
48 { SPRITE_SPELL_FIRE_METEOR_SHOWER, 0 },
|
|
49 { SPRITE_SPELL_FIRE_INFERNO, 0 },
|
|
50 { SPRITE_SPELL_FIRE_INCINERATE, 0 },
|
|
51
|
|
52 { SPRITE_SPELL_AIR_WIZARD_EYE, 0 },
|
|
53 { SPRITE_SPELL_AIR_FEATHER_FALL, 0 },
|
|
54 { SPRITE_SPELL_AIR_PROTECTION_FROM_AIR, 0 },
|
|
55 { SPRITE_SPELL_AIR_SPARKS, 0 },
|
|
56 { SPRITE_SPELL_AIR_JUMP, 0 },
|
|
57 { SPRITE_SPELL_AIR_SHIELD, 0 },
|
|
58 { SPRITE_SPELL_AIR_LIGHNING_BOLT, 0 },
|
|
59 { SPRITE_SPELL_AIR_INVISIBILITY, 0 },
|
|
60 { SPRITE_SPELL_AIR_IMPLOSION, 0 },
|
|
61 { SPRITE_SPELL_AIR_FLY, 0 },
|
|
62 { SPRITE_SPELL_AIR_STARBURST, 0 },
|
|
63
|
|
64 { SPRITE_SPELL_WATER_AWAKEN, 0 },
|
|
65 { SPRITE_SPELL_WATER_POISON_SPRAY, 0 },
|
|
66 { SPRITE_SPELL_WATER_PROTECTION_FROM_WATER, 0 },
|
|
67 { SPRITE_SPELL_WATER_ICE_BOLT, 0 },
|
|
68 { SPRITE_SPELL_WATER_WATER_WALK, 0 },
|
|
69 { SPRITE_SPELL_WATER_RECHARGE_ITEM, 0 },
|
|
70 { SPRITE_SPELL_WATER_ACID_BURST, 0 },
|
|
71 { SPRITE_SPELL_WATER_ENCHANT_ITEM, 0 },
|
|
72 { SPRITE_SPELL_WATER_TOWN_PORTAL, 0 },
|
|
73 { SPRITE_SPELL_WATER_ICE_BLAST, 0 },
|
|
74 { SPRITE_SPELL_WATER_LLOYDS_BEACON, 0 },
|
|
75
|
|
76 { SPRITE_SPELL_EARTH_STUN, 0 },
|
|
77 { SPRITE_SPELL_EARTH_SLOW, 0 },
|
|
78 { SPRITE_SPELL_EARTH_PROTECTION_FROM_EARTH, 0 },
|
|
79 { SPRITE_SPELL_EARTH_DEADLY_SWARM, 0 },
|
|
80 { SPRITE_SPELL_EARTH_STONESKIN, 0 },
|
|
81 { SPRITE_SPELL_EARTH_BLADES, 0 },
|
|
82 { SPRITE_SPELL_EARTH_STONE_TO_FLESH, 0 },
|
|
83 { SPRITE_SPELL_EARTH_ROCK_BLAST, 0 },
|
|
84 { SPRITE_SPELL_EARTH_TELEKINESIS, 0 },
|
|
85 { SPRITE_SPELL_EARTH_DEATH_BLOSSOM, 0 },
|
|
86 { SPRITE_SPELL_EARTH_MASS_DISTORTION, 0 },
|
|
87
|
|
88 { SPRITE_SPELL_SPIRIT_DETECT_LIFE, 0 },
|
|
89 { SPRITE_SPELL_SPIRIT_BLESS, 0 },
|
|
90 { SPRITE_SPELL_SPIRIT_FATE, 0 },
|
|
91 { SPRITE_SPELL_SPIRIT_TURN_UNDEAD, 0 },
|
|
92 { SPRITE_SPELL_SPIRIT_REMOVE_CURSE, 0 },
|
|
93 { SPRITE_SPELL_SPIRIT_PRESERVATION, 0 },
|
|
94 { SPRITE_SPELL_SPIRIT_HEROISM, 0 },
|
|
95 { SPRITE_SPELL_SPIRIT_SPIRIT_LASH, 0 },
|
|
96 { SPRITE_SPELL_SPIRIT_RAISE_DEAD, 0 },
|
|
97 { SPRITE_SPELL_SPIRIT_SHARED_LIFE, 0 },
|
|
98 { SPRITE_SPELL_SPIRIT_RESSURECTION, 0 },
|
|
99
|
|
100 { SPRITE_SPELL_MIND_REMOVE_FEAR, 0 },
|
|
101 { SPRITE_SPELL_MIND_MIND_BLAST, 0 },
|
|
102 { SPRITE_SPELL_MIND_PROTECTION_FROM_MIND, 0 },
|
|
103 { SPRITE_SPELL_MIND_TELEPATHY, 0 },
|
|
104 { SPRITE_SPELL_MIND_CHARM, 0 },
|
|
105 { SPRITE_SPELL_MIND_CURE_PARALYSIS, 0 },
|
|
106 { SPRITE_SPELL_MIND_BERSERK, 0 },
|
|
107 { SPRITE_SPELL_MIND_MASS_FEAR, 0 },
|
|
108 { SPRITE_SPELL_MIND_CURE_INSANITY, 0 },
|
|
109 { SPRITE_SPELL_MIND_PSYCHIC_SHOCK, 0 },
|
|
110 { SPRITE_SPELL_MIND_ENSLAVE, 0 },
|
|
111
|
|
112 { SPRITE_SPELL_BODY_CURE_WEAKNESS, 0 },
|
|
113 { SPRITE_SPELL_BODY_FIRST_AID, 0 },
|
|
114 { SPRITE_SPELL_BODY_PROTECTION_FROM_BODY, 0 },
|
|
115 { SPRITE_SPELL_BODY_HARM, 0 },
|
|
116 { SPRITE_SPELL_BODY_REGENERATION, 0 },
|
|
117 { SPRITE_SPELL_BODY_CURE_POISON, 0 },
|
|
118 { SPRITE_SPELL_BODY_HAMMERHANDS, 0 },
|
|
119 { SPRITE_SPELL_BODY_CURE_DISEASE, 0 },
|
|
120 { SPRITE_SPELL_BODY_PROTECTION_FROM_MAGIC, 0 },
|
|
121 { SPRITE_SPELL_BODY_FLYING_FIST, 0 },
|
|
122 { SPRITE_SPELL_BODY_POWER_CURE, 0 },
|
|
123
|
|
124 { SPRITE_SPELL_LIGHT_LIGHT_BOLT, 0 },
|
|
125 { SPRITE_SPELL_LIGHT_DESTROY_UNDEAD, 0 },
|
|
126 { SPRITE_SPELL_LIGHT_DISPEL_MAGIC, 0 },
|
|
127 { SPRITE_SPELL_LIGHT_PARALYZE, 0 },
|
|
128 { SPRITE_SPELL_LIGHT_SUMMON_ELEMENTAL, 0 },
|
|
129 { SPRITE_SPELL_LIGHT_DAY_OF_THE_GODS, 0 },
|
|
130 { SPRITE_SPELL_LIGHT_PRISMATIC_LIGHT, 0 },
|
|
131 { SPRITE_SPELL_LIGHT_DAY_OF_PROTECTION, 0 },
|
|
132 { SPRITE_SPELL_LIGHT_HOUR_OF_POWER, 0 },
|
|
133 { SPRITE_SPELL_LIGHT_SUNRAY, 0 },
|
|
134 { SPRITE_SPELL_LIGHT_DIVINE_INTERVENTION, 0 },
|
|
135
|
|
136 { SPRITE_SPELL_DARK_REANIMATE, 0 },
|
|
137 { SPRITE_SPELL_DARK_TOXIC_CLOUD, 0 },
|
|
138 { SPRITE_SPELL_DARK_VAMPIRIC_WEAPON, 0 },
|
|
139 { SPRITE_SPELL_DARK_SHRINKING_RAY, 0 },
|
|
140 { SPRITE_SPELL_DARK_SHARPMETAL, 0 },
|
|
141 { SPRITE_SPELL_DARK_CONTROL_UNDEAD, 0 },
|
|
142 { SPRITE_SPELL_DARK_PAIN_REFLECTION, 0 },
|
|
143 { SPRITE_SPELL_DARK_SACRIFICE, 0 },
|
|
144 { SPRITE_SPELL_DARK_DRAGON_BREATH, 0 },
|
|
145 { SPRITE_SPELL_DARK_ARMAGEDDON, 0 },
|
|
146 { SPRITE_SPELL_DARK_SOULDRINKER, 0 },
|
|
147
|
|
148 { SPRITE_SPELL_BOW_ARROW, 0 },
|
|
149 { SPRITE_SPELL_101, 0 },
|
|
150 { SPRITE_SPELL_LASER_PROJECTILE, 0 }
|
2499
|
151 }};
|
|
152
|
|
153
|
|
154
|
|
155 SpellData::SpellData( __int16 innormalMana, __int16 inExpertLevelMana, __int16 inMasterLevelMana, __int16 inMagisterLevelMana,
|
|
156 __int16 inNormalLevelRecovery, __int16 inExpertLevelRecovery, __int16 inMasterLevelRecovery, __int16 inMagisterLevelRecovery,
|
|
157 __int8 inbaseDamage, __int8 inbonusSkillDamage, __int16 instats ):
|
|
158 uNormalLevelMana(innormalMana),
|
|
159 uExpertLevelMana(inExpertLevelMana),
|
|
160 uMasterLevelMana(inMasterLevelMana),
|
|
161 uMagisterLevelMana(inMagisterLevelMana),
|
|
162 uNormalLevelRecovery(inNormalLevelRecovery),
|
|
163 uExpertLevelRecovery(inExpertLevelRecovery),
|
|
164 uMasterLevelRecovery(inMasterLevelRecovery),
|
|
165 uMagisterLevelRecovery(inMagisterLevelRecovery),
|
|
166 baseDamage(inbaseDamage),
|
|
167 bonusSkillDamage(inbonusSkillDamage),
|
|
168 stats(instats)
|
|
169 {
|
|
170
|
|
171 }
|
|
172
|
|
173 //9 spellbook pages 11 spells per page 9*11 =99 +1 zero struct at 0. It counted from 1!
|
|
174 std::array<SpellData, 100> pSpellDatas={{
|
|
175 SpellData(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
|
176
|
|
177 SpellData(1, 1, 1, 1, 60, 60, 60, 40, 0, 0, 0),//0 fire
|
|
178 SpellData(2, 2, 2, 2, 110, 110, 100, 90, 3, 3, 0),
|
|
179 SpellData(3, 3, 3, 3, 120, 120, 120, 120, 0, 0, 0),
|
|
180 SpellData(4, 4, 4, 4, 120, 120, 120, 120, 0, 0, 0),
|
|
181 SpellData(5, 5, 5, 5, 120, 120, 120, 120, 0, 0, 0),
|
|
182 SpellData(8, 8, 8, 8, 100, 100, 90, 80, 0, 6, 0),
|
|
183 SpellData(10, 10, 10, 10, 150, 150, 150, 150, 0, 6, 0),
|
|
184 SpellData(15, 15, 15, 15, 120, 120, 120, 120, 0, 6, 0),
|
|
185 SpellData(20, 20, 20, 20, 100, 100, 100, 90, 8, 1, 0),
|
|
186 SpellData(25, 25, 25, 25, 100, 100, 100, 90, 12, 1, 0),
|
|
187 SpellData(30, 30, 30, 30, 90, 90, 90, 90, 15, 15, 0),
|
|
188
|
|
189 SpellData(1, 1, 1, 0, 60, 60, 60, 60, 0, 0, 0), //1 air
|
|
190 SpellData(2, 2, 2, 2, 120, 120, 120, 100, 0, 0, 0),
|
|
191 SpellData(3, 3, 3, 3, 120, 120, 120, 120, 0, 0, 0),
|
|
192 SpellData(4, 4, 4, 4, 110, 100, 90, 80, 2, 1, 0),
|
|
193 SpellData(5, 5, 5, 5, 90, 90, 70, 50, 0, 0, 0),
|
|
194 SpellData(8, 8, 8, 8, 120, 120, 120, 120, 0, 0, 0),
|
|
195 SpellData(10, 10, 10, 10, 100, 100, 90, 70, 0, 8, 0),
|
|
196 SpellData(15, 15, 15, 15, 200, 200, 200, 200, 0, 0, 0),
|
|
197 SpellData(20, 20, 20, 20, 100, 100, 100, 90, 10, 10, 0),
|
|
198 SpellData(25, 25, 25, 25, 250, 250, 250, 250, 0, 0, 0),
|
|
199 SpellData(30, 30, 30, 30, 90, 90, 90, 90, 20, 1, 0),
|
|
200
|
|
201 SpellData(1, 1, 1, 1, 60, 60, 60, 20, 0, 0, 0), //2 water
|
|
202 SpellData(2, 2, 2, 2, 110, 100, 90, 70, 2, 2, 0),
|
|
203 SpellData(3, 3, 3, 3, 120, 120, 120, 120, 0, 0, 0),
|
|
204 SpellData(4, 4, 4, 4, 110, 100, 90, 80, 0, 4, 0),
|
|
205 SpellData(5, 5, 5, 5, 150, 150, 150, 150, 0, 0, 0),
|
|
206 SpellData(8, 8, 8, 8, 200, 200, 200, 200, 0, 0, 0),
|
|
207 SpellData(10, 10, 10, 10, 100, 100, 90, 80, 9, 9, 0),
|
|
208 SpellData(15, 15, 15, 15, 140, 140, 140, 140, 0, 0, 0),
|
|
209 SpellData(20, 20, 20, 20, 200, 200, 200, 200, 0, 0, 0),
|
|
210 SpellData(25, 25, 25, 25, 80, 80, 80, 80, 12, 3, 0),
|
|
211 SpellData(30, 30, 30, 30, 250, 250, 250, 250, 0, 0, 0),
|
|
212
|
|
213 SpellData(1, 1, 1, 1, 80, 80, 80, 80, 0, 0, 0), //3 earth
|
|
214 SpellData(2, 2, 2, 2, 100, 100, 100, 100, 0, 0, 0),
|
|
215 SpellData(3, 3, 3, 3, 120, 120, 120, 120, 0, 0, 0),
|
|
216 SpellData(4, 4, 4, 4, 110, 100, 90, 80, 5, 3, 0),
|
|
217 SpellData(5, 5, 5, 5, 120, 120, 120, 120, 0, 0, 0),
|
|
218 SpellData(8, 8, 8, 8, 100, 100, 90, 80, 0, 9, 0),
|
|
219 SpellData(10, 10, 10, 10, 140, 140, 140, 140, 0, 0, 0),
|
|
220 SpellData(15, 15, 15, 15, 90, 90, 90, 80, 0, 8, 0),
|
|
221 SpellData(20, 20, 20, 20, 150, 150, 150, 150, 0, 0, 0),
|
|
222 SpellData(25, 25, 25, 25, 100, 100, 100, 90, 20, 1, 0),
|
|
223 SpellData(30, 30, 30, 30, 90, 90, 90, 90, 25, 0, 0),
|
|
224
|
|
225 SpellData(1, 1, 1, 1, 100, 100, 100, 100, 0, 0, 0), //4 spirit
|
|
226 SpellData(2, 2, 2, 2, 100, 100, 100, 100, 0, 0, 0),
|
|
227 SpellData(3, 3, 3, 3, 90, 90, 90, 90, 0, 0, 0),
|
|
228 SpellData(4, 4, 4, 4, 120, 120, 120, 120, 0, 0, 0),
|
|
229 SpellData(5, 5, 5, 5, 120, 120, 120, 120, 0, 0, 0),
|
|
230 SpellData(8, 8, 8, 8, 120, 120, 120, 120, 0, 0, 0),
|
|
231 SpellData(10, 10, 10, 10, 120, 120, 120, 120, 0, 0, 0),
|
|
232 SpellData(15, 15, 15, 15, 100, 100, 100, 100, 10, 8, 0),
|
|
233 SpellData(20, 20, 20, 20, 240, 240, 240, 240, 0, 0, 0),
|
|
234 SpellData(25, 25, 25, 25, 150, 150, 150, 150, 0, 0, 0),
|
|
235 SpellData(30, 30, 30, 30, 1000, 1000, 1000, 1000, 0, 0, 0),
|
|
236
|
|
237 SpellData(1, 1, 1, 1, 120, 120, 120, 120, 0, 0, 0), //5 mind
|
|
238 SpellData(2, 2, 2, 2, 110, 110, 110, 110, 3, 3, 0),
|
|
239 SpellData(3, 3, 3, 3, 120, 120, 120, 120, 0, 0, 0),
|
|
240 SpellData(4, 4, 4, 4, 110, 100, 90, 80, 0, 0, 0),
|
|
241 SpellData(5, 5, 5, 5, 100, 100, 100, 100, 0, 0, 0),
|
|
242 SpellData(8, 8, 8, 8, 120, 120, 120, 120, 0, 0, 0),
|
|
243 SpellData(10, 10, 10, 10, 120, 120, 120, 120, 0, 0, 0),
|
|
244 SpellData(15, 15, 15, 15, 80, 80, 80, 80, 0, 0, 0),
|
|
245 SpellData(20, 20, 20, 20, 120, 120, 120, 120, 0, 0, 0),
|
|
246 SpellData(25, 25, 25, 25, 110, 110, 110, 100, 12, 12, 0),
|
|
247 SpellData(30, 30, 30, 30, 120, 120, 120, 120, 0, 0, 0),
|
|
248
|
|
249 SpellData(1, 1, 1, 1, 120, 120, 120, 120, 0, 0, 0), //6 body
|
|
250 SpellData(2, 2, 2, 2, 100, 100, 100, 100, 0, 0, 0),
|
|
251 SpellData(3, 3, 3, 3, 120, 120, 120, 120, 0, 0, 0),
|
|
252 SpellData(4, 4, 4, 4, 110, 100, 90, 80, 8, 2, 0),
|
|
253 SpellData(5, 5, 5, 5, 110, 110, 110, 110, 0, 0, 0),
|
|
254 SpellData(8, 8, 8, 8, 120, 120, 120, 120, 0, 0, 0),
|
|
255 SpellData(10, 10, 10, 10, 120, 120, 120, 120, 0, 0, 0),
|
|
256 SpellData(15, 15, 15, 15, 120, 120, 120, 120, 0, 0, 0),
|
|
257 SpellData(20, 20, 20, 20, 120, 120, 120, 120, 0, 0, 0),
|
|
258 SpellData(25, 25, 25, 25, 110, 110, 110, 100, 30, 5, 0),
|
|
259 SpellData(30, 30, 30, 30, 100, 100, 100, 100, 0, 0, 0),
|
|
260
|
|
261 SpellData(5, 5, 5, 5, 110, 100, 90, 80, 0, 4, 0), //7 light
|
|
262 SpellData(10, 10, 10, 10, 120, 110, 100, 90, 16, 16, 0),
|
|
263 SpellData(15, 15, 15, 15, 120, 110, 100, 90, 0, 0, 0),
|
|
264 SpellData(20, 20, 20, 20, 160, 140, 120, 100, 0, 0, 0),
|
|
265 SpellData(25, 25, 25, 25, 140, 140, 140, 140, 0, 0, 0),
|
|
266 SpellData(30, 30, 30, 30, 500, 500, 500, 500, 0, 0, 0),
|
|
267 SpellData(35, 35, 35, 35, 135, 135, 120, 100, 25, 1, 0),
|
|
268 SpellData(40, 40, 40, 40, 500, 500, 500, 500, 0, 0, 0),
|
|
269 SpellData(45, 45, 45, 45, 250, 250, 250, 250, 0, 0, 0),
|
|
270 SpellData(50, 50, 50, 50, 150, 150, 150, 135, 20, 20, 0),
|
|
271 SpellData(55, 55, 55, 55, 300, 300, 300, 300, 0, 0, 0),
|
|
272
|
|
273 SpellData(10, 10, 10, 10, 140, 140, 140, 140, 0, 0, 0), //8 dark
|
|
274 SpellData(15, 15, 15, 15, 120, 110, 100, 90, 25, 10, 0),
|
|
275 SpellData(20, 20, 20, 20, 120, 100, 90, 120, 0, 0, 0),
|
|
276 SpellData(25, 25, 25, 25, 120, 120, 120, 120, 0, 0, 0),
|
|
277 SpellData(30, 30, 30, 30, 90, 90, 80, 70, 6, 6, 0),
|
|
278 SpellData(35, 35, 35, 35, 120, 120, 100, 80, 0, 0, 0),
|
|
279 SpellData(40, 40, 40, 40, 110, 110, 110, 110, 0, 0, 0),
|
|
280 SpellData(45, 45, 45, 45, 200, 200, 200, 150, 0, 0, 0),
|
|
281 SpellData(50, 50, 50, 50, 120, 120, 120, 100, 0, 25, 0),
|
|
282 SpellData(55, 55, 55, 55, 250, 250, 250, 250, 50, 1, 0),
|
|
283 SpellData(60, 60, 60, 60, 300, 300, 300, 300, 25, 8, 0)
|
2566
|
284 }};
|
2499
|
285
|
2566
|
286 std::array<SPELL_TYPE, 25> wand_spell_ids =
|
2499
|
287 {
|
|
288 // 135 Wand of Fire 136 Wand of Sparks 137 Wand of Poison 138 Wand of Stunning 139 Wand of Harm
|
|
289 SPELL_FIRE_FIRE_BOLT, SPELL_AIR_SPARKS, SPELL_WATER_POISON_SPRAY, SPELL_EARTH_STUN, SPELL_BODY_HARM,
|
|
290 // 140 Fairy Wand of Light 141 Fairy Wand of Ice 142 Fairy Wand of Lashing 143 Fairy Wand of Mind 144 Fairy Wand of Swarms
|
|
291 SPELL_LIGHT_LIGHT_BOLT, SPELL_WATER_ICE_BOLT, SPELL_SPIRIT_SPIRIT_LASH, SPELL_MIND_MIND_BLAST, SPELL_EARTH_DEADLY_SWARM,
|
|
292 // 145 Alacorn Wand of Fireballs 146 Alacorn Wand of Acid 147 Alacorn Wand of Lightning 148 Alacorn Wand of Blades 149 Alacorn Wand of Charms
|
|
293 SPELL_FIRE_FIREBALL, SPELL_WATER_ACID_BURST, SPELL_AIR_LIGHNING_BOLT, SPELL_EARTH_BLADES, SPELL_MIND_CHARM,
|
|
294 // 150 Arcane Wand of Blasting 151 Arcane Wand of The Fist 152 Arcane Wand of Rocks 153 Arcane Wand of Paralyzing 154 Arcane Wand of Clouds
|
|
295 SPELL_WATER_ICE_BLAST, SPELL_BODY_FLYING_FIST, SPELL_EARTH_ROCK_BLAST, SPELL_LIGHT_PARALYZE, SPELL_DARK_TOXIC_CLOUD,
|
|
296 // 155 Mystic Wand of Implosion 156 Mystic Wand of Distortion 157 Mystic Wand of Sharpmetal 158 Mystic Wand of Shrinking 159 Mystic Wand of Incineration
|
|
297 SPELL_AIR_IMPLOSION, SPELL_EARTH_MASS_DISTORTION, SPELL_DARK_SHARPMETAL, SPELL_DARK_SHRINKING_RAY, SPELL_FIRE_INCINERATE
|
|
298 };
|
|
299
|
|
300
|
|
301 std::array<std::array<struct SpellBookIconPos, 12>, 9> pIconPos={{
|
|
302
|
|
303 { 0, 0, 17, 13, 115, 2, 217, 15,
|
|
304 299, 6, 28, 125, 130, 133, 294, 114,
|
|
305 11, 232, 134, 233, 237, 171, 296, 231},
|
|
306
|
|
307 { 0, 0, 19, 9, 117, 3, 206, 13,
|
|
308 285, 7, 16, 123, 113, 101, 201, 118,
|
|
309 317, 110, 11, 230, 149, 236, 296, 234},
|
|
310
|
|
311 { 0, 0, 17, 9, 140, 0, 210, 34,
|
|
312 293, 5, 15, 98, 78, 121, 175, 136,
|
|
313 301, 115, 15, 226, 154, 225, 272, 220},
|
|
314
|
|
315 { 0, 0, 7, 9, 156, 2, 277, 9,
|
|
316 11, 117, 111, 82, 180, 102, 303, 108,
|
|
317 10, 229, 120, 221, 201, 217, 296, 225},
|
|
318
|
|
319 { 0, 0, 18, 8, 89, 15, 192, 14,
|
|
320 292, 7, 22, 129, 125, 146, 217, 136,
|
|
321 305, 115, 22, 226, 174, 237, 290, 231},
|
|
322
|
|
323 { 0, 0, 18, 12, 148, 9, 292, 7,
|
|
324 17, 122, 121, 99, 220, 87, 293, 112,
|
|
325 13, 236, 128, 213, 220, 223, 315, 223},
|
|
326
|
|
327 { 0, 0, 23, 14, 127, 8, 204, 0,
|
|
328 306, 8, 14, 115, 122, 132, 200, 116,
|
|
329 293, 122, 20, 228, 154, 228, 294, 239},
|
|
330
|
|
331 { 0, 0, 19, 14, 124, 10, 283, 12,
|
|
332 8, 105, 113, 89, 190, 82, 298, 108,
|
|
333 18, 181, 101, 204, 204, 203, 285, 218},
|
|
334
|
|
335 { 0, 0, 18, 17, 110, 16, 201, 15,
|
|
336 307, 15, 18, 148, 125, 166, 201, 123,
|
|
337 275, 120, 28, 235, 217, 222, 324, 216}}};
|
|
338
|
|
339
|
|
340 //----- (0042EB31) --------------------------------------------------------
|
|
341 bool SpellBuff::NotExpired()
|
|
342 {
|
|
343 return (signed __int64)this->uExpireTime > 0 ? true:false;
|
|
344 }
|
|
345
|
|
346
|
|
347 //----- (00458585) --------------------------------------------------------
|
|
348 void SpellBuff::Reset()
|
|
349 {
|
|
350 uSkill = 0;
|
|
351 uPower = 0;
|
|
352 uExpireTime = 0i64;
|
|
353 uCaster = 0;
|
|
354 uFlags = 0;
|
|
355 if (uOverlayID)
|
|
356 {
|
|
357 pOtherOverlayList->pOverlays[uOverlayID - 1].Reset();
|
|
358 pOtherOverlayList->bRedraw = true;
|
|
359 uOverlayID = 0;
|
|
360 }
|
|
361 }
|
|
362
|
|
363 //----- (004585CA) --------------------------------------------------------
|
|
364 bool SpellBuff::IsBuffExpiredToTime( __int64 time_end )
|
|
365 {
|
|
366 if (uExpireTime && (uExpireTime < time_end))
|
|
367 {
|
|
368 uExpireTime = 0;
|
|
369 uPower = 0;
|
|
370 uSkill = 0;
|
|
371 uOverlayID = 0;
|
|
372 return true;
|
|
373 }
|
|
374 return false;
|
|
375 }
|
|
376
|
|
377 //----- (004584E0) --------------------------------------------------------
|
|
378 bool SpellBuff::Apply( signed __int64 uExpireTime, unsigned __int16 uSkillLevel, unsigned __int16 uPower, int uOverlayID, unsigned __int8 caster )
|
|
379 {
|
|
380 if (this->uExpireTime && (uExpireTime < this->uExpireTime))
|
|
381 return false;
|
|
382
|
|
383 this->uSkill = uSkillLevel;
|
|
384 this->uPower = uPower;
|
|
385 this->uExpireTime = uExpireTime;
|
|
386 if (this->uOverlayID && this->uOverlayID != uOverlayID)
|
|
387 {
|
|
388 pOtherOverlayList->pOverlays[this->uOverlayID - 1].Reset();
|
|
389 pOtherOverlayList->bRedraw = true;
|
|
390 this->uOverlayID = 0;
|
|
391 }
|
|
392 this->uOverlayID = uOverlayID;
|
|
393 this->uCaster = caster;
|
|
394
|
|
395 return true;
|
|
396 }
|
|
397
|
|
398 //----- (0045384A) --------------------------------------------------------
|
|
399 void SpellStats::Initialize()
|
|
400 {
|
|
401 std::map<std::string, SPELL_SCHOOL, ci_less> spellSchoolMaps;
|
|
402 spellSchoolMaps["fire"] = SPELL_SCHOOL_FIRE;
|
|
403 spellSchoolMaps["air"] = SPELL_SCHOOL_AIR;
|
|
404 spellSchoolMaps["water"] = SPELL_SCHOOL_WATER;
|
|
405 spellSchoolMaps["earth"] = SPELL_SCHOOL_EARTH;
|
|
406 spellSchoolMaps["spirit"] = SPELL_SCHOOL_SPIRIT;
|
|
407 spellSchoolMaps["mind"] = SPELL_SCHOOL_MIND;
|
|
408 spellSchoolMaps["body"] = SPELL_SCHOOL_BODY;
|
|
409 spellSchoolMaps["light"] = SPELL_SCHOOL_LIGHT;
|
|
410 spellSchoolMaps["dark"] = SPELL_SCHOOL_DARK;
|
|
411 spellSchoolMaps["magic"] = SPELL_SCHOOL_MAGIC;
|
|
412
|
|
413 char* test_string;
|
|
414
|
|
415 free(pSpellsTXT_Raw);
|
|
416 pSpellsTXT_Raw = (char *)pEvents_LOD->LoadRaw("spells.txt", 0);
|
|
417
|
|
418 strtok(pSpellsTXT_Raw, "\r");
|
|
419 for(int i=1; i<100; ++i)
|
|
420 {
|
|
421 if (((i % 11) - 1 )==0)
|
|
422 strtok(NULL, "\r");
|
|
423 test_string=strtok(NULL, "\r")+1;
|
|
424 auto tokens = Tokenize(test_string, '\t');
|
|
425 pInfos[i].pName=RemoveQuotes(tokens[2]);
|
|
426 auto findResult = spellSchoolMaps.find(tokens[3]);
|
|
427 pInfos[i].uSchool = findResult == spellSchoolMaps.end() ? SPELL_SCHOOL_NONE : findResult->second;
|
|
428 pInfos[i].pShortName=RemoveQuotes(tokens[4]);
|
|
429 pInfos[i].pDescription=RemoveQuotes(tokens[5]);
|
|
430 pInfos[i].pBasicSkillDesc=RemoveQuotes(tokens[6]);
|
|
431 pInfos[i].pExpertSkillDesc=RemoveQuotes(tokens[7]);
|
|
432 pInfos[i].pMasterSkillDesc=RemoveQuotes(tokens[8]);
|
|
433 pInfos[i].pGrandmasterSkillDesc=RemoveQuotes(tokens[9]);
|
|
434 pSpellDatas[i].stats |= strchr(tokens[10], 'm') || strchr(tokens[10], 'M') ? 1 : 0;
|
|
435 pSpellDatas[i].stats |= strchr(tokens[10], 'e') || strchr(tokens[10], 'E') ? 2 : 0;
|
|
436 pSpellDatas[i].stats |= strchr(tokens[10], 'c') || strchr(tokens[10], 'C') ? 4 : 0;
|
|
437 pSpellDatas[i].stats |= strchr(tokens[10], 'x') || strchr(tokens[10], 'X') ? 8 : 0;
|
|
438 }
|
|
439 }
|
|
440 //----- (00448DF8) --------------------------------------------------------
|
|
441 void __fastcall EventCastSpell(int uSpellID, int uSkillLevel, int uSkill, int fromx, int fromy, int fromz, int tox, int toy, int toz)//sub_448DF8
|
|
442 {
|
|
443 int v9; // esi@1
|
|
444 signed __int64 v10; // st7@4
|
|
445 signed __int64 v11; // st6@4
|
|
446 signed __int64 v12; // st5@4
|
|
447 double v13; // st7@6
|
|
448 int v14; // ST44_4@7
|
|
449 uint skillMasteryPlusOne; // ebx@9
|
|
450 uint v16; // edx@15
|
|
451 int i; // esi@42
|
|
452 int j; // esi@60
|
|
453 unsigned __int64 v36; // qax@99
|
|
454 // SpellBuff *v37; // ecx@99
|
|
455 int v38; // esi@103
|
|
456 signed __int64 v39; // qax@105
|
|
457 int v42; // esi@111
|
|
458 int v43; // ebx@111
|
|
459 int v47; // [sp-4h] [bp-B8h]@35
|
|
460 int v49; // [sp+0h] [bp-B4h]@35
|
|
461 int v55; // [sp+28h] [bp-8Ch]@7
|
|
462 unsigned int yaw; // [sp+30h] [bp-84h]@7
|
|
463 int pitch; // [sp+34h] [bp-80h]@7
|
|
464 int v60; // [sp+ACh] [bp-8h]@1
|
|
465 int a6_4; // [sp+C8h] [bp+14h]@117
|
|
466 int a7c; // [sp+CCh] [bp+18h]@29
|
|
467 int a7d; // [sp+CCh] [bp+18h]@55
|
|
468 signed __int64 xSquared; // [sp+D0h] [bp+1Ch]@6
|
|
469 int a8b; // [sp+D0h] [bp+1Ch]@37
|
|
470 int a8c; // [sp+D0h] [bp+1Ch]@55
|
|
471 signed __int64 ySquared; // [sp+D4h] [bp+20h]@6
|
|
472
|
|
473 v9 = 0;
|
|
474 skillMasteryPlusOne = uSkillLevel + 1;
|
|
475 //spellnum_ = uSpellID;
|
|
476 v60 = 0;
|
|
477 if ( tox || toy || toz )
|
|
478 {
|
|
479 v10 = tox - fromx;
|
|
480 v11 = toy - fromy;
|
|
481 v12 = toz - fromz;
|
|
482 }
|
|
483 else
|
|
484 {
|
|
485 v10 = pParty->vPosition.x - fromx;
|
|
486 v11 = pParty->vPosition.y - fromy;
|
|
487 v12 = (pParty->vPosition.z + pParty->sEyelevel) - fromz;
|
|
488 }
|
|
489 v13 = sqrt(long double(v10 * v10 + v11 * v11 + v12 * v12));
|
|
490 if ( v13 <= 1.0 )
|
|
491 {
|
|
492 v55 = 1;
|
|
493 yaw = 0;
|
|
494 pitch = 0;
|
|
495 }
|
|
496 else
|
|
497 {
|
|
498 v55 = (int)v13;
|
|
499 ySquared = v11 * v11;
|
|
500 xSquared = v10 * v10;
|
|
501 v14 = (int)sqrt(long double(xSquared + ySquared));
|
|
502 yaw = stru_5C6E00->Atan2((int)v10, (int)v11);
|
|
503 pitch = stru_5C6E00->Atan2(v14, (int)v12);
|
|
504 }
|
|
505 Assert(skillMasteryPlusOne > 0 && skillMasteryPlusOne <= 4, "Invalid mastery level");
|
|
506
|
|
507 SpriteObject a1; // [sp+38h] [bp-7Ch]@12
|
|
508 //SpriteObject::SpriteObject(&a1);
|
|
509
|
|
510 switch ( uSpellID )
|
|
511 {
|
|
512 case SPELL_FIRE_FIRE_BOLT:
|
|
513 case SPELL_FIRE_FIREBALL:
|
|
514 case SPELL_AIR_LIGHNING_BOLT:
|
|
515 case SPELL_WATER_ICE_BOLT:
|
|
516 case SPELL_WATER_ACID_BURST:
|
|
517 case SPELL_WATER_ICE_BLAST:
|
|
518 case SPELL_EARTH_BLADES:
|
|
519 case SPELL_EARTH_ROCK_BLAST:
|
|
520 case SPELL_WATER_POISON_SPRAY:
|
|
521 case SPELL_AIR_SPARKS:
|
|
522 case SPELL_EARTH_DEATH_BLOSSOM:
|
2566
|
523 a1.uType = spell_sprite_mapping[uSpellID].uSpriteType;
|
|
524 a1.containing_item.Reset();
|
2499
|
525 a1.spell_id = uSpellID;
|
|
526 a1.spell_level = uSkill;
|
|
527 a1.spell_skill = skillMasteryPlusOne;
|
|
528 v16 = 0;
|
|
529 while (v16 < pObjectList->uNumObjects)
|
|
530 {
|
|
531 if ( a1.uType == pObjectList->pObjects[v16].uObjectID)
|
|
532 {
|
|
533 break;
|
|
534 }
|
|
535 v16++;
|
|
536 }
|
|
537 a1.uObjectDescID = v16;
|
|
538 a1.vPosition.x = fromx;
|
|
539 a1.vPosition.y = fromy;
|
|
540 a1.vPosition.z = fromz;
|
|
541 a1.uAttributes = 16;
|
|
542 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz);
|
|
543 a1.field_60_distance_related_prolly_lod = v55;
|
|
544 a1.uSpriteFrameID = 0;
|
|
545 a1.spell_caster_pid = 8000 | OBJECT_Item;
|
|
546 a1.uSoundID = 0;
|
|
547 break;
|
|
548 }
|
|
549
|
|
550 switch ( uSpellID )
|
|
551 {
|
|
552 case SPELL_FIRE_FIRE_BOLT:
|
|
553 case SPELL_FIRE_FIREBALL:
|
|
554 case SPELL_AIR_LIGHNING_BOLT:
|
|
555 case SPELL_WATER_ICE_BOLT:
|
|
556 case SPELL_WATER_ACID_BURST:
|
|
557 case SPELL_WATER_ICE_BLAST:
|
|
558 case SPELL_EARTH_BLADES:
|
|
559 case SPELL_EARTH_ROCK_BLAST:
|
|
560 //v20 = yaw;
|
|
561 a1.spell_target_pid = 0;
|
|
562 a1.uFacing = yaw;
|
|
563 a1.uSoundID = 0;
|
|
564 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed;
|
|
565 a1.Create(yaw, pitch, v49, 0);
|
|
566 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);
|
|
567 return;
|
|
568 case SPELL_WATER_POISON_SPRAY:
|
|
569 switch ( skillMasteryPlusOne )
|
|
570 {
|
|
571 case 1:
|
|
572 v60 = 1;
|
|
573 break;
|
|
574 case 2:
|
|
575 v60 = 3;
|
|
576 break;
|
|
577 case 3:
|
|
578 v60 = 5;
|
|
579 break;
|
|
580 case 4:
|
|
581 v60 = 7;
|
|
582 break;
|
|
583 }
|
|
584 a1.spell_target_pid = 0;
|
|
585 a1.uFacing = yaw;
|
|
586 if ( v60 == 1 )
|
|
587 {
|
|
588 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed;
|
|
589 a1.Create(yaw, pitch, v49, 0);
|
|
590 }
|
|
591 else
|
|
592 {
|
|
593 a7c = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
|
|
594 a8b = a7c / (v60 - 1);
|
|
595 for ( i = a7c / -2; i <= a7c / 2; i += a8b )
|
|
596 {
|
|
597 a1.uFacing = i + yaw;
|
|
598 a1.Create((signed __int16)(i + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0);
|
|
599 }
|
|
600 }
|
|
601 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);
|
|
602 return;
|
|
603 case SPELL_AIR_SPARKS:
|
|
604 switch ( skillMasteryPlusOne )
|
|
605 {
|
|
606 case 1:
|
|
607 v60 = 3;
|
|
608 break;
|
|
609 case 2:
|
|
610 v60 = 5;
|
|
611 break;
|
|
612 case 3:
|
|
613 v60 = 7;
|
|
614 break;
|
|
615 case 4:
|
|
616 v60 = 9;
|
|
617 break;
|
|
618 }
|
|
619 a7d = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
|
|
620 a8c = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v60 - 1);
|
|
621 a1.spell_target_pid = 4;
|
|
622 for ( j = a7d / -2; j <= a7d / 2; j += a8c )
|
|
623 {
|
|
624 a1.uFacing = j + yaw;
|
|
625 a1.Create((signed __int16)(j + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0);
|
|
626 }
|
|
627 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);
|
|
628 return;
|
|
629 case SPELL_EARTH_DEATH_BLOSSOM:
|
|
630 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
|
|
631 return;
|
|
632 a1.spell_target_pid = 4;
|
|
633 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed;
|
|
634 v47 = (signed int)stru_5C6E00->uIntegerHalfPi / 2;
|
|
635 a1.Create(yaw, v47, v49, 0);
|
|
636 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);
|
|
637 return;
|
|
638
|
|
639 case SPELL_FIRE_HASTE:
|
|
640 if ( skillMasteryPlusOne > 0 )
|
|
641 {
|
|
642 if ( skillMasteryPlusOne <= 2 )
|
|
643 v9 = 60 * (uSkill + 60);
|
|
644 else if ( skillMasteryPlusOne == 3 )
|
|
645 v9 = 180 * (uSkill + 20);
|
|
646 else if ( skillMasteryPlusOne == 4 )
|
|
647 v9 = 240 * (uSkill + 15);
|
|
648 }
|
|
649 for (uint i = 0; i < 4; ++i)
|
|
650 if (pParty->pPlayers[i].IsWeak())
|
|
651 return;
|
|
652 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 * 128) * 0.033333335), skillMasteryPlusOne, 0, 0, 0);
|
2541
|
653 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0);
|
|
654 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1);
|
|
655 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2);
|
|
656 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3);
|
2499
|
657 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);//çâóê àëòàðÿ
|
|
658 return;
|
|
659 case SPELL_AIR_SHIELD:
|
|
660 case SPELL_EARTH_STONESKIN:
|
|
661 case SPELL_SPIRIT_HEROISM:
|
|
662 switch ( skillMasteryPlusOne )
|
|
663 {
|
|
664 case 1:
|
|
665 case 2:
|
|
666 v9 = 300 * (uSkill + 12);
|
|
667 break;
|
|
668 case 3:
|
|
669 v9 = 900 * (uSkill + 4);
|
|
670 break;
|
|
671 case 4:
|
|
672 v9 = 3600 * (uSkill + 1);
|
|
673 break;
|
|
674 }
|
|
675 switch ( uSpellID )
|
|
676 {
|
|
677 case SPELL_AIR_SHIELD:
|
|
678 v60 = 0;
|
|
679 uSkill = 14;
|
|
680 break;
|
|
681 case SPELL_EARTH_STONESKIN:
|
|
682 v60 = uSkill + 5;
|
|
683 uSkill = 15;
|
|
684 break;
|
|
685 case SPELL_SPIRIT_HEROISM:
|
|
686 v60 = uSkill + 5;
|
|
687 uSkill = 9;
|
|
688 break;
|
|
689 }
|
2541
|
690 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0);
|
|
691 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1);
|
|
692 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2);
|
|
693 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3);
|
2499
|
694 v36 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 << 7) * 0.033333335);
|
|
695 pParty->pPartyBuffs[uSkill].Apply(v36, skillMasteryPlusOne, v60, 0, 0);
|
|
696 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);
|
|
697 return;
|
|
698 case SPELL_FIRE_IMMOLATION:
|
|
699 if (skillMasteryPlusOne == 4)
|
|
700 v38 = 600 * uSkill;
|
|
701 else
|
|
702 v38 = 60 * uSkill;
|
2541
|
703 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0);
|
|
704 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1);
|
|
705 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2);
|
|
706 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3);
|
2499
|
707 v39 = (signed __int64)((double)(v38 << 7) * 0.033333335);
|
|
708 v36 = pParty->uTimePlayed + v39;
|
|
709 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(v36, skillMasteryPlusOne, uSkill, 0, 0);
|
|
710 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);
|
|
711 return;
|
|
712 case SPELL_FIRE_PROTECTION_FROM_FIRE:
|
|
713 case SPELL_AIR_PROTECTION_FROM_AIR:
|
|
714 case SPELL_WATER_PROTECTION_FROM_WATER:
|
|
715 case SPELL_EARTH_PROTECTION_FROM_EARTH:
|
|
716 case SPELL_MIND_PROTECTION_FROM_MIND:
|
|
717 case SPELL_BODY_PROTECTION_FROM_BODY:
|
|
718 a6_4 = 3600 * uSkill;
|
|
719 switch (skillMasteryPlusOne)
|
|
720 {
|
|
721 case 1:
|
|
722 v60 = uSkill;
|
|
723 break;
|
|
724 case 2:
|
|
725 v60 = 2 * uSkill;
|
|
726 break;
|
|
727 case 3:
|
|
728 v60 = 3 * uSkill;
|
|
729 break;
|
|
730 case 4:
|
|
731 v60 = 4 * uSkill;
|
|
732 break;
|
|
733 }
|
|
734 switch ( uSpellID )
|
|
735 {
|
|
736 case SPELL_FIRE_PROTECTION_FROM_FIRE:
|
|
737 uSkill = PARTY_BUFF_RESIST_FIRE;
|
|
738 break;
|
|
739 case SPELL_AIR_PROTECTION_FROM_AIR:
|
|
740 uSkill = PARTY_BUFF_RESIST_AIR;
|
|
741 break;
|
|
742 case SPELL_WATER_PROTECTION_FROM_WATER:
|
|
743 uSkill = PARTY_BUFF_RESIST_WATER;
|
|
744 break;
|
|
745 case SPELL_EARTH_PROTECTION_FROM_EARTH:
|
|
746 uSkill = PARTY_BUFF_RESIST_EARTH;
|
|
747 break;
|
|
748 case SPELL_MIND_PROTECTION_FROM_MIND:
|
|
749 uSkill = PARTY_BUFF_RESIST_MIND;
|
|
750 break;
|
|
751 case SPELL_BODY_PROTECTION_FROM_BODY:
|
|
752 uSkill = PARTY_BUFF_RESIST_BODY;
|
|
753 break;
|
|
754 }
|
2541
|
755 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0);
|
|
756 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1);
|
|
757 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2);
|
|
758 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3);
|
2499
|
759 pParty->pPartyBuffs[uSkill].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)a6_4 * 4.2666669), skillMasteryPlusOne, v60, 0, 0);
|
|
760 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);
|
|
761 return;
|
|
762 case SPELL_LIGHT_DAY_OF_THE_GODS :
|
|
763 switch (skillMasteryPlusOne)
|
|
764 {
|
|
765 case 2:
|
|
766 v42 = 10800 * uSkill;
|
|
767 v43 = 3 * uSkill + 10;
|
|
768 break;
|
|
769 case 3:
|
|
770 v42 = 18000 * uSkill;
|
|
771 v43 = 5 * uSkill + 10;
|
|
772 break;
|
|
773 case 4:
|
|
774 v42 = 14400 * uSkill;
|
|
775 v43 = 4 * uSkill + 10;
|
|
776 break;
|
|
777 }
|
2541
|
778 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0);
|
|
779 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1);
|
|
780 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2);
|
|
781 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3);
|
2499
|
782 v39 = (signed __int64)((double)(v42 << 7) * 0.033333335);
|
|
783 v36 = pParty->uTimePlayed + v39;
|
|
784 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(v36, skillMasteryPlusOne, v43, 0, 0);
|
|
785 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);
|
|
786 return;
|
|
787 default:
|
|
788 return;
|
|
789 }
|
|
790 }
|
|
791 //----- (00427769) --------------------------------------------------------
|
|
792 bool sub_427769_isSpellQuickCastableOnShiftClick(unsigned int uSpellID)
|
|
793 {
|
|
794 return ( pSpellDatas[uSpellID].stats & 0xC ) != 0;
|
|
795 }
|
|
796 //----- (0043AFE3) --------------------------------------------------------
|
|
797 int _43AFE3_calc_spell_damage(int spellId, int spellLevel, signed int skillMastery, int currentHp)
|
|
798 {
|
|
799 int result; // eax@1
|
|
800 unsigned int v5; // [sp-4h] [bp-8h]@9
|
|
801
|
|
802 result = 0;
|
|
803 if ( spellId == SPELL_FIRE_FIRE_SPIKE )
|
|
804 {
|
|
805 switch (skillMastery)
|
|
806 {
|
|
807 case 1:
|
|
808 case 2:
|
|
809 v5 = 6;
|
|
810 case 3:
|
|
811 v5 = 8;
|
|
812 case 4:
|
|
813 v5 = 10;
|
|
814 default:
|
|
815 return 0;
|
|
816 }
|
|
817 result = GetDiceResult(spellLevel, v5);
|
|
818 }
|
|
819 else if ( spellId == SPELL_EARTH_MASS_DISTORTION )
|
|
820 result = currentHp * (pSpellDatas[SPELL_EARTH_MASS_DISTORTION].baseDamage + 2 * spellLevel) / 100;
|
|
821 else
|
|
822 result = pSpellDatas[spellId].baseDamage
|
|
823 + GetDiceResult(spellLevel, pSpellDatas[spellId].bonusSkillDamage);
|
|
824
|
|
825 return result;
|
|
826 } |