Skip to content

feat(stats_calc): recalculate character stats based on master skills#300

Merged
sven-n merged 1 commit intosven-n:mainfrom
olisikh:feat/calc_master_skills_relogin
Mar 25, 2026
Merged

feat(stats_calc): recalculate character stats based on master skills#300
sven-n merged 1 commit intosven-n:mainfrom
olisikh:feat/calc_master_skills_relogin

Conversation

@olisikh
Copy link
Copy Markdown
Contributor

@olisikh olisikh commented Mar 22, 2026

  • recalculate character stats based on master skills (works after relogin too)
  • calculate defense success rate, both pvm and pvp and reflect it on character info pane
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the accuracy and display of character statistics within the game's UI. It introduces a robust mechanism to recalculate character attributes based on learned master skills, ensuring that these crucial values are correctly applied and presented to the player. The primary focus is on the precise calculation and visualization of defense success rates for different combat contexts, making the character information window more informative and reliable.

Highlights

  • Master Skill Stat Recalculation: Refactored the calculation of various character statistics (attack success rate, defense success rate, defense, magic damage) to correctly incorporate values from master skills. This ensures stats are accurate even after a relogin.
  • Defense Success Rate Calculation: Implemented a new system to calculate the defense success rate for both Player vs. Monster (PvM) and Player vs. Player (PvP) scenarios, based on master skills. This includes a clamping mechanism to ensure the multiplier is never below 1.0f.
  • Character Info Pane Update: The character information pane now accurately reflects the newly calculated defense success rates, providing players with up-to-date statistics.
  • Code Refactoring: Introduced a set of helper functions within an anonymous namespace to centralize and simplify the retrieval of master skill values and the clamping of defense success rate multipliers, improving code readability and maintainability.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the calculation of character stats from master skills, which is a great improvement in terms of readability, correctness, and efficiency. The introduction of helper functions in an anonymous namespace is a good approach. I've added a couple of suggestions to make the new helper functions even more concise and efficient.

Comment on lines +31 to +39
const auto firstSkillInfo = CharacterAttribute->MasterSkillInfo[firstSkill];
const auto secondSkillInfo = CharacterAttribute->MasterSkillInfo[secondSkill];

if (secondSkillInfo.GetSkillLevel() > firstSkillInfo.GetSkillLevel())
{
return secondSkillInfo.GetSkillValue();
}

return firstSkillInfo.GetSkillValue();
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.

medium

This function can be made more concise and efficient. Using const auto& avoids unnecessary copies of the skill info objects, and a ternary operator can simplify the logic.

 const auto& firstSkillInfo = CharacterAttribute->MasterSkillInfo[firstSkill]; const auto& secondSkillInfo = CharacterAttribute->MasterSkillInfo[secondSkill]; return (secondSkillInfo.GetSkillLevel() > firstSkillInfo.GetSkillLevel()) ? secondSkillInfo.GetSkillValue() : firstSkillInfo.GetSkillValue();
Comment on lines +54 to +59
if (multiplier < 1.0f)
{
return 1.0f;
}

return multiplier;
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.

medium

For better readability and conciseness, you can use std::max to implement this function. You'll need to include the <algorithm> header at the top of the file.

 return std::max(1.0f, multiplier);
@olisikh olisikh force-pushed the feat/calc_master_skills_relogin branch from ba99b73 to 64eff66 Compare March 24, 2026 16:22
@sven-n sven-n merged commit cf3cea8 into sven-n:main Mar 25, 2026
2 checks passed
@sven-n
Copy link
Copy Markdown
Owner

sven-n commented Mar 25, 2026

Thanks :)
I noticed that a lot of calculation of these values happen in the render methods - this could be optimized in the future 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants