maybe fixed?

This commit is contained in:
Bertie690 2025-08-01 21:18:05 -04:00
parent c737a9206f
commit 20582b43c0
4 changed files with 66 additions and 4 deletions

View File

@ -547,7 +547,7 @@ describe("Abilities - Wimp Out", () => {
await game.move.selectEnemyMove(MoveId.SPLASH); await game.move.selectEnemyMove(MoveId.SPLASH);
await game.move.selectEnemyMove(MoveId.ENDURE); await game.move.selectEnemyMove(MoveId.ENDURE);
await game.toNextWave(); await game.phaseInterceptor.to("SelectModifierPhase");
expect(game.scene.currentBattle.waveIndex).toBe(wave + 1); expect(game.scene.currentBattle.waveIndex).toBe(wave + 1);
}); });
}); });

View File

@ -39,7 +39,7 @@ describe("Battle order", () => {
vi.spyOn(enemyPokemon, "stats", "get").mockReturnValue([20, 20, 20, 20, 20, 150]); // set enemyPokemon's speed to 150 vi.spyOn(enemyPokemon, "stats", "get").mockReturnValue([20, 20, 20, 20, 20, 150]); // set enemyPokemon's speed to 150
game.move.select(MoveId.TACKLE); game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to("TurnStartPhase"); await game.phaseInterceptor.to("TurnStartPhase", false);
const playerPokemonIndex = playerPokemon.getBattlerIndex(); const playerPokemonIndex = playerPokemon.getBattlerIndex();
const enemyPokemonIndex = enemyPokemon.getBattlerIndex(); const enemyPokemonIndex = enemyPokemon.getBattlerIndex();
@ -58,7 +58,7 @@ describe("Battle order", () => {
vi.spyOn(enemyPokemon, "stats", "get").mockReturnValue([20, 20, 20, 20, 20, 50]); // set enemyPokemon's speed to 50 vi.spyOn(enemyPokemon, "stats", "get").mockReturnValue([20, 20, 20, 20, 20, 50]); // set enemyPokemon's speed to 50
game.move.select(MoveId.TACKLE); game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to("TurnStartPhase"); await game.phaseInterceptor.to("TurnStartPhase", false);
const playerPokemonIndex = playerPokemon.getBattlerIndex(); const playerPokemonIndex = playerPokemon.getBattlerIndex();
const enemyPokemonIndex = enemyPokemon.getBattlerIndex(); const enemyPokemonIndex = enemyPokemon.getBattlerIndex();

View File

@ -76,6 +76,68 @@ describe("Phase - Battle Phase", () => {
} }
}); });
it("wrong phase", async () => {
await game.phaseInterceptor.run(LoginPhase);
await game.phaseInterceptor.run(LoginPhase).catch(e => {
expect(e).toBe("Wrong phase: this is SelectGenderPhase and not LoginPhase");
});
});
it("wrong phase but skip", async () => {
await game.phaseInterceptor.run(LoginPhase);
await game.phaseInterceptor.run(LoginPhase, () => game.isCurrentPhase(SelectGenderPhase));
});
it("good run", async () => {
await game.phaseInterceptor.run(LoginPhase);
game.onNextPrompt(
"SelectGenderPhase",
UiMode.OPTION_SELECT,
() => {
game.scene.gameData.gender = PlayerGender.MALE;
game.endPhase();
},
() => game.isCurrentPhase(TitlePhase),
);
await game.phaseInterceptor.run(SelectGenderPhase, () => game.isCurrentPhase(TitlePhase));
await game.phaseInterceptor.run(TitlePhase);
});
it("good run from select gender to title", async () => {
await game.phaseInterceptor.run(LoginPhase);
game.onNextPrompt(
"SelectGenderPhase",
UiMode.OPTION_SELECT,
() => {
game.scene.gameData.gender = PlayerGender.MALE;
game.endPhase();
},
() => game.isCurrentPhase(TitlePhase),
);
await game.phaseInterceptor.runFrom(SelectGenderPhase).to(TitlePhase);
});
it("good run to SummonPhase phase", async () => {
await game.phaseInterceptor.run(LoginPhase);
game.onNextPrompt(
"SelectGenderPhase",
UiMode.OPTION_SELECT,
() => {
game.scene.gameData.gender = PlayerGender.MALE;
game.endPhase();
},
() => game.isCurrentPhase(TitlePhase),
);
game.onNextPrompt("TitlePhase", UiMode.TITLE, () => {
game.scene.gameMode = getGameMode(GameModes.CLASSIC);
const starters = generateStarter(game.scene);
const selectStarterPhase = new SelectStarterPhase();
game.scene.phaseManager.pushPhase(new EncounterPhase(false));
selectStarterPhase.initBattle(starters);
});
await game.phaseInterceptor.runFrom(SelectGenderPhase).to(SummonPhase);
});
it.each([ it.each([
{ name: "1v1", double: false, qty: 1 }, { name: "1v1", double: false, qty: 1 },
{ name: "2v1", double: false, qty: 2 }, { name: "2v1", double: false, qty: 2 },

View File

@ -146,6 +146,6 @@ describe("Moves - Metronome", () => {
const hasFled = enemyPokemon.switchOutStatus; const hasFled = enemyPokemon.switchOutStatus;
expect(!isVisible && hasFled).toBe(true); expect(!isVisible && hasFled).toBe(true);
await game.toNextWave(); await game.toNextTurn();
}); });
}); });