Esempio n. 1
0
File: duel.py Progetto: neuront/sgs
def duel_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])
    checking.valid_target(user, target, 'duel')
    checking.forbid_target_self(user, target)

    game_control.use_cards_for_players(user, targets_ids, args['action'], cards)
    game_control.push_frame(_Duel(game_control, user, target, cards))
    return { 'code': ret_code.OK }
Esempio n. 2
0
def arson_attack_check(game_control, args):
    targets_ids = args['targets']
    cards = game_control.cards_by_ids(args['use'])
    user = game_control.player_by_token(args['token'])
    checking.only_one_target(targets_ids)
    target = game_control.player_by_id(targets_ids[0])
    checking.valid_target(user, target, 'arson attack')
    checking.forbid_target_no_card_on_hand(target, game_control)

    game_control.use_cards_for_players(user, targets_ids, args['action'], cards)
    game_control.push_frame(_ArsonAttack(game_control, user, target, cards))
    return { 'code': ret_code.OK }
Esempio n. 3
0
File: slash.py Progetto: 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 }
Esempio n. 4
0
def sabotage_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, 'sabotage')
    checking.forbid_target_self(user, target)
    checking.forbid_target_no_card(target, gc)

    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, target, a)))
    return { 'code': ret_code.OK }