public static void init() { hiv = DefDatabase <std_def> .GetNamed("HIV"); herpes = DefDatabase <std_def> .GetNamed("Herpes"); warts = DefDatabase <std_def> .GetNamed("Warts"); syphilis = DefDatabase <std_def> .GetNamed("Syphilis"); }
public static BodyPartRecord GetRelevantBodyPartRecord(Pawn pawn, std_def std) { if (std.appliedOnFixedBodyParts == null) { return(null); } BodyPartDef target = std.appliedOnFixedBodyParts.Single(); return(pawn?.RaceProps.body.GetPartsWithDef(target).Single()); //return pawn?.RaceProps.body.GetPartsWithDef(std.appliedOnFixedBodyParts.Single()).Single(); }
public static void show_infection_letter(Pawn p, std_def sd, String source = null, float?chance = null) { StringBuilder info; { info = new StringBuilder(); info.Append(p.NameStringShort + " has caught " + sd.label + ((source != null) ? " from " + source + "." : "")); if (chance.HasValue) { info.Append(" (" + chance.Value.ToStringPercent() + " chance)"); } info.AppendLine(); info.AppendLine(); info.Append(sd.description); } Find.LetterStack.ReceiveLetter("Infection: " + sd.label, info.ToString(), LetterDefOf.ThreatSmall, p); }
static float GetCatchChance(Pawn pawn, std_def sd) { var bodyPartRecord = std.GetRelevantBodyPartRecord(pawn, sd); float artificialFactor = 1f; if (bodyPartRecord == null && pawn.health.hediffSet.HasDirectlyAddedPartFor(Genital_Helper.get_genitalsBPR(pawn))) { artificialFactor = .15f; } else if (pawn.health.hediffSet.HasDirectlyAddedPartFor(bodyPartRecord)) { artificialFactor = 0f; } return(sd.catch_chance * artificialFactor); }
public static Hediff infect(Pawn p, std_def sd, bool include_coinfection = true) { Hediff existing = std.get_infection(p, sd); if (existing != null) { return(existing); } BodyPartRecord part = std.GetRelevantBodyPartRecord(p, sd); p.health.AddHediff(sd.hediff_def, part); if (include_coinfection && sd.cohediff_def != null) { p.health.AddHediff(sd.cohediff_def, part); } //--Log.Message("[RJW]std::infect genitals std"); return(std.get_infection(p, sd)); }
public static Hediff infect(Pawn p, std_def sd, bool include_coinfection = true) { var existing = get_infection(p, sd); if (existing == null) { var part = (sd.applied_on_genitals) ? xxx.genitals : null; p.health.AddHediff(sd.hediff_def, part); if (include_coinfection && (sd.cohediff_def != null)) { p.health.AddHediff(sd.cohediff_def, part); } //--Log.Message("[RJW]std::infect genitals std"); return(get_infection(p, sd)); } else { return(existing); } }
public static Hediff get_infection(Pawn p, std_def sd) { return(p.health.hediffSet.GetFirstHediffOfDef(sd.hediff_def)); }
public static float get_severity(Pawn p, std_def sd) { var hed = get_infection(p, sd); return((hed != null) ? hed.Severity : 0.0f); }
public static float get_severity(Pawn p, std_def sd) { Hediff hed = std.get_infection(p, sd); return(hed?.Severity ?? 0.0f); }