Am I understanding RandomEncounters.cs correctly?
Posted: Tue Jan 24, 2023 12:02 am
I see there has been discussion of this topic in the past, but not quite my particular area of concern.
First off, I'm not entirely clear on whether this is the "classic" mode or the "alternate."
Regardless of which it is, here's how I understand it:
A dice roll is made from 1-100. A roll of 1-80 results in picking from the encounter table slots equal to the player level -3 to the player level +3, a range of six slots.
A roll of 81-95 means picking from slot 0 to a slot equal to the player level +1. And a roll of 96-100 uses the entire table after Level 5. Essentially, particularly at higher levels, it is much more random and the two special results combined allow the player to encounter enemies from below their normal range that otherwise no longer spawn, and there is a roughly 20% chance of this occurring.
The problem, as I see it, is in the code for for the 81-95 range. At Level 18, the code will set the minimum to 0 and the maximum to 19, creating the same result as if a 96 or higher had been rolled. But at Level 19, this will set the maximum to 20. And later in the code on lines 1508-1512, this means the maximum will be adjusted back to 19. All well and good, but then on line 1510 the minimum is ALSO changed, to 14. In other words starting at Level 19, a player's chance of seeing the full encounter list is reduced from 20% to 5%.
Do I have this right and if so, is this intentional?
(Either way I'm not clear on whether this calculation is made on a per enemy/encounter basis or per dungeon/area.)
First off, I'm not entirely clear on whether this is the "classic" mode or the "alternate."
Regardless of which it is, here's how I understand it:
A dice roll is made from 1-100. A roll of 1-80 results in picking from the encounter table slots equal to the player level -3 to the player level +3, a range of six slots.
A roll of 81-95 means picking from slot 0 to a slot equal to the player level +1. And a roll of 96-100 uses the entire table after Level 5. Essentially, particularly at higher levels, it is much more random and the two special results combined allow the player to encounter enemies from below their normal range that otherwise no longer spawn, and there is a roughly 20% chance of this occurring.
The problem, as I see it, is in the code for for the 81-95 range. At Level 18, the code will set the minimum to 0 and the maximum to 19, creating the same result as if a 96 or higher had been rolled. But at Level 19, this will set the maximum to 20. And later in the code on lines 1508-1512, this means the maximum will be adjusted back to 19. All well and good, but then on line 1510 the minimum is ALSO changed, to 14. In other words starting at Level 19, a player's chance of seeing the full encounter list is reduced from 20% to 5%.
Do I have this right and if so, is this intentional?
(Either way I'm not clear on whether this calculation is made on a per enemy/encounter basis or per dungeon/area.)