# ##################
# Basic army
# ##################
tech_planetary_defenses = {
	cost = 0
	area = society
	start_tech = yes
	category = { military_theory }
	tier = 0

	technology_swap = {
		name = tech_nomads_arkship_defenses
		inherit_icon = yes
		inherit_effects = yes
		trigger = {
			is_nomadic = yes
		}
	}

	technology_swap = { # Wilderness icon swap
		name = tech_wilderness_planetary_defenses
		inherit_icon = no
		inherit_effects = yes
		trigger = {
			is_wilderness_empire = yes
		}
	}

	## unlock defense army, militia and basic attachments
}

# ##################
# Trading
# ##################
tech_interplanetary_commerce = {
	cost = 0
	area = society
	start_tech = yes
	category = { statecraft }
	tier = 0

	potential = {
		is_gestalt = no
	}

	## unlock commercial zone building
}

# Space Trading
tech_space_trading = {
	cost = @tier1cost3
	area = society
	tier = 1
	category = { statecraft }
	prerequisites = { "tech_interplanetary_commerce" }
	weight = @tier1weight3

	potential = {
		is_regular_empire = yes
	}

	weight_modifier = {

		modifier = {
			factor = 1.25
			has_tradition = tr_prosperity_adopt
		}
	}

	ai_weight = {

	}
}

# Interstellar Economics
tech_interstellar_economics = {
	cost = @tier3cost1
	area = society
	tier = 3
	category = { statecraft }
	prerequisites = { "tech_space_trading" }
	weight = @tier3weight1

	potential = {
		is_gestalt = no
	}

	weight_modifier = {
		factor = 2
		modifier = {
			factor = 0
			NOR = {
				has_technology = tech_mine_rare_crystals
				has_technology = tech_rare_crystals
				has_country_flag = has_market_access
			}
		}

		modifier = {
			factor = 1.25
			has_tradition = tr_prosperity_adopt
		}
	}

	ai_weight = {

	}
}

# Galactic Markets
tech_galactic_markets = {
	cost = @tier4cost1
	area = society
	tier = 4
	category = { statecraft }
	prerequisites = { "tech_colonial_centralization" "tech_interstellar_economics" }
	weight = @tier4weight1
	is_rare = yes

	# unlocks Galactic Stock Exchange empire wonder

	potential = {
		is_gestalt = no
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 0.25
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_statecraft }
				has_trait_in_council = { TRAIT = leader_trait_curator }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_galactic_markets
		}
		modifier = {
			factor = 0
			num_communications < 2
		}
	}

	ai_weight = {

	}
}

tech_prescient_data_modeling = {
	cost = @tier3cost1
	area = society
	category = { statecraft }
	tier = 3
	is_rare = yes
	weight = 0

	weight_modifier = {
		factor = 0
	}

	modifier = {
		planet_jobs_trade_produces_mult = 0.025
	}
}

# ##################
# Farming
# ##################

#Industrial Farming
tech_industrial_farming = {
	cost = 0
	area = society
	tier = 0
	category = { biology }
	start_tech = yes

	# unlocks farming districts
}

#Eco Simulation
tech_eco_simulation = {
	cost = @tier1cost1
	area = society
	tier = 1
	category = { biology }
	prerequisites = { "tech_industrial_farming" }
	weight = @tier1weight1

	gateway = zone

	modifier = {
		planet_farmers_food_produces_mult = 0.05
	}

	weight_modifier = {
		modifier = {
			factor = 0.01
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_individual_machine = yes
				is_infernal_empire = yes
				has_origin = origin_synthetic_fertility
			}
			NOR = {
				has_country_flag = non_lithoid_subspecies
				has_valid_civic = civic_machine_servitor
				has_valid_civic = civic_machine_assimilator
				any_owned_planet = {
					OR = {
						has_any_planet_farming_district = yes
						has_any_agriculture_zone = yes
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_infernal_empire = yes
				AND = {
					is_individual_machine = yes
					NOT = { has_country_flag = non_lithoid_subspecies }
				}
			}
		}
		modifier = {
			factor = 1.25
			has_ethic = ethic_pacifist
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_fanatic_pacifist
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
		modifier = {
			factor = 2
			country_uses_bio_ships = yes
		}
		modifier = {
			factor = 5
			OR = {
				has_country_flag = non_lithoid_subspecies
				country_uses_bio_ships = yes
				AND = {
					is_machine_empire = no
					is_lithoid_empire = no
					is_individual_machine = no
				}
			}
			any_owned_planet = {
				OR = {
					has_any_planet_farming_district = yes
					has_any_agriculture_zone = yes
				}
			}
		}
	}

	ai_weight = {
		modifier = {
			factor = 1.25
			has_ethic = ethic_pacifist
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_fanatic_pacifist
		}
	}
}

#Gene Crops
tech_gene_crops = {
	cost = @tier2cost1
	area = society
	tier = 2
	category = { biology }
	prerequisites = { "tech_eco_simulation" }
	weight = @tier2weight1

	modifier = {
		planet_farmers_food_produces_mult = 0.05
	}

	potential = {
		is_wilderness_empire = no
	}

	weight_modifier = {
		modifier = {
			factor = 0.01
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_individual_machine = yes
				is_infernal_empire = yes
				has_origin = origin_synthetic_fertility
			}
			NOR = {
				has_country_flag = non_lithoid_subspecies
				has_valid_civic = civic_machine_servitor
				has_valid_civic = civic_machine_assimilator
				any_owned_planet = {
					OR = {
						has_any_planet_farming_district = yes
						has_any_agriculture_zone = yes
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_infernal_empire = yes
				AND = {
					is_individual_machine = yes
					NOT = { has_country_flag = non_lithoid_subspecies }
				}
			}
		}
		modifier = {
			factor = 1.25
			has_ethic = ethic_pacifist
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_fanatic_pacifist
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
		modifier = {
			factor = 2
			country_uses_bio_ships = yes
		}
	}

	ai_weight = {
		factor = @farming_ai_weight_factor
		modifier = {
			factor = 1.25
			has_ethic = ethic_pacifist
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_fanatic_pacifist
		}
	}
}

#Nano-Vitality Crops
tech_nano_vitality_crops = {
	cost = @tier3cost1
	area = society
	tier = 3
	category = { biology }
	prerequisites = { "tech_gene_crops" }
	weight = @tier3weight1

	modifier = {
		planet_farmers_food_produces_mult = 0.05
	}

	potential = {
		is_wilderness_empire = no
	}

	weight_modifier = {
		modifier = {
			factor = 0.01
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_individual_machine = yes
				is_infernal_empire = yes
				has_origin = origin_synthetic_fertility
			}
			NOR = {
				has_country_flag = non_lithoid_subspecies
				has_valid_civic = civic_machine_servitor
				has_valid_civic = civic_machine_assimilator
				any_owned_planet = {
					OR = {
						has_any_planet_farming_district = yes
						has_any_agriculture_zone = yes
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_infernal_empire = yes
				AND = {
					is_individual_machine = yes
					NOT = { has_country_flag = non_lithoid_subspecies }
				}
			}
		}
		modifier = {
			factor = 1.25
			has_ethic = ethic_pacifist
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_fanatic_pacifist
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
		modifier = {
			factor = 2
			country_uses_bio_ships = yes
		}
	}

	ai_weight = {
		factor = @farming_ai_weight_factor
		modifier = {
			factor = 1.25
			has_ethic = ethic_pacifist
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_fanatic_pacifist
		}
	}
}

tech_nutrient_replication = {
	cost = @tier4cost3
	area = society
	tier = 4
	is_rare = yes
	category = { biology }
	prerequisites = { "tech_nano_vitality_crops" }
	weight = @tier4weight3

	modifier = {
		planet_farmers_food_produces_mult = 0.05
	}

	potential = {
		is_machine_empire = no
		is_wilderness_empire = no
	}

	weight_modifier = {
		modifier = {
			factor = 0.01
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_individual_machine = yes
				is_infernal_empire = yes
				has_origin = origin_synthetic_fertility
			}
			NOR = {
				has_country_flag = non_lithoid_subspecies
				has_valid_civic = civic_machine_servitor
				has_valid_civic = civic_machine_assimilator
				any_owned_planet = {
					OR = {
						has_any_planet_farming_district = yes
						has_any_agriculture_zone = yes
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_infernal_empire = yes
				AND = {
					is_individual_machine = yes
					NOT = { has_country_flag = non_lithoid_subspecies }
				}
			}
		}
		modifier = {
			factor = 0.50
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_biology }
				has_trait_in_council = { TRAIT = leader_trait_curator }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_nutrient_replication
		}
		modifier = {
			factor = 1.25
			has_ethic = ethic_pacifist
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_fanatic_pacifist
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
		modifier = {
			factor = 2
			country_uses_bio_ships = yes
		}
	}

	ai_weight = {
		factor = @farming_ai_weight_factor
		modifier = {
			factor = 1.25
			has_ethic = ethic_pacifist
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_fanatic_pacifist
		}
	}
}

#Hydroponics
tech_hydroponics = {
	cost = 0
	area = society
	tier = 0
	category = { biology }
	start_tech = yes

	potential = {
		is_wilderness_empire = no
	}

	# unlock hydroponics buildings

	weight_modifier = {
		factor = 2
		modifier = {
			factor = 0.01
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_individual_machine = yes
				is_infernal_empire = yes
				has_origin = origin_synthetic_fertility
			}
			NOR = {
				has_country_flag = non_lithoid_subspecies
				has_valid_civic = civic_machine_servitor
				has_valid_civic = civic_machine_assimilator
				any_owned_planet = {
					OR = {
						has_any_planet_farming_district = yes
						has_any_agriculture_zone = yes
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_infernal_empire = yes
				AND = {
					is_individual_machine = yes
					NOT = { has_country_flag = non_lithoid_subspecies }
				}
			}
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
		modifier = {
			factor = 2
			country_uses_bio_ships = yes
		}
	}

	ai_weight = {
	}
}

#Food Processing
tech_food_processing_1 = {
	cost = @tier1cost2
	area = society
	tier = 1
	category = { biology }
	prerequisites = { "tech_eco_simulation" }
	weight = @tier1weight2

	# unlock food processing facility

	technology_swap = { # Wilderness icon swap
		name = tech_wilderness_food_processing_1
		inherit_icon = no
		inherit_effects = yes
		trigger = {
			is_wilderness_empire = yes
		}
	}

	weight_modifier = {
		modifier = {
			factor = 2
			country_uses_food = yes
		}
		modifier = {
			factor = 1.25
			has_tradition = tr_prosperity_adopt
			country_uses_food = yes
		}
		modifier = {
			factor = 5
			any_owned_planet = {
				OR = {
					has_any_planet_farming_district = yes
					has_any_agriculture_zone = yes
				}
			}
		}
		modifier = {
			factor = 0.01
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_individual_machine = yes
				is_infernal_empire = yes
				has_origin = origin_synthetic_fertility
			}
			NOR = {
				has_country_flag = non_lithoid_subspecies
				has_valid_civic = civic_machine_servitor
				has_valid_civic = civic_machine_assimilator
				any_owned_planet = {
					OR = {
						has_any_planet_farming_district = yes
						has_any_agriculture_zone = yes
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			country_uses_food = no
		}
		modifier = {
			factor = 1.5
			OR = {
				has_valid_civic = civic_agrarian_idyll
				is_anglers_empire = yes
			}
		}
		modifier = {
			factor = 2
			is_catalytic_empire = yes
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
	}

	ai_weight = {
		factor = @farming_building_ai_weight_factor # leads to food processing building

		modifier = {
			factor = 0
			country_uses_food = no
		}
		modifier = {
			factor = 1.5
			OR = {
				has_valid_civic = civic_agrarian_idyll
				is_anglers_empire = yes
			}
		}
		modifier = {
			factor = 2
			is_catalytic_empire = yes
		}
	}
}

#Advanced Food Processing
tech_food_processing_2 = {
	cost = @tier3cost1
	area = society
	tier = 3
	category = { biology }
	prerequisites = { "tech_food_processing_1" }
	weight = @tier3weight1

	technology_swap = { # Wilderness icon swap
		name = tech_wilderness_food_processing_2
		inherit_icon = no
		inherit_effects = yes
		trigger = {
			is_wilderness_empire = yes
		}
	}

	weight_modifier = {
		factor = 2
		modifier = {
			factor = 0.01
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_individual_machine = yes
				is_infernal_empire = yes
				has_origin = origin_synthetic_fertility
			}
			NOR = {
				has_country_flag = non_lithoid_subspecies
				has_valid_civic = civic_machine_servitor
				has_valid_civic = civic_machine_assimilator
				any_owned_planet = {
					OR = {
						has_any_planet_farming_district = yes
						has_any_agriculture_zone = yes
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_infernal_empire = yes
				AND = {
					is_individual_machine = yes
					NOT = { has_country_flag = non_lithoid_subspecies }
				}
			}
		}
		modifier = {
			factor = 0
			NOR = {
				has_technology = tech_mine_volatile_motes
				has_technology = tech_volatile_motes
				has_country_flag = has_market_access
			}
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
		modifier = {
			factor = 2
			country_uses_bio_ships = yes
		}
	}

	ai_weight = {
		factor = @farming_building_ai_weight_factor # food processing

		modifier = {
			factor = 0
			country_uses_food = no
		}
	}
}

# ##################
# Biolab and Colonization
# ##################

tech_society_1 = {
	area = society
	category = { biology }
	tier = 1
	cost = @tier1cost3
	prerequisites = { "tech_basic_science_lab_1" }
	weight = @tier1weight3

	potential = {
		is_wilderness_empire = no
	}

	weight_modifier = {
		modifier = {
			factor = 5
			is_ai = yes
		}
		modifier = {
			factor = 2
			years_passed > 5
		}
		modifier = {
			factor = 2
			years_passed > 10
		}
		modifier = {
			factor = 2
			years_passed > 15
		}
		modifier = {
			factor = 2
			years_passed > 20
		}
		modifier = {
			factor = 1.5
			is_specialist_subject_type = { TYPE = scholarium }
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
	}

	ai_weight = {
		factor = @ai_society_tech_speed_factor
		factor = @zone_clear_ai_tech_factor
	}
}

tech_society_2 = {
	area = society
	category = { biology }
	tier = 2
	cost = @tier2cost3
	prerequisites = { "tech_society_1" }
	weight = @tier2weight3

	potential = {
		is_wilderness_empire = no
	}

	weight_modifier = {
		modifier = {
			factor = 0
			NOR = {
				has_technology = tech_mine_exotic_gases
				has_technology = tech_exotic_gases
				has_country_flag = has_market_access
			}
		}
		modifier = {
			factor = 2
			years_passed > 5
		}
		modifier = {
			factor = 2
			years_passed > 10
		}
		modifier = {
			factor = 2
			years_passed > 15
		}
		modifier = {
			factor = 2
			years_passed > 20
		}
		modifier = {
			factor = 1.5
			is_specialist_subject_type = { TYPE = scholarium }
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
	}

	ai_weight = {
		factor = @ai_society_tech_speed_factor
		factor = @zone_clear_ai_tech_factor
	}
}

tech_society_3 = {
	area = society
	category = { biology }
	tier = 3
	cost = @tier3cost3
	prerequisites = { "tech_society_2" }
	weight = @tier3weight3

	potential = {
		is_wilderness_empire = no
	}

	weight_modifier = {
		modifier = {
			factor = 0
			NOR = {
				has_technology = tech_mine_exotic_gases
				has_technology = tech_exotic_gases
				has_country_flag = has_market_access
			}
		}
		modifier = {
			factor = 2
			years_passed > 25
		}
		modifier = {
			factor = 2
			years_passed > 30
		}
		modifier = {
			factor = 2
			years_passed > 35
		}
		modifier = {
			factor = 2
			years_passed > 40
		}
		modifier = {
			factor = 1.5
			is_specialist_subject_type = { TYPE = scholarium }
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
	}

	ai_weight = {
		factor = @ai_society_tech_speed_factor
	}
}
#
## Origins of Sapience
#tech_society_4 = {
#	cost = {
#		factor = @tier4breakthrough
#	}
#	area = society
#	tier = 5
#	category = { biology }
#	prerequisites = { "tech_society_3" }
#	is_breakthrough = yes
#	weight = @tier4weightbreakthrough
#
#	modifier = {
#		custom_tooltip = breakthrough_society_unlock_tooltip
#	}
#
#	weight_modifier = {
#		modifier = {
#			factor = 2
#			years_passed > 25
#		}
#		modifier = {
#			factor = 2
#			years_passed > 30
#		}
#		modifier = {
#			factor = 2
#			years_passed > 35
#		}
#		modifier = {
#			factor = 2
#			years_passed > 40
#		}
#		modifier = {
#			factor = 1.5
#			is_specialist_subject_type = { TYPE = scholarium }
#		}
#		modifier = {
#			factor = 2
#			has_relic = r_pox_sample
#		}
#	}
#
#	ai_weight = {
#		factor = @ai_society_tech_speed_factor
#	}
#}

#Xenology
tech_alien_life_studies = {
	cost = @tier1cost2
	area = society
	tier = 1
	category = { biology }
	weight = @tier1weight2

	potential = {
		is_regular_empire = yes
	}

	weight_modifier = {
		modifier = {
			factor = 2
			OR = {
				has_ethic = ethic_xenophile
				AND = {
					has_ethic = ethic_xenophobe
					NOT = { has_ai_personality = xenophobic_isolationists }
				}
			}

		}
		modifier = {
			factor = 3
			OR = {
				has_ethic = ethic_fanatic_xenophile
				AND = {
					has_ethic = ethic_fanatic_xenophobe
					NOT = { has_ai_personality = xenophobic_isolationists }
				}
			}
		}
		modifier = {
			factor = 0
			NOR = {
				any_owned_planet = {
					OR = {
						has_deposit = d_alien_pets_deposit
						has_deposit = d_avian_reserve
						any_owned_pop_group = {
							OR = {
								is_sapient = no
								is_livestock = yes
								has_disconnected_drone_citizenship_type = yes
							}
						}
					}
				}
			}
		}
		modifier = {
			factor = 0
			is_guided_sapience_empire = yes
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
	}

	ai_weight = {
		factor = @society_research_ai_factor
		modifier = {
			factor = 1.25
			OR = {
				has_ethic = ethic_xenophile
				AND = {
					has_ethic = ethic_xenophobe
					NOT = { has_ai_personality = xenophobic_isolationists }
				}
			}
		}
		modifier = {
			factor = 1.5
			OR = {
				has_ethic = ethic_fanatic_xenophile
				AND = {
					has_ethic = ethic_fanatic_xenophobe
					NOT = { has_ai_personality = xenophobic_isolationists }
				}
			}
		}
		modifier = {
			factor = 0
			NOT = { has_country_flag = first_alien_life }
		}
	}
}

#New Worlds Protocol
tech_colonization_1 = {
	cost = 0
	area = society
	tier = 0
	category = { new_worlds }
	prerequisites = { "tech_space_exploration" }
	start_tech = yes

	prereqfor_desc = {
		ship = {
			title = "TECH_UNLOCK_COLONY_SHIP_CONSTRUCTION_TITLE"
			desc = "TECH_UNLOCK_COLONY_SHIP_CONSTRUCTION_DESC"
		}
	}

	weight_modifier = {
		factor = 1000
	}

	technology_swap = {
		name = tech_colonization_1_wilderness
		inherit_icon = yes
		inherit_effects = no
		trigger = {
			is_wilderness_empire = yes
		}
	}

	potential = {
		is_nomadic = no
	}

	starting_potential = {
		is_nomadic = no
	}

	ai_weight = { }
}

#Atmospheric Filtering
tech_colonization_2 = {
	cost = @tier1cost3
	area = society
	tier = 2
	category = { new_worlds }
	prerequisites = { "tech_colonization_1" }
	weight = @tier1weight3

	modifier = {
		pop_environment_tolerance = 0.05
	}

	weight_modifier = {

	}

	ai_weight = {

	}
}

#Hostile Environment Adaptation
tech_colonization_3 = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { new_worlds }
	prerequisites = { "tech_colonization_2" }
	weight = @tier2weight3

	modifier = {
		pop_environment_tolerance = 0.05
	}

	weight_modifier = {

	}

	ai_weight = {

	}
}

#Foreign Soil Enrichment
tech_colonization_4 = {
	cost = @tier3cost3
	area = society
	tier = 3
	category = { new_worlds }
	prerequisites = { "tech_colonization_3" }
	weight = @tier3weight3

	modifier = {
		pop_environment_tolerance = 0.05
	}

	weight_modifier = {

	}

	ai_weight = {

	}
}

#Eco-Integration Studies
tech_colonization_5 = {
	cost = @tier4cost3
	area = society
	tier = 4
	category = { new_worlds }
	prerequisites = { "tech_colonization_4" }
	weight = @tier4weight3

	modifier = {
		pop_environment_tolerance = 0.05
	}

	weight_modifier = {

	}

	ai_weight = {

	}
}

#Tomb World Adaptation
tech_tomb_world_adaption = {
	cost = @tier3cost1
	area = society
	tier = 3
	category = { new_worlds }
	prerequisites = { "tech_colonization_3" }
	weight = @tier3weight1
	is_rare = yes

	potential = {
		is_wilderness_empire = no
	}

	modifier = {
		pc_nuked_habitability = 0.2
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 0.20
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_new_worlds }
				has_trait_in_council = { TRAIT = leader_trait_curator }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_tomb_world_adaption
		}
		modifier = {
			factor = 2
			any_owned_planet = {
				is_planet_class = pc_nuked
			}
		}
	}

	ai_weight = {

	}
}

# Medical Care
tech_basic_health = {
	cost = 0
	area = society
	start_tech = yes
	tier = 0
	category = { biology }

	potential = {
		is_regular_empire = yes
		is_individual_machine = no
	}
}

#Frontier Health
tech_frontier_health = {
	cost = @tier1cost2
	area = society
	tier = 1
	category = { biology }
	prerequisites = { "tech_basic_health" "tech_genome_mapping" }
	weight = @tier1weight2

	potential = {
		is_regular_empire = yes
		is_individual_machine = no
	}

	weight_modifier = {
		factor = 2
		modifier = {
			factor = 1.25
			has_tradition = tr_harmony_adopt
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
		modifier = {
			factor = 2
			has_country_flag = payback_researching_gene_clinics
		}
	}
}

#Frontier Hospital
tech_frontier_hospital = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { biology }
	prerequisites = { "tech_frontier_health" "tech_colonial_centralization" }
	weight = @tier2weight3

	potential = {
		is_gestalt = no
		is_individual_machine = no
	}

	weight_modifier = {
		modifier = {
			factor = 0
			NOR = {
				has_technology = tech_mine_exotic_gases
				has_technology = tech_exotic_gases
				has_country_flag = has_market_access
			}
		}
		modifier = {
			factor = 1.25
			has_tradition = tr_harmony_adopt
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
	}
}

tech_mountain_range = {
	cost = @tier2cost2
	area = society
	tier = 2
	category = { new_worlds }
	prerequisites = { "tech_colonization_1" }
	weight = @tier2weight2

	potential = {
		is_nomadic = no
	}

	weight_groups = {
		deposit_blockers
	}
	mod_weight_if_group_picked = {
		deposit_blockers = 0.5
	}

	weight_modifier = {
		modifier = {
			factor = 2
		}
		modifier = {
			factor = 1.25
			has_tradition = tr_expansion_adopt
		}
		modifier = {
			factor = 4
			has_ascension_perk = ap_mastery_of_nature
		}
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = "d_mountain_range"
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}

	ai_weight = {
		modifier = {
			factor = 3
		}
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = "d_mountain_range"
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}
}

tech_volcano = {
	cost = @tier2cost2
	area = society
	tier = 2
	category = { new_worlds }
	prerequisites = { "tech_colonization_1" }
	weight = @tier2weight2

	potential = {
		is_nomadic = no
	}

	weight_groups = {
		deposit_blockers
	}
	mod_weight_if_group_picked = {
		deposit_blockers = 0.5
	}

	weight_modifier = {
		modifier = {
			factor = 2
		}
		modifier = {
			factor = 1.25
			has_tradition = tr_expansion_adopt
		}
		modifier = {
			factor = 4
			has_ascension_perk = ap_mastery_of_nature
		}
		modifier = {
			factor = 0 # if we have no Volcanic worlds and no volcanic blockers, this tech option doesn't appear
			NOT = {
				any_owned_planet = {
					has_deposit = "d_active_volcano"
				}
				any_system_within_border = {
					any_system_planet = {
						is_planet_class = pc_volcanic
					}
				}
			}
		}
		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}

	prereqfor_desc = {
		diplo_action = {
			title = "TECH_UNLOCK_VOLCANO_TERRAFORM_TITLE"
			desc = "TECH_UNLOCK_VOLCANO_TERRAFORM_DESC"
		}
	}

	ai_weight = {
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = "d_active_volcano"
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}
}

tech_dangerous_wildlife = {
	cost = @tier2cost2
	area = society
	tier = 2
	category = { new_worlds }
	prerequisites = { "tech_colonization_1" }
	weight = @tier2weight2

	potential = {
		is_nomadic = no
	}

	weight_groups = {
		deposit_blockers
	}

	mod_weight_if_group_picked = {
		deposit_blockers = 0.5
	}

	weight_modifier = {
		modifier = {
			factor = 2
		}
		modifier = {
			factor = 1.25
			has_tradition = tr_expansion_adopt
		}
		modifier = {
			factor = 4
			has_ascension_perk = ap_mastery_of_nature
		}
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = d_dangerous_wildlife_blocker
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}

	ai_weight = {
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = d_dangerous_wildlife_blocker
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}
}

tech_dense_jungle = {
	cost = @tier1cost2
	area = society
	tier = 1
	category = { new_worlds }
	prerequisites = { "tech_colonization_1" }
	weight = @tier1weight2

	potential = {
		is_nomadic = no
	}

	weight_groups = {
		deposit_blockers
	}
	mod_weight_if_group_picked = {
		deposit_blockers = 0.5
	}

	weight_modifier = {
		modifier = {
			factor = 2
		}
		modifier = {
			factor = 1.25
			has_tradition = tr_expansion_adopt
		}
		modifier = {
			factor = 4
			has_ascension_perk = ap_mastery_of_nature
		}
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = "d_dense_jungle"
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}

	ai_weight = {
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = "d_dense_jungle"
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}
}

tech_quicksand_basin = {
	cost = @tier1cost2
	area = society
	tier = 1
	category = { new_worlds }
	prerequisites = { "tech_colonization_1" }
	weight = @tier1weight2

	potential = {
		is_nomadic = no
	}

	weight_groups = {
		deposit_blockers
	}
	mod_weight_if_group_picked = {
		deposit_blockers = 0.5
	}

	weight_modifier = {
		modifier = {
			factor = 2
		}
		modifier = {
			factor = 1.25
			has_tradition = tr_expansion_adopt
		}
		modifier = {
			factor = 4
			has_ascension_perk = ap_mastery_of_nature
		}
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = "d_quicksand_basin"
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}

	ai_weight = {
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = "d_quicksand_basin"
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}
}

tech_noxious_swamp = {
	cost = @tier1cost2
	area = society
	tier = 1
	category = { new_worlds }
	prerequisites = { "tech_colonization_1" }
	weight = @tier1weight2

	potential = {
		is_nomadic = no
	}

	weight_groups = {
		deposit_blockers
	}
	mod_weight_if_group_picked = {
		deposit_blockers = 0.5
	}

	weight_modifier = {
		modifier = {
			factor = 2
		}
		modifier = {
			factor = 1.25
			has_tradition = tr_expansion_adopt
		}
		modifier = {
			factor = 4
			has_ascension_perk = ap_mastery_of_nature
		}
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = "d_noxious_swamp"
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}

	ai_weight = {
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = "d_noxious_swamp"
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}
}

tech_massive_glacier = {
	cost = @tier1cost2
	area = society
	tier = 1
	category = { new_worlds }
	prerequisites = { "tech_colonization_1" }
	weight = @tier1weight2

	potential = {
		is_nomadic = no
	}

	weight_groups = {
		deposit_blockers
	}
	mod_weight_if_group_picked = {
		deposit_blockers = 0.5
	}

	weight_modifier = {
		modifier = {
			factor = 2
		}
		modifier = {
			factor = 1.25
			has_tradition = tr_expansion_adopt
		}
		modifier = {
			factor = 4
			has_ascension_perk = ap_mastery_of_nature
		}
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = "d_massive_glacier"
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}

	ai_weight = {
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = "d_massive_glacier"
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}
}

tech_toxic_kelp = {
	cost = @tier1cost2
	area = society
	tier = 1
	category = { new_worlds }
	prerequisites = { "tech_colonization_1" }
	weight = @tier1weight2

	potential = {
		is_nomadic = no
	}

	weight_groups = {
		deposit_blockers
	}
	mod_weight_if_group_picked = {
		deposit_blockers = 0.5
	}

	weight_modifier = {
		modifier = {
			factor = 2
		}
		modifier = {
			factor = 1.25
			has_tradition = tr_expansion_adopt
		}
		modifier = {
			factor = 4
			has_ascension_perk = ap_mastery_of_nature
		}
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = "d_toxic_kelp"
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}

	ai_weight = {
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = "d_toxic_kelp"
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}
}

tech_deep_sinkhole = {
	cost = @tier1cost2
	area = society
	tier = 1
	category = { new_worlds }
	prerequisites = { "tech_colonization_1" }
	weight = @tier1weight2

	potential = {
		is_nomadic = no
	}

	weight_groups = {
		deposit_blockers
	}
	mod_weight_if_group_picked = {
		deposit_blockers = 0.5
	}

	weight_modifier = {
		modifier = {
			factor = 2
		}
		modifier = {
			factor = 1.25
			has_tradition = tr_expansion_adopt
		}
		modifier = {
			factor = 4
			has_ascension_perk = ap_mastery_of_nature
		}
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = "d_deep_sinkhole"
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}

	ai_weight = {
		modifier = {
			factor = 0
			NOT = {
				any_owned_planet = {
					has_deposit = "d_deep_sinkhole"
				}
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}
}

# ##################
# Terraformation
# ##################

tech_terrestrial_sculpting = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { new_worlds }
	prerequisites = {
		OR = {
			tech_colonization_1
			tech_planetary_engineering
		}
	}
	weight = @tier2weight3

	potential = {
		is_nomadic = no
	}

	feature_flags = {
		build_terraform_station
	}

	weight_modifier = {
		factor = 1.5	# terraforming needs to be a bit more common
		modifier = {
			factor = 0
			is_lithoid_devouring_swarm = yes
		}

		modifier = {
			factor = 1.25
			has_tradition = tr_expansion_adopt
		}
		modifier = { #if you're a fish, you're definitely gonna prioritise finding out how to make more oceans
			factor = 1.25
			has_aquatic_trait = yes
		}
		modifier = {
			factor = 1.25
			has_origin = origin_life_seeded
		}
		modifier = {
			add = 5
			has_origin = origin_wilderness
		}
	}

	technology_swap = {
		name = tech_terrestrial_sculpting_wilderness
		inherit_icon = yes
		inherit_effects = no
		trigger = {
			is_wilderness_empire = yes
		}
		modifier = {
			custom_tooltip = tech_terrestrial_sculpting_wilderness_effect
		}
	}

	ai_weight = {
		factor = @terraforming_tech_ai_factor

		modifier = {
			factor = 2
			OR = {
				is_xenophobe = yes
				is_hive_empire = yes
			}
		}
		modifier = {
			factor = 0
			OR = {
				has_origin = origin_shattered_ring
				has_void_dweller_origin = yes
			}
			is_ai = yes
		}
		modifier = {
			factor = 5
			any_system_within_border = {
				any_system_planet = {
					is_colonizable = yes
					habitability = {
						who = root
						value < 0.5
					}
				}
			}
		}
		modifier = { #Hydrocentric is really good and needs this
			factor = 1000
			has_aquatic_trait = yes
		}
		modifier = {
			factor = 100
			has_origin = origin_life_seeded
		}
		modifier = {
			factor = 2
			is_ai = no #auto-research
		}
	}
}

#Ecological Adaptation
tech_ecological_adaptation = {
	cost = @tier3cost2
	area = society
	tier = 3
	category = { new_worlds }
	prerequisites = { "tech_terrestrial_sculpting" }
	weight = @tier3weight2

	feature_flags = {
		terraform_inhabited
	}

	weight_modifier = {
		modifier = {
			factor = 1.25
			has_tradition = tr_expansion_adopt
		}

	}

	ai_weight = {
		factor = @terraforming_tech_ai_factor

		modifier = {
			factor = 2
			OR = {
				is_xenophobe = yes
				is_hive_empire = yes
			}
		}
		modifier = {
			factor = 5
			OR = {
				any_owned_planet = {
					habitability = {
						who = root
						value < 0.5
					}
				}
				any_system_within_border = {
					any_system_planet = {
						is_planet_class = pc_nuked
					}
				}
			}
		}
		modifier = {
			factor = 5
			has_origin = origin_life_seeded
		}
		modifier = {
			factor = 2
			is_ai = no #auto-research
		}
	}
}

#Climate Transformation
tech_climate_restoration = {
	cost = @tier4cost1
	area = society
	tier = 4
	category = { new_worlds }
	prerequisites = { "tech_terrestrial_sculpting" }
	weight = @tier4weight1

	# unlocks additional terraforming-options

	prereqfor_desc = {
		diplo_action = {
			title = "TECH_UNLOCK_TERRAFORMING_NUKED_CHANGE_TITLE"
			desc = "TECH_UNLOCK_TERRAFORMING_NUKED_CHANGE_DESC"
		}
	}

	weight_modifier = {
		modifier = {
			factor = 1.25
			has_tradition = tr_expansion_adopt
		}

	}

	ai_weight = {
		factor = @terraforming_tech_ai_factor

		modifier = {
			factor = 2
			OR = {
				is_xenophobe = yes
				is_hive_empire = yes
			}
		}

		modifier = {
			factor = 5
			has_origin = origin_life_seeded
		}
		modifier = {
			factor = 5
			any_system_within_border = {
				any_system_planet = {
					is_planet_class = pc_nuked
				}
			}
		}
	}
}

# Creating Volcanic Worlds
tech_volcanic_forge = {
	cost = @tier2cost2
	area = society
	tier = 2
	category = { new_worlds }
	is_rare = yes
	weight = @tier2weight1
	potential = {
		is_world_forger_empire = yes
	}
	weight_modifier = {
		modifier = {
			factor = 1.25
			has_tradition = tr_expansion_adopt
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_volcanic_forge
		}
	}
	ai_weight = {
		factor = @terraforming_tech_ai_factor
		modifier = {
			factor = 5
			is_infernal_empire = yes
		}
	}
}

#Volcanic Terraforming
tech_volcanic_terraforming = {
	cost = @tier2cost2
	area = society
	tier = 2
	is_rare = yes
	category = { new_worlds }
	prerequisites = { # the base Terraforming tech + Clear Volcano Blockers
		"tech_terrestrial_sculpting"
		"tech_volcano"
	}
	potential = {
		has_infernals = yes
	}
	prereqfor_desc = {
		diplo_action = {
			title = "TECH_UNLOCK_VOLCANIC_TERRAFORM_TITLE"
			desc = "TECH_UNLOCK_VOLCANIC_TERRAFORM_DESC"
		}
	}
	weight = @tier2weight3

	weight_modifier = { # We want this to be very rare.
		modifier = {
			factor = 0.5
			always = yes
		}
	}

	weight_modifier = {
		modifier = {
			factor = 1.25
			has_tradition = tr_expansion_adopt
		}
	}
	weight_modifier = {
		modifier = {
			factor = 3 # We want this to be common if you have Volcanic planets
			any_system_within_border = {
				any_system_planet = {
					is_planet_class = pc_volcanic
				}
			}
		}
	}

	ai_weight = {
		factor = @terraforming_tech_ai_factor

		modifier = {
			factor = 5
			OR = {
				any_owned_planet = {
					habitability = {
						who = root
						value < 0.5
					}
				}
				any_system_within_border = {
					any_system_planet = {
						is_planet_class = pc_volcanic
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			is_infernal_empire = yes
		}
		modifier = {
			factor = 2
			is_ai = no #auto-research
		}
	}
}

# ##################
# Genetics
# ##################

#Genome Mapping
tech_genome_mapping = {
	cost = @tier1cost1
	area = society
	tier = 1
	category = { biology }
	weight = @tier1weight1

	gateway = biological

	modifier = {
		logistic_growth_mult = 0.1
	}

	potential = {
		OR = {
			is_machine_empire = no
			has_civic = civic_machine_assimilator
			has_civic = civic_machine_servitor
			has_civic = civic_machine_guided_sapience
		}
	}

	weight_modifier = {
		factor = 1.5	# genetech needs to be a bit more common
		modifier = {
			factor = 1.25
			is_hive_empire = yes
		}
		modifier = {
			factor = 1.25
			has_tradition = tr_supremacy_adopt
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
		modifier = {
			factor = 0.5
			is_individual_machine = yes
		}
		modifier = {
			factor = 0.5
			has_origin = origin_synthetic_fertility
		}
		modifier = {
			factor = 2
			AND = {
				OR = {
					is_individual_machine = yes
					has_origin = origin_synthetic_fertility
				}
				any_owned_species = {
					is_organic_species = yes
				}
			}
		}
	}

	technology_swap = {
		name = tech_genome_mapping_wilderness
		inherit_icon = yes
		inherit_effects = yes
		trigger = {
			is_wilderness_empire = yes
		}
	}

	ai_weight = {
		factor = @pop_growth_tech_ai_factor
	}
}

#Vitality Boosters
tech_vitality_boosters = {
	cost = @tier2cost2
	area = society
	tier = 2
	category = { biology }
	prerequisites = { "tech_genome_mapping" }
	weight = @tier2weight2

	modifier = {
		leader_lifespan_add = 10
	}

	potential = {
		OR = {
			is_machine_empire = no
			has_civic = civic_machine_assimilator
		}
	}

	weight_modifier = {
		factor = 1.5	# genetech needs to be a bit more common
		modifier = {
			factor = 1.25
			is_hive_empire = yes
		}
		modifier = {
			factor = 1.25
			has_tradition = tr_supremacy_adopt
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
		modifier = {
			factor = 0.5
			is_individual_machine = yes
		}
		modifier = {
			factor = 0.5
			has_origin = origin_synthetic_fertility
		}
		modifier = {
			factor = 2
			AND = {
				is_individual_machine = yes
				any_owned_species = {
					is_organic_species = yes
				}
			}
		}
	}

	ai_weight = {
	}
}

#Epigenetic Triggers
tech_epigenetic_triggers = {
	cost = @tier2cost2
	area = society
	tier = 2
	category = { biology }
	prerequisites = { "tech_genome_mapping" }
	weight = @tier2weight2

	feature_flags = {
		uplifting
	}

	potential = {
		NOR = {
			has_valid_civic = civic_fanatic_purifiers
			is_natural_design_empire = yes
			is_wilderness_empire = yes
		}
		OR = {
			is_machine_empire = no
			has_civic = civic_machine_assimilator
			has_civic = civic_machine_servitor
			has_civic = civic_machine_guided_sapience
		}
	}

	prereqfor_desc = {
		custom = {
			title = "TECH_UNLOCK_EPIGENETICS_TITLE"
			desc = "TECH_UNLOCK_EPIGENETICS_DESC"
		}
	}

	weight_modifier = {
		modifier = {
			factor = 0.5
			has_ethic = ethic_fanatic_xenophobe
		}
		modifier = {
			factor = 0.75
			has_ethic = ethic_xenophobe
		}
		modifier = {
			factor = 1.25
			has_ethic = ethic_xenophile
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_fanatic_xenophile
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
		modifier = {
			factor = 0.5
			is_individual_machine = yes
		}
		modifier = {
			factor = 0.5
			has_origin = origin_synthetic_fertility
		}
		modifier = {
			factor = 2
			AND = {
				is_individual_machine = yes
				any_owned_species = {
					is_organic_species = yes
				}
			}
		}
		modifier = {
			factor = 5
			is_guided_sapience_empire = yes
		}
		modifier = {
			factor = 0
			NOR = {
				has_country_flag = found_presapients
				any_planet_within_border = {
					any_owned_pop_group = {
						is_sapient = no
						NOT = { has_trait = trait_nascent_stage }
					}
				}
			}
		}
	}

	ai_weight = {
		modifier = {
			factor = 0.5
			has_ethic = ethic_fanatic_xenophobe
		}
		modifier = {
			factor = 0.75
			has_ethic = ethic_xenophobe
		}
		modifier = {
			factor = 1.25
			has_ethic = ethic_xenophile
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_fanatic_xenophile
		}
	}
}

#Cloning
tech_cloning = {
	cost = @tier2cost2
	area = society
	tier = 2
	category = { biology }
	prerequisites = { "tech_genome_mapping" }
	weight = @tier2weight2

	potential = {
		OR = {
			is_machine_empire = no
			has_civic = civic_machine_assimilator
		}
		is_wilderness_empire = no
		is_natural_design_empire = no
	}

	weight_modifier = {
		factor = 1.5	# genetech needs to be a bit more common
		modifier = {
			factor = 1.25
			is_hive_empire = yes
		}
		modifier = {
			factor = 1.25
			has_tradition = tr_supremacy_adopt
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
		modifier = {
			factor = 0.5
			is_individual_machine = yes
		}
		modifier = {
			factor = 0.5
			has_origin = origin_synthetic_fertility
		}
		modifier = {
			factor = 2
			AND = {
				is_individual_machine = yes
				any_owned_species = {
					is_organic_species = yes
				}
			}
		}
	}

	ai_weight = {
		factor = @pop_growth_tech_ai_factor
	}
}

#Gene Banks
tech_gene_banks = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { biology }
	is_rare = yes
	prerequisites = { "tech_cloning" }
	weight = @tier2weight3

	potential = {
		OR = {
			is_machine_empire = no
			is_wilderness_empire = no
			has_civic = civic_machine_assimilator
		}
		is_natural_design_empire = no
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 1.25
			is_hive_empire = yes
		}
		modifier = {
			factor = 0.5
			is_individual_machine = yes
		}
		modifier = {
			factor = 2
			AND = {
				is_individual_machine = yes
				any_owned_species = {
					is_organic_species = yes
				}
			}
		}
		modifier = {
			factor = 0.20
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_biology }
				has_trait_in_council = { TRAIT = leader_trait_curator }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius_2 }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_gene_banks
		}
	}
}

tech_gene_seed_purification = {
	cost = @tier4cost1
	area = society
	category = { biology }
	tier = 4
	is_rare = yes
	prerequisites = { "tech_gene_tailoring" }
	weight = @tier4weight1

	# unlocks gene-warrior armies

	potential = {
		NOR = {
			is_machine_empire = yes
			is_natural_design_empire = yes
			is_individual_machine = yes
			is_wilderness_empire = yes
		}
	}

	weight_modifier = {
		modifier = {
			factor = 0
			NOT = {
				has_ascension_perk = ap_engineered_evolution
			}
		}
		modifier = {
			factor = 1.25
			is_hive_empire = yes
		}
		modifier = {
			factor = 1.25
			has_ethic = ethic_militarist
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_fanatic_militarist
		}
		modifier = {
			factor = 0.10
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_biology }
				has_trait_in_council = { TRAIT = leader_trait_curator }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_gene_seed_purification
		}
		modifier = {
			factor = 1.25
			OR = {
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius_2 }
			}
		}
		modifier = {
			factor = 0.5
			is_individual_machine = yes
		}
		modifier = {
			factor = 2
			AND = {
				is_individual_machine = yes
				any_owned_species = {
					is_organic_species = yes
				}
			}
		}
	}
}

tech_morphogenetic_field_mastery = {
	cost = @tier4cost1
	area = society
	category = { biology }
	tier = 4
	is_rare = yes
	prerequisites = { "tech_epigenetic_triggers" }
	weight = @tier4weight1

	# unlocks xeno-armies

	potential = {
		NOR = {
			is_machine_empire = yes
			is_natural_design_empire = yes
			is_individual_machine = yes
			is_wilderness_empire = yes
		}
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 0
			is_machine_empire = yes
		}
		modifier = {
			factor = 1.25
			is_hive_empire = yes
		}
		modifier = {
			factor = 1.25
			has_ethic = ethic_militarist
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_fanatic_militarist
		}
		modifier = {
			factor = 0.20
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_biology }
				has_trait_in_council = { TRAIT = leader_trait_curator }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_morphogenetic_field_mastery
		}
		modifier = {
			factor = 1.25
			OR = {
				has_trait_in_council = { TRAIT = leader_trait_maniacal }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_2 }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_3 }
			}
		}
		modifier = {
			factor = 1.25
			OR = {
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius_2 }
			}
		}
	}
}

#Gene Tailoring
@tech_gene_tailoring_POINTS = 2
tech_gene_tailoring = {
	cost = @tier3cost1
	area = society
	tier = 3
	category = { biology }
	prerequisites = { "tech_genome_mapping" }
	weight = @tier3weight1

	gateway = biological

	modifier = {
		description = tech_gene_tailoring_modifier_desc
		description_parameters = {
			POINTS = @tech_gene_tailoring_POINTS
		}
		BIOLOGICAL_species_trait_points_add = @tech_gene_tailoring_POINTS
	}

	feature_flags = {
		modify_traits
		pop_self_modification
	}

	technology_swap = {
		name = tech_gene_tailoring_overtuned
		inherit_icon = yes
		inherit_effects = no

		trigger = {
			has_origin = origin_overtuned
		}
	}

	potential = {
		OR = {
			is_machine_empire = no
			has_civic = civic_machine_assimilator
			has_civic = civic_machine_servitor
		}
		is_natural_design_empire = no
	}

	weight_modifier = {
		factor = 2.0	# genetech needs to be a bit more common
		modifier = {
			factor = 1.25
			is_hive_empire = yes
		}
		modifier = {
			factor = 1.25
			is_xenophile = yes
		}
		modifier = {
			factor = 1.25
			has_origin = origin_necrophage
			has_trait = trait_necrophage
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
		modifier = {
			factor = 0
			is_individual_machine = yes
			NOT = {
				any_owned_species = {
					is_organic_species = yes
				}
			}
		}
		modifier = {
			factor = @ap_pending_tech_boost
			has_ascension_perk = ap_engineered_evolution
		}
	}

	ai_weight = {
		modifier = {
			factor = 2
			has_origin = origin_necrophage
			has_trait = trait_necrophage
		}
		modifier = {
			factor = @ap_pending_tech_boost
			has_ascension_perk = ap_engineered_evolution
		}
	}
}

# Glandular Acclimation (planet preference modding)
tech_glandular_acclimation = {
	cost = @tier3cost3
	area = society
	tier = 3
	category = { biology }
	prerequisites = { "tech_gene_tailoring" }
	weight = @tier3weight3

	feature_flags = {
		habitability_gene_modding # No longer does anything except make a tooltip, handled in game rules ("can_gene_mod_habitability")
	}

	potential = {
		OR = {
			is_machine_empire = no
			has_civic = civic_machine_assimilator
			has_civic = civic_machine_servitor
		}
		is_natural_design_empire = no
	}

	weight_modifier = {
		factor = 1.5	# genetech needs to be a bit more common
		modifier = {
			factor = 1.25
			is_hive_empire = yes
		}
		modifier = {
			factor = 1.25
			has_origin = origin_necrophage
			has_trait = trait_necrophage
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
		modifier = {
			factor = 0.5
			is_individual_machine = yes
		}
		modifier = {
			factor = 2
			AND = {
				is_individual_machine = yes
				any_owned_species = {
					is_organic_species = yes
				}
			}
		}
	}

	ai_weight = {
		modifier = {
			factor = 2
			has_origin = origin_necrophage
			has_trait = trait_necrophage
		}
	}
}

# tech_lithoid_transgenesis = {
# 	cost = @tier5cost1
# 	area = society
# 	tier = 5
# 	is_rare = yes
# 	weight = @tier5weight1
# 	category = { biology }

# 	gateway = biological

# 	prereqfor_desc = {
# 		custom = {
# 			title = "TECH_UNLOCK_LITHOID_GENETICS_TITLE"
# 			desc = "TECH_UNLOCK_LITHOID_GENETICS_DESC"
# 		}
# 	}

# 	weight_modifier = {
# 		factor = 2
# 		modifier = {
# 			factor = 0
# 			has_lithoids = no
# 		}
# 		modifier = {
# 			factor = 0
# 			has_biogenesis_dlc = yes
# 		}
# 		modifier = {
# 			factor = 0
# 			NOT = {
# 				has_active_tradition = tr_genetics_finish_extra_traits
# 			}
# 		}
# 		modifier = {
# 			factor = 0
# 			NOT = {
# 				any_owned_species = {
# 					is_species_class = LITHOID
# 				}
# 			}
# 		}
# 		modifier = {
# 			factor = 0.5
# 			has_ethic = ethic_fanatic_xenophobe
# 		}
# 		modifier = {
# 			factor = 0.75
# 			has_ethic = ethic_xenophobe
# 		}
# 		modifier = {
# 			factor = 1.25
# 			has_ethic = ethic_xenophile
# 		}
# 		modifier = {
# 			factor = 1.5
# 			has_ethic = ethic_fanatic_xenophile
# 		}
# 		inline_script = {
# 			script = technologies/rare_technologies_weight_modifiers
# 			TECHNOLOGY = tech_lithoid_transgenesis
# 		}
# 	}

# 	ai_weight = {
# 		modifier = {
# 			factor = 0.5
# 			has_ethic = ethic_fanatic_xenophobe
# 		}
# 		modifier = {
# 			factor = 0.75
# 			has_ethic = ethic_xenophobe
# 		}
# 		modifier = {
# 			factor = 1.25
# 			has_ethic = ethic_xenophile
# 		}
# 		modifier = {
# 			factor = 1.5
# 			has_ethic = ethic_fanatic_xenophile
# 		}
# 	}
# }

# tech_plantoid_transgenesis = {
# 	cost = @tier5cost1
# 	area = society
# 	tier = 5
# 	is_rare = yes
# 	weight = @tier5weight1
# 	category = { biology }

# 	gateway = biological

# 	prereqfor_desc = {
# 		custom = {
# 			title = "TECH_UNLOCK_PLANTOID_GENETICS_TITLE"
# 			desc = "TECH_UNLOCK_PLANTOID_GENETICS_DESC"
# 		}
# 	}

# 	weight_modifier = {
# 		factor = 2
# 		modifier = {
# 			factor = 0
# 			has_plantoids = no
# 		}
# 		modifier = {
# 			factor = 0
# 			has_biogenesis_dlc = yes
# 		}
# 		modifier = {
# 			factor = 0
# 			NOT = {
# 				has_active_tradition = tr_genetics_finish_extra_traits
# 			}
# 		}
# 		modifier = {
# 			factor = 0
# 			NOT = {
# 				any_owned_species = {
# 					OR = {
# 						is_species_class = PLANT
# 						is_species_class = FUN
# 					}
# 				}
# 			}
# 		}
# 		modifier = {
# 			factor = 0.5
# 			has_ethic = ethic_fanatic_xenophobe
# 		}
# 		modifier = {
# 			factor = 0.75
# 			has_ethic = ethic_xenophobe
# 		}
# 		modifier = {
# 			factor = 1.25
# 			has_ethic = ethic_xenophile
# 		}
# 		modifier = {
# 			factor = 1.5
# 			has_ethic = ethic_fanatic_xenophile
# 		}
# 		inline_script = {
# 			script = technologies/rare_technologies_weight_modifiers
# 			TECHNOLOGY = tech_plantoid_transgenesis
# 		}
# 	}

# 	ai_weight = {
# 		modifier = {
# 			factor = 0.5
# 			has_ethic = ethic_fanatic_xenophobe
# 		}
# 		modifier = {
# 			factor = 0.75
# 			has_ethic = ethic_xenophobe
# 		}
# 		modifier = {
# 			factor = 1.25
# 			has_ethic = ethic_xenophile
# 		}
# 		modifier = {
# 			factor = 1.5
# 			has_ethic = ethic_fanatic_xenophile
# 		}
# 	}
# }

# tech_leviathan_transgenesis = {
# 	cost = @tier5cost1
# 	area = society
# 	tier = 5
# 	is_rare = yes
# 	weight = @tier5weight1
# 	category = { biology }

# 	gateway = biological

# 	prereqfor_desc = {
# 		custom = {
# 			title = "TECH_UNLOCK_LEVIATHAN_GENETICS_TITLE"
# 			desc = "TECH_UNLOCK_LEVIATHAN_GENETICS_DESC"
# 		}
# 	}

# 	weight_modifier = {
# 		factor = 2
# 		modifier = {
# 			factor = 0
# 			has_space_monster_dlc = no
# 		}
# 		modifier = {
# 			factor = 0
# 			has_biogenesis_dlc = yes
# 		}
# 		modifier = {
# 			factor = 0
# 			NOT = {
# 				has_active_tradition = tr_genetics_finish_extra_traits
# 			}
# 		}
# 		modifier = {
# 			factor = 0
# 			harvested_leviathan_dna = no
# 		}
# 		modifier = {
# 			factor = 0.5
# 			has_ethic = ethic_fanatic_xenophobe
# 		}
# 		modifier = {
# 			factor = 0.75
# 			has_ethic = ethic_xenophobe
# 		}
# 		modifier = {
# 			factor = 1.25
# 			has_ethic = ethic_xenophile
# 		}
# 		modifier = {
# 			factor = 1.5
# 			has_ethic = ethic_fanatic_xenophile
# 		}
# 		inline_script = {
# 			script = technologies/rare_technologies_weight_modifiers
# 			TECHNOLOGY = tech_leviathan_transgenesis
# 		}
# 	}

# 	ai_weight = {
# 		modifier = {
# 			factor = 0.5
# 			has_ethic = ethic_fanatic_xenophobe
# 		}
# 		modifier = {
# 			factor = 0.75
# 			has_ethic = ethic_xenophobe
# 		}
# 		modifier = {
# 			factor = 1.25
# 			has_ethic = ethic_xenophile
# 		}
# 		modifier = {
# 			factor = 1.5
# 			has_ethic = ethic_fanatic_xenophile
# 		}
# 	}
# }

#Targeted Gene Expressions
@tech_gene_expressions_POINTS = 1
tech_gene_expressions = {
	cost = @tier3cost3
	area = society
	category = { biology }
	tier = 3
	is_rare = yes
	prerequisites = { "tech_gene_tailoring" }
	weight = @tier3weight3

	prereqfor_desc = {
		custom = {
			title = "TECH_UNLOCK_GENE_EXPRESSIONS_TITLE"
			desc = "TECH_UNLOCK_GENE_EXPRESSIONS_DESC"
		}
	}

	prereqfor_desc = {
		custom = {
			title = "TECH_UNLOCK_VOCATIONAL_GENES_TITLE"
			desc = "TECH_UNLOCK_VOCATIONAL_GENES_DESC"
		}
	}

	potential = {
		OR = {
			NOR = {
				is_machine_empire = yes
				is_individual_machine = yes
			}
			has_civic = civic_machine_assimilator
			has_civic = civic_machine_servitor
		}
		NOR = {
			has_valid_civic = civic_natural_design
			has_valid_civic = civic_hive_natural_design
		}
	}

	weight_modifier = {
		modifier = {
			factor = 1.25
			is_hive_empire = yes
		}
		modifier = {
			factor = 0.50
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_biology }
				has_trait_in_council = { TRAIT = leader_trait_curator }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius_2 }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_gene_expressions
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
	}

	ai_weight = {
	}
}

#Selected Lineages
tech_selected_lineages = {
	cost = @tier3cost2
	area = society
	category = { biology }
	tier = 3
	is_rare = yes
	prerequisites = { "tech_vitality_boosters" }
	weight = @tier3weight2

	# Modifiers from this tech is added through a policy-option

	potential = {
		is_machine_empire = no
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 0.50
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_biology }
				has_trait_in_council = { TRAIT = leader_trait_curator }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius_2 }
			}
		}
		modifier = {
			factor = 0
			has_ethic = "ethic_fanatic_egalitarian"
		}
		modifier = {
			factor = 0.25
			is_egalitarian = yes
		}
		modifier = {
			factor = 2
			is_authoritarian = yes
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_selected_lineages
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
		modifier = {
			factor = 0.5
			is_individual_machine = yes
			any_owned_species = {
				is_organic_species = no
			}
		}
	}

	ai_weight = {
		modifier = {
			factor = 0
			is_fanatic_egalitarian = yes
		}
	}
}

#Capacity Boosters
tech_capacity_boosters = {
	cost = @tier4cost3
	area = society
	category = { biology }
	tier = 4
	is_rare = yes
	prerequisites = { "tech_selected_lineages" }
	weight = @tier4weight3

	# Modifiers from this tech is added through a policy-option

	potential = {
		is_machine_empire = no
		is_natural_design_empire = no
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 0.20
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_biology }
				has_trait_in_council = { TRAIT = leader_trait_curator }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius }
				has_trait_in_council = { TRAIT = leader_trait_spark_of_genius_2 }
			}
		}
		modifier = {
			factor = 0
			is_egalitarian = yes
		}
		modifier = {
			factor = 2
			is_authoritarian = yes
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_capacity_boosters
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
		modifier = {
			factor = 0.5
			is_individual_machine = yes
			any_owned_species = {
				is_organic_species = no
			}
		}
	}

	ai_weight = {
	}
}

#Regenerative Hull Tissue
tech_regenerative_hull_tissue = {
	area = society
	cost = @tier3cost2
	tier = 3
	is_rare = yes
	category = { biology }
	weight = @tier3weight2

	weight_modifier = {
		factor = 0		# Can only be reverse engineered
	}
}

# ##################
# Fleet Organization
# ##################

#Doctrine: Space Combat
tech_doctrine_fleet_size_1 = {
	cost = @tier1cost1
	area = society
	tier = 1
	category = { military_theory }
	weight = @tier1weight1

	modifier = {
		command_limit_add = 20
	}

	weight_modifier = {
		factor = 3
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}

#Doctrine: Reactive Formations
tech_doctrine_fleet_size_2 = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { military_theory }
	prerequisites = { "tech_doctrine_fleet_size_1" }
	weight = @tier2weight3

	modifier = {
		command_limit_add = 40
	}

	weight_modifier = {
		factor = 3
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}

#Doctrine: Interstellar Warfare
tech_doctrine_fleet_size_3 = {
	cost = @tier3cost2
	area = society
	tier = 3
	category = { military_theory }
	prerequisites = { "tech_doctrine_fleet_size_2" }
	weight = @tier3weight2

	modifier = {
		command_limit_add = 60
	}

	weight_modifier = {
		factor = 3
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}

#Doctrine: Fluid Fleet Templates
tech_doctrine_fleet_size_4 = {
	cost = @tier4cost1
	area = society
	tier = 4
	category = { military_theory }
	prerequisites = { "tech_doctrine_fleet_size_3" }
	weight = @tier4weight1

	modifier = {
		command_limit_add = 80
	}

	weight_modifier = {
		factor = 3
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}

#Doctrine: Armada Battle Formation
tech_doctrine_fleet_size_5 = {
	cost = @tier5cost3
	area = society
	tier = 5
	category = { military_theory }
	prerequisites = { "tech_doctrine_fleet_size_4" }
	weight = @tier5weight3

	modifier = {
		command_limit_add = 100
	}

	weight_modifier = {
		factor = 3
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}

#Interstellar Fleet Traditions
tech_interstellar_fleet_traditions = {
	cost = @tier2cost2
	area = society
	tier = 2
	category = { military_theory }
	weight = @tier2weight2

	weight_modifier = {
		factor = 3
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}

#Refit Standards
tech_refit_standards = {
	cost = @tier3cost1
	area = society
	tier = 3
	category = { military_theory }
	prerequisites = { "tech_interstellar_fleet_traditions" }
	weight = @tier3weight1

	modifier = {
		starbase_shipyard_build_speed_mult = 0.10
		ships_upkeep_mult = -0.05
	}

	weight_modifier = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}

	technology_swap = {
		name = tech_refit_standards_beastmasters
		inherit_icon = no
		inherit_effects = no

		trigger = {
			is_beastmasters_empire = yes
		}

		modifier = {
			starbase_shipyard_space_fauna_build_speed_mult = 0.10
			space_fauna_ship_upkeep_mult = -0.05
		}
	}
}


# Command Matrix
tech_command_matrix = {
	cost = @tier3cost3
	area = society
	tier = 3
	category = { military_theory }
	prerequisites = { "tech_refit_standards" }
	weight = @tier3weight3

	modifier = {
		ship_fire_rate_mult = 0.05
	}

	prereqfor_desc = {
		hide_prereq_for_desc = component
	}

	weight_modifier = {
		factor = 3
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}

#Doctrine: Fleet Support
tech_doctrine_navy_size_1 = {
	cost = @tier1cost2
	area = society
	tier = 1
	category = { military_theory }
	weight = @tier1weight2

	modifier = {
		country_naval_cap_add = 25
	}

	weight_modifier = {
		factor = 3
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}

# Doctrine: Support Vessels
tech_doctrine_navy_size_2 = {
	cost = @tier2cost2
	area = society
	tier = 2
	category = { military_theory }
	prerequisites = { "tech_doctrine_navy_size_1" }
	weight = @tier2weight2

	modifier = {
		country_naval_cap_add = 50
	}

	weight_modifier = {
		factor = 10
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}

# Doctrine: Interstellar Logistics
tech_doctrine_navy_size_3 = {
	cost = @tier3cost1
	area = society
	tier = 3
	category = { military_theory }
	prerequisites = { "tech_doctrine_navy_size_2" }
	weight = @tier3weight1

	modifier = {
		country_naval_cap_add = 75
	}

	weight_modifier = {
		factor = 3
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}

# Doctrine: Fleet Liasions
tech_doctrine_navy_size_4 = {
	cost = @tier4cost3
	area = society
	tier = 4
	category = { military_theory }
	prerequisites = { "tech_doctrine_navy_size_3" }
	weight = @tier4weight3

	modifier = {
		country_naval_cap_add = 100
	}

	weight_modifier = {
		factor = 3
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}


# ##################
# Army Organization
# ##################
tech_centralized_command = {
	cost = @tier3cost2
	area = society
	tier = 3
	category = { military_theory }
	weight = @tier3weight2

	# unlocks military academy

	modifier = {
		country_occupation_armies_add = 2
	}

	weight_modifier = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}

#Combat Training
tech_combat_training = {
	cost = @tier3cost1
	area = society
	tier = 3
	category = { military_theory }
	prerequisites = { "tech_centralized_command" }
	weight = @tier3weight1

	modifier = {
		army_attack_damage_mult = 0.15
		army_attack_morale_mult = 0.15
	}

	weight_modifier = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}


# Ground Defense Planning
tech_ground_defense_planning = {
	cost = @tier1cost2
	area = society
	tier = 1
	category = { military_theory }
	prerequisites = { "tech_planetary_defenses" }
	weight = @tier1weight2

	modifier = {
		army_defense_damage_mult = 0.33
		show_only_custom_tooltip = no
		custom_tooltip = ADD_NAVAL_CAPACITY_FROM_SOLDIERS
	}

	weight_modifier = {
		factor = 2
		modifier = {
			factor = 2
			is_militarist = yes
		}
	}

	technology_swap = {
		name = tech_ground_defense_planning
		inherit_icon = yes
		inherit_effects = no
		trigger = {
			is_wilderness_empire = yes
		}
		modifier = { # Identical to the base technology, just without the custom tooltip
			army_defense_damage_mult = 0.33
		}
	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}
	}
}

# Global Defense Grid
tech_global_defense_grid = {
	cost = @tier2cost1
	area = society
	tier = 2
	category = { military_theory }
	prerequisites = { "tech_ground_defense_planning" }
	weight = @tier2weight1

	# unlocks fortress

	technology_swap = { # Wilderness icon swap
		name = tech_wilderness_defense_grid
		inherit_icon = no
		inherit_effects = yes
		trigger = {
			is_wilderness_empire = yes
		}
	}

	modifier = {
		army_defense_health_mult = 0.25
	}

	weight_modifier = {
		factor = 2
		modifier = {
			factor = 2
			is_militarist = yes
		}

		modifier = {
			factor = 1.5
			is_specialist_subject_type = { TYPE = bulwark }
		}
	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}


# ##################
# Psionics
# ##################

#Psionic Theory
tech_psionic_theory = {
	cost = @tier3cost1
	area = society
	tier = 3
	category = { psionics }
	is_rare = yes
	weight = @tier3weight1
	is_reverse_engineerable = no

	gateway = psionics

	potential = {
		OR = { #The OR is so that Gestalts can get Zro Distillation with that Resolution
			has_shroud_dlc = yes # Shroud allows everyone to become psionic
			NOT = { has_ethic = ethic_gestalt_consciousness }
			is_active_resolution = resolution_galacticstudies_extradimensional_experimentation
			has_relic = r_zro_crystal
		}
		NOT = { has_origin = origin_mindwardens } # Except Mindwardens since they can't psionically ascend
	}

	modifier = {
		empire_size_pops_mult = -0.05
		army_morale_damage_taken_mult = -0.10
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 0
			has_shroud_dlc = no
			has_ethic = ethic_gestalt_consciousness
		}
		modifier = {
			factor = 0.5
			is_spiritualist = no
		}
		modifier = {
			factor = 2
			has_ethic = "ethic_fanatic_spiritualist"
		}
		modifier = {
			factor = 2
			any_country = {
				has_origin = origin_mindwardens
				NOT = { is_same_value = prev }
			}
		}
		modifier = {
			factor = 2
			OR = {
				has_trait_in_council = { TRAIT = leader_trait_maniacal }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_2 }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_3 }
			}
		}
		modifier = {
			factor = 2
			OR = {
				has_trait_in_council = { TRAIT = leader_trait_psionic }
				has_trait_in_council = { TRAIT = leader_trait_chosen }
				has_trait_in_council = { TRAIT = leader_trait_composer_chosen }
				has_trait_in_council = { TRAIT = leader_trait_instrument_chosen }
				has_trait_in_council = { TRAIT = leader_trait_whisperers_chosen }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_psionic_theory
		}
		modifier = {
			factor = 2
			any_owned_pop_group = {
				is_psionic_species = yes
			}
		}
		modifier = {
			factor = 1.25
			any_owned_pop_group = {
				is_latent_psionic_species = yes
			}
			NOT = {
				any_owned_pop_group = {
					is_psionic_species = yes
				}
			}
		}
		modifier = {
			factor = 2
			has_paragon_dlc = no
			any_owned_leader = {
				has_trait = leader_trait_shroudwalker
			}
		}
		modifier = {
			factor = 0
			AND = {
				is_materialist = yes
				NOR = {
					has_tier1or2or3_in_council = { TRAIT = leader_trait_expertise_psionics }
					has_councilor = { COUNCILOR = "councilor_shroudwalker_teacher" }
					any_owned_pop_group = {
						has_psionic_species_trait = yes
					}
				}
			}
		}
		modifier = {
			factor = 0
			has_origin = origin_endbringers
		}
		modifier = {
			factor = @ap_pending_tech_boost
			has_ascension_perk = ap_mind_over_matter
		}
	}

	ai_weight = {
		modifier = {
			factor = 5
			is_spiritualist = yes
		}

		modifier = {
			factor = 2
			is_ai = no #auto-research
		}

		modifier = {
			factor = 10
			any_country = {
				has_origin = origin_mindwardens
			}
		}
		modifier = {
			factor = @ap_pending_tech_boost
			has_ascension_perk = ap_mind_over_matter
		}
	}
}

#Telepathy
tech_telepathy = {
	cost = @tier3cost3
	area = society
	tier = 3
	category = { psionics }
	is_rare = yes
	prerequisites = { "tech_psionic_theory" }
	weight = @tier3weight3
	is_reverse_engineerable = no

	potential = {
		OR = {
			has_shroud_dlc = yes
			NOT = { has_ethic = ethic_gestalt_consciousness }
		}
	}

	technology_swap = {
		name = tech_telepathy_machine_gestalt
		inherit_icon = yes
		inherit_effects = yes
		trigger = {
			is_machine_empire = yes
		}
	}

	technology_swap = {
		name = tech_telepathy_hive
		inherit_icon = yes
		inherit_effects = yes
		trigger = {
			is_hive_empire = yes
			is_wilderness_empire = no
		}
	}

	technology_swap = {
		name = tech_telepathy_wilderness
		inherit_icon = yes
		inherit_effects = yes
		trigger = {
			is_wilderness_empire = yes
		}
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 0
			has_psionic_ascension = no
		}
		modifier = {
			factor = 0.50
			NOT = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_psionics }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_telepathy
		}
		modifier = {
			factor = 2
			has_ethic = "ethic_spiritualist"
		}
		modifier = {
			factor = 3
			has_ethic = "ethic_fanatic_spiritualist"
		}
		modifier = {
			factor = 3
			has_paragon_dlc = no
			any_owned_leader = {
				has_trait = leader_trait_shroudwalker
			}
		}
		modifier = {
			factor = 4
			OR = {
				has_trait_in_council = { TRAIT = leader_trait_maniacal }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_2 }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_3 }
			}
		}
	}

	ai_weight = {
		modifier = {
			factor = 5
			is_spiritualist = yes
		}
	}
}

tech_precognition_interface = {
	cost = @tier4cost2
	area = society
	tier = 4
	category = { psionics }
	is_rare = yes
	prerequisites = { "tech_telepathy" }
	weight = @tier4weight2
	is_reverse_engineerable = no

	# unlocks precognitive interface-component, combat-computer granting evasion to ships

	prereqfor_desc = {
		hide_prereq_for_desc = component
		custom = {
			title = "TECH_UNLOCK_COMBAT_COMPUTER_PRECOG_TITLE"
			desc = "TECH_UNLOCK_COMBAT_COMPUTER_PRECOG_DESC"
		}
	}

	potential = {
		OR = {
			has_shroud_dlc = yes
			NOT = { has_ethic = ethic_gestalt_consciousness }
		}
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 0.50
			NOT = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_psionics }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_precognition_interface
		}
		modifier = {
			factor = 2
			has_ethic = "ethic_spiritualist"
		}
		modifier = {
			factor = 3
			has_ethic = "ethic_fanatic_spiritualist"
		}
		modifier = {
			factor = 3
			has_paragon_dlc = no
			any_owned_leader = {
				has_trait = leader_trait_shroudwalker
			}
		}
		modifier = {
			factor = 2
			OR = {
				has_trait_in_council = { TRAIT = leader_trait_maniacal }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_2 }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_3 }
			}
		}
	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}

tech_thought_enforcement = {
	cost = @tier4cost2
	area = society
	tier = 4
	category = { psionics }
	is_rare = yes
	prerequisites = { "tech_telepathy" }
	weight = @tier4weight2
	is_reverse_engineerable = no

	# Unlocks thought enforcement edict

	potential = {
		OR = {
			has_shroud_dlc = yes
			NOT = { has_ethic = ethic_gestalt_consciousness }
		}
	}

	technology_swap = {
		name = tech_thought_enforcement_gestalt
		inherit_icon = yes
		inherit_effects = yes
		trigger = {
			is_gestalt = yes
		}
		weight = {
			factor = 1
		}
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 0
			has_psionic_ascension = no
		}
		modifier = {
			factor = 0.50
			NOT = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_psionics }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_thought_enforcement
		}
		modifier = {
			factor = 2
			is_spiritualist = yes
			has_ethic = ethic_authoritarian
		}
		modifier = {
			factor = 3
			is_spiritualist = yes
			has_ethic = ethic_fanatic_authoritarian
		}
		modifier = {
			factor = 2
			has_valid_civic = civic_police_state
		}
		modifier = {
			factor = 3
			has_paragon_dlc = no
			any_owned_leader = {
				has_trait = leader_trait_shroudwalker
			}
		}
		modifier = {
			factor = 2
			OR = {
				has_trait_in_council = { TRAIT = leader_trait_maniacal }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_2 }
				has_trait_in_council = { TRAIT = leader_trait_maniacal_3 }
			}
		}
		modifier = {
			factor = 2
			has_shroud_dlc = yes
			is_gestalt = yes
		}
	}

	ai_weight = {
		modifier = {
			factor = 2
			is_authoritarian = yes
		}
	}
}

tech_psi_jump_drive_1 = {
	cost = @tier5cost2
	area = society
	tier = 5
	category = { psionics }
	is_rare = yes
	is_dangerous = yes
	prerequisites = { "tech_precognition_interface" }
	weight = 0 # given by event
	is_dangerous = yes
	is_reverse_engineerable = no

	feature_flags = {
		jump_method
	}

	prereqfor_desc = {
		component = {
			title = "TECH_UNLOCK_PSI_JUMPDRIVE_1_TITLE"
			desc = "TECH_UNLOCK_PSI_JUMPDRIVE_1_DESC"
		}
	}

	potential = {
		OR = {
			has_shroud_dlc = yes
			NOT = { has_ethic = ethic_gestalt_consciousness }
		}
	}

	technology_swap = {
		name = tech_bio_psi_jump_drive_1
		inherit_icon = no
		inherit_effects = no
		trigger = {
			country_uses_bio_ships = yes
		}
		prereqfor_desc = {
			custom = {
				title = "TECH_UNLOCK_BIO_PSI_JUMPDRIVE_1_TITLE"
				desc = "TECH_UNLOCK_BIO_PSI_JUMPDRIVE_1_DESC"
			}
		}
		weight = {
			factor = 1
		}
	}
}

#Galactic Ambitions
tech_galactic_ambitions = {
	cost = @tier2cost2
	area = society
	category = { new_worlds }
	tier = 2
	weight = @tier2weight2

	modifier = {
		country_starbase_capacity_add = 2
	}

	weight_modifier = {
		modifier = {
			factor = 2
			num_communications > 2
		}
		modifier = {
			factor = 2
			num_communications > 3
		}
		modifier = {
			factor = 2
			num_communications > 4
		}

		modifier = {
			factor = 0
			num_communications < 1
		}
	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}

# Manifest Destiny
tech_manifest_destiny = {
	cost = @tier4cost2
	area = society
	category = { new_worlds }
	tier = 4
	prerequisites = { "tech_galactic_ambitions" }
	weight = @tier4weight2

	modifier = {
		country_starbase_capacity_add = 2
	}

	weight_modifier = {
		modifier = {
			factor = 2
			num_communications > 2
		}
		modifier = {
			factor = 2
			num_communications > 3
		}
		modifier = {
			factor = 2
			num_communications > 4
		}

		modifier = {
			factor = 0
			num_communications < 1
		}
	}

	ai_weight = {
		modifier = {
			factor = 1.5
			has_ethic = ethic_militarist
		}
		modifier = {
			factor = 2
			has_ethic = ethic_fanatic_militarist
		}

	}
}

tech_interstellar_campaigns = {
	cost = @tier2cost3
	area = society
	category = { military_theory }
	tier = 2
	weight = @tier2weight3
	prerequisites = { tech_galactic_ambitions }

	modifier = {
		country_claim_influence_cost_mult = -0.1
		country_war_exhaustion_mult = -0.1
	}

	weight_modifier = {
		modifier = {
			factor = 0
			OR = {
				has_valid_civic = "civic_fanatic_purifiers"
				has_valid_civic = "civic_hive_devouring_swarm"
				has_valid_civic = "civic_machine_terminator"
			}
		}
		modifier = {
			factor = 2
			num_communications > 2
		}
		modifier = {
			factor = 2
			num_communications > 3
		}
		modifier = {
			factor = 2
			num_communications > 4
		}

		modifier = {
			factor = 0
			num_communications < 1
		}
	}

	ai_weight = {
		modifier = {
			factor = 2
			is_militarist = yes
		}

	}
}

tech_galactic_campaigns = {
	cost = @tier4cost1
	area = society
	category = { military_theory }
	tier = 4
	weight = @tier4weight1
	prerequisites = { tech_interstellar_campaigns }

	modifier = {
		country_claim_influence_cost_mult = -0.1
		country_war_exhaustion_mult = -0.1
	}

	weight_modifier = {
		modifier = {
			factor = 0
			OR = {
				has_valid_civic = "civic_fanatic_purifiers"
				has_valid_civic = "civic_hive_devouring_swarm"
				has_valid_civic = "civic_machine_terminator"
			}
		}
		modifier = {
			factor = 2
			num_communications > 2
		}
		modifier = {
			factor = 2
			num_communications > 3
		}
		modifier = {
			factor = 2
			num_communications > 4
		}

		modifier = {
			factor = 0
			num_communications < 1
		}
	}

	ai_weight = {
		modifier = {
			factor = 1.5
			has_ethic = ethic_militarist
		}
		modifier = {
			factor = 2
			has_ethic = ethic_fanatic_militarist
		}

	}
}

tech_existential_campaigns = {
	cost = @tier5cost3
	area = society
	category = { military_theory }
	tier = 5
	weight = @tier5weight3
	is_rare = yes
	is_dangerous = yes
	prerequisites = { tech_galactic_campaigns }

	modifier = {
		show_only_custom_tooltip = yes
		custom_tooltip = tech_existential_campaigns_effect
	}

	weight_modifier = {
		modifier = {
			factor = 0
			OR = {
				has_valid_civic = "civic_fanatic_purifiers"
				has_valid_civic = "civic_hive_devouring_swarm"
				has_valid_civic = "civic_machine_terminator"
			}
		}
		modifier = {
			factor = 2
			has_ethic = ethic_fanatic_militarist
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_militarist
		}
		modifier = {
			factor = 2
			num_communications > 2
		}
		modifier = {
			factor = 2
			num_communications > 3
		}
		modifier = {
			factor = 2
			num_communications > 4
		}
		modifier = {
			factor = 0
			num_communications < 1
		}
		modifier = {
			factor = 0.5
			has_ethic = ethic_pacifist
		}
		modifier = {
			factor = 0
			is_fanatic_pacifist = yes
		}
	}

	ai_weight = {
		modifier = {
			factor = 2
			has_ethic = ethic_fanatic_militarist
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_militarist
		}
		modifier = {
			factor = 0.5
			has_ethic = ethic_pacifist
		}
		modifier = {
			factor = 0
			is_fanatic_pacifist = yes
		}
	}
}

# ##################
# Empire Management
# ##################

tech_planetary_government = {
	cost = @tier0cost1
	area = society
	tier = 0
	category = { statecraft }
	start_tech = yes

	# unlocks Planetary Outpost

	technology_swap = { # Wilderness icon swap
		name = tech_wilderness_government
		inherit_icon = no
		inherit_effects = yes
		trigger = {
			is_wilderness_empire = yes
		}
	}

	starting_potential = {
		is_low_tech_start = no # So Broken Shackles origin players don't start with it
	}
}

#Planetary Unification
tech_planetary_unification = {
	cost = @tier1cost1
	area = society
	tier = 1
	category = { statecraft }
	prerequisites = { "tech_planetary_government" }
	weight = @tier1weight1

	gateway = capital

	feature_flags = {
		campaign_edicts
	}

	# also unlocks planet-happiness edict and gives a one time Unity award

	modifier = {
		country_unity_produces_mult = 0.025
		show_only_custom_tooltip = no
		custom_tooltip = tech_planetary_unification_effect
	}

	weight_modifier = {
		factor = 4
		modifier = {
			factor = 0.75
			NOT = {
				is_pacifist = yes
			}
		}
	}

	ai_weight = {
		factor = @capital_tech_ai_factor
		modifier = {
			factor = 0.75
			NOT = {
				is_pacifist = yes
			}
		}
		modifier = {
			factor = 1.25
			has_ethic = ethic_authoritarian
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_fanatic_authoritarian
		}

	}
}

#Colonial Centralization
tech_colonial_centralization = {
	cost = @tier2cost2
	area = society
	tier = 2
	category = { new_worlds }
	prerequisites = { "tech_planetary_unification" }
	weight = @tier2weight2

	gateway = capital

	# unlocks Planetary Capital
	# unlocks production-targets edict

	technology_swap = { # Wilderness icon swap
		name = tech_wilderness_colonial_centralization
		inherit_icon = no
		inherit_effects = yes
		trigger = {
			is_wilderness_empire = yes
		}
	}

	modifier = {
		country_official_cap_add = 1
		country_commander_cap_add = 1
		country_scientist_cap_add = 1
	}

	weight_modifier = {
		factor = 4
	}

	ai_weight = {
		factor = @capital_tech_ai_factor

	}
}

#Galactic Administration
tech_galactic_administration = {
	cost = @tier3cost3
	area = society
	tier = 3
	category = { statecraft }
	prerequisites = { "tech_colonial_centralization" }
	weight = @tier3weight3

	gateway = capital # unlocks Empire Capital-Complex

	technology_swap = { # Wilderness icon swap
		name = tech_wilderness_galactic_administration
		inherit_icon = no
		inherit_effects = yes
		trigger = {
			is_wilderness_empire = yes
		}
	}

	modifier = { # add civic slot
		country_government_civic_points_add = 1
	}

	weight_modifier = {
		factor = 4

	}

	ai_weight = {
		factor = @capital_tech_ai_factor

	}
}

tech_planetary_infrastructure_1 = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { new_worlds }
	prerequisites = { "tech_colonial_centralization" "tech_ship_armor_2" }
	weight = @tier2weight3

	gateway = infrastructure

	modifier = {
		planet_structures_cost_mult = -0.10
		planet_building_build_speed_mult = 0.15
		planet_colony_development_speed_mult = 0.25
		habitat_max_districts_add = 1
	}

	weight_modifier = {
		factor = 4

	}

	ai_weight = {
		factor = @building_slots_ai_tech_factor

	}

	technology_swap = {
		name = tech_planetary_infrastructure_1_wilderness
		inherit_icon = yes
		inherit_effects = no
		trigger = {
			is_wilderness_empire = yes
		}
		modifier = {
			planet_structures_cost_mult = -0.10
			planet_building_build_speed_mult = 0.15
			terraform_speed_mult = 0.25
		}
	}

	technology_swap = {
		name = tech_planetary_infrastructure_1_nomads
		inherit_icon = yes
		inherit_effects = no
		trigger = {
			is_nomadic = yes
		}
		modifier = {
			planet_structures_cost_mult = -0.10
			planet_building_build_speed_mult = 0.15
			pc_ark_max_districts_add = 1
		}
	}
}

tech_planetary_infrastructure_2 = {
	cost = @tier4cost3
	area = society
	tier = 4
	category = { new_worlds }
	prerequisites = { "tech_galactic_administration" "tech_ship_armor_4" "tech_planetary_infrastructure_1" }
	weight = @tier4weight3

	modifier = {
		planet_structures_cost_mult = -0.10
		planet_building_build_speed_mult = 0.15
		planet_colony_development_speed_mult = 0.25
		habitat_max_districts_add = 1
	}

	weight_modifier = {
		factor = 4

	}

	ai_weight = {
		factor = @building_slots_ai_tech_factor

	}

	technology_swap = {
		name = tech_planetary_infrastructure_2_wilderness
		inherit_icon = yes
		inherit_effects = no
		trigger = {
			is_wilderness_empire = yes
		}
		modifier = {
			planet_structures_cost_mult = -0.10
			planet_building_build_speed_mult = 0.15
			terraform_speed_mult = 0.25
		}
	}

	technology_swap = {
		name = tech_planetary_infrastructure_2_nomads
		inherit_icon = yes
		inherit_effects = no
		trigger = {
			is_nomadic = yes
		}
		modifier = {
			planet_structures_cost_mult = -0.10
			planet_building_build_speed_mult = 0.15
			pc_ark_max_districts_add = 1
		}
	}
}

#Subdermal Implants
tech_subdermal_stimulation = {
	cost = @tier2cost2
	area = society
	tier = 2
	category = { biology }
	prerequisites = { "tech_genome_mapping" }
	weight = @tier2weight2
	is_rare = yes

	# unlocks Chemical Bliss living standard

	feature_flags = {
		bliss_standard
	}

	potential = {
		NOR = {
			has_ethic = ethic_gestalt_consciousness
			has_civic = civic_dystopian_society
			is_individual_machine = yes
		}
	}

	modifier = {
		army_morale = 0.10
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 1.25
			is_egalitarian = no
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_subdermal_stimulation
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
	}

	ai_weight = {
		modifier = {
			factor = 3
			is_egalitarian = no
		}
	}
}

tech_tracking_implants = {
	area = society
	cost = @tier4cost2
	tier = 4
	category = { statecraft }
	prerequisites = { "tech_subdermal_stimulation" "tech_galactic_bureaucracy" }
	is_rare = yes
	weight = @tier4weight2

	# Unlocks tracking implants edict

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 0.20
			NOR = {
				has_modifier = "curator_insight"
				has_trait_in_council = { TRAIT = leader_trait_curator }
				has_trait_in_council = { TRAIT = leader_trait_expertise_statecraft }
			}
		}
		modifier = {
			factor = 2
			is_materialist = yes
			is_authoritarian = yes
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_tracking_implants
		}
	}

	ai_weight = {

	}
}

#Global Manufacturing
tech_global_production_strategy = {
	cost = @tier3cost1
	area = society
	tier = 3
	category = { statecraft }
	prerequisites = { "tech_alloys_1" "tech_colonial_centralization" }
	weight = @tier3weight1

	# unlocks Ministry of Production

	weight_modifier = {
		factor = 1.5
		modifier = {
			factor = 0
			NOR = {
				has_technology = "tech_luxuries_1"
				country_uses_consumer_goods = no
			}
		}

		modifier = {
			factor = 1.5
			is_specialist_subject_type = { TYPE = prospectorium }
		}
	}

	ai_weight = {

	}
}

#Adaptive Bureaucracy
tech_adaptive_bureaucracy = {
	cost = @tier1cost2
	area = society
	tier = 1
	category = { statecraft }
	prerequisites = { "tech_planetary_unification" }
	weight = @tier1weight2

	gateway = espionage

	modifier = {
		country_edict_fund_add = 20
	}

	weight_modifier = {
		modifier = {
			factor = 0.5
			num_owned_planets < 2
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 2
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 3
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 4
		}
	}

	ai_weight = {

	}
}

tech_effective_bureaucracy = {
	cost = @tier2cost1
	area = society
	tier = 2
	category = { statecraft }
	prerequisites = { "tech_adaptive_bureaucracy" }
	weight = @tier2weight1

	potential = {
		is_gestalt = no
	}

	modifier = {
		country_edict_fund_add = 20
	}

	weight_modifier = {
		modifier = {
			factor = 0.5
			num_owned_planets < 2
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 2
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 3
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 4
		}

	}

	ai_weight = {

	}
}

tech_colonial_bureaucracy = {
	cost = @tier2cost1
	area = society
	tier = 2
	category = { statecraft }
	prerequisites = { "tech_adaptive_bureaucracy" }
	weight = @tier2weight1

	gateway = espionage

	modifier = {
		country_edict_fund_add = 20
		add_base_country_intel = 10
	}

	weight_modifier = {
		modifier = {
			factor = 0
			num_owned_planets < 2
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 2
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 3
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 4
		}

	}

	ai_weight = {

	}
}

tech_galactic_bureaucracy = {
	cost = @tier3cost1
	area = society
	tier = 3
	category = { statecraft }
	prerequisites = { "tech_colonial_bureaucracy" }
	weight = @tier3weight1

	modifier = {
		country_edict_fund_add = 20
		add_base_country_intel = 10
	}

	weight_modifier = {
		modifier = {
			factor = 0
			num_owned_planets < 2
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 2
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 3
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 4
		}

	}

	ai_weight = {

	}
}

#Living State
tech_living_state = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { statecraft }
	prerequisites = { "tech_colonial_centralization" }
	weight = @tier2weight3

	potential = {
		NOT = { has_ethic = ethic_gestalt_consciousness }
	}

	modifier = {
		pop_factions_produces_mult = 0.05
	}

	weight_modifier = {
		modifier = {
			factor = 0.5
			num_owned_planets < 5
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 5
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 6
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 7
		}
		modifier = {
			factor = 1.25
			is_authoritarian = yes
		}

	}

	ai_weight = {

	}
}

#Collective Self
tech_collective_self = {
	cost = @tier3cost3
	area = society
	tier = 3
	category = { statecraft }
	prerequisites = { "tech_colonial_centralization" }
	weight = @tier3weight3

	modifier = {
		country_official_cap_add = 1
		country_commander_cap_add = 1
		country_scientist_cap_add = 1
		external_leader_pool_add = 1
		envoys_add = 1
	}

	potential = {
		NOT = { has_ethic = ethic_gestalt_consciousness }
	}

	weight_modifier = {
		modifier = {
			factor = 0.5
			num_owned_planets < 7
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 8
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 9
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 10
		}
		modifier = {
			factor = 1.5
			is_authoritarian = yes
		}

	}

	ai_weight = {

	}
}

# Autonomous Agents
tech_autonomous_agents = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { statecraft }
	prerequisites = { "tech_colonial_centralization" }
	weight = @tier2weight3

	potential = {
		has_ethic = ethic_gestalt_consciousness
	}

	modifier = {
		country_tech_influence_produces_add = 1
		envoys_add = 1
	}

	weight_modifier = {
		modifier = {
			factor = 0.5
			num_owned_planets < 5
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 5
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 6
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 7
		}

	}

	ai_weight = {

	}
}

#Embodied Dynamism
tech_embodied_dynamism = {
	cost = @tier3cost3
	area = society
	tier = 3
	category = { statecraft }
	prerequisites = { "tech_autonomous_agents" }
	weight = @tier3weight3

	modifier = {
		country_official_cap_add = 1
		country_commander_cap_add = 1
		country_scientist_cap_add = 1
		external_leader_pool_add = 1
		envoys_add = 1
	}

	potential = {
		has_ethic = ethic_gestalt_consciousness
	}

	weight_modifier = {
		modifier = {
			factor = 0.5
			num_owned_planets < 7
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 8
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 9
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 10
		}
	}

	ai_weight = {

	}
}

#Neural Implants
tech_neural_implants = {
	cost = @tier1cost3
	area = society
	tier = 1
	category = { statecraft }
	weight = @tier1weight3

	# unlocks slave processing plant, slave armies

	potential = {
		is_regular_empire = yes
		allows_slavery = yes
	}

	weight_modifier = {
		modifier = {
			factor = 1.5
			count_owned_pop_amount = {
				limit = {
					OR = {
						is_enslaved = yes
						has_disconnected_drone_citizenship_type = yes
					}
				}
				count >= 1000
			}
		}
		modifier = {
			factor = 2
			count_owned_pop_amount = {
				limit = {
					OR = {
						is_enslaved = yes
						has_disconnected_drone_citizenship_type = yes
					}
				}
				count >= 2000
			}
		}
		modifier = {
			factor = 2
			count_owned_pop_amount = {
				limit = {
					OR = {
						is_enslaved = yes
						has_disconnected_drone_citizenship_type = yes
					}
				}
				count >= 3000
			}
		}
	}

	ai_weight = {
		modifier = {
			factor = 1.25
			is_authoritarian = yes
		}

	}
}

# ##################
# Social Engineering
# ##################

#Artificial Moral Codes
tech_artificial_moral_codes = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { statecraft }
	weight = @tier2weight2

	modifier = {
		planet_crime_mult = -0.15
		planet_amenities_mult = 0.05
	}

	potential = {
		NOT = { has_ethic = ethic_gestalt_consciousness }
	}

	weight_modifier = {
		factor = 1.5

	}

	ai_weight = {

	}
}

#Synthetic Thought Patterns
tech_synthetic_thought_patterns = {
	cost = @tier3cost3
	area = society
	tier = 3
	category = { statecraft }
	prerequisites = { "tech_artificial_moral_codes" }
	weight = @tier3weight3

	modifier = {
		planet_jobs_produces_mult = 0.025
	}

	potential = {
		is_gestalt = no
	}

	weight_modifier = {
		factor = 1.5

	}

	ai_weight = {

	}
}

#Unity of Purpose
tech_unity_of_purpose = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { statecraft }
	weight = @tier2weight3

	modifier = {
		planet_crime_no_happiness_mult = -0.15
		planet_amenities_no_happiness_mult = 0.05
	}

	potential = {
		is_gestalt = yes
	}

	weight_modifier = {
		factor = 1.5

	}

	ai_weight = {

	}
}

# Collective Production Methods
tech_collective_production_methods = {
	cost = @tier3cost3
	area = society
	tier = 3
	category = { statecraft }
	prerequisites = { "tech_unity_of_purpose" }
	weight = @tier3weight1

	modifier = {
		planet_jobs_produces_mult = 0.025
	}

	potential = {
		is_hive_empire = yes
	}

	weight_modifier = {

	}

	ai_weight = {

	}
}

# Resource Processing Algorithms
tech_resource_processing_algorithms = {
	cost = @tier3cost1
	area = society
	tier = 3
	category = { statecraft }
	prerequisites = { "tech_unity_of_purpose" }
	weight = @tier3weight1

	modifier = {
		planet_jobs_produces_mult = 0.025
	}

	potential = {
		is_machine_empire = yes
	}

	weight_modifier = {

	}

	ai_weight = {

	}
}

# ##################
# Amenities
# ##################
tech_holo_entertainment = {
	cost = 0
	area = society
	start_tech = yes
	category = { statecraft }
	tier = 0

	potential = {
		is_gestalt = no
	}

	## unlock holo-theatres building
}

tech_hyper_entertainment_forum = {
	cost = @tier1cost3
	area = society
	category = { statecraft }
	tier = 1
	prerequisites = { "tech_holo_entertainment" }
	weight = @tier1weight3

	potential = {
		is_gestalt = no
	}

	weight_modifier = {
		modifier = {
			factor = 0
			NOR = {
				has_technology = tech_mine_exotic_gases
				has_technology = tech_exotic_gases
				has_country_flag = has_market_access
			}
		}

	}

	ai_weight = {

	}
}

tech_paradise_dome = {
	cost = @tier3cost1
	area = society
	category = { statecraft }
	tier = 3
	prerequisites = { "tech_housing_1" }
	weight = @tier3weight1

	potential = {
		OR = {
			is_gestalt = no
			has_valid_civic = civic_machine_servitor
			has_origin = origin_forever_cruise
		}
	}

	weight_modifier = {
		modifier = {
			factor = 0
			NOR = {
				has_technology = tech_mine_rare_crystals
				has_technology = tech_rare_crystals
				has_country_flag = has_market_access
			}
		}

	}

	ai_weight = {

		modifier = {
			factor = @housing_ai_tech_factor
			pop_amount >= 10000
		}
	}
}


# ##################
# Unity
# ##################

tech_cultural_heritage = {
	cost = @tier1cost2
	area = society
	category = { statecraft }
	tier = 1
	prerequisites = { "tech_planetary_unification" }
	weight = @tier1weight2

	potential = {
		is_wilderness_empire = no
	}

	weight_modifier = {
		modifier = {
			factor = 0.5
			num_owned_planets < 2
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 2
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 3
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 4
		}
		modifier = {
			factor = 2
			is_memorialist_empire = yes
		}
		modifier = {
			factor = 2
			is_entropy_drinkers_empire = yes
		}
	}

	ai_weight = {

	}
}

tech_heritage_site = {
	cost = @tier2cost2
	area = society
	category = { statecraft }
	tier = 2
	prerequisites = { "tech_cultural_heritage" }
	weight = @tier2weight2

	#unlocks upgraded culture building

	weight_modifier = {
		modifier = {
			factor = 0.5
			num_owned_planets < 2
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 2
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 3
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 4
		}
		modifier = {
			factor = 2
			is_memorialist_empire = yes
		}
		modifier = {
			factor = 2
			is_entropy_drinkers_empire = yes
		}
	}

	ai_weight = {

	}
}

tech_hypercomms_forum = {
	cost = @tier3cost2
	area = society
	category = { statecraft }
	tier = 3
	prerequisites = { "tech_heritage_site" "tech_colonial_centralization" }
	weight = @tier3weight2

	#unlocks 2nd upgraded culture building

	weight_modifier = {
		modifier = {
			factor = 0.5
			num_owned_planets < 2
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 2
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 3
		}
		modifier = {
			factor = 1.5
			num_owned_planets > 4
		}
		modifier = {
			factor = 2
			is_memorialist_empire = yes
		}
		modifier = {
			factor = 2
			is_entropy_drinkers_empire = yes
		}
	}

	ai_weight = {

	}
}

