namespace = xilin_ascension_perk

#ϣ۹¼

#ƽ
# A country has increased the level of a tech, use last_increased_tech trigger to check tech and level.
# This = Country
country_event = {
	id = xilin_ascension_perk.1
	title = "utopia.2700.name"
	desc = xilin_ascension_perk.1.desc
	picture = GFX_evt_genetic_modification
	show_sound = tut_uplift_reminder

	is_triggered_only = yes
	

	trigger = {
	  AND = {
	      has_authority = auth_xilin_mind   #ϣ۹
	      has_technology = tech_gene_tailoring  #ӵпƼü
	      num_ascension_perks > 0  #һ
	      NOT = { has_country_flag = f_engineered_evolution } #Ͳٴ
	  }
	}
	
	immediate = {
		set_country_flag = f_engineered_evolution
	}

	option = {
		name = OK
		capital_scope = {
			enable_special_project = {
				name = "PRO_ENGINEERED_EVOLUTION"
				location = this
				owner = root
			}
		}
	}
}
#ƽĿɽ
country_event = {
	id = xilin_ascension_perk.2
	title = "utopia.2700.name"
	desc = "utopia.2700.desc"
	picture = GFX_evt_genetic_modification
	show_sound = event_engineered_evolution

	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
		add_research_option = tech_gene_seed_purification
		add_modifier = { modifier = m_engineered_evolution } 
	}
}

#ƿؽ
# A country has increased the level of a tech, use last_increased_tech trigger to check tech and level.
# This = Country
country_event = {
	id = xilin_ascension_perk.3
	title = "utopia.2703.name"
	desc = xilin_ascension_perk.3.desc
	picture = GFX_evt_genetic_modification
	show_sound = tut_uplift_reminder

	is_triggered_only = yes
	

	trigger = {
	  AND = {
	      has_authority = auth_xilin_mind   #ϣ۹
	      has_technology = tech_gene_expressions  #ӵпƼ
	      num_ascension_perks > 2  #
	      has_modifier = m_engineered_evolution #ѾƷ
	      NOT = { has_country_flag = f_evolutionary_mastery } #Ͳٴ
	  }
	}
	
	immediate = {
		set_country_flag = f_evolutionary_mastery
	}

	option = {
		name = OK
		capital_scope = {
			enable_special_project = {
				name = "PRO_EVOLUTIONARY_MASTERY"
				location = this
				owner = root
			}
		}
	}
}

#ƿؽĿɽ
country_event = {
	id = xilin_ascension_perk.4
	title = "utopia.2703.name"
	desc = "utopia.2703.desc"
	picture = GFX_evt_genetic_modification
	show_sound = event_engineered_evolution

	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
		add_research_option = tech_genetic_resequencing
		add_modifier = { modifier = m_evolutionary_mastery } 
	}
}

#ѪƤ
# A country has increased the level of a tech, use last_increased_tech trigger to check tech and level.
# This = Country
country_event = {
	id = xilin_ascension_perk.5
	title = "utopia.2500.name"
	desc = xilin_ascension_perk.5.desc
	picture = GFX_evt_cybernetics
	show_sound = event_laboratory_sound

	is_triggered_only = yes
	

	trigger = {
	  AND = {
	      has_authority = auth_xilin_mind   #ϣ۹
	      has_technology = tech_droid_workers  #ӵпƼ
	      num_ascension_perks > 0  #һ
	      NOT = { has_country_flag = f_the_flesh_is_weak } #Ͳٴ
	      OR = {
	          any_country = { #˿Ƽ
	               has_communications = root
	               is_country_type = default
	               NOT = { has_authority = auth_xilin_mind }
	               has_technology = tech_droid_workers
	          }
	          any_country = { #֪ʶ߶۹
	               has_communications = root
	               OR = {
	                   is_country_type = awakened_fallen_empire
	                   is_country_type = fallen_empire
	               }	               
	               has_ethic = ethic_fanatic_materialist
	              # NOT = { has_authority = auth_xilin_mind }
	              # has_technology = tech_droid_workers
	          }
	      }
	  }
	}
	
	immediate = {
		set_country_flag = f_the_flesh_is_weak
	}

	option = {
		name = OK
		capital_scope = {
			enable_special_project = {
				name = "PRO_THE_FLESH_IS_WEAK"
				location = this
				owner = root
			}
		}
	}
}

#ѪƤĿɽ
country_event = {
	id = xilin_ascension_perk.6
	title = "utopia.2500.name"
	desc = "xilin_ascension_perk.6.desc"
	picture = GFX_evt_cybernetics
	show_sound = event_laboratory_sound

	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
		add_modifier = { modifier = m_the_flesh_is_weak } 
	}
}

