2024-08-22 06:49:33 -07:00
|
|
|
import { Status, StatusEffect } from "#app/data/status-effect";
|
|
|
|
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
|
|
|
|
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
2024-07-25 16:03:26 -07:00
|
|
|
import { Abilities } from "#enums/abilities";
|
|
|
|
import { Moves } from "#enums/moves";
|
|
|
|
import { Species } from "#enums/species";
|
|
|
|
import GameManager from "#test/utils/gameManager";
|
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
|
2024-06-13 05:36:12 -04:00
|
|
|
|
|
|
|
const TIMEOUT = 20 * 1000;
|
|
|
|
|
|
|
|
describe("Abilities - POWER CONSTRUCT", () => {
|
|
|
|
let phaserGame: Phaser.Game;
|
|
|
|
let game: GameManager;
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
phaserGame = new Phaser.Game({
|
|
|
|
type: Phaser.HEADLESS,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
game.phaseInterceptor.restoreOg();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
game = new GameManager(phaserGame);
|
|
|
|
const moveToUse = Moves.SPLASH;
|
2024-07-25 14:48:48 -07:00
|
|
|
game.override.battleType("single");
|
2024-07-25 15:35:20 -07:00
|
|
|
game.override.ability(Abilities.POWER_CONSTRUCT);
|
2024-07-25 15:51:05 -07:00
|
|
|
game.override.moveset([moveToUse]);
|
2024-07-25 15:18:14 -07:00
|
|
|
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
|
2024-06-13 05:36:12 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
test(
|
|
|
|
"check if fainted pokemon switches to base form on arena reset",
|
|
|
|
async () => {
|
|
|
|
const baseForm = 2,
|
|
|
|
completeForm = 4;
|
2024-07-25 14:25:31 -07:00
|
|
|
game.override.startingWave(4);
|
2024-07-25 16:03:26 -07:00
|
|
|
game.override.starterForms({
|
2024-06-13 05:36:12 -04:00
|
|
|
[Species.ZYGARDE]: completeForm,
|
|
|
|
});
|
|
|
|
|
|
|
|
await game.startBattle([Species.MAGIKARP, Species.ZYGARDE]);
|
|
|
|
|
|
|
|
const zygarde = game.scene.getParty().find((p) => p.species.speciesId === Species.ZYGARDE);
|
|
|
|
expect(zygarde).not.toBe(undefined);
|
2024-08-07 09:23:12 -07:00
|
|
|
expect(zygarde!.formIndex).toBe(completeForm);
|
2024-06-13 05:36:12 -04:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
zygarde!.hp = 0;
|
|
|
|
zygarde!.status = new Status(StatusEffect.FAINT);
|
|
|
|
expect(zygarde!.isFainted()).toBe(true);
|
2024-06-13 05:36:12 -04:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.SPLASH);
|
2024-06-13 05:36:12 -04:00
|
|
|
await game.doKillOpponents();
|
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
game.doSelectModifier();
|
|
|
|
await game.phaseInterceptor.to(QuietFormChangePhase);
|
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
expect(zygarde!.formIndex).toBe(baseForm);
|
2024-06-13 05:36:12 -04:00
|
|
|
},
|
|
|
|
TIMEOUT
|
|
|
|
);
|
|
|
|
});
|