mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-19 08:08:08 +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>
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
import Phaser from "phaser";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
import { Species } from "#enums/species";
|
|
import { Moves } from "#enums/moves";
|
|
import { allMoves } from "#app/data/moves/move";
|
|
import type Move from "#app/data/moves/move";
|
|
|
|
describe("Moves - Retaliate", () => {
|
|
let phaserGame: Phaser.Game;
|
|
let game: GameManager;
|
|
|
|
let retaliate: Move;
|
|
|
|
beforeAll(() => {
|
|
phaserGame = new Phaser.Game({
|
|
type: Phaser.HEADLESS,
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
retaliate = allMoves[Moves.RETALIATE];
|
|
game = new GameManager(phaserGame);
|
|
game.override
|
|
.battleStyle("single")
|
|
.enemySpecies(Species.SNORLAX)
|
|
.enemyMoveset([Moves.RETALIATE, Moves.RETALIATE, Moves.RETALIATE, Moves.RETALIATE])
|
|
.enemyLevel(100)
|
|
.moveset([Moves.RETALIATE, Moves.SPLASH])
|
|
.startingLevel(80)
|
|
.disableCrits();
|
|
});
|
|
|
|
it("increases power if ally died previous turn", async () => {
|
|
vi.spyOn(retaliate, "calculateBattlePower");
|
|
await game.startBattle([Species.ABRA, Species.COBALION]);
|
|
game.move.select(Moves.RETALIATE);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
expect(retaliate.calculateBattlePower).toHaveLastReturnedWith(70);
|
|
game.doSelectPartyPokemon(1);
|
|
|
|
await game.toNextTurn();
|
|
game.move.select(Moves.RETALIATE);
|
|
await game.phaseInterceptor.to("MoveEffectPhase");
|
|
expect(retaliate.calculateBattlePower).toHaveReturnedWith(140);
|
|
});
|
|
});
|