Skip to content

Conversation

@glinesbdev
Copy link
Contributor

@glinesbdev glinesbdev commented Jan 15, 2026

Maple2.Server.Game/Manager/BuffManager.cs

The main change is the || compulsion.SkillIds.Length == 0 addition to the Where filter. Some skills which can buff all other skills, like the Assassin's Fatal Strikes (10800041). Because the player will have a CritChance compulsion applied to them, but it doesn't affect any particular skill IDs, if the compulsion doesn't have any skill IDs, then it's being interpreted as "this applies to all skills while active".

Maple2.Server.Game/Util/DamageCalculator.cs

This change is just to simplify the logic around applying critical damage.

Summary by CodeRabbit

  • Bug Fixes
    • Compulsion rate aggregations for skills now include additional compulsion events when calculating total rates, improving accuracy of skill-based effects.
    • Critical-damage determination logic streamlined, ensuring consistent and more efficient critical hit calculations.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 15, 2026

Walkthrough

Buff aggregation and critical-hit logic were adjusted: BuffManager's TotalCompulsionRate now includes compulsion entries with empty SkillIds when computing a skill's compulsion rate; DamageCalculator simplifies and reorders critical-determination and crit-rate override checks, reducing nesting.

Changes

Cohort / File(s) Summary
Damage & Buff System
Maple2.Server.Game/Manager/BuffManager.cs, Maple2.Server.Game/Util/DamageCalculator.cs
BuffManager: TotalCompulsionRate now includes compulsion events with empty SkillIds (Length == 0) in addition to explicit matches when computing rates. DamageCalculator: merged nested crit-checks into a single conditional and introduced critChanceOverrideRate to apply crit-rate overrides when damageType is not already Critical; control flow simplified.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • Zintixx

Poem

🐰 I hopped through lines of branch and tree,

counted compulsions both empty and free;
merged a nest of checks into one neat beat,
now crits and buffs dance light on their feet.

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Adjust compulsion buff effect' accurately reflects the main change: modifying how compulsion buffs are applied by including zero-length SkillIds and simplifying critical damage logic.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 15dcefa and 2d0bfe9.

📒 Files selected for processing (1)
  • Maple2.Server.Game/Util/DamageCalculator.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • Maple2.Server.Game/Util/DamageCalculator.cs
⏰ 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). (2)
  • GitHub Check: build
  • GitHub Check: build

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@Maple2.Server.Game/Util/DamageCalculator.cs`:
- Around line 77-83: The logic currently calls caster.Stats.GetCriticalRate even
when property.CanCrit is false; change the flow in DamageCalculator so
GetCriticalRate is only invoked if CanCrit is true (i.e., keep the
CompulsionTypes check and, if that fails, call caster.Stats.GetCriticalRate only
when property.CanCrit is true), ensuring DamageType only becomes Critical when
CanCrit is true; reference the existing symbols property.CanCrit,
property.CompulsionTypes, DamageType, and caster.Stats.GetCriticalRate (and
BuffCompulsionEventType.CritChanceOverride) to locate and wrap/move the
GetCriticalRate call accordingly.
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1882c32 and 15dcefa.

📒 Files selected for processing (2)
  • Maple2.Server.Game/Manager/BuffManager.cs
  • Maple2.Server.Game/Util/DamageCalculator.cs
🧰 Additional context used
🧬 Code graph analysis (1)
Maple2.Server.Game/Util/DamageCalculator.cs (5)
Maple2.Server.Game/Manager/StatsManager.cs (1)
  • DamageType (103-111)
Maple2.Server.Game/Model/Stats.cs (4)
  • Stats (8-165)
  • Stats (17-33)
  • Stats (35-41)
  • Total (116-126)
Maple2.File.Ingest/Utils/AttributeExtensions.cs (1)
  • BasicAttribute (6-44)
Maple2.Server.Core/Formulas/BaseStat.cs (1)
  • CriticalEvasion (274-274)
Maple2.Server.Game/Manager/BuffManager.cs (1)
  • TotalCompulsionRate (301-308)
⏰ 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). (2)
  • GitHub Check: build
  • GitHub Check: build
🔇 Additional comments (1)
Maple2.Server.Game/Manager/BuffManager.cs (1)

301-308: LGTM!

The logic correctly treats compulsions with empty SkillIds arrays as global compulsions that apply to all skills. This addresses the Assassin's Fatal Strikes case mentioned in the PR where buffs should apply to all skills when no specific SkillIds are listed.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@Zintixx Zintixx merged commit 523420e into MS2Community:master Jan 15, 2026
4 checks passed
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.

2 participants