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

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Server.Targeting;
namespace Server.Spells.Sixth
@ -16,7 +17,7 @@ namespace Server.Spells.Sixth
Reagent.SulfurousAsh
);
public MassCurseSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public MassCurseSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -39,8 +40,6 @@ namespace Server.Spells.Sixth
SpellHelper.GetSurfaceTop(ref p);
List<Mobile> targets = new List<Mobile>();
Map map = Caster.Map;
if (map != null)
@ -49,33 +48,26 @@ namespace Server.Spells.Sixth
foreach (Mobile m in eable)
{
if (Core.AOS && m == Caster)
if (Core.AOS && (m == Caster || !SpellHelper.ValidIndirectTarget(Caster, m) || !Caster.CanSee(m) ||
!Caster.CanBeHarmful(m, false)))
continue;
if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanSee(m) && Caster.CanBeHarmful(m, false))
targets.Add(m);
Caster.DoHarmful(m);
SpellHelper.AddStatCurse(Caster, m, StatType.Str);
SpellHelper.DisableSkillCheck = true;
SpellHelper.AddStatCurse(Caster, m, StatType.Dex);
SpellHelper.AddStatCurse(Caster, m, StatType.Int);
SpellHelper.DisableSkillCheck = false;
m.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist);
m.PlaySound(0x1FB);
HarmfulSpell(m);
}
eable.Free();
}
for (int i = 0; i < targets.Count; ++i)
{
Mobile m = targets[i];
Caster.DoHarmful(m);
SpellHelper.AddStatCurse(Caster, m, StatType.Str);
SpellHelper.DisableSkillCheck = true;
SpellHelper.AddStatCurse(Caster, m, StatType.Dex);
SpellHelper.AddStatCurse(Caster, m, StatType.Int);
SpellHelper.DisableSkillCheck = false;
m.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist);
m.PlaySound(0x1FB);
HarmfulSpell(m);
}
}
FinishSequence();
@ -102,4 +94,4 @@ namespace Server.Spells.Sixth
}
}
}
}
}