#added this as a buff to Authoritarians, as this and PRE make it very difficult for them

namespace = cc_thought_police


#Thought Police
pop_group_event = {
	id = cc_thought_police.10
	hide_window = yes
	is_triggered_only = yes
	# mean_time_to_happen = { years = 30 }

	trigger = {
		is_enslaved = no
		happiness < 0.4
		owner? = { has_edict = cc_thought_police }
		if = {
			limit = { owner = { NOT = { has_valid_civic = civic_fanatic_purifiers } } }
			NOT = { has_ethic = ethic_authoritarian }
		}
		if = {
			limit = { owner = { has_ethic = ethic_spiritualist } }
			NOT = { has_ethic = ethic_spiritualist }
		}
		if = {
			limit = { owner = { has_ethic = ethic_materialist } }
			NOT = { has_ethic = ethic_materialist }
		}
		if = {
			limit = { owner = { has_ethic = ethic_pacifist } }
			NOT = { has_ethic = ethic_pacifist }
		}
		if = {
			limit = { owner = { is_militarist = yes } }
			NOT = { has_ethic = ethic_militarist }
		}
		if = {
			limit = { owner = { has_ethic = ethic_xenophile } }
			NOT = { has_ethic = ethic_xenophile }
		}
		if = {
			limit = { owner = { is_xenophobe = yes } }
			NOT = { has_ethic = ethic_xenophobe }
		}
	}

	immediate = {
		random_list = {
			100 = { pop_group_event = { id = cc_thought_police.1 } }

			100 = {
				modifier = {
					factor = 0.75
					has_ethic = ethic_egalitarian
				}
				modifier = {
					factor = 0.67
					happiness < 0.3
				}
				modifier = {
					factor = 0.67
					happiness < 0.2
				}
				modifier = {
					factor = 0
					happiness < 0.1
				}
			}
		}
	}
}

# Pop is purged or escapes as a political refugee
pop_group_event = {
	id = cc_thought_police.1
	
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		if = {
			limit = { is_valid_TP_refugee_pop = yes }
			random_list = {
				5 = {
					save_event_target_as = refugee_pop
					TP_refugee_pop_effect = yes
					
#					log = "Activist Pop in [root.owner.GetName] flees"

					modifier = {
						factor = 1.2
						happiness < 0.2
					}
				}
				5 = {
					kill_pop_group = { pop_group = this amount = 100% } 

#					log = "Activist Pop in [root.owner.GetName] dies"
				}
			}
		}
		else = { kill_pop_group = { pop_group = this amount = 100% } }
	}
}




# Refugees Arrive (new species)
pop_group_event = {
	id = cc_thought_police.2
	title = cc_thought_police.2.name	
	picture = GFX_evt_unknown_ships
	location = root
	
	desc = cc_thought_police.2.desc
	
	is_triggered_only = yes
	
	option = {
		name = cc_thought_police.2.a
	}
}

