Skip to content

Commit dcaf458

Browse files
authored
Fix for Issue MegaMek#7794 - Incorrect BV mod for IS BA Reactive Armor. (MegaMek#7801)
Root Cause: The isReactive(), isFireResistant(), and isReflective() methods in BattleArmor.java were checking for misc equipment flags, but BA special armor types are stored as armor types (via getArmorType()), not as misc equipment. The old code never matched anything. Fix: Simplified all three methods to directly check the armor type: ``` public boolean isFireResistant() { return getArmorType(LOC_TROOPER_1) == EquipmentType.T_ARMOR_BA_FIRE_RESIST; } public boolean isReflective() { return getArmorType(LOC_TROOPER_1) == EquipmentType.T_ARMOR_BA_REFLECTIVE; } public boolean isReactive() { return getArmorType(LOC_TROOPER_1) == EquipmentType.T_ARMOR_BA_REACTIVE; } ``` File changed: megamek/src/megamek/common/battleArmor/BattleArmor.java Fixes MegaMek#7794
2 parents a32118d + 995754d commit dcaf458

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

megamek/src/megamek/common/battleArmor/BattleArmor.java

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,41 +1310,23 @@ public int getVibroClaws() {
13101310

13111311
/**
13121312
* return if this BA has fire-resistant armor
1313-
*
13141313
*/
13151314
public boolean isFireResistant() {
1316-
for (Mounted<?> equip : getMisc()) {
1317-
if (equip.getType().hasFlag(MiscType.F_FIRE_RESISTANT)) {
1318-
return true;
1319-
}
1320-
}
1321-
return false;
1315+
return getArmorType(LOC_TROOPER_1) == EquipmentType.T_ARMOR_BA_FIRE_RESIST;
13221316
}
13231317

13241318
/**
13251319
* return if this BA has laser reflective armor
1326-
*
13271320
*/
13281321
public boolean isReflective() {
1329-
for (Mounted<?> equip : getMisc()) {
1330-
if (equip.getType().hasFlag(MiscType.F_REFLECTIVE)) {
1331-
return true;
1332-
}
1333-
}
1334-
return false;
1322+
return getArmorType(LOC_TROOPER_1) == EquipmentType.T_ARMOR_BA_REFLECTIVE;
13351323
}
13361324

13371325
/**
13381326
* return if this BA has reactive armor
1339-
*
13401327
*/
13411328
public boolean isReactive() {
1342-
for (Mounted<?> equip : getMisc()) {
1343-
if (equip.getType().hasFlag(MiscType.F_REACTIVE)) {
1344-
return true;
1345-
}
1346-
}
1347-
return false;
1329+
return getArmorType(LOC_TROOPER_1) == EquipmentType.T_ARMOR_BA_REACTIVE;
13481330
}
13491331

13501332
/**

0 commit comments

Comments
 (0)