Fixes chaos damage bug with the spell system. Fixes various small other bugs. Fixes more merge cast type checks and uses default values.

This commit is contained in:
Kamron Batman 2018-09-16 21:04:36 -07:00
parent 9542c79ea4
commit c155c82325
115 changed files with 644 additions and 1041 deletions

View file

@ -33,18 +33,12 @@ namespace Server.Spells.Ninjitsu
return false;
}
if (Core.ML)
if (Core.ML && @from.Weapon is BaseRanged)
{
BaseRanged ranged = from.Weapon as BaseRanged;
if (ranged != null)
{
from.SendLocalizedMessage(1075858); // You can only use this with melee attacks.
return false;
}
from.SendLocalizedMessage(1075858); // You can only use this with melee attacks.
return false;
}
return base.Validate(from);
}
@ -86,9 +80,7 @@ namespace Server.Spells.Ninjitsu
public override void OnClearMove(Mobile from)
{
KiAttackInfo info = m_Table[from] as KiAttackInfo;
if (info != null)
if (m_Table[@from] is KiAttackInfo info)
{
info.m_Timer?.Stop();
@ -98,9 +90,7 @@ namespace Server.Spells.Ninjitsu
public static double GetBonus(Mobile from)
{
KiAttackInfo info = m_Table[from] as KiAttackInfo;
if (info == null)
if (!(m_Table[@from] is KiAttackInfo info))
return 0.0;
int xDelta = info.m_Location.X - from.X;

View file

@ -122,9 +122,7 @@ namespace Server.Spells.Ninjitsu
protected override void OnTarget(Mobile from, object o)
{
IPoint3D p = o as IPoint3D;
if (p != null)
if (o is IPoint3D p)
m_Owner.Target(p);
}

View file

@ -86,9 +86,7 @@ namespace Server.Spells.Ninjitsu
public static bool GetMalus(Mobile target, ref int malus)
{
SurpriseAttackInfo info = m_Table[target] as SurpriseAttackInfo;
if (info == null)
if (!(m_Table[target] is SurpriseAttackInfo info))
return false;
malus = info.m_Malus;