def CheckMatchPileDriver(g): """Owned all copies of a card.""" accumed_per_player = g.cards_accumalated_per_player() ret = [] game_size = len(g.get_player_decks()) for player, card_dict in accumed_per_player.iteritems(): if g.get_player_deck(player).WinPoints() > 1.0: for card, quant in card_dict.iteritems(): if quant == card_info.num_copies_per_game(card, game_size): ret.append(achievement(player, "Bought all %d copies of %s" % (quant, card), (card, quant))) return ret
def CheckMatchPileDriver(g): accumed_per_player = g.cards_accumalated_per_player() ret = [] for player, card_dict in accumed_per_player.iteritems(): if g.get_player_deck(player).WinPoints() > 1.0: for card, quant in card_dict.iteritems(): if quant == card_info.num_copies_per_game(card, len(g.get_player_decks())): ret.append( {'player': player, 'reason': 'Bought all %d copies of %s' % ( quant, card)} ) return ret
def CheckMatchPileDriver(g): """Owned all copies of a card.""" accumed_per_player = g.cards_accumalated_per_player() ret = [] game_size = len(g.get_player_decks()) for player, card_dict in accumed_per_player.iteritems(): if g.get_player_deck(player).WinPoints() > 1.0: for card, quant in card_dict.iteritems(): if quant == card_info.num_copies_per_game(card, game_size): ret.append( achievement( player, 'Bought all %d copies of %s' % (quant, card), (card, quant))) return ret
def __init__(self, game): self.game = game self.turn_ordered_players = game.get_player_decks(sort_by_turn_order=True) self.supply = ConvertibleDefaultDict(value_type=int) num_players = len(game.get_player_decks()) for card in itertools.chain(card_info.EVERY_SET_CARDS, game.get_supply()): self.supply[card] = card_info.num_copies_per_game(card, num_players) self.player_decks = ConvertibleDefaultDict(value_type=lambda: ConvertibleDefaultDict(int)) self.player_vp_tokens = collections.defaultdict(int) self.supply["Copper"] = self.supply["Copper"] - (len(self.turn_ordered_players) * 7) for player in self.turn_ordered_players: self.player_decks[player.name()]["Copper"] = 7 self.player_decks[player.name()]["Estate"] = 3 self.turn_ind = 0
def CheckMatchMegaTurn(g): ret = [] scores = [] if 'Colony' in g.get_supply(): biggest_victory = 'Colony' else: biggest_victory = 'Province' victory_copies = card_info.num_copies_per_game(biggest_victory, len(g.get_player_decks())) for turn in g.get_turns(): new_cards = turn.buys + turn.gains if len(new_cards) < victory_copies: continue if new_cards.count(biggest_victory) == victory_copies: ret.append( {'player': turn.player.name(), 'reason': "Obtained all of the %s cards in one turn" % biggest_victory}) return ret
def CheckMatchMegaTurn(g): """Bought all the Provinces or Colonies in a single turn.""" ret = [] scores = [] if 'Colony' in g.get_supply(): biggest_victory = 'Colony' else: biggest_victory = 'Province' victory_copies = card_info.num_copies_per_game(biggest_victory, len(g.get_player_decks())) for turn in g.get_turns(): new_cards = turn.buys + turn.gains if len(new_cards) < victory_copies: continue if new_cards.count(biggest_victory) == victory_copies: ret.append( achievement(turn.player.name(), "Obtained all of the %s cards in one turn" % biggest_victory, biggest_victory)) return ret
def CheckMatchMegaTurn(g): """Bought all the Provinces or Colonies in a single turn.""" ret = [] scores = [] if 'Colony' in g.get_supply(): biggest_victory = 'Colony' else: biggest_victory = 'Province' victory_copies = card_info.num_copies_per_game(biggest_victory, len(g.get_player_decks())) for turn in g.get_turns(): new_cards = turn.buys + turn.gains if len(new_cards) < victory_copies: continue if new_cards.count(biggest_victory) == victory_copies: ret.append( achievement( turn.player.name(), "Obtained all of the %s cards in one turn" % biggest_victory, biggest_victory)) return ret
def __init__(self, game): self.game = game self.turn_ordered_players = game.get_player_decks( sort_by_turn_order=True) self.supply = ConvertibleDefaultDict(value_type=int) num_players = len(game.get_player_decks()) for card in itertools.chain(card_info.EVERY_SET_CARDS, game.get_supply()): self.supply[card] = card_info.num_copies_per_game(card, num_players) self.player_decks = ConvertibleDefaultDict( value_type=lambda: ConvertibleDefaultDict(int)) self.player_vp_tokens = collections.defaultdict(int) self.supply['Copper'] = self.supply['Copper'] - ( len(self.turn_ordered_players) * 7) for player in self.turn_ordered_players: self.player_decks[player.name()]['Copper'] = 7 self.player_decks[player.name()]['Estate'] = 3 self.turn_ind = 0