def construct_team(self): for card, alloc in zip(self.card_list, self.optimal_alloc): card.equip_gem(alloc.gems) center_skill = self.card_list[0].cskill center_idx_list = [ i for i, card in enumerate(self.card_list) if card.cskill.is_equal(center_skill) ] max_pos_factor, final_card_list = 0, [None] * 9 for center_idx in center_idx_list: # Put non-center card with less same group&color bonus at position with smaller combo weight fraction bonus_list = sorted([(card.mu, i) for i, card in enumerate(self.card_list) if i != center_idx]) weight_list = sorted([(self.live.combo_weight_fraction[i], i) for i in range(9) if i != 4]) pos_factor = self.card_list[ center_idx].mu * self.live.combo_weight_fraction[4] pos_factor += sum( [b[0] * w[0] for b, w in zip(bonus_list, weight_list)]) if pos_factor > max_pos_factor: max_pos_factor, final_card_list[ 4] = pos_factor, self.card_list[center_idx] for i in range(8): final_card_list[weight_list[i][1]] = self.card_list[ bonus_list[i][1]] return Team(final_card_list)
def construct_team(self): for card, alloc in zip(self.card_list, self.optimal_alloc): card.equip_gem(alloc.gems) # Put non-center card with less same group&color bonus at position with smaller combo weight fraction bonus_list = sorted([(card.mu,i) for i,card in enumerate(self.card_list[1:])]) weight_list = sorted([(self.live.combo_weight_fraction[i], i) for i in range(9) if i!=4]) final_card_list = [None]*4 + [self.card_list[0]] + [None]*4 for i in range(8): final_card_list[weight_list[i][1]] = self.card_list[1:][bonus_list[i][1]] return Team(final_card_list)
def team_strength_detail(self, team, show_cost=False): candidates, CC = [], CoverageCalculator(self.live, self.setting) for index, card in enumerate(team.card_list): adv_card = AdvancedCard(index, card) adv_card.list_gem_allocation(self.live) adv_card.compute_card_stats(team.center().cskill, self.guest_cskill, self.live, self.setting) adv_card.CR, adv_card.CR_list = CC.compute_coverage(card) if index == 4: center = adv_card else: candidates.append(adv_card) gem_allocator = GemAllocator([center] + candidates, self.live, self.setting, self.owned_gem) gem_allocator.update_gem_score() new_team = Team(candidates[:4]+[center]+candidates[4:]) return gem_allocator.view_optimal_details(show_cost=show_cost, fixed_team=new_team)
def construct_team(self): for card, alloc in zip(self.card_list, self.optimal_alloc): card.equip_gem(alloc.gems) final_card_list = [ self.card_list[self.placement[i]] for i in range(9) ] return Team(final_card_list)