mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-28 12:32:44 +02:00
- remove any `.js` extension imports - remove unncessary dynamic imports of `modifier.ts` file. The file was being imported statically & dynamically. Made it pure static - increase vite chunk-size warning limit Co-authored-by: Mumble <171087428+frutescens@users.noreply.github.com>
31 lines
947 B
TypeScript
31 lines
947 B
TypeScript
import BattleScene from "#app/battle-scene";
|
|
import { ModifierType, ModifierTypeFunc, getModifierType } from "#app/modifier/modifier-type";
|
|
import i18next from "i18next";
|
|
import { BattlePhase } from "./battle-phase";
|
|
|
|
export class ModifierRewardPhase extends BattlePhase {
|
|
protected modifierType: ModifierType;
|
|
|
|
constructor(scene: BattleScene, modifierTypeFunc: ModifierTypeFunc) {
|
|
super(scene);
|
|
|
|
this.modifierType = getModifierType(modifierTypeFunc);
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
|
|
this.doReward().then(() => this.end());
|
|
}
|
|
|
|
doReward(): Promise<void> {
|
|
return new Promise<void>(resolve => {
|
|
const newModifier = this.modifierType.newModifier();
|
|
this.scene.addModifier(newModifier).then(() => {
|
|
this.scene.playSound("item_fanfare");
|
|
this.scene.ui.showText(i18next.t("battle:rewardGain", { modifierName: newModifier?.type.name }), null, () => resolve(), null, true);
|
|
});
|
|
});
|
|
}
|
|
}
|