diff --git a/src/data/move.ts b/src/data/move.ts index 6405419f81d..cca0ad30949 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -6494,7 +6494,7 @@ export class CallMoveAttr extends OverrideMoveEffectAttr { } /** - * Attribute used to call a random move + * Attribute used to call a random move. * Used for {@linkcode Moves.METRONOME} * @see {@linkcode apply} for move selection and move call * @extends OverrideMoveEffectAttr @@ -6514,12 +6514,12 @@ export class RandomMoveAttr extends CallMoveAttr { /** * User calls a random moveId - * @param {Pokemon} user Pokemon that used the move and will call a random move - * @param {Pokemon} target Pokemon that will be targeted by the random move (if single target) - * @param {Move} move Move being used - * @param {any[]} args Unused - * @returns {Promise} - * Invalid moves are indicated by what is passed in to invalidMoves: @constant {invalidMetronomeMoves} + * + * Invalid moves are indicated by what is passed in to invalidMoves: {@linkcode invalidMetronomeMoves} + * @param user Pokemon that used the move and will call a random move + * @param target Pokemon that will be targeted by the random move (if single target) + * @param move Move being used + * @param args Unused */ apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise { const moveIds = Utils.getEnumValues(Moves).map(m => !this.invalidMoves.includes(m) && !allMoves[m].name.endsWith(" (N)") ? m : Moves.NONE); diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 4a7a7d7f6ad..9dec69745be 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -4807,7 +4807,7 @@ export class EnemyPokemon extends Pokemon { if (moveQueue.length !== 0) { const queuedMove = moveQueue[0]; if (queuedMove) { - const moveIndex = this.getMoveset().findIndex(m => m?.moveId === moveQueue[0].move); + const moveIndex = this.getMoveset().findIndex(m => m?.moveId === queuedMove.move); if ((moveIndex > -1 && this.getMoveset()[moveIndex]!.isUsable(this, queuedMove.ignorePP)) || queuedMove.virtual) { return queuedMove; } else { diff --git a/src/phases/command-phase.ts b/src/phases/command-phase.ts index f96a738431b..b1780123197 100644 --- a/src/phases/command-phase.ts +++ b/src/phases/command-phase.ts @@ -81,10 +81,10 @@ export class CommandPhase extends FieldPhase { moveQueue.shift(); } - if (moveQueue.length !== 0) { + if (moveQueue.length > 0) { const queuedMove = moveQueue[0]; if (!queuedMove.move) { - this.handleCommand(Command.FIGHT, -1, undefined); + this.handleCommand(Command.FIGHT, -1); } else { const moveIndex = playerPokemon.getMoveset().findIndex(m => m?.moveId === queuedMove.move); if ((moveIndex > -1 && playerPokemon.getMoveset()[moveIndex]!.isUsable(playerPokemon, queuedMove.ignorePP)) || queuedMove.virtual) { // TODO: is the bang correct?