Fix baton pass test

This commit is contained in:
innerthunder 2024-08-09 11:07:22 -07:00
parent 4aed9aed70
commit 739ed42673
3 changed files with 11 additions and 6 deletions

View File

@ -1685,9 +1685,9 @@ export class SwitchSummonPhase extends SummonPhase {
if (this.batonPass) { if (this.batonPass) {
const substitute = this.lastPokemon.getTag(SubstituteTag); const substitute = this.lastPokemon.getTag(SubstituteTag);
if (!!substitute) { if (!!substitute) {
switchedPokemon.x += switchedPokemon.getSubstituteOffset()[0]; switchedInPokemon.x += switchedPokemon.getSubstituteOffset()[0];
switchedPokemon.y += switchedPokemon.getSubstituteOffset()[1]; switchedInPokemon.y += switchedPokemon.getSubstituteOffset()[1];
switchedPokemon.setAlpha(0.5); switchedInPokemon.setAlpha(0.5);
} }
} else { } else {
switchedInPokemon.resetBattleData(); switchedInPokemon.resetBattleData();

View File

@ -5,7 +5,7 @@ import { Species } from "#app/enums/species";
import { Abilities } from "#app/enums/abilities"; import { Abilities } from "#app/enums/abilities";
import { Moves } from "#app/enums/moves"; import { Moves } from "#app/enums/moves";
import { getMovePosition } from "../utils/gameManagerUtils"; import { getMovePosition } from "../utils/gameManagerUtils";
import { BerryPhase, MoveEndPhase, MovePhase } from "#app/phases"; import { BerryPhase, CommandPhase, MoveEndPhase, MovePhase } from "#app/phases";
import { BattlerTagType } from "#app/enums/battler-tag-type"; import { BattlerTagType } from "#app/enums/battler-tag-type";
import { BattleStat } from "#app/data/battle-stat"; import { BattleStat } from "#app/data/battle-stat";
import { allMoves, StealHeldItemChanceAttr } from "#app/data/move"; import { allMoves, StealHeldItemChanceAttr } from "#app/data/move";
@ -13,6 +13,8 @@ import { SubstituteTag, TrappedTag } from "#app/data/battler-tags";
import { StatusEffect } from "#app/data/status-effect"; import { StatusEffect } from "#app/data/status-effect";
import { BerryType } from "#app/enums/berry-type"; import { BerryType } from "#app/enums/berry-type";
import { SPLASH_ONLY } from "../utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
import { Mode } from "#app/ui/ui.js";
import { Command } from "#app/ui/command-ui-handler.js";
const TIMEOUT = 20 * 1000; // 20 sec timeout const TIMEOUT = 20 * 1000; // 20 sec timeout
@ -391,7 +393,10 @@ describe("Moves - Substitute", () => {
leadPokemon.addTag(BattlerTagType.SUBSTITUTE, 0, Moves.NONE, leadPokemon.id); leadPokemon.addTag(BattlerTagType.SUBSTITUTE, 0, Moves.NONE, leadPokemon.id);
game.doSwitchPokemon(1, true); // Simulate a Baton switch for the player this turn
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.POKEMON, 1, true);
});
await game.phaseInterceptor.to(MovePhase, false); await game.phaseInterceptor.to(MovePhase, false);

View File

@ -316,7 +316,7 @@ export default class GameManager {
* Command an in-battle switch to another Pokemon via the main battle menu. * Command an in-battle switch to another Pokemon via the main battle menu.
* @param pokemonIndex the index of the pokemon in your party to switch to * @param pokemonIndex the index of the pokemon in your party to switch to
*/ */
doSwitchPokemon(pokemonIndex: number, batonPass: boolean = false) { doSwitchPokemon(pokemonIndex: number) {
this.onNextPrompt("CommandPhase", Mode.COMMAND, () => { this.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
(this.scene.ui.getHandler() as CommandUiHandler).setCursor(2); (this.scene.ui.getHandler() as CommandUiHandler).setCursor(2);
(this.scene.ui.getHandler() as CommandUiHandler).processInput(Button.ACTION); (this.scene.ui.getHandler() as CommandUiHandler).processInput(Button.ACTION);