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

Don't print Edge abilities of troopers #1529

Merged
merged 1 commit into from
Jun 20, 2024
Merged
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
20 changes: 16 additions & 4 deletions megameklab/src/megameklab/printing/PrintInfantry.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import megamek.common.*;
import megamek.common.options.IOption;
import megamek.common.options.IOptionGroup;
import megamek.common.weapons.artillery.ArtilleryCannonWeapon;
import megamek.common.weapons.artillery.ArtilleryWeapon;
import megamek.common.weapons.infantry.InfantryWeapon;
Expand All @@ -26,6 +27,7 @@
import java.util.Enumeration;
import java.util.StringJoiner;

import static megamek.common.options.PilotOptions.EDGE_ADVANTAGES;
import static megameklab.printing.InventoryEntry.DASH;

/**
Expand Down Expand Up @@ -286,10 +288,20 @@ && isFlameBased(infantry.getSecondaryWeapon()))) {
}

StringJoiner enhancements = new StringJoiner(", ");
for (Enumeration<IOption> e = infantry.getCrew().getOptions().getOptions(); e.hasMoreElements(); ) {
final IOption option = e.nextElement();
if (option.booleanValue()) {
enhancements.add(option.getDisplayableName().replaceAll("\\s+\\(Not Implemented\\)", ""));
var spas = infantry.getCrew().getOptions();
for (Enumeration<IOptionGroup> e = spas.getGroups(); e.hasMoreElements(); ) {
final IOptionGroup optiongroup = e.nextElement();
if (optiongroup.getKey().equals(EDGE_ADVANTAGES)) {
// Don't print Edge abilities, only SPAs and Cybernetics
continue;
}
if (spas.count(optiongroup.getKey()) > 0) {
for (Enumeration<IOption> options = optiongroup.getOptions(); options.hasMoreElements();) {
IOption option = options.nextElement();
if (option != null && option.booleanValue()) {
enhancements.add(option.getDisplayableNameWithValue().replaceAll("\\s+\\(Not Implemented\\)", ""));
}
}
}
}
if (enhancements.length() > 0) {
Expand Down
Loading