Adds style cop (#109)

This commit is contained in:
Kamron Batman 2020-04-26 00:16:02 -07:00 • committed by GitHub
parent 3e715bcb60
commit 556a17aba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1725 changed files with 33831 additions and 38046 deletions

View file

@ -6,13 +6,12 @@ namespace Server.Spells.Bushido
{
public class Evasion : SamuraiSpell
{
private static SpellInfo m_Info = new SpellInfo(
private static readonly SpellInfo m_Info = new SpellInfo(
"Evasion", null,
-1,
9002
);
9002);
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
private static readonly Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
public Evasion(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
@ -26,34 +25,34 @@ namespace Server.Spells.Bushido
public override bool CheckCast() => VerifyCast(Caster, true) && base.CheckCast();
public static bool VerifyCast(Mobile Caster, bool messages)
public static bool VerifyCast(Mobile caster, bool messages)
{
if (Caster == null) // Sanity
if (caster == null) // Sanity
return false;
if (!(Caster.FindItemOnLayer(Layer.OneHanded) is BaseWeapon weap))
weap = Caster.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;
if (!(caster.FindItemOnLayer(Layer.OneHanded) is BaseWeapon weap))
weap = caster.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;
if (weap != null)
{
if (Core.ML && Caster.Skills[weap.Skill].Base < 50)
if (Core.ML && caster.Skills[weap.Skill].Base < 50)
{
if (messages)
Caster.SendLocalizedMessage(
caster.SendLocalizedMessage(
1076206); // Your skill with your equipped weapon must be 50 or higher to use Evasion.
return false;
}
}
else if (!(Caster.FindItemOnLayer(Layer.TwoHanded) is BaseShield))
else if (!(caster.FindItemOnLayer(Layer.TwoHanded) is BaseShield))
{
if (messages)
Caster.SendLocalizedMessage(1062944); // You must have a weapon or a shield equipped to use this ability!
caster.SendLocalizedMessage(1062944); // You must have a weapon or a shield equipped to use this ability!
return false;
}
if (!Caster.CanBeginAction<Evasion>())
if (!caster.CanBeginAction<Evasion>())
{
if (messages) Caster.SendLocalizedMessage(501789); // You must wait before trying again.
if (messages) caster.SendLocalizedMessage(501789); // You must wait before trying again.
return false;
}
@ -109,7 +108,7 @@ namespace Server.Spells.Bushido
BeginEvasion(Caster);
Caster.BeginAction<Evasion>();
Timer.DelayCall(TimeSpan.FromSeconds(20.0), delegate { Caster.EndAction<Evasion>(); });
Timer.DelayCall(TimeSpan.FromSeconds(20.0), Caster.EndAction<Evasion>);
}
FinishSequence();
@ -135,8 +134,7 @@ namespace Server.Spells.Bushido
if (m.Skills.Bushido.Value > 60)
seconds += (m.Skills.Bushido.Value - 60) / 20;
if (m.Skills.Anatomy.Value >= 100.0 && m.Skills.Tactics.Value >= 100.0 && m.Skills.Bushido.Value > 100.0
) //Bushido being HIGHER than 100 for bonus is intended
if (m.Skills.Anatomy.Value >= 100.0 && m.Skills.Tactics.Value >= 100.0 && m.Skills.Bushido.Value > 100.0) // Bushido being HIGHER than 100 for bonus is intended
seconds++;
return TimeSpan.FromSeconds((int)seconds);
@ -161,8 +159,7 @@ namespace Server.Spells.Bushido
if (m.Skills.Bushido.Value >= 60)
bonus += (m.Skills.Bushido.Value - 60) * .004 + 0.16;
if (m.Skills.Anatomy.Value >= 100 && m.Skills.Tactics.Value >= 100 && m.Skills.Bushido.Value > 100
) //Bushido being HIGHER than 100 for bonus is intended
if (m.Skills.Anatomy.Value >= 100 && m.Skills.Tactics.Value >= 100 && m.Skills.Bushido.Value > 100) // Bushido being HIGHER than 100 for bonus is intended
bonus += 0.10;
return 1.0 + bonus;
@ -190,7 +187,7 @@ namespace Server.Spells.Bushido
private class InternalTimer : Timer
{
private Mobile m_Mobile;
private readonly Mobile m_Mobile;
public InternalTimer(Mobile m, TimeSpan delay)
: base(delay)