More casting fixes

This commit is contained in:
Kamron Batman 2018-09-11 18:59:11 -07:00
parent f211efc3bd
commit 20a80ea2f3
40 changed files with 125 additions and 211 deletions

View file

@ -249,7 +249,7 @@ namespace Server.Mobiles
Mobile target = m_Owner.Focus;
if ( target != null && (target.Deleted || !target.Alive || !m_Owner.CanBeHarmful( target )) )
if ( target != null && (target.Deleted || !target.Alive || !m_Owner.CanBeHarmful( target )) )
{
m_Owner.Focus = null;
Stop();
@ -274,8 +274,8 @@ namespace Server.Mobiles
TeleportTo( target );
target.BoltEffect( 0 );
if ( target is BaseCreature )
((BaseCreature)target).NoKillAwards = true;
if ( target is BaseCreature creature )
creature.NoKillAwards = true;
target.Damage( target.HitsMax, m_Owner );
target.Kill(); // just in case, maybe Damage is overridden on some shard
@ -394,4 +394,4 @@ namespace Server.Mobiles
}
}
}
}
}

View file

@ -20,10 +20,8 @@ namespace Server.Mobiles
foreach ( Mobile m in target.GetMobilesInRange( 15 ) )
{
if ( m is BaseGuard )
if ( m is BaseGuard g )
{
BaseGuard g = (BaseGuard)m;
if ( g.Focus == null ) // idling
{
g.Focus = target;
@ -83,4 +81,4 @@ namespace Server.Mobiles
int version = reader.ReadInt();
}
}
}
}

View file

@ -289,8 +289,8 @@ namespace Server.Mobiles
TeleportTo( target );
target.BoltEffect( 0 );
if ( target is BaseCreature )
((BaseCreature)target).NoKillAwards = true;
if ( target is BaseCreature creature )
creature.NoKillAwards = true;
target.Damage( target.HitsMax, m_Owner );
target.Kill(); // just in case, maybe Damage is overridden on some shard