Ejemplo n.º 1
0
 public void fight()
 {
     for (; ;)
     {
         Console.Clear();
         player.getInfo();
         npc.getInfo();
         player.attackMove();
         npc.setHP(npc.getHP() - player.getAtack());
         Console.Clear();
         player.getInfo();
         npc.getInfo();
         if (npc.getHP() < 1)
         {
             Console.WriteLine("You win");
             Console.ReadKey();
             break;
         }
         Thread.Sleep(300);
         npc.attackMove();
         player.setHP(player.getHP() - npc.getAtack());
         Console.Clear();
         player.getInfo();
         npc.getInfo();
         if (player.getHP() < 1)
         {
             Console.WriteLine("You die");
             Console.ReadKey();
             break;
         }
         Thread.Sleep(400);
     }
 }
Ejemplo n.º 2
0
        public void getTraid()
        {
            Console.Clear();
            warior.getInfo();
            Console.WriteLine("What do you want to buy:\n1.{0}({1} coins)\n2.{2}({3} coins)\n3.{4}({5} coins)\n4.{6}({7} coins)\n5.No", knife.getName(), knife.getPrice(), sword.getName(),
                              sword.getPrice(), rags.getName(), rags.getPrice(), tunic.getName(), tunic.getPrice());
            switch (Console.ReadLine())
            {
            case "1":
                if (warior.getMoney() >= knife.getPrice())
                {
                    warior.setWeapon(knife);
                    warior.setMoney(warior.getMoney() - knife.getPrice());
                }
                else
                {
                    Console.Clear();
                    Console.WriteLine("Not enought money!!");
                    Console.ReadKey();
                }
                break;

            case "2":
                if (warior.getMoney() >= sword.getPrice())
                {
                    warior.setWeapon(sword);
                    warior.setMoney(warior.getMoney() - sword.getPrice());
                }
                else
                {
                    Console.Clear();
                    Console.WriteLine("Not enought money!!");
                    Console.ReadKey();
                }
                break;

            case "3":
                if (warior.getMoney() >= rags.getPrice())
                {
                    warior.setArmor(rags);
                    warior.setMoney(warior.getMoney() - rags.getPrice());
                }
                else
                {
                    Console.Clear();
                    Console.WriteLine("Not enought money!!");
                    Console.ReadKey();
                }
                break;

            case "4":
                if (warior.getMoney() >= tunic.getPrice())
                {
                    warior.setArmor(tunic);
                    warior.setMoney(warior.getMoney() - tunic.getPrice());
                }
                else
                {
                    Console.Clear();
                    Console.WriteLine("Not enought money!!");
                    Console.ReadKey();
                }
                break;

            default:
                Console.Clear();
                Console.WriteLine("Bye");
                Console.ReadKey();
                break;
            }
        }