Get card color from land type

This commit is contained in:
Correl Roush 2010-07-01 18:10:16 -04:00
parent f93d674b8f
commit 621d5da79b

13
mtg.py
View file

@ -184,6 +184,19 @@ class Card:
self.is_tapped = False
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: