[Enhancement] Add Fee Waiving Overrides (#2266)
This commit is contained in:
parent
49f4e5fc2e
commit
2900f22289
|
@ -53,6 +53,10 @@ class DefaultOverrides {
|
||||||
readonly XP_MULTIPLIER_OVERRIDE: number = null;
|
readonly XP_MULTIPLIER_OVERRIDE: number = null;
|
||||||
/** default 1000 */
|
/** default 1000 */
|
||||||
readonly STARTING_MONEY_OVERRIDE: integer = 0;
|
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 FREE_CANDY_UPGRADE_OVERRIDE: boolean = false;
|
||||||
readonly POKEBALL_OVERRIDE: { active: boolean; pokeballs: PokeballCounts } = {
|
readonly POKEBALL_OVERRIDE: { active: boolean; pokeballs: PokeballCounts } = {
|
||||||
active: false,
|
active: false,
|
||||||
|
|
|
@ -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.unshiftPhase(new SelectModifierPhase(this.scene, this.rerollCount + 1, typeOptions.map(o => o.type.tier)));
|
||||||
this.scene.ui.clearText();
|
this.scene.ui.clearText();
|
||||||
this.scene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
this.scene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
||||||
this.scene.money -= rerollCost;
|
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
||||||
this.scene.updateMoneyText();
|
this.scene.money -= rerollCost;
|
||||||
this.scene.animateMoneyChanged(false);
|
this.scene.updateMoneyText();
|
||||||
|
this.scene.animateMoneyChanged(false);
|
||||||
|
}
|
||||||
this.scene.playSound("buy");
|
this.scene.playSound("buy");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -5209,7 +5211,7 @@ export class SelectModifierPhase extends BattlePhase {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cost && this.scene.money < cost) {
|
if (cost && (this.scene.money < cost) && !Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
||||||
this.scene.ui.playError();
|
this.scene.ui.playError();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -5219,9 +5221,11 @@ export class SelectModifierPhase extends BattlePhase {
|
||||||
if (cost) {
|
if (cost) {
|
||||||
result.then(success => {
|
result.then(success => {
|
||||||
if (success) {
|
if (success) {
|
||||||
this.scene.money -= cost;
|
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
||||||
this.scene.updateMoneyText();
|
this.scene.money -= cost;
|
||||||
this.scene.animateMoneyChanged(false);
|
this.scene.updateMoneyText();
|
||||||
|
this.scene.animateMoneyChanged(false);
|
||||||
|
}
|
||||||
this.scene.playSound("buy");
|
this.scene.playSound("buy");
|
||||||
(this.scene.ui.getHandler() as ModifierSelectUiHandler).updateCostText();
|
(this.scene.ui.getHandler() as ModifierSelectUiHandler).updateCostText();
|
||||||
} else {
|
} else {
|
||||||
|
@ -5301,7 +5305,9 @@ export class SelectModifierPhase extends BattlePhase {
|
||||||
|
|
||||||
getRerollCost(typeOptions: ModifierTypeOption[], lockRarities: boolean): integer {
|
getRerollCost(typeOptions: ModifierTypeOption[], lockRarities: boolean): integer {
|
||||||
let baseValue = 0;
|
let baseValue = 0;
|
||||||
if (lockRarities) {
|
if (Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
||||||
|
return baseValue;
|
||||||
|
} else if (lockRarities) {
|
||||||
const tierValues = [50, 125, 300, 750, 2000];
|
const tierValues = [50, 125, 300, 750, 2000];
|
||||||
for (const opt of typeOptions) {
|
for (const opt of typeOptions) {
|
||||||
baseValue += tierValues[opt.type.tier];
|
baseValue += tierValues[opt.type.tier];
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {Button} from "#enums/buttons";
|
||||||
import MoveInfoOverlay from "./move-info-overlay";
|
import MoveInfoOverlay from "./move-info-overlay";
|
||||||
import { allMoves } from "../data/move";
|
import { allMoves } from "../data/move";
|
||||||
import * as Utils from "./../utils";
|
import * as Utils from "./../utils";
|
||||||
|
import Overrides from "#app/overrides";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
|
||||||
export const SHOP_OPTIONS_ROW_LIMIT = 6;
|
export const SHOP_OPTIONS_ROW_LIMIT = 6;
|
||||||
|
@ -726,9 +727,10 @@ class ModifierOption extends Phaser.GameObjects.Container {
|
||||||
|
|
||||||
updateCostText(): void {
|
updateCostText(): void {
|
||||||
const scene = this.scene as BattleScene;
|
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.setText(i18next.t("modifierSelectUiHandler:itemCost", { formattedMoney }));
|
||||||
this.itemCostText.setColor(getTextColor(textStyle, false, scene.uiTheme));
|
this.itemCostText.setColor(getTextColor(textStyle, false, scene.uiTheme));
|
||||||
|
|
Loading…
Reference in New Issue