ref: 498da6ab0921a280507b3d96e7faac1b305959bd
parent: 8ffc0367f927d44ce96d84282146b206e423f31f
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Mon Jul 25 20:01:21 EDT 2022
Clarify how Metronome picks a move
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -5144,12 +5144,13 @@
; values for enemy turn
ld de, wEnemyMoveNum
ld hl, wEnemySelectedMove
-; loop to pick a random number in the range [1, $a5) to be the move used by Metronome
+; loop to pick a random number in the range of valid moves used by Metronome
.pickMoveLoop
call BattleRandom
and a
jr z, .pickMoveLoop
- cp NUM_ATTACKS ; max move number (including Struggle)
+ cp STRUGGLE
+ assert NUM_ATTACKS == STRUGGLE ; random numbers greater than STRUGGLE are not moves
jr nc, .pickMoveLoop
cp METRONOME
jr z, .pickMoveLoop