namespace = xilin_diplo_rdlg

#希灵帝国，对话事件的另一方(主要是应答方)

#收到希灵帝国开放边境的要求
country_event = {
	id = xilin_diplo_rdlg.1
	title = DEMAND_OF_OPEN_BORDER
	desc = RECEIVE_DEMAND_TO_OPEN_BORDER_DESC
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_Country
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	
	#同意要求
	option = { # Minerals
		name = AGREE
		trigger = {
			 OR = {
			    is_ai = no
			    #不是(敌意且舰队强大)
			    NAND = {
			    	OR = {
			    		is_unfriendly_to = event_target:Dip_Country
			    		is_domineering_to = event_target:Dip_Country  #盛气凌人
             	is_threatened_to = event_target:Dip_Country #威胁的
             	is_hostile_to = event_target:Dip_Country  #充满敌意
					   	is_rival = event_target:Dip_Country #宿敌
					   	is_country_type = fallen_empire
					   	is_country_type = awakened_fallen_empire
			    	}
			    	OR = {
			    		relative_power = { who = event_target:Dip_Country  category = fleet  value = overwhelming }
			    		relative_power = { who = event_target:Dip_Country  category = fleet  value = superior }
			    	}
			    }
			 }
		}
		ai_chance = {
		    factor = 50
		    modifier = {
				   factor = 0.5
				   OR = {				   		
			    		relative_power = { who = event_target:Dip_Country  category = fleet  value = overwhelming }
			    		relative_power = { who = event_target:Dip_Country  category = fleet  value = superior }
				   }
			  }	
			  modifier = {
				   factor = 2
				   OR = {
				   		relative_power = { who = event_target:Dip_Country  category = fleet  value = inferior }
			    		relative_power = { who = event_target:Dip_Country  category = fleet  value = pathetic }				   		
				   }
			  }		
		}
		hidden_effect = {
		  log = "agree doing"
		  #开放边境
		  set_closed_borders = {
			   	who = event_target:Dip_Country
					status = no
			}	  
			set_country_flag = f_open_border_to_xilin
			#对希灵帝国外交评价，他们强迫我们开放边境
			add_opinion_modifier = { modifier = opinion_forced_to_open_border   who = event_target:Dip_Country }
			#通告希灵，我们的应答
		  event_target:Dip_Country = {
		      set_country_flag = f_agree
		  		country_event = { id = xilin_diplo_dlg.3 }
		  }
		}
	}
	#拒绝要求
	option = {
		name = REFUSE
		trigger = {
			 OR = {
			    is_ai = no
			    #不是友好
			    NOR = {
			    		is_cordial_to = event_target:Dip_Country  #热诚的
              is_friendly_to = event_target:Dip_Country  #友好的
              is_protective_to = event_target:Dip_Country #保护的
			    }
			 }
		}
		ai_chance = {
		    factor = 50
		    modifier = {
				   factor = 2
				   OR = {			   		
			    		relative_power = { who = event_target:Dip_Country  category = fleet  value = overwhelming }
			    		relative_power = { who = event_target:Dip_Country  category = fleet  value = superior }
				   }
			  }	
			  modifier = {
				   factor = 0.5
				   OR = {
				   		relative_power = { who = event_target:Dip_Country  category = fleet  value = inferior }
			    		relative_power = { who = event_target:Dip_Country  category = fleet  value = pathetic }
				   }
			  }	
		}
		hidden_effect = {
			log = "refuse doing [event_target:Dip_Country.GetName]"
			set_country_flag = f_refuse_open_border_to_xilin
		  event_target:Dip_Country = {
					set_country_flag = f_refuse
		  		country_event = { id = xilin_diplo_dlg.3 }
		  }		  
		}
	}
}

#同意后，对方发来问候
country_event = {
	id = xilin_diplo_rdlg.2
	title = DEMAND_OF_OPEN_BORDER
	desc = XILIN_HELLO_DESC
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_Country
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	option = { # Minerals
		name = OK
		#log = "xilin hello is done"
	}	
}

#希灵帝国对拒绝开放边境的回答
country_event = {
	id = xilin_diplo_rdlg.3
	title = DEMAND_OF_OPEN_BORDER
	desc =  RESPOND_TO_REFUSE_OPEN_BORDER
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_Country
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	option = { # Minerals
		name = OK
		#log = "xilin WARNING is done"
	}	
}

#希灵帝国晋升附庸国地位的回答
country_event = {
	id = xilin_diplo_rdlg.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_Country
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	option = { # Minerals
		name = LONG_LIVE_THE_EMPIRE
		hidden_effect = {
			#对希灵帝国外交评价，获得晋升评价，增加信任
			add_opinion_modifier = { modifier = opinion_vassal_level_up   who = event_target:Dip_Country }
			add_trust = { amount = 20  who = event_target:Dip_Country }
		}
	}	
}

#接受希灵帝国技术援助
country_event = {
	id = xilin_diplo_rdlg.5
	title = TECH_ASSISTANCE
	desc = TECH_ASSISTANCE_DESC
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_Country
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	
	option = { 
		name = LONG_LIVE_THE_EMPIRE
		hidden_effect = {
		    #对希灵帝国外交评价，获得晋升评价，增加信任
			  add_opinion_modifier = { modifier = opinion_tech_assistance   who = event_target:Dip_Country }
			  add_trust = { amount = 20  who = event_target:Dip_Country }
		}
	}			
}

#蜂群思维收到对方改革政府的要求
country_event = {
	id = xilin_diplo_rdlg.6
	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_Country
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	
	option = { 
		name = WE_WILL_DO_YOU_WILL
		trigger = {
			has_global_flag = gf_kala_con_we
		}
		hidden_effect = {
		    #改革成和谐蜂群
			  change_government = {
						authority = auth_hive_mind
						civics = { civic = civic_harmonious   civic = random }
				}
				event_target:Dip_Country = {
		  		country_event = { id = xilin_diplo_dlg.8 }
		  	}	
		}		
	}	
	
	option = { 
		name = WHY
		trigger = {
			NOT = { has_global_flag = gf_kala_con_we }
		}
		hidden_effect = {				
		    #询问原因
		    country_event = { id = xilin_diplo_rdlg.7 }
		}		
	}			
}

#（卡拉连接着我们剧情）询问原因
country_event = {
	id = xilin_diplo_rdlg.7
	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_Country.ruler
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	
	option = { 
		name = SEND
		hidden_effect = {
				event_target:Dip_Country = {
					set_global_flag =  gf_kala_con_we
					#蜂群支线
					set_country_flag = f_kala_hive_mind
		  		country_event = { id = xilin_diplo_dlg.9 }
		  	}	
		}
	}			
}

#（卡拉连接着我们剧情1）
country_event = {
	id = xilin_diplo_rdlg.8
	title = npc_chenjun
	desc = KALA_CON_US_TALK1
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_Country.ruler
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	
	option = { 
		name = CONTINUE
		hidden_effect = {
				country_event = { id = xilin_diplo_rdlg.9 }
		}
	}	
}

#（卡拉连接着我们剧情2）
country_event = {
	id = xilin_diplo_rdlg.9
	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_Country.ruler
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	
	option = { 
		name = SEND
		hidden_effect = {
				event_target:Dip_Country = {
		  		country_event = { id = xilin_diplo_dlg.11 }
		  	}
		}
	}	
}

#（卡拉连接着我们剧情3）
country_event = {
	id = xilin_diplo_rdlg.10
	title = npc_chenjun
	desc = KALA_CON_US_TALK3
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_Country.ruler
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	
	option = { 
		name = CONTINUE
		hidden_effect = {
				country_event = { id = xilin_diplo_rdlg.11 }
		}
	}	
}

#（卡拉连接着我们剧情4）
country_event = {
	id = xilin_diplo_rdlg.11
	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_Country.ruler
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	
	option = { 
		name = SEND
		hidden_effect = {
				event_target:Dip_Country = {
		  		country_event = { id = xilin_diplo_dlg.13 }
		  	}
		}
	}	
}

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

#（卡拉连接着我们剧情6）
country_event = {
	id = xilin_diplo_rdlg.13
	title = npc_paopao
	desc = KALA_CON_US_TALK6
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = paopao
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	
	option = { 
		name = CONTINUE
		hidden_effect = {
				country_event = { id = xilin_diplo_rdlg.14 }
		}
	}	
}

#（卡拉连接着我们剧情7）
country_event = {
	id = xilin_diplo_rdlg.14
	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_Country.ruler
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	
	option = { 
		name = SEND
		hidden_effect = {
				event_target:Dip_Country = {
		  		country_event = { id = xilin_diplo_dlg.16 }
		  	}
		}
	}	
}

#（卡拉连接着我们剧情8）
country_event = {
	id = xilin_diplo_rdlg.15
	title = npc_chenjun
	desc = KALA_CON_US_TALK8
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_Country.ruler
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	
	option = { 
		name = KALA_CON_US_TALK9
		hidden_effect = {
				#改革政府成和谐
				change_government = {
						authority = auth_hive_mind
						civics = { civic = civic_harmonious   civic = random }
				}
				add_influence = 100
				add_unity = 1000
				leader = {
					set_name = NAME_KALA
				}
				event_target:Dip_Country = {
		  		country_event = { id = xilin_diplo_dlg.18 }
		  	}
		  	#6个月后触发第二段剧情
		  	country_event = { id = kala_story_rdlg.1 days = 180  random = 10 }
		}
	}	
}

#收到希灵帝国收回宣称的要求
country_event = {
	id = xilin_diplo_rdlg.16
	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_Country
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	
	#同意要求
	option = { # Minerals
		name = AGREE
		trigger = {
			 OR = {
			    is_ai = no
			    #不是(敌意且舰队强大)
			    NOT = {
			      AND = {
			    	  OR = {
			    		  is_unfriendly_to = event_target:Dip_Country
			    		  is_domineering_to = event_target:Dip_Country  #盛气凌人
             	  is_threatened_to = event_target:Dip_Country #威胁的
             	  is_hostile_to = event_target:Dip_Country  #充满敌意
					   	  is_rival = event_target:Dip_Country #宿敌
					   	  is_country_type = fallen_empire
					   	  is_country_type = awakened_fallen_empire
			    	  }
			    	  OR = {
			    		  relative_power = { who = event_target:Dip_Country  category = fleet  value = overwhelming }
			    		  relative_power = { who = event_target:Dip_Country  category = fleet  value = superior }
			    	  }
			    	} #AND
			    } #NOT
			 }
		}
		ai_chance = {
		    factor = 50
		    modifier = {
				   factor = 0.5
				   OR = {				   		
			    		relative_power = { who = event_target:Dip_Country  category = fleet  value = overwhelming }
			    		relative_power = { who = event_target:Dip_Country  category = fleet  value = superior }
				   }
			  }	
			  modifier = {
				   factor = 2
				   OR = {
				   		relative_power = { who = event_target:Dip_Country  category = fleet  value = inferior }
			    		relative_power = { who = event_target:Dip_Country  category = fleet  value = pathetic }				   		
				   }
			  }		
		}
		hidden_effect = {
		  log = "agree doing"
		  #销毁在希灵帝国境内宣称
		  event_target:Dip_Country = {
		  		every_system_within_border = {
		  				limit = { root = { has_claim = prev } }
		  				remove_claims = { who = root }
		  		}
		  }  
			set_country_flag = f_agree_destroy_claim 
			#对希灵帝国外交评价，他们强迫我们销毁宣称
			add_opinion_modifier = { modifier = opinion_forced_to_destroy_claim   who = event_target:Dip_Country }
			#通告希灵，我们的应答
		  event_target:Dip_Country = {
		      set_country_flag = f_agree
		  		country_event = { id = xilin_diplo_dlg.20 }
		  }
		}
	}
	#拒绝要求
	option = {
		name = REFUSE
		trigger = {
			 OR = {
			    is_ai = no
			    #不是友好
			    NOR = {
			    		is_cordial_to = event_target:Dip_Country  #热诚的
              is_friendly_to = event_target:Dip_Country  #友好的
              is_protective_to = event_target:Dip_Country #保护的
              #希灵附庸
              AND = {
			       			is_subject = yes
			       			exists = overlord
			       			overlord = { is_same_empire = event_target:Dip_Country }
			    		}
			    }
			 }
		}
		ai_chance = {
		    factor = 50
		    modifier = {
				   factor = 2
				   OR = {			   		
			    		relative_power = { who = event_target:Dip_Country  category = fleet  value = overwhelming }
			    		relative_power = { who = event_target:Dip_Country  category = fleet  value = superior }
				   }
			  }	
			  modifier = {
				   factor = 0.5
				   OR = {
				   		relative_power = { who = event_target:Dip_Country  category = fleet  value = inferior }
			    		relative_power = { who = event_target:Dip_Country  category = fleet  value = pathetic }
				   }
			  }	
		}
		hidden_effect = {
			log = "refuse doing [event_target:Dip_Country.GetName]"
			set_country_flag = f_refuse_destroy_claim
		  event_target:Dip_Country = {
					set_country_flag = f_refuse
		  		country_event = { id = xilin_diplo_dlg.20 }
		  }		  
		}
	}
}

#同意后，对方发来问候
country_event = {
	id = xilin_diplo_rdlg.17
	title = DEMAND_TO_DESTROY_CLAIM
	desc = XILIN_HELLO_ABOUT_CLAIM_DESC
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_Country
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	option = { # Minerals
		name = OK
		#log = "xilin hello is done"
	}	
}

#希灵帝国对拒绝取消宣称的回答
country_event = {
	id = xilin_diplo_rdlg.18
	title = DEMAND_OF_OPEN_BORDER
	desc = RESPOND_TO_REFUSE_DESTROY_CLAIM
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_Country
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	option = { # Minerals
		name = OK
		#log = "xilin WARNING is done"
	}	
}

#接受希灵帝国链入数据库要求
country_event = {
	id = xilin_diplo_rdlg.19
	title = TECH_ASSISTANCE
	desc = TECH_ASSISTANCE_DESC
	#惩戒国
	desc = { 
		text =  DEMAND_TO_GET_TECH_LIB_A  
		trigger = {
					is_subject_type = xilin_discipline
		}
	}
	
	#普通附庸
	desc = { 
		text =  DEMAND_TO_GET_TECH_LIB_B 
		trigger = { 
		    NOT = { is_subject_type = xilin_discipline }
		}
	}
	
	is_triggered_only = yes
	diplomatic = yes
	force_open = yes
	
	picture_event_data = {	  
		portrait = event_target:Dip_Country
		planet_background = event_target:Dip_Country
		graphical_culture = event_target:Dip_Country
		city_level = event_target:Dip_Country
		room = event_target:Dip_Country.ruler
	}
	
	option = { 
		name = OK
	}			
}