Esempio n. 1
0
def black_as_sabotage_using_hint(hint, game_control, user, interfaces):
    @invoke_on_success(user, SKILL)
    def to_sabotage(gc, args):
        checking.only_one_card_of_color(gc.cards_by_ids(args['use']),
                                        card.BLACK)
        return sabotage.sabotage_check(gc, args)
    interfaces[SKILL] = to_sabotage
    cards = filter(lambda c: c.color() == card.BLACK,
                   game_control.player_cards_at(user, 'all'))
    targets = sabotage.sabotage_targets(game_control, user)
    if len(targets) == 0:
        return
    hints.add_method_to(hint, SKILL,
                        hints.join_req(hints.fixed_card_count(cards, 1),
                                       hints.fixed_target_count(targets, 1)))
Esempio n. 2
0
 def _hint_detail(self):
     targets = self.game_control.players_from_current()
     targets.remove(self.player)
     import ext.src.hint_common as hints
     return hints.filter_empty(hints.allow_abort(hints.add_method_to(
                     hints.basic_cards_hint(), 'bequeathed strategy',
                     hints.join_req(hints.min_card_count(self.cards, 1),
                                    hints.fixed_target_count(targets, 1)))))
Esempio n. 3
0
def using_hint(hint, gc, user, interfaces):
    @invoke_on_success(user, EQUIP_NAME)
    def to_slash(gc, args):
        two_cards(gc.cards_by_ids(args['use']))
        args['action'] = 'slash'
        return slash.slash_check(gc, args)
    if 'slash' in interfaces:
        interfaces[EQUIP_NAME] = to_slash
        cards = gc.player_cards_at(user, 'onhand')
        targets = slash.slash_targets(gc, user)
        if len(targets) == 0:
            return
        hints.add_method_to(
                hint, EQUIP_NAME,
                hints.join_req(hints.fixed_card_count(cards, 2),
                               hints.fixed_target_count(targets, 1)))
    elif EQUIP_NAME in interfaces:
        del interfaces[EQUIP_NAME]
Esempio n. 4
0
def _add_region(gc, user, region, interfaces, hint):
    @invoke_on_success(user, SKILL)
    def to_slash(gc, args):
        cards = gc.cards_by_ids(args['use'])
        checking.cards_region(cards, region)
        red_as_slash_response(cards)
        args['action'] = 'slash'
        with EquipmentRestore(user, region):
            return slash.slash_check(gc, args)
    interfaces[SKILL + ':' + region] = to_slash
    cards = filter(lambda c: c.color() == card.RED,
                   gc.player_cards_at(user, region))
    targets = slash.slash_targets(gc, user)
    if len(targets) == 0 or len(cards) == 0:
        return
    hints.add_method_to(hint, SKILL + ':' + region,
                        hints.join_req(hints.fixed_card_count(cards, 1),
                                       hints.fixed_target_count(targets, 1)))
Esempio n. 5
0
 def _hint_detail(self):
     cards = self.game_control.player_cards_at(self.player, 'onhand')
     cards = filter(lambda c: c.suit() == card.HEART, cards)
     targets = self.game_control.players_from_current()
     targets.remove(self.player)
     import ext.src.hint_common as hints
     return hints.filter_empty(hints.allow_abort(hints.add_method_to(
                     hints.basic_cards_hint(), SKILL,
                     hints.join_req(hints.fixed_card_count(cards, 1),
                                    hints.fixed_target_count(targets, 1)))))
Esempio n. 6
0
def dodge_as_slash_using_hint(hint, game_control, user, interfaces):
    @invoke_on_success(user, SKILL)
    def to_slash(gc, args):
        dodge_as_slash_check(gc.cards_by_ids(args['use']))
        args['action'] = 'slash'
        return slash.slash_check(gc, args)
    if 'slash' in interfaces:
        interfaces[SKILL] = to_slash
        cards = filter(lambda c: c.name() == 'dodge',
                       game_control.player_cards_at(user, 'onhand'))
        targets = slash.slash_targets(game_control, user)
        if len(targets) == 0:
            return
        hints.add_method_to(
                hint, SKILL,
                hints.join_req(hints.fixed_card_count(cards, 1),
                               hints.fixed_target_count(targets, 1)))
    elif SKILL in interfaces:
        del interfaces[SKILL]
Esempio n. 7
0
 def __init__(self, game_control, slashing):
     hint = hints.filter_empty(hints.allow_abort(hints.add_method_to(
                     hints.basic_cards_hint(), EQUIP_NAME, hints.forbid())))
     AcceptMessage.__init__(self, game_control, [slashing.user], 'discard',
                            hint, self.on_message)
     self.slashing = slashing
Esempio n. 8
0
 def _hint_detail(self):
     cards = self.game_control.player_cards_at(self.player, 'onhand')
     cards = filter(lambda c: c.suit() == self.suit, cards)
     return hints.filter_empty(hints.allow_abort(hints.add_method_to(
                                         hints.basic_cards_hint(), 'discard',
                                         hints.fixed_card_count(cards, 1))))
Esempio n. 9
0
 def _hint_detail(self):
     cards = self.game_control.player_cards_at(self.player, 'onhand')
     return hints.filter_empty(hints.add_method_to(
         hints.basic_cards_hint(), 'show', hints.fixed_card_count(cards, 1)))