This commit is contained in:
Bertie690 2025-06-20 03:31:26 +00:00 committed by GitHub
commit 7e22d80339
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
182 changed files with 1247 additions and 1643 deletions

View File

@ -3,7 +3,7 @@ import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("{{description}}", () => {
let phaserGame: Phaser.Game;
@ -15,10 +15,6 @@ describe("{{description}}", () => {
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override

View File

@ -217,13 +217,28 @@ export type PhaseConstructorMap = typeof PHASES;
* PhaseManager is responsible for managing the phases in the battle scene
*/
export class PhaseManager {
/** PhaseQueue: dequeue/remove the first element to get the next phase */
/**
* A queue of yet-unexecuted {@linkcode Phase}s to be run. \
* Each time the current phase ends, all phases from {@linkcode phaseQueuePrepend} are added
* to the front of this queue and the next phase is started.
*/
public phaseQueue: Phase[] = [];
public conditionalQueue: Array<[() => boolean, Phase]> = [];
/** PhaseQueuePrepend: is a temp storage of what will be added to PhaseQueue */
/**
* A queue of yet-unexecuted {@linkcode Phase}s with conditions for their execution. \
* Each entry is evaluated whenever a new phase starts, being added to the {@linkcode phaseQueue} if the condition is satisfied.
*
*/
public conditionalQueue: Array<[condition: () => boolean, phase: Phase]> = [];
/** A temporary storage of {@linkcode Phase}s */
private phaseQueuePrepend: Phase[] = [];
/** overrides default of inserting phases to end of phaseQueuePrepend array. Useful for inserting Phases "out of order" */
/**
* If set, will cause subsequent calls to {@linkcode unshiftPhase} to insert at this index in **LIFO** order.
* Useful for inserting Phases "out of order".
*
* Is cleared whenever a phase ends, or when {@linkcode clearPhaseQueueSplice} is called.
* @defaultValue `-1`
*/
private phaseQueuePrependSpliceIndex = -1;
private nextCommandPhaseQueue: Phase[] = [];
@ -241,6 +256,13 @@ export class PhaseManager {
}
/* Phase Functions */
/**
* Getter function to return the currently-in-progess {@linkcode Phase}.
* @returns The current Phase, or `null` if no phase is currently active.
* @remarks
* Type narrowing can be done by the caller using {@linkcode Phase.is}.
*/
getCurrentPhase(): Phase | null {
return this.currentPhase;
}
@ -255,18 +277,17 @@ export class PhaseManager {
* This method allows deferring the execution of a phase until certain conditions are met, which is useful for handling
* situations like abilities and entry hazards that depend on specific game states.
*
* @param phase - The phase to be added to the conditional queue.
* @param phase - The {@linkcode Phase} to add to the conditional queue.
* @param condition - A function that returns a boolean indicating whether the phase should be executed.
*
*/
pushConditionalPhase(phase: Phase, condition: () => boolean): void {
this.conditionalQueue.push([condition, phase]);
}
/**
* Adds a phase to nextCommandPhaseQueue, as long as boolean passed in is false
* @param phase {@linkcode Phase} the phase to add
* @param defer boolean on which queue to add to, defaults to false, and adds to phaseQueue
* Add a phase to the end of the {@linkcode phaseQueue}.
* @param phase - The {@linkcode Phase} to be queued.
* @param defer If `true`, will add the phase to {@linkcode nextCommandPhaseQueue} instead of the normal {@linkcode phaseQueue}; default `false`.
*/
pushPhase(phase: Phase, defer = false): void {
if (this.getDynamicPhaseType(phase) !== undefined) {
@ -277,8 +298,13 @@ export class PhaseManager {
}
/**
* Adds Phase(s) to the end of phaseQueuePrepend, or at phaseQueuePrependSpliceIndex
* @param phases {@linkcode Phase} the phase(s) to add
* Adds one or more phase(s) to the **END** of {@linkcode phaseQueuePrepend}.
* If called multiple times, phases will be ran in **FIFO** order.
* @param phases - One or more {@linkcode Phase}s to add.
* @todo Find a better name for this given that "unshift" implies adding to the front.
* @remarks
* If {@linkcode phaseQueuePrependSpliceIndex} is set, the phases will be inserted at that index
* in **LIFO** order.
*/
unshiftPhase(...phases: Phase[]): void {
if (this.phaseQueuePrependSpliceIndex === -1) {
@ -334,17 +360,10 @@ export class PhaseManager {
return;
}
if (this.phaseQueuePrependSpliceIndex > -1) {
this.clearPhaseQueueSplice();
}
if (this.phaseQueuePrepend.length) {
while (this.phaseQueuePrepend.length) {
const poppedPhase = this.phaseQueuePrepend.pop();
if (poppedPhase) {
this.phaseQueue.unshift(poppedPhase);
}
}
}
this.clearPhaseQueueSplice();
this.phaseQueue.unshift(...this.phaseQueuePrepend);
this.phaseQueuePrepend = [];
if (!this.phaseQueue.length) {
this.populatePhaseQueue();
// Clear the conditionalQueue if there are no phases left in the phaseQueue
@ -354,29 +373,37 @@ export class PhaseManager {
this.currentPhase = this.phaseQueue.shift() ?? null;
const unactivatedConditionalPhases: [() => boolean, Phase][] = [];
// Check if there are any conditional phases queued
while (this.conditionalQueue?.length) {
// Retrieve the first conditional phase from the queue
const conditionalPhase = this.conditionalQueue.shift();
// Evaluate the condition associated with the phase
if (conditionalPhase?.[0]()) {
// If the condition is met, add the phase to the phase queue
this.pushPhase(conditionalPhase[1]);
} else if (conditionalPhase) {
// If the condition is not met, re-add the phase back to the front of the conditional queue
unactivatedConditionalPhases.push(conditionalPhase);
// Check each queued conditional phase, either adding it to the end of the queue (if met)
// or keeping it on (if not).
for (const [condition, phase] of this.conditionalQueue) {
if (condition()) {
this.pushPhase(phase);
} else {
console.warn("condition phase is undefined/null!", conditionalPhase);
unactivatedConditionalPhases.push([condition, phase]);
}
}
this.conditionalQueue.push(...unactivatedConditionalPhases);
this.conditionalQueue = unactivatedConditionalPhases;
if (this.currentPhase) {
console.log(`%cStart Phase ${this.currentPhase.constructor.name}`, "color:green;");
this.currentPhase.start();
}
this.startCurrentPhase();
}
/**
* Helper method to start and log the current phase.
*
* @remarks
* This is disabled during tests by `phase-interceptor.ts` to allow for pausing execution at specific phases.
* As such, **do not remove or split this method** as it will break integration tests.
*/
private startCurrentPhase(): void {
if (!this.currentPhase) {
console.warn("trying to start null phase!");
return;
}
console.log(`%cStart Phase ${this.currentPhase.phaseName}`, "color:green;");
this.currentPhase.start();
}
// TODO: Review if we can remove this
overridePhase(phase: Phase): boolean {
if (this.standbyPhase) {
return false;
@ -384,8 +411,7 @@ export class PhaseManager {
this.standbyPhase = this.currentPhase;
this.currentPhase = phase;
console.log(`%cStart Phase ${phase.constructor.name}`, "color:green;");
phase.start();
this.startCurrentPhase();
return true;
}
@ -452,9 +478,9 @@ export class PhaseManager {
/**
* Tries to add the input phase(s) to index after target phase in the {@linkcode phaseQueue}, else simply calls {@linkcode unshiftPhase()}
* @param phase {@linkcode Phase} the phase(s) to be added
* @param targetPhase {@linkcode Phase} the type of phase to search for in {@linkcode phaseQueue}
* @param condition Condition the target phase must meet to be appended to
* @param phase - One or more {@linkcode Phase}s to be added
* @param targetPhase - The type of target {@linkcode Phase} phase to search for in {@linkcode phaseQueue}
* @param condition - If provided, will only consider target phases passing the condition.
* @returns `true` if a `targetPhase` was found to append to
*/
appendToPhase(phase: Phase | Phase[], targetPhase: PhaseString, condition?: (p: Phase) => boolean): boolean {
@ -472,7 +498,7 @@ export class PhaseManager {
/**
* Checks a phase and returns the matching {@linkcode DynamicPhaseType}, or undefined if it does not match one
* @param phase The phase to check
* @param phase - The {@linkcode Phase} to check
* @returns The corresponding {@linkcode DynamicPhaseType} or `undefined`
*/
public getDynamicPhaseType(phase: Phase | null): DynamicPhaseType | undefined {
@ -490,7 +516,7 @@ export class PhaseManager {
* Pushes a phase onto its corresponding dynamic queue and marks the activation point in {@linkcode phaseQueue}
*
* The {@linkcode ActivatePriorityQueuePhase} will run the top phase in the dynamic queue (not necessarily {@linkcode phase})
* @param phase The phase to push
* @param phase The {@linkcode Phase} to push
*/
public pushDynamicPhase(phase: Phase): void {
const type = this.getDynamicPhaseType(phase);
@ -504,7 +530,7 @@ export class PhaseManager {
/**
* Unshifts the top phase from the corresponding dynamic queue onto {@linkcode phaseQueue}
* @param type {@linkcode DynamicPhaseType} The type of dynamic phase to start
* @param type - The {@linkcode DynamicPhaseType} corresponding to the dynamic phase being started.
*/
public startDynamicPhaseType(type: DynamicPhaseType): void {
const phase = this.dynamicPhaseQueues[type].pop();
@ -519,8 +545,7 @@ export class PhaseManager {
* This is the same as {@linkcode pushDynamicPhase}, except the activation phase is unshifted
*
* {@linkcode phase} is not guaranteed to be the next phase from the queue to run (if the queue is not empty)
* @param phase The phase to add
* @returns
* @param phase - The {@linkcode Phase} to add
*/
public startDynamicPhase(phase: Phase): void {
const type = this.getDynamicPhaseType(phase);
@ -542,7 +567,7 @@ export class PhaseManager {
*
* @see {@linkcode MessagePhase} for more details on the parameters
*/
queueMessage(
public queueMessage(
message: string,
callbackDelay?: number | null,
prompt?: boolean | null,
@ -567,7 +592,7 @@ export class PhaseManager {
*/
public queueAbilityDisplay(pokemon: Pokemon, passive: boolean, show: boolean): void {
this.unshiftPhase(show ? new ShowAbilityPhase(pokemon.getBattlerIndex(), passive) : new HideAbilityPhase());
this.clearPhaseQueueSplice();
this.clearPhaseQueueSplice(); // TODO: Is this necessary?
}
/**
@ -580,7 +605,8 @@ export class PhaseManager {
}
/**
* Moves everything from nextCommandPhaseQueue to phaseQueue (keeping order)
* Moves everything from nextCommandPhaseQueue to phaseQueue (keeping order),
* then adds a new {@linkcode TurnInitPhase} to start a new turn.
*/
private populatePhaseQueue(): void {
if (this.nextCommandPhaseQueue.length) {

View File

@ -2,8 +2,10 @@ import { globalScene } from "#app/global-scene";
import type { PhaseMap, PhaseString } from "./@types/phase-types";
export abstract class Phase {
/** Start the current phase. */
start() {}
/** End the current phase and start a new one. */
end() {
globalScene.phaseManager.shiftPhase();
}

View File

@ -11,12 +11,14 @@ export class CheckStatusEffectPhase extends Phase {
}
start() {
super.start();
const field = globalScene.getField();
for (const o of this.order) {
if (field[o].status?.isPostTurn()) {
globalScene.phaseManager.unshiftNew("PostTurnStatusEffectPhase", o);
}
}
this.end();
super.end();
}
}

View File

@ -30,6 +30,7 @@ export class CommonAnimPhase extends PokemonPhase {
}
start() {
super.start();
const target =
this.targetIndex !== undefined
? (this.player ? globalScene.getEnemyField() : globalScene.getPlayerField())[this.targetIndex]

View File

@ -16,6 +16,7 @@ export class MoneyRewardPhase extends BattlePhase {
}
start() {
super.start();
const moneyAmount = new NumberHolder(globalScene.getWaveMoneyAmount(this.moneyMultiplier));
globalScene.applyModifiers(MoneyMultiplierModifier, true, moneyAmount);

View File

@ -34,6 +34,8 @@ export class ObtainStatusEffectPhase extends PokemonPhase {
}
start() {
super.start();
const pokemon = this.getPokemon();
if (pokemon && !pokemon.status) {
if (pokemon.trySetStatus(this.statusEffect, false, this.sourcePokemon)) {

View File

@ -48,9 +48,8 @@ export class PokemonHealPhase extends CommonAnimPhase {
}
start() {
if (!this.skipAnim && (this.revive || this.getPokemon().hp) && !this.getPokemon().isFullHp()) {
super.start();
} else {
super.start();
if (!(this.skipAnim && (this.revive || this.getPokemon().hp) && !this.getPokemon().isFullHp())) {
this.end();
}
}

View File

@ -16,6 +16,8 @@ export class PostSummonActivateAbilityPhase extends PostSummonPhase {
}
start() {
super.start();
applyPostSummonAbAttrs("PostSummonAbAttr", this.getPokemon(), this.passive, false);
this.end();

View File

@ -18,6 +18,8 @@ export class PostTurnStatusEffectPhase extends PokemonPhase {
}
start() {
super.start();
const pokemon = this.getPokemon();
if (pokemon?.isActive(true) && pokemon.status && pokemon.status.isPostTurn() && !pokemon.switchOutStatus) {
pokemon.status.incrementTurn();

View File

@ -83,6 +83,7 @@ export class StatStageChangePhase extends PokemonPhase {
return this.end();
}
super.start();
const pokemon = this.getPokemon();
let opponentPokemon: Pokemon | undefined;

View File

@ -14,6 +14,8 @@ import { timedEventManager } from "#app/global-event-manager";
export class TrainerVictoryPhase extends BattlePhase {
public readonly phaseName = "TrainerVictoryPhase";
start() {
super.start();
globalScene.disableMenu = true;
globalScene.playBgm(globalScene.currentBattle.trainer?.config.victoryBgm);

View File

@ -28,6 +28,7 @@ export class WeatherEffectPhase extends CommonAnimPhase {
}
start() {
super.start();
// Update weather state with any changes that occurred during the turn
this.weather = globalScene?.arena?.weather;

View File

@ -1,7 +1,5 @@
import { allMoves } from "#app/data/data-lists";
import { AbilityId } from "#enums/ability-id";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
@ -44,7 +42,7 @@ describe("Abilities - Battery", () => {
game.move.select(MoveId.DAZZLING_GLEAM);
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower * batteryMultiplier);
});
@ -59,7 +57,7 @@ describe("Abilities - Battery", () => {
game.move.select(MoveId.BREAKING_SWIPE);
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower);
});
@ -74,7 +72,7 @@ describe("Abilities - Battery", () => {
game.move.select(MoveId.DAZZLING_GLEAM);
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower);
});

View File

@ -1,5 +1,4 @@
import { Stat } from "#enums/stat";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -38,7 +37,7 @@ describe("Abilities - Competitive", () => {
const playerPokemon = game.scene.getPlayerPokemon()!;
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnInitPhase);
await game.phaseInterceptor.to("TurnInitPhase");
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(-1);
expect(playerPokemon.getStatStage(Stat.DEF)).toBe(-1);
@ -51,7 +50,7 @@ describe("Abilities - Competitive", () => {
const playerPokemon = game.scene.getPlayerPokemon()!;
game.move.select(MoveId.CLOSE_COMBAT);
await game.phaseInterceptor.to(TurnInitPhase);
await game.phaseInterceptor.to("TurnInitPhase");
expect(playerPokemon.getStatStage(Stat.SPDEF)).toBe(-1);
expect(playerPokemon.getStatStage(Stat.DEF)).toBe(-1);
@ -64,7 +63,7 @@ describe("Abilities - Competitive", () => {
const playerPokemon = game.scene.getPlayerPokemon()!;
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnInitPhase);
await game.phaseInterceptor.to("TurnInitPhase");
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(0);
expect(playerPokemon.getStatStage(Stat.DEF)).toBe(0);

View File

@ -2,8 +2,6 @@ import { Stat } from "#enums/stat";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import { CommandPhase } from "#app/phases/command-phase";
import { MessagePhase } from "#app/phases/message-phase";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
@ -39,7 +37,7 @@ describe("Abilities - COSTAR", () => {
let [leftPokemon, rightPokemon] = game.scene.getPlayerField();
game.move.select(MoveId.NASTY_PLOT);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SPLASH, 1);
await game.toNextTurn();
@ -47,9 +45,9 @@ describe("Abilities - COSTAR", () => {
expect(rightPokemon.getStatStage(Stat.SPATK)).toBe(0);
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.doSwitchPokemon(2);
await game.phaseInterceptor.to(MessagePhase);
await game.phaseInterceptor.to("MessagePhase");
[leftPokemon, rightPokemon] = game.scene.getPlayerField();
expect(leftPokemon.getStatStage(Stat.SPATK)).toBe(2);
@ -67,9 +65,9 @@ describe("Abilities - COSTAR", () => {
expect(leftPokemon.getStatStage(Stat.ATK)).toBe(-2);
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.doSwitchPokemon(2);
await game.phaseInterceptor.to(MessagePhase);
await game.phaseInterceptor.to("MessagePhase");
[leftPokemon, rightPokemon] = game.scene.getPlayerField();
expect(leftPokemon.getStatStage(Stat.ATK)).toBe(-2);

View File

@ -1,5 +1,4 @@
import { Stat } from "#enums/stat";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -38,7 +37,7 @@ describe("Abilities - Defiant", () => {
const playerPokemon = game.scene.getPlayerPokemon()!;
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnInitPhase);
await game.phaseInterceptor.to("TurnInitPhase");
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(3);
expect(playerPokemon.getStatStage(Stat.DEF)).toBe(-1);
@ -50,7 +49,7 @@ describe("Abilities - Defiant", () => {
const playerPokemon = game.scene.getPlayerPokemon()!;
game.move.select(MoveId.CLOSE_COMBAT);
await game.phaseInterceptor.to(TurnInitPhase);
await game.phaseInterceptor.to("TurnInitPhase");
expect(playerPokemon.getStatStage(Stat.SPDEF)).toBe(-1);
expect(playerPokemon.getStatStage(Stat.DEF)).toBe(-1);
@ -63,7 +62,7 @@ describe("Abilities - Defiant", () => {
const playerPokemon = game.scene.getPlayerPokemon()!;
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnInitPhase);
await game.phaseInterceptor.to("TurnInitPhase");
expect(playerPokemon.getStatStage(Stat.DEF)).toBe(0);
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(3);

View File

@ -1,8 +1,6 @@
import { BattlerIndex } from "#enums/battler-index";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { SpeciesId } from "#enums/species-id";
import { MovePhase } from "#app/phases/move-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { StatusEffect } from "#enums/status-effect";
@ -42,7 +40,7 @@ describe("Abilities - Flash Fire", () => {
const blissey = game.scene.getPlayerPokemon()!;
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(blissey.hp).toBe(blissey.getMaxHp());
});
@ -53,7 +51,7 @@ describe("Abilities - Flash Fire", () => {
const blissey = game.scene.getPlayerPokemon()!;
game.move.select(MoveId.PROTECT);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(blissey!.getTag(BattlerTagType.FIRE_BOOST)).toBeUndefined();
});
@ -65,10 +63,10 @@ describe("Abilities - Flash Fire", () => {
game.move.select(MoveId.SPLASH);
await game.move.forceHit();
await game.phaseInterceptor.to(MovePhase, false);
await game.phaseInterceptor.to("MovePhase", false);
await game.move.forceHit();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(blissey!.getTag(BattlerTagType.FIRE_BOOST)).toBeDefined();
});
@ -80,7 +78,7 @@ describe("Abilities - Flash Fire", () => {
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(blissey!.getTag(BattlerTagType.FIRE_BOOST)).toBeDefined();
});
@ -94,7 +92,7 @@ describe("Abilities - Flash Fire", () => {
game.doSelectPartyPokemon(1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const chansey = game.scene.getPlayerPokemon()!;
expect(game.scene.getPlayerPokemon()!.species.speciesId).toBe(SpeciesId.CHANSEY);
expect(chansey!.getTag(BattlerTagType.FIRE_BOOST)).toBeUndefined();
@ -114,7 +112,7 @@ describe("Abilities - Flash Fire", () => {
// first turn
game.move.select(MoveId.EMBER);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const originalDmg = initialHP - blissey.hp;
expect(blissey.hp > 0);
@ -122,7 +120,7 @@ describe("Abilities - Flash Fire", () => {
// second turn
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const flashFireDmg = initialHP - blissey.hp;
expect(flashFireDmg).toBeGreaterThan(originalDmg);
@ -146,7 +144,7 @@ describe("Abilities - Flash Fire", () => {
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to("MoveEffectPhase");
await game.move.forceMiss();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const originalDmg = initialHP - blissey.hp;
expect(blissey.hp > 0);
@ -154,7 +152,7 @@ describe("Abilities - Flash Fire", () => {
// second turn
game.move.select(MoveId.FIRE_PLEDGE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const flashFireDmg = initialHP - blissey.hp;
expect(flashFireDmg).toBeGreaterThan(originalDmg);

View File

@ -3,7 +3,6 @@ import { allAbilities } from "#app/data/data-lists";
import { AbilityId } from "#enums/ability-id";
import { Stat } from "#app/enums/stat";
import { WeatherType } from "#app/enums/weather-type";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
@ -72,7 +71,7 @@ describe("Abilities - Flower Gift", () => {
await game.move.selectEnemyMove(MoveId.SPLASH);
// Ensure sunny day is used last.
await game.setTurnOrder([attacker_index, target_index, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const damageWithoutGift = initialHp - target.hp;
target.hp = initialHp;
@ -83,7 +82,7 @@ describe("Abilities - Flower Gift", () => {
await game.move.selectEnemyMove(enemy_move, BattlerIndex.PLAYER_2);
await game.move.selectEnemyMove(MoveId.SPLASH);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY_2, target_index, attacker_index]);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const damageWithGift = initialHp - target.hp;
return [damageWithoutGift, damageWithGift];

View File

@ -2,11 +2,6 @@ import { BattlerIndex } from "#enums/battler-index";
import { allAbilities } from "#app/data/data-lists";
import { AbilityId } from "#enums/ability-id";
import { WeatherType } from "#app/enums/weather-type";
import { DamageAnimPhase } from "#app/phases/damage-anim-phase";
import { MovePhase } from "#app/phases/move-phase";
import { PostSummonPhase } from "#app/phases/post-summon-phase";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
@ -184,7 +179,7 @@ describe("Abilities - Forecast", () => {
await game.classicMode.startBattle([SpeciesId.CASTFORM]);
game.move.select(MoveId.RAIN_DANCE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.getPlayerPokemon()?.formIndex).toBe(RAINY_FORM);
expect(game.scene.getEnemyPokemon()?.formIndex).not.toBe(RAINY_FORM);
@ -202,7 +197,7 @@ describe("Abilities - Forecast", () => {
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.move.forceHit();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(castform.summonData.abilitySuppressed).toBe(true);
expect(castform.formIndex).toBe(NORMAL_FORM);
@ -215,7 +210,7 @@ describe("Abilities - Forecast", () => {
// Third turn - switch in Castform
game.doSwitchPokemon(1);
await game.phaseInterceptor.to(MovePhase);
await game.phaseInterceptor.to("MovePhase");
expect(castform.summonData.abilitySuppressed).toBe(false);
expect(castform.formIndex).toBe(RAINY_FORM);
@ -231,16 +226,16 @@ describe("Abilities - Forecast", () => {
// Second turn - switch in Castform, regains Forecast
game.doSwitchPokemon(1);
await game.phaseInterceptor.to(PostSummonPhase);
await game.phaseInterceptor.to("PostSummonPhase");
const castform = game.scene.getPlayerPokemon()!;
// Damage phase should come first
await game.phaseInterceptor.to(DamageAnimPhase);
await game.phaseInterceptor.to("DamageAnimPhase");
expect(castform.hp).toBeLessThan(castform.getMaxHp());
// Then change form
await game.phaseInterceptor.to(QuietFormChangePhase);
await game.phaseInterceptor.to("QuietFormChangePhase");
expect(castform.formIndex).toBe(RAINY_FORM);
});

View File

@ -1,6 +1,5 @@
import { SpeciesId } from "#enums/species-id";
import { StatusEffect } from "#app/enums/status-effect";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { toDmgValue } from "#app/utils/common";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
@ -45,14 +44,14 @@ describe("Abilities - Heatproof", () => {
enemy.hp = initialHP;
game.move.select(MoveId.FLAMETHROWER);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const heatproofDamage = initialHP - enemy.hp;
enemy.hp = initialHP;
game.override.enemyAbility(AbilityId.BALL_FETCH);
game.move.select(MoveId.FLAMETHROWER);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const regularDamage = initialHP - enemy.hp;
expect(heatproofDamage).toBeLessThanOrEqual(regularDamage / 2 + 1);

View File

@ -1,9 +1,4 @@
import { BattlerIndex } from "#enums/battler-index";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { MoveEndPhase } from "#app/phases/move-end-phase";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
import { AbilityId } from "#enums/ability-id";
import { BattlerTagType } from "#enums/battler-tag-type";
import { MoveId } from "#enums/move-id";
@ -42,7 +37,7 @@ describe("Abilities - Ice Face", () => {
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
const eiscue = game.scene.getEnemyPokemon()!;
@ -61,17 +56,17 @@ describe("Abilities - Ice Face", () => {
expect(eiscue.getTag(BattlerTagType.ICE_FACE)).toBeDefined();
// First hit
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(eiscue.isFullHp()).toBe(true);
expect(eiscue.formIndex).toBe(icefaceForm);
expect(eiscue.getTag(BattlerTagType.ICE_FACE)).toBeUndefined();
// Second hit
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(eiscue.hp).lessThan(eiscue.getMaxHp());
expect(eiscue.formIndex).toBe(noiceForm);
await game.phaseInterceptor.to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
expect(eiscue.hp).lessThan(eiscue.getMaxHp());
expect(eiscue.formIndex).toBe(noiceForm);
@ -83,7 +78,7 @@ describe("Abilities - Ice Face", () => {
game.move.select(MoveId.ICE_BEAM);
await game.phaseInterceptor.to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
const eiscue = game.scene.getEnemyPokemon()!;
@ -97,7 +92,7 @@ describe("Abilities - Ice Face", () => {
game.move.select(MoveId.TOXIC_THREAD);
await game.phaseInterceptor.to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
const eiscue = game.scene.getEnemyPokemon()!;
@ -112,7 +107,7 @@ describe("Abilities - Ice Face", () => {
game.move.select(MoveId.QUICK_ATTACK);
await game.phaseInterceptor.to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
const eiscue = game.scene.getEnemyPokemon()!;
@ -120,7 +115,7 @@ describe("Abilities - Ice Face", () => {
expect(eiscue.formIndex).toBe(noiceForm);
expect(eiscue.getTag(BattlerTagType.ICE_FACE)).toBeUndefined();
await game.phaseInterceptor.to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
expect(eiscue.getTag(BattlerTagType.ICE_FACE)).not.toBeNull();
expect(eiscue.formIndex).toBe(icefaceForm);
@ -133,7 +128,7 @@ describe("Abilities - Ice Face", () => {
game.move.select(MoveId.SNOWSCAPE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
let eiscue = game.scene.getPlayerPokemon()!;
expect(eiscue.getTag(BattlerTagType.ICE_FACE)).toBeUndefined();
@ -145,7 +140,7 @@ describe("Abilities - Ice Face", () => {
await game.toNextTurn();
game.doSwitchPokemon(1);
await game.phaseInterceptor.to(QuietFormChangePhase);
await game.phaseInterceptor.to("QuietFormChangePhase");
eiscue = game.scene.getPlayerPokemon()!;
expect(eiscue.formIndex).toBe(icefaceForm);
@ -160,12 +155,12 @@ describe("Abilities - Ice Face", () => {
game.move.select(MoveId.HAIL);
const eiscue = game.scene.getPlayerPokemon()!;
await game.phaseInterceptor.to(QuietFormChangePhase);
await game.phaseInterceptor.to("QuietFormChangePhase");
expect(eiscue.formIndex).toBe(noiceForm);
expect(eiscue.getTag(BattlerTagType.ICE_FACE)).toBeUndefined();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(eiscue.formIndex).toBe(noiceForm);
expect(eiscue.getTag(BattlerTagType.ICE_FACE)).toBeUndefined();
@ -178,7 +173,7 @@ describe("Abilities - Ice Face", () => {
game.move.select(MoveId.ICE_BEAM);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
let eiscue = game.scene.getPlayerPokemon()!;
expect(eiscue.getTag(BattlerTagType.ICE_FACE)).toBeUndefined();
@ -188,7 +183,7 @@ describe("Abilities - Ice Face", () => {
await game.toNextTurn();
game.doSwitchPokemon(1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
eiscue = game.scene.getPlayerParty()[1];
expect(eiscue.formIndex).toBe(noiceForm);
@ -213,9 +208,9 @@ describe("Abilities - Ice Face", () => {
game.move.select(MoveId.ICE_BEAM);
await game.doKillOpponents();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
game.doSelectModifier();
await game.phaseInterceptor.to(TurnInitPhase);
await game.phaseInterceptor.to("TurnInitPhase");
expect(eiscue.formIndex).toBe(icefaceForm);
expect(eiscue.getTag(BattlerTagType.ICE_FACE)).not.toBe(undefined);
@ -239,7 +234,7 @@ describe("Abilities - Ice Face", () => {
game.move.select(MoveId.GASTRO_ACID);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const eiscue = game.scene.getEnemyPokemon()!;
@ -255,7 +250,7 @@ describe("Abilities - Ice Face", () => {
game.move.select(MoveId.SKILL_SWAP);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const eiscue = game.scene.getEnemyPokemon()!;
@ -271,7 +266,7 @@ describe("Abilities - Ice Face", () => {
game.move.select(MoveId.SIMPLE_BEAM);
await game.phaseInterceptor.to(TurnInitPhase);
await game.phaseInterceptor.to("TurnInitPhase");
const eiscue = game.scene.getEnemyPokemon()!;

View File

@ -2,7 +2,6 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import Phaser from "phaser";
import GameManager from "#test/testUtils/gameManager";
import { SpeciesId } from "#enums/species-id";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { Stat, BATTLE_STATS, EFFECTIVE_STATS } from "#enums/stat";
import { AbilityId } from "#enums/ability-id";
@ -39,7 +38,7 @@ describe("Abilities - Imposter", () => {
await game.classicMode.startBattle([SpeciesId.DITTO]);
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const player = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
@ -86,7 +85,7 @@ describe("Abilities - Imposter", () => {
const avgSpAtk = Math.floor((player.getStat(Stat.SPATK, false) + enemy.getStat(Stat.SPATK, false)) / 2);
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(player.getStat(Stat.ATK, false)).toBe(avgAtk);
expect(enemy.getStat(Stat.ATK, false)).toBe(avgAtk);
@ -102,7 +101,7 @@ describe("Abilities - Imposter", () => {
const player = game.scene.getPlayerPokemon()!;
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
player.getMoveset().forEach(move => {
// Should set correct maximum PP without touching `ppUp`

View File

@ -55,8 +55,7 @@ describe("Abilities - Intimidate", () => {
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(-1);
game.doSwitchPokemon(1);
await game.phaseInterceptor.run("CommandPhase");
await game.phaseInterceptor.to("CommandPhase");
await game.toNextTurn();
playerPokemon = game.scene.getPlayerPokemon()!;
expect(playerPokemon.species.speciesId).toBe(SpeciesId.POOCHYENA);

View File

@ -1,6 +1,5 @@
import { Stat } from "#enums/stat";
import GameManager from "#test/testUtils/gameManager";
import { CommandPhase } from "#app/phases/command-phase";
import { AbilityId } from "#enums/ability-id";
import { SpeciesId } from "#enums/species-id";
import Phaser from "phaser";
@ -35,7 +34,7 @@ describe("Abilities - Intrepid Sword", () => {
const playerPokemon = game.scene.getPlayerPokemon()!;
const enemyPokemon = game.scene.getEnemyPokemon()!;
await game.phaseInterceptor.to(CommandPhase, false);
await game.phaseInterceptor.to("CommandPhase", false);
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(1);
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);

View File

@ -2,7 +2,6 @@ import { allMoves } from "#app/data/data-lists";
import { PokemonType } from "#enums/pokemon-type";
import { Weather } from "#app/data/weather";
import type { PlayerPokemon } from "#app/field/pokemon";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { BattlerTagType } from "#enums/battler-tag-type";
import { BiomeId } from "#enums/biome-id";
@ -46,7 +45,7 @@ describe("Abilities - Libero", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.SPLASH);
});
@ -61,12 +60,12 @@ describe("Abilities - Libero", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.SPLASH);
game.move.select(MoveId.AGILITY);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.waveData.abilitiesApplied).toContain(AbilityId.LIBERO);
const leadPokemonType = PokemonType[leadPokemon.getTypes()[0]];
@ -83,7 +82,7 @@ describe("Abilities - Libero", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.SPLASH);
});
@ -98,7 +97,7 @@ describe("Abilities - Libero", () => {
game.scene.arena.weather = new Weather(WeatherType.SUNNY);
game.move.select(MoveId.WEATHER_BALL);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.waveData.abilitiesApplied).toContain(AbilityId.LIBERO);
expect(leadPokemon.getTypes()).toHaveLength(1);
@ -116,7 +115,7 @@ describe("Abilities - Libero", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.waveData.abilitiesApplied).toContain(AbilityId.LIBERO);
expect(leadPokemon.getTypes()).toHaveLength(1);
@ -135,7 +134,7 @@ describe("Abilities - Libero", () => {
game.scene.arena.biomeType = BiomeId.MOUNTAIN;
game.move.select(MoveId.NATURE_POWER);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.AIR_SLASH);
});
@ -149,7 +148,7 @@ describe("Abilities - Libero", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.DIG);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.DIG);
});
@ -164,7 +163,7 @@ describe("Abilities - Libero", () => {
game.move.select(MoveId.TACKLE);
await game.move.forceMiss();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon.isFullHp()).toBe(true);
@ -180,7 +179,7 @@ describe("Abilities - Libero", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.TACKLE);
});
@ -194,7 +193,7 @@ describe("Abilities - Libero", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.TACKLE);
});
@ -209,7 +208,7 @@ describe("Abilities - Libero", () => {
leadPokemon.summonData.types = [allMoves[MoveId.SPLASH].type];
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.waveData.abilitiesApplied).not.toContain(AbilityId.LIBERO);
});
@ -225,7 +224,7 @@ describe("Abilities - Libero", () => {
leadPokemon.isTerastallized = true;
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.waveData.abilitiesApplied).not.toContain(AbilityId.LIBERO);
});
@ -239,7 +238,7 @@ describe("Abilities - Libero", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.STRUGGLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.waveData.abilitiesApplied).not.toContain(AbilityId.LIBERO);
});
@ -253,7 +252,7 @@ describe("Abilities - Libero", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.BURN_UP);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.waveData.abilitiesApplied).not.toContain(AbilityId.LIBERO);
});
@ -267,7 +266,7 @@ describe("Abilities - Libero", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.TRICK_OR_TREAT);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.TRICK_OR_TREAT);
});
@ -281,7 +280,7 @@ describe("Abilities - Libero", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.CURSE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.CURSE);
expect(leadPokemon.getTag(BattlerTagType.CURSED)).not.toBe(undefined);

View File

@ -1,7 +1,6 @@
import { getArenaTag } from "#app/data/arena-tag";
import { ArenaTagSide } from "#enums/arena-tag-side";
import { getStatusEffectCatchRateMultiplier } from "#app/data/status-effect";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { ArenaTagType } from "#enums/arena-tag-type";
import { BattlerTagType } from "#enums/battler-tag-type";
@ -56,7 +55,7 @@ describe("Abilities - Magic Guard", () => {
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -77,7 +76,7 @@ describe("Abilities - Magic Guard", () => {
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -97,7 +96,7 @@ describe("Abilities - Magic Guard", () => {
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -115,7 +114,7 @@ describe("Abilities - Magic Guard", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -139,7 +138,7 @@ describe("Abilities - Magic Guard", () => {
const toxicStartCounter = enemyPokemon.status!.toxicTurnCount;
//should be 0
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -164,7 +163,7 @@ describe("Abilities - Magic Guard", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -189,7 +188,7 @@ describe("Abilities - Magic Guard", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -213,7 +212,7 @@ describe("Abilities - Magic Guard", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -235,7 +234,7 @@ describe("Abilities - Magic Guard", () => {
game.move.select(MoveId.HIGH_JUMP_KICK);
await game.move.forceMiss();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -252,7 +251,7 @@ describe("Abilities - Magic Guard", () => {
game.move.select(MoveId.TAKE_DOWN);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -269,7 +268,7 @@ describe("Abilities - Magic Guard", () => {
game.move.select(MoveId.STRUGGLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -287,7 +286,7 @@ describe("Abilities - Magic Guard", () => {
game.move.select(MoveId.STEEL_BEAM);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -302,7 +301,7 @@ describe("Abilities - Magic Guard", () => {
game.move.select(MoveId.CHARM);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
});
*/
@ -314,7 +313,7 @@ describe("Abilities - Magic Guard", () => {
game.move.select(MoveId.BELLY_DRUM);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -337,7 +336,7 @@ describe("Abilities - Magic Guard", () => {
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -360,7 +359,7 @@ describe("Abilities - Magic Guard", () => {
enemyPokemon.hp = 1;
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -382,7 +381,7 @@ describe("Abilities - Magic Guard", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -404,7 +403,7 @@ describe("Abilities - Magic Guard", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!;
game.move.select(MoveId.ABSORB);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:
@ -421,7 +420,7 @@ describe("Abilities - Magic Guard", () => {
await game.classicMode.startBattle([SpeciesId.MAGIKARP]);
const leadPokemon = game.scene.getPlayerPokemon()!;
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
/**
* Expect:

View File

@ -6,9 +6,6 @@ import { SpeciesId } from "#enums/species-id";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { BattlerIndex } from "#enums/battler-index";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { VictoryPhase } from "#app/phases/victory-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
describe("Abilities - Moxie", () => {
let phaserGame: Phaser.Game;
@ -46,7 +43,7 @@ describe("Abilities - Moxie", () => {
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(0);
game.move.select(moveToUse);
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(VictoryPhase);
await game.phaseInterceptor.to("VictoryPhase");
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(1);
});
@ -68,7 +65,7 @@ describe("Abilities - Moxie", () => {
game.move.select(moveToUse);
game.selectTarget(BattlerIndex.PLAYER_2);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(firstPokemon.getStatStage(Stat.ATK)).toBe(1);
},

View File

@ -1,5 +1,4 @@
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { TurnStartPhase } from "#app/phases/turn-start-phase";
import type { TurnStartPhase } from "#app/phases/turn-start-phase";
import GameManager from "#test/testUtils/gameManager";
import { AbilityId } from "#enums/ability-id";
import { Stat } from "#enums/stat";
@ -51,7 +50,7 @@ describe("Abilities - Mycelium Might", () => {
game.move.select(MoveId.BABY_DOLL_EYES);
await game.phaseInterceptor.to(TurnStartPhase, false);
await game.phaseInterceptor.to("TurnStartPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as TurnStartPhase;
const speedOrder = phase.getSpeedOrder();
const commandOrder = phase.getCommandOrder();
@ -59,7 +58,7 @@ describe("Abilities - Mycelium Might", () => {
// The player Pokemon (with Mycelium Might) goes last despite having higher speed than the opponent.
expect(speedOrder).toEqual([playerIndex, enemyIndex]);
expect(commandOrder).toEqual([enemyIndex, playerIndex]);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
// Despite the opponent's ability (Clear Body), its ATK stat stage is still reduced.
expect(enemyPokemon?.getStatStage(Stat.ATK)).toBe(-1);
@ -75,7 +74,7 @@ describe("Abilities - Mycelium Might", () => {
game.move.select(MoveId.BABY_DOLL_EYES);
await game.phaseInterceptor.to(TurnStartPhase, false);
await game.phaseInterceptor.to("TurnStartPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as TurnStartPhase;
const speedOrder = phase.getSpeedOrder();
const commandOrder = phase.getCommandOrder();
@ -83,7 +82,7 @@ describe("Abilities - Mycelium Might", () => {
// The enemy Pokemon goes second because its move is in a lower priority bracket.
expect(speedOrder).toEqual([playerIndex, enemyIndex]);
expect(commandOrder).toEqual([playerIndex, enemyIndex]);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
// Despite the opponent's ability (Clear Body), its ATK stat stage is still reduced.
expect(enemyPokemon?.getStatStage(Stat.ATK)).toBe(-1);
});
@ -96,7 +95,7 @@ describe("Abilities - Mycelium Might", () => {
game.move.select(MoveId.QUICK_ATTACK);
await game.phaseInterceptor.to(TurnStartPhase, false);
await game.phaseInterceptor.to("TurnStartPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as TurnStartPhase;
const speedOrder = phase.getSpeedOrder();
const commandOrder = phase.getCommandOrder();

View File

@ -1,6 +1,5 @@
import { BattlerIndex } from "#enums/battler-index";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { MoveEndPhase } from "#app/phases/move-end-phase";
import type { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -43,12 +42,12 @@ describe("Abilities - No Guard", () => {
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
const moveEffectPhase = game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase;
vi.spyOn(moveEffectPhase, "hitCheck");
await game.phaseInterceptor.to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
expect(moveEffectPhase.hitCheck).toHaveReturnedWith([HitCheckResult.HIT, 1]);
});

View File

@ -1,7 +1,5 @@
import { BattlerIndex } from "#enums/battler-index";
import { AbilityId } from "#enums/ability-id";
import { CommandPhase } from "#app/phases/command-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import { StatusEffect } from "#enums/status-effect";
@ -44,7 +42,7 @@ describe("Abilities - Pastel Veil", () => {
game.move.select(MoveId.SPLASH);
game.move.select(MoveId.TOXIC_THREAD, 1, BattlerIndex.PLAYER);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(magikarp.status?.effect).toBeUndefined();
});
@ -60,13 +58,13 @@ describe("Abilities - Pastel Veil", () => {
game.move.select(MoveId.SPLASH);
game.move.select(MoveId.TOXIC_THREAD, 1, BattlerIndex.PLAYER);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(magikarp.status?.effect).toBe(StatusEffect.POISON);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SPLASH);
game.doSwitchPokemon(2);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(magikarp.status?.effect).toBeUndefined();
});

View File

@ -1,6 +1,4 @@
import { Status } from "#app/data/status-effect";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -51,9 +49,9 @@ describe("Abilities - POWER CONSTRUCT", () => {
game.move.select(MoveId.SPLASH);
await game.doKillOpponents();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
game.doSelectModifier();
await game.phaseInterceptor.to(QuietFormChangePhase);
await game.phaseInterceptor.to("QuietFormChangePhase");
expect(zygarde!.formIndex).toBe(baseForm);
});
@ -77,9 +75,9 @@ describe("Abilities - POWER CONSTRUCT", () => {
game.move.select(MoveId.SPLASH);
await game.doKillOpponents();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
game.doSelectModifier();
await game.phaseInterceptor.to(QuietFormChangePhase);
await game.phaseInterceptor.to("QuietFormChangePhase");
expect(zygarde!.formIndex).toBe(baseForm);
});

View File

@ -1,7 +1,5 @@
import { allMoves } from "#app/data/data-lists";
import { AbilityId } from "#enums/ability-id";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
@ -43,7 +41,7 @@ describe("Abilities - Power Spot", () => {
await game.classicMode.startBattle([SpeciesId.REGIELEKI, SpeciesId.STONJOURNER]);
game.move.select(MoveId.DAZZLING_GLEAM);
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower * powerSpotMultiplier);
});
@ -57,7 +55,7 @@ describe("Abilities - Power Spot", () => {
await game.classicMode.startBattle([SpeciesId.REGIELEKI, SpeciesId.STONJOURNER]);
game.move.select(MoveId.BREAKING_SWIPE);
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower * powerSpotMultiplier);
});
@ -71,7 +69,7 @@ describe("Abilities - Power Spot", () => {
await game.classicMode.startBattle([SpeciesId.STONJOURNER, SpeciesId.REGIELEKI]);
game.move.select(MoveId.BREAKING_SWIPE);
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower);
});

View File

@ -2,7 +2,6 @@ import { allMoves } from "#app/data/data-lists";
import { PokemonType } from "#enums/pokemon-type";
import { Weather } from "#app/data/weather";
import type { PlayerPokemon } from "#app/field/pokemon";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { BattlerTagType } from "#enums/battler-tag-type";
import { BiomeId } from "#enums/biome-id";
@ -46,7 +45,7 @@ describe("Abilities - Protean", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.SPLASH);
});
@ -61,12 +60,12 @@ describe("Abilities - Protean", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.SPLASH);
game.move.select(MoveId.AGILITY);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.waveData.abilitiesApplied).toContain(AbilityId.PROTEAN);
const leadPokemonType = PokemonType[leadPokemon.getTypes()[0]];
@ -83,7 +82,7 @@ describe("Abilities - Protean", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.SPLASH);
});
@ -98,7 +97,7 @@ describe("Abilities - Protean", () => {
game.scene.arena.weather = new Weather(WeatherType.SUNNY);
game.move.select(MoveId.WEATHER_BALL);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.waveData.abilitiesApplied).toContain(AbilityId.PROTEAN);
expect(leadPokemon.getTypes()).toHaveLength(1);
@ -116,7 +115,7 @@ describe("Abilities - Protean", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.waveData.abilitiesApplied).toContain(AbilityId.PROTEAN);
expect(leadPokemon.getTypes()).toHaveLength(1);
@ -135,7 +134,7 @@ describe("Abilities - Protean", () => {
game.scene.arena.biomeType = BiomeId.MOUNTAIN;
game.move.select(MoveId.NATURE_POWER);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.AIR_SLASH);
});
@ -149,7 +148,7 @@ describe("Abilities - Protean", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.DIG);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.DIG);
});
@ -164,7 +163,7 @@ describe("Abilities - Protean", () => {
game.move.select(MoveId.TACKLE);
await game.move.forceMiss();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon.isFullHp()).toBe(true);
@ -180,7 +179,7 @@ describe("Abilities - Protean", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.TACKLE);
});
@ -194,7 +193,7 @@ describe("Abilities - Protean", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.TACKLE);
});
@ -209,7 +208,7 @@ describe("Abilities - Protean", () => {
leadPokemon.summonData.types = [allMoves[MoveId.SPLASH].type];
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.waveData.abilitiesApplied).not.toContain(AbilityId.PROTEAN);
});
@ -225,7 +224,7 @@ describe("Abilities - Protean", () => {
leadPokemon.isTerastallized = true;
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.waveData.abilitiesApplied).not.toContain(AbilityId.PROTEAN);
});
@ -239,7 +238,7 @@ describe("Abilities - Protean", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.STRUGGLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.waveData.abilitiesApplied).not.toContain(AbilityId.PROTEAN);
});
@ -253,7 +252,7 @@ describe("Abilities - Protean", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.BURN_UP);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.waveData.abilitiesApplied).not.toContain(AbilityId.PROTEAN);
});
@ -267,7 +266,7 @@ describe("Abilities - Protean", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.TRICK_OR_TREAT);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.TRICK_OR_TREAT);
});
@ -281,7 +280,7 @@ describe("Abilities - Protean", () => {
expect(leadPokemon).not.toBe(undefined);
game.move.select(MoveId.CURSE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
testPokemonTypeMatchesDefaultMoveType(leadPokemon, MoveId.CURSE);
expect(leadPokemon.getTag(BattlerTagType.CURSED)).not.toBe(undefined);

View File

@ -1,5 +1,4 @@
import { allAbilities } from "#app/data/data-lists";
import { FaintPhase } from "#app/phases/faint-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -50,7 +49,7 @@ describe("Abilities - Quick Draw", () => {
enemy.hp = 1;
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(FaintPhase, false);
await game.phaseInterceptor.to("FaintPhase", false);
expect(pokemon.isFainted()).toBe(false);
expect(enemy.isFainted()).toBe(true);
@ -72,7 +71,7 @@ describe("Abilities - Quick Draw", () => {
enemy.hp = 1;
game.move.select(MoveId.TAIL_WHIP);
await game.phaseInterceptor.to(FaintPhase, false);
await game.phaseInterceptor.to("FaintPhase", false);
expect(pokemon.isFainted()).toBe(true);
expect(enemy.isFainted()).toBe(false);
@ -92,7 +91,7 @@ describe("Abilities - Quick Draw", () => {
enemy.hp = 1;
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(FaintPhase, false);
await game.phaseInterceptor.to("FaintPhase", false);
expect(pokemon.isFainted()).toBe(true);
expect(enemy.isFainted()).toBe(false);

View File

@ -1,7 +1,4 @@
import { allAbilities } from "#app/data/data-lists";
import { CommandPhase } from "#app/phases/command-phase";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { MoveEndPhase } from "#app/phases/move-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -61,13 +58,13 @@ describe("Abilities - Sand Veil", () => {
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
await game.phaseInterceptor.to(MoveEndPhase, false);
await game.phaseInterceptor.to("MoveEndPhase", false);
expect(leadPokemon[0].isFullHp()).toBe(true);
expect(leadPokemon[1].hp).toBeLessThan(leadPokemon[1].getMaxHp());

View File

@ -1,7 +1,5 @@
import { Stat } from "#enums/stat";
import { TerrainType } from "#app/data/terrain";
import { MoveEndPhase } from "#app/phases/move-end-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { BattlerTagType } from "#enums/battler-tag-type";
import { MoveId } from "#enums/move-id";
@ -50,7 +48,7 @@ describe("Abilities - Sap Sipper", () => {
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(initialEnemyHp - enemyPokemon.hp).toBe(0);
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
@ -67,7 +65,7 @@ describe("Abilities - Sap Sipper", () => {
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon.status).toBeUndefined();
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
@ -82,7 +80,7 @@ describe("Abilities - Sap Sipper", () => {
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.arena.terrain).toBeDefined();
expect(game.scene.arena.terrain!.terrainType).toBe(TerrainType.GRASSY);
@ -101,7 +99,7 @@ describe("Abilities - Sap Sipper", () => {
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(initialEnemyHp - enemyPokemon.hp).toBe(0);
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
@ -118,11 +116,11 @@ describe("Abilities - Sap Sipper", () => {
game.move.select(moveToUse);
await game.phaseInterceptor.to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
expect(playerPokemon.getTag(BattlerTagType.SPIKY_SHIELD)).toBeDefined();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(0);
expect(game.phaseInterceptor.log).not.toContain("ShowAbilityPhase");
@ -145,7 +143,7 @@ describe("Abilities - Sap Sipper", () => {
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(initialEnemyHp - enemyPokemon.hp).toBe(0);
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);

View File

@ -1,6 +1,4 @@
import { Status } from "#app/data/status-effect";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -47,9 +45,9 @@ describe("Abilities - SCHOOLING", () => {
game.move.select(MoveId.SPLASH);
await game.doKillOpponents();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
game.doSelectModifier();
await game.phaseInterceptor.to(QuietFormChangePhase);
await game.phaseInterceptor.to("QuietFormChangePhase");
expect(wishiwashi.formIndex).toBe(soloForm);
});

View File

@ -1,6 +1,4 @@
import { ArenaTagType } from "#app/enums/arena-tag-type";
import { PostSummonPhase } from "#app/phases/post-summon-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -33,13 +31,13 @@ describe("Abilities - Screen Cleaner", () => {
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]);
game.move.select(MoveId.HAIL);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.arena.getTag(ArenaTagType.AURORA_VEIL)).toBeDefined();
await game.toNextTurn();
game.doSwitchPokemon(1);
await game.phaseInterceptor.to(PostSummonPhase);
await game.phaseInterceptor.to("PostSummonPhase");
expect(game.scene.arena.getTag(ArenaTagType.AURORA_VEIL)).toBeUndefined();
});
@ -50,13 +48,13 @@ describe("Abilities - Screen Cleaner", () => {
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]);
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.arena.getTag(ArenaTagType.LIGHT_SCREEN)).toBeDefined();
await game.toNextTurn();
game.doSwitchPokemon(1);
await game.phaseInterceptor.to(PostSummonPhase);
await game.phaseInterceptor.to("PostSummonPhase");
expect(game.scene.arena.getTag(ArenaTagType.LIGHT_SCREEN)).toBeUndefined();
});
@ -67,13 +65,13 @@ describe("Abilities - Screen Cleaner", () => {
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MAGIKARP]);
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.arena.getTag(ArenaTagType.REFLECT)).toBeDefined();
await game.toNextTurn();
game.doSwitchPokemon(1);
await game.phaseInterceptor.to(PostSummonPhase);
await game.phaseInterceptor.to("PostSummonPhase");
expect(game.scene.arena.getTag(ArenaTagType.REFLECT)).toBeUndefined();
});

View File

@ -1,6 +1,6 @@
import { BattlerIndex } from "#enums/battler-index";
import { applyAbAttrs, applyPreDefendAbAttrs } from "#app/data/abilities/apply-ab-attrs";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import type { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { NumberHolder } from "#app/utils/common";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
@ -44,7 +44,7 @@ describe("Abilities - Shield Dust", () => {
game.move.select(MoveId.AIR_SLASH);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
// Shield Dust negates secondary effect
const phase = game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase;

View File

@ -1,7 +1,5 @@
import { Status } from "#app/data/status-effect";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -52,9 +50,9 @@ describe("Abilities - SHIELDS DOWN", () => {
game.move.select(MoveId.SPLASH);
await game.doKillOpponents();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
game.doSelectModifier();
await game.phaseInterceptor.to(QuietFormChangePhase);
await game.phaseInterceptor.to("QuietFormChangePhase");
expect(minior.formIndex).toBe(meteorForm);
});
@ -64,7 +62,7 @@ describe("Abilities - SHIELDS DOWN", () => {
await game.classicMode.startBattle([SpeciesId.MINIOR]);
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.getPlayerPokemon()!.status).toBe(undefined);
});
@ -76,7 +74,7 @@ describe("Abilities - SHIELDS DOWN", () => {
game.move.select(MoveId.SPLASH);
await game.move.selectEnemyMove(MoveId.SPORE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.getPlayerPokemon()!.status).toBe(undefined);
});
@ -87,7 +85,7 @@ describe("Abilities - SHIELDS DOWN", () => {
await game.classicMode.startBattle([SpeciesId.MINIOR]);
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.getPlayerPokemon()!.status).toBe(undefined);
});
@ -99,7 +97,7 @@ describe("Abilities - SHIELDS DOWN", () => {
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.getPlayerPokemon()!.status).toBe(undefined);
});
@ -135,7 +133,7 @@ describe("Abilities - SHIELDS DOWN", () => {
game.move.select(MoveId.SPLASH);
await game.move.selectEnemyMove(MoveId.YAWN);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.getPlayerPokemon()!.findTag(tag => tag.tagType === BattlerTagType.DROWSY)).toBe(undefined);
});
@ -147,7 +145,7 @@ describe("Abilities - SHIELDS DOWN", () => {
game.move.select(MoveId.SPLASH);
await game.move.selectEnemyMove(MoveId.CONFUSE_RAY);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.getPlayerPokemon()!.findTag(tag => tag.tagType === BattlerTagType.CONFUSED)).not.toBe(undefined);
});
@ -161,7 +159,7 @@ describe("Abilities - SHIELDS DOWN", () => {
game.move.select(MoveId.SPORE);
await game.move.selectEnemyMove(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.getEnemyPokemon()!.status?.effect).toBe(StatusEffect.SLEEP);
});

View File

@ -7,7 +7,7 @@ import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import type { CommandPhase } from "#app/phases/command-phase";
import { Command } from "#enums/command";
import { AttemptRunPhase } from "#app/phases/attempt-run-phase";
import type { AttemptRunPhase } from "#app/phases/attempt-run-phase";
describe("Abilities - Speed Boost", () => {
let phaserGame: Phaser.Game;
@ -102,7 +102,7 @@ describe("Abilities - Speed Boost", () => {
commandPhase.handleCommand(Command.RUN, 0);
const runPhase = game.scene.phaseManager.getCurrentPhase() as AttemptRunPhase;
runPhase.forceFailEscape = true;
await game.phaseInterceptor.to(AttemptRunPhase);
await game.phaseInterceptor.to("AttemptRunPhase");
await game.toNextTurn();
const playerPokemon = game.scene.getPlayerPokemon()!;

View File

@ -4,7 +4,7 @@ import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { TurnStartPhase } from "#app/phases/turn-start-phase";
import type { TurnStartPhase } from "#app/phases/turn-start-phase";
describe("Abilities - Stall", () => {
let phaserGame: Phaser.Game;
@ -45,7 +45,7 @@ describe("Abilities - Stall", () => {
game.move.select(MoveId.QUICK_ATTACK);
await game.phaseInterceptor.to(TurnStartPhase, false);
await game.phaseInterceptor.to("TurnStartPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as TurnStartPhase;
const speedOrder = phase.getSpeedOrder();
const commandOrder = phase.getCommandOrder();
@ -63,7 +63,7 @@ describe("Abilities - Stall", () => {
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnStartPhase, false);
await game.phaseInterceptor.to("TurnStartPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as TurnStartPhase;
const speedOrder = phase.getSpeedOrder();
const commandOrder = phase.getCommandOrder();
@ -82,7 +82,7 @@ describe("Abilities - Stall", () => {
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnStartPhase, false);
await game.phaseInterceptor.to("TurnStartPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as TurnStartPhase;
const speedOrder = phase.getSpeedOrder();
const commandOrder = phase.getCommandOrder();

View File

@ -1,6 +1,4 @@
import type { EnemyPokemon } from "#app/field/pokemon";
import { DamageAnimPhase } from "#app/phases/damage-anim-phase";
import { MoveEndPhase } from "#app/phases/move-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -37,7 +35,7 @@ describe("Abilities - Sturdy", () => {
test("Sturdy activates when user is at full HP", async () => {
await game.classicMode.startBattle();
game.move.select(MoveId.CLOSE_COMBAT);
await game.phaseInterceptor.to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
expect(game.scene.getEnemyParty()[0].hp).toBe(1);
});
@ -48,7 +46,7 @@ describe("Abilities - Sturdy", () => {
enemyPokemon.hp = enemyPokemon.getMaxHp() - 1;
game.move.select(MoveId.CLOSE_COMBAT);
await game.phaseInterceptor.to(DamageAnimPhase);
await game.phaseInterceptor.to("DamageAnimPhase");
expect(enemyPokemon.hp).toBe(0);
expect(enemyPokemon.isFainted()).toBe(true);
@ -57,7 +55,7 @@ describe("Abilities - Sturdy", () => {
test("Sturdy pokemon should be immune to OHKO moves", async () => {
await game.classicMode.startBattle();
game.move.select(MoveId.FISSURE);
await game.phaseInterceptor.to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
const enemyPokemon: EnemyPokemon = game.scene.getEnemyParty()[0];
expect(enemyPokemon.isFullHp()).toBe(true);
@ -68,7 +66,7 @@ describe("Abilities - Sturdy", () => {
await game.classicMode.startBattle();
game.move.select(MoveId.CLOSE_COMBAT);
await game.phaseInterceptor.to(DamageAnimPhase);
await game.phaseInterceptor.to("DamageAnimPhase");
const enemyPokemon: EnemyPokemon = game.scene.getEnemyParty()[0];
expect(enemyPokemon.hp).toBe(0);

View File

@ -3,7 +3,6 @@ import type Move from "#app/data/moves/move";
import { AbilityId } from "#enums/ability-id";
import { SpeciesId } from "#enums/species-id";
import { BattlerIndex } from "#enums/battler-index";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
@ -58,7 +57,7 @@ describe("Abilities - Supreme Overlord", () => {
game.move.select(MoveId.TACKLE);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(move.calculateBattlePower).toHaveReturnedWith(basePower * 1.2);
});
@ -93,7 +92,7 @@ describe("Abilities - Supreme Overlord", () => {
game.move.select(MoveId.TACKLE);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(move.calculateBattlePower).toHaveReturnedWith(basePower * 1.3);
});

View File

@ -1,8 +1,6 @@
import { BattlerIndex } from "#enums/battler-index";
import { AbilityId } from "#enums/ability-id";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { CommandPhase } from "#app/phases/command-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
@ -39,7 +37,7 @@ describe("Abilities - Sweet Veil", () => {
game.move.select(MoveId.SPLASH);
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.getPlayerField().every(p => p.status?.effect)).toBe(false);
});
@ -51,7 +49,7 @@ describe("Abilities - Sweet Veil", () => {
game.move.select(MoveId.SPLASH);
game.move.select(MoveId.REST, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.getPlayerField().every(p => p.status?.effect)).toBe(false);
});
@ -63,7 +61,7 @@ describe("Abilities - Sweet Veil", () => {
game.move.select(MoveId.SPLASH);
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(game.scene.getPlayerField().every(p => !!p.getTag(BattlerTagType.DROWSY))).toBe(false);
});
@ -80,7 +78,7 @@ describe("Abilities - Sweet Veil", () => {
expect(game.scene.getPlayerField().some(p => !!p.getTag(BattlerTagType.DROWSY))).toBe(true);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SPLASH);
game.doSwitchPokemon(2);

View File

@ -1,4 +1,3 @@
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -6,7 +5,6 @@ import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { BerryPhase } from "#app/phases/berry-phase";
describe("Abilities - Unseen Fist", () => {
let phaserGame: Phaser.Game;
@ -60,7 +58,7 @@ describe("Abilities - Unseen Fist", () => {
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(BerryPhase, false);
await game.phaseInterceptor.to("BerryPhase", false);
expect(enemyPokemon.getTag(BattlerTagType.SUBSTITUTE)).toBeUndefined();
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp());
@ -86,7 +84,7 @@ async function testUnseenFistHitResult(
const enemyStartingHp = enemyPokemon.hp;
game.move.select(attackMove);
await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to("TurnEndPhase", false);
if (shouldSucceed) {
expect(enemyPokemon.hp).toBeLessThan(enemyStartingHp);

View File

@ -1,5 +1,4 @@
import { BattlerIndex } from "#enums/battler-index";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -40,7 +39,7 @@ describe("Abilities - Victory Star", () => {
vi.spyOn(user, "getAccuracyMultiplier");
game.move.select(MoveId.TACKLE, 0, BattlerIndex.ENEMY);
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(user.getAccuracyMultiplier).toHaveReturnedWith(1.1);
});
@ -53,7 +52,7 @@ describe("Abilities - Victory Star", () => {
game.move.select(MoveId.TACKLE, 0, BattlerIndex.ENEMY);
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(ally.getAccuracyMultiplier).toHaveReturnedWith(1.1);
});

View File

@ -1,5 +1,4 @@
import { Stat } from "#enums/stat";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { BattlerTagType } from "#enums/battler-tag-type";
import { MoveId } from "#enums/move-id";
@ -46,7 +45,7 @@ describe("Abilities - Volt Absorb", () => {
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(playerPokemon.getStatStage(Stat.SPDEF)).toBe(1);
expect(playerPokemon.getTag(BattlerTagType.CHARGED)).toBeDefined();

View File

@ -1,5 +1,4 @@
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -38,7 +37,7 @@ describe("Abilities - Wind Power", () => {
expect(shiftry.getTag(BattlerTagType.CHARGED)).toBeUndefined();
game.move.select(MoveId.PETAL_BLIZZARD);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(shiftry.getTag(BattlerTagType.CHARGED)).toBeDefined();
});
@ -52,7 +51,7 @@ describe("Abilities - Wind Power", () => {
expect(shiftry.getTag(BattlerTagType.CHARGED)).toBeUndefined();
game.move.select(MoveId.TAILWIND);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(shiftry.getTag(BattlerTagType.CHARGED)).toBeDefined();
});
@ -69,7 +68,7 @@ describe("Abilities - Wind Power", () => {
game.move.select(MoveId.TAILWIND);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(shiftry.getTag(BattlerTagType.CHARGED)).toBeDefined();
expect(magikarp.getTag(BattlerTagType.CHARGED)).toBeUndefined();
@ -85,7 +84,7 @@ describe("Abilities - Wind Power", () => {
game.move.select(MoveId.SANDSTORM);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(shiftry.getTag(BattlerTagType.CHARGED)).toBeUndefined();
});

View File

@ -1,5 +1,4 @@
import { allMoves } from "#app/data/data-lists";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -39,7 +38,7 @@ describe("Abilities - Wonder Skin", () => {
await game.classicMode.startBattle([SpeciesId.PIKACHU]);
game.move.select(MoveId.CHARM);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattleAccuracy).toHaveReturnedWith(50);
});
@ -51,7 +50,7 @@ describe("Abilities - Wonder Skin", () => {
await game.classicMode.startBattle([SpeciesId.PIKACHU]);
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattleAccuracy).toHaveReturnedWith(100);
});
@ -72,7 +71,7 @@ describe("Abilities - Wonder Skin", () => {
await game.classicMode.startBattle([SpeciesId.PIKACHU]);
game.move.select(MoveId.CHARM);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattleAccuracy).toHaveReturnedWith(100);
});

View File

@ -1,6 +1,4 @@
import { Status } from "#app/data/status-effect";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -50,10 +48,10 @@ describe("Abilities - ZERO TO HERO", () => {
game.move.select(MoveId.SPLASH);
await game.doKillOpponents();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
game.doSelectModifier();
await game.phaseInterceptor.to(QuietFormChangePhase);
await game.phaseInterceptor.to(QuietFormChangePhase);
await game.phaseInterceptor.to("QuietFormChangePhase");
await game.phaseInterceptor.to("QuietFormChangePhase");
expect(palafin1.formIndex).toBe(baseForm);
expect(palafin2.formIndex).toBe(baseForm);
@ -66,7 +64,7 @@ describe("Abilities - ZERO TO HERO", () => {
expect(palafin.formIndex).toBe(baseForm);
game.doSwitchPokemon(1);
await game.phaseInterceptor.to(QuietFormChangePhase);
await game.phaseInterceptor.to("QuietFormChangePhase");
expect(palafin.formIndex).toBe(heroForm);
});

View File

@ -1,6 +1,5 @@
import { allMoves } from "#app/data/data-lists";
import { AbilityId } from "#enums/ability-id";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import { WeatherType } from "#enums/weather-type";
@ -41,7 +40,7 @@ describe("Weather - Fog", () => {
await game.classicMode.startBattle([SpeciesId.MAGIKARP]);
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattleAccuracy).toHaveReturnedWith(100 * 0.9);
});

View File

@ -1,6 +1,5 @@
import { allMoves } from "#app/data/data-lists";
import { StatusEffect } from "#app/enums/status-effect";
import { TurnStartPhase } from "#app/phases/turn-start-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -41,7 +40,7 @@ describe("Weather - Strong Winds", () => {
game.move.select(MoveId.THUNDERBOLT);
await game.phaseInterceptor.to(TurnStartPhase);
await game.phaseInterceptor.to("TurnStartPhase");
expect(enemy.getAttackTypeEffectiveness(allMoves[MoveId.THUNDERBOLT].type, pikachu)).toBe(0.5);
});
@ -52,7 +51,7 @@ describe("Weather - Strong Winds", () => {
game.move.select(MoveId.THUNDERBOLT);
await game.phaseInterceptor.to(TurnStartPhase);
await game.phaseInterceptor.to("TurnStartPhase");
expect(enemy.getAttackTypeEffectiveness(allMoves[MoveId.THUNDERBOLT].type, pikachu)).toBe(1);
});
@ -63,7 +62,7 @@ describe("Weather - Strong Winds", () => {
game.move.select(MoveId.ICE_BEAM);
await game.phaseInterceptor.to(TurnStartPhase);
await game.phaseInterceptor.to("TurnStartPhase");
expect(enemy.getAttackTypeEffectiveness(allMoves[MoveId.ICE_BEAM].type, pikachu)).toBe(1);
});
@ -74,7 +73,7 @@ describe("Weather - Strong Winds", () => {
game.move.select(MoveId.ROCK_SLIDE);
await game.phaseInterceptor.to(TurnStartPhase);
await game.phaseInterceptor.to("TurnStartPhase");
expect(enemy.getAttackTypeEffectiveness(allMoves[MoveId.ROCK_SLIDE].type, pikachu)).toBe(1);
});

View File

@ -1,6 +1,4 @@
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { SelectTargetPhase } from "#app/phases/select-target-phase";
import { TurnStartPhase } from "#app/phases/turn-start-phase";
import type { TurnStartPhase } from "#app/phases/turn-start-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -41,7 +39,7 @@ describe("Battle order", () => {
vi.spyOn(enemyPokemon, "stats", "get").mockReturnValue([20, 20, 20, 20, 20, 150]); // set enemyPokemon's speed to 150
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.run(EnemyCommandPhase);
await game.phaseInterceptor.to("TurnStartPhase");
const playerPokemonIndex = playerPokemon.getBattlerIndex();
const enemyPokemonIndex = enemyPokemon.getBattlerIndex();
@ -60,7 +58,7 @@ describe("Battle order", () => {
vi.spyOn(enemyPokemon, "stats", "get").mockReturnValue([20, 20, 20, 20, 20, 50]); // set enemyPokemon's speed to 50
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.run(EnemyCommandPhase);
await game.phaseInterceptor.to("TurnStartPhase");
const playerPokemonIndex = playerPokemon.getBattlerIndex();
const enemyPokemonIndex = enemyPokemon.getBattlerIndex();
@ -84,7 +82,7 @@ describe("Battle order", () => {
game.move.select(MoveId.TACKLE);
game.move.select(MoveId.TACKLE, 1);
await game.phaseInterceptor.runFrom(SelectTargetPhase).to(TurnStartPhase, false);
await game.phaseInterceptor.to("TurnStartPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as TurnStartPhase;
const order = phase.getCommandOrder();
@ -108,7 +106,7 @@ describe("Battle order", () => {
game.move.select(MoveId.TACKLE);
game.move.select(MoveId.TACKLE, 1);
await game.phaseInterceptor.runFrom(SelectTargetPhase).to(TurnStartPhase, false);
await game.phaseInterceptor.to("TurnStartPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as TurnStartPhase;
const order = phase.getCommandOrder();
@ -132,7 +130,7 @@ describe("Battle order", () => {
game.move.select(MoveId.TACKLE);
game.move.select(MoveId.TACKLE, 1);
await game.phaseInterceptor.runFrom(SelectTargetPhase).to(TurnStartPhase, false);
await game.phaseInterceptor.to("TurnStartPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as TurnStartPhase;
const order = phase.getCommandOrder();

View File

@ -1,26 +1,11 @@
import { allSpecies } from "#app/data/data-lists";
import { Stat } from "#enums/stat";
import { getGameMode } from "#app/game-mode";
import { GameModes } from "#enums/game-modes";
import { BattleEndPhase } from "#app/phases/battle-end-phase";
import { CommandPhase } from "#app/phases/command-phase";
import { DamageAnimPhase } from "#app/phases/damage-anim-phase";
import { EncounterPhase } from "#app/phases/encounter-phase";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { LoginPhase } from "#app/phases/login-phase";
import { NextEncounterPhase } from "#app/phases/next-encounter-phase";
import { SelectGenderPhase } from "#app/phases/select-gender-phase";
import { SelectStarterPhase } from "#app/phases/select-starter-phase";
import { SummonPhase } from "#app/phases/summon-phase";
import { SwitchPhase } from "#app/phases/switch-phase";
import { TitlePhase } from "#app/phases/title-phase";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
import GameManager from "#test/testUtils/gameManager";
import { generateStarter } from "#test/testUtils/gameManagerUtils";
import { UiMode } from "#enums/ui-mode";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { PlayerGender } from "#enums/player-gender";
import { SpeciesId } from "#enums/species-id";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
@ -45,44 +30,6 @@ describe("Test Battle Phase", () => {
game.scene.gameData.gender = undefined!; // just for these tests!
});
it("test phase interceptor with prompt", async () => {
await game.phaseInterceptor.run(LoginPhase);
game.onNextPrompt("SelectGenderPhase", UiMode.OPTION_SELECT, () => {
game.scene.gameData.gender = PlayerGender.MALE;
game.endPhase();
});
await game.phaseInterceptor.run(SelectGenderPhase);
await game.phaseInterceptor.run(TitlePhase);
await game.waitMode(UiMode.TITLE);
expect(game.scene.ui?.getMode()).toBe(UiMode.TITLE);
expect(game.scene.gameData.gender).toBe(PlayerGender.MALE);
});
it("test phase interceptor with prompt with preparation for a future prompt", async () => {
await game.phaseInterceptor.run(LoginPhase);
game.onNextPrompt("SelectGenderPhase", UiMode.OPTION_SELECT, () => {
game.scene.gameData.gender = PlayerGender.MALE;
game.endPhase();
});
game.onNextPrompt("CheckSwitchPhase", UiMode.CONFIRM, () => {
game.setMode(UiMode.MESSAGE);
game.endPhase();
});
await game.phaseInterceptor.run(SelectGenderPhase);
await game.phaseInterceptor.run(TitlePhase);
await game.waitMode(UiMode.TITLE);
expect(game.scene.ui?.getMode()).toBe(UiMode.TITLE);
expect(game.scene.gameData.gender).toBe(PlayerGender.MALE);
});
it("newGame one-liner", async () => {
await game.classicMode.startBattle();
expect(game.scene.ui?.getMode()).toBe(UiMode.COMMAND);
@ -107,7 +54,7 @@ describe("Test Battle Phase", () => {
.battleStyle("single");
await game.classicMode.startBattle([SpeciesId.MEWTWO]);
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnInitPhase, false);
await game.phaseInterceptor.to("TurnInitPhase", false);
});
it("load 100% data file", async () => {
@ -135,68 +82,6 @@ describe("Test Battle Phase", () => {
}
});
it("wrong phase", async () => {
await game.phaseInterceptor.run(LoginPhase);
await game.phaseInterceptor.run(LoginPhase).catch(e => {
expect(e).toBe("Wrong phase: this is SelectGenderPhase and not LoginPhase");
});
});
it("wrong phase but skip", async () => {
await game.phaseInterceptor.run(LoginPhase);
await game.phaseInterceptor.run(LoginPhase, () => game.isCurrentPhase(SelectGenderPhase));
});
it("good run", async () => {
await game.phaseInterceptor.run(LoginPhase);
game.onNextPrompt(
"SelectGenderPhase",
UiMode.OPTION_SELECT,
() => {
game.scene.gameData.gender = PlayerGender.MALE;
game.endPhase();
},
() => game.isCurrentPhase(TitlePhase),
);
await game.phaseInterceptor.run(SelectGenderPhase, () => game.isCurrentPhase(TitlePhase));
await game.phaseInterceptor.run(TitlePhase);
});
it("good run from select gender to title", async () => {
await game.phaseInterceptor.run(LoginPhase);
game.onNextPrompt(
"SelectGenderPhase",
UiMode.OPTION_SELECT,
() => {
game.scene.gameData.gender = PlayerGender.MALE;
game.endPhase();
},
() => game.isCurrentPhase(TitlePhase),
);
await game.phaseInterceptor.runFrom(SelectGenderPhase).to(TitlePhase);
});
it("good run to SummonPhase phase", async () => {
await game.phaseInterceptor.run(LoginPhase);
game.onNextPrompt(
"SelectGenderPhase",
UiMode.OPTION_SELECT,
() => {
game.scene.gameData.gender = PlayerGender.MALE;
game.endPhase();
},
() => game.isCurrentPhase(TitlePhase),
);
game.onNextPrompt("TitlePhase", UiMode.TITLE, () => {
game.scene.gameMode = getGameMode(GameModes.CLASSIC);
const starters = generateStarter(game.scene);
const selectStarterPhase = new SelectStarterPhase();
game.scene.phaseManager.pushPhase(new EncounterPhase(false));
selectStarterPhase.initBattle(starters);
});
await game.phaseInterceptor.runFrom(SelectGenderPhase).to(SummonPhase);
});
it("2vs1", async () => {
game.override.battleStyle("single");
game.override.enemySpecies(SpeciesId.MIGHTYENA);
@ -254,7 +139,7 @@ describe("Test Battle Phase", () => {
await game.classicMode.startBattle([SpeciesId.DARMANITAN, SpeciesId.CHARIZARD]);
game.move.select(moveToUse);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
await game.killPokemon(game.scene.currentBattle.enemyParty[0]);
expect(game.scene.currentBattle.enemyParty[0].isFainted()).toBe(true);
await game.phaseInterceptor.to("VictoryPhase");
@ -318,7 +203,7 @@ describe("Test Battle Phase", () => {
game.scene.getPlayerPokemon()!.hp = 1;
game.move.select(moveToUse);
await game.phaseInterceptor.to(BattleEndPhase);
await game.phaseInterceptor.to("BattleEndPhase");
game.doRevivePokemon(0); // pretend max revive was picked
game.doSelectModifier();
@ -330,6 +215,6 @@ describe("Test Battle Phase", () => {
},
() => game.isCurrentPhase(NextEncounterPhase),
);
await game.phaseInterceptor.to(SwitchPhase);
await game.phaseInterceptor.to("SwitchPhase");
});
});

View File

@ -2,8 +2,6 @@ import { Status } from "#app/data/status-effect";
import { AbilityId } from "#enums/ability-id";
import { getGameMode } from "#app/game-mode";
import { GameModes } from "#enums/game-modes";
import { BattleEndPhase } from "#app/phases/battle-end-phase";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import { StatusEffect } from "#enums/status-effect";
@ -48,13 +46,13 @@ describe("Double Battles", () => {
await game.doKillOpponents();
await game.phaseInterceptor.to(BattleEndPhase);
await game.phaseInterceptor.to("BattleEndPhase");
game.doSelectModifier();
const charizard = game.scene.getPlayerParty().findIndex(p => p.species.speciesId === SpeciesId.CHARIZARD);
game.doRevivePokemon(charizard);
await game.phaseInterceptor.to(TurnInitPhase);
await game.phaseInterceptor.to("TurnInitPhase");
expect(game.scene.getPlayerField().filter(p => !p.isFainted())).toHaveLength(2);
});

View File

@ -1,4 +1,4 @@
import { AttemptRunPhase } from "#app/phases/attempt-run-phase";
import type { AttemptRunPhase } from "#app/phases/attempt-run-phase";
import type { CommandPhase } from "#app/phases/command-phase";
import { Command } from "#enums/command";
import { NumberHolder } from "#app/utils/common";
@ -43,7 +43,7 @@ describe("Escape chance calculations", () => {
const commandPhase = game.scene.phaseManager.getCurrentPhase() as CommandPhase;
commandPhase.handleCommand(Command.RUN, 0);
await game.phaseInterceptor.to(AttemptRunPhase, false);
await game.phaseInterceptor.to("AttemptRunPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as AttemptRunPhase;
const escapePercentage = new NumberHolder(0);
@ -116,7 +116,7 @@ describe("Escape chance calculations", () => {
const commandPhase = game.scene.phaseManager.getCurrentPhase() as CommandPhase;
commandPhase.handleCommand(Command.RUN, 0);
await game.phaseInterceptor.to(AttemptRunPhase, false);
await game.phaseInterceptor.to("AttemptRunPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as AttemptRunPhase;
const escapePercentage = new NumberHolder(0);
@ -195,7 +195,7 @@ describe("Escape chance calculations", () => {
const commandPhase = game.scene.phaseManager.getCurrentPhase() as CommandPhase;
commandPhase.handleCommand(Command.RUN, 0);
await game.phaseInterceptor.to(AttemptRunPhase, false);
await game.phaseInterceptor.to("AttemptRunPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as AttemptRunPhase;
const escapePercentage = new NumberHolder(0);
@ -281,7 +281,7 @@ describe("Escape chance calculations", () => {
const commandPhase = game.scene.phaseManager.getCurrentPhase() as CommandPhase;
commandPhase.handleCommand(Command.RUN, 0);
await game.phaseInterceptor.to(AttemptRunPhase, false);
await game.phaseInterceptor.to("AttemptRunPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as AttemptRunPhase;
const escapePercentage = new NumberHolder(0);

View File

@ -1,17 +1,14 @@
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { BattleEndPhase } from "#app/phases/battle-end-phase";
import { TempCritBoosterModifier } from "#app/modifier/modifier";
import { UiMode } from "#enums/ui-mode";
import type ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
import { Button } from "#app/enums/buttons";
import { CommandPhase } from "#app/phases/command-phase";
import { NewBattlePhase } from "#app/phases/new-battle-phase";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
import { ShopCursorTarget } from "#app/enums/shop-cursor-target";
describe("Items - Dire Hit", () => {
@ -48,7 +45,7 @@ describe("Items - Dire Hit", () => {
game.move.select(MoveId.POUND);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon.getCritStage).toHaveReturnedWith(1);
});
@ -62,7 +59,7 @@ describe("Items - Dire Hit", () => {
await game.doKillOpponents();
await game.phaseInterceptor.to(BattleEndPhase);
await game.phaseInterceptor.to("BattleEndPhase");
const modifier = game.scene.findModifier(m => m instanceof TempCritBoosterModifier) as TempCritBoosterModifier;
expect(modifier.getBattleCount()).toBe(4);
@ -82,7 +79,7 @@ describe("Items - Dire Hit", () => {
true,
);
await game.phaseInterceptor.to(TurnInitPhase);
await game.phaseInterceptor.to("TurnInitPhase");
// Making sure only one booster is in the modifier list even after picking up another
let count = 0;

View File

@ -1,4 +1,3 @@
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { randInt } from "#app/utils/common";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -40,7 +39,7 @@ describe("Items - Leek", () => {
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyMember.getCritStage).toHaveReturnedWith(2);
});
@ -54,7 +53,7 @@ describe("Items - Leek", () => {
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyMember.getCritStage).toHaveReturnedWith(2);
});
@ -68,7 +67,7 @@ describe("Items - Leek", () => {
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyMember.getCritStage).toHaveReturnedWith(2);
});
@ -96,7 +95,7 @@ describe("Items - Leek", () => {
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyMember.getCritStage).toHaveReturnedWith(2);
});
@ -124,7 +123,7 @@ describe("Items - Leek", () => {
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyMember.getCritStage).toHaveReturnedWith(2);
});
@ -138,7 +137,7 @@ describe("Items - Leek", () => {
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyMember.getCritStage).toHaveReturnedWith(0);
});

View File

@ -1,5 +1,3 @@
import { DamageAnimPhase } from "#app/phases/damage-anim-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -48,13 +46,13 @@ describe("Items - Leftovers", () => {
game.move.select(MoveId.SPLASH);
// We should have less hp after the attack
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(leadPokemon.hp).toBeLessThan(leadPokemon.getMaxHp());
const leadHpAfterDamage = leadPokemon.hp;
// Check if leftovers heal us
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.hp).toBeGreaterThan(leadHpAfterDamage);
});
});

View File

@ -1,4 +1,3 @@
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
@ -39,7 +38,7 @@ describe("Items - Scope Lens", () => {
game.move.select(MoveId.POUND);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon.getCritStage).toHaveReturnedWith(1);
});

View File

@ -4,7 +4,6 @@ import { SpeciesId } from "#enums/species-id";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { MoveId } from "#enums/move-id";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { TempStatStageBoosterModifier } from "#app/modifier/modifier";
import { UiMode } from "#enums/ui-mode";
@ -47,7 +46,7 @@ describe("Items - Temporary Stat Stage Boosters", () => {
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.runFrom("EnemyCommandPhase").to(TurnEndPhase);
await game.toEndOfTurn();
expect(partyMember.getStatStageMultiplier).toHaveReturnedWith(1.3);
});
@ -64,11 +63,11 @@ describe("Items - Temporary Stat Stage Boosters", () => {
// Raise ACC by +2 stat stages
game.move.select(MoveId.HONE_CLAWS);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
// ACC at +3 stat stages yields a x2 multiplier
expect(partyMember.getAccuracyMultiplier).toHaveReturnedWith(2);
@ -84,11 +83,11 @@ describe("Items - Temporary Stat Stage Boosters", () => {
// Raise ATK by +1 stat stage
game.move.select(MoveId.HONE_CLAWS);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
// ATK at +1 stat stage yields a x1.5 multiplier, add 0.3 from X_ATTACK
expect(partyMember.getStatStageMultiplier).toHaveReturnedWith(1.8);
@ -112,7 +111,7 @@ describe("Items - Temporary Stat Stage Boosters", () => {
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(partyMember.getAccuracyMultiplier).toHaveReturnedWith(3);
expect(partyMember.getStatStageMultiplier).toHaveReturnedWith(4);

View File

@ -64,16 +64,13 @@ describe("Test misc", () => {
expect(data).toBeDefined();
});
it("testing wait phase queue", async () => {
const fakeScene = {
phaseQueue: [1, 2, 3], // Initially not empty
};
it("testing waitUntil", async () => {
let a = 1;
setTimeout(() => {
fakeScene.phaseQueue = [];
a = 0;
}, 500);
const spy = vi.fn();
await waitUntil(() => fakeScene.phaseQueue.length === 0).then(result => {
expect(result).toBe(true);
await waitUntil(() => a === 0).then(() => {
spy(); // Call the spy function
});
expect(spy).toHaveBeenCalled();

View File

@ -1,7 +1,7 @@
import { BattlerIndex } from "#enums/battler-index";
import { AbilityId } from "#enums/ability-id";
import { MoveResult } from "#enums/move-result";
import { MovePhase } from "#app/phases/move-phase";
import type { MovePhase } from "#app/phases/move-phase";
import { MoveUseMode } from "#enums/move-use-mode";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -42,7 +42,7 @@ describe("Moves - After You", () => {
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to("MoveEffectPhase");
await game.phaseInterceptor.to(MovePhase, false);
await game.phaseInterceptor.to("MovePhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as MovePhase;
expect(phase.pokemon).toBe(game.scene.getPlayerField()[1]);
await game.phaseInterceptor.to("MoveEndPhase");
@ -57,7 +57,7 @@ describe("Moves - After You", () => {
await game.phaseInterceptor.to("MoveEndPhase");
await game.phaseInterceptor.to("MoveEndPhase");
await game.phaseInterceptor.to(MovePhase);
await game.phaseInterceptor.to("MovePhase");
expect(game.scene.getPlayerField()[1].getLastXMoves(1)[0].result).toBe(MoveResult.FAIL);
});

View File

@ -1,7 +1,6 @@
import { BattlerIndex } from "#enums/battler-index";
import { AbilityId } from "#enums/ability-id";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { BerryPhase } from "#app/phases/berry-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
@ -42,7 +41,7 @@ describe("Moves - Alluring Voice", () => {
game.move.use(MoveId.ALLURING_VOICE);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to(BerryPhase);
await game.phaseInterceptor.to("BerryPhase");
expect(enemy.getTag(BattlerTagType.CONFUSED)?.tagType).toBe("CONFUSED");
});

View File

@ -1,5 +1,4 @@
import { StatusEffect } from "#app/enums/status-effect";
import { CommandPhase } from "#app/phases/command-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -40,7 +39,7 @@ describe("Moves - Aromatherapy", () => {
vi.spyOn(partyPokemon, "resetStatus");
game.move.select(MoveId.AROMATHERAPY, 0);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SPLASH, 1);
await game.toNextTurn();
@ -62,7 +61,7 @@ describe("Moves - Aromatherapy", () => {
vi.spyOn(rightOpp, "resetStatus");
game.move.select(MoveId.AROMATHERAPY, 0);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SPLASH, 1);
await game.toNextTurn();
@ -86,7 +85,7 @@ describe("Moves - Aromatherapy", () => {
vi.spyOn(partyPokemon, "resetStatus");
game.move.select(MoveId.AROMATHERAPY, 0);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SPLASH, 1);
await game.toNextTurn();

View File

@ -1,7 +1,6 @@
import { BattlerIndex } from "#enums/battler-index";
import { Stat } from "#app/enums/stat";
import { MoveResult } from "#enums/move-result";
import { CommandPhase } from "#app/phases/command-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -80,7 +79,7 @@ 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);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.PROTECT, 1);
await game.toNextTurn();
@ -96,7 +95,7 @@ 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);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.ASSIST, 1);
await game.toNextTurn();

View File

@ -1,9 +1,5 @@
import { allMoves } from "#app/data/data-lists";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { BerryPhase } from "#app/phases/berry-phase";
import { CommandPhase } from "#app/phases/command-phase";
import { MoveEndPhase } from "#app/phases/move-end-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -48,20 +44,20 @@ describe("Moves - Astonish", () => {
game.move.select(MoveId.ASTONISH);
await game.phaseInterceptor.to(MoveEndPhase, false);
await game.phaseInterceptor.to("MoveEndPhase", false);
expect(enemyPokemon.getTag(BattlerTagType.FLINCHED)).toBeDefined();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp());
expect(enemyPokemon.getTag(BattlerTagType.FLINCHED)).toBeUndefined();
await game.phaseInterceptor.to(CommandPhase, false);
await game.phaseInterceptor.to("CommandPhase", false);
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(BerryPhase, false);
await game.phaseInterceptor.to("BerryPhase", false);
expect(leadPokemon.hp).toBeLessThan(leadPokemon.getMaxHp());
});

View File

@ -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";
@ -52,7 +51,7 @@ describe("Moves - Aurora Veil", () => {
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const mockedDmg = getMockedMoveDamage(
game.scene.getEnemyPokemon()!,
game.scene.getPlayerPokemon()!,
@ -71,7 +70,7 @@ describe("Moves - Aurora Veil", () => {
game.move.select(moveToUse);
game.move.select(moveToUse, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const mockedDmg = getMockedMoveDamage(
game.scene.getEnemyPokemon()!,
game.scene.getPlayerPokemon()!,
@ -87,7 +86,7 @@ describe("Moves - Aurora Veil", () => {
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const mockedDmg = getMockedMoveDamage(
game.scene.getEnemyPokemon()!,
@ -107,7 +106,7 @@ describe("Moves - Aurora Veil", () => {
game.move.select(moveToUse);
game.move.select(moveToUse, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const mockedDmg = getMockedMoveDamage(
game.scene.getEnemyPokemon()!,
game.scene.getPlayerPokemon()!,
@ -123,7 +122,7 @@ describe("Moves - Aurora Veil", () => {
await game.classicMode.startBattle([SpeciesId.SHUCKLE]);
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const mockedDmg = getMockedMoveDamage(
game.scene.getEnemyPokemon()!,
@ -140,7 +139,7 @@ describe("Moves - Aurora Veil", () => {
await game.classicMode.startBattle([SpeciesId.SHUCKLE]);
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const mockedDmg = getMockedMoveDamage(
game.scene.getEnemyPokemon()!,

View File

@ -1,8 +1,5 @@
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { StatusEffect } from "#app/enums/status-effect";
import { BerryPhase } from "#app/phases/berry-phase";
import { MovePhase } from "#app/phases/move-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -45,10 +42,10 @@ describe("Moves - Beak Blast", () => {
game.move.select(MoveId.BEAK_BLAST);
await game.phaseInterceptor.to(MovePhase, false);
await game.phaseInterceptor.to("MovePhase", false);
expect(leadPokemon.getTag(BattlerTagType.BEAK_BLAST_CHARGING)).toBeDefined();
await game.phaseInterceptor.to(BerryPhase, false);
await game.phaseInterceptor.to("BerryPhase", false);
expect(enemyPokemon.status?.effect).toBe(StatusEffect.BURN);
});
@ -62,10 +59,10 @@ describe("Moves - Beak Blast", () => {
game.move.select(MoveId.BEAK_BLAST);
await game.phaseInterceptor.to(MovePhase, false);
await game.phaseInterceptor.to("MovePhase", false);
expect(leadPokemon.getTag(BattlerTagType.BEAK_BLAST_CHARGING)).toBeDefined();
await game.phaseInterceptor.to(BerryPhase, false);
await game.phaseInterceptor.to("BerryPhase", false);
expect(enemyPokemon.status?.effect).toBe(StatusEffect.BURN);
});
@ -79,10 +76,10 @@ describe("Moves - Beak Blast", () => {
game.move.select(MoveId.BEAK_BLAST);
await game.phaseInterceptor.to(MovePhase, false);
await game.phaseInterceptor.to("MovePhase", false);
expect(leadPokemon.getTag(BattlerTagType.BEAK_BLAST_CHARGING)).toBeDefined();
await game.phaseInterceptor.to(BerryPhase, false);
await game.phaseInterceptor.to("BerryPhase", false);
expect(enemyPokemon.status?.effect).not.toBe(StatusEffect.BURN);
});
@ -95,7 +92,7 @@ describe("Moves - Beak Blast", () => {
game.move.select(MoveId.BEAK_BLAST);
await game.phaseInterceptor.to(BerryPhase, false);
await game.phaseInterceptor.to("BerryPhase", false);
expect(leadPokemon.turnData.hitCount).toBe(2);
});
@ -109,10 +106,10 @@ describe("Moves - Beak Blast", () => {
game.move.select(MoveId.BEAK_BLAST);
await game.phaseInterceptor.to(MovePhase, false);
await game.phaseInterceptor.to("MovePhase", false);
expect(leadPokemon.getTag(BattlerTagType.BEAK_BLAST_CHARGING)).toBeDefined();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp());
expect(leadPokemon.getTag(BattlerTagType.BEAK_BLAST_CHARGING)).toBeUndefined();
});

View File

@ -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 "#app/enums/status-effect";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
@ -49,14 +48,14 @@ describe("Moves - Beat Up", () => {
game.move.select(MoveId.BEAT_UP);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(playerPokemon.turnData.hitCount).toBe(6);
expect(enemyPokemon.hp).toBeLessThan(enemyStartingHp);
while (playerPokemon.turnData.hitsLeft > 0) {
enemyStartingHp = enemyPokemon.hp;
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(enemyPokemon.hp).toBeLessThan(enemyStartingHp);
}
});
@ -77,7 +76,7 @@ describe("Moves - Beat Up", () => {
game.move.select(MoveId.BEAT_UP);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(playerPokemon.turnData.hitCount).toBe(5);
});

View File

@ -1,4 +1,3 @@
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { toDmgValue } from "#app/utils/common";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -48,7 +47,7 @@ describe("Moves - BELLY DRUM", () => {
const hpLost = toDmgValue(leadPokemon.getMaxHp() / RATIO);
game.move.select(MoveId.BELLY_DRUM);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp() - hpLost);
expect(leadPokemon.getStatStage(Stat.ATK)).toBe(6);
@ -65,7 +64,7 @@ describe("Moves - BELLY DRUM", () => {
leadPokemon.setStatStage(Stat.SPATK, 6);
game.move.select(MoveId.BELLY_DRUM);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp() - hpLost);
expect(leadPokemon.getStatStage(Stat.ATK)).toBe(6);
@ -80,7 +79,7 @@ describe("Moves - BELLY DRUM", () => {
leadPokemon.setStatStage(Stat.ATK, 6);
game.move.select(MoveId.BELLY_DRUM);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp());
expect(leadPokemon.getStatStage(Stat.ATK)).toBe(6);
@ -94,7 +93,7 @@ describe("Moves - BELLY DRUM", () => {
leadPokemon.hp = hpLost - PREDAMAGE;
game.move.select(MoveId.BELLY_DRUM);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.hp).toBe(hpLost - PREDAMAGE);
expect(leadPokemon.getStatStage(Stat.ATK)).toBe(0);

View File

@ -3,8 +3,6 @@ import { ArenaTagSide } from "#enums/arena-tag-side";
import { allMoves } from "#app/data/data-lists";
import { AbilityId } from "#enums/ability-id";
import { ArenaTagType } from "#app/enums/arena-tag-type";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
@ -48,12 +46,12 @@ describe("Moves - Ceaseless Edge", () => {
game.move.select(MoveId.CEASELESS_EDGE);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
// Spikes should not have any layers before move effect is applied
const tagBefore = game.scene.arena.getTagOnSide(ArenaTagType.SPIKES, ArenaTagSide.ENEMY) as ArenaTrapTag;
expect(tagBefore instanceof ArenaTrapTag).toBeFalsy();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const tagAfter = game.scene.arena.getTagOnSide(ArenaTagType.SPIKES, ArenaTagSide.ENEMY) as ArenaTrapTag;
expect(tagAfter instanceof ArenaTrapTag).toBeTruthy();
expect(tagAfter.layers).toBe(1);
@ -70,12 +68,12 @@ describe("Moves - Ceaseless Edge", () => {
game.move.select(MoveId.CEASELESS_EDGE);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
// Spikes should not have any layers before move effect is applied
const tagBefore = game.scene.arena.getTagOnSide(ArenaTagType.SPIKES, ArenaTagSide.ENEMY) as ArenaTrapTag;
expect(tagBefore instanceof ArenaTrapTag).toBeFalsy();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const tagAfter = game.scene.arena.getTagOnSide(ArenaTagType.SPIKES, ArenaTagSide.ENEMY) as ArenaTrapTag;
expect(tagAfter instanceof ArenaTrapTag).toBeTruthy();
expect(tagAfter.layers).toBe(2);
@ -88,7 +86,7 @@ describe("Moves - Ceaseless Edge", () => {
await game.classicMode.startBattle([SpeciesId.ILLUMISE]);
game.move.select(MoveId.CEASELESS_EDGE);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
// Spikes should not have any layers before move effect is applied
const tagBefore = game.scene.arena.getTagOnSide(ArenaTagType.SPIKES, ArenaTagSide.ENEMY) as ArenaTrapTag;
expect(tagBefore instanceof ArenaTrapTag).toBeFalsy();
@ -102,7 +100,7 @@ describe("Moves - Ceaseless Edge", () => {
// Check HP of pokemon that WILL BE switched in (index 1)
game.forceEnemyToSwitch();
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to("TurnEndPhase", false);
expect(game.scene.currentBattle.enemyParty[0].hp).toBeLessThan(hpBeforeSpikes);
});
});

View File

@ -1,7 +1,6 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import Phaser from "phaser";
import GameManager from "#test/testUtils/gameManager";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import { Stat } from "#enums/stat";
@ -45,7 +44,7 @@ describe("Moves - Clangorous Soul", () => {
const hpLost = Math.floor(leadPokemon.getMaxHp() / RATIO);
game.move.select(MoveId.CLANGOROUS_SOUL);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp() - hpLost);
expect(leadPokemon.getStatStage(Stat.ATK)).toBe(1);
@ -68,7 +67,7 @@ describe("Moves - Clangorous Soul", () => {
leadPokemon.setStatStage(Stat.SPDEF, 4);
game.move.select(MoveId.CLANGOROUS_SOUL);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp() - hpLost);
expect(leadPokemon.getStatStage(Stat.ATK)).toBe(6);
@ -90,7 +89,7 @@ describe("Moves - Clangorous Soul", () => {
leadPokemon.setStatStage(Stat.SPD, 6);
game.move.select(MoveId.CLANGOROUS_SOUL);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp());
expect(leadPokemon.getStatStage(Stat.ATK)).toBe(6);
@ -108,7 +107,7 @@ describe("Moves - Clangorous Soul", () => {
leadPokemon.hp = hpLost - PREDAMAGE;
game.move.select(MoveId.CLANGOROUS_SOUL);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.hp).toBe(hpLost - PREDAMAGE);
expect(leadPokemon.getStatStage(Stat.ATK)).toBe(0);

View File

@ -6,8 +6,6 @@ import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { Stat } from "#enums/stat";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { BerryPhase } from "#app/phases/berry-phase";
import { CommandPhase } from "#app/phases/command-phase";
describe("Moves - Crafty Shield", () => {
let phaserGame: Phaser.Game;
@ -43,11 +41,11 @@ describe("Moves - Crafty Shield", () => {
game.move.select(MoveId.CRAFTY_SHIELD);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(BerryPhase, false);
await game.phaseInterceptor.to("BerryPhase", false);
leadPokemon.forEach(p => expect(p.getStatStage(Stat.ATK)).toBe(0));
});
@ -61,11 +59,11 @@ describe("Moves - Crafty Shield", () => {
game.move.select(MoveId.CRAFTY_SHIELD);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(BerryPhase, false);
await game.phaseInterceptor.to("BerryPhase", false);
expect(leadPokemon.some(p => p.hp < p.getMaxHp())).toBeTruthy();
});
@ -79,11 +77,11 @@ describe("Moves - Crafty Shield", () => {
game.move.select(MoveId.CRAFTY_SHIELD);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(BerryPhase, false);
await game.phaseInterceptor.to("BerryPhase", false);
leadPokemon.forEach(p => expect(p.getTag(BattlerTagType.CURSED)).toBeUndefined());
});
@ -95,11 +93,11 @@ describe("Moves - Crafty Shield", () => {
game.move.select(MoveId.CRAFTY_SHIELD);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SWORDS_DANCE, 1);
await game.phaseInterceptor.to(BerryPhase, false);
await game.phaseInterceptor.to("BerryPhase", false);
expect(leadPokemon[0].getStatStage(Stat.ATK)).toBe(0);
expect(leadPokemon[1].getStatStage(Stat.ATK)).toBe(2);

View File

@ -1,6 +1,5 @@
import { Stat } from "#enums/stat";
import { AbilityId } from "#enums/ability-id";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
@ -43,7 +42,7 @@ describe("Moves - Double Team", () => {
expect(ally.getStatStage(Stat.EVA)).toBe(0);
game.move.select(MoveId.DOUBLE_TEAM);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
await game.toNextTurn();
expect(ally.getStatStage(Stat.EVA)).toBe(1);

View File

@ -1,7 +1,6 @@
import { Stat } from "#enums/stat";
import { PokemonType } from "#enums/pokemon-type";
import type { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { BattlerTagType } from "#enums/battler-tag-type";
import { MoveId } from "#enums/move-id";
@ -55,7 +54,7 @@ describe("Moves - Dragon Rage", () => {
vi.spyOn(enemyPokemon, "getTypes").mockReturnValue([PokemonType.DRAGON]);
game.move.select(MoveId.DRAGON_RAGE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon.getInverseHp()).toBe(dragonRageDamage);
});
@ -65,7 +64,7 @@ describe("Moves - Dragon Rage", () => {
vi.spyOn(enemyPokemon, "getTypes").mockReturnValue([PokemonType.STEEL]);
game.move.select(MoveId.DRAGON_RAGE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon.getInverseHp()).toBe(dragonRageDamage);
});
@ -75,7 +74,7 @@ describe("Moves - Dragon Rage", () => {
partyPokemon.setStatStage(Stat.SPATK, 2);
game.move.select(MoveId.DRAGON_RAGE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon.getInverseHp()).toBe(dragonRageDamage);
});
@ -85,7 +84,7 @@ describe("Moves - Dragon Rage", () => {
vi.spyOn(partyPokemon, "getTypes").mockReturnValue([PokemonType.DRAGON]);
game.move.select(MoveId.DRAGON_RAGE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon.getInverseHp()).toBe(dragonRageDamage);
});
@ -94,7 +93,7 @@ describe("Moves - Dragon Rage", () => {
partyPokemon.addTag(BattlerTagType.ALWAYS_CRIT, 99);
game.move.select(MoveId.DRAGON_RAGE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon.getInverseHp()).toBe(dragonRageDamage);
});
@ -103,7 +102,7 @@ describe("Moves - Dragon Rage", () => {
game.override.criticalHits(false).enemyAbility(AbilityId.ICE_SCALES);
game.move.select(MoveId.DRAGON_RAGE);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon.getInverseHp()).toBe(dragonRageDamage);
});

View File

@ -1,7 +1,6 @@
import { BattlerIndex } from "#enums/battler-index";
import { allMoves } from "#app/data/data-lists";
import { DamageAnimPhase } from "#app/phases/damage-anim-phase";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import type { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { MoveId } from "#enums/move-id";
import type Move from "#app/data/moves/move";
import { SpeciesId } from "#enums/species-id";
@ -47,9 +46,9 @@ describe("Moves - Dynamax Cannon", () => {
game.move.select(dynamaxCannon.id);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(dynamaxCannon.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(100);
});
@ -59,9 +58,9 @@ describe("Moves - Dynamax Cannon", () => {
game.move.select(dynamaxCannon.id);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(dynamaxCannon.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(100);
});
@ -71,12 +70,12 @@ describe("Moves - Dynamax Cannon", () => {
game.move.select(dynamaxCannon.id);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase;
expect(phase.move.id).toBe(dynamaxCannon.id);
// Force level cap to be 100
vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(120);
});
@ -86,12 +85,12 @@ describe("Moves - Dynamax Cannon", () => {
game.move.select(dynamaxCannon.id);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase;
expect(phase.move.id).toBe(dynamaxCannon.id);
// Force level cap to be 100
vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(140);
});
@ -101,12 +100,12 @@ describe("Moves - Dynamax Cannon", () => {
game.move.select(dynamaxCannon.id);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase;
expect(phase.move.id).toBe(dynamaxCannon.id);
// Force level cap to be 100
vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(160);
});
@ -116,12 +115,12 @@ describe("Moves - Dynamax Cannon", () => {
game.move.select(dynamaxCannon.id);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase;
expect(phase.move.id).toBe(dynamaxCannon.id);
// Force level cap to be 100
vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(180);
});
@ -131,12 +130,12 @@ describe("Moves - Dynamax Cannon", () => {
game.move.select(dynamaxCannon.id);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
const phase = game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase;
expect(phase.move.id).toBe(dynamaxCannon.id);
// Force level cap to be 100
vi.spyOn(game.scene, "getMaxExpLevel").mockReturnValue(100);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(200);
});
@ -147,9 +146,9 @@ describe("Moves - Dynamax Cannon", () => {
game.move.select(dynamaxCannon.id);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(dynamaxCannon.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(dynamaxCannon.calculateBattlePower).toHaveLastReturnedWith(200);
});
});

View File

@ -1,4 +1,3 @@
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { toDmgValue } from "#app/utils/common";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -46,7 +45,7 @@ describe("Moves - FILLET AWAY", () => {
const hpLost = toDmgValue(leadPokemon.getMaxHp() / RATIO);
game.move.select(MoveId.FILLET_AWAY);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp() - hpLost);
expect(leadPokemon.getStatStage(Stat.ATK)).toBe(2);
@ -65,7 +64,7 @@ describe("Moves - FILLET AWAY", () => {
leadPokemon.setStatStage(Stat.SPATK, 3);
game.move.select(MoveId.FILLET_AWAY);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp() - hpLost);
expect(leadPokemon.getStatStage(Stat.ATK)).toBe(6);
@ -83,7 +82,7 @@ describe("Moves - FILLET AWAY", () => {
leadPokemon.setStatStage(Stat.SPD, 6);
game.move.select(MoveId.FILLET_AWAY);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.hp).toBe(leadPokemon.getMaxHp());
expect(leadPokemon.getStatStage(Stat.ATK)).toBe(6);
@ -99,7 +98,7 @@ describe("Moves - FILLET AWAY", () => {
leadPokemon.hp = hpLost - PREDAMAGE;
game.move.select(MoveId.FILLET_AWAY);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.hp).toBe(hpLost - PREDAMAGE);
expect(leadPokemon.getStatStage(Stat.ATK)).toBe(0);

View File

@ -1,7 +1,5 @@
import { Stat } from "#enums/stat";
import type { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
import { DamageAnimPhase } from "#app/phases/damage-anim-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import GameManager from "#test/testUtils/gameManager";
@ -50,7 +48,7 @@ describe("Moves - Fissure", () => {
game.override.ability(AbilityId.NO_GUARD).enemyAbility(AbilityId.FUR_COAT);
game.move.select(MoveId.FISSURE);
await game.phaseInterceptor.to(DamageAnimPhase, true);
await game.phaseInterceptor.to("DamageAnimPhase", true);
expect(enemyPokemon.isFainted()).toBe(true);
});
@ -63,7 +61,7 @@ describe("Moves - Fissure", () => {
game.move.select(MoveId.FISSURE);
// wait for TurnEndPhase instead of DamagePhase as fissure might not actually inflict damage
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(partyPokemon.getAccuracyMultiplier).toHaveReturnedWith(1);
});
@ -76,7 +74,7 @@ describe("Moves - Fissure", () => {
game.move.select(MoveId.FISSURE);
// wait for TurnEndPhase instead of DamagePhase as fissure might not actually inflict damage
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(partyPokemon.getAccuracyMultiplier).toHaveReturnedWith(1);
});

View File

@ -1,7 +1,6 @@
import { allAbilities } from "#app/data/data-lists";
import { AbilityId } from "#enums/ability-id";
import type Pokemon from "#app/field/pokemon";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
@ -52,7 +51,7 @@ describe("Moves - Flame Burst", () => {
game.move.select(MoveId.FLAME_BURST, 0, leftEnemy.getBattlerIndex());
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leftEnemy.hp).toBeLessThan(leftEnemy.getMaxHp());
expect(rightEnemy.hp).toBe(rightEnemy.getMaxHp() - getEffectDamage(rightEnemy));
@ -66,7 +65,7 @@ describe("Moves - Flame Burst", () => {
game.move.select(MoveId.FLAME_BURST, 0, leftEnemy.getBattlerIndex());
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leftEnemy.hp).toBe(leftEnemy.getMaxHp());
expect(rightEnemy.hp).toBe(rightEnemy.getMaxHp());
@ -80,7 +79,7 @@ describe("Moves - Flame Burst", () => {
game.move.select(MoveId.FLAME_BURST, 0, leftEnemy.getBattlerIndex());
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leftEnemy.hp).toBeLessThan(leftEnemy.getMaxHp());
expect(rightEnemy.hp).toBe(rightEnemy.getMaxHp() - getEffectDamage(rightEnemy));
@ -94,7 +93,7 @@ describe("Moves - Flame Burst", () => {
game.move.select(MoveId.FLAME_BURST, 0, leftEnemy.getBattlerIndex());
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leftEnemy.hp).toBeLessThan(leftEnemy.getMaxHp());
expect(rightEnemy.hp).toBe(rightEnemy.getMaxHp());

View File

@ -2,7 +2,6 @@ import { Stat } from "#enums/stat";
import { SemiInvulnerableTag } from "#app/data/battler-tags";
import { PokemonType } from "#enums/pokemon-type";
import { BiomeId } from "#enums/biome-id";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -45,7 +44,7 @@ describe("Moves - Flower Shield", () => {
expect(cherrim.getStatStage(Stat.DEF)).toBe(0);
game.move.select(MoveId.FLOWER_SHIELD);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(magikarp.getStatStage(Stat.DEF)).toBe(0);
expect(cherrim.getStatStage(Stat.DEF)).toBe(1);
@ -65,7 +64,7 @@ describe("Moves - Flower Shield", () => {
game.move.select(MoveId.FLOWER_SHIELD);
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
grassPokemons.forEach(p => expect(p.getStatStage(Stat.DEF)).toBe(1));
nonGrassPokemons.forEach(p => expect(p.getStatStage(Stat.DEF)).toBe(0));
@ -86,7 +85,7 @@ describe("Moves - Flower Shield", () => {
expect(paras.getTag(SemiInvulnerableTag)).toBeUndefined;
game.move.select(MoveId.FLOWER_SHIELD);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(paras.getTag(SemiInvulnerableTag)).toBeDefined();
expect(paras.getStatStage(Stat.DEF)).toBe(0);
@ -104,7 +103,7 @@ describe("Moves - Flower Shield", () => {
expect(ally.getStatStage(Stat.DEF)).toBe(0);
game.move.select(MoveId.FLOWER_SHIELD);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemy.getStatStage(Stat.DEF)).toBe(0);
expect(ally.getStatStage(Stat.DEF)).toBe(0);

View File

@ -1,8 +1,5 @@
import { BerryPhase } from "#app/phases/berry-phase";
import { MessagePhase } from "#app/phases/message-phase";
import { MoveHeaderPhase } from "#app/phases/move-header-phase";
import { SwitchSummonPhase } from "#app/phases/switch-summon-phase";
import { TurnStartPhase } from "#app/phases/turn-start-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -48,12 +45,12 @@ describe("Moves - Focus Punch", () => {
game.move.select(MoveId.FOCUS_PUNCH);
await game.phaseInterceptor.to(MessagePhase);
await game.phaseInterceptor.to("MessagePhase");
expect(enemyPokemon.hp).toBe(enemyStartingHp);
expect(leadPokemon.getMoveHistory().length).toBe(0);
await game.phaseInterceptor.to(BerryPhase, false);
await game.phaseInterceptor.to("BerryPhase", false);
expect(enemyPokemon.hp).toBeLessThan(enemyStartingHp);
expect(leadPokemon.getMoveHistory().length).toBe(1);
@ -72,12 +69,12 @@ describe("Moves - Focus Punch", () => {
game.move.select(MoveId.FOCUS_PUNCH);
await game.phaseInterceptor.to(MessagePhase);
await game.phaseInterceptor.to("MessagePhase");
expect(enemyPokemon.hp).toBe(enemyStartingHp);
expect(leadPokemon.getMoveHistory().length).toBe(0);
await game.phaseInterceptor.to(BerryPhase, false);
await game.phaseInterceptor.to("BerryPhase", false);
expect(enemyPokemon.hp).toBe(enemyStartingHp);
expect(leadPokemon.getMoveHistory().length).toBe(1);
@ -94,11 +91,11 @@ describe("Moves - Focus Punch", () => {
game.move.select(MoveId.FOCUS_PUNCH);
await game.phaseInterceptor.to(MessagePhase); // Header message
await game.phaseInterceptor.to("MessagePhase"); // Header message
expect(leadPokemon.getMoveHistory().length).toBe(0);
await game.phaseInterceptor.to(BerryPhase, false);
await game.phaseInterceptor.to("BerryPhase", false);
expect(leadPokemon.getMoveHistory().length).toBe(1);
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp());
@ -113,7 +110,7 @@ describe("Moves - Focus Punch", () => {
game.forceEnemyToSwitch();
game.move.select(MoveId.FOCUS_PUNCH);
await game.phaseInterceptor.to(TurnStartPhase);
await game.phaseInterceptor.to("TurnStartPhase");
expect(game.scene.phaseManager.getCurrentPhase() instanceof SwitchSummonPhase).toBeTruthy();
expect(game.scene.phaseManager.phaseQueue.find(phase => phase instanceof MoveHeaderPhase)).toBeDefined();

View File

@ -1,7 +1,6 @@
import { Stat } from "#enums/stat";
import { BattlerIndex } from "#enums/battler-index";
import { AbilityId } from "#enums/ability-id";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
@ -47,7 +46,7 @@ describe("Moves - Follow Me", () => {
await game.move.selectEnemyMove(MoveId.TACKLE, BattlerIndex.PLAYER_2);
await game.move.selectEnemyMove(MoveId.TACKLE, BattlerIndex.PLAYER_2);
await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to("TurnEndPhase", false);
expect(playerPokemon[0].hp).toBeLessThan(playerPokemon[0].getMaxHp());
expect(playerPokemon[1].hp).toBe(playerPokemon[1].getMaxHp());
@ -65,7 +64,7 @@ describe("Moves - Follow Me", () => {
await game.move.selectEnemyMove(MoveId.TACKLE, BattlerIndex.PLAYER);
await game.move.selectEnemyMove(MoveId.TACKLE, BattlerIndex.PLAYER_2);
await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to("TurnEndPhase", false);
playerPokemon.sort((a, b) => a.getEffectiveStat(Stat.SPD) - b.getEffectiveStat(Stat.SPD));
@ -87,7 +86,7 @@ describe("Moves - Follow Me", () => {
await game.move.selectEnemyMove(MoveId.FOLLOW_ME);
await game.move.selectEnemyMove(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to("TurnEndPhase", false);
// If redirection was bypassed, both enemies should be damaged
expect(enemyPokemon[0].hp).toBeLessThan(enemyPokemon[0].getMaxHp());
@ -107,7 +106,7 @@ describe("Moves - Follow Me", () => {
await game.move.selectEnemyMove(MoveId.FOLLOW_ME);
await game.move.selectEnemyMove(MoveId.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase, false);
await game.phaseInterceptor.to("TurnEndPhase", false);
// If redirection was bypassed, both enemies should be damaged
expect(enemyPokemon[0].hp).toBeLessThan(enemyPokemon[0].getMaxHp());

View File

@ -1,6 +1,5 @@
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
@ -48,7 +47,7 @@ describe("Moves - Foresight", () => {
enemy.hp = enemy.getMaxHp();
game.move.select(MoveId.MACH_PUNCH);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
});
@ -63,7 +62,7 @@ describe("Moves - Foresight", () => {
game.move.select(MoveId.FORESIGHT);
await game.toNextTurn();
game.move.select(MoveId.QUICK_ATTACK);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(pokemon.getAccuracyMultiplier).toHaveReturnedWith(1);
});

View File

@ -6,7 +6,6 @@ import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { allMoves } from "#app/data/data-lists";
import { CommandPhase } from "#app/phases/command-phase";
describe("Moves - Freezy Frost", () => {
let phaserGame: Phaser.Game;
@ -77,7 +76,7 @@ describe("Moves - Freezy Frost", () => {
const [leftOpp, rightOpp] = game.scene.getEnemyField();
game.move.select(MoveId.HOWL, 0);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SPLASH, 1);
await game.toNextTurn();
@ -87,7 +86,7 @@ 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);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SPLASH, 1);
await game.toNextTurn();

View File

@ -1,4 +1,3 @@
import { TurnStartPhase } from "#app/phases/turn-start-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import { StatusEffect } from "#enums/status-effect";
@ -41,7 +40,7 @@ describe("Moves - Fusion Flare", () => {
game.move.select(fusionFlare);
await game.phaseInterceptor.to(TurnStartPhase, false);
await game.phaseInterceptor.to("TurnStartPhase", false);
// Inflict freeze quietly and check if it was properly inflicted
partyMember.trySetStatus(StatusEffect.FREEZE, false);

View File

@ -2,10 +2,7 @@ import { Stat } from "#enums/stat";
import { BattlerIndex } from "#enums/battler-index";
import { allMoves } from "#app/data/data-lists";
import type Move from "#app/data/moves/move";
import { DamageAnimPhase } from "#app/phases/damage-anim-phase";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { MoveEndPhase } from "#app/phases/move-end-phase";
import { MovePhase } from "#app/phases/move-phase";
import type { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
@ -55,14 +52,14 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
// Force user party to act before enemy party
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(100);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionBolt.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(200);
});
@ -75,14 +72,14 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
// Force user party to act before enemy party
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionBolt.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(100);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
});
@ -95,19 +92,19 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
// Force first enemy to act (and fail) in between party
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(100);
await game.phaseInterceptor.to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
// Skip enemy move; because the enemy is at full HP, Rest should fail
await game.phaseInterceptor.runFrom(MovePhase).to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionBolt.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(200);
});
@ -121,18 +118,18 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
// Force first enemy to act in between party
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(100);
await game.phaseInterceptor.to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
// Skip enemy move
await game.phaseInterceptor.runFrom(MovePhase).to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionBolt.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(100);
});
@ -145,14 +142,14 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
// Force user party to act before enemy party
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionBolt.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(100);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
});
@ -189,24 +186,24 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
// Force first enemy to act in between party
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionBolt.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(100);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionBolt.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(200);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
});
@ -243,24 +240,24 @@ describe("Moves - Fusion Flare and Fusion Bolt", () => {
// Force first enemy to act in between party
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionBolt.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(100);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionBolt.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(200);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect((game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase).move.id).toBe(fusionFlare.id);
await game.phaseInterceptor.to(DamageAnimPhase, false);
await game.phaseInterceptor.to("DamageAnimPhase", false);
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
});
});

View File

@ -5,8 +5,6 @@ import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { EnemyCommandPhase } from "#app/phases/enemy-command-phase";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
describe("Moves - Growth", () => {
let phaserGame: Phaser.Game;
@ -40,7 +38,7 @@ describe("Moves - Growth", () => {
expect(playerPokemon.getStatStage(Stat.SPATK)).toBe(0);
game.move.select(MoveId.GROWTH);
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnInitPhase);
await game.toEndOfTurn();
expect(playerPokemon.getStatStage(Stat.SPATK)).toBe(1);
});

View File

@ -2,7 +2,6 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import Phaser from "phaser";
import GameManager from "#test/testUtils/gameManager";
import { SpeciesId } from "#enums/species-id";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { Stat } from "#enums/stat";
import { AbilityId } from "#enums/ability-id";
@ -43,7 +42,7 @@ describe("Moves - Guard Split", () => {
const avgSpDef = Math.floor((player.getStat(Stat.SPDEF, false) + enemy.getStat(Stat.SPDEF, false)) / 2);
game.move.select(MoveId.GUARD_SPLIT);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(player.getStat(Stat.DEF, false)).toBe(avgDef);
expect(enemy.getStat(Stat.DEF, false)).toBe(avgDef);
@ -63,10 +62,10 @@ describe("Moves - Guard Split", () => {
const avgSpDef = Math.floor((player.getStat(Stat.SPDEF, false) + enemy.getStat(Stat.SPDEF, false)) / 2);
game.move.select(MoveId.GUARD_SPLIT);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
game.move.select(MoveId.GUARD_SPLIT);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(player.getStat(Stat.DEF, false)).toBe(avgDef);
expect(enemy.getStat(Stat.DEF, false)).toBe(avgDef);

View File

@ -2,11 +2,9 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite
import Phaser from "phaser";
import GameManager from "#test/testUtils/gameManager";
import { SpeciesId } from "#enums/species-id";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { Stat, BATTLE_STATS } from "#enums/stat";
import { AbilityId } from "#enums/ability-id";
import { MoveEndPhase } from "#app/phases/move-end-phase";
describe("Moves - Guard Swap", () => {
let phaserGame: Phaser.Game;
@ -43,14 +41,14 @@ describe("Moves - Guard Swap", () => {
game.move.select(MoveId.GUARD_SWAP);
await game.phaseInterceptor.to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
for (const s of BATTLE_STATS) {
expect(player.getStatStage(s)).toBe(0);
expect(enemy.getStatStage(s)).toBe(1);
}
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
for (const s of BATTLE_STATS) {
if (s === Stat.DEF || s === Stat.SPDEF) {

View File

@ -1,5 +1,4 @@
import { allMoves } from "#app/data/data-lists";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -41,7 +40,7 @@ describe("Moves - Hard Press", () => {
await game.classicMode.startBattle([SpeciesId.PIKACHU]);
game.move.select(MoveId.HARD_PRESS);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(100);
});
@ -54,7 +53,7 @@ describe("Moves - Hard Press", () => {
vi.spyOn(enemy, "getHpRatio").mockReturnValue(targetHpRatio);
game.move.select(MoveId.HARD_PRESS);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(50);
});
@ -67,7 +66,7 @@ describe("Moves - Hard Press", () => {
vi.spyOn(enemy, "getHpRatio").mockReturnValue(targetHpRatio);
game.move.select(MoveId.HARD_PRESS);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(1);
});
@ -80,7 +79,7 @@ describe("Moves - Hard Press", () => {
vi.spyOn(enemy, "getHpRatio").mockReturnValue(targetHpRatio);
game.move.select(MoveId.HARD_PRESS);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(1);
});

View File

@ -5,7 +5,6 @@ import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
describe("Moves - Haze", () => {
describe("integration tests", () => {
@ -43,16 +42,16 @@ describe("Moves - Haze", () => {
expect(enemy.getStatStage(Stat.ATK)).toBe(0);
game.move.select(MoveId.SWORDS_DANCE);
await game.phaseInterceptor.to(TurnInitPhase);
await game.phaseInterceptor.to("TurnInitPhase");
game.move.select(MoveId.CHARM);
await game.phaseInterceptor.to(TurnInitPhase);
await game.phaseInterceptor.to("TurnInitPhase");
expect(user.getStatStage(Stat.ATK)).toBe(2);
expect(enemy.getStatStage(Stat.ATK)).toBe(-2);
game.move.select(MoveId.HAZE);
await game.phaseInterceptor.to(TurnInitPhase);
await game.phaseInterceptor.to("TurnInitPhase");
expect(user.getStatStage(Stat.ATK)).toBe(0);
expect(enemy.getStatStage(Stat.ATK)).toBe(0);

View File

@ -1,5 +1,4 @@
import { StatusEffect } from "#app/enums/status-effect";
import { CommandPhase } from "#app/phases/command-phase";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -40,7 +39,7 @@ describe("Moves - Heal Bell", () => {
vi.spyOn(partyPokemon, "resetStatus");
game.move.select(MoveId.HEAL_BELL, 0);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SPLASH, 1);
await game.toNextTurn();
@ -62,7 +61,7 @@ describe("Moves - Heal Bell", () => {
vi.spyOn(rightOpp, "resetStatus");
game.move.select(MoveId.HEAL_BELL, 0);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SPLASH, 1);
await game.toNextTurn();
@ -86,7 +85,7 @@ describe("Moves - Heal Bell", () => {
vi.spyOn(partyPokemon, "resetStatus");
game.move.select(MoveId.HEAL_BELL, 0);
await game.phaseInterceptor.to(CommandPhase);
await game.phaseInterceptor.to("CommandPhase");
game.move.select(MoveId.SPLASH, 1);
await game.toNextTurn();

View File

@ -2,11 +2,9 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite
import Phaser from "phaser";
import GameManager from "#test/testUtils/gameManager";
import { SpeciesId } from "#enums/species-id";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { MoveId } from "#enums/move-id";
import { BATTLE_STATS } from "#enums/stat";
import { AbilityId } from "#enums/ability-id";
import { MoveEndPhase } from "#app/phases/move-end-phase";
describe("Moves - Heart Swap", () => {
let phaserGame: Phaser.Game;
@ -43,14 +41,14 @@ describe("Moves - Heart Swap", () => {
game.move.select(MoveId.HEART_SWAP);
await game.phaseInterceptor.to(MoveEndPhase);
await game.phaseInterceptor.to("MoveEndPhase");
for (const s of BATTLE_STATS) {
expect(player.getStatStage(s)).toBe(0);
expect(enemy.getStatStage(s)).toBe(1);
}
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
for (const s of BATTLE_STATS) {
expect(enemy.getStatStage(s)).toBe(0);

View File

@ -3,8 +3,6 @@ import { AbilityId } from "#enums/ability-id";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import { BerryPhase } from "#app/phases/berry-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
@ -45,7 +43,7 @@ describe("Moves - Hyper Beam", () => {
game.move.select(MoveId.HYPER_BEAM);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon.hp).toBeLessThan(enemyPokemon.getMaxHp());
expect(leadPokemon.getTag(BattlerTagType.RECHARGING)).toBeDefined();
@ -53,14 +51,14 @@ describe("Moves - Hyper Beam", () => {
const enemyPostAttackHp = enemyPokemon.hp;
/** Game should progress without a new command from the player */
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon.hp).toBe(enemyPostAttackHp);
expect(leadPokemon.getTag(BattlerTagType.RECHARGING)).toBeUndefined();
game.move.select(MoveId.TACKLE);
await game.phaseInterceptor.to(BerryPhase, false);
await game.phaseInterceptor.to("BerryPhase", false);
expect(enemyPokemon.hp).toBeLessThan(enemyPostAttackHp);
});

View File

@ -1,10 +1,6 @@
import { BattlerIndex } from "#enums/battler-index";
import { AbilityId } from "#enums/ability-id";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { BerryPhase } from "#app/phases/berry-phase";
import { FaintPhase } from "#app/phases/faint-phase";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import GameManager from "#test/testUtils/gameManager";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -48,12 +44,12 @@ describe("Moves - Jaw Lock", () => {
game.move.select(MoveId.JAW_LOCK);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect(leadPokemon.getTag(BattlerTagType.TRAPPED)).toBeUndefined();
expect(enemyPokemon.getTag(BattlerTagType.TRAPPED)).toBeUndefined();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(leadPokemon.getTag(BattlerTagType.TRAPPED)).toBeDefined();
expect(enemyPokemon.getTag(BattlerTagType.TRAPPED)).toBeDefined();
@ -69,17 +65,17 @@ describe("Moves - Jaw Lock", () => {
game.move.select(MoveId.JAW_LOCK);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
await game.phaseInterceptor.to("MoveEffectPhase", false);
expect(leadPokemon.getTag(BattlerTagType.TRAPPED)).toBeUndefined();
expect(enemyPokemon.getTag(BattlerTagType.TRAPPED)).toBeUndefined();
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(leadPokemon.getTag(BattlerTagType.TRAPPED)).toBeUndefined();
expect(enemyPokemon.getTag(BattlerTagType.TRAPPED)).toBeUndefined();
await game.phaseInterceptor.to(FaintPhase);
await game.phaseInterceptor.to("FaintPhase");
expect(leadPokemon.getTag(BattlerTagType.TRAPPED)).toBeUndefined();
expect(enemyPokemon.getTag(BattlerTagType.TRAPPED)).toBeUndefined();
@ -94,12 +90,12 @@ describe("Moves - Jaw Lock", () => {
game.move.select(MoveId.JAW_LOCK);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(leadPokemon.getTag(BattlerTagType.TRAPPED)).toBeDefined();
expect(enemyPokemon.getTag(BattlerTagType.TRAPPED)).toBeDefined();
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
await game.doKillOpponents();
@ -118,7 +114,7 @@ describe("Moves - Jaw Lock", () => {
game.move.select(MoveId.SPLASH, 1);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2]);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(playerPokemon[0].getTag(BattlerTagType.TRAPPED)).toBeDefined();
expect(enemyPokemon[0].getTag(BattlerTagType.TRAPPED)).toBeDefined();
@ -128,7 +124,7 @@ describe("Moves - Jaw Lock", () => {
game.move.select(MoveId.JAW_LOCK, 0, BattlerIndex.ENEMY_2);
game.move.select(MoveId.SPLASH, 1);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(enemyPokemon[1].getTag(BattlerTagType.TRAPPED)).toBeUndefined();
expect(playerPokemon[0].getTag(BattlerTagType.TRAPPED)).toBeDefined();
@ -145,7 +141,7 @@ describe("Moves - Jaw Lock", () => {
game.move.select(MoveId.JAW_LOCK);
await game.phaseInterceptor.to(BerryPhase, false);
await game.phaseInterceptor.to("BerryPhase", false);
expect(playerPokemon.getTag(BattlerTagType.TRAPPED)).toBeUndefined();
expect(enemyPokemon.getTag(BattlerTagType.TRAPPED)).toBeUndefined();

View File

@ -5,7 +5,6 @@ import { AbilityId } from "#enums/ability-id";
import GameManager from "#test/testUtils/gameManager";
import { allMoves } from "#app/data/data-lists";
import type Move from "#app/data/moves/move";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
@ -65,7 +64,7 @@ describe("Moves - Last Respects", () => {
game.move.select(MoveId.LAST_RESPECTS);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(move.calculateBattlePower).toHaveReturnedWith(basePower + 2 * 50);
});
@ -100,7 +99,7 @@ describe("Moves - Last Respects", () => {
game.move.select(MoveId.LAST_RESPECTS);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase);
await game.phaseInterceptor.to("MoveEffectPhase");
expect(move.calculateBattlePower).toHaveReturnedWith(basePower + 3 * 50);
});

View File

@ -5,7 +5,6 @@ import { allMoves } from "#app/data/data-lists";
import { AbilityId } from "#enums/ability-id";
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 { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
@ -50,7 +49,7 @@ describe("Moves - Light Screen", () => {
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const mockedDmg = getMockedMoveDamage(
game.scene.getEnemyPokemon()!,
@ -70,7 +69,7 @@ describe("Moves - Light Screen", () => {
game.move.select(moveToUse);
game.move.select(moveToUse, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const mockedDmg = getMockedMoveDamage(
game.scene.getEnemyPokemon()!,
game.scene.getPlayerPokemon()!,
@ -86,7 +85,7 @@ describe("Moves - Light Screen", () => {
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const mockedDmg = getMockedMoveDamage(
game.scene.getEnemyPokemon()!,
game.scene.getPlayerPokemon()!,
@ -103,7 +102,7 @@ describe("Moves - Light Screen", () => {
await game.classicMode.startBattle([SpeciesId.SHUCKLE]);
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
const mockedDmg = getMockedMoveDamage(
game.scene.getEnemyPokemon()!,

Some files were not shown because too many files have changed in this diff Show More