Skip to content
Snippets Groups Projects
Commit 0fdffd14 authored by Ahmed Yusuf's avatar Ahmed Yusuf
Browse files

battery can be removed

parent 347afb70
No related branches found
No related tags found
No related merge requests found
...@@ -122,6 +122,9 @@ def print_menu(exits, room_items, inv_items): ...@@ -122,6 +122,9 @@ def print_menu(exits, room_items, inv_items):
if item_winebottle in inventory: if item_winebottle in inventory:
time.sleep(0.8) time.sleep(0.8)
print('DRINK WINE to have a glass of wine') print('DRINK WINE to have a glass of wine')
if powered_torch in inventory:
print("REMOVE BATTERIES from TORCH to remove the batteries from the torch")
time.sleep(0.8)
time.sleep(0.8) time.sleep(0.8)
print("What do you want to do?") print("What do you want to do?")
...@@ -171,7 +174,6 @@ def execute_drop(item_id): ...@@ -171,7 +174,6 @@ def execute_drop(item_id):
def time_taken(): def time_taken():
time.sleep(0.1)
current_time = datetime.now() current_time = datetime.now()
time_taken = (current_time - start_time).total_seconds() time_taken = (current_time - start_time).total_seconds()
minutes = time_taken // 60 minutes = time_taken // 60
...@@ -289,6 +291,20 @@ def execute_command(command): ...@@ -289,6 +291,20 @@ def execute_command(command):
use_torch(current_room) use_torch(current_room)
else: else:
print("use what?") print("use what?")
elif command[0] == "remove":
if len(command) > 1:
if command[1] == "batteries":
if len(command) > 2:
if command[2] == "torch":
remove_battery_torch()
elif command[2] == "lock":
"" # remove_battery_lock()
else:
print("remove batteries from what?")
elif command[1] == "torch":
use_torch(current_room)
else:
print("remove what?")
elif command[0] == "drink": elif command[0] == "drink":
if command[1] == "wine": if command[1] == "wine":
drink_wine() drink_wine()
......
...@@ -24,7 +24,12 @@ def open_safe(room_items): ...@@ -24,7 +24,12 @@ def open_safe(room_items):
else: else:
print("you try the code", passcode, "but the safe wouldn't open") print("you try the code", passcode, "but the safe wouldn't open")
print("TRY AGAIN") print("TRY AGAIN")
def remove_battery_torch():
if powered_torch in inventory:
inventory.remove(powered_torch)
inventory.append(item_batteries)
inventory.append(unpowered_torch)
print("You removed the batteries from the torch")
def use_battery_torch(): def use_battery_torch():
if item_batteries in inventory: if item_batteries in inventory:
...@@ -33,9 +38,6 @@ def use_battery_torch(): ...@@ -33,9 +38,6 @@ def use_battery_torch():
inventory.remove(unpowered_torch) inventory.remove(unpowered_torch)
inventory.append(powered_torch) inventory.append(powered_torch)
print("You placed the batteries in the torch.") print("You placed the batteries in the torch.")
else:
print("You have no items in your inventory that uses a battery")
def use_torch(room): def use_torch(room):
if powered_torch in inventory: if powered_torch in inventory:
......
...@@ -84,7 +84,7 @@ location_winecellar = { ...@@ -84,7 +84,7 @@ location_winecellar = {
location_storage = { location_storage = {
"name": "Storage Room", "name": "Storage Room",
"description": "(description needed)", "description": "Boxes of computer parts are lying around scattered across the room. There's a closet across the other side of the room.",
"exits": {"north": "closet", "east": "entrance"}, "exits": {"north": "closet", "east": "entrance"},
...@@ -92,8 +92,8 @@ location_storage = { ...@@ -92,8 +92,8 @@ location_storage = {
} }
location_boileroom = { location_boileroom = {
"name": "Boiler Room", "name": "Boiler Room",
"description": "(description needed)", "description": "You immediately start hearing a high pitched hissing sound. You look around and see a valve needs to be closed. If only you had come sort of utensil to shut it.",
"exits": {"north": "entrance"}, "exits": {"north": "entrance"},
...@@ -103,20 +103,20 @@ location_boileroom = { ...@@ -103,20 +103,20 @@ location_boileroom = {
} }
desk = { desk = {
"name": "desk", "name": "desk",
"description": "(description needed)", "description": "A computer is placed on the desk. There seems to be a game of hangman loaded. Do you wish to play it?",
"exits": {"north-west": "entrance"}, "exits": {"north-west": "entrance"},
"items": [] "items": []
} }
trap_door = { trap_door = {
"name": "trap door", "name": "trap door",
"description": "(description needed)", "description": "You remove the carpet and try to pry open the door. It's locked. ",
"exits": {"west": "entrance"}, "exits": {"west": "entrance"},
"items": [] "items": []
} }
closet = { closet = {
"name": "closet", "name": "closet",
"description": "(description needed)", "description": "You walk up to the closet and try to open it however there's a battery powered lock preventing it from being opened",
"exits": {}, "exits": {"south": "storage room"},
"items": [] "items": []
} }
locations = { locations = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment