pokerogue/test/phases/form-change-phase.test.ts
Bertie690 ccceaac877
[Test] Reworked crit override to allow for forced crits (#5738)
* Crit override stuff

* Update ability.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Update pokemon.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Update game-mode.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-06-16 05:36:09 -07:00

61 lines
2.1 KiB
TypeScript

import { AbilityId } from "#enums/ability-id";
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 { PokemonType } from "#enums/pokemon-type";
import { generateModifierType } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
import { modifierTypes } from "#app/data/data-lists";
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([MoveId.SPLASH])
.ability(AbilityId.BALL_FETCH)
.battleStyle("single")
.criticalHits(false)
.enemySpecies(SpeciesId.MAGIKARP)
.enemyAbility(AbilityId.BALL_FETCH)
.enemyMoveset(MoveId.SPLASH);
});
it("Zacian should successfully change into Crowned form", async () => {
await game.classicMode.startBattle([SpeciesId.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([PokemonType.FAIRY]);
expect(zacian.calculateBaseStats()).toStrictEqual([92, 120, 115, 80, 115, 138]);
// Give Zacian a Rusted Sword
const rustedSwordType = generateModifierType(modifierTypes.RARE_FORM_CHANGE_ITEM)!;
const rustedSword = rustedSwordType.newModifier(zacian);
await game.scene.addModifier(rustedSword);
game.move.select(MoveId.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([PokemonType.FAIRY, PokemonType.STEEL]);
expect(zacian.calculateBaseStats()).toStrictEqual([92, 150, 115, 80, 115, 148]);
});
});