Exemple #1
0
        public void SpawnShip()
        {
            BaseGalleon gal;

            if (this is PirateCaptain)
            {
                gal = new OrcishGalleon(Direction.North);
            }
            else if (Map == Map.Tokuno)
            {
                gal = new TokunoGalleon(Direction.North);
            }
            else
            {
                gal = new GargishGalleon(Direction.North);
            }

            var p   = Location;
            Map map = Map;

            // Move this sucka out of the way!
            Internalize();

            if (gal.CanFit(p, map, gal.ItemID))
            {
                gal.Owner = this;
                gal.MoveToWorld(p, map);
                m_Galleon = gal;

                Server.Engines.Quests.BountyQuestSpawner.FillHold(m_Galleon);
                MoveToWorld(new Point3D(p.X, p.Y - 1, gal.Z + gal.ZSurface), map);

                int crewCount = Utility.RandomMinMax(3, 5);

                for (int j = 0; j < crewCount; j++)
                {
                    Mobile crew = new PirateCrew();

                    if (j == 0 && this is PirateCaptain)
                    {
                        crew.Title = "the orc captain";
                    }

                    AddToCrew(crew);
                    crew.MoveToWorld(new Point3D(gal.X + Utility.RandomList(-1, 1), gal.Y + Utility.RandomList(-1, 0, 1), gal.ZSurface), map);
                }

                gal.AutoAddCannons(this);

                return;
            }
            else
            {
                gal.Delete();
                Delete();
            }
        }
Exemple #2
0
        public void SpawnMerchantAndGalleon(SpawnZone zone, Map map)
        {
            SpawnDefinition def = m_Zones[zone];

            if (map != Map.Internal && map != null)
            {
                Rectangle2D rec  = def.SpawnRegion;
                bool        garg = Utility.RandomBool();
                BaseGalleon gal;
                Point3D     p       = Point3D.Zero;
                bool        spawned = false;

                if (garg)
                {
                    gal = new GargishGalleon(Direction.North);
                }
                else
                {
                    gal = new TokunoGalleon(Direction.North);
                }

                MerchantCaptain captain = new MerchantCaptain(gal);

                for (int i = 0; i < 25; i++)
                {
                    int x = Utility.Random(rec.X, rec.Width);
                    int y = Utility.Random(rec.Y, rec.Height);
                    p = new Point3D(x, y, -5);

                    if (gal.CanFit(p, map, gal.ItemID))
                    {
                        spawned = true;
                        break;
                    }
                }

                if (!spawned)
                {
                    gal.Delete();
                    captain.Delete();
                    return;
                }

                gal.Owner    = captain;
                captain.Zone = zone;
                gal.MoveToWorld(p, map);
                gal.AutoAddCannons(captain);
                captain.MoveToWorld(new Point3D(gal.X, gal.Y - 1, gal.ZSurface), map);

                int crewCount = Utility.RandomMinMax(3, 5);

                for (int i = 0; i < crewCount; i++)
                {
                    Mobile crew = new MerchantCrew();
                    captain.AddToCrew(crew);
                    crew.MoveToWorld(new Point3D(gal.X + Utility.RandomList(-1, 1), gal.Y + Utility.RandomList(-1, 0, 1), gal.ZSurface), map);
                }

                Point2D[] course = def.GetRandomWaypoints();
                gal.BoatCourse = new BoatCourse(gal, new List <Point2D>(def.GetRandomWaypoints()));

                gal.NextNavPoint = 0;
                gal.StartCourse(false, false);

                FillHold(gal);

                m_ActiveZones[zone].Add(captain);
            }
        }