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 MuOnline
- {
- static void Main()
- {
- string[] rooms = Console.ReadLine()
- .Split('|')
- .ToArray();
- int initialHealth = 100;
- int initialBitcoins = 0;
- for (int i = 0; i < rooms.Length; i++)
- {
- string[] currentRoom = rooms[i].Split().ToArray();
- string command = currentRoom[0];
- int number = int.Parse(currentRoom[1]);
- if (command == "potion")
- {
- int currentHealth = initialHealth;
- initialHealth += number;
- if (initialHealth > 100)
- {
- Console.WriteLine($"You healed for {100 - currentHealth} hp.");
- Console.WriteLine($"Current health: 100 hp.");
- initialHealth = 100;
- }
- else
- {
- Console.WriteLine($"You healed for {number} hp.");
- Console.WriteLine($"Current health: {initialHealth} hp.");
- }
- }
- else if (command == "chest")
- {
- initialBitcoins += number;
- Console.WriteLine($"You found {number} bitcoins.");
- }
- else
- {
- string monsterName = command;
- initialHealth -= number;
- if (initialHealth > 0)
- {
- Console.WriteLine($"You slayed {monsterName}.");
- }
- else
- {
- Console.WriteLine($"You died! Killed by {monsterName}.");
- Console.WriteLine($"Best room: {i + 1}");
- return;
- }
- }
- }
- Console.WriteLine("You've made it!");
- Console.WriteLine($"Bitcoins: { initialBitcoins}");
- Console.WriteLine($"Health: { initialHealth}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement