final boolean isInfantryWeapon = ((w.getFlags() & WeaponType.F_INFANTRY) == WeaponType.F_INFANTRY); final boolean usesAmmo = (!isInfantryWeapon && w.getAmmoType() != AmmoType.T_NA);
final boolean isInfantryWeapon = w.hasFlag(WeaponType.F_INFANTRY); final boolean usesAmmo = (!isInfantryWeapon & w.getAmmoType() != AmmoType.T_NA & w.getAmmoType() != AmmoType.T_BA_SMALL_LASER & w.getAmmoType() != AmmoType.T_BA_MG);
    public AttackOption(CEntity target, Mounted weapon, double value, ToHitData toHit) {        this.target = target;        this.weapon = weapon;        this.toHit = toHit;        this.value = value;        if (target != null) {            WeaponType w = (WeaponType) weapon.getType();                        // As a primary attack.  Damage is already odds-adjusted.            this.primary_odds = Compute.oddsAbove(toHit.getValue()) / 100.0;            this.primary_expected = this.value;                        // As a secondary attack.  Raw damage is extracted, then adjusted            // for secondary to-hit odds.  Since units with active Stealth armor            // cannot be secondary targets, chances of hitting are 0.                        if (target.getEntity().isStealthActive()){                this.odds = 0.0;            } else {                this.odds = Compute.oddsAbove(toHit.getValue() + 1) / 100.0;            }            this.heat = w.getHeat();            this.expected = this.value/this.primary_odds;            this.expected = this.expected * this.odds;            final boolean isInfantryWeapon = ((w.getFlags() & WeaponType.F_INFANTRY) == WeaponType.F_INFANTRY);            final boolean usesAmmo = (!isInfantryWeapon && w.getAmmoType() != AmmoType.T_NA);            final Mounted ammo = usesAmmo ? weapon.getLinked() : null;            if (usesAmmo && (ammo == null || ammo.getShotsLeft() == 0)) {                this.value = 0; //should have already been caught...            } else if (usesAmmo) {                this.ammoLeft = ammo.getShotsLeft();            }        }    }