From f206da38f7492c18b8089c6f76b5985bc26d2077 Mon Sep 17 00:00:00 2001 From: voloved <36523934+voloved@users.noreply.github.com> Date: Sat, 29 Apr 2023 15:20:26 -0400 Subject: [PATCH] Cleaner place to not run from double battle added. --- Allow-Running-From-Trainer-Battles.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Allow-Running-From-Trainer-Battles.md b/Allow-Running-From-Trainer-Battles.md index 77f7f7d..0d5880f 100644 --- a/Allow-Running-From-Trainer-Battles.md +++ b/Allow-Running-From-Trainer-Battles.md @@ -186,7 +186,7 @@ EWRAM_DATA u16 gBattle_BG0_X = 0; +static u8 IsTrainerCantRunFrom(void){ + u8 trainerClass; -+ if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_TRAINER_HILL)) ++ if (gBattleTypeFlags & (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_TRAINER_HILL)) + return BATTLE_RUN_FORBIDDEN; + trainerClass = gTrainers[gTrainerBattleOpponent_A].trainerClass; + switch (trainerClass) @@ -217,7 +217,7 @@ void SwitchPartyOrder(u8 battler) && gBattleBufferB[gActiveBattler][1] == B_ACTION_RUN) { - gBattleCommunication[gActiveBattler]++; -+ if (IsTrainerCantRunFrom() || IsDoubleBattle()) ++ if (IsTrainerCantRunFrom()) + { + BattleScriptExecute(BattleScript_PrintCantRunFromTrainer); + gBattleCommunication[gActiveBattler] = STATE_BEFORE_ACTION_CHOSEN;