mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-23 01:54:49 +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>
72 lines
2.3 KiB
TypeScript
72 lines
2.3 KiB
TypeScript
import { Stat } from "#enums/stat";
|
|
import { TurnInitPhase } from "#app/phases/turn-init-phase";
|
|
import { Abilities } from "#enums/abilities";
|
|
import { Moves } from "#enums/moves";
|
|
import { Species } from "#enums/species";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
|
|
describe("Abilities - Defiant", () => {
|
|
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
|
|
.battleStyle("single")
|
|
.enemySpecies(Species.BEEDRILL)
|
|
.enemyMoveset(Moves.TICKLE)
|
|
.startingLevel(1)
|
|
.moveset([Moves.SPLASH, Moves.CLOSE_COMBAT])
|
|
.ability(Abilities.DEFIANT);
|
|
});
|
|
|
|
it("lower atk and def by 1 via tickle, then increase atk by 4 via defiant", async () => {
|
|
await game.classicMode.startBattle([Species.FLYGON]);
|
|
|
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
|
game.move.select(Moves.SPLASH);
|
|
await game.phaseInterceptor.to(TurnInitPhase);
|
|
|
|
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(3);
|
|
expect(playerPokemon.getStatStage(Stat.DEF)).toBe(-1);
|
|
});
|
|
|
|
it("lowering your own stats should not trigger defiant", async () => {
|
|
game.override.enemyMoveset(Moves.SPLASH);
|
|
await game.classicMode.startBattle([Species.FLYGON]);
|
|
|
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
|
game.move.select(Moves.CLOSE_COMBAT);
|
|
await game.phaseInterceptor.to(TurnInitPhase);
|
|
|
|
expect(playerPokemon.getStatStage(Stat.SPDEF)).toBe(-1);
|
|
expect(playerPokemon.getStatStage(Stat.DEF)).toBe(-1);
|
|
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(0);
|
|
});
|
|
|
|
it("white herb should remove only the negative effects", async () => {
|
|
game.override.startingHeldItems([{ name: "WHITE_HERB" }]);
|
|
await game.classicMode.startBattle([Species.FLYGON]);
|
|
|
|
const playerPokemon = game.scene.getPlayerPokemon()!;
|
|
game.move.select(Moves.SPLASH);
|
|
await game.phaseInterceptor.to(TurnInitPhase);
|
|
|
|
expect(playerPokemon.getStatStage(Stat.DEF)).toBe(0);
|
|
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(3);
|
|
});
|
|
});
|