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

@ -158,8 +158,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 )
@ -172,9 +171,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

@ -29,9 +29,7 @@ namespace Server.Mobiles
{
for ( int i = 0; i < pack.Items.Count; i++ )
{
PlagueBeastBlood blood = pack.Items[ i ] as PlagueBeastBlood;
if ( blood != null && !blood.Patched )
if ( pack.Items[ i ] is PlagueBeastBlood blood && !blood.Patched )
return true;
}
}
@ -107,7 +105,7 @@ namespace Server.Mobiles
public override void OnDelete()
{
if ( m_OpenedBy != null && m_OpenedBy.Holding is PlagueBeastInnard )
if ( m_OpenedBy?.Holding is PlagueBeastInnard )
m_OpenedBy.Holding.Delete();
if ( Backpack != null )