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


Python BasicBuilder.create方法代码示例

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


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

示例1: create

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import create [as 别名]
	def create(cls, area_builder, x, y, new_field_purpose):
		building_id = {
			BUILDING_PURPOSE.POTATO_FIELD:    BUILDINGS.POTATO_FIELD,
			BUILDING_PURPOSE.PASTURE:         BUILDINGS.PASTURE,
			BUILDING_PURPOSE.SUGARCANE_FIELD: BUILDINGS.SUGARCANE_FIELD,
			BUILDING_PURPOSE.TOBACCO_FIELD:   BUILDINGS.TOBACCO_FIELD,
			BUILDING_PURPOSE.HERBARY:         BUILDINGS.HERBARY,
		}.get(new_field_purpose)

		personality = area_builder.owner.personality_manager.get('ModifiedFieldEvaluator')
		value = {
			BUILDING_PURPOSE.POTATO_FIELD:    personality.add_potato_field_value,
			BUILDING_PURPOSE.PASTURE:         personality.add_pasture_value,
			BUILDING_PURPOSE.SUGARCANE_FIELD: personality.add_sugarcane_field_value,
			BUILDING_PURPOSE.TOBACCO_FIELD:   personality.add_tobacco_field_value,
			BUILDING_PURPOSE.HERBARY:         personality.add_herbary_field_value,
		}.get(new_field_purpose, 0)

		old_field_purpose = area_builder.plan[(x, y)][0]
		value -= {
			BUILDING_PURPOSE.POTATO_FIELD:    personality.remove_unused_potato_field_penalty,
			BUILDING_PURPOSE.PASTURE:         personality.remove_unused_pasture_penalty,
			BUILDING_PURPOSE.SUGARCANE_FIELD: personality.remove_unused_sugarcane_field_penalty,
			BUILDING_PURPOSE.TOBACCO_FIELD:   personality.remove_unused_tobacco_field_penalty,
			BUILDING_PURPOSE.HERBARY:         personality.remove_unused_herbary_field_penalty,
		}.get(old_field_purpose, 0)

		builder = BasicBuilder.create(building_id, (x, y), 0)
		return ModifiedFieldEvaluator(area_builder, builder, value, old_field_purpose)
开发者ID:cpdef,项目名称:unknown-horizons,代码行数:31,代码来源:farm.py

示例2: create

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import create [as 别名]
	def create(cls, area_builder, x, y, new_field_purpose):
		building_id = None
		if new_field_purpose == BUILDING_PURPOSE.POTATO_FIELD:
			building_id = BUILDINGS.POTATO_FIELD
		elif new_field_purpose == BUILDING_PURPOSE.PASTURE:
			building_id = BUILDINGS.PASTURE
		elif new_field_purpose == BUILDING_PURPOSE.SUGARCANE_FIELD:
			building_id = BUILDINGS.SUGARCANE_FIELD
		elif new_field_purpose == BUILDING_PURPOSE.TOBACCO_FIELD:
			building_id = BUILDINGS.TOBACCO_FIELD

		value = 0
		personality = area_builder.owner.personality_manager.get('ModifiedFieldEvaluator')
		if new_field_purpose == BUILDING_PURPOSE.POTATO_FIELD:
			value += personality.add_potato_field_value
		elif new_field_purpose == BUILDING_PURPOSE.PASTURE:
			value += personality.add_pasture_value
		elif new_field_purpose == BUILDING_PURPOSE.SUGARCANE_FIELD:
			value += personality.add_sugarcane_field_value
		elif new_field_purpose == BUILDING_PURPOSE.TOBACCO_FIELD:
			value += personality.add_tobacco_field_value

		old_field_purpose = area_builder.plan[(x, y)][0]
		if old_field_purpose == BUILDING_PURPOSE.POTATO_FIELD:
			value -= personality.remove_unused_potato_field_penalty
		elif old_field_purpose == BUILDING_PURPOSE.PASTURE:
			value -= personality.remove_unused_pasture_penalty
		elif old_field_purpose == BUILDING_PURPOSE.SUGARCANE_FIELD:
			value -= personality.remove_unused_sugarcane_field_penalty
		elif old_field_purpose == BUILDING_PURPOSE.TOBACCO_FIELD:
			value -= personality.remove_unused_tobacco_field_penalty

		builder = BasicBuilder.create(building_id, (x, y), 0)
		return ModifiedFieldEvaluator(area_builder, builder, value, old_field_purpose)
开发者ID:Daenor,项目名称:unknown-horizons,代码行数:36,代码来源:farm.py

