fix: Cleans up LINQ calls. (#965)

- [X] Removes several `ToList()` uses with `PooledRefQueue`
- [X] Adds a `PeekRandom` to PooledRefQueue
- [X] Updates EV/BS so they dispel each other in a more efficient manner.
- [X] Fixes Firebomb so it works like a normal firefield.
- [X] Fixes field spells so they aren't unnecessarily using a Point3D ref more than necessary.
- [X] Removes extra allocation in campfire by using reverse loop.
- [X] Removes other LINQ calls that aren't needed.
This commit is contained in:
Kamron Batman 2022-03-20 19:20:54 -07:00 • committed by GitHub
parent daf89686d1
commit 23532db603
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 585 additions and 447 deletions

View file

@ -29,12 +29,12 @@ namespace Server.Spells.Sixth
if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
{
SpellHelper.Turn(Caster, p);
SpellHelper.GetSurfaceTop(ref p);
var eastToWest = SpellHelper.GetEastToWest(Caster.Location, p);
var loc = new Point3D(p);
var eastToWest = SpellHelper.GetEastToWest(Caster.Location, loc);
Effects.PlaySound(new Point3D(p), Caster.Map, 0x20B);
Effects.PlaySound(loc, Caster.Map, 0x20B);
var itemID = eastToWest ? 0x3967 : 0x3979;
@ -42,18 +42,18 @@ namespace Server.Spells.Sixth
for (var i = -2; i <= 2; ++i)
{
var loc = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);
var targetLoc = new Point3D(eastToWest ? loc.X + i : loc.X, eastToWest ? loc.Y : loc.Y + i, loc.Z);
if (!SpellHelper.AdjustField(ref loc, Caster.Map, 12, false))
if (!SpellHelper.AdjustField(ref targetLoc, Caster.Map, 12, false))
{
continue;
}
Item item = new InternalItem(Caster, itemID, loc, Caster.Map, duration);
Item item = new InternalItem(Caster, itemID, targetLoc, Caster.Map, duration);
item.ProcessDelta();
Effects.SendLocationParticles(
EffectItem.Create(loc, Caster.Map, EffectItem.DefaultDuration),
EffectItem.Create(targetLoc, Caster.Map, EffectItem.DefaultDuration),
0x376A,
9,
10,