pokerogue/src/test/abilities/intrepid_sword.test.ts
Greenlamp2 0faccad49e
[Bug Fix] Corrected PostSummonPhase Trigger Timing for Accurate Stat Changes (#2057)
* fix postSummonPhase when opponent does not summon and fix the statsChange from push to unshift

* added switch pokemon helper method

* added on switch tests for intimidate

* fix test by overriding passive in tests

* remove a test not needed

* cleanup imports
2024-06-11 16:12:46 +02:00

46 lines
1.5 KiB
TypeScript

import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import * as overrides from "#app/overrides";
import {Abilities} from "#app/data/enums/abilities";
import {Species} from "#app/data/enums/species";
import {
CommandPhase,
} from "#app/phases";
import {BattleStat} from "#app/data/battle-stat";
describe("Abilities - Intrepid Sword", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.ZACIAN);
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTREPID_SWORD);
vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTREPID_SWORD);
});
it("INTREPID SWORD on player", async() => {
await game.runToSummon([
Species.ZACIAN,
]);
await game.phaseInterceptor.to(CommandPhase, false);
const battleStatsPokemon = game.scene.getParty()[0].summonData.battleStats;
expect(battleStatsPokemon[BattleStat.ATK]).toBe(1);
const battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
expect(battleStatsOpponent[BattleStat.ATK]).toBe(1);
}, 20000);
});