pokerogue/src/phases/ribbon-modifier-reward-phase.ts
Sirz Benjie 1029afcdbf
[Refactor] Remove circular dependencies (part 4) (#5964)
* 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>
2025-06-11 19:42:04 -07:00

41 lines
1.2 KiB
TypeScript

import { globalScene } from "#app/global-scene";
import type PokemonSpecies from "#app/data/pokemon-species";
import type { ModifierTypeFunc } from "#app/@types/modifier-types";
import { UiMode } from "#enums/ui-mode";
import i18next from "i18next";
import { ModifierRewardPhase } from "./modifier-reward-phase";
export class RibbonModifierRewardPhase extends ModifierRewardPhase {
public readonly phaseName = "RibbonModifierRewardPhase";
private species: PokemonSpecies;
constructor(modifierTypeFunc: ModifierTypeFunc, species: PokemonSpecies) {
super(modifierTypeFunc);
this.species = species;
}
doReward(): Promise<void> {
return new Promise<void>(resolve => {
const newModifier = this.modifierType.newModifier();
globalScene.addModifier(newModifier);
globalScene.playSound("level_up_fanfare");
globalScene.ui.setMode(UiMode.MESSAGE);
globalScene.ui.showText(
i18next.t("battle:beatModeFirstTime", {
speciesName: this.species.name,
gameMode: globalScene.gameMode.getName(),
newModifier: newModifier?.type.name,
}),
null,
() => {
resolve();
},
null,
true,
1500,
);
});
}
}