public override void CompPostInjuryHeal(float amount) { if (!this.Active || this.IsOld) { return; } if (this.parent.Severity <= this.oldDamageThreshold && this.parent.Severity >= this.oldDamageThreshold - amount) { float num = 0.2f; HediffComp_TendDuration hediffComp_TendDuration = this.parent.TryGetComp <HediffComp_TendDuration>(); if (hediffComp_TendDuration != null) { num *= Mathf.Clamp01(1f - hediffComp_TendDuration.tendQuality); } if (Rand.Value < num) { this.parent.Severity = this.oldDamageThreshold; this.IsOld = true; base.Pawn.health.Notify_HediffChanged(this.parent); } else { this.oldDamageThreshold = 9999f; } } }
private void CheckMakeInfection() { if (base.Pawn.health.immunity.DiseaseContractChanceFactor(HediffDefOf.WoundInfection, this.parent.Part) <= 0.001f) { this.ticksUntilInfect = -3; return; } float num = 1f; HediffComp_TendDuration hediffComp_TendDuration = this.parent.TryGetComp <HediffComp_TendDuration>(); if (hediffComp_TendDuration != null && hediffComp_TendDuration.IsTended) { num *= this.infectionChanceFactorFromTendRoom; num *= HediffComp_Infecter.InfectionChanceFactorFromTendQualityCurve.Evaluate(hediffComp_TendDuration.tendQuality); } num *= HediffComp_Infecter.InfectionChanceFactorFromSeverityCurve.Evaluate(this.parent.Severity); if (base.Pawn.Faction == Faction.OfPlayer) { num *= Find.Storyteller.difficulty.playerPawnInfectionChanceFactor; } if (Rand.Value < num) { this.ticksUntilInfect = -4; base.Pawn.health.AddHediff(HediffDefOf.WoundInfection, this.parent.Part, null, null); } else { this.ticksUntilInfect = -3; } }
public static bool IsTended(this Hediff hd) { HediffWithComps hediffWithComps = hd as HediffWithComps; if (hediffWithComps == null) { return(false); } HediffComp_TendDuration hediffComp_TendDuration = hediffWithComps.TryGetComp <HediffComp_TendDuration>(); return(hediffComp_TendDuration != null && hediffComp_TendDuration.IsTended); }
public virtual bool TendableNow(bool ignoreTimer = false) { if (!def.tendable || Severity <= 0f || this.FullyImmune() || !Visible || this.IsPermanent()) { return(false); } if (!ignoreTimer) { HediffComp_TendDuration hediffComp_TendDuration = this.TryGetComp <HediffComp_TendDuration>(); if (hediffComp_TendDuration != null && !hediffComp_TendDuration.AllowTend) { return(false); } } return(true); }
public static bool IsTended(this Hediff hd) { HediffWithComps hediffWithComps = hd as HediffWithComps; bool result; if (hediffWithComps == null) { result = false; } else { HediffComp_TendDuration hediffComp_TendDuration = hediffWithComps.TryGetComp <HediffComp_TendDuration>(); result = (hediffComp_TendDuration != null && hediffComp_TendDuration.IsTended); } return(result); }