mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-05-11 19:04:00 +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>
65 lines
2.0 KiB
TypeScript
65 lines
2.0 KiB
TypeScript
import { allMoves, FlinchAttr, StatStageChangeAttr } from "#app/data/moves/move";
|
|
import { Abilities } from "#enums/abilities";
|
|
import { Moves } from "#enums/moves";
|
|
import type Move from "#app/data/moves/move";
|
|
import { Species } from "#enums/species";
|
|
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[Moves.TRIPLE_ARROWS];
|
|
flinchAttr = tripleArrows.getAttrs(FlinchAttr)[0];
|
|
defDropAttr = tripleArrows.getAttrs(StatStageChangeAttr)[0];
|
|
});
|
|
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
game = new GameManager(phaserGame);
|
|
game.override
|
|
.ability(Abilities.BALL_FETCH)
|
|
.moveset([Moves.TRIPLE_ARROWS])
|
|
.battleStyle("single")
|
|
.enemySpecies(Species.MAGIKARP)
|
|
.enemyAbility(Abilities.STURDY)
|
|
.enemyMoveset(Moves.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([Species.FEEBAS]);
|
|
|
|
game.move.select(Moves.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(Abilities.SERENE_GRACE);
|
|
await game.classicMode.startBattle([Species.FEEBAS]);
|
|
|
|
game.move.select(Moves.TRIPLE_ARROWS);
|
|
await game.phaseInterceptor.to("BerryPhase");
|
|
|
|
expect(flinchAttr.getMoveChance).toHaveReturnedWith(60);
|
|
expect(defDropAttr.getMoveChance).toHaveReturnedWith(100);
|
|
});
|
|
});
|