-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clamp OpFor Unit Rating within FM:M Bounds #3914
Conversation
AddendumIt's worth noting that there may well be other instances of unbounded Unit Rating causing issues, these were just the ones I found. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3914 +/- ##
=========================================
Coverage 10.60% 10.60%
Complexity 5487 5487
=========================================
Files 836 836
Lines 114266 114270 +4
Branches 17182 17182
=========================================
+ Hits 12121 12122 +1
- Misses 100935 100938 +3
Partials 1210 1210 ☔ View full report in Codecov by Sentry. |
@@ -173,8 +175,9 @@ public Map<UUID, TargetRoll> calculateTargetNumbers(final @Nullable AtBContract | |||
} | |||
|
|||
TargetRoll target = new TargetRoll(3, "Target"); | |||
target.addModifier(p.getExperienceLevel(campaign, false) - campaign.getUnitRatingMod(), | |||
"Experience"); | |||
target.addModifier(p.getExperienceLevel(campaign, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I would suggest instead is to modify the "getUnitRatingMod" function, so that instead of changing six files you're only changing one. And it also guarantees that you don't miss any other usages of that function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current Implementation
Currently, CamOps Unit Rating is uncapped. AtB relies on Unit Rating to generate TN modifiers to a number of different functions.
Problem
With CamOps being uncapped there is no upper or lower boundary to the modifiers it can create undesirable effects. Such as...
Solution
Using
MathUtility.clamp()
I have boundUnitRating
so fit within the lower/upper bounds of the FM:M Dragoon Rating System (F-A*). This is only limited to the above instances, so things likeUnit Report
are unaffected.All issues listed under 'Problems' have been closed by this PR.
Credit
Credit for this solution goes to https://github.com/SuperStucco. All I did was go through the code to find other examples of where this was a problem, and applied their fix where appropriate.
Closes
Closes #3729
Closes #3817
Closes #3753