Skip to content

Commit fe03203

Browse files
committed
add key_gate and egg_pedastel events. fix a few bugs
1 parent e1e76a3 commit fe03203

1 file changed

Lines changed: 34 additions & 4 deletions

File tree

‎src/adv.py‎

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
True),
2121

2222
'ruins': Room("Ancient Ruins", """Smooth, mossy rocks are scattered about. Some are still loosely connected,
23-
forming the remains of a circular tower. An engraved pedastel lies in the center of the tower.
24-
On its surface is an oblong indentation.""",
23+
forming the remains of a circular tower. An engraved pedastel lies in the center of the tower.""",
2524
True),
2625

2726
'forest': Room("Forest", """Trees tower over your head and the floor is thick with underbrush.
@@ -85,14 +84,16 @@
8584
'gate': LockedItem('gate', "A large, imposing wrought-iron gate. It's closed and locked.", False),
8685
'river': Item('river', "Shallow and rocky. The water foams and bubbles and it flows by.", False),
8786
'waterfall': Item('waterfall', "It's falling at a tremendous rate. It could crush you easily.", False),
88-
'dam': Item('dam', "Built from sticks and mud. Completely stopping up the river.", False)
87+
'dam': Item('dam', "Built from sticks and mud. Completely stopping up the river.", False),
88+
'pedastel': LockedItem('pedastel', "It's covered in strange markings. On its surface is an oblong indentation.", False),
8989
}
9090

9191
# Add items to rooms
9292

9393
room['shack'].add_item(item['wood'])
9494
room['shack'].add_item(item['lantern'])
9595
room['garden'].add_item(item['mushroom'])
96+
room['garden'].add_item(item['gate'])
9697
room['coop'].add_item(item['egg'])
9798
room['coop'].add_item(item['chicken'])
9899
room['forest'].add_item(item['knife'])
@@ -101,11 +102,13 @@
101102
room['river'].add_item(item['river'])
102103
room['cliff'].add_item(item['waterfall'])
103104
room['cave'].add_item(item['key'])
105+
room['ruins'].add_item(item['pedastel'])
104106

105107
# Add keys to locks
106108

107109
item['beaver'].key = item['flute']
108110
item['gate'].key = item['key']
111+
item['pedastel'].key = item['egg']
109112

110113

111114
# Define actions
@@ -160,6 +163,8 @@ def lily_beaver(self, lily, beaver):
160163

161164
def beaver_river(self, beaver, river):
162165
self.player.current_room.add_item(beaver)
166+
beaver.is_gettable = False
167+
beaver.is_locked = False
163168
self.player.current_room.add_item(item['dam'])
164169
room['cliff'].remove_item(item['waterfall'])
165170
room['cliff'].s_to = room['cave']
@@ -172,6 +177,31 @@ def beaver_river(self, beaver, river):
172177
display_string += "\nThe dam completely blocks the flow of the river."
173178
print(display_string)
174179

180+
def key_gate(self, key, gate):
181+
self.player.remove_item(key)
182+
gate.is_locked = False
183+
room['garden'].e_to = room['ruins']
184+
185+
display_string = ""
186+
display_string += "\nYou insert the key into the lock."
187+
display_string += "\nThe gate swings open with a groan."
188+
print(display_string)
189+
190+
def egg_pedastel(self, egg, pedastel):
191+
pedastel.is_locked = False
192+
self.player.remove_item(egg)
193+
self.player.current_room.add_item(egg)
194+
195+
display_string = ""
196+
display_string += "\nYou insert the egg into the indentation on the pedastel."
197+
display_string += "\nYour hands glow blue for a few seconds, then return to normal."
198+
display_string += "\nThe pedastel starts to vibrate, slowly at first, then faster and faster until"
199+
display_string += "\nit stops abruptly with the sound of a gong. You pick up the egg and gently tap"
200+
display_string += "\nthe shell against the worn stone. A perfect hard boil. You groan."
201+
display_string += "\n\nYou hate hard-boiled eggs."
202+
print(display_string)
203+
204+
175205

176206
#
177207
# Main
@@ -258,7 +288,7 @@ def main():
258288
player.drop_item(item[object_name])
259289

260290
# look at item
261-
elif verb == 'look':
291+
elif verb == 'look' or verb == 'l':
262292
player.look_item(item[object_name])
263293

264294
# print error message if user enters invalid input

0 commit comments

Comments
 (0)