예제 #1
0
        static void Main(string[] args)
        {
            // Human adrian = new Human("Adrian",4,4,2,2000);
            // Human dude = new Human("Dude");
            // Console.WriteLine($"Name: {adrian.name}");
            // Console.WriteLine($"Health: {adrian.health}");
            // Console.WriteLine($"Strength: {adrian.strength}");
            // Console.WriteLine($"Dexterity: {adrian.dexterity}");
            // Console.WriteLine($"Intelligence: {adrian.intelligence}");

            // Console.WriteLine($"Name: {dude.name}");
            // Console.WriteLine($"Health: {dude.health}");
            // Console.WriteLine($"Strength: {dude.strength}");
            // Console.WriteLine($"Dexterity: {dude.dexterity}");
            // Console.WriteLine($"Intelligence: {dude.intelligence}");

            // adrian.Attack(dude);

            Wizard Harry = new Wizard("Harry Potter");

            Harry.Status();

            Wizard Ron = new Wizard("Ronald Weasley");

            Ron.Status();
            Harry.Fireball(Ron);

            Samurai Hanzo = new Samurai("Hattori Hanzo");

            Harry.Fireball(Hanzo);

            Hanzo.Meditate();
            Hanzo.Status();
            Hanzo.Death_blow(Ron);
        }
예제 #2
0
        static void Main(string[] args)
        {
            Human danny  = new Human("Danny");
            Human robert = new Human("Robert");

            Wizard charles = new Wizard("Charles");

            Ninja cindy = new Ninja("Cindy");

            Samurai sammy = new Samurai("Sammy");

            charles.Heal();
            charles.Fireball(danny);
            danny.Attack(robert);

            cindy.Steal(charles);
            cindy.GetAway();

            sammy.DeathBlow(charles);
            sammy.DeathBlow(charles);
            sammy.DeathBlow(charles);
            sammy.DeathBlow(charles);

            sammy.Meditate();

            Ninja.HowMany();
        }
예제 #3
0
        static void Main(string[] args)
        {
            // Human myhuman1 = new Human("The Name");
            // Human myhuman2 = new Human("Human2 Name", 50, 25, 75, 95);
            // myhuman1.Attack(myhuman2);
            // myhuman1.Attack(myhuman2);
            // myhuman1.Attack(myhuman2);
            // myhuman1.Attack(myhuman2);
            Samurai myhuman1   = new Samurai("P1");
            Samurai myhuman2   = new Samurai("p2");
            Wizard  mywiz2     = new Wizard("w2");
            Ninja   mysamurai2 = new Ninja("s2");

            myhuman1.Attack(myhuman2);
            myhuman1.Attack(myhuman2);
            myhuman1.Attack(myhuman2); myhuman1.Attack(myhuman2); myhuman1.Attack(myhuman2); myhuman1.Attack(myhuman2);
            myhuman1.Attack(myhuman2); myhuman1.Attack(myhuman2); myhuman1.Attack(myhuman2); myhuman1.Attack(myhuman2);
            myhuman1.Attack(myhuman2); myhuman1.Attack(myhuman2); myhuman1.Attack(myhuman2); myhuman1.Attack(myhuman2);
            myhuman1.Attack(myhuman2); myhuman1.Attack(myhuman2); myhuman1.Attack(myhuman2); myhuman1.Attack(myhuman2);
            myhuman2.Meditate();
            myhuman1.Attack(myhuman2);
            mysamurai2.Steal(myhuman1);
            mysamurai2.Steal(myhuman1);
            mysamurai2.Steal(myhuman1);
            mysamurai2.Steal(myhuman1);
            mysamurai2.Steal(myhuman1);
            mysamurai2.Steal(myhuman1);
            mysamurai2.Steal(myhuman1);
            mysamurai2.Steal(myhuman1);
            mysamurai2.Steal(myhuman1);
            mysamurai2.Steal(myhuman1);
            myhuman1.Attack(myhuman2);
            System.Console.WriteLine("done");
        }
예제 #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Kunle like(s) McDonald's");
            Human   bill  = new Human("Bill", 5, 5, 5, 150);
            Human   joe   = new Human("Joe");
            Wizard  Harry = new Wizard("Harry");
            Ninja   Choi  = new Ninja("Choi");
            Samurai Jim   = new Samurai("Jim");
            Samurai Alex  = new Samurai("Alex");

            bill.Attack(Jim);
            Harry.Attack(Jim);
            Alex.Meditate(Jim);
            Choi.Steal(Jim);
        }
예제 #5
0
        static void Main(string[] args)
        {
            Human   bob   = new Human("Bobby", 3, 3, 3, 100);
            Wizard  tam   = new Wizard("Tammi");
            Ninja   henry = new Ninja("Henry");
            Samurai kim   = new Samurai("Kim");

            tam.Attack(bob);
            tam.Heal(bob);
            henry.Attack(bob);
            henry.Steal(bob);
            kim.Attack(bob);
            kim.Meditate();
            // Ninja kevin = new Ninja("Kevin");
            // Samurai jesus = new Samurai("Jesus");
        }
예제 #6
0
        static void Main(string[] args)
        {
            string InputLine = Console.ReadLine();

            Console.WriteLine(InputLine);
            Human   kazuma   = new Human("Kazuma");
            Ninja   chris    = new Ninja("Chris");
            Samurai darkness = new Samurai("Darkness");
            Wizard  megumin  = new Wizard("Megumin");

            chris.Steal(kazuma);
            chris.GetAway();
            darkness.Attack(darkness);
            darkness.Meditate();
            darkness.HowMany();
            megumin.Explosion(kazuma);
        }
예제 #7
0
        static void Main(string[] args)
        {
            Wizard  wiz   = new Wizard("Dima");
            Samurai sam1  = new Samurai("Eric");
            Samurai sam2  = new Samurai("Quon");
            Ninja   ninja = new Ninja("Craig");

            Samurai.HowMany();
            wiz.Heal();
            wiz.Fireball(sam1);
            wiz.Attack(sam2);
            sam1.Meditate();
            sam2.Meditate();
            sam2.DeathBlow(wiz);
            ninja.Steal(sam2);
            sam2.Attack(ninja);
            wiz.Fireball(ninja);
            ninja.GetAway();
            sam1.DeathBlow(ninja);
        }
예제 #8
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Human Jonathon    = new Human("Jonathon");
            Human AfroSamurai = new Human("Afro");

            Jonathon.Attack(AfroSamurai);
            Console.WriteLine(Jonathon.Name);
            Console.WriteLine(AfroSamurai.Name);
            Console.WriteLine(AfroSamurai.showHealth());
            Wizard  mickyMouse = new Wizard("Micky Mouse");
            Samurai jack       = new Samurai("Samurai Jack");
            Ninja   ryzu       = new Ninja("Ryzu");

            Console.WriteLine(mickyMouse.Attack(jack));
            Console.WriteLine(ryzu.Attack(mickyMouse));
            Console.WriteLine(jack.Attack(mickyMouse));
            Console.WriteLine(ryzu.Attack(jack));
            Console.WriteLine(jack.Meditate());
            Console.WriteLine(mickyMouse.Heal(jack));
            Console.WriteLine(ryzu.Steal(jack));
            Console.WriteLine(jack.health);
        }
