Skip to content

Implement Kitchelin Star Action System - #104

Merged
candour merged 3 commits into
mainfrom
kitchelin-star-actions-17123944143120363792
Apr 30, 2026
Merged

Implement Kitchelin Star Action System#104
candour merged 3 commits into
mainfrom
kitchelin-star-actions-17123944143120363792

Conversation

@candour

@candour candour commented Apr 30, 2026

Copy link
Copy Markdown
Owner

This PR implements the new Kitchelin Star action system as requested.

Changes:

  • Star Action Selection: Clicking Kitchelin Stars between waves now opens a selection overlay.
  • Budget Bonus: Users can spend a star for a 10% bonus on gold earned from feeding customers, awarded at wave-end. This bonus is stackable.
  • Free Specific Upgrade: Users can spend a star to make their next specific upgrade free and bypass the wave-shutdown (renovation) penalty.
  • Removal of Old Logic: The previous passive 5% gold bonus per star has been removed.
  • UI/UX: Added a celebratory "+$X Star Bonus!" message at round completion and updated the Kitchelin Star tutorial.
  • Persistence: Free upgrades persist until used, and budget bonuses are tracked per-wave.
  • Tests: Added KitchelinBonusTest.kt to verify all new business logic.
  • Docs: Updated STALL_STATS.md with the new rules.

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

Summary by CodeRabbit

  • New Features

    • Interactive star action overlay to spend stars on stackable budget bonuses or a one-time free specific upgrade; tappable stars with haptic feedback
    • Post-wave animated bonus message showing bonus gold
    • Upgrade overlay shows “free specific upgrade” indicator and contextual tip to use stars
  • Documentation

    • Added guidance describing Kitchelin Stars, earning cadence, and spending options
  • Tests

    • Updated unit tests for star action mechanics, stacked budget bonuses, and free-upgrade flow

- Replaced the automatic 5% gold bonus per star with a manual selection system.
- Added Star Action Overlay to choose between a 10% Budget Bonus or a Free Specific Upgrade.
- Budget bonuses now stack and are awarded at the end of the round based on base rewards earned.
- Free Specific Upgrades now bypass both gold cost and renovation time.
- Updated documentation and added unit tests for the new mechanics.

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

coderabbitai Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Refactors Kitchelin Star mechanics into a between-waves action flow: adds a StarActionOverlay, tracks per-wave gold and stacked budget bonuses, replaces per-kill star gold multipliers with post-wave budget bonuses or consumable free-specific-upgrade tokens, and surfaces a bonus gold message at wave end.

Changes

Cohort / File(s) Summary
Core game state & logic
app/src/main/java/com/messark/hawker/MainViewModel.kt, app/src/main/java/com/messark/hawker/model/GameModels.kt
Adds goldEarnedThisWave, activeBudgetBonuses, freeSpecificUpgrades, showStarActionOverlay, lastWaveBonusGold, showBonusMessage; removes per-kill star multiplier; computes/applies budget bonuses at wave end; adds public VM methods: openStarActionOverlay(), dismissStarActionOverlay(), chooseBudgetBonus(), chooseFreeUpgrade().
UI integration & new overlay
app/src/main/java/com/messark/hawker/MainActivity.kt, app/src/main/java/com/messark/hawker/ui/components/StarActionOverlay.kt, app/src/main/java/com/messark/hawker/ui/components/UpgradeOverlay.kt
Makes Kitchelin stars tappable between waves, triggers haptics and opens StarActionOverlay; adds StarActionOverlay and StarActionButton composables; UpgradeOverlay gains freeUpgradeCount param and updated messaging/cost display and tip text.
Tests
app/src/test/java/com/messark/hawker/KitchelinBonusTest.kt
Updates tests to drive new action-based API (chooseBudgetBonus, chooseFreeUpgrade) and assert stacking, delayed budget application at wave end, free-upgrade consumption, and state resets.
Docs
AGENTS.md
Adds documentation describing Kitchelin Stars cadence, the two between-wave spending options, and the player interaction point (star icons).

Sequence Diagram

sequenceDiagram
    participant Player as Player
    participant UI as MainActivity
    participant Overlay as StarActionOverlay
    participant VM as MainViewModel
    participant State as GameState

    Player->>UI: Tap Kitchelin stars (between waves)
    UI->>UI: Trigger haptics (onTriggerHaptic)
    UI->>VM: openStarActionOverlay()
    VM->>State: showStarActionOverlay = true
    State-->>UI: Recompose (overlay visible)
    UI->>Overlay: Render with kitchelinStars & actions

    Player->>Overlay: Select Budget Bonus / Free Upgrade
    Overlay->>Overlay: Trigger haptics

    alt Budget Bonus
        Overlay->>VM: chooseBudgetBonus()
        VM->>State: activeBudgetBonuses++, kitchelinStars--
    else Free Specific Upgrade
        Overlay->>VM: chooseFreeUpgrade()
        VM->>State: freeSpecificUpgrades++, kitchelinStars--
    end

    Overlay->>VM: onDismiss()
    VM->>State: showStarActionOverlay = false
    State-->>UI: Recompose (overlay hidden)

    Note right of VM: On wave end, VM computes bonus = f(goldEarnedThisWave, activeBudgetBonuses), updates gold and lastWaveBonusGold, clears activeBudgetBonuses, sets showBonusMessage (auto-hide after timeout)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% 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 clearly summarizes the main change: implementation of an interactive Kitchelin Star system with action selection overlays.
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 kitchelin-star-actions-17123944143120363792

