public static void PostFix(ref Pawn_HealthTracker __instance, ref Hediff __result, ref Pawn ___pawn, HediffDef def, BodyPartRecord part = null, DamageInfo?dinfo = null, DamageWorker.DamageResult result = null) { if (!Controller.Settings.DoAilments || GenDate.DaysPassed < Controller.Settings.CAStartDays || __result == null || Controller.Settings.CAChance <= 0 || ___pawn == null || part == null || !CommonAilments.PawnCanAcceptCA(___pawn) || def?.addedPartProps == null || !def.addedPartProps.solid) { return; } var offset = CommonAilmentsUtility.AugmentOffset(___pawn); if (!CommonAilments.CanAddCA(Math.Max(12, Controller.Settings.CAChance * 2), offset)) { return; } var hdef = DefDatabase <HediffDef> .GetNamed("CA_PhantomPain", false); if (hdef == null) { return; } var sev = CommonAilmentsUtility.RandNum(0.5f, 3f); if (CommonAilmentsUtility.HediffEffect(hdef, sev, ___pawn, part, out _)) { CommonAilments.SendCAMsg(___pawn, hdef); } }
// Token: 0x06000022 RID: 34 RVA: 0x00003514 File Offset: 0x00001714 internal static int AugmentOffset(Pawn patient) { var spread = 10; var offset = CommonAilments.GetImmunityOS(patient); if (patient.story.traits.HasTrait(DefDatabase <TraitDef> .GetNamed("Transhumanist", false))) { offset -= 5; } if (patient.story.traits.HasTrait(DefDatabase <TraitDef> .GetNamed("BodyPurist", false))) { offset += 5; } if (!patient.story.traits.HasTrait(DefDatabase <TraitDef> .GetNamed("NaturalMood", false))) { return(Math.Max(0 - spread, Math.Min(spread, offset))); } var traits = patient.story.traits; var NMTrait = traits?.GetTrait(DefDatabase <TraitDef> .GetNamed("NaturalMood", false)); if (NMTrait != null) { offset -= NMTrait.Degree * 2; } return(Math.Max(0 - spread, Math.Min(spread, offset))); }
public static void PostFix() { if (Controller.Settings.DoAilments && GenDate.DaysPassed >= Controller.Settings.CAStartDays && (Find.TickManager.TicksGame + 5) % 600 == 0) { CommonAilments.CommonAilmentsTick(); } }
// Token: 0x06000038 RID: 56 RVA: 0x00003BC0 File Offset: 0x00001DC0 public override void CompPostTick(ref float severityAdjustment) { if (!Controller.Settings.DoSymptoms || !CommonAilments.PawnCanAcceptCA(Pawn) || !Controller.Settings.DoAilments || GenDate.DaysPassed < Controller.Settings.CAStartDays || !Pawn.IsHashIntervalTick(2501)) { return; } var chance = (int)(CAProps.symptomChance + Controller.Settings.CAChance); CommonAilments.CurSituation(Pawn, out var offset, out _, out _, out _, out _, out _); offset += Math.Max(-20, Math.Min(10, CommonAilments.GetImmunityOS(Pawn))); if (CommonAilments.CanAddCA(chance, offset)) { CommonAilmentsUtility.ApplySymptom(Pawn); } }
// Token: 0x06000026 RID: 38 RVA: 0x00003754 File Offset: 0x00001954 public static void ApplySymptom(Pawn p) { var def = DefDatabase <HediffDef> .GetNamed(Symptoms().RandomElement(), false); if (def == null) { return; } var maxSev = Math.Max(1f, def.maxSeverity); var sev = RandNum(0.33f, maxSev); if (CommonAilments.HasCA(p, def) || !HediffEffect(def, sev, p, null, out _)) { return; } CommonAilments.SendCAMsg(p, def); PawnCAData.PawnCADataTickSet(p, true); }
public static void PostFix(ref JobDriver_Lovin __instance, ref TargetIndex ___PartnerInd, Pawn pawn) { if (!Controller.Settings.DoAilments || !Controller.Settings.DoSTI || GenDate.DaysPassed < Controller.Settings.CAStartDays) { return; } HediffDef hediffdef = null; var severity = 0f; CommonAilments.CurSituation(pawn, out var offset, out _, out _, out _, out _, out _); offset += CommonAilments.GetImmunityOS(pawn); var CASTIBaseChance = Controller.Settings.CASTIChance; if (offset > 25) { offset = 25; } if (offset < -25) { offset = -25; } Hediff std = null; var sexwith = (Pawn)(Thing)__instance.job.GetTarget(___PartnerInd); if (sexwith == null) { return; } if (!CommonAilments.GetEitherProtected(sexwith, pawn)) { var health = sexwith.health; var hediffSet = health?.hediffSet; var swset = hediffSet; var infected = false; if (swset != null) { offset += Controller.Settings.CASTIOffset; std = swset.GetFirstHediffOfDef(ComAilDefOf.HediffDefOf.CA_Minor_STD); if (std != null) { infected = true; } } if (CommonAilments.CanAddCASTI(CASTIBaseChance, offset, infected)) { if (std != null) { hediffdef = std.def; severity = std.Severity + GetARnd(-0.5f, 0.5f); } else { hediffdef = ComAilDefOf.HediffDefOf.CA_Minor_STD; severity = GetARnd(1f, 5f); } } } if (hediffdef == null || !(severity > 0f)) { return; } CommonAilments.TryApplyAilment(hediffdef, severity, pawn, null, out _); if (std != null || !(GetARnd(1f, 100f) < 50f)) { return; } CommonAilments.TryApplyAilment(hediffdef, severity, sexwith, null, out _); }