Fix some mod ranges being inverted #6549
Merged
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.
Fixes #6548
Description of the problem being solved:
#6056 introduced an error in cases where mods that scaled in a positive direction were inverted incorrectly, such as the shaper body armour mod for crit chance to spells. It used the value 1 to check for discontinuity between tiers, which works for almost all mods, but for mods with a step of less than 1 it caused issues.
Specifically, it inverted the ranges even for positive mods when the difference between minimum and maximum of different tiers was exactly 1, which for the mods in question applied since the first mod starts at 0.5 and the second ends at 1.5.
Optimally we'd somehow fetch the step value, but I don't have the time or energy to delve into the stat descriptions right now. Looks like divide_by_one_hundred is how we'd find the step value though.
This adds a check to only invert the ranges if the values are integers.
One thing that the original PR never fixed was the tooltip for the slider itself. That's not fixed in this either, that's still incorrect on the flasks. The body armour mods work great though!
Steps taken to verify a working solution:
Link to a build that showcases this PR:
https://pobb.in/OliPnl0lAKej