public void setArmorType(int armType) { for (int i = 0; i < locations(); i++) { armorType[i] = armType; } }
public boolean hasHardenedArmor() { for (int i = 0; i < locations(); i++) { if ((armorType[i] == EquipmentType.T_ARMOR_HARDENED)) { return true; } } return false; }
public void refreshLocations() { armor = new int[locations()]; internal = new int[locations()]; orig_armor = new int[locations()]; orig_internal = new int[locations()]; crits = new CriticalSlot[locations()][]; exposure = new int[locations()]; for (int i = 0; i < locations(); i++) { crits[i] = new CriticalSlot[getNumberOfCriticals(i)]; } }
/** * Returns the location that the specified abbreviation indicates */ public int getLocationFromAbbr(String abbr) { for (int i = 0; i < locations(); i++) { if (getLocationAbbr(i).equalsIgnoreCase(abbr)) { return i; } } return Entity.LOC_NONE; }
/** * Checks whether a weapon has been fired on this unit this turn * * @return */ public boolean weaponFired() { boolean fired = false; for (int loc = 0; (loc < locations()) && !fired; loc++) { fired |= weaponFiredFrom(loc); } return fired; }
public boolean hasArcFired(int location, boolean rearMount) { if ((null == frontArcFired) || (null == rearArcFired)) { resetFiringArcs(); } if ((location > locations()) || (location < 0)) { return false; } if (rearMount) { return rearArcFired[location]; } return frontArcFired[location]; }
/** * Returns the number of critical slots present in the mech, destroyed or * not. */ public int getNumberOfCriticals(EquipmentType etype) { int num = 0; int locations = locations(); for (int l = 0; l < locations; l++) { num += getNumberOfCriticals(etype, l); } return num; }
public void setArmorTechLevel(int newTL) { for (int i = 0; i < locations(); i++) { armorTechLevel[i] = newTL; } recalculateTechAdvancement(); }
public void damageSystem(int type, int slot, int hits) { for (int loc = 0; loc < locations(); loc++) { damageSystem(type, slot, loc, hits); } }
public String printArmorPlacement() { StringBuffer buff = new StringBuffer(); buff.append("Armor Placement:\n"); for (int loc = 0; loc < getEntity().locations(); loc++) { buff.append(printArmorLocation(loc)).append("\n"); } return buff.toString(); }
@Override public String printArmorPlacement() { StringBuffer buff = new StringBuffer(); buff.append("Armor Placement:\n"); for (int loc = 1; loc < getEntity().locations(); loc++) { buff.append(printArmorLocation(loc)).append("\n"); } return buff.toString(); }
@Override public int getLocation() { if(null != unit) { Entity entity = unit.getEntity(); for (int i = 0; i < entity.locations(); i++) { if (entity.getNumberOfCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_LIFE_SUPPORT, i) > 0) { return i; } } } return Entity.LOC_NONE; }
public void destroySystem(int type, int equipmentNum) { for (int loc = 0; loc < getEntity().locations(); loc++) { destroySystem(type, equipmentNum, loc); } }
@Override public int getLocation() { if(null != unit) { Entity entity = unit.getEntity(); for (int i = 0; i < entity.locations(); i++) { if (entity.getNumberOfCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_SENSORS, i) > 0) { return i; } } } return Entity.LOC_NONE; }
/** * Returns the total original amount of internal structure on the entity. */ public int getTotalOInternal() { int totalInternal = 0; for (int i = 0; i < locations(); i++) { if (getOInternal(i) > 0) { totalInternal += getOInternal(i); } } return totalInternal; }
public void repairSystem(int type, int equipmentNum) { for (int loc = 0; loc < getEntity().locations(); loc++) { repairSystem(type, equipmentNum, 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; }
public void damageSystem(int type, int equipmentNum, int hits) { //make sure we take note of existing hits to start and as we cycle through locations int existingHits = getHitCriticals(type, equipmentNum); int neededHits = Math.max(0, hits - existingHits); int usedHits = 0; for (int loc = 0; loc < getEntity().locations(); loc++) { if(neededHits > usedHits) { usedHits += damageSystem(type, equipmentNum, loc, neededHits-usedHits); } } }
private Map<Integer, Integer> getSpreadableLocations(final Entity entity, final EquipmentType eq) { final Map<Integer, Integer> retVal = new HashMap<>(); for (int loc = 0; loc < entity.locations(); loc++) { for (int slot = 0; slot < entity.getNumberOfCriticals(loc); slot++) { final CriticalSlot crit = entity.getCritical(loc, slot); if ((crit != null) && (crit.getMount() != null) && (crit.getMount().getType() == eq)) { retVal.merge(loc, 1, Integer::sum); } } } return retVal; }