Minor touchups

This commit is contained in:
Sirz Benjie 2025-05-26 16:41:58 -05:00
parent ab94e82163
commit 3497f93141
No known key found for this signature in database
GPG Key ID: 38AC42D68CF5E138

View File

@ -248,8 +248,7 @@ export class CommandPhase extends FieldPhase {
const playerPokemon = this.getPokemon(); const playerPokemon = this.getPokemon();
const ignorePP = isIgnorePP(useMode); const ignorePP = isIgnorePP(useMode);
/** Whether or not to display an error message instead of attempting to initiate the command selection process */ let canUse = cursor === -1 || playerPokemon.trySelectMove(cursor, ignorePP);
let canUse = cursor !== -1 || !playerPokemon.trySelectMove(cursor, ignorePP);
const useStruggle = canUse const useStruggle = canUse
? false ? false
@ -290,7 +289,7 @@ export class CommandPhase extends FieldPhase {
console.log(moveTargets, getPokemonNameWithAffix(playerPokemon)); console.log(moveTargets, getPokemonNameWithAffix(playerPokemon));
if (moveTargets.multiple) { if (moveTargets.targets.length > 1 && moveTargets.multiple) {
globalScene.phaseManager.unshiftNew("SelectTargetPhase", this.fieldIndex); globalScene.phaseManager.unshiftNew("SelectTargetPhase", this.fieldIndex);
} }
@ -418,7 +417,7 @@ export class CommandPhase extends FieldPhase {
} }
/** /**
* Common helper method to handle the logic for effects that prevent the pokemon from leaving the field * Helper method to handle the logic for effects that prevent the pokemon from leaving the field
* due to trapping abilities or effects. * due to trapping abilities or effects.
* *
* This method queues the proper messages in the case of trapping abilities or effects * This method queues the proper messages in the case of trapping abilities or effects
@ -477,11 +476,16 @@ export class CommandPhase extends FieldPhase {
private tryLeaveField(cursor?: number, isBatonSwitch = false): boolean { private tryLeaveField(cursor?: number, isBatonSwitch = false): boolean {
const currentBattle = globalScene.currentBattle; const currentBattle = globalScene.currentBattle;
if (isBatonSwitch && !this.handleTrap()) { if (isBatonSwitch || !this.handleTrap()) {
currentBattle.turnCommands[this.fieldIndex] = { currentBattle.turnCommands[this.fieldIndex] = this.isSwitch
command: this.isSwitch ? Command.POKEMON : Command.RUN, ? {
cursor: cursor, command: Command.POKEMON,
}; cursor: cursor,
args: [isBatonSwitch],
}
: {
command: Command.RUN,
};
if (!this.isSwitch && this.fieldIndex) { if (!this.isSwitch && this.fieldIndex) {
currentBattle.turnCommands[this.fieldIndex - 1]!.skip = true; currentBattle.turnCommands[this.fieldIndex - 1]!.skip = true;
} }
@ -536,7 +540,7 @@ export class CommandPhase extends FieldPhase {
); );
} }
// Overloads for handleCommand to provide a more specific type signature for the different options // Overloads for handleCommand to provide a more specific signature for the different options
handleCommand(command: Command.FIGHT | Command.TERA, cursor: number, useMode?: MoveUseMode, move?: TurnMove): boolean; handleCommand(command: Command.FIGHT | Command.TERA, cursor: number, useMode?: MoveUseMode, move?: TurnMove): boolean;
handleCommand(command: Command.BALL, cursor: number): boolean; handleCommand(command: Command.BALL, cursor: number): boolean;
handleCommand(command: Command.POKEMON, cursor: number, useBaton: boolean): boolean; handleCommand(command: Command.POKEMON, cursor: number, useBaton: boolean): boolean;