diff --git a/.gitignore b/.gitignore index 8a53af5..ab7e2ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ bag -treasure.png key.txt +treasure.jpg .timer +.log **/__pycache__/ diff --git a/adventure/seafloor/coral_reef/chest.py b/adventure/seafloor/coral_reef/chest.py index 29b0f8a..7cca8e4 100644 --- a/adventure/seafloor/coral_reef/chest.py +++ b/adventure/seafloor/coral_reef/chest.py @@ -31,6 +31,8 @@ MONSTER1 = [ MONSTER2 = [ "*rumble* *rumble* *rumble*", "A SEA MONSTER APPEARS FROM THE REEF!", +] +INSTRUCTIONS = [ "The sea monster must have seen you open the chest! There's no time to squander. You grab the treasure from the chest without taking a closer look! Quick, make a bag and store your treasure inside, using the following commands:", "mkdir bag", "mv treasure.jpg bag", @@ -47,7 +49,8 @@ if guess.strip() == SECRET: print_fancy(CHEST_OPENS) os.system('cp ./../../../.assets/fork.jpg treasure.jpg') Timer(1.0, print_fancy, [TREASURE]).start() - Timer(3.0, print_fancy, [MONSTER1]).start() - Timer(5.0, print_fancy, [MONSTER2]).start() + Timer(5.0, print_fancy, [MONSTER1]).start() + Timer(9.0, print_fancy, [MONSTER2]).start() + Timer(13.0, print_fancy, [INSTRUCTIONS]).start() else: print_fancy(["nothing happens. Maybe next time."]) diff --git a/return_to_ship.py b/return_to_ship.py index bd0990d..dd6446e 100644 --- a/return_to_ship.py +++ b/return_to_ship.py @@ -18,21 +18,24 @@ BEGINNING = [ FORGOT_BAG = [ "You forgot your treasure bag! Hurry back to get it before the sea monster hides it away forever!" ] +EMPTY_BAG = [ + "You brought the bag back to the surface, but the treasure is not inside. What a disappointment after all that work. Will you attempt the dive again?" +] LOST_TREASURE = [ "You are swimming as fast as you can towards the boat but you can feel the water begin to pull you back as the sea monster opens its giant mouth. You kick with all your might, sure that you are about to breath your last breath.", "Suddenly... The treasure bag slips out of your hand!", "It swirls down through the water and into the mouth of the sea monster. The beast's mouth snaps closed and it jets away into the depth of the ocean, taking with it the treasure. You are safe... but will you attempt the dive again?" ] VICTORY = [ - "You are swimming as fast as you can towards the boat but you can feel the water begin to pull you back as the sea monster opens its giant mouth. You kick with all your might, sure that you are about to breathe your last breath." + "You are swimming as fast as you can towards the boat but you can feel the water begin to pull you back as the sea monster opens its giant mouth. You kick with all your might, sure that you are about to breathe your last breath. " "Suddenly... A hand appears! You've made it to the boat! The crew pulls you into the boat, just in time to avoid the sea monster's vicious maw. You're safe at last! Now you can finally show off the treasure you risked your life for... Use `open bag/treasure.jpg` to take a peek.", "Congratulations! You have completed the Terminal Adventure." ] def reset(): - rmtree('bag') + if Path('bag').exists(): + rmtree('bag') Path('adventure/seafloor/coral_reef/.timer').unlink() - print_fancy(LOST_TREASURE) def win(): print_fancy(VICTORY) @@ -42,6 +45,9 @@ def win(): def chest_was_opened(): return Path(CHEST_TIMER_FILE).exists() +def bag_is_present(): + return Path("bag").exists() + def treasure_is_present(): return Path("bag/treasure.jpg").exists() @@ -54,11 +60,16 @@ def time_since_chest_was_opened(): return 0 if chest_was_opened(): - if treasure_is_present(): - if time_since_chest_was_opened() < 60: - win() + if bag_is_present(): + if treasure_is_present(): + if time_since_chest_was_opened() < 60: + win() + else: + reset() + print_fancy(LOST_TREASURE) else: reset() + print_fancy(EMPTY_BAG) else: print_fancy(FORGOT_BAG) else: