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

@ -92,11 +92,9 @@ namespace Server.Mobiles
return true;
}
else
{
if ( m_Mobile.Debug )
m_Mobile.DebugSay( "I should be closer to {0}", combatant.Name );
}
if ( m_Mobile.Debug )
m_Mobile.DebugSay( "I should be closer to {0}", combatant.Name );
}
if ( !m_Mobile.Controlled && !m_Mobile.Summoned && m_Mobile.CanFlee )

View file

@ -117,7 +117,7 @@ namespace Server.Mobiles
if (!isOwner && !isFriend)
return;
else if (isFriend && m_Order != OrderType.Follow && m_Order != OrderType.Stay && m_Order != OrderType.Stop)
if (isFriend && m_Order != OrderType.Follow && m_Order != OrderType.Stay && m_Order != OrderType.Stop)
return;
switch (m_Order)
@ -141,8 +141,7 @@ namespace Server.Mobiles
{
if (m_Mobile.Summoned)
goto default;
else
m_From.SendGump(new Gumps.ConfirmReleaseGump(m_From, m_Mobile));
m_From.SendGump(new Gumps.ConfirmReleaseGump(m_From, m_Mobile));
break;
}
@ -203,7 +202,7 @@ namespace Server.Mobiles
if (!isOwner && !isFriend)
return;
else if (isFriend && order != OrderType.Follow && order != OrderType.Stay && order != OrderType.Stop)
if (isFriend && order != OrderType.Follow && order != OrderType.Stay && order != OrderType.Stop)
return;
if (from.Target == null)
@ -947,10 +946,8 @@ namespace Server.Mobiles
Action = ActionType.Guard;
return true;
}
else
{
m_Mobile.DebugSay("I am fleeing!");
}
m_Mobile.DebugSay("I am fleeing!");
return true;
}
@ -1353,7 +1350,7 @@ namespace Server.Mobiles
/* ~1_NAME~ has granted you the ability to give orders to their pet ~2_PET_NAME~.
* This creature will now consider you as a friend.
*/
to.SendLocalizedMessage(1043246, $"{@from.Name}\t{m_Mobile.Name}");
to.SendLocalizedMessage(1043246, $"{from.Name}\t{m_Mobile.Name}");
m_Mobile.AddPetFriend(to);
@ -1393,7 +1390,7 @@ namespace Server.Mobiles
/* ~1_NAME~ has no longer granted you the ability to give orders to their pet ~2_PET_NAME~.
* This creature will no longer consider you as a friend.
*/
to.SendLocalizedMessage(1070952, $"{@from.Name}\t{m_Mobile.Name}");
to.SendLocalizedMessage(1070952, $"{from.Name}\t{m_Mobile.Name}");
m_Mobile.RemovePetFriend(to);
}
@ -1679,7 +1676,7 @@ namespace Server.Mobiles
}
else if (accepted && !m_Creature.CanBeControlledBy(to))
{
string args = $"{to.Name}\t{@from.Name}\t ";
string args = $"{to.Name}\t{from.Name}\t ";
from.SendLocalizedMessage(1043248, args); // The pet refuses to be transferred because it will not obey ~1_NAME~.~3_BLANK~
to.SendLocalizedMessage(1043249, args); // The pet will not accept you as a master because it does not trust you.~3_BLANK~
@ -1688,7 +1685,7 @@ namespace Server.Mobiles
}
else if (accepted && !m_Creature.CanBeControlledBy(from))
{
string args = $"{to.Name}\t{@from.Name}\t ";
string args = $"{to.Name}\t{from.Name}\t ";
from.SendLocalizedMessage(1043250, args); // The pet refuses to be transferred because it will not obey you sufficiently.~3_BLANK~
to.SendLocalizedMessage(1043251, args); // The pet will not accept you as a master because it does not trust ~2_NAME~.~3_BLANK~
@ -1739,7 +1736,7 @@ namespace Server.Mobiles
m_Creature.PlaySound(m_Creature.GetIdleSound());
string args = $"{@from.Name}\t{m_Creature.Name}\t{to.Name}";
string args = $"{from.Name}\t{m_Creature.Name}\t{to.Name}";
from.SendLocalizedMessage(1043253, args); // You have transferred your pet to ~3_GETTER~.
to.SendLocalizedMessage(1043252, args); // ~1_NAME~ has transferred the allegiance of ~2_PET_NAME~ to you.
@ -1773,14 +1770,14 @@ namespace Server.Mobiles
}
else if (!m_Mobile.CanBeControlledBy(to))
{
string args = $"{to.Name}\t{@from.Name}\t ";
string args = $"{to.Name}\t{from.Name}\t ";
from.SendLocalizedMessage(1043248, args); // The pet refuses to be transferred because it will not obey ~1_NAME~.~3_BLANK~
to.SendLocalizedMessage(1043249, args); // The pet will not accept you as a master because it does not trust you.~3_BLANK~
}
else if (!m_Mobile.CanBeControlledBy(from))
{
string args = $"{to.Name}\t{@from.Name}\t ";
string args = $"{to.Name}\t{from.Name}\t ";
from.SendLocalizedMessage(1043250, args); // The pet refuses to be transferred because it will not obey you sufficiently.~3_BLANK~
to.SendLocalizedMessage(1043251, args); // The pet will not accept you as a master because it does not trust ~2_NAME~.~3_BLANK~
@ -2410,7 +2407,8 @@ namespace Server.Mobiles
m_Mobile.FocusMob = m_Mobile.BardTarget;
return (m_Mobile.FocusMob != null);
}
else if (m_Mobile.Controlled)
if (m_Mobile.Controlled)
{
if (m_Mobile.ControlTarget == null || m_Mobile.ControlTarget.Deleted || m_Mobile.ControlTarget.Hidden || !m_Mobile.ControlTarget.Alive || m_Mobile.ControlTarget.IsDeadBondedPet || !m_Mobile.InRange(m_Mobile.ControlTarget, m_Mobile.RangePerception * 2))
{

View file

@ -30,8 +30,7 @@ namespace Server.Mobiles
if ( ProcessTarget() )
return true;
else
return base.Think();
return base.Think();
}
public virtual bool SmartAI => ( m_Mobile is BaseVendor || m_Mobile is BaseEscortable || m_Mobile is Changeling );
@ -547,14 +546,12 @@ namespace Server.Mobiles
{
return TimeSpan.FromSeconds( m_Mobile.ActiveSpeed );
}
else
{
double del = ScaleBySkill( 3.0, SkillName.Magery );
double min = 6.0 - ( del * 0.75 );
double max = 6.0 - ( del * 1.25 );
return TimeSpan.FromSeconds( min + ( ( max - min ) * Utility.RandomDouble() ) );
}
double del = ScaleBySkill( 3.0, SkillName.Magery );
double min = 6.0 - ( del * 0.75 );
double max = 6.0 - ( del * 1.25 );
return TimeSpan.FromSeconds( min + ( ( max - min ) * Utility.RandomDouble() ) );
}
private Mobile m_LastTarget;
@ -864,45 +861,43 @@ namespace Server.Mobiles
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( Core.ML ? 10 : 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( Core.ML ? 10 : 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;

View file

@ -59,10 +59,8 @@ namespace Server.Mobiles
Action = ActionType.Wander;
return true;
}
else
{
m_Mobile.DebugSay( "I should be closer to {0}", combatant.Name );
}
m_Mobile.DebugSay( "I should be closer to {0}", combatant.Name );
}
return true;