mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-06 08:07:42 +00: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>
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import BattleScene from "#app/battle-scene";
|
|
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
|
import { MoneyMultiplierModifier } from "#app/modifier/modifier";
|
|
import i18next from "i18next";
|
|
import * as Utils from "#app/utils";
|
|
import { BattlePhase } from "./battle-phase";
|
|
|
|
export class MoneyRewardPhase extends BattlePhase {
|
|
private moneyMultiplier: number;
|
|
|
|
constructor(scene: BattleScene, moneyMultiplier: number) {
|
|
super(scene);
|
|
|
|
this.moneyMultiplier = moneyMultiplier;
|
|
}
|
|
|
|
start() {
|
|
const moneyAmount = new Utils.IntegerHolder(this.scene.getWaveMoneyAmount(this.moneyMultiplier));
|
|
|
|
this.scene.applyModifiers(MoneyMultiplierModifier, true, moneyAmount);
|
|
|
|
if (this.scene.arena.getTag(ArenaTagType.HAPPY_HOUR)) {
|
|
moneyAmount.value *= 2;
|
|
}
|
|
|
|
this.scene.addMoney(moneyAmount.value);
|
|
|
|
const userLocale = navigator.language || "en-US";
|
|
const formattedMoneyAmount = moneyAmount.value.toLocaleString(userLocale);
|
|
const message = i18next.t("battle:moneyWon", { moneyAmount: formattedMoneyAmount });
|
|
|
|
this.scene.ui.showText(message, null, () => this.end(), null, true);
|
|
}
|
|
}
|