gruntfutuk

Easy-Light7219

Nov 10th, 2025
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 8.64 KB | None | 0 0
  1.     import time
  2.    
  3.     # --- Monkeypatching Setup ---
  4.    
  5.     # Set this to True to disable sleep, False to enable it.
  6.     DEBUG = True
  7.    
  8.     # Store the original sleep function in case you need it later
  9.     original_sleep = time.sleep
  10.    
  11.     if DEBUG:
  12.         print("DEBUG mode is ON. Disabling time.sleep().")
  13.         # Replace the sleep function with a lambda that does nothing
  14.         time.sleep = lambda seconds: None
  15.    
  16.     # -------------------------------
  17.     # Helper function for Game Over
  18.     # -------------------------------
  19.     def game_over(health, courage, inventory):
  20.         print("\n--- GAME OVER ---")
  21.         print(f"Courage: {courage}")
  22.         print(f"Health: {health}")
  23.         print(f"Inventory: {inventory}")
  24.         print("Thanks for playing...")
  25.         time.sleep(2)
  26.    
  27.    
  28.     # -------------------------------
  29.     # Intro Scene
  30.     # -------------------------------
  31.     def intro_scene():
  32.         begin = input("Shall we begin? (Y/N)? ").lower()
  33.         if begin == "n":
  34.             print("You can't delay the inevitable.")
  35.             time.sleep(2)
  36.             return True
  37.         else:
  38.             print("Wake up...")
  39.             time.sleep(2)
  40.             print("\nYou wake up in a small cabin in the woods.")
  41.             time.sleep(2)
  42.             print("It's raining outside, and you hear footsteps nearby...")
  43.             time.sleep(2)
  44.             return True
  45.    
  46.    
  47.     # -------------------------------
  48.     # Cabin Scene
  49.     # -------------------------------
  50.     def cabin_scene(health, courage, inventory):
  51.         choice1 = input("\nDo you OPEN the door or HIDE under the bed? ").lower()
  52.         if choice1 == "open":
  53.             courage += 10
  54.             print("\nYou open the door slowly... A lost traveler stands outside asking for help.")
  55.             time.sleep(2)
  56.             choice2 = input("Do you INVITE them in or REFUSE? ").lower()
  57.             if choice2 == "invite":
  58.                 print("\nYou share some soup with the traveler. They thank you and give you a map.")
  59.                 time.sleep(2)
  60.                 inventory.append("map")
  61.                 print("You received a map.")
  62.                 time.sleep(2)
  63.             else:
  64.                 print("\nYou keep the door shut. The footsteps fade. Loneliness fills the cabin...")
  65.                 time.sleep(2)
  66.                 print("But you aren't alone...")
  67.                 time.sleep(3)
  68.                 print("Game over.")
  69.                 time.sleep(2)
  70.                 health -= 101
  71.                 game_over(health, courage, inventory)
  72.                 return None, courage, inventory  # Stop game here
  73.         elif choice1 == "hide":
  74.             courage -= 5
  75.             print("\nYou crawl under the bed and hold your breath...")
  76.             time.sleep(2)
  77.             print("After a moment, a wolf sneaks in!")
  78.             time.sleep(2)
  79.             choice2 = input("Do you STAY quiet or RUN outside? ").lower()
  80.             if choice2 == "stay":
  81.                 print("\nThe wolf sniffs around but leaves. You survive!")
  82.                 time.sleep(2)
  83.                 print("But now you're all alone...")
  84.                 time.sleep(2)
  85.                 print("Game over.")
  86.                 game_over(health, courage, inventory)
  87.                 return None, courage, inventory
  88.             else:
  89.                 print("\nYou dash outside but slip on the mud. The wolf bites you.")
  90.                 health -= 100
  91.                 time.sleep(2)
  92.                 print(f"Your health is now {health}")
  93.                 time.sleep(3)
  94.                 print("...")
  95.                 time.sleep(3)
  96.                 print("You bled out.")
  97.                 time.sleep(3)
  98.                 print("It seems cowardice gets you nowhere.")
  99.                 time.sleep(3)
  100.                 print("Game over.")
  101.                 game_over(health, courage, inventory)
  102.                 return None, courage, inventory
  103.         else:
  104.             print("\nYou hesitate too long... the footsteps reach the door.")
  105.             time.sleep(2)
  106.             print("...")
  107.             time.sleep(3)
  108.             print("Game over!")
  109.             health -= 101
  110.             time.sleep(2)
  111.             game_over(health, courage, inventory)
  112.             return None, courage, inventory
  113.         return health, courage, inventory  # Continue game if survived
  114.    
  115.    
  116.     # -------------------------------
  117.     # Forest Scene
  118.     # -------------------------------
  119.     def forest_scene(health, inventory):
  120.         if "map" in inventory:
  121.             next_scene = input("\nDo you want to FOLLOW the map or STAY in the cabin? ").lower()
  122.             if next_scene == "follow":
  123.                 print("\nYou pack your things and step into the dark forest...")
  124.                 time.sleep(2)
  125.                 print("After an hour, you reach an old bridge. It looks weak.")
  126.                 time.sleep(2)
  127.                 bridge_choice = input("Do you CROSS it or FIND another way? ").lower()
  128.                 if bridge_choice == "cross":
  129.                     print("\nYou make it halfway... the bridge creaks.")
  130.                     time.sleep(2)
  131.                     print("You run and barely make it across—but you drop your map!")
  132.                     if "map" in inventory:
  133.                         inventory.remove("map")
  134.                     health -= 10
  135.                     print(f"Health: {health}")
  136.                     time.sleep(2)
  137.                 else:
  138.                     print("\nYou walk along the riverbank and find a safer crossing.")
  139.                     health += 5
  140.                     print(f"Health: {health}")
  141.             else:
  142.                 print("\nYou stay in the cabin. It's quiet...")
  143.                 time.sleep(3)
  144.                 print("The world moves on without you. Your story ends here.")
  145.                 time.sleep(2)
  146.                 game_over(health, 0, inventory)
  147.                 return None, inventory
  148.         else:
  149.             print("\nYou have no map, so you cannot continue into the forest yet.")
  150.             return health, inventory
  151.         return health, inventory
  152.    
  153.    
  154.     # -------------------------------
  155.     # Mountain Scene
  156.     # -------------------------------
  157.     def mountain_scene(health, inventory):
  158.         print("\nYou find yourself at the edge of a colossal mountain.")
  159.         time.sleep(3)
  160.         print("The wind howls. There's a narrow path leading up and a dark cave nearby.")
  161.         time.sleep(3)
  162.         choicem = input("Do you CLIMB the path or ENTER the cave? ").lower()
  163.         if choicem == "climb":
  164.             print("You start climbing carefully...")
  165.             time.sleep(2)
  166.             print("Halfway up, rocks crumble under your feet. You barely hang on.")
  167.             health -= 15
  168.             time.sleep(2)
  169.             print(f"You survive but lose some health. Health: {health}")
  170.         else:
  171.             print("You step into the cave. It's cold and dark.")
  172.             time.sleep(2)
  173.             print("You find a glowing stone—it feels warm to the touch.")
  174.             inventory.append("Glowing stone")
  175.             time.sleep(2)
  176.             print("You gained: Glowing stone")
  177.             time.sleep(2)
  178.         return health, inventory
  179.    
  180.    
  181.     # -------------------------------
  182.     # Main Game Loop
  183.     # -------------------------------
  184.     def main():
  185.         while True:
  186.             health = 100
  187.             courage = 0
  188.             inventory = []
  189.             print("\n--- NEW GAME ---")
  190.             time.sleep(1)
  191.             # Intro
  192.             continue_game = intro_scene()
  193.             if not continue_game:
  194.                 break
  195.             # Cabin scene
  196.             result = cabin_scene(health, courage, inventory)
  197.             if result[0] is None:
  198.                 break  # player died
  199.             else:
  200.                 health, courage, inventory = result
  201.             # Forest scene
  202.             result = forest_scene(health, inventory)
  203.             if result[0] is None:
  204.                 break
  205.             else:
  206.                 health, inventory = result
  207.             # Mountain scene
  208.             health, inventory = mountain_scene(health, inventory)
  209.             # Show final stats after surviving all scenes
  210.             game_over(health, courage, inventory)
  211.             # Replay option
  212.             play_again = input("\nPlay again? (yes/no) ").lower()
  213.             if play_again == "no":
  214.                 print("Thanks for playing...")
  215.                 break
  216.             else:
  217.                 print("If you insist...")
  218.                 time.sleep(1)
  219.    
  220.    
  221.     # -------------------------------
  222.     # Run the Game
  223.     # -------------------------------
  224.     if __name__ == "__main__":
  225.         main()
  226.  
Advertisement
Add Comment
Please, Sign In to add comment