Support for hybrid symbols in the database loader

This commit is contained in:
Correl Roush 2010-09-02 11:57:00 -04:00
parent 436c635eb2
commit 4932e7c1fa

View file

@ -40,7 +40,7 @@ class TextDB(Database):
} }
elif card and line: elif card and line:
# Load the data into the card # Load the data into the card
if not card['cost'] and re.match('^X?\d*[{0}]*$'.format(' '.join(Mana.types.keys())), line): if not card['cost'] and re.match('^X?\d*(\((\d+|[{0}])/(\d+|[{0}])\))*[{0}]*$'.format(''.join(Mana.types.keys())), line.upper()):
card['cost'] = line card['cost'] = line
continue continue
elif not card['type']: elif not card['type']:
@ -93,10 +93,5 @@ class WagicDB(Database):
if __name__ == '__main__': if __name__ == '__main__':
db = TextDB('db.txt') db = TextDB('db.txt')
deck = Deck() c = db.getCard('Balefire Liege')
deck.load('decks/BlackSiege.txt', db) print c
wagic = Deck()
w = WagicDB('/home/correlr/Download/wth/PSP/GAME/WTH')
for card in deck:
wagic.append(w.getCard(card.name, card))