mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-06 23:49:26 +02:00
[Test] Removed unnecessary calls to PhaseInterceptor.to("CommandPhase")
(#6108)
* [Test] Removed unnecessary calls to `PhaseInterceptor.to("CommandPhase")` * minor cleanup to final_boss.test.ts * Made run to final boss encounter actually go to command phase * fix final_boss.test.ts select bug * actually fixed test fr this time * Fix magnet_rise.test.ts * Fixed test * Update test/moves/stockpile.test.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Update stockpile.test.ts --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
parent
a382554256
commit
6aa5c03b75
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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]==================");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user