feat(main-street): branching & multi-level upgrade chains for Business cards#412
Merged
SorraTheOrc merged 4 commits intomainfrom Mar 10, 2026
Merged
Conversation
Co-authored-by: SorraTheOrc <250240+SorraTheOrc@users.noreply.github.com>
- Add optional `requiredLevel` to UpgradeCard interface (0 = base, 1 = post-upgrade) - Add optional `appliedUpgrades` tracking array to BusinessCard interface - Update `makeBusiness()` factory to initialise `appliedUpgrades: []` - Raise `maxLevel` to 2 for Bakery, Diner, Cinema, Day Spa - Add 4 branching upgrade cards (Bread Factory, Fast Food, Drive-In, Wellness Center) - Add 4 level-2 upgrade cards (Grand Bakehouse, Restaurant, Multiplex, Luxury Retreat) - Update `canPurchaseUpgrade` to enforce `requiredLevel` constraint - Update `purchaseUpgrade` to apply `requiredLevel` matching and record applied IDs - Add `getUpgradeBranchesForBusiness` helper for UI branch detection - Add `showUpgradeChoiceModal` in MainStreetScene with branch-choice modal UI - Update `onUpgradeCardClick` to trigger modal when multiple branches available - Add 18 new tests in `tests/main-street/upgrades.test.ts` - Update existing test counts (expanded-card-pool, game-state) to reflect 25 templates Co-authored-by: SorraTheOrc <250240+SorraTheOrc@users.noreply.github.com>
…te slot-finding logic Co-authored-by: SorraTheOrc <250240+SorraTheOrc@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for branching and multi-level upgrades for business cards
feat(main-street): branching & multi-level upgrade chains for Business cards
Mar 10, 2026
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.
Business cards were capped at a single upgrade path with
maxLevel: 1. This adds branching upgrade choices (pick one of N paths) and multi-level chains (apply level-0 then level-1 upgrades sequentially).Schema changes (
MainStreetCards.ts)UpgradeCard.requiredLevel?: number— gates when an upgrade may be applied;0= base business (default),1= after first upgrade. Optional for backward compat.BusinessCard.appliedUpgrades?: string[]— ordered list of applied upgrade IDs; initialized to[]bymakeBusiness().maxLevelraised to2for Bakery, Diner, Cinema, Day Spa.requiredLevel: 1): Grand Bakehouse, Restaurant, Multiplex, Luxury Retreat.Market logic (
MainStreetMarket.ts)canPurchaseUpgradenow enforcesbusiness.level === (card.requiredLevel ?? 0).purchaseUpgraderecordscard.idintobusiness.appliedUpgradesand applies the same level match for explicittargetSlotpaths.findTargetBusinessSlot(state, card)— shared helper; used by both market logic and the UI to avoid duplicating the matching predicate.getUpgradeBranchesForBusiness(state, slotIndex)— returns all market upgrades valid for a given street slot; >1 result signals a branching choice.UI (
MainStreetScene.ts)onUpgradeCardClickcallsfindTargetBusinessSlotthen checksgetUpgradeBranchesForBusiness; when >1 branch exists it defers to a modal instead of applying immediately.showUpgradeChoiceModal(branches, targetSlot)— new full-screen Phaser overlay listing each branch as a button with name, cost, and stat deltas. Selecting a branch dispatches abuy-upgradeaction with the resolvedtargetSlot; Cancel dismisses without side-effects.Tests (
tests/main-street/upgrades.test.ts)18 new tests covering:
requiredLevelallow/reject, state persistence (level,incomeBonus,synergyRangeBonus,appliedUpgrades), multi-level accumulation, branching detection, branch exclusion after one is taken, and real-pool template assertions (IMAX vs Drive-In trade-offs, Luxury RetreatrequiredLevel).Updated hardcoded template counts in
game-state.test.tsandexpanded-card-pool.test.ts(17 → 25 upgrade templates).Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.