Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Lab4.Resources.Monsters;
- namespace Lab4.Resources
- {
- public static class Combat
- {
- public static bool Active { get; private set; }
- private static Player player;
- private static Monster monster;
- public static void Start(Player player, Monster monster)
- {
- Console.Clear();
- Combat.player = player;
- Combat.monster = monster;
- Active = true;
- bool playerTurn = false;
- while (Active)
- {
- playerTurn = !playerTurn;
- if (!playerTurn)
- {
- player.TakeDamage(monster.Damage);
- Console.WriteLine($"You take {monster.Damage} damage." +
- $"\nYou have {player.Health}HP left." +
- $"\nPress <Enter> to continue...");
- Console.ReadLine();
- continue;
- }
- int input;
- do
- {
- Console.WriteLine($"..::* OPTIONS *::.." +
- $"\n1) Attack" +
- $"\n2) Flee");
- if (!int.TryParse(Console.ReadLine(), out input))
- continue;
- switch (input)
- {
- case 1:
- monster.TakeDamage(player.Damage);
- Console.WriteLine($"{monster.Name} takes {player.Damage} damage." +
- $"\n{monster.Name} has {monster.Health}HP left." +
- $"\nPress <Enter> to continue...");
- Console.ReadLine();
- break;
- case 2:
- End();
- break;
- }
- } while (input <= 0 && input > 2);
- }
- }
- private static void End()
- {
- Console.Clear();
- Active = false;
- player = null;
- monster = null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement