public static bool BloodStatus(Pawn pawn, out Hediff BloodHD)
        {
            HediffSet      hediffSet = pawn.health.hediffSet;
            BodyPartRecord part;
            bool           result = false;

            BloodHD = null;
            bool hasbloodedM = hediffSet.hediffs.Any <Hediff>(x => x.def.defName.StartsWith(markedDef.defName));

            if (hasbloodedM)
            {
                foreach (var item in hediffSet.hediffs)
                {
                    if (item.def.defName.StartsWith(markedDef.defName))
                    {
                        BloodHD = item;
                        result  = true;
                        break;
                    }
                }
            }
            bool hasunblooded = hediffSet.HasHediff(unbloodedDef);

            if (hasunblooded)
            {
                BloodHD = hediffSet.GetFirstHediffOfDef(unbloodedDef);
                result  = false;
            }
            bool hasbloodedUM = hediffSet.HasHediff(unmarkedDef);

            if (hasbloodedUM)
            {
                BloodHD = hediffSet.GetFirstHediffOfDef(unmarkedDef);
                result  = true;
            }
            if (BloodHD == null)
            {
                foreach (var item in pawn.RaceProps.body.AllParts)
                {
                    if (item.def == BodyPartDefOf.Head)
                    {
                        part = item;
                        pawn.health.AddHediff(unbloodedDef, part);
                    }
                }
            }
            return(result);
        }
Exemple #2
0
        // Token: 0x06000015 RID: 21 RVA: 0x00002480 File Offset: 0x00000680
        public float MSAdjustment(Pawn p, float sev, HediffGrowthMode gm)
        {
            float newSev = sev;

            if (gm == HediffGrowthMode.Growing)
            {
                HediffSet hediffSet;
                if (p == null)
                {
                    hediffSet = null;
                }
                else
                {
                    Pawn_HealthTracker health = p.health;
                    hediffSet = (health?.hediffSet);
                }
                HediffSet hSet = hediffSet;
                if (hSet != null)
                {
                    HediffDef drugDef = DefDatabase <HediffDef> .GetNamed("MSVinacol_High", false);

                    if (drugDef != null && hSet.GetFirstHediffOfDef(drugDef, false) != null)
                    {
                        newSev *= Rand.Range(0f, 0.1f);
                    }
                }
            }
            return(newSev);
        }
Exemple #3
0
        // Token: 0x06000066 RID: 102 RVA: 0x00006030 File Offset: 0x00004230
        internal static bool HasHediff(Pawn pawn, HediffDef def)
        {
            Pawn_HealthTracker health = pawn.health;
            HediffSet          HS     = health?.hediffSet;

            return(HS != null && HS.GetFirstHediffOfDef(def, false) != null);
        }
        public static bool Prefix(MentalState __instance)
        {
            if (!(__instance.def.defName == "Wander_Psychotic"))
            {
                return(true);
            }
            Pawn p = __instance.pawn;

            if (!p.InMentalState || !p.IsHashIntervalTick(150))
            {
                return(true);
            }
            HediffSet MShedSet = p.health.hediffSet;

            if (MShedSet == null)
            {
                return(true);
            }
            Hediff MSCheckClarity = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSClarity_High"), false);

            if (MSCheckClarity != null)
            {
                __instance.RecoverFromState();
                Messages.Message(p.Label.CapitalizeFirst() + "'s condition of " + __instance.def.label.CapitalizeFirst() + " has been cured by " + MSCheckClarity.LabelBase.CapitalizeFirst(), p, MessageTypeDefOf.PositiveEvent, true);
                return(false);
            }
            return(true);
        }
