Spellforce-Spell-framework
Loading...
Searching...
No Matches
sf_spellend_handlers.cpp
Go to the documentation of this file.
2#include "../core/sf_hooks.h"
4
5// default case
6void __thiscall default_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
7{
8 spellAPI.removeDLLNode(_this, spell_index);
9 spellAPI.setEffectDone(_this, spell_index, 0);
10}
11
12// Stat changing handlers
13void __thiscall slowness_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
14{
15 SF_CGdResourceSpell spell_data;
16 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data, _this->active_spell_list[spell_index].spell_id);
17 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
18
19 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_data.spell_line_id))
20 {
21 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, WALK_SPEED, target_index, spell_data.params[0]);
22 }
23 // just don't wanna to repeat it every time
24 default_end_handler(_this, spell_index);
25}
26void __thiscall decay1_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
27{
28 SF_CGdResourceSpell spell_data;
29 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data, _this->active_spell_list[spell_index].spell_id);
30 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
31
32 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_data.spell_line_id))
33 {
34 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, ARMOR, target_index, spell_data.params[2]);
35 }
36 default_end_handler(_this, spell_index);
37}
38
39void __thiscall inflexibility_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
40{
41 SF_CGdResourceSpell spell_data;
42 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data, _this->active_spell_list[spell_index].spell_id);
43 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
44
45 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_data.spell_line_id))
46 {
47 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, AGILITY, target_index, spell_data.params[0]);
48 }
49 default_end_handler(_this, spell_index);
50}
51
52void __thiscall weaken_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
53{
54 SF_CGdResourceSpell spell_data;
55 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data, _this->active_spell_list[spell_index].spell_id);
56 uint16_t target_index =_this->active_spell_list[spell_index].target.entity_index;
57
58 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_data.spell_line_id))
59 {
60 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, STRENGTH, target_index, spell_data.params[0]);
61 }
62 default_end_handler(_this, spell_index);
63}
64
65void __thiscall quickness_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
66{
67 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
68 uint16_t spell_line = _this->active_spell_list[spell_index].spell_line;
69
70 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_line))
71 {
72 int8_t bonus = (int8_t)(-spellAPI.getXData(_this, spell_index, SPELL_STAT_MUL_MODIFIER));
73 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, WALK_SPEED, target_index, bonus);
74 }
75 default_end_handler(_this, spell_index);
76}
77
78void __thiscall flexibility_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
79{
80
81 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
82 uint16_t spell_line = _this->active_spell_list[spell_index].spell_line;
83
84 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_line))
85 {
86 int8_t bonus = (int8_t)(-spellAPI.getXData(_this, spell_index, SPELL_STAT_MUL_MODIFIER));
87 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, AGILITY, target_index, bonus);
88 }
89 default_end_handler(_this, spell_index);
90}
91
92void __thiscall strength_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
93{
94 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
95 uint16_t spell_line = _this->active_spell_list[spell_index].spell_line;
96 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_line))
97 {
98 int8_t bonus = (int8_t)(-spellAPI.getXData(_this, spell_index, SPELL_STAT_MUL_MODIFIER));
99 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, STRENGTH, target_index, bonus);
100 }
101 default_end_handler(_this, spell_index);
102}
103
104// same handler for both brilliance and retention
105void __thiscall brilliance_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
106{
107 SF_CGdResourceSpell spell_data;
108 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data, _this->active_spell_list[spell_index].spell_id);
109 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
110 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_data.spell_line_id))
111 {
112 uint16_t max_mana = figureAPI.getMaxStat(_this->SF_CGdFigure, target_index, MANA);
113 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, WISDOM, target_index, -spell_data.params[0]);
114 toolboxAPI.rescaleLevelStats(_this->SF_CGdFigureToolBox, target_index);
115 figureAPI.rescaleMana(_this->SF_CGdFigure, target_index, max_mana);
116 }
117 default_end_handler(_this, spell_index);
118}
119
121 uint16_t spell_index)
122{
123 SF_CGdResourceSpell spell_data;
124 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data, _this->active_spell_list[spell_index].spell_id);
125 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
126 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_data.spell_line_id))
127 {
128 uint16_t max_health = figureAPI.getMaxStat(_this->SF_CGdFigure, target_index, HEALTH);
129 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, STAMINA, target_index, spell_data.params[0]);
130 toolboxAPI.rescaleLevelStats(_this->SF_CGdFigureToolBox, target_index);
131 figureAPI.rescaleHealth(_this->SF_CGdFigure, target_index, max_health);
132 }
133 default_end_handler(_this, spell_index);
134}
135
136void __thiscall inablility_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
137{
138 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
139 SF_CGdResourceSpell spell_data;
140 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data, _this->active_spell_list[spell_index].spell_id);
141 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_data.spell_line_id))
142 {
143 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, DEXTERITY, target_index, spell_data.params[0]);
144 }
145 default_end_handler(_this, spell_index);
146}
147
148void __thiscall slow_fighting_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
149{
150 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
151 SF_CGdResourceSpell spell_data;
152 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data, _this->active_spell_list[spell_index].spell_id);
153 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_data.spell_line_id))
154 {
155 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, FIGHT_SPEED, target_index, spell_data.params[0]);
156 }
157 default_end_handler(_this, spell_index);
158}
159
160void __thiscall dexterity_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
161{
162 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
163 uint16_t spell_line = _this->active_spell_list[spell_index].spell_line;
164 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_line))
165 {
166 int8_t bonus = (int8_t)(-spellAPI.getXData(_this, spell_index, SPELL_STAT_MUL_MODIFIER));
167 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, DEXTERITY, target_index, bonus);
168 }
169 default_end_handler(_this, spell_index);
170}
171
172void __thiscall edurance_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
173{
174
175 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
176 uint16_t spell_line = _this->active_spell_list[spell_index].spell_line;
177 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_line))
178 {
179 uint16_t max_health = figureAPI.getMaxStat(_this->SF_CGdFigure, target_index, HEALTH);
180 int8_t bonus = (int8_t)(-spellAPI.getXData(_this, spell_index, SPELL_STAT_MUL_MODIFIER));
181
182 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, STAMINA, target_index, bonus);
183 toolboxAPI.rescaleLevelStats(_this->SF_CGdFigureToolBox, target_index);
184 figureAPI.rescaleHealth(_this->SF_CGdFigure, target_index, max_health);
185 }
186 default_end_handler(_this, spell_index);
187}
188
189void __thiscall fast_fighting_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
190{
191 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
192 uint16_t spell_line = _this->active_spell_list[spell_index].spell_line;
193 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_line))
194 {
195 int8_t bonus = spellAPI.getXData(_this, spell_index, SPELL_STAT_MUL_MODIFIER);
196 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, FIGHT_SPEED, target_index, bonus);
197 }
198 default_end_handler(_this, spell_index);
199}
200
201void __thiscall charisma_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
202{
203 SF_CGdResourceSpell spell_data;
204 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data, _this->active_spell_list[spell_index].spell_id);
205 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
206 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_data.spell_line_id))
207 {
208 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, CHARISMA, target_index, -spell_data.params[0]);
209 }
210 default_end_handler(_this, spell_index);
211}
212
213void __thiscall enlightenment_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
214{
215 SF_CGdResourceSpell spell_data;
216 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data, _this->active_spell_list[spell_index].spell_id);
217 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
218 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_data.spell_line_id))
219 {
220 uint16_t max_mana = figureAPI.getMaxStat(_this->SF_CGdFigure, target_index, MANA);
221
222 int8_t bonus = (int8_t)(-spellAPI.getXData(_this, spell_index, SPELL_STAT_MUL_MODIFIER));
223 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, INTELLIGENCE, target_index, bonus);
224 bonus = (int8_t)(-spellAPI.getXData(_this, spell_index, SPELL_STAT_MUL_MODIFIER2));
225 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, WISDOM, target_index, bonus);
226 toolboxAPI.rescaleLevelStats(_this->SF_CGdFigureToolBox, target_index);
227 figureAPI.rescaleMana(_this->SF_CGdFigure, target_index, max_mana);
228 }
229 default_end_handler(_this, spell_index);
230}
231void __thiscall melt_resistance_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
232{
233 SF_CGdResourceSpell spell_data;
234 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data, _this->active_spell_list[spell_index].spell_id);
235 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
236 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_data.spell_line_id))
237 {
238 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, RESISTANCE_ICE, target_index, spell_data.params[0]);
239 }
240 default_end_handler(_this, spell_index);
241}
242
243void __thiscall chill_resistance_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
244{
245 SF_CGdResourceSpell spell_data;
246 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data, _this->active_spell_list[spell_index].spell_id);
247 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
248 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_data.spell_line_id))
249 {
250 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, RESISTANCE_FIRE, target_index, spell_data.params[0]);
251 }
252 default_end_handler(_this, spell_index);
253}
254
255void __thiscall black_almightness_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
256{
257 SF_CGdResourceSpell spell_data;
258 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data, _this->active_spell_list[spell_index].spell_id);
259 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
260 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_data.spell_line_id))
261 {
262 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, FIGHT_SPEED, target_index, spell_data.params[3]);
263 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, AGILITY, target_index, spell_data.params[2]);
264 }
265 default_end_handler(_this, spell_index);
266}
267
269 uint16_t spell_index)
270{
271 SF_CGdResourceSpell spell_data;
272 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data, _this->active_spell_list[spell_index].spell_id);
273 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
274 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_data.spell_line_id))
275 {
276 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, FIGHT_SPEED, target_index, -spell_data.params[3]);
277 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, DEXTERITY, target_index, -spell_data.params[2]);
278 }
279 default_end_handler(_this, spell_index);
280}
281
282void __thiscall mutation_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
283{
284 SF_CGdResourceSpell spell_data;
285 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data,
286 _this->active_spell_list[spell_index].spell_id);
287 uint16_t target_index =
288 _this->active_spell_list[spell_index].target.entity_index;
289 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index,
290 spell_data.spell_line_id))
291 {
292 int8_t bonus = spellAPI.getXData(_this, spell_index,
294 uint16_t stat_value =
295 _this->SF_CGdFigure->figures[target_index].resistance_fire.base_val;
296 int8_t recalc_value = stat_value - ((bonus * stat_value) / 100);
297 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, RESISTANCE_FIRE,
298 target_index, recalc_value);
299
300 stat_value =
301 _this->SF_CGdFigure->figures[target_index].fight_speed.base_val;
302 recalc_value = stat_value - ((bonus * stat_value) / 100);
303 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, FIGHT_SPEED,
304 target_index, recalc_value);
305
306 stat_value =
307 _this->SF_CGdFigure->figures[target_index].intelligence.base_val;
308 recalc_value = stat_value - ((bonus * stat_value) / 100);
309 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, INTELLIGENCE,
310 target_index, recalc_value);
311
312 stat_value =
313 _this->SF_CGdFigure->figures[target_index].stamina.base_val;
314 recalc_value = stat_value - ((bonus * stat_value) / 100);
315 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, STAMINA,
316 target_index, recalc_value);
317
318 bonus = spellAPI.getXData(_this, spell_index, SPELL_STAT_MUL_MODIFIER2);
319 stat_value =
320 _this->SF_CGdFigure->figures[target_index].resistance_ice.base_val;
321 recalc_value = stat_value - ((bonus * stat_value) / 100);
322 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, RESISTANCE_ICE,
323 target_index, recalc_value);
324
325 stat_value =
326 _this->SF_CGdFigure->figures[target_index].cast_speed.base_val;
327 recalc_value = stat_value - ((bonus * stat_value) / 100);
328 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, CAST_SPEED,
329 target_index, recalc_value);
330
331 stat_value = _this->SF_CGdFigure->figures[target_index].wisdom.base_val;
332 recalc_value = stat_value - ((bonus * stat_value) / 100);
333 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, WISDOM,
334 target_index, recalc_value);
335
336 bonus = spellAPI.getXData(_this, spell_index, SPELL_STAT_MUL_MODIFIER3);
337 stat_value =
338 _this->SF_CGdFigure->figures[target_index].resistance_black.base_val;
339 recalc_value = stat_value - ((bonus * stat_value) / 100);
340 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, RESISTANCE_BLACK,
341 target_index, recalc_value);
342
343 stat_value =
344 _this->SF_CGdFigure->figures[target_index].walk_speed.base_val;
345 recalc_value = stat_value - ((bonus * stat_value) / 100);
346 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, WALK_SPEED,
347 target_index, recalc_value);
348
349 stat_value =
350 _this->SF_CGdFigure->figures[target_index].charisma.base_val;
351 recalc_value = stat_value - ((bonus * stat_value) / 100);
352 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, CHARISMA,
353 target_index, recalc_value);
354
355 stat_value =
356 _this->SF_CGdFigure->figures[target_index].dexterity.base_val;
357 recalc_value = stat_value - ((bonus * stat_value) / 100);
358 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, DEXTERITY,
359 target_index, recalc_value);
360
361 bonus = spellAPI.getXData(_this, spell_index, SPELL_STAT_MUL_MODIFIER4);
362 stat_value =
363 _this->SF_CGdFigure->figures[target_index].resistance_mental.
364 base_val;
365 recalc_value = stat_value - ((bonus * stat_value) / 100);
366 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure,
367 RESISTANCE_MENTAL, target_index,
368 recalc_value);
369
370 stat_value =
371 _this->SF_CGdFigure->figures[target_index].strength.base_val;
372 recalc_value = stat_value - ((bonus * stat_value) / 100);
373 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, STRENGTH,
374 target_index, recalc_value);
375
376 stat_value =
377 _this->SF_CGdFigure->figures[target_index].agility.base_val;
378 recalc_value = stat_value - ((bonus * stat_value) / 100);
379 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, AGILITY,
380 target_index, recalc_value);
381 }
382 default_end_handler(_this, spell_index);
383}
384
385void __thiscall eternity_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
386{
387 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
388 uint16_t spell_line = _this->active_spell_list[spell_index].spell_line;
389 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_line))
390 {
391 int8_t bonus = (int8_t)(-spellAPI.getXData(_this, spell_index, SPELL_STAT_MUL_MODIFIER));
392 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, DEXTERITY, target_index, bonus);
393 bonus = (int8_t)(-spellAPI.getXData(_this, spell_index, SPELL_STAT_MUL_MODIFIER2));
394 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, AGILITY, target_index, bonus);
395 bonus = (int8_t)(-spellAPI.getXData(_this, spell_index, SPELL_STAT_MUL_MODIFIER3));
396 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, FIGHT_SPEED, target_index, bonus);
397 bonus = (int8_t)(-spellAPI.getXData(_this, spell_index, SPELL_STAT_MUL_MODIFIER4));
398 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, WALK_SPEED, target_index, bonus);
399 }
400 default_end_handler(_this, spell_index);
401}
402
403// Muddykat Section:
404
405// FIRST BLOCK (has a goto, to FigureClearCheckSpellsBeforeCheckBattle; -> break;)
406void __thiscall common_handler_check_battle(SF_CGdSpell *_this, uint16_t spell_index)
407{
409 default_end_handler(_this, spell_index);
410}
411
412void __thiscall common_handler_unfreeze(SF_CGdSpell *_this, uint16_t spell_index)
413{
414 spellClearFigureFlag(_this, spell_index, UNFREEZE);
415 default_end_handler(_this, spell_index);
416}
417
418// Freeze, Petrify
419void __thiscall common_handler_check_unfreeze(SF_CGdSpell *_this, uint16_t spell_index)
420{
422 spellClearFigureFlag(_this, spell_index, UNFREEZE);
423 default_end_handler(_this, spell_index);
424}
425
426void __thiscall common_handler_check_unfreeze2(SF_CGdSpell *_this, uint16_t spell_index)
427{
428 spellClearFigureFlag(_this, spell_index, UNFREEZE);
430 default_end_handler(_this, spell_index);
431}
432
433// THIRD BLOCK FigureClearCheckSpellsBeforeCheckBattle -> Done -> Return;
434void __thiscall fog_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
435{
437 spellAPI.setEffectDone(_this, spell_index, 0);
438};
439
440// FOURTH BLOCK FigureTryClearCheckSpellsBeforeJob2 -> goto -> FigureClearCheckSpellsBeforeCheckBattle -> break;
441void __thiscall common_handler_job_battle_check(SF_CGdSpell *_this, uint16_t spell_index)
442{
445 default_end_handler(_this, spell_index);
446}
447
448void __thiscall common_handler_done(SF_CGdSpell *_this, uint16_t spell_index)
449{
450 spellAPI.setEffectDone(_this, spell_index, 1);
451}
452
453// Not 100% sure if this is neccessary, however the order of operations may be important
454void __thiscall common_handler_job_battle_check2(SF_CGdSpell *_this, uint16_t spell_index)
455{
458 default_end_handler(_this, spell_index);
459}
460
461void __thiscall clay_feet_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
462{
463 SF_CGdResourceSpell spell_data;
464 spellAPI.getResourceSpellData(_this->SF_CGdResource, &spell_data, _this->active_spell_list[spell_index].spell_id);
465 uint16_t target_index = _this->active_spell_list[spell_index].target.entity_index;
466 if (toolboxAPI.hasSpellOnIt(_this->SF_CGdFigureToolBox, target_index, spell_data.spell_line_id))
467 {
468 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, FIGHT_SPEED, target_index, spell_data.params[1]);
469 figureAPI.addBonusMultToStatistic(_this->SF_CGdFigure, CAST_SPEED, target_index, spell_data.params[1]);
470 }
473 spellAPI.setEffectDone(_this, spell_index, 0);
474}
475
476void __thiscall aura_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
477{
478 SF_CGdFigure *sf_figures = _this->SF_CGdFigure;
479 uint16_t source_index = _this->active_spell_list[spell_index].source.entity_index;
480 if ((sf_figures->figures[source_index].owner != (uint16_t)(-1)) &&
481 ((sf_figures->figures[source_index].flags & (IS_DEAD | RESESRVED_ONLY)) == 0))
482 {
483 sf_figures->figures[source_index].flags &= ~(GdFigureFlags::AURA_RUNNING);
484 }
485 uint16_t effect_index = spellAPI.getXData(_this, spell_index, EFFECT_EFFECT_INDEX);
486 if (effect_index != 0)
487 {
488 effectAPI.tryEndEffect(_this->SF_CGdEffect, effect_index);
489 }
490 default_end_handler(_this, spell_index);
491}
SpellFunctions * spellAPI
Definition TestMod.cpp:11
FigureFunctions * figureAPI
Definition TestMod.cpp:13
ToolboxFunctions * toolboxAPI
Definition TestMod.cpp:12
EffectFunctions effectAPI
Definition sf_hooks.c:45
void __thiscall spellClearFigureFlag(SF_CGdSpell *_this, uint16_t spell_id, SpellFlagKey key)
@ RESISTANCE_FIRE
@ RESISTANCE_MENTAL
@ RESISTANCE_BLACK
@ SPELL_STAT_MUL_MODIFIER2
@ SPELL_STAT_MUL_MODIFIER4
@ SPELL_STAT_MUL_MODIFIER3
@ SPELL_STAT_MUL_MODIFIER
@ EFFECT_EFFECT_INDEX
@ CHECK_SPELLS_BEFORE_JOB2
@ CHECK_SPELLS_BEFORE_CHECK_BATTLE
void __thiscall inablility_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall common_handler_done(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall aura_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall chill_resistance_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall melt_resistance_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall black_almightness_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall edurance_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall fast_fighting_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall eternity_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall dexterity_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall mutation_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall white_almightness_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall default_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall common_handler_check_battle(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall common_handler_check_unfreeze2(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall common_handler_job_battle_check2(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall common_handler_unfreeze(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall strength_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall weaken_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall enlightenment_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall fog_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall inflexibility_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall decay1_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall charisma_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall suffocation_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall brilliance_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall quickness_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall common_handler_check_unfreeze(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall slow_fighting_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall slowness_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall clay_feet_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall flexibility_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall common_handler_job_battle_check(SF_CGdSpell *_this, uint16_t spell_index)
FigureStatisticExt stamina
FigureStatistic strength
FigureStatistic dexterity
FigureStatistic resistance_mental
FigureStatistic charisma
FigureStatistic resistance_fire
FigureStatistic cast_speed
FigureStatistic wisdom
FigureStatistic fight_speed
FigureStatistic resistance_ice
FigureStatistic agility
FigureStatistic resistance_black
FigureStatistic walk_speed
FigureStatistic intelligence
A structure for the global list of figures and related statistics for them.
GdFigure figures[2000]
SF_CGdFigure * SF_CGdFigure
SF_CGdFigureToolbox * SF_CGdFigureToolBox
SF_GdSpell active_spell_list[800]
SF_CGdEffect * SF_CGdEffect
SF_CGdTargetData source
SF_CGdTargetData target