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

@ -14,8 +14,8 @@ namespace Server.Items
{
}
public abstract int DexOffset{ get; }
public abstract TimeSpan Duration{ get; }
public abstract int DexOffset { get; }
public abstract TimeSpan Duration { get; }
public override void Serialize(IGenericWriter writer)
{

View file

@ -72,8 +72,6 @@ namespace Server.Items
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => Core.ML;
#region ICraftable Members
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
CraftItem craftItem, int resHue)
{
@ -93,8 +91,8 @@ namespace Server.Items
PotionKeg keg = kegs[i];
// Should never happen
// if (keg == null)
// continue;
// if (keg == null)
// continue;
if (keg.Held <= 0 || keg.Held >= 100)
continue;
@ -115,8 +113,6 @@ namespace Server.Items
return 1;
}
#endregion
public static bool HasFreeHand(Mobile m)
{
Item handOne = m.FindItemOnLayer(Layer.OneHanded);
@ -187,10 +183,10 @@ namespace Server.Items
{
case 1:
case 0:
{
m_PotionEffect = (PotionEffect)reader.ReadInt();
break;
}
{
m_PotionEffect = (PotionEffect)reader.ReadInt();
break;
}
}
if (version == 0)
@ -205,13 +201,9 @@ namespace Server.Items
m.PlaySound(0x2D6);
#region Dueling
if (!DuelContext.IsFreeConsume(m))
m.AddToBackpack(new Bottle());
#endregion
if (m.Body.IsHuman && !m.Mounted)
m.Animate(34, 5, 1, true, false, 0);
}

View file

@ -7,7 +7,7 @@ namespace Server.Items
{
public abstract class BaseConflagrationPotion : BasePotion
{
private List<Mobile> m_Users = new List<Mobile>();
private readonly List<Mobile> m_Users = new List<Mobile>();
public BaseConflagrationPotion(PotionEffect effect) : base(0xF06, effect) => Hue = 0x489;
@ -15,8 +15,8 @@ namespace Server.Items
{
}
public abstract int MinDamage{ get; }
public abstract int MaxDamage{ get; }
public abstract int MinDamage { get; }
public abstract int MaxDamage { get; }
public override bool RequireFreeHand => false;
@ -78,20 +78,20 @@ namespace Server.Items
Effects.PlaySound(loc, map, 0x20C);
for (int i = -2; i <= 2; i++)
for (int j = -2; j <= 2; j++)
{
Point3D p = new Point3D(loc.X + i, loc.Y + j, loc.Z);
for (int j = -2; j <= 2; j++)
{
Point3D p = new Point3D(loc.X + i, loc.Y + j, loc.Z);
if (map.CanFit(p, 12, true, false) && from.InLOS(p))
new InternalItem(from, p, map, MinDamage, MaxDamage);
}
if (map.CanFit(p, 12, true, false) && from.InLOS(p))
new InternalItem(from, p, map, MinDamage, MaxDamage);
}
}
private class ThrowTarget : Target
{
public ThrowTarget(BaseConflagrationPotion potion) : base(12, true, TargetFlags.None) => Potion = potion;
public BaseConflagrationPotion Potion{ get; }
public BaseConflagrationPotion Potion { get; }
protected override void OnTarget(Mobile from, object targeted)
{
@ -147,7 +147,7 @@ namespace Server.Items
{
}
public Mobile From{ get; private set; }
public Mobile From { get; private set; }
public override bool BlocksFit => true;
@ -222,8 +222,8 @@ namespace Server.Items
private class InternalTimer : Timer
{
private DateTime m_End;
private InternalItem m_Item;
private readonly DateTime m_End;
private readonly InternalItem m_Item;
public InternalTimer(InternalItem item, DateTime end) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1.0))
{
@ -263,9 +263,7 @@ namespace Server.Items
}
}
#region Delay
private static Dictionary<Mobile, Timer> m_Delay = new Dictionary<Mobile, Timer>();
private static readonly Dictionary<Mobile, Timer> m_Delay = new Dictionary<Mobile, Timer>();
public static void AddDelay(Mobile m)
{
@ -290,7 +288,5 @@ namespace Server.Items
m_Delay.Remove(m);
}
}
#endregion
}
}

