Example #1
0
 def format_stats(num_tests, stats, use_color):
     return '{pl} {p}/{t} {fl} {f}/{t} {sl} {s}/{t}'.format(
         pl=util.color_string('PASS', 'green') if use_color else 'PASS',
         fl=util.color_string('FAIL', 'red') if use_color else 'FAIL',
         sl=util.color_string('SKIP', 'yellow') if use_color else 'SKIP',
         p=stats['pass'], f=stats['fail'],
         s=stats['skip'], t=num_tests)
Example #2
0
 def format_stats(num_tests, stats, use_color):
     return '{pl} {p}/{t} {fl} {f}/{t} {sl} {s}/{t}'.format(
         pl=util.color_string('PASS', 'green') if use_color else 'PASS',
         fl=util.color_string('FAIL', 'red') if use_color else 'FAIL',
         sl=util.color_string('SKIP', 'yellow') if use_color else 'SKIP',
         p=stats['pass'],
         f=stats['fail'],
         s=stats['skip'],
         t=num_tests)
Example #3
0
    def detail_card(player, tokens, **kwargs):
        from cards.creatures import CreatureType

        card_num = int(tokens[1])
        curr_card = player.hand[card_num]

        card_template = """
            ==============================
            {card_header}
            ==============================
            |(Fancy image goes here)     |
            |                            |
            |                            |
            |                            |
            |                            |
            |                            |
            ==============================
            {card_type}
            ==============================
            {card_abilities}
            |                            |
            |                            |
            |                            |
            |                            |
            {card_power}
            ==============================
        """

        args_dict = {}
        args_dict['card_header'] = '|' + color_string(curr_card.name, curr_card.get_color())
        args_dict['card_header'] += (' ' * (28 - len(curr_card.name)))

        if curr_card.mana_cost:
            mana_count = sum([curr_card.mana_cost[mana] for mana in curr_card.mana_cost])
            mana_str = ''.join([color_string(mana.short_name * curr_card.mana_cost[mana], mana.color) for mana in curr_card.mana_cost])
            args_dict['card_header'] = args_dict['card_header'][:mana_count * -1] + mana_str

        args_dict['card_header'] += '|'

        args_dict['card_type'] = '|' + player.hand[int(card_num)].type_name.ljust(28) + '|'

        if isinstance(curr_card, CreatureType):
            power_toughness = '{}/{}'.format(curr_card.power, curr_card.toughness)
            args_dict['card_power'] = '|' + power_toughness.rjust(28) + '|'

            ability_text = ''
            if curr_card.abilities:
                ability_text = ', '.join([ability.display_text for ability in curr_card.abilities])
            args_dict['card_abilities'] = '|' + ability_text.ljust(28) + '|'
        else:
            args_dict['card_power'] = '|' + (' ' * 28) + '|'
            args_dict['card_abilities'] = '|' + (' ' * 28) + '|'

        card_art = card_template.format(**args_dict)

        GameController.print_message(card_art)
Example #4
0
 def format_stats(num_tests, stats, use_color):
     return "{pl} {p}/{t} {fl} {f}/{t} {sl} {s}/{t}".format(
         pl=util.color_string("PASS", "green") if use_color else "PASS",
         fl=util.color_string("FAIL", "red") if use_color else "FAIL",
         sl=util.color_string("SKIP", "yellow") if use_color else "SKIP",
         p=stats["pass"],
         f=stats["fail"],
         s=stats["skip"],
         t=num_tests,
     )
Example #5
0
 def pprint_string(self):
     top_bottom = util.color_string('+' + ('-' * self.size) + '+',
                                    fore='blue',
                                    back='blue')
     side = util.color_string('|', fore='blue', back='blue')
     s = top_bottom + '\n'
     for y in range(self.size):
         s += side + ''.join([Cell.color(c)
                              for c in self.row(y)]) + side + '\n'
     return s + top_bottom
Example #6
0
    def __str__(self):
        tapped = ''
        if self.tapped:
            tapped = ': TAPPED'

        if self.get_color():
            return color_string(self.type_name + ' - ' + self.name + tapped, self.get_color())

        return self.type_name + ' - ' + self.name + tapped
Example #7
0
    def __str__(self):
        tapped = ''
        if self.tapped:
            tapped = ': TAPPED'

        if self.get_color():
            return color_string(self.type_name + ' - ' + self.name + tapped,
                                self.get_color())

        return self.type_name + ' - ' + self.name + tapped
Example #8
0
    def get_mana_string(player):
        mana_list = []

        for color_type in player.mana_pool:
            curr_string = ''

            if player.mana_pool[color_type] > 0:
                curr_string = color_string('O', color_type.color)
                curr_string *= player.mana_pool[color_type]

            if curr_string:
                mana_list.append(curr_string)

        return 'player mana:\n{}'.format(' '.join(mana_list))
Example #9
0
 def to_string(self, colored=False):
     label = util.color_string('PASS', 'green') if colored else 'PASS'
     return '{} {}'.format(label, self.test_name)
Example #10
0
 def color(cls, char):
     return util.color_string(char,
                              fore=Cell.FORE[char],
                              back=Cell.BACK[char])
Example #11
0
 def to_string(self, colored=False):
     label = util.color_string('FAIL', 'red') if colored else 'FAIL'
     return '{} {}: {}'.format(label, self.test_name, self.message)
Example #12
0
 def color(cls, c):
     return util.color_string(c, fore=Cell.FORE[c], back=Cell.BACK[c])
Example #13
0
 def to_string(self, colored=False):
     label = util.color_string('SKIP', 'yellow') if colored else 'SKIP'
     return '{} {}: {}'.format(label, self.test_name, self.reason)
Example #14
0
 def to_string(self, colored=False):
     label = util.color_string('PASS', 'green') if colored else 'PASS'
     return '{} {}'.format(label, self.test_name)
Example #15
0
def _maybe_color(text, color, do_color):
    return util.color_string(text, color) if do_color else text
Example #16
0
 def to_string(self, colored=False):
     label = util.color_string('SKIP', 'yellow') if colored else 'SKIP'
     return '{} {}: {}'.format(label, self.test_name, self.reason)
Example #17
0
 def to_string(self, colored=False):
     label = util.color_string('FAIL', 'red') if colored else 'FAIL'
     return '{} {}: {}'.format(label, self.test_name, self.message)