mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-11-26 21:18:18 +01:00
* Move phase types out of phase interceptor * Create isXPhase method and add properties to each phase * Replace instanceof phase with isXPhase * Fix missing union types for phaseName * Update doc comment in phase.ts * Fix incomplete comment in encounter-phase * Make phaseName as public and fix more uses * Move phaseName property declaration before constructor in move anim phase Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Rename isXPhase to is --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
|
import { MoneyMultiplierModifier } from "#app/modifier/modifier";
|
|
import i18next from "i18next";
|
|
import { NumberHolder } from "#app/utils/common";
|
|
import { BattlePhase } from "./battle-phase";
|
|
|
|
export class MoneyRewardPhase extends BattlePhase {
|
|
public readonly phaseName = "MoneyRewardPhase";
|
|
private moneyMultiplier: number;
|
|
|
|
constructor(moneyMultiplier: number) {
|
|
super();
|
|
|
|
this.moneyMultiplier = moneyMultiplier;
|
|
}
|
|
|
|
start() {
|
|
const moneyAmount = new NumberHolder(globalScene.getWaveMoneyAmount(this.moneyMultiplier));
|
|
|
|
globalScene.applyModifiers(MoneyMultiplierModifier, true, moneyAmount);
|
|
|
|
if (globalScene.arena.getTag(ArenaTagType.HAPPY_HOUR)) {
|
|
moneyAmount.value *= 2;
|
|
}
|
|
|
|
globalScene.addMoney(moneyAmount.value);
|
|
|
|
const userLocale = navigator.language || "en-US";
|
|
const formattedMoneyAmount = moneyAmount.value.toLocaleString(userLocale);
|
|
const message = i18next.t("battle:moneyWon", {
|
|
moneyAmount: formattedMoneyAmount,
|
|
});
|
|
|
|
globalScene.ui.showText(message, null, () => this.end(), null, true);
|
|
}
|
|
}
|