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_MRM_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
ArrayList<Mounted> vCounters = waa.getCounterEquipment();
if (vCounters != null) {
for (int x = 0; x < vCounters.size(); x++) {
EquipmentType type = vCounters.get(x).getType();
if (type instanceof WeaponType
&& type.hasFlag(WeaponType.F_AMS)) {
float fAMS = 3.5f * ((WeaponType) type).getDamage();
fHits = Math.max(0.0f, fHits - fAMS);
}
}
}
// damage is expected missiles * damage per missile
fDamage = fHits * at.getDamagePerShot();
} else {
fDamage = wt.getDamage();
}
fDamage *= fChance;