240 {
249 s32 hitResult;
250 s32 currentAttackDamage;
251 s32 targetDefense;
252 s32 dispatchEvent;
253 s32 partImmuneToElement;
254 s32 canBeShocked;
255 s32 missedAllOrNothing;
256 s32 isFireDamage;
257 s32 isShockDamage;
258 s32 isWaterDamage;
259 s32 isIceDamage;
260 s32 wasSpecialHit;
261 s32 wasStatusInflicted;
262 s32 attackFxType;
263
264 canBeShocked = FALSE;
265 isFireDamage = FALSE;
266 isWaterDamage = FALSE;
267 isShockDamage = FALSE;
268 isIceDamage = FALSE;
269 wasSpecialHit = FALSE;
270 partImmuneToElement = FALSE;
271 wasStatusInflicted = FALSE;
272 missedAllOrNothing = FALSE;
273
280 state = &player->
state;
281
282 if (target == NULL) {
284 }
285
287
288 ASSERT(targetPart != NULL);
289
291
295 } else {
299 }
300 }
301
305 ) {
307 }
308
315 } else {
317 }
318 }
319
321 partImmuneToElement = TRUE;
322 }
323
324
328 {
333 }
334
335
342 }
343
348 ) {
353 }
354 }
355
356
360 ) {
365 } else {
367 }
368 }
369
370
375 ) {
380 }
381
384 isFireDamage = TRUE;
385 }
386
389 isShockDamage = TRUE;
390 }
391
394 isWaterDamage = TRUE;
395 }
396
399 isIceDamage = TRUE;
400 }
401
403
404 if (attackFxType) {
406
407 switch (attackFxType) {
408 case 1:
410 break;
411 case 2:
413 break;
414 case 3:
416 break;
417 case 4:
419 break;
420 case 5:
422 break;
423 case 6:
425 break;
426 }
427 }
428
434 ) {
436 canBeShocked = TRUE;
437 }
438
441 }
442
444
447 }
448
450 targetDefense += 127;
451 }
452
455
458 ) {
460 }
461
463 currentAttackDamage += battleStatus->
jumpCharge;
465 }
466
470 }
471
472 if (battleStatus->
unk_98 != 0) {
473 currentAttackDamage += 2;
474 }
475
477 currentAttackDamage += 2;
478 }
479
481 currentAttackDamage++;
482 }
483
485 currentAttackDamage--;
486 }
487
489 currentAttackDamage++;
490 }
491
493
496 currentAttackDamage--;
497
498 if (currentAttackDamage < 0) {
500 }
501
503
506 }
507 }
508
511 currentAttackDamage -= 2;
512
513 if (currentAttackDamage < 0) {
515 }
516
518
521 }
522 }
523
526 ) {
528 currentAttackDamage += 2;
529 }
530
532 currentAttackDamage += 4;
533 }
535 }
536
539 ) {
540 currentAttackDamage++;
541
543 missedAllOrNothing = TRUE;
544 currentAttackDamage = 0;
545#if !VERSION_JP
546 targetDefense = 0;
547#endif
552 }
553 }
554
556 if (currentAttackDamage > 0) {
557 currentAttackDamage /= 2;
558
559 if (currentAttackDamage == 0) {
560 currentAttackDamage = 1;
561 }
562 }
563 }
564
568 ) {
569 targetDefense = 0;
570 currentAttackDamage = target->
curHP;
571 }
572
574 targetDefense = 0;
575 currentAttackDamage = 0;
576 }
577
578 if (currentAttackDamage > 99) {
579 currentAttackDamage = 99;
580 }
581
582 if (currentAttackDamage < 0) {
583 targetDefense = 0;
584 }
585
587 currentAttackDamage -= targetDefense;
588
589 if (currentAttackDamage < 0) {
590 currentAttackDamage = 0;
591 }
592
595
596 if (currentAttackDamage < 1) {
597 currentAttackDamage = 1;
598 }
599 }
600
602
603 if (currentAttackDamage < 1) {
606
610 } else {
611 if (target->
curHP < 1) {
613 } else {
615 }
616 }
617
619 } else {
624
627 && !partImmuneToElement
629 ) {
630 target->
curHP -= currentAttackDamage;
631
632 if (target->
curHP < 1) {
635 }
636 }
637
641 }
642
650 ) {
655 } else {
658 } else {
660 }
666 } else {
668 }
669 }
670 }
671
682 ) {
686 } else {
688 }
689 }
690 }
691 }
692
696 }
697
700 }
701
702 if (target->
curHP < 1) {
705 }
706 }
709 }
710
713 }
714
715
717
720
725 ) {
728 }
729
732 }
733
736 }
737
740 }
741
744 }
745 }
746 }
747
748
752 ) {
755 }
756
759 }
760
763 }
764
767 }
768
771 }
772 }
773
774
778 ) {
781 }
782
785 }
786
787 wasSpecialHit = TRUE;
788 }
789
790
794 ) {
797 }
798
801 }
802
804 wasSpecialHit = TRUE;
805 }
806 }
807 }
808
809
813 ) {
816 }
817
820 }
821
823 wasSpecialHit = TRUE;
824 }
825 }
826
827
831 ) {
834 }
835
838 }
839 wasSpecialHit = TRUE;
840 }
841
842
845 ) {
848 }
849
852 }
853
854 isFireDamage = TRUE;
855 }
856
857
864 ) {
865 #define INFLICT_STATUS(STATUS_TYPE) \
866 if ((battleStatus->curAttackStatus & STATUS_FLAG_##STATUS_TYPE) && \
867 try_inflict_status(target, STATUS_KEY_##STATUS_TYPE, STATUS_TURN_MOD_##STATUS_TYPE)) { \
868 wasSpecialHit = TRUE; \
869 wasStatusInflicted = TRUE; \
870 } \
871
881
882 #undef INFLICT_STATUS
883
884 if (wasStatusInflicted) {
887 }
888
891 }
892 }
893 }
894
897
900 if (!wasSpecialHit && !wasStatusInflicted) {
902 }
903 } else if (!partImmuneToElement) {
906 } else {
908 }
909
912 }
913 }
914 }
915
920 }
921
924 }
925
929 } else {
931 }
932 }
933 }
934 }
935
936 if (missedAllOrNothing) {
938 }
939
942 }
943
944 if ((battleStatus->
lastAttackDamage > 0 || wasSpecialHit) && !partImmuneToElement) {
946
947 if (isFireDamage) {
949 } else if (isShockDamage) {
951 } else if (isIceDamage) {
953 } else {
955 }
956 }
957
960 }
961
964 evt->varTable[0] = state->
goalPos.
x;
965 evt->varTable[1] = state->
goalPos.
y;
966 evt->varTable[2] = state->
goalPos.
z;
968 }
969
972 evt->varTable[0] = state->
goalPos.
x;
973 evt->varTable[1] = state->
goalPos.
y;
974 evt->varTable[2] = state->
goalPos.
z;
976 }
977
980 evt->varTable[0] = state->
goalPos.
x;
981 evt->varTable[1] = state->
goalPos.
y;
982 evt->varTable[2] = state->
goalPos.
z;
984 }
985
988 evt->varTable[0] = state->
goalPos.
x;
989 evt->varTable[1] = state->
goalPos.
y;
990 evt->varTable[2] = state->
goalPos.
z;
992 }
993
996 evt->varTable[0] = state->
goalPos.
x;
997 evt->varTable[1] = state->
goalPos.
y;
998 evt->varTable[2] = state->
goalPos.
z;
1000 }
1001
1004 evt->varTable[0] = state->
goalPos.
x;
1005 evt->varTable[1] = state->
goalPos.
y;
1006 evt->varTable[2] = state->
goalPos.
z;
1007 evt->varTablePtr[3] = target;
1009 }
1010
1013 evt->varTable[0] = state->
goalPos.
x;
1014 evt->varTable[1] = state->
goalPos.
y;
1015 evt->varTable[2] = state->
goalPos.
z;
1016 evt->varTablePtr[3] = target;
1018 }
1019
1022 }
1023
1025
1029 }
1032 }
1033 }
1034
1040 ) {
1045 }
1046
1047 return hitResult;
1048}
struct ActorBlueprint * actorBlueprint
EvtScript EVS_PlayStopHitFX
#define INFLICT_STATUS(STATUS_TYPE)
EvtScript EVS_PlayFreezeHitFX
EvtScript EVS_PlayShrinkHitFX
EvtScript EVS_PlayParalyzeHitFX
EvtScript EVS_PlayPoisonHitFX
EvtScript EVS_PlaySleepHitFX
EvtScript EVS_PlayDizzyHitFX
@ ACTION_RATING_NICE_SUPER_COMBO
'Nice' but becomes 'Super' if nice hits > 2
@ ACTION_RATING_MISS
clears nice hits
@ ACTION_RATING_NICE
sets nice hits = 1
@ BS_FLAGS1_TUTORIAL_BATTLE
@ BS_FLAGS1_FORCE_IMMUNE_HIT
@ BS_FLAGS1_TRIGGER_EVENTS
@ BS_FLAGS1_INCLUDE_POWER_UPS
@ ACTOR_EVENT_FLAG_STAR_ROD_ENCHANTED
Actor glows and listens for Star Beam and Peach Beam events.
@ ACTOR_EVENT_FLAG_GROUNDABLE
Actor can be knocked down from flight; triggered by jump attacks.
@ ACTOR_EVENT_FLAG_FIRE_EXPLODE
Fire attacks trigger an explosion, used only by bullet/bombshell bills.
@ ACTOR_EVENT_FLAG_POWER_BOUNCE
Actor listens for Power Bounce events.
@ ACTOR_EVENT_FLAG_ELECTRIFIED
Player takes shock damage upon contact.
@ ACTOR_EVENT_FLAG_EXTREME_DEFENSE
Actor has 127 extra defense during damage calculation, unaffected by IGNORE_DEFENSE.
@ ACTOR_EVENT_FLAG_EXPLODE_ON_CONTACT
Attacks that contact will trigger an explosion.
@ ACTOR_EVENT_FLAG_FIREY
Player takes burn damage upon contact.
@ ACTOR_EVENT_FLAG_ALT_SPIKY
Additional spiky quality associated with Pokeys and Spinies.
@ ACTOR_EVENT_FLAG_FLIPABLE
Actor can be flipped; triggered by jump and quake attacks.
@ ACTOR_EVENT_FLAG_EXPLODE_ON_IGNITION
Blast and fire attacks trigger an explosion.
@ ACTOR_EVENT_FLAG_ENCHANTED
Actor glows and listens for the Star Beam event.
@ ACTOR_PART_TARGET_NO_DAMAGE
@ BS_FLAGS2_IS_FIRST_STRIKE
@ BS_FLAGS2_HAS_DRAINED_HP
@ HIT_RESULT_NICE_NO_DAMAGE
@ SUPPRESS_EVENT_ALT_SPIKY
@ SUPPRESS_EVENT_SHOCK_CONTACT
@ SUPPRESS_EVENT_BURN_CONTACT
@ SOUND_SLIDE_WHISTLE_OUT
@ SOUND_LIFE_SHROOM_CHIME
@ ACTOR_FLAG_NO_DMG_POPUP
Hide damage popup.
@ ACTOR_FLAG_FLIPPED
Actor has been flipped over.
@ EVENT_POWER_BOUNCE_DEATH
@ ACTOR_PART_FLAG_DAMAGE_IMMUNE
electrified Plays extra hurt SFX?
@ DAMAGE_TYPE_MULTI_BOUNCE
@ DAMAGE_TYPE_SHELL_CRACK
@ DAMAGE_TYPE_STATUS_ALWAYS_HITS
@ DAMAGE_TYPE_POWER_BOUNCE
@ DAMAGE_TYPE_IGNORE_DEFENSE
@ DAMAGE_TYPE_QUAKE_HAMMER
@ DAMAGE_TYPE_MULTIPLE_POPUPS
void show_primary_damage_popup(f32 x, f32 y, f32 z, s32 attack, s32 a)
s32 is_ability_active(s32 arg0)
void show_immune_bonk(f32 x, f32 y, f32 z, s32, s32, s32)
s32 count_power_plus(s32)
void show_actor_health_bar(Actor *)
void clear_part_pal_adjustment(ActorPart *)
s32 get_defense(Actor *actor, s32 *defenseTable, s32 elementFlags)
void func_80266970(Actor *)
void apply_shock_effect(Actor *)
void show_action_rating(s32, Actor *, f32, f32, f32)
void sfx_play_sound(s32 soundID)