Advertisement
osman1997

Mu Online

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