示例3: create

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import create [as 别名]
	def create(cls, area_builder, x, y, orientation):
		# TODO: create a late initialization phase for this kind of stuff
		if cls.__radius_offsets is None:
			cls.__init_outline()

		area_value = 0
		coastline = area_builder.land_manager.coastline
		personality = area_builder.owner.personality_manager.get('LumberjackEvaluator')
		for dx, dy in cls.__radius_offsets:
			coords = (x + dx, y + dy)
			if coords in area_builder.plan and coords not in coastline:
				purpose = area_builder.plan[coords][0]
				if purpose == BUILDING_PURPOSE.NONE:
					area_value += personality.new_tree
				elif purpose == BUILDING_PURPOSE.TREE:
					area_value += personality.shared_tree
		area_value = min(area_value, personality.max_forest_value) # the lumberjack doesn't actually need all the trees
		if area_value < personality.min_forest_value:
			return None # the area is too bad for a lumberjack

		personality = area_builder.owner.personality_manager.get('LumberjackEvaluator')
		alignment = cls._get_alignment_from_outline(area_builder, cls._get_outline(x, y))
		value = area_value + alignment * personality.alignment_importance
		builder = BasicBuilder.create(BUILDINGS.LUMBERJACK, (x, y), orientation)
		return LumberjackEvaluator(area_builder, builder, value)
开发者ID:Rareson,项目名称:unknown-horizons,代码行数:27,代码来源:lumberjack.py

示例4: create

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import create [as 别名]
    def create(cls, area_builder, x, y, orientation):
        builder = BasicBuilder.create(BUILDINGS.SMELTERY, (x, y), orientation)

        distance_to_iron_mine = cls._distance_to_nearest_building(area_builder, builder, BUILDINGS.MINE)
        distance_to_collector = cls._distance_to_nearest_collector(area_builder, builder)
        distance_to_charcoal_burner = cls._distance_to_nearest_building(
            area_builder, builder, BUILDINGS.CHARCOAL_BURNER
        )
        if distance_to_collector is None and (distance_to_charcoal_burner is None or distance_to_iron_mine is None):
            return None

        personality = area_builder.owner.personality_manager.get("SmelteryEvaluator")
        distance_penalty = Entities.buildings[BUILDINGS.SMELTERY].radius * personality.distance_penalty

        alignment = cls._get_alignment(area_builder, builder.position.tuple_iter())
        distance = cls._weighted_distance(
            distance_to_iron_mine,
            [
                (personality.collector_distance_importance, distance_to_collector),
                (personality.charcoal_burner_distance_importance, distance_to_charcoal_burner),
            ],
            distance_penalty,
        )
        value = (
            float(Entities.buildings[BUILDINGS.SMELTERY].radius) / distance
            + alignment * personality.alignment_importance
        )
        return SmelteryEvaluator(area_builder, builder, value)
开发者ID:korchynskyi,项目名称:unknown-horizons,代码行数:30,代码来源:smeltery.py

示例5: extend_settlement_with_storage

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import create [as 别名]
	def extend_settlement_with_storage(self, target_position):
		"""Build a storage to extend the settlement towards the given position. Return a BUILD_RESULT constant."""
		if not self.have_resources(BUILDINGS.STORAGE):
			return BUILD_RESULT.NEED_RESOURCES

		storage_class = Entities.buildings[BUILDINGS.STORAGE]
		storage_spots = self.island.terrain_cache.get_buildability_intersection(storage_class.terrain_type,
			storage_class.size, self.settlement.buildability_cache, self.buildability_cache)
		storage_surrounding_offsets = Rect.get_surrounding_offsets(storage_class.size)
		coastline = self.land_manager.coastline

		options = []
		for (x, y) in sorted(storage_spots):
			builder = BasicBuilder.create(BUILDINGS.STORAGE, (x, y), 0)

			alignment = 1
			for (dx, dy) in storage_surrounding_offsets:
				coords = (x + dx, y + dy)
				if coords in coastline or coords not in self.plan or self.plan[coords][0] != BUILDING_PURPOSE.NONE:
					alignment += 1

			distance = distances.distance_rect_rect(target_position, builder.position)
			value = distance - alignment * 0.7
			options.append((-value, builder))
		return self.build_best_option(options, BUILDING_PURPOSE.STORAGE)
开发者ID:STEVEOO6,项目名称:unknown-horizons,代码行数:27,代码来源:productionbuilder.py

