2024-09-07 21:37:37 -07:00
|
|
|
import BattleScene from "#app/battle-scene";
|
|
|
|
import PokemonSpecies from "#app/data/pokemon-species";
|
|
|
|
import { ModifierTypeFunc } from "#app/modifier/modifier-type";
|
|
|
|
import { Mode } from "#app/ui/ui";
|
2024-08-19 03:23:52 +01:00
|
|
|
import i18next from "i18next";
|
|
|
|
import { ModifierRewardPhase } from "./modifier-reward-phase";
|
|
|
|
|
|
|
|
export class RibbonModifierRewardPhase extends ModifierRewardPhase {
|
|
|
|
private species: PokemonSpecies;
|
|
|
|
|
|
|
|
constructor(scene: BattleScene, modifierTypeFunc: ModifierTypeFunc, species: PokemonSpecies) {
|
|
|
|
super(scene, modifierTypeFunc);
|
|
|
|
|
|
|
|
this.species = species;
|
|
|
|
}
|
|
|
|
|
|
|
|
doReward(): Promise<void> {
|
|
|
|
return new Promise<void>(resolve => {
|
|
|
|
const newModifier = this.modifierType.newModifier();
|
|
|
|
this.scene.addModifier(newModifier).then(() => {
|
|
|
|
this.scene.playSound("level_up_fanfare");
|
|
|
|
this.scene.ui.setMode(Mode.MESSAGE);
|
|
|
|
this.scene.ui.showText(i18next.t("battle:beatModeFirstTime", {
|
|
|
|
speciesName: this.species.name,
|
|
|
|
gameMode: this.scene.gameMode.getName(),
|
|
|
|
newModifier: newModifier?.type.name
|
|
|
|
}), null, () => {
|
|
|
|
resolve();
|
|
|
|
}, null, true, 1500);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|