public Vector<Mounted> getBombs(BigInteger flag) { Vector<Mounted> bombs = new Vector<Mounted>(); for (Mounted bomb : getBombs()) { BombType btype = (BombType) bomb.getType(); if (!bomb.isInoperable() && (bomb.getUsableShotsLeft() > 0) && btype.hasFlag(flag)) { bombs.add(bomb); } } return bombs; } /**
/** * does this mech mount MASC? * * @return */ public boolean hasMASC() { for (Mounted mEquip : getMisc()) { MiscType mtype = (MiscType) mEquip.getType(); if (mtype.hasFlag(MiscType.F_MASC) && !mEquip.isInoperable()) { return true; } } return false; }
/** * does this protomech mount a myomer booster? * * @return */ public boolean hasMyomerBooster() { for (Mounted mEquip : getMisc()) { MiscType mtype = (MiscType) mEquip.getType(); if (mtype.hasFlag(MiscType.F_MASC) && !mEquip.isInoperable()) { return true; } } return false; }
/** * does this ba mount a myomer booster? * * @return */ public boolean hasMyomerBooster() { for (Mounted mEquip : getMisc()) { MiscType mtype = (MiscType) mEquip.getType(); if (mtype.hasFlag(MiscType.F_MASC) && !mEquip.isInoperable()) { return true; } } return false; }
/** * Returns true if the unit has a usable spotlight. It considers both * externally mounted spotlights as well as internally mounted ones. * * @return */ public boolean hasSpotlight() { for (Mounted m : getMisc()) { if (m.getType().hasFlag(MiscType.F_SEARCHLIGHT) && !m.isInoperable()) { return true; } } return hasExternalSpotlight; }
/** * Returns wether or not this entity has a Targeting Computer. */ public boolean hasTargComp() { for (Mounted m : getMisc()) { if ((m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_TARGCOMP)) { return !m.isInoperable(); } } return false; }
public boolean hasNovaCEWS() { for (Mounted m : getEquipment()) { if ((m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_NOVA) && !m.isInoperable()) { return true; } } return false; }
/** * @return the tonnage of additional mounted communications equipment */ public int getExtraCommGearTons() { int i = 0; for (Mounted mounted : miscList) { if (mounted.getType().hasFlag(MiscType.F_COMMUNICATIONS) && !mounted.isInoperable()) { i += mounted.getType().getTonnage(this); } } return i; }
public boolean hasNavalC3() { if (isShutDown() || isOffBoard()) { return false; } for (Mounted m : getEquipment()) { if ((m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_NAVAL_C3) && !m.isInoperable()) { return true; } } return false; }
public boolean hasBoostedC3() { if (isShutDown() || isOffBoard()) { return false; } for (Mounted m : getEquipment()) { if ((m.getType().hasFlag(MiscType.F_C3SBS) || m.getType().hasFlag( WeaponType.F_C3MBS)) && !m.isInoperable()) { return true; } } return false; }
/** * 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; }
public int countWorkingMisc(BigInteger flag, int location) { int count = 0; OUTER: for (Mounted m : getMisc()) { if (!m.isInoperable() && m.getType().hasFlag(flag) && ((location == -1) || (m.getLocation() == location))) { if (m.getType().hasModes()) { for (Enumeration<EquipmentMode> e = m.getType().getModes(); e.hasMoreElements();) { if (e.nextElement().equals("On") && !m.curMode().equals("On")) { continue OUTER; } } } count++; } } return count; }
@Override protected AttackHandler getCorrectHandler(ToHitData toHit, WeaponAttackAction waa, IGame game, Server server) { Mounted linkedBy = waa.getEntity(game).getEquipment(waa.getWeaponId()) .getLinkedBy(); if ((linkedBy != null) && !linkedBy.isInoperable() && linkedBy.getType().hasFlag(MiscType.F_LASER_INSULATOR)) { return new InsulatedLaserWeaponHandler(toHit, waa, game, server); } return new EnergyWeaponHandler(toHit, waa, game, server); } }
/** * 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; }
/** * @return the initiative bonus this Entity grants for HQ */ public int getHQIniBonus() { int bonus = 0; for (Mounted misc : getMisc()) { if (misc.getType().hasFlag(MiscType.F_COMMUNICATIONS) && misc.curMode().equals("Default") && !misc.isInoperable()) { if (getTotalCommGearTons() >= 3) { bonus += 1; } if (getTotalCommGearTons() >= 7) { bonus += 1; } break; } } return bonus; }
/** * Returns whether this 'mech has a C3 Slave or not. */ public boolean hasC3S() { if (isShutDown() || isOffBoard()) { return false; } for (Mounted m : getEquipment()) { if ((m.getType() instanceof MiscType) && (m.getType().hasFlag(MiscType.F_C3S) || m.getType() .hasFlag(MiscType.F_C3SBS)) && !m.isInoperable()) { return true; } } return false; }
/** * Checks if we have nova CEWS that is not offline. * * @return */ public boolean hasActiveNovaCEWS() { if (isShutDown() || isOffBoard()) { return false; } for (Mounted m : getEquipment()) { if ((m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_NOVA) && !m.isInoperable() && !m.curMode().equals("Off")) { return true; } } return false; }
public boolean hasC3i() { if (isShutDown() || isOffBoard()) { return false; } for (Mounted m : getEquipment()) { if ((m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_C3I) && !m.isInoperable()) { return true; } } // check for Manei Domini implants if ((this instanceof Infantry) && (null != crew) //Fix for Bug Report #1194 && hasAbility(OptionsConstants.MD_ENH_MM_IMPLANTS) && hasAbility(OptionsConstants.MD_BOOST_COMM_IMPLANT)) { return true; } return false; }
/** * WOR Does the mech have a functioning ECM unit? */ public boolean hasActiveNovaECM() { // no ECM in space unless strat op option enabled if (game.getBoard().inSpace() && !game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_STRATOPS_ECM)) { return false; } if (!isShutDown()) { for (Mounted m : getMisc()) { EquipmentType type = m.getType(); if ((type instanceof MiscType) && type.hasFlag(MiscType.F_NOVA) && m.curMode().equals("ECM")) { return !(m.isInoperable()); } } } return false; }
/** * Does the mech have a functioning ECM unit? */ public boolean hasActiveAngelECM() { // no ECM in space unless strat op option enabled if (game.getBoard().inSpace() && !game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_STRATOPS_ECM)) { return false; } if (game.getOptions().booleanOption(OptionsConstants.ADVANCED_TACOPS_ANGEL_ECM) && !isShutDown()) { for (Mounted m : getMisc()) { EquipmentType type = m.getType(); if ((type instanceof MiscType) && type.hasFlag(MiscType.F_ANGEL_ECM) && (m.curMode().equals("ECM") || m.curMode().equals("ECM & ECCM") || m .curMode().equals("ECM & Ghost Targets"))) { return !(m.isInoperable()); } } } return false; }