Example #1
0
            public bool detonateLocation(Point3D location)
            {
                IPooledEnumerable items     = DetonateMap.GetItemsInRange(location, 0);
                ArrayList         todestroy = new ArrayList();

                foreach (Item item in items)
                {
                    if (item is BombermanStone)
                    {
                        BombermanStone stone = (BombermanStone)item;
                        if (stone.Destructable)
                        {
                            Effects.SendLocationEffect(location, DetonateMap, 0x36CB, 10);
                            todestroy.Add(stone);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
                items.Free();

                for (int i = 0; i < todestroy.Count; i++)
                {
                    if ((todestroy[i]) != null)
                    {
                        ((BombermanStone)todestroy[i]).destroy();
                    }
                }
                if (todestroy.Count > 0)
                {
                    return(false);
                }

                Effects.SendLocationEffect(location, DetonateMap, 0x36CB, 10);
                ArrayList         tokill  = new ArrayList();
                IPooledEnumerable mobiles = DetonateMap.GetMobilesInRange(location, 0);

                foreach (Mobile mobile in mobiles)
                {
                    tokill.Add(mobile);
                }
                mobiles.Free();

                for (int i = 0; i < tokill.Count; i++)
                {
                    if (((Mobile)tokill[i]).NetState != null)
                    {
                        if (((Mobile)tokill[i]).CanBeDamaged())
                        {
                            /*if(m_Game == null)
                             *  Console.WriteLine("game");
                             * if(tokill[i] == null)
                             *  Console.WriteLine("tokill");
                             * if(m_Owner == null)
                             *  Console.WriteLine("owner");*/
                            if (tokill[i] == m_Owner)
                            {
                                m_Game.AnnounceToPlayers(2593, (m_Owner.Name + " has killed himself"));
                            }
                            else
                            {
                                m_Game.AnnounceToPlayers(2593, ((Mobile)tokill[i]).Name + " has been killed by " + m_Owner.Name);
                            }
                            ((Mobile)tokill[i]).Kill();
                        }
                    }
                }

                return(true);
            }
Example #2
0
        public override void StartGame(Mobile gm)
        {
            base.StartGame(gm);

            m_GameItems = new List<Item>();

            Rectangle2D playerarea = new Rectangle2D(GameAreaStartPoint.X, GameAreaStartPoint.Y,
                                                     GameAreaEndPoint.X - GameAreaStartPoint.X + 1,
                                                     GameAreaEndPoint.Y - GameAreaStartPoint.Y + 1);
            IPooledEnumerable players = Map.GetMobilesInBounds(playerarea);
            foreach (Mobile player in players)
            {
                if (player.AccessLevel == AccessLevel.Player)
                    AddPlayer(player);
            }

            #region Create stones for gamearea
            int startx = m_GameArea.Start.X;
            int starty = m_GameArea.Start.Y;
            int endx = m_GameArea.End.X;
            int endy = m_GameArea.End.Y;

            BombermanStone stone;
            for (int x = 0; x <= endx - startx; ++x)
            {
                for (int y = 0; y <= endy - starty; ++y)
                {
                    if(x != 0 && x != endx - startx && y != 0 && y != endy - starty)
                    {
                        if (x % 2 == 1 && y % 2 == 1)
                        {
                            stone = new BombermanStone(false, this);
                        }
                        else
                        {
                            stone = new BombermanStone(true, this);
                        }
                        stone.MoveToWorld(new Point3D(startx + x, starty + y, Map.Tiles.GetLandTile(startx + x, starty + y).Z), Map);
                        m_GameItems.Add(stone);
                    }
                    else if ((x == 0 || x == endx - startx) && y > 1 && y < endy - starty - 1)
                    {
                        stone = new BombermanStone(true, this);
                        stone.MoveToWorld(new Point3D(startx + x, starty + y, Map.Tiles.GetLandTile(startx + x, starty + y).Z), Map);
                        m_GameItems.Add(stone);
                    }
                    else if ((y == 0 || y == endy - starty) && x > 1 && x < endx - startx - 1)
                    {
                        stone = new BombermanStone(true, this);
                        stone.MoveToWorld(new Point3D(startx + x, starty + y, Map.Tiles.GetLandTile(startx + x, starty + y).Z), Map);
                        m_GameItems.Add(stone);
                    }
                }
            }
            #endregion

            #region Handle players: location, items, etc
            Point2D upleft = m_GameArea.Start;
            Point2D downright = m_GameArea.End;
            Point2D upright = new Point2D(downright.X, upleft.Y);
            Point2D downleft = new Point2D(upleft.X, downright.Y);

            byte index = 0;
            List<Mobile> toRemove = new List<Mobile>();
            foreach (Mobile m in Players)
            {
                switch (index++)
                {
                    case 0:
                        m.Location = new Point3D(upleft, Map.Tiles.GetLandTile(upleft.X, upleft.Y).Z);
                        break;
                    case 1:
                        m.Location = new Point3D(downright, Map.Tiles.GetLandTile(upright.X, upright.Y).Z);
                        break;
                    case 2:
                        m.Location = new Point3D(downleft, Map.Tiles.GetLandTile(downleft.X, downleft.Y).Z);
                        break;
                    case 3:
                        m.Location = new Point3D(upright, Map.Tiles.GetLandTile(downright.X, downright.Y).Z);
                        break;
                    default:
                        toRemove.Add(m);
                        PublicOverheadMessage(MessageType.Regular, 906, true, "There are more than 4 mobiles in the game area.");
                        break;
                }
            }

            foreach (Mobile mob in toRemove)
            {
                RemovePlayer(mob);
            }
            #endregion

            StartTimer timer = new StartTimer(this);
            timer.Start();

            gm.SendMessage("The game has been started.");
        }
Example #3
0
        public override void StartGame(Mobile gm)
        {
            base.StartGame(gm);

            m_GameItems = new List <Item>();

            Rectangle2D playerarea = new Rectangle2D(GameAreaStartPoint.X, GameAreaStartPoint.Y,
                                                     GameAreaEndPoint.X - GameAreaStartPoint.X + 1,
                                                     GameAreaEndPoint.Y - GameAreaStartPoint.Y + 1);
            IPooledEnumerable players = Map.GetMobilesInBounds(playerarea);

            foreach (Mobile player in players)
            {
                if (player.AccessLevel == AccessLevel.Player)
                {
                    AddPlayer(player);
                }
            }

            #region Create stones for gamearea
            int startx = m_GameArea.Start.X;
            int starty = m_GameArea.Start.Y;
            int endx   = m_GameArea.End.X;
            int endy   = m_GameArea.End.Y;

            BombermanStone stone;
            for (int x = 0; x <= endx - startx; ++x)
            {
                for (int y = 0; y <= endy - starty; ++y)
                {
                    if (x != 0 && x != endx - startx && y != 0 && y != endy - starty)
                    {
                        if (x % 2 == 1 && y % 2 == 1)
                        {
                            stone = new BombermanStone(false, this);
                        }
                        else
                        {
                            stone = new BombermanStone(true, this);
                        }
                        stone.MoveToWorld(new Point3D(startx + x, starty + y, Map.Tiles.GetLandTile(startx + x, starty + y).Z), Map);
                        m_GameItems.Add(stone);
                    }
                    else if ((x == 0 || x == endx - startx) && y > 1 && y < endy - starty - 1)
                    {
                        stone = new BombermanStone(true, this);
                        stone.MoveToWorld(new Point3D(startx + x, starty + y, Map.Tiles.GetLandTile(startx + x, starty + y).Z), Map);
                        m_GameItems.Add(stone);
                    }
                    else if ((y == 0 || y == endy - starty) && x > 1 && x < endx - startx - 1)
                    {
                        stone = new BombermanStone(true, this);
                        stone.MoveToWorld(new Point3D(startx + x, starty + y, Map.Tiles.GetLandTile(startx + x, starty + y).Z), Map);
                        m_GameItems.Add(stone);
                    }
                }
            }
            #endregion

            #region Handle players: location, items, etc
            Point2D upleft    = m_GameArea.Start;
            Point2D downright = m_GameArea.End;
            Point2D upright   = new Point2D(downright.X, upleft.Y);
            Point2D downleft  = new Point2D(upleft.X, downright.Y);

            byte          index    = 0;
            List <Mobile> toRemove = new List <Mobile>();
            foreach (Mobile m in Players)
            {
                switch (index++)
                {
                case 0:
                    m.Location = new Point3D(upleft, Map.Tiles.GetLandTile(upleft.X, upleft.Y).Z);
                    break;

                case 1:
                    m.Location = new Point3D(downright, Map.Tiles.GetLandTile(upright.X, upright.Y).Z);
                    break;

                case 2:
                    m.Location = new Point3D(downleft, Map.Tiles.GetLandTile(downleft.X, downleft.Y).Z);
                    break;

                case 3:
                    m.Location = new Point3D(upright, Map.Tiles.GetLandTile(downright.X, downright.Y).Z);
                    break;

                default:
                    toRemove.Add(m);
                    PublicOverheadMessage(MessageType.Regular, 906, true, "There are more than 4 mobiles in the game area.");
                    break;
                }
            }

            foreach (Mobile mob in toRemove)
            {
                RemovePlayer(mob);
            }
            #endregion

            StartTimer timer = new StartTimer(this);
            timer.Start();

            gm.SendMessage("The game has been started.");
        }