
is_valid_xenophilia_refugee_pop = {	
	has_pop_group_flag = cc_literally_xenophile_manifested
	is_robot_pop = no
	has_culture_shock = no
	NOR = {
		has_trait = trait_hive_mind 
		has_trait = trait_nerve_stapled
	}
	owner = {
		any_relation = {
			is_country_type = default
			NOT = { has_policy_flag = refugees_not_allowed }
			has_policy_flag = allows_im
			prevprev = { #this ensures Pop scope, as root will not always be pop scope
				OR = { 
					has_citizenship_type = { type = citizenship_full country = prev }
					AND = {
						has_citizenship_type = { type = citizenship_limited country = prev }
						prev = { has_policy_flag = refugees_allowed }
					}
				}
			}
			any_owned_planet = {
				is_under_colonization = no
				is_controlled_by = owner
				has_orbital_bombardment = no
			}
		}
	}
}



has_political_colony_modifier = {
	OR = {
		has_modifier = cc_colony_distrusts
		has_modifier = cc_planet_oppression
		any_owned_pop_group = { has_modifier = cc_lingering_oppression }
		any_owned_pop_group = { has_modifier = cc_oppression }
		has_modifier = cc_breakaway_sympathy
		has_modifier = cc_faction_acute_unrest
		
		has_modifier = cc_founder_spiritualist
		has_modifier = cc_minor_protests_spiritualist
		has_modifier = cc_major_protests_spiritualist
		has_modifier = cc_spiritualist_leader_visit
		has_modifier = cc_building_mausoleum
		has_modifier = cc_minor_mausoleum
		has_modifier = cc_religious_centre
		has_modifier = cc_founders_memory_disrespected_1_spiritualist
		has_modifier = cc_founders_memory_disrespected_2_spiritualist
		has_modifier = cc_underground_spiritualist_movement_1
		has_modifier = cc_underground_spiritualist_movement_2
		has_modifier = cc_spiritualist_protectorate
		has_modifier = cc_spiritualists_offended
		has_modifier = cc_famous_guru

		has_modifier = cc_colony_direct_democracy
		has_modifier = cc_colony_democracy_unhappy
		has_modifier = cc_minor_protests_egalitarian
		has_modifier = cc_major_protests_egalitarian
		has_modifier = cc_underground_egalitarian_movement_1
		has_modifier = cc_underground_egalitarian_movement_2
		has_modifier = cc_university
		has_modifier = cc_founder_materialist

		has_modifier = cc_minor_protests_materialist
		has_modifier = cc_major_protests_materialist
		has_modifier = cc_underground_materialist_movement_1
		has_modifier = cc_underground_materialist_movement_2
		has_modifier = cc_building_university
		has_modifier = cc_founders_memory_disrespected_1_materialist
		has_modifier = cc_materialists_offended

		has_modifier = cc_colony_monarchy
		has_modifier = cc_colony_monarchy_unhappy
		has_modifier = cc_minor_protests_authoritarian
		has_modifier = cc_major_protests_authoritarian
		has_modifier = cc_underground_authoritarian_movement_1
		has_modifier = cc_underground_authoritarian_movement_2
		
		has_modifier = cc_founder_militarist
		has_modifier = cc_minor_protests_militarist
		has_modifier = cc_major_protests_militarist
		has_modifier = cc_underground_militarist_movement_1
		has_modifier = cc_underground_militarist_movement_2
		has_modifier = cc_militarists_offended
		has_modifier = cc_milacademy_built_faction
		has_modifier = cc_building_milacademy
		has_modifier = cc_milacademy
		has_modifier = cc_founders_memory_disrespected_1_militarist
		has_modifier = cc_militarist_influence

		has_modifier = cc_founder_pacifist
		has_modifier = cc_minor_protests_pacifist
		has_modifier = cc_major_protests_pacifist
		has_modifier = cc_pacifist_leader_visit
		has_modifier = cc_building_pacmonument
		has_modifier = cc_minor_pacmonument
		has_modifier = cc_pacifist_centre
		has_modifier = cc_founders_memory_disrespected_1_pacifist
		has_modifier = cc_founders_memory_disrespected_2_pacifist
		has_modifier = cc_underground_pacifist_movement_1
		has_modifier = cc_underground_pacifist_movement_2
		has_modifier = cc_pacifist_protectorate
		has_modifier = cc_pacifists_offended
		

		has_modifier = cc_building_xenophobe_institute
		has_modifier = cc_xenophobe_institute
		has_modifier = cc_minor_xenophobe_institute
		has_modifier = cc_xenophobe_martyr
		has_modifier = cc_xenophobe_hero
		has_modifier = cc_founder_xenophobe
		has_modifier = cc_minor_protests_xenophobe
		has_modifier = cc_major_protests_xenophobe
		has_modifier = cc_underground_xenophobe_movement_1
		has_modifier = cc_underground_xenophobe_movement_2
		has_modifier = cc_xenophobes_offended
		has_modifier = cc_founders_memory_disrespected_1_xenophobe
		has_modifier = cc_founders_memory_disrespected_2_xenophobe
		
		
		has_modifier = cc_founder_xenophile
		has_modifier = cc_minor_protests_xenophile
		has_modifier = cc_major_protests_xenophile
		has_modifier = cc_underground_xenophile_movement_1
		has_modifier = cc_underground_xenophile_movement_2
		has_modifier = cc_xenophiles_offended
		has_modifier = cc_building_xenophile_institute
		has_modifier = cc_xenophile_institute
		has_modifier = cc_founders_memory_disrespected_1_xenophile
		has_modifier = cc_founders_memory_disrespected_2_xenophile
	}
}

is_evil_empire = {
	OR = {
		has_valid_civic = civic_fanatic_purifiers
		has_ethic = ethic_fanatic_authoritarian
		AND = {
			has_ethic = ethic_authoritarian
			OR = {
				has_ethic = ethic_fanatic_xenophobe
				has_ethic = ethic_fanatic_militarist
				AND = {
					has_ethic = ethic_xenophobe
					has_ethic = ethic_militarist
				}
			}
		}
		AND = {
			has_ethic = ethic_fanatic_xenophobe
			NOR = {
				has_ethic = ethic_pacifist
				has_ethic = ethic_egalitarian
			}
		}
		AND = {
			has_ethic = ethic_xenophobe
			OR = {
				has_ethic = ethic_fanatic_militarist
				AND = {
					has_ethic = ethic_authoritarian
					has_ethic = ethic_militarist
				}
			}
		}
	}
}



dpe_talent_flavour_scientist_university = {
	has_country_flag = dpe_talent_cc_university
}

dpe_talent_flavour_scientist_default = {
	has_country_flag = dpe_talent_scientist_default
}

dpe_talent_flavour_general_academy = {
	has_country_flag = dpe_talent_cc_milacademy
}

dpe_talent_flavour_general_default = {
	has_country_flag = dpe_talent_general_default
}

dpe_talent_flavour_governor_royal = {
	has_country_flag = dpe_talent_cc_colony_monarchy
}

dpe_talent_flavour_governor_democracy = {
	has_country_flag = dpe_talent_cc_colony_direct_democracy
}

dpe_talent_flavour_governor_default = {
	has_country_flag = dpe_talent_governor_default
}

dpe_talent_scientist_has_speciality = {
	OR = {
		has_trait_tier1or2or3 = { TRAIT = leader_trait_expertise_materials }
		has_trait_tier1or2or3 = { TRAIT = leader_trait_expertise_propulsion }
		has_trait_tier1or2or3 = { TRAIT = leader_trait_expertise_voidcraft }
		has_trait_tier1or2or3 = { TRAIT = leader_trait_expertise_industry }
		has_trait_tier1or2or3 = { TRAIT = leader_trait_expertise_field_manipulation }
		has_trait_tier1or2or3 = { TRAIT = leader_trait_expertise_particles }
		has_trait_tier1or2or3 = { TRAIT = leader_trait_expertise_computing }
		has_trait_tier1or2or3 = { TRAIT = leader_trait_expertise_psionics }
		has_trait_tier1or2or3 = { TRAIT = leader_trait_expertise_new_worlds }
		has_trait_tier1or2or3 = { TRAIT = leader_trait_expertise_statecraft }
		has_trait_tier1or2or3 = { TRAIT = leader_trait_expertise_biology }
		has_trait_tier1or2or3 = { TRAIT = leader_trait_expertise_military_theory }
	}
}

dpe_talent_scientist_materials = {
	has_country_flag = dpe_talent_expertise_materials
}
dpe_talent_scientist_propulsion = {
	has_country_flag = dpe_talent_expertise_propulsion
}
dpe_talent_scientist_voidcraft = {
	has_country_flag = dpe_talent_expertise_voidcraft
}
dpe_talent_scientist_industry = {
	has_country_flag = dpe_talent_expertise_industry
}
dpe_talent_scientist_field_manipulation = {
	has_country_flag = dpe_talent_expertise_field_manipulation
}
dpe_talent_scientist_particles = {
	has_country_flag = dpe_talent_expertise_particles
}
dpe_talent_scientist_computing = {
	has_country_flag = dpe_talent_expertise_computing
}
dpe_talent_scientist_psionics = {
	has_country_flag = dpe_talent_expertise_psionics
}
dpe_talent_scientist_new_worlds = {
	has_country_flag = dpe_talent_expertise_new_worlds
}
dpe_talent_scientist_statecraft = {
	has_country_flag = dpe_talent_expertise_statecraft
}
dpe_talent_scientist_biology = {
	has_country_flag = dpe_talent_expertise_biology
}
dpe_talent_scientist_military_theory = {
	has_country_flag = dpe_talent_expertise_military_theory
}


dpe_is_governor = { leader_class = official }
dpe_is_scientist = { leader_class = scientist }
