Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace MuOnline
- {
- class Program
- {
- static void Main(string[] args)
- {
- int health = 100, bitcoins = 0;
- var rooms = Console.ReadLine().Split('|').ToList();
- for (int i = 0; i < rooms.Count(); i++)
- {
- var tokens = rooms[i].Split(' ');
- string command = tokens[0];
- int amount = int.Parse(tokens[1]);
- if (command == "potion")
- {
- if (health + amount > 100)
- {
- amount = 100 - health;
- }
- health += amount;
- Console.WriteLine($"You healed for {amount} hp.\nCurrent health: {health} hp.");
- }
- else if (command == "chest")
- {
- bitcoins += amount;
- Console.WriteLine($"You found {amount} bitcoins.");
- }
- else
- {
- health -= amount;
- if (health <= 0)
- {
- Console.WriteLine($"You died! Killed by {command}.\nBest room: {i + 1}");
- break;
- }
- Console.WriteLine($"You slayed {command}.");
- }
- }
- if (health > 0)
- {
- Console.WriteLine($"You've made it!\nBitcoins: {bitcoins}\nHealth: {health}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement