Beispiel #1
0
 def get_cards_kept_by_player(self):
     cards_drawn = []
     cards_mulliganed = []
     kps = self.keypoints
     for i in range(self.get_last_choosing_draw() + 1):
         if kps[i]['Type'] == keypoint_type('Draw'):
             card = None
             target_id = kps[i]['Id']
             for d in kps[i]['Data']:
                 if d['Id'] == target_id and 'CARDTYPE' in d['Tags'] and 'CONTROLLER' in d['Tags'] and (
                                     d['Tags']['CONTROLLER'] == self.player_id and (d['Tags'][
                                                                                        'CARDTYPE'] == card_type(
                                 'MINION') or d['Tags']['CARDTYPE'] == card_type(
                                 "INVALID")) and d['CardId'] != Replay.the_coin):
                     card = d['CardId']
                     break
             if card != None:
                 cards_drawn.append(card)
     for i in range(self.get_last_intro_draw() + 1):
         if kps[i]['Type'] == keypoint_type('Mulligan'):
             card = None
             target_id = kps[i]['Id']
             for d in kps[i]['Data']:
                 if d['Id'] == target_id and 'CARDTYPE' in d['Tags'] and 'CONTROLLER' in d['Tags'] and (
                                 d['Tags']['CONTROLLER'] == self.player_id and (d['Tags'][
                                                                                    'CARDTYPE'] == card_type(
                             'MINION') or d['Tags']['CARDTYPE'] == card_type(
                             "INVALID"))):
                     card = d['CardId']
                     break
             if card != None:
                 cards_mulliganed.append(card)
     cards_kept = [item for item in cards_drawn if item not in cards_mulliganed]
     return cards_kept, cards_mulliganed, cards_drawn
Beispiel #2
0
 def game_won(self):
     kps = self.keypoints
     size = len(self.keypoints)
     status = kps[size-1]['Type']
     if status == keypoint_type('Victory'):
         return True
     elif status == keypoint_type('Defeat'):
         return False
     else:
         return None
Beispiel #3
0
 def get_last_intro_draw(self):
     kps = self.keypoints
     last_mull = -1
     for i in range(len(kps)):
         if kps[i]['Type'] == keypoint_type('Mulligan'):
             last_mull = i-1
     if last_mull != -1:
         return last_mull
     else:
         return None
Beispiel #4
0
 def get_last_choosing_draw(self):
     kps = self.keypoints
     last_draw = -1
     for i in range(len(kps)):
         if kps[i]['Type'] == keypoint_type('Draw'):
             for d in kps[i]['Data']:
                 if d['IsPlayer'] and 'MULLIGAN_STATE' not in d['Tags']:
                     last_draw = i
     if last_draw != -1:
         return last_draw
     else:
         return None