mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-03 06:37:12 +00:00
828897316e
* Consolidate `doSelectTarget()` into `doAttack()` * Fix ternary * Add error message to aid in debugging tests * Update docs * [Test] Change `doAttack()` to `selectMove()` * Add `select()` to `src/test/utils/helpers/moveHelper.ts` * Replace instances of `game.selectMove()` with `game.move.select()` * Fix imports * Replace `selectMove()` with `move.select()` helper Fix broken tests for Pastel Veil and Sweet Veil * Update tsdocs
90 lines
2.9 KiB
TypeScript
90 lines
2.9 KiB
TypeScript
import { BattleStat } from "#app/data/battle-stat";
|
|
import { Abilities } from "#app/enums/abilities";
|
|
import { Moves } from "#app/enums/moves";
|
|
import { Species } from "#app/enums/species";
|
|
import { CommandPhase } from "#app/phases/command-phase";
|
|
import { MessagePhase } from "#app/phases/message-phase";
|
|
import GameManager from "#test/utils/gameManager";
|
|
import { SPLASH_ONLY } from "#test/utils/testUtils";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
|
|
|
|
const TIMEOUT = 20 * 1000;
|
|
|
|
describe("Abilities - COSTAR", () => {
|
|
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("double");
|
|
game.override.ability(Abilities.COSTAR);
|
|
game.override.moveset([Moves.SPLASH, Moves.NASTY_PLOT]);
|
|
game.override.enemyMoveset(SPLASH_ONLY);
|
|
});
|
|
|
|
|
|
test(
|
|
"ability copies positive stat changes",
|
|
async () => {
|
|
game.override.enemyAbility(Abilities.BALL_FETCH);
|
|
|
|
await game.startBattle([Species.MAGIKARP, Species.MAGIKARP, Species.FLAMIGO]);
|
|
|
|
let [leftPokemon, rightPokemon] = game.scene.getPlayerField();
|
|
|
|
game.move.select(Moves.NASTY_PLOT);
|
|
await game.phaseInterceptor.to(CommandPhase);
|
|
game.move.select(Moves.SPLASH, 1);
|
|
await game.toNextTurn();
|
|
|
|
expect(leftPokemon.summonData.battleStats[BattleStat.SPATK]).toBe(+2);
|
|
expect(rightPokemon.summonData.battleStats[BattleStat.SPATK]).toBe(0);
|
|
|
|
game.move.select(Moves.SPLASH);
|
|
await game.phaseInterceptor.to(CommandPhase);
|
|
game.doSwitchPokemon(2);
|
|
await game.phaseInterceptor.to(MessagePhase);
|
|
|
|
[leftPokemon, rightPokemon] = game.scene.getPlayerField();
|
|
expect(leftPokemon.summonData.battleStats[BattleStat.SPATK]).toBe(+2);
|
|
expect(rightPokemon.summonData.battleStats[BattleStat.SPATK]).toBe(+2);
|
|
},
|
|
TIMEOUT,
|
|
);
|
|
|
|
test(
|
|
"ability copies negative stat changes",
|
|
async () => {
|
|
game.override.enemyAbility(Abilities.INTIMIDATE);
|
|
|
|
await game.startBattle([Species.MAGIKARP, Species.MAGIKARP, Species.FLAMIGO]);
|
|
|
|
let [leftPokemon, rightPokemon] = game.scene.getPlayerField();
|
|
|
|
expect(leftPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2);
|
|
expect(leftPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2);
|
|
|
|
game.move.select(Moves.SPLASH);
|
|
await game.phaseInterceptor.to(CommandPhase);
|
|
game.doSwitchPokemon(2);
|
|
await game.phaseInterceptor.to(MessagePhase);
|
|
|
|
[leftPokemon, rightPokemon] = game.scene.getPlayerField();
|
|
expect(leftPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2);
|
|
expect(rightPokemon.summonData.battleStats[BattleStat.ATK]).toBe(-2);
|
|
},
|
|
TIMEOUT,
|
|
);
|
|
});
|