-
Notifications
You must be signed in to change notification settings - Fork 453
feat: money drop rate #661
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: master
Are you sure you want to change the base?
Conversation
Add MoneyDropRate configuration to allow independent control of money drops Adds a new MoneyDropRate property to GameConfiguration that acts as a multiplier for all money drops, allowing server administrators to balance money drops independently from the experience rate. Changes: - Add MoneyDropRate property to GameConfiguration (default: 1.0f) - Initialize MoneyDropRate in GameConfigurationInitializerBase - Update DefaultDropGenerator to apply MoneyDropRate multiplier to money drops - Store GameConfiguration reference in DefaultDropGenerator for access to rate This addresses the issue where increasing XP rate also increases money drops proportionally.
Summary of ChangesHello @5Miro, 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 addresses a common game balancing challenge by decoupling money drop rates from experience rates. It introduces a dedicated Highlights
Using Gemini Code AssistThe 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
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 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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a MoneyDropRate to allow server administrators to control money drops independently. The implementation is straightforward and correctly applies the new rate to money dropped from monsters. I've added one suggestion to make the calculation more robust against potential misconfiguration.
| return this.GenerateRandomItem((int)monster[Stats.Level], true); | ||
| case SpecialItemType.Money: | ||
| droppedMoney = (uint)(gainedExperience + BaseMoneyDrop); | ||
| droppedMoney = (uint)((gainedExperience + BaseMoneyDrop) * this._config.MoneyDropRate); |
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.
A negative MoneyDropRate could lead to undefined behavior when casting the resulting negative float to uint. It's safer to ensure the value is not negative before casting. This will prevent potential issues, such as dropping a very large amount of money due to how negative floats are converted to unsigned integers.
droppedMoney = (uint)Math.Max(0, (gainedExperience + BaseMoneyDrop) * this._config.MoneyDropRate);|
Hi, thanks for the PR. I'd like to implement this a bit different to be even more flexible for more options in the future. My idea is to add two collections to the /// <summary>
/// Gets or sets the attribute combinations.
/// </summary>
[MemberOfAggregate]
public virtual ICollection<AttributeRelationship> GlobalAttributeCombinations { get; protected set; } = null!;
/// <summary>
/// Gets or sets the base attribute values.
/// For example the amount of health a character got without any added stat point.
/// </summary>
[MemberOfAggregate]
public virtual ICollection<ConstValueAttribute> GlobalBaseAttributeValues { get; protected set; } = null!;The idea is to apply both globally, for all characters, no matter which character class. With that we can easily add a Do you think you can do that? 😅 |
Hi there! |
Add MoneyDropRate configuration to allow independent control of money drops
This addresses the issue where increasing XP rate also increases money drops proportionally.
Adds a new MoneyDropRate property to GameConfiguration that acts as a multiplier for all money drops, allowing server administrators to balance money drops independently from the experience rate.
Changes: