Exemple #1
0
        protected override bool PerformAbility()
        {
            DungeonMap map    = Game.DungeonMap;
            Player     player = Game.Player;

            if (player.Mana < _manaCost)
            {
                Game.MessageLog.Add($"You don't have enough mana to use this skill. It costs {_manaCost} mana points", Swatch.DbBlood);

                return(false);
            }
            else
            {
                player.Mana -= _manaCost;

                foreach (ICell cell in map.GetAllCells())
                {
                    if (cell.IsWalkable)
                    {
                        map.SetCellProperties(cell.X, cell.Y, cell.IsTransparent, cell.IsWalkable, true);
                    }
                }
                Game.MessageLog.Add($"You cast {Name} and gains knowledge of the surrounding area");

                return(true);
            }
        }
Exemple #2
0
        protected override bool UseItem()
        {
            DungeonMap map = Game.DungeonMap;

            Game.MessageLog.Add($"You read the {Name} and gains knowledge of the surrounding area");

            foreach (ICell cell in map.GetAllCells())
            {
                if (cell.IsWalkable)
                {
                    map.SetCellProperties(cell.X, cell.Y, cell.IsTransparent, cell.IsWalkable, true);
                }
            }

            RemainingUses--;
            return(true);
        }
    protected override bool UseItem()
    {
        DungeonMap map = Game.DungeonMap;

        Game.MessageLog.Add(string.Format("{0} reads a {1} and gains knowledge of the surrounding area", Game.Player.Name, Name));

        foreach (RogueSharp.Cell cell in map.GetAllCells())
        {
            if (cell.IsWalkable)
            {
                map.SetCellProperties(cell.X, cell.Y, cell.IsTransparent, cell.IsWalkable, true);
            }
        }

        RemainingUses--;

        return(true);
    }
Exemple #4
0
        /// <summary>
        /// Creates the overworld and places a town in it
        /// </summary>
        /// <returns></returns>
        public DungeonMap CreateWorld()
        {
            // Set the properties of all cells to false
            _map.Initialize(_width, _height);

            // Make every tile a grass tile, walls around the edges
            foreach (Cell cell in _map.GetAllCells())
            {
                // As long as we aren't on the border....
                if (cell.X != 0 && cell.Y != 0 && cell.X != _width - 1 && cell.Y != _height - 1)
                {
                    // High percentage change to plant a tree
                    if (Dice.Roll("1d100") > 92)
                    {
                        _map.SetCellProperties(cell.X, cell.Y, false, false, false);
                        _map.Plants.Add(new Tree(
                                            cell.X,
                                            cell.Y
                                            ));
                    }
                    // Or plant some grass
                    else
                    {
                        _map.SetCellProperties(cell.X, cell.Y, true, true, false);
                        _map.Plants.Add(new Grass(
                                            cell.X,
                                            cell.Y
                                            ));
                    }
                }
            }

            // Now add the stairs- only down- before we add the player
            CreateDownStairs();

            // Now that our rooms and hallways are done, place the player in the middle
            // of the first room
            PlacePlayerInOverworld();

            // Now that the player is placed, place the monsters!
            PlaceMonsters();

            return(_map);
        }
Exemple #5
0
        private void MakeRoom(DungeonMap map, Rectangle Room)
        {
            foreach (Cell cell in map.GetAllCells())
            {
                map.SetCellProperties(cell.X, cell.Y, true, true, true);
            }

            // Set the first and last rows in the map to not be transparent or walkable
            foreach (Cell cell in map.GetCellsInRows(0, _height - 1))
            {
                map.SetCellProperties(cell.X, cell.Y, false, false, true);
            }

            // Set the first and last columns in the map to not be transparent or walkable
            foreach (Cell cell in map.GetCellsInColumns(0, _width - 1))
            {
                map.SetCellProperties(cell.X, cell.Y, false, false, true);
            }
        }
        public DungeonMap CreateMap()
        {
            _map.Initialize(_width, _height);

            foreach (Cell cell in _map.GetAllCells())
            {
                _map.SetCellProperties(cell.X, cell.Y, true, true, true);
            }
            foreach (Cell cell in _map.GetCellsInRows(0, _height - 1))
            {
                _map.SetCellProperties(cell.X, cell.Y, false, false, true);
            }
            foreach (Cell cell in _map.GetCellsInColumns(0, _width - 1))
            {
                _map.SetCellProperties(cell.X, cell.Y, false, false, true);
            }

            return(_map);
        }
