Get a card's color from its abilities if it has no cost (i.e. special lands)
This commit is contained in:
parent
0dc2e4e794
commit
f93d674b8f
1 changed files with 6 additions and 0 deletions
6
mtg.py
6
mtg.py
|
@ -184,6 +184,12 @@ class Card:
|
|||
self.is_tapped = False
|
||||
self.abilities = []
|
||||
|
||||
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.zone = None
|
||||
|
||||
|
|
Loading…
Reference in a new issue