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

MML Issue 567: Disallow Commercial Armor for BattleMeks #3485

Merged
merged 1 commit into from
Mar 5, 2022
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: 11 additions & 9 deletions megamek/src/megamek/common/verifier/TestMech.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,37 +85,39 @@ public static List<EquipmentType> allJJs(boolean industrialOnly) {
* @return
*/
public static List<EquipmentType> legalArmorsFor(long etype, boolean industrial, ITechManager techManager) {
List<EquipmentType> retVal = new ArrayList<>();
List<EquipmentType> legalArmors = new ArrayList<>();
boolean industrialOnly = industrial
&& (techManager.getTechLevel().ordinal() < SimpleTechLevel.EXPERIMENTAL.ordinal());
boolean isLam = (etype & Entity.ETYPE_LAND_AIR_MECH) != 0;
for (int at = 0; at < EquipmentType.armorNames.length; at++) {
if ((at == EquipmentType.T_ARMOR_PATCHWORK)
|| (isLam && (at == EquipmentType.T_ARMOR_HARDENED))) {
for (int armorType = 0; armorType < EquipmentType.armorNames.length; armorType++) {
if ((armorType == EquipmentType.T_ARMOR_PATCHWORK)
|| (isLam && (armorType == EquipmentType.T_ARMOR_HARDENED))) {
continue;
}
String name = EquipmentType.getArmorTypeName(at, techManager.useClanTechBase());
String name = EquipmentType.getArmorTypeName(armorType, techManager.useClanTechBase());
EquipmentType eq = EquipmentType.get(name);
if ((null != eq)
&& eq.hasFlag(MiscType.F_MECH_EQUIPMENT)
&& ((armorType != EquipmentType.T_ARMOR_COMMERCIAL) || industrial)
&& techManager.isLegal(eq)
&& (!isLam || (eq.getCriticals(null) == 0))
&& (!industrialOnly || ((MiscType) eq).isIndustrial())) {
retVal.add(eq);
legalArmors.add(eq);
}
if (techManager.useMixedTech()) {
name = EquipmentType.getArmorTypeName(at, !techManager.useClanTechBase());
name = EquipmentType.getArmorTypeName(armorType, !techManager.useClanTechBase());
EquipmentType eq2 = EquipmentType.get(name);
if ((null != eq2) && (eq != eq2)
&& eq2.hasFlag(MiscType.F_MECH_EQUIPMENT)
&& ((armorType != EquipmentType.T_ARMOR_COMMERCIAL) || industrial)
&& techManager.isLegal(eq2)
&& (!isLam || (eq2.getCriticals(null) == 0))
&& (!industrialOnly || ((null != eq) && ((MiscType) eq).isIndustrial()))) {
retVal.add(eq2);
legalArmors.add(eq2);
}
}
}
return retVal;
return legalArmors;
}

private Mech mech = null;
Expand Down