diff --git a/Group_game/game.py b/Group_game/game.py index 15cfca493e25da2c42a4f9e6aea00e7d292966d2..6b0116083c51343ca47308cb31514fc44d019e33 100644 --- a/Group_game/game.py +++ b/Group_game/game.py @@ -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) diff --git a/Group_game/level_2.py b/Group_game/level_2.py index ffca4286e878a39ffa3bca51fdcd94a847ab0fa5..e8b9349859fea08d20b069bf3b83fb38e4b1882c 100644 --- a/Group_game/level_2.py +++ b/Group_game/level_2.py @@ -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: diff --git a/Group_game/map.py b/Group_game/map.py index 97fe2a6ccd63cad6a9d4e92e5eaa9e02674a8357..8df17fdf9a1b362be8489caf4f1fdea6f338df67 100644 --- a/Group_game/map.py +++ b/Group_game/map.py @@ -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",