diff --git a/bridge/DumpDamaged.java b/bridge/DumpDamaged.java index 3524fb7..6d2261f 100644 --- a/bridge/DumpDamaged.java +++ b/bridge/DumpDamaged.java @@ -41,9 +41,16 @@ public final class DumpDamaged { "Atlas AS7-D", "Locust LCT-1V", "Warhammer WHM-6R", - "Timber Wolf (Mad Cat) Prime", + // MegaMek puts the reporting name first for a Clan design, so this is + // the spelling its cache answers to. + "Mad Cat (Timber Wolf) Prime", "Catapult CPLT-C1", "Hunchback HBK-4G", + // One of each system whose loss changes a figure: jump jets, a hatchet + // and the arm actuators that swing it, and MASC. + "Griffin GRF-1N", + "Hatchetman HCT-3F", + "Celerity CLR-03-O", }; public static void main(String[] args) throws Exception { @@ -81,7 +88,8 @@ public final class DumpDamaged { } for (String scenario : new String[] { "fresh", "stripped", "torso-open", "structure-hurt", "arm-gone", "dry", - "hip-gone", "leg-actuators" }) { + "hip-gone", "leg-actuators", "engine-hit", "gyro-hit", "heat-sinks-gone", + "jets-gone", "arm-actuators", "movement-gear-gone" }) { Entity entity = ms.loadEntity(); if (entity == null) { System.err.println("could not load: " + name); @@ -144,10 +152,56 @@ public final class DumpDamaged { } } } + // One engine hit, which is five points of heat a turn in play. + case "engine-hit" -> wreckSystem(entity, Mek.LOC_CENTER_TORSO, Mek.SYSTEM_ENGINE); + case "gyro-hit" -> wreckSystem(entity, Mek.LOC_CENTER_TORSO, Mek.SYSTEM_GYRO); + // Cooling shot away, which is what makes a design run out of heat + // sooner and count its weapons at half. + case "heat-sinks-gone" -> wreckEquipment(entity, "Heat Sink"); + case "jets-gone" -> wreckEquipment(entity, "Jump Jet"); + // The two actuators a hatchet swings with, which the physical + // attack values depend on. + case "arm-actuators" -> { + wreckSystem(entity, Mek.LOC_RIGHT_ARM, Mek.ACTUATOR_LOWER_ARM); + wreckSystem(entity, Mek.LOC_RIGHT_ARM, Mek.ACTUATOR_HAND); + } + case "movement-gear-gone" -> { + wreckEquipment(entity, "MASC"); + wreckEquipment(entity, "Supercharger"); + wreckEquipment(entity, "TSM"); + } default -> throw new IllegalArgumentException(scenario); } } + /** Every mounted item whose name contains `what`, shot out where it sits. */ + private static void wreckEquipment(Entity entity, String what) { + for (Mounted m : entity.getEquipment()) { + if (m.getType() == null || !m.getType().getInternalName().contains(what)) { + continue; + } + int loc = m.getLocation(); + // Only what a critical hit could reach. A Mek's engine-integrated + // heat sinks are mounted with no location and fill no critical + // slot, so shooting them out describes damage that cannot happen + // and that a .mul has no way to record - which would make this an + // oracle for a state helm can never be asked about. + if (loc < 0) { + continue; + } + m.setDestroyed(true); + m.setHit(true); + for (int slot = 0; slot < entity.getNumberOfCriticalSlots(loc); slot++) { + CriticalSlot cs = entity.getCritical(loc, slot); + if (cs != null && cs.getType() == CriticalSlot.TYPE_EQUIPMENT + && cs.getMount() == m) { + cs.setDestroyed(true); + cs.setHit(true); + } + } + } + } + /** One system critical slot shot out, leaving everything else alone. */ private static void wreckSystem(Entity entity, int loc, int system) { for (int slot = 0; slot < entity.getNumberOfCriticalSlots(loc); slot++) {