示例#1
0
            public MakeEnemy()
            {
                string[] names        = { "Carl", "Samantha", "Robocop", "Blaine", "Roblox", "Goblix", "Jimmy", "Mr. Spanx" };
                Random   random       = new Random();
                int      randomChance = random.Next(1, 5);
                int      randomName   = random.Next(1, 10);

                switch (randomChance)
                {
                case 1:
                    Goblin goblinEnemy = new Goblin(names[randomName]);
                    obj = goblinEnemy;
                    break;

                case 2:
                    Spider spiderEnemy = new Spider(names[randomName]);
                    obj = spiderEnemy;
                    break;

                case 3:
                    Zombie zombieEnemy = new Zombie(names[randomName]);
                    obj = zombieEnemy;
                    break;

                case 4:
                    GiantBaby giantBabyEnemy = new GiantBaby(names[randomName]);
                    obj = giantBabyEnemy;
                    break;
                }
            }
示例#2
0
        // Main method invoked upon running program
        static void Main(string[] args)
        {
            // Create new player of class Human
            Human me = new Human("Maki");

            me.Health = 200;

            // Create new heroes
            Scribe  Steve = new Scribe("Steve");
            Wizard  Wanda = new Wizard("Wanda");
            Ninja   Nick  = new Ninja("Nick");
            Samurai Sam   = new Samurai("Sam");

            // Create new enemies
            Zombie    Zeek   = new Zombie("Zeek");
            GiantBaby Timmy  = new GiantBaby("Timmy");
            Spider    Slink  = new Spider("Slink");
            Goblin    Goblix = new Goblin("Goblix");

            // Show stats of players at the beginning of the game
            System.Console.WriteLine("\n\n============================== Before Attacking ===============================\n");
            System.Console.WriteLine("~ ALL PLAYERS ~\n");
            System.Console.WriteLine("Player 1: {0}", me.ShowStatus());

            // Show stats of heroes at the beginning of the game
            System.Console.WriteLine("\n~ ALL HEROES ~\n");
            System.Console.WriteLine("  Hero 1: {0}", Steve.ShowStatus());
            System.Console.WriteLine("  Hero 2: {0}", Wanda.ShowStatus());
            System.Console.WriteLine("  Hero 3: {0}", Nick.ShowStatus());
            System.Console.WriteLine("  Hero 4: {0}", Sam.ShowStatus());

            // Show stats of enemies at the beginning of the game
            System.Console.WriteLine("\n~ ALL ENEMIES ~\n");
            System.Console.WriteLine(" Enemy 1: {0}", Zeek.ShowStatus());
            System.Console.WriteLine(" Enemy 2: {0}", Timmy.ShowStatus());
            System.Console.WriteLine(" Enemy 3: {0}", Slink.ShowStatus());
            System.Console.WriteLine(" Enemy 4: {0}", Goblix.ShowStatus());

            // Attack round
            System.Console.WriteLine("\n=============================== While Attacking ===============================\n");
            System.Console.WriteLine("1. Wanda fireballs me.");
            Wanda.Fireball(me);
            System.Console.WriteLine("2. I attack Steve.");
            me.Attack(Steve);
            System.Console.WriteLine("3. Steve stabs Wanda with his quill.");
            Steve.Quill_Stab(Wanda);
            System.Console.WriteLine("4. Sam death blows Wanda. (Suck it Wanda!)");
            Sam.Death_Blow(Wanda);
            System.Console.WriteLine("5. Nick steals from Sam.");
            Nick.Steal(Sam);

            // Show stats of players after attacking
            System.Console.WriteLine("\n=============================== After Attacking ===============================\n");
            System.Console.WriteLine("~ ALL PLAYERS ~\n");
            System.Console.WriteLine("Player 1: {0}", me.ShowStatus());

            // Show stats of heroes after attacking
            System.Console.WriteLine("\n~ ALL HEROES ~\n");
            System.Console.WriteLine("  Hero 1: {0}", Steve.ShowStatus());
            System.Console.WriteLine("  Hero 2: {0}", Wanda.ShowStatus());
            System.Console.WriteLine("  Hero 3: {0}", Nick.ShowStatus());
            System.Console.WriteLine("  Hero 4: {0}", Sam.ShowStatus());

            // Show stats of enemies after attacking
            System.Console.WriteLine("\n~ ALL ENEMIES ~\n");
            System.Console.WriteLine(" Enemy 1: {0}", Zeek.ShowStatus());
            System.Console.WriteLine(" Enemy 2: {0}", Timmy.ShowStatus());
            System.Console.WriteLine(" Enemy 3: {0}", Slink.ShowStatus());
            System.Console.WriteLine(" Enemy 4: {0}", Goblix.ShowStatus());

            // Heal round
            System.Console.WriteLine("\n================================ While Healing ================================\n");
            System.Console.WriteLine("1. Wanda uses heal on herself.");
            Wanda.Heal();
            System.Console.WriteLine("2. Sam uses meditate on himself.");
            Sam.Meditate();

            // Show stats of players after healing
            System.Console.WriteLine("\n================================ After Healing ================================\n");
            System.Console.WriteLine("~ ALL PLAYERS ~\n");
            System.Console.WriteLine("Player 1: {0}", me.ShowStatus());

            // Show stats of heroes after healing
            System.Console.WriteLine("\n~ ALL HEROES ~\n");
            System.Console.WriteLine("  Hero 1: {0}", Steve.ShowStatus());
            System.Console.WriteLine("  Hero 2: {0}", Wanda.ShowStatus());
            System.Console.WriteLine("  Hero 3: {0}", Nick.ShowStatus());
            System.Console.WriteLine("  Hero 4: {0}", Sam.ShowStatus());

            System.Console.WriteLine("\n");
        }