diff --git a/test/abilities/good_as_gold.test.ts b/test/abilities/good_as_gold.test.ts index 89e354b1f34..2490cd43fea 100644 --- a/test/abilities/good_as_gold.test.ts +++ b/test/abilities/good_as_gold.test.ts @@ -45,7 +45,7 @@ describe("Abilities - Good As Gold", () => { const player = game.scene.getPlayerPokemon()!; - game.move.select(MoveId.SPLASH, 0); + game.move.select(MoveId.SPLASH); await game.phaseInterceptor.to("BerryPhase"); @@ -54,12 +54,13 @@ describe("Abilities - Good As Gold", () => { }); it("should block memento and prevent the user from fainting", async () => { - game.override.enemyMoveset([MoveId.MEMENTO]); + game.override.enemyAbility(AbilityId.GOOD_AS_GOLD); await game.classicMode.startBattle([SpeciesId.MAGIKARP]); - game.move.select(MoveId.MEMENTO); + + game.move.use(MoveId.MEMENTO); await game.phaseInterceptor.to("BerryPhase"); - expect(game.scene.getPlayerPokemon()!.isFainted()).toBe(false); - expect(game.scene.getEnemyPokemon()?.getStatStage(Stat.ATK)).toBe(0); + expect(game.field.getPlayerPokemon().isFainted()).toBe(false); + expect(game.field.getEnemyPokemon().getStatStage(Stat.ATK)).toBe(0); }); it("should not block any status moves that target the field, one side, or all pokemon", async () => { diff --git a/test/abilities/imposter.test.ts b/test/abilities/imposter.test.ts index 30491139877..0023dd594da 100644 --- a/test/abilities/imposter.test.ts +++ b/test/abilities/imposter.test.ts @@ -75,8 +75,6 @@ describe("Abilities - Imposter", () => { }); it("should copy in-battle overridden stats", async () => { - game.override.enemyMoveset([MoveId.POWER_SPLIT]); - await game.classicMode.startBattle([SpeciesId.DITTO]); const player = game.scene.getPlayerPokemon()!; @@ -85,7 +83,8 @@ describe("Abilities - Imposter", () => { const avgAtk = Math.floor((player.getStat(Stat.ATK, false) + enemy.getStat(Stat.ATK, false)) / 2); const avgSpAtk = Math.floor((player.getStat(Stat.SPATK, false) + enemy.getStat(Stat.SPATK, false)) / 2); - game.move.select(MoveId.TACKLE); + game.move.use(MoveId.TACKLE); + await game.move.forceEnemyMove(MoveId.POWER_SPLIT); await game.phaseInterceptor.to(TurnEndPhase); expect(player.getStat(Stat.ATK, false)).toBe(avgAtk); @@ -101,31 +100,22 @@ describe("Abilities - Imposter", () => { await game.classicMode.startBattle([SpeciesId.DITTO]); const player = game.scene.getPlayerPokemon()!; - game.move.select(MoveId.TACKLE); - await game.phaseInterceptor.to(TurnEndPhase); - player.getMoveset().forEach(move => { // Should set correct maximum PP without touching `ppUp` - if (move) { - if (move.moveId === MoveId.SKETCH) { - expect(move.getMovePp()).toBe(1); - } else { - expect(move.getMovePp()).toBe(5); - } - expect(move.ppUp).toBe(0); + if (move.moveId === MoveId.SKETCH) { + expect(move.getMovePp()).toBe(1); + } else { + expect(move.getMovePp()).toBe(5); } + expect(move.ppUp).toBe(0); }); }); it("should activate its ability if it copies one that activates on summon", async () => { game.override.enemyAbility(AbilityId.INTIMIDATE); - await game.classicMode.startBattle([SpeciesId.DITTO]); - game.move.select(MoveId.TACKLE); - await game.phaseInterceptor.to("MoveEndPhase"); - - expect(game.scene.getEnemyPokemon()?.getStatStage(Stat.ATK)).toBe(-1); + expect(game.field.getEnemyPokemon().getStatStage(Stat.ATK)).toBe(-1); }); it("should persist transformed attributes across reloads", async () => { diff --git a/test/abilities/storm_drain.test.ts b/test/abilities/storm_drain.test.ts index 8eedf0c7ce8..28085138d75 100644 --- a/test/abilities/storm_drain.test.ts +++ b/test/abilities/storm_drain.test.ts @@ -96,16 +96,15 @@ describe("Abilities - Storm Drain", () => { }); it("should redirect moves changed to water type via ability", async () => { - game.override.ability(AbilityId.LIQUID_VOICE).moveset(MoveId.PSYCHIC_NOISE); - await game.classicMode.startBattle([SpeciesId.FEEBAS, SpeciesId.MAGIKARP]); + game.override.ability(AbilityId.LIQUID_VOICE); + await game.classicMode.startBattle([SpeciesId.FEEBAS]); const enemy1 = game.scene.getEnemyField()[0]; const enemy2 = game.scene.getEnemyField()[1]; enemy2.summonData.ability = AbilityId.STORM_DRAIN; - game.move.select(MoveId.PSYCHIC_NOISE, BattlerIndex.PLAYER, BattlerIndex.ENEMY); - game.move.select(MoveId.SPLASH, BattlerIndex.PLAYER_2); + game.move.use(MoveId.HYPER_VOICE, BattlerIndex.PLAYER, BattlerIndex.ENEMY); await game.phaseInterceptor.to("BerryPhase"); expect(enemy1.isFullHp()).toBe(true); diff --git a/test/moves/aurora_veil.test.ts b/test/moves/aurora_veil.test.ts index b9ae79e4155..8faf3654401 100644 --- a/test/moves/aurora_veil.test.ts +++ b/test/moves/aurora_veil.test.ts @@ -4,7 +4,6 @@ import type Move from "#app/data/moves/move"; import { allMoves } from "#app/data/data-lists"; import { ArenaTagType } from "#app/enums/arena-tag-type"; import type Pokemon from "#app/field/pokemon"; -import { TurnEndPhase } from "#app/phases/turn-end-phase"; import { NumberHolder } from "#app/utils/common"; import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; @@ -12,7 +11,7 @@ import { SpeciesId } from "#enums/species-id"; import { WeatherType } from "#enums/weather-type"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; let globalScene: BattleScene; @@ -52,10 +51,10 @@ describe("Moves - Aurora Veil", () => { game.move.select(moveToUse); - await game.phaseInterceptor.to(TurnEndPhase); + await game.toEndOfTurn(); const mockedDmg = getMockedMoveDamage( - game.scene.getEnemyPokemon()!, - game.scene.getPlayerPokemon()!, + game.field.getEnemyPokemon(), + game.field.getPlayerPokemon(), allMoves[moveToUse], ); @@ -71,10 +70,10 @@ describe("Moves - Aurora Veil", () => { game.move.select(moveToUse); game.move.select(moveToUse, 1); - await game.phaseInterceptor.to(TurnEndPhase); + await game.toEndOfTurn(); const mockedDmg = getMockedMoveDamage( - game.scene.getEnemyPokemon()!, - game.scene.getPlayerPokemon()!, + game.field.getEnemyPokemon(), + game.field.getPlayerPokemon(), allMoves[moveToUse], ); @@ -82,72 +81,48 @@ describe("Moves - Aurora Veil", () => { }); it("reduces damage of special attacks by half in a single battle", async () => { - const moveToUse = MoveId.ABSORB; await game.classicMode.startBattle([SpeciesId.SHUCKLE]); - game.move.select(moveToUse); + game.move.use(MoveId.ABSORB); - await game.phaseInterceptor.to(TurnEndPhase); + await game.toEndOfTurn(); const mockedDmg = getMockedMoveDamage( - game.scene.getEnemyPokemon()!, - game.scene.getPlayerPokemon()!, - allMoves[moveToUse], + game.field.getEnemyPokemon(), + game.field.getPlayerPokemon(), + allMoves[MoveId.ABSORB], ); - expect(mockedDmg).toBe(allMoves[moveToUse].power * singleBattleMultiplier); + expect(mockedDmg).toBe(allMoves[MoveId.ABSORB].power * singleBattleMultiplier); }); it("reduces damage of special attacks by a third in a double battle", async () => { game.override.battleStyle("double"); - - const moveToUse = MoveId.DAZZLING_GLEAM; - await game.classicMode.startBattle([SpeciesId.SHUCKLE, SpeciesId.SHUCKLE]); - - game.move.select(moveToUse); - game.move.select(moveToUse, 1); - - await game.phaseInterceptor.to(TurnEndPhase); - const mockedDmg = getMockedMoveDamage( - game.scene.getEnemyPokemon()!, - game.scene.getPlayerPokemon()!, - allMoves[moveToUse], - ); - - expect(mockedDmg).toBe(allMoves[moveToUse].power * doubleBattleMultiplier); - }); - - it("does not affect physical critical hits", async () => { - game.override.moveset([MoveId.WICKED_BLOW]); - const moveToUse = MoveId.WICKED_BLOW; await game.classicMode.startBattle([SpeciesId.SHUCKLE]); - game.move.select(moveToUse); - await game.phaseInterceptor.to(TurnEndPhase); - + game.move.use(MoveId.ABSORB); + await game.toEndOfTurn(); const mockedDmg = getMockedMoveDamage( - game.scene.getEnemyPokemon()!, - game.scene.getPlayerPokemon()!, - allMoves[moveToUse], + game.field.getEnemyPokemon(), + game.field.getPlayerPokemon(), + allMoves[MoveId.ABSORB], ); - expect(mockedDmg).toBe(allMoves[moveToUse].power); + + expect(mockedDmg).toBe(allMoves[MoveId.ABSORB].power * doubleBattleMultiplier); }); it("does not affect critical hits", async () => { - game.override.moveset([MoveId.FROST_BREATH]); - const moveToUse = MoveId.FROST_BREATH; - vi.spyOn(allMoves[MoveId.FROST_BREATH], "accuracy", "get").mockReturnValue(100); await game.classicMode.startBattle([SpeciesId.SHUCKLE]); - game.move.select(moveToUse); - await game.phaseInterceptor.to(TurnEndPhase); + game.move.use(MoveId.WICKED_BLOW); + await game.toEndOfTurn(); const mockedDmg = getMockedMoveDamage( - game.scene.getEnemyPokemon()!, - game.scene.getPlayerPokemon()!, - allMoves[moveToUse], + game.field.getEnemyPokemon(), + game.field.getPlayerPokemon(), + allMoves[MoveId.WICKED_BLOW], ); - expect(mockedDmg).toBe(allMoves[moveToUse].power); + expect(mockedDmg).toBe(allMoves[MoveId.WICKED_BLOW].power); }); });