/** * Returns true if this weapon fires into the secondary facing arc. If * false, assume it fires into the primary. */ @Override public boolean isSecondaryArcWeapon(int weaponId) { // leg-mounted weapons fire into the primary arc, always if ((getEquipment(weaponId).getLocation() == LOC_RLEG) || (getEquipment(weaponId).getLocation() == LOC_LLEG)) { return false; } // other weapons into the secondary return true; }
/** * does this mech have TSM? */ public boolean hasTSM() { for (Mounted m : getEquipment()) { if ((m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_TSM)) { return true; } } return false; }
/** * does this mech have SCM? */ public boolean hasSCM() { for (Mounted m : getEquipment()) { if ((m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_SCM)) { return true; } } return false; }
public boolean hasCASEIIAnywhere() { for (Mounted mount : this.getEquipment()) { if ((mount.getType() instanceof MiscType) && ((MiscType) mount.getType()).hasFlag(MiscType.F_CASEII)) { return true; } } return false; }
/** * does this mech have industrial TSM= * * @return */ public boolean hasIndustrialTSM() { for (Mounted m : getEquipment()) { if ((m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_INDUSTRIAL_TSM)) { return true; } } return false; }
@Override public boolean hasCASEII(int location) { for (Mounted mount : this.getEquipment()) { if ((mount.getLocation() == location) && (mount.getType() instanceof MiscType) && ((MiscType) mount.getType()).hasFlag(MiscType.F_CASEII)) { return true; } } return false; }
@Override protected int implicitClanCASE() { if (!isClan()) { return 0; } int explicit = 0; Set<Integer> caseLocations = new HashSet<>(); for (Mounted m : getEquipment()) { if ((m.getType() instanceof MiscType) && (m.getType().hasFlag(MiscType.F_CASE))) { explicit++; } else if (m.getType().isExplosive(m)) { caseLocations.add(m.getLocation()); if (m.getSecondLocation() >= 0) { caseLocations.add(m.getSecondLocation()); } } } return Math.max(0, caseLocations.size() - explicit); }
if (turret.getType().hasFlag(MiscType.F_SHOULDER_TURRET) || turret.getType().hasFlag(MiscType.F_QUAD_TURRET)) { if (turret.getLocation() == Mech.LOC_LT) { for (Mounted mount : mech.getEquipment()) { if ((mount.getLocation() == Mech.LOC_LT) && mount.isMechTurretMounted()) { turretFacing = mount.getFacing(); for (Mounted mount : mech.getEquipment()) { if ((mount.getLocation() == Mech.LOC_RT) && mount.isMechTurretMounted()) { turretFacing = mount.getFacing(); for (Mounted mount : mech.getEquipment()) { if ((mount.getLocation() == Mech.LOC_HEAD) && mount.isMechTurretMounted()) { turretFacing = mount.getFacing();
super.addBattleForceSpecialAbilities(specialAbilities); specialAbilities.put(BattleForceSPA.SRCH, null); for (Mounted m : getEquipment()) { if (!(m.getType() instanceof MiscType)) { continue;
/** * Checks if a mech has an armed MASC system. Note that the mech will have * to exceed its normal run to actually engage the MASC system */ public boolean hasArmedMASC() { for (Mounted m : getEquipment()) { if (!m.isDestroyed() && !m.isBreached() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_MASC) && m.curMode().equals("Armed")) { return true; } } return false; }
for (Mounted mounted : getEquipment()) { EquipmentType etype = mounted.getType(); for (Mounted mounted : getEquipment()) { int loc = mounted.getLocation(); int toSubtract = 15;
/** * Does this mech have an extended retractable blade in working condition? */ public boolean hasExtendedRetractableBlade() { for (Mounted m : getEquipment()) { if (!m.isInoperable() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_CLUB) && m.getType().hasSubType(MiscType.S_RETRACTABLE_BLADE) && m.curMode().equals("extended")) { return true; } } return false; }
/** * Adds clan CASE in every location */ public void addClanCase() { boolean explosiveFound = false; EquipmentType clCase = EquipmentType.get("CLCASE"); for (int i = 0; i < locations(); i++) { 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. } } } }
final Mounted mounted = getEquipment(wn);
/** * checks if a mech has both a normal MASC system and a supercharger, * regardless of arming status */ public boolean hasMASCAndSuperCharger() { boolean hasMASC = false; boolean hasSuperCharger = false; for (Mounted m : getEquipment()) { if (!m.isInoperable() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_MASC) && m.getType().hasSubType(MiscType.S_SUPERCHARGER)) { hasSuperCharger = true; } if (!m.isInoperable() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_MASC) && !m.getType().hasSubType(MiscType.S_SUPERCHARGER)) { hasMASC = true; } } return hasMASC && hasSuperCharger; }
for (Mounted m : mech.getEquipment()) { if (m.isSplit()) { buff.append("Cannot split ").append(m.getType().getName())
/** * checks if a mech has both a normal armed MASC system and a armed super- * charger. */ public boolean hasArmedMASCAndSuperCharger() { boolean hasMASC = false; boolean hasSuperCharger = false; for (Mounted m : getEquipment()) { if (!m.isDestroyed() && !m.isBreached() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_MASC) && m.curMode().equals("Armed") && m.getType().hasSubType(MiscType.S_SUPERCHARGER)) { hasSuperCharger = true; } if (!m.isDestroyed() && !m.isBreached() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_MASC) && m.curMode().equals("Armed") && !m.getType().hasSubType(MiscType.S_SUPERCHARGER)) { hasMASC = true; } } return hasMASC && hasSuperCharger; }
for (Mounted mount : getEquipment()) { if (!mount.isArmored() || ((mount.getType() instanceof MiscType) && ((MiscType) mount