当前位置: 首页>>代码示例>>Python>>正文


Python BasicBuilder.execute方法代码示例

本文整理汇总了Python中horizons.ai.aiplayer.basicbuilder.BasicBuilder.execute方法的典型用法代码示例。如果您正苦于以下问题:Python BasicBuilder.execute方法的具体用法?Python BasicBuilder.execute怎么用?Python BasicBuilder.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在horizons.ai.aiplayer.basicbuilder.BasicBuilder的用法示例。


在下文中一共展示了BasicBuilder.execute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: execute

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import execute [as 别名]
	def execute(self):
		# TODO Add a check that figures out if all trees that should be planted are in range of the settlement.
		# If not, return range missing result
		(result, building) = super(LumberjackEvaluator, self).execute()
		if result != BUILD_RESULT.OK:
			return (result, None)

		production_builder = self.area_builder
		coastline = production_builder.land_manager.coastline
		island_ground_map = production_builder.island.ground_map
		forest_coords_list = []
		for coords in building.position.get_radius_coordinates(Entities.buildings[BUILDINGS.LUMBERJACK].radius):
			if coords in production_builder.plan and production_builder.plan[coords][0] == BUILDING_PURPOSE.NONE and coords not in coastline:
				if island_ground_map[coords].object is not None and island_ground_map[coords].object.id == BUILDINGS.TREE:
					forest_coords_list.append(coords)
				elif island_ground_map[coords].settlement is not None and island_ground_map[coords].settlement.owner is self.area_builder.owner:
					builder = BasicBuilder(BUILDINGS.TREE, coords, 0)
					if not builder.have_resources(production_builder.land_manager):
						break
					if builder:
						assert builder.execute(production_builder.land_manager)
						forest_coords_list.append(coords)

		production_builder.register_change_list(forest_coords_list, BUILDING_PURPOSE.TREE, None)

		return (BUILD_RESULT.OK, building)
开发者ID:Rareson,项目名称:unknown-horizons,代码行数:28,代码来源:lumberjack.py

示例2: execute

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import execute [as 别名]
	def execute(self):
		(result, building) = super(LumberjackEvaluator, self).execute()
		if result != BUILD_RESULT.OK:
			return (result, None)

		production_builder = self.area_builder
		coastline = production_builder.land_manager.coastline
		island_ground_map = production_builder.island.ground_map
		forest_coords_list = []
		for coords in building.position.get_radius_coordinates(Entities.buildings[BUILDINGS.LUMBERJACK].radius):
			if coords in production_builder.plan and production_builder.plan[coords][0] == BUILDING_PURPOSE.NONE and coords not in coastline:
				ok = False
				if island_ground_map[coords].object is not None and island_ground_map[coords].object.id == BUILDINGS.TREE:
					ok = True
				else:
					builder = BasicBuilder(BUILDINGS.TREE, coords, 0)
					if not builder.have_resources(production_builder.land_manager):
						break
					if builder:
						assert builder.execute(production_builder.land_manager)
						ok = True
				if ok:
					forest_coords_list.append(coords)

		production_builder.register_change_list(forest_coords_list, BUILDING_PURPOSE.TREE, None)

		return (BUILD_RESULT.OK, building)
开发者ID:BenjaminHarper,项目名称:unknown-horizons,代码行数:29,代码来源:lumberjack.py

示例3: _reached_destination_area

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import execute [as 别名]
	def _reached_destination_area(self):
		self.log.info('%s reached BO area', self)

		builder = BasicBuilder(BUILDINGS.WAREHOUSE, self.coords, 0)
		self.warehouse = builder.execute(self.land_manager, ship=self.ship)
		if not self.warehouse:
			self.report_failure('Unable to build the warehouse')
			return

		self.land_manager.settlement = self.warehouse.settlement
		self.log.info('%s built the warehouse', self)

		self._unload_all_resources(self.land_manager.settlement)
		self.report_success('Built the warehouse, transferred resources')
开发者ID:Antagonym,项目名称:unknown-horizons,代码行数:16,代码来源:foundsettlement.py


注:本文中的horizons.ai.aiplayer.basicbuilder.BasicBuilder.execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。