當前位置: 首頁>>代碼示例>>Python>>正文


Python PlayerUtil.teams方法代碼示例

本文整理匯總了Python中PlayerUtil.teams方法的典型用法代碼示例。如果您正苦於以下問題:Python PlayerUtil.teams方法的具體用法?Python PlayerUtil.teams怎麽用?Python PlayerUtil.teams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PlayerUtil的用法示例。


在下文中一共展示了PlayerUtil.teams方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: getWorstEnemyTeams

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import teams [as 別名]
def getWorstEnemyTeams():
	"""
	Returns a dictionary of the team IDs that are each team's worst enemy.
	
	The key is team ID; the value is the worst enemy team ID.
	If a team has no worst enemy, -1 is stored as its value.
	Ignores dead, human, barbarian, and minor teams.
	
	Loops over players because CyTeam does not have getWorstEnemyName().
	"""
	namesToID = {}
	for team in PlayerUtil.teams(alive=True, barbarian=False, minor=False):
		namesToID[team.getName()] = team.getID()
	enemies = {}
	for team in PlayerUtil.teams(alive=True, human=False, barbarian=False, minor=False):
		eTeam = team.getID()
		eLeader = team.getLeaderID()
		if eLeader != -1:
			player = PlayerUtil.getPlayer(eLeader)
			worstEnemyName = player.getWorstEnemyName()
			if worstEnemyName:
				try:
					enemies[eTeam] = namesToID[worstEnemyName]
				except KeyError:
					BugUtil.debug("Cannot find team \"%s\"", worstEnemyName)
					enemies[eTeam] = -1
			else:
				enemies[eTeam] = -1
	return enemies
開發者ID:DC123456789,項目名稱:Dawn-of-Civilization,代碼行數:31,代碼來源:AttitudeUtil.py

示例2: getCurrentValuesByTeam

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import teams [as 別名]
def getCurrentValuesByTeam():
    valuesByTeam = {}
    for team in PlayerUtil.teams(True, None, False):
        valuesByTeam[team.getID()] = values = []
        for targetTeam in PlayerUtil.teams():
            values.append(team.getEspionagePointsAgainstTeam(targetTeam.getID()))
    return valuesByTeam
開發者ID:NikNaks,項目名稱:Civ4-K-Mod,代碼行數:9,代碼來源:SpyUtil.py

示例3: getSpending

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import teams [as 別名]
def getSpending(playerOrID, ActiveplayerOrID=None):
    if ActiveplayerOrID != None:
        pActiveTeam = PlayerUtil.getPlayerTeam(ActiveplayerOrID)

    iTotal = 0
    for targetTeam in PlayerUtil.teams(True, None, False):
        if ActiveplayerOrID == None or pActiveTeam.isHasMet(targetTeam.getID()):
            iTotal += getDifferenceByTeam(PlayerUtil.getPlayerTeam(playerOrID), targetTeam.getID())
    return iTotal
開發者ID:NikNaks,項目名稱:Civ4-K-Mod,代碼行數:11,代碼來源:SpyUtil.py

示例4: getWorstEnemyTeam

# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import teams [as 別名]
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
開發者ID:DC123456789,項目名稱:Dawn-of-Civilization,代碼行數:16,代碼來源:AttitudeUtil.py


注:本文中的PlayerUtil.teams方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。