def on_ui_button_press(self, *, ui_element):
     play_card = ui_element == self.buttons['Yes']
     response_event = pygame.event.Event(
         pygame.USEREVENT,
         dict(user_type='custom_event',
              event=ResponseEvent('vassal', play_card)))
     pygame.event.post(response_event)
示例#2
0
 def on_ui_button_press(self, *, ui_element):
     selected_card_names = [card.name for card in self.selected_cards]
     response_event = pygame.event.Event(
         pygame.USEREVENT,
         dict(user_type='custom_event',
              event=ResponseEvent('chapel', selected_card_names)))
     pygame.event.post(response_event)
示例#3
0
 def on_ui_button_press(self, *, ui_element):
     selected_card_name = self.selected_cards[0].name
     response_event = pygame.event.Event(
         pygame.USEREVENT,
         dict(user_type='custom_event',
              event=ResponseEvent('throneroom', selected_card_name)))
     pygame.event.post(response_event)
示例#4
0
    def on_ui_button_press(self, *, ui_element):
        selected_card_name = [card.name for card in self.selected_cards][0]

        if self.gain_card is None:
            self.gain_card = selected_card_name
            self.set_prompt_text(second_prompt_text)
            self.selected_cards = []
            self.buttons['Done'].enabled = False
            self.set_cards(self.hand_card_names + [selected_card_name])
            return

        response_content = (self.gain_card, selected_card_name)
        response_event = pygame.event.Event(
            pygame.USEREVENT,
            dict(user_type='custom_event',
                 event=ResponseEvent('artisan', response_content)))
        pygame.event.post(response_event)
示例#5
0
    def on_ui_button_press(self, *, ui_element):
        next_cards = ([
            card.name for card in self.card_view.cards
            if card not in self.selected_cards
        ])

        remaining_count = self.expected_count - len(next_cards)
        if len(self.remaining_candidates) >= remaining_count > 0:
            next_cards.extend(self.remaining_candidates[:remaining_count])
            self.remaining_candidates = self.remaining_candidates[
                remaining_count:]
            self.selected_cards = []
            self.set_cards(next_cards)
            return

        response_event = pygame.event.Event(
            pygame.USEREVENT,
            dict(user_type='custom_event',
                 event=ResponseEvent('library', next_cards)))
        pygame.event.post(response_event)
    def on_ui_button_press(self, *, ui_element):
        selected_card_name = [card.name for card in self.selected_cards][0]

        if self.trash_card is None:
            self.trash_card = selected_card_name
            self.set_prompt_text(second_prompt_text + selected_card_name)
            self.selected_cards = []
            self.buttons['Done'].enabled = False

            next_cards = self.supply_card_names
            trash_card_data = util.get_card_data(self.trash_card)
            if trash_card_data is not None:
                next_cards = util.filter_card_names(next_cards, f'card.cost <= {trash_card_data["Cost"] + 2}')
            self.set_cards(next_cards)
            return

        response_content = (self.trash_card, selected_card_name)
        response_event = pygame.event.Event(
            pygame.USEREVENT,
            dict(user_type='custom_event', event=ResponseEvent('remodel', response_content))
        )
        pygame.event.post(response_event)
示例#7
0
    def on_ui_button_press(self, *, ui_element):
        selected_card_names = [card.name for card in self.selected_cards]

        if self.last_step:
            self.cards_to_discard = selected_card_names
        else:
            self.cards_to_trash = selected_card_names

            if len(selected_card_names) != 2:
                next_cards = [card.name for card in self.card_view.cards if card not in self.selected_cards]
                self.selected_cards = []
                self.set_prompt_text(second_prompt_text)
                self.set_cards(next_cards)
                self.last_step = True
                return

        response_content = (self.cards_to_trash, self.cards_to_discard)
        response_event = pygame.event.Event(
            pygame.USEREVENT,
            dict(user_type='custom_event', event=ResponseEvent('sentry', response_content))
        )
        pygame.event.post(response_event)