public static double getExpectedDamage(WeaponType weap) { if (weap.getDamage() != WeaponType.DAMAGE_MISSILE) {  return weap.getDamage();
public static double getExpectedDamage(Entity attacker, Mounted weapon, int range, int gunskill) {  int total_mod = gunskill; double[] expectedHitsByRackSize = { 0.0, 1.0, 1.58, 2.0, 2.63, 3.17, 4.0, 4.49, 4.98, 5.47, 6.31, 7.23, 8.14, 8.59, 9.04, 9.5, 10.1, 10.8, 11.42, 12.1, 12.7 };  boolean use_table = false;  Infantry inf_attacker = new Infantry(); BattleArmor ba_attacker = new BattleArmor(); Mounted lnk_guide;  if (attacker instanceof BattleArmor) { ba_attacker = (BattleArmor) attacker; } if ((attacker instanceof Infantry) && !(attacker instanceof BattleArmor)) { inf_attacker = (Infantry) attacker; }    if (!(attacker instanceof Infantry) & range == 0){ return 0.0; }  double fDamage = 0.0; WeaponType wt = (WeaponType) weapon.getType();    if (wt.getName() == "Stop Swarm Attack"){ return 0.0; }    if (range <= wt.getMinimumRange()){ total_mod = total_mod + 1 + (wt.getMinimumRange() - range);
    public static double getExpectedDamage(WeaponType weap) {        if (weap.getDamage() != WeaponType.DAMAGE_MISSILE) {            // normal weapon            return weap.getDamage();        } else {            // hard-coded expected missile numbers            if (weap.getAmmoType() == AmmoType.T_SRM) {                switch (weap.getRackSize()) {                    case 2 :                        return 1.41666 * 2;                    case 4 :                        return 2.63888 * 2;                    case 6 :                        return 4 * 2;                }            } else {                switch (weap.getRackSize()) {                    case 5 :                        return 3.16666;                    case 10 :                        return 6.30555;                    case 15 :                        return 9.5;                    case 20 :                        return 12.69444;                }            }        }        return 0;    }