-
Notifications
You must be signed in to change notification settings - Fork 0
/
Effects.py
187 lines (156 loc) · 6.38 KB
/
Effects.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
from pygame import *
from random import *
from Buff import *
from Buffs import *
from Damage import *
from DrawBoard import *
from Effect import *
from card import *
from Constants import *
class BRK_EFF(Effect):
def __init__(self, card):
self.played = False
self.endTurn = False
self.beginTurn = False
self.onDam = True
self.board = getBoard()
self.host = card
def onDamage(self, card):
if card == self.host:
card.incPower(3)
# Grimscale oracle effect
# While Grimscale Oracle is in play, all other murlocs gain +1 attack
class GRM_EFF(Effect):
def __init__ (self, board, card):
self.played = True
self.endTurn = False
self.beginTurn = False
self.board = getBoard()
self.host = card
#On play give each other Murloc +1 attack
def onPlay(self):
spots = self.board.getSpots()
for i in range (2):
for j in range (7):
if spots[i][j].getOccupied():
card = spots[i][j].getCard()
if card.getCreatureType() == "Murloc" and card != self.host:
curBuff = GRM_BUFF(card, self.board)
card.addBuff(curBuff)
curBuff.applyBuff()
#On another creature being played, check if its a murloc and give buff if needed
def playCreature(self, card):
if card.getCreatureType() == "Murloc" and card.getID() != self.host.getID():
curBuff = GRM_BUFF(card, self.board)
card.addBuff(curBuff)
curBuff.applyBuff()
#When the Grimscale oracle dies, remove the buff from all other murlocs
def killCreature(self, card):
if card == self.host:
spots = self.board.getSpots()
for i in range (2):
for j in range (7):
if spots[i][j].getOccupied():
onlyOne = True
card = spots[i][j].getCard()
for buff in card.getBuffs():
if type(buff) == type(GRM_BUFF(None,None)) and onlyOne:
onlyOne = False
buff.removeBuff()
self.board.effects.remove(self)
class RAID_EFF(Effect):
def __init__ (self, card):
self.played = True
self.endTurn = False
self.beginTurn = False
self.board = getBoard()
self.host = card
self.turn = abs(1 - getTurn())
#On play give each other Murloc +1 attack
def onPlay(self):
spots = self.board.getSpots()
i = self.turn
for j in range (7):
if spots[i][j].getOccupied():
card = spots[i][j].getCard()
if card != self.host:
curBuff = GRM_BUFF(card, self.board)
card.addBuff(curBuff)
curBuff.applyBuff()
#On another creature being played, check if its a murloc and give buff if needed
def playCreature(self, card):
if self.turn == getTurn():
curBuff = GRM_BUFF(card, self.board)
card.addBuff(curBuff)
curBuff.applyBuff()
#When the Grimscale oracle dies, remove the buff from all other murlocs
def killCreature(self, card):
if card == self.host:
spots = self.board.getSpots()
i = self.turn
for j in range (7):
if spots[i][j].getOccupied():
onlyOne = True
card = spots[i][j].getCard()
for buff in card.getBuffs():
if type(buff) == type(GRM_BUFF(None,None)) and onlyOne:
onlyOne = False
buff.removeBuff()
self.board.effects.remove(self)
class CHMP_EFF(Effect):
def __init__ (self, card):
self.played = True
self.endTurn = False
self.beginTurn = False
self.board = getBoard()
self.host = card
self.turn = abs(1 - getTurn())
#On play give each other Murloc +1 attack
def onPlay(self):
spots = self.board.getSpots()
i = self.turn
for j in range (7):
if spots[i][j].getOccupied():
card = spots[i][j].getCard()
if card != self.host:
curBuff = CHMP_BUFF(card, self.board)
card.addBuff(curBuff)
curBuff.applyBuff()
#On another creature being played, check if its a murloc and give buff if needed
def playCreature(self, card):
if self.turn == getTurn():
curBuff = CHMP_BUFF(card, self.board)
card.addBuff(curBuff)
curBuff.applyBuff()
#When the Grimscale oracle dies, remove the buff from all other murlocs
def killCreature(self, card):
if card == self.host:
spots = self.board.getSpots()
i = self.turn
for j in range (7):
if spots[i][j].getOccupied():
onlyOne = True
card = spots[i][j].getCard()
for buff in card.getBuffs():
if type(buff) == type(CHMP_BUFF(None,None)) and onlyOne:
onlyOne = False
buff.removeBuff()
self.board.effects.remove(self)
class SPELL_DAMAGE(Effect):
def __init__ (self, board, card, spellDamage):
self.played = True
self.endTurn = False
self.beginTurn = False
self.board = getBoard()
self.host = card
self.damage = spellDamage
#On play give each other Murloc +1 attack
def onPlay(self):
self.host.getPlayer().addSpellDamage(self.damage)
def playCreature(self, card):
pass
#When the Grimscale oracle dies, remove the buff from all other murlocs
def killCreature(self, card):
if card == self.host:
self.host.getPlayer().addSpellDamage(-self.damage)
self.board.effects.remove(self)