def get_heuristic_info(card): """ hueristic category label (fetch-land, removal, creature) """ heuristic_types = [] heuristic_subtypes = [] if ut.is_subset(['Basic', 'Land'], card.types): heuristic_types += ['basic'] RuleHeuristics = mtgrules.RuleHeuristics for block in RuleHeuristics._iter_blocks(card): if RuleHeuristics.is_tapland(block, card): heuristic_types += ['tap'] if RuleHeuristics.is_tangoland(block, card): heuristic_types += ['tango'] if RuleHeuristics.is_triland(block, card): heuristic_types += ['tri'] if RuleHeuristics.is_painland(block, card): heuristic_types += ['pain'] if mtgrules.is_fetchland(block, card): heuristic_types += ['fetch'] return heuristic_types, heuristic_subtypes
def get_fetch_search_targets(effect, card, deck=None): from mtgmonte import mtgobjs valid_types = RuleHeuristics.get_fetched_lands(effect, card) targets = [] for type_ in valid_types: if deck is None: # Infer normal sort of thing out of deck context card = mtgobjs.lookup_card(type_) targets.add(card) else: for card in deck.library: alltypes = card.subtypes + card.types alltypes = [x.lower() for x in alltypes] if ut.is_subset(type_, alltypes): targets += [card] return targets