-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrongusRoom.py
86 lines (62 loc) · 2.15 KB
/
grongusRoom.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#GrongusRoom2
#For room stuff
import GrongusCharacter
class Room:
#name,x coords, y coords, energyCost,discovered,canContainGrongus,icon
def __init__(self,name,x,y,energyCost,discovered,canContain,icon):
self.name = name
self.roomCoords = {'x':x,'y':y}
self.energyCost = energyCost
self.discovered = discovered
self.canContainGrongus = canContain
self.HiddenImage = "X"
self.revealedImage = icon
self.roomImage = self.HiddenImage
self.roomContents = {}
def roomSounds(self,player):
if player.coords
def roomEntered(self,icon):
self.roomImage = icon
self.discovered = True
def roomExited(self):
self.roomImage = self.revealedImage
def updateRoom(self,icon,status):
self.roomImage = icon
self.discovered = status
def printRoomCoords(self):
print (self.roomName, end = " ")
print (self.roomCoords)
def printRoom(self):
print(self.roomImage,end = "")
def addToContents(self,key,thing):
self.roomContents[key] = thing
"""Note:I recommend overriding this with subclass method, since
each room will want to have special effects it does to the player
"""
def applyRoomEffects(self,player):
player.curEnergy -= self.energyCost
def containsObject(self,thing):
if thing in self.roomContents:
return True
def attackRoomContents(self,damage):
for key in self.roomContents:
object = self.roomContents[key]
print("Attacking: ",object.name, " for ", damage," damage!")
object.takeDamage(damage)
print("It has ",object.curHealth," HP remaining")
class SandRoom(Room):
def __init__(self,x,y):
#name,x coords, y coords, energyCost,discovered,canContainGrongus,icon
super().__init__("Sand",x,y,1,False,True,"S")
class RestPool(Room):
def __init__(self,x,y):
#name,x coords, y coords, energyCost,discovered,canContainGrongus,icon
super().__init__("Resting Pool",x,y,0,False, False,"W")
def applyRoomEffects(self,player):
player.curEnergy += 10
class BlackPit(Room):
def __init__(self,x,y):
#name,x coords, y coords, energyCost,discovered,canContainGrongus,icon
super().init__("Black Pit",x,y,1,False,False,"O")
def applyRoomEffects(self,player):
player.curHealth = 0