Choosing RUN in a trainer battle makes you win on DEBUG mode - pret/pokered GitHub Wiki
This is very simple. Code by ZetaPhoenix.
The enemy is fainted first to avoid some graphical glitches.
In engine/battle/core.asm
Go to TryRunningFromBattle.trainerBattle
.trainerBattle
+IF DEF(_DEBUG)
+ call FaintEnemyPokemon
+ call TrainerBattleVictory
+ jp _InitBattleCommon.endOfBattle
+ENDC
ld hl, NoRunningText
.printCantEscapeOrNoRunningText
call PrintText
ld a, 1
ld [wForcePlayerToChooseMon], a
call SaveScreenTilesToBuffer1
and a ; reset carry
ret
Go to _InitBattleCommon
; common code that executes after init battle code specific to trainer or wild battles
_InitBattleCommon:
ld b, SET_PAL_BATTLE_BLACK
call RunPaletteCommand
call SlidePlayerAndEnemySilhouettesOnScreen
xor a
ldh [hAutoBGTransferEnabled], a
ld hl, .emptyString
call PrintText
call SaveScreenTilesToBuffer1
call ClearScreen
ld a, HIGH(vBGMap0)
ldh [hAutoBGTransferDest + 1], a
ld a, $1
ldh [hAutoBGTransferEnabled], a
call Delay3
ld a, HIGH(vBGMap1)
ldh [hAutoBGTransferDest + 1], a
call LoadScreenTilesFromBuffer1
hlcoord 9, 7
lb bc, 5, 10
call ClearScreenArea
hlcoord 1, 0
lb bc, 4, 10
call ClearScreenArea
call ClearSprites
ld a, [wIsInBattle]
dec a ; is it a wild battle?
call z, DrawEnemyHUDAndHPBar ; draw enemy HUD and HP bar if it's a wild battle
call StartBattle
+.endOfBattle
callfar EndOfBattle
pop af
ld [wLetterPrintingDelayFlags], a
pop af
ld [wMapPalOffset], a
ld a, [wSavedTileAnimations]
ldh [hTileAnimations], a
scf
ret
.emptyString
db "@"