Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -1,93 +1,94 @@
using System;
using System.Text;
using Server.Network;
namespace Server.Ethics.Hero
{
public sealed class HolySense : Power
{
public HolySense()
{
m_Definition = new PowerDefinition(
0,
"Holy Sense",
"Drewrok Erstok",
""
);
}
public sealed class HolySense : Power
{
public HolySense()
{
m_Definition = new PowerDefinition(
0,
"Holy Sense",
"Drewrok Erstok",
""
);
}
public override void BeginInvoke( Player from )
{
Ethic opposition = Ethic.Evil;
public override void BeginInvoke(Player from)
{
Ethic opposition = Ethic.Evil;
int enemyCount = 0;
int enemyCount = 0;
int maxRange = 18 + from.Power;
int maxRange = 18 + from.Power;
Player primary = null;
Player primary = null;
foreach ( Player pl in opposition.Players )
{
Mobile mob = pl.Mobile;
foreach (Player pl in opposition.Players)
{
Mobile mob = pl.Mobile;
if ( mob == null || mob.Map != from.Mobile.Map || !mob.Alive )
continue;
if (mob == null || mob.Map != from.Mobile.Map || !mob.Alive)
continue;
if ( !mob.InRange( from.Mobile, Math.Max( 18, maxRange - pl.Power ) ) )
continue;
if (!mob.InRange(from.Mobile, Math.Max(18, maxRange - pl.Power)))
continue;
if ( primary == null || pl.Power > primary.Power )
primary = pl;
if (primary == null || pl.Power > primary.Power)
primary = pl;
++enemyCount;
}
++enemyCount;
}
StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder();
sb.Append( "You sense " );
sb.Append( enemyCount == 0 ? "no" : enemyCount.ToString() );
sb.Append( enemyCount == 1 ? " enemy" : " enemies" );
sb.Append("You sense ");
sb.Append(enemyCount == 0 ? "no" : enemyCount.ToString());
sb.Append(enemyCount == 1 ? " enemy" : " enemies");
if ( primary != null )
{
sb.Append( ", and a strong presense" );
if (primary != null)
{
sb.Append(", and a strong presense");
switch ( from.Mobile.GetDirectionTo( primary.Mobile ) )
{
case Direction.West:
sb.Append( " to the west." );
break;
case Direction.East:
sb.Append( " to the east." );
break;
case Direction.North:
sb.Append( " to the north." );
break;
case Direction.South:
sb.Append( " to the south." );
break;
switch (from.Mobile.GetDirectionTo(primary.Mobile))
{
case Direction.West:
sb.Append(" to the west.");
break;
case Direction.East:
sb.Append(" to the east.");
break;
case Direction.North:
sb.Append(" to the north.");
break;
case Direction.South:
sb.Append(" to the south.");
break;
case Direction.Up:
sb.Append( " to the north-west." );
break;
case Direction.Down:
sb.Append( " to the south-east." );
break;
case Direction.Left:
sb.Append( " to the south-west." );
break;
case Direction.Right:
sb.Append( " to the north-east." );
break;
}
}
else
{
sb.Append( '.' );
}
case Direction.Up:
sb.Append(" to the north-west.");
break;
case Direction.Down:
sb.Append(" to the south-east.");
break;
case Direction.Left:
sb.Append(" to the south-west.");
break;
case Direction.Right:
sb.Append(" to the north-east.");
break;
}
}
else
{
sb.Append('.');
}
from.Mobile.LocalOverheadMessage( Network.MessageType.Regular, 0x59, false, sb.ToString() );
from.Mobile.LocalOverheadMessage(MessageType.Regular, 0x59, false, sb.ToString());
FinishInvoke( from );
}
}
}
FinishInvoke(from);
}
}
}