.getEntity(); BattleForceElement bfe = new BattleForceElement(entity); bfe.writeCsv(w);
public BattleForceElement(Entity en) { name = en.getShortName(); size = en.getBattleForceSize(); computeMovement(en); armor = en.getBattleForceArmorPointsRaw(); if (en instanceof Aero) { threshold = armor / 10.0; } structure = en.getBattleForceStructurePoints(); if (en instanceof Aero) { rangeBands = RANGE_BAND_NUM_AERO; } initWeaponLocations(en); heat = new int[rangeBands]; computeDamage(en); points = calculatePointValue(en); en.addBattleForceSpecialAbilities(specialAbilities); }
w.write(Integer.toString(size)); w.write("\t"); w.write(getMovementAsString()); w.write("\t"); w.write(Integer.toString(getFinalArmor())); if (threshold >= 0) { w.write("-" + (int)Math.ceil(threshold));//TODO: threshold for (int loc = 0; loc < weaponLocations.length; loc++) { StringBuilder str = new StringBuilder(); String damStr = getBFDamageString(loc); if (weaponLocations[loc].hasDamageRounded()) { str.append(damStr); w.write(Integer.toString(getFinalPoints())); w.write("\t"); w.write(specialAbilities.keySet().stream() .filter(spa -> spa.usedByBattleForce() && !spa.isDoor()) .map(spa -> formatSPAString(spa)) .collect(Collectors.joining(", "))); w.newLine();
addArtillery(weapon); continue; Mounted m = en.getEquipment(index); if (m.getType() instanceof WeaponType) { addArtillery((WeaponType)m.getType()); for (int r = 0; r < rangeBands; r++) { if (en instanceof BattleArmor) { baseDamage[r] = getBattleArmorDamage(weapon, ranges[r], ((BattleArmor)en), mount.isAPMMounted()); } else { double locMultiplier = locationMultiplier(en, loc, mount); if (locMultiplier == 0) { continue; for (int r = 0; r < STANDARD_RANGES.length; r++) { if (range >= STANDARD_RANGES[r]) { weaponLocations[0].addDamage(r, getConvInfantryStandardDamage(STANDARD_RANGES[r], (Infantry)en)); } else { adjustForHeat(en);
protected String formatSPAString(BattleForceSPA spa) { /* BOMB rating for ASFs and CFs is one less than for BF */ if (spa.equals(BattleForceSPA.BOMB) && (asUnitType.equals(ASUnitType.AF) || asUnitType.equals(ASUnitType.CF))) { return spa.toString() + (specialAbilities.get(spa) - 1); } if (spa.equals(BattleForceSPA.HT)) { return spa.toString() + IntStream.range(0, rangeBands) .mapToObj(String::valueOf).collect(Collectors.joining("/")); } return super.formatSPAString(spa); } }
protected void adjustForHeat(Entity en) { double totalHeat; totalHeat = en.getBattleForceTotalHeatGeneration(false) - 4; int heatCapacity = calcHeatCapacity(en); if (totalHeat > heatCapacity) { double adjustment = heatCapacity / totalHeat;