Reorganizes Project (#41)

This commit is contained in:
Kamron Batman 2019-08-02 18:13:40 -07:00 committed by GitHub
parent 08bf44af9a
commit 3614a66aee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3499 changed files with 79 additions and 55 deletions

View file

@ -0,0 +1,75 @@
using Server.Items;
namespace Server.Mobiles
{
public abstract class BaseGuard : Mobile
{
public BaseGuard(Mobile target)
{
if (target != null)
{
Location = target.Location;
Map = target.Map;
Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x3728, 10, 10,
5023);
}
}
public BaseGuard(Serial serial) : base(serial)
{
}
public abstract Mobile Focus{ get; set; }
public static void Spawn(Mobile caller, Mobile target, int amount = 1, bool onlyAdditional = false)
{
if (target?.Deleted != false)
return;
foreach (Mobile m in target.GetMobilesInRange(15))
if (m is BaseGuard g)
{
if (g.Focus == null) // idling
{
g.Focus = target;
--amount;
}
else if (g.Focus == target && !onlyAdditional)
{
--amount;
}
}
while (amount-- > 0)
caller.Region.MakeGuard(target);
}
public override bool OnBeforeDeath()
{
Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x3728, 10, 10,
2023);
PlaySound(0x1FE);
Delete();
return false;
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}