namespace = xilin_diplo_dlg
#希灵外交对话事件

country_event = {
	id = xilin_diplo_dlg.1
	title = xilin_diplo_more_title
	desc = WAITING_XILIN_SPEAK
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	trigger = {
		 has_country_flag = more_diplomacy_engaged
	}
	
	#要求对方开放边境
	option = { 
		name = DEMAND_TO_OPEN_BORDER	
		trigger ={		
			 event_target:Dip_More_OP_Country = { 
			    has_closed_borders = ROOT
			    NOR = { 
					  has_country_flag = f_refuse_open_border_to_xilin 
					  has_country_flag = f_open_border_to_xilin
					}
					#不是希灵的敌人
					is_xilin_enemy = no
		   }	
		}	
		hidden_effect = {
			country_event = { id = xilin_diplo_dlg.2 }
		}
	}
	
	#要求对方收回宣称
	option = { 
		name = DEMAND_TO_DESTROY_CLAIM	
		trigger ={		
			 event_target:Dip_More_OP_Country = { 
			    has_claim = ROOT
			    NOR = { 
			    	has_country_flag = f_refuse_destroy_claim 
					  has_country_flag = f_agree_destroy_claim 					  
					}
					#不是希灵的敌人
					is_xilin_enemy = no
		   }	
		}	
		hidden_effect = {
			country_event = { id = xilin_diplo_dlg.19 }
		}
	}
	
	#要求对方改革政府(蜂群变和谐)
	option = { 
		name = DEMAND_TO_REBUILD_GOV
		trigger ={		
			 event_target:Dip_More_OP_Country = { 
			    AND = {
			       is_subject = yes
			       exists = overlord
			       overlord = { is_same_empire = root }
			    }
			    NOT = { 
					  is_subject_type = xilin_discipline
					}
					subject_need_rebuild_gov = yes
		   }	
		}	
		allow = { #忠诚、影响力与传统
			custom_tooltip = {
				fail_text = SUGGEST_TO_LOYAL
				event_target:Dip_More_OP_Country = {
					is_loyal_to = root
				}	
			}
			influence > 100
			unity > 1000
		}	
		hidden_effect = {
			country_event = { id = xilin_diplo_dlg.7 }
		}
	}
	#给晋升附庸等级
	option = { # Minerals
		name = LEVELUP_VASSAL	
		trigger ={	#希灵附庸，但未到最高等级	,也不是惩戒国
			 event_target:Dip_More_OP_Country = { 
			    AND = {
			       is_subject = yes
			       exists = overlord
			       overlord = { is_same_empire = root }
			    }
			    NOR = { 
					  is_subject_type = xilin_blessed
					  is_subject_type = xilin_follower_protector
					  is_subject_type = xilin_discipline
					}
		   }	
		}
		allow = { #年限与忠诚
			custom_tooltip = {
				fail_text = BE_VASSAL_NOT_ENOUGH_TIME
				event_target:Dip_More_OP_Country = {
					NOT = { has_country_flag = f_new_vassal }
				}				
			}
			custom_tooltip = {
				fail_text = LEVELUP_NEED_LOYAL
				event_target:Dip_More_OP_Country = {
					is_loyal_to = root
				}	
			}
		}	
		hidden_effect = {
			country_event = { id = xilin_diplo_dlg.4 }
		}
	}
	
	#获取科技数据库
	option = {
	  name = GET_TECH_LIB
	  trigger ={	#希灵附庸，未进行过技术整合
			 event_target:Dip_More_OP_Country = { 
			    AND = {
			       is_subject = yes
			       exists = overlord
			       overlord = { is_same_empire = root }
			    }
			    NOT = { has_country_flag = f_get_tech_lib }
		   }
		   	
		}
		hidden_effect = {
	  	 country_event = { id = xilin_diplo_dlg.21 }
		} 
	}
	
	#技术援助
	option = {
	  name = TECH_ASSISTANCE
	  trigger ={	#希灵附庸，科技未达到希灵的80%,不是惩戒国	
			 event_target:Dip_More_OP_Country = { 
			    AND = {
			       is_subject = yes
			       exists = overlord
			       overlord = { is_same_empire = root }
			    }
			    NOT = { 
					  is_subject_type = xilin_discipline
					}
					has_country_flag = f_get_tech_lib #已经链入过数据库
					NOT = {
						tech_unlocked_ratio = {
									who = root
									ratio > 0.8
						}
					}
		   }	
		}
		allow = { #忠诚			
			custom_tooltip = {
				fail_text = LEVELUP_NEED_LOYAL
				event_target:Dip_More_OP_Country = {
					is_loyal_to = root
				}	
			}
			custom_tooltip = {
				fail_text = ALREADY_HAS_TECH_ASSISTANCE
				event_target:Dip_More_OP_Country = {
					 NOT = { has_modifier = m_xilin_tech_assistance  }
				}	
			}
		}
	  
	  hidden_effect = {
	  	 country_event = { id = xilin_diplo_dlg.6 }
		}  
	}
	
	option = {
	  name = EXIT
	  default_hide_option = yes #关闭窗口时默认按钮
	  hidden_effect = {
	     remove_country_flag = more_diplomacy_engaged
		}  
	}
	#测试
#	option = { # Minerals
#		name = TEST
#		hidden_effect = {
#			country_event = { id = xilin_diplo_dlg.1000 }
#		}
#	}
}

#要求对方开放边境
country_event = {
	id = xilin_diplo_dlg.2
	title = DEMAND_TO_OPEN_BORDER
	desc = DEMAND_TO_OPEN_BORDER_DESC
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	immediate = {
	   save_event_target_as = Dip_Country
	}
	
	#要求对方开放边境
	option = { # Minerals
		name = SEND
		hidden_effect = {
		  event_target:Dip_More_OP_Country = {
		  		country_event = { id = xilin_diplo_rdlg.1 }
		  }			
		}
	}
			
}

#对方对开放边境的回答
country_event = {
	id = xilin_diplo_dlg.3
	title = FROM_RESPOND
	
	desc = { 
		text =  DEMAND_TO_OPEN_BORDER_RESPOND_AGREE
		trigger = { 
		    has_country_flag = f_agree
		}
	}
	
	desc = { 
		text =  DEMAND_TO_OPEN_BORDER_RESPOND_REFUSE
		trigger = { 
		    has_country_flag = f_refuse
		}
	}
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	immediate = {
	   log = "xilin_diplo_dlg.3 is triggered"
	}
		
	#对方同意
	option = { # Minerals
		name = GOOD
		trigger = {
		    has_country_flag = f_agree
		}
		hidden_effect = {	
		  #移除标记，保证下次会话功能正常
		  remove_country_flag = f_agree	
		  #希灵帝国增加信任,和外交评价  
		  add_trust = { amount = 10  who = event_target:Dip_More_OP_Country }
		  add_opinion_modifier = { modifier = opinion_agree_to_open_border   who = event_target:Dip_More_OP_Country }
		  #发问候给对方，然后结束通话
		  event_target:Dip_More_OP_Country = {
		  		country_event = { id = xilin_diplo_rdlg.2 }
		  }
			#通话结束
		  remove_country_flag = more_diplomacy_engaged
		}
	}	
	#对方拒绝
	option = { # Minerals
		name = RESPOND_TO_REFUSE_OPEN_BORDER
		trigger = {
		   has_country_flag = f_refuse 
		}
		custom_tooltip = MAY_DECLARE_WAR
		hidden_effect = {
		  #移除标记，以便下次还能用
		  remove_country_flag = f_refuse
		  	
		  #激怒希灵帝国
		  add_opinion_modifier = { modifier = opinion_anger_xilin   who = event_target:Dip_More_OP_Country }
		  #警告对方，然后结束通话
		  event_target:Dip_More_OP_Country = {
		  		country_event = { id = xilin_diplo_rdlg.3 }
		  }
		  #检查开放边境战争理由
		  check_casus_belli_valid = {
					target = event_target:Dip_More_OP_Country
					type = cb_open_border
			}
		  #通话结束
		  remove_country_flag = more_diplomacy_engaged
		}  
	}	
}

