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
def get_player_hero(self): hero = None for kp in self.keypoints: for d in kp['Data']: if "CONTROLLER" in d['Tags'].keys() and "CARDTYPE" in d['Tags'].keys(): if d['Tags']['CONTROLLER'] == self.player_id and d['Tags']['CARDTYPE'] == card_type('HERO') and d[ 'CardId'] != None: hero = d['CardId'] return hero return None