@cost0 = 0
@cost1 = 5
@cost2 = 10
@cost3 = 20

utility_component_template = {
	key = "NEUROCHIPS_SWARM_SAPIENT"
	size = small
	icon = "GFX_neurochips_swarm_sapient"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "swarm"
	upgrade_path = swarm
	prerequisites = { "tech_combat_computers_3" "tech_combat_computers_bio_integration" }
	upgrades_to = "AVC_NEUROCHIPS_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 = "NEUROCHIPS_SWARM_AUTONOMOUS"
	size = small
	icon = "GFX_neurochips_swarm_sapient"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "swarm"
	upgrade_path = swarm
	prerequisites = { "tech_combat_computers_autonomous" "tech_combat_computers_bio_integration" }
	upgrades_to = "AVC_NEUROCHIPS_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 = "NEUROCHIPS_SWARM_PRECOG"
	size = small
	icon = "GFX_neurochips_swarm_precog"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "swarm"
	upgrade_path = swarm
	prerequisites = { "tech_precognition_interface" "tech_combat_computers_bio_integration" }
	upgrades_to = "AVC_NEUROCHIPS_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 = "NEUROCHIPS_TORPEDO_SAPIENT"
	size = small
	icon = "GFX_neurochips_swarm_sapient"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "torpedo"
	upgrade_path = torpedo
	prerequisites = {
		"tech_combat_computers_3"
		"tech_combat_computers_bio_integration"
		"tech_torpedoes_1"
	}
	upgrades_to = "AVC_NEUROCHIPS_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 = "NEUROCHIPS_TORPEDO_AUTONOMOUS"
	size = small
	icon = "GFX_neurochips_swarm_sapient"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "torpedo"
	upgrade_path = torpedo
	prerequisites = {
		"tech_combat_computers_autonomous"
		"tech_combat_computers_bio_integration"
		"tech_torpedoes_1"
	}
	upgrades_to = "AVC_NEUROCHIPS_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 = "NEUROCHIPS_TORPEDO_PRECOG"
	size = small
	icon = "GFX_neurochips_swarm_precog"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "torpedo"
	upgrade_path = torpedo
	prerequisites = {
		"tech_precognition_interface"
		"tech_combat_computers_bio_integration"
		"tech_torpedoes_1"
	}
	upgrades_to = "AVC_NEUROCHIPS_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 = "NEUROCHIPS_PICKET_SAPIENT"
	size = small
	icon = "GFX_neurochips_picket_sapient"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "picket"
	upgrade_path = picket
	prerequisites = { "tech_combat_computers_3" "tech_combat_computers_bio_integration" }
	upgrades_to = "AVC_NEUROCHIPS_PICKET_4"
	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 = "NEUROCHIPS_PICKET_AUTONOMOUS"
	size = small
	icon = "GFX_neurochips_picket_sapient"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "picket"
	upgrade_path = picket
	prerequisites = { "tech_combat_computers_autonomous" "tech_combat_computers_bio_integration" }
	upgrades_to = "AVC_NEUROCHIPS_PICKET_AUTONOMOUS_4"
	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 = "NEUROCHIPS_PICKET_PRECOG"
	size = small
	icon = "GFX_neurochips_picket_precog"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "picket"
	upgrade_path = picket
	prerequisites = { "tech_precognition_interface" "tech_combat_computers_bio_integration" }
	upgrades_to = "AVC_NEUROCHIPS_PICKET_PRECOG_2"
	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 = "NEUROCHIPS_LINE_SAPIENT"
	size = small
	icon = "GFX_neurochips_line_sapient"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "line"
	upgrade_path = line
	prerequisites = { "tech_combat_computers_3" "tech_combat_computers_bio_integration" }
	upgrades_to = "AVC_NEUROCHIPS_LINE_4"
	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 = "NEUROCHIPS_LINE_AUTONOMOUS"
	size = small
	icon = "GFX_neurochips_line_sapient"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "line"
	upgrade_path = line
	prerequisites = { "tech_combat_computers_autonomous" "tech_combat_computers_bio_integration" }
	upgrades_to = "AVC_NEUROCHIPS_LINE_AUTONOMOUS_4"
	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 = "NEUROCHIPS_LINE_PRECOG"
	size = small
	icon = "GFX_neurochips_line_precog"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "line"
	upgrade_path = line
	prerequisites = { "tech_precognition_interface" "tech_combat_computers_bio_integration" }
	upgrades_to = "AVC_NEUROCHIPS_LINE_PRECOG_2"
	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 = "NEUROCHIPS_ARTILLERY_SAPIENT"
	size = small
	icon = "GFX_neurochips_artillery_sapient"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "artillery"
	upgrade_path = artillery
	prerequisites = { "tech_combat_computers_3" "tech_combat_computers_bio_integration" }
	upgrades_to = "AVC_NEUROCHIPS_ARTILLERY_4"
	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 = "NEUROCHIPS_ARTILLERY_AUTONOMOUS"
	size = small
	icon = "GFX_neurochips_artillery_sapient"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "artillery"
	upgrade_path = artillery
	prerequisites = { "tech_combat_computers_autonomous" "tech_combat_computers_bio_integration" }
	upgrades_to = "AVC_NEUROCHIPS_ARTILLERY_AUTONOMOUS_4"
	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 = "NEUROCHIPS_ARTILLERY_PRECOG"
	size = small
	icon = "GFX_neurochips_artillery_precog"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "artillery"
	upgrade_path = artillery
	prerequisites = { "tech_precognition_interface" "tech_combat_computers_bio_integration" }
	upgrades_to = "AVC_NEUROCHIPS_ARTILLERY_PRECOG_2"
	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 = "NEUROCHIPS_CARRIER_SAPIENT"
	size = small
	icon = "GFX_neurochips_carrier_sapient"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "carrier"
	upgrade_path = carrier
	prerequisites = { "tech_combat_computers_3" "tech_combat_computers_bio_integration" }
	upgrades_to = "AVC_NEUROCHIPS_CARRIER_4"
	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 = "NEUROCHIPS_CARRIER_AUTONOMOUS"
	size = small
	icon = "GFX_neurochips_carrier_sapient"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "carrier"
	upgrade_path = carrier
	prerequisites = { "tech_combat_computers_autonomous" "tech_combat_computers_bio_integration" }
	upgrades_to = "AVC_NEUROCHIPS_CARRIER_AUTONOMOUS_4"
	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 = "NEUROCHIPS_CARRIER_PRECOG"
	size = small
	icon = "GFX_neurochips_carrier_precog"
	icon_frame = 1
	resources = {
		category = ship_components
		inline_script = {
			script = "grand_archive/mutations/component_dynamic_cost"
			COST = @cost3
		}
	}
	potential = {
		ship_uses_space_fauna_computers = yes
	}
	component_set = "neurochips"
	ship_behavior = "carrier"
	upgrade_path = carrier
	prerequisites = { "tech_precognition_interface" "tech_combat_computers_bio_integration" }
	upgrades_to = "AVC_NEUROCHIPS_CARRIER_PRECOG_2"
	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
		}
	}
}
