mAmmo.setShotsLeft(mAmmo.getShotsLeft() - amsHits);
mAmmo.setShotsLeft(Math.max(0, mAmmo.getShotsLeft() - amsHits));
    private WeaponResult resolveAmsFor(WeaponAttackAction waa, WeaponResult wr) {        final Entity te = game.getEntity(waa.getTargetId());                // any AMS attacks by the target?        Vector vCounters = waa.getCounterEquipment();        if (vCounters == null) {            return wr;        }                 // resolve AMS counter-fire        for (int x = 0; x < vCounters.size(); x++) {            Mounted counter = (Mounted)vCounters.elementAt(x);            Mounted mAmmo = counter.getLinked();            if (!(counter.getType() instanceof WeaponType)             || ((WeaponType)counter.getType()).getAmmoType() != AmmoType.T_AMS            || !counter.isReady() || counter.isMissing()) {                continue;            }            // roll hits            int amsHits = Compute.d6(((WeaponType)counter.getType()).getDamage());            // build up some heat (assume target is ams owner)            te.heatBuildup += ((WeaponType)counter.getType()).getHeat();            // decrement the ammo            mAmmo.setShotsLeft(mAmmo.getShotsLeft() - amsHits);            // set the ams as having fired            counter.setUsedThisRound(true);            wr.amsShotDown += amsHits;        }                return wr;    }