fix cauterization (#23264)

* fix cauterization

* remove if statement

* revert DamageTest change

* fix
This commit is contained in:
themias
2024-01-01 03:08:25 -05:00
committed by GitHub
parent 2ac40560dd
commit 9115994abf
3 changed files with 7 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
using Content.Shared.Damage.Prototypes;
using Content.Shared.Damage.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
@@ -12,7 +12,6 @@ namespace Content.Shared.Damage
/// </summary>
/// <remarks>
/// The modifier will only ever be applied to damage that is being dealt. Healing is unmodified.
/// The modifier can also never convert damage into healing.
/// </remarks>
[DataDefinition]
[Serializable, NetSerializable]

View File

@@ -151,12 +151,12 @@ namespace Content.Shared.Damage
float newValue = value.Float();
if (modifierSet.FlatReduction.TryGetValue(key, out var reduction))
newValue -= reduction;
newValue = Math.Max(0f, newValue - reduction); // flat reductions can't heal you
if (modifierSet.Coefficients.TryGetValue(key, out var coefficient))
newValue *= coefficient;
newValue *= coefficient; // coefficients can heal you, e.g. cauterizing bleeding
if (newValue > 0)
if(newValue != 0)
newDamage.DamageDict[key] = FixedPoint2.New(newValue);
}