Materials Roll Individually For Direct Attacks #55405
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.
Summary
None
Purpose of change
Materials on armor didn't work exactly how people thought but wanted to use it in PR's like #55316, where the desired outcome is materials may overlap, protect with only 1, or protect with none. Before the material roll was fixed for all materials so if you had two 80% materials you always got both or none, never that middle ground chance.
This fixes that.
Describe the solution
Made it so passing a negative value for roll to the relevant call stack makes it roll a chance per material at the lowest level.
So for UI and such you can still pass a fixed material roll (including 0 for legacy calcs).
Added a unit test for this stuff.
Describe alternatives you've considered
Testing
Added a unit test specifically testing for this. Using a large number of materials to minimize variance.
Additional context
This should effect basically no balance since almost no items are made of 2+ non 100% proportional coverage materials.