def isWorstEnemy(playerOrID, enemyOrID):
	"""
	Returns True if <enemy> is one of the worst enemies of <player>'s team.
	"""
	player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
	enemy, enemyTeam = PlayerUtil.getPlayerAndTeam(enemyOrID)
	return not team.isHuman() and team.getID() != enemyTeam.getID() and getWorstEnemyTeam(player) == enemyTeam.getID()
def isWorstEnemy(playerOrID, enemyOrID):
    """
    Returns True if <enemy> is one of the worst enemies of <player>'s team.
    """
    player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
    enemy, enemyTeam = PlayerUtil.getPlayerAndTeam(enemyOrID)
    return not team.isHuman() and team.getID() != enemyTeam.getID() and getWorstEnemyTeam(player) == enemyTeam.getID()
Example #3
0
	def fillStratAdvGrid(self):
		self.iconGrid.clearData()
		self.iHumanKnowableUnits = UnitUtil.getKnowableUnits(self.iActivePlayer)
		self.iHumanUnits = UnitUtil.getTrainableUnits(self.iActivePlayer, self.iHumanKnowableUnits, True, True)
		#self.iHumanYesUnits, self.iHumanNoUnits = UnitUtil.getTrainableAndUntrainableUnits(self.iActivePlayer, self.iHumanKnowableUnits, True)
		BugUtil.debug("----------------------- fillStratAdvGrid start")
		self.iHumanObsoleteUnits = UnitUtil.findObsoleteUnits(self.iHumanUnits)
		for eUnit in self.iHumanObsoleteUnits:
			BugUtil.debug("  obs %s", gc.getUnitInfo(eUnit).getDescription())
		
		activePlayer, activeTeam = PlayerUtil.getPlayerAndTeam(self.iActivePlayer)
		iRow = 0
		for player in PlayerUtil.players(alive=True, barbarian=False, minor=False):
			ePlayer = player.getID()
			if (ePlayer != self.iActivePlayer
					and (activeTeam.isHasMet(player.getTeam()) or gc.getGame().isDebugMode())):
				self.iconGrid.appendRow(player.getCivilizationShortDescription(0), "", 3)
				
				# add leaderhead icon
				self.iconGrid.addIcon(iRow, self.SA_Col_Leader,
						gc.getLeaderHeadInfo(player.getLeaderType()).getButton(), 64, 
						WidgetTypes.WIDGET_LEADERHEAD, player.getID(), self.iActivePlayer)
				
				# add bonus and unit icons
				self.addStratAdvBonuses(activePlayer, player, iRow)
				self.addStratAdvUnits(activePlayer, player, iRow)
				
				iRow += 1
		
		BugUtil.debug("----------------------- fillStratAdvGrid end")
		self.iconGrid.refresh()
Example #4
0
def getKnownTrainableUnits(playerOrID,
                           askingPlayerOrID,
                           knowableUnits,
                           bonuses,
                           military=None):
    player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
    askingPlayer = PlayerUtil.getPlayer(askingPlayerOrID)
    eAskingTeam, askingTeam = PlayerUtil.getPlayerTeamAndID(askingPlayer)
    #trade = player.canTradeNetworkWith(askingPlayer.getID())
    cities = PlayerUtil.getPlayerCities(
        player, lambda city: city.isRevealed(eAskingTeam, False))
    # separate units into two groups: yes and maybe
    units = getTrainableUnits(playerOrID, knowableUnits, False, military)
    yesUnits = set()
    maybeUnits = set()
    BugUtil.debug("-----------------------")
    for eUnit in units:
        if not canAnyCityBuildUnit(eUnit, cities, eAskingTeam, False):
            BugUtil.debug("  no    %s", gc.getUnitInfo(eUnit).getDescription())
        elif hasBonusesForUnit(eUnit, bonuses):
            BugUtil.debug("  yes   %s", gc.getUnitInfo(eUnit).getDescription())
            yesUnits.add(eUnit)
        elif bonuses is None:
            BugUtil.debug("  maybe %s", gc.getUnitInfo(eUnit).getDescription())
            maybeUnits.add(eUnit)
    return yesUnits, maybeUnits
	def fillStratAdvGrid(self):
		self.iconGrid.clearData()
		self.iHumanKnowableUnits = UnitUtil.getKnowableUnits(self.iActivePlayer)
		self.iHumanUnits = UnitUtil.getTrainableUnits(self.iActivePlayer, self.iHumanKnowableUnits, True, True)
		#self.iHumanYesUnits, self.iHumanNoUnits = UnitUtil.getTrainableAndUntrainableUnits(self.iActivePlayer, self.iHumanKnowableUnits, True)
		BugUtil.debug("----------------------- fillStratAdvGrid start")
		self.iHumanObsoleteUnits = UnitUtil.findObsoleteUnits(self.iHumanUnits)
		for eUnit in self.iHumanObsoleteUnits:
			BugUtil.debug("  obs %s", gc.getUnitInfo(eUnit).getDescription())
		
		activePlayer, activeTeam = PlayerUtil.getPlayerAndTeam(self.iActivePlayer)
		iRow = 0
		for player in PlayerUtil.players(alive=True, barbarian=False, minor=False):
			ePlayer = player.getID()
			if (ePlayer != self.iActivePlayer
					and (activeTeam.isHasMet(player.getTeam()) or gc.getGame().isDebugMode())):
				self.iconGrid.appendRow(player.getCivilizationShortDescription(0), "", 3)
				
				# add leaderhead icon
				self.iconGrid.addIcon(iRow, self.SA_Col_Leader,
						gc.getLeaderHeadInfo(player.getLeaderType()).getButton(), 64, 
						WidgetTypes.WIDGET_LEADERHEAD, player.getID(), self.iActivePlayer)
				
				# add bonus and unit icons
				self.addStratAdvBonuses(activePlayer, player, iRow)
				self.addStratAdvUnits(activePlayer, player, iRow)
				
				iRow += 1
		
		BugUtil.debug("----------------------- fillStratAdvGrid end")
		self.iconGrid.refresh()
Example #6
0
def getKnownUnits(playerOrID):
    player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
    units = set()
    for eUnit in range(NUM_UNITS):
        for eTech in unitTechs[eUnit]:
            if team.isHasTech(eTech):
                units.add(eUnit)
    return units
Example #7
0
def getKnownUnits(playerOrID):
	player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
	units = set()
	for eUnit in range(NUM_UNITS):
		for eTech in unitTechs[eUnit]:
			if team.isHasTech(eTech):
				units.add(eUnit)
	return units
Example #8
0
def getKnowableUnits(playerOrID):
	player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
	units = set()
	for eUnit in range(NUM_UNITS):
		for eTech in unitTechs[eUnit]:
			if not (team.isHasTech(eTech) or player.canResearch(eTech, False)):
				break
		else:
			units.add(eUnit)
	return units
Example #9
0
def getKnowableUnits(playerOrID):
    player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
    units = set()
    for eUnit in range(NUM_UNITS):
        for eTech in unitTechs[eUnit]:
            if not (team.isHasTech(eTech) or player.canResearch(eTech, False)):
                break
        else:
            units.add(eUnit)
    return units
Example #10
0
def getDesiredBonuses(playerOrID):
    """
	Returns a set of bonus IDs that <player> can receive in trade.
	"""
    player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
    bonuses = set()
    for eBonus in range(gc.getNumBonusInfos()):
        if player.getNumAvailableBonuses(eBonus) == 0:
            eObsoleteTech = gc.getBonusInfo(eBonus).getTechObsolete()
            if eObsoleteTech == -1 or not team.isHasTech(eObsoleteTech):
                bonuses.add(eBonus)
    return bonuses | getCorporationBonuses(player)
def getDesiredBonuses(playerOrID):
	"""
	Returns a set of bonus IDs that <player> can receive in trade.
	"""
	player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
	bonuses = set()
	for eBonus in range(gc.getNumBonusInfos()):
		if player.getNumAvailableBonuses(eBonus) == 0:
			eObsoleteTech = gc.getBonusInfo(eBonus).getTechObsolete()
			if eObsoleteTech == -1 or not team.isHasTech(eObsoleteTech):
				bonuses.add(eBonus)
	return bonuses | getCorporationBonuses(player)
