Exemple #1
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;
  }
Exemple #2
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;
  }