25 if (handleEventScript != NULL) {
43 if (handleEventScript != NULL) {
60 state = &partner->
state;
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;
189 state = &partner->
state;
191 if (target == NULL) {
197 ASSERT(targetPart != NULL);
226 partImmuneToElement = TRUE;
359 isShockDamage = TRUE;
364 isWaterDamage = TRUE;
396 statusChanceOrDefense = 0;
397 damageDealt = target->
curHP;
402 statusChanceOrDefense = 0;
407 if (damageDealt != 0) {
410 if (damageDealt == 0) {
416 if (damageDealt > 99) {
420 if (damageDealt < 0) {
421 statusChanceOrDefense = 0;
424 damageDealt -= statusChanceOrDefense;
427 if (damageDealt < 0) {
434 if (damageDealt < 1) {
441 if (damageDealt < 1) {
450 if (target->
curHP < 1) {
467 && !partImmuneToElement
470 target->
curHP -= damageDealt;
472 if (target->
curHP < 1) {
516 if (target->
curHP < 1) {
539 wasSpecialHit = TRUE;
575 wasSpecialHit = TRUE;
589 wasSpecialHit = TRUE;
610 wasSpecialHit = TRUE;
630 wasSpecialHit = TRUE;
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; \
671 #undef INFLICT_STATUS
675 if (statusChanceOrDefense > 0) {
676 statusChanceOrDefense = 100;
679 statusChanceOrDefense = (battleStatus->
statusChance * statusChanceOrDefense) / 100;
682 if (
rand_int(99) < statusChanceOrDefense) {
692 wasStatusInflicted = TRUE;
694 wasSpecialHit = TRUE;
711 if (wasStatusInflicted) {
724 statusChanceOrDefense = (battleStatus->
statusChance * statusChanceOrDefense) / 100;
728 if (
rand_int(99) < statusChanceOrDefense) {
736 wasStatusInflicted = TRUE;
738 wasSpecialHit = TRUE;
761 if (!wasSpecialHit && !wasStatusInflicted) {
764 }
else if (!partImmuneToElement) {
798 if (partImmuneToElement == 0) {
807 }
else if (isShockDamage) {
809 }
else if (isIceDamage) {
818 && !(wasSpecialHit || wasStatusInflicted)
826 evt->varTable[0] = state->
goalPos.
x;
827 evt->varTable[1] = state->
goalPos.
y;
828 evt->varTable[2] = state->
goalPos.
z;
834 evt->varTable[0] = state->
goalPos.
x;
835 evt->varTable[1] = state->
goalPos.
y;
836 evt->varTable[2] = state->
goalPos.
z;
842 evt->varTable[0] = state->
goalPos.
x;
843 evt->varTable[1] = state->
goalPos.
y;
844 evt->varTable[2] = state->
goalPos.
z;
850 evt->varTable[0] = state->
goalPos.
x;
851 evt->varTable[1] = state->
goalPos.
y;
852 evt->varTable[2] = state->
goalPos.
z;
858 evt->varTable[0] = state->
goalPos.
x;
859 evt->varTable[1] = state->
goalPos.
y;
860 evt->varTable[2] = state->
goalPos.
z;
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;
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;
918 hpChange = (s16)damageAmount;
922 partner->
curHP = 127;
926 partner->
curHP -= hpChange;
928 if (partner->
curHP <= 0) {
980API_CALLABLE(MakeOwnerTargetIndex) {
981 Bytecode* args = script->ptrReadPos;
987 s32 otherArg = *args++;
990 if (numTargets == 0) {
994 if (arg2 >= numTargets) {
995 arg2 = numTargets - 1;
1001 selectableTarget = &actor->
targetData[targetList[arg2]];
1010API_CALLABLE(func_8027FC90) {
1011 Bytecode* args = script->ptrReadPos;
1019 actorID = script->owner1.enemyID;
1034API_CALLABLE(GetActorLevel) {
1035 Bytecode* args = script->ptrReadPos;
1040 actorID = script->owner1.enemyID;
1049API_CALLABLE(PartnerDamageEnemy) {
1052 Bytecode* args = script->ptrReadPos;
1054 s32 temp_s4 = *args++;
1067 if (dx_debug_is_cheat_enabled(DEBUG_CHEAT_GOD_MODE)) {
1077 battleStatus->
flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1079 battleStatus->
flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1082 battleStatus->
flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1083 battleStatus->
flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1122 if (damageResult < 0) {
1135API_CALLABLE(PartnerAfflictEnemy) {
1137 Bytecode* args = script->ptrReadPos;
1139 s32 returnValue = *args++;
1157 battleStatus->
flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1159 battleStatus->
flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1162 battleStatus->
flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1163 battleStatus->
flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1199 if (damageResult < 0) {
1212API_CALLABLE(PartnerPowerBounceEnemy) {
1214 Bytecode* args = script->ptrReadPos;
1216 s32 returnValue = *args++;
1233 battleStatus->
flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1235 battleStatus->
flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1238 battleStatus->
flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1239 battleStatus->
flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1275 if (damageResult < 0) {
1288API_CALLABLE(PartnerTestEnemy) {
1291 Bytecode* args = script->ptrReadPos;
1311 battleStatus->
flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1313 battleStatus->
flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1316 battleStatus->
flags1 &= ~BS_FLAGS1_INCLUDE_POWER_UPS;
1317 battleStatus->
flags1 &= ~BS_FLAGS1_TRIGGER_EVENTS;
1356 if (damageResult < 0) {
1365API_CALLABLE(func_8028070C) {
1367 Bytecode* args = script->ptrReadPos;
1382API_CALLABLE(DeletePartner) {
1389API_CALLABLE(GetPartnerActionSuccess) {
1391 s32 var = *script->ptrReadPos;
1395 if (actionSuccess < outVal) {
1396 actionSuccess = outVal;
1399 if (actionSuccess > outVal) {
1400 outVal = actionSuccess;
1408API_CALLABLE(PartnerYieldTurn) {
struct Evt * takeTurnScript
EvtScript * handleEventSource
struct ActorBlueprint * actorBlueprint
struct Evt * handleEventScript
struct SelectableTarget targetData[24]
union Evt::@8 owner1
Initially -1.
HitResult calc_partner_test_enemy(void)
#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)
void dispatch_event_partner(s32 lastEventType)
#define sfx_play_sound_at_position
#define ASSERT(condition)
@ 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_ELECTRIFIED
Player takes shock damage upon contact.
@ ACTOR_EVENT_FLAG_SPIKY_FRONT
Player takes spike damage from hammer attacks.
@ 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_BURIED
Actor can only by hit by quake-element attacks.
@ 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_ILLUSORY
Player attacks pass through and miss.
@ ACTOR_EVENT_FLAG_SPIKY_TOP
Player takes spike damage from jump attacks.
@ ACTOR_EVENT_FLAG_ENCHANTED
Actor glows and listens for the Star Beam event.
@ ACTOR_PART_TARGET_NO_DAMAGE
@ HIT_RESULT_LANDED_ON_SPIKE
@ HIT_RESULT_NICE_NO_DAMAGE
@ SUPPRESS_EVENT_EXPLODE_CONTACT
@ SUPPRESS_EVENT_SPIKY_TOP
@ SUPPRESS_EVENT_ALT_SPIKY
@ SUPPRESS_EVENT_SHOCK_CONTACT
@ SUPPRESS_EVENT_SPIKY_FRONT
@ SUPPRESS_EVENT_BURN_CONTACT
@ ACTOR_FLAG_NO_DMG_POPUP
Hide damage popup.
@ ACTOR_FLAG_HEALTH_BAR_HIDDEN
@ ACTOR_FLAG_UPSIDE_DOWN
HP bar offset below actor (e.g. Swooper when upside-down).
@ 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
@ EVT_FLAG_RUN_IMMEDIATELY
don't wait for next update_scripts call
void show_primary_damage_popup(f32 x, f32 y, f32 z, s32 attack, s32 a)
s32 does_script_exist_by_ref(Evt *script)
s32 evt_get_variable(Evt *script, Bytecode var)
s32 player_team_is_ability_active(Actor *actor, s32 ability)
void show_immune_bonk(f32 x, f32 y, f32 z, s32, s32, s32)
void dispatch_event_actor(Actor *, s32)
void show_actor_health_bar(Actor *)
void clear_part_pal_adjustment(ActorPart *)
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
void set_actor_flash_mode(Actor *actor, s32 arg1)
void show_damage_fx(Actor *actor, f32 x, f32 y, f32 z, s32 damage)
Evt * start_script(EvtScript *source, s32 priority, s32 initialState)
s32 inflict_status(Actor *, s32, s32)
ActorPart * get_actor_part(Actor *actor, s32 partID)
s32 get_defense(Actor *actor, s32 *defenseTable, s32 elementFlags)
Actor * get_actor(s32 actorID)
void kill_script_by_ID(s32 id)
void func_80266970(Actor *)
void set_goal_pos_to_part(ActorState *state, s32 actorID, s32 partID)
void btl_delete_actor(Actor *actor)
void show_next_damage_popup(f32 x, f32 y, f32 z, s32 damageAmount, s32)
void apply_shock_effect(Actor *)
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
struct Actor * partnerActor
s32 curAttackEventSuppression
BattleStatus gBattleStatus
PlayerStatus gPlayerStatus