namespace = nnnethic_event

country_event = {
	id = nnnethic_event.1
	hide_window = yes
	
	mean_time_to_happen = {
		months = 10
	}

	trigger = {
		has_ascension_perk = eap_one_vision 
	}
	immediate = {
		every_owned_planet = {
				planet_event = { id = nnnethic_event.2 }
		}
	} 
}

planet_event = {
	id = nnnethic_event.2
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				owner = { has_policy_flag = nnnethic_authoritarian_attraction }
			}
			random_pop = {
				limit = {
					NOR = {
						has_ethic = "ethic_authoritarian"
						pop_has_trait = trait_robotic_1
						pop_has_trait = trait_robotic_2
					}
				}
				pop_change_ethic = ethic_authoritarian
			}
		}
		if = {
			limit = {
				owner = { has_policy_flag = nnnethic_egalitarian_attraction }
			}
			random_pop = {
				limit = {
					NOR = {
						has_ethic = "ethic_egalitarian"
						pop_has_trait = trait_robotic_1
						pop_has_trait = trait_robotic_2
					}
				}
				pop_change_ethic = ethic_egalitarian
			}
		}
		if = {
			limit = {
				owner = { has_policy_flag = nnnethic_materialist_attraction }
			}
			random_pop = {
				limit = {
					NOR = {
						has_ethic = "ethic_materialist"
						pop_has_trait = trait_robotic_1
						pop_has_trait = trait_robotic_2
					}
				}
				pop_change_ethic = ethic_materialist
			}
		}
		if = {
			limit = {
				owner = { has_policy_flag = nnnethic_spiritualist_attraction }
			}
			random_pop = {
				limit = {
					NOR = {
						has_ethic = "ethic_spiritualist"
						pop_has_trait = trait_robotic_1
						pop_has_trait = trait_robotic_2
					}
				}
				pop_change_ethic = ethic_spiritualist
			}
		}
		if = {
			limit = {
				owner = { has_policy_flag = nnnethic_xenophobe_attraction }
			}
			random_pop = {
				limit = {
					NOR = {
						has_ethic = "ethic_xenophobe"
						pop_has_trait = trait_robotic_1
						pop_has_trait = trait_robotic_2
					}
				}
				pop_change_ethic = ethic_xenophobe
			}
		}
		if = {
			limit = {
				owner = { has_policy_flag = nnnethic_xenophile_attraction }
			}
			random_pop = {
				limit = {
					NOR = {
						has_ethic = "ethic_xenophile"
						pop_has_trait = trait_robotic_1
						pop_has_trait = trait_robotic_2
					}
				}
				pop_change_ethic = ethic_xenophile
			}
		}
		if = {
			limit = {
				owner = { has_policy_flag = nnnethic_pacifist_attraction }
			}
			random_pop = {
				limit = {
					NOR = {
						has_ethic = "ethic_pacifist"
						pop_has_trait = trait_robotic_1
						pop_has_trait = trait_robotic_2
					}
				}
				pop_change_ethic = ethic_pacifist
			}
		}
		if = {
			limit = {
				owner = { has_policy_flag = nnnethic_militarist_attraction }
			}
			random_pop = {
				limit = {
					NOR = {
						has_ethic = "ethic_militarist"
						pop_has_trait = trait_robotic_1
						pop_has_trait = trait_robotic_2
					}
				}
				pop_change_ethic = ethic_militarist
			}
		}
	}
}



event = {
	id = nnnethic_event.3
	id = nnnethic_event.3
	title = "nnnethic_event.3.name"
	desc = "nnnethic_event.3.desc"
	picture = GFX_evt_news_room
	show_sound = event_factions
	is_triggered_only = yes
	trigger = {
		last_changed_policy = nnn_ethic_attraction
		or = { 
			has_policy_flag = nnnethic_authoritarian_attraction
			has_policy_flag = nnnethic_egalitarian_attraction 
			has_policy_flag = nnnethic_materialist_attraction
			has_policy_flag = nnnethic_spiritualist_attraction
			has_policy_flag = nnnethic_xenophobe_attraction
			has_policy_flag = nnnethic_xenophile_attraction 
			has_policy_flag = nnnethic_pacifist_attraction
			has_policy_flag = nnnethic_militarist_attraction
		}
		not = { has_country_flag = nnnnethic_authoritarian_attraction }
		
	}
	immediate = {
		country_event = { id = nnnethic_event.4 days=3601 }
		set_country_flag = nnnnethic_authoritarian_attraction
	}
}
		

country_event = {
	id = nnnethic_event.4
	title = "nnnethic_event.4.name"
	desc = "nnnethic_event.4.desc"
	picture = GFX_evt_news_room
	show_sound = event_factions
	
	is_triggered_only = yes
	
	immediate = {
		if = {
			limit = {
				or = { 
					has_policy_flag = nnnethic_authoritarian_attraction
					has_policy_flag = nnnethic_egalitarian_attraction 
					has_policy_flag = nnnethic_materialist_attraction
					has_policy_flag = nnnethic_spiritualist_attraction
					has_policy_flag = nnnethic_xenophobe_attraction
					has_policy_flag = nnnethic_xenophile_attraction 
					has_policy_flag = nnnethic_pacifist_attraction	
					has_policy_flag = nnnethic_militarist_attraction
				} 
			}
			hidden_effect = {
				set_policy = {
					policy = nnn_ethic_attraction
					option = government_ethic_attraction
					cooldown = no
				}
			}
			remove_country_flag = nnnnethic_authoritarian_attraction
		}
	}
}	
		
		
		
		
		