Esempio n. 1
0
        private void Shop()
        {
            int userChoice = _gameConsoleView.DisplayShopOptions();

            switch (userChoice)
            {
            case 1:
                buyItem();
                break;

            case 2:
                GameObject       item       = _gameConsoleView.DisplaySell();
                ProspectorObject itemtoSell = item as ProspectorObject;
                _gamePlayer.Inventory.Remove(itemtoSell);
                _gamePlayer.Money += (int)(itemtoSell.Value * (.5));
                _gameConsoleView.DisplayConfirmationSell(itemtoSell);
                break;

            case 3:
                _gameConsoleView.DisplayNoShop();
                break;

            default:
                _gameConsoleView.DisplayNoShop();
                break;
            }
        }
Esempio n. 2
0
        public static string LookAt(GameObject gameObject)
        {
            string messageBoxText = "";

            messageBoxText =
                $"{gameObject.Name}\n" +
                " \n" +
                gameObject.Description + " \n" +
                " \n";

            if (gameObject is GameObject)
            {
                ProspectorObject travelerObject = gameObject as ProspectorObject;

                messageBoxText += $"The {travelerObject.Name} has a value of {travelerObject.Value} and ";

                if (travelerObject.CanInventory)
                {
                    messageBoxText += "may be added to your inventory.";
                }
                else
                {
                    messageBoxText += "may not be added to your inventory.";
                }
            }
            else
            {
                messageBoxText += $"The {gameObject.Name} may not be added to your inventory.";
            }

            return(messageBoxText);
        }
Esempio n. 3
0
        private void HandleObjectAddedToInventory(object gameObject, EventArgs e)
        {
            if (gameObject.GetType() == typeof(ProspectorObject))
            {
                ProspectorObject travelerObject = gameObject as ProspectorObject;
                _gamePlayer.Inventory.Add(travelerObject);
                switch (travelerObject.Type)
                {
                case ProspectorObjectType.Food:
                    _gameConsoleView.DisplayGamePlayScreen("Item Added", $"You have added {travelerObject.Name} to your inventory!", ActionMenu.MainMenu, "");
                    break;

                case ProspectorObjectType.Medicine:
                    _gameConsoleView.DisplayGamePlayScreen("Item Added", $"You have added {travelerObject.Name} to your inventory!", ActionMenu.MainMenu, "");
                    break;

                case ProspectorObjectType.Weapon:
                    _gameConsoleView.DisplayGamePlayScreen("Item Added", $"You have added {travelerObject.Name} to your inventory!", ActionMenu.MainMenu, "");
                    break;

                case ProspectorObjectType.Treasure:
                    _gamePlayer.Money += travelerObject.Value;
                    _gameConsoleView.DisplayConfirmTravelerObjectAddedToMoney(travelerObject);
                    Random rnd = new Random();
                    travelerObject.RegionLocationId = rnd.Next(1, _gameUniverse.RegionLocations.Count);
                    break;

                case ProspectorObjectType.Information:
                    _gameConsoleView.DisplayGamePlayScreen("An Important Message", travelerObject.PickUpMessage, ActionMenu.MainMenu, "");
                    break;

                case ProspectorObjectType.Resource:
                    _gameConsoleView.DisplayGamePlayScreen("Item Added", $"You have added {travelerObject.Name} to your inventory!", ActionMenu.MainMenu, "");
                    break;

                case ProspectorObjectType.Tool:
                    _gameConsoleView.DisplayGamePlayScreen("Item Added", $"You have added {travelerObject.Name} to your inventory!", ActionMenu.MainMenu, "");
                    break;

                default:
                    break;
                }
            }
        }
Esempio n. 4
0
        private void buyItem()
        {
            Random R = new Random();

            double           currentPricePercent = R.Next(1, 50);
            GameObject       itemToBuy           = _gameConsoleView.DisplayBuy(currentPricePercent);
            ProspectorObject travelerObject      = itemToBuy as ProspectorObject;

            if (_gamePlayer.Money - travelerObject.Value > 0)
            {
                //_gamePlayer.Inventory.Add(travelerObject);
                travelerObject.RegionLocationId = 0;
                _gamePlayer.Money -= travelerObject.Value;
                _gameConsoleView.DisplayConfirmationPurchase(travelerObject);
            }
            else
            {
                _gameConsoleView.DisplayCanNotBuy();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// process the Pick Up action
        /// </summary>
        private void PickUpAction()
        {
            //
            // display a list of traveler objects in space-time location and get a player choice
            //
            int travelerObjectToPickUpId = _gameConsoleView.DisplayGetTravelerObjectToPickUp();

            //
            // add the traveler object to traveler's inventory
            //
            if (travelerObjectToPickUpId != 0)
            {
                //
                // get the game object from the universe
                //
                ProspectorObject travelerObject = _gameUniverse.GetGameObjectById(travelerObjectToPickUpId) as ProspectorObject;
                _gamePlayer.ExpPoints += travelerObject.ExperiencePoints;

                travelerObject.RegionLocationId = 0;
            }
        }
Esempio n. 6
0
        private void SellItem()
        {
            int              npcToSellToId = _gameConsoleView.DisplayGetNpcToSellTo();
            GameObject       itemToSell    = _gameConsoleView.DisplaySellToNPC();
            ProspectorObject objecttosell  = itemToSell as ProspectorObject;

            _gameConsoleView.DisplayGamePlayScreen("The offer", $"{_gameUniverse.GetNpcById(npcToSellToId).Name} would like to offer you {objecttosell.Value}", ActionMenu.NpcMenu, "");
            int userResponse;

            _gameConsoleView.GetInteger("Enter 1 for YES and 2 for No", 1, 2, out userResponse);
            if (userResponse == 1)
            {
                _gamePlayer.Money += objecttosell.Value;
                _gamePlayer.Inventory.Remove(objecttosell);

                _gameConsoleView.DisplayGamePlayScreen("Deal Processed!", $"{_gameUniverse.GetNpcById(npcToSellToId).Name} bought {objecttosell.Name} for {objecttosell.Value}", ActionMenu.NpcMenu, "");
            }
            else
            {
                _gameConsoleView.DisplayGamePlayScreen("Deal Cancelled!", $"The deal was cancelled", ActionMenu.NpcMenu, "");
            }
        }
Esempio n. 7
0
        private void PutDownAction()
        {
            //
            // display a list of traveler objects in inventory and get a player choice
            //
            int inventoryObjectToPutDownId = _gameConsoleView.DisplayGetInventoryObjectToPutDown();

            //
            // get the game object from the universe
            //
            ProspectorObject travelerObject = _gameUniverse.GetGameObjectById(inventoryObjectToPutDownId) as ProspectorObject;

            //
            // remove the object from inventory and set the space-time location to the current value
            //
            _gamePlayer.Inventory.Remove(travelerObject);
            travelerObject.RegionLocationId = _gamePlayer.CurrentRegionLocationID;

            //
            // display confirmation message
            //
            _gameConsoleView.DisplayConfirmTravelerObjectRemovedFromInventory(travelerObject);
        }