示例#1
0
文件: slash.py 项目: neuront/sgs
def slash_check(game_control, args):
    targets_ids = args['targets']
    user = game_control.player_by_token(args['token'])
    cards = game_control.cards_by_ids(args['use'])
    checking.only_one_target(targets_ids)
    target = game_control.player_by_id(targets_ids[0])
    action = args['action']
    checking.valid_target(user, target, action)
    checking.forbid_target_self(user, target)
    checking.within_range(game_control, user, target, 'slash')

    game_control.use_cards_for_players(user, targets_ids, action, cards)
    _SlashFlow(game_control, user, target, cards, action).resume()
    return { 'code': ret_code.OK }
示例#2
0
文件: steal.py 项目: neuront/sgs
def steal_check(gc, args):
    targets_ids = args['targets']
    user = gc.player_by_token(args['token'])
    cards = gc.cards_by_ids(args['use'])
    checking.only_one_target(targets_ids)
    target = gc.player_by_id(targets_ids[0])
    checking.valid_target(user, target, 'steal')
    checking.forbid_target_self(user, target)
    checking.forbid_target_no_card(target, gc)
    checking.within_range(gc, user, target, 'steal')

    gc.use_cards_for_players(user, targets_ids, args['action'], cards)
    hint = { 'regions': target.all_regions(gc) }
    gc.push_frame(
              frames.AcceptMessage(gc, [user], 'region', hint,
                                   lambda a: on_region(gc, user, target, a)))
    return { 'code': ret_code.OK }
示例#3
0
文件: steal.py 项目: linluxiang/sgs
def steal(game_control, args):
    targets_ids = args['targets']
    user = game_control.player_by_token(args['token'])
    cards = game_control.cards_by_ids(args['use'])
    checking.only_one_target(targets_ids)
    target = game_control.player_by_id(targets_ids[0])
    checking.only_one_card_named_as(cards, 'steal')
    checking.forbid_target_self(user, target)
    checking.forbid_target_no_card(target, game_control)
    checking.within_range(game_control, user, target, 'steal')

    game_control.use_cards_for_players(user, targets_ids, args['action'], cards)
    on_result = lambda gc, a: None
    game_control.push_frame(
      frames.AcceptMessage(game_control, [user],
                           lambda a: on_message(game_control, user, target, a),
                           on_result))
    return { 'code': ret_code.OK }
示例#4
0
文件: steal.py 项目: linluxiang/sgs
def steal(game_control, args):
    targets_ids = args['targets']
    user = game_control.player_by_token(args['token'])
    cards = game_control.cards_by_ids(args['use'])
    checking.only_one_target(targets_ids)
    target = game_control.player_by_id(targets_ids[0])
    checking.only_one_card_named_as(cards, 'steal')
    checking.forbid_target_self(user, target)
    checking.forbid_target_no_card(target, game_control)
    checking.within_range(game_control, user, target, 'steal')

    game_control.use_cards_for_players(user, targets_ids, args['action'],
                                       cards)
    on_result = lambda gc, a: None
    game_control.push_frame(
        frames.AcceptMessage(
            game_control, [user],
            lambda a: on_message(game_control, user, target, a), on_result))
    return {'code': ret_code.OK}