Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace new_new_new_new
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Welcome, traveler! Please, say your name.");
- string playerName = Console.ReadLine();
- string[] playerEquipment = Player.Equipment();
- int playerHealth = Player.Health();
- int playerDamage = Player.PlayerDamage();
- int playerDefense = Player.PlayerDefense();
- string[] enemiesName = Enemies.EnemiesName();
- int enemiesDamage = Enemies.EnemiesDamage();
- int enemiesHealth = Enemies.EnemiesHealth();
- int damagePlayer;
- int damageEnemy;
- bool endOfBattle;
- Random rng = new Random();
- int randomEnemy = rng.Next(0, 2);
- Console.WriteLine(playerName + " have: " + playerHealth + " health and: " + playerEquipment[0] + ", " + playerEquipment[1] + " and " + playerEquipment[2] + "!");
- Console.WriteLine("Stats: " + playerDamage + " damage and " + playerDefense + " defense.");
- Console.WriteLine("Choose path: left or right. Choose wisely!");
- string playerChoose1 = Console.ReadLine();
- string playerChoose2;
- if (playerChoose1 == "left" || playerChoose1 == "Left")
- {
- Console.WriteLine(playerName + " chosen left path. Time to your first adventure in forest.");
- Console.WriteLine("When " + playerName + " go into the forest - you see some good house. Maybe you want to go in? You chose to go in. When you came through the door - you saw a sleeping " + enemiesName[randomEnemy] + "!");
- Console.WriteLine("What do " + playerName + " choose? Run or fight?");
- playerChoose2 = Console.ReadLine();
- if (playerChoose2 == "Run" || playerChoose2 == "run")
- {
- Console.WriteLine(playerName + " chose to run as a rat. So pathetic. " + playerName + "'s journey ends here.");
- } else if (playerChoose2 == "Fight" || playerChoose2 == "fight")
- {
- Console.WriteLine(playerName + " chose a fight vs " + enemiesName[randomEnemy] + "!");
- endOfBattle = true;
- while (endOfBattle == true)
- {
- damageEnemy = enemiesHealth - playerDamage;
- Console.WriteLine(enemiesName[randomEnemy] + " HP: " + damageEnemy); //Battle code
- damagePlayer = playerHealth - (enemiesDamage - playerDefense);
- Console.WriteLine(playerName[randomEnemy] + " HP: " + damagePlayer);
- if (enemiesHealth <= 0)
- {
- endOfBattle = false;
- Console.WriteLine(playerName + " won the battle! Good job! " + playerName + "'s journey ends here.");
- } else if (playerHealth <= 0)
- {
- endOfBattle = false;
- Console.WriteLine(playerName + " died in battle! " + playerName + "'s journey ends here.");
- }
- }
- }
- }
- Console.ReadKey();
- }
- }
- class Player
- {
- public static int Health ()
- {
- int playerHealth = 100; //Player health
- return playerHealth;
- }
- public static string[] Equipment()
- {
- string[] equipment = new string[] {"Cloth armor", "Sword", "Health potion"}; //Player equipment
- return equipment;
- }
- public static int PlayerDamage()
- {
- string[] playerEquipment = Player.Equipment();
- int playerDamage;
- if (playerEquipment[1] == "Sword")
- {
- playerDamage = 10; //Player damage
- } else
- {
- playerDamage = 5;
- }
- return playerDamage;
- }
- public static int PlayerDefense()
- {
- string[] playerEquipment = Player.Equipment();
- int playerDefense;
- if (playerEquipment[0] == "Cloth armor")
- {
- playerDefense = 5;
- } else //Player defense
- {
- playerDefense = 0;
- }
- return playerDefense;
- }
- }
- class Enemies
- {
- public static string[] EnemiesName ()
- {
- string[] enemies = new string[] { "Slime", "Little ghoust", "Little wolf" };
- return enemies;
- }
- public static int EnemiesDamage ()
- {
- Random rngDamage = new Random();
- int damage = rngDamage.Next(5, 10); //Enemies info
- return damage;
- }
- public static int EnemiesHealth()
- {
- Random rngHealth = new Random();
- int health = rngHealth.Next(15, 150);
- return health;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement