Update turn-start-phase.ts

This commit is contained in:
Bertie690 2025-06-16 08:23:44 -04:00 committed by GitHub
parent 4ab2a33578
commit 93740ae3a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -223,12 +223,11 @@ export class TurnStartPhase extends FieldPhase {
} }
private handleFightCommand(turnCommand: TurnCommand, pokemon: Pokemon) { private handleFightCommand(turnCommand: TurnCommand, pokemon: Pokemon) {
if (!turnCommand.move) { const queuedMove = turnCommand.move;
if (!queuedMove) {
return; return;
} }
const queuedMove = turnCommand.move;
// TODO: This seems somewhat dubious // TODO: This seems somewhat dubious
const move = const move =
pokemon.getMoveset().find(m => m.moveId === queuedMove.move && m.ppUsed < m.getMovePp()) ?? pokemon.getMoveset().find(m => m.moveId === queuedMove.move && m.ppUsed < m.getMovePp()) ??
@ -238,18 +237,12 @@ export class TurnStartPhase extends FieldPhase {
globalScene.phaseManager.unshiftNew("MoveHeaderPhase", pokemon, move); globalScene.phaseManager.unshiftNew("MoveHeaderPhase", pokemon, move);
} }
// TODO: Review what a `-1` cursor means
if (pokemon.isPlayer() && turnCommand.cursor === -1) {
globalScene.phaseManager.pushNew("MovePhase", pokemon, turnCommand.targets ?? queuedMove.targets, move);
} else {
globalScene.phaseManager.pushNew( globalScene.phaseManager.pushNew(
"MovePhase", "MovePhase",
pokemon, pokemon,
turnCommand.targets ?? turnCommand.move.targets, turnCommand.targets ?? queuedMove.targets,
move, move,
false,
queuedMove.useMode, queuedMove.useMode,
); );
} }
}
} }