Esempio n. 1
0
 @Override
 public void remove(boolean salvage) {
   blownOff = false;
   if (null != unit) {
     unit.getEntity().setInternal(IArmorState.ARMOR_DESTROYED, loc);
     unit.getEntity().setLocationBlownOff(loc, false);
     Part spare = campaign.checkForExistingSparePart(this);
     if (!salvage) {
       campaign.removePart(this);
     } else if (null != spare) {
       spare.incrementQuantity();
       campaign.removePart(this);
     }
     unit.removePart(this);
     if (loc != Protomech.LOC_TORSO) {
       Part missing = getMissingPart();
       unit.addPart(missing);
       campaign.addPart(missing, 0);
     }
     // According to StratOps, this always destroys all equipment in that location as well
     for (int i = 0; i < unit.getEntity().getNumberOfCriticals(loc); i++) {
       final CriticalSlot cs = unit.getEntity().getCritical(loc, i);
       if (null == cs || !cs.isEverHittable()) {
         continue;
       }
       cs.setHit(true);
       cs.setDestroyed(true);
       cs.setRepairable(false);
       Mounted m = cs.getMount();
       if (null != m) {
         m.setHit(true);
         m.setDestroyed(true);
         m.setRepairable(false);
       }
     }
     for (Mounted m : unit.getEntity().getEquipment()) {
       if (m.getLocation() == loc || m.getSecondLocation() == loc) {
         m.setHit(true);
         m.setDestroyed(true);
         m.setRepairable(false);
       }
     }
   }
   setUnit(null);
   updateConditionFromEntity(false);
 }