Advertisement
anton_d

02.MuOnline

Sep 19th, 2022
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1. dungeons_rooms = input().split("|")
  2.  
  3. hero_info = {
  4.     "bitcoins": 0,
  5.     "health": 100,
  6. }
  7. bitcoins = "bitcoins"
  8. health = "health"
  9. finish_dungeon = True
  10. for room, command in enumerate(dungeons_rooms):
  11.     command = command.split()
  12.     type_command = command[0]
  13.     points_command = int(command[-1])
  14.     if type_command == "potion":
  15.         if hero_info[health] + points_command > 100:
  16.             print(f"You healed for {100 - hero_info[health]} hp.")
  17.             hero_info[health] = 100
  18.         else:
  19.             hero_info[health] += points_command
  20.             print(f"You healed for {points_command} hp.")
  21.         print(f"Current health: {hero_info[health]} hp.")
  22.     elif type_command == "chest":
  23.         hero_info[bitcoins] += points_command
  24.         print(f"You found {points_command} bitcoins.")
  25.     else:
  26.         hero_info[health] -= points_command
  27.     if hero_info[health] > 0 and type_command != "potion" and type_command != "chest":
  28.         print(f"You slayed {type_command}.")
  29.     if hero_info[health] <= 0:
  30.         print(f"You died! Killed by {type_command}.")
  31.         print(f"Best room: {room + 1}")
  32.         finish_dungeon = False
  33.         break
  34.  
  35. if finish_dungeon:
  36.     print("You've made it!")
  37.     print(f"Bitcoins: {hero_info[bitcoins]}")
  38.     print(f"Health: {hero_info[health]}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement