mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-23 12:38:09 +00:00
56 lines
1.9 KiB
TypeScript
56 lines
1.9 KiB
TypeScript
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
import Phaser from "phaser";
|
|
import GameManager from "#app/test/utils/gameManager";
|
|
import Overrides from "#app/overrides";
|
|
import { Species } from "#enums/species";
|
|
import {
|
|
TurnEndPhase,
|
|
} from "#app/phases";
|
|
import { Moves } from "#enums/moves";
|
|
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
|
|
import { BattleStat } from "#app/data/battle-stat.js";
|
|
import { Abilities } from "#app/enums/abilities.js";
|
|
|
|
describe("Moves - Double Team", () => {
|
|
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.battleType("single");
|
|
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DOUBLE_TEAM]);
|
|
vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true);
|
|
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH);
|
|
game.override.enemySpecies(Species.SHUCKLE);
|
|
game.override.enemyAbility(Abilities.BALL_FETCH);
|
|
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
|
|
});
|
|
|
|
it("increases the user's evasion by one stage.", async () => {
|
|
await game.startBattle([Species.MAGIKARP]);
|
|
|
|
const ally = game.scene.getPlayerPokemon();
|
|
const enemy = game.scene.getEnemyPokemon();
|
|
|
|
vi.spyOn(enemy, "getAccuracyMultiplier");
|
|
expect(ally.summonData.battleStats[BattleStat.EVA]).toBe(0);
|
|
|
|
game.doAttack(getMovePosition(game.scene, 0, Moves.DOUBLE_TEAM));
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
await game.toNextTurn();
|
|
|
|
expect(ally.summonData.battleStats[BattleStat.EVA]).toBe(1);
|
|
expect(enemy.getAccuracyMultiplier).toHaveReturnedWith(.75);
|
|
});
|
|
});
|