mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-25 02:59:22 +01:00
* Add abilityAttr.is methods * [WIP] move modifier stuff around * Untangle circular deps from modifiers * Move unlockables to own file * Untangle all circular deps outside of MEs * Move constants in MEs to their own files * Re-add missing import to battle.ts * Add necessary overload for getTag * Add missing type import in weather.ts * Init modifier types and pools in loading-scene * Remove stray commented code * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import { Phase } from "#app/phase";
|
|
import type { Unlockables } from "#enums/unlockables";
|
|
import { getUnlockableName } from "#app/system/unlockables";
|
|
import { UiMode } from "#enums/ui-mode";
|
|
import i18next from "i18next";
|
|
|
|
export class UnlockPhase extends Phase {
|
|
public readonly phaseName = "UnlockPhase";
|
|
private unlockable: Unlockables;
|
|
|
|
constructor(unlockable: Unlockables) {
|
|
super();
|
|
|
|
this.unlockable = unlockable;
|
|
}
|
|
|
|
start(): void {
|
|
globalScene.time.delayedCall(2000, () => {
|
|
globalScene.gameData.unlocks[this.unlockable] = true;
|
|
// Sound loaded into game as is
|
|
globalScene.playSound("level_up_fanfare");
|
|
globalScene.ui.setMode(UiMode.MESSAGE);
|
|
globalScene.ui.showText(
|
|
i18next.t("battle:unlockedSomething", {
|
|
unlockedThing: getUnlockableName(this.unlockable),
|
|
}),
|
|
null,
|
|
() => {
|
|
globalScene.time.delayedCall(1500, () => globalScene.arenaBg.setVisible(true));
|
|
this.end();
|
|
},
|
|
null,
|
|
true,
|
|
1500,
|
|
);
|
|
});
|
|
}
|
|
}
|