From ceb185d380e7dcdc4ca9d3a24f87d4de21b6147f Mon Sep 17 00:00:00 2001
From: Morgan Diment <dimentm@cardiff.ac.uk>
Date: Tue, 25 Oct 2022 15:56:00 +0100
Subject: [PATCH] adding drinking wine functionality

---
 Group_game/game.py    |  9 ++++++++-
 Group_game/items.py   | 10 ++++++++++
 Group_game/level_2.py | 31 ++++++++++++++++++++++++-------
 Group_game/map.py     |  6 +++---
 Group_game/player.py  |  2 +-
 5 files changed, 46 insertions(+), 12 deletions(-)

diff --git a/Group_game/game.py b/Group_game/game.py
index c778eb3..087769d 100644
--- a/Group_game/game.py
+++ b/Group_game/game.py
@@ -97,6 +97,8 @@ def print_menu(exits, room_items, inv_items):
         print("CLOSE valve to close the valve and stop the leakage")
     if location_boileroom["valve_open"]:
         print("CHECK GAS TIMER to see how long left before the room fills with gas")
+    if item_winebottle in inventory:
+        print('DRINK WINE to have a glass of wine')
     print("What do you want to do?")
 
 
@@ -166,7 +168,7 @@ def unlock_door():
                         location_door["exits"].update({"upstairs": "entrance"})
                         current_room = locations["entrance"]
                         start_time = datetime.now()
-                        print("(introduction to level 2)")
+                        print("You open the door and see a staircase. You decide to head up to the next level...")
                         time.sleep(5)
                         break
 
@@ -256,6 +258,11 @@ def execute_command(command):
                 use_torch(current_room)
         else:
             print("use what?")
+    elif command[0] == "drink":
+        if command[1] == "wine":
+            drink_wine()
+        else:
+            print("drink what?")
     else:
         print("This makes no sense.")
 
diff --git a/Group_game/items.py b/Group_game/items.py
index a9e0f19..edb8325 100644
--- a/Group_game/items.py
+++ b/Group_game/items.py
@@ -69,4 +69,14 @@ item_screwdriver = {
 
     "description": "()",
     "pick-up": True
+}
+item_winebottle = {
+    "id": "wine",
+
+    "name": "the bottle of wine",
+
+    "description": "()",
+
+    "pick-up": True,
+
 }
\ No newline at end of file
diff --git a/Group_game/level_2.py b/Group_game/level_2.py
index 31462d4..76e1ec0 100644
--- a/Group_game/level_2.py
+++ b/Group_game/level_2.py
@@ -5,23 +5,40 @@ from player import *
 from map import *
 from datetime import datetime
 from gameparser import *
+import time
 
 
-def drink_wine(time_taken):
+def drink_wine():
+    # need to add time deduction
     counter = 0
-    while True:
-        if counter < 2:
-            print('You drink a glass of the wine, but still cannot see the clue.')
+    while counter < 3:
+        if counter < 1:
+            print('You drink a glass of the wine, but have not got much closer the clue.')
             print('Would you like to drink another glass?')
+            print('YES or NO')
             more = str(input())
             if more == 'yes':
                 counter += 1
-            False
+            else:
+                counter = 3
+        elif counter == 1:
+            print()
+            print('You enjoy a second glass of wine, but can not see the bottom yet.')
+            print('Would you like to drink another glass?')
+            print('YES or NO')
+            more = str(input())
+            if more == 'yes':
+                counter += 1
+            else:
+                counter = 3
         else:
+            print()
             print('You pass out from too much alchohol consumption.')
             print('You wake up 5 minutes later on the floor.')
-            time_taken = time_taken - 360
-            False
+            counter += 1
+            time.sleep(5)
+            # time_taken = time_taken - 360
+            
 
 def close_valve():
     if item_screwdriver in inventory:
diff --git a/Group_game/map.py b/Group_game/map.py
index 2cef007..2e4889a 100644
--- a/Group_game/map.py
+++ b/Group_game/map.py
@@ -66,7 +66,7 @@ location_door = {
 location_entrance = {
     "name": "level 2 Entrance",
 
-    "description": "(description needed)",
+    "description": "You reach the top of the staircase, you're in a bright, cold room. You are surrounded by doors, and the only other thing in sight is a desk in the corner.",
 
     "exits": {"north": "wine cellar", "west": "storage room", "south": "boiler room", "east": "trap door", "south-east": "desk", "downstairs": "door"},
 
@@ -75,11 +75,11 @@ location_entrance = {
 location_winecellar = {
     "name": "Wine Cellar",
 
-    "description": "(description needed)",
+    "description": "The wine cellar is filled with old, dusty bottles of wine. One stands out, pick it up to take a look.",
 
     "exits": {"south": "entrance"},
 
-    "items": []
+    "items": [item_winebottle]
 }
 location_storage = {
     "name": "Storage Room",
diff --git a/Group_game/player.py b/Group_game/player.py
index e234b6c..51d2708 100644
--- a/Group_game/player.py
+++ b/Group_game/player.py
@@ -1,7 +1,7 @@
 from items import *
 from map import *
 
-inventory = []
+inventory = [item_key]
 
 # Start game at the centre
 current_room = locations["centre"]
-- 
GitLab