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

bug fixes

parent e9858366
No related branches found
No related tags found
No related merge requests found
......@@ -106,10 +106,12 @@ def execute_take(item_id):
found = False
for items in current_room["items"]:
if item_id == items["id"]:
inventory.append(items)
current_room["items"].remove(items)
found = True
if len(inventory) < 3:
inventory.append(items)
current_room["items"].remove(items)
else:
print("Your inventory is full, Drop an item to free some space.")
if not found:
print("You cannot take that.")
......@@ -193,9 +195,9 @@ def execute_command(command):
elif command[0] == "open":
if command[1] == "diary":
open_diary()
open_diary(current_room["items"])
elif command[1] == "safe":
open_safe()
open_safe(current_room["items"])
else:
print("open what?")
......
......@@ -2,25 +2,28 @@ from items import *
from player import *
from map import *
def open_diary():
def open_diary(room_items):
if item_diary in inventory:
print("You opened the diary and found a hidden note.")
inventory.append(item_note)
room_items.append(item_note)
item_diary.update({"open": True})
else:
print("You cannot open that.")
def open_safe():
global safe_opened
def open_safe(room_items):
print("To open this safe you need a passcode")
print("please enter the passcode")
passcode = input()
if passcode == "042":
print("THE PASSCODE WAS CORRECT!")
print("inside the safe you found a pair of batteries")
inventory.append(item_batteries)
room_items.append(item_batteries)
item_safe.update({"open": True})
else:
print("you try the code", passcode, "but the safe wouldn't open")
print("TRY AGAIN")
def use_battery():
......@@ -35,9 +38,7 @@ def use_battery():
def use_torch(room):
if powered_torch in inventory:
print(room)
if room == location_dark_corner:
print("true")
room["items"].append(item_key)
else:
print("There is no use for the torch in this room")
......
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