예제 #1
0
        public void DoDelayedSpawn(object o)
        {
            object[] ojs  = (object[])o;
            Mobile   from = (Mobile)ojs[0];
            Point3D  pnt  = (Point3D)ojs[1];
            Map      map  = (Map)ojs[2];
            BaseBoat boat = (BaseBoat)ojs[3];

            int x = pnt.X, y = pnt.Y;

            m_Charydbis.MoveToWorld(new Point3D(x, y, map.GetAverageZ(pnt.X, pnt.Y)), map);
            m_Charydbis.Combatant = from;

            from.SendMessage("THATS NO FISH!");

            if (boat != null)
            {
                pnt = boat.Location;
            }

            for (int i = 0; i < 8; i++)
            {
                x = pnt.X; y = pnt.Y;
                if (TrySpawnMobile(ref x, ref y, map))
                {
                    GiantTentacle tent = new GiantTentacle(m_Charydbis);
                    m_Charydbis.AddTentacle(tent);
                    tent.MoveToWorld(new Point3D(x, y, -5), map);
                }
            }
        }
예제 #2
0
파일: Charybdis.cs 프로젝트: pallop/Servuo
        public void SpawnTentacle()
        {
            if (this.Combatant == null)
            {
                m_NextSpawn = DateTime.UtcNow + SpawnRate;
                return;
            }

            Map map = this.Map;

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

            IPooledEnumerable eable = this.GetMobilesInRange(15);

            foreach (Mobile m in eable)
            {
                if (m == this || !CanBeHarmful(m))
                {
                    continue;
                }

                if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned || ((BaseCreature)m).Team != this.Team))
                {
                    list.Add(m);
                }
                else if (m.Player)
                {
                    list.Add(m);
                }
            }
            eable.Free();

            if (list.Count > 0)
            {
                Mobile   spawn = list[Utility.Random(list.Count)];
                BaseBoat boat  = BaseBoat.FindBoatAt(spawn, map);
                Point3D  loc   = spawn.Location;

                for (int i = 0; i < 25; i++)
                {
                    Point3D spawnLoc = Point3D.Zero;

                    if (boat != null)
                    {
                        spawnLoc = GetValidPoint(boat, map, 4);
                    }
                    else
                    {
                        int y = Utility.RandomMinMax(loc.X - 10, loc.Y + 10);
                        int x = Utility.RandomMinMax(loc.X - 10, loc.Y + 10);
                        int z = map.GetAverageZ(x, y);

                        spawnLoc = new Point3D(x, y, z);
                    }

                    if (Spells.SpellHelper.CheckMulti(spawnLoc, map))
                    {
                        continue;
                    }

                    LandTile t = map.Tiles.GetLandTile(spawnLoc.X, spawnLoc.Y);

                    if (IsSeaTile(t) && spawnLoc != Point3D.Zero)
                    {
                        GiantTentacle tent = new GiantTentacle(this);

                        tent.MoveToWorld(spawnLoc, map);
                        tent.Home      = tent.Location;
                        tent.RangeHome = 15;
                        tent.Team      = this.Team;
                        if (spawn != this)
                        {
                            tent.Combatant = spawn;
                        }
                        break;
                    }
                }
            }

            m_NextSpawn = DateTime.UtcNow + SpawnRate;
        }
예제 #3
0
        public void DoDelayedSpawn(object o)
        {
            object[] ojs = (object[])o;
            Mobile from = (Mobile)ojs[0];
            Point3D pnt = (Point3D)ojs[1];
            Map map = (Map)ojs[2];
            BaseBoat boat = (BaseBoat)ojs[3];

            int x = pnt.X, y = pnt.Y;

            m_Charydbis.MoveToWorld(new Point3D(x, y, map.GetAverageZ(pnt.X, pnt.Y)), map);
            m_Charydbis.Combatant = from;

            from.SendMessage("THATS NO FISH!");

            if (boat != null)
            {
                pnt = boat.Location;
            }

            for (int i = 0; i < 8; i++)
            {
                x = pnt.X; y = pnt.Y;
                if (TrySpawnMobile(ref x, ref y, map))
                {
                    GiantTentacle tent = new GiantTentacle(m_Charydbis);
                    m_Charydbis.AddTentacle(tent);
                    tent.MoveToWorld(new Point3D(x, y, -5), map);
                }
            }
        }
예제 #4
0
        public void SpawnTentacle()
        {
            if (this.Combatant == null)
            {
                m_NextSpawn = DateTime.UtcNow + SpawnRate;
                return;
            }

            Map map = this.Map;

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

            IPooledEnumerable eable = this.GetMobilesInRange(15);
            foreach (Mobile m in eable)
            {
                if (m == this || !CanBeHarmful(m))
                    continue;

                if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned || ((BaseCreature)m).Team != this.Team))
                    list.Add(m);
                else if (m.Player)
                    list.Add(m);
            }
            eable.Free();

            if (list.Count > 0)
            {
                Mobile spawn = list[Utility.Random(list.Count)];
                BaseBoat boat = BaseBoat.FindBoatAt(spawn, map);
                Point3D loc = spawn.Location;

                for (int i = 0; i < 25; i++)
                {
                    Point3D spawnLoc = Point3D.Zero;

                    if (boat != null)
                        spawnLoc = GetValidPoint(boat, map, 4);
                    else
                    {
                        int y = Utility.RandomMinMax(loc.X - 10, loc.Y + 10);
                        int x = Utility.RandomMinMax(loc.X - 10, loc.Y + 10);
                        int z = map.GetAverageZ(x, y);

                        spawnLoc = new Point3D(x, y, z);
                    }

                    if (Spells.SpellHelper.CheckMulti(spawnLoc, map))
                        continue;

                    LandTile t = map.Tiles.GetLandTile(spawnLoc.X, spawnLoc.Y);

                    if (IsSeaTile(t) && spawnLoc != Point3D.Zero)
                    {
                        GiantTentacle tent = new GiantTentacle(this);

                        tent.MoveToWorld(spawnLoc, map);
                        tent.Home = tent.Location;
                        tent.RangeHome = 15;
                        tent.Team = this.Team;
                        if (spawn != this)
                            tent.Combatant = spawn;
                        break;
                    }

                }
            }

            m_NextSpawn = DateTime.UtcNow + SpawnRate;
        }