Exemple #7
0
        public void MakeExteriorWall(DungeonMap map, Rectangle rect)
        {
            int height = rect.Height;
            int width  = rect.Width;

            foreach (Cell cell in map.GetAllCells())
            {
                map.SetCellProperties(cell.X, cell.Y, true, true, true);
            }
            foreach (Cell cell in map.GetCellsInRows(0, height - 1))
            {
                map.SetCellProperties(cell.X, cell.Y, false, false, true);
            }

            // Set the first and last columns in the map to not be transparent or walkable
            foreach (Cell cell in map.GetCellsInColumns(0, width - 1))
            {
                map.SetCellProperties(cell.X, cell.Y, false, false, true);
            }
        }
        public DungeonMap CreateForrest()
        {
            _map.Initialize(_width, _height);

            Rectangle newRoom = new Rectangle(0, 0, _width - 1, _height - 1);

            _map.Rooms.Add(newRoom);

            foreach (Rectangle room in _map.Rooms)
            {
                CreateMap(room);
            }

            foreach (ICell cell in _map.GetAllCells())
            {
                if (cell.X != 0 && cell.Y != 0 && cell.X != _width - 1 && cell.Y != _height - 1)
                {
                    if (Dice.Roll("1d100") > 95)
                    {
                        _map.SetCellProperties(cell.X, cell.Y, false, false, false);
                        _map.Plants.Add(new Tree(cell.X, cell.Y));
                    }
                    else
                    {
                        _map.SetCellProperties(cell.X, cell.Y, true, true, false);
                        _map.Plants.Add(new Grass(cell.X, cell.Y));
                    }
                }
            }

            PlacePlayerInForrest();
            CreateForrestStairs();
            PlaceMonstersInRoom(true, 10);
            PlaceFoodInRoom(true, 2, 1);
            PlaceItemsInRoom(true, 6);
            PlaceEquipmentInRoom(true, 2);
            PlaceTrapsInRoom(true, 4);

            return(_map);
        }
Exemple #9
0
        //Simple map plan
        public DungeonMap CreateMap()
        {
            //Initialize every cell
            //See in sight, walkable, explored, etc.
            _map.Initialize(_width, _height);
            foreach (Cell cell in _map.GetAllCells())
            {
                _map.SetCellProperties(cell.X, cell.Y, false, true, true);
            }
            //Set the first and last rows in the map to not be transparent or walkable
            foreach (Cell cell in _map.GetCellsInRows(0, _height - 1))
            {
                _map.SetCellProperties(cell.X, cell.Y, false, false, true);
            }
            //Set the first and last columns in the map to not be transparent or walkable
            foreach (Cell cell in _map.GetCellsInColumns(0, _width - 1))
            {
                _map.SetCellProperties(cell.X, cell.Y, false, false, true);
            }

            return(_map);
        }
Exemple #10
0
        // generate a new map
        public DungeonMap CreateMap()
        {
            // init every cell in the map by setting walk, transparency and explored to true
            _map.Initialize(_width, _height);
            foreach (Cell cell in _map.GetAllCells())
            {
                _map.SetCellProperties(cell.X, cell.Y, true, true, true);
            }

            // set the first and last rows in the map to not be transparent or walk
            foreach (Cell cell in _map.GetCellsInRows(0, _height - 1))
            {
                _map.SetCellProperties(cell.X, cell.Y, false, false, true);
            }

            // set the first and last columns in the map to not be transparent or walk
            foreach (Cell cell in _map.GetCellsInColumns(0, _width - 1))
            {
                _map.SetCellProperties(cell.X, cell.Y, false, false, true);
            }

            return(_map);
        }