Пример #1
0
        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: 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);
            }
        }