@Override public int getInternal(int loc) { if ((loc == LOC_BODY) || (loc == LOC_NMISS)) { return IArmorState.ARMOR_NA; } return super.getInternal(loc); }
/** * Returns the total amount of internal structure on the entity. */ public int getTotalInternal() { int totalInternal = 0; for (int i = 0; i < locations(); i++) { if (getInternal(i) > 0) { totalInternal += getInternal(i); } } return totalInternal; }
/** * Is this location destroyed or breached? */ public boolean isLocationDoomed(int loc) { return (getInternal(loc) == IArmorState.ARMOR_DOOMED) || isLocationBlownOff(loc); }
/** * Returns a string representing the internal structure in the location */ public String getInternalString(int loc) { return Entity.armorStringFor(getInternal(loc)); }
/** * Returns the amount of internal structure in the location hit. */ public int getInternal(HitData hit) { return getInternal(hit.getLocation()); }
/** * Returns the number of men left in the platoon, or * IArmorState.ARMOR_DESTROYED. */ @Override public int getInternal(int loc) { if (!isPlatoon()) { return super.getInternal(loc); } if(loc != LOC_INFANTRY) { return 0; } return (men > 0 ? men : IArmorState.ARMOR_DESTROYED); }
public static boolean isRepairable(Entity en) { if (en instanceof Mech) { // you can repair anything so long as one point of CT is left if (en.getInternal(Mech.LOC_CT) <= 0) { return false; } } if (en instanceof Tank) { // can't repair a tank with a destroyed location for (int i = 0; i < en.locations(); i++) { if(i == Tank.LOC_TURRET || i == Tank.LOC_TURRET_2 || i == Tank.LOC_BODY) { continue; } if (en.getInternal(i) <= 0) { return false; } } } if(en instanceof Aero) { if(((Aero)en).getSI() <= 0) { return false; } } return true; }
@Override public boolean needsFixing() { //can only be replaced the normal way if modular and suit exists if(null != unit && unit.getEntity().getInternal(trooper)>=0 && isModular()) { return true; } return false; }
/** * Is this location destroyed or breached? */ public boolean isLocationBad(int loc) { return (getInternal(loc) == IArmorState.ARMOR_DESTROYED) || (isLocationBlownOff(loc) && !isLocationBlownOffThisPhase(loc)); }
/** * Report the location as destroyed if blown off in a previous phase, doomed * if blown off in this one. */ @Override public int getInternal(int loc) { if (isLocationBlownOff(loc)) { return isLocationBlownOffThisPhase(loc) ? IArmorState.ARMOR_DOOMED : IArmorState.ARMOR_DESTROYED; } return super.getInternal(loc); }
private boolean locationCanHoldNarcPod(int location) { return (getInternal(location) > 0) && !isLocationBlownOff(location) && !isLocationBlownOffThisPhase(location); }
private boolean narcCanAttachTo(Entity entity, int location) { return (entity.getInternal(location) > 0) && !entity.isLocationBlownOff(location) && !entity.isLocationBlownOffThisPhase(location); } }
public void doMaintenanceDamage(int d) { int points = unit.getEntity().getInternal(loc); points = Math.max(points -d, 1); unit.getEntity().setInternal(points, loc); updateConditionFromEntity(false); }
public void doMaintenanceDamage(int d) { int points = unit.getEntity().getInternal(loc); points = Math.max(points -d, 1); unit.getEntity().setInternal(points, loc); updateConditionFromEntity(false); }
public void doMaintenanceDamage(int d) { int points = unit.getEntity().getInternal(loc); points = Math.max(points -d, 1); unit.getEntity().setInternal(points, loc); updateConditionFromEntity(false); }
@Override public void updateConditionFromEntity(boolean checkForDestruction) { if(null != unit) { if(IArmorState.ARMOR_DESTROYED == unit.getEntity().getInternal(loc)) { remove(false); } else { damage = unit.getEntity().getOInternal(loc) - unit.getEntity().getInternal(loc); if(unit.isLocationBreached(loc)) { breached = true; } } } }
@Override public void fix() { super.fix(); damage--; if(null != unit && unit.getEntity() instanceof VTOL) { int currIsVal = unit.getEntity().getInternal(VTOL.LOC_ROTOR); int maxIsVal = unit.getEntity().getOInternal(VTOL.LOC_ROTOR); int repairedIsVal = Math.min(maxIsVal, currIsVal + 1); unit.getEntity().setInternal(repairedIsVal, VTOL.LOC_ROTOR); } }
/** * Checks to see if a particular BA suit on BA is currently operable * This requires the suit to not be destroyed and to have not missing equipment parts */ public boolean isBattleArmorSuitOperable(int trooper) { if(null == getEntity() || !(getEntity() instanceof BattleArmor)) { return false; } if(getEntity().getInternal(trooper) < 0) { return false; } for(Part part : getParts()) { if(part instanceof MissingBattleArmorEquipmentPart && ((MissingBattleArmorEquipmentPart)part).getTrooper() == trooper) { return false; } } return true; }
@Override public void updateConditionFromEntity(boolean checkForDestruction) { if(null != unit) { if(trooper < 0) { System.err.println("Trooper location -1 found on BattleArmorSuit attached to unit"); return; } if(unit.getEntity().getInternal(trooper) == IArmorState.ARMOR_DESTROYED) { if(!checkForDestruction) { remove(false); return; } else { if(Compute.d6(2) < campaign.getCampaignOptions().getDestroyPartTarget()) { remove(false); return; } else { //it seems a little weird to change the entity here, but no other //way to guarantee this happens unit.getEntity().setInternal(0, trooper); } } } } }
int resultingStructure = Math.max(0, en.getInternal(hitData) + resultingArmor); en.setInternal(resultingStructure, hitData);