Exemplo n.º 1
0
        /// <summary>
        /// list all locations other than the current location
        /// </summary>
        /// <param name="gameadventurer">game Adventurer object</param>
        /// <param name="worldAreaLocations">list of all World area locations</param>
        /// <returns></returns>
        public static string Travel(Adventurer gameadventurer, List <WorldAreaLocation> worldAreaLocations)
        {
            string messageBoxText =
                $"{gameadventurer.Name}, Where would you like to travel adventurer?\n" +
                " \n" +
                "Enter the ID number of your desired location from the table below.\n" +
                " \n" +

                //
                // display table header
                //
                "ID".PadRight(10) + "Name".PadRight(30) + "Accessible".PadRight(10) + "\n" +
                "---".PadRight(10) + "----------------------".PadRight(30) + "-------".PadRight(10) + "\n";

            //
            // display all locations except the current location
            //
            string worldAreaLocationList = null;

            foreach (WorldAreaLocation worldAreaLocation in worldAreaLocations)
            {
                if (worldAreaLocation.WorldAreaLocationID != gameadventurer.WorldAreaLocationID)
                {
                    worldAreaLocationList +=
                        $"{worldAreaLocation.WorldAreaLocationID}".PadRight(10) +
                        $"{worldAreaLocation.CommonName}".PadRight(30) +
                        $"{worldAreaLocation.PlayerCanAccess(gameadventurer)}".PadRight(10) +
                        Environment.NewLine;
                }
            }

            messageBoxText += worldAreaLocationList;

            return(messageBoxText);
        }
Exemplo n.º 2
0
        /// <summary>
        /// initialize the major game objects
        /// </summary>
        private void InitializeGame()
        {
            _gameTraveler    = new Adventurer();
            _gameConsoleView = new ConsoleView(_gameTraveler);
            _playingGame     = true;

            Console.CursorVisible = false;
        }
Exemplo n.º 3
0
        /// <summary>
        /// default constructor to create the console view objects
        /// </summary>
        public ConsoleView(Adventurer gameAdventurer, World gameWorld)
        {
            _gameAdventurer = gameAdventurer;
            _gameWorld      = gameWorld;

            _viewStatus = ViewStatus.AdventurerInitialization;

            InitializeDisplay();
        }
Exemplo n.º 4
0
        public static List <string> StatusBox(Adventurer adventurer, World world)
        {
            List <string> statusBoxText = new List <string>();

            statusBoxText.Add($"Experience Points: {adventurer.ExperiencePoints}\n");
            statusBoxText.Add($"Health: {adventurer.Health}\n");
            statusBoxText.Add($"Lives: {adventurer.Lives}\n");

            return(statusBoxText);
        }
Exemplo n.º 5
0
        /// <summary>
        /// get the player's initial information at the beginning of the game
        /// </summary>
        /// <returns>traveler object with all properties updated</returns>
        public Adventurer GetInitialTravelerInfo()
        {
            Adventurer traveler = new Adventurer();

            //
            // intro
            //
            DisplayGamePlayScreen("Mission Initialization", Text.InitializeAdventureIntro(), ActionMenu.MissionIntro, "");
            GetContinueKey();

            //
            // get traveler's name
            //
            DisplayGamePlayScreen("Mission Initialization - Name", Text.InitializeAdventureGetAdventurerName(), ActionMenu.MissionIntro, "");
            DisplayInputBoxPrompt("Enter your name: ");
            traveler.Name = GetString();

            //
            // get traveler's age
            //
            DisplayGamePlayScreen("Mission Initialization - Age", Text.InitializeAdventureGetAdventurerAge(traveler.Name), ActionMenu.MissionIntro, "");
            int gameTravelerAge;

            GetInteger($"Enter your age {traveler.Name}: ", 0, 1000000, out gameTravelerAge);
            traveler.Age = gameTravelerAge;

            //
            // get traveler's race
            //
            DisplayGamePlayScreen("Mission Initialization - Race", Text.InitializeAdventureGetAdventurerRace(traveler), ActionMenu.MissionIntro, "");
            DisplayInputBoxPrompt($"Enter your race {traveler.Name}: ");
            traveler.Race = GetRace();

            //
            // get traveler's Hair Color
            //
            DisplayGamePlayScreen("Mission Initialization - Hair Color", Text.InitializeAdventureGetAdventurerHairColor(), ActionMenu.MissionIntro, "");
            DisplayInputBoxPrompt("Enter your hair color: ");
            traveler.HairColor = GetString();

            //
            // get traveler's money stats
            //
            DisplayGamePlayScreen("Mission Initialization - Gold", Text.InitializeAdventureGetAdventurerGold(), ActionMenu.MissionIntro, "");
            DisplayInputBoxPrompt($"Enter your gold {traveler.Name}: ");
            traveler.Gold = GetDouble();

            //
            // echo the traveler's info
            //
            DisplayGamePlayScreen("Mission Initialization - Complete", Text.InitializeAdventureEchoAdventurerInfo(traveler), ActionMenu.MissionIntro, "");
            GetContinueKey();

            return(traveler);
        }