View file

@ -9,7 +9,7 @@ namespace Server.Items
{
public abstract class BaseConfusionBlastPotion : BasePotion
{
private List<Mobile> m_Users = new List<Mobile>();
private readonly List<Mobile> m_Users = new List<Mobile>();
public BaseConfusionBlastPotion(PotionEffect effect) : base(0xF06, effect) => Hue = 0x48D;
@ -17,7 +17,7 @@ namespace Server.Items
{
}
public abstract int Radius{ get; }
public abstract int Radius { get; }
public override bool RequireFreeHand => false;
@ -96,7 +96,7 @@ namespace Server.Items
{
public ThrowTarget(BaseConfusionBlastPotion potion) : base(12, true, TargetFlags.None) => Potion = potion;
public BaseConfusionBlastPotion Potion{ get; }
public BaseConfusionBlastPotion Potion { get; }
protected override void OnTarget(Mobile from, object targeted)
{
@ -125,8 +125,6 @@ namespace Server.Items
}
}
#region Effects
public virtual void BlastEffect(Point3D p, Map map)
{
if (map.CanFit(p, 12, true, false))
@ -138,11 +136,7 @@ namespace Server.Items
Geometry.Circle2D(p, m, Radius, BlastEffect, 90, 270);
}
#endregion
#region Delay
private static Dictionary<Mobile, Timer> m_Delay = new Dictionary<Mobile, Timer>();
private static readonly Dictionary<Mobile, Timer> m_Delay = new Dictionary<Mobile, Timer>();
public static void AddDelay(Mobile m)
{
@ -167,7 +161,5 @@ namespace Server.Items
m_Delay.Remove(m);
}
}
#endregion
}
}

View file

@ -12,9 +12,9 @@ namespace Server.Items
Chance = chance;
}
public Poison Poison{ get; }
public Poison Poison { get; }
public double Chance{ get; }
public double Chance { get; }
}
public abstract class BaseCurePotion : BasePotion
@ -27,7 +27,7 @@ namespace Server.Items
{
}
public abstract CureLevelInfo[] LevelInfo{ get; }
public abstract CureLevelInfo[] LevelInfo { get; }
public override void Serialize(IGenericWriter writer)
{

View file

@ -2,7 +2,7 @@ namespace Server.Items
{
public class CurePotion : BaseCurePotion
{
private static CureLevelInfo[] m_OldLevelInfo =
private static readonly CureLevelInfo[] m_OldLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 1.00), // 100% chance to cure lesser poison
new CureLevelInfo(Poison.Regular, 0.75), // 75% chance to cure regular poison
@ -10,7 +10,7 @@ namespace Server.Items
new CureLevelInfo(Poison.Deadly, 0.15) // 15% chance to cure deadly poison
};
private static CureLevelInfo[] m_AosLevelInfo =
private static readonly CureLevelInfo[] m_AosLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 1.00),
new CureLevelInfo(Poison.Regular, 0.95),

View file

@ -2,7 +2,7 @@ namespace Server.Items
{
public class GreaterCurePotion : BaseCurePotion
{
private static CureLevelInfo[] m_OldLevelInfo =
private static readonly CureLevelInfo[] m_OldLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 1.00), // 100% chance to cure lesser poison
new CureLevelInfo(Poison.Regular, 1.00), // 100% chance to cure regular poison
@ -11,7 +11,7 @@ namespace Server.Items
new CureLevelInfo(Poison.Lethal, 0.25) // 25% chance to cure lethal poison
};
private static CureLevelInfo[] m_AosLevelInfo =
private static readonly CureLevelInfo[] m_AosLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 1.00),
new CureLevelInfo(Poison.Regular, 1.00),

View file

@ -2,14 +2,14 @@ namespace Server.Items
{
public class LesserCurePotion : BaseCurePotion
{
private static CureLevelInfo[] m_OldLevelInfo =
private static readonly CureLevelInfo[] m_OldLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 0.75), // 75% chance to cure lesser poison
new CureLevelInfo(Poison.Regular, 0.50), // 50% chance to cure regular poison
new CureLevelInfo(Poison.Greater, 0.15) // 15% chance to cure greater poison
};
private static CureLevelInfo[] m_AosLevelInfo =
private static readonly CureLevelInfo[] m_AosLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 0.75),
new CureLevelInfo(Poison.Regular, 0.50),

