public float ImmunityChangePerTick(Pawn pawn, bool sick, Hediff diseaseInstance) { float result; if (!pawn.RaceProps.IsFlesh) { result = 0f; } else { HediffCompProperties_Immunizable hediffCompProperties_Immunizable = this.hediffDef.CompProps <HediffCompProperties_Immunizable>(); float num = (!sick) ? hediffCompProperties_Immunizable.immunityPerDayNotSick : hediffCompProperties_Immunizable.immunityPerDaySick; num /= 60000f; float num2 = pawn.GetStatValue(StatDefOf.ImmunityGainSpeed, true); if (diseaseInstance != null) { Rand.PushState(); Rand.Seed = Gen.HashCombineInt(diseaseInstance.loadID ^ Find.World.info.randomValue, 156482735); num2 *= Mathf.Lerp(0.8f, 1.2f, Rand.Value); Rand.PopState(); } if (num > 0f) { result = num * num2; } else { result = num / num2; } } return(result); }
public bool PossibleToDevelopImmunityNaturally() { HediffCompProperties_Immunizable hediffCompProperties_Immunizable = CompProps <HediffCompProperties_Immunizable>(); if (hediffCompProperties_Immunizable != null && (hediffCompProperties_Immunizable.immunityPerDayNotSick > 0f || hediffCompProperties_Immunizable.immunityPerDaySick > 0f)) { return(true); } return(false); }
public float ImmunityChangePerTick(Pawn pawn, bool sick, Hediff diseaseInstance) { if (!pawn.RaceProps.IsFlesh) { return(0f); } HediffCompProperties_Immunizable hediffCompProperties_Immunizable = this.hediffDef.CompProps <HediffCompProperties_Immunizable>(); if (sick) { float num = hediffCompProperties_Immunizable.immunityPerDaySick; num *= pawn.GetStatValue(StatDefOf.ImmunityGainSpeed, true); if (diseaseInstance != null) { Rand.PushState(); Rand.Seed = Gen.HashCombineInt(diseaseInstance.loadID ^ Find.World.info.persistentRandomValue, 156482735); num *= Mathf.Lerp(0.8f, 1.2f, Rand.Value); Rand.PopState(); } return(num / 60000f); } return(hediffCompProperties_Immunizable.immunityPerDayNotSick / 60000f); }
public float ImmunityChangePerTick(Pawn pawn, bool sick, Hediff diseaseInstance) { if (!pawn.RaceProps.IsFlesh) { return(0f); } HediffCompProperties_Immunizable hediffCompProperties_Immunizable = this.hediffDef.CompProps <HediffCompProperties_Immunizable>(); float num = (!sick) ? hediffCompProperties_Immunizable.immunityPerDayNotSick : hediffCompProperties_Immunizable.immunityPerDaySick; num /= 60000f; float num2 = pawn.GetStatValue(StatDefOf.ImmunityGainSpeed, true); if (diseaseInstance != null) { int value = Gen.HashCombineInt(diseaseInstance.GetHashCode(), 156482735); num2 *= Mathf.Lerp(0.8f, 1.2f, (float)Mathf.Abs(value) / 2.14748365E+09f); } if (num > 0f) { return(num * num2); } return(num / num2); }
public bool PossibleToDevelopImmunityNaturally() { HediffCompProperties_Immunizable hediffCompProperties_Immunizable = this.CompProps <HediffCompProperties_Immunizable>(); return(hediffCompProperties_Immunizable != null && (hediffCompProperties_Immunizable.immunityPerDayNotSick > 0f || hediffCompProperties_Immunizable.immunityPerDaySick > 0f)); }