Fix: Buffs & DotDamage - #245
Conversation
WalkthroughThe changes involve modifications to various classes and interfaces within the Maple2 server codebase, focusing on buff management, experience leveling, and damage calculations. Key updates include the addition of a statistics refresh during player level-ups, simplifications in the actor's target attack logic, the removal of the Changes
Sequence Diagram(s)sequenceDiagram
participant Player
participant ExperienceManager
participant Stats
Player->>ExperienceManager: LevelUp()
ExperienceManager->>Player: Update player conditions
ExperienceManager->>Stats: Refresh()
ExperienceManager->>Player: Send update request
Suggested reviewers
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (2)
Additional comments not posted (4)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (7)
- Maple2.Server.Game/Manager/ExperienceManager.cs (1 hunks)
- Maple2.Server.Game/Model/Field/Actor/Actor.cs (1 hunks)
- Maple2.Server.Game/Model/Field/Actor/IActor.cs (0 hunks)
- Maple2.Server.Game/Model/Field/Buff.cs (1 hunks)
- Maple2.Server.Game/Model/Skill/DotDamageRecord.cs (1 hunks)
- Maple2.Server.Game/Trigger/TriggerContext.Field.cs (1 hunks)
- Maple2.Server.Game/Trigger/TriggerContext.Npc.cs (1 hunks)
Files not reviewed due to no reviewable changes (1)
- Maple2.Server.Game/Model/Field/Actor/IActor.cs
Additional comments not posted (7)
Maple2.Server.Game/Model/Skill/DotDamageRecord.cs (2)
28-28: LGTM!The addition of the
Rateproperty to thePropertiesobject is a valid change and aligns with the provided list of alterations. The property is likely used in damage calculations or other game mechanics.
36-36: Verify the impact of the change on game balance and damage output.The change in the damage calculation logic, specifically the removal of the dependency on
dotDamage.Rateduring the accumulation ofhpAmount, may impact the overall damage output and game balance.Please ensure that the
DamageCalculator.CalculateDamagemethod accurately calculates the intended damage and that the change does not introduce any unintended consequences or imbalances in the game.To verify the impact of the change, consider the following:
- Review the implementation of the
DamageCalculator.CalculateDamagemethod to ensure it correctly calculates the damage based on the desired formula and factors.- Conduct thorough testing with various scenarios and edge cases to validate that the damage output aligns with the expected values and does not introduce any exploits or imbalances.
- Analyze the game balance implications of the change, considering factors such as player progression, enemy difficulty, and overall gameplay experience.
- If necessary, adjust the damage calculation formula or other game parameters to maintain the desired balance and gameplay experience.
Maple2.Server.Game/Model/Field/Actor/Actor.cs (1)
175-176: LGTM!The change simplifies the logic by removing the intermediate
castervariable and directly usingrecord.Casterin the condition check. This streamlines the code without altering the overall control flow.Maple2.Server.Game/Manager/ExperienceManager.cs (1)
179-180: LGTM!The addition of
session.Stats.Refresh()after updating the player's conditions for leveling up is a good practice. It ensures that the player's statistics are up-to-date before sending the update request to the player's information.Refreshing the player's statistics at this point is crucial for maintaining consistency in the game state and ensuring that any subsequent operations or calculations that rely on the player's current state have access to the most recent data.
Maple2.Server.Game/Model/Field/Buff.cs (1)
226-228: LGTM!The changes to the
ApplyDotBuffmethod look good. The updates to how buffs are added to theOwnerandCasterentities are consistent with the AI-generated summary and appear to be part of a larger refactoring effort to improve the buff management system. The changes are localized and do not appear to introduce any new issues.Maple2.Server.Game/Trigger/TriggerContext.Npc.cs (1)
249-249: LGTM! The change aligns the method behavior with its name and purpose.The modification in the
NpcsInBoxmethod to returnField.EnumerateNpcs()instead ofField.Mobs.ValueswhenboxIdsis empty or contains a zero is a positive change. It ensures that the method returns a collection of NPCs, which aligns with its name and expected behavior.This change appears to be a bug fix or correction, as the method name
NpcsInBoximplies it should return NPCs, not mobs. The rest of the method logic remains intact, filtering the returned collection based on the providedboxIds.Overall, this change improves the consistency and correctness of the method.
Maple2.Server.Game/Trigger/TriggerContext.Field.cs (1)
Line range hint
372-382: Verify theignorePlayerparameter usage across the codebase.The changes to the
RemoveBufffunction, including the parameter rename and logic inversion, look good. However, ensure that all code paths invoking this function have been updated to pass theignorePlayerparameter correctly to maintain the intended behavior.Run the following script to verify the parameter usage:
#!/bin/bash # Description: Verify all invocations of `RemoveBuff` pass the `ignorePlayer` parameter correctly. # Test: Search for the function usage. Expect: Only occurrences passing `ignorePlayer` as the 3rd argument. rg --type cs -A 5 $'RemoveBuff\('
Buffs: Now apply correctly from dots & triggers
Dot damage: Now applies the correct caster when calculating the damage.
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Refactor
Documentation