[Bug] Fix Thrash continuing on caught Pokemon (#6144)

Fix Thrash continuing on caught Pokemon
This commit is contained in:
Acelynn Zhang 2025-07-25 19:55:13 -04:00 committed by GitHub
parent ab394db9cf
commit 2e3a7d47e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 38 additions and 0 deletions

View File

@ -279,6 +279,7 @@ export class AttemptCapturePhase extends PokemonPhase {
globalScene.updateModifiers(true);
removePokemon();
if (newPokemon) {
newPokemon.leaveField(true, true, false);
newPokemon.loadAssets().then(end);
} else {
end();

View File

@ -0,0 +1,37 @@
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import { GameManager } from "#test/test-utils/game-manager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, it } from "vitest";
describe("Capture Phase", () => {
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
.ability(AbilityId.BALL_FETCH)
.battleStyle("single")
.criticalHits(false)
.enemySpecies(SpeciesId.MAGIKARP)
.enemyAbility(AbilityId.BALL_FETCH)
.enemyMoveset(MoveId.SPLASH)
.startingLevel(100)
.enemyLevel(100);
});
// TODO: write test and enable once the phase's logic has been refactored
it.todo("should reset the captured Pokemon's temporary data");
});