def getWorstEnemyTeam(playerOrID):
    """
    Returns the team ID that is the worst enemy of <player>'s team.

    If <player>'s team has no worst enemy, returns -1.
    """
    player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
    if not team.isHuman():
        worstEnemyName = player.getWorstEnemyName()
        if worstEnemyName:
            for team in PlayerUtil.teams(alive=True, barbarian=False):
                if team.getName() == worstEnemyName:
                    return team.getID()
    return -1
def getWorstEnemyTeam(playerOrID):
	"""
	Returns the team ID that is the worst enemy of <player>'s team.
	
	If <player>'s team has no worst enemy, returns -1.
	"""
	player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
	if not team.isHuman():
		worstEnemyName = player.getWorstEnemyName()
		if worstEnemyName:
			for team in PlayerUtil.teams(alive=True, barbarian=False):
				if team.getName() == worstEnemyName:
					return team.getID()
	return -1
Example #14
0
def getTrainableAndUntrainableUnits(playerOrID, knowableUnits, military=None):
    player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
    cities = PlayerUtil.getPlayerCities(player)
    # separate units into two groups: yes and no
    units = getTrainableUnits(playerOrID, knowableUnits, False, military)
    yesUnits = set()
    noUnits = set()
    BugUtil.debug("-----------------------")
    for eUnit in units:
        if canAnyCityBuildUnit(eUnit, cities, -1, True):
            BugUtil.debug("  yes %s", gc.getUnitInfo(eUnit).getDescription())
            yesUnits.add(eUnit)
        else:
            BugUtil.debug("  no  %s", gc.getUnitInfo(eUnit).getDescription())
            noUnits.add(eUnit)
    return yesUnits, noUnits
Example #15
0
def getTrainableAndUntrainableUnits(playerOrID, knowableUnits, military=None):
	player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
	cities = PlayerUtil.getPlayerCities(player)
	# separate units into two groups: yes and no
	units = getTrainableUnits(playerOrID, knowableUnits, False, military)
	yesUnits = set()
	noUnits = set()
	BugUtil.debug("-----------------------")
	for eUnit in units:
		if canAnyCityBuildUnit(eUnit, cities, -1, True):
			BugUtil.debug("  yes %s", gc.getUnitInfo(eUnit).getDescription())
			yesUnits.add(eUnit)
		else:
			BugUtil.debug("  no  %s", gc.getUnitInfo(eUnit).getDescription())
			noUnits.add(eUnit)
	return yesUnits, noUnits
Example #16
0
def getKnownTrainableUnits(playerOrID, askingPlayerOrID, knowableUnits, bonuses, military=None):
    player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
    askingPlayer = PlayerUtil.getPlayer(askingPlayerOrID)
    eAskingTeam, askingTeam = PlayerUtil.getPlayerTeamAndID(askingPlayer)
    # trade = player.canTradeNetworkWith(askingPlayer.getID())
    cities = PlayerUtil.getPlayerCities(player, lambda city: city.isRevealed(eAskingTeam, False))
    # separate units into two groups: yes and maybe
    units = getTrainableUnits(playerOrID, knowableUnits, False, military)
    yesUnits = set()
    maybeUnits = set()
    BugUtil.debug("-----------------------")
    for eUnit in units:
        if not canAnyCityBuildUnit(eUnit, cities, eAskingTeam, False):
            BugUtil.debug("  no    %s", gc.getUnitInfo(eUnit).getDescription())
        elif hasBonusesForUnit(eUnit, bonuses):
            BugUtil.debug("  yes   %s", gc.getUnitInfo(eUnit).getDescription())
            yesUnits.add(eUnit)
        elif bonuses is None:
            BugUtil.debug("  maybe %s", gc.getUnitInfo(eUnit).getDescription())
            maybeUnits.add(eUnit)
    return yesUnits, maybeUnits
Example #17
0
def getCanTrainUnits(playerOrID, askingPlayerOrID=None, military=None):
    """
	Returns the set of all units the player can train.
	
	Searches all of the player's cities to find which units can be trained.
	
	If askingPlayerOrID is given, only cities they have seen are checked, and
	only units whose prerequisite techs they know or can research are returned.
	Also, if the two players' trade networks are not connected, units that
	require resources to train are returned in a second set.
	
	If military is provided, only military or civilian units are checked
	depending on its value, True or False, respectively.
	
	*** OBSOLETE ***
	
	"""
    player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
    askingPlayer = PlayerUtil.getPlayer(askingPlayerOrID)
    if askingPlayer:
        eAskingTeam, askingTeam = PlayerUtil.getPlayerTeamAndID(askingPlayer)
        trade = player.canTradeNetworkWith(askingPlayer.getID())
    civInfo = gc.getCivilizationInfo(player.getCivilizationType())
    units = set()
    maybeUnits = set()
    for eClass in range(NUM_CLASSES):
        eUnit = civInfo.getCivilizationUnits(eClass)
        if eUnit == -1:
            classInfo = gc.getUnitClassInfo(eClass)
            BugUtil.debug("%s doesn't have %s", civInfo.getDescription(),
                          classInfo.getDescription())
            eUnit = classInfo.getDefaultUnitIndex()
        unitInfo = gc.getUnitInfo(eUnit)
        if unitInfo:
            if ((military == True and unitInfo.getUnitCombatType() <= 0) or
                (military == False and unitInfo.getUnitCombatType() > 0)):
                BugUtil.debug("skipping (non-)military %s",
                              unitInfo.getDescription())
                continue
            if askingPlayer:
                for eTech in unitTechs[eUnit]:
                    if not (askingTeam.isHasTech(eTech)
                            or askingPlayer.canResearch(eTech, False)):
                        BugUtil.debug(
                            "%s doesn't comprehend %s",
                            askingPlayer.getCivilizationShortDescription(0),
                            gc.getTechInfo(eTech).getDescription())
                        skip = True
                        break
                else:
                    skip = False
                if skip:
                    BugUtil.debug("skipping unknowable %s",
                                  unitInfo.getDescription())
                    continue
            for city in PlayerUtil.playerCities(player):
                if askingPlayer:
                    if not city.isRevealed(eAskingTeam, False):
                        continue
                    if city.canTrain(eUnit, False, not trade):
                        if eUnit in unitsWithBonuses:
                            maybeUnits.add(eUnit)
                        else:
                            units.add(eUnit)
                        break
                else:
                    if city.canTrain(eUnit, False, False):
                        units.add(eUnit)
                        break
    BugUtil.debug("%s can train:", player.getCivilizationShortDescription(0))
    for eUnit in units:
        unitInfo = gc.getUnitInfo(eUnit)
        BugUtil.debug("  %s", unitInfo.getDescription())
    if askingPlayer:
        BugUtil.debug("%s can maybe train:",
                      player.getCivilizationShortDescription(0))
        for eUnit in maybeUnits:
            unitInfo = gc.getUnitInfo(eUnit)
            BugUtil.debug("  %s", unitInfo.getDescription())
        return units, maybeUnits
    else:
        return units
Example #18
0
def getCanTrainUnits(playerOrID, askingPlayerOrID=None, military=None):
	"""
	Returns the set of all units the player can train.
	
	Searches all of the player's cities to find which units can be trained.
	
	If askingPlayerOrID is given, only cities they have seen are checked, and
	only units whose prerequisite techs they know or can research are returned.
	Also, if the two players' trade networks are not connected, units that
	require resources to train are returned in a second set.
	
	If military is provided, only military or civilian units are checked
	depending on its value, True or False, respectively.
	
	*** OBSOLETE ***
	
	"""
	player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
	askingPlayer = PlayerUtil.getPlayer(askingPlayerOrID)
	if askingPlayer:
		eAskingTeam, askingTeam = PlayerUtil.getPlayerTeamAndID(askingPlayer)
		trade = player.canTradeNetworkWith(askingPlayer.getID())
	civInfo = gc.getCivilizationInfo(player.getCivilizationType())
	units = set()
	maybeUnits = set()
	for eClass in range(NUM_CLASSES):
		eUnit = civInfo.getCivilizationUnits(eClass)
		if eUnit == -1:
			classInfo = gc.getUnitClassInfo(eClass)
			BugUtil.debug("%s doesn't have %s", civInfo.getDescription(), classInfo.getDescription())
			eUnit = classInfo.getDefaultUnitIndex()
		unitInfo = gc.getUnitInfo(eUnit)
		if unitInfo:
			if ((military == True and unitInfo.getUnitCombatType() <= 0)
			or (military == False and unitInfo.getUnitCombatType() > 0)):
				BugUtil.debug("skipping (non-)military %s", unitInfo.getDescription())
				continue
			if askingPlayer:
				for eTech in unitTechs[eUnit]:
					if not (askingTeam.isHasTech(eTech) or askingPlayer.canResearch(eTech, False)):
						BugUtil.debug("%s doesn't comprehend %s", askingPlayer.getName(), gc.getTechInfo(eTech).getDescription())
						skip = True
						break
				else:
					skip = False
				if skip:
					BugUtil.debug("skipping unknowable %s", unitInfo.getDescription())
					continue
			for city in PlayerUtil.playerCities(player):
				if askingPlayer:
					if not city.isRevealed(eAskingTeam, False):
						continue
					if city.canTrain(eUnit, False, not trade):
						if eUnit in unitsWithBonuses:
							maybeUnits.add(eUnit)
						else:
							units.add(eUnit)
						break
				else:
					if city.canTrain(eUnit, False, False):
						units.add(eUnit)
						break
	BugUtil.debug("%s can train:", player.getName())
	for eUnit in units:
		unitInfo = gc.getUnitInfo(eUnit)
		BugUtil.debug("  %s", unitInfo.getDescription())
	if askingPlayer:
		BugUtil.debug("%s can maybe train:", player.getName())
		for eUnit in maybeUnits:
			unitInfo = gc.getUnitInfo(eUnit)
			BugUtil.debug("  %s", unitInfo.getDescription())
		return units, maybeUnits
	else:
		return units
Example #19
0
def getTrainableUnits(playerOrID, knowableUnits, checkCities=True, military=None):
	"""
	Returns the set of all units the player can train, including obsolete ones.
	"""
	game = CyGame()
	player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
	civInfo = gc.getCivilizationInfo(player.getCivilizationType())
	if checkCities:
		cities = PlayerUtil.getPlayerCities(player)
	else:
		cities = None
	units = set()
	BugUtil.debug("%s =========", player.getName())
	for eClass in range(NUM_CLASSES):
		eUnit = civInfo.getCivilizationUnits(eClass)
		if eUnit == -1 or eUnit not in knowableUnits:
			#BugUtil.debug("  %s -> unknowable", gc.getUnitClassInfo(eClass).getDescription())
			continue
		unitInfo = gc.getUnitInfo(eUnit)
		# not buildable
		eCost = unitInfo.getProductionCost()
		if (eCost == -1):
			BugUtil.debug("  %s -> not a buildable unit", unitInfo.getDescription())
			continue
		# military
		if military is not None:
			combat = (unitInfo.getUnitCombatType() > 0 or unitInfo.getNukeRange() != -1
					or unitInfo.getAirCombat() > 0)
			if military != combat:
				#BugUtil.debug("  %s -> combat is %s", unitInfo.getDescription(), combat)
				continue
		# OCC and Settlers
		if game.isOption(GameOptionTypes.GAMEOPTION_ONE_CITY_CHALLENGE) and unitInfo.isFound():
			BugUtil.debug("  %s -> no founding units in OCC", unitInfo.getDescription())
			continue
		# techs
		for eTech in unitTechs[eUnit]:
			if not team.isHasTech(eTech):
				BugUtil.debug("  %s -> doesn't know %s", unitInfo.getDescription(), 
						gc.getTechInfo(eTech).getDescription())
				missing = True
				break
		else:
			missing = False
		if missing:
			continue
		# civ specific
		ePrereqCiv = unitInfo.getPrereqCiv()
		if ePrereqCiv != -1 and player.getCivilizationType() != ePrereqCiv:
			BugUtil.debug("  %s -> wrong civilization", unitInfo.getDescription())
			continue
		# state religion
		eReligion = unitInfo.getStateReligion()
		if eReligion != -1 and player.getStateReligion() != eReligion:
			BugUtil.debug("  %s -> wrong state religion", unitInfo.getDescription())
			continue
		# nukes
		if (game.isNoNukes() or not game.isNukesValid()) and unitInfo.getNukeRange() != -1:
			BugUtil.debug("  %s -> no nukes", unitInfo.getDescription())
			continue
		# getSpecialUnitType, game.isSpecialUnitValid
		eSpecialType = unitInfo.getSpecialUnitType()
		if eSpecialType != -1 and not game.isSpecialUnitValid(eSpecialType):
			BugUtil.debug("  %s -> special unit type %s invalid", unitInfo.getDescription(),
					gc.getSpecialUnitInfo(eSpecialType).getDescription())
			continue
		# cities
		if cities and not canAnyCityBuildUnit(eUnit, cities, -1, True):
			BugUtil.debug("  %s -> no city can train unit", unitInfo.getDescription())
			continue
		BugUtil.debug("  %s", unitInfo.getDescription())
		units.add(eUnit)
	return units
