Fixes sequential checks

This commit is contained in:
Kamron Batman 2018-09-14 13:00:41 -07:00
parent 83dcf536d8
commit 42d0b6271f
67 changed files with 99 additions and 99 deletions

View file

@ -145,7 +145,7 @@ namespace Server.Spells
TransformContext context = TransformationSpellHelper.GetContext( Caster );
if ( context != null && context.Spell is ReaperFormSpell )
if ( context?.Spell is ReaperFormSpell )
damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
damage = AOS.Scale( damage, 100 + damageBonus );
@ -173,7 +173,7 @@ namespace Server.Spells
object o = ProtectionSpell.Registry[m_Caster];
bool disturb = true;
if ( o != null && o is double )
if ( o is double )
{
if ( ((double)o) > Utility.RandomDouble()*100.0 )
disturb = false;
@ -513,7 +513,7 @@ namespace Server.Spells
m_Caster.SendLocalizedMessage( 1072060 ); // You cannot cast a spell while calmed.
}
#region Dueling
else if ( m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast( m_Caster, this ) )
else if ( (m_Caster as PlayerMobile)?.DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast( m_Caster, this ) )
{
}
#endregion
@ -899,7 +899,7 @@ namespace Server.Spells
protected override void OnTick()
{
if ( m_Spell == null || m_Spell.m_Caster == null )
if ( m_Spell?.m_Caster == null )
{
return;
}

View file

@ -747,7 +747,7 @@ namespace Server.Spells
{
PlayerMobile pm = m_TravelCaster as PlayerMobile;
if ( pm != null && pm.DuelPlayer != null && !pm.DuelPlayer.Eliminated )
if ( pm?.DuelPlayer != null && !pm.DuelPlayer.Eliminated )
return true;
}
@ -880,7 +880,7 @@ namespace Server.Spells
{
PlayerMobile pm = (PlayerMobile) caster;
if ( pm == null || pm.DuelContext == null || !pm.DuelContext.Started || pm.DuelPlayer == null || pm.DuelPlayer.Eliminated )
if ( pm?.DuelContext == null || !pm.DuelContext.Started || pm.DuelPlayer == null || pm.DuelPlayer.Eliminated )
return true;
}
#endregion

View file

@ -94,7 +94,7 @@ namespace Server.Spells.Chivalry
}
TransformContext context = TransformationSpellHelper.GetContext( m );
if ( context != null && context.Spell is NecromancerSpell ) //Trees are not evil! TODO: OSI confirm?
if ( context?.Spell is NecromancerSpell ) //Trees are not evil! TODO: OSI confirm?
{
// transformed ..

View file

@ -77,7 +77,7 @@ namespace Server.Spells.Fifth
PlayerMobile pm = Caster as PlayerMobile;
if ( pm != null && pm.Race != null )
if ( pm?.Race != null )
{
pm.SetHairMods( pm.Race.RandomHair( pm.Female ), pm.Race.RandomFacialHair( pm.Female ) );
pm.HairHue = pm.Race.RandomHairHue();

View file

@ -197,7 +197,7 @@ namespace Server.Spells.Necromancy
type = c.Owner.GetType();
}
if ( c.ItemID != 0x2006 || c.Animated || type == typeof( PlayerMobile ) || type == null || ( c.Owner != null && c.Owner.Fame < 100 ) || ( ( c.Owner != null ) && ( c.Owner is BaseCreature ) && ( ( ( BaseCreature )c.Owner ).Summoned || ( ( BaseCreature )c.Owner ).IsBonded ) ) )
if ( c.ItemID != 0x2006 || c.Animated || type == typeof( PlayerMobile ) || type == null || ( c.Owner != null && c.Owner.Fame < 100 ) || ( c.Owner is BaseCreature && ( ( ( BaseCreature )c.Owner ).Summoned || ( ( BaseCreature )c.Owner ).IsBonded ) ) )
{
Caster.SendLocalizedMessage( 1061085 ); // There's not enough life force there to animate.
}

View file

@ -156,7 +156,7 @@ namespace Server.Spells.Necromancy
BaseCreature check = (BaseCreature)SummonFamiliarSpell.Table[m_From];
#region Dueling
if ( m_From is PlayerMobile && ( (PlayerMobile)m_From ).DuelContext != null && !( (PlayerMobile)m_From ).DuelContext.AllowSpellCast( m_From, m_Spell ) )
if ( (m_From as PlayerMobile)?.DuelContext != null && !( (PlayerMobile)m_From ).DuelContext.AllowSpellCast( m_From, m_Spell ) )
{
}
#endregion

View file

@ -479,7 +479,7 @@ namespace Server.Spells.Ninjitsu
else if (BaseFormTalisman.EntryEnabled(sender.Mobile, entry.Type))
{
#region Dueling
if ( m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast( m_Caster, m_Spell ) )
if ( (m_Caster as PlayerMobile)?.DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast( m_Caster, m_Spell ) )
{
}
#endregion

View file

@ -36,7 +36,7 @@ namespace Server.Spells.Spellweaving
public static ArcaneFocus FindArcaneFocus( Mobile from )
{
if ( from == null || from.Backpack == null )
if ( @from?.Backpack == null )
return null;
if ( from.Holding is ArcaneFocus )

View file

@ -107,7 +107,7 @@ namespace Server.Spells.Spellweaving
BaseCreature pet = (BaseCreature)m;
Mobile master = pet.GetMaster();
if ( master != null && master.NetState != null && Utility.InUpdateRange( pet, master ) )
if ( master?.NetState != null && Utility.InUpdateRange( pet, master ) )
{
master.CloseGump( typeof( PetResurrectGump ) );
master.SendGump( new PetResurrectGump( master, pet, hitsScalar ) );

View file

@ -52,7 +52,7 @@ namespace Server.Spells.Spellweaving
HouseRegion r = Region.Find( p, map ).GetRegion( typeof( HouseRegion ) ) as HouseRegion;
if ( r != null && r.House != null && !r.House.IsFriend( Caster ) )
if ( r?.House != null && !r.House.IsFriend( Caster ) )
return;
if ( !map.CanSpawnMobile( p.X, p.Y, p.Z ) )

View file

@ -51,7 +51,7 @@ namespace Server.Spells.Third
else if ( !item.CheckItemUse( Caster, item ) )
{
}
else if ( root != null && root is Mobile && root != Caster )
else if ( root is Mobile && root != Caster )
{
item.OnSnoop( Caster );
}