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

@ -5,82 +5,89 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class Anatomy
{
public static void Initialize()
{
SkillInfo.Table[(int)SkillName.Anatomy].Callback = OnUse;
}
public class Anatomy
{
public static void Initialize()
{
SkillInfo.Table[(int)SkillName.Anatomy].Callback = OnUse;
}
public static TimeSpan OnUse( Mobile m )
{
m.Target = new InternalTarget();
public static TimeSpan OnUse(Mobile m)
{
m.Target = new InternalTarget();
m.SendLocalizedMessage( 500321 ); // Whom shall I examine?
m.SendLocalizedMessage(500321); // Whom shall I examine?
return TimeSpan.FromSeconds( 1.0 );
}
return TimeSpan.FromSeconds(1.0);
}
private class InternalTarget : Target
{
public InternalTarget() : base ( 8, false, TargetFlags.None )
{
}
private class InternalTarget : Target
{
public InternalTarget() : base(8, false, TargetFlags.None)
{
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( from == targeted )
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500324 ); // You know yourself quite well enough already.
}
else if ( targeted is TownCrier )
{
((TownCrier)targeted).PrivateOverheadMessage( MessageType.Regular, 0x3B2, 500322, from.NetState ); // This person looks fine to me, though he may have some news...
}
else if ( targeted is BaseVendor && ((BaseVendor)targeted).IsInvulnerable )
{
((BaseVendor)targeted).PrivateOverheadMessage( MessageType.Regular, 0x3B2, 500326, from.NetState ); // That can not be inspected.
}
else if ( targeted is Mobile )
{
Mobile targ = (Mobile)targeted;
protected override void OnTarget(Mobile from, object targeted)
{
if (from == targeted)
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2,
500324); // You know yourself quite well enough already.
}
else if (targeted is TownCrier)
{
((TownCrier)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500322,
from.NetState); // This person looks fine to me, though he may have some news...
}
else if (targeted is BaseVendor && ((BaseVendor)targeted).IsInvulnerable)
{
((BaseVendor)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500326,
from.NetState); // That can not be inspected.
}
else if (targeted is Mobile)
{
Mobile targ = (Mobile)targeted;
int marginOfError = Math.Max( 0, 25 - (int)(from.Skills[SkillName.Anatomy].Value / 4) );
int marginOfError = Math.Max(0, 25 - (int)(from.Skills[SkillName.Anatomy].Value / 4));
int str = targ.Str + Utility.RandomMinMax( -marginOfError, +marginOfError );
int dex = targ.Dex + Utility.RandomMinMax( -marginOfError, +marginOfError );
int stm = ((targ.Stam * 100) / Math.Max( targ.StamMax, 1 )) + Utility.RandomMinMax( -marginOfError, +marginOfError );
int str = targ.Str + Utility.RandomMinMax(-marginOfError, +marginOfError);
int dex = targ.Dex + Utility.RandomMinMax(-marginOfError, +marginOfError);
int stm = targ.Stam * 100 / Math.Max(targ.StamMax, 1) +
Utility.RandomMinMax(-marginOfError, +marginOfError);
int strMod = str / 10;
int dexMod = dex / 10;
int stmMod = stm / 10;
int strMod = str / 10;
int dexMod = dex / 10;
int stmMod = stm / 10;
if ( strMod < 0 ) strMod = 0;
else if ( strMod > 10 ) strMod = 10;
if (strMod < 0) strMod = 0;
else if (strMod > 10) strMod = 10;
if ( dexMod < 0 ) dexMod = 0;
else if ( dexMod > 10 ) dexMod = 10;
if (dexMod < 0) dexMod = 0;
else if (dexMod > 10) dexMod = 10;
if ( stmMod > 10 ) stmMod = 10;
else if ( stmMod < 0 ) stmMod = 0;
if (stmMod > 10) stmMod = 10;
else if (stmMod < 0) stmMod = 0;
if ( from.CheckTargetSkill( SkillName.Anatomy, targ, 0, 100 ) )
{
targ.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1038045 + (strMod * 11) + dexMod, from.NetState ); // That looks [strong] and [dexterous].
if (from.CheckTargetSkill(SkillName.Anatomy, targ, 0, 100))
{
targ.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1038045 + strMod * 11 + dexMod,
from.NetState); // That looks [strong] and [dexterous].
if ( from.Skills[SkillName.Anatomy].Base >= 65.0 )
targ.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1038303 + stmMod, from.NetState ); // That being is at [10,20,...] percent endurance.
}
else
{
targ.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1042666, from.NetState ); // You can not quite get a sense of their physical characteristics.
}
}
else
{
(targeted as Item)?.SendLocalizedMessageTo( from, 500323, "" ); // Only living things have anatomies!
}
}
}
}
}
if (from.Skills[SkillName.Anatomy].Base >= 65.0)
targ.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1038303 + stmMod,
from.NetState); // That being is at [10,20,...] percent endurance.
}
else
{
targ.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042666,
from.NetState); // You can not quite get a sense of their physical characteristics.
}
}
else
{
(targeted as Item)?.SendLocalizedMessageTo(from, 500323, ""); // Only living things have anatomies!
}
}
}
}
}