diff --git a/test/abilities/commander.test.ts b/test/abilities/commander.test.ts index 5ddafc90d05..8c19ee083c5 100644 --- a/test/abilities/commander.test.ts +++ b/test/abilities/commander.test.ts @@ -200,8 +200,6 @@ describe("Abilities - Commander", () => { game.move.select(MoveId.DIVE, 0, BattlerIndex.ENEMY); game.move.select(MoveId.SPLASH, 1); - - await game.phaseInterceptor.to("CommandPhase"); await game.toNextTurn(); expect(tatsugiri.getTag(BattlerTagType.UNDERWATER)).toBeDefined(); diff --git a/test/abilities/costar.test.ts b/test/abilities/costar.test.ts index 42d8f7811f8..c8c0ffd3184 100644 --- a/test/abilities/costar.test.ts +++ b/test/abilities/costar.test.ts @@ -2,7 +2,6 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { CommandPhase } from "#phases/command-phase"; import { MessagePhase } from "#phases/message-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; @@ -39,7 +38,6 @@ describe("Abilities - COSTAR", () => { let [leftPokemon, rightPokemon] = game.scene.getPlayerField(); game.move.select(MoveId.NASTY_PLOT); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH, 1); await game.toNextTurn(); @@ -47,7 +45,6 @@ describe("Abilities - COSTAR", () => { expect(rightPokemon.getStatStage(Stat.SPATK)).toBe(0); game.move.select(MoveId.SPLASH); - await game.phaseInterceptor.to(CommandPhase); game.doSwitchPokemon(2); await game.phaseInterceptor.to(MessagePhase); @@ -67,7 +64,6 @@ describe("Abilities - COSTAR", () => { expect(leftPokemon.getStatStage(Stat.ATK)).toBe(-2); game.move.select(MoveId.SPLASH); - await game.phaseInterceptor.to(CommandPhase); game.doSwitchPokemon(2); await game.phaseInterceptor.to(MessagePhase); diff --git a/test/abilities/pastel_veil.test.ts b/test/abilities/pastel_veil.test.ts index 47fdd751931..88f5415524f 100644 --- a/test/abilities/pastel_veil.test.ts +++ b/test/abilities/pastel_veil.test.ts @@ -3,7 +3,6 @@ import { BattlerIndex } from "#enums/battler-index"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { CommandPhase } from "#phases/command-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; @@ -63,7 +62,6 @@ describe("Abilities - Pastel Veil", () => { await game.phaseInterceptor.to(TurnEndPhase); expect(magikarp.status?.effect).toBe(StatusEffect.POISON); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH); game.doSwitchPokemon(2); await game.phaseInterceptor.to(TurnEndPhase); diff --git a/test/abilities/sand_veil.test.ts b/test/abilities/sand_veil.test.ts index b37901f65c3..2ad9ef7eaa1 100644 --- a/test/abilities/sand_veil.test.ts +++ b/test/abilities/sand_veil.test.ts @@ -4,7 +4,6 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { WeatherType } from "#enums/weather-type"; -import { CommandPhase } from "#phases/command-phase"; import { MoveEffectPhase } from "#phases/move-effect-phase"; import { MoveEndPhase } from "#phases/move-end-phase"; import { GameManager } from "#test/testUtils/gameManager"; @@ -59,9 +58,6 @@ describe("Abilities - Sand Veil", () => { expect(leadPokemon[1].hasAbility(AbilityId.SAND_VEIL)).toBe(false); game.move.select(MoveId.SPLASH); - - await game.phaseInterceptor.to(CommandPhase); - game.move.select(MoveId.SPLASH, 1); await game.phaseInterceptor.to(MoveEffectPhase, false); diff --git a/test/abilities/sweet_veil.test.ts b/test/abilities/sweet_veil.test.ts index 97ddb2c5f36..ca98e827c4f 100644 --- a/test/abilities/sweet_veil.test.ts +++ b/test/abilities/sweet_veil.test.ts @@ -3,7 +3,6 @@ import { BattlerIndex } from "#enums/battler-index"; import { BattlerTagType } from "#enums/battler-tag-type"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { CommandPhase } from "#phases/command-phase"; import { TurnEndPhase } from "#phases/turn-end-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; @@ -80,7 +79,6 @@ describe("Abilities - Sweet Veil", () => { expect(game.scene.getPlayerField().some(p => !!p.getTag(BattlerTagType.DROWSY))).toBe(true); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH); game.doSwitchPokemon(2); diff --git a/test/final_boss.test.ts b/test/final_boss.test.ts index 59918d28aa5..9dc54490330 100644 --- a/test/final_boss.test.ts +++ b/test/final_boss.test.ts @@ -29,7 +29,6 @@ describe("Final Boss", () => { .startingBiome(BiomeId.END) .criticalHits(false) .enemyMoveset(MoveId.SPLASH) - .moveset([MoveId.SPLASH, MoveId.WILL_O_WISP, MoveId.DRAGON_PULSE]) .startingLevel(10000); }); @@ -63,33 +62,31 @@ describe("Final Boss", () => { expect(game.scene.getEnemyPokemon()!.species.speciesId).not.toBe(SpeciesId.ETERNATUS); }); - it("should not have passive enabled on Eternatus", async () => { + it("should initially spawn in regular form without passive & 4 boss segments", async () => { await game.runToFinalBossEncounter([SpeciesId.BIDOOF], GameModes.CLASSIC); const eternatus = game.scene.getEnemyPokemon()!; + expect(eternatus.formIndex).toBe(0); + expect(eternatus.bossSegments).toBe(4); + expect(eternatus.bossSegmentIndex).toBe(3); expect(eternatus.species.speciesId).toBe(SpeciesId.ETERNATUS); expect(eternatus.hasPassive()).toBe(false); }); it("should change form on direct hit down to last boss fragment", async () => { await game.runToFinalBossEncounter([SpeciesId.KYUREM], GameModes.CLASSIC); - await game.phaseInterceptor.to("CommandPhase"); - // Eternatus phase 1 + // phase 1 const eternatus = game.scene.getEnemyPokemon()!; const phase1Hp = eternatus.getMaxHp(); - expect(eternatus.species.speciesId).toBe(SpeciesId.ETERNATUS); - expect(eternatus.formIndex).toBe(0); - expect(eternatus.bossSegments).toBe(4); - expect(eternatus.bossSegmentIndex).toBe(3); - game.move.select(MoveId.DRAGON_PULSE); + game.move.use(MoveId.DRAGON_PULSE); await game.toNextTurn(); - // Eternatus phase 2: changed form, healed and restored its shields + // Eternatus phase 2: changed form, healed fully and restored its shields expect(eternatus.species.speciesId).toBe(SpeciesId.ETERNATUS); - expect(eternatus.hp).toBeGreaterThan(phase1Hp); expect(eternatus.hp).toBe(eternatus.getMaxHp()); + expect(eternatus.getMaxHp()).toBeGreaterThan(phase1Hp); expect(eternatus.formIndex).toBe(1); expect(eternatus.bossSegments).toBe(5); expect(eternatus.bossSegmentIndex).toBe(4); @@ -100,19 +97,13 @@ describe("Final Boss", () => { it("should change form on status damage down to last boss fragment", async () => { game.override.ability(AbilityId.NO_GUARD); - - await game.runToFinalBossEncounter([SpeciesId.BIDOOF], GameModes.CLASSIC); - await game.phaseInterceptor.to("CommandPhase"); + await game.runToFinalBossEncounter([SpeciesId.SALAZZLE], GameModes.CLASSIC); // Eternatus phase 1 const eternatus = game.scene.getEnemyPokemon()!; const phase1Hp = eternatus.getMaxHp(); - expect(eternatus.species.speciesId).toBe(SpeciesId.ETERNATUS); - expect(eternatus.formIndex).toBe(0); - expect(eternatus.bossSegments).toBe(4); - expect(eternatus.bossSegmentIndex).toBe(3); - game.move.select(MoveId.WILL_O_WISP); + game.move.use(MoveId.WILL_O_WISP); await game.toNextTurn(); expect(eternatus.status?.effect).toBe(StatusEffect.BURN); @@ -120,19 +111,19 @@ describe("Final Boss", () => { const lastShieldHp = Math.ceil(phase1Hp / eternatus.bossSegments); // Stall until the burn is one hit away from breaking the last shield while (eternatus.hp - tickDamage > lastShieldHp) { - game.move.select(MoveId.SPLASH); + game.move.use(MoveId.SPLASH); await game.toNextTurn(); } expect(eternatus.bossSegmentIndex).toBe(1); - game.move.select(MoveId.SPLASH); + game.move.use(MoveId.SPLASH); await game.toNextTurn(); // Eternatus phase 2: changed form, healed and restored its shields expect(eternatus.hp).toBeGreaterThan(phase1Hp); expect(eternatus.hp).toBe(eternatus.getMaxHp()); - expect(eternatus.status).toBeFalsy(); + expect(eternatus.status?.effect).toBeUndefined(); expect(eternatus.formIndex).toBe(1); expect(eternatus.bossSegments).toBe(5); expect(eternatus.bossSegmentIndex).toBe(4); diff --git a/test/moves/aromatherapy.test.ts b/test/moves/aromatherapy.test.ts index d18f886bff2..39850c4f841 100644 --- a/test/moves/aromatherapy.test.ts +++ b/test/moves/aromatherapy.test.ts @@ -2,7 +2,6 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { CommandPhase } from "#phases/command-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; @@ -40,7 +39,6 @@ describe("Moves - Aromatherapy", () => { vi.spyOn(partyPokemon, "resetStatus"); game.move.select(MoveId.AROMATHERAPY, 0); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH, 1); await game.toNextTurn(); @@ -62,7 +60,6 @@ describe("Moves - Aromatherapy", () => { vi.spyOn(rightOpp, "resetStatus"); game.move.select(MoveId.AROMATHERAPY, 0); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH, 1); await game.toNextTurn(); @@ -86,7 +83,6 @@ describe("Moves - Aromatherapy", () => { vi.spyOn(partyPokemon, "resetStatus"); game.move.select(MoveId.AROMATHERAPY, 0); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH, 1); await game.toNextTurn(); diff --git a/test/moves/assist.test.ts b/test/moves/assist.test.ts index 6ef8946eaf8..eff153534dd 100644 --- a/test/moves/assist.test.ts +++ b/test/moves/assist.test.ts @@ -4,7 +4,6 @@ import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { CommandPhase } from "#phases/command-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; @@ -80,7 +79,6 @@ describe("Moves - Assist", () => { // Player uses Sketch to copy Swords Dance, Player_2 stalls a turn. Player will attempt Assist and should have no usable moves await game.toNextTurn(); game.move.select(MoveId.ASSIST, 0); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.PROTECT, 1); await game.toNextTurn(); @@ -96,7 +94,6 @@ describe("Moves - Assist", () => { game.move.changeMoveset(shuckle, [MoveId.ASSIST, MoveId.SKETCH, MoveId.PROTECT, MoveId.DRAGON_TAIL]); game.move.select(MoveId.ASSIST, 0); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.ASSIST, 1); await game.toNextTurn(); diff --git a/test/moves/crafty_shield.test.ts b/test/moves/crafty_shield.test.ts index b9dbac76b90..98c0dfd7c9a 100644 --- a/test/moves/crafty_shield.test.ts +++ b/test/moves/crafty_shield.test.ts @@ -4,7 +4,6 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { BerryPhase } from "#phases/berry-phase"; -import { CommandPhase } from "#phases/command-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; @@ -42,9 +41,6 @@ describe("Moves - Crafty Shield", () => { const leadPokemon = game.scene.getPlayerField(); game.move.select(MoveId.CRAFTY_SHIELD); - - await game.phaseInterceptor.to(CommandPhase); - game.move.select(MoveId.SPLASH, 1); await game.phaseInterceptor.to(BerryPhase, false); @@ -60,9 +56,6 @@ describe("Moves - Crafty Shield", () => { const leadPokemon = game.scene.getPlayerField(); game.move.select(MoveId.CRAFTY_SHIELD); - - await game.phaseInterceptor.to(CommandPhase); - game.move.select(MoveId.SPLASH, 1); await game.phaseInterceptor.to(BerryPhase, false); @@ -78,9 +71,6 @@ describe("Moves - Crafty Shield", () => { const leadPokemon = game.scene.getPlayerField(); game.move.select(MoveId.CRAFTY_SHIELD); - - await game.phaseInterceptor.to(CommandPhase); - game.move.select(MoveId.SPLASH, 1); await game.phaseInterceptor.to(BerryPhase, false); @@ -94,9 +84,6 @@ describe("Moves - Crafty Shield", () => { const leadPokemon = game.scene.getPlayerField(); game.move.select(MoveId.CRAFTY_SHIELD); - - await game.phaseInterceptor.to(CommandPhase); - game.move.select(MoveId.SWORDS_DANCE, 1); await game.phaseInterceptor.to(BerryPhase, false); diff --git a/test/moves/freezy_frost.test.ts b/test/moves/freezy_frost.test.ts index 9c917ee0854..9cf2f38b286 100644 --- a/test/moves/freezy_frost.test.ts +++ b/test/moves/freezy_frost.test.ts @@ -3,7 +3,6 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { CommandPhase } from "#phases/command-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; @@ -77,7 +76,6 @@ describe("Moves - Freezy Frost", () => { const [leftOpp, rightOpp] = game.scene.getEnemyField(); game.move.select(MoveId.HOWL, 0); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH, 1); await game.toNextTurn(); @@ -87,7 +85,6 @@ describe("Moves - Freezy Frost", () => { expect(rightOpp.getStatStage(Stat.ATK)).toBe(2); game.move.select(MoveId.FREEZY_FROST, 0, leftOpp.getBattlerIndex()); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH, 1); await game.toNextTurn(); diff --git a/test/moves/heal_bell.test.ts b/test/moves/heal_bell.test.ts index b6d757300ad..e7f6548713a 100644 --- a/test/moves/heal_bell.test.ts +++ b/test/moves/heal_bell.test.ts @@ -2,7 +2,6 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { CommandPhase } from "#phases/command-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; @@ -40,7 +39,6 @@ describe("Moves - Heal Bell", () => { vi.spyOn(partyPokemon, "resetStatus"); game.move.select(MoveId.HEAL_BELL, 0); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH, 1); await game.toNextTurn(); @@ -62,7 +60,6 @@ describe("Moves - Heal Bell", () => { vi.spyOn(rightOpp, "resetStatus"); game.move.select(MoveId.HEAL_BELL, 0); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH, 1); await game.toNextTurn(); @@ -86,7 +83,6 @@ describe("Moves - Heal Bell", () => { vi.spyOn(partyPokemon, "resetStatus"); game.move.select(MoveId.HEAL_BELL, 0); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH, 1); await game.toNextTurn(); diff --git a/test/moves/lunar_blessing.test.ts b/test/moves/lunar_blessing.test.ts index 5d6bc44201d..481156748e3 100644 --- a/test/moves/lunar_blessing.test.ts +++ b/test/moves/lunar_blessing.test.ts @@ -2,7 +2,6 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { CommandPhase } from "#phases/command-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; @@ -47,7 +46,6 @@ describe("Moves - Lunar Blessing", () => { vi.spyOn(rightPlayer, "heal"); game.move.select(MoveId.LUNAR_BLESSING, 0); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH, 1); await game.toNextTurn(); @@ -67,7 +65,6 @@ describe("Moves - Lunar Blessing", () => { vi.spyOn(rightPlayer, "resetStatus"); game.move.select(MoveId.LUNAR_BLESSING, 0); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH, 1); await game.toNextTurn(); diff --git a/test/moves/lunar_dance.test.ts b/test/moves/lunar_dance.test.ts index c49baad3e8f..3fcf953a37c 100644 --- a/test/moves/lunar_dance.test.ts +++ b/test/moves/lunar_dance.test.ts @@ -2,7 +2,6 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { CommandPhase } from "#phases/command-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; @@ -40,7 +39,6 @@ describe("Moves - Lunar Dance", () => { game.move.select(MoveId.SPLASH, 0); game.move.select(MoveId.SPLASH, 1); - await game.phaseInterceptor.to(CommandPhase); await game.toNextTurn(); // Bulbasaur should still be burned and have used a PP for splash and not at max hp @@ -51,7 +49,6 @@ describe("Moves - Lunar Dance", () => { // Switch out Bulbasaur for Rattata so we can swtich bulbasaur back in with lunar dance game.doSwitchPokemon(2); game.move.select(MoveId.SPLASH, 1); - await game.phaseInterceptor.to(CommandPhase); await game.toNextTurn(); game.move.select(MoveId.SPLASH, 0); @@ -67,7 +64,6 @@ describe("Moves - Lunar Dance", () => { game.move.select(MoveId.SPLASH, 0); game.move.select(MoveId.LUNAR_DANCE); - await game.phaseInterceptor.to(CommandPhase); await game.toNextTurn(); // Using Lunar dance again should fail because nothing in party and rattata should be alive diff --git a/test/moves/magnet_rise.test.ts b/test/moves/magnet_rise.test.ts index 0fc96fa1a05..da76c178be8 100644 --- a/test/moves/magnet_rise.test.ts +++ b/test/moves/magnet_rise.test.ts @@ -1,7 +1,5 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { CommandPhase } from "#phases/command-phase"; -import { TurnEndPhase } from "#phases/turn-end-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; @@ -9,7 +7,6 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Moves - Magnet Rise", () => { let phaserGame: Phaser.Game; let game: GameManager; - const moveToUse = MoveId.MAGNET_RISE; beforeAll(() => { phaserGame = new Phaser.Game({ @@ -25,38 +22,36 @@ describe("Moves - Magnet Rise", () => { game = new GameManager(phaserGame); game.override .battleStyle("single") - .starterSpecies(SpeciesId.MAGNEZONE) .enemySpecies(SpeciesId.RATTATA) - .enemyMoveset(MoveId.DRILL_RUN) + .enemyMoveset(MoveId.EARTHQUAKE) .criticalHits(false) - .enemyLevel(1) - .moveset([moveToUse, MoveId.SPLASH, MoveId.GRAVITY, MoveId.BATON_PASS]); + .enemyLevel(1); }); - it("MAGNET RISE", async () => { - await game.classicMode.startBattle(); + it("should make the user immune to ground-type moves", async () => { + await game.classicMode.startBattle([SpeciesId.MAGNEZONE]); - const startingHp = game.scene.getPlayerParty()[0].hp; - game.move.select(moveToUse); - await game.phaseInterceptor.to(TurnEndPhase); - const finalHp = game.scene.getPlayerParty()[0].hp; - const hpLost = finalHp - startingHp; - expect(hpLost).toBe(0); + game.move.use(MoveId.MAGNET_RISE); + await game.toEndOfTurn(); + + const magnezone = game.field.getPlayerPokemon(); + expect(magnezone.hp).toBe(magnezone.getMaxHp()); + expect(magnezone.isGrounded()).toBe(false); }); - it("MAGNET RISE - Gravity", async () => { - await game.classicMode.startBattle(); + it("should be removed by gravity", async () => { + await game.classicMode.startBattle([SpeciesId.MAGNEZONE]); - const startingHp = game.scene.getPlayerParty()[0].hp; - game.move.select(moveToUse); - await game.phaseInterceptor.to(CommandPhase); - let finalHp = game.scene.getPlayerParty()[0].hp; - let hpLost = finalHp - startingHp; - expect(hpLost).toBe(0); - game.move.select(MoveId.GRAVITY); - await game.phaseInterceptor.to(TurnEndPhase); - finalHp = game.scene.getPlayerParty()[0].hp; - hpLost = finalHp - startingHp; - expect(hpLost).not.toBe(0); + game.move.use(MoveId.MAGNET_RISE); + await game.toNextTurn(); + + const magnezone = game.field.getPlayerPokemon(); + expect(magnezone.hp).toBe(magnezone.getMaxHp()); + + game.move.use(MoveId.GRAVITY); + await game.toEndOfTurn(); + + expect(magnezone.hp).toBeLessThan(magnezone.getMaxHp()); + expect(magnezone.isGrounded()).toBe(true); }); }); diff --git a/test/moves/mat_block.test.ts b/test/moves/mat_block.test.ts index edbe465e500..954e2a8135d 100644 --- a/test/moves/mat_block.test.ts +++ b/test/moves/mat_block.test.ts @@ -42,9 +42,6 @@ describe("Moves - Mat Block", () => { const leadPokemon = game.scene.getPlayerField(); game.move.select(MoveId.MAT_BLOCK); - - await game.phaseInterceptor.to(CommandPhase); - game.move.select(MoveId.SPLASH, 1); await game.phaseInterceptor.to(BerryPhase, false); @@ -60,9 +57,6 @@ describe("Moves - Mat Block", () => { const leadPokemon = game.scene.getPlayerField(); game.move.select(MoveId.MAT_BLOCK); - - await game.phaseInterceptor.to(CommandPhase); - game.move.select(MoveId.SPLASH, 1); await game.phaseInterceptor.to(BerryPhase, false); @@ -76,7 +70,6 @@ describe("Moves - Mat Block", () => { const leadPokemon = game.scene.getPlayerField(); game.move.select(MoveId.SPLASH); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH, 1); await game.phaseInterceptor.to(TurnEndPhase); @@ -85,7 +78,6 @@ describe("Moves - Mat Block", () => { await game.phaseInterceptor.to(CommandPhase, false); game.move.select(MoveId.MAT_BLOCK); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.MAT_BLOCK, 1); await game.phaseInterceptor.to(BerryPhase, false); diff --git a/test/moves/metronome.test.ts b/test/moves/metronome.test.ts index 9a9fcdff04a..8ca9e63582e 100644 --- a/test/moves/metronome.test.ts +++ b/test/moves/metronome.test.ts @@ -9,7 +9,6 @@ import { MoveUseMode } from "#enums/move-use-mode"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import type { RandomMoveAttr } from "#moves/move"; -import { CommandPhase } from "#phases/command-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; @@ -125,7 +124,6 @@ describe("Moves - Metronome", () => { vi.spyOn(randomMoveAttr, "getMoveOverride").mockReturnValue(MoveId.AROMATIC_MIST); game.move.select(MoveId.METRONOME, 0); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH, 1); await game.toNextTurn(); @@ -148,6 +146,6 @@ describe("Moves - Metronome", () => { const hasFled = enemyPokemon.switchOutStatus; expect(!isVisible && hasFled).toBe(true); - await game.phaseInterceptor.to("CommandPhase"); + await game.toNextTurn(); }); }); diff --git a/test/moves/rollout.test.ts b/test/moves/rollout.test.ts index 46c53b05c6c..eed61f82ab4 100644 --- a/test/moves/rollout.test.ts +++ b/test/moves/rollout.test.ts @@ -2,7 +2,6 @@ import { allMoves } from "#data/data-lists"; import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; -import { CommandPhase } from "#phases/command-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; @@ -57,8 +56,7 @@ describe("Moves - Rollout", () => { for (let i = 0; i < turns; i++) { game.move.select(MoveId.ROLLOUT); - await game.phaseInterceptor.to(CommandPhase); - + await game.toNextTurn(); dmgHistory.push(previousHp - enemyPkm.hp); previousHp = enemyPkm.hp; } diff --git a/test/moves/sparkly_swirl.test.ts b/test/moves/sparkly_swirl.test.ts index b81bda66c56..d58b6efe990 100644 --- a/test/moves/sparkly_swirl.test.ts +++ b/test/moves/sparkly_swirl.test.ts @@ -3,7 +3,6 @@ import { AbilityId } from "#enums/ability-id"; import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { StatusEffect } from "#enums/status-effect"; -import { CommandPhase } from "#phases/command-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; @@ -44,7 +43,6 @@ describe("Moves - Sparkly Swirl", () => { vi.spyOn(partyPokemon, "resetStatus"); game.move.select(MoveId.SPARKLY_SWIRL, 0, leftOpp.getBattlerIndex()); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH, 1); await game.toNextTurn(); @@ -66,7 +64,6 @@ describe("Moves - Sparkly Swirl", () => { vi.spyOn(rightOpp, "resetStatus"); game.move.select(MoveId.SPARKLY_SWIRL, 0, leftOpp.getBattlerIndex()); - await game.phaseInterceptor.to(CommandPhase); game.move.select(MoveId.SPLASH, 1); await game.toNextTurn(); diff --git a/test/moves/stockpile.test.ts b/test/moves/stockpile.test.ts index d2465446ff6..efc1757738a 100644 --- a/test/moves/stockpile.test.ts +++ b/test/moves/stockpile.test.ts @@ -4,7 +4,6 @@ import { MoveId } from "#enums/move-id"; import { MoveResult } from "#enums/move-result"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; -import { CommandPhase } from "#phases/command-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; @@ -50,12 +49,8 @@ describe("Moves - Stockpile", () => { // use Stockpile four times for (let i = 0; i < 4; i++) { - if (i !== 0) { - await game.phaseInterceptor.to(CommandPhase); - } - game.move.select(MoveId.STOCKPILE); - await game.phaseInterceptor.to(TurnInitPhase); + await game.toNextTurn(); const stockpilingTag = user.getTag(StockpilingTag)!; @@ -101,9 +96,6 @@ describe("Moves - Stockpile", () => { expect(user.getStatStage(Stat.DEF)).toBe(6); expect(user.getStatStage(Stat.SPDEF)).toBe(6); - // do it again, just for good measure - await game.phaseInterceptor.to(CommandPhase); - game.move.select(MoveId.STOCKPILE); await game.phaseInterceptor.to(TurnInitPhase); diff --git a/test/moves/wide_guard.test.ts b/test/moves/wide_guard.test.ts index 8f17938b02a..7de1faea900 100644 --- a/test/moves/wide_guard.test.ts +++ b/test/moves/wide_guard.test.ts @@ -3,7 +3,6 @@ import { MoveId } from "#enums/move-id"; import { SpeciesId } from "#enums/species-id"; import { Stat } from "#enums/stat"; import { BerryPhase } from "#phases/berry-phase"; -import { CommandPhase } from "#phases/command-phase"; import { GameManager } from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; @@ -41,9 +40,6 @@ describe("Moves - Wide Guard", () => { const leadPokemon = game.scene.getPlayerField(); game.move.select(MoveId.WIDE_GUARD); - - await game.phaseInterceptor.to(CommandPhase); - game.move.select(MoveId.SPLASH, 1); await game.phaseInterceptor.to(BerryPhase, false); @@ -59,9 +55,6 @@ describe("Moves - Wide Guard", () => { const leadPokemon = game.scene.getPlayerField(); game.move.select(MoveId.WIDE_GUARD); - - await game.phaseInterceptor.to(CommandPhase); - game.move.select(MoveId.SPLASH, 1); await game.phaseInterceptor.to(BerryPhase, false); @@ -77,9 +70,6 @@ describe("Moves - Wide Guard", () => { const leadPokemon = game.scene.getPlayerField(); game.move.select(MoveId.WIDE_GUARD); - - await game.phaseInterceptor.to(CommandPhase); - game.move.select(MoveId.SPLASH, 1); await game.phaseInterceptor.to(BerryPhase, false); @@ -96,9 +86,6 @@ describe("Moves - Wide Guard", () => { const enemyPokemon = game.scene.getEnemyField(); game.move.select(MoveId.WIDE_GUARD); - - await game.phaseInterceptor.to(CommandPhase); - game.move.select(MoveId.SURF, 1); await game.phaseInterceptor.to(BerryPhase, false); diff --git a/test/mystery-encounter/encounters/fun-and-games-encounter.test.ts b/test/mystery-encounter/encounters/fun-and-games-encounter.test.ts index 6a3aa71ad22..43102cbc80d 100644 --- a/test/mystery-encounter/encounters/fun-and-games-encounter.test.ts +++ b/test/mystery-encounter/encounters/fun-and-games-encounter.test.ts @@ -154,11 +154,11 @@ describe("Fun And Games! - Mystery Encounter", () => { // Turn 1 (game.scene.phaseManager.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, 0, MoveUseMode.NORMAL); - await game.phaseInterceptor.to(CommandPhase); + await game.toNextTurn(); // Turn 2 (game.scene.phaseManager.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, 0, MoveUseMode.NORMAL); - await game.phaseInterceptor.to(CommandPhase); + await game.toNextTurn(); // Turn 3 (game.scene.phaseManager.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, 0, MoveUseMode.NORMAL); diff --git a/test/mystery-encounter/encounters/the-winstrate-challenge-encounter.test.ts b/test/mystery-encounter/encounters/the-winstrate-challenge-encounter.test.ts index 078b278dd19..0541826e569 100644 --- a/test/mystery-encounter/encounters/the-winstrate-challenge-encounter.test.ts +++ b/test/mystery-encounter/encounters/the-winstrate-challenge-encounter.test.ts @@ -372,6 +372,6 @@ async function skipBattleToNextBattle(game: GameManager, isFinalBattle = false) if (isFinalBattle) { await game.phaseInterceptor.to(MysteryEncounterRewardsPhase); } else { - await game.phaseInterceptor.to(CommandPhase); + await game.toNextTurn(); } } diff --git a/test/testUtils/gameManager.ts b/test/testUtils/gameManager.ts index 30bcf170fae..b6d0da49902 100644 --- a/test/testUtils/gameManager.ts +++ b/test/testUtils/gameManager.ts @@ -205,7 +205,6 @@ export class GameManager { * @param mode - The {@linkcode GameModes} to spawn the final boss encounter in. */ async runToFinalBossEncounter(species: SpeciesId[], mode: GameModes) { - console.log("===to final boss encounter==="); await this.runToTitle(); this.onNextPrompt("TitlePhase", UiMode.TITLE, () => { @@ -223,8 +222,8 @@ export class GameManager { this.removeEnemyHeldItems(); } - await this.phaseInterceptor.to(EncounterPhase); - console.log("===finished run to final boss encounter==="); + await this.phaseInterceptor.to("CommandPhase", false); + console.log("==================[Final Boss Encounter]=================="); } /**