Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Engines.PartySystem;
|
||||
using Server.Spells.Second;
|
||||
using Server.Targeting;
|
||||
|
|
@ -20,7 +21,7 @@ namespace Server.Spells.Fourth
|
|||
|
||||
private static Dictionary<Mobile, int> _Table = new Dictionary<Mobile, int>();
|
||||
|
||||
public ArchProtectionSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
public ArchProtectionSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -43,30 +44,25 @@ namespace Server.Spells.Fourth
|
|||
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
if (!Core.AOS)
|
||||
Effects.PlaySound(p, Caster.Map, 0x299);
|
||||
|
||||
Map map = Caster.Map;
|
||||
|
||||
if (map != null)
|
||||
if (Caster.Map == null)
|
||||
{
|
||||
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange(new Point3D(p), Core.AOS ? 2 : 3);
|
||||
|
||||
foreach (Mobile m in eable)
|
||||
if (Caster.CanBeBeneficial(m, false))
|
||||
targets.Add(m);
|
||||
|
||||
eable.Free();
|
||||
FinishSequence();
|
||||
return;
|
||||
}
|
||||
|
||||
IEnumerable<Mobile> targets = Caster.Map.GetMobilesInRange(new Point3D(p), Core.AOS ? 2 : 3)
|
||||
.Where(m => Caster.CanBeBeneficial(m, false));
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
Party party = Party.Get(Caster);
|
||||
|
||||
for (int i = 0; i < targets.Count; ++i)
|
||||
foreach (Mobile m in targets)
|
||||
{
|
||||
Mobile m = targets[i];
|
||||
|
||||
if (m == Caster || party != null && party.Contains(m))
|
||||
if (m == Caster || party?.Contains(m) == true)
|
||||
{
|
||||
Caster.DoBeneficial(m);
|
||||
ProtectionSpell.Toggle(Caster, m);
|
||||
|
|
@ -75,27 +71,22 @@ namespace Server.Spells.Fourth
|
|||
}
|
||||
else
|
||||
{
|
||||
Effects.PlaySound(p, Caster.Map, 0x299);
|
||||
|
||||
int val = (int)(Caster.Skills.Magery.Value / 10.0 + 1);
|
||||
|
||||
if (targets.Count > 0)
|
||||
for (int i = 0; i < targets.Count; ++i)
|
||||
foreach (Mobile m in targets)
|
||||
{
|
||||
if (m.BeginAction<ArchProtectionSpell>())
|
||||
{
|
||||
Mobile m = targets[i];
|
||||
Caster.DoBeneficial(m);
|
||||
m.VirtualArmorMod += val;
|
||||
|
||||
if (m.BeginAction<ArchProtectionSpell>())
|
||||
{
|
||||
Caster.DoBeneficial(m);
|
||||
m.VirtualArmorMod += val;
|
||||
AddEntry(m, val);
|
||||
new InternalTimer(m, Caster).Start();
|
||||
|
||||
AddEntry(m, val);
|
||||
new InternalTimer(m, Caster).Start();
|
||||
|
||||
m.FixedParticles(0x375A, 9, 20, 5027, EffectLayer.Waist);
|
||||
m.PlaySound(0x1F7);
|
||||
}
|
||||
m.FixedParticles(0x375A, 9, 20, 5027, EffectLayer.Waist);
|
||||
m.PlaySound(0x1F7);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue