Open
Conversation
The probability was very slightly off when calculating drop chances, and there was an error in instances where the maximum number of items dropped was greater than 1.
Clean slate scrolls could not be used on equips with 0 slots remaining. Additionally, using a scroll with legendary spirit on an equip with 0 slots remaining would freeze the legendary spirit window. This fixes both issues by adding an isCleanSlate check and sending a different packet in the legendary spirit case (the player will still need to dispose after).
This reverts commit b9f47ff.
ronancpl
approved these changes
Jul 26, 2025
ronancpl
left a comment
There was a problem hiding this comment.
Didn't review the test case, but the logic behind the mob, meso and drop rate fixes attests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The probability was very slightly off when calculating drop chances. The previous code generated a random integer between 0 (inclusive) and 999,999 (exclusive), when both bounds should have been inclusive. This is based on the assumption that a drop chance of 100,000 should correspond to 10%. Previously there were 999,999 possible values that could be generated (all of the integers from 0 to 999,998), and 100,000 of them were less than 100,000 (all of the integers from 0 to 99,999), so since every integer is equally likely to be generated this gave a 100,000 / 999,999 probability of dropping the item, which is very slightly more than 0.1. This difference is small enough to be negligible, which is probably why it wasn't caught. Increasing the upper bound of the randomly generated number by 1 fixes this.
Additionally, the code which determined the quantity of items dropped when the maximum quantity was greater than 1 always gave a number less than the maximum, and didn't work at all if the max and min were equal. Adding 1 to the bound of the randomly generated number fixes this as well, as shown by the unit test. Also removed the de.Maximum != 1 check since this is not necessary with the fix.
Checklist before requesting a review