mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-20 06:19:29 +02:00
Apply suggested changes to added test
This commit is contained in:
parent
717c0a5a36
commit
8d5ae50375
@ -1,18 +1,14 @@
|
||||
import { FormChangeItem } from "#app/data/pokemon-forms";
|
||||
import { GameModes, getGameMode } from "#app/game-mode";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
import GameManager from "#test/utils/gameManager";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import { generateStarter } from "#test/utils/gameManagerUtils";
|
||||
import { SelectStarterPhase } from "#app/phases/select-starter-phase";
|
||||
import { EncounterPhase } from "#app/phases/encounter-phase";
|
||||
import { Type } from "#app/data/type";
|
||||
import { generateModifierType } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { modifierTypes } from "#app/modifier/modifier-type";
|
||||
|
||||
describe("Form Change", () => {
|
||||
describe("Form Change Phase", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
@ -38,30 +34,25 @@ describe("Form Change", () => {
|
||||
.enemyMoveset(Moves.SPLASH);
|
||||
});
|
||||
|
||||
it("should not crash", async () => {
|
||||
// Test will use Zacian -> Zacian Crowned form change
|
||||
game.override.startingHeldItems([{ name: "FORM_CHANGE_ITEM", type: FormChangeItem.RUSTED_SWORD }]);
|
||||
|
||||
await game.runToTitle();
|
||||
|
||||
// Copied from code for `runToSummon()`
|
||||
if (game.override.disableShinies) {
|
||||
game.override.shiny(false).enemyShiny(false);
|
||||
}
|
||||
|
||||
game.onNextPrompt("TitlePhase", Mode.TITLE, () => {
|
||||
game.scene.gameMode = getGameMode(GameModes.CLASSIC);
|
||||
const starters = generateStarter(game.scene, [ Species.ZACIAN ]);
|
||||
const selectStarterPhase = new SelectStarterPhase(game.scene);
|
||||
game.scene.pushPhase(new EncounterPhase(game.scene, false));
|
||||
selectStarterPhase.initBattle(starters);
|
||||
});
|
||||
|
||||
await game.phaseInterceptor.run("FormChangePhase");
|
||||
|
||||
expect(game.phaseInterceptor.log.includes("FormChangePhase")).toBe(true);
|
||||
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
|
||||
const rustedSwordType = generateModifierType(game.scene, modifierTypes.RARE_FORM_CHANGE_ITEM)!;
|
||||
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 ]);
|
@ -35,7 +35,7 @@ export class ClassicModeHelper extends GameManagerHelper {
|
||||
selectStarterPhase.initBattle(starters);
|
||||
});
|
||||
|
||||
await this.game.phaseInterceptor.run(EncounterPhase);
|
||||
await this.game.phaseInterceptor.to(EncounterPhase);
|
||||
if (overrides.OPP_HELD_ITEMS_OVERRIDE.length === 0 && this.game.override.removeEnemyStartingItems) {
|
||||
this.game.removeEnemyHeldItems();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user