예제 #1
0
    def get(cls, card):
        """
        if the card has phyrexian mana in the cost, often designers
        will put in on curve as if people will always pay life and put it in
        a colorless section
        """

        if not card.mana_cost or not '/P' in card.mana_cost:
            return

        parsed_cost = parse_mana_cost(card.mana_cost)
        modified_cost = [sym for sym in parsed_cost if '/P' not in sym]

        heuristic = dict(
            mana_cost=stitch_mana_cost(modified_cost),
            colors=card.estimate_colors(modified_cost)
        )

        num_phyrexian_symbols = len(parsed_cost) - len(modified_cost)
        heuristic['converted_mana_cost'] = (card.converted_mana_cost -
                                            num_phyrexian_symbols)

        return {
            cls.key: heuristic
        }
예제 #2
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
        }
예제 #3
0
    def get(cls, card):
        """
        if designers know that players are going to kick a card all the time,
        then they'll lay it out at a cost and (maybe a color) based on that
        """

        kicker_result = cls._get_kicker_stuff(card)
        if not kicker_result:
            return

        full_dict = dict(
            mana_cost=stitch_mana_cost(kicker_result['updated_cost']),
            converted_mana_cost=kicker_result['updated_cmc']
        )

        # potentially change the colors
        off_color_result = _handle_off_color_kicker.get(card)
        if off_color_result:
            full_dict.update(off_color_result[_handle_off_color_kicker.key])

        return {
            cls.key: full_dict
        }