System.out.println("Computing expected damage for " + attacker.getShortName() + " " + weapon.getName());
Mounted lnk_guide;
    public static float getExpectedDamage(IGame g, WeaponAttackAction waa)    {        Entity attacker = g.getEntity(waa.getEntityId());        Mounted weapon = attacker.getEquipment(waa.getWeaponId());        System.out.println("Computing expected damage for " + attacker.getShortName() + " " +                weapon.getName());        ToHitData hitData = waa.toHit(g);        if (hitData.getValue() == ToHitData.IMPOSSIBLE || hitData.getValue() == ToHitData.AUTOMATIC_FAIL) {            return 0.0f;        }        float fChance = 0.0f;        if (hitData.getValue() == ToHitData.AUTOMATIC_SUCCESS) {            fChance = 1.0f;        }        else {            fChance = (float)oddsAbove(hitData.getValue()) / 100.0f;        }        System.out.println("\tHit Chance: " + fChance);        // TODO : update for BattleArmor.        float fDamage = 0.0f;        WeaponType wt = (WeaponType)weapon.getType();        if (wt.getDamage() == WeaponType.DAMAGE_MISSILE) {            if (weapon.getLinked() == null) return 0.0f;            AmmoType at = (AmmoType)weapon.getLinked().getType();            float fHits = 0.0f;            if ((wt.getAmmoType() == AmmoType.T_SRM_STREAK) || (wt.getAmmoType() == AmmoType.T_LRM_STREAK)) {                fHits = wt.getRackSize();            }            else if (wt.getRackSize() == 40 || wt.getRackSize() == 30) {                fHits = 2.0f * expectedHitsByRackSize[wt.getRackSize() / 2];            }            else {                fHits = expectedHitsByRackSize[wt.getRackSize()];            }            // adjust for previous AMS            Vector vCounters = waa.getCounterEquipment();            if (vCounters != null) {                for (int x = 0; x < vCounters.size(); x++) {                    Mounted counter = (Mounted)vCounters.elementAt(x);                    if (counter.getType() instanceof WeaponType &&                            counter.getType().hasFlag(WeaponType.F_AMS)) {                        float fAMS = 3.5f * ((WeaponType)counter.getType()).getDamage();                        fHits = Math.max(0.0f, fHits - fAMS);                    }                }            }            System.out.println("\tExpected Hits: " + fHits);            // damage is expected missiles * damage per missile            fDamage = fHits * (float)at.getDamagePerShot();        }        else {            fDamage = (float)wt.getDamage();        }        fDamage *= fChance;        System.out.println("\tExpected Damage: " + fDamage);        return fDamage;    }