From e9595954710669526350a04ac2889d34a60016d8 Mon Sep 17 00:00:00 2001 From: "Adrian T." <68144167+torranx@users.noreply.github.com> Date: Tue, 10 Sep 2024 04:03:29 +0800 Subject: [PATCH] [Test] Fix throat chop and gorilla tactics tests (#4140) --- src/test/abilities/gorilla_tactics.test.ts | 17 ++++++++--------- src/test/moves/throat_chop.test.ts | 6 ++++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/test/abilities/gorilla_tactics.test.ts b/src/test/abilities/gorilla_tactics.test.ts index e772088ea97..df698194323 100644 --- a/src/test/abilities/gorilla_tactics.test.ts +++ b/src/test/abilities/gorilla_tactics.test.ts @@ -30,7 +30,7 @@ describe("Abilities - Gorilla Tactics", () => { .enemyMoveset([Moves.SPLASH, Moves.DISABLE]) .enemySpecies(Species.MAGIKARP) .enemyLevel(30) - .moveset([Moves.SPLASH, Moves.TACKLE]) + .moveset([Moves.SPLASH, Moves.TACKLE, Moves.GROWL]) .ability(Abilities.GORILLA_TACTICS); }); @@ -57,22 +57,21 @@ describe("Abilities - Gorilla Tactics", () => { const darmanitan = game.scene.getPlayerPokemon()!; const enemy = game.scene.getEnemyPokemon()!; - game.move.select(Moves.SPLASH); + // First turn, lock move to Growl + game.move.select(Moves.GROWL); + await game.forceEnemyMove(Moves.SPLASH); - await game.phaseInterceptor.to("TurnEndPhase"); - - // Turn where Tackle is interrupted by Disable + // Second turn, Growl is interrupted by Disable await game.toNextTurn(); - game.move.select(Moves.SPLASH); + game.move.select(Moves.GROWL); await game.forceEnemyMove(Moves.DISABLE); - await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); await game.phaseInterceptor.to("TurnEndPhase"); - expect(enemy.hp).toBe(enemy.getMaxHp()); + expect(enemy.getStatStage(Stat.ATK)).toBe(-1); // Only the effect of the first Growl should be applied - // Turn where Struggle is used + // Third turn, Struggle is used await game.toNextTurn(); game.move.select(Moves.TACKLE); diff --git a/src/test/moves/throat_chop.test.ts b/src/test/moves/throat_chop.test.ts index 151aec58b38..cb34b4bafff 100644 --- a/src/test/moves/throat_chop.test.ts +++ b/src/test/moves/throat_chop.test.ts @@ -36,12 +36,14 @@ describe("Moves - Throat Chop", () => { it("prevents the target from using sound-based moves for two turns", async () => { await game.classicMode.startBattle([Species.MAGIKARP]); + const enemy = game.scene.getEnemyPokemon()!; + game.move.select(Moves.GROWL); await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); // First turn, move is interrupted await game.phaseInterceptor.to("TurnEndPhase"); - expect(game.scene.getPlayerPokemon()?.getStatStage(Stat.ATK)).toBe(0); + expect(enemy.getStatStage(Stat.ATK)).toBe(0); // Second turn, struggle if no valid moves await game.toNextTurn(); @@ -50,6 +52,6 @@ describe("Moves - Throat Chop", () => { await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]); await game.phaseInterceptor.to("MoveEndPhase"); - expect(game.scene.getEnemyPokemon()!.isFullHp()).toBe(false); + expect(enemy.isFullHp()).toBe(false); }, TIMEOUT); });