From c29840e7450dbb448f616996df7b698964ed2244 Mon Sep 17 00:00:00 2001 From: Nameless <85962933+Misfiy@users.noreply.github.com> Date: Thu, 4 Jul 2024 05:03:35 +0200 Subject: [PATCH] [API] Fix issues (#2673) * Fix * revert --- .../Features/CustomStats/CustomHumeShieldStat.cs | 14 +++++--------- .../Features/DamageHandlers/CustomDamageHandler.cs | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs b/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs index 57e85880cd..14a51674dc 100644 --- a/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs +++ b/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs @@ -18,8 +18,10 @@ namespace Exiled.API.Features.CustomStats /// public class CustomHumeShieldStat : HumeShieldStat { + private const float DefaultCustomValue = -1; + /// - public override float MaxValue => CustomMaxValue == default ? base.MaxValue : CustomMaxValue; + public override float MaxValue => CustomMaxValue == DefaultCustomValue ? base.MaxValue : CustomMaxValue; /// /// Gets or sets the multiplier for gaining HumeShield. @@ -29,14 +31,14 @@ public class CustomHumeShieldStat : HumeShieldStat /// /// Gets or sets the maximum amount of HumeShield the player can have. /// - public float CustomMaxValue { get; set; } + public float CustomMaxValue { get; set; } = DefaultCustomValue; private float ShieldRegeneration => TryGetHsModule(out HumeShieldModuleBase controller) ? controller.HsRegeneration * ShieldRegenerationMultiplier : 0; /// public override void Update() { - if (MaxValue == default) + if (MaxValue == DefaultCustomValue) { base.Update(); return; @@ -66,13 +68,7 @@ public override void Update() if (CurValue >= MaxValue) return; CurValue = Mathf.MoveTowards(CurValue, MaxValue, delta); - return; } - - if (CurValue <= 0) - return; - - CurValue += delta; } } } \ No newline at end of file diff --git a/Exiled.API/Features/DamageHandlers/CustomDamageHandler.cs b/Exiled.API/Features/DamageHandlers/CustomDamageHandler.cs index ceb57d406d..c72d482293 100644 --- a/Exiled.API/Features/DamageHandlers/CustomDamageHandler.cs +++ b/Exiled.API/Features/DamageHandlers/CustomDamageHandler.cs @@ -56,7 +56,7 @@ public CustomDamageHandler(Player target, BaseHandler baseHandler) else if (Attacker.CurrentItem is not null && Attacker.CurrentItem.Type.IsWeapon() && baseHandler is BaseFirearmHandler) CustomBase = new FirearmDamageHandler(Attacker.CurrentItem, target, baseHandler); else - CustomBase = new DamageHandler(target, Attacker); + CustomBase = new DamageHandler(target, baseHandler); } else {