/// <summary> /// Calculates the chance that the gun will jam /// </summary> /// <param name="gun">The gun object</param> /// <returns>floating point number representing the jam chance</returns> public static float JamChance(VerbProperties_EquipmentAbility gun) { float result = 0f; switch (gun.reliability) { case Reliability.UR: result = 50f; break; case Reliability.ST: result = 30f; break; case Reliability.VR: result = 10f; break; default: return(0); } // Log.Message(string.Format("result {0}", result)); // result += GetQualityFactor(gun.parent); // Log.Message(string.Format("result {0}", result)); // result = result * 100 / gun.parent.HitPoints / 100; // Log.Message(string.Format("result {0}", result)); result = (float)(Math.Truncate((double)result * 100.0) / 100.0); // Log.Message(string.Format("result {0}", result)); return(result); }
public static void GetReliability(VerbProperties_EquipmentAbility gun, out string rel, out float jamsOn) { rel = string.Empty; jamsOn = JamChance(gun); if (jamsOn < 0.25) { rel = "Extremely Reliable"; } else if (jamsOn < 0.5) { rel = "Very Reliable"; } else if (jamsOn < 1) { rel = "Standard"; } else { rel = "Unreliable"; } }