Skip to content

drop rate fixes#287

Open
pimittens wants to merge 3 commits intoP0nk:masterfrom
pimittens:vanillafixes
Open

drop rate fixes#287
pimittens wants to merge 3 commits intoP0nk:masterfrom
pimittens:vanillafixes

Conversation

@pimittens
Copy link

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

  • [ x] I have performed a self-review of my code
  • [x ] I have tested my changes
  • [x ] I have added unit tests that prove my changes work

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).
Copy link

@ronancpl ronancpl left a comment

Choose a reason for hiding this comment

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

Didn't review the test case, but the logic behind the mob, meso and drop rate fixes attests.

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.

3 participants