162 {
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;
179 s32 statusChanceOrDefense;
180 s32 damageDealt;
181 s32 dispatchEvent;
182
189 state = &partner->
state;
190
191 if (target == NULL) {
193 }
194
196
197 ASSERT(targetPart != NULL);
198
200
205 } else {
209 ) {
211 }
212
217
220 } else {
222 }
223 }
224
226 partImmuneToElement = TRUE;
227 }
228
229
232 ) {
237 }
238
239
242 ) {
244
249 }
250
252
255 } else {
257 }
258 }
259
260
264 ) {
269 }
270
271
275 ) {
280 }
281
282
286 ) {
289
292 } else {
294 }
295 }
296
297
302 ) {
307 }
308
309
314 ) {
319 }
320
321
325 ) {
328
331 } else {
333 }
334 }
335
336
342 ) {
347 } else {
349 }
350 }
351
354 isFireDamage = TRUE;
355 }
356
359 isShockDamage = TRUE;
360 }
361
364 isWaterDamage = TRUE;
365 }
366
369 isIceDamage = TRUE;
370 }
371
376 ) {
378 }
379
382 }
383
385
388 }
389
391
395 ) {
396 statusChanceOrDefense = 0;
397 damageDealt = target->
curHP;
398 }
399 }
400
402 statusChanceOrDefense = 0;
403 damageDealt = 0;
404 }
405
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;
426
427 if (damageDealt < 0) {
428 damageDealt = 0;
429 }
430
433
434 if (damageDealt < 1) {
435 damageDealt = 1;
436 }
437 }
438
440
441 if (damageDealt < 1) {
443
448 } else {
450 if (target->
curHP < 1) {
452 } else {
454 }
455 }
456
458 } else {
464
467 && !partImmuneToElement
469 ) {
470 target->
curHP -= damageDealt;
471
472 if (target->
curHP < 1) {
475 }
476 }
477
481 }
482
488 ) {
495 } else {
497 }
498 }
499
504 }
505 }
506
510 }
511
514 }
515
516 if (target->
curHP < 1) {
519 }
520 }
523 }
524
527 }
528
533 }
534
537 }
538
539 wasSpecialHit = TRUE;
540 }
541
546 }
547
550 }
551
554 }
555
558 }
559
562 }
563 }
564
569 }
570
573 }
574
575 wasSpecialHit = TRUE;
576 }
577
582 }
583
586 }
587
589 wasSpecialHit = TRUE;
590 }
591 }
592 }
593 }
594 }
595 }
596
600 ) {
603 }
604
607 }
608
610 wasSpecialHit = TRUE;
611 }
612 }
613
617 ) {
620 }
621
624 }
625
628 }
629
630 wasSpecialHit = TRUE;
631 isFireDamage = TRUE;
632 }
633
638 }
639
642 }
643
644 isFireDamage = TRUE;
645 }
646
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
670
671 #undef INFLICT_STATUS
672
674
675 if (statusChanceOrDefense > 0) {
676 statusChanceOrDefense = 100;
677 }
678
679 statusChanceOrDefense = (battleStatus->
statusChance * statusChanceOrDefense) / 100;
680
682 if (
rand_int(99) < statusChanceOrDefense) {
690 ) {
692 wasStatusInflicted = TRUE;
694 wasSpecialHit = TRUE;
701 } else {
704 }
705 } else {
708 }
709 }
710
711 if (wasStatusInflicted) {
714 }
715
718 }
719 }
720 }
721 }
722
724 statusChanceOrDefense = (battleStatus->
statusChance * statusChanceOrDefense) / 100;
725
728 if (
rand_int(99) < statusChanceOrDefense) {
736 wasStatusInflicted = TRUE;
738 wasSpecialHit = TRUE;
745 } else {
748 }
749 } else {
752 }
753 }
754 }
755
758
761 if (!wasSpecialHit && !wasStatusInflicted) {
763 }
764 } else if (!partImmuneToElement) {
767 } else {
769 }
770
773 }
774 }
775 }
776
779 ) {
782 }
783
787 } else {
789 }
790 }
791 }
792
795 }
796
798 if (partImmuneToElement == 0) {
801 }
802
804
805 if (isFireDamage) {
807 } else if (isShockDamage) {
809 } else if (isIceDamage) {
811 } else {
813 }
814 }
815 }
816
818 && !(wasSpecialHit || wasStatusInflicted)
820 ) {
822 }
823
826 evt->varTable[0] = state->
goalPos.
x;
827 evt->varTable[1] = state->
goalPos.
y;
828 evt->varTable[2] = state->
goalPos.
z;
830 }
831
834 evt->varTable[0] = state->
goalPos.
x;
835 evt->varTable[1] = state->
goalPos.
y;
836 evt->varTable[2] = state->
goalPos.
z;
838 }
839
842 evt->varTable[0] = state->
goalPos.
x;
843 evt->varTable[1] = state->
goalPos.
y;
844 evt->varTable[2] = state->
goalPos.
z;
846 }
847
850 evt->varTable[0] = state->
goalPos.
x;
851 evt->varTable[1] = state->
goalPos.
y;
852 evt->varTable[2] = state->
goalPos.
z;
854 }
855
858 evt->varTable[0] = state->
goalPos.
x;
859 evt->varTable[1] = state->
goalPos.
y;
860 evt->varTable[2] = state->
goalPos.
z;
862 }
863
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
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
884 }
885
887
891 }
894 }
895 }
896
904 }
905
906 return hitResult;
907}
struct ActorBlueprint * actorBlueprint
#define INFLICT_STATUS(STATUS_TYPE)
@ ACTION_RATING_SUPER
sets nice hits = 2
@ ACTION_RATING_NICE
sets nice hits = 1
@ BS_FLAGS1_TUTORIAL_BATTLE
@ BS_FLAGS1_FORCE_IMMUNE_HIT
@ BS_FLAGS1_TRIGGER_EVENTS
@ BS_FLAGS1_SHOW_PLAYER_DECORATIONS
@ BS_FLAGS1_INCLUDE_POWER_UPS
@ BS_FLAGS1_ACTORS_VISIBLE
@ 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_EXPLODE_ON_CONTACT
Attacks that contact will trigger an explosion.
@ ACTOR_EVENT_FLAG_BURIED
Actor can only by hit by quake-element attacks.
@ 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
@ HIT_RESULT_NICE_NO_DAMAGE
@ SUPPRESS_EVENT_EXPLODE_CONTACT
@ 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_STATUS_ALWAYS_HITS
@ DAMAGE_TYPE_POWER_BOUNCE
@ DAMAGE_TYPE_IGNORE_DEFENSE
@ DAMAGE_TYPE_MULTIPLE_POPUPS
void show_primary_damage_popup(f32 x, f32 y, f32 z, s32 attack, s32 a)
void show_immune_bonk(f32 x, f32 y, f32 z, s32, s32, s32)
void show_actor_health_bar(Actor *)
void clear_part_pal_adjustment(ActorPart *)
void set_actor_flash_mode(Actor *actor, s32 arg1)
void show_damage_fx(Actor *actor, f32 x, f32 y, f32 z, s32 damage)
s32 get_defense(Actor *actor, s32 *defenseTable, s32 elementFlags)
void func_80266970(Actor *)
void show_next_damage_popup(f32 x, f32 y, f32 z, s32 damageAmount, s32)
void show_action_rating(s32, Actor *, f32, f32, f32)
EvtScript EVS_PlayStopHitFX
EvtScript EVS_PlayFreezeHitFX
EvtScript EVS_PlayShrinkHitFX
EvtScript EVS_PlayParalyzeHitFX
EvtScript EVS_PlayPoisonHitFX
EvtScript EVS_PlaySleepHitFX
EvtScript EVS_PlayDizzyHitFX