Fixes bad expressions, bad bool checks in loops, a few null pointer exceptions, and optimizes constructors.

This commit is contained in:
Kamron Batman 2018-09-15 23:16:45 -07:00
parent 8da55d6043
commit f93c3b992e
62 changed files with 318 additions and 634 deletions

View file

@ -227,8 +227,8 @@ namespace Server.Spells.Necromancy
protected override void OnTarget(Mobile from, object o)
{
if (o is Mobile)
m_Owner.Target((Mobile)o);
if (o is Mobile mobile)
m_Owner.Target(mobile);
}
protected override void OnTargetFinish(Mobile from)

View file

@ -128,12 +128,12 @@ namespace Server.Spells.Necromancy
AddButton(27, 53 + i * 21, 9702, 9703, i + 1, GumpButtonType.Reply, 0);
if (name is int)
AddHtmlLocalized(50, 51 + i * 21, 150, 20, (int)name, enabled ? EnabledColor16 : DisabledColor16, false,
if (name is int intName)
AddHtmlLocalized(50, 51 + i * 21, 150, 20, intName, enabled ? EnabledColor16 : DisabledColor16, false,
false);
else if (name is string)
else if (name is string strName)
AddHtml(50, 51 + i * 21, 150, 20,
$"<BASEFONT COLOR=#{(enabled ? EnabledColor32 : DisabledColor32):X6}>{name}</BASEFONT>", false,
$"<BASEFONT COLOR=#{(enabled ? EnabledColor32 : DisabledColor32):X6}>{strName}</BASEFONT>", false,
false);
}
}

View file

@ -82,8 +82,8 @@ namespace Server.Spells.Necromancy
protected override void OnTarget(Mobile from, object o)
{
if (o is Mobile)
m_Owner.Target((Mobile)o);
if (o is Mobile mobile)
m_Owner.Target(mobile);
}
protected override void OnTargetFinish(Mobile from)

View file

@ -52,10 +52,8 @@ namespace Server.Spells.Necromancy
{
if (isMonster)
{
if (m is BaseCreature)
if (m is BaseCreature bc)
{
BaseCreature bc = (BaseCreature)m;
if (!bc.Controlled && !bc.Summoned && bc.Team == cbc.Team)
continue;
}

View file

@ -33,8 +33,8 @@ namespace Server.Spells.Necromancy
public override void DoEffect(Mobile m)
{
if (m is PlayerMobile)
((PlayerMobile)m).IgnoreMobiles = true;
if (m is PlayerMobile mobile)
mobile.IgnoreMobiles = true;
m.PlaySound(0x17F);
m.FixedParticles(0x374A, 1, 15, 9902, 1108, 4, EffectLayer.Waist);
@ -42,8 +42,8 @@ namespace Server.Spells.Necromancy
public override void RemoveEffect(Mobile m)
{
if (m is PlayerMobile && m.AccessLevel == AccessLevel.Player)
((PlayerMobile)m).IgnoreMobiles = false;
if (m is PlayerMobile mobile && mobile.AccessLevel == AccessLevel.Player)
mobile.IgnoreMobiles = false;
}
}
}