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

	modifier = {
		planet_farmers_food_produces_mult = 0.2
		starbase_constructions_food_produces_mult = 0.10
	}

	weight_modifier = {
		modifier = {
			factor = 0.01
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_individual_machine = yes
				has_origin = origin_synthetic_fertility
			}
			NOR = {
				has_country_flag = non_lithoid_subspecies
				has_valid_civic = civic_machine_servitor
				OR = { 
                    has_valid_civic = civic_machine_assimilator
                    has_ascension_perk = ap_organo_machine_interfacing_assimilator
                }
				any_owned_planet = {
					OR = {
						num_districts = { type = district_farming value > 0 }
						num_districts = { type = district_rw_farming value > 0 }
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			OR = {
				is_machine_empire = yes
				is_lithoid_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
		}
	}

	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.2
		starbase_constructions_food_produces_mult = 0.10
	}

	weight_modifier = {
		modifier = {
			factor = 0.01
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_individual_machine = yes
				has_origin = origin_synthetic_fertility
			}
			NOR = {
				has_country_flag = non_lithoid_subspecies
				has_valid_civic = civic_machine_servitor
				OR = { 
                    has_valid_civic = civic_machine_assimilator
                    has_ascension_perk = ap_organo_machine_interfacing_assimilator
                }
				any_owned_planet = {
					OR = {
						num_districts = { type = district_farming value > 0 }
						num_districts = { type = district_rw_farming value > 0 }
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			OR = {
				is_machine_empire = yes
				is_lithoid_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
		}
	}

	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.2
		starbase_constructions_food_produces_mult = 0.10
	}

	weight_modifier = {
		modifier = {
			factor = 0.01
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_individual_machine = yes
				has_origin = origin_synthetic_fertility
			}
			NOR = {
				has_country_flag = non_lithoid_subspecies
				has_valid_civic = civic_machine_servitor
				OR = { 
                    has_valid_civic = civic_machine_assimilator
                    has_ascension_perk = ap_organo_machine_interfacing_assimilator
                }
				any_owned_planet = {
					OR = {
						num_districts = { type = district_farming value > 0 }
						num_districts = { type = district_rw_farming value > 0 }
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			OR = {
				is_machine_empire = yes
				is_lithoid_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
		}
	}

	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_jobs_food_produces_mult = 0.15
		starbase_constructions_food_produces_mult = 0.10
	}

	potential = {
		NOT = { has_authority = auth_machine_intelligence }
	}

	weight_modifier = {
		modifier = {
			factor = 0.01
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_individual_machine = yes
				has_origin = origin_synthetic_fertility
			}
			NOR = {
				has_country_flag = non_lithoid_subspecies
				has_valid_civic = civic_machine_servitor
				OR = { 
                    has_valid_civic = civic_machine_assimilator
                    has_ascension_perk = ap_organo_machine_interfacing_assimilator
                }
				any_owned_planet = {
					OR = {
						num_districts = { type = district_farming value > 0 }
						num_districts = { type = district_rw_farming value > 0 }
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			OR = {
				is_machine_empire = yes
				is_lithoid_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
		}
	}

	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 = @tier1cost1
	area = society
	tier = 1
	category = { biology }
	prerequisites = { "tech_industrial_farming" }
	weight = @tier1weight1

	# unlock hydroponics buildings

	weight_modifier = {
		factor = 2
		modifier = {
			factor = 0.01
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_individual_machine = yes
				has_origin = origin_synthetic_fertility
			}
			NOR = {
				has_country_flag = non_lithoid_subspecies
				has_valid_civic = civic_machine_servitor
				OR = { 
                    has_valid_civic = civic_machine_assimilator
                    has_ascension_perk = ap_organo_machine_interfacing_assimilator
                }
				any_owned_planet = {
					OR = {
						num_districts = { type = district_farming value > 0 }
						num_districts = { type = district_rw_farming value > 0 }
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				AND = {
					is_individual_machine = yes
					NOT = { has_country_flag = non_lithoid_subspecies }
				}
			}
		}
		modifier = {
			factor = 2
			has_relic = r_pox_sample
		}
	}

	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

	weight_modifier = {
		modifier = {
			factor = 0.01
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_individual_machine = yes
				has_origin = origin_synthetic_fertility
			}
			NOR = {
				has_country_flag = non_lithoid_subspecies
				has_valid_civic = civic_machine_servitor
				OR = { 
                    has_valid_civic = civic_machine_assimilator
                    has_ascension_perk = ap_organo_machine_interfacing_assimilator
                }
				any_owned_planet = {
					OR = {
						num_districts = { type = district_farming value > 0 }
						num_districts = { type = district_rw_farming value > 0 }
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				AND = {
					is_individual_machine = yes
					NOT = { has_country_flag = non_lithoid_subspecies }
				}
			}
		}
		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

	weight_modifier = {
		factor = 2
		modifier = {
			factor = 0.01
			OR = {
				is_machine_empire = yes
				is_lithoid_empire = yes
				is_individual_machine = yes
				has_origin = origin_synthetic_fertility
			}
			NOR = {
				has_country_flag = non_lithoid_subspecies
				has_valid_civic = civic_machine_servitor
				OR = { 
                    has_valid_civic = civic_machine_assimilator
                    has_ascension_perk = ap_organo_machine_interfacing_assimilator
                }
				any_owned_planet = {
					OR = {
						num_districts = { type = district_farming value > 0 }
						num_districts = { type = district_rw_farming value > 0 }
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			OR = {
				is_machine_empire = yes
				is_lithoid_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
		}
	}

	ai_weight = {
		factor = @farming_building_ai_weight_factor # food processing

		modifier = {
			factor = 0
			country_uses_food = no
		}
	}
}
#Genome Mapping
tech_genome_mapping = {
	cost = @tier1cost1
	area = society
	tier = 1
	category = { biology }
	weight = @tier1weight1

	gateway = biological

	modifier = {
		pop_growth_speed = 0.10
	}

	potential = {
		OR = {
			NOT = { has_authority = auth_machine_intelligence }
			OR = { 
                    has_civic = civic_machine_assimilator
                    has_ascension_perk = ap_organo_machine_interfacing_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
			has_authority = auth_hive_mind
		}
		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
				}
			}
		}
	}

	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 = {
			NOT = { has_authority = auth_machine_intelligence }
			OR = { 
                    has_civic = civic_machine_assimilator
                    has_ascension_perk = ap_organo_machine_interfacing_assimilator
            }
		}
	}

	weight_modifier = {
		factor = 1.5	# genetech needs to be a bit more common
		modifier = {
			factor = 1.25
			has_authority = auth_hive_mind
		}
		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
			#has_valid_civic = civic_machine_terminator # covered by not being machine
			#has_valid_civic = civic_hive_devouring_swarm # can uplift to make delicious
			is_natural_design_empire = yes
		}
		OR = {
			NOT = { has_authority = auth_machine_intelligence }
			OR = { 
                    has_civic = civic_machine_assimilator
                    has_ascension_perk = ap_organo_machine_interfacing_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 = {
						is_sapient = no
					}
				}
			}
		}
	}

	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

	modifier = {
		pop_growth_speed = 0.10
	}

	potential = {
		OR = {
			NOT = { has_authority = auth_machine_intelligence }
			OR = { 
                    has_civic = civic_machine_assimilator
                    has_ascension_perk = ap_organo_machine_interfacing_assimilator
            }
		}
		is_natural_design_empire = no
	}

	weight_modifier = {
		factor = 1.5	# genetech needs to be a bit more common
		modifier = {
			factor = 1.25
			has_authority = auth_hive_mind
		}
		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 = {
			NOT = { has_authority = auth_machine_intelligence }
			OR = { 
                    has_civic = civic_machine_assimilator
                    has_ascension_perk = ap_organo_machine_interfacing_assimilator
            }
		}
		is_natural_design_empire = no
	}

	weight_modifier = {
		factor = 0.5
		modifier = {
			factor = 1.25
			has_authority = auth_hive_mind
		}
		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
		}
	}
}

#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
	}

	potential = {
		OR = {
			NOT = { has_authority = auth_machine_intelligence }
			OR = { 
                    has_civic = civic_machine_assimilator
                    has_ascension_perk = ap_organo_machine_interfacing_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
			has_authority = auth_hive_mind
		}
		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
				}
			}
		}
	}

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

# 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 = {
			NOT = { has_authority = auth_machine_intelligence }
			OR = { 
                    has_civic = civic_machine_assimilator
                    has_ascension_perk = ap_organo_machine_interfacing_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
			has_authority = auth_hive_mind
		}
		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
		}
	}
}

#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"
		}
	}

	potential = {
		OR = {
			NOR = {
				has_authority = auth_machine_intelligence
				is_individual_machine = yes
			}
			OR = { 
                    has_civic = civic_machine_assimilator
                    has_ascension_perk = ap_organo_machine_interfacing_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
			has_authority = auth_hive_mind
		}
		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 = {
	}
}
