From a9712556fcc9eb4058d0315380fa05323750c512 Mon Sep 17 00:00:00 2001 From: Tostov <57082718+Tostov@users.noreply.github.com> Date: Sat, 7 Sep 2024 15:59:59 +1000 Subject: [PATCH] Heat Damage testing --- .../CombatExtended/CombatExtended/ArmorUtilityCE.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Source/CombatExtended/CombatExtended/ArmorUtilityCE.cs b/Source/CombatExtended/CombatExtended/ArmorUtilityCE.cs index f6cafbdf4b..3faa747fe2 100644 --- a/Source/CombatExtended/CombatExtended/ArmorUtilityCE.cs +++ b/Source/CombatExtended/CombatExtended/ArmorUtilityCE.cs @@ -58,13 +58,14 @@ public static DamageInfo GetAfterArmorDamage(DamageInfo originalDinfo, Pawn pawn var dinfo = new DamageInfo(originalDinfo); var dmgAmount = dinfo.Amount; + var penAmount = originalDinfo.ArmorPenetrationInt; //GetPenetrationValue(originalDinfo); var involveArmor = dinfo.Def.harmAllLayersUntilOutside || hitPart.depth == BodyPartDepth.Outside; bool isAmbientDamage = dinfo.IsAmbientDamage(); // In case of ambient damage (fire, electricity) we apply a percentage reduction formula based on the sum of all applicable armor if (isAmbientDamage) { - dinfo.SetAmount(Mathf.CeilToInt(GetAmbientPostArmorDamage(dmgAmount, originalDinfo.Def.armorCategory.armorRatingStat, pawn, hitPart))); + dinfo.SetAmount(Mathf.CeilToInt(GetAmbientPostArmorDamage(dmgAmount, penAmount, originalDinfo.Def.armorCategory.armorRatingStat, pawn, hitPart))); armorDeflected = dinfo.Amount <= 0; return dinfo; } @@ -73,7 +74,6 @@ public static DamageInfo GetAfterArmorDamage(DamageInfo originalDinfo, Pawn pawn deflectionComp.deflectedSharp = false; } - var penAmount = originalDinfo.ArmorPenetrationInt; //GetPenetrationValue(originalDinfo); // Apply worn armor if (involveArmor && pawn.apparel != null && !pawn.apparel.WornApparel.NullOrEmpty()) @@ -419,9 +419,9 @@ private static bool TryDamageArmor(DamageDef def, float penAmount, float armorAm /// The damaged pawn /// The body part affected /// The post-armor damage ranging from 0 to the original amount - private static float GetAmbientPostArmorDamage(float dmgAmount, StatDef armorRatingStat, Pawn pawn, BodyPartRecord part) + private static float GetAmbientPostArmorDamage(float dmgAmount,float penAmount, StatDef armorRatingStat, Pawn pawn, BodyPartRecord part) { - var dmgMult = 1f; + var dmgMult = 1f + penAmount; if (part.IsInGroup(CE_BodyPartGroupDefOf.CoveredByNaturalArmor)) { dmgMult -= pawn.GetStatValue(armorRatingStat); @@ -447,7 +447,10 @@ private static float GetAmbientPostArmorDamage(float dmgAmount, StatDef armorRat } } } - + if (dmgMult > 1) + { + dmgMult = 1; + } var deflectionComp = pawn.TryGetComp(); if (deflectionComp != null) {