本文整理匯總了Python中PlayerUtil.getPlayerTeam方法的典型用法代碼示例。如果您正苦於以下問題:Python PlayerUtil.getPlayerTeam方法的具體用法?Python PlayerUtil.getPlayerTeam怎麽用?Python PlayerUtil.getPlayerTeam使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PlayerUtil
的用法示例。
在下文中一共展示了PlayerUtil.getPlayerTeam方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: getSpending
# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getPlayerTeam [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
示例2: canContact
# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getPlayerTeam [as 別名]
def canContact(playerOrID, toPlayerOrID):
"""
Returns True if <player> can attempt to contact <toPlayer> given game settings,
initial contact, and war-time situation without regard to willingness to talk.
- They must not be the same player
- <toPlayer> must be alive, not minor, and not a barbarian
- Their teams must have met
- If they are at war, they must be able to sign a peace deal (no Always War or Permanent War/Peace options)
"""
playerID, player = PlayerUtil.getPlayerAndID(playerOrID)
toPlayerID, toPlayer = PlayerUtil.getPlayerAndID(toPlayerOrID)
if playerID == toPlayerID:
return False
if not toPlayer.isAlive() or toPlayer.isBarbarian() or toPlayer.isMinorCiv():
return False
if not PlayerUtil.getPlayerTeam(player).isHasMet(toPlayer.getTeam()):
return False
if PlayerUtil.getPlayerTeam(player).isAtWar(toPlayer.getTeam()) and (GameUtil.isAlwaysWar() or GameUtil.isPermanentWarPeace()):
return False
return True
示例3: calculateTradeRoutes
# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getPlayerTeam [as 別名]
def calculateTradeRoutes(playerOrID, withPlayerOrID=None):
"""
Returns the domestic and foreign trade route yields and counts for <playerOrID>:
domestic yield, domestic count, foreign yield, and foreign count.
If <withPlayerOrID> is given, only counts trade routes to their cities.
If Fractional Trade Routes is active, the value returned is fractional (times 100).
"""
domesticTrade = domesticCount = foreignTrade = foreignCount = 0
eTeam = PlayerUtil.getPlayerTeam(playerOrID)
eWithPlayer = PlayerUtil.getPlayerID(withPlayerOrID)
for city in PlayerUtil.playerCities(playerOrID):
for i in range(city.getTradeRoutes()):
tradeCity = city.getTradeCity(i)
if tradeCity and tradeCity.getOwner() >= 0 and (eWithPlayer == -1 or eWithPlayer == tradeCity.getOwner()):
trade = city.calculateTradeYield(YieldTypes.YIELD_COMMERCE, TRADE_PROFIT_FUNC(city, tradeCity))
if tradeCity.getTeam() == eTeam:
domesticTrade += trade
domesticCount += 1
else:
foreignTrade += trade
foreignCount += 1
return domesticTrade, domesticCount, foreignTrade, foreignCount
示例4: getDifferenceByPlayer
# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getPlayerTeam [as 別名]
def getDifferenceByPlayer(playerOrID, targetPlayerOrID=None):
if targetPlayerOrID is None:
return getDifferenceByTeam(PlayerUtil.getPlayerTeam(playerOrID))
else:
return getDifferenceByTeam(PlayerUtil.getPlayerTeam(playerOrID), PlayerUtil.getPlayerTeamID(targetPlayerOrID))
示例5: getTradeContacts
# 需要導入模塊: import PlayerUtil [as 別名]
# 或者: from PlayerUtil import getPlayerTeam [as 別名]
def getTradeContacts(player, trade):
return PlayerUtil.getPlayerTeam(trade.iData).getName()