Review rate limit: 2/3 reviews remaining, refill in 20 minutes.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

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

73-79: ⚡ Quick win

Use a theme token for the free-upgrade notice.

Color(0xFF4CAF50) hardcodes the new success state, so this text can drift from the app’s light/dark palette. Prefer a MaterialTheme.colorScheme color here instead.

As per coding guidelines, "Avoid hardcoding colors in UI components; always prefer MaterialTheme.colorScheme (onSurface, surface, primary) to support light and dark themes".


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 64b22f13-ba24-4e25-9f14-dbd9f27cd183

📥 Commits

Reviewing files that changed from the base of the PR and between 04adced and f0e20b1.

📒 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/StarActionOverlay.kt
  • app/src/main/java/com/messark/hawker/ui/components/UpgradeOverlay.kt
  • app/src/test/java/com/messark/hawker/KitchelinBonusTest.kt

Comment thread app/src/main/java/com/messark/hawker/MainViewModel.kt
Comment thread app/src/test/java/com/messark/hawker/KitchelinBonusTest.kt
- Manual action selection (Budget Bonus or Free Specific Upgrade).
- Removal of old 5% gold bonus.
- Stackable 10% round-end budget bonus.
- Free Specific Upgrades with no renovation time.
- Full UI implementation (Overlays, Star clicks, Messages).
- Updated AGENTS.md and STALL_STATS.md.
- Comprehensive unit tests in KitchelinBonusTest.kt.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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/MainViewModel.kt (1)

361-365: ⚡ Quick win

Make bonus-message auto-hide resilient to overlapping timers.

At Lines [361-365], each bonus spawns a new delayed coroutine; an older timer can hide a newer bonus message early. Keep a single cancellable hide job.

Suggested patch
@@
-    private var lastHapticTimeMs = 0L
+    private var lastHapticTimeMs = 0L
+    private var bonusMessageHideJob: Job? = null
@@
-        if (bonusAwardedOutside > 0) {
-            viewModelScope.launch {
-                delay(3000)
-                _gameState.update { it.copy(showBonusMessage = false) }
-            }
-        }
+        if (bonusAwardedOutside > 0) {
+            bonusMessageHideJob?.cancel()
+            bonusMessageHideJob = viewModelScope.launch {
+                delay(3000)
+                _gameState.update { it.copy(showBonusMessage = false) }
+            }
+        }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 24fce5fd-6712-47fe-97cd-bae6035750de

📥 Commits

Reviewing files that changed from the base of the PR and between f0e20b1 and 13383d3.

📒 Files selected for processing (2)
  • AGENTS.md
  • app/src/main/java/com/messark/hawker/MainViewModel.kt

Comment thread app/src/main/java/com/messark/hawker/MainViewModel.kt
- Replaced passive gold bonus with manual Star Action selection.
- Added Budget Bonus (10% end-of-round bonus, stackable).
- Added Free Specific Upgrade (costs $0, no renovation, stackable Int counter).
- Added Star Action Overlay and updated Upgrade Overlay UI.
- Removed old 5% gold bonus logic.
- Updated documentation and added unit tests in KitchelinBonusTest.kt.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

653-690: 💤 Low value

Consider using theme colors for better dark/light mode support.

The bonus message uses hardcoded Color.Yellow for the text and star icons. Per coding guidelines, prefer MaterialTheme.colorScheme tokens for theme consistency. However, yellow stars are a strong visual identity element, so this may be intentional.

If you want to keep the yellow branding while respecting themes, consider defining a custom color in your theme that maps to yellow.

app/src/main/java/com/messark/hawker/ui/components/UpgradeOverlay.kt (1)

73-97: 💤 Low value

Consider using a semantic color for the success message.

Line 76 uses a hardcoded green Color(0xFF4CAF50). While Material3's colorScheme doesn't include a built-in success color, consider defining one in your theme for consistency. The MaterialTheme.colorScheme.error usage on line 84 is good practice.

That said, this is a minor consistency concern and the current implementation is functionally correct.

app/src/main/java/com/messark/hawker/MainViewModel.kt (1)

361-366: 💤 Low value

Auto-hide coroutine is acceptable but could accumulate if waves complete rapidly.

If multiple waves complete in quick succession (unlikely in normal gameplay), multiple coroutines would be launched. Since setting showBonusMessage = false is idempotent, this won't cause functional issues, but the extra coroutines are wasteful. Consider cancelling any previous hide-coroutine or using a Job reference.

This is a very minor edge case that's unlikely to occur in practice.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 03832601-887b-47b9-8f6e-6b3282898552

📥 Commits

Reviewing files that changed from the base of the PR and between 13383d3 and 34c325b.

📒 Files selected for processing (5)
  • 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/UpgradeOverlay.kt
  • app/src/test/java/com/messark/hawker/KitchelinBonusTest.kt

@candour
candour enabled auto-merge (squash) April 30, 2026 04:53
@candour

candour commented Apr 30, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resolve

@candour
candour merged commit 83bb20e into main Apr 30, 2026
3 checks passed
@coderabbitai

coderabbitai Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Comments resolved and changes approved.

@candour
candour deleted the kitchelin-star-actions-17123944143120363792 branch April 30, 2026 04:54
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