[Enhancement] Add Fee Waiving Overrides #2266
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are the changes?
Adds two new boolean overrides:
WAIVE_SHOP_FEES_OVERRIDE
andWAIVE_REROLL_FEE_OVERRIDE
.Why am I doing these changes?
Whenever I'm testing item weights for really rare items and making sure that they actually appear in a "normal" reward fetching context outside of
STARTING_HELD_ITEMS_OVERRIDE
andITEM_REWARD_OVERRIDE
, I end up having to either use an all shiny team to bolster luck or setSTARTING_MONEY_OVERRIDE
to a really large number. This usually works if luck comes through, but because reroll prices exponentially grow, you end up running out of money pretty fast and then having to restart to get theSTARTING_MONEY_OVERRIDE
to kick in again. The reroll override directly addresses this by keeping the reroll price at 0 forever, which was the primary motivation.Alongside the reroll override, I figured I would bundle this with a shop fee override since it also pertains to test runs in general, making it easier to do a full run for testing purposes without having to necessarily play a real run of Classic. In a similar sense, it helps gauge what items can be realistically be obtained in a mostly normal run and has applications in unit tests, removing the necessity to coordinate money and shop prices with waves or pad values to account for swings in RNG.
What did change?
Along with the two override variables, checks and ternaries for these variables were added to the
SelectModifierPhase
at the appropriate points to make sure that cost is 0 for the corresponding things. For reroll pricing, this involves directly placing the override ingetRerollCost
and, for visual purposes, surrounding the animation and cost subtraction code in anif
. For shop pricing though, a lot of logic already relies on cost being 0 or null; that is, anything with a cost of 0 or null is treated as a modifier roll, which makes picking up a truly free shop item turn into picking up a modifier and moving immediately into the next wave. As a result, cost isn't mutated at all. Instead, the cost subtraction is wrapped in anif
and theupdateCostText
is changed to display 0 rather than the actual cost of the shop item. Both of these things give the effect of the shop item cost being 0 but doesn't actually change the shop item value internally.Screenshots/Videos
Reroll and Shop Prices - Before
Reroll and Shop Prices - After (w/ Overrides set to
true
)waiveFeesDemo.mov
How to test the changes?
All that's needed to test is to set either of the new override variables,
WAIVE_SHOP_FEES_OVERRIDE
orWAIVE_REROLL_FEE_OVERRIDE
, totrue
insrc/overrides.ts
, going into an existing or new run, winning a wave to enter theSelectModifierPhase
, and try buying any item or rerolling.Checklist
npm run test
)