Beispiel #1
0
 public bool MasterBlessCheck(ShrineMaster master)
 {
     return(master != null && Spawn != null && Spawn.ContainsKey(master) && !Spawn[master].Any(x => x.Alive));
 }
Beispiel #2
0
        public void BeginInvasion()
        {
            if (m_Active || Deleted)
            {
                return;
            }

            m_Active = true;

            List <Rectangle2D> SpawnZones = Defs[Shrine].ToList();

            for (int i = 0; i < 3; i++)
            {
                Rectangle2D spawnrec = SpawnZones[Utility.Random(SpawnZones.Count)];
                SpawnZones.Remove(spawnrec);

                Point3D p = Point3D.Zero;

                do
                {
                    p = Map.GetRandomSpawnPoint(spawnrec);
                }while (p == Point3D.Zero || !Map.CanSpawnMobile(p));

                List <Point3D> points = new List <Point3D>();

                Misc.Geometry.Circle2D(p, Map, 4, (pnt, map) =>
                {
                    if (Map.CanSpawnMobile(pnt.X, pnt.Y, pnt.Z))
                    {
                        points.Add(pnt);
                    }
                });

                if (points.Count == 0)
                {
                    points.Add(p);
                }

                MasterType type = (MasterType)Utility.Random(9);

                List <BaseCreature> list = new List <BaseCreature>();

                for (int s = 0; s < 10; s++)
                {
                    BaseCreature bc = Activator.CreateInstance(_SpawnTable[(int)type][Utility.Random(_SpawnTable[(int)type].Length)]) as BaseCreature;

                    bc.Kills = 100;

                    if (bc.FightMode == FightMode.Evil)
                    {
                        bc.FightMode = FightMode.Aggressor;
                    }

                    list.Add(bc);

                    Point3D point = points[Utility.Random(points.Count)];

                    SpawnMobile(bc, point);
                }

                ShrineMaster capt = new ShrineMaster(type, this);
                capt.Blessed     = true;
                capt._Controller = this;
                Spawn[capt]      = list;
                SpawnMobile(capt, p);
            }
        }