Skip to content

Implement Milestone Boosts for Upgrades - #63

Merged
candour merged 3 commits into
mainfrom
feature/milestone-boosts-2673194256689265103
Apr 21, 2026
Merged

Implement Milestone Boosts for Upgrades#63
candour merged 3 commits into
mainfrom
feature/milestone-boosts-2673194256689265103

Conversation

@candour

@candour candour commented Apr 21, 2026

Copy link
Copy Markdown
Owner

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

    • Milestone boost mechanics: stronger level-10 upgrade bonuses for stalls.
  • Improvements

    • Upgrade selection now tries all categories in randomized order until a valid upgrade applies.
    • Fire-rate upgrades enforce a 50ms minimum to avoid overly fast rates.
    • Upgrade benefit displays updated to reflect cumulative progression with periodic spikes.
  • Tests

    • Added tests validating milestone boosts, upgrade flow, and the 50ms fire-rate constraint.

- 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>
@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 21, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8dd46466-c545-4641-b18b-2e2b8ad0d7bb

📥 Commits

Reviewing files that changed from the base of the PR and between 84f5a97 and b19f8f2.

📒 Files selected for processing (1)
  • app/src/test/java/com/messark/hawkerrush/MilestoneBoostTest.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/test/java/com/messark/hawkerrush/MilestoneBoostTest.kt

📝 Walkthrough

Walkthrough

Upgrade 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

Cohort / File(s) Summary
Upgrade Selection & Application
app/src/main/java/com/messark/hawkerrush/MainViewModel.kt
Rewrote upgradeStall() to generate a shuffled list of categories and attempt each in order until an upgrade succeeds; removed previous single-random selection and triggeredCategory logic; performs early return after constructing and saving the updated stall; Rate upgrades explicitly skipped if resulting fire-rate < 50ms.
Upgrade Benefit Calculation
app/src/main/java/com/messark/hawkerrush/model/GameModels.kt
Changed Stall.getUpgradeBenefit(...) to iterative per-level accumulation, applying multiplicative spikes every 10 levels and clamping Rate reductions to a 50ms minimum; returns empty string for level <= 0 and adjusted formatting for Damage/Rate percentages and other absolute deltas.
Tests: Milestone & Rate Constraints
app/src/test/java/com/messark/hawkerrush/MilestoneBoostTest.kt
Added unit tests that validate cumulative milestone boost math for Damage (levels 9→10), verify MainViewModel upgrade behavior advancing Damage to level 10 and updating stall damage, and confirm Rate upgrades are skipped when the 50ms minimum would be breached.

Sequence Diagram

sequenceDiagram
    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
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 0.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 'Implement Milestone Boosts for Upgrades' directly describes the main feature added: a milestone boost mechanic that grants extra bonuses at level 10 intervals.
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/milestone-boosts-2673194256689265103

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: 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 shared applyUpgrade(...)/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

📥 Commits

Reviewing files that changed from the base of the PR and between 6ccca7b and 84f5a97.

📒 Files selected for processing (3)
  • app/src/main/java/com/messark/hawkerrush/MainViewModel.kt
  • app/src/main/java/com/messark/hawkerrush/model/GameModels.kt
  • app/src/test/java/com/messark/hawkerrush/MilestoneBoostTest.kt

Comment thread app/src/main/java/com/messark/hawkerrush/model/GameModels.kt
Comment thread app/src/test/java/com/messark/hawkerrush/MilestoneBoostTest.kt Outdated
Comment thread app/src/test/java/com/messark/hawkerrush/MilestoneBoostTest.kt Outdated
candour and others added 2 commits April 21, 2026 15:18
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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.

@candour

candour commented Apr 21, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resolve

@github-actions

Copy link
Copy Markdown

Build Successful! 🚀

Download APK

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

@coderabbitai

coderabbitai Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Comments resolved and changes approved.

@candour
candour merged commit 6ac1db0 into main Apr 21, 2026
3 checks passed
@candour
candour deleted the feature/milestone-boosts-2673194256689265103 branch April 21, 2026 07:22
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