Skip to content

Commit

Permalink
fix: Fixes NPE with stun attack (#1751)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamronbatman committed May 1, 2024
1 parent 347ac28 commit db0621b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Projects/UOContent/Mobiles/Abilities/StunAttack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Server.Mobiles;
public abstract class StunAttack : MonsterAbility
{
// Prevents infinite loop
private HashSet<BaseCreature> _stunning;
private static readonly HashSet<BaseCreature> _stunning = [];

public override MonsterAbilityTrigger AbilityTrigger => MonsterAbilityTrigger.GiveMeleeDamage;
public override MonsterAbilityType AbilityType => MonsterAbilityType.Stun;
Expand All @@ -21,7 +21,6 @@ public override void Trigger(MonsterAbilityTrigger trigger, BaseCreature source,
{
if (source.Weapon is BaseWeapon weapon)
{
_stunning ??= new HashSet<BaseCreature>();
_stunning.Add(source);
weapon.OnHit(source, target);
_stunning.Remove(source);
Expand Down

0 comments on commit db0621b

Please sign in to comment.