pokerogue icon indicating copy to clipboard operation
pokerogue copied to clipboard

[Bug] Fix off-by-one error in some random number calls

Open DayKev opened this issue 6 months ago • 0 comments

Still a couple questions left.

What are the changes the user will see?

Confusion will last 2-5 turns now instead of 2-4, trapping moves like Fire Spin will last 4-5 turns now instead of only 4, etc. Basically, every move/effect that had a min-max turn range will actually last between the minimum and maximum amount of turns now instead of between min and max - 1. Also fixes a bug where a move with 99 accuracy couldn't miss, as if it had 100 accuracy.

Why am I making these changes?

There was some usage of the random number functions that was incorrect.

What are the changes from a developer perspective?

Some instances of randSeedInt(range, min) are replaced with randSeedIntRange(min, max) when they were intended to be random between min and max inclusive and min was a number greater than zero.

How to test the changes?

Liberal use of the browser devtools console and console.log().

Checklist

  • [x] I'm using beta as my base branch
  • [x] There is no overlap with another PR?
  • [x] The PR is self-contained and cannot be split into smaller PRs?
  • [x] Have I provided a clear explanation of the changes?
  • ~[ ] Have I considered writing automated tests for the issue?~
  • ~[ ] If I have text, did I add placeholders for them in locales?~
  • [x] Have I tested the changes (manually)?
    • [x] Are all unit tests still passing? (npm run test)
  • ~[ ] Are the changes visual?~
    • ~[ ] Have I provided screenshots/videos of the changes?~

DayKev avatar Aug 20 '24 13:08 DayKev