/*
   * (non-Javadoc)
   *
   * @see megamek.common.weapons.WeaponHandler#calcHits(Vector<Report>
   * vPhaseReport)
   */
  @Override
  protected int calcHits(Vector<Report> vPhaseReport) {
    // conventional infantry gets hit in one lump
    // BAs can't mount LBXs
    if ((target instanceof Infantry) && !(target instanceof BattleArmor)) {
      return 1;
    }

    int shotsHit;
    int nHitsModifier = getClusterModifiers(true);

    if (allShotsHit()) {
      shotsHit = wtype.getRackSize();
      if (game.getOptions().booleanOption(OptionsConstants.ADVCOMBAT_TACOPS_RANGE)
          && (nRange > wtype.getRanges(weapon)[RangeType.RANGE_LONG])) {
        shotsHit = (int) Math.ceil(shotsHit * .75);
      }
      if (game.getOptions().booleanOption(OptionsConstants.ADVCOMBAT_TACOPS_LOS_RANGE)
          && (nRange > wtype.getRanges(weapon)[RangeType.RANGE_EXTREME])) {
        shotsHit = (int) Math.ceil(shotsHit * .5);
      }
    } else {
      // flat modifier of -1, because of prototype
      nHitsModifier -= 1;

      shotsHit =
          Compute.missilesHit(
              wtype.getRackSize(), nHitsModifier, game.getPlanetaryConditions().hasEMI());
    }

    Report r = new Report(3325);
    r.subject = subjectId;
    r.add(shotsHit);
    r.add(sSalvoType);
    r.add(toHit.getTableDesc());
    r.newlines = 0;
    vPhaseReport.addElement(r);
    if (nHitsModifier != 0) {
      if (nHitsModifier > 0) {
        r = new Report(3340);
      } else {
        r = new Report(3341);
      }
      r.subject = subjectId;
      r.add(nHitsModifier);
      r.newlines = 0;
      vPhaseReport.addElement(r);
    }
    r = new Report(3345);
    r.subject = subjectId;
    vPhaseReport.addElement(r);
    bSalvo = true;
    return shotsHit;
  }
  /*
   * (non-Javadoc)
   *
   * @see megamek.common.weapons.WeaponHandler#calcHits(java.util.Vector)
   */
  @Override
  protected int calcHits(Vector<Report> vPhaseReport) {
    // conventional infantry gets hit in one lump
    // BAs can't mount UACS/RACs
    if ((target instanceof Infantry) && !(target instanceof BattleArmor)) {
      return 1;
    }

    bSalvo = true;

    if (howManyShots == 1 || twoRollsUltra) {
      return 1;
    }

    int shotsHit;
    int nMod = getClusterModifiers(true);

    shotsHit = allShotsHit() ? howManyShots : Compute.missilesHit(howManyShots, nMod);

    // report number of shots that hit only when weapon doesn't jam
    if (!weapon.isJammed()) {
      Report r = new Report(3325);
      r.subject = subjectId;
      r.add(shotsHit);
      r.add(sSalvoType);
      r.add(toHit.getTableDesc());
      r.newlines = 0;
      vPhaseReport.addElement(r);
      if (nMod != 0) {
        if (nMod > 0) {
          r = new Report(3340);
        } else {
          r = new Report(3341);
        }
        r.subject = subjectId;
        r.add(nMod);
        r.newlines = 0;
        vPhaseReport.addElement(r);
      }
      r = new Report(3345);
      r.subject = subjectId;
      vPhaseReport.addElement(r);
    }
    return shotsHit;
  }