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
|
|
@ -12,7 +12,7 @@ namespace Server.Spells.Chivalry
|
|||
9002
|
||||
);
|
||||
|
||||
public CleanseByFireSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
public CleanseByFireSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -123,4 +123,4 @@ namespace Server.Spells.Chivalry
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Server.Spells.Chivalry
|
|||
9002
|
||||
);
|
||||
|
||||
public CloseWoundsSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
public CloseWoundsSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -112,4 +112,4 @@ namespace Server.Spells.Chivalry
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
|
||||
|
|
@ -15,7 +14,7 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
private static Dictionary<BaseWeapon, ExpireTimer> m_Table = new Dictionary<BaseWeapon, ExpireTimer>();
|
||||
|
||||
public ConsecrateWeaponSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
public ConsecrateWeaponSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells.Necromancy;
|
||||
|
|
@ -14,7 +15,7 @@ namespace Server.Spells.Chivalry
|
|||
9002
|
||||
);
|
||||
|
||||
public DispelEvilSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
public DispelEvilSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -37,12 +38,6 @@ namespace Server.Spells.Chivalry
|
|||
{
|
||||
if (CheckSequence())
|
||||
{
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
|
||||
foreach (Mobile m in Caster.GetMobilesInRange(8))
|
||||
if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
|
||||
targets.Add(m);
|
||||
|
||||
Caster.PlaySound(0xF5);
|
||||
Caster.PlaySound(0x299);
|
||||
Caster.FixedParticles(0x37C4, 1, 25, 9922, 14, 3, EffectLayer.Head);
|
||||
|
|
@ -51,10 +46,11 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
double chiv = Caster.Skills.Chivalry.Value;
|
||||
|
||||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
Mobile m = targets[i];
|
||||
IEnumerable<Mobile> targets = Caster.GetMobilesInRange(8)
|
||||
.Where(m => Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false));
|
||||
|
||||
foreach (Mobile m in targets)
|
||||
{
|
||||
if (m is BaseCreature bc)
|
||||
{
|
||||
if (bc.Summoned && !bc.IsAnimatedDead)
|
||||
|
|
@ -106,4 +102,4 @@ namespace Server.Spells.Chivalry
|
|||
FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Spells.Chivalry
|
||||
|
|
@ -14,7 +13,7 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
|
||||
|
||||
public DivineFurySpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
public DivineFurySpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
|
||||
|
|
@ -15,7 +14,7 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
|
||||
|
||||
public EnemyOfOneSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
public EnemyOfOneSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Spells.Chivalry
|
||||
|
|
@ -12,7 +13,7 @@ namespace Server.Spells.Chivalry
|
|||
9002
|
||||
);
|
||||
|
||||
public HolyLightSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
public HolyLightSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -30,13 +31,6 @@ namespace Server.Spells.Chivalry
|
|||
{
|
||||
if (CheckSequence())
|
||||
{
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
|
||||
foreach (Mobile m in Caster.GetMobilesInRange(3))
|
||||
if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) &&
|
||||
(!Core.AOS || Caster.InLOS(m)))
|
||||
targets.Add(m);
|
||||
|
||||
Caster.PlaySound(0x212);
|
||||
Caster.PlaySound(0x206);
|
||||
|
||||
|
|
@ -46,10 +40,12 @@ namespace Server.Spells.Chivalry
|
|||
EffectItem.Create(new Point3D(Caster.X, Caster.Y, Caster.Z - 7), Caster.Map, EffectItem.DefaultDuration),
|
||||
0x37C4, 1, 29, 0x47D, 2, 9502, 0);
|
||||
|
||||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
Mobile m = targets[i];
|
||||
IEnumerable<Mobile> targets = Caster.GetMobilesInRange(3)
|
||||
.Where(m => Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) &&
|
||||
(!Core.AOS || Caster.InLOS(m)));
|
||||
|
||||
foreach (Mobile m in targets)
|
||||
{
|
||||
int damage = ComputePowerValue(10) + Utility.RandomMinMax(0, 2);
|
||||
|
||||
// TODO: Should caps be applied?
|
||||
|
|
@ -66,4 +62,4 @@ namespace Server.Spells.Chivalry
|
|||
FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Server.Spells.Chivalry
|
|||
9002
|
||||
);
|
||||
|
||||
public NobleSacrificeSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
public NobleSacrificeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -109,21 +109,21 @@ namespace Server.Spells.Chivalry
|
|||
StatMod mod;
|
||||
|
||||
mod = m.GetStatMod("[Magic] Str Offset");
|
||||
if (mod != null && mod.Offset < 0)
|
||||
if (mod?.Offset < 0)
|
||||
{
|
||||
m.RemoveStatMod("[Magic] Str Offset");
|
||||
sendEffect = true;
|
||||
}
|
||||
|
||||
mod = m.GetStatMod("[Magic] Dex Offset");
|
||||
if (mod != null && mod.Offset < 0)
|
||||
if (mod?.Offset < 0)
|
||||
{
|
||||
m.RemoveStatMod("[Magic] Dex Offset");
|
||||
sendEffect = true;
|
||||
}
|
||||
|
||||
mod = m.GetStatMod("[Magic] Int Offset");
|
||||
if (mod != null && mod.Offset < 0)
|
||||
if (mod?.Offset < 0)
|
||||
{
|
||||
m.RemoveStatMod("[Magic] Int Offset");
|
||||
sendEffect = true;
|
||||
|
|
@ -166,4 +166,4 @@ namespace Server.Spells.Chivalry
|
|||
FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Server.Spells.Chivalry
|
|||
9002
|
||||
);
|
||||
|
||||
public RemoveCurseSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
public RemoveCurseSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -77,15 +77,15 @@ namespace Server.Spells.Chivalry
|
|||
0x100);
|
||||
|
||||
StatMod mod = m.GetStatMod("[Magic] Str Offset");
|
||||
if (mod != null && mod.Offset < 0)
|
||||
if (mod?.Offset < 0)
|
||||
m.RemoveStatMod("[Magic] Str Offset");
|
||||
|
||||
mod = m.GetStatMod("[Magic] Dex Offset");
|
||||
if (mod != null && mod.Offset < 0)
|
||||
if (mod?.Offset < 0)
|
||||
m.RemoveStatMod("[Magic] Dex Offset");
|
||||
|
||||
mod = m.GetStatMod("[Magic] Int Offset");
|
||||
if (mod != null && mod.Offset < 0)
|
||||
if (mod?.Offset < 0)
|
||||
m.RemoveStatMod("[Magic] Int Offset");
|
||||
|
||||
m.Paralyzed = false;
|
||||
|
|
@ -138,4 +138,4 @@ namespace Server.Spells.Chivalry
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
private RunebookEntry m_Entry;
|
||||
|
||||
public SacredJourneySpell(Mobile caster, Item scroll, RunebookEntry entry = null, Runebook book = null) : base(caster, scroll,
|
||||
m_Info)
|
||||
public SacredJourneySpell(Mobile caster, RunebookEntry entry = null, Runebook book = null, Item scroll = null) :
|
||||
base(caster, scroll, m_Info)
|
||||
{
|
||||
m_Entry = entry;
|
||||
m_Book = book;
|
||||
|
|
@ -198,4 +198,4 @@ namespace Server.Spells.Chivalry
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue