/** * does this BA have an unjettisoned DWP? * * @return */ public boolean hasDWP() { for (Mounted mounted : getWeaponList()) { if (mounted.isDWPMounted()) { if (mounted.isMissing()) { continue; } else if ((mounted.getLinked() != null) && (mounted.getLinked().getUsableShotsLeft() > 0)) { return true; } else if ((mounted.getLinked() == null) && !mounted.isMissing()) { return true; } } } return false; }
public boolean canLayMine() { for (Object oMount : miscList) { Mounted mount = (Mounted) oMount; EquipmentType type = mount.getType(); if (!mount.isMissing() && (type.hasFlag(MiscType.F_MINE) || type .hasFlag(MiscType.F_VEHICLE_MINE_DISPENSER)) && !isLayingMines()) { return true; } } return false; }
/** * 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; }
@Override public void updateConditionFromEntity(boolean checkForDestruction) { if(null != unit) { Mounted mounted = unit.getEntity().getEquipment(equipmentNum); if(null != mounted) { capacity = mounted.getAmmoCapacity(); type = mounted.getType(); if(mounted.isMissing() || mounted.isDestroyed()) { mounted.setShotsLeft(0); return; } shotsNeeded = getFullShots() - mounted.getBaseShotsLeft(); } } }
@Override public void updateConditionFromEntity(boolean checkForDestruction) { if(null != unit) { Mounted mounted = unit.getEntity().getEquipment(equipmentNum); if(null != mounted) { if(mounted.isMissing() || mounted.isDestroyed()) { mounted.setShotsLeft(0); remove(false); return; } if (type == mounted.getType()) { shotsNeeded = getFullShots() - mounted.getBaseShotsLeft(); } } } }
/** * 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; }
/** * 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; }
/** * 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; }
@Override public void updateConditionFromEntity(boolean checkForDestruction) { if(null != unit) { int priorHits = hits; Mounted mounted = unit.getEntity().getEquipment(equipmentNum); if(null != mounted) { if(mounted.isMissing()) { remove(false); return; } hits = unit.getEntity().getDamagedCriticals(CriticalSlot.TYPE_EQUIPMENT, equipmentNum, mounted.getLocation()); } if(checkForDestruction && hits > priorHits && Compute.d6(2) < campaign.getCampaignOptions().getDestroyPartTarget()) { remove(false); return; } } }
/** * This counts the number of UMU's a Mech has that are still viable * * @return number <code>int</code>of useable UMU's */ public int getActiveUMUCount() { int count = 0; if (this instanceof Infantry) { if ((getMovementMode() == EntityMovementMode.INF_UMU) || (getMovementMode() == EntityMovementMode.SUBMARINE)) { // UMU MP for Infantry is stored in jumpMP return jumpMP; } } if (hasShield() && (getNumberOfShields(MiscType.S_SHIELD_LARGE) > 0)) { return 0; } for (Mounted m : getMisc()) { EquipmentType type = m.getType(); if ((type instanceof MiscType) && type.hasFlag(MiscType.F_UMU) && !(m.isDestroyed() || m.isMissing() || m.isBreached())) { count++; } } return count; }
/** * 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; }
@Override public void updateConditionFromEntity(boolean checkForDestruction) { if(null != unit) { int priorHits = hits; Mounted mounted = unit.getEntity().getEquipment(equipmentNum); if(null != mounted) { if(mounted.isMissing()) { remove(false); return; } hits = unit.getEntity().getDamagedCriticals(CriticalSlot.TYPE_EQUIPMENT, equipmentNum, mounted.getLocation()); } if(checkForDestruction && hits > priorHits && Compute.d6(2) < campaign.getCampaignOptions().getDestroyPartTarget()) { remove(false); return; } } }
/** * Check to see if a 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; }
/** * 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; }
&& !mounted.isDestroyed() && !mounted.isBreached() && !mounted.isMissing()) { if (mounted.getLocation() == Mech.LOC_LLEG) { leftLeg = true;
@Override public void updateConditionFromEntity(boolean checkForDestruction) { if(null != unit) { int priorHits = hits; Mounted mounted = unit.getEntity().getEquipment(equipmentNum); if(null != mounted) { if(mounted.isMissing()) { remove(false); return; } hits = unit.getEntity().getDamagedCriticals(CriticalSlot.TYPE_EQUIPMENT, equipmentNum, mounted.getLocation()); if(mounted.isSplit()) { hits += unit.getEntity().getDamagedCriticals(CriticalSlot.TYPE_EQUIPMENT, equipmentNum, mounted.getSecondLocation()); } omniPodded = mounted.isOmniPodMounted(); } if(checkForDestruction && hits > priorHits && Compute.d6(2) < campaign.getCampaignOptions().getDestroyPartTarget()) { remove(false); 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; }