public override void Update(int passed) { if (passed < Rand.Range(0, (int)(def.mtthDays * 60000))) { return; } BodyPartRecord part = TargetParts().RandomElementWithFallback(); if (part == null) { return; } Cancer newCancer = HediffMaker.MakeHediff(cancer.def, cancer.pawn, part) as Cancer; if (newCancer == null) { return; } if (!def.mutates) { newCancer.BecomeCopyOf(cancer); } cancer.pawn.health.AddHediff(newCancer, part, null, null); }
public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List <Thing> ingredients, Bill bill) { Hediff hediff = pawn.health.hediffSet.hediffs.Find(x => x is Cancer && x.Part == part && x.Visible); Cancer cancer = hediff as Cancer; if (cancer == null) { return; } Thing medicine = ingredients.FirstOrDefault(); float quality = TendUtility.CalculateBaseTendQuality(billDoer, pawn, (medicine == null) ? null : medicine.def); cancer.Tended(quality, 0); }
public void BecomeCopyOf(Cancer other) { diagnosed = other.diagnosed; apparentGrowth = other.apparentGrowth; Severity = other.Severity; foreach (var comp in other.apparentComps) { apparentComps.Add(CreateComp(comp.def)); } foreach (var comp in other.actualComps) { actualComps.Add(CreateComp(comp.def)); } UpdateStage(); }
public IEnumerable <BodyPartRecord> TargetParts() { foreach (BodyPartRecord part in PotentialTargetParts()) { if (part == null) { continue; } Cancer otherCancer = Cancer.GetCancerAt(cancer.pawn, part); if (otherCancer == null) { yield return(part); } } yield break; }