Esempio n. 1
0
 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)
Esempio n. 2
0
def interface(game_control, args):
    cards = game_control.cards_by_ids(args['use'])
    checking.cards_region(cards, 'cards')
    if len(cards) != 1:
        raise ValueError('wrong cards')
    player = game_control.player_by_token(args['token'])
    equip(player, game_control, cards[0])
    return { 'code': ret_code.OK }
Esempio n. 3
0
def interface(game_control, args):
    cards = game_control.cards_by_ids(args['use'])
    checking.cards_region(cards, 'cards')
    if len(cards) != 1:
        raise ValueError('wrong cards')
    player = game_control.player_by_token(args['token'])
    equip(player, game_control, cards[0])
    return {'code': ret_code.OK}
Esempio n. 4
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}
Esempio n. 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 }
Esempio n. 6
0
    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 }
Esempio n. 7
0
def _check_one_heart_card(gc, cards_ids):
    cards = gc.cards_by_ids(cards_ids)
    checking.only_one_card_of_suit(cards, card.HEART)
    checking.cards_region(cards, 'onhand')
Esempio n. 8
0
def two_cards(cards):
    checking.cards_region(cards, 'cards')
    if len(cards) != 2:
        raise ValueError('wrong cards')
Esempio n. 9
0
File: equip.py Progetto: neuront/sgs
def interface(gc, args):
    cards = gc.cards_by_ids(args['use'])
    checking.cards_region(cards, 'onhand')
    player = gc.player_by_token(args['token'])
    equip(player, gc, cards[0])
    return { 'code': ret_code.OK }
Esempio n. 10
0
def slash_as_dodge(cards):
    checking.cards_region(cards, 'onhand')
    checking.only_one_card_of_category(cards, category.is_slash)
Esempio n. 11
0
def dodge_as_slash_check(cards):
    checking.cards_region(cards, 'onhand')
    checking.only_one_card_named_as(cards, 'dodge')
Esempio n. 12
0
def _check_one_heart_card(game_control, cards_ids):
    if len(cards_ids) > 0:
        cards = game_control.cards_by_ids(cards_ids)
        checking.only_one_card_of_suit(cards, card.HEART)
        checking.cards_region(cards, 'cards')
Esempio n. 13
0
 def _show_check(self, cids):
     if len(cids) != 1:
         raise ValueError('need exactly one card')
     checking.cards_region(self.game_control.cards_by_ids(cids), 'onhand')
Esempio n. 14
0
def two_cards(cards):
    checking.cards_region(cards, 'cards')
    if len(cards) != 2:
        raise ValueError('wrong cards')