mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-21 17:19:16 +01:00
* Move phase types out of phase interceptor * Create isXPhase method and add properties to each phase * Replace instanceof phase with isXPhase * Fix missing union types for phaseName * Update doc comment in phase.ts * Fix incomplete comment in encounter-phase * Make phaseName as public and fix more uses * Move phaseName property declaration before constructor in move anim phase Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Rename isXPhase to is --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import { Phase } from "#app/phase";
|
|
import { UiMode } from "#enums/ui-mode";
|
|
import type { EggHatchData } from "#app/data/egg-hatch-data";
|
|
|
|
/**
|
|
* Class that represents the egg summary phase
|
|
* It does some of the function for updating egg data
|
|
* Phase is handled mostly by the egg-hatch-scene-handler UI
|
|
*/
|
|
export class EggSummaryPhase extends Phase {
|
|
public readonly phaseName = "EggSummaryPhase";
|
|
private eggHatchData: EggHatchData[];
|
|
|
|
constructor(eggHatchData: EggHatchData[]) {
|
|
super();
|
|
this.eggHatchData = eggHatchData;
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
|
|
// updates next pokemon once the current update has been completed
|
|
const updateNextPokemon = (i: number) => {
|
|
if (i >= this.eggHatchData.length) {
|
|
globalScene.ui.setModeForceTransition(UiMode.EGG_HATCH_SUMMARY, this.eggHatchData).then(() => {
|
|
globalScene.fadeOutBgm(undefined, false);
|
|
});
|
|
} else {
|
|
this.eggHatchData[i].setDex();
|
|
this.eggHatchData[i].updatePokemon().then(() => {
|
|
if (i < this.eggHatchData.length) {
|
|
updateNextPokemon(i + 1);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
updateNextPokemon(0);
|
|
}
|
|
|
|
end() {
|
|
globalScene.time.delayedCall(250, () => globalScene.setModifiersVisible(true));
|
|
globalScene.ui.setModeForceTransition(UiMode.MESSAGE).then(() => {
|
|
super.end();
|
|
});
|
|
}
|
|
}
|