public void TryHealRandomDermalWound() { if (base.Pawn.health.hediffSet.hediffs.Where((Hediff hd) => hd.IsPermanent() || hd.def.chronic).TryRandomElement(out Hediff result)) { if (Props.excludeChronic == true) { if (result.def.chronic) { return; } } foreach (BodyPartDef bodyPart in Props.exclusionList) { if (result.Part.def == bodyPart) { return; } } HealthUtility.CureHediff(result); if (PawnUtility.ShouldSendNotificationAbout(base.Pawn)) { Messages.Message("MessagePermanentWoundHealed".Translate(parent.LabelCap, base.Pawn.LabelShort, result.Label, base.Pawn.Named("PAWN")), base.Pawn, MessageTypeDefOf.PositiveEvent); } } }
public static void Repair(Pawn pawn) { List <Hediff_MissingPart> missings = pawn.health.hediffSet.GetMissingPartsCommonAncestors().Where(x => !pawn.health.hediffSet.PartOrAnyAncestorHasDirectlyAddedParts(x.Part)).ToList(); foreach (var hediff in missings) { pawn.health.RestorePart(hediff.Part); } List <Hediff> injuries = pawn.health.hediffSet.hediffs.Where(x => IsCurableHediff(x)).ToList(); foreach (var hediff in injuries) { HealthUtility.CureHediff(hediff); } }
private void Cure(Hediff hediff) { HealthUtility.CureHediff(hediff); Messages.Message("MessageHediffCuredByItem".Translate(hediff.LabelBase.CapitalizeFirst()), hediff.pawn, MessageTypeDefOf.PositiveEvent); }