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

@ -15,8 +15,8 @@ namespace Server.Factions
{
m_Faction = value;
Body = ( m_Faction == null ? 0xE2 : m_Faction.Definition.WarHorseBody );
ItemID = ( m_Faction == null ? 0x3EA0 : m_Faction.Definition.WarHorseItem );
Body = m_Faction?.Definition.WarHorseBody ?? 0xE2;
ItemID = m_Faction?.Definition.WarHorseItem ?? 0x3EA0;
}
}

View file

@ -310,45 +310,43 @@ namespace Server.Factions
return active;
}
else
Map map = m_Mobile.Map;
if ( map != null )
{
Map map = m_Mobile.Map;
Mobile active = null, inactive = null;
double actPrio = 0.0, inactPrio = 0.0;
if ( map != null )
Mobile comb = m_Mobile.Combatant;
if ( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel( comb ) )
{
Mobile active = null, inactive = null;
double actPrio = 0.0, inactPrio = 0.0;
active = inactive = comb;
actPrio = inactPrio = m_Mobile.GetDistanceToSqrt( comb );
}
Mobile comb = m_Mobile.Combatant;
if ( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel( comb ) )
foreach ( Mobile m in m_Mobile.GetMobilesInRange( 12 ) )
{
if ( m != m_Mobile && CanDispel( m ) )
{
active = inactive = comb;
actPrio = inactPrio = m_Mobile.GetDistanceToSqrt( comb );
}
double prio = m_Mobile.GetDistanceToSqrt( m );
foreach ( Mobile m in m_Mobile.GetMobilesInRange( 12 ) )
{
if ( m != m_Mobile && CanDispel( m ) )
if ( !activeOnly && (inactive == null || prio < inactPrio) )
{
double prio = m_Mobile.GetDistanceToSqrt( m );
inactive = m;
inactPrio = prio;
}
if ( !activeOnly && (inactive == null || prio < inactPrio) )
{
inactive = m;
inactPrio = prio;
}
if ( (m_Mobile.Combatant == m || m.Combatant == m_Mobile) && (active == null || prio < actPrio) )
{
active = m;
actPrio = prio;
}
if ( (m_Mobile.Combatant == m || m.Combatant == m_Mobile) && (active == null || prio < actPrio) )
{
active = m;
actPrio = prio;
}
}
return active != null ? active : inactive;
}
return active ?? inactive;
}
return null;
@ -473,7 +471,7 @@ namespace Server.Factions
{
Target targ = m_Guard.Target;
Mobile toHarm = ( dispelTarget == null ? combatant : dispelTarget );
Mobile toHarm = dispelTarget ?? combatant;
if ( (targ.Flags & TargetFlags.Harmful) != 0 && toHarm != null )
{