Repository navigation
Conversation
Two problems in the per-source conversion step of CalcDefence: - When a source's ConvertTo* rates totalled more than 100%, the loop meant to scale them down used ipairs over a table keyed by target name, so it never ran. Global and Life/Mana conversions then converted more than 100% of the source. - The per-slot path reduced the source's slot base inside the target loop. Every target after the first with a non-zero rate took its share from an already reduced base, and the source was reduced once per target. This also happened below 100% total, and when one target came only from a GainAs rate. Iterate the rates with pairs, and reduce each slot base once after all targets have taken their share.
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.
Fixes #2570 .
Description of the problem being solved:
Two problems in the per-source conversion step of
calcs.defence:ipairsover a table keyed by target name, so it never ran. Global and Life/Mana conversions then handed out more than 100% of the source.This iterates the rates with
pairsand reduces each slot base once, after every target has taken its share. The global and total bases already worked that way.Steps taken to verify a working solution:
Added two specs to
spec/System/TestDefence_spec.lua:Both fail on
devand pass with this change.Ran every
spec/Systemspec inghcr.io/pathofbuildingcommunity/pathofbuilding-tests:latest, the same way CI does: 52 files, 905 tests, 0 failures.Loaded both builds from Defence conversion: rates above 100% aren't scaled down, and a second target reduces the source base twice #2570:
No parser changes, so
ModCache.luais unaffected.Link to a build that showcases this PR:
See the build codes in #2570.
Before screenshot:
After screenshot: