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

@ -18,14 +18,13 @@ namespace Server.Spells.Ninjitsu
NoSkill
}
private static SpellInfo m_Info = new SpellInfo(
private static readonly SpellInfo m_Info = new SpellInfo(
"Animal Form", null,
-1,
9002
);
9002);
private static Dictionary<Mobile, int> m_LastAnimalForms = new Dictionary<Mobile, int>();
private static Dictionary<Mobile, AnimalFormContext> m_Table = new Dictionary<Mobile, AnimalFormContext>();
private static readonly Dictionary<Mobile, int> m_LastAnimalForms = new Dictionary<Mobile, int>();
private static readonly Dictionary<Mobile, AnimalFormContext> m_Table = new Dictionary<Mobile, AnimalFormContext>();
private bool m_WasMoving;
@ -42,7 +41,7 @@ namespace Server.Spells.Ninjitsu
public override bool BlockedByAnimalForm => false;
public static AnimalFormEntry[] Entries{ get; } =
public static AnimalFormEntry[] Entries { get; } =
{
new AnimalFormEntry(typeof(Kirin), 1029632, 9632, 0, 1070811, 100.0, 0x84, 0, 0),
new AnimalFormEntry(typeof(Unicorn), 1018214, 9678, 0, 1070812, 100.0, 0x7A, 0, 0),
@ -120,7 +119,7 @@ namespace Server.Spells.Ninjitsu
{
Caster.SendLocalizedMessage(1063219); // You cannot mimic an animal while in that form.
}
else if (!Caster.CanBeginAction<IncognitoSpell>() || Caster.IsBodyMod && GetContext(Caster) == null)
else if (!Caster.CanBeginAction<IncognitoSpell>() || (Caster.IsBodyMod && GetContext(Caster) == null))
{
DoFizzle();
}
@ -187,7 +186,7 @@ namespace Server.Spells.Ninjitsu
AnimalFormEntry entry = Entries[entryID];
m_LastAnimalForms[m] = entryID; //On OSI, it's the last /attempted/ one not the last succeeded one
m_LastAnimalForms[m] = entryID; // On OSI, it's the last /attempted/ one not the last succeeded one
if (m.Skills.Ninjitsu.Value < entry.ReqSkill)
{
@ -198,7 +197,7 @@ namespace Server.Spells.Ninjitsu
}
/*
if ( !m.CheckSkill( SkillName.Ninjitsu, entry.ReqSkill, entry.ReqSkill + 37.5 ) )
if (!m.CheckSkill( SkillName.Ninjitsu, entry.ReqSkill, entry.ReqSkill + 37.5 ))
return MorphResult.Fail;
*
* On OSI,it seems you can only gain starting at '0' using Animal form.
@ -311,9 +310,9 @@ namespace Server.Spells.Ninjitsu
public class AnimalFormEntry
{
private int m_HueModMax;
private readonly int m_HueModMax;
private int m_HueModMin;
private readonly int m_HueModMin;
/*
private AnimalFormCallback m_TransformCallback;
private AnimalFormCallback m_UntransformCallback;
@ -337,33 +336,33 @@ namespace Server.Spells.Ninjitsu
StealingBonus = stealingBonus;
}
public Type Type{ get; }
public Type Type { get; }
public TextDefinition Name{ get; }
public TextDefinition Name { get; }
public int ItemID{ get; }
public int ItemID { get; }
public int Hue{ get; }
public int Hue { get; }
public int Tooltip{ get; }
public int Tooltip { get; }
public double ReqSkill{ get; }
public double ReqSkill { get; }
public int BodyMod{ get; }
public int BodyMod { get; }
public int HueMod => Utility.RandomMinMax(m_HueModMin, m_HueModMax);
public bool StealthBonus{ get; }
public bool StealthBonus { get; }
public bool SpeedBoost{ get; }
public bool SpeedBoost { get; }
public bool StealingBonus{ get; }
public bool StealingBonus { get; }
}
public class AnimalFormGump : Gump
{
//TODO: Convert this for ML to the BaseImageTileButtonsGump
private Mobile m_Caster;
private AnimalForm m_Spell;
// TODO: Convert this for ML to the BaseImageTileButtonsGump
private readonly Mobile m_Caster;
private readonly AnimalForm m_Spell;
public AnimalFormGump(Mobile caster, AnimalFormEntry[] entries, AnimalForm spell)
: base(50, 50)
@ -449,14 +448,9 @@ namespace Server.Spells.Ninjitsu
}
else if (BaseFormTalisman.EntryEnabled(sender.Mobile, entry.Type))
{
#region Dueling
if ((m_Caster as PlayerMobile)?.DuelContext?.AllowSpellCast(m_Caster, m_Spell) == false)
{
}
#endregion
else if (Morph(m_Caster, entryID) == MorphResult.Fail)
{
m_Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502632); // The spell fizzles.
@ -484,24 +478,24 @@ namespace Server.Spells.Ninjitsu
StealingMod = stealingMod;
}
public Timer Timer{ get; }
public Timer Timer { get; }
public SkillMod Mod{ get; }
public SkillMod Mod { get; }
public bool SpeedBoost{ get; }
public bool SpeedBoost { get; }
public Type Type{ get; }
public Type Type { get; }
public SkillMod StealingMod{ get; }
public SkillMod StealingMod { get; }
}
public class AnimalFormTimer : Timer
{
private int m_Body;
private readonly int m_Body;
private int m_Counter;
private int m_Hue;
private readonly int m_Hue;
private Mobile m_LastTarget;
private Mobile m_Mobile;
private readonly Mobile m_Mobile;
public AnimalFormTimer(Mobile from, int body, int hue)
: base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0))

View file

@ -38,7 +38,7 @@ namespace Server.Spells.Ninjitsu
if (valid)
{
attacker.BeginAction<Stealth>();
Timer.DelayCall(TimeSpan.FromSeconds(5.0), delegate { attacker.EndAction<Stealth>(); });
Timer.DelayCall(TimeSpan.FromSeconds(5.0), attacker.EndAction<Stealth>);
}
return valid;
@ -46,7 +46,7 @@ namespace Server.Spells.Ninjitsu
public override void OnHit(Mobile attacker, Mobile defender, int damage)
{
//Validates before swing
// Validates before swing
ClearCurrentMove(attacker);
@ -68,4 +68,4 @@ namespace Server.Spells.Ninjitsu
attacker.RevealingAction();
}
}
}
}

View file

@ -7,7 +7,7 @@ namespace Server.Spells.Ninjitsu
{
public class DeathStrike : NinjaMove
{
private static Dictionary<Mobile, DeathStrikeInfo> m_Table = new Dictionary<Mobile, DeathStrikeInfo>();
private static readonly Dictionary<Mobile, DeathStrikeInfo> m_Table = new Dictionary<Mobile, DeathStrikeInfo>();
public override int BaseMana => 30;
public override double RequiredSkill => 85.0;
@ -31,7 +31,7 @@ namespace Server.Spells.Ninjitsu
// TODO: should be defined onHit method, what if the player hit and remove the weapon before process? ;)
bool isRanged = attacker.Weapon is BaseRanged;
if (ninjitsu < 100) //This formula is an approximation from OSI data. TODO: find correct formula
if (ninjitsu < 100) // This formula is an approximation from OSI data. TODO: find correct formula
chance = 30 + (ninjitsu - 85) * 2.2;
else
chance = 63 + (ninjitsu - 100) * 1.1;
@ -130,11 +130,11 @@ namespace Server.Spells.Ninjitsu
private class DeathStrikeInfo
{
public Mobile m_Attacker;
public int m_DamageBonus;
public bool m_isRanged;
public readonly Mobile m_Attacker;
public readonly int m_DamageBonus;
public readonly bool m_isRanged;
public int m_Steps;
public Mobile m_Target;
public readonly Mobile m_Target;
public Timer m_Timer;
public DeathStrikeInfo(Mobile target, Mobile attacker, int damageBonus, bool isRanged)

View file

@ -6,7 +6,7 @@ namespace Server.Spells.Ninjitsu
{
public class KiAttack : NinjaMove
{
private static Dictionary<Mobile, KiAttackInfo> m_Table = new Dictionary<Mobile, KiAttackInfo>();
private static readonly Dictionary<Mobile, KiAttackInfo> m_Table = new Dictionary<Mobile, KiAttackInfo>();
public override int BaseMana => 25;
public override double RequiredSkill => 80.0;
@ -116,7 +116,7 @@ namespace Server.Spells.Ninjitsu
private class KiAttackInfo
{
public Point3D m_Location;
public Mobile m_Mobile;
public readonly Mobile m_Mobile;
public Timer m_Timer;
public KiAttackInfo(Mobile m)

View file

@ -10,13 +10,12 @@ namespace Server.Spells.Ninjitsu
{
public class MirrorImage : NinjaSpell
{
private static Dictionary<Mobile, int> m_CloneCount = new Dictionary<Mobile, int>();
private static readonly Dictionary<Mobile, int> m_CloneCount = new Dictionary<Mobile, int>();
private static SpellInfo m_Info = new SpellInfo(
private static readonly SpellInfo m_Info = new SpellInfo(
"Mirror Image", null,
-1,
9002
);
9002);
public MirrorImage(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -225,7 +224,6 @@ namespace Server.Mobiles
}
}
namespace Server.Mobiles
{
public class CloneAI : BaseAI

View file

@ -6,7 +6,7 @@ namespace Server.Spells
public override void CheckGain(Mobile m)
{
m.CheckSkill(MoveSkill, RequiredSkill - 12.5, RequiredSkill + 37.5); //Per five on friday 02/16/07
m.CheckSkill(MoveSkill, RequiredSkill - 12.5, RequiredSkill + 37.5); // Per five on friday 02/16/07
}
}
}

View file

@ -8,8 +8,8 @@ namespace Server.Spells.Ninjitsu
{
}
public abstract double RequiredSkill{ get; }
public abstract int RequiredMana{ get; }
public abstract double RequiredSkill { get; }
public abstract int RequiredMana { get; }
public override SkillName CastSkill => SkillName.Ninjitsu;
public override SkillName DamageSkill => SkillName.Ninjitsu;
@ -20,7 +20,7 @@ namespace Server.Spells.Ninjitsu
public override bool BlocksMovement => false;
//public override int CastDelayBase => 1;
// public override int CastDelayBase => 1;
public override int CastRecoveryBase => 7;
@ -85,7 +85,7 @@ namespace Server.Spells.Ninjitsu
public override void GetCastSkills(out double min, out double max)
{
min = RequiredSkill - 12.5; //Per 5 on friday 2/16/07
min = RequiredSkill - 12.5; // Per 5 on friday 2/16/07
max = RequiredSkill + 37.5;
}

View file

@ -11,11 +11,10 @@ namespace Server.Spells.Ninjitsu
{
public class Shadowjump : NinjaSpell, ISpellTargetingPoint3D
{
private static SpellInfo m_Info = new SpellInfo(
private static readonly SpellInfo m_Info = new SpellInfo(
"Shadowjump", null,
-1,
9002
);
9002);
public Shadowjump(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{

View file

@ -6,7 +6,7 @@ namespace Server.Spells.Ninjitsu
{
public class SurpriseAttack : NinjaMove
{
private static Dictionary<Mobile, SurpriseAttackInfo> m_Table = new Dictionary<Mobile, SurpriseAttackInfo>();
private static readonly Dictionary<Mobile, SurpriseAttackInfo> m_Table = new Dictionary<Mobile, SurpriseAttackInfo>();
public override int BaseMana => 20;
public override double RequiredSkill => Core.ML ? 60.0 : 30.0;
@ -33,7 +33,7 @@ namespace Server.Spells.Ninjitsu
if (valid)
{
attacker.BeginAction<Stealth>();
Timer.DelayCall(TimeSpan.FromSeconds(5.0), delegate { attacker.EndAction<Stealth>(); });
Timer.DelayCall(TimeSpan.FromSeconds(5.0), attacker.EndAction<Stealth>);
}
return valid;
@ -41,7 +41,7 @@ namespace Server.Spells.Ninjitsu
public override void OnHit(Mobile attacker, Mobile defender, int damage)
{
//Validates before swing
// Validates before swing
ClearCurrentMove(attacker);
@ -99,8 +99,8 @@ namespace Server.Spells.Ninjitsu
private class SurpriseAttackInfo
{
public int m_Malus;
public Mobile m_Target;
public readonly int m_Malus;
public readonly Mobile m_Target;
public Timer m_Timer;
public SurpriseAttackInfo(Mobile target, int effect)