CCCPaste

Easy-Light7219

    import time
    
    # --- Monkeypatching Setup ---
    
    # Set this to True to disable sleep, False to enable it.
    DEBUG = True
    
    # Store the original sleep function in case you need it later
    original_sleep = time.sleep
    
    if DEBUG:
        print("DEBUG mode is ON. Disabling time.sleep().")
        # Replace the sleep function with a lambda that does nothing
        time.sleep = lambda seconds: None
    
    # -------------------------------
    # Helper function for Game Over
    # -------------------------------
    def game_over(health, courage, inventory):
        print("\n--- GAME OVER ---")
        print(f"Courage: {courage}")
        print(f"Health: {health}")
        print(f"Inventory: {inventory}")
        print("Thanks for playing...")
        time.sleep(2)
    
    
    # -------------------------------
    # Intro Scene
    # -------------------------------
    def intro_scene():
        begin = input("Shall we begin? (Y/N)? ").lower()
        if begin == "n":
            print("You can't delay the inevitable.")
            time.sleep(2)
            return True
        else:
            print("Wake up...")
            time.sleep(2)
            print("\nYou wake up in a small cabin in the woods.")
            time.sleep(2)
            print("It's raining outside, and you hear footsteps nearby...")
            time.sleep(2)
            return True
    
    
    # -------------------------------
    # Cabin Scene
    # -------------------------------
    def cabin_scene(health, courage, inventory):
        choice1 = input("\nDo you OPEN the door or HIDE under the bed? ").lower()
        if choice1 == "open":
            courage += 10
            print("\nYou open the door slowly... A lost traveler stands outside asking for help.")
            time.sleep(2)
            choice2 = input("Do you INVITE them in or REFUSE? ").lower()
            if choice2 == "invite":
                print("\nYou share some soup with the traveler. They thank you and give you a map.")
                time.sleep(2)
                inventory.append("map")
                print("You received a map.")
                time.sleep(2)
            else:
                print("\nYou keep the door shut. The footsteps fade. Loneliness fills the cabin...")
                time.sleep(2)
                print("But you aren't alone...")
                time.sleep(3)
                print("Game over.")
                time.sleep(2)
                health -= 101
                game_over(health, courage, inventory)
                return None, courage, inventory  # Stop game here
        elif choice1 == "hide":
            courage -= 5
            print("\nYou crawl under the bed and hold your breath...")
            time.sleep(2)
            print("After a moment, a wolf sneaks in!")
            time.sleep(2)
            choice2 = input("Do you STAY quiet or RUN outside? ").lower()
            if choice2 == "stay":
                print("\nThe wolf sniffs around but leaves. You survive!")
                time.sleep(2)
                print("But now you're all alone...")
                time.sleep(2)
                print("Game over.")
                game_over(health, courage, inventory)
                return None, courage, inventory
            else:
                print("\nYou dash outside but slip on the mud. The wolf bites you.")
                health -= 100
                time.sleep(2)
                print(f"Your health is now {health}")
                time.sleep(3)
                print("...")
                time.sleep(3)
                print("You bled out.")
                time.sleep(3)
                print("It seems cowardice gets you nowhere.")
                time.sleep(3)
                print("Game over.")
                game_over(health, courage, inventory)
                return None, courage, inventory
        else:
            print("\nYou hesitate too long... the footsteps reach the door.")
            time.sleep(2)
            print("...")
            time.sleep(3)
            print("Game over!")
            health -= 101
            time.sleep(2)
            game_over(health, courage, inventory)
            return None, courage, inventory
        return health, courage, inventory  # Continue game if survived
    
    
    # -------------------------------
    # Forest Scene
    # -------------------------------
    def forest_scene(health, inventory):
        if "map" in inventory:
            next_scene = input("\nDo you want to FOLLOW the map or STAY in the cabin? ").lower()
            if next_scene == "follow":
                print("\nYou pack your things and step into the dark forest...")
                time.sleep(2)
                print("After an hour, you reach an old bridge. It looks weak.")
                time.sleep(2)
                bridge_choice = input("Do you CROSS it or FIND another way? ").lower()
                if bridge_choice == "cross":
                    print("\nYou make it halfway... the bridge creaks.")
                    time.sleep(2)
                    print("You run and barely make it across—but you drop your map!")
                    if "map" in inventory:
                        inventory.remove("map")
                    health -= 10
                    print(f"Health: {health}")
                    time.sleep(2)
                else:
                    print("\nYou walk along the riverbank and find a safer crossing.")
                    health += 5
                    print(f"Health: {health}")
            else:
                print("\nYou stay in the cabin. It's quiet...")
                time.sleep(3)
                print("The world moves on without you. Your story ends here.")
                time.sleep(2)
                game_over(health, 0, inventory)
                return None, inventory
        else:
            print("\nYou have no map, so you cannot continue into the forest yet.")
            return health, inventory
        return health, inventory
    
    
    # -------------------------------
    # Mountain Scene
    # -------------------------------
    def mountain_scene(health, inventory):
        print("\nYou find yourself at the edge of a colossal mountain.")
        time.sleep(3)
        print("The wind howls. There's a narrow path leading up and a dark cave nearby.")
        time.sleep(3)
        choicem = input("Do you CLIMB the path or ENTER the cave? ").lower()
        if choicem == "climb":
            print("You start climbing carefully...")
            time.sleep(2)
            print("Halfway up, rocks crumble under your feet. You barely hang on.")
            health -= 15
            time.sleep(2)
            print(f"You survive but lose some health. Health: {health}")
        else:
            print("You step into the cave. It's cold and dark.")
            time.sleep(2)
            print("You find a glowing stone—it feels warm to the touch.")
            inventory.append("Glowing stone")
            time.sleep(2)
            print("You gained: Glowing stone")
            time.sleep(2)
        return health, inventory
    
    
    # -------------------------------
    # Main Game Loop
    # -------------------------------
    def main():
        while True:
            health = 100
            courage = 0
            inventory = []
            print("\n--- NEW GAME ---")
            time.sleep(1)
            # Intro
            continue_game = intro_scene()
            if not continue_game:
                break
            # Cabin scene
            result = cabin_scene(health, courage, inventory)
            if result[0] is None:
                break  # player died
            else:
                health, courage, inventory = result
            # Forest scene
            result = forest_scene(health, inventory)
            if result[0] is None:
                break
            else:
                health, inventory = result
            # Mountain scene
            health, inventory = mountain_scene(health, inventory)
            # Show final stats after surviving all scenes
            game_over(health, courage, inventory)
            # Replay option
            play_again = input("\nPlay again? (yes/no) ").lower()
            if play_again == "no":
                print("Thanks for playing...")
                break
            else:
                print("If you insist...")
                time.sleep(1)
    
    
    # -------------------------------
    # Run the Game
    # -------------------------------
    if __name__ == "__main__":
        main()