Exemplo n.º 1
2
 public void Attack(Player player, Enemy enemy)
 {
     Console.WriteLine("\n" + name + " attacked! " + enemy.name + " takes " + strength + " damage.");
     enemy.takeDamage(player.strength);
 }
Exemplo n.º 2
0
        public void Abilities(Player player, Enemy enemy)
        {
            Console.WriteLine("\nAbilities Menu\n" + "-----------------------");
            Console.WriteLine("Z) Use Strong Attack");
            Console.WriteLine("X) Use Heal");
            var choice = Console.ReadKey();

            switch (choice.Key)
            {
            case ConsoleKey.Z:
                if (energy >= 20)
                {
                    Console.WriteLine("\n\n" + name + " used Strong Attack! Did 20 damage, lost 20 energy.");
                    enemy.takeDamage(20);
                    energy -= 20;
                }
                else
                {
                    Console.WriteLine("\n\nNot enough energy to use move!");
                }
                break;

            case ConsoleKey.X:
                if (energy >= 15)
                {
                    Console.WriteLine("\n\n" + name + " used Heal! Restored 25 health, lost 15 energy.");
                    health += 25;
                    energy -= 15;
                }
                else
                {
                    Console.WriteLine("\n\nNot enough energy to use move!");
                }
                break;

            default:
                Console.WriteLine("\n\nError: Unacceptable input. Lost turn due to inability to follow directions.");
                break;
            }
            if (health > 100)
            {
                health = 100;
            }
        }
Exemplo n.º 3
0
 public void Abilities(Player player, Enemy enemy)
 {
     Console.WriteLine("\nAbilities Menu\n" + "-----------------------");
     Console.WriteLine("Z) Use Strong Attack");
     Console.WriteLine("X) Use Heal");
     var choice = Console.ReadKey();
     switch (choice.Key)
     {
         case ConsoleKey.Z:
             if (energy >= 20)
             {
                 Console.WriteLine("\n\n" + name + " used Strong Attack! Did 20 damage, lost 20 energy.");
                 enemy.takeDamage(20);
                 energy -= 20;
             }
             else
             {
                 Console.WriteLine("\n\nNot enough energy to use move!");
             }
             break;
         case ConsoleKey.X:
             if (energy >= 15)
             {
                 Console.WriteLine("\n\n" + name + " used Heal! Restored 25 health, lost 15 energy.");
                 health += 25;
                 energy -= 15;
             }
             else
             {
                 Console.WriteLine("\n\nNot enough energy to use move!");
             }
             break;
         default:
             Console.WriteLine("\n\nError: Unacceptable input. Lost turn due to inability to follow directions.");
             break;
     }
     if (health > 100)
     {
         health = 100;
     }
 }
Exemplo n.º 4
0
 public int Attack(Enemy other)
 {
     return(other.takeDamage(strength));
 }
Exemplo n.º 5
0
 public int Attack(Enemy other)
 {
     return other.takeDamage(strength);
 }
Exemplo n.º 6
0
 public void Attack(Player player, Enemy enemy)
 {
     Console.WriteLine("\n" + name + " attacked! " + enemy.name + " takes " + strength + " damage.");
     enemy.takeDamage(player.strength);
 }