@Override public boolean hasArmoredChassis() { for (Mounted misc : miscList) { if (misc.getType().hasFlag(MiscType.F_ARMORED_CHASSIS)) { return true; } } return false; }
@Override public boolean hasArmoredChassis() { for (Mounted misc : miscList) { if (misc.getType().hasFlag(MiscType.F_ARMORED_CHASSIS)) { return true; } } return false; }
public static double getTonnageIncrement(EquipmentType type) { if((type.hasFlag(MiscType.F_CLUB) && type.hasSubType(MiscType.S_RETRACTABLE_BLADE))) { return 0.5; } return 1; }
public List<Mounted> getClubs() { List<Mounted> rv = new ArrayList<Mounted>(); for (Mounted m : getMisc()) { if (m.getType().hasFlag(MiscType.F_CLUB)) { rv.add(m); } } return rv; }
public EquipmentType getArmorKit() { Optional<Mounted> kit = getEquipment().stream() .filter(m -> m.getType().hasFlag(MiscType.F_ARMOR_KIT)) .findFirst(); if (kit.isPresent()) { return kit.get().getType(); } else { return null; } }
public boolean hasCompactHeatSinks() { for (Mounted mounted : getMisc()) { if (mounted.getType().hasFlag(MiscType.F_COMPACT_HEAT_SINK)) { return true; } } return false; }
@Override public int getVibroClaws() { int claws = 0; for (Mounted mounted : getMisc()) { if (mounted.getType().hasFlag(MiscType.F_VIBROCLAW)) { claws++; } } return claws; }
public static int maxJumpMP(Protomech proto) { if (proto.getMisc().stream().map(Mounted::getType) .anyMatch(eq -> eq.hasFlag(MiscType.F_JUMP_JET) && eq.hasSubType(MiscType.S_IMPROVED))) { return (int) Math.ceil(proto.getOriginalWalkMP() * 1.5); } return proto.getOriginalWalkMP(); }
@Override public void autoSetMaxBombPoints() { // fixed wing support craft need external stores hardpoints to be able to carry bombs int bombpoints = 0; for (Mounted misc : getMisc()) { if (misc.getType().hasFlag(MiscType.F_EXTERNAL_STORES_HARDPOINT)) { bombpoints++; } } maxBombPoints = bombpoints; }
@Override public double getBaseBattleForceMovement() { double move = getOriginalWalkMP(); if (getMisc().stream().filter(m -> m.getType().hasFlag(MiscType.F_MASC)) .map(m -> m.getType().getSubType()) .anyMatch(st -> st == MiscType.S_SUPERCHARGER)) { move *= 1.25; } return move; }
/** * 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 void deactivateRadicalHS() { for (Mounted m : getMisc()) { if (m.getType().hasFlag(MiscType.F_RADICAL_HEATSINK)) { m.setMode("Off"); // Can only have one radical heat sink break; } } }
public boolean hasNovaCEWS() { for (Mounted m : getEquipment()) { if ((m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_NOVA) && !m.isInoperable()) { return true; } } return false; }
public boolean hasActivatedRadicalHS() { for (Mounted m : getMisc()) { if (m.getType().hasFlag(MiscType.F_RADICAL_HEATSINK) && m.curMode().equals("On")) { return true; } } return false; }
/** * 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 static int findCorrectRepairType(IPartWork part) { if ((part instanceof EquipmentPart && ((EquipmentPart)part).getType() instanceof WeaponType) || (part instanceof MissingEquipmentPart && ((MissingEquipmentPart)part).getType() instanceof WeaponType)) { return Part.REPAIR_PART_TYPE.WEAPON; } else { if (part instanceof EquipmentPart && ((EquipmentPart)part).getType().hasFlag(MiscType.F_CLUB)) { return Part.REPAIR_PART_TYPE.PHYSICAL_WEAPON; } return part.getRepairPartType(); } } }
private int emptyBaysInLoc(int loc) { int bays = 0; for (CriticalSlot slot : crits[loc]) { if ((slot != null) && (slot.getType() == CriticalSlot.TYPE_EQUIPMENT) && slot.getMount2() == null && slot.getMount().getType() instanceof MiscType && slot.getMount().getType().hasFlag(MiscType.F_BOMB_BAY)) { bays++; } } return bays; }
@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); } }
public boolean hasLinkedMGA(Mounted mounted) { for (Mounted m : getWeaponList()) { if ((m.getLocation() == mounted.getLocation()) && m.getType().hasFlag(WeaponType.F_MGA) && !(m.isDestroyed() || m.isBreached()) && m.getBayWeapons().contains(getEquipmentNum(mounted)) && m.getType().hasModes() && m.curMode().equals("Linked")) { return true; } } return false; }