From 155a97e668910888e83bfc0f6e2e454a68ae05eb Mon Sep 17 00:00:00 2001 From: OBilo <54061981+Keshash@users.noreply.github.com> Date: Thu, 30 Jul 2026 23:29:12 +0300 Subject: [PATCH 1/3] Add concealment stat --- Defs/Stats/Stats_Concealment.xml | 84 +++++++++++++++++++ Languages/English/Keyed/Keys.xml | 1 + .../CombatExtended/DefOfs/CE_StatDefOf.cs | 1 + .../CombatExtended/ShiftVecReport.cs | 19 ++++- 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 Defs/Stats/Stats_Concealment.xml diff --git a/Defs/Stats/Stats_Concealment.xml b/Defs/Stats/Stats_Concealment.xml new file mode 100644 index 0000000000..7a7f0235bd --- /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 error against them based on apparel, implants, and their natural abilities. + PawnCombat + 1 + 70 + PercentZero + true + 0 + 10.0 + +
  • + ConcealmentEfficiency_Apparel + false + ConcealmentEfficiency_Weapon + true + ConcealmentEfficiency_Implant + 1000 +
  • +
    +
    + + + + + 0 + 10.0 + 1 + 1 + PercentZero + false + + + + + + ConcealmentEfficiency_Implant + + The effect of artifical implants on a creature's ability to conceal themselves and blend into surroundings, increasing visibility error against them. + PawnCombat + + + + + + +
  • + 0.70 + 0.85 + 1 + 1.05 + 1.1 + 1.15 + 1.25 +
  • +
    +
    + + + + + ConcealmentEfficiency_Weapon + + The effect of a weapon's camouflage on the wielder's ability to conceal themselves and blend into surroundings, increasing visibility error against them. + Weapon + +
  • + + + + + ConcealmentEfficiency_Apparel + + The effect of apparel items on a creature's ability to conceal themselves and blend into surroundings, increasing visibility error against them. + Apparel + + + \ 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..6f6fa50dc4 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 @@ -275,6 +288,10 @@ public string GetTextReadout() { stringBuilder.AppendLine(" " + "CE_SmokeDensity".Translate() + "\t" + AsPercent(smokeDensity)); } + if (visibilityShift > 0 && !Mathf.Approximately(concealmentFactor, 1f)) + { + stringBuilder.AppendLine(" " + "CE_Concealment".Translate() + "\t" + AsPercent(concealmentFactor)); + } if (leadShift > 0) { stringBuilder.AppendLine(" " + "CE_LeadError".Translate() + "\t" + GenText.ToStringByStyle(leadShift, ToStringStyle.FloatTwo) + " " + "CE_cells".Translate()); From d86c6c5d3b3f8db5a00f4236c4a270af31f22ebe Mon Sep 17 00:00:00 2001 From: OBilo <54061981+Keshash@users.noreply.github.com> Date: Fri, 28 Aug 2026 23:08:34 +0300 Subject: [PATCH 2/3] Simplify concealment stats, add stuffing impact on concealment --- Defs/Stats/Stats_Concealment.xml | 82 ++++++++++++++++---------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/Defs/Stats/Stats_Concealment.xml b/Defs/Stats/Stats_Concealment.xml index 7a7f0235bd..c3c11114fd 100644 --- a/Defs/Stats/Stats_Concealment.xml +++ b/Defs/Stats/Stats_Concealment.xml @@ -15,40 +15,29 @@ 0 10.0 -
  • - ConcealmentEfficiency_Apparel - false - ConcealmentEfficiency_Weapon - true - ConcealmentEfficiency_Implant - 1000 +
  • + 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 error against them. + Apparel 0 10.0 - 1 - 1 + 0 + 0 PercentZero false - - - - - - ConcealmentEfficiency_Implant - - The effect of artifical implants on a creature's ability to conceal themselves and blend into surroundings, increasing visibility error against them. - PawnCombat - - - - -
  • 0.70 @@ -59,26 +48,37 @@ 1.15 1.25
  • +
  • + 100 + StuffPower_ConcealmentEfficiency + StuffEffectMultiplierConcealment +
  • - - - - ConcealmentEfficiency_Weapon - - The effect of a weapon's camouflage on the wielder's ability to conceal themselves and blend into surroundings, increasing visibility error against them. - Weapon - -
  • - + + + 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 - - ConcealmentEfficiency_Apparel - - The effect of apparel items on a creature's ability to conceal themselves and blend into surroundings, increasing visibility error against them. + + + StuffEffectMultiplierConcealment + Apparel - + 1 + 0 + true + 1 + \ No newline at end of file From e9afdefaeae8a8ca00eb46ca8dda8721adab5a56 Mon Sep 17 00:00:00 2001 From: OBilo <54061981+Keshash@users.noreply.github.com> Date: Fri, 28 Aug 2026 23:28:21 +0300 Subject: [PATCH 3/3] Make concealment affect range errors --- Defs/Stats/Stats_Concealment.xml | 4 ++-- Source/CombatExtended/CombatExtended/ShiftVecReport.cs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Defs/Stats/Stats_Concealment.xml b/Defs/Stats/Stats_Concealment.xml index c3c11114fd..3597b8b487 100644 --- a/Defs/Stats/Stats_Concealment.xml +++ b/Defs/Stats/Stats_Concealment.xml @@ -6,7 +6,7 @@ ConcealmentEfficiency - A measure of the creature's overall ability to conceal themselves and blend into surroundings, increasing visibility error against them based on apparel, implants, and their natural abilities. + 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 @@ -30,7 +30,7 @@ ConcealmentEfficiency_Apparel - The effect of apparel items on a creature's ability to conceal themselves and blend into surroundings, increasing visibility error against them. + 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 diff --git a/Source/CombatExtended/CombatExtended/ShiftVecReport.cs b/Source/CombatExtended/CombatExtended/ShiftVecReport.cs index 6f6fa50dc4..724df15ab3 100755 --- a/Source/CombatExtended/CombatExtended/ShiftVecReport.cs +++ b/Source/CombatExtended/CombatExtended/ShiftVecReport.cs @@ -182,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; } } @@ -288,10 +288,6 @@ public string GetTextReadout() { stringBuilder.AppendLine(" " + "CE_SmokeDensity".Translate() + "\t" + AsPercent(smokeDensity)); } - if (visibilityShift > 0 && !Mathf.Approximately(concealmentFactor, 1f)) - { - stringBuilder.AppendLine(" " + "CE_Concealment".Translate() + "\t" + AsPercent(concealmentFactor)); - } if (leadShift > 0) { stringBuilder.AppendLine(" " + "CE_LeadError".Translate() + "\t" + GenText.ToStringByStyle(leadShift, ToStringStyle.FloatTwo) + " " + "CE_cells".Translate()); @@ -300,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());