/** * Check to see how many shields of a certain size a mek has. you can have * up to shields per mek. However they can be of different size and each * size has its own draw backs. So check each size and add modifers based on * the number shields of that size. */ @Override public int getNumberOfShields(long size) { int raShield = 0; int laShield = 0; for (Mounted m : getMisc()) { EquipmentType type = m.getType(); if ((type instanceof MiscType) && type.hasFlag(MiscType.F_CLUB) && (type.hasSubType(size))) { // ok so we have a shield of certain size. no which arm is it. if (m.getLocation() == Mech.LOC_RARM) { raShield = 1; } if (m.getLocation() == Mech.LOC_LARM) { laShield = 1; } // break now. if ((raShield > 0) && (laShield > 0)) { return 2; } } } return raShield + laShield; }
/** * 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 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; }
/** * Does the mech have any shields. a mech can have up to 2 shields. * * @return <code>true</code> if unit has a shield crit. */ @Override public boolean hasShield() { for (Mounted m : getMisc()) { boolean isShield = (m.getType() instanceof MiscType) && ((MiscType) m.getType()).isShield(); if (((m.getLocation() == Mech.LOC_LARM) || (m.getLocation() == Mech.LOC_RARM)) && isShield && !m.isInoperable() && (getInternal(m.getLocation()) > 0)) { for (int slot = 0; slot < this.getNumberOfCriticals(m.getLocation()); slot++) { CriticalSlot cs = getCritical(m.getLocation(), slot); if ((cs != null) && (cs.getType() == CriticalSlot.TYPE_EQUIPMENT) && cs.getMount().equals(m) && !cs.isDestroyed() && !cs.isMissing()) { // when all crits of a shield are destroyed, it // no longer hinders movement and stuff return true; } } } } return false; }
for (Mounted m : getMisc()) { if (m.getType().hasFlag(MiscType.F_TRACKS)) { if (m.isHit() || isLocationBad(m.getLocation())) {