private static bool <Infections> m__4(HediffDef d) { return(d.defName.Contains("Animal")); }
public bool ImmunityRecordExists(HediffDef def) { return(this.GetImmunityRecord(def) != null); }
private static bool <InfectionList> m__1(HediffDef hediff) { return(hediff.tendable && hediff.HasComp(typeof(HediffComp_TendDuration)) && hediff.HasComp(typeof(HediffComp_Immunizable)) && hediff.lethalSeverity > 0f); }
internal string <> m__5(HediffDef d) { return(this.stringizeWithLuck((DebugOutputsInfection.InfectionLuck il) => this.baseImmunityIncrease(d, il))); }
static bool isAnimal(HediffDef d) { return(d.defName.Contains("Animal")); }
private static string <Infections> m__7(HediffDef d) { return(d.lethalSeverity.ToString("F2")); }
internal float <> m__1(HediffDef d, float tend) { return(this.baseSeverityIncrease(d) + d.CompProps <HediffCompProperties_TendDuration>().severityPerDayTended *tend); }
private bool AnyHediffMakesFullyImmuneTo(HediffDef def) { Hediff sourceHediff; return(AnyHediffMakesFullyImmuneTo_NewTemp(def, out sourceHediff)); }
public float DiseaseContractChanceFactor(HediffDef diseaseDef, BodyPartRecord part = null) { HediffDef immunityCause = null; return(DiseaseContractChanceFactor(diseaseDef, out immunityCause, part)); }
private IEnumerable <string> < ConfigErrors > __BaseCallProxy0(HediffDef parentDef) { return(base.ConfigErrors(parentDef)); }
public BattleLogEntry_MeleeCombat(RulePackDef ruleDef, bool alwaysShowInCompact, Pawn initiator, Thing recipient, ImplementOwnerTypeDef implementType, string toolLabel, ThingDef ownerEquipmentDef = null, HediffDef ownerHediffDef = null, LogEntryDef def = null) : base(def) { this.ruleDef = ruleDef; this.alwaysShowInCompact = alwaysShowInCompact; this.initiator = initiator; this.implementType = implementType; this.ownerEquipmentDef = ownerEquipmentDef; this.ownerHediffDef = ownerHediffDef; this.toolLabel = toolLabel; if (recipient is Pawn) { this.recipientPawn = (recipient as Pawn); } else if (recipient != null) { this.recipientThing = recipient.def; } if (ownerEquipmentDef != null && ownerHediffDef != null) { Log.ErrorOnce(string.Format("Combat log owned by both equipment {0} and hediff {1}, may produce unexpected results", ownerEquipmentDef.label, ownerHediffDef.label), 96474669, false); } }
public float DiseaseContractChanceFactor(HediffDef diseaseDef, BodyPartRecord part = null) { HediffDef hediffDef = null; return(this.DiseaseContractChanceFactor(diseaseDef, out hediffDef, part)); }
private static void DoTablesInternalMelee(ThingDef stuff, bool doRaces = false) { Func <Def, float> meleeDamageGetter = delegate(Def d) { List <Verb> concreteExampleVerbs5 = VerbUtility.GetConcreteExampleVerbs(d, stuff); if (concreteExampleVerbs5.OfType <Verb_MeleeAttack>().Any()) { return(concreteExampleVerbs5.OfType <Verb_MeleeAttack>().AverageWeighted((Verb_MeleeAttack v) => v.verbProps.AdjustedMeleeSelectionWeight(v, null), (Verb_MeleeAttack v) => v.verbProps.AdjustedMeleeDamageAmount(v, null))); } return(-1f); }; Func <Def, float> rangedDamageGetter = delegate(Def d) { List <Verb> concreteExampleVerbs4 = VerbUtility.GetConcreteExampleVerbs(d, stuff); Verb_LaunchProjectile verb_LaunchProjectile = concreteExampleVerbs4.OfType <Verb_LaunchProjectile>().FirstOrDefault(); if (verb_LaunchProjectile != null && verb_LaunchProjectile.GetProjectile() != null) { return((float)verb_LaunchProjectile.GetProjectile().projectile.GetDamageAmount(null)); } return(-1f); }; Func <Def, float> rangedWarmupGetter = delegate(Def d) { List <Verb> concreteExampleVerbs3 = VerbUtility.GetConcreteExampleVerbs(d, stuff); return(concreteExampleVerbs3.OfType <Verb_LaunchProjectile>().FirstOrDefault()?.verbProps.warmupTime ?? (-1f)); }; Func <Def, float> meleeCooldownGetter = delegate(Def d) { List <Verb> concreteExampleVerbs2 = VerbUtility.GetConcreteExampleVerbs(d, stuff); if (concreteExampleVerbs2.OfType <Verb_MeleeAttack>().Any()) { return(concreteExampleVerbs2.OfType <Verb_MeleeAttack>().AverageWeighted((Verb_MeleeAttack v) => v.verbProps.AdjustedMeleeSelectionWeight(v, null), (Verb_MeleeAttack v) => v.verbProps.AdjustedCooldown(v, null))); } return(-1f); }; Func <Def, float> rangedCooldownGetter = delegate(Def d) { List <Verb> concreteExampleVerbs = VerbUtility.GetConcreteExampleVerbs(d, stuff); return(concreteExampleVerbs.OfType <Verb_LaunchProjectile>().FirstOrDefault()?.verbProps.defaultCooldownTime ?? (-1f)); }; Func <Def, float> meleeDpsGetter = (Def d) => meleeDamageGetter(d) * 0.82f / meleeCooldownGetter(d); Func <Def, float> marketValueGetter = delegate(Def d) { ThingDef thingDef3 = d as ThingDef; if (thingDef3 != null) { return(thingDef3.GetStatValueAbstract(StatDefOf.MarketValue, stuff)); } HediffDef hediffDef = d as HediffDef; if (hediffDef != null) { if (hediffDef.spawnThingOnRemoved == null) { return(0f); } return(hediffDef.spawnThingOnRemoved.GetStatValueAbstract(StatDefOf.MarketValue)); } return(-1f); }; IEnumerable <Def> enumerable = (from d in DefDatabase <ThingDef> .AllDefs where d.IsWeapon select d).Cast <Def>().Concat((from h in DefDatabase <HediffDef> .AllDefs where h.CompProps <HediffCompProperties_VerbGiver>() != null select h).Cast <Def>()); if (doRaces) { enumerable = enumerable.Concat((from d in DefDatabase <ThingDef> .AllDefs where d.race != null select d).Cast <Def>()); } enumerable = from h in enumerable orderby meleeDpsGetter(h) descending select h; DebugTables.MakeTablesDialog(enumerable, new TableDataGetter <Def>("defName", (Def d) => d.defName), new TableDataGetter <Def>("melee\ndamage\naverage", (Def d) => meleeDamageGetter(d).ToString("F2")), new TableDataGetter <Def>("melee\ncooldown\naverage", (Def d) => meleeCooldownGetter(d).ToString("F2")), new TableDataGetter <Def>("melee\nDPS", (Def d) => meleeDpsGetter(d).ToString("F2")), new TableDataGetter <Def>("ranged\ndamage", (Def d) => rangedDamageGetter(d).ToString()), new TableDataGetter <Def>("ranged\nwarmup", (Def d) => rangedWarmupGetter(d).ToString("F2")), new TableDataGetter <Def>("ranged\ncooldown", (Def d) => rangedCooldownGetter(d).ToString("F2")), new TableDataGetter <Def>("market value", (Def d) => marketValueGetter(d).ToStringMoney()), new TableDataGetter <Def>("work to make", delegate(Def d) { ThingDef thingDef2 = d as ThingDef; if (thingDef2 == null) { return("-"); } return(thingDef2.GetStatValueAbstract(StatDefOf.WorkToMake, stuff).ToString("F0")); }), new TableDataGetter <Def>((stuff == null) ? "CanMake" : (stuff.defName + " CanMake"), delegate(Def d) { if (stuff == null) { return("n/a"); } ThingDef thingDef = d as ThingDef; if (thingDef == null) { return("-"); } return(stuff.stuffProps.CanMake(thingDef).ToStringCheckBlank()); }), new TableDataGetter <Def>("assumed\nmelee\nhit chance", (Def d) => 0.82f.ToStringPercent())); }
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); } } }
private static float <Infections> m__5(HediffDef d) { return(d.CompProps <HediffCompProperties_Immunizable>().severityPerDayNotImmune); }
private static string <Options_AddHediff> m__0(HediffDef d) { return(d.hediffClass.ToStringSafe <Type>()); }
private static string <Infections> m__6(HediffDef d) { return(d.defName + ((!d.stages.Any((HediffStage stage) => stage.capMods.Any((PawnCapacityModifier cap) => cap.capacity == PawnCapacityDefOf.BloodFiltration))) ? string.Empty : " (inaccurate)")); }
public void AddHediff(HediffDef def, BodyPartRecord part = null, DamageInfo?dinfo = null) { this.AddHediff(HediffMaker.MakeHediff(def, this.pawn, null), part, dinfo); }
internal float <> m__0(HediffDef d, DebugOutputsInfection.InfectionLuck il) { return(d.CompProps <HediffCompProperties_Immunizable>().immunityPerDaySick *this.ilc(il)); }
public BattleLogEntry_MeleeCombat(RulePackDef outcomeRuleDef, RulePackDef maneuverRuleDef, Pawn initiator, Thing recipient, ImplementOwnerTypeDef implementType, string toolLabel, ThingDef ownerEquipmentDef = null, HediffDef ownerHediffDef = null) { this.outcomeRuleDef = outcomeRuleDef; this.maneuverRuleDef = maneuverRuleDef; this.initiator = initiator; this.implementType = implementType; this.ownerEquipmentDef = ownerEquipmentDef; this.ownerHediffDef = ownerHediffDef; this.toolLabel = toolLabel; if (recipient is Pawn) { this.recipientPawn = (recipient as Pawn); } else if (recipient != null) { this.recipientThing = recipient.def; } if (ownerEquipmentDef != null && ownerHediffDef != null) { Log.ErrorOnce(string.Format("Combat log owned by both equipment {0} and hediff {1}, may produce unexpected results", ownerEquipmentDef.label, ownerHediffDef.label), 96474669); } }
internal string <> m__4(HediffDef d) { return(this.baseSeverityIncrease(d).ToString("F2")); }
public void SetWeaponHediff(HediffDef hd) { this.weaponHediffInt = hd; }
public static void DamageUntilDowned(Pawn p, bool allowBleedingWounds = true) { if (p.health.Downed) { return; } HediffSet hediffSet = p.health.hediffSet; p.health.forceIncap = true; IEnumerable <BodyPartRecord> source = from x in HealthUtility.HittablePartsViolence(hediffSet) where !p.health.hediffSet.hediffs.Any((Hediff y) => y.Part == x && y.CurStage != null && y.CurStage.partEfficiencyOffset < 0f) select x; int num = 0; while (num < 300 && !p.Downed && source.Any <BodyPartRecord>()) { num++; BodyPartRecord bodyPartRecord = source.RandomElementByWeight((BodyPartRecord x) => x.coverageAbs); int num2 = Mathf.RoundToInt(hediffSet.GetPartHealth(bodyPartRecord)) - 3; if (num2 >= 8) { DamageDef damageDef; if (bodyPartRecord.depth == BodyPartDepth.Outside) { if (!allowBleedingWounds && bodyPartRecord.def.bleedRate > 0f) { damageDef = DamageDefOf.Blunt; } else { damageDef = HealthUtility.RandomViolenceDamageType(); } } else { damageDef = DamageDefOf.Blunt; } int num3 = Rand.RangeInclusive(Mathf.RoundToInt((float)num2 * 0.65f), num2); HediffDef hediffDefFromDamage = HealthUtility.GetHediffDefFromDamage(damageDef, p, bodyPartRecord); if (!p.health.WouldDieAfterAddingHediff(hediffDefFromDamage, bodyPartRecord, (float)num3)) { DamageDef def = damageDef; float amount = (float)num3; float armorPenetration = 999f; BodyPartRecord hitPart = bodyPartRecord; DamageInfo dinfo = new DamageInfo(def, amount, armorPenetration, -1f, null, hitPart, null, DamageInfo.SourceCategory.ThingOrUnknown, null); dinfo.SetAllowDamagePropagation(false); p.TakeDamage(dinfo); } } } if (p.Dead) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(p + " died during GiveInjuriesToForceDowned"); for (int i = 0; i < p.health.hediffSet.hediffs.Count; i++) { stringBuilder.AppendLine(" -" + p.health.hediffSet.hediffs[i].ToString()); } Log.Error(stringBuilder.ToString(), false); } p.health.forceIncap = false; }
static float baseSeverityIncrease(HediffDef d) { return(d.CompProps <HediffCompProperties_Immunizable>().severityPerDayNotImmune); }