예제 #9
0
        public void Encounter(Human[] allies, Monster[] enemies)
        {
            Random rand = new Random();

            Console.WriteLine("Random encounter! Enemies appeared!");
            int totallength = allies.Length + enemies.Length;

            object[] turns = new object[totallength];
            int      i     = 0;

            foreach (Human ally in allies)
            {
                turns[i] = ally;
                i++;
            }
            foreach (Monster enemy in enemies)
            {
                turns[i] = enemy;
                i++;
            }
            foreach (Monster enemy in enemies)
            {
                Console.WriteLine(enemy.name);
            }
            int turncount = 0;

            while (true)
            {
                Boolean allieswin  = true;
                Boolean enemieswin = true;
                foreach (Monster enemy in enemies)
                {
                    if (enemy.health > 0)
                    {
                        allieswin = false;
                    }
                }
                foreach (Human ally in allies)
                {
                    if (ally.health > 0)
                    {
                        enemieswin = false;
                    }
                }
                if (allieswin == true)
                {
                    Console.WriteLine("You win! Commence victory theme!");
                    break;
                }
                if (enemieswin == true)
                {
                    Console.WriteLine("The allied party has died. Now the sacred crystals will never be collected, and darkness will forever rule throughout the land. Game Over.");
                    break;
                }
                int myturn = turncount % totallength;
                //Console.WriteLine(myturn);
                if (turns[myturn] is Monster)
                {
                    Monster currenemy = turns[myturn] as Monster;
                    if (currenemy.health == 0)
                    {
                        turncount += 1;
                        continue;
                    }
                    Console.WriteLine("{0}'s turn!", currenemy.name);
                    int mytarget = 0;
                    while (true)
                    {
                        mytarget = rand.Next(0, allies.Length);
                        if (allies[mytarget].health > 0)
                        {
                            currenemy.Attack(allies[mytarget]);
                            break;
                        }
                    }
                    turns[myturn] = currenemy;
                }
                else if (turns[myturn] is Human)
                {
                    string  command  = "default";
                    string  target   = "default";
                    Monster mytarget = enemies[0];
                    if (turns[myturn] is Samurai)
                    {
                        Samurai turnplayer = turns[myturn] as Samurai;
                        if (turnplayer.health == 0)
                        {
                            turncount += 1;
                            continue;
                        }
                        while (true)
                        {
                            Boolean found = false;
                            Console.WriteLine("What will {0} do?", turnplayer.name);
                            command = Console.ReadLine();
                            if (command != "attack" && command != "deathblow" && command != "meditate")
                            {
                                Console.WriteLine("Invalid command.");
                                continue;
                            }
                            if (command != "meditate")
                            {
                                Console.WriteLine("Targeting what?");
                                target = Console.ReadLine();
                                foreach (Monster enemy in enemies)
                                {
                                    if (target == enemy.name)
                                    {
                                        mytarget = enemy;
                                        found    = true;
                                        break;
                                    }
                                }
                                if (found == false)
                                {
                                    Console.WriteLine("Invalid target.");
                                    continue;
                                }
                            }
                            if (command == "attack")
                            {
                                turnplayer.Attack(mytarget);
                                if (turnplayer.poisoned > 0)
                                {
                                    turnplayer.health -= 5;
                                    turnplayer.poisoned--;
                                }
                                break;
                            }
                            else if (command == "deathblow")
                            {
                                turnplayer.Death_blow(mytarget);
                                if (turnplayer.poisoned > 0)
                                {
                                    turnplayer.health -= 5;
                                    turnplayer.poisoned--;
                                }
                                break;
                            }
                            else if (command == "meditate")
                            {
                                turnplayer.Meditate();
                                if (turnplayer.poisoned > 0)
                                {
                                    turnplayer.health -= 5;
                                    turnplayer.poisoned--;
                                }
                                break;
                            }
                        }
                    }
                    else if (turns[myturn] is Wizard)
                    {
                        Wizard turnplayer = turns[myturn] as Wizard;
                        if (turnplayer.health == 0)
                        {
                            turncount += 1;
                            continue;
                        }
                        while (true)
                        {
                            Boolean found = false;
                            Console.WriteLine("What will {0} do?", turnplayer.name);
                            command = Console.ReadLine();
                            if (command != "attack" && command != "fireball" && command != "heal")
                            {
                                Console.WriteLine("Invalid command.");
                                continue;
                            }
                            if (command != "heal")
                            {
                                Console.WriteLine("Targeting what?");
                                target = Console.ReadLine();
                                foreach (Monster enemy in enemies)
                                {
                                    if (target == enemy.name)
                                    {
                                        mytarget = enemy;
                                        found    = true;
                                        break;
                                    }
                                }
                                if (found == false)
                                {
                                    Console.WriteLine("Invalid target.");
                                    continue;
                                }
                            }


                            if (command == "attack")
                            {
                                turnplayer.Attack(mytarget);
                                break;
                            }
                            else if (command == "fireball")
                            {
                                turnplayer.Fireball(mytarget);
                                break;
                            }
                            else if (command == "heal")
                            {
                                turnplayer.Heal();
                                break;
                            }
                        }
                    }
                    else if (turns[myturn] is Ninja)
                    {
                        Ninja turnplayer = turns[myturn] as Ninja;
                        if (turnplayer.health == 0)
                        {
                            turncount += 1;
                            continue;
                        }
                        while (true)
                        {
                            Boolean found = false;
                            Console.WriteLine("What will {0} do?", turnplayer.name);
                            command = Console.ReadLine();
                            if (command != "attack" && command != "steal" && command != "getaway")
                            {
                                Console.WriteLine("Invalid command.");
                                continue;
                            }
                            if (command != "getaway")
                            {
                                Console.WriteLine("Targeting what?");
                                target = Console.ReadLine();
                            }
                            foreach (Monster enemy in enemies)
                            {
                                if (target == enemy.name)
                                {
                                    mytarget = enemy;
                                    found    = true;
                                    break;
                                }
                            }
                            if (found == false)
                            {
                                Console.WriteLine("Invalid target.");
                                continue;
                            }
                            if (command == "attack")
                            {
                                turnplayer.Attack(mytarget);
                                break;
                            }
                            else if (command == "steal")
                            {
                                turnplayer.Steal(mytarget);
                                break;
                            }
                            else if (command == "getaway")
                            {
                                turnplayer.Get_away();
                                Console.WriteLine("{} couldn't get away!", turnplayer.name);
                                break;
                            }
                        }
                    }
                    else
                    {
                        Human turnplayer = turns[myturn] as Human;
                        if (turnplayer.health == 0)
                        {
                            turncount += 1;
                            continue;
                        }
                        while (true)
                        {
                            Boolean found = false;
                            Console.WriteLine("What will {0} do?", turnplayer.name);
                            command = Console.ReadLine();
                            if (command != "attack")
                            {
                                Console.WriteLine("Invalid command.");
                                continue;
                            }
                            foreach (Monster enemy in enemies)
                            {
                                if (target == enemy.name)
                                {
                                    mytarget = enemy;
                                    found    = true;
                                    break;
                                }
                            }
                            if (found == false)
                            {
                                Console.WriteLine("Invalid target.");
                                continue;
                            }
                            if (command == "attack")
                            {
                                turnplayer.Attack(mytarget);
                                break;
                            }
                        }
                    }
                }
                turncount += 1;
            }
        }
예제 #10
0
        static void Main(string[] args)
        {
            Dictionary <string, Human> alliance = new Dictionary <string, Human>();
            Dictionary <string, Enemy> enemy    = new Dictionary <string, Enemy>();

            Console.WriteLine("Start a new game ?");
            string input = Console.ReadLine();

            if (input == "yes")
            {
                Wizard  w1  = new Wizard();
                Ninja   n1  = new Ninja();
                Samurai s1  = new Samurai();
                Zombie  z1  = new Zombie("z1");
                Zombie  z2  = new Zombie("z2");
                Spider  sp1 = new Spider("spider1", 2, 150);
                alliance.Add("w1", w1);
                alliance.Add("n1", n1);
                alliance.Add("s1", s1);
                enemy.Add("z1", z1);
                enemy.Add("z2", z2);
                enemy.Add("spider1", sp1);
                Console.WriteLine("Game start !\n Alliance: 1 Wizard: w1 \t 1 Ninja: n1 \t 1 Samurai: s1\n Enemy: 2 Zombies: z1,z2 \t 1 Spider spider1\nPlease input  ally");
                string ally = Console.ReadLine();
                Console.WriteLine("please input ability");
                string ability = Console.ReadLine();
                Console.WriteLine("Please input target");
                string target = Console.ReadLine();
                if (ally == "w1")  // Wizard abilities:
                {
                    if (ability == "heal")
                    {
                        if (alliance.ContainsKey(target) == true)
                        {
                            switch (target)
                            {
                            case "w1":
                                w1.Heal(w1);
                                break;

                            case "n1":
                                w1.Heal(n1);
                                break;

                            case "s1":
                                w1.Heal(s1);
                                break;
                            }
                        }
                        else
                        {
                            Console.WriteLine("This ability can only be used to ally !");
                        }
                    }
                    else if (ability == "fireball")
                    {
                        if (enemy.ContainsKey(target) == true)
                        {
                            switch (target)
                            {
                            case "z1":
                                w1.Fireball(z1);
                                break;

                            case "z2":
                                w1.Fireball(z2);
                                break;

                            case "spider1":
                                w1.Fireball(sp1);
                                break;
                            }
                        }
                        else
                        {
                            Console.WriteLine("This ability can only be used to enemy!");
                        }
                    }
                }
                else if (ally == "n1")  //Ninja abilities:
                {
                    if (ability == "steal")
                    {
                        if (enemy.ContainsKey(target) == true)
                        {
                            switch (target)
                            {
                            case "z1":
                                n1.Steal(z1);
                                break;

                            case "z2":
                                n1.Steal(z2);
                                break;

                            case "spider1":
                                n1.Steal(sp1);
                                break;
                            }
                        }
                        else
                        {
                            Console.WriteLine("This ability can only be used to enemy !");
                        }
                    }
                    else if (ability == "get_away")
                    {
                        if (target == "n1")
                        {
                            n1.Get_away();
                        }
                        else
                        {
                            Console.WriteLine("This ability can only be used to self !");
                        }
                    }
                }
                else if (ally == "s1")
                {
                    if (ability == "death_blow")
                    {
                        if (alliance.ContainsKey(target) == true)
                        {
                            switch (target)
                            {
                            case "w1":
                                s1.Death_blow(w1);
                                break;

                            case "n1":
                                s1.Death_blow(n1);
                                break;

                            case "s1":
                                s1.Death_blow(s1);
                                break;
                            }
                        }
                        else
                        {
                            Console.WriteLine("This ability can only be used to ally !");
                        }
                    }
                    else if (ability == "meditate")
                    {
                        if (target == "s1")
                        {
                            s1.Meditate();
                        }
                        else
                        {
                            Console.WriteLine("This ability can only be used to self !");
                        }
                    }
                }
            }
        }
예제 #11
0
        static void Main(string[] args)
        {
            // Create new players
            Human me = new Human("Maki");

            me.Health = 200;
            Human   Lola  = new Human("Lola");
            Wizard  Wanda = new Wizard("Wanda");
            Ninja   Nick  = new Ninja("Nick");
            Samurai Sam   = new Samurai("Sam");
            Samurai Ducky = new Samurai("Ducky");

            // Show stats of players at beginning of game
            System.Console.WriteLine("\n=====Before Attacking======");
            System.Console.WriteLine("\n---------Player 1----------");
            me.ShowStatus();
            System.Console.WriteLine("\n---------Player 2----------");
            Lola.ShowStatus();
            System.Console.WriteLine("\n---------Player 3----------");
            Wanda.ShowStatus();
            System.Console.WriteLine("\n---------Player 4----------");
            Nick.ShowStatus();
            System.Console.WriteLine("\n---------Player 5----------");
            Sam.ShowStatus();

            // Attack round
            System.Console.WriteLine("\n======While Attacking======");
            Wanda.Fireball(me);
            System.Console.WriteLine("\n1. Wanda fireballs me.");
            me.Attack(Lola);
            System.Console.WriteLine("\n2. I attack Lola.");
            Lola.Attack(Wanda);
            System.Console.WriteLine("\n3. Lola attacks Wanda.");
            Sam.Death_Blow(Wanda);
            System.Console.WriteLine("\n4. Sam death blows Wanda. (Suck it Wanda!)");
            Nick.Steal(Sam);
            System.Console.WriteLine("\n5. Nick steals from Sam.");

            // Show stats of players after attacking
            System.Console.WriteLine("\n======After Attacking======");
            System.Console.WriteLine("\n---------Player 1----------");
            me.ShowStatus();
            System.Console.WriteLine("\n---------Player 2----------");
            Lola.ShowStatus();
            System.Console.WriteLine("\n---------Player 3----------");
            Wanda.ShowStatus();
            System.Console.WriteLine("\n---------Player 4----------");
            Nick.ShowStatus();
            System.Console.WriteLine("\n---------Player 5----------");
            Sam.ShowStatus();

            // Heal round
            System.Console.WriteLine("\n=======While Healing=======");
            Wanda.Heal();
            System.Console.WriteLine("\n1. Wanda uses heal on herself.");
            Sam.Meditate();
            System.Console.WriteLine("\n2. Sam uses meditate on himself.");
            System.Console.WriteLine("\n=======After Healing=======");
            System.Console.WriteLine("\n---------Player 3----------");
            Wanda.ShowStatus();
            System.Console.WriteLine("\n---------Player 5----------");
            Sam.ShowStatus();
            System.Console.WriteLine("\n");
            Samurai.How_Many();
        }