示例6: create

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import create [as 别名]
	def create(cls, area_builder, x, y, orientation):
		coords = (x, y)
		rect_rect_distance_func = distances.distance_rect_rect
		builder = BasicBuilder.create(BUILDINGS.FISHER, coords, orientation)

		shallow_water_body = area_builder.session.world.shallow_water_body
		fisher_shallow_water_body_ids = set()
		for fisher_coords in builder.position.tuple_iter():
			if fisher_coords in shallow_water_body:
				fisher_shallow_water_body_ids.add(shallow_water_body[fisher_coords])
		fisher_shallow_water_body_ids = list(fisher_shallow_water_body_ids)
		assert fisher_shallow_water_body_ids

		tiles_used = 0
		fish_value = 0.0
		last_usable_tick = Scheduler().cur_tick - 60 * GAME_SPEED.TICKS_PER_SECOND # TODO: use a direct calculation
		for fish in area_builder.session.world.fish_indexer.get_buildings_in_range(coords):
			if shallow_water_body[fish.position.origin.to_tuple()] not in fisher_shallow_water_body_ids:
				continue # not in the same shallow water body as the fisher => unreachable
			if fish.last_usage_tick > last_usable_tick:
				continue # the fish deposit seems to be already in use

			distance = rect_rect_distance_func(builder.position, fish.position) + 1.0
			if tiles_used >= cls.refill_cycle_in_tiles:
				fish_value += min(1.0, (3 * cls.refill_cycle_in_tiles - tiles_used) / distance) / 10.0
			else:
				fish_value += min(1.0, (cls.refill_cycle_in_tiles - tiles_used) / distance)

			tiles_used += distance
			if tiles_used >= 3 * cls.refill_cycle_in_tiles:
				break

		if fish_value < 1.5:
			return None
		return FisherEvaluator(area_builder, builder, fish_value)
开发者ID:JamesOravec,项目名称:unknown-horizons,代码行数:37,代码来源:fisher.py

示例7: create

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import create [as 别名]
	def create(cls, area_builder, x, y, orientation):
		builder = BasicBuilder.create(BUILDINGS.WEAVER, (x, y), orientation)

		distance_to_farm = None
		for building in area_builder.settlement.buildings_by_id.get(BUILDINGS.FARM, []):
			distance = builder.position.distance(building.position)
			if distance <= Entities.buildings[BUILDINGS.WEAVER].radius:
				wool_producer = False
				for provider in building.get_providers():
					if isinstance(provider, Entities.buildings[BUILDINGS.PASTURE]):
						wool_producer = True
						break
				if wool_producer:
					distance_to_farm = distance if distance_to_farm is None or distance < distance_to_farm else distance_to_farm

		distance_to_collector = cls._distance_to_nearest_collector(area_builder, builder)
		if distance_to_collector is None:
			return None # require weavers to have a collector building in range

		personality = area_builder.owner.personality_manager.get('WeaverEvaluator')
		distance_penalty = Entities.buildings[BUILDINGS.WEAVER].radius * personality.distance_penalty
		alignment = cls._get_alignment(area_builder, builder.position.tuple_iter())
		distance = cls._weighted_distance(distance_to_collector, [(personality.farm_distance_importance, distance_to_farm)], distance_penalty)
		value = float(Entities.buildings[BUILDINGS.WEAVER].radius) / distance + alignment * personality.alignment_importance
		return WeaverEvaluator(area_builder, builder, value)
开发者ID:JamesOravec,项目名称:unknown-horizons,代码行数:27,代码来源:weaver.py

示例8: create

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import create [as 别名]
    def create(cls, area_builder, x, y, orientation):
        builder = BasicBuilder.create(BUILDINGS.DISTILLERY, (x, y), orientation)

        distance_to_farm = None
        for building in area_builder.settlement.buildings_by_id.get(BUILDINGS.FARM, []):
            distance = builder.position.distance(building.position)
            if distance <= Entities.buildings[BUILDINGS.DISTILLERY].radius:
                sugarcane_producer = False
                for provider in building.get_providers():
                    if isinstance(provider, Entities.buildings[BUILDINGS.SUGARCANE_FIELD]):
                        sugarcane_producer = True
                        break
                if sugarcane_producer:
                    distance_to_farm = (
                        distance if distance_to_farm is None or distance < distance_to_farm else distance_to_farm
                    )

        distance_to_collector = cls._distance_to_nearest_collector(area_builder, builder)
        if distance_to_collector is None:
            return None  # require distilleries to have a collector building in range

        personality = area_builder.owner.personality_manager.get("DistilleryEvaluator")
        distance_penalty = Entities.buildings[BUILDINGS.DISTILLERY].radius * personality.distance_penalty

        alignment = cls._get_alignment(area_builder, builder.position.tuple_iter())
        distance = cls._weighted_distance(
            distance_to_collector, [(personality.farm_distance_importance, distance_to_farm)], distance_penalty
        )
        value = (
            float(Entities.buildings[BUILDINGS.DISTILLERY].radius) / distance
            + alignment * personality.alignment_importance
        )
        return DistilleryEvaluator(area_builder, builder, value)
