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 Program
- {
- static void Main()
- {
- int health = 100;
- int bitcoins = 0;
- int bestRoom = 0;
- List<string> rooms = Console.ReadLine().Split("|").ToList();
- for (int i = 0; i < rooms.Count(); i++)
- {
- string[] tokens = rooms[i].Split();
- string action = tokens[0];
- int number = int.Parse(tokens[1]);
- bestRoom++;
- if (action=="potion")
- {
- int currHealth = health;
- health += number;
- if (health>100)
- {
- health = 100;
- int diff = 100 - currHealth;
- Console.WriteLine($"You healed for {diff} hp.");
- }
- else
- {
- Console.WriteLine($"You healed for {number} hp.");
- }
- Console.WriteLine($"Current health: {health} hp.");
- }
- else if (action=="chest")
- {
- Console.WriteLine($"You found {number} bitcoins.");
- bitcoins += number;
- }
- else
- {
- health -= number;
- if (health<=0)
- {
- Console.WriteLine($"You died! Killed by {action}.");
- Console.WriteLine($"Best room: {bestRoom}");
- return;
- }
- else
- {
- Console.WriteLine($"You slayed {action}.");
- continue;
- }
- }
- }
- Console.WriteLine($"You've made it!");
- Console.WriteLine($"Bitcoins: {bitcoins}");
- Console.WriteLine($"Health: {health}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement