Пример #1
0
        static void Main(string[] args)
        {
            Human   Greg    = new Human("Greg");
            Human   Dean    = new Human("Dean");
            Wizard  Gandalf = new Wizard("Gandalf");
            Samurai Tonchu  = new Samurai("Tonchu");

            Greg.Attack(Gandalf);
            Dean.Attack(Tonchu);
            Tonchu.Attack(Dean);
            Gandalf.Attack(Dean);
            Dean.Attack(Tonchu);



            Console.WriteLine(Greg.Dexterity);
        }
Пример #2
0
        // Use a switch statement for attack or heal.
        public void Action(string do_this, Wizard w1, Samurai s1, Ninja n1, Human mon)
        {
            Random rand = new Random();

            System.Console.WriteLine("_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_");
            switch (do_this)
            {
            case "a":
                w1.Attack(mon);
                int x = rand.Next(3);
                int y = rand.Next(2);
                if (x == 1)
                {
                    System.Console.WriteLine($"{s1.Name} has decided to help you attack!");
                    s1.Attack(mon);
                }
                else if (x == 2)
                {
                    System.Console.WriteLine($"{n1.Name} has decided to help you attack!");
                    n1.Attack(mon);
                }
                System.Console.WriteLine("-------------------------------------------------");
                if (y == 0)
                {
                    mon.Attack(w1);
                }
                if (y == 1)
                {
                    mon.Attack1(w1);
                }
                break;

            case "h":
                w1.Heal(w1);
                System.Console.WriteLine("-------------------------------------------------");
                mon.Attack(w1);
                break;
            }
            System.Console.WriteLine("-------------------------------------------------");
            mon.GetInfo();
            w1.GetInfo();
            System.Console.WriteLine("_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_");
        }
        static void Main(string[] args)
        {
            Human   Dave     = new Human("Dave");
            Wizard  Gandolf  = new Wizard("Gandolf");
            Ninja   Shredder = new Ninja("Shredder");
            Samurai Kyoto    = new Samurai("Kyoto");

            Dave.Attack(Shredder);
            Gandolf.Attack(Shredder);
            Kyoto.Attack(Gandolf);
            Shredder.Attack(Gandolf);
            Gandolf.Heal(Kyoto);
            Shredder.Steal(Kyoto);
            Kyoto.Meditate();
        }
        static void Main(string[] args)
        {
            Human   me    = new Human("me");
            Ninja   tokyo = new Ninja("tokyo");
            Wizard  pine  = new Wizard("pine");
            Samurai king  = new Samurai("king");

            me.Attack(tokyo);
            System.Console.WriteLine($"tokyo's health: {tokyo.Health}");
            pine.Heal(tokyo);
            System.Console.WriteLine($"tokyo's health: {tokyo.Health}");
            tokyo.Steal(king);
            System.Console.WriteLine($"tokyo's health: {tokyo.Health}");
            System.Console.WriteLine($"king's health: {king.Health}");
            king.Meditate();
            System.Console.WriteLine($"king's health: {king.Health}");
        }