tech_autocurating_vault = {
	cost = @tier3cost2
	area = society
	category = { statecraft }
	tier = 3
	prerequisites = { "tech_administrative_ai" "tech_colonial_centralization" }
	weight = @tier3weight1

	potential = {
		NOR = {
			is_spiritualist = yes
			is_wilderness_empire = yes
		}
	}

	weight_modifier = {

	}

	ai_weight = {

	}
}

tech_holographic_rituals = {
	cost = @tier2cost2
	area = society
	category = { statecraft }
	tier = 2
	prerequisites = { "tech_planetary_government" }
	weight = @tier2weight2

	potential = {
		OR = {
			is_spiritualist = yes
			AND = {
				is_gestalt = no
				has_make_spiritualist_perk = yes
			}
		}
	}

	weight_modifier = {
		modifier = {
			factor = 0
			NOR = {
				has_technology = tech_mine_rare_crystals
				has_technology = tech_rare_crystals
				has_country_flag = has_market_access
			}
		}

	}

	ai_weight = {

	}
}

tech_consecration_fields = {
	cost = @tier3cost2
	area = society
	category = { statecraft }
	tier = 3
	prerequisites = { "tech_holographic_rituals" "tech_colonial_centralization" }
	weight = @tier3weight2

	potential = {
		OR = {
			is_spiritualist = yes
			AND = {
				is_gestalt = no
				has_make_spiritualist_perk = yes
			}
		}
	}

	weight_modifier = {

	}

	ai_weight = {

	}
}

tech_transcendent_faith = {
	cost = @tier4cost2
	area = society
	category = { statecraft }
	tier = 4
	prerequisites = { "tech_consecration_fields" "tech_galactic_administration" }
	weight = @tier4weight2

	potential = {
		OR = {
			is_spiritualist = yes
			AND = {
				is_gestalt = no
				has_make_spiritualist_perk = yes
			}
		}
	}

	weight_modifier = {

	}

	ai_weight = {

	}
}

# Hive Mind
tech_hive_node = {
	cost = 0
	area = society
	start_tech = yes
	category = { statecraft }
	tier = 0

	potential = {
		is_hive_empire = yes
		is_wilderness_empire = no
	}

	weight_modifier = { }

	ai_weight = { }
}

tech_hive_cluster = {
	cost = @tier2cost2
	area = society
	category = { statecraft }
	tier = 2
	prerequisites = { "tech_hive_node" }
	weight = @tier2weight2

	potential = {
		is_wilderness_empire = no
	}

	weight_modifier = { }

	ai_weight = { }
}

tech_hive_confluence = {
	cost = @tier3cost2
	area = society
	category = { statecraft }
	tier = 3
	prerequisites = { "tech_hive_cluster" "tech_colonial_centralization" }
	weight = @tier3weight2

	weight_modifier = { }

	ai_weight = { }
}

# Wilderness
tech_wilderness_node = {
	cost = 0
	area = society
	start_tech = yes
	category = { statecraft }
	tier = 0

	potential = {
		is_wilderness_empire = yes
	}

	weight_modifier = { }

	ai_weight = { }
}

tech_wilderness_cluster = {
	cost = @tier2cost2
	area = society
	category = { statecraft }
	tier = 2
	prerequisites = { "tech_wilderness_node" }
	weight = @tier2weight2

	weight_modifier = { }

	ai_weight = { }
}

tech_wilderness_confluence = {
	cost = @tier3cost2
	area = society
	category = { statecraft }
	tier = 3
	prerequisites = { "tech_wilderness_cluster" "tech_colonial_centralization" }
	weight = @tier3weight2

	weight_modifier = { }

	ai_weight = { }
}

# ##################
# Ascension Perk
# ##################
tech_ascension_theory = {
	area = society
	cost = @tier4cost2
	tier = 4
	category = { statecraft }
	is_rare = yes
	weight = @tier4weight2

	modifier = {
		ascension_perks_add = 1
	}

	feature_flags = {
		unity_ambitions
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 0.20
			NOR = {
				has_modifier = "curator_insight"
				has_trait_in_council = { TRAIT = leader_trait_curator }
				has_trait_in_council = { TRAIT = leader_trait_expertise_statecraft }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_ascension_theory
		}
		modifier = {
			factor = 0
			num_ascension_perk_slots < 6
		}
	}

	ai_weight = {
		factor = 5 #more ascension perks are good
	}
}

# ##################
# Psionic Shield
# ##################
tech_psionic_barrier = {
	area = society
	cost = @tier3cost1
	tier = 3
	category = { psionics }
	is_rare = yes
	prerequisites = { "tech_psionic_theory" }
	weight = 0
	is_reverse_engineerable = no
	icon = tech_psionic_barrier

	technology_swap = {
		name = tech_bio_psionic_barrier
		inherit_icon = no
		inherit_effects = no
		trigger = {
			country_uses_bio_ships = yes
		}
		weight = {
			factor = 1
		}
	}

	technology_swap = {
		name = tech_psionic_barrier_gestalt
		inherit_icon = yes
		inherit_effects = yes
		trigger = {
			is_gestalt = yes
			NOT = { has_origin = origin_shroud_forged }
		}
	}

	technology_swap = {
		name = tech_psionic_barrier_shroud_forged
		inherit_icon = yes
		inherit_effects = yes
		trigger = {
			has_origin = origin_shroud_forged
		}
	}

	weight_modifier = {
		factor = 0
	}

	ai_weight = {
		inline_script = "ai/shield_preference_weight"
	}
}

tech_psionic_shield = {
	area = society
	cost = @tier5cost3
	tier = 5
	category = { psionics }
	is_rare = yes
	prerequisites = { "tech_psionic_theory" }
	weight = 0 # given by event
	is_reverse_engineerable = no

	technology_swap = {
		name = tech_bio_psionic_shield
		inherit_icon = no
		inherit_effects = no
		trigger = {
			country_uses_bio_ships = yes
		}
		weight = {
			factor = 1
		}
	}

	technology_swap = {
		name = tech_psionic_shield_gestalt
		inherit_icon = yes
		inherit_effects = yes
		trigger = {
			is_gestalt = yes
			NOT = { has_origin = origin_shroud_forged }
		}
	}

	technology_swap = {
		name = tech_psionic_shield_shroud_forged
		inherit_icon = yes
		inherit_effects = yes
		trigger = {
			has_origin = origin_shroud_forged
		}
	}

	ai_weight = {
		inline_script = "ai/shield_preference_weight"
	}
}

# ##################
# Other
# ##################

# Penal Colonies
tech_penal_colonies = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { statecraft }
	prerequisites = { "tech_artificial_moral_codes" }
	weight = @tier2weight3
	is_rare = yes

	potential = {
		is_gestalt = no
		is_nomadic = no
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 0.25
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_statecraft }
				has_trait_in_council = { TRAIT = leader_trait_curator }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_penal_colonies
		}
		modifier = {
			factor = 2
			is_authoritarian = yes
		}
		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}

	ai_weight = {

	}
}

