public override string GetExplanationUnfinalized(StatRequest req, ToStringNumberSense numberSense) { ThingDef thingDef = req.Def as ThingDef; if (thingDef == null) { return(null); } Pawn currentWeaponUser = StatWorker_MeleeAverageDPS.GetCurrentWeaponUser(req.Thing); IEnumerable <VerbUtility.VerbPropertiesWithSource> enumerable = from x in VerbUtility.GetAllVerbProperties(thingDef.Verbs, thingDef.tools) where x.verbProps.IsMeleeAttack select x; StringBuilder stringBuilder = new StringBuilder(); foreach (VerbUtility.VerbPropertiesWithSource current in enumerable) { float num = current.verbProps.AdjustedMeleeDamageAmount(current.tool, currentWeaponUser, req.Thing, null); float num2 = current.verbProps.AdjustedCooldown(current.tool, currentWeaponUser, req.Thing); if (current.tool != null) { stringBuilder.AppendLine(string.Format(" {0}: {1} ({2})", "Tool".Translate(), current.tool.LabelCap, current.ToolCapacity.defName)); } else { stringBuilder.AppendLine(string.Format(" {0}:", "StatsReport_NonToolAttack".Translate())); } stringBuilder.AppendLine(string.Format(" {0} {1}", num.ToString("F1"), "DamageLower".Translate())); stringBuilder.AppendLine(string.Format(" {0} {1}", num2.ToString("F2"), "SecondsPerAttackLower".Translate())); stringBuilder.AppendLine(); } return(stringBuilder.ToString()); }
public override float GetValueUnfinalized(StatRequest req, bool applyPostProcess = true) { ThingDef thingDef = req.Def as ThingDef; if (thingDef == null) { return(0f); } List <VerbProperties> verbProps; List <Tool> tools; this.GetVerbsAndTools(thingDef, out verbProps, out tools); Pawn attacker = StatWorker_MeleeAverageDPS.GetCurrentWeaponUser(req.Thing); float num = (from x in VerbUtility.GetAllVerbProperties(verbProps, tools) where x.verbProps.IsMeleeAttack select x).AverageWeighted((VerbUtility.VerbPropertiesWithSource x) => x.verbProps.AdjustedMeleeSelectionWeight(x.tool, attacker, req.Thing, null, false), (VerbUtility.VerbPropertiesWithSource x) => x.verbProps.AdjustedMeleeDamageAmount(x.tool, attacker, req.Thing, null)); float num2 = (from x in VerbUtility.GetAllVerbProperties(verbProps, tools) where x.verbProps.IsMeleeAttack select x).AverageWeighted((VerbUtility.VerbPropertiesWithSource x) => x.verbProps.AdjustedMeleeSelectionWeight(x.tool, attacker, req.Thing, null, false), (VerbUtility.VerbPropertiesWithSource x) => x.verbProps.AdjustedCooldown(x.tool, attacker, req.Thing)); if (num2 == 0f) { return(0f); } return(num / num2); }
public override string GetExplanationUnfinalized(StatRequest req, ToStringNumberSense numberSense) { ThingDef thingDef = req.Def as ThingDef; if (thingDef == null) { return(null); } Pawn currentWeaponUser = StatWorker_MeleeAverageDPS.GetCurrentWeaponUser(req.Thing); IEnumerable <VerbUtility.VerbPropertiesWithSource> enumerable = from x in VerbUtility.GetAllVerbProperties(thingDef.Verbs, thingDef.tools) where x.verbProps.IsMeleeAttack select x; StringBuilder stringBuilder = new StringBuilder(); foreach (VerbUtility.VerbPropertiesWithSource item in enumerable) { float f = item.verbProps.AdjustedArmorPenetration(item.tool, currentWeaponUser, req.Thing, null); if (item.tool != null) { stringBuilder.AppendLine($" {item.tool.LabelCap} ({item.ToolCapacity.label})"); } else { stringBuilder.AppendLine(string.Format(" {0}:", "StatsReport_NonToolAttack".Translate())); } stringBuilder.AppendLine(" " + f.ToStringPercent()); } return(stringBuilder.ToString()); }
public override float GetValueUnfinalized(StatRequest req, bool applyPostProcess = true) { ThingDef thingDef = req.Def as ThingDef; if (thingDef == null) { return(0f); } Pawn attacker = StatWorker_MeleeAverageDPS.GetCurrentWeaponUser(req.Thing); return((from x in VerbUtility.GetAllVerbProperties(thingDef.Verbs, thingDef.tools) where x.verbProps.IsMeleeAttack select x).AverageWeighted((VerbUtility.VerbPropertiesWithSource x) => x.verbProps.AdjustedMeleeSelectionWeight(x.tool, attacker, req.Thing, null, false), (VerbUtility.VerbPropertiesWithSource x) => x.verbProps.AdjustedArmorPenetration(x.tool, attacker, req.Thing, null))); }