Skip to content

Proposed fix drop zen in party#778

Open
nolt wants to merge 2 commits into
MUnique:masterfrom
nolt:zen-drop-party-fix
Open

Proposed fix drop zen in party#778
nolt wants to merge 2 commits into
MUnique:masterfrom
nolt:zen-drop-party-fix

Conversation

@nolt
Copy link
Copy Markdown
Contributor

@nolt nolt commented May 17, 2026

Party Zen Drop Fix

Problem

When a player killed a monster in a party, the zen (money) drop amount was
dramatically lower than when playing solo. With a high experience rate server,
a solo player could get ~1,000,000 zen per kill, while a party member would
only see ~3,000 zen. Additionally, the zen was not shared among party members.

Root Cause

The zen drop amount is calculated as gainedExperience + BaseMoneyDrop (7) in
DefaultDropGenerator.GenerateItemDropOrMoney. The gainedExperience value
comes from AttackableNpcBase.OnDeathAsync, which uses different formulas for
solo and party play:

Solo: player.AddExpAfterKillAsync()
→ baseExp * gameRate * personalRate * mapMultiplier * random

Party: party.DistributeExperienceAfterKillAsync()
→ baseExp * count * 1.05^(count-1) * mapMultiplier * random

The party formula does NOT include the game rate (e.g. 100x) or personal
experience rate bonuses, making the zen amount orders of magnitude smaller.

Changes

Three files modified on branch zen-drop-party-fix:

  1. src/GameLogic/Player.cs — new CalculateExpAfterKill() method
    Extracts the experience calculation logic from AddExpAfterKillAsync into
    a separate public method that returns the calculated value without applying
    it to the character. AddExpAfterKillAsync now calls this shared method.
    This avoids duplicating the experience formula when it's needed for other
    purposes (like zen calculation).

  2. src/GameLogic/NPC/AttackableNpcBase.csDropItemAsync()
    When the killer is in a party, uses player.CalculateExpAfterKill(this)
    to get the correct experience value for zen calculation instead of using
    the party-distributed value (which lacks game rate and personal bonuses).
    Also uses null-conditional access for Attributes instead of !.

  3. src/GameLogic/DroppedMoney.csTryPickUpByAsync()
    When a player in a party picks up money from the ground, it is now
    distributed equally among all eligible party members (same map, not in
    safezone). Solo pickup behavior is unchanged.

Result

  • Solo: 1,000,000 zen drops on the ground → picked up by one player → gets 1,000,000
  • Party of 2: 1,000,000 zen drops on the ground → picked up → each gets 500,000
  • Party of 5: 1,000,000 zen drops on the ground → picked up → each gets 200,000

@gemini-code-assist
Copy link
Copy Markdown

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 addresses a discrepancy in zen (money) drops between solo and party play. Previously, party members received significantly less money because the experience calculation used for drops excluded server-side experience rates. The changes normalize the experience calculation for money drops regardless of party status and introduce a fair distribution mechanism to split the dropped money among party members.

Highlights

  • Experience Calculation Consistency: Recalculated experience for money drops in party scenarios to include game rates and multipliers, ensuring consistency with solo play.
  • Party Money Distribution: Implemented logic to divide dropped zen among eligible party members on the same map, preventing an imbalance in money acquisition.
New Features

🧠 You can now enable Memory (public preview) 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 the 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 counterproductive. 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

@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 adjusts money and experience calculations for NPC drops when the killer is in a party, aiming to make party drops more consistent with solo play. However, several issues were identified: dividing physical money drops by party size penalizes groups since only one player can collect the item, and there is a potential NullReferenceException when accessing player attributes. Additionally, the experience calculation logic is duplicated from other classes and should be refactored into a shared utility to prevent future maintenance issues.

Comment thread src/GameLogic/NPC/AttackableNpcBase.cs Outdated
Comment thread src/GameLogic/NPC/AttackableNpcBase.cs Outdated
Comment thread src/GameLogic/NPC/AttackableNpcBase.cs Outdated
@nolt
Copy link
Copy Markdown
Contributor Author

nolt commented May 18, 2026

/gemini summary

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

This pull request addresses an imbalance in the game's economy where party members received significantly less zen (money) than solo players due to differences in how experience-based drops were calculated. By refactoring the experience calculation logic and updating the money pickup system, the changes ensure that zen drops are consistent with server rates and that wealth is distributed equitably among party members.

Highlights

  • Experience Calculation Refactoring: Extracted the experience calculation logic into a shared method, 'CalculateExpAfterKill', to eliminate code duplication and ensure consistency between experience gain and zen drop calculations.
  • Party Zen Drop Normalization: Updated the zen drop logic to use the solo experience formula for party members, ensuring that game rates and personal bonuses are correctly applied regardless of party status.
  • Fair Party Money Distribution: Implemented a new mechanism in 'DroppedMoney' that automatically splits picked-up zen among all eligible party members on the same map, replacing the previous single-player pickup behavior.
New Features

🧠 You can now enable Memory (public preview) 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.

Activity
  • The pull request was created by nolt.
  • Gemini Code Assist provided initial feedback regarding potential issues with party money distribution, null-safety, and code duplication.
  • The author addressed all feedback by refactoring the experience calculation, adding null-conditional access for attributes, and implementing a fair distribution logic for party money pickups.

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.

1 participant