fixed syntax error 2.0

This commit is contained in:
Bertie690 2025-08-01 21:33:57 -04:00
parent 0c03cf1df6
commit 3114c1743f
3 changed files with 16 additions and 13 deletions

View File

@ -1,7 +1,8 @@
import { AbilityId } from "#enums/ability-id"; import { AbilityId } from "#enums/ability-id";
import { ModifierTier } from "#enums/modifier-tier"; import { ModifierTier } from "#enums/modifier-tier";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import type { SelectModifierPhase } from "#phases/select-modifier-phase"; import { UiMode } from "#enums/ui-mode";
import { SelectModifierPhase } from "#phases/select-modifier-phase";
import { GameManager } from "#test/test-utils/game-manager"; import { GameManager } from "#test/test-utils/game-manager";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
@ -33,17 +34,20 @@ describe("Items - Lock Capsule", () => {
it("doesn't set the cost of common tier items to 0", async () => { it("doesn't set the cost of common tier items to 0", async () => {
await game.classicMode.startBattle(); await game.classicMode.startBattle();
game.scene.phaseManager.clearAllPhases(); game.scene.phaseManager.overridePhase(
game.scene.phaseManager.unshiftNew("SelectModifierPhase", 0, undefined, { new SelectModifierPhase(0, undefined, {
guaranteedModifierTiers: [ModifierTier.COMMON, ModifierTier.COMMON, ModifierTier.COMMON], guaranteedModifierTiers: [ModifierTier.COMMON, ModifierTier.COMMON, ModifierTier.COMMON],
fillRemaining: false, fillRemaining: false,
}),
);
game.onNextPrompt("SelectModifierPhase", UiMode.MODIFIER_SELECT, () => {
const selectModifierPhase = game.scene.phaseManager.getCurrentPhase() as SelectModifierPhase;
const rerollCost = selectModifierPhase.getRerollCost(true);
expect(rerollCost).toBe(150);
}); });
game.doSelectModifier(); game.doSelectModifier();
await game.phaseInterceptor.to("SelectModifierPhase", false); await game.phaseInterceptor.to("SelectModifierPhase");
const selectModifierPhase = game.scene.phaseManager.getCurrentPhase() as SelectModifierPhase;
const rerollCost = selectModifierPhase.getRerollCost(true);
expect(rerollCost).toBe(150);
}); });
}); });

View File

@ -241,7 +241,7 @@ describe("SelectModifierPhase", () => {
const selectModifierPhase = new SelectModifierPhase(0, undefined, customModifiers); const selectModifierPhase = new SelectModifierPhase(0, undefined, customModifiers);
scene.phaseManager.unshiftPhase(selectModifierPhase); scene.phaseManager.unshiftPhase(selectModifierPhase);
game.move.select(MoveId.SPLASH); game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.run(SelectModifierPhase); await game.phaseInterceptor.to("SelectModifierPhase");
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
const modifierSelectHandler = scene.ui.handlers.find( const modifierSelectHandler = scene.ui.handlers.find(
@ -265,7 +265,7 @@ describe("SelectModifierPhase", () => {
const selectModifierPhase = new SelectModifierPhase(0, undefined, customModifiers); const selectModifierPhase = new SelectModifierPhase(0, undefined, customModifiers);
scene.phaseManager.unshiftPhase(selectModifierPhase); scene.phaseManager.unshiftPhase(selectModifierPhase);
game.move.select(MoveId.SPLASH); game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.run(SelectModifierPhase); await game.phaseInterceptor.to("SelectModifierPhase");
expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT); expect(scene.ui.getMode()).to.equal(UiMode.MODIFIER_SELECT);
const modifierSelectHandler = scene.ui.handlers.find( const modifierSelectHandler = scene.ui.handlers.find(

View File

@ -61,7 +61,6 @@ export class PhaseInterceptor {
* @param runTarget - Whether or not to run the target phase before resolving; default `true` * @param runTarget - Whether or not to run the target phase before resolving; default `true`
* @returns A Promise that resolves once {@linkcode target} has been reached. * @returns A Promise that resolves once {@linkcode target} has been reached.
* @todo remove `Constructor` from type signature in favor of phase strings * @todo remove `Constructor` from type signature in favor of phase strings
* @see {@linkcode toUIMode} Method for transitioning to a specific {@linkcode UiMode}
* @remarks * @remarks
* This will not resolve for *any* reason until the target phase has been reached. * This will not resolve for *any* reason until the target phase has been reached.
* @example * @example