Exemple #5
0
 // Token: 0x06000050 RID: 80 RVA: 0x000054F0 File Offset: 0x000036F0
 private static bool ImmuneNow(Pawn pawn, HediffDef chkhdef)
 {
     if (pawn != null && chkhdef != null)
     {
         HediffSet hediffSet;
         if (pawn == null)
         {
             hediffSet = null;
         }
         else
         {
             Pawn_HealthTracker health = pawn.health;
             hediffSet = (health?.hediffSet);
         }
         HediffSet set = hediffSet;
         if (set != null)
         {
             Hediff chk = set.GetFirstHediffOfDef(chkhdef, false);
             if (chk != null && HediffUtility.FullyImmune(chk))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
        public static bool Patch_CalculateLimbEfficiency(ref float __result, HediffSet diffSet, BodyPartTagDef limbCoreTag, BodyPartTagDef limbSegmentTag,
                                                         BodyPartTagDef limbDigitTag, float appendageWeight, out float functionalPercentage, List <CapacityImpactor> impactors)
        {
            functionalPercentage = 0f;

            if (limbCoreTag != BodyPartTagDefOf.MovingLimbCore)
            {
                return(true);
            }

            var hediff = diffSet.GetFirstHediffOfDef(LifeSupportDefOf.QE_LifeSupport);

            if (hediff is null)
            {
                return(true);
            }

            if (hediff.Severity < 1f)
            {
                return(true);
            }

            __result = 0f;

            if (!(impactors is null))
            {
                var capacityImpactor = new CapacityImpactorHediff();
                capacityImpactor.hediff = hediff;
                impactors.Add(capacityImpactor);
            }

            return(false);
        }
Exemple #7
0
 // Token: 0x060000C2 RID: 194 RVA: 0x00009518 File Offset: 0x00007718
 public override void CompPostTick(ref float severityAdjustment)
 {
     if ((Find.TickManager.TicksGame + base.Pawn.HashOffset()) % 2500 == 0)
     {
         List <ChemicalDef> Chemicals = DefDatabase <ChemicalDef> .AllDefsListForReading;
         Pawn      pawn = base.Pawn;
         HediffSet hediffSet;
         if (pawn == null)
         {
             hediffSet = null;
         }
         else
         {
             Pawn_HealthTracker health = pawn.health;
             hediffSet = (health?.hediffSet);
         }
         HediffSet set = hediffSet;
         if (Chemicals != null && Chemicals.Count > 0)
         {
             foreach (ChemicalDef Chemical in Chemicals)
             {
                 if (!(Chemical.defName == "MSMental"))
                 {
                     HediffDef addiction = Chemical?.addictionHediff;
                     if (addiction != null && set != null)
                     {
                         Hediff chkaddiction = set.GetFirstHediffOfDef(addiction, false);
                         if (chkaddiction != null)
                         {
                             this.ReduceHediff(chkaddiction, this.MSProps.AddictionLossPerHour);
                         }
                     }
                     HediffDef tolerance = Chemical?.toleranceHediff;
                     if (tolerance != null && set != null)
                     {
                         Hediff chktolerance = set.GetFirstHediffOfDef(tolerance, false);
                         if (chktolerance != null)
                         {
                             this.ReduceHediff(chktolerance, this.MSProps.ToleranceLossPerHour);
                         }
                     }
                 }
             }
         }
     }
 }
 public static bool OnIntervalPassedPrefix(Pawn pawn, Hediff cause)
 {
     if (pawn.RaceProps.FleshType == XenomorphRacesDefOf.RRY_Xenomorph)
     {
         float      ambientTemperature = pawn.AmbientTemperature;
         FloatRange floatRange         = pawn.ComfortableTemperatureRange();
         FloatRange floatRange2        = pawn.SafeTemperatureRange();
         HediffSet  hediffSet          = pawn.health.hediffSet;
         HediffDef  hediffDef          = XenomorphDefOf.HypothermicSlowdown;
         Hediff     firstHediffOfDef   = hediffSet.GetFirstHediffOfDef(hediffDef, false);
         if (ambientTemperature < floatRange2.min)
         {
             float num  = Mathf.Abs(ambientTemperature - floatRange2.min);
             float num2 = num * 6.45E-05f;
             num2 = Mathf.Max(num2, 0.00075f);
             HealthUtility.AdjustSeverity(pawn, hediffDef, num2);
             if (pawn.Dead)
             {
                 return(true);
             }
         }
         if (firstHediffOfDef != null)
         {
             if (ambientTemperature > floatRange.min)
             {
                 float num3 = firstHediffOfDef.Severity * 0.027f;
                 num3 = Mathf.Clamp(num3, 0.0015f, 0.015f);
                 firstHediffOfDef.Severity -= num3;
             }
             else if (pawn.RaceProps.FleshType != XenomorphRacesDefOf.RRY_Xenomorph && ambientTemperature < 0f && firstHediffOfDef.Severity > 0.37f)
             {
                 float num4 = 0.025f * firstHediffOfDef.Severity;
                 if (Rand.Value < num4)
                 {
                     BodyPartRecord bodyPartRecord;
                     if ((from x in pawn.RaceProps.body.AllPartsVulnerableToFrostbite
                          where !hediffSet.PartIsMissing(x)
                          select x).TryRandomElementByWeight((BodyPartRecord x) => x.def.frostbiteVulnerability, out bodyPartRecord))
                     {
                         int            num5      = Mathf.CeilToInt((float)bodyPartRecord.def.hitPoints * 0.5f);
                         DamageDef      frostbite = DamageDefOf.Frostbite;
                         float          amount    = (float)num5;
                         BodyPartRecord hitPart   = bodyPartRecord;
                         DamageInfo     dinfo     = new DamageInfo(frostbite, amount, 0f, -1f, null, hitPart, null, DamageInfo.SourceCategory.ThingOrUnknown, null);
                         pawn.TakeDamage(dinfo);
                     }
                 }
             }
         }
         return(false);
     }
     else
     {
         return(true);
     }
 }
        /// <summary>
        ///     Initializes this instance.
        /// </summary>
        /// this is always called before enter and after loading a pawn
        protected override void Init()
        {
            base.Init();

            Pawn_HealthTracker health = Pawn?.health;
            HediffSet hDiffs = health?.hediffSet;
            if (health == null || hDiffs == null) return;
            //fix for old saves
            HediffDef hDef = SapienceStateDefOf.FormerHuman.forcedHediff;
            Hediff hDiff = hDiffs.GetFirstHediffOfDef(hDef);
            if (hDiff != null) health.RemoveHediff(hDiff);
        }
 // Token: 0x060000C8 RID: 200 RVA: 0x00009708 File Offset: 0x00007908
 public override void CompPostTick(ref float severityAdjustment)
 {
     if (base.Pawn.Awake())
     {
         Pawn_HealthTracker health = base.Pawn.health;
         bool flag;
         if (health == null)
         {
             flag = false;
         }
         else
         {
             PawnCapacitiesHandler capacities = health.capacities;
             float?num  = (capacities != null) ? new float?(capacities.GetLevel(PawnCapacityDefOf.Consciousness)) : null;
             float num2 = 0.05f;
             flag = (num.GetValueOrDefault() > num2 & num != null);
         }
         if (flag && base.Pawn.IsHashIntervalTick(2500))
         {
             Pawn      pawn = base.Pawn;
             HediffSet hediffSet;
             if (pawn == null)
             {
                 hediffSet = null;
             }
             else
             {
                 Pawn_HealthTracker health2 = pawn.health;
                 hediffSet = (health2?.hediffSet);
             }
             HediffSet set = hediffSet;
             if (set != null)
             {
                 Hediff anasthetic = set.GetFirstHediffOfDef(HediffDefOf.Anesthetic, false);
                 if (anasthetic != null)
                 {
                     float sev = anasthetic.Severity;
                     if (sev > 0f)
                     {
                         float sevloss = sev * this.MSProps.sevReduce;
                         if (sev - sevloss > 0f)
                         {
                             anasthetic.Severity = sev - sevloss;
                             return;
                         }
                         anasthetic.Severity = 0f;
                     }
                 }
             }
         }
     }
 }
Exemple #11
0
        public override void OnIntervalPassed(Pawn pawn, Hediff cause)
        {
            base.OnIntervalPassed(pawn, cause);
            var       ship             = pawn?.Map?.GetSpaceAtmosphereMapComponent()?.DefinitionAt(pawn.Position);
            HediffSet hediffSet        = pawn.health.hediffSet;
            Hediff    firstHediffOfDef = hediffSet.GetFirstHediffOfDef(hediff);

            //Log.Message("--------------------------------------2"); <-- HOW LOG
            //Tags for EVA_GEAR STUFF
            if ((pawn?.apparel?.WornApparel?.Any(x => x.def.apparel.tags.Contains("EVA_Helmet")) == true) &&
                (pawn?.apparel?.WornApparel?.Any(x => x.def.apparel.tags.Contains("EVA_GasTank")) == true))
            {
                if (firstHediffOfDef != null)
                {
                    float value = firstHediffOfDef.Severity * 0.027f;
                    value = Mathf.Clamp(value, 0.0015f, 0.015f);
                    firstHediffOfDef.Severity -= value;
                }
                return;
            }

            if (ship == null)
            {
                if (pawn?.Map?.IsSpace() == true)
                {
                    //increase severity
                    HealthUtility.AdjustSeverity(pawn, hediff, 0.00375f);
                }
                else if (firstHediffOfDef != null)
                {
                    float value = firstHediffOfDef.Severity * 0.027f;
                    value = Mathf.Clamp(value, 0.0015f, 0.015f);
                    firstHediffOfDef.Severity -= value;
                }
            }
            else
            {
                if (pawn.Map != null && pawn.GetRoom() != null && ship.GetGas(pawn.GetRoom()).mixture.O2Partial <= 6f)
                {
                    //increase severity
                    HealthUtility.AdjustSeverity(pawn, hediff, 0.00375f);
                }
                else if (firstHediffOfDef != null)
                {
                    float value = firstHediffOfDef.Severity * 0.027f;
                    value = Mathf.Clamp(value, 0.0015f, 0.015f);
                    firstHediffOfDef.Severity -= value;
                }
            }
        }
Exemple #12
0
        public override void OnIntervalPassed(Pawn pawn, Hediff cause)
        {
            HediffSet hediffSet = pawn.health.hediffSet;

            Hediff cooldown = hediffSet.GetFirstHediffOfDef(cooldownHediff);

            if (cooldown != null)
            {
                // TODO: custom cooldown based on temperature, maybe?
                return;
            }

            Hediff overheat = hediffSet.GetFirstHediffOfDef(hediff);

            if (overheat != null && overheat.Severity >= hediff.maxSeverity)
            {
                pawn.health.RemoveHediff(overheat);
                HealthUtility.AdjustSeverity(pawn, cooldownHediff, 1f);
                return;
            }

            base.OnIntervalPassed(pawn, cause);
        }
        protected override void Impact(Thing hitThing)
        {
            base.Impact(hitThing);
            Pawn pawn;

            if (this.Def != null && hitThing != null && (pawn = (hitThing as Pawn)) != null)
            {
                if (!pawn.RaceProps.IsFlesh)
                {
                    return;
                }
                foreach (HediffDef def in this.Def.HediffsToAdd)
                {
                    if (Rand.Value <= this.Def.AddHediffChance)
                    {
                        Hediff hediff;
                        if (pawn == null)
                        {
                            hediff = null;
                        }
                        else
                        {
                            Pawn_HealthTracker health = pawn.health;
                            if (health == null)
                            {
                                hediff = null;
                            }
                            else
                            {
                                HediffSet hediffSet = health.hediffSet;
                                hediff = hediffSet?.GetFirstHediffOfDef(def, false);
                            }
                        }
                        Hediff hediff2 = hediff;
                        float  num     = Rand.Range(0.25f, 0.4285f) / (float)Math.Pow((double)pawn.RaceProps.baseBodySize, 1.5);
                        if (hediff2 != null)
                        {
                            hediff2.Severity += num;
                        }
                        else
                        {
                            Hediff hediff3 = HediffMaker.MakeHediff(def, pawn, null);
                            hediff3.Severity = num;
                            pawn.health.AddHediff(hediff3, null, null, null);
                        }
                    }
                }
            }
        }
 // Token: 0x060000B7 RID: 183 RVA: 0x00009138 File Offset: 0x00007338
 public override void CompPostTick(ref float severityAdjustment)
 {
     this.ticksToDisappear--;
     if (this.ticksToDisappear > 0)
     {
         HediffSet MShedSet = this.parent.pawn.health.hediffSet;
         if (MShedSet != null)
         {
             if ((base.Def.defName == "CatatonicBreakdown" || base.Def.defName == "PsychicShock") && (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSClarity_High"), false)) != null)
             {
                 this.ticksToDisappear--;
             }
             if (base.Def.defName == "Unease" || base.Def.defName == "SuicidePreparation")
             {
                 bool   flag          = (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSClarity_High"), false)) != null;
                 Hediff MSCheckRimzac = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSRimzac_High"), false);
                 if (flag || MSCheckRimzac != null)
                 {
                     this.ticksToDisappear--;
                 }
             }
         }
     }
 }
        public override void OnIntervalPassed(Pawn pawn, Hediff cause)
        {
            base.OnIntervalPassed(pawn, cause);
            var       ship             = pawn?.Map?.GetSpaceAtmosphereMapComponent()?.DefinitionAt(pawn.Position);
            HediffSet hediffSet        = pawn.health.hediffSet;
            Hediff    firstHediffOfDef = hediffSet.GetFirstHediffOfDef(hediff);

            //TODO: actually use a component on the headgear to determine time of o2
            if (pawn?.apparel?.WornApparel?.Any(x => x.def.defName == "Apparel_PowerArmorHelmet") == true)
            {
                if (firstHediffOfDef != null)
                {
                    float value = firstHediffOfDef.Severity * 0.027f;
                    value = Mathf.Clamp(value, 0.0015f, 0.015f);
                    firstHediffOfDef.Severity -= value;
                }
                return;
            }

            if (ship == null)
            {
                if (pawn?.Map?.IsSpace() == true)
                {
                    //increase severity
                    HealthUtility.AdjustSeverity(pawn, hediff, 0.00375f);
                }
                else if (firstHediffOfDef != null)
                {
                    float value = firstHediffOfDef.Severity * 0.027f;
                    value = Mathf.Clamp(value, 0.0015f, 0.015f);
                    firstHediffOfDef.Severity -= value;
                }
            }
            else
            {
                if (pawn.Map != null && pawn.GetRoom() != null && ship.GetGas(pawn.GetRoom()).mixture.O2Partial <= 6f)
                {
                    //increase severity
                    HealthUtility.AdjustSeverity(pawn, hediff, 0.00375f);
                }
                else if (firstHediffOfDef != null)
                {
                    float value = firstHediffOfDef.Severity * 0.027f;
                    value = Mathf.Clamp(value, 0.0015f, 0.015f);
                    firstHediffOfDef.Severity -= value;
                }
            }
        }
        public static bool OnIntervalPassed(HediffGiver_Hypothermia __instance, Pawn pawn, Hediff cause)
        {
            float ambientTemperature = pawn.AmbientTemperature;
            //FloatRange floatRange = pawn.ComfortableTemperatureRange(); //REMOVED
            //FloatRange floatRange2 = pawn.SafeTemperatureRange(); //REMOVED
            float     comfortableTemperatureMin = pawn.GetStatValue(StatDefOf.ComfyTemperatureMin); //ADDED
            float     minTemp          = comfortableTemperatureMin - 10f;                           //ADDED
            HediffSet hediffSet        = pawn.health.hediffSet;
            HediffDef hediffDef        = pawn.RaceProps.FleshType == FleshTypeDefOf.Insectoid ? __instance.hediffInsectoid : __instance.hediff;
            Hediff    firstHediffOfDef = hediffSet.GetFirstHediffOfDef(hediffDef);

            //if (ambientTemperature < floatRange2.min) //REMOVED
            if (ambientTemperature < minTemp)             //ADDED
            {
                //float a = Mathf.Abs(ambientTemperature - floatRange2.min) * 6.45E-05f; //REMOVED
                float a = Mathf.Abs(ambientTemperature - minTemp) * 6.45E-05f;                 //ADDED
                a = Mathf.Max(a, 0.00075f);
                HealthUtility.AdjustSeverity(pawn, hediffDef, a);
                if (pawn.Dead)
                {
                    return(false);
                }
            }
            if (firstHediffOfDef == null)
            {
                return(false);
            }
            //if (ambientTemperature > floatRange.min) //REMOVED
            if (ambientTemperature > comfortableTemperatureMin)             //ADDED
            {
                float value = firstHediffOfDef.Severity * 0.027f;
                value = Mathf.Clamp(value, 0.0015f, 0.015f);
                firstHediffOfDef.Severity -= value;
            }
            else if (pawn.RaceProps.FleshType != FleshTypeDefOf.Insectoid && ambientTemperature < 0f && firstHediffOfDef.Severity > 0.37f)
            {
                float num = 0.025f * firstHediffOfDef.Severity;
                if (Rand.Value < num && pawn.RaceProps.body.AllPartsVulnerableToFrostbite.Where(x => !hediffSet.PartIsMissing(x)).TryRandomElementByWeight(x => x.def.frostbiteVulnerability, out BodyPartRecord result))
                {
                    int        num2  = Mathf.CeilToInt(result.def.hitPoints * 0.5f);
                    DamageInfo dinfo = new DamageInfo(DamageDefOf.Frostbite, num2, 0f, -1f, null, result);
                    pawn.TakeDamage(dinfo);
                }
            }
            return(false);
        }
        public override void OnIntervalPassed(Pawn pawn, Hediff cause)
        {
            HediffSet hediffSet = pawn.health.hediffSet;

            Hediff coolantHediff = hediffSet.GetFirstHediffOfDef(contributingHediff);

            bool isOverheating = coolantHediff != null && coolantHediff.Severity >= startToOverheatAt;

            if (isOverheating)
            {
                HealthUtility.AdjustSeverity(pawn, this.hediff, hediffSet.BleedRateTotal * 0.005f);
            }
            else
            {
                HealthUtility.AdjustSeverity(pawn, this.hediff, -0.0125f);
            }
        }
        // Token: 0x06000002 RID: 2 RVA: 0x00002058 File Offset: 0x00000258
        public override void PostIngested(Pawn ingester)
        {
            HediffSet MShedSet = ingester.health.hediffSet;

            if (MShedSet != null)
            {
                if ((MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSMultiVitamins_High"), false)) == null && Rand.Chance(this.poisonPct * Find.Storyteller.difficulty.foodPoisonChanceFactor))
                {
                    FoodUtility.AddFoodPoisoningHediff(ingester, this.parent, this.cause);
                    return;
                }
            }
            else if (Rand.Chance(this.poisonPct * Find.Storyteller.difficulty.foodPoisonChanceFactor))
            {
                FoodUtility.AddFoodPoisoningHediff(ingester, this.parent, this.cause);
            }
        }
        // Token: 0x06000003 RID: 3 RVA: 0x00002108 File Offset: 0x00000308
        private void Randomanesthetic(Pawn hitPawn)
        {
            if (Rand.Value > 0.25f)
            {
                return;
            }
            var anestheticHediffDef = DefDatabase <HediffDef> .GetNamedSilentFail("Hediff_AnestheticBullet");

            if (anestheticHediffDef == null)
            {
                return;
            }
            Messages.Message(TranslatorFormattedStringExtensions.Translate("meng_punji_sticks_anestheticSuccess", hitPawn.Label), new LookTargets(hitPawn), MessageTypeDefOf.PositiveEvent, false);
            Hediff hediff;

            if (hitPawn == null)
            {
                hediff = null;
            }
            else
            {
                Pawn_HealthTracker health = hitPawn.health;
                if (health == null)
                {
                    hediff = null;
                }
                else
                {
                    HediffSet hediffSet = health.hediffSet;
                    hediff = hediffSet?.GetFirstHediffOfDef(anestheticHediffDef, false);
                }
            }
            Hediff hediff2 = hediff;
            var    num     = Rand.Range(0.5f, 0.8f);

            if (hediff2 != null)
            {
                hediff2.Severity += num;
                return;
            }
            Hediff hediff3 = HediffMaker.MakeHediff(anestheticHediffDef, hitPawn, null);

            hediff3.Severity = num;
            hitPawn.health.AddHediff(hediff3, null, null, null);
        }
        public static bool OnIntervalPassed(HediffGiver_Hypothermia __instance, Pawn pawn, Hediff cause)
        {
            float     ambientTemperature        = pawn.AmbientTemperature;
            float     comfortableTemperatureMin = pawn.GetStatValue(StatDefOf.ComfyTemperatureMin, true);
            float     minTemp          = comfortableTemperatureMin - 10f;
            HediffSet hediffSet        = pawn.health.hediffSet;
            HediffDef hediffDef        = pawn.RaceProps.FleshType == FleshTypeDefOf.Insectoid ? __instance.hediffInsectoid : __instance.hediff;
            Hediff    firstHediffOfDef = hediffSet.GetFirstHediffOfDef(hediffDef, false);

            if (ambientTemperature < minTemp)
            {
                float sevOffset = Mathf.Max(Mathf.Abs(ambientTemperature - minTemp) * 6.45E-05f, 0.00075f);
                HealthUtility.AdjustSeverity(pawn, hediffDef, sevOffset);
                if (pawn.Dead)
                {
                    return(false);
                }
            }
            if (firstHediffOfDef == null)
            {
                return(false);
            }
            if (ambientTemperature > comfortableTemperatureMin)
            {
                float num = Mathf.Clamp(firstHediffOfDef.Severity * 0.027f, 0.0015f, 0.015f);
                firstHediffOfDef.Severity -= num;
            }
            else
            {
                BodyPartRecord result;
                if (pawn.RaceProps.FleshType == FleshTypeDefOf.Insectoid || (double)ambientTemperature >= 0.0 || ((double)firstHediffOfDef.Severity <= 0.370000004768372 || (double)Rand.Value >= (double)(0.025f * firstHediffOfDef.Severity)) || !pawn.RaceProps.body.AllPartsVulnerableToFrostbite.Where <BodyPartRecord>((Func <BodyPartRecord, bool>)(x => !hediffSet.PartIsMissing(x))).TryRandomElementByWeight <BodyPartRecord>((Func <BodyPartRecord, float>)(x => x.def.frostbiteVulnerability), out result))
                {
                    return(false);
                }
                int        num   = Mathf.CeilToInt(result.def.hitPoints * 0.5f);
                DamageInfo dinfo = new DamageInfo(DamageDefOf.Frostbite, (float)num, 0.0f, -1f, (Verse.Thing)null, result, (ThingDef)null, DamageInfo.SourceCategory.ThingOrUnknown, (Verse.Thing)null);
                pawn.TakeDamage(dinfo);
            }
            return(false);
        }
Exemple #21
0
        // Token: 0x06000003 RID: 3 RVA: 0x00002108 File Offset: 0x00000308
        private void RandomPlague(Pawn hitPawn)
        {
            if (Rand.Value > 0.25f)
            {
                return;
            }
            Messages.Message(TranslatorFormattedStringExtensions.Translate("meng_punji_sticks_PlagueSuccess", hitPawn.Label), new LookTargets(hitPawn), MessageTypeDefOf.PositiveEvent, false);
            Hediff hediff;

            if (hitPawn == null)
            {
                hediff = null;
            }
            else
            {
                Pawn_HealthTracker health = hitPawn.health;
                if (health == null)
                {
                    hediff = null;
                }
                else
                {
                    HediffSet hediffSet = health.hediffSet;
                    hediff = hediffSet?.GetFirstHediffOfDef(HediffDefOf.Plague, false);
                }
            }
            Hediff hediff2 = hediff;
            var    num     = Rand.Range(0.1f, 0.2f);

            if (hediff2 != null)
            {
                hediff2.Severity += num;
                return;
            }
            Hediff hediff3 = HediffMaker.MakeHediff(HediffDefOf.Plague, hitPawn, null);

            hediff3.Severity = num;
            hitPawn.health.AddHediff(hediff3, null, null, null);
        }
Exemple #22
0
        public void DoOPToxicGas(Thing Gas, Thing targ)
        {
            Pawn pawn = targ as Pawn;

            if (pawn != null && pawn.health.capacities.CapableOf(PawnCapacityDefOf.Breathing))
            {
                HediffDef namedSilentFail = DefDatabase <HediffDef> .GetNamedSilentFail(OPToxicDefGetValue.OPToxicGetHediff(Gas.def));

                if (namedSilentFail != null)
                {
                    Pawn_HealthTracker health = pawn.health;
                    Hediff             hediff;
                    if (health == null)
                    {
                        hediff = null;
                    }
                    else
                    {
                        HediffSet hediffSet = health.hediffSet;
                        hediff = ((hediffSet != null) ? hediffSet.GetFirstHediffOfDef(namedSilentFail, false) : null);
                    }
                    float statValue = pawn.GetStatValue(StatDefOf.ToxicSensitivity, true);
                    float num       = OPToxicDefGetValue.OPToxicGetSev(Gas.def);
                    if (num < 0.01f)
                    {
                        num = 0.01f;
                    }
                    float num2 = Rand.Range(0.01f * statValue, num * statValue);
                    if (hediff != null && num2 > 0f)
                    {
                        hediff.Severity += num2;
                        return;
                    }
                    Hediff hediff2 = HediffMaker.MakeHediff(namedSilentFail, pawn, null);
                    hediff2.Severity = num2;
                    pawn.health.AddHediff(hediff2, null, null, null);
                }
            }
        }
Exemple #23
0
 // Token: 0x06000064 RID: 100 RVA: 0x00005F24 File Offset: 0x00004124
 internal static bool HediffEffect(HediffDef hediffdef, float SeverityToApply, Pawn pawn, BodyPartRecord part, out bool immune)
 {
     immune = false;
     if (!pawn.RaceProps.IsMechanoid && hediffdef != null)
     {
         if (!MSHediffEffecter.ImmuneTo(pawn, hediffdef))
         {
             if (!pawn.health.WouldDieAfterAddingHediff(hediffdef, part, SeverityToApply))
             {
                 Pawn_HealthTracker health = pawn.health;
                 Hediff             hediff;
                 if (health == null)
                 {
                     hediff = null;
                 }
                 else
                 {
                     HediffSet hediffSet = health.hediffSet;
                     hediff = (hediffSet?.GetFirstHediffOfDef(hediffdef, false));
                 }
                 Hediff hashediff = hediff;
                 if (hashediff != null)
                 {
                     hashediff.Severity += SeverityToApply;
                     return(true);
                 }
                 Hediff addhediff = HediffMaker.MakeHediff(hediffdef, pawn, part);
                 addhediff.Severity = SeverityToApply;
                 pawn.health.AddHediff(addhediff, part, null, null);
                 return(true);
             }
         }
         else
         {
             immune = true;
         }
     }
     return(false);
 }
        public override void OnIntervalPassed(Pawn pawn, Hediff cause)
        {
            if (!pawn.IsColonist)
            {
                return;
            }
            var active = InterestBase.GetActiveSkill(pawn);

            if (active == null)
            {
                DecreaseAllergy(pawn);
                return;
            }
            SkillRecord skill = pawn.skills.GetSkill(active);

            if (skill == null)
            {
                return;
            }
            int       passion          = (int)skill.passion;
            int       allergic         = InterestBase.interestList["DAllergic"];
            HediffSet hediffSet        = pawn.health.hediffSet;
            Hediff    firstHediffOfDef = hediffSet.GetFirstHediffOfDef(this.hediff, false);

            if (passion != allergic && firstHediffOfDef != null) // pawn's active skill isn't causing an allergy, but they have the allergic hediff
            {
                DecreaseAllergy(pawn);
                //firstHediffOfDef.Severity -= gainRate;
            }
            else if (passion == allergic) // pawn's active skill is allergy causing
            {
                IncreaseAllergy(pawn);
            }

            base.OnIntervalPassed(pawn, cause);
        }
        public static bool BloodStatus(Pawn pawn, out Hediff BloodHD)
        {
            HediffSet      hediffSet = pawn.health.hediffSet;
            BodyPartRecord part      = pawn.RaceProps.body.AllParts.Find(x => x.def == BodyPartDefOf.Head);
            HediffDef      hediffDef;
            bool           result = false;

            BloodHD = null;
            bool hasbloodedM = hediffSet.hediffs.Any <Hediff>(x => x.def.defName.StartsWith(markedDef.defName));

            if (hasbloodedM)
            {
                BloodHD = hediffSet.hediffs.Find(x => x.def.defName.Contains(markedDef.defName));
                //    Log.Message(string.Format("hasbloodedM: {0}", BloodHD));
                result = true;
            }
            bool hasunblooded = hediffSet.HasHediff(unbloodedDef);

            if (hasunblooded)
            {
                BloodHD = hediffSet.GetFirstHediffOfDef(unbloodedDef);
                if (!PlayerKnowledgeDatabase.IsComplete(YautjaConceptDefOf.RRY_Concept_Unblooded) && pawn.IsColonist && pawn.Spawned && (pawn.Map != null || pawn.MapHeld != null))
                {
                    LessonAutoActivator.TeachOpportunity(YautjaConceptDefOf.RRY_Concept_Unblooded, OpportunityType.Important);
                }
                //    Log.Message(string.Format("hasunblooded: {0}", BloodHD));
                result = false;
            }
            bool hasbloodedUM = hediffSet.HasHediff(unmarkedDef);

            if (hasbloodedUM)
            {
                BloodHD = hediffSet.GetFirstHediffOfDef(unmarkedDef);
                if (!PlayerKnowledgeDatabase.IsComplete(YautjaConceptDefOf.RRY_Concept_Blooding) && pawn.IsColonist && pawn.Spawned && (pawn.Map != null || pawn.MapHeld != null))
                {
                    LessonAutoActivator.TeachOpportunity(YautjaConceptDefOf.RRY_Concept_Blooding, OpportunityType.Important);
                }
                //    Log.Message(string.Format("hasbloodedUM: {0}", BloodHD));
                result = true;
            }
            if (BloodHD == null)
            {
                //    Log.Message(string.Format("1"));
                Backstory pawnStoryC = pawn.story.childhood;
                Backstory pawnStoryA = pawn.story.adulthood ?? null;

                if (pawn.kindDef.race == YautjaDefOf.RRY_Alien_Yautja && pawnStoryA != null)
                {
                    //    Log.Message(string.Format("2"));
                    if (pawnStoryA != bsDefUnblooded.backstory)
                    {
                        //    Log.Message(string.Format("3"));
                        Comp_Yautja _Yautja = pawn.TryGetComp <Comp_Yautja>();
                        hediffDef = _Yautja.Props.bloodedDefs.RandomElement();

                        if (hediffDef != null)
                        {
                            //    Log.Message(string.Format("4"));
                            PawnKindDef pawnKindDef = YautjaBloodedUtility.RandomMarked(hediffDef);
                            if (_Yautja != null)
                            {
                                //    Log.Message(string.Format("5"));
                                _Yautja.MarkHedifflabel = pawnKindDef.LabelCap;
                                _Yautja.MarkedhediffDef = hediffDef;
                                _Yautja.predator        = pawnKindDef.RaceProps.predator;
                                _Yautja.BodySize        = pawnKindDef.RaceProps.baseBodySize;
                                _Yautja.combatPower     = pawnKindDef.combatPower;
                            }
                        }
                    }
                    else
                    {
                        //    Log.Message(string.Format("6"));
                        hediffDef = unbloodedDef;
                    }
                }
                else
                {
                    //    Log.Message(string.Format("7"));
                    hediffDef = unbloodedDef;
                }
                //    Log.Message(string.Format("8"));
                pawn.health.AddHediff(hediffDef, part);
                //    Log.Message(string.Format("9"));
                BloodHD = hediffSet.GetFirstHediffOfDef(hediffDef);
                //    Log.Message(string.Format("10"));
                result = true;
                //    Log.Message(string.Format("11"));
            }
            else
            {
                //    Log.Message(string.Format("12"));
                Comp_Yautja _Yautja = pawn.TryGetComp <Comp_Yautja>();
                //    Log.Message(string.Format("12 a {0}", BloodHD.def));
                if (hasbloodedM)
                {
                    PawnKindDef pawnKindDef = YautjaBloodedUtility.RandomMarked(BloodHD.def);
                    //    Log.Message(string.Format("12 B {0}", pawnKindDef));
                    if (_Yautja != null && _Yautja.MarkHedifflabel.NullOrEmpty())
                    {
                        //    Log.Message(string.Format("13 "));
                        _Yautja.MarkHedifflabel = pawnKindDef.LabelCap;
                        //    Log.Message(string.Format("13 a"));
                        _Yautja.MarkedhediffDef = BloodHD.def;
                        //    Log.Message(string.Format("13 b"));
                        _Yautja.predator = pawnKindDef.RaceProps.predator;
                        //    Log.Message(string.Format("13 c"));
                        _Yautja.BodySize = pawnKindDef.RaceProps.baseBodySize;
                        //    Log.Message(string.Format("13 d"));
                        _Yautja.combatPower = pawnKindDef.combatPower;
                        //    Log.Message(string.Format("13 f"));
                    }
                }
            }
            //    Log.Message(string.Format("14"));
            return(result);
        }
        // Token: 0x06000028 RID: 40 RVA: 0x00003048 File Offset: 0x00001248
        public void addHediffToPawn(Pawn p, HediffDef _heddiff, float _addhediffChance, float _hediffseverity, bool onlylungs)
        {
            bool EyeProtection  = false;
            bool LungProtection = false;
            bool flag           = !Rand.Chance(_addhediffChance);

            if (!flag)
            {
                Hediff hediff = HediffMaker.MakeHediff(_heddiff, p, null);
                hediff.Severity = _hediffseverity;
                CompLungProtection clp;
                clp = p.GetComp <CompLungProtection>();
                if (clp != null)
                {
                    LungProtection = true;
                }
                CompEyeProtection cep;
                foreach (var a in p.apparel.WornApparel)
                {
                    if (a.def.apparel.tags.Contains("GasMask"))
                    {
                    }
                }

                cep = p.GetComp <CompEyeProtection>();
                if (cep != null)
                {
                    EyeProtection = true;
                }
                bool flag2 = onlylungs && p.health.capacities.CapableOf(PawnCapacityDefOf.Breathing);
                if (flag2)
                {
                    if (!LungProtection)
                    {
                        List <BodyPartRecord> list = new List <BodyPartRecord>();
                        float num = 0.028758334f;
                        num *= StatExtension.GetStatValue(p, StatDefOf.ToxicSensitivity, true);
                        bool flag3 = num != 0f;
                        if (flag3)
                        {
                            float num2 = Mathf.Lerp(0.85f, 1.15f, Rand.ValueSeeded(p.thingIDNumber ^ 74374237));
                            num *= num2;
                        }
                        float statValue = StatExtension.GetStatValue(p, StatDefOf.ToxicSensitivity, true);
                        hediff.Severity = _hediffseverity * statValue;
                        foreach (BodyPartRecord bodyPartRecord in p.health.hediffSet.GetNotMissingParts(0, BodyPartDepth.Inside, null, null))
                        {
                            bool flag4 = bodyPartRecord.def.tags.Contains(BodyPartTagDefOf.BreathingSource);
                            if (flag4)
                            {
                                list.Add(bodyPartRecord);
                            }
                        }
                        bool flag5 = list.Count > 0;
                        if (flag5)
                        {
                            for (int i = 0; i < list.Count; i++)
                            {
                                Hediff hediff2;
                                if (p == null)
                                {
                                    hediff2 = null;
                                }
                                else
                                {
                                    Pawn_HealthTracker health = p.health;
                                    if (health == null)
                                    {
                                        hediff2 = null;
                                    }
                                    else
                                    {
                                        HediffSet hediffSet = health.hediffSet;
                                        hediff2 = ((hediffSet != null) ? hediffSet.GetFirstHediffOfDef(_heddiff, false) : null);
                                    }
                                }
                                Hediff hediff3 = hediff2;
                                float  num3    = Rand.Range(0.1f, 0.2f);
                                bool   flag6   = hediff3 != null;
                                if (flag6)
                                {
                                    hediff3.Severity += num3 * statValue;
                                }
                                else
                                {
                                    p.health.AddHediff(hediff, list[i], null, null);
                                }
                            }
                        }
                    }
                }
                else
                {
                    Hediff hediff4;
                    if (p == null)
                    {
                        hediff4 = null;
                    }
                    else
                    {
                        Pawn_HealthTracker health2 = p.health;
                        if (health2 == null)
                        {
                            hediff4 = null;
                        }
                        else
                        {
                            HediffSet hediffSet2 = health2.hediffSet;
                            hediff4 = ((hediffSet2 != null) ? hediffSet2.GetFirstHediffOfDef(_heddiff, false) : null);
                        }
                    }
                    Hediff hediff5    = hediff4;
                    float  num4       = Rand.Range(0.1f, 0.2f);
                    float  statValue2 = StatExtension.GetStatValue(p, StatDefOf.ToxicSensitivity, true);
                    bool   flag7      = hediff5 != null;
                    if (flag7)
                    {
                        hediff5.Severity += num4 * statValue2;
                    }
                    else
                    {
                        hediff.Severity = _hediffseverity * statValue2;
                        p.health.AddHediff(hediff, null, null, null);
                    }
                }
            }
        }
        // Token: 0x06000023 RID: 35 RVA: 0x00002BEC File Offset: 0x00000DEC
        public override void CompTended_NewTemp(float quality, float maxQuality, int batchPosition = 0)
        {
            float     MSAddQuality = 0f;
            HediffSet MShedSet     = this.parent.pawn.health.hediffSet;

            if (base.Def.defName == "WoundInfection" && (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSRimedicrem_High"), false)) != null)
            {
                MSAddQuality += 0.25f;
            }
            if (base.Def.defName == "Asthma" && (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSInhaler_High"), false)) != null)
            {
                MSAddQuality += 0.2f;
            }
            if (base.Def.defName == "Flu" && (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSFireThroat_High"), false)) != null)
            {
                MSAddQuality += 0.25f;
            }
            if (base.Def.defName == "MuscleParasites" && (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSRimtarolHigh"), false)) != null)
            {
                MSAddQuality += 0.15f;
            }
            if (base.Def.defName == "GutWorms" && (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSRimpepticHigh"), false)) != null)
            {
                MSAddQuality += 0.18f;
            }
            if ((base.Def.defName == "Carcinoma" || base.Def.defName == "BloodCancer") && (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSVinacol_High"), false)) != null)
            {
                MSAddQuality += 0.25f;
            }
            if (base.Def.defName == "HepatitisK")
            {
                bool   flag         = (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSMetasisHigh"), false)) != null;
                Hediff MSCheckDrug2 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSBattleStim_High"), false);
                if (flag || MSCheckDrug2 != null)
                {
                    MSAddQuality += 0.15f;
                }
            }
            if (base.Def.defName == "StomachUlcer")
            {
                bool   flag2        = (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSRimpepticHigh"), false)) != null;
                Hediff MSCheckDrug3 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSMetasisHigh"), false);
                Hediff MSCheckDrug4 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSBattleStim_High"), false);
                if (flag2 || MSCheckDrug3 != null || MSCheckDrug4 != null)
                {
                    MSAddQuality += 0.2f;
                }
            }
            if (base.Def.defName == "Tuberculosis" || base.Def.defName == "KindredDickVirus" || base.Def.defName == "Sepsis" || base.Def.defName == "Toothache" || base.Def.defName == "VoightBernsteinDisease" || base.Def.defName == "NewReschianFever")
            {
                bool   flag3        = (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSRimoxicillin_High"), false)) != null;
                Hediff MSCheckDrug5 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSMetasisHigh"), false);
                Hediff MSCheckDrug6 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSBattleStim_High"), false);
                if (flag3 || MSCheckDrug5 != null || MSCheckDrug6 != null)
                {
                    MSAddQuality += 0.15f;
                }
            }
            if (base.Def.defName == "Migraine")
            {
                bool   flag4        = (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSRimCodamol_High"), false)) != null;
                Hediff MSCheckDrug7 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSMorphine_High"), false);
                Hediff MSCheckDrug8 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSOpiumPipe_High"), false);
                if (flag4)
                {
                    MSAddQuality += 0.25f;
                }
                if (MSCheckDrug7 != null || MSCheckDrug8 != null)
                {
                    MSAddQuality += 0.5f;
                }
            }
            this.tendQuality       = Mathf.Clamp01(quality + Rand.Range(-0.25f + MSAddQuality, 0.25f + MSAddQuality));
            this.totalTendQuality += this.tendQuality;
            if (this.TProps.TendIsPermanent)
            {
                this.tendTicksLeft = 1;
            }
            else
            {
                this.tendTicksLeft = Mathf.Max(0, this.tendTicksLeft) + this.TProps.TendTicksFull;
            }
            if (batchPosition == 0 && base.Pawn.Spawned)
            {
                string text = "TextMote_Tended".Translate(this.parent.Label).CapitalizeFirst() + "\n" + "Quality".Translate() + " " + this.tendQuality.ToStringPercent();
                MoteMaker.ThrowText(base.Pawn.DrawPos, base.Pawn.Map, text, Color.white, 3.65f);
            }
            base.Pawn.health.Notify_HediffChanged(this.parent);
        }
Exemple #28
0
        // Token: 0x0600004C RID: 76 RVA: 0x00005168 File Offset: 0x00003368
        public static bool IsOKtoAdmin(Pawn pawn, HediffDef hdef, ThingDef def)
        {
            DrugPolicy drugPolicy;

            if (pawn == null)
            {
                drugPolicy = null;
            }
            else
            {
                Pawn_DrugPolicyTracker drugs = pawn.drugs;
                drugPolicy = (drugs?.CurrentPolicy);
            }
            DrugPolicy policy = drugPolicy;

            if (policy != null)
            {
                if (!MSDrugUtility.DPExists(policy, def))
                {
                    Messages.Message(TranslatorFormattedStringExtensions.Translate("MSPainless.ErrDrugPolicy", pawn?.LabelShort, def?.label), pawn, MessageTypeDefOf.NeutralEvent, false);
                    return(false);
                }
                if (policy[def] != null)
                {
                    DrugPolicyEntry entry = policy[def];
                    if (entry != null && entry.allowScheduled && entry != null && entry.daysFrequency > 0f)
                    {
                        return(false);
                    }
                }
            }
            if (!DRSettings.DoIfImmune && MSDrugUtility.ImmuneNow(pawn, hdef))
            {
                return(false);
            }
            if (hdef != null && hdef.defName == "Anesthetic")
            {
                HediffSet hediffSet;
                if (pawn == null)
                {
                    hediffSet = null;
                }
                else
                {
                    Pawn_HealthTracker health = pawn.health;
                    hediffSet = (health?.hediffSet);
                }
                HediffSet set = hediffSet;
                if (set != null)
                {
                    Hediff Anesthetic = set.GetFirstHediffOfDef(hdef, false);
                    if (Anesthetic != null && Anesthetic.Severity >= 0.8f)
                    {
                        return(false);
                    }
                }
            }
            if (def.IsIngestible)
            {
                List <IngestionOutcomeDoer> ODs = def.ingestible.outcomeDoers;
                if (ODs.Count > 0)
                {
                    bool      toohighsev = false;
                    HediffSet hediffSet2;
                    if (pawn == null)
                    {
                        hediffSet2 = null;
                    }
                    else
                    {
                        Pawn_HealthTracker health2 = pawn.health;
                        hediffSet2 = (health2?.hediffSet);
                    }
                    HediffSet hediffset = hediffSet2;
                    if (hediffset != null)
                    {
                        foreach (IngestionOutcomeDoer OD in ODs)
                        {
                            if (OD is IngestionOutcomeDoer_GiveHediff)
                            {
                                IngestionOutcomeDoer_GiveHediff ingestionOutcomeDoer_GiveHediff = OD as IngestionOutcomeDoer_GiveHediff;
                                HediffDef ODhediffdef = ingestionOutcomeDoer_GiveHediff?.hediffDef;
                                if (ODhediffdef != null)
                                {
                                    float ODSev = (OD as IngestionOutcomeDoer_GiveHediff).severity;
                                    if (ODSev > 0f)
                                    {
                                        Hediff ODhediff = hediffset.GetFirstHediffOfDef(ODhediffdef, false);
                                        if (ODhediff != null && ODhediff.Severity / ODSev > 0.75f)
                                        {
                                            toohighsev = true;
                                        }
                                    }
                                }
                            }
                        }
                        if (toohighsev)
                        {
                            return(false);
                        }
                    }
                }
                return(true);
            }
            return(false);
        }
 // Token: 0x06000024 RID: 36 RVA: 0x000030B8 File Offset: 0x000012B8
 public override void CompPostTick(ref float severityAdjustment)
 {
     base.CompPostTick(ref severityAdjustment);
     if (this.tendTicksLeft > 0 && !this.TProps.TendIsPermanent)
     {
         this.tendTicksLeft--;
         if (this.tendTicksLeft > 0)
         {
             bool      MSDebug              = false;
             HediffSet MShedSet             = this.parent.pawn.health.hediffSet;
             float     MSOverComeLevel      = 0.5f;
             float     MSRimpepticCureLevel = 0.01f;
             float     MSRimpepticCureTend  = 0.85f;
             int       MSTicksSafeTendTime  = 5000;
             if (MSRimpepticCureTend < MSOverComeLevel)
             {
                 MSRimpepticCureTend = MSOverComeLevel;
             }
             if (this.tendQuality >= MSOverComeLevel)
             {
                 if (base.Def.defName == "Asthma" && (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSInhaler_High"), false)) != null && Rand.Range(0f, this.tendQuality) >= MSOverComeLevel)
                 {
                     if (MSDebug && this.tendTicksLeft % 250 == 0)
                     {
                         Messages.Message(string.Concat(new string[]
                         {
                             "Debug: ",
                             base.Def.label,
                             " for ",
                             base.Pawn.Label,
                             " is INCREASING with tendqual ",
                             this.tendQuality.ToString("N2")
                         }), base.Pawn, MessageTypeDefOf.PositiveEvent, true);
                     }
                     this.tendTicksLeft++;
                 }
                 if (base.Def.defName == "Flu" && (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSFireThroat_High"), false)) != null && Rand.Range(0f, this.tendQuality) >= MSOverComeLevel)
                 {
                     if (MSDebug && this.tendTicksLeft % 250 == 0)
                     {
                         Messages.Message(string.Concat(new string[]
                         {
                             "Debug: ",
                             base.Def.label,
                             " for ",
                             base.Pawn.Label,
                             " is INCREASING with tendqual ",
                             this.tendQuality.ToString("N2")
                         }), base.Pawn, MessageTypeDefOf.PositiveEvent, true);
                     }
                     this.tendTicksLeft++;
                 }
                 if (base.Def.defName == "WoundInfection" && (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSRimedicrem_High"), false)) != null && Rand.Range(0f, this.tendQuality) >= MSOverComeLevel)
                 {
                     if (MSDebug && this.tendTicksLeft % 250 == 0)
                     {
                         Messages.Message(string.Concat(new string[]
                         {
                             "Debug: ",
                             base.Def.label,
                             " for ",
                             base.Pawn.Label,
                             " is INCREASING with tendqual ",
                             this.tendQuality.ToString("N2")
                         }), base.Pawn, MessageTypeDefOf.PositiveEvent, true);
                     }
                     this.tendTicksLeft++;
                 }
                 if (this.tendTicksLeft > MSTicksSafeTendTime && base.Def.defName == "MuscleParasites" && (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSRimtarolHigh"), false)) != null && Rand.Range(0f, this.tendQuality) >= MSOverComeLevel)
                 {
                     if (MSDebug && this.tendTicksLeft % 250 == 0)
                     {
                         Messages.Message(string.Concat(new string[]
                         {
                             "Debug: ",
                             base.Def.label,
                             " for ",
                             base.Pawn.Label,
                             " is REDUCING with tendqual ",
                             this.tendQuality.ToString("N2")
                         }), base.Pawn, MessageTypeDefOf.PositiveEvent, true);
                     }
                     this.tendTicksLeft--;
                 }
                 if (base.Def.defName == "GutWorms")
                 {
                     Hediff MSCheckRimpeptic = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSRimpepticHigh"), false);
                     if (MSCheckRimpeptic != null)
                     {
                         if (this.tendTicksLeft > MSTicksSafeTendTime && Rand.Range(0f, this.tendQuality) >= MSOverComeLevel)
                         {
                             if (MSDebug && this.tendTicksLeft % 250 == 0)
                             {
                                 Messages.Message(string.Concat(new string[]
                                 {
                                     "Debug: ",
                                     base.Def.label,
                                     " for ",
                                     base.Pawn.Label,
                                     " is REDUCING with tendqual ",
                                     this.tendQuality.ToString("N2")
                                 }), base.Pawn, MessageTypeDefOf.PositiveEvent, true);
                             }
                             this.tendTicksLeft--;
                         }
                         if (this.tendTicksLeft > 0 && (this.tendTicksLeft % 1000 == 0 || (this.tendTicksLeft + 1) % 1000 == 0) && this.tendQuality >= MSRimpepticCureTend && Rand.Range(0f, 1f - (this.tendQuality - MSRimpepticCureTend)) <= MSRimpepticCureLevel)
                         {
                             Hediff MSHediffGWToGo = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("GutWorms"), false);
                             if (MSHediffGWToGo != null)
                             {
                                 this.MSCure(MSHediffGWToGo, MSCheckRimpeptic);
                             }
                         }
                     }
                 }
                 if ((base.Def.defName == "BloodCancer" || base.Def.defName == "Carcinoma") && (MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSVinacol_High"), false)) != null && Rand.Range(0f, this.tendQuality) >= MSOverComeLevel)
                 {
                     if (MSDebug && this.tendTicksLeft % 250 == 0)
                     {
                         Messages.Message(string.Concat(new string[]
                         {
                             "Debug: ",
                             base.Def.label,
                             " for ",
                             base.Pawn.Label,
                             " is INCREASING with tendqual ",
                             this.tendQuality.ToString("N2")
                         }), base.Pawn, MessageTypeDefOf.PositiveEvent, true);
                     }
                     this.tendTicksLeft++;
                 }
                 if (base.Def.defName == "HepatitisK")
                 {
                     Hediff MSCheckDrug  = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSMetasisHigh"), false);
                     Hediff MSCheckDrug2 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSBattleStim_High"), false);
                     if ((MSCheckDrug != null || MSCheckDrug2 != null) && Rand.Range(0f, this.tendQuality) >= MSOverComeLevel)
                     {
                         if (MSDebug && this.tendTicksLeft % 250 == 0)
                         {
                             Messages.Message(string.Concat(new string[]
                             {
                                 "Debug: ",
                                 base.Def.label,
                                 " for ",
                                 base.Pawn.Label,
                                 " is INCREASING with tendqual ",
                                 this.tendQuality.ToString("N2")
                             }), base.Pawn, MessageTypeDefOf.PositiveEvent, true);
                         }
                         this.tendTicksLeft++;
                     }
                 }
                 if (base.Def.defName == "StomachUlcer")
                 {
                     Hediff MSCheckDrug3 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSRimpepticHigh"), false);
                     Hediff MSCheckDrug4 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSMetasisHigh"), false);
                     Hediff MSCheckDrug5 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSBattleStim_High"), false);
                     if ((MSCheckDrug3 != null || MSCheckDrug4 != null || MSCheckDrug5 != null) && Rand.Range(0f, this.tendQuality) >= MSOverComeLevel)
                     {
                         if (MSDebug && this.tendTicksLeft % 250 == 0)
                         {
                             Messages.Message(string.Concat(new string[]
                             {
                                 "Debug: ",
                                 base.Def.label,
                                 " for ",
                                 base.Pawn.Label,
                                 " is INCREASING with tendqual ",
                                 this.tendQuality.ToString("N2")
                             }), base.Pawn, MessageTypeDefOf.PositiveEvent, true);
                         }
                         this.tendTicksLeft++;
                     }
                 }
                 if (base.Def.defName == "Tuberculosis" || base.Def.defName == "KindredDickVirus" || base.Def.defName == "Sepsis" || base.Def.defName == "Toothache" || base.Def.defName == "VoightBernsteinDisease" || base.Def.defName == "NewReschianFever")
                 {
                     Hediff MSCheckDrug6 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSRimoxicillin_High"), false);
                     Hediff MSCheckDrug7 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSMetasisHigh"), false);
                     Hediff MSCheckDrug8 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSBattleStim_High"), false);
                     if ((MSCheckDrug6 != null || MSCheckDrug7 != null || MSCheckDrug8 != null) && Rand.Range(0f, this.tendQuality) >= MSOverComeLevel)
                     {
                         if (MSDebug && this.tendTicksLeft % 250 == 0)
                         {
                             Messages.Message(string.Concat(new string[]
                             {
                                 "Debug: ",
                                 base.Def.label,
                                 " for ",
                                 base.Pawn.Label,
                                 " is INCREASING with tendqual ",
                                 this.tendQuality.ToString("N2")
                             }), base.Pawn, MessageTypeDefOf.PositiveEvent, true);
                         }
                         this.tendTicksLeft++;
                     }
                 }
                 if (base.Def.defName == "Migraine")
                 {
                     Hediff MSCheckDrug9  = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSRimCodamol_High"), false);
                     Hediff MSCheckDrug10 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSMorphine_High"), false);
                     Hediff MSCheckDrug11 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSOpiumPipe_High"), false);
                     if ((MSCheckDrug9 != null || MSCheckDrug10 != null || MSCheckDrug11 != null) && Rand.Range(0f, this.tendQuality) >= MSOverComeLevel)
                     {
                         if (MSDebug && this.tendTicksLeft % 250 == 0)
                         {
                             Messages.Message(string.Concat(new string[]
                             {
                                 "Debug: ",
                                 base.Def.label,
                                 " for ",
                                 base.Pawn.Label,
                                 " is INCREASING with tendqual ",
                                 this.tendQuality.ToString("N2")
                             }), base.Pawn, MessageTypeDefOf.PositiveEvent, true);
                         }
                         this.tendTicksLeft++;
                     }
                 }
             }
             if (base.Def.defName == "FibrousMechanites")
             {
                 Hediff MSCheckAntinites = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSAntinitesHigh"), false);
                 if (MSCheckAntinites != null)
                 {
                     Hediff MSHediffFMToGo = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("FibrousMechanites"), false);
                     if (MSHediffFMToGo != null)
                     {
                         this.MSCure(MSHediffFMToGo, MSCheckAntinites);
                     }
                 }
             }
             if (base.Def.defName == "SensoryMechanites")
             {
                 Hediff MSCheckAntinites2 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSAntinitesHigh"), false);
                 if (MSCheckAntinites2 != null)
                 {
                     Hediff MSHediffSMToGo = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("SensoryMechanites"), false);
                     if (MSHediffSMToGo != null)
                     {
                         this.MSCure(MSHediffSMToGo, MSCheckAntinites2);
                     }
                 }
             }
             if (base.Def.defName == "LymphaticMechanites")
             {
                 Hediff MSCheckAntinites3 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("MSAntinitesHigh"), false);
                 if (MSCheckAntinites3 != null)
                 {
                     Hediff MSHediffSMToGo2 = MShedSet?.GetFirstHediffOfDef(HediffDef.Named("LymphaticMechanites"), false);
                     if (MSHediffSMToGo2 != null)
                     {
                         this.MSCure(MSHediffSMToGo2, MSCheckAntinites3);
                     }
                 }
             }
         }
     }
 }