Skip to content

Kitchelin Stars and Manual Upgrade System#98

Merged
candour merged 2 commits into
mainfrom
feature/kitchelin-stars-upgrades-2981389049891829714
Apr 28, 2026
Merged

Kitchelin Stars and Manual Upgrade System#98
candour merged 2 commits into
mainfrom
feature/kitchelin-stars-upgrades-2981389049891829714

Conversation

@candour
Copy link
Copy Markdown
Owner

@candour candour commented Apr 28, 2026

I have implemented the Kitchelin Star currency and the manual upgrade system as requested.

Key Changes:

  • Kitchelin Stars: Users now earn a Kitchelin Star upon completion of every 10th wave. These stars are displayed in the top-left of the game screen (capped at 5 visible icons, but the internal count persists).
  • Manual Upgrade Overlay: When the game is between waves, clicking the upgrade button for a stall now opens an overlay. This overlay allows users to choose exactly which stat to upgrade (at double the normal cost) or perform a random upgrade as before.
  • Stall Shutdown & Star Consumption: Choosing a specific upgrade will disable the stall for the next active wave (indicated by an orange cone sprite). If the user has a Kitchelin Star, it is automatically consumed to keep the stall open. Disabled waves stack if multiple specific upgrades are bought for the same stall.
  • Persistence: The Kitchelin Star count is now saved and loaded via GameStateRepository, ensuring players don't lose their stars between sessions.
  • Visuals: Added the orange cone sprite to the game board for disabled stalls and the star icons for the new currency.

PR created automatically by Jules for task 2981389049891829714 started by @candour

Summary by CodeRabbit

  • New Features

    • Kitchelin Stars system: earn stars every 10 waves and spend them for upgrades.
    • Upgrade overlay: choose Random or Specific stat upgrades; specific upgrades cost more and may consume stars or apply temporary disable effects.
    • Stalls can be temporarily disabled, preventing them from firing while disabled.
  • Style

    • Top-left HUD shows up to 5 Kitchelin Stars.
    • Orange cone visual marks temporarily disabled stalls.

- Earn Kitchelin Stars every 10 waves.
- Display up to 5 stars in the top-left of the game screen.
- Added UpgradeOverlay for manual stall upgrades between waves.
- Specific upgrades cost 2x and disable the stall for one wave unless a star is used.
- Visualize disabled stalls with an orange cone sprite.
- Persist Kitchelin Star count in gamestate.json.

Co-authored-by: candour <4670475+candour@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

📝 Walkthrough

Walkthrough

Adds a between-wave upgrade overlay (random or specific stat upgrades) and a Kitchelin star system; stalls gain a disabledWaves counter that blocks firing and shows a cone FX; upgrades can consume stars or increase disabledWaves; persistence updated to store stars.

Changes

Cohort / File(s) Summary
Activity / HUD
app/src/main/java/com/messark/hawker/MainActivity.kt
Embeds GameBoard in a Box and overlays a top-left HUD showing up to 5 Kitchelin star icons driven by gameState.kitchelinStars; conditionally renders UpgradeOverlay when showUpgradeOverlay and a selected stall exist.
Upgrade UI
app/src/main/java/com/messark/hawker/ui/components/UpgradeOverlay.kt
New composable overlay presenting Random and Specific upgrade buttons, cost calculations (specific = double base), star-aware explanatory text, haptic triggers, and dismissal handling.
ViewModel / Upgrade Logic
app/src/main/java/com/messark/hawker/MainViewModel.kt
Refactors upgrade flow: upgradeStall() shows overlay when between waves or applies upgrade during waves; adds applyUpgrade, dismissUpgradeOverlay, upgradeStallRandomly, upgradeStallSpecifically; wave completion awards kitchelinStars every 10 waves and decrements disabledWaves for all stalls; specific upgrades cost double and may consume stars or increment disabledWaves.
Models & Persistence
app/src/main/java/com/messark/hawker/model/GameModels.kt, app/src/main/java/com/messark/hawker/utils/GameStateRepository.kt
Adds Stall.disabledWaves:Int, GameState.kitchelinStars:Int, GameState.showUpgradeOverlay:Boolean; persistence (PersistentGameState and save/load) updated to include kitchelinStars.
Rendering / FX
app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt, app/src/main/java/com/messark/hawker/ui/constants/SpriteConstants.kt
Renders an FX cone sprite over stalls when disabledWaves > 0; adds FX_CONE_RECT sprite bounds constant.

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as MainActivity / UpgradeOverlay
    participant VM as MainViewModel
    participant GS as GameState / Repo
    participant Board as GameBoard

    User->>UI: Open upgrade (select stall)
    UI->>VM: request upgrade (upgradeStall)
    alt waveActive == true
        VM->>VM: applyUpgrade(isSpecific=false/true)
        VM->>GS: mutate stall, gold, stars, disabledWaves
        VM->>Board: updated stall state (disabledWaves affects rendering)
        VM->>UI: close overlay
    else between-waves
        VM->>GS: set showUpgradeOverlay = true
        GS->>UI: render UpgradeOverlay with stall + gold + kitchelinStars
        User->>UI: click Random/Specific
        UI->>VM: onUpgradeRandom / onUpgradeSpecific(stat)
        VM->>VM: applyUpgrade(...)
        VM->>GS: persist changes (gold, stars, stall.disabledWaves)
        VM->>GS: set showUpgradeOverlay = false
        GS->>UI: dismiss overlay
    end
    Note over VM,GS: Wave completion path\n(every 10 waves -> kitchelinStars++, all stalls disabledWaves--)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the two main features added in this PR: Kitchelin Stars (a new currency system) and the Manual Upgrade System (stall upgrade overlay).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/kitchelin-stars-upgrades-2981389049891829714

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

