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

@ -114,8 +114,7 @@ namespace Server.Mobiles
this.PlaySound( 0xEE );
defender.LocalOverheadMessage( MessageType.Regular, 0x3B2, false, "You have been stunned by a colossal blow!" );
BaseWeapon weapon = this.Weapon as BaseWeapon;
if ( weapon != null )
if ( this.Weapon is BaseWeapon weapon )
weapon.OnHit( this, defender );
if ( defender.Alive )
@ -128,9 +127,7 @@ namespace Server.Mobiles
private void Recover_Callback( object state )
{
Mobile defender = state as Mobile;
if ( defender != null )
if ( state is Mobile defender )
{
defender.Frozen = false;
defender.Combatant = null;

View file

@ -60,9 +60,8 @@ namespace Server.Mobiles
public void AddArcane( Item item )
{
if ( item is IArcaneEquip )
if ( item is IArcaneEquip eq )
{
IArcaneEquip eq = (IArcaneEquip)item;
eq.CurArcaneCharges = eq.MaxArcaneCharges = 20;
}

View file

@ -94,8 +94,8 @@ namespace Server.Mobiles
aggressor.PlaySound( 0x307 );
aggressor.SendLocalizedMessage( 1040008 ); // Your skin is scorched as the tribal paint burns away!
if ( aggressor is PlayerMobile )
((PlayerMobile)aggressor).SavagePaintExpiration = TimeSpan.Zero;
if ( aggressor is PlayerMobile mobile )
mobile.SavagePaintExpiration = TimeSpan.Zero;
}
}

View file

@ -64,7 +64,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 creature && (creature.Controlled || creature.Summoned || creature.Team != this.Team) )
list.Add( m );
else if ( m.Player )
list.Add( m );