Implement Milestone Boosts for Upgrades - #63
Conversation
- Updated `Stall.getUpgradeBenefit` in `GameModels.kt` to calculate and display cumulative benefits including 25% boosts at levels divisible by 10. - Modified `MainViewModel.upgradeStall` to apply a 25% boost to the total stat value when a milestone level (10, 20, 30...) is reached. - Implemented a 50ms floor for Fire Rate, ensuring that upgrades violating this floor are skipped in favor of other categories. - Added `MilestoneBoostTest.kt` to verify the logic. 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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughUpgrade selection now iterates a shuffled sequence of all three categories until one upgrade applies; Rate upgrades are skipped if they would reduce fire-rate below 50ms. Upgrade benefit computation changed to per-level accumulation with multiplicative spikes every 10 levels. New tests exercise milestone boosts and the 50ms constraint. Changes
Sequence DiagramsequenceDiagram
participant VM as MainViewModel
participant Repo as GameStateRepository
participant Stall as Stall Model
participant SR as StateRepository
VM->>SR: fetch current game state / stall
SR-->>VM: current stall & baseStall
VM->>VM: create shuffledCategories [0,1,2]
loop for each category in shuffledCategories
VM->>Stall: compute getUpgradeBenefit(category, newLevel, baseStall)
Stall-->>VM: benefit string + computed values
alt category == Rate
VM->>VM: compute potentialRate = currentRate - delta
alt potentialRate < 50ms
VM-->VM: skip (continue) to next category
else
VM->>VM: build updatedStall with new rate/level
VM->>Repo: save updatedStall, deduct gold
Repo-->>VM: persist confirmation
VM-->>VM: return (end)
end
else
VM->>VM: build updatedStall with new level/value
VM->>Repo: save updatedStall, deduct gold
Repo-->>VM: persist confirmation
VM-->>VM: return (end)
end
end
Note over VM,Repo: if none applied, state remains unchanged
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 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)
Comment |
Build Successful! 🚀Note: This link will be removed when the PR is closed. |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
app/src/main/java/com/messark/hawkerrush/MainViewModel.kt (1)
855-982: Extract the upgrade math into one shared calculator.The per-category formulas and milestone handling now live here and in
Stall.getUpgradeBenefit(). That duplication will drift on the next balance tweak and leave the displayed cumulative bonus out of sync with the applied stats. A sharedapplyUpgrade(...)/computeUpgradeResult(...)helper would keep both paths aligned.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8d5c917d-43ae-40ad-a057-962bd818d8e9
📒 Files selected for processing (3)
app/src/main/java/com/messark/hawkerrush/MainViewModel.ktapp/src/main/java/com/messark/hawkerrush/model/GameModels.ktapp/src/test/java/com/messark/hawkerrush/MilestoneBoostTest.kt
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Build Successful! 🚀Note: This link will be removed when the PR is closed. |
|
@coderabbitai resolve |
Build Successful! 🚀Note: This link will be removed when the PR is closed. |
✅ Actions performedComments resolved and changes approved. |
This change implements a "Milestone Boost" mechanic where every 10 levels an upgrade reaches, it receives an extra 25% boost to its total value. It also ensures the Fire Rate doesn't drop below 50ms and that the UI correctly displays these cumulative benefits.
PR created automatically by Jules for task 2673194256689265103 started by @candour
Summary by CodeRabbit
New Features
Improvements
Tests