[Enhancement] Add Fee Waiving Overrides (#2266)

This commit is contained in:
Amani H. 2024-07-30 17:15:08 -04:00 committed by GitHub
parent 49f4e5fc2e
commit 2900f22289
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 10 deletions

View File

@ -53,6 +53,10 @@ class DefaultOverrides {
readonly XP_MULTIPLIER_OVERRIDE: number = null;
/** default 1000 */
readonly STARTING_MONEY_OVERRIDE: integer = 0;
/** Sets all shop item prices to 0 */
readonly WAIVE_SHOP_FEES_OVERRIDE: boolean = false;
/** Sets reroll price to 0 */
readonly WAIVE_ROLL_FEE_OVERRIDE: boolean = false;
readonly FREE_CANDY_UPGRADE_OVERRIDE: boolean = false;
readonly POKEBALL_OVERRIDE: { active: boolean; pokeballs: PokeballCounts } = {
active: false,

View File

@ -5166,9 +5166,11 @@ export class SelectModifierPhase extends BattlePhase {
this.scene.unshiftPhase(new SelectModifierPhase(this.scene, this.rerollCount + 1, typeOptions.map(o => o.type.tier)));
this.scene.ui.clearText();
this.scene.ui.setMode(Mode.MESSAGE).then(() => super.end());
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
this.scene.money -= rerollCost;
this.scene.updateMoneyText();
this.scene.animateMoneyChanged(false);
}
this.scene.playSound("buy");
}
break;
@ -5209,7 +5211,7 @@ export class SelectModifierPhase extends BattlePhase {
break;
}
if (cost && this.scene.money < cost) {
if (cost && (this.scene.money < cost) && !Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
this.scene.ui.playError();
return false;
}
@ -5219,9 +5221,11 @@ export class SelectModifierPhase extends BattlePhase {
if (cost) {
result.then(success => {
if (success) {
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
this.scene.money -= cost;
this.scene.updateMoneyText();
this.scene.animateMoneyChanged(false);
}
this.scene.playSound("buy");
(this.scene.ui.getHandler() as ModifierSelectUiHandler).updateCostText();
} else {
@ -5301,7 +5305,9 @@ export class SelectModifierPhase extends BattlePhase {
getRerollCost(typeOptions: ModifierTypeOption[], lockRarities: boolean): integer {
let baseValue = 0;
if (lockRarities) {
if (Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
return baseValue;
} else if (lockRarities) {
const tierValues = [50, 125, 300, 750, 2000];
for (const opt of typeOptions) {
baseValue += tierValues[opt.type.tier];

View File

@ -10,6 +10,7 @@ import {Button} from "#enums/buttons";
import MoveInfoOverlay from "./move-info-overlay";
import { allMoves } from "../data/move";
import * as Utils from "./../utils";
import Overrides from "#app/overrides";
import i18next from "i18next";
export const SHOP_OPTIONS_ROW_LIMIT = 6;
@ -726,9 +727,10 @@ class ModifierOption extends Phaser.GameObjects.Container {
updateCostText(): void {
const scene = this.scene as BattleScene;
const textStyle = this.modifierTypeOption.cost <= scene.money ? TextStyle.MONEY : TextStyle.PARTY_RED;
const cost = Overrides.WAIVE_ROLL_FEE_OVERRIDE ? 0 : this.modifierTypeOption.cost;
const textStyle = cost <= scene.money ? TextStyle.MONEY : TextStyle.PARTY_RED;
const formattedMoney = Utils.formatMoney(scene.moneyFormat, this.modifierTypeOption.cost);
const formattedMoney = Utils.formatMoney(scene.moneyFormat, cost);
this.itemCostText.setText(i18next.t("modifierSelectUiHandler:itemCost", { formattedMoney }));
this.itemCostText.setColor(getTextColor(textStyle, false, scene.uiTheme));