public static int getWeaponPierceLocations(List <int> hitLocations, ICombatant target, float DamagePerShot) { int result = 0; CustomAmmoCategoriesLog.Log.LogWrite("getWeaponPierceLocations " + target.DisplayName + " : " + DamagePerShot + "\n"); foreach (int hitLocation in hitLocations) { if (target.ArmorForLocation(hitLocation) <= DamagePerShot) { CustomAmmoCategoriesLog.Log.LogWrite(" location " + hitLocation + " pierced\n"); ++result; } } return(result); }
public static float getTargetAvarageArmor(List <int> hitLocations, ICombatant target) { CustomAmmoCategoriesLog.Log.LogWrite("getTargetAvarageArmor " + target.DisplayName + "\n"); float result = 0.0f; foreach (int hitLocation in hitLocations) { CustomAmmoCategoriesLog.Log.LogWrite(" location " + hitLocation + " : " + target.ArmorForLocation(hitLocation) + "\n"); result += target.ArmorForLocation(hitLocation); } if (hitLocations.Count > 0) { result /= (float)hitLocations.Count; } else { result = 1.0f; } if (result < Epsilon) { result = 1.0f; } return(result); }