public static List <DamagePredictRecord> getWeaponDamagePredict(AbstractActor unit, ICombatant target, Weapon weapon) { List <DamagePredictRecord> result = new List <DamagePredictRecord>(); ExtWeaponDef extWeapon = CustomAmmoCategories.getExtWeaponDef(weapon.defId); if (extWeapon.Modes.Count < 1) { CustomAmmoCategoriesLog.Log.LogWrite("WARNING! " + weapon.defId + " has no modes. Even base mode. This means something is very very wrong\n", true); return(result); } string currentMode = extWeapon.baseModeId; if (CustomAmmoCategories.checkExistance(weapon.StatCollection, CustomAmmoCategories.WeaponModeStatisticName) == true) { currentMode = weapon.StatCollection.GetStatistic(CustomAmmoCategories.WeaponModeStatisticName).Value <string>(); } string currentAmmo = ""; if (CustomAmmoCategories.checkExistance(weapon.StatCollection, CustomAmmoCategories.AmmoIdStatName) == true) { currentAmmo = weapon.StatCollection.GetStatistic(CustomAmmoCategories.AmmoIdStatName).Value <string>(); } foreach (var mode in extWeapon.Modes) { HashSet <string> ammos = CustomAmmoCategories.getWeaponAvaibleAmmoForMode(weapon, mode.Value.Id); List <int> hitLocations = null; float AverageArmor = float.NaN; foreach (var ammo in ammos) { DamagePredictRecord record = new DamagePredictRecord(ammo, mode.Value.Id); CustomAmmoCategories.fillWeaponPredictRecord(ref record, unit, target, weapon, ref hitLocations, ref AverageArmor); result.Add(record); } } CustomAmmoCategories.applyWeaponAmmoMode(weapon, currentMode, currentAmmo); return(result); }