2024-11-05 09:19:20 -05:00
|
|
|
import { Abilities } from "#enums/abilities";
|
|
|
|
import { Moves } from "#enums/moves";
|
|
|
|
import { Species } from "#enums/species";
|
2025-02-22 22:52:07 -06:00
|
|
|
import GameManager from "#test/testUtils/gameManager";
|
2024-11-05 09:19:20 -05:00
|
|
|
import Phaser from "phaser";
|
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
2024-11-08 14:44:34 -08:00
|
|
|
import { Type } from "#enums/type";
|
2024-11-05 09:19:20 -05:00
|
|
|
import { generateModifierType } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
|
|
|
import { modifierTypes } from "#app/modifier/modifier-type";
|
|
|
|
|
|
|
|
describe("Form Change Phase", () => {
|
|
|
|
let phaserGame: Phaser.Game;
|
|
|
|
let game: GameManager;
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
phaserGame = new Phaser.Game({
|
|
|
|
type: Phaser.HEADLESS,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
game.phaseInterceptor.restoreOg();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
game = new GameManager(phaserGame);
|
|
|
|
game.override
|
|
|
|
.moveset([ Moves.SPLASH ])
|
|
|
|
.ability(Abilities.BALL_FETCH)
|
|
|
|
.battleType("single")
|
|
|
|
.disableCrits()
|
|
|
|
.enemySpecies(Species.MAGIKARP)
|
|
|
|
.enemyAbility(Abilities.BALL_FETCH)
|
|
|
|
.enemyMoveset(Moves.SPLASH);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Zacian should successfully change into Crowned form", async () => {
|
|
|
|
await game.classicMode.startBattle([ Species.ZACIAN ]);
|
|
|
|
|
|
|
|
// Before the form change: Should be Hero form
|
|
|
|
const zacian = game.scene.getPlayerParty()[0];
|
|
|
|
expect(zacian.getFormKey()).toBe("hero-of-many-battles");
|
|
|
|
expect(zacian.getTypes()).toStrictEqual([ Type.FAIRY ]);
|
|
|
|
expect(zacian.calculateBaseStats()).toStrictEqual([ 92, 120, 115, 80, 115, 138 ]);
|
|
|
|
|
|
|
|
// Give Zacian a Rusted Sword
|
2025-01-12 15:33:05 -08:00
|
|
|
const rustedSwordType = generateModifierType( modifierTypes.RARE_FORM_CHANGE_ITEM)!;
|
2024-11-05 09:19:20 -05:00
|
|
|
const rustedSword = rustedSwordType.newModifier(zacian);
|
|
|
|
await game.scene.addModifier(rustedSword);
|
|
|
|
|
|
|
|
game.move.select(Moves.SPLASH);
|
|
|
|
await game.toNextTurn();
|
|
|
|
|
|
|
|
// After the form change: Should be Crowned form
|
|
|
|
expect(game.phaseInterceptor.log.includes("FormChangePhase")).toBe(true);
|
|
|
|
expect(zacian.getFormKey()).toBe("crowned");
|
|
|
|
expect(zacian.getTypes()).toStrictEqual([ Type.FAIRY, Type.STEEL ]);
|
|
|
|
expect(zacian.calculateBaseStats()).toStrictEqual([ 92, 150, 115, 80, 115, 148 ]);
|
|
|
|
});
|
|
|
|
});
|