#this = species, from = country
can_do_advanced_gene_modding = {
	hidden_trigger = { exists = from }
	from = {
		if = {
			limit = {
				OR = {
					has_biogenesis_dlc = no
					has_tradition = tr_genetics_adopt
				}
			}
			has_tradition = tr_genetics_enhanced_expression
		}
		else = {
			OR = {
				has_tradition = tr_purity_exemplary_genetics
				has_tradition = tr_cloning_somatic_synthesization
				has_tradition = tr_mutation_unnatural_selection
			}
		}
	}
}

owner_can_do_advanced_gene_modding = {
	owner = {
		OR = {
			has_tradition = tr_genetics_enhanced_expression
			has_tradition = tr_purity_exemplary_genetics
			has_tradition = tr_cloning_somatic_synthesization
			has_tradition = tr_mutation_unnatural_selection
		}
	}
}

advanced_traits_have_reduced_cost = {
	has_tradition = tr_purity_exemplary_genetics
}

can_add_negative_organic_traits = {
	hidden_trigger = { exists = from }
	from = {
		if = {
			limit = {
				OR = {
					has_biogenesis_dlc = no
					has_tradition = tr_genetics_adopt
				}
			}
			has_tradition = tr_genetics_resequencing
		}
		else = {
			OR = {
				has_tradition = tr_purity_genotype_regeneration
				has_tradition = tr_mutation_unnatural_selection
			}
		}
	}
}

#this = species, from = country
can_remove_vocational_genetic_traits = {
	hidden_trigger = { exists = from }
	from = {
		has_technology = tech_gene_expressions
	}
}

#this = species, from = country
can_remove_beneficial_genetic_traits = {
	hidden_trigger = { exists = from }
	from = {
		if = {
			limit = {
				OR = {
					has_biogenesis_dlc = no
					has_tradition = tr_genetics_adopt
				}
			}
			has_tradition = tr_genetics_resequencing
		}
		else = {
			has_tradition = tr_purity_genotype_regeneration
		}
	}
}

#this = species, from = country
can_remove_presapient_genetic_traits = {
	hidden_trigger = { exists = from }
	from = {
		OR = {
			has_technology = tech_epigenetic_triggers
			if = {
				limit = {
					OR = {
						has_biogenesis_dlc = no
						has_tradition = tr_genetics_adopt
					}
				}
				has_tradition = tr_genetics_resequencing
			}
			else = {
				has_tradition = tr_purity_genotype_regeneration
			}
		}
	}
}

#this = species, from = country
can_add_overtuned_traits = {
	hidden_trigger = { exists = from }
	from = { has_origin = origin_overtuned }
}

#this = species, from = country
can_remove_overtuned_traits = {
	hidden_trigger = { exists = from }
	from = {
		OR = {
			has_origin = origin_overtuned
			if = {
				limit = {
					OR = {
						has_biogenesis_dlc = no
						has_tradition = tr_genetics_adopt
					}
				}
				has_tradition = tr_genetics_resequencing
			}
			else = {
				has_tradition = tr_purity_genotype_regeneration
			}
		}
	}
}

#this = species, from = country
can_add_mutation_traits = {
	hidden_trigger = { exists = from }
	from = {
		has_tradition = tr_mutation_adopt
	}
}

#this = species, from = country
can_add_or_remove_phenotype_traits = {
	hidden_trigger = { exists = from }
	from = {
		has_tradition = tr_mutation_unnatural_selection
	}
}

#this = species, from = country
can_add_or_remove_special_traits = {
	hidden_trigger = { exists = from }
	from = {
		has_mutation_nucleotide_isolation_tradition = yes
	}
}

#this = species, from = country
can_add_auto_preference_traits = {
	hidden_trigger = { exists = from }
	from = {
		has_mutation_environmental_integration_tradition = yes
	}
}

#this = species, from = country
can_add_cloning_traits = {
	hidden_trigger = { exists = from }
	from = {
		has_active_tradition = tr_cloning_somatic_synthesization_clone_army
	}
}

#this = species, from = country
can_remove_pop_growth_genetic_traits = {
	hidden_trigger = { exists = from }
	from = {
		OR = {
			has_active_tradition = tr_cloning_somatic_synthesization
			has_active_tradition = tr_cloning_somatic_synthesization_clone_army
		}
	}
}

#this = species, from = country
can_add_transgenic_traits = {
	exists = from
	from = {
		has_tradition = tr_genetics_finish
		has_tradition = tr_genetics_enhanced_expression
	}
}

#this = species, from = country
can_add_or_remove_leviathan_traits = {
	hidden_trigger = { exists = from }
	from = {
		if = {
			limit = {
				OR = {
					has_biogenesis_dlc = no
					has_tradition = tr_genetics_adopt
				}
			}
			has_tradition = tr_genetics_finish
			has_tradition = tr_genetics_enhanced_expression
		}
		else = {
			has_mutation_nucleotide_isolation_tradition = yes
		}
	}
}

#this = species, from = country
has_harvested_radiotrophic_dna = {
	exists = from
	from = {
		has_country_flag = harvested_radiotrophic_dna
	}
}

