Card colors are from casting costs only
This commit is contained in:
parent
87c61cee6a
commit
ee0da6e0de
1 changed files with 2 additions and 20 deletions
22
mtg.py
22
mtg.py
|
@ -203,29 +203,9 @@ class Card:
|
||||||
self.sets = sets
|
self.sets = sets
|
||||||
self.rarity = rarity
|
self.rarity = rarity
|
||||||
self.text = text
|
self.text = text
|
||||||
self.colors = [color for color, cost in self.cost.mana.mana.iteritems() if cost > 0]
|
|
||||||
self.is_tapped = False
|
self.is_tapped = False
|
||||||
self.abilities = []
|
self.abilities = []
|
||||||
|
|
||||||
# Get color from land type
|
|
||||||
if 'land' in self.type.split(' '):
|
|
||||||
if 'mountain' in self.attributes:
|
|
||||||
self.colors.append('R')
|
|
||||||
if 'plains' in self.attributes:
|
|
||||||
self.colors.append('W')
|
|
||||||
if 'swamp' in self.attributes:
|
|
||||||
self.colors.append('B')
|
|
||||||
if 'island' in self.attributes:
|
|
||||||
self.colors.append('U')
|
|
||||||
if 'forest' in self.attributes:
|
|
||||||
self.colors.append('G')
|
|
||||||
|
|
||||||
if not self.colors:
|
|
||||||
# Try to determine the card's color based on its abilities. Not ideal, but maybe it'll help for now
|
|
||||||
for line in self.text:
|
|
||||||
for m in [ManaCost(c) for c in re.findall('{(\d*[WURGB]*)}',line)]:
|
|
||||||
self.colors.extend([color for color, c in m.mana.mana.iteritems() if c > 0 and color not in self.colors])
|
|
||||||
|
|
||||||
self.owner = owner
|
self.owner = owner
|
||||||
self.zone = None
|
self.zone = None
|
||||||
|
|
||||||
|
@ -242,6 +222,8 @@ class Card:
|
||||||
for i in xrange(other):
|
for i in xrange(other):
|
||||||
result.append(copy.copy(self))
|
result.append(copy.copy(self))
|
||||||
return result
|
return result
|
||||||
|
def colors(self):
|
||||||
|
return [color for color, cost in ManaCost(self.cost).mana.mana.iteritems() if cost > 0]
|
||||||
def store(self):
|
def store(self):
|
||||||
self.__stored = copy.copy(self)
|
self.__stored = copy.copy(self)
|
||||||
def restore(self):
|
def restore(self):
|
||||||
|
|
Loading…
Reference in a new issue