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 globalScene.phaseManager.pushNew(
if (pokemon.isPlayer() && turnCommand.cursor === -1) { "MovePhase",
globalScene.phaseManager.pushNew("MovePhase", pokemon, turnCommand.targets ?? queuedMove.targets, move); pokemon,
} else { turnCommand.targets ?? queuedMove.targets,
globalScene.phaseManager.pushNew( move,
"MovePhase", queuedMove.useMode,
pokemon, );
turnCommand.targets ?? turnCommand.move.targets,
move,
false,
queuedMove.useMode,
);
}
} }
} }