diff --git a/test/abilities/screen_cleaner.test.ts b/test/abilities/screen_cleaner.test.ts index e896d2e51f9..790ffcdc462 100644 --- a/test/abilities/screen_cleaner.test.ts +++ b/test/abilities/screen_cleaner.test.ts @@ -28,11 +28,11 @@ describe("Abilities - Screen Cleaner", () => { }); it("removes Aurora Veil", async () => { - game.override.moveset([MoveId.HAIL]).enemyMoveset(MoveId.AURORA_VEIL); + game.override.enemyMoveset(MoveId.AURORA_VEIL); await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]); - game.move.select(MoveId.HAIL); + game.move.use(MoveId.HAIL); await game.phaseInterceptor.to(TurnEndPhase); expect(game.scene.arena.getTag(ArenaTagType.AURORA_VEIL)).toBeDefined(); @@ -49,7 +49,7 @@ describe("Abilities - Screen Cleaner", () => { await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]); - game.move.select(MoveId.SPLASH); + game.move.use(MoveId.SPLASH); await game.phaseInterceptor.to(TurnEndPhase); expect(game.scene.arena.getTag(ArenaTagType.LIGHT_SCREEN)).toBeDefined(); @@ -66,7 +66,7 @@ describe("Abilities - Screen Cleaner", () => { await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]); - game.move.select(MoveId.SPLASH); + game.move.use(MoveId.SPLASH); await game.phaseInterceptor.to(TurnEndPhase); expect(game.scene.arena.getTag(ArenaTagType.REFLECT)).toBeDefined(); diff --git a/test/moves/gastro_acid.test.ts b/test/moves/gastro_acid.test.ts index baa4a4b863a..15a63561f94 100644 --- a/test/moves/gastro_acid.test.ts +++ b/test/moves/gastro_acid.test.ts @@ -103,7 +103,7 @@ describe("Moves - Gastro Acid", () => { game.move.use(MoveId.WATER_GUN); await game.toNextTurn(); // water gun should've dealt damage due to suppressed Water Absorb - expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp()); + expect(enemyPokemon.hp).toBeLessThan(enemyPokemon.getMaxHp()); game.move.use(MoveId.SPORE); await game.toEndOfTurn(); diff --git a/test/moves/spikes.test.ts b/test/moves/spikes.test.ts index f6f603ef2c4..180785b558a 100644 --- a/test/moves/spikes.test.ts +++ b/test/moves/spikes.test.ts @@ -6,6 +6,7 @@ import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { ArenaTrapTag } from "#app/data/arena-tag"; import { ArenaTagSide } from "#enums/arena-tag-side"; +import { BattlerIndex } from "#enums/battler-index"; describe("Moves - Spikes", () => { let phaserGame: Phaser.Game; @@ -81,12 +82,12 @@ describe("Moves - Spikes", () => { }); it("should work when all targets fainted", async () => { - game.override.enemySpecies(SpeciesId.DIGLETT).battleStyle("double").startingLevel(50); - await game.classicMode.startBattle([SpeciesId.RAYQUAZA]); + game.override.enemySpecies(SpeciesId.DIGLETT).battleStyle("double").startingLevel(1000); + await game.classicMode.startBattle([SpeciesId.RAYQUAZA, SpeciesId.SHUCKLE]); - game.move.use(MoveId.SPIKES); - await game.doKillOpponents(); - await game.phaseInterceptor.to("TurnEndPhase"); + game.move.use(MoveId.HYPER_VOICE, BattlerIndex.PLAYER); + game.move.use(MoveId.SPIKES, BattlerIndex.PLAYER_2); + await game.toNextWave(); expect(game.scene.arena.getTagOnSide(ArenaTrapTag, ArenaTagSide.ENEMY)).toBeDefined(); }); diff --git a/test/testUtils/gameManager.ts b/test/testUtils/gameManager.ts index f4ba31499d4..91f9096f3d4 100644 --- a/test/testUtils/gameManager.ts +++ b/test/testUtils/gameManager.ts @@ -12,7 +12,6 @@ import overrides from "#app/overrides"; import { CheckSwitchPhase } from "#app/phases/check-switch-phase"; import { CommandPhase } from "#app/phases/command-phase"; import { EncounterPhase } from "#app/phases/encounter-phase"; -import { FaintPhase } from "#app/phases/faint-phase"; import { LoginPhase } from "#app/phases/login-phase"; import { MovePhase } from "#app/phases/move-phase"; import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases"; @@ -452,17 +451,14 @@ export default class GameManager { } /** - * Faints a player or enemy pokemon instantly by setting their HP to 0. + * Faint a player or enemy pokemon instantly by setting their HP to 0. * @param pokemon - The player/enemy pokemon being fainted - * @returns A promise that resolves once the fainted pokemon's FaintPhase finishes running. + * @returns A Promise that resolves once the fainted pokemon's FaintPhase finishes running. */ async killPokemon(pokemon: PlayerPokemon | EnemyPokemon) { - return new Promise(async (resolve, reject) => { - pokemon.hp = 0; - this.scene.phaseManager.pushPhase(new FaintPhase(pokemon.getBattlerIndex(), true)); - await this.phaseInterceptor.to(FaintPhase).catch(e => reject(e)); - resolve(); - }); + pokemon.hp = 0; + this.scene.phaseManager.pushNew("FaintPhase", pokemon.getBattlerIndex(), true); + await this.phaseInterceptor.to("FaintPhase"); } /**