#晋升附庸
country_event = {
	id = xilin_diplo_dlg.4
	title = LEVELUP_XILIN_VASSAL
	desc = LEVELUP_XILIN_VASSAL_DESC
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	immediate = {
	   save_event_target_as = Dip_Country
	   event_target:Dip_More_OP_Country = {
		      if = { #追随者晋升眷族
							limit = {								 
								 is_subject_type = xilin_follower_vassal								 						   
							   #can_be_subject = { subject_type = xilin_blessed   overlord = root }
							}	
							set_subject_of = {  who = root  subject_type = xilin_blessed	}	
							if = {
								limit = { #排外且没有内圣之道的转崇外
					  				has_ethic = ethic_fanatic_xenophobe
					  				has_ethic = ethic_xenophobe
					  				NOT = { has_valid_civic = civic_inwards_perfection }
								}
								shift_ethic = ethic_xenophile
							}	
							set_timed_country_flag = { flag = f_new_vassal  days = 3600 }
			   			if = {
			     			limit = { NOT = { has_modifier = m_xilin_blessed  } }
			     			add_modifier = { modifier = m_xilin_blessed  }
			   			}			   
			   			if = {
			     			limit = { NOT = { has_modifier = m_xilin_tech_dependence  } }
			     			add_modifier = { modifier = m_xilin_tech_dependence  }
			   			}
			   
			  	 		#移除原来的级别的修正
			   			remove_modifier = m_xilin_follower 
			   			#移除开放边境相关flag
			   			remove_country_flag = f_refuse_open_border_to_xilin
			   			remove_country_flag = f_open_border_to_xilin      
		      }
		      if = { #附庸晋升追随者(附庸)
							limit = {
								 is_subject_type = vassal
							   can_be_subject = { subject_type = xilin_follower_vassal   overlord = root }
							}	
							set_subject_of = {  who = root  subject_type = xilin_follower_vassal	}	
							if = {
									limit = { #排外且没有内圣之道的转崇外
					  					has_ethic = ethic_fanatic_xenophobe
					  					has_ethic = ethic_xenophobe
					  					NOT = { has_valid_civic = civic_inwards_perfection }
									}
									shift_ethic = ethic_xenophile
							}	
							set_timed_country_flag = { flag = f_new_vassal  days = 3600 }
			   			if = {
			     				limit = { NOT = { has_modifier = m_xilin_follower  } }
			     				add_modifier = { modifier = m_xilin_follower  }
			   			}			   
			   			if = {
			     				limit = { NOT = { has_modifier = m_xilin_tech_dependence  } }
			     				add_modifier = { modifier = m_xilin_tech_dependence  }
			   			}
			   
			   			#移除原来的级别的修正
			  	 		remove_modifier = m_xilin_servant_vassal
			   			#移除开放边境相关flag
			   			remove_country_flag = f_refuse_open_border_to_xilin
			  			remove_country_flag = f_open_border_to_xilin	      
		      }
		      	      
		      if = { #保护国晋升追随者(保护国)
							limit = {
								 is_subject_type = protectorate
							   can_be_subject = { subject_type = xilin_follower_protector   overlord = root }
							}	
							set_subject_of = {  who = root  subject_type = xilin_follower_protector	}	 
							if = {
									limit = {
					  				has_ethic = ethic_fanatic_xenophobe
					  				has_ethic = ethic_xenophobe
					  				NOT = { has_valid_civic = civic_inwards_perfection }
									}
									shift_ethic = ethic_xenophile
							}		
							set_timed_country_flag = { flag = f_new_vassal  days = 3600 }
			   			if = {
			     				limit = { NOT = { has_modifier = m_xilin_follower  } }
			     				add_modifier = { modifier = m_xilin_follower  }
			   			}			   
			   			if = {
			     				limit = { NOT = { has_modifier = m_xilin_tech_dependence  } }
			     				add_modifier = { modifier = m_xilin_tech_dependence  }
			   			}			   
			  			#移除原来的级别的修正
			   			remove_modifier = m_xilin_servant_vassal
			  			 #移除开放边境相关flag
			   			remove_country_flag = f_refuse_open_border_to_xilin
			   			remove_country_flag = f_open_border_to_xilin	     
		      }
		      if = { #仆从国晋升普通附庸
							limit = { 
							   is_subject_type = xilin_servant
							   can_be_subject = { subject_type = vassal   overlord = root }
							}	
							set_subject_of = {  who = root  subject_type = vassal	}	 
							#设置标记，十年后，可根据忠诚度提升为眷族
				 			set_timed_country_flag = { flag = f_new_vassal  days = 3600 }
			   			if = {  
			   			  limit = { NOT = { has_modifier = m_xilin_servant_vassal } }
			   			  add_modifier = { modifier = m_xilin_servant_vassal  }
			   			}
			   			if = {
			     			limit = { NOT = { has_modifier = m_xilin_tech_dependence  } }
			     			add_modifier = { modifier = m_xilin_tech_dependence  }
			   			}
			   			#移除开放边境相关flag
			   			remove_country_flag = f_refuse_open_border_to_xilin
			   			remove_country_flag = f_open_border_to_xilin	     
		      }
		      if = { #仆从国晋升保护国
							limit = { 
							   is_subject_type = xilin_servant
							   can_be_subject = { subject_type = protectorate   overlord = root }
							}	
							set_subject_of = {  who = root  subject_type = protectorate	}	 
							#设置标记，十年后，可根据忠诚度提升为追随者
							set_timed_country_flag = { flag = f_new_vassal  days = 3600 }
			   			if = {
			    			limit = { NOT = { has_modifier = m_xilin_servant_vassal } }
			     			add_modifier = { modifier = m_xilin_servant_vassal  }
			   			}
			  		 	if = {
			     			limit = { NOT = { has_modifier = m_xilin_tech_dependence  } }
			     			add_modifier = { modifier = m_xilin_tech_dependence  }
			   			}			   
			  			 #移除开放边境相关flag
			   			remove_country_flag = f_refuse_open_border_to_xilin
			   			remove_country_flag = f_open_border_to_xilin	     
		      }
		  }	   
	}
	
	#通知对方附庸晋升
	option = { # Minerals
		name = SEND
		hidden_effect = {
		  event_target:Dip_More_OP_Country = {		      
		  		country_event = { id = xilin_diplo_rdlg.4 }
		  }	
		  #对方的回答	
		  country_event = { id = xilin_diplo_dlg.5 }	
		}
	}			
}

