@cost0 = 0
@cost1 = 5
@cost2 = 10
@cost3 = 20
@power0 = -5
@power1 = -10
@power2 = -15
@power3 = -25

utility_component_template = {
	key = "COMBAT_COMPUTER_SWARM_SAPIENT"
	size = small
	icon = "GFX_ship_part_computer_swarm_sapient"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_swarm_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "swarm"
	upgrade_path = swarm
	prerequisites = { "tech_combat_computers_3" }
	upgrades_to = "AVC_COMBAT_COMPUTER_SWARM_4"
	ai_tags = { gunship gunship_stealth brawler brawler_stealth }
	ai_tag_weight = 0

	modifier = {
		ship_evasion_mult = 0.25
	}
	ship_modifier = {
		ship_fire_rate_mult = 0.15
	}

	ai_weight = {
		weight = 5
		modifier = {
			factor = 0
			OR = {
				has_global_flag = ghost_signal_5_flag
				has_global_flag = ghost_signal_4_flag
				has_global_flag = ghost_signal_3_flag
				has_global_flag = ghost_signal_2_flag
				has_global_flag = ghost_signal_1_flag
				has_policy_flag = ai_outlawed
			}
		}
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_SWARM_AUTONOMOUS"
	size = small
	icon = "GFX_ship_part_computer_swarm_sapient"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_swarm_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "swarm"
	upgrade_path = swarm
	prerequisites = { "tech_combat_computers_autonomous" }
	upgrades_to = "AVC_COMBAT_COMPUTER_SWARM_AUTONOMOUS_4"
	ai_tags = { gunship gunship_stealth brawler brawler_stealth }
	ai_tag_weight = 0

	modifier = {
		ship_evasion_mult = 0.25
	}
	ship_modifier = {
		ship_fire_rate_mult = 0.15
	}

	ai_weight = {
		weight = 5
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_SWARM_PRECOG"
	size = small
	icon = "GFX_ship_part_computer_swarm_precog"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_swarm_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "swarm"
	upgrade_path = swarm
	prerequisites = { "tech_precognition_interface" }
	upgrades_to = "AVC_COMBAT_COMPUTER_SWARM_PRECOG_2"
	ai_tags = { gunship gunship_stealth brawler brawler_stealth }
	ai_tag_weight = 0

	modifier = {
		ship_evasion_mult = 0.15
		ship_speed_mult = 0.20
	}
	ship_modifier = {
		ship_fire_rate_mult = 0.15
	}

	ai_weight = {
		weight = 4
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_TORPEDO_SAPIENT"
	size = small
	icon = "GFX_ship_part_computer_swarm_sapient"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_torpedo_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "torpedo"
	upgrade_path = torpedo
	prerequisites = {
		tech_combat_computers_3
		tech_torpedoes_1
	}
	upgrades_to = "AVC_COMBAT_COMPUTER_TORPEDO_4"
	ai_tags = { explosive explosive_stealth }
	ai_tag_weight = 0

	modifier = {
		ship_evasion_mult = 0.10
	}

	ship_modifier = {
		weapon_type_explosive_weapon_damage_mult = 0.15
		ship_damage_against_starbases_mult = 0.80
		ship_orbital_bombardment_mult = 0.80
	}

	ai_weight = {
		weight = 5
		modifier = {
			factor = 0
			OR = {
				has_global_flag = ghost_signal_5_flag
				has_global_flag = ghost_signal_4_flag
				has_global_flag = ghost_signal_3_flag
				has_global_flag = ghost_signal_2_flag
				has_global_flag = ghost_signal_1_flag
				has_policy_flag = ai_outlawed
			}
		}
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_TORPEDO_AUTONOMOUS"
	size = small
	icon = "GFX_ship_part_computer_swarm_sapient"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_torpedo_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "torpedo"
	upgrade_path = torpedo
	prerequisites = {
		tech_combat_computers_autonomous
		tech_torpedoes_1
	}
	upgrades_to = "AVC_COMBAT_COMPUTER_TORPEDO_AUTONOMOUS_4"
	ai_tags = { explosive explosive_stealth }
	ai_tag_weight = 0

	modifier = {
		ship_evasion_mult = 0.10
	}

	ship_modifier = {
		weapon_type_explosive_weapon_damage_mult = 0.15
		ship_damage_against_starbases_mult = 0.80
		ship_orbital_bombardment_mult = 0.80
	}

	ai_weight = {
		weight = 5
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_TORPEDO_PRECOG"
	size = small
	icon = "GFX_ship_part_computer_swarm_precog"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_torpedo_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "torpedo"
	upgrade_path = torpedo
	prerequisites = {
		tech_precognition_interface
		tech_torpedoes_1
	}
	upgrades_to = "AVC_COMBAT_COMPUTER_TORPEDO_PRECOG_2"
	ai_tags = { explosive explosive_stealth }
	ai_tag_weight = 0

	ship_modifier = {
		weapon_type_explosive_weapon_damage_mult = 0.15
		ship_tracking_add = 10
		ship_damage_against_starbases_mult = 0.80
		ship_orbital_bombardment_mult = 0.80
	}

	ai_weight = {
		weight = 4
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_PICKET_SAPIENT"
	size = small
	icon = "GFX_ship_part_computer_picket_sapient"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_picket_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "picket"
	upgrades_to = "AVC_COMBAT_COMPUTER_PICKET_4"
	upgrade_path = picket
	prerequisites = { "tech_combat_computers_3" }
	ai_tags = { screen screen_stealth }
	ai_tag_weight = 0

	modifier = {
		ship_evasion_mult = 0.10
	}
	ship_modifier = {
		ship_fire_rate_mult = 0.15
		ship_tracking_add = 30
	}

	ai_weight = {
		weight = 5
		modifier = {
			factor = 0
			OR = {
				has_global_flag = ghost_signal_5_flag
				has_global_flag = ghost_signal_4_flag
				has_global_flag = ghost_signal_3_flag
				has_global_flag = ghost_signal_2_flag
				has_global_flag = ghost_signal_1_flag
				has_policy_flag = ai_outlawed
			}
		}
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_PICKET_AUTONOMOUS"
	size = small
	icon = "GFX_ship_part_computer_picket_sapient"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_picket_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "picket"
	upgrades_to = "AVC_COMBAT_COMPUTER_PICKET_AUTONOMOUS_4"
	upgrade_path = picket
	prerequisites = { "tech_combat_computers_autonomous" }
	ai_tags = { screen screen_stealth }
	ai_tag_weight = 0

	modifier = {
		ship_evasion_mult = 0.10
	}
	ship_modifier = {
		ship_fire_rate_mult = 0.15
		ship_tracking_add = 30
	}

	ai_weight = {
		weight = 5
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_PICKET_PRECOG"
	size = small
	icon = "GFX_ship_part_computer_picket_precog"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_picket_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "picket"
	upgrades_to = "AVC_COMBAT_COMPUTER_PICKET_PRECOG_2"
	upgrade_path = picket
	prerequisites = { "tech_precognition_interface" }
	ai_tags = { screen screen_stealth }
	ai_tag_weight = 0

	ship_modifier = {
		ship_fire_rate_mult = 0.20
		ship_tracking_add = 40
	}

	ai_weight = {
		weight = 4
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_LINE_SAPIENT"
	size = small
	icon = "GFX_ship_part_computer_line_sapient"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_line_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "line"
	upgrades_to = "AVC_COMBAT_COMPUTER_LINE_4"
	upgrade_path = line
	prerequisites = { "tech_combat_computers_3" }
	ai_tags = { gunship gunship_stealth }
	ai_tag_weight = 0

	ship_modifier = {
		ship_fire_rate_mult = 0.20
		ship_accuracy_add = 20
	}

	ai_weight = {
		weight = 5
		modifier = {
			factor = 0
			OR = {
				has_global_flag = ghost_signal_5_flag
				has_global_flag = ghost_signal_4_flag
				has_global_flag = ghost_signal_3_flag
				has_global_flag = ghost_signal_2_flag
				has_global_flag = ghost_signal_1_flag
				has_policy_flag = ai_outlawed
			}
		}
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_LINE_AUTONOMOUS"
	size = small
	icon = "GFX_ship_part_computer_line_sapient"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_line_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "line"
	upgrades_to = "AVC_COMBAT_COMPUTER_LINE_AUTONOMOUS_4"
	upgrade_path = line
	prerequisites = { "tech_combat_computers_autonomous" }
	ai_tags = { gunship gunship_stealth }
	ai_tag_weight = 0

	ship_modifier = {
		ship_fire_rate_mult = 0.20
		ship_accuracy_add = 20
	}

	ai_weight = {
		weight = 5
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_LINE_PRECOG"
	size = small
	icon = "GFX_ship_part_computer_line_precog"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_line_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "line"
	upgrades_to = "AVC_COMBAT_COMPUTER_LINE_PRECOG_2"
	upgrade_path = line
	prerequisites = { "tech_precognition_interface" }
	ai_tags = { gunship gunship_stealth }
	ai_tag_weight = 0

	ship_modifier = {
		ship_fire_rate_mult = 0.15
		ship_accuracy_add = 15
		ship_tracking_add = 10
	}

	ai_weight = {
		weight = 4
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_ARTILLERY_SAPIENT"
	size = small
	icon = "GFX_ship_part_computer_artillery_sapient"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_artillery_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "artillery"
	upgrades_to = "AVC_COMBAT_COMPUTER_ARTILLERY_4"
	upgrade_path = artillery
	prerequisites = { "tech_combat_computers_3" }
	ai_tags = { artillery artillery_stealth energy_torpedoes energy_torpedoes_stealth }
	ai_tag_weight = 0

	ship_modifier = {
		ship_fire_rate_mult = 0.20
		ship_weapon_range_mult = 0.20
	}

	ai_weight = {
		weight = 5
		modifier = {
			factor = 0
			OR = {
				has_global_flag = ghost_signal_5_flag
				has_global_flag = ghost_signal_4_flag
				has_global_flag = ghost_signal_3_flag
				has_global_flag = ghost_signal_2_flag
				has_global_flag = ghost_signal_1_flag
				has_policy_flag = ai_outlawed
			}
		}
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_ARTILLERY_AUTONOMOUS"
	size = small
	icon = "GFX_ship_part_computer_artillery_sapient"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_artillery_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "artillery"
	upgrades_to = "AVC_COMBAT_COMPUTER_ARTILLERY_AUTONOMOUS_4"
	upgrade_path = artillery
	prerequisites = { "tech_combat_computers_autonomous" }
	ai_tags = { artillery artillery_stealth energy_torpedoes energy_torpedoes_stealth }
	ai_tag_weight = 0

	ship_modifier = {
		ship_fire_rate_mult = 0.20
		ship_weapon_range_mult = 0.20
	}

	ai_weight = {
		weight = 5
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_ARTILLERY_PRECOG"
	size = small
	icon = "GFX_ship_part_computer_artillery_precog"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_artillery_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "artillery"
	upgrades_to = "AVC_COMBAT_COMPUTER_ARTILLERY_PRECOG_2"
	upgrade_path = artillery
	prerequisites = { "tech_precognition_interface" }
	ai_tags = { artillery artillery_stealth energy_torpedoes energy_torpedoes_stealth }
	ai_tag_weight = 0

	ship_modifier = {
		ship_fire_rate_mult = 0.15
		ship_weapon_range_mult = 0.15
		ship_tracking_add = 10
	}

	ai_weight = {
		weight = 4
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_CARRIER_SAPIENT"
	size = small
	icon = "GFX_ship_part_computer_carrier_sapient"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_carrier_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "carrier"
	upgrades_to = "AVC_COMBAT_COMPUTER_CARRIER_4"
	upgrade_path = carrier
	prerequisites = { "tech_combat_computers_3" }
	ai_tags = { carrier }
	ai_tag_weight = 0

	ship_modifier = {
		ship_engagement_range_mult = 1.0
	}

	ai_weight = {
		weight = 5
		modifier = {
			factor = 5
			is_preferred_weapons = weapon_type_strike_craft
		}
		modifier = {
			factor = 0
			OR = {
				has_global_flag = ghost_signal_5_flag
				has_global_flag = ghost_signal_4_flag
				has_global_flag = ghost_signal_3_flag
				has_global_flag = ghost_signal_2_flag
				has_global_flag = ghost_signal_1_flag
				has_policy_flag = ai_outlawed
			}
		}
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_CARRIER_AUTONOMOUS"
	size = small
	icon = "GFX_ship_part_computer_carrier_sapient"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_carrier_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "carrier"
	upgrades_to = "AVC_COMBAT_COMPUTER_CARRIER_AUTONOMOUS_4"
	upgrade_path = carrier
	prerequisites = { "tech_combat_computers_autonomous" }
	ai_tags = { carrier }
	ai_tag_weight = 0

	ship_modifier = {
		ship_engagement_range_mult = 1.0
	}

	ai_weight = {
		weight = 5
		modifier = {
			factor = 5
			is_preferred_weapons = weapon_type_strike_craft
		}
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_CARRIER_PRECOG"
	size = small
	icon = "GFX_ship_part_computer_carrier_precog"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_carrier_role = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "carrier"
	upgrades_to = "AVC_COMBAT_COMPUTER_CARRIER_PRECOG_2"
	upgrade_path = carrier
	prerequisites = { "tech_precognition_interface" }
	ai_tags = { carrier }
	ai_tag_weight = 0

	ship_modifier = {
		ship_engagement_range_mult = 0.75
		ship_tracking_add = 10
	}

	ai_weight = {
		weight = 4
		modifier = {
			factor = 5
			is_preferred_weapons = weapon_type_strike_craft
		}
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_PLATFORM_SAPIENT"
	size = small
	icon = "GFX_ship_part_computer_platform_sapient"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_platform_computers = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "platform"
	upgrades_to = "AVC_COMBAT_COMPUTER_PLATFORM_4"
	prerequisites = { "tech_combat_computers_3" }

	ship_modifier = {
		ship_fire_rate_mult = 0.35
		ship_tracking_add = 25
		ship_accuracy_add = 10
	}

	ai_weight = {
		weight = 5
		modifier = {
			factor = 0
			OR = {
				has_global_flag = ghost_signal_5_flag
				has_global_flag = ghost_signal_4_flag
				has_global_flag = ghost_signal_3_flag
				has_global_flag = ghost_signal_2_flag
				has_global_flag = ghost_signal_1_flag
				has_policy_flag = ai_outlawed
			}
		}
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_PLATFORM_AUTONOMOUS"
	size = small
	icon = "GFX_ship_part_computer_platform_sapient"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_platform_computers = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "platform"
	upgrades_to = "AVC_COMBAT_COMPUTER_PLATFORM_AUTONOMOUS_4"
	prerequisites = { "tech_combat_computers_autonomous" }

	ship_modifier = {
		ship_fire_rate_mult = 0.35
		ship_tracking_add = 25
		ship_accuracy_add = 10
	}

	ai_weight = {
		weight = 5
	}
}

utility_component_template = {
	key = "COMBAT_COMPUTER_PLATFORM_PRECOG"
	size = small
	icon = "GFX_ship_part_computer_platform_precog"
	icon_frame = 1
	power = @power3
	resources = {
		category = ship_components
		cost = {
			alloys = @cost3
		}
	}
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_platform_computers = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "platform"
	upgrades_to = "AVC_COMBAT_COMPUTER_PLATFORM_PRECOG_2"
	prerequisites = { "tech_precognition_interface" }

	ship_modifier = {
		ship_fire_rate_mult = 0.35
		ship_tracking_add = 35
	}

	ai_weight = {
		weight = 4
	}
}

utility_component_template = {
	key = "STARBASE_COMBAT_COMPUTER_3"
	size = small
	icon = "GFX_ship_part_computer_default"
	icon_frame = 1
	power = 0
	potential = {
		from = {
			country_uses_bio_ships = no
		}
		ship_uses_starbase_components = yes
	}

	show_tech_unlock_if = {
		country_uses_bio_ships = no
	}
	component_set = "combat_computers"
	ship_behavior = "platform"
	upgrades_to = "AVC_STARBASE_COMBAT_COMPUTER_4"
	prerequisites = { "tech_combat_computers_2" }

	ship_modifier = {
		ship_fire_rate_mult = 0.15
		ship_tracking_add = 30
	}

	ai_weight = {
		weight = 3
	}
}
