Skip to content

Conversation

@IllianiBird
Copy link
Collaborator

This is a QOL improvement for players who want to give their characters lots of prosthetics. Now prosthetics will be listed separately to normal injuries in the Person View panel - that's the panel on the right-hand side in the personnel tab.

@IllianiBird IllianiBird self-assigned this Nov 21, 2025
@IllianiBird IllianiBird requested a review from a team as a code owner November 21, 2025 01:44
@IllianiBird IllianiBird added GUI UX User experience labels Nov 21, 2025
gridY++;

List<Injury> injuries = person.getInjuries();
if (campaignOptions.isUseAdvancedMedical() && !injuries.isEmpty()) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed the campaignOptions.isUseAdvancedMedical() condition as I can foresee a situation where a player has injuries active on a character, then disables AM (or AAM) and suddenly finds themselves struggling to figure out why some characters still have weird penalties.

@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 0% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 11.73%. Comparing base (0dfb268) to head (5c117f4).
⚠️ Report is 45 commits behind head on main.

Files with missing lines Patch % Lines
MekHQ/src/mekhq/gui/view/PersonViewPanel.java 0.00% 29 Missing ⚠️
MekHQ/src/mekhq/campaign/personnel/Person.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8274   +/-   ##
=========================================
  Coverage     11.73%   11.73%           
- Complexity     7531     7533    +2     
=========================================
  Files          1271     1271           
  Lines        162693   162744   +51     
  Branches      24505    24519   +14     
=========================================
+ Hits          19084    19090    +6     
- Misses       141608   141652   +44     
- Partials       2001     2002    +1     

☔ 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 November 21, 2025 02:25
Copilot finished reviewing on behalf of HammerGS November 21, 2025 02:30
Copy link
Contributor

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 improves the user experience for managing personnel with prosthetics by separating prosthetic display from regular injuries in the PersonViewPanel. The change introduces filtering methods in the Person class and updates the UI to show "Injuries" and "Prosthetics" as distinct sections, making it easier for players who give their characters many prosthetic enhancements to view and manage them separately.

Key Changes

  • Added two new filtering methods (getProstheticInjuries() and getNonProstheticInjuries()) to separate prosthetic injuries from regular injuries
  • Updated PersonViewPanel to display prosthetics in a separate panel with its own title
  • Refactored injury label formatting into a dedicated method that handles different display formats for prosthetics, permanent injuries, and temporary injuries
  • Simplified the injury display logic by removing redundant campaignOptions.isUseAdvancedMedical() checks (injuries are only present when advanced medical is enabled)

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
Person.java Added getProstheticInjuries() and getNonProstheticInjuries() filtering methods to separate prosthetic injuries from regular injuries
PersonViewPanel.java Updated UI to display separate "Injuries" and "Prosthetics" panels; refactored injury label formatting into getInjuryLabel() method with prosthetic-specific formatting
PersonViewPanel.properties Added new localized format strings for injury labels (format.injuryLabel.injury, format.injuryLabel.permanent, format.injuryLabel.prosthetic) and updated panel titles

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = gridY;
gridBagConstraints.gridwidth = 2;
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

[nitpick] Missing gridBagConstraints.weightx = 1.0 setting. Other similar panels in this method (e.g., abilities at line 285, other at line 298) set weightx to 1.0 for consistent layout behavior. Consider adding this for consistency with the rest of the UI components.

Suggested change
gridBagConstraints.gridwidth = 2;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.weightx = 1.0;

Copilot uses AI. Check for mistakes.
Comment on lines +2757 to +2769
String durationValue = injury.isPermanent() ? "\u26A0" : String.valueOf(injury.getTime());
String durationColor = injury.isPermanent() ? getNegativeColor() : getWarningColor();
String durationText = messageSurroundedBySpanWithColor(durationColor, durationValue);

String label;
if (injury.getSubType().isProsthetic()) {
label = String.format(resourceMap.getString("format.injuryLabel.prosthetic"), injury.getName());
} else if (injury.isPermanent()) {
label = String.format(resourceMap.getString("format.injuryLabel.permanent"), injury.getName(),
durationText);
} else {
label = String.format(resourceMap.getString("format.injuryLabel.injury"), injury.getName(),
durationText);
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

[nitpick] The durationValue, durationColor, and durationText variables are computed for all injuries but not used when the injury is a prosthetic (line 2762-2763). Consider moving these computations inside the else branch (after line 2763) to avoid unnecessary work for prosthetic injuries:

String label;
if (injury.getSubType().isProsthetic()) {
    label = String.format(resourceMap.getString("format.injuryLabel.prosthetic"), injury.getName());
} else {
    String durationValue = injury.isPermanent() ? "\u26A0" : String.valueOf(injury.getTime());
    String durationColor = injury.isPermanent() ? getNegativeColor() : getWarningColor();
    String durationText = messageSurroundedBySpanWithColor(durationColor, durationValue);
    
    if (injury.isPermanent()) {
        label = String.format(resourceMap.getString("format.injuryLabel.permanent"), injury.getName(), durationText);
    } else {
        label = String.format(resourceMap.getString("format.injuryLabel.injury"), injury.getName(), durationText);
    }
}
Suggested change
String durationValue = injury.isPermanent() ? "\u26A0" : String.valueOf(injury.getTime());
String durationColor = injury.isPermanent() ? getNegativeColor() : getWarningColor();
String durationText = messageSurroundedBySpanWithColor(durationColor, durationValue);
String label;
if (injury.getSubType().isProsthetic()) {
label = String.format(resourceMap.getString("format.injuryLabel.prosthetic"), injury.getName());
} else if (injury.isPermanent()) {
label = String.format(resourceMap.getString("format.injuryLabel.permanent"), injury.getName(),
durationText);
} else {
label = String.format(resourceMap.getString("format.injuryLabel.injury"), injury.getName(),
durationText);
String label;
if (injury.getSubType().isProsthetic()) {
label = String.format(resourceMap.getString("format.injuryLabel.prosthetic"), injury.getName());
} else {
String durationValue = injury.isPermanent() ? "\u26A0" : String.valueOf(injury.getTime());
String durationColor = injury.isPermanent() ? getNegativeColor() : getWarningColor();
String durationText = messageSurroundedBySpanWithColor(durationColor, durationValue);
if (injury.isPermanent()) {
label = String.format(resourceMap.getString("format.injuryLabel.permanent"), injury.getName(),
durationText);
} else {
label = String.format(resourceMap.getString("format.injuryLabel.injury"), injury.getName(),
durationText);
}

Copilot uses AI. Check for mistakes.

return pnlScenariosLog;
}

Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

[nitpick] The fillInjuries method signature was updated to include a isProstheticReport parameter but lacks JavaDoc documentation. Consider adding documentation to explain:

  • What the method does
  • The purpose of the new isProstheticReport parameter
  • What it returns

Example:

/**
 * Creates a panel displaying a list of injuries with appropriate formatting and layout.
 *
 * @param injuries the list of injuries to display
 * @param isProstheticReport if {@code true}, displays prosthetics with the "Prosthetics" title;
 *                           if {@code false}, displays injuries with the "Injuries" title
 * @return a JPanel containing the formatted injury information
 */
Suggested change
/**
* Creates a panel displaying a list of injuries or prosthetics with appropriate formatting and layout.
*
* @param injuries the list of injuries to display
* @param isProstheticReport if {@code true}, displays prosthetics with the "Prosthetics" title;
* if {@code false}, displays injuries with the "Injuries" title
* @return a JPanel containing the formatted injury or prosthetic information
*/

Copilot uses AI. Check for mistakes.
Comment on lines 7009 to +7013

public List<Injury> getProstheticInjuries() {
return injuries.stream().filter(i -> i.getSubType().isProsthetic()).collect(Collectors.toList());
}

Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

[nitpick] The new methods getProstheticInjuries() and getNonProstheticInjuries() lack JavaDoc documentation. While this follows the existing pattern in this section (other methods like getInjuries() and getPermanentInjuries() also lack docs), consider adding documentation to clarify:

  • What each method returns
  • The filtering criteria used

Example:

/**
 * Returns a list of all prosthetic-type injuries for this person.
 *
 * @return a list of injuries where the subtype is prosthetic
 */
public List<Injury> getProstheticInjuries() { ... }

/**
 * Returns a list of all non-prosthetic injuries for this person.
 *
 * @return a list of injuries where the subtype is not prosthetic
 */
public List<Injury> getNonProstheticInjuries() { ... }
Suggested change
public List<Injury> getProstheticInjuries() {
return injuries.stream().filter(i -> i.getSubType().isProsthetic()).collect(Collectors.toList());
}
/**
* Returns a list of all prosthetic-type injuries for this person.
*
* @return a list of injuries where the subtype is prosthetic
*/
public List<Injury> getProstheticInjuries() {
return injuries.stream().filter(i -> i.getSubType().isProsthetic()).collect(Collectors.toList());
}
/**
* Returns a list of all non-prosthetic injuries for this person.
*
* @return a list of injuries where the subtype is not prosthetic
*/

Copilot uses AI. Check for mistakes.
@HammerGS HammerGS merged commit d79f02c into MegaMek:main Nov 21, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GUI UX User experience

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants