-
Notifications
You must be signed in to change notification settings - Fork 0
/
card.py
81 lines (76 loc) · 1.94 KB
/
card.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
class card(object):
def __init__(self,data,player):# data is a dictionary
self.data = copy.deepcopy(data)
self.player = player
def getID(self):
return self.data['id']
def getType(self):
return self.data['type']
def isSpell(self):
if self.getType() == 'SPELL':
return True
else:
return False
def isBattlecry(self):
if 'mechanics' in self.data and 'BATTLECRY' in self.data['mechanics']:
return True
else:
return False
def isChooseOne(self):
if 'text' in self.data and 'Choose One' in self.data['text']:
return True
else:
return False
def isMinion(self):
if self.getType() == 'MINION':
return True
else:
return False
def getCost(self):
cost = self.data['cost']
if self.isSpell():
cost += self.player.getSpellCostAddOn()
if cost < 0:
return 0
else:
return cost
def getName(self):
return self.data['name']
def getAttack(self):
return self.data['attack']
def getHealth(self):
return self.data['health']
def hasStealth(self):
if 'mechanics' in self.data and 'STEALTH' in self.data['mechanics']:
return True
else:
return False
def hasDivineShield(self):
if 'mechanics' in self.data and 'DIVINE_SHIELD' in self.data['mechanics']:
return True
else:
return False
def isTaunt(self):
if 'mechanics' in self.data and 'TAUNT' in self.data['mechanics']:
return True
else:
return False
def removeDivineShield(self):
if self.hasDivineShield():
self.data['mechanics'].remove('DIVINE_SHIELD')
def silence(self):
self.data.pop("mechanics", None)
def modifyCost(self,incremental):
self.data['cost'] += incremental
def getTargetMinAttack(self):
return self.data['playRequirements']['REQ_TARGET_MIN_ATTACK']
class card_EX1_586(card):
def getCost(self):
newCost = self.data['cost'] - self.player.totalMinionNum() - \
self.player.getComponent().totalMinionNum()
if newCost < 0:
newCost = 0
return newCost