15 #include "../OurMath.h"
25 {{{Vec3_int_(-5121, 2107, 1), 1536, 0, 21, 0},
26 {Vec3_int_(-15148, -10240, 1473), 0, 0, 4, 0},
27 {Vec3_int_(-10519, 5375, 753), 512, 0, 3, 0},
28 {Vec3_int_(3114, -11055, 513), 0, 0, 10, 0},
29 {Vec3_int_(-158, 7624, 1), 512, 0, 7, 0},
30 {Vec3_int_(-1837, -4247, 65), 65, 0, 8, 0}}};
34 std::array<stru324_spell_id_to_sprite_mapping, 103>
150 __int16 inMasterLevelMana, __int16 inMagisterLevelMana,
151 __int16 inNormalLevelRecovery,
152 __int16 inExpertLevelRecovery,
153 __int16 inMasterLevelRecovery,
154 __int16 inMagisterLevelRecovery, __int8 inbaseDamage,
155 __int8 inbonusSkillDamage, __int16 instats)
156 : uNormalLevelMana(innormalMana),
157 uExpertLevelMana(inExpertLevelMana),
158 uMasterLevelMana(inMasterLevelMana),
159 uMagisterLevelMana(inMagisterLevelMana),
160 uNormalLevelRecovery(inNormalLevelRecovery),
161 uExpertLevelRecovery(inExpertLevelRecovery),
162 uMasterLevelRecovery(inMasterLevelRecovery),
163 uMagisterLevelRecovery(inMagisterLevelRecovery),
164 baseDamage(inbaseDamage),
165 bonusSkillDamage(inbonusSkillDamage),
171 {
SpellData(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
172 SpellData(1, 1, 1, 1, 60, 60, 60, 40, 0, 0, 0),
173 SpellData(2, 2, 2, 2, 110, 110, 100, 90, 3, 3, 0),
174 SpellData(3, 3, 3, 3, 120, 120, 120, 120, 0, 0, 0),
175 SpellData(4, 4, 4, 4, 120, 120, 120, 120, 0, 0, 0),
176 SpellData(5, 5, 5, 5, 120, 120, 120, 120, 0, 0, 0),
177 SpellData(8, 8, 8, 8, 100, 100, 90, 80, 0, 6, 0),
178 SpellData(10, 10, 10, 10, 150, 150, 150, 150, 0, 6, 0),
179 SpellData(15, 15, 15, 15, 120, 120, 120, 120, 0, 6, 0),
180 SpellData(20, 20, 20, 20, 100, 100, 100, 90, 8, 1, 0),
181 SpellData(25, 25, 25, 25, 100, 100, 100, 90, 12, 1, 0),
182 SpellData(30, 30, 30, 30, 90, 90, 90, 90, 15, 15, 0),
184 SpellData(1, 1, 1, 0, 60, 60, 60, 60, 0, 0, 0),
185 SpellData(2, 2, 2, 2, 120, 120, 120, 100, 0, 0, 0),
186 SpellData(3, 3, 3, 3, 120, 120, 120, 120, 0, 0, 0),
187 SpellData(4, 4, 4, 4, 110, 100, 90, 80, 2, 1, 0),
188 SpellData(5, 5, 5, 5, 90, 90, 70, 50, 0, 0, 0),
189 SpellData(8, 8, 8, 8, 120, 120, 120, 120, 0, 0, 0),
190 SpellData(10, 10, 10, 10, 100, 100, 90, 70, 0, 8, 0),
191 SpellData(15, 15, 15, 15, 200, 200, 200, 200, 0, 0, 0),
192 SpellData(20, 20, 20, 20, 100, 100, 100, 90, 10, 10, 0),
193 SpellData(25, 25, 25, 25, 250, 250, 250, 250, 0, 0, 0),
194 SpellData(30, 30, 30, 30, 90, 90, 90, 90, 20, 1, 0),
196 SpellData(1, 1, 1, 1, 60, 60, 60, 20, 0, 0, 0),
197 SpellData(2, 2, 2, 2, 110, 100, 90, 70, 2, 2, 0),
198 SpellData(3, 3, 3, 3, 120, 120, 120, 120, 0, 0, 0),
199 SpellData(4, 4, 4, 4, 110, 100, 90, 80, 0, 4, 0),
200 SpellData(5, 5, 5, 5, 150, 150, 150, 150, 0, 0, 0),
201 SpellData(8, 8, 8, 8, 200, 200, 200, 200, 0, 0, 0),
202 SpellData(10, 10, 10, 10, 100, 100, 90, 80, 9, 9, 0),
203 SpellData(15, 15, 15, 15, 140, 140, 140, 140, 0, 0, 0),
204 SpellData(20, 20, 20, 20, 200, 200, 200, 200, 0, 0, 0),
205 SpellData(25, 25, 25, 25, 80, 80, 80, 80, 12, 3, 0),
206 SpellData(30, 30, 30, 30, 250, 250, 250, 250, 0, 0, 0),
208 SpellData(1, 1, 1, 1, 80, 80, 80, 80, 0, 0, 0),
209 SpellData(2, 2, 2, 2, 100, 100, 100, 100, 0, 0, 0),
210 SpellData(3, 3, 3, 3, 120, 120, 120, 120, 0, 0, 0),
211 SpellData(4, 4, 4, 4, 110, 100, 90, 80, 5, 3, 0),
212 SpellData(5, 5, 5, 5, 120, 120, 120, 120, 0, 0, 0),
213 SpellData(8, 8, 8, 8, 100, 100, 90, 80, 0, 9, 0),
214 SpellData(10, 10, 10, 10, 140, 140, 140, 140, 0, 0, 0),
215 SpellData(15, 15, 15, 15, 90, 90, 90, 80, 0, 8, 0),
216 SpellData(20, 20, 20, 20, 150, 150, 150, 150, 0, 0, 0),
217 SpellData(25, 25, 25, 25, 100, 100, 100, 90, 20, 1, 0),
218 SpellData(30, 30, 30, 30, 90, 90, 90, 90, 25, 0, 0),
220 SpellData(1, 1, 1, 1, 100, 100, 100, 100, 0, 0, 0),
221 SpellData(2, 2, 2, 2, 100, 100, 100, 100, 0, 0, 0),
222 SpellData(3, 3, 3, 3, 90, 90, 90, 90, 0, 0, 0),
223 SpellData(4, 4, 4, 4, 120, 120, 120, 120, 0, 0, 0),
224 SpellData(5, 5, 5, 5, 120, 120, 120, 120, 0, 0, 0),
225 SpellData(8, 8, 8, 8, 120, 120, 120, 120, 0, 0, 0),
226 SpellData(10, 10, 10, 10, 120, 120, 120, 120, 0, 0, 0),
227 SpellData(15, 15, 15, 15, 100, 100, 100, 100, 10, 8, 0),
228 SpellData(20, 20, 20, 20, 240, 240, 240, 240, 0, 0, 0),
229 SpellData(25, 25, 25, 25, 150, 150, 150, 150, 0, 0, 0),
230 SpellData(30, 30, 30, 30, 1000, 1000, 1000, 1000, 0, 0, 0),
232 SpellData(1, 1, 1, 1, 120, 120, 120, 120, 0, 0, 0),
233 SpellData(2, 2, 2, 2, 110, 110, 110, 110, 3, 3, 0),
234 SpellData(3, 3, 3, 3, 120, 120, 120, 120, 0, 0, 0),
235 SpellData(4, 4, 4, 4, 110, 100, 90, 80, 0, 0, 0),
236 SpellData(5, 5, 5, 5, 100, 100, 100, 100, 0, 0, 0),
237 SpellData(8, 8, 8, 8, 120, 120, 120, 120, 0, 0, 0),
238 SpellData(10, 10, 10, 10, 120, 120, 120, 120, 0, 0, 0),
239 SpellData(15, 15, 15, 15, 80, 80, 80, 80, 0, 0, 0),
240 SpellData(20, 20, 20, 20, 120, 120, 120, 120, 0, 0, 0),
241 SpellData(25, 25, 25, 25, 110, 110, 110, 100, 12, 12, 0),
242 SpellData(30, 30, 30, 30, 120, 120, 120, 120, 0, 0, 0),
244 SpellData(1, 1, 1, 1, 120, 120, 120, 120, 0, 0, 0),
245 SpellData(2, 2, 2, 2, 100, 100, 100, 100, 0, 0, 0),
246 SpellData(3, 3, 3, 3, 120, 120, 120, 120, 0, 0, 0),
247 SpellData(4, 4, 4, 4, 110, 100, 90, 80, 8, 2, 0),
248 SpellData(5, 5, 5, 5, 110, 110, 110, 110, 0, 0, 0),
249 SpellData(8, 8, 8, 8, 120, 120, 120, 120, 0, 0, 0),
250 SpellData(10, 10, 10, 10, 120, 120, 120, 120, 0, 0, 0),
251 SpellData(15, 15, 15, 15, 120, 120, 120, 120, 0, 0, 0),
252 SpellData(20, 20, 20, 20, 120, 120, 120, 120, 0, 0, 0),
253 SpellData(25, 25, 25, 25, 110, 110, 110, 100, 30, 5, 0),
254 SpellData(30, 30, 30, 30, 100, 100, 100, 100, 0, 0, 0),
256 SpellData(5, 5, 5, 5, 110, 100, 90, 80, 0, 4, 0),
257 SpellData(10, 10, 10, 10, 120, 110, 100, 90, 16, 16, 0),
258 SpellData(15, 15, 15, 15, 120, 110, 100, 90, 0, 0, 0),
259 SpellData(20, 20, 20, 20, 160, 140, 120, 100, 0, 0, 0),
260 SpellData(25, 25, 25, 25, 140, 140, 140, 140, 0, 0, 0),
261 SpellData(30, 30, 30, 30, 500, 500, 500, 500, 0, 0, 0),
262 SpellData(35, 35, 35, 35, 135, 135, 120, 100, 25, 1, 0),
263 SpellData(40, 40, 40, 40, 500, 500, 500, 500, 0, 0, 0),
264 SpellData(45, 45, 45, 45, 250, 250, 250, 250, 0, 0, 0),
265 SpellData(50, 50, 50, 50, 150, 150, 150, 135, 20, 20, 0),
266 SpellData(55, 55, 55, 55, 300, 300, 300, 300, 0, 0, 0),
268 SpellData(10, 10, 10, 10, 140, 140, 140, 140, 0, 0, 0),
269 SpellData(15, 15, 15, 15, 120, 110, 100, 90, 25, 10, 0),
270 SpellData(20, 20, 20, 20, 120, 100, 90, 120, 0, 0, 0),
271 SpellData(25, 25, 25, 25, 120, 120, 120, 120, 0, 0, 0),
272 SpellData(30, 30, 30, 30, 90, 90, 80, 70, 6, 6, 0),
273 SpellData(35, 35, 35, 35, 120, 120, 100, 80, 0, 0, 0),
274 SpellData(40, 40, 40, 40, 110, 110, 110, 110, 0, 0, 0),
275 SpellData(45, 45, 45, 45, 200, 200, 200, 150, 0, 0, 0),
276 SpellData(50, 50, 50, 50, 120, 120, 120, 100, 0, 25, 0),
277 SpellData(55, 55, 55, 55, 250, 250, 250, 250, 50, 1, 0),
278 SpellData(60, 60, 60, 60, 300, 300, 300, 300, 25, 8, 0)}};
307 std::array<std::array<struct SpellBookIconPos, 12>, 9>
pIconPos = {{
308 {{{0, 0}, {17, 13}, {115, 2}, {217, 15}, {299, 6}, {28, 125},
309 {130, 133}, {294, 114}, {11, 232}, {134, 233}, {237, 171}, {296, 231}}},
311 {{{0, 0}, {19, 9}, {117, 3}, {206, 13}, {285, 7}, {16, 123},
312 {113, 101}, {201, 118}, {317, 110}, {11, 230}, {149, 236}, {296, 234}}},
314 {{{0, 0}, {17, 9}, {140, 0}, {210, 34}, {293, 5}, {15, 98},
315 {78, 121}, {175, 136}, {301, 115}, {15, 226}, {154, 225}, {272, 220}}},
317 {{{0, 0}, {7, 9}, {156, 2}, {277, 9}, {11, 117}, {111, 82},
318 {180, 102}, {303, 108}, {10, 229}, {120, 221}, {201, 217}, {296, 225}}},
320 {{{0, 0}, {18, 8}, {89, 15}, {192, 14}, {292, 7}, {22, 129},
321 {125, 146}, {217, 136}, {305, 115}, {22, 226}, {174, 237}, {290, 231}}},
323 {{{0, 0}, {18, 12}, {148, 9}, {292, 7}, {17, 122}, {121, 99},
324 {220, 87}, {293, 112}, {13, 236}, {128, 213}, {220, 223}, {315, 223}}},
326 {{{0, 0}, {23, 14}, {127, 8}, {204, 0}, {306, 8}, {14, 115},
327 {122, 132}, {200, 116}, {293, 122}, {20, 228}, {154, 228}, {294, 239}}},
329 {{{0, 0}, {19, 14}, {124, 10}, {283, 12}, {8, 105}, {113, 89},
330 {190, 82}, {298, 108}, {18, 181}, {101, 204}, {204, 203}, {285, 218}}},
332 {{{0, 0}, {18, 17}, {110, 16}, {201, 15}, {307, 15}, {18, 148},
333 {125, 166}, {201, 123}, {275, 120}, {28, 235}, {217, 222}, {324, 216}}}
364 unsigned __int16 uPower,
int uOverlayID,
365 unsigned __int8 caster) {
366 if (this->expire_time && (expire_time < this->
expire_time)) {
370 this->
uSkill = uSkillLevel;
373 if (this->uOverlayID && this->uOverlayID !=
uOverlayID) {
376 this->uOverlayID = 0;
386 std::map<String, SPELL_SCHOOL, ci_less> spellSchoolMaps;
404 for (
int i = 1; i < 100; ++i) {
405 if (((i % 11) - 1) == 0) strtok(NULL,
"\r");
406 test_string = strtok(NULL,
"\r") + 1;
408 extern std::vector<char *>
Tokenize(
char *
input,
const char separator);
409 auto tokens =
Tokenize(test_string,
'\t');
412 auto findResult = spellSchoolMaps.find(tokens[3]);
415 : findResult->second;
422 pSpellDatas[i].stats |= strchr(tokens[10],
'm') || strchr(tokens[10],
'M') ? 1 : 0;
423 pSpellDatas[i].stats |= strchr(tokens[10],
'e') || strchr(tokens[10],
'E') ? 2 : 0;
424 pSpellDatas[i].stats |= strchr(tokens[10],
'c') || strchr(tokens[10],
'C') ? 4 : 0;
425 pSpellDatas[i].stats |= strchr(tokens[10],
'x') || strchr(tokens[10],
'X') ? 8 : 0;
430 int fromy,
int fromz,
int tox,
int toy,
int toz) {
431 unsigned int skillMasteryPlusOne = uSkillLevel + 1;
432 Assert(skillMasteryPlusOne > 0 && skillMasteryPlusOne <= 4,
433 "Invalid mastery level");
438 if (tox || toy || toz) {
439 x_coord_delta = tox - fromx;
440 y_coord_delta = toy - fromy;
441 z_coord_delta = toz - fromz;
450 double distance_to_target = sqrt((
long double)(
451 x_coord_delta * x_coord_delta + y_coord_delta * y_coord_delta +
452 z_coord_delta * z_coord_delta));
453 if (distance_to_target <= 1.0) {
454 distance_to_target = 1;
456 int64_t ySquared = y_coord_delta * y_coord_delta;
457 int64_t xSquared = x_coord_delta * x_coord_delta;
458 int xy_distance = (int)sqrt((
long double)(xSquared + ySquared));
495 int spell_length = 0;
500 int spell_num_objects = 0;
502 int spell_spray_angles;
522 spriteid = spell_sprites.
Create(yaw, pitch, launch_speed, 0);
528 spell_num_objects = (skillMasteryPlusOne * 2) - 1;
531 if (spell_num_objects == 1) {
536 spriteid = spell_sprites.
Create(yaw, pitch, launch_speed, 0);
540 spell_spray_angles = spell_spray_arc / (spell_num_objects - 1);
541 for (
int i = spell_spray_arc / -2; i <= spell_spray_arc / 2;
542 i += spell_spray_angles) {
543 spell_sprites.
uFacing = i + yaw;
544 spriteid = spell_sprites.
Create(
556 spell_num_objects = (skillMasteryPlusOne * 2) + 1;
559 spell_spray_angles = spell_spray_arc / (spell_num_objects - 1);
561 for (
int i = spell_spray_arc / -2; i <= spell_spray_arc / 2;
562 i += spell_spray_angles) {
563 spell_sprites.
uFacing = i + yaw;
564 spriteid = spell_sprites.
Create(
579 spriteid = spell_sprites.
Create(yaw, launch_angle, launch_speed, 0);
586 if (skillMasteryPlusOne > 0) {
587 if (skillMasteryPlusOne <= 2)
588 spell_length = 60 * (uSkill + 60);
589 else if (skillMasteryPlusOne == 3)
590 spell_length = 180 * (uSkill + 20);
591 else if (skillMasteryPlusOne == 4)
592 spell_length = 240 * (uSkill + 15);
594 for (
uint i = 0; i < 4; ++i)
598 skillMasteryPlusOne, 0, 0, 0);
610 switch (skillMasteryPlusOne) {
613 spell_length = 300 * (uSkill + 12);
616 spell_length = 900 * (uSkill + 4);
619 spell_length = 3600 * (uSkill + 1);
624 spell_num_objects = 0;
628 spell_num_objects = uSkill + 5;
632 spell_num_objects = uSkill + 5;
644 spell_num_objects, 0, 0);
650 if (skillMasteryPlusOne == 4)
651 spell_length = 600 * uSkill;
653 spell_length = 60 * uSkill;
662 spell_expire_time, skillMasteryPlusOne, uSkill, 0, 0);
673 spell_length = 3600 * uSkill;
674 spell_num_objects = uSkill * skillMasteryPlusOne;
702 skillMasteryPlusOne, spell_num_objects, 0, 0);
708 switch (skillMasteryPlusOne) {
710 spell_length = 10800 * uSkill;
711 spell_power = 3 * uSkill + 10;
714 spell_length = 18000 * uSkill;
715 spell_power = 5 * uSkill + 10;
718 spell_length = 14400 * uSkill;
719 spell_power = 4 * uSkill + 10;
730 spell_expire_time, skillMasteryPlusOne, spell_power, 0, 0);
746 signed int skillMastery,
int currentHp) {
752 switch (skillMastery) {