Exemplo n.º 6
0
        /// <summary>
        /// initialize the player info
        /// </summary>
        private void InitializeMission()
        {
            Adventurer traveler = _gameConsoleView.GetInitialTravelerInfo();

            _gameTraveler.Name            = traveler.Name;
            _gameTraveler.HairColor       = traveler.HairColor;
            _gameTraveler.Gold            = traveler.Gold;
            _gameTraveler.Age             = traveler.Age;
            _gameTraveler.Race            = traveler.Race;
            _gameTraveler.WorldLocationID = 1;
        }
Exemplo n.º 7
0
        public static string AdventurerInfo(Adventurer gameAdventurer, WorldAreaLocation currentLocation)
        {
            string messageBoxText =
                $"\tAdventurer Name: {gameAdventurer.Name}\n" +
                $"\tAdventurer Age: {gameAdventurer.Age}\n" +
                $"\tAdventurer Race: {gameAdventurer.Race}\n" +
                " \n" +
                $"\tCurrent Location: {currentLocation.CommonName}\n" +
                " \n";

            return(messageBoxText);
        }
Exemplo n.º 8
0
        /// <summary>
        /// determine if a location is accessible to the player
        /// </summary>
        /// <param name="WorldAreaeLocationId"></param>
        /// <returns>accessible</returns>
        public bool IsAccessibleLocation(int worldAreaLocationId, Adventurer adventurer)
        {
            WorldAreaLocation worldAreaLocation = GetWorldAreaLocationById(worldAreaLocationId);

            if (worldAreaLocation.PlayerCanAccess(adventurer) == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 9
0
        public static string AdventurerInfo(Adventurer gameAdventurer)
        {
            string messageBoxText =
                $"\tAdventurer Name: {gameAdventurer.Name}\n" +
                $"\tAdventurer Age: {gameAdventurer.Age}\n" +
                $"\tAdventurer Race: {gameAdventurer.Race}\n" +
                $"\tAdventurer Class: {gameAdventurer.Class}\n" +
                $"\tAdventurer Hair Color: {gameAdventurer.HairColor}\n" +
                $"\tAdventurer Gold: {gameAdventurer.Gold}\n" +
                " \n";

            return(messageBoxText);
        }
Exemplo n.º 10
0
        /// <summary>
        /// initialize the player info
        /// </summary>
        private void InitializeMission()
        {
            Adventurer adventurer = _gameConsoleView.GetInitialAdventurerInfo();

            _gameAdventurer.Name = adventurer.Name;
            _gameAdventurer.Age  = adventurer.Age;
            _gameAdventurer.Race = adventurer.Race;
            _gameAdventurer.WorldAreaLocationID = 1;

            _gameAdventurer.ExperiencePoints = 0;
            _gameAdventurer.Health           = 100;
            _gameAdventurer.Lives            = 3;
        }
Exemplo n.º 11
0
        /// <summary>
        /// initialize the major game objects
        /// </summary>
        private void InitializeGame()
        {
            _gameAdventurer  = new Adventurer();
            _gameWorld       = new World();
            _gameConsoleView = new ConsoleView(_gameAdventurer, _gameWorld);
            _playingGame     = true;

            //
            // add initial items to the Adventurer's inventory
            //
            _gameAdventurer.Inventory.Add(_gameWorld.GetGameObjectById(8) as AdventurerObject);
            _gameAdventurer.Inventory.Add(_gameWorld.GetGameObjectById(9) as AdventurerObject);

            Console.CursorVisible = false;
        }
Exemplo n.º 12
0
        public static string InitializeAdventureEchoAdventurerInfo(Adventurer gameAdventurer)
        {
            string messageBoxText =
                $"Very good then {gameAdventurer.Name}.\n" +
                " \n" +
                "It appears we have all the necessary data to begin your adventure. You will find it" +
                " listed below.\n" +
                " \n" +
                $"\tAdventurer Name: {gameAdventurer.Name}\n" +
                $"\tAdventurer Age: {gameAdventurer.Age}\n" +
                $"\tAdventurer Race: {gameAdventurer.Race}\n" +
                " \n" +
                "Press any key to begin your adventure.";

            return(messageBoxText);
        }
Exemplo n.º 13
0
        /// <summary>
        /// get the player's initial information at the beginning of the game
        /// </summary>
        /// <returns>adventure object with all properties updated</returns>
        public Adventurer GetInitialAdventurerInfo()
        {
            Adventurer adventurer = new Adventurer();

            //
            // intro
            //
            DisplayGamePlayScreen("Mission Initialization", Text.InitializeAdventureIntro(), ActionMenu.AdventureIntro, "");
            GetContinueKey();

            //
            // get adventurer's name
            //
            DisplayGamePlayScreen("Mission Initialization - Name", Text.InitializeAdventureGetAdventurerName(), ActionMenu.AdventureIntro, "");
            DisplayInputBoxPrompt("Enter your name: ");
            adventurer.Name = GetString();

            //
            // get adventurer's age
            //
            DisplayGamePlayScreen("Mission Initialization - Age", Text.InitializeAdventureGetAdventurerAge(adventurer.Name), ActionMenu.AdventureIntro, "");
            int gameAdventurerAge;

            GetInteger($"Enter your age {adventurer.Name}: ", 0, 1000000, out gameAdventurerAge);
            adventurer.Age = gameAdventurerAge;

            //
            // get adventurer's race
            //
            DisplayGamePlayScreen("Mission Initialization - Race", Text.InitializeAdventureGetAdventurerRace(adventurer), ActionMenu.AdventureIntro, "");
            DisplayInputBoxPrompt($"Enter your race {adventurer.Name}: ");
            adventurer.Race = GetRace();

            //
            // echo the adventurer's info
            //
            DisplayGamePlayScreen("Mission Initialization - Complete", Text.InitializeAdventureEchoAdventurerInfo(adventurer), ActionMenu.AdventureIntro, "");
            GetContinueKey();

            //
            // change view status to playing game
            //
            _viewStatus = ViewStatus.PlayingGame;

            return(adventurer);
        }
Exemplo n.º 14
0
        public static string InitializeAdventureGetAdventurerClass(Adventurer gameAdventurer)
        {
            string messageBoxText =
                $"{gameAdventurer.Name}, it will be important for us to know your characters class.\n" +
                " \n" +
                "Enter your class below.\n" +
                " \n" +
                "Please use the universal class classifications below." +
                " \n";

            string classList = null;

            foreach (Character.ClassType race in Enum.GetValues(typeof(Character.ClassType)))
            {
                if (race != Character.ClassType.None)
                {
                    classList += $"\t{classList}\n";
                }
            }

            messageBoxText += classList;

            return(messageBoxText);
        }
Exemplo n.º 15
0
        public static string InitializeAdventureGetAdventurerRace(Adventurer gameAdventurer)
        {
            string messageBoxText =
                $"{gameAdventurer.Name}, it will be important for us to know your race on your adventure.\n" +
                " \n" +
                "Enter your race below.\n" +
                " \n" +
                "Please use the universal race classifications below." +
                " \n";

            string raceList = null;

            foreach (Character.RaceType race in Enum.GetValues(typeof(Character.RaceType)))
            {
                if (race != Character.RaceType.None)
                {
                    raceList += $"\t{race}\n";
                }
            }

            messageBoxText += raceList;

            return(messageBoxText);
        }
Exemplo n.º 16
0
        //test
        #endregion

        #region PROPERTIES

        #endregion

        #region CONSTRUCTORS

        /// <summary>
        /// default constructor to create the console view objects
        /// </summary>
        public ConsoleView(Adventurer gameTraveler)
        {
            _gameTraveler = gameTraveler;

            InitializeDisplay();
        }