public void TryHealWounds() { IEnumerable <Hediff> enumerable = from hd in pawn.health.hediffSet.hediffs where !hd.IsTended() select hd; if (enumerable != null) { foreach (Hediff item in enumerable) { HediffWithComps val = item as HediffWithComps; if (val != null && val.TendableNow()) { if (val.Bleeding) { //Log.Message("TrySealWounds " + xxx.get_pawnname(pawn) + ", Bleeding " + item.Label); HediffComp_TendDuration val2 = HediffUtility.TryGetComp <HediffComp_TendDuration>(val); val2.tendQuality = 2f; val2.tendTicksLeft = Find.TickManager.TicksGame; pawn.health.Notify_HediffChanged(item); } // infections etc else // if (val.def.lethalSeverity > 0f) { //Log.Message("TryHeal " + xxx.get_pawnname(pawn) + ", infection(?) " + item.Label); HediffComp_TendDuration val2 = HediffUtility.TryGetComp <HediffComp_TendDuration>(val); val2.tendQuality = 2f; val2.tendTicksLeft = Find.TickManager.TicksGame; pawn.health.Notify_HediffChanged(item); } } } } }
public void TrySealWounds() { IEnumerable <Hediff> enumerable = from hd in this.pawn.health.hediffSet.hediffs where hd.Bleeding select hd; bool flag = enumerable != null; if (flag && canHeal) { foreach (Hediff hediff in enumerable) { HediffWithComps hediffWithComps = hediff as HediffWithComps; bool flag2 = hediffWithComps != null; Rand.PushState(); float chance = Rand.Value; Rand.PopState(); if (flag2 && canHeal && chance < Props.sealWoundsChance) { HediffComp_TendDuration hediffComp_TendDuration = hediffWithComps.TryGetCompFast <HediffComp_TendDuration>(); hediffComp_TendDuration.tendQuality = 0f; hediffComp_TendDuration.tendTicksLeft = Find.TickManager.TicksGame; this.pawn.health.Notify_HediffChanged(hediff); } } } }
public static void Prefix(HediffComp_TendDuration __instance) { if (true && __instance.parent.pawn.IsSkippingTicks() && __instance.parent.pawn.IsValidWildlifeOrWorldPawn()) { __instance.tendTicksLeft -= (__instance.parent.pawn.GetDeltaT() - 1); } }
// Token: 0x06004CA6 RID: 19622 RVA: 0x0023A3F0 File Offset: 0x002387F0 public static bool IsTended(this Hediff hd) { HediffWithComps hediffWithComps = hd as HediffWithComps; if (hediffWithComps == null) { return(false); } HediffComp_TendDuration hediffComp_TendDuration = hediffWithComps.TryGetCompFast <HediffComp_TendDuration>(); return(hediffComp_TendDuration != null && hediffComp_TendDuration.IsTended); }
// Token: 0x0600004D RID: 77 RVA: 0x00003A84 File Offset: 0x00001C84 public void TrySealWounds() { IEnumerable <Hediff> enumerable = from hd in this.pawn.health.hediffSet.hediffs where hd.TendableNow(false) select hd; if (enumerable != null) { foreach (Hediff hediff in enumerable) { if (hediff is HediffWithComps hediffWithComps) { HediffComp_TendDuration hediffComp_TendDuration = hediffWithComps.TryGetComp <HediffComp_TendDuration>(); hediffComp_TendDuration.tendQuality = 2f; hediffComp_TendDuration.tendTicksLeft = Find.TickManager.TicksGame; this.pawn.health.Notify_HediffChanged(hediff); } } } }
private void CheckMakeInfection() { ticksUntilInfect = -1; infectionModifier *= Pawn.health.immunity.DiseaseContractChanceFactor(HediffDefOf.WoundInfection, parent.Part); // Apply pawn immunity if (Pawn.def.race.Animal) { infectionModifier *= 0.5f; } // Adjust for difficulty if (Pawn.Faction == Faction.OfPlayer) { infectionModifier *= Find.Storyteller.difficulty.playerPawnInfectionChanceFactor; } // Find out how long the wound was untreated HediffComp_TendDuration compTended = parent.TryGetComp <HediffComp_TendDuration>(); int ticksUntended = parent.ageTicks; if (compTended != null && compTended.IsTended) { int ticksTended = Find.TickManager.TicksGame - compTended.tendTicksLeft; // B19 tendTicksLeft??? ticksUntended -= ticksTended; infectionModifier /= Mathf.Pow(compTended.tendQuality + 0.75f, 2); // Adjust infection chance based on tend quality } float infectChance = Props.infectionChancePerHourUntended * (ticksUntended / GenDate.TicksPerHour); // Calculate base chance from time untreated if (parent.Part.depth == BodyPartDepth.Inside) { infectChance *= infectionInnerModifier; // Increase chance of infection for inner organs } if (Rand.Value < infectChance * infectionModifier) { alreadyCausedInfection = true; Pawn.health.AddHediff(HediffDefOf.WoundInfection, parent.Part); } }
// Token: 0x06000008 RID: 8 RVA: 0x00002190 File Offset: 0x00000390 public void TrySealWounds() { IEnumerable <Hediff> enumerable = from hd in this.pawn.health.hediffSet.hediffs where hd.Bleeding select hd; bool flag = enumerable != null; if (flag) { foreach (Hediff hediff in enumerable) { HediffWithComps hediffWithComps = hediff as HediffWithComps; bool flag2 = hediffWithComps != null; if (flag2) { HediffComp_TendDuration hediffComp_TendDuration = HediffUtility.TryGetComp <HediffComp_TendDuration>(hediffWithComps); hediffComp_TendDuration.tendQuality = 2f; hediffComp_TendDuration.tendTicksLeft = Find.TickManager.TicksGame; this.pawn.health.Notify_HediffChanged(hediff); } } } }
public void TrySealWounds() { IEnumerable <Hediff> hediffs = ((IEnumerable <Hediff>)((HediffSet)((Pawn_HealthTracker)((Pawn)((Hediff)this).pawn).health).hediffSet).hediffs).Where <Hediff>((Func <Hediff, bool>)(hd => hd.get_Bleeding())); if (hediffs == null) { return; } using (IEnumerator <Hediff> enumerator = hediffs.GetEnumerator()) { while (((IEnumerator)enumerator).MoveNext()) { Hediff current = enumerator.Current; if (current is HediffWithComps hediffWithComps) { HediffComp_TendDuration comp = (HediffComp_TendDuration)HediffUtility.TryGetComp <HediffComp_TendDuration>((Hediff)hediffWithComps); comp.tendQuality = (__Null)2.0; comp.tendTicksLeft = (__Null)Find.get_TickManager().get_TicksGame(); ((Pawn_HealthTracker)((Pawn)((Hediff)this).pawn).health).Notify_HediffChanged(current); } } } }
// Token: 0x060010CC RID: 4300 RVA: 0x0005FD70 File Offset: 0x0005DF70 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.TryGetCompFast <HediffComp_TendDuration>(); if (hediffComp_TendDuration != null && hediffComp_TendDuration.IsTended) { // num *= this.infectionChanceFactorFromTendRoom; num *= HediffComp_Irradiator.IrradiationChanceFactorFromTendQualityCurve.Evaluate(hediffComp_TendDuration.tendQuality); } num *= HediffComp_Irradiator.IrradiationChanceFactorFromSeverityCurve.Evaluate(this.parent.Severity); if (base.Pawn.Faction == Faction.OfPlayer) { num *= Find.Storyteller.difficultyValues.playerPawnInfectionChanceFactor; } if (Rand.Value < num) { this.ticksUntilIrradiate = -4; HediffWithComps hediff = base.Pawn.health.hediffSet.GetFirstHediffOfDef(AdeptusHediffDefOf.OG_Hediff_RadiationPoisioning) as HediffWithComps; if (hediff == null) { hediff = HediffMaker.MakeHediff(AdeptusHediffDefOf.OG_Hediff_RadiationPoisioning, base.Pawn) as HediffWithComps; base.Pawn.health.AddHediff(hediff); } hediff.Severity += this.parent.Severity / 100; return; } this.ticksUntilIrradiate = -3; }
public static void Postfix(ref Hediff __instance, ref bool __result, bool ignoreTimer = false) { if (!__instance.def.tendable || __instance.Severity <= 0f || __instance.FullyImmune() || !__instance.Visible || __instance.IsPermanent()) { __result = false; return; } if (!ignoreTimer) { HediffComp_TendDuration hediffComp_TendDuration = __instance.TryGetComp <HediffComp_TendDuration>(); if (hediffComp_TendDuration != null && !hediffComp_TendDuration.AllowTend) { __result = false; return; } MSHediffComp_TendDuration MShediffComp_TendDuration = __instance.TryGetComp <MSHediffComp_TendDuration>(); if (MShediffComp_TendDuration != null && !MShediffComp_TendDuration.AllowTend) { __result = false; return; } } __result = true; }
public void HealWounds() { IEnumerable <Hediff> enumerable = from hd in pawn.health.hediffSet.hediffs where !hd.IsTended() && hd.TendableNow() select hd; if (enumerable != null) { foreach (Hediff item in enumerable) { HediffWithComps val = item as HediffWithComps; if (val != null) { if (val.Bleeding) { //Log.Message("TrySealWounds " + xxx.get_pawnname(pawn) + ", Bleeding " + item.Label); //HediffComp_TendDuration val2 = HediffUtility.TryGetComp<HediffComp_TendDuration>(val); val.Heal(0.25f); //val2.tendQuality = 1f; //val2.tendTicksLeft = 10000; //pawn.health.Notify_HediffChanged(item); } // tend infections // tend lifeThreatening chronic else if ((!val.def.chronic && val.def.lethalSeverity > 0f) || (val.CurStage?.lifeThreatening ?? false)) { //Log.Message("TryHeal " + xxx.get_pawnname(pawn) + ", infection(?) " + item.Label); HediffComp_TendDuration val2 = HediffUtility.TryGetComp <HediffComp_TendDuration>(val); val2.tendQuality = 1f; val2.tendTicksLeft = 10000; pawn.health.Notify_HediffChanged(item); } } } } }