Update assist tests to use manual moveset overrides

Minor fixes to other tests
This commit is contained in:
NightKev 2024-12-29 23:27:27 -08:00
parent 499a7eb344
commit 31ff6dc54e
4 changed files with 23 additions and 7 deletions

View File

@ -25,8 +25,9 @@ describe("Moves - Assist", () => {
beforeEach(() => {
game = new GameManager(phaserGame);
// Manual moveset overrides are required for the player pokemon in these tests
// because the normal moveset override doesn't allow for accurate testing of moveset changes
game.override
.moveset([ Moves.ASSIST, Moves.SKETCH, Moves.PROTECT, Moves.DRAGON_TAIL ]) // These are all moves Assist cannot call; Sketch will be used to test that it can call other moves properly
.ability(Abilities.BALL_FETCH)
.battleType("double")
.disableCrits()
@ -40,6 +41,11 @@ describe("Moves - Assist", () => {
game.override.enemyMoveset(Moves.SWORDS_DANCE);
await game.classicMode.startBattle([ Species.FEEBAS, Species.SHUCKLE ]);
const [ feebas, shuckle ] = game.scene.getPlayerField();
// These are all moves Assist cannot call; Sketch will be used to test that it can call other moves properly
game.move.changeMoveset(feebas, [ Moves.ASSIST, Moves.SKETCH, Moves.PROTECT, Moves.DRAGON_TAIL ]);
game.move.changeMoveset(shuckle, [ Moves.ASSIST, Moves.SKETCH, Moves.PROTECT, Moves.DRAGON_TAIL ]);
game.move.select(Moves.ASSIST, 0);
game.move.select(Moves.SKETCH, 1);
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER_2, BattlerIndex.PLAYER ]);
@ -49,9 +55,12 @@ describe("Moves - Assist", () => {
expect(game.scene.getPlayerPokemon()!.getStatStage(Stat.ATK)).toBe(2); // Stat raised from Assist -> Swords Dance
});
it("should fail if there are no usable moves", async () => {
it("should fail if there are no allies", async () => {
await game.classicMode.startBattle([ Species.FEEBAS ]);
// Moves in beforeEach are already unusable by Assist
const feebas = game.scene.getPlayerPokemon()!;
game.move.changeMoveset(feebas, [ Moves.ASSIST, Moves.SKETCH, Moves.PROTECT, Moves.DRAGON_TAIL ]);
game.move.select(Moves.ASSIST, 0);
await game.toNextTurn();
expect(game.scene.getPlayerPokemon()!.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
@ -61,6 +70,10 @@ describe("Moves - Assist", () => {
game.override.enemyMoveset(Moves.SWORDS_DANCE);
await game.classicMode.startBattle([ Species.FEEBAS, Species.SHUCKLE ]);
const [ feebas, shuckle ] = game.scene.getPlayerField();
game.move.changeMoveset(feebas, [ Moves.ASSIST, Moves.SKETCH, Moves.PROTECT, Moves.DRAGON_TAIL ]);
game.move.changeMoveset(shuckle, [ Moves.ASSIST, Moves.SKETCH, Moves.PROTECT, Moves.DRAGON_TAIL ]);
game.move.select(Moves.SKETCH, 0);
game.move.select(Moves.PROTECT, 1);
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER, BattlerIndex.PLAYER_2 ]);
@ -78,6 +91,10 @@ describe("Moves - Assist", () => {
game.override.moveset([ Moves.ASSIST, Moves.WOOD_HAMMER, Moves.WOOD_HAMMER, Moves.WOOD_HAMMER ]);
await game.classicMode.startBattle([ Species.FEEBAS, Species.SHUCKLE ]);
const [ feebas, shuckle ] = game.scene.getPlayerField();
game.move.changeMoveset(feebas, [ Moves.ASSIST, Moves.SKETCH, Moves.PROTECT, Moves.DRAGON_TAIL ]);
game.move.changeMoveset(shuckle, [ Moves.ASSIST, Moves.SKETCH, Moves.PROTECT, Moves.DRAGON_TAIL ]);
game.move.select(Moves.ASSIST, 0);
await game.phaseInterceptor.to(CommandPhase);
game.move.select(Moves.ASSIST, 1);

View File

@ -43,7 +43,6 @@ describe("Moves - Metronome", () => {
const player = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
vi.spyOn(randomMoveAttr, "getMoveOverride").mockReturnValue(Moves.DIVE);
vi.spyOn(allMoves[Moves.DIVE], "accuracy", "get").mockReturnValue(100);
game.move.select(Moves.METRONOME);
await game.toNextTurn();
@ -109,6 +108,6 @@ describe("Moves - Metronome", () => {
const hasFled = enemyPokemon.switchOutStatus;
expect(!isVisible && hasFled).toBe(true);
await game.phaseInterceptor.to("BattleEndPhase");
await game.phaseInterceptor.to("CommandPhase");
});
});

View File

@ -34,7 +34,7 @@ describe("Moves - Mirror Move", () => {
.enemyMoveset(Moves.SPLASH);
});
it("should use the last move that the target", async () => {
it("should use the last move that the target used on the user", async () => {
game.override
.battleType("double")
.enemyMoveset([ Moves.TACKLE, Moves.GROWL ]);

View File

@ -46,7 +46,7 @@ describe("Moves - Sleep Talk", () => {
});
it("should fail if the user has no valid moves", async () => {
game.override.moveset([ Moves.SLEEP_TALK, Moves.DIG, Moves.METRONOME, Moves.SOLAR_BEAM, Moves.SLEEP_TALK ]);
game.override.moveset([ Moves.SLEEP_TALK, Moves.DIG, Moves.METRONOME, Moves.SOLAR_BEAM ]);
await game.classicMode.startBattle([ Species.FEEBAS ]);
game.move.select(Moves.SLEEP_TALK);