8000 Refactored Medical Systems by IllianiBird · Pull Request #6707 · MegaMek/mekhq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Refactored Medical Systems #6707

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

Merged
merged 5 commits into from
Apr 26, 2025
Merged

Conversation

IllianiBird
Copy link
Collaborator
@IllianiBird IllianiBird commented Apr 19, 2025
  • Centralized medical logic into a new MedicalController class. Moving it out of Campaign.java.
  • Moved InjuryTypes, InjuryUtil, and related advanced medical files to a new package: mekhq.campaign.personnel.medical.advancedMedical.
  • Removed logic checks for impossible healing rolls that are no longer valid due to centralization.
  • Prevented invalid doctor assignments with strengthened validation.
  • Integrated SkillCheckUtility.java so that non-Advanced Medical healing checks now use the centralized skill check utility class.

Dev Notes

This PR also includes the changes made in #6706

- Moved `InjuryTypes`, `InjuryUtil`, and related advanced medical files to a new package: `mekhq.campaign.personnel.medical.advancedMedical`.
- Centralized medical logic into a new `MedicalController` class. Moving it out of `Campaign.java`.
- Removed logic checks for impossible healing rolls that are no longer valid due to centralization.
- Prevented unintentional doctor reassignments with strengthened validation.
Copy link
codecov bot commented Apr 19, 2025

Codecov Report

Attention: Patch coverage is 13.95349% with 74 lines in your changes missing coverage. Please review.

Project coverage is 11.45%. Comparing base (502a153) to head (1e3b58e).
Report is 45 commits behind head on master.

Files with missing lines Patch % Lines
.../campaign/personnel/medical/MedicalController.java 0.00% 68 Missing ⚠️
MekHQ/src/mekhq/campaign/Campaign.java 0.00% 3 Missing ⚠️
MekHQ/src/mekhq/gui/InfirmaryTab.java 0.00% 2 Missing ⚠️
MekHQ/src/mekhq/campaign/personnel/Person.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6707      +/-   ##
============================================
+ Coverage     11.44%   11.45%   +0.01%     
- Complexity     6479     6501      +22     
============================================
  Files          1094     1098       +4     
  Lines        140666   140870     +204     
  Branches      21808    21843      +35     
============================================
+ Hits          16095    16135      +40     
- Misses       122916   123061     +145     
- Partials       1655     1674      +19     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@HammerGS HammerGS requested a review from Copilot April 23, 2025 02:37
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR centralizes medical logic by introducing a new MedicalController, moves advanced medical classes to a dedicated package, and updates related functionality (including skill checks and healing roll computations) throughout the codebase.

  • Centralized medical healing and doctor assignment logic into MedicalController.
  • Moved InjuryTypes, InjuryUtil, and related files to a new advanced medical package.
  • Updated SkillCheckUtility integration and adjusted corresponding test cases.

Reviewed Changes

Copilot reviewed 18 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
MekHQ/unittests/mekhq/campaign/personnel/skills/SkillCheckUtilityTest.java Updated test cases to reflect new SkillCheckUtility API and TargetRoll usage.
MekHQ/src/mekhq/gui/dialog/SkillCheckDialog.java Modified SkillCheckUtility constructor parameters and added reporting.
MekHQ/src/mekhq/gui/dialog/ReplacementLimbDialog.java Updated import paths for advanced medical InjuryTypes.
MekHQ/src/mekhq/gui/dialog/DataLoadingDialog.java Corrected imports for InjuryTypes and removed redundant SkillType import.
MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java Updated multiple import statements to point to advanced medical package.
MekHQ/src/mekhq/gui/InfirmaryTab.java Removed obsolete impossible healing roll check to align with centralized logic.
MekHQ/src/mekhq/campaign/personnel/skills/Attributes.java Enhanced getters by clamping attribute values within defined bounds.
MekHQ/src/mekhq/campaign/personnel/medical/advancedMedical/* Moved files to the new package structure for advanced medical handling.
MekHQ/src/mekhq/campaign/medical/MedicalController.java Introduced centralized medical event processing and healing logic.
MekHQ/src/mekhq/campaign/Person.java Adjusted healing mod retrieval to align with new TargetRollModifier usage.
MekHQ/src/mekhq/campaign/Campaign.java Removed legacy advanced medical event processing in favor of MedicalController.
Others Various import and package updates to support the refactor.
Files not reviewed (2)
  • MekHQ/resources/mekhq/resources/MedicalController.properties: Language not supported
  • MekHQ/resources/mekhq/resources/SkillCheckUtility.properties: Language not supported
Comments suppressed due to low confidence (1)

MekHQ/unittests/mekhq/campaign/personnel/skills/SkillCheckUtilityTest.java:262

  • The expected total attribute score for two linked attributes has changed sign (from a positive to a negative value). Please verify that this update accurately reflects the intended calculation and doesn’t introduce an error in the healing or skill check logic.
assertEquals(-14, targetNumber.getValue(), targetNumber.toString());

@IllianiBird IllianiBird merged commit a664a9c into MegaMek:master Apr 26, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0