-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathitems.py
More file actions
48 lines (39 loc) · 1.23 KB
/
items.py
File metadata and controls
48 lines (39 loc) · 1.23 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class Weapon:
def __init__(self):
raise NotImplementedError("Do not create raw Weapon objects.")
def __str__(self):
return self.name
class Rock(Weapon):
def __init__(self):
self.name = "Rock"
self.description = "A rock the size of a baseball."
self.damage = 5
self.value = 1
class Dagger(Weapon):
def __init__(self):
self.name = "Dagger"
self.description = "A small dagger. It looks pretty sharp."
self.damage = 10
self.value = 20
class RustySword(Weapon):
def __init__(self):
self.name = "Rusty Sword"
self.description = "A rusty sword. Its pretty sharp still"
self.damage = 20
self.value = 100
# Consumables
class Consumable:
def __init__(self):
raise NotImplementedError("Do not create raw Consumable objects.")
def __str__(self):
return "{} (+{} Hp)".format(self.name, self.healing_value)
class PlainBread(Consumable):
def __init__(self):
self.name = "Plain slice of bread"
self.healing_value = 10
self.value = 12
class HealingPotion(Consumable):
def __init__(self):
self.name = "Healing Patch"
self.healing_value = 50
self.value = 60