Skip to content

Updated Edge Handling and GUI Support (Sentry) #6579

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 3 commits into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions MekHQ/src/mekhq/campaign/Campaign.java
Original file line number Diff line number Diff line change
Expand Up @@ -4910,7 +4910,7 @@ public void processNewDayPersonnel() {
processWeeklyRelationshipEvents(person);
}

processWeeklyEdgeResets(person);
person.resetCurrentEdge();

if (!person.getStatus().isMIA()) {
processFatigueRecovery(this, person);
Expand Down Expand Up @@ -4999,14 +4999,11 @@ private void processAdvancedMedicalEvents(Person person) {
}

/**
* Process weekly Edge resets for a given person.
*
* @param person the person for whom weekly Edge resets will be processed
* @deprecated use {@link Person#resetCurrentEdge()} instead
*/
@Deprecated(since = "0.50.05", forRemoval = true)
private void processWeeklyEdgeResets(Person person) {
if ((person.hasSupportRole(true) || person.isEngineer())) {
person.resetCurrentEdge();
}
person.resetCurrentEdge();
}

/**
Expand Down
23 changes: 4 additions & 19 deletions MekHQ/src/mekhq/campaign/personnel/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public class Person {

// Supports edge usage by a ship's engineer composite crewman
private int edgeUsedThisRound;
// To track how many edge points support personnel have left until next refresh
// To track how many edge points personnel have left until next refresh
private int currentEdge;

// phenotype and background
Expand Down Expand Up @@ -2417,10 +2417,7 @@ public void writeToXML(final PrintWriter pw, int indent, final Campaign campaign
indent,
"edge",
getOptionList("::", PersonnelOptions.EDGE_ADVANTAGES));
// For support personnel, write an available edge value
if (hasSupportRole(true) || isEngineer()) {
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "edgeAvailable", getCurrentEdge());
}
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "edgeAvailable", getCurrentEdge());
}

if (countOptions(PersonnelOptions.MD_ADVANTAGES) > 0) {
Expand Down Expand Up @@ -4255,14 +4252,14 @@ public void changeEdge(final int amount) {
}

/**
* Resets support personnel edge points to the purchased level. Used for weekly refresh.
* Resets edge points to the purchased level. Used for weekly refresh.
*/
public void resetCurrentEdge() {
setCurrentEdge(getAdjustedEdge());
}

/**
* Sets support personnel edge points to the value 'currentEdge'. Used for weekly refresh.
* Sets edge points to the value 'currentEdge'. Used for weekly refresh.
*
* @param currentEdge - integer used to track this person's edge points available for the current week
*/
Expand Down Expand Up @@ -5056,18 +5053,6 @@ public void changeWealth(final int delta) {
wealth = clamp(newValue, MINIMUM_WEALTH, MAXIMUM_WEALTH);
}

/**
* Adjusts the person's wealth by the specified amount.
*
* <p>The change in wealth can be positive or negative, depending on the provided delta value.</p>
*
* @param delta The amount by which to adjust the wealth. A positive value increases the wealth, while a negative
* value decreases it.
*/
public void changeWealth(final int delta) {
this.wealth += delta;
}

public boolean isHasPerformedExtremeExpenditure() {
return hasPerformedExtremeExpenditure;
}
Expand Down
23 changes: 1 addition & 22 deletions MekHQ/src/mekhq/gui/view/PersonViewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,7 @@ private JPanel fillSkills() {

lblEdge2.setName("lblEdge2");
lblEdge1.setLabelFor(lblEdge2);
lblEdge2.setText(Integer.toString(edge));
lblEdge2.setText("" + person.getCurrentEdge() + '/' + person.getEdge());
lblEdge2.setToolTipText(person.getEdgeTooltip());
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 1;
Expand All @@ -1624,27 +1624,6 @@ private JPanel fillSkills() {
gridBagConstraints.fill = GridBagConstraints.NONE;
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
pnlSkills.add(lblEdge2, gridBagConstraints);

if (campaign.getCampaignOptions().isUseSupportEdge() && person.hasSupportRole(true)) {
// Add the Edge Available field for support personnel only
lblEdgeAvail1.setName("lblEdgeAvail1");
lblEdgeAvail1.setText(resourceMap.getString("lblEdgeAvail1.text"));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = firsty;
gridBagConstraints.fill = GridBagConstraints.NONE;
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
pnlSkills.add(lblEdgeAvail1, gridBagConstraints);

lblEdgeAvail2.setName("lblEdgeAvail2");
lblEdgeAvail1.setLabelFor(lblEdgeAvail2);
lblEdgeAvail2.setText(Integer.toString(person.getCurrentEdge()));
gridBagConstraints.gridx = 3;
gridBagConstraints.gridwidth = 1;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new Insets(0, 10, 0, 0);
pnlSkills.add(lblEdgeAvail2, gridBagConstraints);
}
firsty++;
}

Expand Down
Loading