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

time reduction from wine and gas leakage

parent 967a2088
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ start_time = ""
global current_room
global current_level
gas_starttime = ""
time_penalty = False
def list_of_items(items):
time.sleep(0.1)
......@@ -225,12 +226,15 @@ def check_timer():
current_time = datetime.now()
time_taken = current_time - start_time
time_left = 1200 - time_taken.total_seconds()
if time_penalty:
time_left = time_left - 300
minutes = time_left//60
seconds = time_left%60
print("You have", round(minutes), "minutes and", round(seconds), "seconds")
def execute_command(command):
global time_penalty
if 0 == len(command):
return
......@@ -313,7 +317,9 @@ def execute_command(command):
print("remove what?")
elif command[0] == "drink":
if command[1] == "wine":
drink_wine()
x = drink_wine()
if x == 3:
time_penalty = True
else:
print("drink what?")
elif command[0] == "play":
......@@ -356,24 +362,26 @@ def main():
current_time = datetime.now()
time_taken = current_time - start_time
time_left = 1200 - time_taken.total_seconds()
if time_penalty:
time_left = time_left - 300
if time_left < 0:
print("Oh no! You ran out of time!")
break
if location_boileroom["valve_open"]:
gastime = current_time - gas_starttime
gastime_left = 120 - gastime.total_seconds()
gastime_left = 180 - gastime.total_seconds()
if gastime_left < 0:
print("OH NO! the floor was filled with gas and you died")
break
# Display game status (room description, inventory etc.)
if current_room == location_boileroom:
if not location_boileroom["entered"]:
if current_room == location_entrance:
if not location_entrance["entered"]:
location_boileroom["valve_open"] = True
print("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.")
print("You've got 2 minutes to close the valve before the room fills with gas")
print("You've got 3 minutes to close the valve in the boiling room before the room fills with gas")
time.sleep(5)
gas_starttime = datetime.now()
location_boileroom["entered"] = True
location_entrance["entered"] = True
print_room(current_room)
print_inventory_items(inventory)
......
......@@ -11,6 +11,7 @@ import time
def drink_wine():
# need to add time deduction
counter = 0
x = ""
while counter < 3:
if counter < 1:
time.sleep(1)
......@@ -22,6 +23,7 @@ def drink_wine():
counter += 1
else:
counter = 3
x = 1
elif counter == 1:
time.sleep(1)
print()
......@@ -33,6 +35,7 @@ def drink_wine():
counter += 1
else:
counter = 3
x = 2
else:
time.sleep(1)
print()
......@@ -42,9 +45,10 @@ def drink_wine():
print('...')
counter += 1
time.sleep(4)
x = 3
# time_taken = time_taken - 360
# remove wine from inventory
return x
def close_valve():
......@@ -81,7 +85,7 @@ def use_battery_lock():
def gas_timer(timer):
current_time = datetime.now()
time_taken = current_time - timer
time_left = 120 - time_taken.total_seconds()
time_left = 180 - time_taken.total_seconds()
minutes = time_left//60
seconds = time_left%60
if time_left > 0:
......
......@@ -71,7 +71,8 @@ location_entrance = {
"exits": {"north": "wine cellar", "west": "storage room", "south": "boiler room", "east": "trap door", "south-east": "desk", "downstairs": "door"},
"items": []
"items": [],
"entered": False
}
location_winecellar = {
"name": "Wine Cellar",
......@@ -100,7 +101,7 @@ location_boileroom = {
"items": [],
"valve_open": False,
"entered": False
}
desk = {
"name": "desk",
......
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