@Override public void addBattleForceSpecialAbilities(Map<BattleForceSPA, Integer> specialAbilities) { super.addBattleForceSpecialAbilities(specialAbilities); for (Mounted m : getEquipment()) { if (m.getType().hasFlag(MiscType.F_SPACE_MINE_DISPENSER)) { specialAbilities.merge(BattleForceSPA.MDS, 1, Integer::sum); } } if ((getEntityType() & (ETYPE_SMALL_CRAFT | ETYPE_JUMPSHIP | ETYPE_FIXED_WING_SUPPORT)) == 0) { specialAbilities.put(BattleForceSPA.BOMB, getWeightClass() + 1); } if ((getEntityType() & (ETYPE_JUMPSHIP | ETYPE_CONV_FIGHTER)) == 0) { specialAbilities.put(BattleForceSPA.SPC, null); } if (isVSTOL()) { specialAbilities.put(BattleForceSPA.VSTOL, null); } }
@Override protected int implicitClanCASE() { if (!isClan() || !isFighter()) { return 0; } // Ammo is actually supposed to be assigned to a fuselage location rather than one of the four // weapon arcs. We will use LOC_NONE to record the existence of non-weapon explosive equipment. Set<Integer> caseLocations = new HashSet<>(); int explicit = 0; for (Mounted m : getEquipment()) { if ((m.getType() instanceof MiscType) && (m.getType().hasFlag(MiscType.F_CASE))) { explicit++; } else if (m.getType().isExplosive(m)) { if (m.getType() instanceof WeaponType) { caseLocations.add(m.getLocation()); } else { caseLocations.add(LOC_NONE); } } } return Math.max(0, caseLocations.size() - explicit); }
final int multiplier = ((WeaponType) bay.getType()).isCapital() ? 10 : 1; EquipmentType linker = null; final Map<AmmoType, Integer> shotsByAmmoType = bay.getBayAmmo().stream().map(num -> aero.getEquipment(num)) .collect(Collectors.groupingBy(m -> (AmmoType) m.getType(), Collectors.summingInt(Mounted::getBaseShotsLeft))); for (final Integer eqNum : bay.getBayWeapons()) { final Mounted wMount = aero.getEquipment(eqNum); if (null == wMount) { DefaultMmLogger.getInstance().error(getClass(), "createBayRow(Mounted)",
for (Mounted mounted : getEquipment()) { if ((mounted.getType() instanceof MiscType) && mounted.getType().hasFlag(MiscType.F_MODULAR_ARMOR) && (mounted.getLocation() == loc)) { double screenAmmoBV = 0; double defEqBV = 0; for (Mounted mounted : getEquipment()) { EquipmentType etype = mounted.getType(); for (Mounted mounted : getEquipment()) { int loc = mounted.getLocation(); int toSubtract = 1;
/** * Adds clan CASE in every location */ public void addClanCase() { boolean explosiveFound = false; EquipmentType clCase = EquipmentType.get("CLCASE"); for (int i = 0; i < locations(); i++) { // Ignore wings location: it's not a valid loc to put equipment in if (i == LOC_WINGS) { continue; } explosiveFound = false; for (Mounted m : getEquipment()) { if (m.getType().isExplosive(m) && (m.getLocation() == i)) { explosiveFound = true; } } if (explosiveFound) { try { addEquipment(new Mounted(this, clCase), i, false); } catch (LocationFullException ex) { // um, that's impossible. } } } }
/** * We need to check whether the weapon is mounted in LOC_AFT in addition to * isRearMounted() */ @Override public int getBattleForceTotalHeatGeneration(boolean allowRear) { int totalHeat = 0; for (Mounted mount : getWeaponList()) { WeaponType weapon = (WeaponType) mount.getType(); if (weapon instanceof BayWeapon) { for (int index : mount.getBayWeapons()) { totalHeat += ((WeaponType) (getEquipment(index).getType())).getHeat(); } } if (weapon.hasFlag(WeaponType.F_ONESHOT) || (allowRear && !mount.isRearMounted() && mount.getLocation() != LOC_AFT) || (!allowRear && (mount.isRearMounted() || mount.getLocation() == LOC_AFT))) { continue; } totalHeat += weapon.getHeat(); } return totalHeat; }
final Mounted mounted = getEquipment(wn); if (mounted.getType().hasFlag(WeaponType.F_SPACE_BOMB) || mounted.getType().hasFlag(WeaponType.F_DIVE_BOMB) || mounted.getType().hasFlag(WeaponType.F_ALT_BOMB)) {
Mounted bayW = getEquipment(wId); Mounted bayWAmmo = bayW.getLinked(); if (!(weapon.getType().hasFlag(WeaponType.F_ENERGY))