fix: Fixes stack overflow from death explosion (#1346)
This commit is contained in:
parent
95e55e994f
commit
42bcf3c95a
1 changed files with 10 additions and 2 deletions
|
|
@ -1,9 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Mobiles;
|
||||
|
||||
public class DeathExplosion : AreaEffectMonsterAbility
|
||||
{
|
||||
private static HashSet<Mobile> _exploding = new();
|
||||
|
||||
public override MonsterAbilityTrigger AbilityTrigger => MonsterAbilityTrigger.Death;
|
||||
public override MonsterAbilityType AbilityType => MonsterAbilityType.DeathExplosion;
|
||||
|
||||
|
|
@ -15,16 +18,21 @@ public class DeathExplosion : AreaEffectMonsterAbility
|
|||
|
||||
public override void Trigger(MonsterAbilityTrigger trigger, BaseCreature source, Mobile target)
|
||||
{
|
||||
_exploding.Add(source);
|
||||
source.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);
|
||||
source. PlaySound(0x307);
|
||||
source.PlaySound(0x307);
|
||||
|
||||
base.Trigger(trigger, source, target);
|
||||
_exploding.Remove(source);
|
||||
}
|
||||
|
||||
protected override bool CanEffectTarget(BaseCreature source, Mobile defender) =>
|
||||
!_exploding.Contains(defender) && base.CanEffectTarget(source, defender);
|
||||
|
||||
protected override void DoEffectTarget(BaseCreature source, Mobile defender)
|
||||
{
|
||||
source.DoHarmful(defender);
|
||||
// TODO: Is the damage type correct?
|
||||
AOS.Damage(defender, source, defender.HitsMax / 5, true, 100, 0, 0, 0, 0);
|
||||
AOS.Damage(defender, source, defender.HitsMax / 5, true, 50, 50, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue