Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,12 +9,8 @@ namespace Server.Mobiles
|
|||
private bool m_Stunning;
|
||||
|
||||
[Constructible]
|
||||
public Golem() : this(false, 1.0)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Golem(bool summoned, double scalar) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.4, 0.8)
|
||||
public Golem(bool summoned = false, double scalar = 1.0) :
|
||||
base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.4, 0.8)
|
||||
{
|
||||
Body = 752;
|
||||
|
||||
|
|
@ -192,12 +188,9 @@ namespace Server.Mobiles
|
|||
{
|
||||
if (Controlled || Summoned)
|
||||
{
|
||||
Mobile master = ControlMaster;
|
||||
Mobile master = ControlMaster ?? SummonMaster;
|
||||
|
||||
if (master == null)
|
||||
master = SummonMaster;
|
||||
|
||||
if (master != null && master.Player && master.Map == Map && master.InRange(Location, 20))
|
||||
if (master?.Player == true && master.Map == Map && master.InRange(Location, 20))
|
||||
{
|
||||
if (master.Mana >= amount)
|
||||
{
|
||||
|
|
@ -227,4 +220,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,10 +205,10 @@ namespace Server.Mobiles
|
|||
|
||||
foreach (Corpse item in eable)
|
||||
// Ensure that the corpse was killed by us
|
||||
if (item.Killer == this && item.Owner != null)
|
||||
if (!item.DevourCorpse() && !item.Devoured)
|
||||
PublicOverheadMessage(MessageType.Emote, 0x3B2,
|
||||
1053032); // * The plague beast attempts to absorb the remains, but cannot! *
|
||||
if (item.Killer == this && item.Owner != null && !item.DevourCorpse() && !item.Devoured)
|
||||
PublicOverheadMessage(MessageType.Emote, 0x3B2,
|
||||
1053032); // * The plague beast attempts to absorb the remains, but cannot! *
|
||||
|
||||
eable.Free();
|
||||
}
|
||||
|
||||
|
|
@ -245,4 +245,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile m = state.Mobile;
|
||||
|
||||
if (m != null && m.Player && m != from)
|
||||
if (m?.Player == true && m != from)
|
||||
PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1071919, from.Name,
|
||||
m.NetState); // * ~1_VAL~ slices through the plague beast's amorphous tissue *
|
||||
}
|
||||
|
|
@ -305,7 +305,7 @@ namespace Server.Mobiles
|
|||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (m_Lord == null || m_Lord.Deleted)
|
||||
if (m_Lord?.Deleted != false)
|
||||
{
|
||||
Stop();
|
||||
return;
|
||||
|
|
@ -350,4 +350,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,8 @@ namespace Server.Mobiles
|
|||
{
|
||||
public class PlagueSpawn : BaseCreature
|
||||
{
|
||||
[Constructible]
|
||||
public PlagueSpawn() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public PlagueSpawn(Mobile owner) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public PlagueSpawn(Mobile owner = null) :
|
||||
base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
Owner = owner;
|
||||
ExpireTime = DateTime.UtcNow + TimeSpan.FromMinutes(1.0);
|
||||
|
|
@ -132,4 +128,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Mobile combatant = Combatant;
|
||||
|
||||
if (combatant == null || combatant.Deleted || combatant.Map != Map || !InRange(combatant, 12) ||
|
||||
if (combatant?.Deleted != false || combatant.Map != Map || !InRange(combatant, 12) ||
|
||||
!CanBeHarmful(combatant) || !InLOS(combatant))
|
||||
return;
|
||||
|
||||
|
|
@ -109,4 +109,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue