Exemplo n.º 1
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;
                FillHold(gal);
                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);

                m_ActiveZones[zone].Add(captain);
            }
        }
Exemplo n.º 2
0
        public void SpawnShip()
        {
            BaseGalleon gal;

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

            if (gal.CanFit(this.Location, this.Map, gal.ItemID))
            {
                gal.Owner = this;
                gal.MoveToWorld(this.Location, this.Map);
                m_Galleon = gal;

                Server.Engines.Quests.BountyQuestSpawner.FillHold(m_Galleon);

                this.MoveToWorld(new Point3D(gal.X, gal.Y - 1, gal.ZSurface), this.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), this.Map);
                }

                gal.AutoAddCannons(this);

                return;
            }
            else
            {
                gal.Delete();
                Delete();
            }
        }