コード例 #1
0
ファイル: TestTank.java プロジェクト: rhubarbselleven/megamek
  private int getTankCountHeatLaserWeapons() {
    int heat = 0;
    for (Mounted m : tank.getWeaponList()) {
      WeaponType wt = (WeaponType) m.getType();
      if ((wt.hasFlag(WeaponType.F_LASER) && (wt.getAmmoType() == AmmoType.T_NA))
          || wt.hasFlag(WeaponType.F_PPC)
          || wt.hasFlag(WeaponType.F_PLASMA)
          || wt.hasFlag(WeaponType.F_PLASMA_MFUK)
          || (wt.hasFlag(WeaponType.F_FLAMER) && (wt.getAmmoType() == AmmoType.T_NA))) {
        heat += wt.getHeat();
      }
      // laser insulator reduce heat by 1, to a minimum of 1
      if (wt.hasFlag(WeaponType.F_LASER)
          && (m.getLinkedBy() != null)
          && !m.getLinkedBy().isInoperable()
          && m.getLinkedBy().getType().hasFlag(MiscType.F_LASER_INSULATOR)) {
        heat -= 1;
        if (heat == 0) {
          heat++;
        }
      }

      if ((m.getLinkedBy() != null)
          && (m.getLinkedBy().getType() instanceof MiscType)
          && m.getLinkedBy().getType().hasFlag(MiscType.F_PPC_CAPACITOR)) {
        heat += 5;
      }
    }
    for (Mounted m : tank.getMisc()) {
      MiscType mtype = (MiscType) m.getType();
      // mobile HPGs count as energy weapons for construction purposes
      if (mtype.hasFlag(MiscType.F_MOBILE_HPG)) {
        heat += 20;
      }
      if (mtype.hasFlag(MiscType.F_RISC_LASER_PULSE_MODULE)) {
        heat += 2;
      }
      if (mtype.hasFlag(MiscType.F_VIRAL_JAMMER_DECOY)
          || mtype.hasFlag(MiscType.F_VIRAL_JAMMER_DECOY)) {
        heat += 12;
      }
    }
    return heat;
  }
コード例 #2
0
ファイル: TestTank.java プロジェクト: rhubarbselleven/megamek
 @Override
 public float getWeightPowerAmp() {
   if (!engine.isFusion() && (engine.getEngineType() != Engine.FISSION)) {
     int weight = 0;
     for (Mounted m : tank.getWeaponList()) {
       WeaponType wt = (WeaponType) m.getType();
       if (wt.hasFlag(WeaponType.F_ENERGY)
           && !(wt instanceof CLChemicalLaserWeapon)
           && !(wt instanceof VehicleFlamerWeapon)) {
         weight += wt.getTonnage(tank);
       }
       if ((m.getLinkedBy() != null)
           && (m.getLinkedBy().getType() instanceof MiscType)
           && m.getLinkedBy().getType().hasFlag(MiscType.F_PPC_CAPACITOR)) {
         weight += ((MiscType) m.getLinkedBy().getType()).getTonnage(tank);
       }
     }
     return TestEntity.ceil(weight / 10f, getWeightCeilingPowerAmp());
   }
   return 0;
 }