result.add(new AttackOption(null, mw, 0, null));
result.add(new AttackOption(null, mw, 0, null, 1));
    protected ArrayList calculateWeaponAttacks(Entity en, Mounted mw, boolean best_only) {        int from = en.getId();        int weaponID = en.getEquipmentNum(mw);        int spin_mode = 0;        ArrayList result = new ArrayList();        Enumeration ents = game.getValidTargets(en).elements();        WeaponAttackAction wep_test;        WeaponType spinner;        AttackOption a = null;        AttackOption max = new AttackOption(null, null, 0, null);        while (ents.hasMoreElements()) {            Entity e = (Entity) ents.nextElement();            CEntity enemy = centities.get(e);//            long entry = System.currentTimeMillis();            ToHitData th = WeaponAttackAction.toHit(game, from, e, weaponID);//            long exit = System.currentTimeMillis();//            if (exit != entry)//                System.out.println("Weapon attack toHit took "+(exit-entry));            if (th.getValue() != ToHitData.IMPOSSIBLE && !(th.getValue() >= 13)) {                double expectedDmg;                wep_test = new WeaponAttackAction(from, e.getId(), weaponID);                // If this is an Ultra or Rotary cannon, check for spin up                spinner = (WeaponType) mw.getType();                if ((spinner.getAmmoType() == AmmoType.T_AC_ULTRA)                        || (spinner.getAmmoType() == AmmoType.T_AC_ULTRA_THB)                        || (spinner.getAmmoType() == AmmoType.T_AC_ROTARY)) {                    spin_mode = Compute.spinUpCannon(game, wep_test);                    super.sendModeChange(from, weaponID, spin_mode);                }                // Ammo cycler runs each valid ammo type through the weapon while                 // calling for expected damage on each type; best type by damage is loaded                expectedDmg = Compute.getAmmoAdjDamage(game, wep_test);                a = new AttackOption(enemy, mw, expectedDmg, th);                if (a.value > max.value) {                    if (best_only) {                        max = a;                    } else {                        result.add(0, a);                    }                } else {                    result.add(a);                }            }        }        if (best_only && max.target != null) {            result.add(max);        }        if (result.size() > 0) {            result.add(new AttackOption(null, mw, 0, null));        }        return result;    }