Пример #1
0
  /** Called when the quit buttons is pressed or the main menu is closed. */
  static void quit() {
    PreferenceManager.getInstance().save();

    try {
      WeaponOrderHandler.saveWeaponOrderFile();
    } catch (IOException e) {
      System.out.println("Error saving custom weapon orders!");
      e.printStackTrace();
    }

    try {
      QuirksHandler.saveCustomQuirksList();
    } catch (IOException e) {
      System.out.println("Error saving quirks override!");
      e.printStackTrace();
    }

    System.exit(0);
  }
Пример #2
0
  @Override
  public boolean isCrippled() {
    if (getArmor(LOC_FRONT) < 1 && getOArmor(LOC_FRONT) > 0) {
      if (PreferenceManager.getClientPreferences().debugOutputOn()) {
        System.out.println(getDisplayName() + " CRIPPLED: Front armor destroyed.");
      }
      return true;
    }
    if (getArmor(LOC_FRONTRIGHT) < 1 && getOArmor(LOC_FRONTRIGHT) > 0) {
      if (PreferenceManager.getClientPreferences().debugOutputOn()) {
        System.out.println(getDisplayName() + " CRIPPLED: Front Right armor destroyed.");
      }
      return true;
    }
    if (getArmor(LOC_FRONTLEFT) < 1 && getOArmor(LOC_FRONTLEFT) > 0) {
      if (PreferenceManager.getClientPreferences().debugOutputOn()) {
        System.out.println(getDisplayName() + " CRIPPLED: Front Left armor destroyed.");
      }
      return true;
    }
    if (getArmor(LOC_REARRIGHT) < 1 && getOArmor(LOC_REARRIGHT) > 0) {
      if (PreferenceManager.getClientPreferences().debugOutputOn()) {
        System.out.println(getDisplayName() + " CRIPPLED: Rear Right armor destroyed.");
      }
      return true;
    }
    if (getArmor(LOC_REARLEFT) < 1 && getOArmor(LOC_REARLEFT) > 0) {
      if (PreferenceManager.getClientPreferences().debugOutputOn()) {
        System.out.println(getDisplayName() + " CRIPPLED: Rear Left armor destroyed.");
      }
      return true;
    }
    if (!hasNoTurret() && (getArmor(LOC_TURRET) < 1 && getOArmor(LOC_TURRET) > 0)) {
      if (PreferenceManager.getClientPreferences().debugOutputOn()) {
        System.out.println(getDisplayName() + " CRIPPLED: Turret armor destroyed.");
      }
      return true;
    }
    if (!hasNoDualTurret() && (getArmor(LOC_TURRET_2) < 1 && getOArmor(LOC_TURRET_2) > 0)) {
      if (PreferenceManager.getClientPreferences().debugOutputOn()) {
        System.out.println(getDisplayName() + " CRIPPLED: Front Turret armor destroyed.");
      }
      return true;
    }
    if (getArmor(LOC_REAR) < 1 && getOArmor(LOC_REAR) > 0) {
      if (PreferenceManager.getClientPreferences().debugOutputOn()) {
        System.out.println(getDisplayName() + " CRIPPLED: Rear armor destroyed.");
      }
      return true;
    }

    if (isPermanentlyImmobilized(true)) {
      if (PreferenceManager.getClientPreferences().debugOutputOn()) {
        System.out.println(getDisplayName() + " CRIPPLED: Immobilized.");
      }
      return true;
    }

    // If this is not a military vehicle, we don't need to do a weapon
    // check.
    if (!isMilitary()) {
      return false;
    }

    // no weapons can fire anymore, can cause no more than 5 points of
    // combined weapons damage,
    // or has no weapons with range greater than 5 hexes
    if (!hasViableWeapons()) {
      System.out.println(getDisplayName() + " CRIPPLED: has no more viable weapons.");
      return true;
    }
    return false;
  }