开发者ID:hansjoachim,项目名称:unknown-horizons,代码行数:35,代码来源:distillery.py

示例9: create

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import create [as 别名]
	def create(cls, area_builder, x, y, orientation):
		builder = BasicBuilder.create(BUILDINGS.BOAT_BUILDER, (x, y), orientation)

		distance_to_collector = cls._distance_to_nearest_collector(area_builder, builder)
		if distance_to_collector is None:
			return None # require boat builders to have a collector building in range

		personality = area_builder.owner.personality_manager.get('BoatBuilderEvaluator')
		alignment = cls._get_alignment(area_builder, builder.position.tuple_iter())
		value = float(Entities.buildings[BUILDINGS.BOAT_BUILDER].radius) / distance_to_collector + alignment * personality.alignment_importance
		return BoatBuilderEvaluator(area_builder, builder, value)
开发者ID:Antagonym,项目名称:unknown-horizons,代码行数:13,代码来源:boatbuilder.py

示例10: create

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import create [as 别名]
	def create(cls, area_builder, x, y, orientation):
		builder = BasicBuilder.create(BUILDINGS.SIGNAL_FIRE, (x, y), orientation)

		sea_area = 0
		for coords in builder.position.get_radius_coordinates(Entities.buildings[BUILDINGS.SIGNAL_FIRE].radius):
			if coords in area_builder.session.world.water:
				sea_area += 1

		personality = area_builder.owner.personality_manager.get('SignalFireEvaluator')
		alignment = cls._get_alignment(area_builder, builder.position.tuple_iter())
		value = sea_area + alignment * personality.alignment_importance
		return SignalFireEvaluator(area_builder, builder, value)
开发者ID:ErwinJunge,项目名称:unknown-horizons,代码行数:14,代码来源:signalfire.py

示例11: create

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import create [as 别名]
	def create(cls, area_builder, x, y, orientation):
		builder = BasicBuilder.create(BUILDINGS.STONEMASON, (x, y), orientation)
		distance_to_collector = cls._distance_to_nearest_collector(area_builder, builder)
		if distance_to_collector is None:
			return None

		distance_to_stone_pit = cls._distance_to_nearest_building(area_builder, builder, BUILDINGS.STONE_PIT)
		alignment = cls._get_alignment(area_builder, builder.position.tuple_iter())

		personality = area_builder.owner.personality_manager.get('StonemasonEvaluator')
		distance_penalty = Entities.buildings[BUILDINGS.STONEMASON].radius * personality.distance_penalty

		distance = cls._weighted_distance(distance_to_collector, [(personality.stone_pit_distance_importance, distance_to_stone_pit)], distance_penalty)
		value = float(Entities.buildings[BUILDINGS.STONEMASON].radius) / distance + alignment * personality.alignment_importance
		return StonemasonEvaluator(area_builder, builder, value)
开发者ID:ErwinJunge,项目名称:unknown-horizons,代码行数:17,代码来源:stonemason.py

示例12: create

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import create [as 别名]
	def create(cls, production_builder, x, y, orientation):
		settlement_manager = production_builder.settlement_manager
		village_builder = settlement_manager.village_builder
		builder = BasicBuilder.create(BUILDINGS.FIRE_STATION, (x, y), orientation)

		assigned_residences = village_builder.special_building_assignments[BUILDING_PURPOSE.FIRE_STATION][(x, y)]
		total = len(assigned_residences)
		not_serviced = 0
		for residence_coords in assigned_residences:
			if village_builder.plan[residence_coords][0] == BUILDING_PURPOSE.RESIDENCE:
				not_serviced += 1

		if not_serviced <= 0 or not_serviced < total * settlement_manager.owner.personality_manager.get('AbstractFireStation').fraction_of_assigned_residences_built:
			return None

		return FireStationEvaluator(village_builder, builder, not_serviced)
开发者ID:BenjaminHarper,项目名称:unknown-horizons,代码行数:18,代码来源:firestation.py

