-
Notifications
You must be signed in to change notification settings - Fork 0
/
minions.py
330 lines (280 loc) · 8.33 KB
/
minions.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Minion import Minion
import utils
import json
import random
with open('data/cards.json') as f:
allCards = json.load(f)
with open('data/cards.collectible.json') as f:
allCardsCollectible = json.load(f)
# Brann Bronzebeard
class LOE_077(Minion):
pass
# Darnassus Aspirant
class AT_038(Minion):
def battlecry(self,pos):
self.player.modifyMaxMana(1)
return self,pos
def deathrattle(self,pos):
self.player.modifyMaxMana(-1)
self.player.modifyMana(-1)
# Lance Carrier
class AT_084(Minion):
def battlecry(self,pos):
if self.target == None:
self.target = utils.selectFriendlyMinion(self.player)
if self.target != None:
self.target.modifyAttack(2)
return self,pos
# Imp Gang Boss
class BRM_006(Minion):
def modifyHealth(self,incremental):
preHealth = self.getHealth()
super(self.__class__, self).modifyHealth(incremental)
if self.getHealth() < preHealth:
for cardData in allCards:
if cardData['id'] == 'BRM_006t':
card = utils.createCard(cardData,self.player)
imp = Minion(card,self.player,self.game)
self.player.insertToBoard(imp,self.getBoardPos() + 1)
return
# Emperor Thaurissan
class BRM_028(Minion):
def endTurn(self):
for card in self.player.getHand():
card.modifyCost(-1)
# Voidwalker
class CS2_065(Minion):
pass
# Abusive Sergeant
class CS2_188(Minion):
def battlecry(self,pos):
if self.target == None:
self.target = utils.selectMinion(self.player)
if self.target != None:
self.target.modifyAttack(2)
def minionTask(minion):
minion.modifyAttack(-2)
self.target.addTask(minionTask,self.game.currentTime() + 1)
return self,pos
# Ironbeak Owl
class CS2_203(Minion):
def battlecry(self,pos):
if self.target == None:
self.target = utils.selectMinion(self.player)
if self.target != None:
utils.silence(self.target)
return self,pos
# Big Game Hunter
class EX1_005(Minion):
def battlecry(self,pos):
if self.target == None:
minAttack = self.getTargetMinAttack()
self.target = utils.selectMinionWithMinAttack(self.player,minAttack)
if self.target != None:
self.target.die()
return self,pos
# Argent Squire
class EX1_008(Minion):
pass
# Defender of Argus
class EX1_093(Minion):
def battlecry(self,pos):
if pos > 1:
leftMinion = self.game.getTarget(self.player,['L',str(pos-1)])
leftMinion.setTaunt()
leftMinion.modifyAttack(1)
leftMinion.modifyMaxHealth(1)
leftMinion.modifyHealth(1)
if pos <= self.player.totalMinionNum():
rightMinion = self.game.getTarget(self.player,['L',str(pos)])
rightMinion.setTaunt()
rightMinion.modifyAttack(1)
rightMinion.modifyMaxHealth(1)
rightMinion.modifyHealth(1)
return self,pos
# Loot Hoarder
class EX1_096(Minion):
def deathrattle(self,pos):
self.player.draw()
# Leeroy Jenkins
class EX1_116(Minion):
def battlecry(self,pos):
for cardData in allCards:
if cardData['id'] == 'EX1_116t':
card_1 = utils.createCard(cardData,self.player)
card_2 = utils.createCard(cardData,self.player)
owner = self.player.getComponent()
whelp_1 = Minion(card_1,owner,self.game)
whelp_2 = Minion(card_2,owner,self.game)
whelpPos = owner.totalMinionNum() + 1
owner.insertToBoard(whelp_1,whelpPos)
owner.insertToBoard(whelp_2,whelpPos)
break
return self,pos
# Druid of the Claw
class EX1_165(Minion):
def chooseOne(self):
cmd = int(raw_input(self.player.getName() +\
': Choose One: [1]Charge; or [2]+2 Health and Taunt: '))
minion = None
if cmd == 1:
for cardData in allCards:
if cardData['id'] == 'EX1_165t1':
card = utils.createCard(cardData,self.player)
minion = Minion(card,self.player,self.game)
elif cmd == 2:
for cardData in allCards:
if cardData['id'] == 'EX1_165t2':
card = utils.createCard(cardData,self.player)
minion = Minion(card,self.player,self.game)
return minion
# Keeper of the Grove
class EX1_166(Minion):
def chooseOne(self):
damage = 2
cmd = int(raw_input(self.player.getName() + ': Choose One: [1]Deal ' + \
str(damage) + ' damage; or [2]Silence a minion: '))
if cmd == 1:
target = utils.selectTarget(self.player)
target.modifyHealth(-damage)
elif cmd == 2:
minion = utils.selectMinion(self.player)
if minion != None:
utils.silence(minion)
return self
# Azure Drake
class EX1_284(Minion):
def battlecry(self,pos):
self.spellDamage = 1
self.player.draw()
return self,pos
# Sea Giant
class EX1_586(Minion):
pass
# Treant (Charge. At the end of the turn, destroy this minion)
class EX1_tk9(Minion):
def __init__(self,card,player,game):
super(self.__class__, self).__init__(card,player,game)
def task(game):
self.die()
self.addTask(task,game.currentTime() + 1)
# Haunted Creeper
class FP1_002(Minion):
def deathrattle(self,pos):
for cardData in allCards:
if cardData['id'] == 'FP1_002t':
card_1 = utils.createCard(cardData,self.player)
card_2 = utils.createCard(cardData,self.player)
spider_1 = Minion(card_1,self.player,self.game)
spider_2 = Minion(card_2,self.player,self.game)
self.player.insertToBoard(spider_1,pos)
self.player.insertToBoard(spider_2,pos)
return
# Shade of Naxxramas
class FP1_005(Minion):
def startTurn(self):
self.modifyAttack(1)
self.modifyMaxHealth(1)
self.modifyHealth(1)
# Nerubian Egg
class FP1_007(Minion):
def deathrattle(self,pos):
for cardData in allCards:
if cardData['id'] == 'FP1_007t':
card = utils.createCard(cardData,self.player)
nerubian = Minion(card,self.player,self.game)
self.player.insertToBoard(nerubian,pos)
return
# Sludge Belcher
class FP1_012(Minion):
def deathrattle(self,pos):
for cardData in allCards:
if cardData['id'] == 'FP1_012t':
card = utils.createCard(cardData,self.player)
minion = Minion(card,self.player,self.game)
self.player.insertToBoard(minion,pos)
return
# Unstable Ghoul
class FP1_024(Minion):
def deathrattle(self,pos):
for minion in self.game.getFirstPlayer().getAllMinions() + \
self.game.getSecondPlayer().getAllMinions():
minion.modifyHealth(-1)
# Loatheb
class FP1_030(Minion):
def battlecry(self,pos):
scheduledTime = self.game.currentTime() + 3
component = self.player.getComponent()
component.modifySpellCostAddOn(5)
def task(game):
component.modifySpellCostAddOn(-5)
self.game.addTask(task,scheduledTime)
return self,pos
# Vitality Totem
class GVG_039(Minion):
def endTurn(self):
self.player.modifyHealth(4)
# Shielded Minibot
class GVG_058(Minion):
pass
# Gilblin Stalker
class GVG_081(Minion):
pass
# Piloted Shredder
class GVG_096(Minion):
def deathrattle(self,pos):
#### This is for testing use ####
# for cardData in allCardsCollectible:
# if cardData['id'] == 'GVG_058':
# card = utils.createCard(cardData,self.player)
# minion = GVG_058(card,self.player,self.game)
# self.player.insertToBoard(minion,self.getBoardPos())
# return
cardNamePool = []
for card in allCardsCollectible:
if 'cost' in card and card['cost'] == 2 and card['type'] == \
'MINION' and card['id'] in globals():
cardNamePool.append(card)
cardData = random.choice(cardNamePool)
card = utils.createCard(cardData,self.player)
minion = globals()[cardData['id']](card,self.player,self.game)
self.player.insertToBoard(minion,pos)
return
# Dr. Boom
class GVG_110(Minion):
def battlecry(self,pos):
for cardData in allCards:
if cardData['id'] == 'GVG_110t':
card_1 = utils.createCard(cardData,self.player)
card_2 = utils.createCard(cardData,self.player)
boom_1 = GVG_110t(card_1,self.player,self.game)
boom_2 = GVG_110t(card_2,self.player,self.game)
self.player.insertToBoard(boom_1,pos)
self.player.insertToBoard(boom_2,pos+1)
break
return self,pos+1
# Boom Bot
class GVG_110t(Minion):
def deathrattle(self,pos):
numberOfEnemies = self.player.getComponent().totalMinionNum() + 1
target = random.randint(0,numberOfEnemies-1)
damage = random.randint(1,4)
command = ['U',str(target),str(-damage)]
self.game.modifyHealth(self.player, command)
# Dark Peddler
class LOE_023(Minion):
def battlecry(self,pos):
return self,pos
# Ancient of Lore
class NEW1_008(Minion):
def chooseOne(self):
cmd = int(raw_input(self.player.getName() +\
': Choose One: [1]Draw a card; or [2]Restore 5 Health: '))
if cmd == 1:
self.player.draw()
elif cmd == 2:
target = utils.selectTarget(self.player)
target.modifyHealth(5)
return self