Ejemplo n.º 1
0
        public void Attack(Mage target)  // to hit d20 + attacker focus vs oponent dodge, Mage target är andra spelaren
        {
            int attack = Gen.Next(20) + m_focus.value + m_focus.modifier;

            if (attack >= target.m_dodge.value + target.m_dodge.modifier)//on hit: d5+ d5+ damage vs oponent defense
            {
                int damageAmount = Gen.Next(5) + Gen.Next(5) + m_damage.value + m_damage.modifier - (target.m_defense.value + target.m_defense.modifier);
                target.hp.modifier -= damageAmount;
                Console.WriteLine(target.name + m_frase + " and takes " + damageAmount + " amount of damage");
            }
            else
            {
                Console.WriteLine(target.name + " evades the attack");
            }


            m_defense.modifier = 0;
            m_dodge.modifier   = 0;
            m_focus.modifier   = 0;
            m_damage.modifier  = 0;
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            bool   play = false;
            string A    = "Teine"; //(fun note: all names comes from gaelich comes from their respective elements)
            string B    = "Usige"; //(which are;fire, water, earth, shadow, air, light)
            string C    = "Ùir";
            string D    = "Sgàil";
            string E    = "Gaoth";
            string F    = "Leus";

            string[]  Roster  = { A, B, C, D, E, F };
            string [] YesNo   = { "Yes", "No" };
            string[]  Actions = { "Attack", "Guard", "Channel your spell" };


            Console.WriteLine("To play press: p");
            ConsoleKeyInfo confirm = Console.ReadKey();

            if ((confirm.KeyChar == 'p') || (confirm.KeyChar == 'P'))
            {
                play = true;
            }
            Console.ReadLine();

            while (play == true)
            {
                Random generator = new Random(); // används senare till att styra p2

                bool singleMode  = false;
                bool matchActive = true;


                Console.WriteLine("Welcome to the Mage Arena");
                Console.WriteLine("Are you alone are with a friend?");
                Console.ReadLine();

                int valSingle = ChoiseMenu("Switch to single player mode?", new string[] { "Yes", "No" });

                string single = (YesNo[valSingle]);

                if (single == "Yes")
                {
                    singleMode = true;
                }


                Console.WriteLine("Player1 select your duelist\n");

                int valP1 = ChoiseMenu("Player1 select your duelist\nYour choises are:", new string[] { A, B, C, D, E, F });

                string p1choise = (Roster[valP1]);// väljer karaktär att spela som från namn i roster, detta avgör sedan stats


                Mage player1 = new Mage("", 0, 0, 0, 0, "", "");
                if (p1choise == A)
                {
                    player1 = new Mage(A, 5, 10, 0, 3, " is scurged by blazing flames", "fire");
                }
                if (p1choise == B)
                {
                    player1 = new Mage(B, 1, 10, 4, 3, " is drenched by a roaring tidal wave", "water");
                }
                if (p1choise == C)
                {
                    player1 = new Mage(C, 3, 8, 2, 5, " is hit by rushing boulders", "rock");
                }
                if (p1choise == D)
                {
                    player1 = new Mage(D, 3, 12, 2, 1, " is engulfed in a cloud of shadows", "shadow");
                }
                if (p1choise == E)
                {
                    player1 = new Mage(E, 3, 12, 0, 3, " is hurled around by dancing winds", "wind");
                }
                if (p1choise == F)
                {
                    player1 = new Mage(F, 5, 10, 2, 1, " is shreded by sharp rays of light", "light");
                }


                int valP2;
                if (singleMode == false)
                {
                    Console.WriteLine("Player2 select your duelist");

                    valP2 = ChoiseMenu("Your choises are:", new string[] { A, B, C, D, E, F });
                    Console.ReadLine();
                }
                else
                {
                    valP2 = generator.Next(5);
                }

                string p2choise = (Roster[valP2]);
                Mage   player2  = new Mage("", 0, 0, 0, 0, "", "");
                if (p2choise == A)
                {
                    player2 = new Mage(A, 5, 10, 0, 3, " is scurged by blazing flames", "fire");
                }
                if (p2choise == B)
                {
                    player2 = new Mage(B, 1, 10, 4, 3, " is drenched by a roaring tidal wave", "water");
                }
                if (p2choise == C)
                {
                    player2 = new Mage(C, 3, 8, 2, 5, " is hit by rushing boulders", "rock");
                }
                if (p2choise == D)
                {
                    player2 = new Mage(D, 3, 12, 2, 1, " is engulfed in a cloud of shadows", "shadow");
                }
                if (p2choise == E)
                {
                    player2 = new Mage(E, 3, 12, 0, 3, " is hurled around by dancing winds", "wind");
                }
                if (p2choise == F)
                {
                    player2 = new Mage(F, 5, 10, 2, 1, " is shreded by sharp rays of light", "light");
                }

                Console.ReadLine();
                Console.WriteLine(p1choise + "VS " + p2choise);
                Console.WriteLine("May the best spellcaster win");
                while (matchActive == true)
                {
                    bool p1Alive = true;
                    bool p2Alive = true;

                    int actionChoiseP1;
                    actionChoiseP1 = ChoiseMenu("It is your turn player 1", new string[] { "Attack", "Guard", "Channel your spell" });

                    string p1Action = Actions[actionChoiseP1];

                    Console.ReadLine();

                    if (p1Action == "Attack")
                    {
                        Console.WriteLine(p1choise + " Attacks " + p2choise);
                        player1.Attack(player2);
                    }

                    if (p1Action == "Guard")
                    {
                        player1.Defend();
                    }
                    if (p1Action == "Channel your spell")
                    {
                        player1.Chanell();
                    }
                    if (p1Action == "Attack")
                    {
                        Console.WriteLine(p1choise + " Attacks " + p2choise);
                        player2.Attack(player1);
                    }



                    p2Alive     = player2.StatusUpdate();
                    matchActive = WinStatus(p1Alive, p2Alive, p1choise, p2choise);


                    int actionChoiseP2;
                    if (singleMode == false)
                    {
                        actionChoiseP2 = ChoiseMenu("It is your turn player 2", new string[] { "Attack", "Guard", "Channel your spell" });
                        Console.ReadLine();
                    }
                    else
                    {
                        actionChoiseP2 = generator.Next(2);
                    }


                    string p2Action = (Actions[actionChoiseP2]);
                    if (p2Action == "Guard")
                    {
                        player2.Defend();
                    }
                    if (p2Action == "Channel your spell")
                    {
                        player2.Chanell();
                    }
                    Console.ReadLine();

                    p1Alive = player1.StatusUpdate();

                    matchActive = WinStatus(p1Alive, p2Alive, p1choise, p2choise);
                }
            }
        }