Implement Kitchelin Star Action System - #104
Conversation
- 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>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
📝 WalkthroughWalkthroughRefactors 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
Sequence DiagramsequenceDiagram
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)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 2/3 reviews remaining, refill in 20 minutes. Comment |
Build Successful! 🚀Note: This link will be removed when the PR is closed. |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
app/src/main/java/com/messark/hawker/ui/components/UpgradeOverlay.kt (1)
73-79: ⚡ Quick winUse 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 aMaterialTheme.colorSchemecolor 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
📒 Files selected for processing (6)
app/src/main/java/com/messark/hawker/MainActivity.ktapp/src/main/java/com/messark/hawker/MainViewModel.ktapp/src/main/java/com/messark/hawker/model/GameModels.ktapp/src/main/java/com/messark/hawker/ui/components/StarActionOverlay.ktapp/src/main/java/com/messark/hawker/ui/components/UpgradeOverlay.ktapp/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>
Build Successful! 🚀Note: This link will be removed when the PR is closed. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app/src/main/java/com/messark/hawker/MainViewModel.kt (1)
361-365: ⚡ Quick winMake 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
📒 Files selected for processing (2)
AGENTS.mdapp/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>
Build Successful! 🚀Note: This link will be removed when the PR is closed. |
There was a problem hiding this comment.
🧹 Nitpick comments (3)
app/src/main/java/com/messark/hawker/MainActivity.kt (1)
653-690: 💤 Low valueConsider using theme colors for better dark/light mode support.
The bonus message uses hardcoded
Color.Yellowfor the text and star icons. Per coding guidelines, preferMaterialTheme.colorSchemetokens 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 valueConsider using a semantic color for the success message.
Line 76 uses a hardcoded green
Color(0xFF4CAF50). While Material3'scolorSchemedoesn't include a built-in success color, consider defining one in your theme for consistency. TheMaterialTheme.colorScheme.errorusage 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 valueAuto-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 = falseis idempotent, this won't cause functional issues, but the extra coroutines are wasteful. Consider cancelling any previous hide-coroutine or using aJobreference.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
📒 Files selected for processing (5)
app/src/main/java/com/messark/hawker/MainActivity.ktapp/src/main/java/com/messark/hawker/MainViewModel.ktapp/src/main/java/com/messark/hawker/model/GameModels.ktapp/src/main/java/com/messark/hawker/ui/components/UpgradeOverlay.ktapp/src/test/java/com/messark/hawker/KitchelinBonusTest.kt
|
@coderabbitai resolve |
✅ Actions performedComments resolved and changes approved. |
This PR implements the new Kitchelin Star action system as requested.
Changes:
KitchelinBonusTest.ktto verify all new business logic.STALL_STATS.mdwith the new rules.PR created automatically by Jules for task 17123944143120363792 started by @candour
Summary by CodeRabbit
New Features
Documentation
Tests