aboutsummaryrefslogtreecommitdiffstats
path: root/engine
diff options
context:
space:
mode:
authorRangi <35663410+Rangi42@users.noreply.github.com>2025-05-31 15:08:23 -0400
committerGitHub <noreply@github.com>2025-05-31 15:08:23 -0400
commitb4bae4a5d5abd3f44a49028f550c1eb475ac280b (patch)
treeb1a750bbfcc548be5fa1e4a6f53d0dd4dd3a8132 /engine
parentUse features new to RGBDS 0.9.2 (#506) (diff)
downloadpokeyellow-b4bae4a5d5abd3f44a49028f550c1eb475ac280b.tar.gz
pokeyellow-b4bae4a5d5abd3f44a49028f550c1eb475ac280b.tar.xz
pokeyellow-b4bae4a5d5abd3f44a49028f550c1eb475ac280b.zip
Add a `CANNOT_MOVE` constant (#508)
Diffstat (limited to 'engine')
-rw-r--r--engine/battle/core.asm9
1 files changed, 6 insertions, 3 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 4fe7880f..c833fc71 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -317,7 +317,7 @@ MainInBattleLoop:
bit USING_TRAPPING_MOVE, a ; check if enemy is using a multi-turn attack like wrap
jr z, .selectPlayerMove ; if not, jump
; enemy is using a multi-turn attack like wrap, so player is trapped and cannot execute a move
- ld a, $ff
+ ld a, CANNOT_MOVE
ld [wPlayerSelectedMove], a
jr .selectEnemyMove
.selectPlayerMove
@@ -3018,7 +3018,8 @@ LinkBattleExchangeData:
ld b, LINKBATTLE_STRUGGLE
jr z, .next
dec b ; LINKBATTLE_NO_ACTION
- inc a ; does move equal -1 (i.e. no action)?
+ ASSERT CANNOT_MOVE == $ff
+ inc a
jr z, .next
ld a, [wPlayerMoveListIndex]
jr .doExchange
@@ -3071,8 +3072,9 @@ ExecutePlayerMove:
xor a
ldh [hWhoseTurn], a ; set player's turn
ld a, [wPlayerSelectedMove]
+ ASSERT CANNOT_MOVE == $ff
inc a
- jp z, ExecutePlayerMoveDone ; for selected move = FF, skip most of player's turn
+ jp z, ExecutePlayerMoveDone ; if the player cannot move, skip most of their turn
xor a
ld [wMoveMissed], a
ld [wMonIsDisobedient], a
@@ -5584,6 +5586,7 @@ RandomizeDamage:
; for more detailed commentary, see equivalent function for player side (ExecutePlayerMove)
ExecuteEnemyMove:
ld a, [wEnemySelectedMove]
+ ASSERT CANNOT_MOVE == $ff
inc a
jp z, ExecuteEnemyMoveDone
call PrintGhostText