destroyLocation(en, loc); pilotRolls.addElement(new PilotingRollData(en.getId(), PilotingRollData.AUTOMATIC_FALL, "leg destroyed"));
if (en.getInternal(loc) > 0) { destroyLocation(en, loc); pilotRolls.addElement(new PilotingRollData(en.getId(), PilotingRollData.AUTOMATIC_FAIL, 5, "leg destroyed")); }
    private String criticalEntity(Entity en, int loc) {        String desc = "        Critical hit on " + en.getLocationAbbr(loc) + ". ";        int hits = 0;        int roll = Compute.d6(2);        desc += "Roll = " + roll + ";";        if (roll <= 7) {            desc += " no effect.";            return desc;        } else if (roll >= 8 && roll <= 9) {            hits = 1;            desc += " 1 location.";        } else if (roll >= 10 && roll <= 11) {            hits = 2;            desc += " 2 locations.";        } else if (roll == 12) {            if (loc == Mech.LOC_RLEG || loc == Mech.LOC_LLEG) {                desc += "<<<LIMB BLOWN OFF>>> " + en.getLocationName(loc) + " blown off.";                destroyLocation(en, loc);                pilotRolls.addElement(new PilotingRollData(en.getId(), PilotingRollData.AUTOMATIC_FALL, "leg destroyed"));                return desc;            } else if (loc == Mech.LOC_RARM || loc == Mech.LOC_LARM) {                desc += "<<<LIMB BLOWN OFF>>> " + en.getLocationName(loc) + " blown off.";                destroyLocation(en, loc);                return desc;            } else if (loc == Mech.LOC_HEAD) {                desc += "<<<HEAD BLOWN OFF>>> " + en.getLocationName(loc) + " blown off.";                destroyLocation(en, loc);                en.crew.setDead(true);                desc += "\n*** " + en.getDisplayName() + " PILOT KILLED! ***";                return desc;            } else {                // torso hit                hits = 3;                desc += " 3 locations.";            }        }        // transfer criticals, if needed        if (hits > 0 && !en.hasHitableCriticals(loc)                && en.getTransferLocation(new HitData(loc)).getLocation() != Entity.LOC_DESTROYED) {            loc = en.getTransferLocation(new HitData(loc)).getLocation();            desc += "\n            Location is empty, so criticals transfer to " + en.getLocationAbbr(loc) +".";        }        // roll criticals        while (hits > 0) {            if (en.getHitableCriticals(loc) <= 0) {                desc += "\n            Location empty.";                break;            }            int slot = Compute.random.nextInt(en.getNumberOfCriticals(loc));            CriticalSlot cs = en.getCritical(loc, slot);            if (cs == null || !cs.isHitable()) {                continue;            }            cs.setHit(true);            switch(cs.getType()) {            case CriticalSlot.TYPE_SYSTEM :                desc += "\n            <<<CRITICAL HIT>>> on " + Mech.systemNames[cs.getIndex()] + ".";                switch(cs.getIndex()) {                case Mech.SYSTEM_COCKPIT :                    // boink!                    en.crew.setDead(true);                    desc += "\n*** " + en.getDisplayName() + " PILOT KILLED! ***";                    break;                case Mech.SYSTEM_ENGINE :                    if (en.getHitCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_ENGINE, loc) > 2) {                        // third engine hit                        en.setDoomed(true);                        desc += "\n*** " + en.getDisplayName() + " ENGINE DESTROYED! ***";                    }                    break;                case Mech.SYSTEM_GYRO :                    if (en.getHitCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_GYRO, loc) > 1) {                        // gyro destroyed                        pilotRolls.addElement(new PilotingRollData(en.getId(), PilotingRollData.AUTOMATIC_FALL, "gyro destroyed"));                    } else {                        // first gyro hit                        pilotRolls.addElement(new PilotingRollData(en.getId(), 3, "gyro hit"));                    }                    break;                case Mech.ACTUATOR_UPPER_LEG :                case Mech.ACTUATOR_LOWER_LEG :                case Mech.ACTUATOR_FOOT :                    // leg/foot actuator piloting roll                    pilotRolls.addElement(new PilotingRollData(en.getId(), 1, "leg/foot actuator hit"));                    break;                case Mech.ACTUATOR_HIP :                    // hip piloting roll                    pilotRolls.addElement(new PilotingRollData(en.getId(), 2, "hip actuator hit"));                    break;                }                break;            case CriticalSlot.TYPE_EQUIPMENT :                desc += "\n            <<<CRITICAL HIT>>> on " + en.getEquipment(cs.getIndex()).getDesc() + ".";                if (en.getEquipment(cs.getIndex()).getType() instanceof AmmoType) {                    desc += explodeAmmo(en, loc, slot);                }                en.getEquipment(cs.getIndex()).setHit(true);                break;            }            hits--;//                System.err.println("s: critical loop, " + hits + " remaining");        }        return desc;    }