示例#1
0
        } //For the player this code block lets the player choose if they want to check their stats or attack

        public void DealDamage(Fighters player, Fighters enemy, bool playerBool) //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.
        {
            Console.Clear();
            string[] attacks   = { "hook", "straight", "death stare", "roundhouse kick", "DDT" };
            string[] hit       = { "stomach", "knee", "shoulder", "liver", "Hand", "feet" };
            bool     playerHit = player.HitOrMiss();
            bool     enemyHit  = enemy.HitOrMiss();

            Thread.Sleep(200);

            if (playerHit == true && playerBool == true)
            {
                int damage = player.Damage;

                Klasser.WriteLine(player.Name + " hit a " + Klasser.RandString(attacks) + " on " + enemy.Name + "'s " + Klasser.RandString(hit) + " and dealt " + damage + " damage" + "\n\n(*Enter*)", false);

                enemy.Hp -= damage;
            }

            if (playerHit == false && playerBool == true)
            {
                Klasser.WriteLine(player.Name + " missed his attack\n\n(*Enter *)", false);
            }

            if (enemyHit == true && playerBool == false)
            {
                int damage = enemy.Damage;

                Klasser.WriteLine(enemy.Name + " hit a " + Klasser.RandString(attacks) + " on " + player.Name + "'s " + Klasser.RandString(hit) + " and dealt " + damage + " damage\n\n(*Enter*)", false);

                player.Hp -= damage;
            }

            if (enemyHit == false && playerBool == false)
            {
                Klasser.WriteLine(enemy.Name + " missed the attack\n\n(*Enter *)", false);
            }
        } //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.
        private bool defeated;                                                                                                                                                                                                                                //A bool to se if the character is defeated;

        public Fighters()                                                                                                                                                                                                                                     //When this class is instantiated a name will be randomed
        {
            name = Klasser.RandString(enemyNames);
        } //When this class is instantiated a name will be randomed