Ejemplo n.º 1
0
        } //This code block presents the three different fighter klass

        public Fighters chooseFighter(bool player) //This code block lets the player choose one of the three fighterklasses
        {
            string[] answears = { "1", "2", "3", "fighter 1", "fighter1", "fighter 2", "fighter2", "fighter 3", "fighter3" };
            string   choice;
            Fighters fighter = new Fighters();

            if (player == false)
            {
                choice = Klasser.ChoiseCorrect(answears);
            }
            else
            {
                choice = RandomiseChoise();
            }

            if (choice == "fighter 1" || choice == "fighter1" || choice == "1")
            {
                fighter = new Fighter_1();
            }

            if (choice == "fighter 2" || choice == "fighter2" || choice == "2")
            {
                fighter = new Fighter_2();
            }

            if (choice == "fighter 3" || choice == "fighter3" || choice == "3")
            {
                fighter = new Fighter_3();
            }

            return(fighter);
        } //This code block lets the player choose one of the three fighterklasses
Ejemplo n.º 2
0
        } //This is the processor of the fight. It says which characters turn it is and after the fight the block says who won the fight

        public void FightMenues(Fighters player, Fighters enemy, bool isPlayer) //For the player this code block lets the player choose if they want to check their stats or attack
        {
            if (isPlayer == true)
            {
                Console.Clear();
                Klasser.WriteLine("Name: " + player.Name + "\nHp: " + player.Name + "\nEnemy Hp: " + enemy.Hp + "\n\nWhat do you want to do? \n1. Fight\n2. Check Status", true);
                string[] answears = { "1", "2", "fight", "check staus", "checkstatus" };

                string answear = Klasser.ChoiseCorrect(answears);

                Console.Clear();

                if (answear == answears[0] || answear == answears[2])
                {
                    DealDamage(player, enemy, true);
                }

                if (answear == answears[1] || answear == answears[3] || answear == answears[4])
                {
                    player.PrintStats();
                    FightMenues(player, enemy, true);
                }
            }
            else
            {
                DealDamage(player, enemy, false);
            }
        } //For the player this code block lets the player choose if they want to check their stats or attack
Ejemplo n.º 3
0
        } //This code block is for dealing dammage between the player and the enemy. It randomise if the attack will hit or not. If it hit it randomises what kind of attack it was and where it hit.

        public void End(bool playerWon) //This code block resolvs the "after fight" and let the player choose if they want to restart the game
        {
            Console.Clear();

            if (playerWon == true)
            {
                Klasser.WriteLine("Perfekt round!", true);
            }
            else
            {
                Klasser.WriteLine("Better luck next time!", true);
            }

            Klasser.WriteLine("Would you like to play again? \n\n (Yes/No)", true);

            string[] answears = { "yes", "no" };

            string answear = Klasser.ChoiseCorrect(answears);

            if (answear == "yes")
            {
                Klasser.restartGame = true;
            }
        } //This code block resolvs the "after fight" and let the player choose if they want to restart the game