Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
dmg_partner.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "effects.h"
4
6
7void dispatch_event_partner(s32 lastEventType) {
8 BattleStatus* battleStatus = &gBattleStatus;
9 Actor* partnerActor = battleStatus->partnerActor;
10 Evt* handleEventScript = partnerActor->handleEventScript;
11 s32 onHitID = partnerActor->handleEventScriptID;
12 Evt* script;
13
14 partnerActor->lastEventType = lastEventType;
16 partnerActor->handleEventScript = script;
17 partnerActor->handleEventScriptID = script->id;
18 script->owner1.actorID = ACTOR_PARTNER;
19
20 if (partnerActor->takeTurnScript != NULL) {
22 partnerActor->takeTurnScript = NULL;
23 }
24
25 if (handleEventScript != NULL) {
26 kill_script_by_ID(onHitID);
27 }
28}
29
31 BattleStatus* battleStatus = &gBattleStatus;
32 Actor* partnerActor = battleStatus->partnerActor;
33 Evt* handleEventScript = partnerActor->handleEventScript;
34 s32 onHitID = partnerActor->handleEventScriptID;
35 Evt* script;
36
37 partnerActor->lastEventType = lastEventType;
39 partnerActor->handleEventScript = script;
40 partnerActor->handleEventScriptID = script->id;
41 script->owner1.actorID = ACTOR_PARTNER;
42
43 if (handleEventScript != NULL) {
44 kill_script_by_ID(onHitID);
45 }
46}
47
49 BattleStatus* battleStatus = &gBattleStatus;
50 Actor* partner = battleStatus->partnerActor;
51 s32 currentTargetID = battleStatus->curTargetID;
52 s32 currentTargetPart = battleStatus->curTargetPart;
53 Actor* target;
54 ActorState* state;
55 ActorPart* part;
56
57 battleStatus->curTargetID2 = battleStatus->curTargetID;
58 battleStatus->curTargetPart2 = battleStatus->curTargetPart;
59 target = get_actor(currentTargetID);
60 state = &partner->state;
61
62 if (target == NULL) {
63 return HIT_RESULT_HIT;
64 }
65
66 part = get_actor_part(target, currentTargetPart);
67 ASSERT(part != NULL);
68
69 if (target->stoneStatus == STATUS_KEY_STONE) {
70 return HIT_RESULT_IMMUNE;
71 }
72
74 return HIT_RESULT_MISS;
75 }
76
77 // check partner jumping on top-spiky enemy (cannot be suppressed)
78 if ((battleStatus->curAttackElement & DAMAGE_TYPE_JUMP)
80 && !(target->flags2 & ACTOR_FLAG_UPSIDE_DOWN)
81 ) {
84 }
85
86 // check partner contacting front-spiky enemy
91 ) {
96 }
97
98 // check partner contacting fiery enemy
102 ) {
106 return HIT_RESULT_BACKFIRE;
107 }
108
109 // special handling for air lift
110 if (battleStatus->curAttackElement & DAMAGE_TYPE_AIR_LIFT) {
111 // check partner airlifting top-spiky enemy
112 if (!(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT)) {
114 && !(target->flags & ACTOR_FLAG_UPSIDE_DOWN)
116 ) {
120 return HIT_RESULT_BACKFIRE;
121 }
122
123 if (!(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT)
125 && !(target->flags & ACTOR_FLAG_UPSIDE_DOWN)
127 ) {
131 return HIT_RESULT_BACKFIRE;
132 }
133 }
134
135 // check partner airlifting electrified enemy
136 if (partner->staticStatus != STATUS_KEY_STATIC
138 && !(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT)
140 {
142 apply_shock_effect(partner);
144 return HIT_RESULT_BACKFIRE;
145 }
146
147 // check partner airlifting fiery enemy
151 {
155 return HIT_RESULT_BACKFIRE;
156 }
158 }
159 return HIT_RESULT_HIT;
160}
161
163 BattleStatus* battleStatus = &gBattleStatus;
164 Actor* partner = battleStatus->partnerActor;
165 s32 currentTargetID = battleStatus->curTargetID;
166 s32 currentTargetPartID = battleStatus->curTargetPart;
167 s32 hitResult = HIT_RESULT_HIT;
168 s32 partImmuneToElement = FALSE;
169 s32 isFireDamage = FALSE;
170 s32 isWaterDamage = FALSE;
171 s32 isShockDamage = FALSE;
172 s32 isIceDamage = FALSE;
173 s32 wasSpecialHit = FALSE;
174 s32 wasStatusInflicted = FALSE;
175 Actor* target;
176 ActorPart* targetPart;
177 ActorState* state;
178 Evt* evt;
179 s32 statusChanceOrDefense;
180 s32 damageDealt;
181 s32 dispatchEvent;
182
183 battleStatus->wasStatusInflicted = FALSE;
184 battleStatus->lastAttackDamage = 0;
185 battleStatus->attackerActorID = partner->actorID;
186 battleStatus->curTargetID2 = battleStatus->curTargetID;
187 battleStatus->curTargetPart2 = battleStatus->curTargetPart;
188 target = get_actor(currentTargetID);
189 state = &partner->state;
190
191 if (target == NULL) {
192 return HIT_RESULT_HIT;
193 }
194
195 targetPart = get_actor_part(target, currentTargetPartID);
196
197 ASSERT(targetPart != NULL);
198
199 target->lastDamageTaken = 0;
200
202 hitResult = HIT_RESULT_NO_DAMAGE;
203 dispatchEvent = EVENT_ZERO_DAMAGE;
205 } else {
206 if ((targetPart->eventFlags & ACTOR_EVENT_FLAG_ILLUSORY)
208 || (targetPart->eventFlags & ACTOR_EVENT_FLAG_BURIED && !(battleStatus->curAttackElement & DAMAGE_TYPE_QUAKE))
209 ) {
210 return HIT_RESULT_MISS;
211 }
212
213 if (target->stoneStatus == STATUS_KEY_STONE) {
215 show_immune_bonk(state->goalPos.x, state->goalPos.y, state->goalPos.z, 0, 1, 1);
216 show_next_damage_popup(state->goalPos.x, state->goalPos.y, state->goalPos.z, 0, 0);
217
219 return HIT_RESULT_NICE;
220 } else {
221 return HIT_RESULT_HIT;
222 }
223 }
224
225 if (targetPart->elementalImmunities & battleStatus->curAttackElement) {
226 partImmuneToElement = TRUE;
227 }
228
229 // check jumping on spiky enemy
230 if (battleStatus->curAttackElement & DAMAGE_TYPE_JUMP
232 ) {
236 return HIT_RESULT_BACKFIRE;
237 }
238
239 // check explode on contact
240 if (!(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT)
242 ) {
244
248 return HIT_RESULT_BACKFIRE;
249 }
250
252
254 return HIT_RESULT_NICE;
255 } else {
256 return HIT_RESULT_HIT;
257 }
258 }
259
260 // check touching fiery enemy
262 && targetPart->eventFlags & ACTOR_EVENT_FLAG_FIREY
264 ) {
268 return HIT_RESULT_BACKFIRE;
269 }
270
271 // check touching spiky-front enemy
275 ) {
279 return HIT_RESULT_BACKFIRE;
280 }
281
282 // check explode on ignition
284 && battleStatus->curAttackElement & DAMAGE_TYPE_FIRE
286 ) {
289
291 return HIT_RESULT_NICE;
292 } else {
293 return HIT_RESULT_HIT;
294 }
295 }
296
297 // unknown alternate spiky #1
298 if (!(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT)
300 && !(target->flags & ACTOR_FLAG_UPSIDE_DOWN)
302 ) {
306 return HIT_RESULT_BACKFIRE;
307 }
308
309 // unknown alternate spiky top
310 if (!(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT)
312 && !(target->flags & ACTOR_FLAG_UPSIDE_DOWN)
314 ) {
318 return HIT_RESULT_BACKFIRE;
319 }
320
321 // check explode on ignition (duplicate of previous check)
323 && battleStatus->curAttackElement & DAMAGE_TYPE_FIRE
325 ) {
328
330 return HIT_RESULT_NICE;
331 } else {
332 return HIT_RESULT_HIT;
333 }
334 }
335
336 // check shock contact for airlift
337 if (battleStatus->curAttackElement & DAMAGE_TYPE_AIR_LIFT) {
338 if (partner->staticStatus != STATUS_KEY_STATIC
340 && !(battleStatus->curAttackElement & DAMAGE_TYPE_NO_CONTACT)
342 ) {
344 apply_shock_effect(partner);
346 return HIT_RESULT_BACKFIRE;
347 } else {
348 return HIT_RESULT_HIT;
349 }
350 }
351
352 if (battleStatus->curAttackElement & DAMAGE_TYPE_FIRE) {
353 fx_ring_blast(0, state->goalPos.x, state->goalPos.y, state->goalPos.z + 5.0f, 1.0f, 24);
354 isFireDamage = TRUE;
355 }
356
357 if (battleStatus->curAttackElement & DAMAGE_TYPE_SHOCK) {
358 apply_shock_effect(target);
359 isShockDamage = TRUE;
360 }
361
362 if (battleStatus->curAttackElement & DAMAGE_TYPE_WATER) {
363 fx_water_splash(0, state->goalPos.x, state->goalPos.y, state->goalPos.z + 5.0f, 1.0f, 24);
364 isWaterDamage = TRUE;
365 }
366
367 if (battleStatus->curAttackElement & DAMAGE_TYPE_ICE) {
368 fx_big_snowflakes(0, state->goalPos.x, state->goalPos.y, state->goalPos.z + 5.0f);
369 isIceDamage = TRUE;
370 }
371
372 if (partner->staticStatus != STATUS_KEY_STATIC
376 ) {
378 }
379
381 battleStatus->curAttackElement &= ~DAMAGE_TYPE_IGNORE_DEFENSE;
382 }
383
384 statusChanceOrDefense = get_defense(target, targetPart->defenseTable, battleStatus->curAttackElement);
385
386 if (!(battleStatus->curAttackElement & DAMAGE_TYPE_IGNORE_DEFENSE)) {
387 statusChanceOrDefense += target->defenseBoost;
388 }
389
390 damageDealt = battleStatus->curAttackDamage + partner->attackBoost;
391
393 if (battleStatus->curAttackElement & DAMAGE_TYPE_BLAST
395 ) {
396 statusChanceOrDefense = 0;
397 damageDealt = target->curHP;
398 }
399 }
400
402 statusChanceOrDefense = 0;
403 damageDealt = 0;
404 }
405
406 if (partner->debuff == STATUS_KEY_SHRINK) {
407 if (damageDealt != 0) {
408 damageDealt /= 2;
409
410 if (damageDealt == 0) {
411 damageDealt = 1;
412 }
413 }
414 }
415
416 if (damageDealt > 99) {
417 damageDealt = 99;
418 }
419
420 if (damageDealt < 0) {
421 statusChanceOrDefense = 0;
422 }
423
424 damageDealt -= statusChanceOrDefense;
425 target->hpChangeCounter = 0;
426
427 if (damageDealt < 0) {
428 damageDealt = 0;
429 }
430
431 if (battleStatus->curAttackElement & DAMAGE_TYPE_POWER_BOUNCE && damageDealt > 0) {
432 damageDealt += battleStatus->powerBounceCounter;
433
434 if (damageDealt < 1) {
435 damageDealt = 1;
436 }
437 }
438
439 battleStatus->lastAttackDamage = 0;
440
441 if (damageDealt < 1) {
442 target->hpChangeCounter = 0;
443
444 if (!(battleStatus->curAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS)) {
445 hitResult = HIT_RESULT_NO_DAMAGE;
446 dispatchEvent = EVENT_ZERO_DAMAGE;
448 } else {
449 hitResult = HIT_RESULT_NO_DAMAGE;
450 if (target->curHP < 1) {
451 dispatchEvent = EVENT_DEATH;
452 } else {
453 dispatchEvent = EVENT_ZERO_DAMAGE;
454 }
455 }
456
457 battleStatus->lastAttackDamage = 0;
458 } else {
459 target->damageCounter += damageDealt;
460 target->hpChangeCounter -= damageDealt;
461 battleStatus->lastAttackDamage = 0;
462 dispatchEvent = EVENT_HIT_COMBO;
463 hitResult = HIT_RESULT_HIT;
464
465 if (!(targetPart->flags & ACTOR_PART_FLAG_DAMAGE_IMMUNE)
467 && !partImmuneToElement
468 && !(targetPart->targetFlags & ACTOR_PART_TARGET_NO_DAMAGE)
469 ) {
470 target->curHP -= damageDealt;
471
472 if (target->curHP < 1) {
473 target->curHP = 0;
474 dispatchEvent = EVENT_DEATH;
475 }
476 }
477
478 battleStatus->lastAttackDamage += damageDealt;
479 target->lastDamageTaken = battleStatus->lastAttackDamage;
480 target->hpChangeCounter = 0;
481 }
482
483 if (targetPart->flags & ACTOR_PART_FLAG_DAMAGE_IMMUNE) {
484 if (partner->staticStatus == STATUS_KEY_STATIC
488 ) {
491 dispatch_event_actor(target, dispatchEvent);
492 show_immune_bonk(state->goalPos.x, state->goalPos.y, state->goalPos.z, 0, 1, 3);
494 return HIT_RESULT_NICE;
495 } else {
496 return HIT_RESULT_HIT;
497 }
498 }
499
501 apply_shock_effect(partner);
503 return HIT_RESULT_BACKFIRE;
504 }
505 }
506
508 if (dispatchEvent == EVENT_HIT_COMBO) {
509 dispatchEvent = EVENT_HIT;
510 }
511
512 if (dispatchEvent == EVENT_ZERO_DAMAGE) {
513 dispatchEvent = EVENT_IMMUNE;
514 }
515
516 if (target->curHP < 1) {
517 if (dispatchEvent == EVENT_IMMUNE) {
518 dispatchEvent = EVENT_DEATH;
519 }
520 }
521 } else if (dispatchEvent == EVENT_DEATH) {
522 dispatchEvent = EVENT_HIT_COMBO;
523 }
524
526 clear_part_pal_adjustment(targetPart);
527 }
528
530 if (battleStatus->curAttackElement & DAMAGE_TYPE_SPIN_SMASH) {
531 if (dispatchEvent == EVENT_HIT) {
532 dispatchEvent = EVENT_SPIN_SMASH_HIT;
533 }
534
535 if (dispatchEvent == EVENT_DEATH) {
536 dispatchEvent = EVENT_SPIN_SMASH_DEATH;
537 }
538
539 wasSpecialHit = TRUE;
540 }
541
544 if (dispatchEvent == EVENT_HIT_COMBO) {
545 dispatchEvent = EVENT_POWER_BOUNCE_HIT;
546 }
547
548 if (dispatchEvent == EVENT_HIT) {
549 dispatchEvent = EVENT_POWER_BOUNCE_HIT;
550 }
551
552 if (dispatchEvent == EVENT_ZERO_DAMAGE) {
553 dispatchEvent = EVENT_POWER_BOUNCE_HIT;
554 }
555
556 if (dispatchEvent == EVENT_IMMUNE) {
557 dispatchEvent = EVENT_POWER_BOUNCE_HIT;
558 }
559
560 if (dispatchEvent == EVENT_DEATH) {
561 dispatchEvent = EVENT_POWER_BOUNCE_DEATH;
562 }
563 }
564
566 if (battleStatus->curAttackElement & DAMAGE_TYPE_JUMP && targetPart->eventFlags & ACTOR_EVENT_FLAG_GROUNDABLE) {
567 if (dispatchEvent == EVENT_HIT) {
568 dispatchEvent = EVENT_FALL_TRIGGER;
569 }
570
571 if (dispatchEvent == EVENT_IMMUNE) {
572 dispatchEvent = EVENT_FALL_TRIGGER;
573 }
574
575 wasSpecialHit = TRUE;
576 }
577
579 if (battleStatus->curAttackElement & DAMAGE_TYPE_JUMP && targetPart->eventFlags & ACTOR_EVENT_FLAG_FLIPABLE) {
580 if (dispatchEvent == EVENT_HIT) {
581 dispatchEvent = EVENT_FLIP_TRIGGER;
582 }
583
584 if (dispatchEvent == EVENT_IMMUNE) {
585 dispatchEvent = EVENT_FLIP_TRIGGER;
586 }
587
588 if (!(target->flags & ACTOR_FLAG_FLIPPED)) {
589 wasSpecialHit = TRUE;
590 }
591 }
592 }
593 }
594 }
595 }
596
598 && battleStatus->curAttackElement & DAMAGE_TYPE_JUMP
600 ) {
601 if (dispatchEvent == EVENT_HIT_COMBO) {
602 dispatchEvent = EVENT_FLIP_TRIGGER;
603 }
604
605 if (dispatchEvent == EVENT_ZERO_DAMAGE) {
606 dispatchEvent = EVENT_FLIP_TRIGGER;
607 }
608
609 if (!(target->flags & ACTOR_FLAG_FLIPPED)) {
610 wasSpecialHit = TRUE;
611 }
612 }
613
615 && battleStatus->curAttackElement & DAMAGE_TYPE_BLAST
617 ) {
618 if (dispatchEvent == EVENT_DEATH) {
619 dispatchEvent = EVENT_EXPLODE_TRIGGER;
620 }
621
622 if (dispatchEvent == EVENT_IMMUNE) {
623 dispatchEvent = EVENT_EXPLODE_TRIGGER;
624 }
625
626 if (dispatchEvent == EVENT_HIT) {
627 dispatchEvent = EVENT_EXPLODE_TRIGGER;
628 }
629
630 wasSpecialHit = TRUE;
631 isFireDamage = TRUE;
632 }
633
635 if (battleStatus->curAttackElement & (DAMAGE_TYPE_BLAST | DAMAGE_TYPE_FIRE)) {
636 if (dispatchEvent == EVENT_HIT) {
637 dispatchEvent = EVENT_BURN_HIT;
638 }
639
640 if (dispatchEvent == EVENT_DEATH) {
641 dispatchEvent = EVENT_BURN_DEATH;
642 }
643
644 isFireDamage = TRUE;
645 }
646
648 && battleStatus->lastAttackDamage >= 0
649 && dispatchEvent != EVENT_DEATH
650 && dispatchEvent != EVENT_SPIN_SMASH_DEATH
651 && dispatchEvent != EVENT_EXPLODE_TRIGGER
652 && !(targetPart->targetFlags & ACTOR_PART_TARGET_NO_DAMAGE)
653 ) {
654 #define INFLICT_STATUS(STATUS_TYPE) \
655 if ((battleStatus->curAttackStatus & STATUS_FLAG_##STATUS_TYPE) && \
656 try_inflict_status(target, STATUS_KEY_##STATUS_TYPE, STATUS_TURN_MOD_##STATUS_TYPE)) { \
657 wasSpecialHit = TRUE; \
658 wasStatusInflicted = TRUE; \
659 } \
660
661 INFLICT_STATUS(SHRINK);
662 INFLICT_STATUS(POISON);
663 INFLICT_STATUS(STONE);
664 INFLICT_STATUS(SLEEP);
665 INFLICT_STATUS(STOP);
666 INFLICT_STATUS(STATIC);
667 INFLICT_STATUS(FEAR);
668 INFLICT_STATUS(PARALYZE);
669 INFLICT_STATUS(DIZZY);
670
671 #undef INFLICT_STATUS
672
673 statusChanceOrDefense = target->actorBlueprint->spookChance;
674
675 if (statusChanceOrDefense > 0) {
676 statusChanceOrDefense = 100;
677 }
678
679 statusChanceOrDefense = (battleStatus->statusChance * statusChanceOrDefense) / 100;
680
681 if (battleStatus->curAttackStatus & STATUS_FLAG_400000) {
682 if (rand_int(99) < statusChanceOrDefense) {
683 if (!(target->debuff == STATUS_KEY_FEAR
684 || target->debuff == STATUS_KEY_DIZZY
685 || target->debuff == STATUS_KEY_PARALYZE
686 || target->debuff == STATUS_KEY_SLEEP
687 || target->debuff == STATUS_KEY_FROZEN
688 || target->debuff == STATUS_KEY_STOP)
689 && !(target->flags & ACTOR_FLAG_FLIPPED)
690 ) {
691 dispatchEvent = EVENT_SCARE_AWAY;
692 wasStatusInflicted = TRUE;
693 hitResult = HIT_RESULT_HIT;
694 wasSpecialHit = TRUE;
701 } else {
702 dispatchEvent = EVENT_IMMUNE;
703 hitResult = HIT_RESULT_NO_DAMAGE;
704 }
705 } else {
706 dispatchEvent = EVENT_IMMUNE;
707 hitResult = HIT_RESULT_NO_DAMAGE;
708 }
709 }
710
711 if (wasStatusInflicted) {
712 if (dispatchEvent == EVENT_ZERO_DAMAGE) {
713 dispatchEvent = EVENT_HIT_COMBO;
714 }
715
716 if (dispatchEvent == EVENT_IMMUNE) {
717 dispatchEvent = EVENT_HIT;
718 }
719 }
720 }
721 }
722
723 statusChanceOrDefense = target->actorBlueprint->spookChance;
724 statusChanceOrDefense = (battleStatus->statusChance * statusChanceOrDefense) / 100;
725
727 if (battleStatus->curAttackElement & DAMAGE_TYPE_FEAR) {
728 if (rand_int(99) < statusChanceOrDefense) {
729 if (!(target->debuff == STATUS_KEY_FEAR ||
730 target->debuff == STATUS_KEY_DIZZY ||
731 target->debuff == STATUS_KEY_PARALYZE ||
732 target->debuff == STATUS_KEY_SLEEP ||
733 target->debuff == STATUS_KEY_FROZEN ||
734 target->debuff == STATUS_KEY_STOP) && !(target->flags & ACTOR_FLAG_FLIPPED)) {
735 dispatchEvent = EVENT_SCARE_AWAY;
736 wasStatusInflicted = TRUE;
737 hitResult = HIT_RESULT_HIT;
738 wasSpecialHit = TRUE;
745 } else {
746 dispatchEvent = EVENT_IMMUNE;
747 hitResult = HIT_RESULT_NO_DAMAGE;
748 }
749 } else {
750 dispatchEvent = EVENT_IMMUNE;
751 hitResult = HIT_RESULT_NO_DAMAGE;
752 }
753 }
754 }
755
756 battleStatus->wasStatusInflicted = wasStatusInflicted;
757 dispatch_event_actor(target, dispatchEvent);
758
759 if (!(target->flags & ACTOR_FLAG_NO_DMG_POPUP)) {
760 if (battleStatus->lastAttackDamage == 0) {
761 if (!wasSpecialHit && !wasStatusInflicted) {
762 show_immune_bonk(state->goalPos.x, state->goalPos.y, state->goalPos.z, 0, 1, 3);
763 }
764 } else if (!partImmuneToElement) {
766 show_next_damage_popup(state->goalPos.x, state->goalPos.y, state->goalPos.z, battleStatus->lastAttackDamage, 0);
767 } else {
768 show_primary_damage_popup(state->goalPos.x, state->goalPos.y, state->goalPos.z, battleStatus->lastAttackDamage, 0);
769 }
770
771 if (!(targetPart->targetFlags & ACTOR_PART_TARGET_NO_DAMAGE)) {
772 show_damage_fx(target, state->goalPos.x, state->goalPos.y, state->goalPos.z, battleStatus->lastAttackDamage);
773 }
774 }
775 }
776
779 ) {
780 if (battleStatus->lastAttackDamage > 0) {
782 }
783
784 if (battleStatus->lastAttackDamage > 0 || (battleStatus->curAttackElement & DAMAGE_TYPE_STATUS_ALWAYS_HITS && wasSpecialHit)) {
786 show_action_rating(ACTION_RATING_NICE, target, state->goalPos.x, state->goalPos.y, state->goalPos.z);
787 } else {
788 show_action_rating(ACTION_RATING_SUPER, target, state->goalPos.x, state->goalPos.y, state->goalPos.z);
789 }
790 }
791 }
792
794 func_80266970(target);
795 }
796
797 if (battleStatus->lastAttackDamage > 0) {
798 if (partImmuneToElement == 0) {
799 if (partner->actorTypeData1[5] != 0) {
801 }
802
803 set_actor_flash_mode(target, 1);
804
805 if (isFireDamage) {
807 } else if (isShockDamage) {
809 } else if (isIceDamage) {
811 } else {
813 }
814 }
815 }
816
817 if (battleStatus->lastAttackDamage < 1
818 && !(wasSpecialHit || wasStatusInflicted)
819 || targetPart->flags & ACTOR_PART_FLAG_DAMAGE_IMMUNE
820 ) {
822 }
823
824 if (battleStatus->curAttackStatus & STATUS_FLAG_SLEEP && wasStatusInflicted) {
826 evt->varTable[0] = state->goalPos.x;
827 evt->varTable[1] = state->goalPos.y;
828 evt->varTable[2] = state->goalPos.z;
830 }
831
832 if (battleStatus->curAttackStatus & STATUS_FLAG_DIZZY && wasStatusInflicted) {
834 evt->varTable[0] = state->goalPos.x;
835 evt->varTable[1] = state->goalPos.y;
836 evt->varTable[2] = state->goalPos.z;
838 }
839
840 if (battleStatus->curAttackStatus & STATUS_FLAG_PARALYZE && wasStatusInflicted) {
842 evt->varTable[0] = state->goalPos.x;
843 evt->varTable[1] = state->goalPos.y;
844 evt->varTable[2] = state->goalPos.z;
846 }
847
848 if (battleStatus->curAttackStatus & STATUS_FLAG_POISON && wasStatusInflicted) {
850 evt->varTable[0] = state->goalPos.x;
851 evt->varTable[1] = state->goalPos.y;
852 evt->varTable[2] = state->goalPos.z;
854 }
855
856 if (battleStatus->curAttackStatus & STATUS_FLAG_STOP && wasStatusInflicted) {
858 evt->varTable[0] = state->goalPos.x;
859 evt->varTable[1] = state->goalPos.y;
860 evt->varTable[2] = state->goalPos.z;
862 }
863
864 if (battleStatus->curAttackStatus & STATUS_FLAG_FROZEN && wasStatusInflicted) {
866 evt->varTable[0] = state->goalPos.x;
867 evt->varTable[1] = state->goalPos.y;
868 evt->varTable[2] = state->goalPos.z;
869 evt->varTablePtr[3] = target;
871 }
872
873 if (battleStatus->curAttackStatus & STATUS_FLAG_SHRINK && wasStatusInflicted) {
875 evt->varTable[0] = state->goalPos.x;
876 evt->varTable[1] = state->goalPos.y;
877 evt->varTable[2] = state->goalPos.z;
878 evt->varTablePtr[3] = target;
880 }
881
882 if (battleStatus->curAttackElement & DAMAGE_TYPE_SMASH && target->actorType == ACTOR_TYPE_GOOMNUT_TREE) {
884 }
885
886 show_actor_health_bar(target);
887
889 if (hitResult == HIT_RESULT_HIT) {
890 hitResult = HIT_RESULT_NICE;
891 }
892 if (hitResult == HIT_RESULT_NO_DAMAGE) {
893 hitResult = HIT_RESULT_NICE_NO_DAMAGE;
894 }
895 }
896
897 if (partner->staticStatus != STATUS_KEY_STATIC && (target->staticStatus == STATUS_KEY_STATIC ||
901 apply_shock_effect(partner);
903 return HIT_RESULT_BACKFIRE;
904 }
905
906 return hitResult;
907}
908
909s32 dispatch_damage_event_partner(s32 damageAmount, s32 event, s32 stopMotion) {
910 BattleStatus* battleStatus = &gBattleStatus;
911 Actor* partner = battleStatus->partnerActor;
912 ActorState* state = &partner->state;
913 s32 hpChange;
914 s32 flagCheck;
915
916 battleStatus->curAttackDamage = damageAmount;
917
918 hpChange = (s16)damageAmount;
919 partner->hpChangeCounter += hpChange;
920
921 hpChange = partner->hpChangeCounter;
922 partner->curHP = 127;
923 partner->damageCounter += hpChange;
924 partner->hpChangeCounter -= hpChange;
925 battleStatus->lastAttackDamage = 0;
926 partner->curHP -= hpChange;
927
928 if (partner->curHP <= 0) {
929 event = EVENT_DEATH;
930 battleStatus->lastAttackDamage += partner->curHP;
931 partner->curHP = 0;
932 }
933
934 battleStatus->lastAttackDamage += hpChange;
935 partner->lastDamageTaken = battleStatus->lastAttackDamage;
936 battleStatus->curDamageSource = DMG_SRC_DEFAULT;
938 if (event == EVENT_HIT_COMBO) {
939 event = EVENT_HIT;
940 }
941 if (event == EVENT_ZERO_DAMAGE) {
942 event = EVENT_IMMUNE;
943 }
944 }
945
946 if (battleStatus->lastAttackDamage > 0) {
948
949 inflict_status(partner, STATUS_KEY_DAZE, battleStatus->lastAttackDamage);
950 }
951
952 if (!stopMotion) {
954 }
955
956 show_next_damage_popup(state->goalPos.x, state->goalPos.y, state->goalPos.z,
957 battleStatus->lastAttackDamage, 1);
958 show_damage_fx(partner, state->goalPos.x, state->goalPos.y, state->goalPos.z,
959 battleStatus->lastAttackDamage);
960
961 if (battleStatus->lastAttackDamage > 0) {
962 set_actor_flash_mode(partner, 1);
963 }
964
966
969 return flagCheck;
970}
971
972s32 dispatch_damage_event_partner_0(s32 damageAmount, s32 event, s32 stopMotion) {
973 return dispatch_damage_event_partner(damageAmount, event, FALSE);
974}
975
976s32 dispatch_damage_event_partner_1(s32 damageAmount, s32 event) {
977 return dispatch_damage_event_partner(damageAmount, event, TRUE);
978}
979
980API_CALLABLE(MakeOwnerTargetIndex) {
981 Bytecode* args = script->ptrReadPos;
982 Actor* actor = get_actor(script->owner1.actorID);
983 s32 numTargets = actor->targetListLength;
984 s8* targetList = actor->targetIndexList;
985 s32 arg1 = evt_get_variable(script, *args++);
986 s32 arg2 = evt_get_variable(script, *args++);
987 s32 otherArg = *args++;
988 SelectableTarget* selectableTarget;
989
990 if (numTargets == 0) {
991 arg2 = -1;
992 } else {
993 if (arg2 != 0) {
994 if (arg2 >= numTargets) {
995 arg2 = numTargets - 1;
996 } else {
997 arg2--;
998 }
999 }
1000
1001 selectableTarget = &actor->targetData[targetList[arg2]];
1002 actor->targetActorID = selectableTarget->actorID;
1003 actor->targetPartID = selectableTarget->partID;
1004 }
1005
1006 evt_set_variable(script, otherArg, arg2);
1007 return ApiStatus_DONE2;
1008}
1009
1010API_CALLABLE(func_8027FC90) {
1011 Bytecode* args = script->ptrReadPos;
1012 BattleStatus* battleStatus = &gBattleStatus;
1013 s32 hitResult;
1014 Actor* actor;
1015 s32 actorID = evt_get_variable(script, *args++);
1016 s32 outVar;
1017
1018 if (actorID == ACTOR_SELF) {
1019 actorID = script->owner1.enemyID;
1020 }
1021
1022 outVar = *args++;
1023 actor = get_actor(actorID);
1024 battleStatus->flags1 |= BS_FLAGS1_TRIGGER_EVENTS;
1025
1026 hitResult = calc_partner_damage_enemy();
1027 show_next_damage_popup(actor->state.goalPos.x, actor->state.goalPos.y, actor->state.goalPos.z, battleStatus->lastAttackDamage,
1028 0);
1029 evt_set_variable(script, outVar, hitResult);
1030
1031 return ApiStatus_DONE2;
1032}
1033
1034API_CALLABLE(GetActorLevel) {
1035 Bytecode* args = script->ptrReadPos;
1036 s32 actorID = evt_get_variable(script, *args++);
1037 Bytecode outVar;
1038
1039 if (actorID == ACTOR_SELF) {
1040 actorID = script->owner1.enemyID;
1041 }
1042
1043 outVar = *args++;
1044 evt_set_variable(script, outVar, get_actor(actorID)->actorBlueprint->level);
1045
1046 return ApiStatus_DONE2;
1047}
1048
1049API_CALLABLE(PartnerDamageEnemy) {
1050 BattleStatus* battleStatus = &gBattleStatus;
1051 PlayerStatus* playerStatus = &gPlayerStatus;
1052 Bytecode* args = script->ptrReadPos;
1053 Actor* enemy = get_actor(script->owner1.enemyID);
1054 s32 temp_s4 = *args++;
1055 s32 flags;
1056 s32 damageResult;
1057 u8 statusChance;
1058
1064 flags = *args++;
1065
1066 #if DX_DEBUG_MENU
1067 if (dx_debug_is_cheat_enabled(DEBUG_CHEAT_GOD_MODE)) {
1068 battleStatus->curAttackDamage = 99;
1069 }
1070 #endif
1071
1073 battleStatus->flags1 |= BS_FLAGS1_INCLUDE_POWER_UPS;
1074 battleStatus->flags1 |= BS_FLAGS1_TRIGGER_EVENTS;
1075 } else if (flags & BS_FLAGS1_INCLUDE_POWER_UPS) {
1076 battleStatus->flags1 |= BS_FLAGS1_INCLUDE_POWER_UPS;
1077 battleStatus->flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1078 } else if (flags & BS_FLAGS1_TRIGGER_EVENTS) {
1079 battleStatus->flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1080 battleStatus->flags1 |= BS_FLAGS1_TRIGGER_EVENTS;
1081 } else {
1082 battleStatus->flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1083 battleStatus->flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1084 }
1085
1086 if (flags & BS_FLAGS1_NICE_HIT) {
1088 } else {
1089 gBattleStatus.flags1 &= ~BS_FLAGS1_NICE_HIT;
1090 }
1091
1092 if (flags & BS_FLAGS1_SUPER_HIT) {
1094 } else {
1095 gBattleStatus.flags1 &= ~BS_FLAGS1_SUPER_HIT;
1096 }
1097
1098 if (flags & BS_FLAGS1_NO_RATING) {
1100 } else {
1101 gBattleStatus.flags1 &= ~BS_FLAGS1_NO_RATING;
1102 }
1103
1106 } else {
1107 gBattleStatus.flags1 &= ~BS_FLAGS1_FORCE_IMMUNE_HIT;
1108 }
1109
1110 statusChance = battleStatus->curAttackStatus;
1111 battleStatus->curTargetID = enemy->targetActorID;
1112 battleStatus->curTargetPart = enemy->targetPartID;
1113 battleStatus->statusChance = statusChance;
1114
1115 if (statusChance == STATUS_KEY_NEVER) {
1116 battleStatus->statusChance = 0;
1117 }
1118
1119 battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8;
1120 damageResult = calc_partner_damage_enemy();
1121
1122 if (damageResult < 0) {
1123 return ApiStatus_FINISH;
1124 }
1125
1126 evt_set_variable(script, temp_s4, damageResult);
1127
1128 if (!does_script_exist_by_ref(script)) {
1129 return ApiStatus_FINISH;
1130 }
1131
1132 return ApiStatus_DONE2;
1133}
1134
1135API_CALLABLE(PartnerAfflictEnemy) {
1136 BattleStatus* battleStatus = &gBattleStatus;
1137 Bytecode* args = script->ptrReadPos;
1138 Actor* actor = get_actor(script->owner1.enemyID);
1139 s32 returnValue = *args++;
1140 s32 flags;
1141 u8 statusChance;
1142 s32 damageResult;
1143
1144 battleStatus->curAttackElement = *args++;
1145 battleStatus->curAttackEventSuppression = *args++;
1146 battleStatus->curAttackStatus = *args++;
1147 battleStatus->curAttackStatus |= evt_get_variable(script, *args++);
1148 battleStatus->curAttackDamage = evt_get_variable(script, *args++);
1149 battleStatus->powerBounceCounter = 0;
1150 flags = *args++;
1151
1153 battleStatus->flags1 |= BS_FLAGS1_INCLUDE_POWER_UPS;
1154 battleStatus->flags1 |= BS_FLAGS1_TRIGGER_EVENTS;
1155 } else if (flags & BS_FLAGS1_INCLUDE_POWER_UPS) {
1156 battleStatus->flags1 |= BS_FLAGS1_INCLUDE_POWER_UPS;
1157 battleStatus->flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1158 } else if (flags & BS_FLAGS1_TRIGGER_EVENTS) {
1159 battleStatus->flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1160 battleStatus->flags1 |= BS_FLAGS1_TRIGGER_EVENTS;
1161 } else {
1162 battleStatus->flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1163 battleStatus->flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1164 }
1165
1166 if (flags & BS_FLAGS1_NICE_HIT) {
1168 } else {
1169 gBattleStatus.flags1 &= ~BS_FLAGS1_NICE_HIT;
1170 }
1171 if (flags & BS_FLAGS1_SUPER_HIT) {
1173 } else {
1174 gBattleStatus.flags1 &= ~BS_FLAGS1_SUPER_HIT;
1175 }
1176 if (flags & BS_FLAGS1_NO_RATING) {
1178 } else {
1179 gBattleStatus.flags1 &= ~BS_FLAGS1_NO_RATING;
1180 }
1183 } else {
1184 gBattleStatus.flags1 &= ~BS_FLAGS1_FORCE_IMMUNE_HIT;
1185 }
1186
1187 statusChance = battleStatus->curAttackStatus;
1188 battleStatus->curTargetID = actor->targetActorID;
1189 battleStatus->curTargetPart = actor->targetPartID;
1190 battleStatus->statusChance = statusChance;
1191
1192 if (statusChance == STATUS_KEY_NEVER) {
1193 battleStatus->statusChance = 0;
1194 }
1195
1196 battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8;
1197 damageResult = calc_partner_damage_enemy();
1198
1199 if (damageResult < 0) {
1200 return ApiStatus_FINISH;
1201 }
1202
1203 evt_set_variable(script, returnValue, damageResult);
1204
1205 if (!does_script_exist_by_ref(script)) {
1206 return ApiStatus_FINISH;
1207 }
1208
1209 return ApiStatus_DONE2;
1210}
1211
1212API_CALLABLE(PartnerPowerBounceEnemy) {
1213 BattleStatus* battleStatus = &gBattleStatus;
1214 Bytecode* args = script->ptrReadPos;
1215 Actor* actor = get_actor(script->owner1.enemyID);
1216 s32 returnValue = *args++;
1217 s32 flags;
1218 u8 statusChance;
1219 s32 damageResult;
1220
1221 battleStatus->curAttackElement = *args++;
1222 battleStatus->curAttackEventSuppression = *args++;
1223 battleStatus->curAttackStatus = *args++;
1224 battleStatus->curAttackDamage = evt_get_variable(script, *args++);
1225 battleStatus->powerBounceCounter = evt_get_variable(script, *args++);
1226 flags = *args++;
1227
1229 battleStatus->flags1 |= BS_FLAGS1_INCLUDE_POWER_UPS;
1230 battleStatus->flags1 |= BS_FLAGS1_TRIGGER_EVENTS;
1231 } else if (flags & BS_FLAGS1_INCLUDE_POWER_UPS) {
1232 battleStatus->flags1 |= BS_FLAGS1_INCLUDE_POWER_UPS;
1233 battleStatus->flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1234 } else if (flags & BS_FLAGS1_TRIGGER_EVENTS) {
1235 battleStatus->flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1236 battleStatus->flags1 |= BS_FLAGS1_TRIGGER_EVENTS;
1237 } else {
1238 battleStatus->flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1239 battleStatus->flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1240 }
1241
1242 if (flags & BS_FLAGS1_NICE_HIT) {
1244 } else {
1245 gBattleStatus.flags1 &= ~BS_FLAGS1_NICE_HIT;
1246 }
1247 if (flags & BS_FLAGS1_SUPER_HIT) {
1249 } else {
1250 gBattleStatus.flags1 &= ~BS_FLAGS1_SUPER_HIT;
1251 }
1252 if (flags & BS_FLAGS1_NO_RATING) {
1254 } else {
1255 gBattleStatus.flags1 &= ~BS_FLAGS1_NO_RATING;
1256 }
1259 } else {
1260 gBattleStatus.flags1 &= ~BS_FLAGS1_FORCE_IMMUNE_HIT;
1261 }
1262
1263 statusChance = battleStatus->curAttackStatus;
1264 battleStatus->curTargetID = actor->targetActorID;
1265 battleStatus->curTargetPart = actor->targetPartID;
1266 battleStatus->statusChance = statusChance;
1267
1268 if (statusChance == STATUS_KEY_NEVER) {
1269 battleStatus->statusChance = 0;
1270 }
1271
1272 battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8;
1273 damageResult = calc_partner_damage_enemy();
1274
1275 if (damageResult < 0) {
1276 return ApiStatus_FINISH;
1277 }
1278
1279 evt_set_variable(script, returnValue, damageResult);
1280
1281 if (!does_script_exist_by_ref(script)) {
1282 return ApiStatus_FINISH;
1283 }
1284
1285 return ApiStatus_DONE2;
1286}
1287
1288API_CALLABLE(PartnerTestEnemy) {
1289 BattleStatus* battleStatus = &gBattleStatus;
1290 PlayerStatus* playerStatus = &gPlayerStatus;
1291 Bytecode* args = script->ptrReadPos;
1292 Actor* enemy = get_actor(script->owner1.enemyID);
1293 s32 outVar;
1294 s32 flags;
1295 s32 damageResult;
1296 u8 statusChance;
1297
1298 outVar = *args++;
1304 flags = *args++;
1305
1307 battleStatus->flags1 |= BS_FLAGS1_INCLUDE_POWER_UPS;
1308 battleStatus->flags1 |= BS_FLAGS1_TRIGGER_EVENTS;
1309 } else if (flags & BS_FLAGS1_INCLUDE_POWER_UPS) {
1310 battleStatus->flags1 |= BS_FLAGS1_INCLUDE_POWER_UPS;
1311 battleStatus->flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1312 } else if (flags & BS_FLAGS1_TRIGGER_EVENTS) {
1313 battleStatus->flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1314 battleStatus->flags1 |= BS_FLAGS1_TRIGGER_EVENTS;
1315 } else {
1316 battleStatus->flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1317 battleStatus->flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1318 }
1319
1320 if (flags & BS_FLAGS1_NICE_HIT) {
1322 } else {
1323 gBattleStatus.flags1 &= ~BS_FLAGS1_NICE_HIT;
1324 }
1325
1326 if (flags & BS_FLAGS1_SUPER_HIT) {
1328 } else {
1329 gBattleStatus.flags1 &= ~BS_FLAGS1_SUPER_HIT;
1330 }
1331
1332 if (flags & BS_FLAGS1_NO_RATING) {
1334 } else {
1335 gBattleStatus.flags1 &= ~BS_FLAGS1_NO_RATING;
1336 }
1337
1340 } else {
1341 gBattleStatus.flags1 &= ~BS_FLAGS1_FORCE_IMMUNE_HIT;
1342 }
1343
1344 statusChance = battleStatus->curAttackStatus;
1345 battleStatus->curTargetID = enemy->targetActorID;
1346 battleStatus->curTargetPart = enemy->targetPartID;
1347 battleStatus->statusChance = statusChance;
1348
1349 if (statusChance == STATUS_KEY_NEVER) {
1350 battleStatus->statusChance = 0;
1351 }
1352
1353 battleStatus->statusDuration = (battleStatus->curAttackStatus & 0xF00) >> 8;
1354 damageResult = calc_partner_test_enemy();
1355
1356 if (damageResult < 0) {
1357 return ApiStatus_FINISH;
1358 }
1359
1360 evt_set_variable(script, outVar, damageResult);
1361
1362 return ApiStatus_DONE2;
1363}
1364
1365API_CALLABLE(func_8028070C) {
1366 BattleStatus* battleStatus = &gBattleStatus;
1367 Bytecode* args = script->ptrReadPos;
1368 Actor* actor = get_actor(script->owner1.actorID);
1369 s32 damageAmount = evt_get_variable(script, *args++);
1370 s32 event = evt_get_variable(script, *args++);
1371
1372 battleStatus->curTargetID = actor->targetActorID;
1373 battleStatus->curTargetPart = actor->targetPartID;
1374
1375 if (dispatch_damage_event_partner_0(damageAmount, event, (s32) battleStatus) >= 0) {
1377 }
1378
1379 return ApiStatus_BLOCK;
1380}
1381
1382API_CALLABLE(DeletePartner) {
1383 BattleStatus* battleStatus = &gBattleStatus;
1384
1385 btl_delete_actor(battleStatus->partnerActor);
1386 return ApiStatus_DONE2;
1387}
1388
1389API_CALLABLE(GetPartnerActionSuccess) {
1390 BattleStatus* battleStatus = &gBattleStatus;
1391 s32 var = *script->ptrReadPos;
1392 s32 actionSuccess = battleStatus->actionSuccess;
1393 s32 outVal = 0;
1394
1395 if (actionSuccess < outVal) {
1396 actionSuccess = outVal;
1397 }
1398
1399 if (actionSuccess > outVal) {
1400 outVal = actionSuccess;
1401 }
1402
1403 evt_set_variable(script, var, outVal);
1404 return ApiStatus_DONE2;
1405}
1406
1408API_CALLABLE(PartnerYieldTurn) {
1410 return ApiStatus_DONE2;
1411}
struct Evt * takeTurnScript
s8 transparentStatus
EvtScript * handleEventSource
s16 lastDamageTaken
struct ActorBlueprint * actorBlueprint
s32 elementalImmunities
s32 actorTypeData1[6]
ActorState state
s16 damageCounter
struct Evt * handleEventScript
s32 takeTurnScriptID
struct SelectableTarget targetData[24]
s16 targetActorID
s32 handleEventScriptID
union Evt::@8 owner1
Initially -1.
s8 targetIndexList[24]
s16 hpChangeCounter
Bytecode EvtScript[]
s8 targetListLength
s8 flags
Definition demo_api.c:15
HitResult calc_partner_test_enemy(void)
Definition dmg_partner.c:48
#define INFLICT_STATUS(STATUS_TYPE)
s32 dispatch_damage_event_partner_0(s32 damageAmount, s32 event, s32 stopMotion)
s32 dispatch_damage_event_partner_1(s32, s32)
HitResult calc_partner_damage_enemy(void)
s32 dispatch_damage_event_partner(s32 damageAmount, s32 event, s32 stopMotion)
void dispatch_event_partner_continue_turn(s8 lastEventType)
Definition dmg_partner.c:30
void dispatch_event_partner(s32 lastEventType)
Definition dmg_partner.c:7
#define sfx_play_sound_at_position
#define rand_int
#define ASSERT(condition)
@ ACTION_RATING_SUPER
sets nice hits = 2
Definition enums.h:1982
@ ACTION_RATING_NICE
sets nice hits = 1
Definition enums.h:1979
@ BS_FLAGS1_TUTORIAL_BATTLE
Definition enums.h:3594
@ BS_FLAGS1_NO_RATING
Definition enums.h:3577
@ BS_FLAGS1_FORCE_IMMUNE_HIT
Definition enums.h:3580
@ BS_FLAGS1_SUPER_HIT
Definition enums.h:3579
@ BS_FLAGS1_YIELD_TURN
Definition enums.h:3590
@ BS_FLAGS1_NICE_HIT
Definition enums.h:3576
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3575
@ BS_FLAGS1_SHOW_PLAYER_DECORATIONS
Definition enums.h:3568
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3571
@ BS_FLAGS1_ACTORS_VISIBLE
Definition enums.h:3565
@ ACTOR_EVENT_FLAG_STAR_ROD_ENCHANTED
Actor glows and listens for Star Beam and Peach Beam events.
Definition enums.h:3386
@ ACTOR_EVENT_FLAG_GROUNDABLE
Actor can be knocked down from flight; triggered by jump attacks.
Definition enums.h:3382
@ ACTOR_EVENT_FLAG_FIRE_EXPLODE
Fire attacks trigger an explosion, used only by bullet/bombshell bills.
Definition enums.h:3378
@ ACTOR_EVENT_FLAG_POWER_BOUNCE
Actor listens for Power Bounce events.
Definition enums.h:3387
@ ACTOR_EVENT_FLAG_ELECTRIFIED
Player takes shock damage upon contact.
Definition enums.h:3375
@ ACTOR_EVENT_FLAG_SPIKY_FRONT
Player takes spike damage from hammer attacks.
Definition enums.h:3384
@ ACTOR_EVENT_FLAG_EXPLODE_ON_CONTACT
Attacks that contact will trigger an explosion.
Definition enums.h:3383
@ ACTOR_EVENT_FLAG_FIREY
Player takes burn damage upon contact.
Definition enums.h:3371
@ ACTOR_EVENT_FLAG_BURIED
Actor can only by hit by quake-element attacks.
Definition enums.h:3379
@ ACTOR_EVENT_FLAG_ALT_SPIKY
Additional spiky quality associated with Pokeys and Spinies.
Definition enums.h:3388
@ ACTOR_EVENT_FLAG_FLIPABLE
Actor can be flipped; triggered by jump and quake attacks.
Definition enums.h:3380
@ ACTOR_EVENT_FLAG_EXPLODE_ON_IGNITION
Blast and fire attacks trigger an explosion.
Definition enums.h:3377
@ ACTOR_EVENT_FLAG_ILLUSORY
Player attacks pass through and miss.
Definition enums.h:3374
@ ACTOR_EVENT_FLAG_SPIKY_TOP
Player takes spike damage from jump attacks.
Definition enums.h:3373
@ ACTOR_EVENT_FLAG_ENCHANTED
Actor glows and listens for the Star Beam event.
Definition enums.h:3385
@ ACTOR_PART_TARGET_NO_DAMAGE
Definition enums.h:1877
@ STATUS_KEY_PARALYZE
Definition enums.h:2201
@ STATUS_KEY_FROZEN
Definition enums.h:2203
@ STATUS_KEY_TRANSPARENT
Definition enums.h:2210
@ STATUS_KEY_STATIC
Definition enums.h:2207
@ STATUS_KEY_FEAR
Definition enums.h:2199
@ STATUS_KEY_SLEEP
Definition enums.h:2202
@ STATUS_KEY_STONE
Definition enums.h:2208
@ STATUS_KEY_STOP
Definition enums.h:2204
@ STATUS_KEY_SHRINK
Definition enums.h:2206
@ STATUS_KEY_DIZZY
Definition enums.h:2200
@ STATUS_KEY_DAZE
Definition enums.h:2209
HitResult
Definition enums.h:1948
@ HIT_RESULT_LANDED_ON_SPIKE
Definition enums.h:1954
@ HIT_RESULT_BACKFIRE
Definition enums.h:1949
@ HIT_RESULT_NO_DAMAGE
Definition enums.h:1952
@ HIT_RESULT_HIT
Definition enums.h:1950
@ HIT_RESULT_IMMUNE
Definition enums.h:1958
@ HIT_RESULT_NICE_NO_DAMAGE
Definition enums.h:1953
@ HIT_RESULT_NICE
Definition enums.h:1951
@ HIT_RESULT_MISS
Definition enums.h:1956
@ SUPPRESS_EVENT_EXPLODE_CONTACT
Definition enums.h:2901
@ SUPPRESS_EVENT_SPIKY_TOP
Definition enums.h:2900
@ SUPPRESS_EVENT_ALT_SPIKY
Definition enums.h:2905
@ SUPPRESS_EVENT_SHOCK_CONTACT
Definition enums.h:2903
@ SUPPRESS_EVENT_SPIKY_FRONT
Definition enums.h:2902
@ SUPPRESS_EVENT_BURN_CONTACT
Definition enums.h:2904
@ STATUS_FLAG_STOP
Definition enums.h:2821
@ STATUS_FLAG_FROZEN
Definition enums.h:2814
@ STATUS_FLAG_400000
Definition enums.h:2822
@ STATUS_FLAG_SHRINK
Definition enums.h:2819
@ STATUS_FLAG_PARALYZE
Definition enums.h:2816
@ STATUS_FLAG_DIZZY
Definition enums.h:2818
@ STATUS_FLAG_SLEEP
Definition enums.h:2812
@ STATUS_FLAG_POISON
Definition enums.h:2817
@ DMG_SRC_DEFAULT
Definition enums.h:1988
@ ABILITY_SPIKE_SHIELD
Definition enums.h:438
@ SOUND_IMMUNE
Definition enums.h:745
@ SOUND_DAMAGE_STARS
Definition enums.h:950
@ SOUND_INFLICT_STATUS
Definition enums.h:1355
@ SOUND_HIT_SPIKE
Definition enums.h:743
@ SOUND_HIT_NORMAL
Definition enums.h:724
@ SOUND_SMACK_TREE
Definition enums.h:787
@ SOUND_HIT_SHOCK
Definition enums.h:1195
@ SOUND_HIT_ICE
Definition enums.h:726
@ SOUND_HIT_FIRE
Definition enums.h:725
@ SOUND_INFLICT_SLEEP
Definition enums.h:1354
@ ACTOR_PARTNER
Definition enums.h:2086
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_NO_DMG_POPUP
Hide damage popup.
Definition enums.h:3341
@ ACTOR_FLAG_HEALTH_BAR_HIDDEN
Definition enums.h:3338
@ ACTOR_FLAG_UPSIDE_DOWN
HP bar offset below actor (e.g. Swooper when upside-down).
Definition enums.h:3331
@ ACTOR_FLAG_FLIPPED
Actor has been flipped over.
Definition enums.h:3330
@ SOUND_SPACE_DEFAULT
Definition enums.h:1737
@ EVENT_HIT
Definition enums.h:2132
@ EVENT_SCARE_AWAY
Definition enums.h:2174
@ EVENT_BURN_HIT
Definition enums.h:2136
@ EVENT_SPIKE_CONTACT
Definition enums.h:2163
@ EVENT_POWER_BOUNCE_DEATH
Definition enums.h:2161
@ EVENT_IMMUNE
Definition enums.h:2146
@ EVENT_FALL_TRIGGER
Definition enums.h:2134
@ EVENT_BURN_DEATH
Definition enums.h:2157
@ EVENT_ZERO_DAMAGE
Definition enums.h:2144
@ EVENT_SPIN_SMASH_HIT
Definition enums.h:2133
@ EVENT_EXPLODE_TRIGGER
Definition enums.h:2155
@ EVENT_SPIN_SMASH_DEATH
Definition enums.h:2154
@ EVENT_HIT_COMBO
Definition enums.h:2131
@ EVENT_SPIKE_TAUNT
Definition enums.h:2148
@ EVENT_BEGIN_AIR_LIFT
Definition enums.h:2175
@ EVENT_POWER_BOUNCE_HIT
Definition enums.h:2142
@ EVENT_DEATH
Definition enums.h:2153
@ EVENT_FLIP_TRIGGER
Definition enums.h:2135
@ EVENT_SHOCK_HIT
Definition enums.h:2165
@ EVENT_BURN_CONTACT
Definition enums.h:2164
@ EVENT_BURN_TAUNT
Definition enums.h:2149
@ ACTOR_PART_FLAG_DAMAGE_IMMUNE
electrified Plays extra hurt SFX?
Definition enums.h:3358
@ DAMAGE_TYPE_SPIN_SMASH
Definition enums.h:2876
@ DAMAGE_TYPE_ICE
Definition enums.h:2854
@ DAMAGE_TYPE_STATUS_ALWAYS_HITS
Definition enums.h:2880
@ DAMAGE_TYPE_SMASH
Definition enums.h:2857
@ DAMAGE_TYPE_POWER_BOUNCE
Definition enums.h:2870
@ DAMAGE_TYPE_IGNORE_DEFENSE
Definition enums.h:2877
@ DAMAGE_TYPE_SHOCK
Definition enums.h:2856
@ DAMAGE_TYPE_BLAST
Definition enums.h:2860
@ DAMAGE_TYPE_FIRE
Definition enums.h:2852
@ DAMAGE_TYPE_AIR_LIFT
Definition enums.h:2866
@ DAMAGE_TYPE_QUAKE
Definition enums.h:2862
@ DAMAGE_TYPE_JUMP
Definition enums.h:2858
@ DAMAGE_TYPE_FEAR
Definition enums.h:2863
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2878
@ DAMAGE_TYPE_MULTIPLE_POPUPS
Definition enums.h:2879
@ DAMAGE_TYPE_WATER
Definition enums.h:2853
@ EVT_PRIORITY_A
Definition evt.h:153
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
#define ApiStatus_FINISH
Definition evt.h:120
#define ApiStatus_BLOCK
Definition evt.h:116
@ EVT_FLAG_RUN_IMMEDIATELY
don't wait for next update_scripts call
Definition evt.h:161
void show_primary_damage_popup(f32 x, f32 y, f32 z, s32 attack, s32 a)
Definition 190B20.c:2269
s32 does_script_exist_by_ref(Evt *script)
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1690
s32 player_team_is_ability_active(Actor *actor, s32 ability)
Definition 190B20.c:2765
void show_immune_bonk(f32 x, f32 y, f32 z, s32, s32, s32)
void dispatch_event_actor(Actor *, s32)
Definition 1A5830.c:103
void show_actor_health_bar(Actor *)
Definition 190B20.c:2505
void clear_part_pal_adjustment(ActorPart *)
Definition 190B20.c:2618
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
Definition evt.c:1847
void set_actor_flash_mode(Actor *actor, s32 arg1)
Definition 190B20.c:2696
void show_damage_fx(Actor *actor, f32 x, f32 y, f32 z, s32 damage)
Definition 190B20.c:2334
Evt * start_script(EvtScript *source, s32 priority, s32 initialState)
s32 inflict_status(Actor *, s32, s32)
Definition 190B20.c:2084
ActorPart * get_actor_part(Actor *actor, s32 partID)
Definition 190B20.c:1191
s32 get_defense(Actor *actor, s32 *defenseTable, s32 elementFlags)
Definition 190B20.c:2219
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
void kill_script_by_ID(s32 id)
void func_80266970(Actor *)
Definition 190B20.c:2439
void set_goal_pos_to_part(ActorState *state, s32 actorID, s32 partID)
Definition actor_api.c:44
void btl_delete_actor(Actor *actor)
Definition 16C8E0.c:1111
void show_next_damage_popup(f32 x, f32 y, f32 z, s32 damageAmount, s32)
Definition 190B20.c:2295
void apply_shock_effect(Actor *)
void show_action_rating(s32, Actor *, f32, f32, f32)
Definition 190B20.c:2360
EvtScript EVS_PlayStopHitFX
Definition dmg_player.c:109
EvtScript EVS_PlayFreezeHitFX
Definition dmg_player.c:115
EvtScript EVS_PlayShrinkHitFX
Definition dmg_player.c:125
EvtScript EVS_PlayParalyzeHitFX
Definition dmg_player.c:97
EvtScript EVS_PlayPoisonHitFX
Definition dmg_player.c:103
EvtScript EVS_PlaySleepHitFX
Definition dmg_player.c:85
EvtScript EVS_PlayDizzyHitFX
Definition dmg_player.c:91
#define STATUS_KEY_NEVER
Definition macros.h:223
struct Actor * partnerActor
s32 curAttackEventSuppression
BattleStatus gBattleStatus
Definition battle.c:11
PlayerStatus gPlayerStatus
Definition 77480.c:39