diff --git a/Defs/Stats/Stats_Concealment.xml b/Defs/Stats/Stats_Concealment.xml new file mode 100644 index 0000000000..3597b8b487 --- /dev/null +++ b/Defs/Stats/Stats_Concealment.xml @@ -0,0 +1,84 @@ + + + + + + + ConcealmentEfficiency + + A measure of the creature's overall ability to conceal themselves and blend into surroundings, increasing visibility and range errors against them based on apparel, implants, and their natural abilities. + PawnCombat + 1 + 70 + PercentZero + true + 0 + 10.0 + +
  • + 100 + StuffPower_ConcealmentEfficiency + StuffEffectMultiplierConcealment +
  • +
  • + ConcealmentEfficiency_Apparel +
  • +
    +
    + + + + ConcealmentEfficiency_Apparel + + The effect of apparel items on a creature's ability to conceal themselves and blend into surroundings, increasing visibility and range errors against them. + Apparel + 0 + 10.0 + 0 + 0 + PercentZero + false + +
  • + 0.70 + 0.85 + 1 + 1.05 + 1.1 + 1.15 + 1.25 +
  • +
  • + 100 + StuffPower_ConcealmentEfficiency + StuffEffectMultiplierConcealment +
  • +
    +
    + + + + StuffPower_ConcealmentEfficiency + + How much an apparel made of this material improves a wearer's ability to conceal themselves and blend into surroundings. + StuffStatFactors + 0 + 1 + 0 + PercentZero + false + 79 + + + + + StuffEffectMultiplierConcealment + + Apparel + 1 + 0 + true + 1 + + +
    \ No newline at end of file diff --git a/Languages/English/Keyed/Keys.xml b/Languages/English/Keyed/Keys.xml index 94095594c6..30b062581b 100644 --- a/Languages/English/Keyed/Keys.xml +++ b/Languages/English/Keyed/Keys.xml @@ -44,6 +44,7 @@ Cover height Target height Target width + Concealment Estimated hit chance diff --git a/Source/CombatExtended/CombatExtended/DefOfs/CE_StatDefOf.cs b/Source/CombatExtended/CombatExtended/DefOfs/CE_StatDefOf.cs index 0c81d97794..3ab3a2aa06 100755 --- a/Source/CombatExtended/CombatExtended/DefOfs/CE_StatDefOf.cs +++ b/Source/CombatExtended/CombatExtended/DefOfs/CE_StatDefOf.cs @@ -50,6 +50,7 @@ static CE_StatDefOf() public static StatDef BodyPartBluntArmor; public static StatDef AverageSharpArmor; public static StatDef NightVisionEfficiency; + public static StatDef ConcealmentEfficiency; public static StatDef SmokeSensitivity; diff --git a/Source/CombatExtended/CombatExtended/ShiftVecReport.cs b/Source/CombatExtended/CombatExtended/ShiftVecReport.cs index e55f505b88..724df15ab3 100755 --- a/Source/CombatExtended/CombatExtended/ShiftVecReport.cs +++ b/Source/CombatExtended/CombatExtended/ShiftVecReport.cs @@ -113,12 +113,25 @@ public float visibilityShift { se = 0.02f; } - visibilityShiftInt = environmentShift * (shotDist / 50 / se) * (2 - aimingAccuracy); + visibilityShiftInt = environmentShift * (shotDist / 50 / se) * (2 - aimingAccuracy) * concealmentFactor; } return visibilityShiftInt; } } + public float concealmentFactor + { + get + { + if (targetPawn != null) + { + return targetPawn.GetStatValue(CE_StatDefOf.ConcealmentEfficiency); + } + + return 1f; + } + } + // Leading variables public float shotSpeed = 0f; private bool targetIsMoving @@ -169,7 +182,7 @@ public float distShift { get { - return shotDist * (shotDist / Math.Max(maxRange, 20)) * Mathf.Min(accuracyFactor * 0.5f, 0.8f); + return shotDist * (shotDist / Math.Max(maxRange, 20)) * Mathf.Min(accuracyFactor * 0.5f, 0.8f) * concealmentFactor; } } @@ -283,6 +296,10 @@ public string GetTextReadout() { stringBuilder.AppendLine(" " + "CE_RangeError".Translate() + "\t" + GenText.ToStringByStyle(distShift, ToStringStyle.FloatTwo) + " " + "CE_cells".Translate()); } + if ((visibilityShift > 0 || distShift > 0) && !Mathf.Approximately(concealmentFactor, 1f)) + { + stringBuilder.AppendLine(" " + "CE_Concealment".Translate() + "\t" + AsPercent(concealmentFactor)); + } if (swayDegrees > 0) { stringBuilder.AppendLine(" " + "CE_Sway".Translate() + "\t\t" + GenText.ToStringByStyle(swayDegrees, ToStringStyle.FloatTwo) + "CE_degrees".Translate());