Пример #1
0
  /**
   * 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;
  }
Пример #2
0
  /** Does the mech have an shield in no defense mode */
  @Override
  public boolean hasNoDefenseShield(int location) {

    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;
      }

      if (cs.isDamaged()) {
        continue;
      }

      Mounted m = cs.getMount();
      EquipmentType type = m.getType();
      if ((type instanceof MiscType)
          && ((MiscType) type).isShield()
          && (m.curMode().equals(MiscType.S_NO_SHIELD)
              || isShutDown()
              || // if
              // he
              // has
              // a
              // shield
              // and
              // the mek is SD or pilot
              // KOed then it goes to no
              // defense mode
              getCrew().isKoThisRound()
              || getCrew().isUnconscious())) {
        return m.getCurrentDamageCapacity(this, m.getLocation()) > 0;
      }
    }
    return false;
  }
Пример #3
0
  /**
   * Does the mech have a passive shield This should only be called by
   * hasPassiveShield(location,rear)
   */
  @Override
  public boolean hasPassiveShield(int location) {

    if (isShutDown() || (getCrew().isKoThisRound() || getCrew().isUnconscious())) {
      return false;
    }

    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;
      }

      if (cs.isDamaged()) {
        continue;
      }

      Mounted m = cs.getMount();
      EquipmentType type = m.getType();
      if ((type instanceof MiscType)
          && ((MiscType) type).isShield()
          && m.curMode().equals(MiscType.S_PASSIVE_SHIELD)) {
        return m.getCurrentDamageCapacity(this, m.getLocation()) > 0;
      }
    }
    return false;
  }
Пример #4
0
 /**
  * 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;
 }
Пример #5
0
  @Override
  public int getActiveVibrobladeHeat(int location, boolean ignoreMode) {
    // Only arms have VibroBlades.
    if ((location != Mech.LOC_RARM) && (location != Mech.LOC_LARM)) {
      return 0;
    }

    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()
          && (m.curMode().equals("Active") || ignoreMode)
          && !(m.isDestroyed() || m.isMissing() || m.isBreached())) {
        MiscType blade = (MiscType) type;
        if (blade.hasSubType(MiscType.S_VIBRO_LARGE)) {
          return 7;
        }
        if (blade.hasSubType(MiscType.S_VIBRO_MEDIUM)) {
          return 5;
        }
        // else
        return 3;
      }
    }

    return 0;
  }