Example #20
0
def getTrainableUnits(playerOrID,
                      knowableUnits,
                      checkCities=True,
                      military=None):
    """
	Returns the set of all units the player can train, including obsolete ones.
	"""
    game = CyGame()
    player, team = PlayerUtil.getPlayerAndTeam(playerOrID)
    civInfo = gc.getCivilizationInfo(player.getCivilizationType())
    if checkCities:
        cities = PlayerUtil.getPlayerCities(player)
    else:
        cities = None
    units = set()
    BugUtil.debug("%s =========", player.getCivilizationShortDescription(0))
    for eClass in range(NUM_CLASSES):
        eUnit = civInfo.getCivilizationUnits(eClass)
        if eUnit == -1 or eUnit not in knowableUnits:
            #BugUtil.debug("  %s -> unknowable", gc.getUnitClassInfo(eClass).getDescription())
            continue
        unitInfo = gc.getUnitInfo(eUnit)
        # military
        if military is not None:
            combat = (unitInfo.getUnitCombatType() > 0
                      or unitInfo.getNukeRange() != -1
                      or unitInfo.getAirCombat() > 0)
            if military != combat:
                #BugUtil.debug("  %s -> combat is %s", unitInfo.getDescription(), combat)
                continue
        # OCC and Settlers
        if game.isOption(GameOptionTypes.GAMEOPTION_ONE_CITY_CHALLENGE
                         ) and unitInfo.isFound():
            BugUtil.debug("  %s -> no founding units in OCC",
                          unitInfo.getDescription())
            continue
        # techs
        for eTech in unitTechs[eUnit]:
            if not team.isHasTech(eTech):
                BugUtil.debug("  %s -> doesn't know %s",
                              unitInfo.getDescription(),
                              gc.getTechInfo(eTech).getDescription())
                missing = True
                break
        else:
            missing = False
        if missing:
            continue
        # state religion
        eReligion = unitInfo.getStateReligion()
        if eReligion != -1 and player.getStateReligion() != eReligion:
            BugUtil.debug("  %s -> wrong state religion",
                          unitInfo.getDescription())
            continue
        # nukes
        if (game.isNoNukes()
                or not game.isNukesValid()) and unitInfo.getNukeRange() != -1:
            BugUtil.debug("  %s -> no nukes", unitInfo.getDescription())
            continue
        # getSpecialUnitType, game.isSpecialUnitValid
        eSpecialType = unitInfo.getSpecialUnitType()
        if eSpecialType != -1 and not game.isSpecialUnitValid(eSpecialType):
            BugUtil.debug("  %s -> special unit type %s invalid",
                          unitInfo.getDescription(),
                          gc.getSpecialUnitInfo(eSpecialType).getDescription())
            continue
        # cities
        if cities and not canAnyCityBuildUnit(eUnit, cities, -1, True):
            BugUtil.debug("  %s -> no city can train unit",
                          unitInfo.getDescription())
            continue
        BugUtil.debug("  %s", unitInfo.getDescription())
        units.add(eUnit)
    return units