private String criticalEntity(Entity en, int loc) { return criticalEntity(en, loc, 0);
private String criticalEntity(Entity en, int loc, int critMod) { CriticalSlot slot = null; StringBuffer desc = new StringBuffer(); desc.append( "        Critical hit on " ) .append( en.getLocationAbbr(loc) ) .append( ". " ); int hits = 0; int roll = Compute.d6(2); desc.append( "Roll = " ); if ( critMod != 0 ) { desc.append( "(" ).append( roll ); if ( critMod > 0 ) { desc.append( "+" ); } desc.append( critMod ).append( ") = " ); roll += critMod; } desc.append( roll ).append( ";" ); if (roll <= 7) { desc.append( " no effect." ); return desc.toString(); } else if (roll >= 8 && roll <= 9) { hits = 1; desc.append( " 1 location." ); } else if (roll >= 10 && roll <= 11) { hits = 2; desc.append( " 2 locations." ); } else if (roll == 12) { if (en instanceof Tank) { hits = 3; desc.append( " 3 locations." ); } else if (en instanceof Protomech) { hits=3; desc.append( " 3 locations" );  } else if (en.locationIsLeg(loc)) { desc.append( "<<<LIMB BLOWN OFF>>> " ) .append( en.getLocationName(loc) ) .append( " blown off." ); if (en.getInternal(loc) > 0) { destroyLocation(en, loc); } return desc.toString(); } else if (loc == Mech.LOC_RARM || loc == Mech.LOC_LARM) { desc.append( "<<<LIMB BLOWN OFF>>> " ) .append( en.getLocationName(loc) ) .append( " blown off." ); destroyLocation(en, loc); return desc.toString(); } else if (loc == Mech.LOC_HEAD) { desc.append( "<<<HEAD BLOWN OFF>>> " ) .append( en.getLocationName(loc) ) .append( " blown off." ); destroyLocation(en, loc);  if ( Pilot.DEATH > en.getCrew().getHits() ) { en.crew.setDoomed(true); desc.append( "\n*** " ) .append( en.getDisplayName() ) .append( " PILOT KILLED! ***" ); } return desc.toString(); } else {  hits = 3; desc.append( " 3 locations." ); } }   if (en instanceof Tank) { Tank tank = (Tank)en; for (int x = 0; x < hits && !tank.isDoomed(); x++) { slot = new CriticalSlot( CriticalSlot.TYPE_SYSTEM, Compute.d6(1) ); desc.append( applyCriticalHit(en, Entity.NONE, slot, true) ); } } else {  while (hits > 0 && en.canTransferCriticals(loc) && en.getTransferLocation(loc) != Entity.LOC_DESTROYED) { loc = en.getTransferLocation(loc); desc.append( "\n            Location is empty, " ) .append( "so criticals transfer to " ) .append( en.getLocationAbbr(loc) ) .append( "." ); }   while (hits > 0) {   if (en.getHittableCriticals(loc) <= 0) { desc.append( "\n            Location has no more " ) .append( "hittable critical slots." ); break; }   int slotIndex = Compute.randomInt ( en.getNumberOfCriticals(loc) ); slot = en.getCritical(loc, slotIndex);    if (slot != null && slot.isHittable()) { desc.append( applyCriticalHit(en, loc, slot, true) ); hits--; }  } }  return desc.toString();
    private String criticalEntity(Entity en, int loc) {    	return criticalEntity(en, loc, 0);    }