Fixes implicit ternary expressions

This commit is contained in:
Kamron Batman 2018-09-14 14:56:48 -07:00
parent c85b0a740c
commit ff26dfa375
345 changed files with 1905 additions and 2336 deletions

View file

@ -50,10 +50,11 @@ namespace Server.Mobiles
double random = Utility.RandomDouble();
if ( 0.05 >= random )
return CreateArtifact( UniqueList );
else if ( 0.15 >= random )
if ( 0.15 >= random )
return CreateArtifact( SharedList );
else if ( 0.30 >= random )
if ( 0.30 >= random )
return CreateArtifact( DecorativeList );
return null;
}
@ -169,15 +170,13 @@ namespace Server.Mobiles
m.AddToBackpack( ps );
}
if ( m is PlayerMobile )
if ( m is PlayerMobile pm )
{
PlayerMobile pm = (PlayerMobile)m;
for( int j = 0; j < pm.JusticeProtectors.Count; ++j )
{
Mobile prot = pm.JusticeProtectors[j];
if ( prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion( m, prot ) )
if ( prot.Map != pm.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion( pm, prot ) )
continue;
int chance = 0;

View file

@ -291,15 +291,13 @@ namespace Server.Mobiles
m.SendLocalizedMessage( 1049524 ); // You have received a scroll of power!
m.AddToBackpack( new StatCapScroll( 225 + level ) );
if ( m is PlayerMobile )
if ( m is PlayerMobile pm )
{
PlayerMobile pm = (PlayerMobile)m;
for ( int j = 0; j < pm.JusticeProtectors.Count; ++j )
{
Mobile prot = (Mobile)pm.JusticeProtectors[j];
Mobile prot = pm.JusticeProtectors[j];
if ( prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion( m, prot ) )
if ( prot.Map != pm.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion( pm, prot ) )
continue;
int chance = 0;
@ -377,11 +375,9 @@ namespace Server.Mobiles
return base.OnBeforeDeath();
}
else
{
Morph();
return false;
}
Morph();
return false;
}
Dictionary<Mobile, int> m_DamageEntries;
@ -414,7 +410,7 @@ namespace Server.Mobiles
else
m_DamageEntries.Add( from, amount );
from.SendMessage($"Total Damage: {m_DamageEntries[@from]}");
from.SendMessage($"Total Damage: {m_DamageEntries[from]}");
}
public void AwardArtifact( Item artifact )
@ -476,10 +472,11 @@ namespace Server.Mobiles
double random = Utility.RandomDouble();
if ( 0.05 >= random )
return CreateArtifact( UniqueList );
else if ( 0.15 >= random )
if ( 0.15 >= random )
return CreateArtifact( SharedList );
else if ( 0.30 >= random )
if ( 0.30 >= random )
return CreateArtifact( DecorativeList );
return null;
}
@ -560,15 +557,13 @@ namespace Server.Mobiles
to = new Point3D( x, y, m_Owner.Z );
break;
}
else
{
int z = map.GetAverageZ( x, y );
if ( map.CanSpawnMobile( x, y, z ) )
{
to = new Point3D( x, y, z );
break;
}
int z = map.GetAverageZ( x, y );
if ( map.CanSpawnMobile( x, y, z ) )
{
to = new Point3D( x, y, z );
break;
}
}

View file

@ -176,10 +176,8 @@ namespace Server.Mobiles
if ( m == m_Owner || m == m_Owner.Harrower || !m_Owner.CanBeHarmful( m ) )
continue;
if ( m is BaseCreature )
if ( m is BaseCreature bc )
{
BaseCreature bc = m as BaseCreature;
if ( bc.Controlled || bc.Summoned )
m_ToDrain.Add( m );
}