pokerogue/test/moves/triple_arrows.test.ts
NightKev 9dcb904649
[Misc] Improve enum naming (#5933)
* Rename `Abilities` to `AbilityId`

* Rename `abilities.ts` to `ability-id.ts`

* Rename `Moves` to `MoveId`

* Rename `moves.ts` to `move-id.ts`

* Rename `Species` to `SpeciesId`

* Rename `species.ts` to `species-id.ts`

* Rename `Biome` to `BiomeId`

* Rename `biome.ts` to `biome-id.ts`

* Replace `Abilities` with `AbilityId` in comments

* Replace `Biome` with `BiomeId` in comments

* Replace `Moves` with `MoveId` in comments

* Replace `Species` with `SpeciesId` in comments
2025-06-04 14:54:27 -07:00

66 lines
2.1 KiB
TypeScript

import { FlinchAttr, StatStageChangeAttr } from "#app/data/moves/move";
import { allMoves } from "#app/data/data-lists";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import type Move from "#app/data/moves/move";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Moves - Triple Arrows", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
let tripleArrows: Move;
let flinchAttr: FlinchAttr;
let defDropAttr: StatStageChangeAttr;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
tripleArrows = allMoves[MoveId.TRIPLE_ARROWS];
flinchAttr = tripleArrows.getAttrs(FlinchAttr)[0];
defDropAttr = tripleArrows.getAttrs(StatStageChangeAttr)[0];
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.ability(AbilityId.BALL_FETCH)
.moveset([MoveId.TRIPLE_ARROWS])
.battleStyle("single")
.enemySpecies(SpeciesId.MAGIKARP)
.enemyAbility(AbilityId.STURDY)
.enemyMoveset(MoveId.SPLASH);
vi.spyOn(flinchAttr, "getMoveChance");
vi.spyOn(defDropAttr, "getMoveChance");
});
it("has a 30% flinch chance and 50% defense drop chance", async () => {
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
game.move.select(MoveId.TRIPLE_ARROWS);
await game.phaseInterceptor.to("BerryPhase");
expect(flinchAttr.getMoveChance).toHaveReturnedWith(30);
expect(defDropAttr.getMoveChance).toHaveReturnedWith(50);
});
it("is affected normally by Serene Grace", async () => {
game.override.ability(AbilityId.SERENE_GRACE);
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
game.move.select(MoveId.TRIPLE_ARROWS);
await game.phaseInterceptor.to("BerryPhase");
expect(flinchAttr.getMoveChance).toHaveReturnedWith(60);
expect(defDropAttr.getMoveChance).toHaveReturnedWith(100);
});
});