Ejemplo n.º 1
0
    def setUp(self):
        card1 = Card()
        card1.name = u'Name'
        card1.mana_cost = u'2UUU'
        card1.types = [u'Legendary', u'Creature']
        card1.subtypes = [u'Human', u'Wizard']
        card1.power = 3
        card1.toughness = 4
        card1.rules_text = u'Rules Text (This is just an example.)'
        card1.flavor_text = u'"Flavor text"'
        card1.printings = [(u'Time Spiral', u'Rare')]
        card1.ruling_data = [(u'9/25/2006', u'Ruling Text'),
                             (u'9/25/2006', u'Ruling Two')]
        card2 = Card()
        card2.name = u'Worldspine Wurm'
        card2.mana_cost = u'8GGG'
        card2.types = [u'Creature']
        card2.subtypes = [u'Wurm']
        card2.power = 15
        card2.toughness = 15
        card2.rules_text = u'Trample ; When Worldspine Wurm dies, put three 5/5 green Wurm creature tokens with trample onto the battlefield. ; When Worldspine Wurm is put into a graveyard from anywhere, shuffle it into its owner\'s library.'
        card2.printings = [(u'Return to Ravnica', u'Mythic Rare')]

        self.cards = [card1, card2]
Ejemplo n.º 2
0
    def setUp(self):
        card1 = Card()
        card1.name = u'Name'
        card1.mana_cost = u'2UUU'
        card1.types = [u'Legendary', u'Creature']
        card1.subtypes = [u'Human', u'Wizard']
        card1.power = 3
        card1.toughness = 4
        card1.rules_text = u'Rules Text (This is just an example.)'
        card1.flavor_text = u'"Flavor text"'
        card1.printings = [(u'Time Spiral', u'Rare')]
        card1.ruling_data = [(u'9/25/2006', u'Ruling Text'),
                             (u'9/25/2006', u'Ruling Two')]
        card2 = Card()
        card2.name = u'Worldspine Wurm'
        card2.mana_cost = u'8GGG'
        card2.types = [u'Creature']
        card2.subtypes = [u'Wurm']
        card2.power = 15
        card2.toughness = 15
        card2.rules_text = u'Trample ; When Worldspine Wurm dies, put three 5/5 green Wurm creature tokens with trample onto the battlefield. ; When Worldspine Wurm is put into a graveyard from anywhere, shuffle it into its owner\'s library.'
        card2.printings = [(u'Return to Ravnica', u'Mythic Rare')]

        self.cards = [card1, card2]
Ejemplo n.º 3
0
    def extract_many(self):
        cards = []

        for item in self.document.cssselect('tr.cardItem'):
            for c in item.cssselect('div.cardInfo'):
                card = Card()
                card.name = self.text_field(c, '.cardTitle')
                card.mana_cost = self.symbol_field(c, '.manaCost img')
                typeline = self.text_field(c, '.typeLine')
                t = [l.strip() for l in typeline.split('\n') if l.strip()]
                card.types = t.pop(0)
                if t:
                    number = t.pop(0).strip('()')
                    if '/' in number:
                        card.power, card.toughness = number.split('/')
                    else:
                        card.loyalty = number
                card.types = clean_dashes(card.types)
                card.rules_text = self.box_field(c, 'div.rulesText p', ' ; ')
                card.printings = self.printings(item, 'td.rightCol img')
            cards.append(card)
        return cards
Ejemplo n.º 4
0
    def extract_many(self):
        cards = []
        for card_item in self.document.cssselect('.cardItem'):
            card = Card()
            cardinfo = card_item.cssselect('.cardInfo')[0]
            card.name = self.text_field(cardinfo, '.cardTitle')
            card.mana_cost = self.symbol_field(cardinfo, '.manaCost img')
            card.rules_text = self.box_field(cardinfo, '.rulesText p', '\n')

            typeline = self.text_field(cardinfo, '.typeLine')
            if '(' in typeline:
                typeline, number = typeline.rsplit(' ', 1)
                number = number.strip('()')
                if number.isnumeric():
                    card.loyalty = number
                else:
                    card.power, card.toughness = self.split_pow_tgh(number)
            card.types, card.subtypes = self.types(typeline.strip('\n '))
            setinfo = card_item.cssselect('.setVersions')[0]
            card.printings = self.printings(setinfo, 'img')
            card.printings_full = self.printings(setinfo, 'img', full=True)
            cards.append(card)
        return cards
Ejemplo n.º 5
0
    def extract_many(self):
        cards = []
        for card_item in self.document.cssselect('.cardItem'):
            card = Card()
            cardinfo = card_item.cssselect('.cardInfo')[0]
            card.name = self.text_field(cardinfo, '.cardTitle')
            card.mana_cost = self.symbol_field(cardinfo, '.manaCost img')
            card.rules_text = self.box_field(cardinfo, '.rulesText p', '\n')

            typeline = self.text_field(cardinfo, '.typeLine')
            if '(' in typeline:
                typeline, number = typeline.rsplit(' ', 1)
                number = number.strip('()')
                if number.isnumeric():
                    card.loyalty = number
                else:
                    card.power, card.toughness = self.split_pow_tgh(number)
            card.types, card.subtypes = self.types(typeline.strip('\n '))
            setinfo = card_item.cssselect('.setVersions')[0]
            card.printings = self.printings(setinfo, 'img')
            card.printings_full = self.printings(setinfo, 'img', full=True)
            cards.append(card)
        return cards