def get_resources(): resources = {} resources["land_drops_left"] = player.land_drops_left # group = CardGroup(player.bfield) untapped_lands = [c for c in player.bfield if ut.is_superset(c.types, ["Land"]) and "tapped" not in c.state] mana_potential = [c.mana_source_stats() for c in untapped_lands] resources["mana_potential"] = mana_potential resources["life"] = 20
def get_cards_in_hand(player, valid_types=None, invert=False): card_list = player.hand if valid_types is None: valid_cards = card_list else: flags = [ut.is_superset(c.types, valid_types) for c in card_list] if invert: flags = ut.not_list(flags) valid_cards = ut.compress(card_list, flags) return valid_cards
def get_etb_modifiers(card, player=None): if 'tap' in card.heuristic_types: return ['tapped'] if 'tango' in card.heuristic_types: if player is None: return ['tapped'] else: basic_lands_under_control = [ c for c in player.bfield if ut.is_superset(c.types, ['Basic', 'Land']) ] if len(basic_lands_under_control) >= 2: return [] else: return ['tapped'] else: return []
def get_cards_in_play(player, valid_types=None): return [c for c in player.bfield if valid_types is None or ut.is_superset(c.types, valid_types)]