public void restoreAllDoors() { setCurrentDoors(getDoors()); }
public void destroyDoor() { if (getCurrentDoors() > 0) setCurrentDoors(getCurrentDoors() - 1); }
currentbay.setBayDamage(Double.parseDouble(currNode.getTextContent())); } else if (nodeName.equalsIgnoreCase(BAYDOORS)) { currentbay.setCurrentDoors(Integer.parseInt(currNode.getTextContent()));
public void restoreDoor() { if (getCurrentDoors() < getDoors()) { setCurrentDoors(getCurrentDoors() + 1); } }
/** * Damages a randomly determined bay door on the entity, if one exists */ public String damageBayDoor() { String bayType = "none"; Vector<Bay> potential; potential = new Vector<Bay>(); Enumeration<Transporter> iter = transports.elements(); while (iter.hasMoreElements()) { Transporter next = iter.nextElement(); if (next instanceof Bay) { Bay nextBay = (Bay) next; if (nextBay.getCurrentDoors() > 0) { potential.add(nextBay); } } } if (potential.size() > 0) { Bay chosenBay = potential.elementAt(Compute.randomInt(potential .size())); chosenBay.destroyDoor(); chosenBay.resetDoors(); chosenBay.setCurrentDoors(chosenBay.getCurrentDoors() - 1); bayType = chosenBay.getType(); } return bayType; }
@Override public void fix() { super.fix(); Part bayPart = campaign.getPart(parentPartId); if (null != bayPart) { Bay bay = ((TransportBayPart) bayPart).getBay(); if (null != bay) { bay.setCurrentDoors(Math.min(bay.getCurrentDoors() + 1, bay.getDoors())); } } }
@Override public void updateConditionFromPart() { Bay bay = getBay(); if (null != bay) { int goodDoors = 0; int badCubicles = 0; for (int id : childPartIds) { final Part p = campaign.getPart(id); if (null != p) { if ((p instanceof BayDoor) && !p.needsFixing()) { goodDoors++; } else if (p instanceof MissingCubicle) { badCubicles++; } } } bay.setCurrentDoors(goodDoors); // Even if the bay is repaired, it still has reduced capacity until the cubicles are replaced. bay.setBayDamage(Math.max(hits, badCubicles)); } }
bay.setCurrentDoors(bay.getDoors() - doorCrit.getHits()); bay.setCurrentDoors(bay.getDoors());