Cleaner place to not run from double battle added.

voloved 2023-04-29 15:20:26 -04:00
parent d6f9926bee
commit f206da38f7
1 changed files with 2 additions and 2 deletions

@ -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;