示例13: _improve_deposit_coverage

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import create [as 别名]
    def _improve_deposit_coverage(self):
        """Get closer to having a resource deposit in the settlement."""
        if not self.production_builder.have_resources(BUILDINGS.STORAGE):
            return BUILD_RESULT.NEED_RESOURCES

        available_deposits = []
        for tile in self.land_manager.resource_deposits[self._deposit_resource_id]:
            if tile.object.settlement is None:
                available_deposits.append(tile.object)
        if not available_deposits:
            return BUILD_RESULT.IMPOSSIBLE

        storage_class = Entities.buildings[BUILDINGS.STORAGE]
        storage_spots = self.island.terrain_cache.get_buildability_intersection(
            storage_class.terrain_type,
            storage_class.size,
            self.settlement.buildability_cache,
            self.production_builder.buildability_cache,
        )

        options = []
        for coords in sorted(storage_spots):
            builder = BasicBuilder.create(BUILDINGS.STORAGE, coords, 0)

            min_distance = None
            for building in available_deposits:
                distance = building.position.distance(builder.position)
                if min_distance is None or min_distance > distance:
                    min_distance = distance

            alignment = 0
            for tile in self.production_builder.iter_neighbor_tiles(builder.position):
                if tile is None:
                    continue
                coords = (tile.x, tile.y)
                if (
                    coords not in self.production_builder.plan
                    or self.production_builder.plan[coords][0] != BUILDING_PURPOSE.NONE
                ):
                    alignment += 1

            value = min_distance - alignment * self.personality.alignment_coefficient
            options.append((-value, builder))

        return self.production_builder.build_best_option(options, BUILDING_PURPOSE.STORAGE)
开发者ID:korchynskyi,项目名称:unknown-horizons,代码行数:47,代码来源:depositcoverage.py

示例14: create

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import create [as 别名]
	def create(cls, area_builder, x, y, orientation):
		builder = BasicBuilder.create(BUILDINGS.CHARCOAL_BURNER, (x, y), orientation)

		distance_to_collector = cls._distance_to_nearest_collector(area_builder, builder)
		if distance_to_collector is None:
			return None

		personality = area_builder.owner.personality_manager.get('CharcoalBurnerEvaluator')
		distance_penalty = Entities.buildings[BUILDINGS.CHARCOAL_BURNER].radius * personality.distance_penalty

		distance_to_iron_mine = cls._distance_to_nearest_building(area_builder, builder, BUILDINGS.MINE)
		distance_to_lumberjack = cls._distance_to_nearest_building(area_builder, builder, BUILDINGS.LUMBERJACK)
		alignment = cls._get_alignment(area_builder, builder.position.tuple_iter())

		distance = cls._weighted_distance(distance_to_collector, [(personality.lumberjack_distance_importance, distance_to_lumberjack),
			(personality.iron_mine_distance_importance, distance_to_iron_mine)], distance_penalty)
		value = float(Entities.buildings[BUILDINGS.CHARCOAL_BURNER].radius) / distance + alignment * personality.alignment_importance
		return CharcoalBurnerEvaluator(area_builder, builder, value)
开发者ID:JamesOravec,项目名称:unknown-horizons,代码行数:20,代码来源:charcoalburner.py

示例15: create

# 需要导入模块: from horizons.ai.aiplayer.basicbuilder import BasicBuilder [as 别名]
# 或者: from horizons.ai.aiplayer.basicbuilder.BasicBuilder import create [as 别名]
	def create(cls, area_builder, x, y, orientation):
		builder = BasicBuilder.create(BUILDINGS.TOOLMAKER, (x, y), orientation)
		distance_to_collector = cls._distance_to_nearest_collector(area_builder, builder)
		if distance_to_collector is None:
			return None

		distance_to_smeltery = cls._distance_to_nearest_building(area_builder, builder, BUILDINGS.SMELTERY)
		distance_to_charcoal_burner = cls._distance_to_nearest_building(area_builder, builder, BUILDINGS.CHARCOAL_BURNER)
		distance_to_lumberjack = cls._distance_to_nearest_building(area_builder, builder, BUILDINGS.LUMBERJACK)
		alignment = cls._get_alignment(area_builder, builder.position.tuple_iter())

		personality = area_builder.owner.personality_manager.get('ToolmakerEvaluator')
		distance_penalty = Entities.buildings[BUILDINGS.TOOLMAKER].radius * personality.distance_penalty

		distance = cls._weighted_distance(distance_to_collector, [(personality.smeltery_distance_importance, distance_to_smeltery),
			(personality.charcoal_burner_distance_importance, distance_to_charcoal_burner), (personality.lumberjack_distance_importance, distance_to_lumberjack)],
			distance_penalty)
		value = float(Entities.buildings[BUILDINGS.TOOLMAKER].radius) / distance + alignment * personality.alignment_importance
		return ToolmakerEvaluator(area_builder, builder, value)
开发者ID:Antagonym,项目名称:unknown-horizons,代码行数:21,代码来源:toolmaker.py


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