Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)

This commit is contained in:
Kamron Batman 2019-03-11 14:29:59 -07:00 • committed by GitHub
parent e748af4430
commit 513e54f70e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1094 changed files with 15913 additions and 21892 deletions

View file

@ -9,12 +9,7 @@ namespace Server.Mobiles
private Mobile m_Focus;
[Constructible]
public ArcherGuard() : this(null)
{
}
public ArcherGuard(Mobile target) : base(target)
public ArcherGuard(Mobile target = null) : base(target)
{
InitStats(100, 125, 25);
Title = "the guard";
@ -99,7 +94,7 @@ namespace Server.Mobiles
Combatant = value;
if (oldFocus != null && !oldFocus.Alive)
if (oldFocus?.Alive == false)
Say("Thou hast suffered thy punishment, scoundrel.");
if (value != null)
@ -139,7 +134,7 @@ namespace Server.Mobiles
public override bool OnBeforeDeath()
{
if (m_Focus != null && m_Focus.Alive)
if (m_Focus?.Alive == true)
new AvengeTimer(m_Focus).Start(); // If a guard dies, three more guards will spawn
return base.OnBeforeDeath();
@ -396,4 +391,4 @@ namespace Server.Mobiles
}
}
}
}
}

View file

@ -22,14 +22,9 @@ namespace Server.Mobiles
public abstract Mobile Focus{ get; set; }
public static void Spawn(Mobile caller, Mobile target)
public static void Spawn(Mobile caller, Mobile target, int amount = 1, bool onlyAdditional = false)
{
Spawn(caller, target, 1, false);
}
public static void Spawn(Mobile caller, Mobile target, int amount, bool onlyAdditional)
{
if (target == null || target.Deleted)
if (target?.Deleted != false)
return;
foreach (Mobile m in target.GetMobilesInRange(15))

View file

@ -9,12 +9,7 @@ namespace Server.Mobiles
private Mobile m_Focus;
[Constructible]
public WarriorGuard() : this(null)
{
}
public WarriorGuard(Mobile target) : base(target)
public WarriorGuard(Mobile target = null) : base(target)
{
InitStats(1000, 1000, 1000);
Title = "the guard";
@ -135,7 +130,7 @@ namespace Server.Mobiles
Combatant = value;
if (oldFocus != null && !oldFocus.Alive)
if (oldFocus?.Alive == false)
Say("Thou hast suffered thy punishment, scoundrel.");
if (value != null)
@ -175,7 +170,7 @@ namespace Server.Mobiles
public override bool OnBeforeDeath()
{
if (m_Focus != null && m_Focus.Alive)
if (m_Focus?.Alive == true)
new AvengeTimer(m_Focus).Start(); // If a guard dies, three more guards will spawn
return base.OnBeforeDeath();
@ -386,4 +381,4 @@ namespace Server.Mobiles
}
}
}
}
}