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,7 +14,7 @@ namespace Server.Items
/// </summary>
public class BleedAttack : WeaponAbility
{
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
private static readonly Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
public override int BaseMana => 30;
@ -28,8 +28,8 @@ namespace Server.Items
// Necromancers under Lich or Wraith Form are immune to Bleed Attacks.
TransformContext context = TransformationSpellHelper.GetContext(defender);
if (context != null && (context.Type == typeof(LichFormSpell) || context.Type == typeof(WraithFormSpell)) ||
defender is BaseCreature creature && creature.BleedImmune)
if ((context != null && (context.Type == typeof(LichFormSpell) || context.Type == typeof(WraithFormSpell))) ||
(defender is BaseCreature creature && creature.BleedImmune))
{
attacker.SendLocalizedMessage(1062052); // Your target is not affected by the bleed attack!
return;
@ -98,8 +98,8 @@ namespace Server.Items
private class InternalTimer : Timer
{
private int m_Count;
private Mobile m_From;
private Mobile m_Mobile;
private readonly Mobile m_From;
private readonly Mobile m_Mobile;
public InternalTimer(Mobile from, Mobile m) : base(TimeSpan.FromSeconds(2.0), TimeSpan.FromSeconds(2.0))
{

View file

@ -8,7 +8,7 @@ namespace Server.Items
/// </summary>
public class Block : WeaponAbility
{
private static Dictionary<Mobile, BlockInfo> m_Table = new Dictionary<Mobile, BlockInfo>();
private static readonly Dictionary<Mobile, BlockInfo> m_Table = new Dictionary<Mobile, BlockInfo>();
public override int BaseMana => 30;
@ -68,8 +68,8 @@ namespace Server.Items
private class BlockInfo
{
public int m_Bonus;
public Timer m_Timer;
public readonly int m_Bonus;
public readonly Timer m_Timer;
public BlockInfo(Mobile target, int bonus)
{
@ -80,7 +80,7 @@ namespace Server.Items
private class InternalTimer : Timer
{
private Mobile m_Mobile;
private readonly Mobile m_Mobile;
public InternalTimer(Mobile m) : base(TimeSpan.FromSeconds(6.0))
{

View file

@ -8,7 +8,6 @@ namespace Server.Items
public override int BaseMana => 25;
public override double DamageScalar => 1.5;
public override void OnHit(Mobile attacker, Mobile defender, int damage)
{
if (!Validate(attacker) || !CheckMana(attacker, true))

View file

@ -9,7 +9,7 @@ namespace Server.Items
/// </summary>
public class DefenseMastery : WeaponAbility
{
private static Dictionary<Mobile, DefenseMasteryInfo> m_Table = new Dictionary<Mobile, DefenseMasteryInfo>();
private static readonly Dictionary<Mobile, DefenseMasteryInfo> m_Table = new Dictionary<Mobile, DefenseMasteryInfo>();
public override int BaseMana => 30;
@ -80,9 +80,9 @@ namespace Server.Items
private class DefenseMasteryInfo
{
public int m_DamageMalus;
public Mobile m_From;
public ResistanceMod m_Mod;
public readonly int m_DamageMalus;
public readonly Mobile m_From;
public readonly ResistanceMod m_Mod;
public Timer m_Timer;
public DefenseMasteryInfo(Mobile from, int damageMalus, ResistanceMod mod)

View file

@ -15,15 +15,15 @@ namespace Server.Items
// No longer active in pub21:
/*public override bool CheckSkills( Mobile from )
{
if ( !base.CheckSkills( from ) )
if (!base.CheckSkills( from ))
return false;
if ( !(from.Weapon is Fists) )
if (!(from.Weapon is Fists))
return true;
Skill skill = from.Skills.ArmsLore;
if ( skill?.Base >= 80.0 )
if (skill?.Base >= 80.0)
return true;
from.SendLocalizedMessage( 1061812 ); // You lack the required skill in armslore to perform that attack!
@ -57,7 +57,7 @@ namespace Server.Items
{
attacker.SendLocalizedMessage(1004001); // You cannot disarm your opponent.
}
else if (!Core.ML && toDisarm == null || toDisarm is BaseShield || toDisarm is Spellbook)
else if ((!Core.ML && toDisarm == null) || toDisarm is BaseShield || toDisarm is Spellbook)
{
attacker.SendLocalizedMessage(1060849); // Your target is already unarmed!
}

View file

@ -38,8 +38,7 @@ namespace Server.Items
if (defender is ChaosDragoon || defender is ChaosDragoonElite)
return;
if (attacker.Mounted && (!(attacker.Weapon is Lance) || !(defender.Weapon is Lance))
) // TODO: Should there be a message here?
if (attacker.Mounted && (!(attacker.Weapon is Lance) || !(defender.Weapon is Lance))) // TODO: Should there be a message here?
return;
ClearCurrentAbility(attacker);
@ -55,8 +54,8 @@ namespace Server.Items
if (!CheckMana(attacker, true))
return;
if (Core.ML && attacker is LesserHiryu && 0.8 >= Utility.RandomDouble())
return; //Lesser Hiryu have an 80% chance of missing this attack
if (Core.ML && attacker is LesserHiryu && Utility.RandomDouble() <= 0.8)
return; // Lesser Hiryu have an 80% chance of missing this attack
attacker.SendLocalizedMessage(1060082); // The force of your attack has dislodged them from their mount!

View file

@ -30,11 +30,11 @@ namespace Server.Items
}
else if (CheckMana(attacker, true))
{
//attacker.SendLocalizedMessage( 1060092 ); // You disarm their weapon!
// attacker.SendLocalizedMessage( 1060092 ); // You disarm their weapon!
defender.SendLocalizedMessage(1062002); // You can no longer wear your ~1_ARMOR~
defender.PlaySound(0x3B9);
//defender.FixedParticles( 0x37BE, 232, 25, 9948, EffectLayer.InnerTorso );
// defender.FixedParticles( 0x37BE, 232, 25, 9948, EffectLayer.InnerTorso );
pack.DropItem(toDisrobe);

View file

@ -44,7 +44,7 @@ namespace Server.Items
public void Use(Mobile attacker, Mobile defender)
{
if (!Validate(attacker) || !CheckMana(attacker, true) || attacker.Weapon == null) //sanity
if (!Validate(attacker) || !CheckMana(attacker, true) || attacker.Weapon == null) // sanity
return;
ClearCurrentAbility(attacker);

View file

@ -34,7 +34,7 @@ namespace Server.Items
IWeapon weapon = attacker.Weapon;
if (!(weapon != null && attacker.InRange(defender, weapon.MaxRange) &&attacker.InLOS(defender)))
if (!(weapon != null && attacker.InRange(defender, weapon.MaxRange) && attacker.InLOS(defender)))
return;
BaseWeapon.InDoubleStrike = true;

View file

@ -8,7 +8,7 @@ namespace Server.Items
/// </summary>
public class DualWield : WeaponAbility
{
public static Dictionary<Mobile, DualWieldTimer> Registry{ get; } = new Dictionary<Mobile, DualWieldTimer>();
public static Dictionary<Mobile, DualWieldTimer> Registry { get; } = new Dictionary<Mobile, DualWieldTimer>();
public override int BaseMana => 30;
@ -41,7 +41,7 @@ namespace Server.Items
attacker.FixedParticles(0x3779, 1, 15, 0x7F6, 0x3E8, 3, EffectLayer.LeftHand);
timer = new DualWieldTimer(attacker,
(int)(20.0 + 3.0 * (attacker.Skills.Ninjitsu.Value - 50.0) / 7.0)); //20-50 % increase
(int)(20.0 + 3.0 * (attacker.Skills.Ninjitsu.Value - 50.0) / 7.0)); // 20-50 % increase
timer.Start();
Registry.Add(attacker, timer);
@ -49,7 +49,7 @@ namespace Server.Items
public class DualWieldTimer : Timer
{
private Mobile m_Owner;
private readonly Mobile m_Owner;
public DualWieldTimer(Mobile owner, int bonusSwingSpeed)
: base(TimeSpan.FromSeconds(6.0))
@ -59,7 +59,7 @@ namespace Server.Items
Priority = TimerPriority.FiftyMS;
}
public int BonusSwingSpeed{ get; }
public int BonusSwingSpeed { get; }
protected override void OnTick()
{

View file

@ -8,7 +8,7 @@ namespace Server.Items
/// </summary>
public class Feint : WeaponAbility
{
public static Dictionary<Mobile, FeintTimer> Registry{ get; } = new Dictionary<Mobile, FeintTimer>();
public static Dictionary<Mobile, FeintTimer> Registry { get; } = new Dictionary<Mobile, FeintTimer>();
public override int BaseMana => 30;
@ -44,7 +44,7 @@ namespace Server.Items
timer = new FeintTimer(defender,
(int)(20.0 + 3.0 * (Math.Max(attacker.Skills.Ninjitsu.Value,
attacker.Skills.Bushido.Value) - 50.0) / 7.0)); //20-50 % decrease
attacker.Skills.Bushido.Value) - 50.0) / 7.0)); // 20-50 % decrease
timer.Start();
Registry.Add(defender, timer);
@ -52,7 +52,7 @@ namespace Server.Items
public class FeintTimer : Timer
{
private Mobile m_Defender;
private readonly Mobile m_Defender;
public FeintTimer(Mobile defender, int swingSpeedReduction)
: base(TimeSpan.FromSeconds(6.0))
@ -62,7 +62,7 @@ namespace Server.Items
Priority = TimerPriority.FiftyMS;
}
public int SwingSpeedReduction{ get; }
public int SwingSpeedReduction { get; }
protected override void OnTick()
{

View file

@ -12,7 +12,7 @@ namespace Server.Items
{
public override int BaseMana => 30;
public static Dictionary<Mobile, FrenziedWirlwindTimer> Registry{ get; } = new Dictionary<Mobile, FrenziedWirlwindTimer>();
public static Dictionary<Mobile, FrenziedWirlwindTimer> Registry { get; } = new Dictionary<Mobile, FrenziedWirlwindTimer>();
public override bool CheckSkills(Mobile from)
{
@ -28,7 +28,7 @@ namespace Server.Items
public override void OnHit(Mobile attacker, Mobile defender, int damage)
{
if (!Validate(attacker)) //Mana check after check that there are targets
if (!Validate(attacker)) // Mana check after check that there are targets
return;
ClearCurrentAbility(attacker);
@ -81,10 +81,10 @@ namespace Server.Items
public class FrenziedWirlwindTimer : Timer
{
private readonly double DamagePerTick;
private Mobile m_Attacker;
private readonly Mobile m_Attacker;
private double m_DamageRemaining;
private double m_DamageToDo;
private Mobile m_Defender;
private readonly Mobile m_Defender;
public FrenziedWirlwindTimer(Mobile attacker, Mobile defender, int totalDamage)
: base(TimeSpan.Zero, TimeSpan.FromSeconds(0.25),
@ -112,7 +112,7 @@ namespace Server.Items
m_DamageToDo += DamagePerTick;
if (m_DamageRemaining <= 0 && m_DamageToDo < 1)
m_DamageToDo = 1.0; //Confirm this 'round up' at the end
m_DamageToDo = 1.0; // Confirm this 'round up' at the end
int damage = (int)m_DamageToDo;

View file

@ -13,7 +13,7 @@ namespace Server.Items
public static readonly TimeSpan PlayerDuration = TimeSpan.FromSeconds(6.0);
public static readonly TimeSpan NPCDuration = TimeSpan.FromSeconds(12.0);
private static Dictionary<Mobile, InternalTimer> m_Table = new Dictionary<Mobile, InternalTimer>();
private static readonly Dictionary<Mobile, InternalTimer> m_Table = new Dictionary<Mobile, InternalTimer>();
public override int BaseMana => 30;
@ -61,7 +61,7 @@ namespace Server.Items
private class InternalTimer : Timer
{
private Mobile m_Mobile;
private readonly Mobile m_Mobile;
public InternalTimer(Mobile m, TimeSpan duration) : base(duration)
{

View file

@ -15,7 +15,7 @@ namespace Server.Items
public override void OnMiss(Mobile attacker, Mobile defender)
{
//Validates in OnSwing for accuracy scalar
// Validates in OnSwing for accuracy scalar
ClearCurrentAbility(attacker);
@ -24,7 +24,7 @@ namespace Server.Items
public override void OnHit(Mobile attacker, Mobile defender, int damage)
{
//Validates in OnSwing for accuracy scalar
// Validates in OnSwing for accuracy scalar
ClearCurrentAbility(attacker);

View file

@ -60,7 +60,7 @@ namespace Server.Items
{
AOS.Damage(defender, attacker,
(int)(15.0 * (attacker.Skills.Bushido.Value - 50.0) / 70.0 + Utility.Random(10)), true, 100,
0, 0, 0, 0); //0-25
0, 0, 0, 0); // 0-25
if (!cantpara && (150.0 / 7.0 + 4.0 * attacker.Skills.Bushido.Value / 7.0) / 100.0 >
Utility.RandomDouble())
@ -72,7 +72,7 @@ namespace Server.Items
else if (!cantpara)
{
AOS.Damage(defender, attacker, (int)(15.0 * (attacker.Skills.Bushido.Value - 50.0) / 70.0 + 10),
true, 100, 0, 0, 0, 0); //10-25
true, 100, 0, 0, 0, 0); // 10-25
defender.Freeze(TimeSpan.FromSeconds(2.0));
Items.ParalyzingBlow.BeginImmunity(defender, Items.ParalyzingBlow.FreezeDelayDuration);
}

View file

@ -13,22 +13,22 @@ namespace Server.Items
public static readonly TimeSpan FreezeDelayDuration = TimeSpan.FromSeconds(8.0);
private static Dictionary<Mobile, InternalTimer> m_Table = new Dictionary<Mobile, InternalTimer>();
private static readonly Dictionary<Mobile, InternalTimer> m_Table = new Dictionary<Mobile, InternalTimer>();
public override int BaseMana => 30;
// No longer active in pub21:
/*public override bool CheckSkills( Mobile from )
{
if ( !base.CheckSkills( from ) )
if (!base.CheckSkills( from ))
return false;
if ( !(from.Weapon is Fists) )
if (!(from.Weapon is Fists))
return true;
Skill skill = from.Skills.Anatomy;
if ( skill?.Base >= 80.0 )
if (skill?.Base >= 80.0)
return true;
from.SendLocalizedMessage( 1061811 ); // You lack the required anatomy skill to perform that attack!
@ -56,7 +56,7 @@ namespace Server.Items
ClearCurrentAbility(attacker);
if (IsImmune(defender)) //Intentionally going after Mana consumption
if (IsImmune(defender)) // Intentionally going after Mana consumption
{
attacker.SendLocalizedMessage(1070804); // Your target resists paralysis.
defender.SendLocalizedMessage(1070813); // You resist paralysis.
@ -99,7 +99,7 @@ namespace Server.Items
private class InternalTimer : Timer
{
private Mobile m_Mobile;
private readonly Mobile m_Mobile;
public InternalTimer(Mobile m, TimeSpan duration) : base(duration)
{

View file

@ -45,14 +45,14 @@ namespace Server.Items
Mobile mount = defender.Mount as Mobile;
BaseMount.Dismount(defender);
if (mount != null) //Ethy mounts don't take damage
if (mount != null) // Ethy mounts don't take damage
{
int amount = 10 + (int)(10.0 * (attacker.Skills.Bushido.Value - 50.0) / 70.0 + 5);
AOS.Damage(mount, null, amount, 100, 0, 0, 0,
0); //The mount just takes damage, there's no flagging as if it was attacking the mount directly
0); // The mount just takes damage, there's no flagging as if it was attacking the mount directly
//TODO: Mount prevention until mount healed
// TODO: Mount prevention until mount healed
}
}
else
@ -61,7 +61,7 @@ namespace Server.Items
AOS.Damage(defender, attacker, amount, 100, 0, 0, 0, 0);
if (Items.ParalyzingBlow.IsImmune(defender)) //Does it still do damage?
if (Items.ParalyzingBlow.IsImmune(defender)) // Does it still do damage?
{
attacker.SendLocalizedMessage(1070804); // Your target resists paralysis.
defender.SendLocalizedMessage(1070813); // You resist paralysis.

View file

@ -8,7 +8,7 @@ namespace Server.Items
/// </summary>
public class TalonStrike : WeaponAbility
{
private static HashSet<Mobile> m_Table = new HashSet<Mobile>();
private static readonly HashSet<Mobile> m_Table = new HashSet<Mobile>();
public override int BaseMana => 30;
public override double DamageScalar => 1.2;
@ -38,7 +38,7 @@ namespace Server.Items
defender.FixedParticles(0x373A, 1, 17, 0x26BC, 0x662, 0, EffectLayer.Waist);
InternalTimer timer = new InternalTimer(defender,
(int)(10.0 * (attacker.Skills.Ninjitsu.Value - 50.0) / 70.0 + 5)); //5 - 15 damage
(int)(10.0 * (attacker.Skills.Ninjitsu.Value - 50.0) / 70.0 + 5)); // 5 - 15 damage
timer.Start();
@ -50,7 +50,7 @@ namespace Server.Items
private readonly double DamagePerTick;
private double m_DamageRemaining;
private double m_DamageToDo;
private Mobile m_Defender;
private readonly Mobile m_Defender;
public InternalTimer(Mobile defender, int totalDamage)
: base(TimeSpan.Zero, TimeSpan.FromSeconds(0.25),
@ -76,14 +76,14 @@ namespace Server.Items
m_DamageToDo += DamagePerTick;
if (m_DamageRemaining <= 0 && m_DamageToDo < 1)
m_DamageToDo = 1.0; //Confirm this 'round up' at the end
m_DamageToDo = 1.0; // Confirm this 'round up' at the end
int damage = (int)m_DamageToDo;
if (damage > 0)
{
//m_Defender.Damage( damage, m_Attacker, false );
m_Defender.Hits -= damage; //Don't show damage, don't disrupt
// m_Defender.Damage( damage, m_Attacker, false );
m_Defender.Hits -= damage; // Don't show damage, don't disrupt
m_DamageToDo -= damage;
}

View file

@ -12,7 +12,7 @@ namespace Server.Items
{
public abstract class WeaponAbility
{
public static WeaponAbility[] Abilities{ get; } = {
public static WeaponAbility[] Abilities { get; } = {
null,
new ArmorIgnore(),
new BleedAttack(),
@ -81,7 +81,7 @@ namespace Server.Items
public static readonly WeaponAbility Disrobe = Abilities[30];
private static Dictionary<Mobile, WeaponAbilityContext> m_PlayersTable = new Dictionary<Mobile, WeaponAbilityContext>();
private static readonly Dictionary<Mobile, WeaponAbilityContext> m_PlayersTable = new Dictionary<Mobile, WeaponAbilityContext>();
public virtual int BaseMana => 0;
@ -90,7 +90,7 @@ namespace Server.Items
public virtual bool RequiresSE => false;
public static Dictionary<Mobile, WeaponAbility> Table{ get; } = new Dictionary<Mobile, WeaponAbility>();
public static Dictionary<Mobile, WeaponAbility> Table { get; } = new Dictionary<Mobile, WeaponAbility>();
public virtual bool ValidatesDuringHit => true;
@ -254,8 +254,6 @@ namespace Server.Items
return false;
}
#region Dueling
string option = null;
if (this is ArmorIgnore)
@ -305,18 +303,15 @@ namespace Server.Items
else if (this is ArmorPierce)
option = "Armor Pierce";
if (option != null && !DuelContext.AllowSpecialAbility(from, option, true))
return false;
#endregion
return CheckSkills(from) && CheckMana(from, false);
}
public static bool IsWeaponAbility(Mobile m, WeaponAbility a) =>
a == null || !m.Player || m.Weapon is BaseWeapon weapon &&
(weapon.PrimaryAbility == a || weapon.SecondaryAbility == a);
a == null || !m.Player || (m.Weapon is BaseWeapon weapon &&
(weapon.PrimaryAbility == a || weapon.SecondaryAbility == a));
public static WeaponAbility GetCurrentAbility(Mobile m)
{
@ -425,7 +420,7 @@ namespace Server.Items
private class WeaponAbilityTimer : Timer
{
private Mobile m_Mobile;
private readonly Mobile m_Mobile;
public WeaponAbilityTimer(Mobile from) : base(TimeSpan.FromSeconds(3.0))
{
@ -444,7 +439,7 @@ namespace Server.Items
{
public WeaponAbilityContext(Timer timer) => Timer = timer;
public Timer Timer{ get; }
public Timer Timer { get; }
}
}
}

View file

@ -6,7 +6,7 @@ namespace Server.Items
public BladeOfTheRighteous()
{
Hue = 0x47E;
//Slayer = SlayerName.DaemonDismissal;
// Slayer = SlayerName.DaemonDismissal;
Slayer = SlayerName.Exorcism;
WeaponAttributes.HitLeechHits = 50;
WeaponAttributes.UseBestSkill = 1;

View file

@ -2,7 +2,7 @@ namespace Server.Items
{
public class TheDryadBow : Bow
{
private static SkillName[] m_PossibleBonusSkills =
private static readonly SkillName[] m_PossibleBonusSkills =
{
SkillName.Archery,
SkillName.Healing,

View file

@ -136,22 +136,22 @@ namespace Server.Items
switch (version)
{
case 2:
{
m_ShowUsesRemaining = reader.ReadBool();
goto case 1;
}
{
m_ShowUsesRemaining = reader.ReadBool();
goto case 1;
}
case 1:
{
m_UsesRemaining = reader.ReadInt();
goto case 0;
}
{
m_UsesRemaining = reader.ReadInt();
goto case 0;
}
case 0:
{
if (m_UsesRemaining < 1)
m_UsesRemaining = 150;
{
if (m_UsesRemaining < 1)
m_UsesRemaining = 150;
break;
}
break;
}
}
}

View file

@ -51,14 +51,16 @@ namespace Server.Items
return damage;
}
// ReSharper disable once RedundantOverriddenMember
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
}
// ReSharper disable once RedundantOverriddenMember
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -221,13 +221,9 @@ namespace Server.Items
if (Core.AOS)
return;
#region Dueling
if (!DuelContext.AllowSpecialAbility(m, "Disarm", true))
return;
#endregion
double armsValue = m.Skills.ArmsLore.Value;
double wresValue = m.Skills.Wrestling.Value;
@ -254,13 +250,9 @@ namespace Server.Items
if (Core.AOS)
return;
#region Dueling
if (!DuelContext.AllowSpecialAbility(m, "Stun", true))
return;
#endregion
double anatValue = m.Skills.Anatomy.Value;
double wresValue = m.Skills.Wrestling.Value;
@ -289,7 +281,7 @@ namespace Server.Items
private class MoveDelayTimer : Timer
{
private Mobile m_Mobile;
private readonly Mobile m_Mobile;
public MoveDelayTimer(Mobile m) : base(TimeSpan.FromSeconds(10.0))
{

View file

@ -8,8 +8,8 @@ namespace Server.Items
public static readonly TimeSpan AttackEffectDuration = TimeSpan.FromSeconds(10.0);
public static readonly TimeSpan DefenseEffectDuration = TimeSpan.FromSeconds(8.0);
private static HashSet<Mobile> m_AttackTable = new HashSet<Mobile>();
private static HashSet<Mobile> m_DefenseTable = new HashSet<Mobile>();
private static readonly HashSet<Mobile> m_AttackTable = new HashSet<Mobile>();
private static readonly HashSet<Mobile> m_DefenseTable = new HashSet<Mobile>();
public static bool IsUnderAttackEffect(Mobile m) => m_AttackTable.Contains(m);
@ -53,7 +53,7 @@ namespace Server.Items
private class AttackTimer : Timer
{
private Mobile m_Player;
private readonly Mobile m_Player;
public AttackTimer(Mobile player) : base(AttackEffectDuration)
{
@ -69,7 +69,7 @@ namespace Server.Items
private class DefenseTimer : Timer
{
private Mobile m_Player;
private readonly Mobile m_Player;
public DefenseTimer(Mobile player) : base(DefenseEffectDuration)
{

View file

@ -48,7 +48,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private ThrowingDagger m_Dagger;
private readonly ThrowingDagger m_Dagger;
public InternalTarget(ThrowingDagger dagger) : base(10, false, TargetFlags.Harmful) => m_Dagger = dagger;

View file

@ -120,10 +120,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_Charges = reader.ReadInt();
break;
}
{
m_Charges = reader.ReadInt();
break;
}
}
}
}

View file

@ -88,22 +88,22 @@ namespace Server.Items
switch (version)
{
case 2:
{
m_ShowUsesRemaining = reader.ReadBool();
goto case 1;
}
{
m_ShowUsesRemaining = reader.ReadBool();
goto case 1;
}
case 1:
{
m_UsesRemaining = reader.ReadInt();
goto case 0;
}
{
m_UsesRemaining = reader.ReadInt();
goto case 0;
}
case 0:
{
if (m_UsesRemaining < 1)
m_UsesRemaining = 150;
{
if (m_UsesRemaining < 1)
m_UsesRemaining = 150;
break;
}
break;
}
}
}

View file

@ -20,9 +20,9 @@ namespace Server.Items
{
}
public abstract int EffectID{ get; }
public abstract Type AmmoType{ get; }
public abstract Item Ammo{ get; }
public abstract int EffectID { get; }
public abstract Type AmmoType { get; }
public abstract Item Ammo { get; }
public override int DefHitSound => 0x234;
public override int DefMissSound => 0x238;
@ -61,7 +61,7 @@ namespace Server.Items
// Make sure we've been standing still for .25/.5/1 second depending on Era
if (Core.TickCount - attacker.LastMoveTime >= (Core.SE ? 250 : Core.AOS ? 500 : 1000) ||
Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot)
(Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot))
{
bool canSwing = true;
@ -73,10 +73,8 @@ namespace Server.Items
canSwing = !(attacker.Spell is Spell sp) || !sp.IsCasting || !sp.BlocksMovement;
}
#region Dueling
if ((attacker as PlayerMobile)?.DuelContext?.CheckItemEquip(attacker, this) == false)
canSwing = false;
#endregion
if (canSwing && attacker.HarmfulCheck(defender))
{
@ -105,7 +103,7 @@ namespace Server.Items
public override void OnHit(Mobile attacker, Mobile defender, double damageBonus = 1)
{
if (attacker.Player && !defender.Player && (defender.Body.IsAnimal || defender.Body.IsMonster) &&
0.4 >= Utility.RandomDouble())
Utility.RandomDouble() <= 0.4)
defender.AddToBackpack(Ammo);
if (Core.ML && m_Velocity > 0)
@ -129,7 +127,7 @@ namespace Server.Items
public override void OnMiss(Mobile attacker, Mobile defender)
{
if (attacker.Player && 0.4 >= Utility.RandomDouble())
if (attacker.Player && Utility.RandomDouble() <= 0.4)
{
if (Core.SE)
{
@ -208,23 +206,23 @@ namespace Server.Items
switch (version)
{
case 3:
{
m_Balanced = reader.ReadBool();
m_Velocity = reader.ReadInt();
{
m_Balanced = reader.ReadBool();
m_Velocity = reader.ReadInt();
goto case 2;
}
goto case 2;
}
case 2:
case 1:
{
break;
}
{
break;
}
case 0:
{
/*m_EffectID =*/
reader.ReadInt();
break;
}
{
/*m_EffectID =*/
reader.ReadInt();
break;
}
}
if (version < 2)

View file

@ -4,7 +4,7 @@ namespace Server.Items
{
public class SlayerEntry
{
private static int[] m_AosTitles =
private static readonly int[] m_AosTitles =
{
1060479, // undead slayer
1060470, // orc slayer
@ -35,7 +35,7 @@ namespace Server.Items
1070855 // fey slayer
};
private static int[] m_OldTitles =
private static readonly int[] m_OldTitles =
{
1017384, // Silver
1017385, // Orc Slaying
@ -72,11 +72,11 @@ namespace Server.Items
Types = types;
}
public SlayerGroup Group{ get; set; }
public SlayerGroup Group { get; set; }
public SlayerName Name{ get; }
public SlayerName Name { get; }
public Type[] Types{ get; }
public Type[] Types { get; }
public int Title
{

View file

@ -39,13 +39,13 @@ namespace Server.Items
typeof(PestilentBandage), typeof(Revenant), typeof(RevenantLion), typeof(RottingCorpse), typeof(Shade),
typeof(ShadowKnight), typeof(SkeletalKnight), typeof(SkeletalMage), typeof(SkeletalMount), typeof(Skeleton),
typeof(Spectre), typeof(Wraith), typeof(Zombie));
undead.Entries = new SlayerEntry[0];
undead.Entries = Array.Empty<SlayerEntry>();
fey.Opposition = new[] { abyss };
fey.Super = new SlayerEntry(SlayerName.Fey, typeof(Centaur), typeof(CuSidhe), typeof(EtherealWarrior),
typeof(Kirin), typeof(LordOaks), typeof(Pixie), typeof(Silvani), typeof(Treefellow), typeof(Unicorn),
typeof(Wisp), typeof(MLDryad), typeof(Satyr));
fey.Entries = new SlayerEntry[0];
fey.Entries = Array.Empty<SlayerEntry>();
elemental.Opposition = new[] { abyss };
elemental.FoundOn = new[] { typeof(Balron), typeof(Daemon) };
@ -163,17 +163,17 @@ namespace Server.Items
TotalEntries = CompileEntries(Groups);
}
public static SlayerEntry[] TotalEntries{ get; }
public static SlayerEntry[] TotalEntries { get; }
public static SlayerGroup[] Groups{ get; }
public static SlayerGroup[] Groups { get; }
public SlayerGroup[] Opposition{ get; set; }
public SlayerGroup[] Opposition { get; set; }
public SlayerEntry Super{ get; set; }
public SlayerEntry Super { get; set; }
public SlayerEntry[] Entries{ get; set; }
public SlayerEntry[] Entries { get; set; }
public Type[] FoundOn{ get; set; }
public Type[] FoundOn { get; set; }
public static SlayerEntry GetEntryByName(SlayerName name)
{
@ -242,4 +242,4 @@ namespace Server.Items
return false;
}
}
}
}

View file

@ -16,7 +16,7 @@ namespace Server.Items
{
}
//TODO: Pre-AoS stuff
// TODO: Pre-AoS stuff
public override int LabelNumber => 1017413; // Glacial Staff
public override void Serialize(IGenericWriter writer)

View file

@ -58,7 +58,7 @@ namespace Server.Items
private class HerdingTarget : Target
{
private static Type[] m_ChampTamables =
private static readonly Type[] m_ChampTamables =
{
typeof(StrongMongbat), typeof(Imp), typeof(Scorpion), typeof(GiantSpider),
typeof(Snake), typeof(LavaLizard), typeof(Drake), typeof(Dragon),
@ -128,7 +128,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private BaseCreature m_Creature;
private readonly BaseCreature m_Creature;
public InternalTarget(BaseCreature c) : base(10, true, TargetFlags.None) => m_Creature = c;

View file

@ -24,8 +24,6 @@ namespace Server.Items
public override int InitMinHits => 5;
public override int InitMaxHits => 5;
#region ITicket Members
public void OnTicketUsed(Mobile from)
{
if (Utility.RandomDouble() < 0.25)
@ -41,8 +39,6 @@ namespace Server.Items
}
}
#endregion
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);