#ںϽʧ¼Ƿ
country_event = {
	id = xilin_ascension_perk.7
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
	  AND = {
	      has_authority = auth_xilin_mind   #ϣ۹
	      has_technology = tech_synthetic_leaders  #ӵпƼϳ
	      num_ascension_perks > 2  #
        has_modifier = m_the_flesh_is_weak #ѾѪ
	      NOT = { has_country_flag = f_limbo_test } #Ͳٴ
	      NOR = {
	          has_special_project = LIMBO_1_PROJECT
	          has_country_flag = limbo_downloaded
	          has_special_project = LIMBO_2_PROJECT
	          has_country_flag = limbo_uploaded_robots
	      }	      
	  }
	}
	
	immediate = {
		set_country_flag = f_limbo_test
		#δ򴥷ʧ¼
		country_event = { id = xilin_ascension_perk.70 }
	}
}

#ںϽʧ¼
country_event = {
	id = xilin_ascension_perk.70
	title = "anomaly.185.name"
	desc = "anomaly.185.desc"
	show_sound = event_radio_chatter
	picture = GFX_evt_archaeological_dig
	
	is_triggered_only = yes
	
	immediate = {
		#ھҵһ
		if = {
		    limit = {
							any_planet_within_border = {
										is_planet_class = pc_barren									
							}
				}
		    random_planet_within_border = {
				  limit = {
					  is_planet_class = pc_barren	
					}
					save_event_target_as = limbo_target
				}
			  else = { #û⴦һ
			     random_planet ={
			         limit = {
					        is_planet_class = pc_barren	
					     }
					     save_event_target_as = limbo_target
			     }
			  }
		}
	}
	option = {
		name = OK	
		enable_special_project = {
				name = "LIMBO_1_PROJECT"
				location = event_target:limbo_target
				owner = root
		}
		#set_country_flag = BARR_BASE_FLAG
	}
}

#ںϽ
# A country has increased the level of a tech, use last_increased_tech trigger to check tech and level.
# This = Country
country_event = {
	id = xilin_ascension_perk.71
	title = "utopia.2550.name"
	desc = "xilin_ascension_perk.71.desc"
	picture = GFX_evt_cybernetics
	show_sound = event_laboratory_sound

	is_triggered_only = yes
	

	trigger = {
	  AND = {
	      has_authority = auth_xilin_mind   #ϣ۹
	      has_technology = tech_synthetic_leaders  #ӵпƼϳ
	      num_ascension_perks > 2  #
	      has_modifier = m_the_flesh_is_weak #ѾѪ
	      has_country_flag = limbo_uploaded_robots #ѷϴ¼
	      NOT = { has_country_flag = f_synthetic_evolution } #Ͳٴ	      
	  }
	}
	
	immediate = {
		set_country_flag = f_synthetic_evolution
	}

	option = {
		name = OK
		capital_scope = {
			enable_special_project = {
				name = "PRO_SYNTHETIC_EVOLUTION"
				location = this
				owner = root
			}
		}
	}
}


#ںϽĿɽ
country_event = {
	id = xilin_ascension_perk.8
	title = "utopia.2550.name"
	desc = "xilin_ascension_perk.8.desc"
	picture = GFX_evt_robot_assembly_plant
	show_sound = event_laboratory_sound

	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
		add_modifier = { modifier = m_synthetic_evolution } 
	}
}

#ʤ
# A country has increased the level of a tech, use last_increased_tech trigger to check tech and level.
# This = Country
country_event = {
	id = xilin_ascension_perk.9
	title = npc_anaiye
	desc = xilin_ascension_perk.9.desc
	diplomatic = yes
#	force_open = yes
	picture_event_data = {
		portrait = anaiye
		room = shroud_room
	}
#	picture = GFX_evt_psionics
	show_sound = event_mind_over_matter

	is_triggered_only = yes
	

	trigger = {
	  AND = {
	      has_authority = auth_xilin_mind   #ϣ۹
	      has_technology = tech_psionic_theory  #ӵۿƼ
	      num_ascension_perks > 0  #һ
	      NOR = { 
	         has_country_flag = f_mind_over_matter 
	         has_special_project = PRO_MIND_OVER_MATTER
	      } #Ͳٴ
	  }
	}
	
#	immediate = {
#		set_country_flag = f_mind_over_matter
#	}

	option = {
		name = CONTINUE
		hidden_effect = { country_event = { id = xilin_ascension_perk.91 } }
	}
}

country_event = {
	id = xilin_ascension_perk.91
	title = npc_taweier
	desc = xilin_ascension_perk.91.desc
	diplomatic = yes
#	force_open = yes
	picture_event_data = {
		portrait = taweier
		room = no_video_feed_room
	}
#	picture = GFX_evt_psionics
#	show_sound = event_mind_over_matter

	is_triggered_only = yes
	
	option = {
		name = OK
		capital_scope = {
			enable_special_project = {
				name = "PRO_MIND_OVER_MATTER"
				location = this
				owner = root
			}
		}
	}
}



#ʤĿɽ
country_event = {
	id = xilin_ascension_perk.10
	title = "utopia.2600.name"
	desc = xilin_ascension_perk.10.desc
	picture = GFX_evt_psionics
	show_sound = event_mind_over_matter

	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
		add_research_option = tech_telepathy
		set_country_flag = f_mind_over_matter
	}
}

#ʥ
# A country has increased the level of a tech, use last_increased_tech trigger to check tech and level.
# This = Country
country_event = {
	id = xilin_ascension_perk.11
	title = npc_anaiye
	desc = "xilin_ascension_perk.11.desc"
	diplomatic = yes
#	force_open = yes
	picture_event_data = {
		portrait = anaiye
		room = shroud_room
	}
	show_sound = event_psionic

	is_triggered_only = yes
	

	trigger = {
	  AND = {
	      has_authority = auth_xilin_mind   #ϣ۹
	      num_ascension_perks > 2  #
	      NOT = { has_country_flag = f_transcendence } #Ͳٴ
	      has_country_flag = f_mind_over_matter #ʤ
	  }
	}
	
	immediate = {
		set_country_flag = f_transcendence
	}

	option = {
		name = CONTINUE
		hidden_effect = { country_event = { id = xilin_ascension_perk.1101 } }
	}
}

country_event = {
	id = xilin_ascension_perk.1101
	title = npc_taweier
	desc = "xilin_ascension_perk.1101.desc"
	diplomatic = yes
#	force_open = yes
	picture_event_data = {
		portrait = taweier
		room = no_video_feed_room
	}

	is_triggered_only = yes
	
	option = {
		name = OK
		capital_scope = {
			enable_special_project = {
				name = "XILIN_BREACHING_SHROUD_PROJECT"
				location = this
				owner = root
			}
		}
		
	}
}

country_event = {
	id = xilin_ascension_perk.1102
	title = "xilin_ascension_perk.1102.name"
	desc = "xilin_ascension_perk.1102.desc"
	picture = GFX_evt_psionics
	show_sound = event_psionic
	
	is_triggered_only = yes

	immediate = {
		random_country = {
			limit = { is_country_type = shroud }
			save_event_target_as = the_shroud
		}
	}

	option = {
		name = "utopia.2656.a"
		establish_communications_no_message = event_target:the_shroud
		hidden_effect = {
			set_country_flag = shroud_intro
			country_event = { id = xilin_ascension_perk.1103 }
		}
	}
}

country_event = {
	id = xilin_ascension_perk.1103
	title = "utopia.3000.name"
	desc = utopia.3000.intro.desc
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {
		portrait = shroud1
		room = shroud_room
	}
		
	is_triggered_only = yes

	option = {
		name = CONTINUE
		hidden_effect = { country_event = { id = xilin_ascension_perk.1104 } }
	}
}

country_event = {
	id = xilin_ascension_perk.1104
	title =  npc_anaiye
	desc =  xilin_ascension_perk.1104.desc
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {
		portrait = anaiye
		room = shroud_room
	}
		
	is_triggered_only = yes

	option = {
		name = CONTINUE
		hidden_effect = { country_event = { id = xilin_ascension_perk.1105 } }
	}
}

country_event = {
	id = xilin_ascension_perk.1105
	title =  npc_xuqianqian
	desc =  xilin_ascension_perk.1105.desc
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {
		portrait = xuqianqian
		room = shroud_room
	}
		
	is_triggered_only = yes

	option = {
		name = CONTINUE
		hidden_effect = { country_event = { id = xilin_ascension_perk.1106 } }
	}
}

country_event = {
	id = xilin_ascension_perk.1106
	title = npc_dingdang
	desc =  xilin_ascension_perk.1106.desc
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {
		portrait = dingdang
		room = shroud_room
	}
	
	is_triggered_only = yes
	
	option = {
		name = CONTINUE
		hidden_effect = {
			country_event = { id = utopia.3000 }
		}
	}
}
