Skip to content

Commit

Permalink
[API] Fix issues (#2673)
Browse files Browse the repository at this point in the history
* Fix

* revert
  • Loading branch information
Misfiy committed Jul 4, 2024
1 parent 2906020 commit c29840e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ namespace Exiled.API.Features.CustomStats
/// </summary>
public class CustomHumeShieldStat : HumeShieldStat
{
private const float DefaultCustomValue = -1;

/// <inheritdoc/>
public override float MaxValue => CustomMaxValue == default ? base.MaxValue : CustomMaxValue;
public override float MaxValue => CustomMaxValue == DefaultCustomValue ? base.MaxValue : CustomMaxValue;

/// <summary>
/// Gets or sets the multiplier for gaining HumeShield.
Expand All @@ -29,14 +31,14 @@ public class CustomHumeShieldStat : HumeShieldStat
/// <summary>
/// Gets or sets the maximum amount of HumeShield the player can have.
/// </summary>
public float CustomMaxValue { get; set; }
public float CustomMaxValue { get; set; } = DefaultCustomValue;

private float ShieldRegeneration => TryGetHsModule(out HumeShieldModuleBase controller) ? controller.HsRegeneration * ShieldRegenerationMultiplier : 0;

/// <inheritdoc/>
public override void Update()
{
if (MaxValue == default)
if (MaxValue == DefaultCustomValue)
{
base.Update();
return;
Expand Down Expand Up @@ -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;
}
}
}
2 changes: 1 addition & 1 deletion Exiled.API/Features/DamageHandlers/CustomDamageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit c29840e

Please sign in to comment.