-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitems.py
30 lines (27 loc) · 811 Bytes
/
items.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class Item:
def __init__(
self,
name: str,
description: str,
value,
durability: int = 100,
lightsource: bool = False,
):
self.name = name
# If the item gives off light (like a torch)
self.lightsource = lightsource
self.durability = durability
self.description = description
self.value = value
def __str__(self): # pragma: no cover
return "{}\n=====\n{}\nValue: {}\n".format(
self.name, self.description, self.value
)
class Torch(Item): # pragma: no cover
def __init__(self):
super().__init__(
name="Torch",
description="A sturdy torch, suitable for lighting up dark places.",
value=0,
durability=10,
)