Esempio n. 1
0
        //Method handles taking the name and creating the hero, adds and assigns gear to hero
        public static Hero CreateHero(List <Merchant> equipment, List <Merchant> armor)
        {
            string heroName = Initialize();
            Hero   hero     = new Hero(heroName);
            int    ind      = 1;

            Console.WriteLine($"\n Greeting {hero.name}, let's get you sorted with some items. It is a harsh world... \n");
            Thread.Sleep(2000);
            foreach (var item in equipment)
            {
                Merchant.AddAttributes(equipment, hero, ind);
                ind++;
            }

            hero.helmet      = "Iron cap";
            hero.shoulder    = "Plated shoulderpads";
            hero.chestArmor  = "Iron Chestplate";
            hero.gloves      = "Defenders gauntlets";
            hero.legs        = "Iron leggings";
            hero.boots       = "Steel boots";
            hero.weapon      = "Short sword";
            hero.AttackPower = hero.AttackPower;
            hero.MinDamage   = hero.MinDamage;
            hero.MaxDamage   = hero.MaxDamage;
            Console.Clear();
            GodMode(hero, armor, heroName);
            Console.WriteLine("There we are. you probably noticed getting a bit stronger there. Good luck!");

            HeroMethods.Updating(hero);
            return(hero);
        }
Esempio n. 2
0
        //Main menu for the Inn where the hero can rest for the night or eat a meal
        public static void VisitInn(Hero hero, List <Merchant> food)
        {
            Console.Clear();
            const float gold = 500;

            Console.WriteLine($"1. Spend the night at the Inn? {gold} gold per night\n" +
                              "2. Eat something\n" +
                              "press [Q] to exit Inn");
            Console.WriteLine(">>");
            string input = Console.ReadLine();
            int    intInput;

            switch (input)
            {
            case "1":
                if (hero.gold >= gold)
                {
                    hero.gold -= gold;
                    Console.WriteLine("You enjoy a good nights rest and heal up to full health");
                    hero.hp = hero.maxHp;
                }
                else
                {
                    Console.WriteLine("You do not have enough gold..");
                }
                break;

            case "2":
                ListEnhancements(food);
                Console.Write("\nWhat would you like to eat?\n" +
                              ">>");
                input = (Console.ReadLine());
                if (Int32.TryParse(input, out intInput) && intInput <= food.Count && intInput > 0)
                {
                    EatFood(food, hero, intInput);
                    Merchant.AddAttributes(food, hero, intInput);
                    Thread.Sleep(1000);
                }
                else if (input == "q" || input == "Q")
                {
                    break;
                }
                else
                {
                    Console.WriteLine("Invalid choice");
                }
                break;

            case "q":
                break;
            }
        }