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

@ -81,7 +81,7 @@ namespace Server.Mobiles
if ( this.Map == null )
return;
if ( attacker is BaseCreature && ((BaseCreature)attacker).BardProvoked )
if ( attacker is BaseCreature creature && creature.BardProvoked )
return;
if ( 0.2 > Utility.RandomDouble() )
@ -95,9 +95,9 @@ namespace Server.Mobiles
Mobile target = null;
if ( attacker is BaseCreature )
if ( attacker is BaseCreature baseCreature )
{
Mobile m = ((BaseCreature)attacker).GetMaster();
Mobile m = baseCreature.GetMaster();
if ( m != null )
target = m;
@ -115,7 +115,7 @@ namespace Server.Mobiles
if ( m == this || !CanBeHarmful( m ) )
continue;
if ( m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned || ((BaseCreature)m).Team != this.Team) )
if ( m is BaseCreature bc && (bc.Controlled || bc.Summoned || bc.Team != this.Team))
targets.Add( m );
else if ( m.Player && m.Alive )
targets.Add( m );