mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-11 10:45:34 +00:00
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
|
import BattleScene from "#app/battle-scene.js";
|
||
|
import { ArenaTagType } from "#app/enums/arena-tag-type.js";
|
||
|
import { MoneyMultiplierModifier } from "#app/modifier/modifier.js";
|
||
|
import i18next from "i18next";
|
||
|
import * as Utils from "#app/utils.js";
|
||
|
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);
|
||
|
}
|
||
|
}
|