#this = species, from = country
can_change_habitability_preference = {
	hidden_trigger = { exists = from }
	custom_tooltip = {
		text = requires_technology_glandular_acclimation
		from = {
			has_technology = tech_glandular_acclimation
		}
	}
}

#this = species, from = country
can_take_non_ocean_planet_preference = {
	custom_tooltip = {
		fail_text = trait_aquatic_requires_ocean_preference
		NOT = { has_trait = trait_aquatic }
	}
}

#this = species, from = country
can_add_cybernetic_traits = {
	hidden_trigger = { exists = from }
	has_trait = trait_cybernetic
	custom_tooltip = {
		text = requires_tr_cybernetics_integrated_anatomy
		from = {
			OR = {
				has_active_tradition = tr_cybernetics_integrated_anatomy
				has_active_tradition = tr_cybernetics_assimilator_integrated_anatomy
			}
		}
	}
}

#this = species, from = country
can_add_unplugged_traits = {
	hidden_trigger = { exists = from }
	has_unplugged_positive_trait = yes
	from = {
		has_origin = origin_unplugged
	}
}

can_add_aug_bazaar_traits = {
	hidden_trigger = { exists = from }
	from = {
		has_valid_civic = civic_augmentation_bazaars
	}
}

#this = species, from = country
can_remove_cybernetic_traits = {
	hidden_trigger = { exists = from }
	custom_tooltip = {
		text = requires_tr_cybernetics_integrated_anatomy
		from = {
			OR = {
				has_active_tradition = tr_cybernetics_integrated_anatomy
				has_active_tradition = tr_cybernetics_assimilator_integrated_anatomy
			}
		}
	}
}

#this = species, from = country
can_remove_unplugged_traits = {
	hidden_trigger = { exists = from }
	custom_tooltip = {
		from = {
			has_origin = origin_unplugged
		}
	}
}

#this = species, from = country
can_add_genetic_traits = {
	hidden_trigger = { exists = from }
	custom_tooltip = {
		text = requires_tech_gene_tailoring
		from = {
			has_technology = tech_gene_tailoring
		}
	}
}

#this = species, from = country
can_add_droid_traits = {
	hidden_trigger = { exists = from }
	from = {
		has_technology = tech_droid_workers
		NOT = { has_policy_flag = ai_outlawed }
	}
}

#this = species, from = country
can_add_synth_traits = {
	hidden_trigger = { exists = from }
	from = {
		has_technology = tech_synthetic_workers
		NOT = { has_policy_flag = ai_outlawed }
	}
}

#this = species, from = country
owner_is_machine_intelligence = {
	hidden_trigger = { exists = from }
	from = {
		is_machine_empire = yes
	}
}

#this = species, from = country
owner_is_individual_machine = {
	hidden_trigger = { exists = from }
	from = {
		is_individual_machine = yes
	}
}

#this = species, from = country
owner_is_hive_empire = {
	hidden_trigger = { exists = from }
	from = {
		is_hive_empire = yes
	}
}

#this = species, from = country
can_do_advanced_robo_modding = {
	hidden_trigger = { exists = from }
	from = {
		OR = {
			has_tradition = tr_modularity_5
			has_country_flag = synth_physical
		}
	}
}

can_harvest_dna = {
	# Only regular empires and hive-minds can genetically ascend.
	is_machine_empire = no
	# If you've taken other ascension path, we shouldn't let you harvest DNA anymore.
	NOR = {
		has_cybernetic_ascension = yes
		has_psionic_ascension = yes
		has_synthetic_ascension = yes
		has_country_flag = genetic_ascension_stage_3_purity
		has_country_flag = genetic_ascension_stage_3_cloning
	}
}

can_harvest_parts = {
	has_machine_age_dlc = yes
	OR = {
		has_technology = tech_neuro_quantum_links
		has_technology = tech_synthetic_workers
		has_technology = tech_binary_motivators
	}
	# Only machine empires and cyborgs can use mechanical leviathan parts.
	OR = {
		has_active_tradition = tr_cybernetics_integrated_anatomy
		has_active_tradition = tr_cybernetics_assimilator_integrated_anatomy
		is_synthetic_empire = yes
	}
	# If you've taken another ascension path, we shouldn't let you harvest parts anymore.
	NOR = {
		has_genetic_ascension = yes
		has_psionic_ascension = yes
	}
}

is_phototrophic = {
	OR = {
		has_trait = trait_plantoid_phototrophic
		has_trait = trait_plantoid_radiotrophic
	}
}

has_phototrophic_energy_upkeep = {
	OR = {
		has_trait = trait_plantoid_phototrophic
		AND = {
			has_trait = trait_plantoid_radiotrophic
			NOT = { planet = { is_planet_class = pc_nuked } }
		}
	}
}

has_budding_trait = {
	OR = {
		has_trait = trait_plantoid_budding
		has_trait = trait_lithoid_budding
	}
}

empire_has_good_habitability_on_tomb_worlds = {
	OR = {
		is_lithoid = yes
		has_trait = trait_survivor
		has_trait = trait_robot_survivor
		has_trait = trait_pc_nuked_preference
		has_trait = trait_plantoid_radiotrophic
		has_trait = trait_cybernetic
		has_trait = trait_mechanical
		has_trait = trait_machine_unit
	}
}

has_infertile_clone_soldier_trait = {
	OR = {
		has_trait = trait_clone_soldier_infertile
		has_trait = trait_clone_soldier_infertile_full_potential
	}
}

is_latent_psionic_species = {
	OR = {
		has_trait = trait_latent_psionic
		has_trait = trait_robot_latent_psionic
	}
}

is_psionic_species = {
	OR = {
		has_trait = trait_psionic
		has_trait = trait_robot_psionic
	}
}

has_psionic_species_trait = {
	OR = {
		is_latent_psionic_species = yes
		is_psionic_species = yes
		has_trait = trait_shroud_forged
	}
}

has_aquatic_trait = {
	OR = {
		has_trait = trait_aquatic
		has_trait = trait_robot_aquatic
	}
}

has_virtual_species_trait = {
	OR = {
		has_trait = trait_robot_digital_1
		has_trait = trait_robot_digital_2
	}
}

is_slave_or_better = {
	OR = {
		is_pop_category = ruler
		is_pop_category = specialist
		is_pop_category = worker
		is_pop_category = civilian
		is_pop_category = complex_drone
		is_pop_category = simple_drone
		is_enslaved = yes
		is_robot_servant = yes
		is_pop_category = bio_trophy
		is_pop_category = chip_slave
		is_pop_category = maintenance_drone
		is_pop_category = wilderness_heart_strata
		is_pop_category = cruise_passenger
		is_pop_category = cruise_passenger_unemployment
		is_pop_category = precursor
	}
}

# Check for a specific range of Cyborg traits, as used in script value 'num_cyborg_traits_species'. SEE ALSO 'is_cyborg_empire' (scripted trigger).
has_cyborg_trait = {
	OR = {
		has_trait = trait_cyborg_power_drills
		has_trait = trait_cyborg_harvesters
		has_trait = trait_cyborg_superconductive
		has_trait = trait_cyborg_efficient_processors
		has_trait = trait_cyborg_logic_engines
		has_trait = trait_cyborg_loyalty_circuits
		has_trait = trait_cyborg_double_jointed
		has_trait = trait_cyborg_bulky
		has_trait = trait_cyborg_enhanced_memory
		has_trait = trait_cyborg_durable
		has_trait = trait_cyborg_high_maintenance
		has_trait = trait_cyborg_learning_algorithms
		has_trait = trait_cyborg_power_intensive
		has_trait = trait_cyborg_neural_limiters
		has_trait = trait_cyborg_streamlined_protocols
		has_trait = trait_cyborg_high_bandwidth
		has_trait = trait_cyborg_trading_algorithms
		has_trait = trait_cyborg_scarcity_algorithms
		has_trait = trait_cyborg_stainless_steel_smile
		has_trait = trait_cyborg_welded_countenance
		has_trait = trait_cyborg_apathy_loops
		has_trait = trait_cyborg_bionic_engineers
		has_trait = trait_cyborg_bionic_physicists
		has_trait = trait_cyborg_bionic_sociologists
		has_trait = trait_cyborg_integrated_weaponry
		has_trait = trait_cyborg_delicate_frames
		has_trait = trait_cyborg_limited_memory
		has_trait = trait_cyborg_climate_adjustment_dry
		has_trait = trait_cyborg_climate_adjustment_wet
		has_trait = trait_cyborg_climate_adjustment_cold
		has_trait = trait_cyborg_ancient_dreadnought
		has_trait = trait_cyborg_enigmatic_fortress
		has_trait = trait_cyborg_infinity_sphere
		has_trait = trait_cyborg_scavenger_bot
		has_trait = trait_cyborg_creed_of_construction
		has_trait = trait_cyborg_creed_of_war
		has_trait = trait_cyborg_creed_of_research
		has_trait = trait_cyborg_creed_of_labor
		has_trait = trait_cyborg_ritualistic_implants
		# Hard Reset
		has_unplugged_positive_trait = yes
		has_unplugged_negative_trait = yes
		has_trait = trait_unplugged_neurocalmed
		has_trait = trait_unplugged_neurosavant
		has_trait = trait_unplugged_regenoptimized
	}
}

is_homeworld_or_lost_colony = {
	OR = {
		is_homeworld = yes
		has_modifier = colonial_spirit_mod
	}
}

has_unplugged_positive_trait = {
	OR = {
		has_trait = trait_unplugged_cybernetic_positives_1
		has_trait = trait_unplugged_cybernetic_positives_2
		has_trait = trait_unplugged_cybernetic_positives_3
	}
}

has_unplugged_negative_trait = {
	OR = {
		has_trait = trait_unplugged_cybernetic_negatives_1
		has_trait = trait_unplugged_cybernetic_negatives_2
		has_trait = trait_unplugged_cybernetic_negatives_3
	}
}

has_conformists_thrifty_or_traditional_trait = {
	OR = {
		has_trait = trait_conformists
		has_trait = trait_thrifty
		has_trait = trait_traditional
	}
}
