Beispiel #1
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]
Beispiel #2
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)))
Beispiel #3
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]