fix: Fixes crash in mass dispel (#856)
This commit is contained in:
parent
8806d6d7a7
commit
09613e2536
1 changed files with 9 additions and 2 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Server.Collections;
|
||||||
using Server.Items;
|
using Server.Items;
|
||||||
using Server.Mobiles;
|
using Server.Mobiles;
|
||||||
using Server.Targeting;
|
using Server.Targeting;
|
||||||
|
|
@ -37,6 +38,8 @@ namespace Server.Spells.Seventh
|
||||||
{
|
{
|
||||||
var eable = map.GetMobilesInRange<BaseCreature>(new Point3D(p), 8);
|
var eable = map.GetMobilesInRange<BaseCreature>(new Point3D(p), 8);
|
||||||
|
|
||||||
|
using var queue = PooledRefQueue<Mobile>.Create();
|
||||||
|
|
||||||
foreach (var bc in eable)
|
foreach (var bc in eable)
|
||||||
{
|
{
|
||||||
if (!(bc.IsDispellable && Caster.CanBeHarmful(bc, false)))
|
if (!(bc.IsDispellable && Caster.CanBeHarmful(bc, false)))
|
||||||
|
|
@ -58,17 +61,21 @@ namespace Server.Spells.Seventh
|
||||||
);
|
);
|
||||||
Effects.PlaySound(bc, 0x201);
|
Effects.PlaySound(bc, 0x201);
|
||||||
|
|
||||||
bc.Delete();
|
queue.Enqueue(bc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Caster.DoHarmful(bc);
|
Caster.DoHarmful(bc);
|
||||||
|
|
||||||
bc.FixedEffect(0x3779, 10, 20);
|
bc.FixedEffect(0x3779, 10, 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eable.Free();
|
eable.Free();
|
||||||
|
|
||||||
|
while (queue.Count > 0)
|
||||||
|
{
|
||||||
|
queue.Dequeue().Delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue