Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Spatison committed Sep 23, 2024
1 parent 4272976 commit dcfd816
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Content.Server/_White/Melee/Crit/CritComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ namespace Content.Server._White.Melee.Crit;
[RegisterComponent]
public sealed partial class CritComponent : Component
{
[DataField, ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float CritChance = 0.2f;

[DataField, ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float CritMultiplier = 2f;

public float? RealChance;
Expand Down
7 changes: 2 additions & 5 deletions Content.Server/_White/Melee/Crit/CritSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ public override void Initialize()

private void HandleHit(EntityUid uid, CritComponent component, MeleeHitEvent args)
{
if (args.HitEntities.Count == 0
|| !IsCriticalHit(component))
{
if (args.HitEntities.Count == 0 || !IsCriticalHit(component))
return;
}

var damage = args.BaseDamage.GetTotal() * component.CritMultiplier;

Expand All @@ -46,7 +43,7 @@ private bool IsCriticalHit(CritComponent component)
if (isCritical)
component.RealChance = component.CritChance;
else
component.RealChance++;
component.RealChance += component.CritChance;

return isCritical;
}
Expand Down

0 comments on commit dcfd816

Please sign in to comment.