if (weapon.getLinked() == null || weapon.getLinked().getShotsLeft() == 0) {
if ( ammo == null || ammo.getShotsLeft() == 0 || ammo.isDumping() ) {
    public void assignAMS(Vector vAttacks) {        for (Enumeration e = getWeapons(); e.hasMoreElements(); ) {            Mounted weapon = (Mounted)e.nextElement();            if (((WeaponType)weapon.getType()).getAmmoType() == AmmoType.T_AMS) {                if (!weapon.isReady() || weapon.isMissing()) {                    continue;                }                // don't try if it's turned off                if (weapon.curMode().equals("Off")) {                    continue;                }                if (weapon.getLinked() == null || weapon.getLinked().getShotsLeft() == 0) {                    loadWeapon(weapon);                }                // try again                if (weapon.getLinked() == null || weapon.getLinked().getShotsLeft() == 0) {                    continue;                }                // make a new vector of only incoming attacks in arc                Vector vAttacksInArc = new Vector(vAttacks.size());                for (Enumeration i = vAttacks.elements(); i.hasMoreElements();) {                    WeaponAttackAction waa = (WeaponAttackAction)i.nextElement();                    if (Compute.isInArc(game, this.getId(), getEquipmentNum(weapon),                            game.getEntity(waa.getEntityId()))) {                        vAttacksInArc.addElement(waa);                    }                }                // find the most dangerous salvo by expected damage                WeaponAttackAction waa = Compute.getHighestExpectedDamage(game, vAttacksInArc);                if (waa != null) {                    waa.addCounterEquipment(weapon);                }            }        }    }