Beispiel #1
0
    def get(cls, card):
        """
        this card has a triggered ability when cycled that could be
        considered as the "real" mana cost
        """
        cycling_text = (r"\((?P<mana_cost>\{.+\}),\s+"
                        r"Discard this card\: Draw a card\.\)\n\n"
                        r"When you cycle %s(?:.+"
                        r"you may pay (?P<extra_cost>\{.+\}))?.+$" % card.name)
        cycling_match = re.search(cycling_text, card.text, re.I)
        if not cycling_match:
            return

        results = cycling_match.groupdict()
        parsed_cost = parse_mana_cost(results['mana_cost'])
        if results.get('extra_cost'):
            parsed_cost = merge_mana_costs(parsed_cost, results['extra_cost'])

        _cyc = dict(
            mana_cost=stitch_mana_cost(parsed_cost),
            converted_mana_cost=estimate_cmc(parsed_cost)
        )

        return {
            cls.key: _cyc
        }
Beispiel #2
0
    def _get_kicker_stuff(cls, card):
        kicker_costs = re.search(
            r'Kicker (\{.+\})(?:\s+and/or (\{.+\}))* \(You',
            card.text
        )
        if not kicker_costs:
            return {}

        kicker_colors = set()
        kickers = kicker_costs.groups()

        for cost in kickers:
            kicker_colors |= card.estimate_colors(cost, [])

        updated_cost = merge_mana_costs(card.mana_cost, *kickers)

        return dict(
            updated_colors=kicker_colors | card.colors,
            updated_cost=updated_cost,
            updated_cmc=estimate_cmc(updated_cost)
        )
Beispiel #3
0
    def get(cls, card):
        """
        Some designers, when laying out the curves, place suspends out as if
        their CMC was the suspend cost
        """
        # \u2014 is the specific em-dash returned by tutor
        has_suspend = re.search(u"Suspend \d+\u2014(\{.+\}) \(", card.text)
        if not has_suspend:
            return

        mana_cost = has_suspend.group(1)

        suspend_heuristic  = dict(
            mana_cost=mana_cost,
            converted_mana_cost=estimate_cmc(mana_cost)
        )

        suspend_colors = estimate_colors(mana_cost)
        if suspend_colors != card.colors:
            suspend_heuristic['colors'] = card.colors | suspend_colors

        return {cls.key: suspend_heuristic}