Refactor StallUpgradeManager architecture#160
Conversation
- Introduced StatScaler interface and specialized implementations for each stat type. - Replaced monolithic branching logic in calculateValue with a strategy pattern delegation. - Simplified applyUpgrade to handle stat normalization and level synchronization more efficiently. - Improved code maintainability and readability by separating scaling rules from core logic. - Updated fixes.md with refactoring record REF-010. 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. |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughStallUpgradeManager refactors stat-upgrade computation from iterative scaling logic into a declarative StatScaler abstraction. Seven concrete scaler implementations compute stat values, calculateValue delegates to the scaler map, applyUpgrade normalizes levels only across available stats and updates legendary naming rules, and a changelog entry documents the refactor. ChangesUpgrade Manager Refactor
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 unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Build Successful! 🚀Note: This link will be removed when the PR is closed. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ada3784e-13cf-46b5-bbe7-fbc38d5a056f
📒 Files selected for processing (2)
app/src/main/java/com/messark/hawker/utils/StallUpgradeManager.ktfixes.md
|
Normalize the legacy Damage alias for BAK_KUT_TEH before reading levels. getAvailableUpgradeStats() only returns "Boost" for StallType.BAK_KUT_TEH, so this pass never copies an existing legacy "Damage" level into "Boost". newLevel and the later getLevel() helper then read only "Boost", which resets persisted upgrade progress on the next apply. |
Good catch. I've updated the normalization pass to iterate over both the existing upgrade keys and the available stats. This ensures that legacy aliases (like 'Damage' for Bak Kut Teh) are correctly mapped to their canonical forms ('Boost') before the level is read, preventing progress resets. |
- Updated normalization pass in applyUpgrade to iterate over all existing upgrade keys.
- This ensures that legacy aliases (e.g., 'Damage' for BKT) are correctly mapped to canonical names ('Boost') even if not returned by getAvailableUpgradeStats.
- Prevents upgrade progress reset when applying new upgrades to legacy stalls.
- Verified with unit tests.
Co-authored-by: candour <4670475+candour@users.noreply.github.com>
Build Successful! 🚀Note: This link will be removed when the PR is closed. |
|
@coderabbitai resolve |
✅ Actions performedComments resolved and changes approved. |
|
@jules please rebase and fix merge conflicts |
This PR refactors
StallUpgradeManager.ktto replace a complex, branchingfoldloop with a declarative strategy-based architecture.Key improvements:
StatScalerinterface without modifying the core calculation engine.applyUpgradenow includes a clean normalization pass to ensure that aliased stats (e.g., "Grab Rate" vs "Rate") stay in sync, preventing legacy data bugs.Verified with the following test suites:
StallStatsTestMilestoneBoostTestAliasNormalizationTestLegendaryNamingTestPR created automatically by Jules for task 4147648448634557213 started by @candour
Summary by CodeRabbit