mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 00:52:47 +02:00
https://github.com/pagefaultgames/pokerogue/pull/5926 * Condensed all overrides into 1 line where possible I hope I got them all... * Fixed tests 0.5 * Cleaned up safeguard test to not use outdated code; fixed rest of errors * Fixed illusion test * Revert safeguart etst * Fixed battle tets * Fixed stuff * Fixed things2.0 * Fixed import issues * Revert changes outside of the tests directory * Revert changes outside of the tests directory --------- Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
87 lines
2.8 KiB
TypeScript
87 lines
2.8 KiB
TypeScript
import { Status } from "#app/data/status-effect";
|
|
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
|
|
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
|
import { AbilityId } from "#enums/ability-id";
|
|
import { MoveId } from "#enums/move-id";
|
|
import { SpeciesId } from "#enums/species-id";
|
|
import { StatusEffect } from "#enums/status-effect";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
|
|
|
|
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 = MoveId.SPLASH;
|
|
game.override
|
|
.battleStyle("single")
|
|
.ability(AbilityId.POWER_CONSTRUCT)
|
|
.moveset([moveToUse])
|
|
.enemyMoveset(MoveId.TACKLE);
|
|
});
|
|
|
|
test("check if fainted 50% Power Construct Pokemon switches to base form on arena reset", async () => {
|
|
const baseForm = 2,
|
|
completeForm = 4;
|
|
game.override.startingWave(4).starterForms({
|
|
[SpeciesId.ZYGARDE]: completeForm,
|
|
});
|
|
|
|
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.ZYGARDE]);
|
|
|
|
const zygarde = game.scene.getPlayerParty().find(p => p.species.speciesId === SpeciesId.ZYGARDE);
|
|
expect(zygarde).not.toBe(undefined);
|
|
expect(zygarde!.formIndex).toBe(completeForm);
|
|
|
|
zygarde!.hp = 0;
|
|
zygarde!.status = new Status(StatusEffect.FAINT);
|
|
expect(zygarde!.isFainted()).toBe(true);
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.doKillOpponents();
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
game.doSelectModifier();
|
|
await game.phaseInterceptor.to(QuietFormChangePhase);
|
|
|
|
expect(zygarde!.formIndex).toBe(baseForm);
|
|
});
|
|
|
|
test("check if fainted 10% Power Construct Pokemon switches to base form on arena reset", async () => {
|
|
const baseForm = 3,
|
|
completeForm = 5;
|
|
game.override.startingWave(4).starterForms({
|
|
[SpeciesId.ZYGARDE]: completeForm,
|
|
});
|
|
|
|
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.ZYGARDE]);
|
|
|
|
const zygarde = game.scene.getPlayerParty().find(p => p.species.speciesId === SpeciesId.ZYGARDE);
|
|
expect(zygarde).not.toBe(undefined);
|
|
expect(zygarde!.formIndex).toBe(completeForm);
|
|
|
|
zygarde!.hp = 0;
|
|
zygarde!.status = new Status(StatusEffect.FAINT);
|
|
expect(zygarde!.isFainted()).toBe(true);
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.doKillOpponents();
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
game.doSelectModifier();
|
|
await game.phaseInterceptor.to(QuietFormChangePhase);
|
|
|
|
expect(zygarde!.formIndex).toBe(baseForm);
|
|
});
|
|
});
|