#晋升附庸回答
country_event = {
	id = xilin_diplo_dlg.5
	title = LEVELUP_XILIN_VASSAL
	desc = RESPOND_LEVELUP_XILIN_VASSAL_DESC
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	#清除flag,退出
	option = { 
		name = OK
		hidden_effect = {
		  	#通话结束
		    remove_country_flag = more_diplomacy_engaged	
		}
	}			
}

#技术援助
country_event = {
	id = xilin_diplo_dlg.6
	title = TECH_ASSISTANCE
	desc = TECH_ASSISTANCE_DESC
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	immediate = {
	   save_event_target_as = Dip_Country
	}
		
	option = { 
		name = OK
		hidden_effect = {		    
		    event_target:Dip_More_OP_Country = {	
		      #添加技术援助修正
		      add_modifier = { modifier = m_xilin_tech_assistance  days = 3600 }
		      #对方接收信息	      
		  		country_event = { id = xilin_diplo_rdlg.5 }
		  	}	
		  	#通话结束#清除flag,退出
		    remove_country_flag = more_diplomacy_engaged	
		}
	}			
}

#要求改革政府
country_event = {
	id = xilin_diplo_dlg.7
	title = DEMAND_TO_REBUILD_GOV
	desc = DEMAND_TO_REBUILD_GOV_DESC
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	immediate = {
	   save_event_target_as = Dip_Country
	}
		
	option = { 
		name = SEND
		hidden_effect = {		    
		    event_target:Dip_More_OP_Country = {	
		      #对方(蜂群)接收信息	      
		  		country_event = { id = xilin_diplo_rdlg.6 }
		  	}	
		}
	}			
}

#要求改革政府的回答
country_event = {
	id = xilin_diplo_dlg.8
	title = DEMAND_TO_REBUILD_GOV
	desc = WE_WILL_DO_YOU_WILL
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	#清除flag,退出
	option = { 
		name = OK
		hidden_effect = {
				add_influence = -100
				add_unity = -1000
		  	#通话结束		  	
		    remove_country_flag = more_diplomacy_engaged	
		}
	}			
}

#要求改革政府的回答(卡拉连接着我们剧情)
country_event = {
	id = xilin_diplo_dlg.9
	title = Dip_More_OP_Country_Ruler_Name
	desc = HIVE_MIND_ASK_WAY_TO_REBUILD_GOV
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country.ruler
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	option = { 
		name = CONTINUE
		hidden_effect = {
		  	country_event = { id = xilin_diplo_dlg.10 }	
		}
	}			
}

#回答(卡拉连接着我们剧情)
country_event = {
	id = xilin_diplo_dlg.10
	title = npc_chenjun
	desc = KALA_CON_US_TALK1
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country.ruler
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	option = { 
		name = SEND
		hidden_effect = {
			event_target:Dip_More_OP_Country = {	
		  	country_event = { id = xilin_diplo_rdlg.8 }
		  }	
		}
	}			
}
#(卡拉连接着我们剧情2)
country_event = {
	id = xilin_diplo_dlg.11
	title = Dip_More_OP_Country_Ruler_Name
	desc = KALA_CON_US_TALK2
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country.ruler
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	option = { 
		name = CONTINUE
		hidden_effect = {
		  	country_event = { id = xilin_diplo_dlg.12 }	
		}
	}			
}

#(卡拉连接着我们剧情3)
country_event = {
	id = xilin_diplo_dlg.12
	title = npc_chenjun
	desc = KALA_CON_US_TALK3
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country.ruler
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	option = { 
		name = SEND
		hidden_effect = {
			event_target:Dip_More_OP_Country = {	
		  	country_event = { id = xilin_diplo_rdlg.10 }	
		  }
		}
	}			
}

#(卡拉连接着我们剧情4)
country_event = {
	id = xilin_diplo_dlg.13
	title = Dip_More_OP_Country_Ruler_Name
	desc = KALA_CON_US_TALK4
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country.ruler
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	option = { 
		name = CONTINUE
		hidden_effect = {
		  	country_event = { id = xilin_diplo_dlg.14 }	
		}
	}			
}

#(卡拉连接着我们剧情5)
country_event = {
	id = xilin_diplo_dlg.14
	title = npc_chenjun
	desc = KALA_CON_US_TALK5
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country.ruler
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	option = { 
		name = CONTINUE
		hidden_effect = {
			event_target:Dip_More_OP_Country = {	
		  	country_event = { id = xilin_diplo_rdlg.12 }	
		  }
		}
	}			
}

#(卡拉连接着我们剧情6)就叫卡拉
country_event = {
	id = xilin_diplo_dlg.15
	title = npc_paopao
	desc = KALA_CON_US_TALK6
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = paopao
		planet_background = ROOT
		graphical_culture = ROOT
		city_level = ROOT
		room = ROOT.ruler
	}
	
	option = { 
		name = SEND
		custom_tooltip = KALA_CON_US_TALK6_TOOLTIP
		hidden_effect = {
			event_target:Dip_More_OP_Country = {	
		  	country_event = { id = xilin_diplo_rdlg.13 }
		  }	
		}
	}			
}

#(卡拉连接着我们剧情7)
country_event = {
	id = xilin_diplo_dlg.16
	title = Dip_More_OP_Country_Ruler_Name
	desc = KALA_CON_US_TALK7
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country.ruler
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	option = { 
		name = CONTINUE
		custom_tooltip = KALA_CON_US_TALK7_TOOLTIP
		hidden_effect = {
		  	country_event = { id = xilin_diplo_dlg.17 }
		}
	}			
}

