Advertisement
bl00dt3ars

02. MuOnline

Jun 26th, 2021
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. health = 100
  2. coins = 0
  3.  
  4. data = input().split("|")
  5. completed = True
  6.  
  7. for i in range(len(data)):
  8.     key, value = data[i].split()
  9.     value = int(value)
  10.     if key == "potion":
  11.         if health + value > 100:
  12.             value = 100 - health
  13.         health += value
  14.         print(f"You healed for {value} hp.")
  15.         print(f"Current health: {health} hp.")
  16.     elif key == "chest":
  17.         coins += value
  18.         print(f"You found {value} bitcoins.")
  19.     else:
  20.         if health - value > 0:
  21.             print(f"You slayed {key}.")
  22.             health -= value
  23.         else:
  24.             print(f"You died! Killed by {key}.")
  25.             print(f"Best room: {i+1}")
  26.             completed = False
  27.             break
  28.  
  29. if completed:
  30.     print(f"You've made it!")
  31.     print(f"Bitcoins: {coins}")
  32.     print(f"Health: {health}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement