Example #1
0
        static void Main(string[] args)
        {
            Elf yopapa = new Elf("YoPapa", 100);

            Console.WriteLine($"YoPapa has {yopapa.Health}");
            Orc grendal = new Orc("Grendal", 85);

            Console.WriteLine($"Grendal has {grendal.Health}");
            while ((grendal.Health > 0) && (yopapa.Health > 0))
            {
                double Damage = grendal.Attack(grendal.Armour);
                grendal.TakeDamage(Damage);
                Console.WriteLine($"Yopapa's health: {grendal.Health} Amrour:{grendal.Armour}");
                Damage = yopapa.Attack(yopapa.Armour);
                yopapa.TakeDamage(Damage);
                Console.WriteLine($"Yopapa's health: {yopapa.Health} Amrour:{yopapa.Armour}");
            }
            if (grendal.Health > 0)
            {
                Console.WriteLine($"Grendal Proves Victorious");
            }
            else
            {
                Console.WriteLine($"YoPapa Proves Victorious");
            }
        }
        static void Main(string[] args)
        {
            Elf yopapa = new Elf("YoPapa", 100);

            Console.WriteLine($"YoPapa has {yopapa.Health}");
            Orc grendal = new Orc("Grendal", 85);

            Console.WriteLine($"Grendal has {grendal.Health}");
            int Round = 0;

            while ((grendal.Health > 0) && (yopapa.Health > 0))
            {
                Round++;
                double Damage = grendal.Attack(grendal.Armour);
                grendal.TakeDamage(Damage);
                Console.WriteLine($"Round: {Round}");
                Console.WriteLine($"Grendal's health: {grendal.Health} Armour:{grendal.Armour}");
                Damage = yopapa.Attack(yopapa.Armour);
                yopapa.TakeDamage(Damage);
                Console.WriteLine($"Yopapa's health: {yopapa.Health} Armour:{yopapa.Armour}" + "\n");
            }
            if (grendal.Health > 0)
            {
                Console.WriteLine($"Press F to pay respects to Yopapa");
            }
            else
            {
                Console.WriteLine($"YoPapa Proves Victorious!");
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            Elf Glorfindel = new Elf("Glorfindel", 20);
            Orc Captain    = new Orc("Orc Captain", 10);

            Console.WriteLine(Captain.Name + "'s Health:" + Captain.Health.ToString());
            Console.WriteLine(Glorfindel.Name + "'s Health:" + Glorfindel.Health.ToString());

            while (Glorfindel.Health > 0 && Captain.Health > 0)
            {
                double scoutDamage      = Glorfindel.Attack(Captain.Armor);
                double GlorfindelDamage = Captain.Attack(Glorfindel.Armor);
                Glorfindel.TakeDamage(GlorfindelDamage);
                Captain.TakeDamage(scoutDamage);
                Console.WriteLine(Captain.Name + "'s Health:" + Captain.Health.ToString());
                Console.WriteLine(Glorfindel.Name + "'s Health:" + Glorfindel.Health.ToString());
            }

            if ((Captain.Health <= 0) && (Glorfindel.Health <= 0))
            {
                Console.WriteLine("Both creatures tragically perished from their wounds.");
            }

            else if (Captain.Health <= 0)
            {
                Console.WriteLine(Glorfindel.Name + " wins!");
            }

            else if (Glorfindel.Health <= 0)
            {
                Console.WriteLine(Captain.Name + " wins!");
            }
        }
Example #4
0
        static void Main(string[] args)
        {
            Elf Fingon = new Elf("Fingon", 15);
            Orc Ugluk  = new Orc("Ugluk", 25);

            Console.WriteLine($"Elf.Health = {Fingon.Health}, Orc.Health = {Ugluk.Health}");
            while (Fingon.Health > 0 && Ugluk.Health > 0)
            {
                Ugluk.TakeDamage(Fingon.Attack(Ugluk.Armour));
                Fingon.TakeDamage(Ugluk.Attack(Fingon.Armour));
                Console.WriteLine($"Elf.Health = {Fingon.Health}, Orc.Health = {Ugluk.Health}");
                Console.WriteLine(Winner = Ugluk)
            }
        }
Example #5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Testing Monsters");
            Elf Nareth     = new Elf("Nareth", elfLvl, 28);
            Orc Brothnagar = new Orc("Broth'nagar", orcLvl, 8);

            Console.WriteLine("Elf " + Nareth.Name + " starting level: " + Nareth.Level);
            Console.WriteLine("Orc " + Brothnagar.Name + " starting level: " + Brothnagar.Level);
            Console.WriteLine();
            Console.WriteLine("Elf " + Nareth.Name + " starting health: " + Nareth.Health);
            Console.WriteLine("Orc " + Brothnagar.Name + " starting health: " + Brothnagar.Health);
            Console.WriteLine();

            while (Nareth.Health >= 0 && Brothnagar.Health >= 0)
            {
                if (Nareth.Health > 0)
                {
                    Brothnagar.TakeDamage(Nareth.Attack(Brothnagar.Armor));

                    Console.WriteLine("Nareth attacked Broth'Nagar for " + Nareth.Damage + " damage.");
                    Console.WriteLine("Broth'nagar's health: " + Brothnagar.Health + ", Nareth's health: " + Nareth.Health);
                    Console.WriteLine();
                }
                if (Brothnagar.Health > 0)
                {
                    Nareth.TakeDamage(Brothnagar.Attack(Nareth.Armor));

                    Console.WriteLine("Broth'Nagar attacked Nareth for " + Brothnagar.Damage + " damage.");
                    Console.WriteLine("Broth'nagar's health: " + Brothnagar.Health + ", Nareth's health: " + Nareth.Health);
                    Console.WriteLine();
                }
            }

            if (Nareth.Health <= 0)
            {
                Console.WriteLine("Brothnagar won!");
            }
            else if (Brothnagar.Health <= 0)
            {
                Console.WriteLine("Nareth won!");
            }
        }
Example #6
0
        static void Main()
        {
            Elf legolas = new Elf("legolas", 10);
            Orc ugluk   = new Orc("ugluk", 8);

            Console.WriteLine("The Orc's Health:" + ugluk.Health.ToString());
            Console.WriteLine("The Elf's Health:" + legolas.Health.ToString());

            /*for (ugluk.Health && legolas.Health; ugluk.Health && legolas.Health > 0; IAttacker<>.Battle())
             * {
             *  Console.WriteLine("The ugluk's Health:" + Orc.Health.ToString());
             *  Console.WriteLine("The legolas's Health:" + Elf.Health.ToString());
             * }*/

            while (legolas.Health > 0 && ugluk.Health > 0)
            {
                ugluk.TakeDamage(legolas.Attack(ugluk.Armor));
                legolas.TakeDamage(ugluk.Attack(legolas.Armor));
                Console.WriteLine("The Orc's Health:" + ugluk.Health.ToString());
                Console.WriteLine("The Elf's Health:" + legolas.Health.ToString());
            }

            if (ugluk.Health < 0)
            {
                Console.WriteLine("legolas wins!");
            }

            else if (legolas.Health < 0)
            {
                Console.WriteLine("ugluk wins!");
            }
            else
            {
                Console.WriteLine("error");
            }
        }