Skip to content

Commit

Permalink
Update SV armor slots to 2 or 1 for non-patchwork Rating E or F respe…
Browse files Browse the repository at this point in the history
…ctively
  • Loading branch information
Sleet01 committed May 20, 2024
1 parent 8a6125c commit 3b6c165
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
8 changes: 4 additions & 4 deletions megamek/src/megamek/common/equipment/ArmorType.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,12 @@ public int getPatchworkSlotsCVFtr() {

@Override
public int getSupportVeeSlots(Entity entity) {
// Support vehicle armor takes slots like ferro-fibrous at BAR 10/TL E/F
// Support vehicle armor takes slots like CV ferro-fibrous at BAR 10/TL E/F
if (getArmorType() == T_ARMOR_SV_BAR_10) {
if (entity.getArmorTechRating() == ITechnology.RATING_E) {
return ArmorType.of(T_ARMOR_FERRO_FIBROUS, false).criticals;
return ArmorType.of(T_ARMOR_FERRO_FIBROUS, false).svslots;
} else if (entity.getArmorTechRating() == ITechnology.RATING_F) {
return ArmorType.of(T_ARMOR_FERRO_FIBROUS, true).criticals;
return ArmorType.of(T_ARMOR_FERRO_FIBROUS, true).svslots;
}
}
return svslots;
Expand Down Expand Up @@ -371,7 +371,7 @@ private static ArmorType createClanFerroFibrous() {
armor.cost = 20000.0;
armor.criticals = 7;
armor.tankslots = 1;
armor.svslots = 3;
armor.svslots = 1;
armor.patchworkSlotsMechSV = 1;
armor.patchworkSlotsCVFtr = 1;
armor.flags = armor.flags.or(F_FERRO_FIBROUS).or(F_MECH_EQUIPMENT).or(F_TANK_EQUIPMENT).or(F_VTOL_EQUIPMENT);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
package megamek.common.verifier;

import megamek.common.MiscType;
import megamek.common.*;
import megamek.common.equipment.ArmorType;
import megamek.common.verifier.TestSupportVehicle.ChassisModification;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static megamek.common.EquipmentType.T_ARMOR_FERRO_FIBROUS;
import static org.junit.jupiter.api.Assertions.*;

public class TestSupportVehicleTest {

@BeforeAll
public static void initialize() {
EquipmentType.initializeTypes();
}

@Test
public void testChassisModLookup() {
for (ChassisModification mod : ChassisModification.values()) {
Expand All @@ -17,4 +24,23 @@ public void testChassisModLookup() {
assertTrue(mod.equipment.hasFlag(MiscType.F_CHASSIS_MODIFICATION));
}
}

@Test
public void testBAR10ArmorCorrectSlots() {
SupportTank st = new SupportTank();
st.setArmorType(EquipmentType.T_ARMOR_SV_BAR_10);
// Rating E should return CV slots for IS FF
st.setArmorTechRating(ITechnology.RATING_E);
assertEquals(
2,
ArmorType.of(T_ARMOR_FERRO_FIBROUS, false).getSupportVeeSlots(st)
);

// Rating F should return CV slots for Clan FF
st.setArmorTechRating(ITechnology.RATING_F);
assertEquals(
1,
ArmorType.of(T_ARMOR_FERRO_FIBROUS, true).getSupportVeeSlots(st)
);
}
}

0 comments on commit 3b6c165

Please sign in to comment.