View file

@ -11,9 +11,9 @@ namespace Server.Items
{
private const int ExplosionRange = 2; // How long is the blast radius?
private static bool LeveledExplosion = false; // Should explosion potions explode other nearby potions?
private static bool InstantExplosion = false; // Should explosion potions explode on impact?
private static bool RelativeLocation = false; // Is the explosion target location relative for mobiles?
private static readonly bool LeveledExplosion = false; // Should explosion potions explode other nearby potions?
private static readonly bool InstantExplosion = false; // Should explosion potions explode on impact?
private static readonly bool RelativeLocation = false; // Is the explosion target location relative for mobiles?
private Timer m_Timer;
@ -25,12 +25,12 @@ namespace Server.Items
{
}
public abstract int MinDamage{ get; }
public abstract int MaxDamage{ get; }
public abstract int MinDamage { get; }
public abstract int MaxDamage { get; }
public override bool RequireFreeHand => false;
public List<Mobile> Users{ get; private set; }
public List<Mobile> Users { get; private set; }
public override void Serialize(IGenericWriter writer)
{
@ -179,8 +179,8 @@ namespace Server.Items
List<IEntity> toExplode = eable.Where(o =>
{
if (!(o is Mobile mobile) || from != null &&
(!SpellHelper.ValidIndirectTarget(from, mobile) || !from.CanBeHarmful(mobile, false)))
if (!(o is Mobile mobile) || (from != null &&
(!SpellHelper.ValidIndirectTarget(from, mobile) || !from.CanBeHarmful(mobile, false))))
return o is BaseExplosionPotion && o != this;
++toDamage;
@ -222,7 +222,7 @@ namespace Server.Items
{
public ThrowTarget(BaseExplosionPotion potion) : base(12, true, TargetFlags.None) => Potion = potion;
public BaseExplosionPotion Potion{ get; }
public BaseExplosionPotion Potion { get; }
protected override void OnTarget(Mobile from, object targeted)
{

View file

@ -14,9 +14,9 @@ namespace Server.Items
{
}
public abstract int MinHeal{ get; }
public abstract int MaxHeal{ get; }
public abstract double Delay{ get; }
public abstract int MinHeal { get; }
public abstract int MaxHeal { get; }
public abstract double Delay { get; }
public override void Serialize(IGenericWriter writer)
{

View file

@ -5,7 +5,7 @@ namespace Server.Items
{
public class InvisibilityPotion : BasePotion
{
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
private static readonly Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
[Constructible]
public InvisibilityPotion() : base(0xF0A, PotionEffect.Invisibility) => Hue = 0x48D;
@ -44,7 +44,7 @@ namespace Server.Items
m.Hidden = true;
BuffInfo.RemoveBuff(m, BuffIcon.HidingAndOrStealth);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Invisibility, 1075825)); //Invisibility/Invisible
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Invisibility, 1075825)); // Invisibility/Invisible
RemoveTimer(m);

View file

@ -12,10 +12,10 @@ namespace Server.Items
{
}
public abstract Poison Poison{ get; }
public abstract Poison Poison { get; }
public abstract double MinPoisoningSkill{ get; }
public abstract double MaxPoisoningSkill{ get; }
public abstract double MinPoisoningSkill { get; }
public abstract double MaxPoisoningSkill { get; }
public override void Serialize(IGenericWriter writer)
{

View file

@ -12,7 +12,7 @@ namespace Server.Items
{
}
public abstract double Refresh{ get; }
public abstract double Refresh { get; }
public override void Serialize(IGenericWriter writer)
{

View file

@ -14,8 +14,8 @@ namespace Server.Items
{
}
public abstract int StrOffset{ get; }
public abstract TimeSpan Duration{ get; }
public abstract int StrOffset { get; }
public abstract TimeSpan Duration { get; }
public override void Serialize(IGenericWriter writer)
{