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;
fHits = 2.0f * expectedHitsByRackSize[wt.getRackSize() / 2]; } if (wt.getAmmoType() == AmmoType.T_SRM_STREAK || wt.getAmmoType() == AmmoType.T_LRM_STREAK){ fHits = wt.getRackSize(); } if (wt.getAmmoType() == AmmoType.T_AC_ULTRA || wt.getAmmoType() == AmmoType.T_AC_ULTRA_THB){ fHits = expectedHitsByRackSize[2]; } if (wt.getAmmoType() == AmmoType.T_AC_ROTARY){ fHits = expectedHitsByRackSize[4]; } if ((wt.getAmmoType() == AmmoType.T_AC_LBX) || (wt.getAmmoType() == AmmoType.T_AC_LBX_THB)) { fHits = expectedHitsByRackSize[wt.getDamage()]; } if (wt.getAmmoType() == AmmoType.T_LRM || wt.getAmmoType() == AmmoType.T_SRM) { lnk_guide = weapon.getLinkedBy(); if (lnk_guide != null && lnk_guide.getType() instanceof MiscType && !lnk_guide.isDestroyed() && !lnk_guide.isMissing() && !lnk_guide.isBreached() && lnk_guide.getType().hasFlag(MiscType.F_ARTEMIS)) { fHits *= 1.2f; } }    if (attacker instanceof BattleArmor) {  fHits = expectedHitsByRackSize[ba_attacker .getShootingStrength()]; if (wt.getDamage() == WeaponType.DAMAGE_MISSILE) { fHits *= expectedHitsByRackSize[wt.getRackSize()]; } if (wt.getDamage() != WeaponType.DAMAGE_MISSILE) { if (wt.getDamage() != WeaponType.DAMAGE_VARIABLE) { fDamage = wt.getDamage(); } else { fDamage = wt.getRackSize(); } } if (wt.hasFlag(WeaponType.F_DOUBLE_HITS)) { fHits *= 2.0; } if (wt.hasFlag(WeaponType.F_MISSILE_HITS)) { fHits *= expectedHitsByRackSize[wt.getRackSize()]; } }  fDamage *= fHits;  if ((wt.getAmmoType() == AmmoType.T_AC_ULTRA) || (wt.getAmmoType() == AmmoType.T_AC_ULTRA_THB) || (wt.getAmmoType() == AmmoType.T_AC_ROTARY)) { fDamage = fHits * wt.getDamage(); }  } else {     fDamage = wt.getDamage();    if (wt.getAmmoType() == AmmoType.T_GAUSS_HEAVY){ fDamage = 25.0; if (range > 6){ fDamage = 20.0; } if (range > 13){ fDamage = 10.0; } } if (wt.getAmmoType() == AmmoType.T_TBOLT5 || wt.getAmmoType() == AmmoType.T_TBOLT10 || wt.getAmmoType() == AmmoType.T_TBOLT15 || wt.getAmmoType() == AmmoType.T_TBOLT20){ if (range <= wt.getMinimumRange()){ fDamage *= 0.5; } }    if (attacker instanceof Infantry) {  if (wt.hasFlag(WeaponType.F_INFANTRY)) {   fDamage = inf_attacker.getDamage(inf_attacker. getShootingStrength()); if (attacker instanceof BattleArmor){ fDamage = inf_attacker.getDamage(ba_attacker. getShootingStrength()); } }  if (wt.getInternalName() == Infantry.LEG_ATTACK) {  if (!(attacker instanceof BattleArmor)){ total_mod = 4 + 2 * (inf_attacker.getOInternal(0) - inf_attacker.getShootingStrength())/5; } else { total_mod = 8 - ba_attacker.getShootingStrength(); } fDamage = 10.0; }  if (wt.getInternalName() == Infantry.SWARM_MEK) {   if (!(attacker instanceof BattleArmor)){ total_mod = 7 + 2 * (inf_attacker.getOInternal(0) - inf_attacker.getShootingStrength())/5; fDamage = 1.5 * inf_attacker.getDamage(inf_attacker .getShootingStrength()); } else { total_mod = 11 - ba_attacker.getShootingStrength(); fDamage = 5.0 * ba_attacker.getShootingStrength(); } }  } } double fChance = Compute.oddsAbove(total_mod)/100; fDamage *= fChance; return fDamage;
    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;    }