Skip to content

Making the Debug Fight Function use moves other than Pound

Llinos Evans edited this page Jun 5, 2023 · 1 revision

If you're looking to test move animations, damage, and so on, the bare-bones Debug Fight function isn't very helpful, as it only loads Pound for some reason. I figured out why this is, and how to make it bugger off. In fact, it's so helpful to do this, that it even frees up a WRAM entry.

Fix

In engine\battle\init_battle_variables.asm:

	ld [hli], a
	dec b
	jr nz, .loop
-	inc a ; POUND
-	ld [wTestBattlePlayerSelectedMove], a
	ld a, [wCurMap]
	cp SAFARI_ZONE_EAST
	jr c, .notSafariBattle

Firstly, we have where Pound is loaded into wTestBattlePlayerSelectedMove. This WRAM entry is used later to decide the move choice. You don't need this anymore, so chuck it out.

In engine\battle\core.asm:

.player
	ld de, wPlayerMoveNum
	ld a, [wFlags_D733]
-	bit BIT_TEST_BATTLE, a
-	ld a, [wTestBattlePlayerSelectedMove]
	jr nz, .selected
	ld a, [wPlayerSelectedMove]
.selected
	ld [wd0b5], a
	dec a
	ld hl, Moves
	ld bc, MOVE_LENGTH

These pesky lines are the cause of all your troubles. It's checking if you're in the test battle and then loading wTestBattlePlayerSelectedMove - which contains Pound - as the move you selected if true (Not 0). You'll notice wPlayerSelectedMove comes after - it skips this when wTestBattlePlayerSelectedMove is set, see? That's how it eats up your inputs!

Finally, in ram\wram:

-; The player's selected move during a test battle.
-; InitBattleVariables sets it to the move Pound.
-wTestBattlePlayerSelectedMove:: db

-	ds 1
+ds 2

Now that this is unused, you may as well cut it. You can use this entry for whatever you want now; personally, I used it to make a message that tells the player when they've dealt zero damage.

And there you have it! Now it's much more helpful.

Bonus

If you want some more flexibility, it's quite trivial to add moves to the Pokemon you're testing as well. I personally use this for easier move animation jank.

In engine\debug\debug_menu.asm:

	; Give the player a
	; level 20 Rhydon.
	ld a, RHYDON
	ld [wcf91], a
	ld a, 20
	ld [wCurEnemyLVL], a
	xor a
	ld [wMonDataLocation], a
	ld [wCurMap], a
	call AddPartyMon
	
+	; This function gives you a way to waste a turn, never know when you'll need it.
+	; Alternatively, add a move to test.
+	ld hl, wPartyMon1Moves
+	ld a, SPLASH
+	ld [hli], a

And if you want to change the level of what you're fighting, you can do this:

	; Fight against a
	; level 20 Rhydon.
	ld a, RHYDON
	ld [wCurOpponent], a
+	ld a, 100 ; Set the level you want here.
+	ld [wCurEnemyLVL], a
Clone this wiki locally