# Resort Colonies
tech_resort_colonies = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { statecraft }
	prerequisites = { "tech_artificial_moral_codes" }
	weight = @tier2weight3

	potential = {
		is_gestalt = no
		is_nomadic = no
	}

	weight_modifier = {
		factor = 1.5
		modifier = {
			factor = 0
			num_owned_planets < 2
		}
	}

	ai_weight = {

	}
}


# Slave Colonies
tech_slave_colonies = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { statecraft }
	prerequisites = { "tech_neural_implants" }
	weight = @tier2weight3

	potential = {
		is_gestalt = no
		is_nomadic = no
	}

	weight_modifier = {
		factor = 1
		modifier = {
			factor = 0.25
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_statecraft }
				has_trait_in_council = { TRAIT = leader_trait_curator }
			}
		}

		modifier = {
			factor = 0
			num_owned_planets < 2
		}
		modifier = {
			factor = 0.0
			OR = {
				allows_slavery = no
				NOT = { any_owned_pop_group = { is_enslaved = yes } }
			}
		}
	}

	ai_weight = {

	}
}

tech_housing_agrarian_idyll = {
	cost = @tier3cost1
	area = society
	tier = 3
	category = { statecraft }
	weight = @tier3weight1

	modifier = {
		description = district_housing_agrarian_idyll_tech_effect
	}

	weight_modifier = {
		factor = 1.5
		modifier = {
			factor = 0
			NOT = { has_valid_civic = civic_agrarian_idyll }
		}

	}

	ai_weight = {

		modifier = {
			factor = @housing_ai_tech_factor
			pop_amount >= 10000
		}
	}
}

tech_federation_code = {
	cost = @tier1cost2
	area = society
	tier = 1
	category = { statecraft }
	prerequisites = { "tech_colonial_centralization" }
	weight = @tier2weight1

	potential = {
		OR = {
			# The tech can be given at the start of the game
			days_passed = 0
			# Or when you know someone you can form a federation with
			any_relation = {
				can_form_federation_with_empire = yes
			}
			has_tradition = tr_diplomacy_adopt
		}
	}

	modifier = {
		show_only_custom_tooltip = no
		diplomacy_influence_upkeep_mult = -0.25
		custom_tooltip = tech_federation_code_effect
	}

	## unlock embassy building and edict

	weight_modifier = {
		factor = 2

		modifier = {
			factor = 2
			is_galactic_community_member = yes
		}
		modifier = {
			factor = 2
			has_ethic = ethic_fanatic_xenophile
		}
		modifier = {
			factor = 1.25
			has_ethic = ethic_xenophile
		}
		modifier = {
			factor = 0.5
			has_ethic = ethic_xenophobe
		}
		modifier = {
			factor = 0.25
			has_ethic = ethic_fanatic_xenophobe
		}
	}

	ai_weight = {

		modifier = {
			factor = 2
			has_ethic = ethic_fanatic_xenophile
		}
		modifier = {
			factor = 1.25
			has_ethic = ethic_xenophile
		}
		modifier = {
			factor = 0.5
			has_ethic = ethic_xenophobe
		}
		modifier = {
			factor = 0.25
			has_ethic = ethic_fanatic_xenophobe
		}
	}
}

tech_xeno_diplomacy = {
	cost = @tier2cost2
	area = society
	tier = 2
	category = { statecraft }
	prerequisites = { "tech_federation_code" }
	weight = @tier2weight1

	potential = {
		is_regular_empire = yes
	}

	modifier = {
		diplo_weight_mult = 0.1
	}

	## unlock embassy building and edict

	weight_modifier = {
		factor = 2

		modifier = {
			factor = 1.25
			has_ethic = ethic_xenophile
		}
		modifier = {
			factor = 2
			has_ethic = ethic_fanatic_xenophile
		}
		modifier = {
			factor = 2
			is_galactic_community_member = yes
		}
		modifier = {
			factor = 0.01
			has_civic = civic_inwards_perfection
		}
	}

	ai_weight = {

		modifier = {
			factor = 1.25
			has_ethic = ethic_xenophile
		}
		modifier = {
			factor = 2
			has_ethic = ethic_fanatic_xenophile
		}
		modifier = {
			factor = 0.01
			has_civic = civic_inwards_perfection
		}
	}
}

tech_xeno_relations = {
	cost = @tier3cost2
	area = society
	tier = 3
	category = { statecraft }
	prerequisites = { "tech_xeno_diplomacy" "tech_galactic_administration" }
	weight = @tier3weight1

	potential = {
		is_regular_empire = yes
	}

	modifier = {
		diplo_weight_mult = 0.1
	}

	## unlock embassy building upgrade

	weight_modifier = {
		factor = 2

		modifier = {
			factor = 1.25
			has_ethic = ethic_xenophile
		}
		modifier = {
			factor = 2
			has_ethic = ethic_fanatic_xenophile
		}
		modifier = {
			factor = 2
			is_galactic_community_member = yes
		}
		modifier = {
			factor = 0.01
			has_civic = civic_inwards_perfection
		}
	}

	ai_weight = {

		modifier = {
			factor = 1.25
			has_ethic = ethic_xenophile
		}
		modifier = {
			factor = 2
			has_ethic = ethic_fanatic_xenophile
		}
		modifier = {
			factor = 0.01
			has_civic = civic_inwards_perfection
		}
	}
}

### Productivity
tech_capital_productivity_1 = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { statecraft }
	prerequisites = { "tech_planetary_unification" }
	weight = @tier2weight3

	# Increases production and upkeep of planets with tier 2 capitals or better.

	modifier = {
		description = tech_capital_productivity_1_effect
	}

	weight_modifier = {
		factor = 1
		modifier = {
			factor = 0.25
			NOT = { has_tradition = tr_prosperity_finish }
		}

	}

	ai_weight = {

	}
}

tech_capital_productivity_2 = {
	cost = @tier3cost3
	area = society
	tier = 3
	category = { statecraft }
	prerequisites = { "tech_colonial_centralization" "tech_capital_productivity_1" }
	weight = @tier2weight3

	# Increases production and upkeep of planets with tier 2 capitals or better.

	modifier = {
		description = tech_capital_productivity_2_effect
	}

	weight_modifier = {
		factor = 1
		modifier = {
			factor = 0.25
			NOT = { has_tradition = tr_prosperity_finish }
		}

	}

	ai_weight = {

	}
}

tech_capital_productivity_3 = {
	cost = @tier4cost3
	area = society
	tier = 4
	category = { statecraft }
	prerequisites = { "tech_galactic_administration" "tech_capital_productivity_2" }
	weight = @tier2weight3

	# Increases production and upkeep of planets with tier 2 capitals or better.

	modifier = {
		description = tech_capital_productivity_3_effect
	}

	weight_modifier = {
		factor = 1
		modifier = {
			factor = 0.25
			NOT = { has_tradition = tr_prosperity_finish }
		}

	}

	ai_weight = {

	}
}

# ##################
# Covenant Reward
# ##################
tech_covenant_composer = {
	area = society
	cost = @guardiantechcost
	tier = @guardiantechtier
	category = { psionics }
	is_rare = yes
	prerequisites = { "tech_psionic_theory" }
	weight = 0 # given by event
	is_reverse_engineerable = no
	icon = tech_covenant_composer
}

tech_covenant_eater = {
	area = society
	cost = @guardiantechcost
	tier = @guardiantechtier
	category = { psionics }
	is_rare = yes
	prerequisites = { "tech_psionic_theory" }
	weight = 0 # given by event
	is_reverse_engineerable = no
	icon = tech_covenant_eater
}

tech_covenant_instrument = {
	area = society
	cost = @guardiantechcost
	tier = @guardiantechtier
	category = { psionics }
	is_rare = yes
	prerequisites = { "tech_psionic_theory" }
	weight = 0 # given by event
	is_reverse_engineerable = no
	icon = tech_covenant_instrument
}

tech_covenant_cradle = {
	area = society
	cost = @guardiantechcost
	tier = @guardiantechtier
	category = { psionics }
	is_rare = yes
	prerequisites = { "tech_psionic_theory" }
	weight = 0 # given by event
	is_reverse_engineerable = no
	icon = tech_covenant_cradle
}

tech_covenant_whisperers = {
	area = society
	cost = @guardiantechcost
	tier = @guardiantechtier
	category = { psionics }
	is_rare = yes
	prerequisites = { "tech_psionic_theory" }
	weight = 0 # given by event
	is_reverse_engineerable = no
	icon = tech_covenant_whisperers
}

tech_xeno_linguistics = {
	cost = @tier1cost2
	area = society
	tier = 1
	category = { statecraft }
	weight = 0
	icon = tech_xeno_linguistics
	is_rare = yes

	potential = {
		has_paragon_dlc = yes
		is_regular_empire = yes
		is_gestalt = no
		is_homicidal = no
	}

	modifier = {
		first_contact_speed_mult = 0.2
		show_only_custom_tooltip = no
		custom_tooltip = tech_xeno_linguistics_effect
	}

	weight_modifier = {
		factor = 0
		modifier = {
			add = 100
			AND = {
				is_regular_empire = yes
				is_homicidal = no
				is_gestalt = no
				perc_communications_with_playable > 0
			}
		}
	}
}

# Node Reformatting
tech_node_reformatting_1 = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { statecraft }
	prerequisites = { "tech_colonial_centralization" }
	weight = @tier2weight3

	potential = {
		is_machine_empire = yes
	}

	gateway = node_reformatting

	prereqfor_desc = {
		custom = {
			title = "AGENDA_UNLOCK_NODE_REFORMATTING_TITLE"
			desc = "AGENDA_UNLOCK_NODE_REFORMATTING_DESC"
		}
	}

	weight_modifier = {
		modifier = {
			factor = 0.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill < 2
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 3
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 5
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 7
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 9
			}
		}
	}

	ai_weight = {

	}
}

tech_node_reformatting_2 = {
	cost = @tier3cost3
	area = society
	tier = 3
	category = { statecraft }
	prerequisites = { "tech_node_reformatting_1" }
	weight = @tier3weight3

	potential = {
		is_machine_empire = yes
	}

	modifier = {
		restored_node_bonus_skill = 2
		councilor_exp_gain = 0.25
	}

	weight_modifier = {
		modifier = {
			factor = 0.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill < 4
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 5
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 7
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 9
			}
		}
	}

	ai_weight = {

	}
}

tech_node_reformatting_3 = {
	cost = @tier4cost3
	area = society
	tier = 4
	category = { statecraft }
	prerequisites = { "tech_node_reformatting_2" }
	weight = @tier4weight3
	is_rare = yes

	potential = {
		is_machine_empire = yes
	}

	modifier = {
		restored_node_bonus_skill = 2
		councilor_skill_add = 1
	}

	weight_modifier = {
		modifier = {
			factor = 0.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill < 6
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 7
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 9
			}
		}
		modifier = {
			factor = 0.25
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_statecraft }
				has_trait_in_council = { TRAIT = leader_trait_curator }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_node_reformatting_3
		}
	}

	ai_weight = {

	}
}

# Node Culling
tech_node_culling_1 = {
	cost = @tier2cost3
	area = society
	tier = 2
	category = { statecraft }
	prerequisites = { "tech_colonial_centralization" }
	weight = @tier2weight3

	potential = {
		is_hive_empire = yes
	}

	gateway = node_culling

	prereqfor_desc = {
		custom = {
			title = "AGENDA_UNLOCK_NODE_CULLING_TITLE"
			desc = "AGENDA_UNLOCK_NODE_CULLING_DESC"
		}
	}

	technology_swap = {
		name = tech_node_culling_1_cloning
		inherit_icon = yes
		inherit_effects = no
		trigger = {
			is_cloning_authority = yes
		}

		prereqfor_desc = {
			custom = {
			title = "AGENDA_UNLOCK_NODE_CULLING_TITLE"
			desc = "AGENDA_UNLOCK_NODE_CULLING_DESC"
			}
		}

		prereqfor_desc = {
			custom = {
				title = "REDUCED_CLONE_DEGRADATION_TITLE"
				desc = "REDUCED_CLONE_DEGRADATION_DESC"
			}
		}
	}

	weight_modifier = {
		modifier = {
			factor = 0.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill < 2
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 3
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 5
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 7
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 9
			}
		}
		modifier = {
			factor = 2
			is_cloning_authority = yes
		}
	}

	ai_weight = {

	}
}

tech_node_culling_2 = {
	cost = @tier3cost3
	area = society
	tier = 3
	category = { statecraft }
	prerequisites = { "tech_node_culling_1" }
	weight = @tier3weight3

	potential = {
		is_hive_empire = yes
	}

	modifier = {
		restored_node_bonus_skill = 2
		councilor_exp_gain = 0.25
	}

	weight_modifier = {
		modifier = {
			factor = 0.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill < 4
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 5
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 7
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 9
			}
		}
	}

	ai_weight = {

	}
}

tech_node_culling_3 = {
	cost = @tier4cost3
	area = society
	tier = 4
	category = { statecraft }
	prerequisites = { "tech_node_culling_2" }
	weight = @tier4weight3
	is_rare = yes

	potential = {
		is_hive_empire = yes
	}

	modifier = {
		restored_node_bonus_skill = 2
		councilor_skill_add = 1
	}

	weight_modifier = {
		modifier = {
			factor = 0.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill < 6
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 7
			}
		}
		modifier = {
			factor = 1.5
			any_owned_leader = {
				is_councilor = yes
				is_ruler = no
				has_base_skill >= 9
			}
		}
		modifier = {
			factor = 0.25
			NOR = {
				has_trait_in_council = { TRAIT = leader_trait_expertise_statecraft }
				has_trait_in_council = { TRAIT = leader_trait_curator }
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_node_culling_3
		}
	}

	ai_weight = {

	}
}

# ##################
# Bio Reactor
# ##################
tech_bio_reactor = {
	cost = @tier1cost1
	area = society
	tier = 1
	category = { biology }
	prerequisites = { "tech_industrial_farming" }
	weight = @tier1weight1
	is_rare = yes

	potential = {
		is_wilderness_empire = no
	}

	weight_modifier = {
		factor = 0.1
		modifier = {
			factor = 20
			OR = {
				is_catalytic_empire = yes
				is_machine_empire = yes
				is_mechanical_empire = yes
				is_lithoid_empire = yes
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_bio_reactor
		}
	}

	ai_weight = {

	}
}

tech_bio_reactor_2 = {
	cost = @tier2cost1
	area = society
	tier = 2
	category = { biology }
	prerequisites = { "tech_bio_reactor" }
	weight = @tier2weight1
	is_rare = yes

	potential = {
		is_wilderness_empire = no
	}

	weight_modifier = {
		factor = 0.1
		modifier = {
			factor = 20
			OR = {
				is_catalytic_empire = yes
				is_machine_empire = yes
				is_mechanical_empire = yes
				is_lithoid_empire = yes
			}
		}
		inline_script = {
			script = technologies/rare_technologies_weight_modifiers
			TECHNOLOGY = tech_bio_reactor_2
		}
	}

	ai_weight = {

	}
}
