本文整理汇总了Python中MilitaryAI.get_num_military_ships方法的典型用法代码示例。如果您正苦于以下问题:Python MilitaryAI.get_num_military_ships方法的具体用法?Python MilitaryAI.get_num_military_ships怎么用?Python MilitaryAI.get_num_military_ships使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MilitaryAI
的用法示例。
在下文中一共展示了MilitaryAI.get_num_military_ships方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _calculate_exploration_priority
# 需要导入模块: import MilitaryAI [as 别名]
# 或者: from MilitaryAI import get_num_military_ships [as 别名]
def _calculate_exploration_priority():
"""Calculates the demand for scouts by unexplored systems."""
empire = fo.getEmpire()
num_unexplored_systems = len(ExplorationAI.borderUnexploredSystemIDs)
num_scouts = sum([foAI.foAIstate.fleetStatus.get(fid, {}).get('nships', 0) for fid in FleetUtilsAI.get_empire_fleet_ids_by_role(
MissionType.EXPLORATION)])
production_queue = empire.productionQueue
queued_scout_ships = 0
for queue_index in range(0, len(production_queue)):
element = production_queue[queue_index]
if element.buildType == EmpireProductionTypes.BT_SHIP:
if foAI.foAIstate.get_ship_role(element.designID) == ShipRoleType.CIVILIAN_EXPLORATION:
queued_scout_ships += element.remaining * element.blocksize
mil_ships = MilitaryAI.get_num_military_ships()
# intent of the following calc is essentially
# new_scouts_needed = min(need_cap_A, need_cap_B, base_need) - already_got_or_queued
# where need_cap_A is to help prevent scouting needs from swamping military needs, and
# need_cap_B is to help regulate investment into scouting while the empire is small.
# These caps could perhaps instead be tied more directly to military priority and
# total empire production.
desired_number_of_scouts = int(min(4 + mil_ships/5, 4 + fo.currentTurn()/50.0, 2 + num_unexplored_systems**0.5))
scouts_needed = max(0, desired_number_of_scouts - (num_scouts + queued_scout_ships))
exploration_priority = int(40 * scouts_needed)
print
print "Number of Scouts: %s" % num_scouts
print "Number of Unexplored systems: %s" % num_unexplored_systems
print "Military size: %s" % mil_ships
print "Priority for scouts: %s" % exploration_priority
return exploration_priority