-
Notifications
You must be signed in to change notification settings - Fork 642
feat: Implement hyperbolic defense bonus and upgradability for Defens… #2296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
WalkthroughThe Config API's Changes
Sequence Diagram(s)sequenceDiagram
participant Attacker as Attack logic
participant Config as DefaultConfig
participant Unit as DefensePost unit
Attacker->>Unit: find defense post (dp)
Note over Unit: dp.unit.level() → level
Attacker->>Config: defensePostDefenseBonus(level)
Config-->>Attacker: numeric bonus (level-scaled)
Attacker->>Attacker: apply bonus in damage calculation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested labels
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (9)📓 Common learnings📚 Learning: 2025-08-29T16:16:11.309ZApplied to files:
📚 Learning: 2025-10-20T20:15:28.858ZApplied to files:
📚 Learning: 2025-08-23T07:48:19.060ZApplied to files:
📚 Learning: 2025-05-31T18:15:03.445ZApplied to files:
📚 Learning: 2025-10-27T09:47:26.395ZApplied to files:
📚 Learning: 2025-06-05T02:34:45.899ZApplied to files:
📚 Learning: 2025-10-08T17:14:49.369ZApplied to files:
📚 Learning: 2025-08-20T10:06:20.469ZApplied to files:
🧬 Code graph analysis (1)src/core/configuration/DefaultConfig.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (3)
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/core/configuration/DefaultConfig.ts (1)
310-312: Consider adding explanatory comments for the formula constants.The magic numbers reduce readability. Add a brief comment explaining the hyperbolic curve behavior and why these specific values were chosen.
Example:
defensePostDefenseBonus(level: number): number { + // Hyperbolic formula providing diminishing returns: + // Level 1: 5x defense, Level 2: ~8.3x, Level 3: 10x, Max (∞): 15x const baseValue = 5; const maxIncrease = 10; const k = 2; return baseValue + maxIncrease * ((level - 1) / (level - 1 + k)); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/core/configuration/Config.ts(1 hunks)src/core/configuration/DefaultConfig.ts(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/core/configuration/Config.ts (2)
src/core/game/UnitImpl.ts (1)
level(406-408)src/core/game/GameView.ts (1)
level(167-169)
src/core/configuration/DefaultConfig.ts (2)
src/core/game/UnitImpl.ts (1)
level(406-408)src/core/game/GameView.ts (1)
level(167-169)
🔇 Additional comments (2)
src/core/configuration/DefaultConfig.ts (1)
672-673: LGTM!The call site correctly passes the unit level to compute the dynamic defense bonus. The bonus is properly applied as a multiplier to the magnitude.
src/core/configuration/Config.ts (1)
154-154: All call sites verified and properly updated.The signature change has been correctly implemented. The only call site in the codebase (DefaultConfig.ts:672) already passes the
levelparameter viadp.unit.level(), matching the new interface requirement.
…e Posts
Description:
Added a new hyperbolic formula for defensePostDefenseBuff with diminishing returns and upgradability for defense posts.
Variables
Y = total defense bonus (constant)
X = level of defense post (constant)
B = base constant of level 1 defense post (constant)
M = asymptote of the function
K = changes steepness of the curve
Formula: Y = B + M * ((X - 1) / (X - 1 + K))
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
restart