key = HEALING_GUN_$TIER$
icon = GFX_ship_part_bio_healing_$TIER$
icon_frame = 1
type = missile

size = point_defence
hide_damage_values_from_tooltip = yes
potential = {
	ship_uses_weaver_components = yes
	from = {
		country_uses_bio_ships = yes
	}
}

show_tech_unlock_if = {
	country_uses_bio_ships = yes
}

use_ship_main_target = no
target_type = target_allies
target_focus = spread
on_hit = {
	hidden_effect = {
		if = {
			limit = {
				exists = this
				has_hp_percentage < 0.99
			}
			repair_amount = @bio_healing_t$TIER$
		}
		else = {
			repair_armor_amount = @bio_healing_t$TIER$
		}
	}
	custom_tooltip = "bio_healing_$TIER$_tt"
}
injected_modifier = {
	modifier = {
		modifier = bio_healing_$TIER$
		days = 10
	}
	stack_info = {			#A ship can only be affected by one injected modifier of a certain id. If multiple modifiers have the same ID the one with the highest priority will be applied.
		id = bio_healing
		priority = $TIER$
	}
}

target_weights = {
	# Ships with lower hp/armor should have a higher target weight
	mauler_stage_1 = 12
	mauler_stage_2 = 11
	mauler_stage_3 = 10
	harbinger_stage_1 = 9
	harbinger_stage_2 = 8
	harbinger_stage_3 = 7
	stinger_stage_1 = 6
	stinger_stage_2 = 5
	stinger_stage_3 = 4
	# Weavers should prioritise other ship types above themselves
	weaver_stage_1 = 3
	weaver_stage_2 = 2
	weaver_stage_3 = 1
}

resources = {
	# Explicitly call the costs and upkeep for "small" weapons
	category = ship_components
	cost = {
		alloys = @s_t$TIER$_cost
		mult = 0.5
	}
	cost = {
		food = @s_t$TIER$_cost
		mult = @alloy_to_food_cost_ratio
	}
	cost = {
		exotic_gases = $EXOTIC_GASES$
		sr_dark_matter = $DARK_MATTER$
	}
	upkeep = {
		food = @s_t$TIER$_upkeep_energy
		alloys = @s_t$TIER$_upkeep_alloys
	}
}
ai_tags = { buffer_role buffer_role_stealth }	#tags must be pre-registered in common/weapon_tags
component_set = BIO_HEALING_GUN_$TIER$
prerequisites = {
	tech_weaver_bio_healing_$TIER$
}
tags = { weapon_type_kinetic buffer_role }
