/** * Returns the amount of armor in the location specified, or ARMOR_NA, or * ARMOR_DESTROYED. Only works on front locations. */ public int getArmor(int loc) { return getArmor(loc, false); }
extraHeat += Compute.d6(); if (entityTarget.getArmor(hit) > 0 && (entityTarget.getArmorType(hit.getLocation()) == EquipmentType.T_ARMOR_REFLECTIVE)) { entityTarget.heatFromExternal += Math.max(1, extraHeat / 2); r.add(EquipmentType.armorNames[entityTarget.getArmorType(hit .getLocation())]); } else if (entityTarget.getArmor(hit) > 0 && (entityTarget.getArmorType(hit.getLocation()) == EquipmentType.T_ARMOR_HEAT_DISSIPATING)) { entityTarget.heatFromExternal += extraHeat / 2;
r.subject = subjectId; r.indent(2); if (entityTarget.getArmor(hit) > 0 && ((entityTarget.getArmorType(hit.getLocation()) == EquipmentType.T_ARMOR_HEAT_DISSIPATING) ||
@Override public int getArmor(int loc, boolean rear) { if ((loc == LOC_BODY) || (loc == LOC_NMISS)) { return IArmorState.ARMOR_NA; } return super.getArmor(loc, rear); }
r.subject = subjectId; r.indent(2); if (entityTarget.getArmor(hit) > 0 && (entityTarget.getArmorType(hit.getLocation()) == EquipmentType.T_ARMOR_REFLECTIVE)){ r.add(EquipmentType.armorNames [entityTarget.getArmorType(hit.getLocation())]); } else if (entityTarget.getArmor(hit) > 0 && (entityTarget.getArmorType(hit.getLocation()) == EquipmentType.T_ARMOR_HEAT_DISSIPATING)){
/** * Returns the total amount of armor on the entity. */ public int getTotalArmor() { int totalArmor = 0; for (int i = 0; i < locations(); i++) { if (getArmor(i) > 0) { totalArmor += getArmor(i); } if (hasRearArmor(i) && (getArmor(i, true) > 0)) { totalArmor += getArmor(i, true); } } return totalArmor; }
r.subject = subjectId; r.newlines = 0; if (entityTarget.getArmor(hit) > 0 && (entityTarget.getArmorType(hit.getLocation()) == EquipmentType.T_ARMOR_REFLECTIVE)){ r.add(EquipmentType.armorNames [entityTarget.getArmorType(hit.getLocation())]); } else if (entityTarget.getArmor(hit) > 0 && (entityTarget.getArmorType(hit.getLocation()) == EquipmentType.T_ARMOR_HEAT_DISSIPATING)){
/** * Returns a string representing the armor in the location */ public String getArmorString(int loc, boolean rear) { return Entity.armorStringFor(getArmor(loc, rear)); }
r.subject = subjectId; r.indent(2); if (entityTarget.getArmor(hit) > 0 && ((entityTarget.getArmorType(hit.getLocation()) == EquipmentType.T_ARMOR_HEAT_DISSIPATING) ||
@Override public String checkScrappable() { //check for armor if(unit.getEntity().getArmor(loc, false) != IArmorState.ARMOR_DESTROYED) { return "You must scrap armor in the rotor first"; } return null; }
r.subject = subjectId; r.indent(2); if (entityTarget.getArmor(hit) > 0 && (entityTarget.getArmorType(hit.getLocation()) == EquipmentType.T_ARMOR_HEAT_DISSIPATING)){
/** * Returns the amount of armor in the location hit, or IArmorState.ARMOR_NA, * or IArmorState.ARMOR_DESTROYED. */ public int getArmor(HitData hit) { return getArmor(hit.getLocation(), hit.isRear()); }
/** * Returns the value of the armor in the indicated location. Conventional * infantry and battle armor behave differently than other units. Armor is * in integer units. */ protected int getArmorValue(int loc, boolean rear) { int result = entity.getArmor(loc, rear); // Conventional infantry don't have armor (yet), so use the number of // troopers // TODO: This will probably need some revamping when Total Warfare is // released. if ((entity instanceof Infantry) & !(entity instanceof BattleArmor)) { result = ((Infantry) entity).getShootingStrength(); } // Battle armor has armor per trooper; treat each trooper as a // "location" if (entity instanceof BattleArmor) { result = ((BattleArmor) entity).getArmor(loc, false); } if (result <= 0) { result = 0; } return result; }
int armor = Math.max(entity.getArmor(i, false), 0); spnArmor[i] = new JSpinner(new SpinnerNumberModel(armor, 0, entity.getOArmor(i), 1)); panArmor.add(spnArmor[i], gridBagConstraints); if (entity.hasRearArmor(i)) { int rear = Math.max(entity.getArmor(i, true), 0); spnRear[i] = new JSpinner(new SpinnerNumberModel(rear, 0, entity.getOArmor(i, true), 1));
public void doMaintenanceDamage(int d) { int current = unit.getEntity().getArmor(location, rear); if(d >= current) { unit.getEntity().setArmor(IArmorState.ARMOR_DESTROYED, location, rear); } else { unit.getEntity().setArmor(current - d, location, rear); } updateConditionFromEntity(false); }
@Override public String checkScrappable() { //check for armor if(unit.getEntity().getArmor(loc, false) != IArmorState.ARMOR_DESTROYED) { return "You must scrap armor in the turret first"; } //you can only scrap a location that has nothing left on it for (int i = 0; i < unit.getEntity().getNumberOfCriticals(loc); i++) { CriticalSlot slot = unit.getEntity().getCritical(loc, i); // ignore empty & non-hittable slots if ((slot == null) || !slot.isEverHittable()) { continue; } if (slot.isRepairable()) { return "You must scrap all equipment in the turret first"; } } return null; }
int resultingArmor = en.getArmor(hitData) - 5;
/** * Returns the number of operational critical slots remaining in a location */ public int getHittableCriticals(int loc) { int hittable = 0; for (int i = 0; i < getNumberOfCriticals(loc); i++) { CriticalSlot crit = getCritical(loc, i); if ((crit != null) && getCritical(loc, i).isHittable()) { hittable++; } // Reactive armor criticals in a location with armor should count // as hittable, evne though they aren't actually hittable else if ((crit != null) && (crit.getType() == CriticalSlot.TYPE_EQUIPMENT) && (crit.getMount() != null) && crit.getMount().getType().hasFlag(MiscType.F_REACTIVE) && (getArmor(loc) > 0)) { hittable++; } } return hittable; }