Build Successful! 🚀

Download APK

Note: This link will be removed when the PR is closed.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/src/main/java/com/messark/hawker/MainViewModel.kt (1)

913-1168: ⚠️ Potential issue | 🟠 Major

Persist successful manual upgrades immediately.

applyUpgrade() now mutates persisted progression state between waves (gold, kitchelinStars, disabledWaves, upgrade levels, totalInvestment), but the only save in this file still happens on wave completion. If the app is backgrounded or killed after a manual upgrade and before the next wave ends, the player resumes from the pre-upgrade save and effectively rolls back the purchase. Save the updated GameState right after a successful between-wave upgrade.

Based on learnings, "Use GameStateRepository to manage gamestate.json via GSON for auto-saving after each wave".


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 58923aae-4f8e-4ffc-b78b-3625b0f8a74c

📥 Commits

Reviewing files that changed from the base of the PR and between be60f15 and b94ca87.

📒 Files selected for processing (6)
  • app/src/main/java/com/messark/hawker/MainActivity.kt
  • app/src/main/java/com/messark/hawker/MainViewModel.kt
  • app/src/main/java/com/messark/hawker/model/GameModels.kt
  • app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
  • app/src/main/java/com/messark/hawker/ui/components/UpgradeOverlay.kt
  • app/src/main/java/com/messark/hawker/utils/GameStateRepository.kt

Comment thread app/src/main/java/com/messark/hawker/MainActivity.kt
@candour candour enabled auto-merge (squash) April 28, 2026 02:59
@candour
Copy link
Copy Markdown
Owner Author

candour commented Apr 28, 2026

@jules please deal with the two PR comments

- Use Icons.Default.Star for Kitchelin Stars display to avoid issues with missing emoji support in the app's font/environment.
- Centralize orange cone sprite coordinates in SpriteConstants.

Co-authored-by: candour <4670475+candour@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

Build Successful! 🚀

Download APK

Note: This link will be removed when the PR is closed.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
app/src/main/java/com/messark/hawker/MainActivity.kt (1)

682-697: Derive a single canShowUpgradeOverlay guard.

Consider enforcing all UI preconditions (showUpgradeOverlay, selected stall exists, and wave inactive) in one derived boolean before rendering the overlay. It keeps the “between waves” invariant explicit at the UI boundary.

♻️ Suggested refactor
-            if (gameState.showUpgradeOverlay) {
-                gameState.selectedBoardStall?.let { coord ->
-                    gameState.hexes[coord]?.stall?.let { stall ->
-                        UpgradeOverlay(
-                            stall = stall,
-                            gold = gameState.gold,
-                            kitchelinStars = gameState.kitchelinStars,
-                            onUpgradeRandom = { viewModel.upgradeStallRandomly() },
-                            onUpgradeSpecific = { viewModel.upgradeStallSpecifically(it) },
-                            onDismiss = { viewModel.dismissUpgradeOverlay() },
-                            onTriggerHaptic = { viewModel.triggerHaptic() }
-                        )
-                    }
-                }
-            }
+            val selectedStall = gameState.selectedBoardStall?.let { coord -> gameState.hexes[coord]?.stall }
+            val canShowUpgradeOverlay =
+                gameState.showUpgradeOverlay && !gameState.waveActive && selectedStall != null
+
+            if (canShowUpgradeOverlay) {
+                UpgradeOverlay(
+                    stall = selectedStall!!,
+                    gold = gameState.gold,
+                    kitchelinStars = gameState.kitchelinStars,
+                    onUpgradeRandom = { viewModel.upgradeStallRandomly() },
+                    onUpgradeSpecific = { viewModel.upgradeStallSpecifically(it) },
+                    onDismiss = { viewModel.dismissUpgradeOverlay() },
+                    onTriggerHaptic = { viewModel.triggerHaptic() }
+                )
+            }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9270a2b3-675c-4aec-91d5-941dbb414bef

📥 Commits

Reviewing files that changed from the base of the PR and between b94ca87 and c5a5a15.

📒 Files selected for processing (3)
  • app/src/main/java/com/messark/hawker/MainActivity.kt
  • app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
  • app/src/main/java/com/messark/hawker/ui/constants/SpriteConstants.kt
✅ Files skipped from review due to trivial changes (1)
  • app/src/main/java/com/messark/hawker/ui/constants/SpriteConstants.kt

Comment thread app/src/main/java/com/messark/hawker/MainActivity.kt
@candour candour merged commit 100e4fb into main Apr 28, 2026
3 checks passed
@candour candour deleted the feature/kitchelin-stars-upgrades-2981389049891829714 branch April 28, 2026 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant