コード例 #1
0
 def react(self, args):
     cards = args['discard']
     if len(cards) > 0:
         targets_ids = args['targets']
         checking.only_one_target(targets_ids)
         checking.forbid_target_self(self.player.player_id, targets_ids[0])
     return DiscardCards.react(self, args)
コード例 #2
0
ファイル: heavenly_scent.py プロジェクト: neuront/sgs
    def react(self, args):
        if args['action'] == 'abort':
            return self.done(args)

        args['discard'] = args['use']
        if len(args['discard']) == 0:
            raise ValueError('wrong cards')
        targets_ids = args['targets']
        checking.only_one_target(targets_ids)
        checking.forbid_target_self(self.player.player_id, targets_ids[0])
        return DiscardCards.react(self, args)
コード例 #3
0
ファイル: duel.py プロジェクト: 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 }
コード例 #4
0
ファイル: duel.py プロジェクト: linluxiang/sgs
def duel(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.forbid_target_self(user, target)
    checking.only_one_card_named_as(cards, 'duel')

    game_control.use_cards_for_players(user, targets_ids, args['action'], cards)
    game_control.push_frame(play_slash_frame(game_control, target, user, cards))
    return { 'code': ret_code.OK }
コード例 #5
0
 def react(self, args):
     cards = self.game_control.cards_by_ids(args['transfer'])
     if len(cards) == 0:
         return self.done(None)
     target = self.game_control.player_by_id(args['target'])
     checking.forbid_target_self(self.source, target)
     checking.cards_region(cards, 'bequeathed strategy')
     self.game_control.private_cards_transfer(self.source, target, cards)
     self.rest -= len(cards)
     if self.rest == 0:
         return self.done(None)
     return {'code': ret_code.OK}
コード例 #6
0
ファイル: bequeathed_strategy.py プロジェクト: linluxiang/sgs
 def react(self, args):
     cards = self.game_control.cards_by_ids(args['transfer'])
     if len(cards) == 0:
         return self.done(None)
     target = self.game_control.player_by_id(args['target'])
     checking.forbid_target_self(self.source, target)
     checking.cards_region(cards, 'bequeathed strategy')
     self.game_control.private_cards_transfer(self.source, target, cards)
     self.rest -= len(cards)
     if self.rest == 0:
         return self.done(None)
     return { 'code': ret_code.OK }
コード例 #7
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 }
コード例 #8
0
ファイル: sabotage.py プロジェクト: neuront/sgs
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 }
コード例 #9
0
ファイル: sabotage.py プロジェクト: linluxiang/sgs
def sabotage(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, 'sabotage')
    checking.forbid_target_self(user, target)
    checking.forbid_target_no_card(target, game_control)

    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, target, a),
                                 on_result))
    return { 'code': ret_code.OK }
コード例 #10
0
def sabotage(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, 'sabotage')
    checking.forbid_target_self(user, target)
    checking.forbid_target_no_card(target, game_control)

    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, target, a),
                             on_result))
    return {'code': ret_code.OK}
コード例 #11
0
ファイル: bequeathed_strategy.py プロジェクト: neuront/sgs
    def react(self, args):
        if args['action'] == 'abort':
            return self.done(None)
        cards = self.game_control.cards_by_ids(args['use'])
        if len(cards) == 0:
            raise ValueError('bad cards')
        targets_ids = args['targets']
        checking.only_one_target(targets_ids)
        target = self.game_control.player_by_id(targets_ids[0])
        checking.forbid_target_self(self.player, target)
        checking.cards_region(cards, 'bequeathed strategy')

        for c in cards: c.set_region('onhand')
        self.game_control.private_cards_transfer(self.player, target, cards)
        self.cards = [c for c in self.cards if c not in cards]
        if len(self.cards) == 0:
            return self.done(None)
        return { 'code': ret_code.OK }