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; }
if (range > wt.getShortRange()){ total_mod += 2; } if (range > wt.getMediumRange()){ total_mod +=2; } if (range > wt.getLongRange()){ total_mod += 4; } if (range > wt.getExtremeRange()){ return 0.0; } }    total_mod += wt.getToHitModifier();      if (wt.getDamage() == WeaponType.DAMAGE_MISSILE & wt.getAmmoType() != AmmoType.T_TBOLT5 & wt.getAmmoType() != AmmoType.T_TBOLT10 & wt.getAmmoType() != AmmoType.T_TBOLT15 & wt.getAmmoType() != AmmoType.T_TBOLT20) { use_table = true; } if ((wt.getAmmoType() == AmmoType.T_AC_LBX) || (wt.getAmmoType() == AmmoType.T_AC_LBX_THB)) { use_table = true; total_mod -= 1; }  if ((wt.getAmmoType() == AmmoType.T_AC_ULTRA) || (wt.getAmmoType() == AmmoType.T_AC_ULTRA_THB) || (wt.getAmmoType() == AmmoType.T_AC_ROTARY)) { use_table = true; }     if (attacker instanceof BattleArmor) { if ((wt.getInternalName() != Infantry.SWARM_MEK) & (wt.getInternalName() != Infantry.LEG_ATTACK) & !(wt.hasFlag(WeaponType.F_INFANTRY))) { use_table = true; } }  if (use_table == true) { double fHits = 0.0; if (!(attacker instanceof BattleArmor)) { if (weapon.getLinked() == null) return 0.0; } AmmoType at = null; if (weapon.getLinked() != null) { at = (AmmoType) weapon.getLinked().getType();      fDamage = at.getDamagePerShot(); if (wt.getAmmoType() == AmmoType.T_SRM_STREAK || wt.getAmmoType() == AmmoType.T_SRM) { fDamage = 2.0; } if (wt.getAmmoType() == AmmoType.T_ATM) { fDamage = 2.4; } if (wt.getAmmoType() == AmmoType.T_LRM_STREAK || wt.getAmmoType() == AmmoType.T_LRM || wt.getAmmoType() == AmmoType.T_MRM) { fDamage = 1.0; } } if (wt.getRackSize() != 40 && wt.getRackSize() != 30) { fHits = expectedHitsByRackSize[wt.getRackSize()];
    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;    }