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 }
		}
	}
}
