Esempio n. 1
0
  public double calculateTotalHeat() {
    double heat = 0;

    if (getMech().getOriginalJumpMP() > 0) {
      if (getMech().getJumpType() == Mech.JUMP_IMPROVED) {
        heat += Math.max(3, Math.ceil(getMech().getOriginalJumpMP() / 2.0f));
      } else if (getMech().getJumpType() != Mech.JUMP_BOOSTER) {
        heat += Math.max(3, getMech().getOriginalJumpMP());
      }
      if (getMech().getEngine().getEngineType() == Engine.XXL_ENGINE) {
        heat *= 2;
      }
    } else if (getMech().getEngine().getEngineType() == Engine.XXL_ENGINE) {
      heat += 6;
    } else {
      heat += 2;
    }

    if (getMech().hasNullSig()) {
      heat += 10;
    }

    if (getMech().hasChameleonShield()) {
      heat += 6;
    }

    for (Mounted mounted : getMech().getWeaponList()) {
      WeaponType wtype = (WeaponType) mounted.getType();
      double weaponHeat = wtype.getHeat();

      // only count non-damaged equipment
      if (mounted.isMissing() || mounted.isHit() || mounted.isDestroyed() || mounted.isBreached()) {
        continue;
      }

      // one shot weapons count 1/4
      if ((wtype.getAmmoType() == AmmoType.T_ROCKET_LAUNCHER)
          || wtype.hasFlag(WeaponType.F_ONESHOT)) {
        weaponHeat *= 0.25;
      }

      // double heat for ultras
      if ((wtype.getAmmoType() == AmmoType.T_AC_ULTRA)
          || (wtype.getAmmoType() == AmmoType.T_AC_ULTRA_THB)) {
        weaponHeat *= 2;
      }

      // Six times heat for RAC
      if (wtype.getAmmoType() == AmmoType.T_AC_ROTARY) {
        weaponHeat *= 6;
      }

      // half heat for streaks
      if ((wtype.getAmmoType() == AmmoType.T_SRM_STREAK)
          || (wtype.getAmmoType() == AmmoType.T_MRM_STREAK)
          || (wtype.getAmmoType() == AmmoType.T_LRM_STREAK)) {
        weaponHeat *= 0.5;
      }
      heat += weaponHeat;
    }
    return heat;
  }