def __init__(self, live, game_data, opt={}):
     self.owned_gem = copy.deepcopy(game_data.owned_gem)
     self.live = live
     self.guest_cskill = opt.get('guest_cskill', None)
     self.score_up_bonus = opt.get('score_up_bonus', 0)
     self.skill_up_bonus = opt.get('skill_up_bonus', 0)
     self.generate_setting(opt)
     self.cards = [
         AdvancedCard(index, card)
         for index, card in game_data.raw_card.items()
     ]
     for card in self.cards:
         card.list_gem_allocation(self.live)
     self.best_team = None
     self.log = ''
	def team_alloc(self, team, alloc_method='DC', 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.allocate(alloc_method)
		return gem_allocator.view_optimal_details(show_cost=show_cost)
	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 __init__(self, live, game_data, opt={}, unlimited_SIS=False, extra_cond=None):
		# Get Live Info
		self.live = live
		# Get guest cskill and purchased boost
		self.guest_cskill = opt.get('guest_cskill',None)
		self.score_up_bonus = opt.get('score_up_bonus',0)
		self.skill_up_bonus = opt.get('skill_up_bonus',0)
		self.generate_setting(opt)
		# Import SIS inventory
		self.owned_gem = copy.deepcopy(game_data.owned_gem)
		if not unlimited_SIS:
			for x in attr_list: 
				self.owned_gem[x+' Kiss'] = 9
		else:
			for x in list(self.owned_gem.keys()):
				self.owned_gem[x] = 9
		# Import card inventory
		raw_cards = copy.deepcopy(game_data.raw_card)
		if extra_cond == 'current_max':
			for i, card in raw_cards.items():
				card.idolize(idolized=card.idolized, reset_slot=False)
		elif extra_cond == 'idolized_max':
			for i, card in raw_cards.items():
				card.idolize(idolized=True, reset_slot=False)
		elif extra_cond == 'copy_idolized_max':
			for i, card in raw_cards.items():
				if not card.idolized:
					card.idolize(idolized=True, reset_slot=False)
					card.slot_num = card.min_slot_num + 1
		elif extra_cond == 'ultimate':
			for i, card in raw_cards.items():
				card.idolize(idolized=True)
				card.slot_num = card.max_slot_num
				if card.skill is not None:
					card.skill.level = 8
		self.cards = [AdvancedCard(index, card) for index, card in raw_cards.items()]
		# List all possible SIS single plans for each card
		for card in self.cards: card.list_gem_allocation(self.live)
		self.best_team = None
		self.log = ''
 def team_alloc(self, team, alloc_method='DC', 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 = 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.allocate(alloc_method)
     new_team = gem_allocator.construct_team()
     # new_team.compute_expected_total_score(self.live, opt=self.setting, verbose=True)
     # new_team.to_LLHelper('team.sd')
     # new_team.to_ieb('team.ieb')
     return gem_allocator.view_optimal_details(show_cost=show_cost)