本文整理汇总了Python中MoveUtilsAI.getAIFleetOrdersFromSystemAITargets方法的典型用法代码示例。如果您正苦于以下问题:Python MoveUtilsAI.getAIFleetOrdersFromSystemAITargets方法的具体用法?Python MoveUtilsAI.getAIFleetOrdersFromSystemAITargets怎么用?Python MoveUtilsAI.getAIFleetOrdersFromSystemAITargets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoveUtilsAI
的用法示例。
在下文中一共展示了MoveUtilsAI.getAIFleetOrdersFromSystemAITargets方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generateAIFleetOrders
# 需要导入模块: import MoveUtilsAI [as 别名]
# 或者: from MoveUtilsAI import getAIFleetOrdersFromSystemAITargets [as 别名]
def generateAIFleetOrders(self):
"generates AIFleetOrders from fleets targets to accomplish"
universe = fo.getUniverse()
fleetID = self.target_id
fleet = universe.getFleet(fleetID)
if (not fleet) or fleet.empty or (fleetID in universe.destroyedObjectIDs(fo.empireID())): #fleet was probably merged into another or was destroyed
foAI.foAIstate.deleteFleetInfo(fleetID)
return
# TODO: priority
self.clearAIFleetOrders()
systemID = fleet.systemID
start_sys_id = [ fleet.nextSystemID, systemID ][ systemID >= 0 ]
# if fleet doesn't have any mission, then repair if needed or resupply if is current location not in supplyable system
empire = fo.getEmpire()
fleetSupplyableSystemIDs = empire.fleetSupplyableSystemIDs
#if (not self.hasAnyAIMissionTypes()):
ntargets=0
for aiFleetMissionType in self.getAIMissionTypes():
ntargets += len( self.getAITargets(aiFleetMissionType) )
if (ntargets ==0) and (systemID not in set(AIstate.colonyTargetedSystemIDs + AIstate.outpostTargetedSystemIDs +
AIstate.invasionTargetedSystemIDs + AIstate.blockadeTargetedSystemIDs) ):
if self.need_repair():
repairAIFleetOrder = MoveUtilsAI.getRepairAIFleetOrder(self.getAITarget(), start_sys_id)
if repairAIFleetOrder.isValid():
self.appendAIFleetOrder(repairAIFleetOrder)
if not(self.getLocationAITarget().target_id in fleetSupplyableSystemIDs):
resupplyAIFleetOrder = MoveUtilsAI.getResupplyAIFleetOrder(self.getAITarget(), self.getLocationAITarget())
if resupplyAIFleetOrder.isValid():
self.appendAIFleetOrder(resupplyAIFleetOrder)
return #no targets
# for some targets fleet has to visit systems and therefore fleet visit them
systemAITargets = self.__getRequiredToVisitSystemAITargets()
aiFleetOrdersToVisitSystems = MoveUtilsAI.getAIFleetOrdersFromSystemAITargets(self.getAITarget(), systemAITargets)
#TODO: if fleet doesn't have enough fuel to get to final target, consider resetting Mission
#print "----------------------------------------"
#print "*+*+ fleet %d : has fleet action system targets: %s"%(fleetID, [str(obj) for obj in systemAITargets])
#print "----------"
#print "*+*+ fleet %d: has movement orders: %s"%(fleetID, [str(obj) for obj in aiFleetOrdersToVisitSystems])
for aiFleetOrder in aiFleetOrdersToVisitSystems:
self.appendAIFleetOrder(aiFleetOrder)
# if fleet is in some system = fleet.systemID >=0, then also generate system AIFleetOrders
if systemID >= 0:
# system in where fleet is
systemAITarget = AITarget.AITarget(EnumsAI.AITargetType.TARGET_SYSTEM, systemID)
# if mission aiTarget has required system where fleet is, then generate aiFleetOrder from this aiTarget
aiMissionTypes = self.getAIMissionTypes()
# for all targets in all mission types get required systems to visit
for aiFleetMissionType in aiMissionTypes:
aiTargets = self.getAITargets(aiFleetMissionType)
for aiTarget in aiTargets:
if systemAITarget in aiTarget.get_required_system_ai_targets():
# from target required to visit get fleet orders to accomplish target
aiFleetOrder = self.__getAIFleetOrderFromAITarget(aiFleetMissionType, aiTarget)
self.appendAIFleetOrder(aiFleetOrder)
示例2: generateAIFleetOrders
# 需要导入模块: import MoveUtilsAI [as 别名]
# 或者: from MoveUtilsAI import getAIFleetOrdersFromSystemAITargets [as 别名]
def generateAIFleetOrders(self):
"generates AIFleetOrders from fleets targets to accomplish"
universe = fo.getUniverse()
fleetID = self.getAITargetID()
fleet = universe.getFleet(fleetID)
if (not fleet) or fleet.empty or (fleetID in universe.destroyedObjectIDs(fo.empireID())): #fleet was probably merged into another or was destroyed
foAI.foAIstate.deleteFleetInfo(fleetID)
return
# TODO: priority
self.clearAIFleetOrders()
ntargets=0
for aiFleetMissionType in self.getAIMissionTypes():
ntargets += len( self.getAITargets(aiFleetMissionType) )
if ntargets ==0:
return #no targets
# for some targets fleet has to visit systems and therefore fleet visit them
systemAITargets = self.__getRequiredToVisitSystemAITargets()
aiFleetOrdersToVisitSystems = MoveUtilsAI.getAIFleetOrdersFromSystemAITargets(self.getAITarget(), systemAITargets)
#print "----------------------------------------"
#print "*+*+ fleet %d : has fleet action system targets: %s"%(fleetID, [str(obj) for obj in systemAITargets])
#print "----------"
#print "*+*+ fleet %d: has movement orders: %s"%(fleetID, [str(obj) for obj in aiFleetOrdersToVisitSystems])
for aiFleetOrder in aiFleetOrdersToVisitSystems:
self.appendAIFleetOrder(aiFleetOrder)
# if fleet is in some system = fleet.systemID >=0, then also generate system AIFleetOrders
systemID = fleet.systemID
if systemID >= 0:
# system in where fleet is
systemAITarget = AITarget.AITarget(AITargetType.TARGET_SYSTEM, systemID)
# if mission aiTarget has required system where fleet is, then generate aiFleetOrder from this aiTarget
aiMissionTypes = self.getAIMissionTypes()
# for all targets in all mission types get required systems to visit
for aiFleetMissionType in aiMissionTypes:
aiTargets = self.getAITargets(aiFleetMissionType)
for aiTarget in aiTargets:
if systemAITarget in aiTarget.getRequiredSystemAITargets():
# from target required to visit get fleet orders to accomplish target
aiFleetOrder = self.__getAIFleetOrderFromAITarget(aiFleetMissionType, aiTarget)
self.appendAIFleetOrder(aiFleetOrder)
# if fleet don't have any mission, then resupply if is current location not in supplyable system
empire = fo.getEmpire()
fleetSupplyableSystemIDs = empire.fleetSupplyableSystemIDs
if (not self.hasAnyAIMissionTypes()) and not(self.getLocationAITarget().getTargetID() in fleetSupplyableSystemIDs):
resupplyAIFleetOrder = MoveUtilsAI.getResupplyAIFleetOrder(self.getAITarget(), self.getLocationAITarget())
if resupplyAIFleetOrder.isValid():
self.appendAIFleetOrder(resupplyAIFleetOrder)
示例3: generateAIFleetOrders
# 需要导入模块: import MoveUtilsAI [as 别名]
# 或者: from MoveUtilsAI import getAIFleetOrdersFromSystemAITargets [as 别名]
def generateAIFleetOrders(self):
"generates AIFleetOrders from fleets targets to accomplish"
# TODO: priority
self.clearAIFleetOrders()
# for some targets fleet has to visit systems and therefore fleet visit them
systemAITargets = self.__getRequiredToVisitSystemAITargets()
aiFleetOrdersToVisitSystems = MoveUtilsAI.getAIFleetOrdersFromSystemAITargets(self.getAITarget(), systemAITargets)
# if fleet is in some system = fleet.systemID >=0, then also generate system AIFleetOrders
universe = fo.getUniverse()
fleet = universe.getFleet(self.getAITargetID())
systemID = fleet.systemID
if systemID >= 0:
# system in where fleet is
systemAITarget = AITarget.AITarget(AITargetType.TARGET_SYSTEM, systemID)
# if mission aiTarget has required system where fleet is, then generate aiFleetOrder from this aiTarget
aiMissionTypes = self.getAIMissionTypes()
# for all targets in all mission types get required systems to visit
for aiFleetMissionType in aiMissionTypes:
aiTargets = self.getAITargets(aiFleetMissionType)
for aiTarget in aiTargets:
if systemAITarget in aiTarget.getRequiredSystemAITargets():
# from target required to visit get fleet orders to accomplish target
aiFleetOrder = self.__getAIFleetOrderFromAITarget(aiFleetMissionType, aiTarget)
self.appendAIFleetOrder(aiFleetOrder)
for aiFleetOrder in aiFleetOrdersToVisitSystems:
self.appendAIFleetOrder(aiFleetOrder)
# if fleet don't have any mission, then resupply if is current location not in supplyable system
empire = fo.getEmpire()
fleetSupplyableSystemIDs = empire.fleetSupplyableSystemIDs
if (not self.hasAnyAIMissionTypes()) and not(self.getLocationAITarget().getTargetID() in fleetSupplyableSystemIDs):
resupplyAIFleetOrder = MoveUtilsAI.getResupplyAIFleetOrder(self.getAITarget(), self.getLocationAITarget())
if resupplyAIFleetOrder.isValid():
self.appendAIFleetOrder(resupplyAIFleetOrder)