Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace MuOnline
- {
- class MainClass
- {
- public static void Main()
- {
- List<string> dungeonsRooms = Console.ReadLine().Split('|').ToList();
- int health = 100;
- int bitcoins = 0;
- for (int i = 0; i < dungeonsRooms.Count; i++)
- {
- string[] commandArray = dungeonsRooms[i].Split().ToArray();
- if (commandArray[0] == "potion")
- {
- int numberForHelth = int.Parse(commandArray[1]);
- int currentHelth = health;
- health = currentHelth + numberForHelth;
- if (health > 100)
- {
- health = 100;
- }
- if (health <100)
- {
- Console.WriteLine($"You healed for {numberForHelth} hp.");
- Console.WriteLine($"Current health: {health} hp.");
- }
- else if (health == 100)
- {
- Console.WriteLine($"You healed for {100 - currentHelth} hp.");
- Console.WriteLine($"Current health: {health} hp.");
- }
- }
- else if (commandArray[0] == "chest")
- {
- int numberForBitcoins = int.Parse(commandArray[1]);
- bitcoins = bitcoins + numberForBitcoins;
- Console.WriteLine($"You found {numberForBitcoins} bitcoins.");
- }
- else
- {
- string monster = commandArray[0];
- int attackOfTheMonster = int.Parse(commandArray[1]);
- health = health - attackOfTheMonster;
- if (health > 0)
- {
- Console.WriteLine($"You slayed {monster}.");
- }
- else if(health<=0)
- {
- Console.WriteLine($"You died! Killed by {monster}.");
- Console.WriteLine($"Best room: {i + 1}");
- return;
- }
- }
- }
- Console.WriteLine($"You've made it!", "Bitcoins: {bitcoins}", "Health: {health}");
- Console.WriteLine($"Bitcoins: {bitcoins}");
- Console.WriteLine($"Health: {health}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement