###########################
# tier On-Action Events #
###########################
namespace = tier
country_event = {
	id = tier.1
	title = tier.1.name
	desc = tier.1.desc
	picture = GFX_evt_announcement
	show_sound = event_announcement
	location = root
	is_triggered_only = yes
	pre_triggers = {
		is_ai = no
	}
	immediate = {
		set_global_flag = apb_tier_unlocked
	}
	option = {
		name = tier.1.unlocked
		hidden_effect = {
			set_global_flag = apb_tier_unlocked
			remove_global_flag = apb_tier_locked
		}
	}
	option = {
		name = tier.1.locked
		hidden_effect = {
			set_global_flag = apb_tier_locked
			remove_global_flag = apb_tier_unlocked
		}
	}
}

###########################
# Fountain On-Action Events #
###########################
namespace = fountain
country_event = {
	id = fountain.100
	title = "fountain.100.name"
	desc = "fountain.100.desc"
	picture = GFX_evt_fountain
	show_sound = event_engineered_evolution
	is_triggered_only = yes
	option = {
		name = "fountain.100.a"
		hidden_effect = {
			save_event_target_as = fountain_of_youth_owner
		}
		capital_scope = {
			enable_special_project = {
				name = "FOUNTAIN_OF_YOUTH_PROJECT"
				location = this
				owner = root
			}
		}
	}
}

country_event = {
	id = fountain.101
	title = "fountain.101.name"
	desc = "fountain.101.desc"
	picture = "GFX_evt_fountain"
	show_sound = event_engineered_evolution
	is_triggered_only = yes
	immediate = {
		add_research_option = tech_synthetic_youth
		give_technology = {
			tech = tech_synthetic_youth
		}
	}
}

# Handle leader traits after species modification
country_event = {
	id = fountain.200
	is_triggered_only = yes
	hide_window = yes
	immediate = {
		every_owned_leader = {
			apb_add_leader_traits_after_modification = yes
			apb_remove_leader_traits_after_modification = yes
		}
		every_pool_leader = {
			apb_add_leader_traits_after_modification = yes
			apb_remove_leader_traits_after_modification = yes
		}
	}
}

country_event = {
	id = fountain.201
	is_triggered_only = yes
	hide_window = yes
	trigger = {
		from = {
			species = {
				has_trait = trait_youth
				#NOR = {
				#has_trait = trait_cybernetic
				#}
			}
		}
	}
	immediate = {
		from = {
			#if = {
			#limit = { leader_class = admiral }
			#add_trait = leader_trait_admiral_youth
			#add_ruler_trait = leader_trait_ruler_youth
			#break = yes
			#}
			#if = {
			#limit = { leader_class = general }
			#add_trait = leader_trait_general_youth
			#add_ruler_trait = leader_trait_ruler_youth
			#break = yes
			#}
			if = {
				limit = {
					leader_class = commander
				}
				add_trait = leader_trait_commander_youth
				add_ruler_trait = leader_trait_ruler_youth
				break = yes
			}
			#if = {
			#limit = { leader_class = governor }
			#add_trait = leader_trait_governor_youth
			#add_ruler_trait = leader_trait_ruler_youth
			#break = yes
			#}
			if = {
				limit = {
					leader_class = official
				}
				add_trait = leader_trait_official_youth
				add_ruler_trait = leader_trait_ruler_youth
				break = yes
			}
			if = {
				limit = {
					leader_class = scientist
				}
				add_trait = leader_trait_scientist_youth
				add_ruler_trait = leader_trait_ruler_youth
				break = yes
			}
			if = {
				limit = {
					leader_class = ruler
				}
				add_trait = leader_trait_ruler_youth
				add_ruler_trait = leader_trait_ruler_youth
				break = yes
			}
		}
	}
}
