コード例 #1
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
コード例 #2
0
        static void Main(string[] args)
        {
            Fighters player = m.PresentFighterKlass(false); //The player gets to choose a fighter
            Fighters enemy  = m.PresentFighterKlass(true);  //The game randomises a fighter

            m.NameYourFighter(player);                      //Lets the player name their character
            player.PrintStats();                            //Prints the player's stats

            Console.Clear();

            Klasser.WriteLine("You'r oponent is ...\n\n(*Enter*)", false);

            enemy.PrintStats();              //Prints the enemy's stats

            m.AnitiateFight(player, enemy);  //This code block is for Anitiating the fight by randomise if the playeer or the enemy start the fight

            if (Klasser.restartGame == true) //After the fight, if the player wants to restart the game, the bool restartGame becomes true
            {
                Program.Main(args);
            } //After the fight, if the player wants to restart the game, the bool restartGame becomes true
        }