public void ApplyHediffAndRegisterWithBodyPartList(HediffItem hi, HediffAssociation CurHA, AssociatedHediffHistory CurAHH, List <BodyPartRecord> BPRL, bool debug = false) { foreach (BodyPartRecord BPR in BPRL) { ApplyHediffAndRegisterSingleBodyPart(hi, CurHA, CurAHH, BPR, debug); } }
public void ApplyHediffAndRegisterSingleBodyPart(HediffItem hi, HediffAssociation CurHA, AssociatedHediffHistory CurAHH, BodyPartRecord BPR = null, bool debug = false) { //Severity Hediff h = HediffMaker.MakeHediff(hi.hediff, Pawn, BPR); if (hi.HasSeverity) { h.Severity = hi.severity.RandomInRange; } //Applying hediff to full body if BPR is null Pawn.health.AddHediff(h, BPR, null); //Recording hediff applied in registry CurAHH.appliedHediffs.Add(h); if (CurHA.specifics.HasLimit) { CurAHH.appliedNum++; } // destroy parent hediff if discard upon remove setting and random is satisfied if (CurHA.specifics.HasDiscard && CurHA.specifics.discard.HasUponApplyDiscard && Rand.Chance(CurHA.specifics.discard.uponApply.chance.RandomInRange)) { Pawn.health.RemoveHediff(parent); } // add grace destroy if grace setting upon remove and random is satisfied if (CurHA.specifics.HasGrace && CurHA.specifics.grace.HasUponApplyGrace && Rand.Chance(CurHA.specifics.grace.uponApply.chance.RandomInRange)) { CurAHH.grace += CurHA.specifics.grace.uponApply.tickAmount.RandomInRange; } }