mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 00:52:47 +02:00
Fixed remaining old methods
This commit is contained in:
parent
194ced277b
commit
105f39088e
@ -204,7 +204,7 @@ export async function skipBattleRunMysteryEncounterRewardsPhase(game: GameManage
|
||||
game.scene.field.remove(p);
|
||||
});
|
||||
game.scene.phaseManager.pushPhase(new VictoryPhase(0));
|
||||
game.phaseInterceptor.superEndPhase();
|
||||
game.phaseInterceptor.shiftPhase();
|
||||
game.setMode(UiMode.MESSAGE);
|
||||
await game.phaseInterceptor.to("MysteryEncounterRewardsPhase", runRewardsPhase);
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ describe("The Expert Pokémon Breeder - Mystery Encounter", () => {
|
||||
expect(eggsAfter.filter(egg => egg.tier === EggTier.COMMON).length).toBe(commonEggs);
|
||||
expect(eggsAfter.filter(egg => egg.tier === EggTier.RARE).length).toBe(rareEggs);
|
||||
|
||||
game.phaseInterceptor.superEndPhase();
|
||||
game.phaseInterceptor.shiftPhase();
|
||||
await game.phaseInterceptor.to("PostMysteryEncounterPhase");
|
||||
|
||||
const friendshipAfter = scene.currentBattle.mysteryEncounter!.misc.pokemon1.friendship;
|
||||
@ -271,7 +271,7 @@ describe("The Expert Pokémon Breeder - Mystery Encounter", () => {
|
||||
expect(eggsAfter.filter(egg => egg.tier === EggTier.COMMON).length).toBe(commonEggs);
|
||||
expect(eggsAfter.filter(egg => egg.tier === EggTier.RARE).length).toBe(rareEggs);
|
||||
|
||||
game.phaseInterceptor.superEndPhase();
|
||||
game.phaseInterceptor.shiftPhase();
|
||||
await game.phaseInterceptor.to("PostMysteryEncounterPhase");
|
||||
|
||||
const friendshipAfter = scene.currentBattle.mysteryEncounter!.misc.pokemon2.friendship;
|
||||
@ -353,7 +353,7 @@ describe("The Expert Pokémon Breeder - Mystery Encounter", () => {
|
||||
expect(eggsAfter.filter(egg => egg.tier === EggTier.COMMON).length).toBe(commonEggs);
|
||||
expect(eggsAfter.filter(egg => egg.tier === EggTier.RARE).length).toBe(rareEggs);
|
||||
|
||||
game.phaseInterceptor.superEndPhase();
|
||||
game.phaseInterceptor.shiftPhase();
|
||||
await game.phaseInterceptor.to("PostMysteryEncounterPhase");
|
||||
|
||||
const friendshipAfter = scene.currentBattle.mysteryEncounter!.misc.pokemon3.friendship;
|
||||
|
@ -365,9 +365,8 @@ async function skipBattleToNextBattle(game: GameManager, isFinalBattle = false)
|
||||
p.status = new Status(StatusEffect.FAINT);
|
||||
game.scene.field.remove(p);
|
||||
});
|
||||
game.phaseInterceptor["onHold"] = [];
|
||||
game.scene.phaseManager.pushPhase(new VictoryPhase(0));
|
||||
game.phaseInterceptor.superEndPhase();
|
||||
game.phaseInterceptor.shiftPhase();
|
||||
if (isFinalBattle) {
|
||||
await game.phaseInterceptor.to("MysteryEncounterRewardsPhase");
|
||||
} else {
|
||||
|
@ -36,7 +36,6 @@ import type { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { PlayerGender } from "#enums/player-gender";
|
||||
import type { SpeciesId } from "#enums/species-id";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import ErrorInterceptor from "#test/testUtils/errorInterceptor";
|
||||
import { generateStarter, waitUntil } from "#test/testUtils/gameManagerUtils";
|
||||
import GameWrapper from "#test/testUtils/gameWrapper";
|
||||
import { ChallengeModeHelper } from "#test/testUtils/helpers/challengeModeHelper";
|
||||
@ -83,7 +82,6 @@ export default class GameManager {
|
||||
*/
|
||||
constructor(phaserGame: Phaser.Game, bypassLogin = true) {
|
||||
localStorage.clear();
|
||||
ErrorInterceptor.getInstance().clear();
|
||||
BattleScene.prototype.randBattleSeedInt = (range, min = 0) => min + range - 1; // This simulates a max roll
|
||||
this.gameWrapper = new GameWrapper(phaserGame, bypassLogin);
|
||||
|
||||
@ -268,7 +266,7 @@ export default class GameManager {
|
||||
true,
|
||||
);
|
||||
|
||||
await this.phaseInterceptor.run(EncounterPhase);
|
||||
await this.phaseInterceptor.to("EncounterPhase");
|
||||
if (!isNullOrUndefined(encounterType)) {
|
||||
expect(this.scene.currentBattle?.mysteryEncounter?.encounterType).toBe(encounterType);
|
||||
}
|
||||
@ -500,7 +498,7 @@ export default class GameManager {
|
||||
* @param inPhase - Which phase to expect the selection to occur in. Defaults to `SwitchPhase`
|
||||
* (which is where the majority of non-command switch operations occur).
|
||||
*/
|
||||
doSelectPartyPokemon(slot: number, inPhase = "SwitchPhase") {
|
||||
doSelectPartyPokemon(slot: number, inPhase: PhaseString = "SwitchPhase") {
|
||||
this.onNextPrompt(inPhase, UiMode.PARTY, () => {
|
||||
const partyHandler = this.scene.ui.getHandler() as PartyUiHandler;
|
||||
|
||||
|
@ -49,7 +49,7 @@ export class ChallengeModeHelper extends GameManagerHelper {
|
||||
selectStarterPhase.initBattle(starters);
|
||||
});
|
||||
|
||||
await this.game.phaseInterceptor.run(EncounterPhase);
|
||||
await this.game.phaseInterceptor.to("EncounterPhase");
|
||||
if (overrides.OPP_HELD_ITEMS_OVERRIDE.length === 0 && this.game.override.removeEnemyStartingItems) {
|
||||
this.game.removeEnemyHeldItems();
|
||||
}
|
||||
|
@ -64,7 +64,9 @@ export default class PhaseInterceptor {
|
||||
|
||||
// Mock the private startCurrentPhase method to do nothing to let us
|
||||
// handle starting phases manually in the `run` method.
|
||||
vi.fn(this.scene.phaseManager["startCurrentPhase"]).mockImplementation(() => {});
|
||||
vi.fn(this.scene.phaseManager["startCurrentPhase"]).mockImplementation(() => {
|
||||
console.log("Did nothing!!!!");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,7 +71,7 @@ describe("UI - Pokedex", () => {
|
||||
// Open the pokedex UI.
|
||||
await game.runToTitle();
|
||||
|
||||
await game.phaseInterceptor.setOverlayMode(UiMode.POKEDEX);
|
||||
await game.scene.ui.setOverlayMode(UiMode.POKEDEX);
|
||||
|
||||
// Get the handler for the current UI.
|
||||
const handler = game.scene.ui.getHandler();
|
||||
@ -91,7 +91,7 @@ describe("UI - Pokedex", () => {
|
||||
// Open the pokedex UI.
|
||||
await game.runToTitle();
|
||||
|
||||
await game.phaseInterceptor.setOverlayMode(UiMode.POKEDEX_PAGE, species, starterAttributes);
|
||||
await game.scene.ui.setOverlayMode(UiMode.POKEDEX_PAGE, species, starterAttributes);
|
||||
|
||||
// Get the handler for the current UI.
|
||||
const handler = game.scene.ui.getHandler();
|
||||
|
@ -2,7 +2,6 @@ import { Gender } from "#app/data/gender";
|
||||
import { Nature } from "#enums/nature";
|
||||
import { allSpecies } from "#app/data/data-lists";
|
||||
import { GameModes } from "#enums/game-modes";
|
||||
import { EncounterPhase } from "#app/phases/encounter-phase";
|
||||
import type { TitlePhase } from "#app/phases/title-phase";
|
||||
import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import type SaveSlotSelectUiHandler from "#app/ui/save-slot-select-ui-handler";
|
||||
@ -86,7 +85,7 @@ describe("UI - Starter select", () => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
await game.phaseInterceptor.whenAboutToRun(EncounterPhase);
|
||||
await game.phaseInterceptor.to("EncounterPhase", false);
|
||||
|
||||
expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.BULBASAUR);
|
||||
expect(game.scene.getPlayerParty()[0].shiny).toBe(true);
|
||||
@ -209,7 +208,7 @@ describe("UI - Starter select", () => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
await game.phaseInterceptor.whenAboutToRun(EncounterPhase);
|
||||
await game.phaseInterceptor.to("EncounterPhase", false);
|
||||
|
||||
expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.BULBASAUR);
|
||||
expect(game.scene.getPlayerParty()[0].shiny).toBe(true);
|
||||
@ -271,7 +270,7 @@ describe("UI - Starter select", () => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
await game.phaseInterceptor.whenAboutToRun(EncounterPhase);
|
||||
await game.phaseInterceptor.to("EncounterPhase", false);
|
||||
|
||||
expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.BULBASAUR);
|
||||
expect(game.scene.getPlayerParty()[0].shiny).toBe(true);
|
||||
@ -331,7 +330,7 @@ describe("UI - Starter select", () => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
await game.phaseInterceptor.whenAboutToRun(EncounterPhase);
|
||||
await game.phaseInterceptor.to("EncounterPhase", false);
|
||||
|
||||
expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.BULBASAUR);
|
||||
expect(game.scene.getPlayerParty()[0].shiny).toBe(false);
|
||||
@ -392,7 +391,7 @@ describe("UI - Starter select", () => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
await game.phaseInterceptor.whenAboutToRun(EncounterPhase);
|
||||
await game.phaseInterceptor.to("EncounterPhase", false);
|
||||
|
||||
expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.BULBASAUR);
|
||||
expect(game.scene.getPlayerParty()[0].shiny).toBe(true);
|
||||
@ -452,7 +451,7 @@ describe("UI - Starter select", () => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
await game.phaseInterceptor.whenAboutToRun(EncounterPhase);
|
||||
await game.phaseInterceptor.to("EncounterPhase", false);
|
||||
|
||||
expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.BULBASAUR);
|
||||
expect(game.scene.getPlayerParty()[0].shiny).toBe(true);
|
||||
@ -518,7 +517,7 @@ describe("UI - Starter select", () => {
|
||||
const saveSlotSelectUiHandler = game.scene.ui.getHandler() as SaveSlotSelectUiHandler;
|
||||
saveSlotSelectUiHandler.processInput(Button.ACTION);
|
||||
});
|
||||
await game.phaseInterceptor.whenAboutToRun(EncounterPhase);
|
||||
await game.phaseInterceptor.to("EncounterPhase", false);
|
||||
expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.CATERPIE);
|
||||
});
|
||||
|
||||
@ -583,7 +582,7 @@ describe("UI - Starter select", () => {
|
||||
const saveSlotSelectUiHandler = game.scene.ui.getHandler() as SaveSlotSelectUiHandler;
|
||||
saveSlotSelectUiHandler.processInput(Button.ACTION);
|
||||
});
|
||||
await game.phaseInterceptor.whenAboutToRun(EncounterPhase);
|
||||
await game.phaseInterceptor.to("EncounterPhase", false);
|
||||
expect(game.scene.getPlayerParty()[0].species.speciesId).toBe(SpeciesId.NIDORAN_M);
|
||||
});
|
||||
});
|
||||
|
@ -72,8 +72,6 @@ describe("UI - Transfer Items", () => {
|
||||
expect(
|
||||
handler.optionsContainer.list.some(option => RegExp(/Lum Berry\[color.*(2)/).exec((option as BBCodeText).text)),
|
||||
).toBe(true);
|
||||
|
||||
game.phaseInterceptor.unlock();
|
||||
});
|
||||
|
||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
||||
@ -93,8 +91,6 @@ describe("UI - Transfer Items", () => {
|
||||
expect(handler.optionsContainer.list.some(option => (option as BBCodeText).text?.includes("Transfer"))).toBe(
|
||||
true,
|
||||
);
|
||||
|
||||
game.phaseInterceptor.unlock();
|
||||
});
|
||||
|
||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
||||
|
@ -45,7 +45,6 @@ describe("UI - Type Hints", () => {
|
||||
const { ui } = game.scene;
|
||||
const handler = ui.getHandler<FightUiHandler>();
|
||||
handler.processInput(Button.ACTION); // select "Fight"
|
||||
game.phaseInterceptor.unlock();
|
||||
});
|
||||
|
||||
game.onNextPrompt("CommandPhase", UiMode.FIGHT, () => {
|
||||
@ -70,7 +69,6 @@ describe("UI - Type Hints", () => {
|
||||
const { ui } = game.scene;
|
||||
const handler = ui.getHandler<FightUiHandler>();
|
||||
handler.processInput(Button.ACTION); // select "Fight"
|
||||
game.phaseInterceptor.unlock();
|
||||
});
|
||||
|
||||
game.onNextPrompt("CommandPhase", UiMode.FIGHT, () => {
|
||||
@ -106,7 +104,6 @@ describe("UI - Type Hints", () => {
|
||||
const { ui } = game.scene;
|
||||
const handler = ui.getHandler<FightUiHandler>();
|
||||
handler.processInput(Button.ACTION); // select "Fight"
|
||||
game.phaseInterceptor.unlock();
|
||||
});
|
||||
|
||||
game.onNextPrompt("CommandPhase", UiMode.FIGHT, () => {
|
||||
|
Loading…
Reference in New Issue
Block a user