public int getNumberOfSinks() { int sinks = 0; for (Mounted mounted : getMisc()) { if (mounted.isDestroyed() || mounted.isBreached()) { continue; } if (mounted.getType().hasFlag(MiscType.F_HEAT_SINK)) { sinks++; } else if (mounted.getType().hasFlag(MiscType.F_DOUBLE_HEAT_SINK)) { sinks++; } } return sinks; }
/** * does this mech have working jump boosters? * * @return */ public boolean hasJumpBoosters() { boolean jumpBoosters = false; for (Mounted mEquip : getMisc()) { MiscType mtype = (MiscType) mEquip.getType(); if (mtype.hasFlag(MiscType.F_JUMP_BOOSTER)) { // one crit destroyed they all all screwed // --Torren if (mEquip.isBreached() || mEquip.isDestroyed() || mEquip.isMissing()) { return false; } jumpBoosters = true; } } return jumpBoosters; }
public boolean canFire(boolean isStrafing) { // Equipment operational? if (!isReady(isStrafing) || isBreached() || isMissing() || isFired()) { return false; } // Is the entity even active? if (entity.isShutDown() || ((null != entity.getCrew()) && !entity.getCrew().isActive())) { return false; } // Otherwise, the equipment can be fired. return true; }
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; }
/** * 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; }
/** * Set the retractable blade in the given location as extended Takes the * first piece of appropriate equipment */ public void extendBlade(int loc) { for (Mounted m : getEquipment()) { if ((m.getLocation() == loc) && !m.isDestroyed() && !m.isBreached() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_CLUB) && m.getType().hasSubType(MiscType.S_RETRACTABLE_BLADE)) { m.setMode("extended"); return; } } }
/** * Does the entity have a retracted blade in the given location */ @Override public boolean hasRetractedBlade(int loc) { for (Mounted m : getEquipment()) { if ((m.getLocation() == loc) && !m.isDestroyed() && !m.isBreached() && (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; }
/** * 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") || m.getType().hasSubType( MiscType.S_JETBOOSTER))) { return true; } } return false; }
/** * Checks to see if this unit has a functional Blue Shield Particle Field * Damper that is turned on * * @return <code>true</code> if the entity has a working, switched on blue * field <code>false</code> otherwise */ public boolean hasActiveBlueShield() { if (!isShutDown()) { for (Mounted m : getMisc()) { EquipmentType type = m.getType(); if ((type instanceof MiscType) && type.hasFlag(MiscType.F_BLUE_SHIELD) && m.curMode().equals("On")) { return !(m.isDestroyed() || m.isMissing() || m.isBreached() || isShutDown()); } } } return false; }
/** * Checks to see if this bipedmech has a vibroblade in this location. * * @param location * @return boolean <code>true</code> if the mech has vibroblades * <code>false</code> if not. */ public boolean hasVibrobladesInLocation(int location) { // Only arms have VibroBlades. if ((location != Mech.LOC_RARM) && (location != Mech.LOC_LARM)) { return false; } for (int slot = 0; slot < this.getNumberOfCriticals(location); slot++) { CriticalSlot cs = getCritical(location, slot); if (cs == null) { continue; } if (cs.getType() != CriticalSlot.TYPE_EQUIPMENT) { continue; } Mounted m = cs.getMount(); EquipmentType type = m.getType(); if ((type instanceof MiscType) && ((MiscType) type).isVibroblade()) { return !(m.isDestroyed() || m.isMissing() || m.isBreached()); } } return false; }
/** * QuadVees cannot benefit from MASC in vehicle mode, so in that case we only return true if there * is an armed supercharger. */ @Override public boolean hasArmedMASC() { boolean superchargerOnly = getConversionMode() == CONV_MODE_VEHICLE; for (Mounted m : getEquipment()) { if (!m.isDestroyed() && !m.isBreached() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_MASC) && (!superchargerOnly || m.getType().getSubType() == MiscType.S_SUPERCHARGER) && m.curMode().equals("Armed")) { return true; } } return false; }
/** * Checks is Biped Mek has functional AES in the location. Only works for * Arms */ @Override public boolean hasFunctionalArmAES(int location) { boolean hasAES = false; if ((location != Mech.LOC_RARM) && (location != Mech.LOC_LARM)) { return false; } for (Mounted mounted : getMisc()) { if ((mounted.getLocation() == location) && mounted.getType().hasFlag(MiscType.F_ACTUATOR_ENHANCEMENT_SYSTEM) && !mounted.isDestroyed() && !mounted.isBreached() && !mounted.isMissing()) { hasAES = true; } // AES is destroyed their for it cannot be used. else if ((mounted.getLocation() == location) && mounted.getType().hasFlag(MiscType.F_ACTUATOR_ENHANCEMENT_SYSTEM)) { return false; } } return hasAES; }
/** * Does the entity have a retracted blade in the given location */ @Override public boolean hasRetractedBlade(int loc) { for (Mounted m : getEquipment()) { if ((m.getLocation() == loc) && !m.isDestroyed() && !m.isBreached() && (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; }
/** * 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; }
/** * Check to see if a Biped mech has a claw in one of its arms * * @param location (LOC_RARM or LOC_LARM) * @return True/False */ public boolean hasClaw(int location) { // only arms have claws. if ((location != Mech.LOC_RARM) && (location != Mech.LOC_LARM)) { return false; } for (int slot = 0; slot < this.getNumberOfCriticals(location); slot++) { CriticalSlot cs = getCritical(location, slot); if (cs == null) { continue; } if (cs.getType() != CriticalSlot.TYPE_EQUIPMENT) { continue; } Mounted m = cs.getMount(); EquipmentType type = m.getType(); if ((type instanceof MiscType) && type.hasFlag(MiscType.F_HAND_WEAPON) && type.hasSubType(MiscType.S_CLAW)) { return !(m.isDestroyed() || m.isMissing() || m.isBreached()); } } return false; }
/** * Returns the number of (working) jump jets mounted in the torsos. */ public int torsoJumpJets() { int jump = 0; for (Mounted mounted : getMisc()) { if (mounted.getType().hasFlag(MiscType.F_JUMP_JET) && !mounted.isDestroyed() && !mounted.isBreached() && locationIsTorso(mounted.getLocation())) { jump++; } } // apply Partial Wing bonus if we have the ability to jump if (jump > 0) { for (Mounted mount : getMisc()) { if (mount.getType().hasFlag(MiscType.F_PARTIAL_WING)) { jump += getPartialWingJumpBonus(mount); break; } } } return jump; }
/** * Checks for functional AES in both legs */ @Override public boolean hasFunctionalLegAES() { boolean rightLeg = false; boolean leftLeg = false; for (Mounted mounted : getMisc()) { if ((mounted.getLocation() == Mech.LOC_LLEG) || (mounted.getLocation() == Mech.LOC_RLEG)) { if (((MiscType) mounted.getType()).hasFlag(MiscType.F_ACTUATOR_ENHANCEMENT_SYSTEM) && !mounted .isDestroyed() && !mounted.isBreached() && !mounted.isMissing()) { if (mounted.getLocation() == Mech.LOC_LLEG) { leftLeg = true; } else { rightLeg = true; } }// AES is destroyed their for it cannot be used. else if (((MiscType) mounted.getType()).hasFlag(MiscType.F_ACTUATOR_ENHANCEMENT_SYSTEM)) { return false; } } } return rightLeg && leftLeg; }
/** * destroys the first retractable blade critical slot found */ public void destroyRetractableBlade(int loc) { // check critical slots for (int i = 0; i < this.getNumberOfCriticals(loc); i++) { CriticalSlot slot = getCritical(loc, i); // ignore empty & system slots if ((slot == null) || (slot.getType() != CriticalSlot.TYPE_EQUIPMENT)) { continue; } Mounted m = slot.getMount(); if ((m.getLocation() == loc) && !m.isHit() && !m.isBreached() && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_CLUB) && m.getType().hasSubType(MiscType.S_RETRACTABLE_BLADE)) { slot.setHit(true); m.setHit(true); return; } } }
/** * Checks for functional AES in all legs */ @Override public boolean hasFunctionalLegAES() { boolean frontRightLeg = false; boolean frontLeftLeg = false; boolean rearRightLeg = false; boolean rearLeftLeg = false; for (Mounted mounted : getMisc()) { if ((mounted.getLocation() == Mech.LOC_LLEG) || (mounted.getLocation() == Mech.LOC_RLEG) || (mounted.getLocation() == Mech.LOC_LARM) || (mounted.getLocation() == Mech.LOC_RARM)) { if (((MiscType) mounted.getType()).hasFlag(MiscType.F_ACTUATOR_ENHANCEMENT_SYSTEM) && !mounted.isDestroyed() && !mounted.isBreached() && !mounted.isMissing()) { if (mounted.getLocation() == Mech.LOC_LLEG) { rearLeftLeg = true; } else if (mounted.getLocation() == Mech.LOC_RLEG) { rearRightLeg = true; } else if (mounted.getLocation() == Mech.LOC_RARM) { frontRightLeg = true; } else { frontLeftLeg = true; } }// AES is destroyed their for it cannot be used. else if (((MiscType) mounted.getType()).hasFlag(MiscType.F_ACTUATOR_ENHANCEMENT_SYSTEM)) { return false; } } } return frontLeftLeg && frontRightLeg && rearRightLeg && rearLeftLeg; }
/** * Checks to see if this unit has a functional AngelECM unit that is using * ECCM. * * @return <code>true</code> if the entity has angelecm and it is in ECCM * mode <code>false</code> if the entity does not have angel ecm or * it is not in eccm mode or it is damaged. */ public boolean hasActiveAngelECCM() { if (game.getOptions().booleanOption(OptionsConstants.ADVANCED_TACOPS_ANGEL_ECM) && game.getOptions().booleanOption(OptionsConstants.ADVANCED_TACOPS_ECCM) && !isShutDown()) { for (Mounted m : getMisc()) { EquipmentType type = m.getType(); if ((type instanceof MiscType) && type.hasFlag(MiscType.F_ANGEL_ECM) && (m.curMode().equals("ECCM") || m.curMode().equals("ECM & ECCM") || m .curMode().equals("ECCM & Ghost Targets"))) { return !(m.isDestroyed() || m.isMissing() || m.isBreached() || isShutDown()); } } } return false; }