Skip to content

Commit

Permalink
Merge pull request #3485 from SJuliez/MML_Issue567
Browse files Browse the repository at this point in the history
MML Issue #567: Disallow Commercial Armor for BattleMeks
  • Loading branch information
Windchild292 authored Mar 5, 2022
2 parents 5138735 + b38b313 commit ac4dd3a
Showing 1 changed file with 11 additions and 9 deletions.
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

0 comments on commit ac4dd3a

Please sign in to comment.