Advertisement
dinko_dt

Untitled

Feb 29th, 2020
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5.  
  6. namespace MuOnline
  7. {
  8. class MuOnline
  9. {
  10. static void Main()
  11. {
  12. string[] rooms = Console.ReadLine()
  13. .Split('|')
  14. .ToArray();
  15.  
  16. int initialHealth = 100;
  17. int initialBitcoins = 0;
  18.  
  19.  
  20. for (int i = 0; i < rooms.Length; i++)
  21. {
  22. string[] currentRoom = rooms[i].Split().ToArray();
  23. string command = currentRoom[0];
  24. int number = int.Parse(currentRoom[1]);
  25.  
  26. if (command == "potion")
  27. {
  28. int currentHealth = initialHealth;
  29. initialHealth += number;
  30. if (initialHealth > 100)
  31. {
  32. Console.WriteLine($"You healed for {100 - currentHealth} hp.");
  33. Console.WriteLine($"Current health: 100 hp.");
  34. initialHealth = 100;
  35. }
  36. else
  37. {
  38. Console.WriteLine($"You healed for {number} hp.");
  39. Console.WriteLine($"Current health: {initialHealth} hp.");
  40.  
  41. }
  42. }
  43.  
  44. else if (command == "chest")
  45. {
  46. initialBitcoins += number;
  47. Console.WriteLine($"You found {number} bitcoins.");
  48. }
  49. else
  50. {
  51. string monsterName = command;
  52. initialHealth -= number;
  53.  
  54. if (initialHealth > 0)
  55. {
  56. Console.WriteLine($"You slayed {monsterName}.");
  57. }
  58. else
  59. {
  60. Console.WriteLine($"You died! Killed by {monsterName}.");
  61. Console.WriteLine($"Best room: {i + 1}");
  62. return;
  63.  
  64. }
  65. }
  66. }
  67. Console.WriteLine("You've made it!");
  68. Console.WriteLine($"Bitcoins: { initialBitcoins}");
  69. Console.WriteLine($"Health: { initialHealth}");
  70.  
  71. }
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement