Skip to content
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

Clamped Unit Rating Mod for CamOps (redux) #3933

Merged
merged 3 commits into from
Apr 6, 2024

Conversation

IllianiCBT
Copy link
Collaborator

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 which can create undesirable effects. Such as...

  • Only generating Relief missions
  • Making Retirement checks impossible to pass/fail.
  • Making Ship Search checks impossible to pass/fail.
  • Influencing what large craft are found, through the Ship Search.
  • Influencing the arrival/departure of Dependents.
  • Influencing enemy Morale Checks, causing enemy morale to snowball towards Invincible/Rout.
  • Influencing part availability, during contracts. Potentially making the availability of parts much easier/harder than intended.
  • Influencing where units are placed, after scenarios (Field Repair, Repair Bay, etc).
  • Influencing the hiring hall, making better pilots more/less common than intended.

Solution

Using MathUtility.clamp() I have bound UnitRating 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 like Unit 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 edit the getUnitRatingMod to ensure it applied to all uses of getUnitRatingMod. This approach was suggested by Nick and replaces my earlier approach of editing on a case-by-case basis.

Closes

Closes #3729
Closes #3817
Closes #3753

Copy link

codecov bot commented Mar 31, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 10.65%. Comparing base (2676968) to head (ef0ff24).
Report is 2 commits behind head on master.

Files Patch % Lines
MekHQ/src/mekhq/campaign/Campaign.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #3933   +/-   ##
=========================================
  Coverage     10.65%   10.65%           
  Complexity     5528     5528           
=========================================
  Files           836      836           
  Lines        114275   114275           
  Branches      17185    17185           
=========================================
  Hits          12176    12176           
  Misses       100871   100871           
  Partials       1228     1228           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@Sleet01 Sleet01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@HammerGS HammerGS merged commit 5590876 into MegaMek:master Apr 6, 2024
5 of 6 checks passed
HammerGS added a commit that referenced this pull request Apr 6, 2024
+ PR #3922: Add missing cockpit costs and weights
+ PR #3944: Added Nag Dialog for Pregnant Combatants
+ Fix #3943: Unmaintained Unit Nag Dialog Suppressed for Units set to
Salvage
+ PR #3933: Fixes for #3729,#3817,#3753: Clamped Unit Rating Mod for
CamOps (redux)
+ PR #3923: Hide Toughness When 0
+ PR #3915: Added Dialog to Confirm New Campaign (redux)
+ PR #3908: Adjusted Default Tech Counts
+ PR #3967: Adjusted Zoom Speed on Interstellar Map Panel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment