diff --git a/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs b/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs index e7e9f4ca3..65ff4e537 100644 --- a/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs +++ b/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs @@ -298,8 +298,11 @@ namespace Server.Mobiles if (pet?.Deleted != false) { - pet.IsStabled = false; - pet.StabledBy = null; + if (pet != null) + { + pet.IsStabled = false; + pet.StabledBy = null; + } from.Stabled.RemoveAt(i); --i; continue; diff --git a/Projects/UOContent/Multis/Boats/Hold.cs b/Projects/UOContent/Multis/Boats/Hold.cs index 6b5090115..3bebcdb34 100644 --- a/Projects/UOContent/Multis/Boats/Hold.cs +++ b/Projects/UOContent/Multis/Boats/Hold.cs @@ -80,7 +80,7 @@ namespace Server.Items { if (m_Boat?.Contains(from) != true) { - m_Boat.TillerMan?.Say(502490); // You must be on the ship to open the hold. + m_Boat?.TillerMan?.Say(502490); // You must be on the ship to open the hold. } else if (m_Boat.IsMoving) { diff --git a/Projects/UOContent/Spells/Bushido/LightningStrike.cs b/Projects/UOContent/Spells/Bushido/LightningStrike.cs index 4b5f33714..7e78dfe07 100644 --- a/Projects/UOContent/Spells/Bushido/LightningStrike.cs +++ b/Projects/UOContent/Spells/Bushido/LightningStrike.cs @@ -18,10 +18,9 @@ namespace Server.Spells.Bushido public override bool Validate(Mobile from) { var isValid = base.Validate(from); - if (isValid) + if (isValid && from is PlayerMobile pm) { - var ThePlayer = from as PlayerMobile; - ThePlayer.ExecutesLightningStrike = BaseMana; + pm.ExecutesLightningStrike = BaseMana; } return isValid; @@ -57,10 +56,10 @@ namespace Server.Spells.Bushido public override void OnClearMove(Mobile attacker) { - var - ThePlayer = - attacker as PlayerMobile; // this can be deletet if the PlayerMobile parts are moved to Server.Mobile - ThePlayer.ExecutesLightningStrike = 0; + if (attacker is PlayerMobile pm) + { + pm.ExecutesLightningStrike = 0; + } } } } diff --git a/Projects/UOContent/Spells/Fourth/FireField.cs b/Projects/UOContent/Spells/Fourth/FireField.cs index 8f1353fda..4acb576a5 100644 --- a/Projects/UOContent/Spells/Fourth/FireField.cs +++ b/Projects/UOContent/Spells/Fourth/FireField.cs @@ -289,7 +289,11 @@ namespace Server.Spells.Fourth while (m_Queue.Count > 0) { - var m = (Mobile)m_Queue.Dequeue(); + var m = m_Queue.Dequeue() as Mobile; + if (m == null) + { + continue; + } if (SpellHelper.CanRevealCaster(m)) { diff --git a/Projects/UOContent/Spells/Ninjitsu/ShadowJump.cs b/Projects/UOContent/Spells/Ninjitsu/ShadowJump.cs index 775d0742c..008132b42 100644 --- a/Projects/UOContent/Spells/Ninjitsu/ShadowJump.cs +++ b/Projects/UOContent/Spells/Ninjitsu/ShadowJump.cs @@ -39,9 +39,7 @@ namespace Server.Spells.Ninjitsu var from = Caster.Location; var to = new Point3D(p); - var pm = Caster as PlayerMobile; // IsStealthing should be moved to Server.Mobiles - - if (!pm.IsStealthing) + if ((Caster as PlayerMobile)?.IsStealthing != true) { Caster.SendLocalizedMessage(1063087); // You must be in stealth mode to use this ability. }