public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); Dragon = reader.ReadMobile() as ShadowguardGreaterDragon; int count = reader.ReadInt(); Drakes = new List <VileDrake>(); for (int i = 0; i < count; i++) { VileDrake d = reader.ReadMobile() as VileDrake; if (d != null) { Drakes.Add(d); } } if (Dragon == null || Dragon.Deleted) { Expire(); } }
public void SpawnDrake(Point3D p, Mobile from) { if (Drakes == null) { return; } Rectangle2D rec = SpawnRecs[0]; ConvertOffset(ref rec); foreach (Rectangle2D r in SpawnRecs) { Rectangle2D copy = r; ConvertOffset(ref copy); if (copy.Contains(p)) { rec = copy; break; } } while (true) { int x = Utility.RandomMinMax(rec.X, rec.X + rec.Width); int y = Utility.RandomMinMax(rec.Y, rec.Y + rec.Height); int z = Map.TerMur.GetAverageZ(x, y); if (Map.TerMur.CanSpawnMobile(x, y, z)) { var drake = new VileDrake(); drake.MoveToWorld(new Point3D(x, y, z), Map.TerMur); Timer.DelayCall(TimeSpan.FromSeconds(.5), () => drake.Combatant = from); Drakes.Add(drake); break; } } }