Skip to content

Commit c8f0d83

Browse files
committed
modified the item.py file adding LightSource and Treasure classes
1 parent 3b48e22 commit c8f0d83

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

‎src/item.py‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,38 @@ def on_drop(self):
2020
"""
2121
returns a string upon the user dropping an item.
2222
"""
23-
return "No use for this item right now but remember where you dropped it. Might come in handy later.."
23+
return "No use for this item right now but remember where you dropped it. Might come in handy later.."
24+
class Treasure(Item):
25+
def __init__(self,value, name, description):
26+
"""
27+
initialized value, name and description on the Treasure class.
28+
"""
29+
self.value = value
30+
super(Treasure,self).__init__(name, description)
31+
def on_take(self):
32+
"""
33+
returns string for when user takes a treasure
34+
"""
35+
return "Points collected maybe time to dump this sucker."
36+
def on_drop(self):
37+
"""
38+
returns a string for when the user drops treasure.
39+
"""
40+
return "Well you have already collected the points."
41+
class LightSource(Item):
42+
def __init__(self, name, description):
43+
"""
44+
Initialize the name and description for a LightSource
45+
"""
46+
self.light = True
47+
return super(LightSource, self).__init__(name, description)
48+
def on_take(self):
49+
"""
50+
returns a string for when a user takes a light source.
51+
"""
52+
return "Keep your light with you at all times."
53+
def on_drop(self):
54+
"""
55+
returns a string for when a user drops a light source.
56+
"""
57+
return "It's not wise to drop your source of light!"

0 commit comments

Comments
 (0)