Ejemplo n.º 1
0
 /** 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;
 }
Ejemplo n.º 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;
  }
Ejemplo n.º 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;
  }
Ejemplo n.º 4
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;
  }