Force generator updates - C/SL/O and mixed weight class handling #6394
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.
There are three updates in this PR.
First is a minor tweak to whether the C/SL/O (Clan/Star League/Omni) percentages are used to adjust weights in the RAT table. The previous update had some bad logic with role checking. Now it simply skips the adjustment if any roles are used, on the basis that specific force types are probably not going to conform and trying to force them are more likely to generate off-kilter results.
Second is applying a similar gate/filter to the weight class proportion adjustment. Previously, when more than one weight class was used to generate the RAT it would adjust the random selection weights by weight classes using faction data. Fine for combat units, although they are almost always generated with a single weight class and would skip this part anyways. For other units such as non-combat/civilian, which are generated across all weight classes due to limited numbers, this unnecessarily distorts the table values. The weight balancing now includes similar filters to the C/SL/O adjustments where it is only performed on Meks, vehicles, and aerospace (no infantry, DropShips/large craft, etc.), and only when no roles are used.
Third is a minor adjustment in how C/SL/O percentages are read from faction data. Previously they incorporated a fallback, automatically using Mek data if vehicle or aerospace data was not provided. With few (if any) Clan vehicles or aerospace fighters made available to IS factions, these unit types will never have the same proportions as Mek forces causing significant changes as it attempted to change ratios to values that could not be met. Now with the fallback removed, if there is no specific vehicle or aerospace C/SL/O rating provided when processing those units types it leaves the availability values as they are.