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