fix(spells): Fixes interruption of spells (#702)

This commit is contained in:
Kamron Batman 2021-08-18 12:17:42 -07:00 • committed by GitHub
parent 50dd7a1146
commit e6de7a5898
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 64 additions and 55 deletions

View file

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Collections;
using Server.Engines.PartySystem;
using Server.Spells.Second;
using Server.Targeting;
@ -53,15 +53,26 @@ namespace Server.Spells.Fourth
return;
}
var targets = Caster.Map.GetMobilesInRange(loc, Core.AOS ? 2 : 3)
.Where(m => Caster.CanBeBeneficial(m, false));
var eable = Caster.Map.GetMobilesInRange(loc, Core.AOS ? 2 : 3);
using var targets = PooledRefQueue<Mobile>.Create();
foreach (var m in eable)
{
if (Caster.CanBeBeneficial(m, false))
{
targets.Enqueue(m);
}
}
eable.Free();
if (Core.AOS)
{
var party = Party.Get(Caster);
foreach (var m in targets)
while (targets.Count > 0)
{
var m = targets.Dequeue();
if (m == Caster || party?.Contains(m) == true)
{
Caster.DoBeneficial(m);
@ -73,8 +84,9 @@ namespace Server.Spells.Fourth
{
var val = (int)(Caster.Skills.Magery.Value / 10.0 + 1);
foreach (var m in targets)
while (targets.Count > 0)
{
var m = targets.Dequeue();
if (m.BeginAction<ArchProtectionSpell>())
{
Caster.DoBeneficial(m);