Some tests for weakening and catching bosses

This commit is contained in:
Wlowscha 2025-08-26 22:33:16 +02:00
parent 443d747ad1
commit 6bc469dec4
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04

View File

@ -1,4 +1,5 @@
import { pokerogueApi } from "#api/pokerogue-api";
import { AbilityId } from "#enums/ability-id";
import { BattleType } from "#enums/battle-type";
import { BiomeId } from "#enums/biome-id";
import { Challenges } from "#enums/challenges";
@ -297,3 +298,74 @@ describe("Throwing balls at trainers", () => {
await runPokeballTest(game, PokeballType.MASTER_BALL, "battle:noPokeballTrainer");
});
});
describe("Throwing balls at bosses after weakening them", () => {
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(BattleType.WILD)
.moveset([MoveId.SLASH])
.enemyMoveset([MoveId.SPLASH])
.enemyHeldItems([])
.enemySpecies(SpeciesId.CATERPIE)
.startingLevel(99999)
.startingWave(170);
});
it("weakening and catching a single boss", async () => {
game.override.battleStyle("single").enemyAbility(AbilityId.STURDY);
await game.classicMode.startBattle([SpeciesId.KARTANA]);
const partyLength = game.scene.getPlayerParty().length;
const ball = PokeballType.ROGUE_BALL;
game.scene.pokeballCounts[ball] = 1;
game.move.select(MoveId.SLASH);
await game.toNextTurn();
game.doThrowPokeball(ball);
await game.toEndOfTurn();
expect(game.scene.getPlayerParty()).toHaveLength(partyLength + 1);
});
it("weakening and catching a boss in a double battle", async () => {
game.override.battleStyle("double").enemyAbility(AbilityId.STURDY);
await game.classicMode.startBattle([SpeciesId.KARTANA]);
const partyLength = game.scene.getPlayerParty().length;
const ball = PokeballType.ROGUE_BALL;
game.scene.pokeballCounts[ball] = 1;
game.move.select(MoveId.SLASH);
await game.toNextTurn();
game.move.select(MoveId.SLASH);
await game.toNextTurn();
game.move.select(MoveId.SLASH);
await game.toNextTurn();
game.doThrowPokeball(ball);
await game.toEndOfTurn();
expect(game.scene.getPlayerParty()).toHaveLength(partyLength + 1);
});
});