Spellforce-Spell-framework
Loading...
Searching...
No Matches
sf_ai_spell_handlers.cpp
Go to the documentation of this file.
3
4#include <stdio.h>
5
7 uint16_t target_index,
8 uint16_t spell_line,
9 SF_CGdResourceSpell *spell_data)
10{
11 uint32_t rank = 1;
12 if (!toolboxAPI.hasSpellOnIt((_this->battleData).CGdFigureToolBox,
13 target_index, kGdSpellLinePoison))
14 {
15 rank = 0;
16 }
17 return rank;
18}
19
20// Ice, Fire, Thorn shield, Conservation, Dexterity
22 uint16_t target_index,
23 uint16_t spell_line,
24 SF_CGdResourceSpell *spell_data)
25{
26 uint32_t rank = 1;
27 if (_this->battleData.enemy_figures.entityCount == 0)
28 {
29 rank = 0;
30 }
31 else
32 {
34 target_index))
35 {
36 rank = rank << 2;
37 }
38 else
39 {
40 rank = rank << 1;
41 }
42
44 target_index) <
46 target_index))
47 {
48 rank = rank << 1;
49 }
50 }
51 return rank;
52}
53
55 uint16_t target_index,
56 uint16_t spell_line,
57 SF_CGdResourceSpell *spell_data)
58{
59 uint32_t rank = 1;
60 if (!toolboxAPI.hasSpellOnIt((_this->battleData).CGdFigureToolBox,
61 target_index, kGdSpellLinePestilence))
62 {
63 rank = 0;
64 }
65 return rank;
66}
67
69 uint16_t target_index,
70 uint16_t spell_line,
71 SF_CGdResourceSpell *spell_data)
72{
73 uint32_t rank = 1;
75 target_index) < 50)
76 {
77 rank = rank * 10;
78 }
79 else
80 {
81 rank = 0;
82 }
83
84 return rank;
85}
86
87// weakness, suffocation, lifetap
88// slow fighting, inflexibility, slow walking
89// inability, hypnotization, manatap
91 uint16_t target_index,
92 uint16_t spell_line,
93 SF_CGdResourceSpell *spell_data)
94{
95 uint32_t rank = 1;
96 if (_this->battleData.current_figure == target_index)
97 {
98 if (_this->battleData.enemy_figures.entityCount == 0)
99 {
100 rank = 0;
101 }
102 else
103 {
104 uint16_t manacost = (spell_data->mana_cost * 3) / 2;
106 target_index) < manacost)
107 {
108 rank = 0;
109 }
110 }
111 }
112 else
113 {
114 rank = 0;
115 }
116 return rank;
117}
118
119// kGdSpellLineAuraStrength
120// kGdSpellLineAuraEndurance
121// kGdSpellLineAuraFastFighting
122// kGdSpellLineAuraFlexibility
123// kGdSpellLineAuraFastWalking
124// kGdSpellLineAuraDexterity
125// kGdSpellLineAuraBrilliance
127 uint16_t target_index,
128 uint16_t spell_line,
129 SF_CGdResourceSpell *spell_data)
130{
131 uint32_t rank = 1;
132 if (_this->battleData.current_figure == target_index)
133 {
134 if ((_this->battleData.enemy_figures.entityCount == 0) ||
135 (_this->battleData.ally_figures.entityCount == 0))
136 {
137 rank = 0;
138 }
139 else
140 {
141 uint16_t manacost = (spell_data->mana_cost * 3) / 2;
143 target_index) < manacost)
144 {
145 rank = 0;
146 }
147 }
148 }
149 else
150 {
151 rank = 0;
152 }
153 return rank;
154}
155
156// Regeneration and Healing
158 uint16_t target_index,
159 uint16_t spell_line,
160 SF_CGdResourceSpell *spell_data)
161{
162 uint32_t rank = 1;
163 if (_this->battleData.current_figure == target_index)
164 {
165 if ((_this->battleData.enemy_figures.entityCount == 0) ||
166 (_this->battleData.ally_figures.entityCount == 0))
167 {
168 rank = 0;
169 }
170 else
171 {
172 if (_this->battleData.figures_missing_hp == 0)
173 {
174 rank = 0;
175 }
176 else
177 {
178 uint16_t manacost = (spell_data->mana_cost * 3) / 2;
180 target_index) < manacost)
181 {
182 rank = 0;
183 }
184 }
185 }
186 }
187 else
188 {
189 rank = 0;
190 }
191 return rank;
192}
193
195 uint16_t target_index,
196 uint16_t spell_line,
197 SF_CGdResourceSpell *spell_data)
198{
199 uint32_t rank = 1;
200 if (_this->battleData.current_figure == target_index)
201 {
202 if (_this->battleData.enemy_figures.entityCount == 0)
203 {
204 rank = 0;
205 }
206 else
207 {
208 rank = 0;
209 // Vanilla Bug Fix
210 for (uint16_t i =
212 i++)
213 {
214 uint16_t enemy_index =
216 if (_this->battleData.CGdFigure->figures[enemy_index].flags &
217 UNDEAD)
218 {
219 rank = 1;
220 break;
221 }
222 }
223 if (rank)
224 {
225 uint16_t manacost = (spell_data->mana_cost * 3) / 2;
227 target_index) < manacost)
228 {
229 rank = 0;
230 }
231 }
232 }
233 }
234 else
235 {
236 rank = 0;
237 }
238 return rank;
239}
240
241// kGdSpellLineAbilityWarCry
242// kGdSpellLineAbilityPatronize
243// kGdSpellLineAbilityEndurance
245 uint16_t target_index,
246 uint16_t spell_line,
247 SF_CGdResourceSpell *spell_data)
248{
249 uint32_t rank = 1;
250 if ((_this->battleData.current_figure != target_index) ||
251 (_this->battleData.ally_figures.entityCount < 4) ||
253 {
254 rank = 0;
255 }
256 else
257 {
258 uint8_t figure_count = 0;
259 for (uint16_t i = 0; i < _this->battleData.ally_figures.entityCount;
260 i++)
261 {
262 uint16_t ally_index =
264 if ((figureAPI.isAlive(_this->battleData.CGdFigure, ally_index)) &&
266 ally_index)) &&
268 ally_index, spell_line)))
269 {
270 figure_count++;
271 }
272 if (figure_count > 3)
273 {
274 break;
275 }
276 }
277 if (figure_count < 3)
278 {
279 rank = 0;
280 }
281 }
282 return rank;
283}
284
285// kGdSpellLineAbilityShelter
286// kGdSpellLineAbilityTrueShot
287// kGdSpellLineAbilitySteelSkin
288// kGdSpellLineAbilitySalvo
290 uint16_t target_index,
291 uint16_t spell_line,
292 SF_CGdResourceSpell *spell_data)
293{
294 uint32_t rank = 1;
295 if ((_this->battleData.current_figure != target_index) ||
297 {
298 rank = 0;
299 }
300 return rank;
301}
302
303// kGdSpellLineAbilityDurability
304// kGdSpellLineAbilityRiposte
306 uint16_t target_index,
307 uint16_t spell_line,
308 SF_CGdResourceSpell *spell_data)
309{
310 uint32_t rank = 1;
311 if ((_this->battleData.current_figure != target_index) ||
313 {
314 rank = 0;
315 }
316 else
317 {
319 target_index) > 80)
320 {
321 rank = 0;
322 }
323 }
324 return rank;
325}
326
327// kGdSpellLineSummonGoblin
328// kGdSpellLineSummonSkeleton
329// kGdSpellLineSummonDemon
330// kGdSpellLineSummonChanneler
331// kGdSpellLineSummonSpectre
332// kGdSpellLineSummonWolf
333// kGdSpellLineSummonBear
334// kGdSpellLineFireElemental
335// kGdSpellLineIceElemental
336// kGdSpellLineEarthElemental
337// kGdSpellLineSummonTreeWraith
338// kGdSpellLineSummonBlade
339// kGdSpellLineSummonFireGolem
340// kGdSpellLineSummonIceGolem
341// kGdSpellLineSummonEarthGolem
342// kGdSpellLineMirrorImage
344 uint16_t target_index,
345 uint16_t spell_line,
346 SF_CGdResourceSpell *spell_data)
347{
348 uint32_t rank = 1;
349 if ((_this->battleData.current_figure != target_index) ||
351 {
352 rank = 0;
353 }
354 else
355 {
356 uint16_t manacost = (spell_data->mana_cost * 3) / 2;
358 target_index) < manacost)
359 {
360 rank = 0;
361 }
362 }
363 return rank;
364}
365
366// kGdSpellLineDistract
367// kGdSpellLineShockwave
368// kGdSpellLineWaveOfFire
369// kGdSpellLineWaveOfIce
370// kGdSpellLineWaveOfRocks
371uint32_t __thiscall wave_ai_handler(SF_CGdBattleDevelopment *_this,
372 uint16_t target_index, uint16_t spell_line,
373 SF_CGdResourceSpell *spell_data)
374{
375 uint32_t rank = 1;
376 if ((_this->battleData.current_figure != target_index) ||
378 {
379 rank = 0;
380 }
381 else
382 {
383 uint8_t figure_count = 0;
384 for (uint16_t i = 0; i < _this->battleData.enemy_figures.entityCount;
385 i++)
386 {
387 uint16_t enemy_index =
389 if (figureAPI.isAlive(_this->battleData.CGdFigure, enemy_index))
390 {
391 SF_Coord enemy_pos =
392 _this->battleData.CGdFigure->figures[enemy_index].position;
393 SF_Coord caster_pos = _this->battleData.current_figure_pos;
394 if (getDistance(&enemy_pos, &caster_pos) < 10)
395 {
396 figure_count++;
397 }
398 }
399 if (figure_count > 2)
400 {
401 break;
402 }
403 }
404 if (figure_count < 2)
405 {
406 rank = 0;
407 }
408 }
409 return rank;
410}
411
413 uint16_t target_index,
414 uint16_t spell_line,
415 SF_CGdResourceSpell *spell_data)
416{
417 uint32_t rank = 1;
418 if ((_this->battleData.current_figure != target_index) ||
420 {
421 rank = 0;
422 }
423 else
424 {
425 // Berserk level 101 is special case for trolls
426 if (spell_data->skill_requirements[2] > 100)
427 {
429 target_index) > 25)
430 {
431 rank = 0;
432 }
433 }
434 }
435 return rank;
436}
437
439 uint16_t target_index,
440 uint16_t spell_line,
441 SF_CGdResourceSpell *spell_data)
442{
443 uint32_t rank = 1;
444 if ((_this->battleData.current_figure != target_index) ||
446 {
447 rank = 0;
448 }
449 else
450 {
452 target_index) >
453 (100 - spell_data->params[0]))
454 {
455 rank = 0;
456 }
457 }
458 return rank;
459}
460
462 uint16_t target_index,
463 uint16_t spell_line,
464 SF_CGdResourceSpell *spell_data)
465{
466 uint32_t rank = 1;
467 if ((_this->battleData.current_figure != target_index) ||
468 (_this->battleData.enemy_figures.entityCount == 0) ||
469 (_this->battleData.ally_figures.entityCount < 4) ||
470 (_this->battleData.figures_missing_hp == 0))
471 {
472 rank = 0;
473 }
474 else
475 {
476 uint16_t figures_count = 0;
477 for (uint16_t i = 0; i < _this->battleData.ally_figures.entityCount;
478 i++)
479 {
480 uint16_t ally_index =
482 if (figureAPI.isAlive(_this->battleData.CGdFigure, ally_index))
483 {
485 ally_index, spell_line))
486 {
488 ally_index))
489 {
491 _this->battleData.CGdFigure,
492 ally_index) < (100 - spell_data->params[0]))
493 {
494 figures_count++;
495 }
496 }
497 }
498 else
499 {
500 rank = 0;
501 break;
502 }
503 }
504 }
505 if (figures_count < 3)
506 {
507 rank = 0;
508 }
509 }
510 return rank;
511}
512
514 uint16_t target_index,
515 uint16_t spell_line,
516 SF_CGdResourceSpell *spell_data)
517{
518 uint32_t rank = 1;
519 if ((_this->battleData.current_figure != target_index) ||
520 (_this->battleData.enemy_figures.entityCount == 0) ||
521 (_this->battleData.ally_figures.entityCount == 0))
522 {
523 rank = 0;
524 }
525 else
526 {
527 uint16_t percent =
529 target_index);
530 // hardcode value is 75% gamedata value is 50%, i go with gamedata value
531 if (percent > (100 - spell_data->params[1]))
532 {
533 rank = 0;
534 }
535 }
536 return rank;
537}
538
540 uint16_t target_index,
541 uint16_t spell_line,
542 SF_CGdResourceSpell *spell_data)
543{
544 uint32_t rank = 1;
545 if ((_this->battleData.current_figure != target_index) ||
547 {
548 rank = 0;
549 }
550 else
551 {
553 SF_Coord pos;
554 iteratorAPI.figureIteratorInit(&iter, 0, 0, 0x3ff, 0x3ff);
556 _this->battleData.CGdFigure,
557 _this->battleData.autoclass22,
558 _this->battleData.CGdWorld);
559 figureAPI.getPosition(_this->battleData.CGdFigure, &pos, target_index);
561 target_index))
562 {
563 iteratorAPI.iteratorSetArea(&iter, &pos, 2);
564 }
565 else
566 {
567 iteratorAPI.iteratorSetArea(&iter, &pos, 8);
568 }
569 bool should_use = false;
570 uint16_t figure_id = iteratorAPI.getNextFigure(&iter);
571 while (figure_id != 0)
572 {
573 if (_this->battleData.CGdFigure->figures[figure_id].owner !=
574 (uint16_t)-1)
575 {
577 _this->battleData.CGdFigureToolBox, target_index,
578 figure_id))
579 {
581 figure_id))
582 {
584 _this->battleData.CGdFigure, figure_id) < 50)
585 {
586 should_use = true;
587 break;
588 }
589 }
590 }
591 }
592 figure_id = iteratorAPI.getNextFigure(&iter);
593 }
594 if (!should_use)
595 {
596 rank = 0;
597 }
599 }
600 return rank;
601}
602
603// kGdSpellLineProtectionBlack
604// kGdSpellLineFakeSpellOneFigure
606 uint16_t target_index,
607 uint16_t spell_line,
608 SF_CGdResourceSpell *spell_data)
609{
610 return 0;
611}
612
614 uint16_t target_index,
615 uint16_t spell_line,
616 SF_CGdResourceSpell *spell_data)
617{
618 return 2;
619}
620
621// Weird shit, might need fix?
623 uint16_t target_index,
624 uint16_t spell_line,
625 SF_CGdResourceSpell *spell_data)
626{
627 uint32_t rank = 5;
628 uint16_t current_mana =
631 uint16_t max_mana = figureAPI.getCurrentMaxMana(_this->battleData.CGdFigure,
632 _this->battleData.
633 current_figure);
634 uint16_t current_health =
635 figureAPI.getCurrentHealth(_this->battleData.CGdFigure, target_index);
636 uint16_t max_health =
638 target_index);
639 if ((max_mana / 2 < current_mana) && (current_health < max_health))
640 {
641 if (current_health == 0)
642 {
643 rank = 0;
644 }
645 else
646 {
647 if (max_health == 0)
648 {
649 rank = 0;
650 }
651 else
652 {
653 rank = (current_health * 2 - max_health) /
654 (max_health * max_health);
655 }
656 }
657 }
658 else
659 {
660 rank = 0;
661 }
662 return rank;
663}
664
666 uint16_t target_index,
667 uint16_t spell_line,
668 SF_CGdResourceSpell *spell_data)
669{
670 uint32_t rank = 1;
671 ushort_list_node node =
673 uint16_t list_length = ((uint32_t)node.data - (uint32_t)node.first) >> 1;
674 if ((_this->battleData.enemy_figures.entityCount == 0) ||
675 (list_length == 0))
676 {
677 rank = 0;
678 }
679 else
680 {
688 }
689 return rank;
690}
691
693 uint16_t target_index,
694 uint16_t spell_line,
695 SF_CGdResourceSpell *spell_data)
696{
697 uint32_t rank = 1;
698 if (target_index == _this->battleData.current_figure)
699 {
700 uint16_t threshold = spell_data->params[0];
701 uint16_t count = 0;
702 for (int i = 0; i < _this->battleData.enemy_figures.entityCount; i++)
703 {
704 uint16_t figure_index =
706 if (figureAPI.isAlive(_this->battleData.CGdFigure, figure_index))
707 {
709 figure_index) < threshold)
710 {
711 SF_Coord position;
713 &position, figure_index);
714 uint16_t distance = getDistance(&position,
715 &(_this->battleData.
716 current_figure_pos));
717 if (distance < 10)
718 {
719 count++;
720 break;
721 }
722 }
723 }
724 }
725 if (!count)
726 {
727 rank = 0;
728 }
729 }
730 else
731 {
732 rank = 0;
733 }
734 return rank;
735}
736
738 uint16_t target_index,
739 uint16_t spell_line,
740 SF_CGdResourceSpell *spell_data)
741{
742 uint32_t rank = 1;
743 uint16_t current_health =
744 figureAPI.getCurrentHealth(_this->battleData.CGdFigure, target_index);
745 uint16_t max_health =
747 target_index);
748 uint16_t healing_amount = 0;
749 struct
750 {
751 uint32_t *first;
752 uint32_t *data;
753 uint32_t *post_last;
754 } some_list;
755 uint32_t *list_first;
756 uint32_t *list_current;
757 figureAPI.getHealersList(_this->battleData.CGdFigure, &some_list,
758 target_index);
759 uint32_t list_length = ((uint32_t)some_list.data -
760 (uint32_t)some_list.first) >> 2;
761 if (list_length != 0)
762 {
763 list_first = some_list.first;
764 list_current = some_list.data;
765 while (list_current != list_first)
766 {
767 healing_amount += spell_data->params[0];
768 list_first++;
769 }
770 }
771 if (current_health + healing_amount < max_health)
772 {
773 if (current_health == 0)
774 {
775 rank = 0;
776 figureAPI.disposeHealerList(&some_list);
777 return rank;
778 }
779 if (((max_health * 9) / 10 < current_health + healing_amount) ||
780 (current_health + healing_amount < max_health / 10))
781 {
782 rank = rank << 1;
783 }
784 }
785 else
786 {
787 rank = 0;
788 }
789 return rank;
790}
791
792uint32_t __thiscall amok_ai_handler(SF_CGdBattleDevelopment *_this,
793 uint16_t target_index, uint16_t spell_line,
794 SF_CGdResourceSpell *spell_data)
795{
796 uint32_t rank = 2;
797 if ((_this->battleData.enemy_figures.entityCount < 2) ||
798 (spell_data->params[2] <
800 {
801 rank = 0;
802 }
803 return rank;
804}
805
806// kGdSpellLineHypnotizeTower
807// kGdSpellLineHypnotizeTwo
808// kGdSpellLineHypnotizeArea
809// kGdSpellLineHypnotize
811 uint16_t target_index,
812 uint16_t spell_line,
813 SF_CGdResourceSpell *spell_data)
814{
815 uint32_t rank = 2;
816
817 if (spell_data->params[2] < _this->battleData.current_target_level_possibly)
818 {
819 rank = 0;
820 }
821 else
822 {
824 target_index))
825 {
826 rank = 4;
827 }
828 }
829 return rank;
830}
831
833 uint16_t target_index,
834 uint16_t spell_line,
835 SF_CGdResourceSpell *spell_data)
836{
837 uint32_t rank = 2;
838 uint16_t max_health =
840 target_index);
841 uint16_t current_health =
842 figureAPI.getCurrentHealth(_this->battleData.CGdFigure, target_index);
843 if (current_health < max_health)
844 {
845 rank = 4;
846 }
847 return rank;
848}
849
850// Stackable:
851// kGdSpellLineFireBurst
852// Icestrike
853// Non-stackable:
854// kGdSpellLinePoison
855// kGdSpellLinePestilence
857 uint16_t target_index,
858 uint16_t spell_line,
859 SF_CGdResourceSpell *spell_data)
860{
861 uint32_t rank = 2;
863 {
864 rank = 4;
865 }
866 return rank;
867}
868
869// Death and Pain
870uint32_t __thiscall death_ai_handler(SF_CGdBattleDevelopment *_this,
871 uint16_t target_index, uint16_t spell_line,
872 SF_CGdResourceSpell *spell_data)
873{
874 uint32_t rank = 2;
876 {
877 rank = ((uint16_t)_this->battleData.current_target_level_possibly / 5 +
878 1) * 2;
879 }
880 return rank;
881}
882
884 uint16_t target_index,
885 uint16_t spell_line,
886 SF_CGdResourceSpell *spell_data)
887{
888 uint32_t rank = 2;
889 uint16_t percent =
892 if (percent > 95)
893 {
894 rank = 0;
895 }
897 target_index);
898 if (percent > 10)
899 {
900 rank = 0;
901 }
902 return rank;
903}
904
906 uint16_t target_index,
907 uint16_t spell_line,
908 SF_CGdResourceSpell *spell_data)
909{
910 uint32_t rank = 2;
911
912 if (spell_data->params[2] < _this->battleData.current_target_level_possibly)
913 {
914 rank = 0;
915 }
916 return rank;
917}
918
919// charm
920// charm animal
921uint32_t __thiscall charm_ai_handler(SF_CGdBattleDevelopment *_this,
922 uint16_t target_index, uint16_t spell_line,
923 SF_CGdResourceSpell *spell_data)
924{
925 uint32_t rank = 2;
926 if ((figureAPI.isFlagSet(_this->battleData.CGdFigure, target_index,
927 UNKILLABLE)) ||
928 (spell_data->params[6] <
930 {
931 rank = 0;
932 }
933 return rank;
934}
935
937 uint16_t target_index,
938 uint16_t spell_line,
939 SF_CGdResourceSpell *spell_data)
940{
941 uint32_t rank = 2;
942 if ((_this->battleData.CGdFigure->figures[target_index].flags &
944 {
945 rank = 0;
946 }
947 return rank;
948}
949
951 uint16_t target_index,
952 uint16_t spell_line,
953 SF_CGdResourceSpell *spell_data)
954{
955 uint32_t rank = 2;
956 uint16_t current_mana =
959 uint16_t max_mana = figureAPI.getCurrentMaxMana(_this->battleData.CGdFigure,
960 _this->battleData.
961 current_figure);
962 if (current_mana <= (uint16_t)((max_mana * 95) / 100))
963 {
964 uint16_t target_mana =
965 figureAPI.getCurrentMana(_this->battleData.CGdFigure, target_index);
966 uint16_t target_max_mana =
968 target_index);
969 if ((target_max_mana / 10) > target_mana)
970 {
971 rank = 0;
972 }
973 }
974 else
975 {
976 rank = 0;
977 }
978 return rank;
979}
980
982 uint16_t target_index,
983 uint16_t spell_line,
984 SF_CGdResourceSpell *spell_data)
985{
986 uint32_t rank = 2;
988 target_index))
989 {
990 rank = 0;
991 }
992 return rank;
993}
994
996 uint16_t target_index,
997 uint16_t spell_line,
998 SF_CGdResourceSpell *spell_data)
999{
1000 uint32_t rank = 2;
1001 if (spell_data->params[1] < _this->battleData.current_target_level_possibly)
1002 {
1003 rank = 0;
1004 }
1005 return rank;
1006}
1007
1008// befriend
1009// disenchant
1011 uint16_t target_index,
1012 uint16_t spell_line,
1013 SF_CGdResourceSpell *spell_data)
1014{
1015 uint32_t rank = 2;
1016 if (spell_data->params[0] < _this->battleData.current_target_level_possibly)
1017 {
1018 rank = 0;
1019 }
1020 return rank;
1021}
1022
1024 uint16_t target_index,
1025 uint16_t spell_line,
1026 SF_CGdResourceSpell *spell_data)
1027{
1028 uint32_t rank = 2;
1029 bool hasAura = false;
1031 target_index))
1032 {
1033 for (uint16_t node_id =
1035 target_index);
1036 node_id != 0;
1037 node_id =
1039 (uint32_t *)_this->battleData.CGdDoubleLinkList, node_id))
1040 {
1041 uint16_t spell_index =
1043 (uint32_t *) _this->battleData.CGdDoubleLinkList, node_id);
1044 uint16_t spell_line =
1045 spellAPI.getSpellLine(_this->battleData.CGdSpell, spell_index);
1047 {
1048 hasAura = true;
1049 break;
1050 }
1051 }
1052 }
1053 if (!hasAura)
1054 {
1055 rank = 0;
1056 }
1057 return rank;
1058}
1059
1061 uint16_t target_index,
1062 uint16_t spell_line,
1063 SF_CGdResourceSpell *spell_data)
1064{
1065 uint32_t rank = 2;
1066 bool hasAura = false;
1068 target_index))
1069 {
1070 for (uint16_t node_id =
1072 target_index);
1073 node_id != 0;
1074 node_id =
1076 (uint32_t *) _this->battleData.CGdDoubleLinkList, node_id))
1077 {
1078 uint16_t spell_index =
1080 (uint32_t *) _this->battleData.CGdDoubleLinkList, node_id);
1081 uint16_t spell_line =
1082 spellAPI.getSpellLine(_this->battleData.CGdSpell, spell_index);
1084 {
1085 hasAura = true;
1086 break;
1087 }
1088 }
1089 }
1090 if (!hasAura)
1091 {
1092 rank = 0;
1093 }
1094 return rank;
1095}
1096
1098 uint16_t target_index,
1099 uint16_t spell_line,
1100 SF_CGdResourceSpell *spell_data)
1101{
1102 return 4;
1103}
1104
1106 uint16_t target_index,
1107 uint16_t spell_line,
1108 SF_CGdResourceSpell *spell_data)
1109{
1110 uint32_t rank = 2;
1111 if ((spell_data->params[2] <
1113 (figureAPI.isFlagSet(_this->battleData.CGdFigure, target_index,
1114 UNKILLABLE)))
1115 {
1116 rank = 0;
1117 }
1118 return rank;
1119}
SpellFunctions * spellAPI
Definition TestMod.cpp:11
FigureFunctions * figureAPI
Definition TestMod.cpp:13
ToolboxFunctions * toolboxAPI
Definition TestMod.cpp:12
IteratorFunctions iteratorAPI
Definition sf_hooks.c:40
uint32_t getDistance(SF_Coord *pointA, SF_Coord *pointB)
uint32_t __thiscall cure_disease_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall hallow_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall berserk_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall shields_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall death_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall fireburst_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall manatap_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall RCA_ability_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall amok_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall hypnotize_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall lifetap_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall do_not_cast_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall dispel_white_aura_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall befriend_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall healing_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall tower_extinct_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall shift_life_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall death_grasp_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall demoralization_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall charm_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall freeze_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall summon_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall riposte_ability_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall default_support_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall cure_poison_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall dispel_black_aura_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall sacrifice_mana_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall offensive_aura_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall HCA_ability_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall critical_hits_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall wave_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall dominate_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall petrify_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall defensive_aura_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall blessing_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall healing_aura_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall extinct_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall benefactions_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall default_offensive_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall confuse_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t __thiscall aura_light_ai_handler(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
@ WHITE_AURA_SPELL
@ BLACK_AURA_SPELL
@ kGdSpellLinePoison
@ kGdSpellLinePestilence
AutoClass60_data data[500]
uint16_t entityCount
uint32_t figures_missing_hp
SF_CGdTargetData current_source_maybe
uint32_t current_target_level_possibly
SF_Coord current_figure_pos
SF_CGdFigureToolbox * CGdFigureToolBox
SF_CGdFigure * CGdFigure
AutoClass60 ally_figures
SF_CGdSpell * CGdSpell
ushort_list_node another_figure_list[2000]
SF_CGdWorld * CGdWorld
AutoClass60 enemy_figures
isWarrior_ptr isWarrior
disposeHealerList_ptr disposeHealerList
getPosition_ptr getPosition
getCurrentMaxMana_ptr getCurrentMaxMana
getCurrentMaxHealth_ptr getCurrentMaxHealth
getCurrentHealth_ptr getCurrentHealth
isFlagSet_ptr isFlagSet
getHealersList_ptr getHealersList
getSpellJobStartNode_ptr getSpellJobStartNode
getCurrentHealthPercent_ptr getCurrentHealthPercent
getCurrentMana_ptr getCurrentMana
GdFigureFlags flags
disposeFigureIterator_ptr disposeFigureIterator
getNextFigure_ptr getNextFigure
figureIteratorSetPointers_ptr figureIteratorSetPointers
iteratorSetArea_ptr iteratorSetArea
figureIteratorInit_ptr figureIteratorInit
High-level structure managing AI battle development.
GdFigure figures[2000]
getSpellLine_ptr getSpellLine
Retrieves the spell type ID of a given spell.
hasSpellTag_ptr hasSpellTag
Checks if a spell has a specific tag.
hasSpellOnIt_ptr hasSpellOnIt
figuresCheckHostile_ptr figuresCheckHostile
getNextNode_ptr getNextNode
hasAuraActive_ptr hasAuraActive
isUnitMelee_ptr isUnitMelee
getSpellIndexFromDLL_ptr getSpellIndexFromDLL
Represents a node in a list of unsigned short values.