Armory variety: withhold two random offers each wave#2
Open
lfscheidegger wants to merge 1 commit into
Open
Conversation
The between-wave armory always listed the same five upgrade lines, so every run shopped identically. Now each wave clear rolls two of the five slots to withhold, leaving three on the counter — build order varies run to run without touching the underlying economy. The roll happens once on wave clear (not in getShopItems, which rebuilds every frame and would flicker) and rides along in the checkpoint, so revisiting the armory after a reload shows the same stock instead of re-rolling into a fresh one. The count lives in config.shop.dropPerWave. Tests cover the drop count, the keep-at-least-one clamp, the per-wave reroll, and reload stability; the existing shop tests opt out of the drop (setup.js) so they stay deterministic. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The between-wave armory always offered the same five upgrade lines (interceptor, shield, laser, fire rate, twin barrels), so every run shopped the same way. This rolls two of the five slots to withhold each wave, leaving three on the counter — so build order and run feel vary playthrough to playthrough, without changing the underlying economy.
How
getShopItems()now tags each offer with a stablekeyand filters out the wave's withheld set.endWave()— deliberately not insidegetShopItems(), which rebuilds every render frame and would make the shop flicker.continueGame(), so reopening the armory after a reload shows the same stock rather than letting you re-roll by refreshing. Older saves without the field just roll fresh.config.shop.dropPerWave(default2); it's clamped to always leave at least one purchasable offer.shuffle()toutils.js.Tests
setup.js) defaultsdropPerWaveto0; the new tests opt back in explicitly. Full suite passes (205).Try it
Clear a wave to reach the armory — you'll see three offers instead of five; clear another and a different pair is withheld. Refresh mid-armory and hit Continue: the same three persist.