private void TryAddImmunityRecord(HediffDef def) { if (def.CompProps <HediffCompProperties_Immunizable>() != null && !this.ImmunityRecordExists(def)) { ImmunityRecord immunityRecord = new ImmunityRecord(); immunityRecord.hediffDef = def; this.immunityList.Add(immunityRecord); } }
private void TryAddImmunityRecord(HediffDef def, HediffDef source) { if (def.CompProps <HediffCompProperties_Immunizable>() == null) { return; } if (this.ImmunityRecordExists(def)) { return; } ImmunityRecord immunityRecord = new ImmunityRecord(); immunityRecord.hediffDef = def; immunityRecord.source = source; this.immunityList.Add(immunityRecord); }
public float ImmunityChangePerTick(Pawn pawn, bool sick, Hediff diseaseInstance) { if (!pawn.RaceProps.IsFlesh) { return(0f); } HediffCompProperties_Immunizable hediffCompProperties_Immunizable = hediffDef.CompProps <HediffCompProperties_Immunizable>(); if (sick) { float immunityPerDaySick = hediffCompProperties_Immunizable.immunityPerDaySick; immunityPerDaySick *= pawn.GetStatValue(StatDefOf.ImmunityGainSpeed); if (diseaseInstance != null) { Rand.PushState(); Rand.Seed = Gen.HashCombineInt(diseaseInstance.loadID ^ Find.World.info.persistentRandomValue, 156482735); immunityPerDaySick *= Mathf.Lerp(0.8f, 1.2f, Rand.Value); Rand.PopState(); } return(immunityPerDaySick / 60000f); } return(hediffCompProperties_Immunizable.immunityPerDayNotSick / 60000f); }
internal float <> m__1(HediffDef d, float tend) { return(this.baseSeverityIncrease(d) + d.CompProps <HediffCompProperties_TendDuration>().severityPerDayTended *tend); }
internal float <> m__0(HediffDef d, DebugOutputsInfection.InfectionLuck il) { return(d.CompProps <HediffCompProperties_Immunizable>().immunityPerDaySick *this.ilc(il)); }
private static float <Infections> m__6(HediffDef d) { return(d.CompProps <HediffCompProperties_Immunizable>().severityPerDayNotImmune); }
public override IEnumerable <StatDrawEntry> SpecialDisplayStats() { if (this.apparel != null) { string coveredParts = this.apparel.GetCoveredOuterPartsString(BodyDefOf.Human); yield return(new StatDrawEntry(StatCategoryDefOf.Apparel, "Covers".Translate(), coveredParts, 100, string.Empty)); } if (this.IsMedicine && this.MedicineTendXpGainFactor != 1f) { yield return(new StatDrawEntry(StatCategoryDefOf.Basics, "MedicineXpGainFactor".Translate(), this.MedicineTendXpGainFactor.ToStringPercent(), 0, string.Empty)); } if (this.fillPercent > 0f && this.fillPercent < 1f && (this.category == ThingCategory.Item || this.category == ThingCategory.Building || this.category == ThingCategory.Plant)) { yield return(new StatDrawEntry(StatCategoryDefOf.Basics, "CoverEffectiveness".Translate(), this.BaseBlockChance().ToStringPercent(), 0, string.Empty) { overrideReportText = "CoverEffectivenessExplanation".Translate() }); } if (this.constructionSkillPrerequisite > 0) { StatCategoryDef basics = StatCategoryDefOf.Basics; string label = "ConstructionSkillRequired".Translate(); string valueString = this.constructionSkillPrerequisite.ToString(); string overrideReportText = "ConstructionSkillRequiredExplanation".Translate(); yield return(new StatDrawEntry(basics, label, valueString, 0, overrideReportText)); } if (!this.verbs.NullOrEmpty <VerbProperties>()) { VerbProperties verb = (from x in this.verbs where x.isPrimary select x).First <VerbProperties>(); StatCategoryDef verbStatCategory = (this.category != ThingCategory.Pawn) ? (verbStatCategory = StatCategoryDefOf.Weapon) : (verbStatCategory = StatCategoryDefOf.PawnCombat); float warmup = verb.warmupTime; if (warmup > 0f) { string warmupLabel = (this.category != ThingCategory.Pawn) ? "WarmupTime".Translate() : "MeleeWarmupTime".Translate(); yield return(new StatDrawEntry(verbStatCategory, warmupLabel, warmup.ToString("0.##") + " s", 40, string.Empty)); } if (verb.defaultProjectile != null) { float dam = (float)verb.defaultProjectile.projectile.damageAmountBase; yield return(new StatDrawEntry(verbStatCategory, "Damage".Translate(), dam.ToString(), 50, string.Empty)); } if (verb.LaunchesProjectile) { int burstShotCount = verb.burstShotCount; float burstShotFireRate = 60f / verb.ticksBetweenBurstShots.TicksToSeconds(); float range = verb.range; if (burstShotCount > 1) { yield return(new StatDrawEntry(verbStatCategory, "BurstShotCount".Translate(), burstShotCount.ToString(), 20, string.Empty)); yield return(new StatDrawEntry(verbStatCategory, "BurstShotFireRate".Translate(), burstShotFireRate.ToString("0.##") + " rpm", 19, string.Empty)); } yield return(new StatDrawEntry(verbStatCategory, "Range".Translate(), range.ToString("0.##"), 10, string.Empty)); } } if (this.plant != null) { foreach (StatDrawEntry s in this.plant.SpecialDisplayStats()) { yield return(s); } } if (this.ingestible != null) { foreach (StatDrawEntry s2 in this.ingestible.SpecialDisplayStats(this)) { yield return(s2); } } if (this.race != null) { foreach (StatDrawEntry s3 in this.race.SpecialDisplayStats(this)) { yield return(s3); } } if (this.isBodyPartOrImplant) { foreach (RecipeDef def in from x in DefDatabase <RecipeDef> .AllDefs where x.IsIngredient(this.$this) select x) { HediffDef diff = def.addsHediff; if (diff != null) { if (diff.addedPartProps != null) { yield return(new StatDrawEntry(StatCategoryDefOf.Basics, "BodyPartEfficiency".Translate(), diff.addedPartProps.partEfficiency.ToStringByStyle(ToStringStyle.PercentZero, ToStringNumberSense.Absolute), 0, string.Empty)); } foreach (StatDrawEntry s4 in diff.SpecialDisplayStats()) { yield return(s4); } HediffCompProperties_VerbGiver vg = diff.CompProps <HediffCompProperties_VerbGiver>(); if (vg != null) { if (!vg.verbs.NullOrEmpty <VerbProperties>()) { VerbProperties verb2 = vg.verbs[0]; if (!verb2.MeleeRange) { if (verb2.defaultProjectile != null) { int projDamage = verb2.defaultProjectile.projectile.damageAmountBase; yield return(new StatDrawEntry(StatCategoryDefOf.Basics, "Damage".Translate(), projDamage.ToString(), 0, string.Empty)); } } else { int meleeDamage = verb2.meleeDamageBaseAmount; yield return(new StatDrawEntry(StatCategoryDefOf.Weapon, "Damage".Translate(), meleeDamage.ToString(), 0, string.Empty)); } } else if (!vg.tools.NullOrEmpty <Tool>()) { Tool tool = vg.tools[0]; yield return(new StatDrawEntry(StatCategoryDefOf.Weapon, "Damage".Translate(), tool.power.ToString(), 0, string.Empty)); } } ThoughtDef thought = DefDatabase <ThoughtDef> .AllDefs.FirstOrDefault((ThoughtDef x) => x.hediff == diff); if (thought != null && thought.stages != null && thought.stages.Any <ThoughtStage>()) { yield return(new StatDrawEntry(StatCategoryDefOf.Basics, "MoodChange".Translate(), thought.stages.First <ThoughtStage>().baseMoodEffect.ToStringByStyle(ToStringStyle.Integer, ToStringNumberSense.Offset), 0, string.Empty)); } } } } for (int i = 0; i < this.comps.Count; i++) { foreach (StatDrawEntry s5 in this.comps[i].SpecialDisplayStats()) { yield return(s5); } } }
static float baseSeverityIncrease(HediffDef d) { return(d.CompProps <HediffCompProperties_Immunizable>().severityPerDayNotImmune); }