Beispiel #1
0
        public void calAddGold(Character character)
        {
            try
            {
                double gold = 900;
                Console.WriteLine("How many do you want to buy?");
                double n = double.Parse(Console.ReadLine());


                if (character.Storage.Coin < gold * n)
                {
                    Console.WriteLine("Insuficient Funds you cannot buy this item. Please choose a different item.\n Press Enter to continue");
                    Console.ReadLine();
                    Console.Clear();
                    p.marketPharvis();
                }

                else
                {
                    character.Storage.Coin -= n * gold;
                }
                character.Storage.Gold += n;
                Console.WriteLine($"You now have {character.Storage.Coin} coins.");
                Console.WriteLine($"You now have {character.Storage.Gold} Gold");
                Console.ReadLine();
            }
            catch (Exception)
            {
                Console.WriteLine("Wrong input use numbers");
                calAddGold(character);
            }
        }
Beispiel #2
0
        public void marketPharvis()
        {
            Inventory();
            Console.WriteLine("\n1 - Gold = 900 coins\n2 - Silver = 500 coins\n3 - Copper = 150 coins\n4 - Switch Planet\n5 - Earth");
            Console.Write("\nWhat do you want?: ");
            Console.Write(">> ");
            string choose = Console.ReadLine().ToString();



            switch (choose)
            {
            case "1":
                s.calAddGold(character);
                break;

            case "2":
                s.calAddSilver(character);
                break;

            case "3":
                s.calAddCopper(character);
                break;

            case "4":
                Console.Clear();
                Console.WriteLine("Please Choose another planet");
                s.Restart(character);
                character.callPlanets();
                break;

            case "5":
                Earth();
                break;

            default:
                Console.WriteLine("Wrong Input Try again");
                marketPharvis();
                break;
            }
            Console.WriteLine("Are you done shopping?\n1 - Yes\n2 - No");
            Console.Write(">> ");
            string leave = Console.ReadLine().ToString();

            while (leave != "1" && leave != "2")
            {
                Console.WriteLine("Wrong Input Try again");
                Console.Write(">> ");
                leave = Console.ReadLine().ToString();
            }

            if (leave == "1")
            {
                Console.Clear();
                Console.WriteLine("Please Choose another planet");
                s.Restart(character);
                character.callPlanets();
            }
            else if (leave == "2")
            {
                Console.Clear();
                p.marketPharvis();
            }
        }