mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-05-04 07:23:57 +01:00
* Add isPartner method to trainer class * Ensure force switches cannot pull pokemon from the wrong trainer * Add override for battle type * Fixup tests and broken assumptions * Make move fail override semi-invuln check Bandaid fix because move effect phase does not allow for the move to fail if all of its conditions fail * Restore overrides * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Fix illusion test battle type invocation * Update struggle and healer tests to use battleStyle --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
63 lines
2.0 KiB
TypeScript
63 lines
2.0 KiB
TypeScript
import { Stat } from "#enums/stat";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
import { Abilities } from "#enums/abilities";
|
|
import { Moves } from "#enums/moves";
|
|
import { Species } from "#enums/species";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
import { TurnInitPhase } from "#app/phases/turn-init-phase";
|
|
|
|
describe("Moves - Haze", () => {
|
|
describe("integration tests", () => {
|
|
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.battleStyle("single");
|
|
|
|
game.override.enemySpecies(Species.RATTATA);
|
|
game.override.enemyLevel(100);
|
|
game.override.enemyMoveset(Moves.SPLASH);
|
|
game.override.enemyAbility(Abilities.NONE);
|
|
|
|
game.override.startingLevel(100);
|
|
game.override.moveset([Moves.HAZE, Moves.SWORDS_DANCE, Moves.CHARM, Moves.SPLASH]);
|
|
game.override.ability(Abilities.NONE);
|
|
});
|
|
|
|
it("should reset all stat changes of all Pokemon on field", async () => {
|
|
await game.startBattle([Species.RATTATA]);
|
|
const user = game.scene.getPlayerPokemon()!;
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
|
|
|
expect(user.getStatStage(Stat.ATK)).toBe(0);
|
|
expect(enemy.getStatStage(Stat.ATK)).toBe(0);
|
|
|
|
game.move.select(Moves.SWORDS_DANCE);
|
|
await game.phaseInterceptor.to(TurnInitPhase);
|
|
|
|
game.move.select(Moves.CHARM);
|
|
await game.phaseInterceptor.to(TurnInitPhase);
|
|
|
|
expect(user.getStatStage(Stat.ATK)).toBe(2);
|
|
expect(enemy.getStatStage(Stat.ATK)).toBe(-2);
|
|
|
|
game.move.select(Moves.HAZE);
|
|
await game.phaseInterceptor.to(TurnInitPhase);
|
|
|
|
expect(user.getStatStage(Stat.ATK)).toBe(0);
|
|
expect(enemy.getStatStage(Stat.ATK)).toBe(0);
|
|
});
|
|
});
|
|
});
|