#(卡拉连接着我们剧情8)
country_event = {
	id = xilin_diplo_dlg.17
	title = npc_chenjun
	desc = KALA_CON_US_TALK8
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country.ruler
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	option = { 
		name = SEND
		hidden_effect = {
		  event_target:Dip_More_OP_Country = {	
		  	country_event = { id = xilin_diplo_rdlg.15 }
		  }
		}
	}			
}

#(卡拉连接着我们剧情9)
country_event = {
	id = xilin_diplo_dlg.18
	title = Dip_More_OP_Country_Ruler_Name
	desc = KALA_CON_US_TALK9
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country.ruler
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	option = { 
		name = OK
		hidden_effect = {
				add_influence = -100
				add_unity = -1000
		 		#通话结束#清除flag,退出
		    remove_country_flag = more_diplomacy_engaged	
		}
	}			
}

#要求对方收回宣称
country_event = {
	id = xilin_diplo_dlg.19
	title = DEMAND_TO_DESTROY_CLAIM
	desc = DEMAND_TO_DESTROY_CLAIM_DESC
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	immediate = {
	   save_event_target_as = Dip_Country
	   #随机挑选一个被对方宣称的星系
	   random_system_within_border = {
	   		limit = {
	   				event_target:Dip_More_OP_Country = { has_claim = prev }
	   		}
	   		save_event_target_as = Claimed_System
	   }
	}
	
	#要求对方收回宣称
	option = { # Minerals
		name = SEND
		hidden_effect = {
		  event_target:Dip_More_OP_Country = {
		  		country_event = { id = xilin_diplo_rdlg.16 }
		  }			
		}
	}
			
}

#对方对销毁宣称的回答
country_event = {
	id = xilin_diplo_dlg.20
	title = FROM_RESPOND
	
	desc = { 
		text =  DEMAND_TO_DESTROY_CLAIM_RESPOND_AGREE
		trigger = { 
		    has_country_flag = f_agree
		}
	}
	
	desc = { 
		text =  DEMAND_TO_DESTROY_CLAIM_RESPOND_REFUSE
		trigger = { 
		    has_country_flag = f_refuse
		}
	}
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	immediate = {
	   log = "xilin_diplo_dlg.20 is triggered"
	}
		
	#对方同意
	option = { # Minerals
		name = GOOD
		trigger = {
		    has_country_flag = f_agree
		}
		hidden_effect = {	
		  #移除标记，保证下次会话功能正常
		  remove_country_flag = f_agree	
		  #希灵帝国增加信任,和外交评价  
		  add_trust = { amount = 10  who = event_target:Dip_More_OP_Country }
		  add_opinion_modifier = { modifier = opinion_agree_to_destroy_claim   who = event_target:Dip_More_OP_Country }
		  #发问候给对方，然后结束通话
		  event_target:Dip_More_OP_Country = {
		  		country_event = { id = xilin_diplo_rdlg.17 }
		  }
			#通话结束
		  remove_country_flag = more_diplomacy_engaged
		}
	}	
	#对方拒绝
	option = { # Minerals
		name = RESPOND_TO_REFUSE_DESTROY_CLAIM
		trigger = {
		   has_country_flag = f_refuse 
		}
		custom_tooltip = MAY_DECLARE_WAR
		hidden_effect = {
		  #移除标记，以便下次还能用
		  remove_country_flag = f_refuse
		  	
		  #大大激怒希灵帝国
		  add_opinion_modifier = { modifier = opinion_greate_anger_xilin   who = event_target:Dip_More_OP_Country }
		  #警告对方，然后结束通话
		  event_target:Dip_More_OP_Country = {
		  		country_event = { id = xilin_diplo_rdlg.18 }
		  }
		  #检查开放边境战争理由
		  #check_casus_belli_valid = {
			#		target = event_target:Dip_More_OP_Country
			#		type = cb_open_border
			#}
		  #通话结束
		  remove_country_flag = more_diplomacy_engaged
		}  
	}	
}

#获取科技数据库
country_event = {
	id = xilin_diplo_dlg.21
	title = DEMAND_TO_GET_TECH_LIB
	
	#惩戒国
	desc = { 
		text =  DEMAND_TO_GET_TECH_LIB_A  
		trigger = {
			event_target:Dip_More_OP_Country = { 
					is_subject_type = xilin_discipline
			}
		}
	}
	
	#普通附庸
	desc = { 
		text =  DEMAND_TO_GET_TECH_LIB_B 
		trigger = { 
			event_target:Dip_More_OP_Country = { 
		    NOT = { is_subject_type = xilin_discipline }
		  }
		}
	}
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
		
	#要求获取科技数据库
	option = { # Minerals
		name = LINK_TECH_LIB
		custom_tooltip = WILL_GET_TECH
		copy_techs_from = { target = event_target:Dip_More_OP_Country	}
		hidden_effect = {
		  event_target:Dip_More_OP_Country = {
		      if = {
		      		limit = { NOT = { is_subject_type = xilin_discipline  } }
		      		#添加技术援助修正
		          add_modifier = { modifier = m_xilin_tech_assistance  days = 3600 }
		      }
		      set_country_flag = f_get_tech_lib
		  		country_event = { id = xilin_diplo_rdlg.19 }
		  }	
		  #通话结束
		  remove_country_flag = more_diplomacy_engaged		
		}
	}
			
}


country_event = {
	id = xilin_diplo_dlg.1000
	title = TEST
	desc = THIS_IS_TEST
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_More_OP_Country
		planet_background = event_target:Dip_More_OP_Country
		graphical_culture = event_target:Dip_More_OP_Country
		city_level = event_target:Dip_More_OP_Country
		room = event_target:Dip_More_OP_Country.ruler
	}
	
	immediate = {
      # country_event = { id = xilin_diplo_dlg.1001 }
      # country_event = { id = xilin_diplo_dlg.1002 }
    	set_variable = { which = "v1" value = 2 }
    	set_variable = { which = "v2" value = 2 }
    	if = {
    			limit = {
    					NAND = {
    							check_variable = { which = "V1" value < 4 }
    							check_variable = { which = "V1" value < 4 }
    					}   			   
    			}
    			log = "NAND(1,1)=1"
    			else = {
    			  log = "NAND(1,1)=0"
    			} 
    	}
    	if = {
    			limit = {
    					NAND = {
    							check_variable = { which = "V1" value < 4 }
    							check_variable = { which = "V1" value > 4 }
    					}   			   
    			}
    			log = "NAND(1,0)=1"
    			else = {
    			  log = "NAND(1,0)=0"
    			} 
    	}
    	if = {
    			limit = {
    					NAND = {
    							check_variable = { which = "V1" value > 4 }
    							check_variable = { which = "V1" value < 4 }
    					}   			   
    			}
    			log = "NAND(0,1)=1"
    			else = {
    			  log = "NAND(0,1)=0"
    			} 
    	}
    	if = {
    			limit = {
    					NAND = {
    							check_variable = { which = "V1" value > 4 }
    							check_variable = { which = "V1" value > 4 }
    					}   			   
    			}
    			log = "NAND(0,0)=1"
    			else = {
    			  log = "NAND(0,0)=0"
    			} 
    	}
  }
	
	
	option = { # Minerals
		name = CONTINUE
		#trigger = {
		#      has_country_flag = f_more
	  #}
		hidden_effect = {		  
			country_event = { id = xilin_diplo_dlg.1 }
		}
	}		
}
country_event = {
	id = xilin_diplo_dlg.1001
	title = TEST
	desc = TEST
	picture = GFX_evt_burning_settlement
	show_sound = tut_uplift_reminder
  is_triggered_only = yes
		
	option = {
	  name = OK
	  hidden_effect = {		  
			set_country_flag = f_more
		}
	}	
}

country_event = {
	id = xilin_diplo_dlg.1002
	title = TEST2
	desc = TEST2
	picture = GFX_evt_burning_settlement
	show_sound = tut_uplift_reminder
  is_triggered_only = yes
		
	option = {
	  name = OK
	}	
}