Esempio n. 1
0
 internal bool CanMonsterMoveInDirection(MapPointDetails mapPointDetails)
 {
     if (mapPointDetails.Description == "Impenetrable terrain!" || mapPointDetails.MonsterCanPass == false)
     {
         return(false);
     }
     return(true);
 }
Esempio n. 2
0
        public MapPointDetails[] CreateMap(int width, int height)
        {
            int mapWidth = width * 2;
            int index    = 0;

            var map = new MapPointDetails[width * height];

            for (int i = 0; i < height; i++)
            {
                for (int j = 0; j < mapWidth; j += 2)
                {
                    if (i == 0 || j == 0 || index > ((height - 1) * width) - 1 || (index + 1) % (width) == 0) //making the edges impenetrable.
                    {
                        map[index] = (new MapPointDetails("#", "Impenetrable terrain!",
                                                          new MapPoint(j, i)));
                    }
                    else if (index == 108)
                    {
                        map[index] = (new MapPointDetails(".", "A strange sandy dry desert...",
                                                          new MapPoint(j, i), 2, false));
                    }
                    else if (index == 216)
                    {
                        map[index] = (new MapPointDetails(".", "A strange sandy dry desert...",
                                                          new MapPoint(j, i), 3, false));
                    }
                    else if ((j == mapWidth / 3) || (j == mapWidth / 3 * 2))
                    {
                        map[index] = (new MapPointDetails("#", "Impenetrable terrain!",
                                                          new MapPoint(j, i)));
                    }
                    else
                    {
                        map[index] = (new MapPointDetails(".", "A strange sandy dry desert...",
                                                          new MapPoint(j, i)));
                    }

                    index++;
                }
            }

            return(map);
        }
Esempio n. 3
0
        public bool CanPlayerMoveInDirection(MapPointDetails mapPointDetails)
        {
            var player = _world.Get <PlayerStats>();

            if (player.InCombat == true)
            {
                _message.InCombatMessage();
                _world.LinesTypedInMessageBox++;
                return(false);
            }
            if (mapPointDetails.Description == "Impenetrable terrain!")
            {
                _message.WrongDirectionMessage(_world.WrongDirectionCount++);
                _world.LinesTypedInMessageBox++;
                return(false);
            }
            if (mapPointDetails.LevelNeededToEnter > player.Level)
            {
                _message.LevelTooLowMessage();
                _world.LinesTypedInMessageBox++;
                return(false);
            }
            if (_world.LinesTypedInMessageBox > 0)
            {
                RemoveExtraText();
                _world.LinesTypedInMessageBox = 0;
                _world.WrongDirectionCount    = 0;
            }

            if (_world.LinesTypedInCombatBox > 0)
            {
                RemoveCombatText();
                _world.LinesTypedInCombatBox = 0;
            }
            return(true);
        }