Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)

This commit is contained in:
Kamron Batman 2019-03-11 14:29:59 -07:00 • committed by GitHub
parent e748af4430
commit 513e54f70e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1094 changed files with 15913 additions and 21892 deletions

View file

@ -15,7 +15,7 @@ namespace Server.Spells.Eighth
Reagent.SpidersSilk
);
public AirElementalSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public AirElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -50,4 +50,4 @@ namespace Server.Spells.Eighth
FinishSequence();
}
}
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Spells.Eighth
Reagent.SpidersSilk
);
public EarthElementalSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public EarthElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -50,4 +50,4 @@ namespace Server.Spells.Eighth
FinishSequence();
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Server.Spells.Eighth
{
@ -16,7 +17,7 @@ namespace Server.Spells.Eighth
Reagent.SulfurousAsh
);
public EarthquakeSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public EarthquakeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -28,22 +29,19 @@ namespace Server.Spells.Eighth
{
if (SpellHelper.CheckTown(Caster, Caster) && CheckSequence())
{
List<Mobile> targets = new List<Mobile>();
Map map = Caster.Map;
if (map != null)
foreach (Mobile m in Caster.GetMobilesInRange(1 + (int)(Caster.Skills.Magery.Value / 15.0)))
if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) &&
(!Core.AOS || Caster.InLOS(m)))
targets.Add(m);
Caster.PlaySound(0x220);
for (int i = 0; i < targets.Count; ++i)
if (Caster.Map == null)
{
Mobile m = targets[i];
FinishSequence();
return;
}
IEnumerable<Mobile> targets = Caster.GetMobilesInRange(1 + (int)(Caster.Skills.Magery.Value / 15.0))
.Where(m => Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) && (!Core.AOS || Caster.InLOS(m)));
foreach (Mobile m in targets)
{
int damage;
if (Core.AOS)
@ -72,4 +70,4 @@ namespace Server.Spells.Eighth
FinishSequence();
}
}
}
}

View file

@ -17,7 +17,7 @@ namespace Server.Spells.Eighth
Reagent.Nightshade
);
public EnergyVortexSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public EnergyVortexSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -96,4 +96,4 @@ namespace Server.Spells.Eighth
}
}
}
}
}

View file

@ -16,7 +16,7 @@ namespace Server.Spells.Eighth
Reagent.SulfurousAsh
);
public FireElementalSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public FireElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -51,4 +51,4 @@ namespace Server.Spells.Eighth
FinishSequence();
}
}
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Spells.Eighth
Reagent.Ginseng
);
public ResurrectionSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public ResurrectionSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -108,4 +108,4 @@ namespace Server.Spells.Eighth
}
}
}
}
}

View file

@ -16,7 +16,7 @@ namespace Server.Spells.Eighth
Reagent.SulfurousAsh
);
public SummonDaemonSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public SummonDaemonSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -57,4 +57,4 @@ namespace Server.Spells.Eighth
FinishSequence();
}
}
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Spells.Eighth
Reagent.SpidersSilk
);
public WaterElementalSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public WaterElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -50,4 +50,4 @@ namespace Server.Spells.Eighth
FinishSequence();
}
}
}
}