﻿add_namespace = Saleh

### SAU Approach Saleh
country_event = {
	id = Saleh.1
	title = Saleh.1.t
	desc = Saleh.1.d
	
	fire_only_once = yes
	
	trigger = {
		tag = SAU
		date > 2017.2.1
			HOU = {
				has_war_with = YEM
				has_government = communism
				has_country_leader = { 
				ruling_only = yes 
				name = "Abdul-Malik Al-Houthi"
			} 
		}
	}
	
	mean_time_to_happen = {
		days = 175
	}
	
	option = { #Ignore
	name = Saleh.1.a
	log = "[GetDateText]: [This.GetName]: Saleh.1.a executed"
	ai_chance = {
		factor = 5
		modifier = {
			factor = 0
				SAU = {
				has_war = yes
					NOT = {
						has_government = fascism
					}
				}
			}
		}
	}
	
	option = { #Pursue
	name = Saleh.1.b
	log = "[GetDateText]: [This.GetName]: Saleh.1.b executed"
	ai_chance = {
		factor = 25
		modifier = {
		factor = 1
			SAU = {
				has_government = fascism
				has_war = no
				}
			}
		}
		
		hidden_effect = {
			HOU = {
				country_event = { days = 5 id = Saleh.2 }
			}
		}
		custom_effect_tooltip = HOU_Saleh.2
	}
}

### HOU Saleh Suggests Dialogue
country_event = {
	id = Saleh.2
	title = Saleh.2.t
	desc = Saleh.2.d
	
	is_triggered_only = yes
	fire_only_once = yes
	
	option = { #Refuse
	name = Saleh.2.a
	log = "[GetDateText]: [This.GetName]: Saleh.2.a executed"
	ai_chance = {
		factor = 60
		modifier = {
		factor = 1
			HOU = {
				has_government = communism
				has_war_with = YEM
				}
			}
		}
		
		hidden_effect = {
			SAU = {
				country_event = { days = 5 id = Saleh.8 }
			}
		}
		custom_effect_tooltip = HOU_Saleh.4
	}
	
	#option = { #Accept
	#name = Saleh.2.b
	#log = "[GetDateText]: [This.GetName]: Saleh.2.b executed"
	#hidden_effect = {
	#SAU = {
	#country_event = { id = Saleh.3 }
	#		}
	#	}
	# }
}

### SAU Houthi Leaders Willing to Talk
country_event = {
	id = Saleh.3
	title = Saleh.3.t
	desc = Saleh.3.d
	
	is_triggered_only = yes
	fire_only_once = yes
	
	option = { #Accept
	name = Saleh.3.a
	log = "[GetDateText]: [This.GetName]: Saleh.3.a executed"
	ai_chance = {
		factor = 10
	}
		BHR = { country_event = { id = Saleh.14 } }						
		KUW = { country_event = { id = Saleh.14 } }									
		EGY = { country_event = { id = Saleh.14 } }									
		JOR = { country_event = { id = Saleh.14 } }									
		MOR = { country_event = { id = Saleh.14 } }									
		SEN = { country_event = { id = Saleh.14 } }									
		SUD = { country_event = { id = Saleh.14 } }								
	}
	
	option = { #Refuse
	name = Saleh.3.b
	log = "[GetDateText]: [This.GetName]: Saleh.3.b executed"
	ai_chance = {
		factor = 1
		}												  
	}
}

### HOU Saleh Defects
country_event = {
	id = Saleh.5
	title = Saleh.5.t
	desc = Saleh.5.d
	
	is_triggered_only = yes
	fire_only_once = yes
	
	option = { #Find him
	name = Saleh.5.a
	log = "[GetDateText]: [This.GetName]: Saleh.5.a executed"
	ai_chance = {
		factor = 60
		modifier = {
		factor = 1
			HOU = {
				has_government = communism
				has_war_with = YEM
			}
		}
	}
	
	hidden_effect = {
		HOU = { country_event = { days = 5 id = Saleh.6 } }
		}
	}
	
	option = { #Ignore him
	name = Saleh.5.b
	log = "[GetDateText]: [This.GetName]: Saleh.5.b executed"
	ai_chance = {
		factor = 10
		}
	}
}

### HOU Saleh Potential Assassination
country_event = {
	id = Saleh.6
	title = Saleh.6.t
	desc = Saleh.6.d
	
	is_triggered_only = yes
	fire_only_once = yes
	
	option = { #Kill him
	name = Saleh.6.a
	log = "[GetDateText]: [This.GetName]: Saleh.6.a executed"
	ai_chance = {
		factor = 60
		modifier = {
		factor = 1
			HOU = {
				has_government = communism
				has_war_with = YEM
			}
		}
	}
	
	hidden_effect = {
		HOU = {
			set_politics = {
				ruling_party = nationalist
				elections_allowed = no
			}
		
			kill_country_leader = yes
		
			news_event = { hours = 16 id = Saleh.12 }
		
				set_politics = {
					ruling_party = communism
					elections_allowed = no
				}
			}
		}
	}
	
	option = { #Let him go
	name = Saleh.6.b
	log = "[GetDateText]: [This.GetName]: Saleh.6.b executed"
	ai_chance = {
		factor = 5
	}
	hidden_effect = {
		HOU = {
			set_politics = {
				ruling_party = nationalist
				elections_allowed = no
			}
		
			retire_country_leader = yes
		
				set_politics = {
					ruling_party = communism
					elections_allowed = no
				}
			}
		}
	}
}

# HOU Houthi Victory - Revolutionary Committee
country_event = {
	id = Saleh.7
	title = Saleh.7.t
	desc = Saleh.7.d
	picture = GFX_HOU_SPC
	
	fire_only_once = yes

	trigger = {
		tag = HOU
		HOU = {
			has_global_flag = Yemen_Civil_War_Over
			has_country_flag = saleh_ally
		}
			
		NOT = {
			country_exists = YEM
			country_exists = AQY
			has_war = yes
		}
	}

	mean_time_to_happen = {
		days = 2
	}

	option = { #Refuse SPC
		name = Saleh.7.a
		log = "[GetDateText]: [This.GetName]: Saleh.7.a executed"
		ai_chance = {
			factor = 60
		}
		hidden_effect = {
		HOU = {
		set_politics = { 
			ruling_party = nationalist
			elections_allowed = no 
		}
		
		retire_country_leader = yes
		
		clr_global_flag = Yemen_Civil_War_Over
		
		set_politics = { 
			ruling_party = communism
			elections_allowed = no 
			}
		}
	}
	
	YEM = {
		set_party_name = { 
		ideology = nationalist 
		long_name = YEM_nationalist2_party_long
		name = YEM_nationalist2_party
	}
	
	create_country_leader = {
		name = "Ali Abdullah Saleh"
		desc = ""
		picture = "Ali-Saleh.dds"
		expire = "2050.1.1"
		ideology = Nat_Autocracy
		traits = {
			#
		}
	}
	
	 add_opinion_modifier = { target = HOU modifier = hostile_status }
		
	set_politics = { 
		ruling_party = nationalist
		elections_allowed = no 
	}
		
	remove_ideas = { 
		youth_radicalization
	}
			
	hidden_effect = { 
		set_political_party = {
			ideology = nationalist
			popularity = 80
		}
		
		set_political_party = {
			ideology = fascism
			popularity = 2
		}
			
		set_political_party = {
			ideology = communism
			popularity = 14
		}
			
		set_political_party = {
			ideology = democratic
			popularity = 0
		}
			
		set_political_party = {
			ideology = neutrality
			popularity = 4
		}
	}
	
	hidden_effect = {
		add_state_core = 197
		add_state_core = 195
		add_state_core = 198
		add_state_core = 196
		add_state_core = 199
		add_state_core = 194
		add_state_core = 200
		set_state_owner = 198
		set_state_owner = 197
	}
		set_state_controller = 198
		set_state_controller = 197
			
		declare_war_on = {
		target = HOU
		type = civil_war 
	}
			
	hidden_effect = {
			load_oob = "YEM_Saleh"
			set_equipment_fraction = 0.5
			}
		}	
	}

	option = { #Accept SPC
		name = Saleh.7.b
		log = "[GetDateText]: [This.GetName]: Saleh.7.b executed"
		ai_chance = {
			factor = 40
		}
		set_party_name = {
			ideology = nationalist 
			long_name = HOU_nationalist2_party_long
			name = HOU_nationalist2_party
		}
		
		hidden_effect = {
		  set_political_party = {
		  ideology = nationalist
		  popularity = 50
		}
		
		set_political_party = {
			ideology = communism
			popularity = 50
		}
		
		set_political_party = {
			ideology = communism
			popularity = 0	
		}	
	}
	
	add_opinion_modifier = { target = SAU modifier = hostile_status }
	
	set_politics = { 
		ruling_party = nationalist
		elections_allowed = no 
		}
	}
}

### SAU Saudi Arabia Tries Again
country_event = {
	id = Saleh.8
	title = Saleh.8.t
	desc = Saleh.8.d
	
	is_triggered_only = yes
	fire_only_once = yes

	option = { #Try harder
	name = Saleh.8.a
	log = "[GetDateText]: [This.GetName]: Saleh.8.a executed"
	ai_chance = {
		factor = 90
	}
	hidden_effect = {
		custom_effect_tooltip = HOU_Saleh.5
		HOU = {
			country_event = { days = 14 id = Saleh.9 }
			}
		}
	}
	
	option = { #Forget it
	name = Saleh.8.b
	log = "[GetDateText]: [This.GetName]: Saleh.8.b executed"
	ai_chance = {
		factor = 10
		}
	}
}

### HOU Saleh Persists
country_event = {
	id = Saleh.9
	title = Saleh.9.t
	desc = Saleh.9.d
	
	is_triggered_only = yes
	fire_only_once = yes

	#option = { #Accept
	#name = Saleh.9.a
	#log = "[GetDateText]: [This.GetName]: Saleh.9.a executed"
	#ai_chance = {
	#	factor = 8
	#	}
	#SAU = {
	#country_event = { days = 5 id = Saleh.3 }
	#	}
	# }
	
	option = { #Warn Saleh
	name = Saleh.9.b
	log = "[GetDateText]: [This.GetName]: Saleh.9.b executed"
	ai_chance = {
		factor = 60
		modifier = {
		factor = 1
			HOU = {
				has_government = communism
				has_war_with = YEM
			}
		}
	}
		
	hidden_effect = {
		custom_effect_tooltip = HOU_Saleh.6
		SAU = {
			country_event = { days = 5 id = Saleh.10 } }
		}
	}
	
	option = { #Focus on war
	name = Saleh.9.c
	log = "[GetDateText]: [This.GetName]: Saleh.9.c executed"
	ai_chance = {
		factor = 2
	}
	custom_effect_tooltip = HOU_Saleh.3
	hidden_effect = {
		HOU = { country_event = { days = 21 id = Saleh.13 } }
		SAU = { country_event = { days = 21 id = Saleh.13 } }
		BHR = { country_event = { days = 21 id = Saleh.13 } }
		KUW = { country_event = { days = 21 id = Saleh.13 } }
		EGY = { country_event = { days = 21 id = Saleh.13 } }
		JOR = { country_event = { days = 21 id = Saleh.13 } }
		MOR = { country_event = { days = 21 id = Saleh.13 } }
		SEN = { country_event = { days = 21 id = Saleh.13 } }
		SUD = { country_event = { days = 21 id = Saleh.13 } }
		YEM = { country_event = { days = 21 id = Saleh.13 } }
		UAE = { country_event = { days = 21 id = Saleh.13 } }
		}
	}
}

### SAU Saudi Ultimatum
country_event = {
	id = Saleh.10
	title = Saleh.10.t
	desc = Saleh.10.d
	
	is_triggered_only = yes
	fire_only_once = yes

	option = { #Threaten Saleh
	name = Saleh.10.a
	log = "[GetDateText]: [This.GetName]: Saleh.10.a executed"
	ai_chance = {
		factor = 10
	}
	hidden_effect = {
		HOU = {
			country_event = { days = 60 id = Saleh.5 }
			}
		}
		custom_effect_tooltip = HOU_Saleh.7
	}
	
	option = { #Give up
	name = Saleh.10.b
	log = "[GetDateText]: [This.GetName]: Saleh.10.b executed"
	ai_chance = {
		factor = 1
		}
	}
}

### HOU GPC Defects
country_event = {
	id = Saleh.11
	title = Saleh.11.t
	desc = Saleh.11.d
	
	is_triggered_only = yes
	fire_only_once = yes

	option = {
	name = Saleh.11.a
	log = "[GetDateText]: [This.GetName]: Saleh.11.a executed"
	set_political_party = {
		ideology = nationalist
		popularity = 5
		}
	}
}

### WORLD Saleh is Dead
news_event = {
	id = Saleh.12
	title = Saleh.12.t
	desc = Saleh.12.d
	picture = GFX_saleh_killed
	
	is_triggered_only = yes
	major = yes
	
	immediate = {
		hidden_effect = {
			HOU = {
				country_event = { days = 7 id = Saleh.11 } 
			}
		}
	}
	
	option = {
		name = Saleh.12.a
		log = "[GetDateText]: [This.GetName]: Saleh.12.a executed"
		trigger = {
			tag = HOU
		}
	}
	
	option = {
		name = Saleh.12.b
		log = "[GetDateText]: [This.GetName]: Saleh.12.b executed"
		trigger = {
			OR = {
				tag = SAU
				tag = UAE
				tag = BHR
				tag = KUW
				tag = EGY
				tag = JOR
				tag = MOR
				tag = SEN
				tag = SUD
			}
		}
	}
	
	option = {
	name = Saleh.12.c
	log = "[GetDateText]: [This.GetName]: Saleh.12.c executed"
	trigger = {
		NOT = {
			tag = SAU
			tag = UAE
			tag = BHR
			tag = KUW
			tag = EGY
			tag = JOR
			tag = MOR
			tag = SEN
			tag = SUD
			tag = HOU
			}
		}
	}
}

# HOU Saleh renews alliance with Houthis
country_event = {
	id = Saleh.13
	title = Saleh.13.t
	desc = Saleh.13.d
	picture = GFX_saleh_speech
	
	is_triggered_only = yes
	fire_only_once = yes
	
	option = { #Okay
	name = Saleh.13.a
	log = "[GetDateText]: [This.GetName]: Saleh.13.a executed"
	trigger = {
		tag = HOU
	}
	HOU = {
		set_country_flag = saleh_ally
		}
	}
	
	option = { #Damn!
	name = Saleh.13.b
	log = "[GetDateText]: [This.GetName]: Saleh.13.b executed"
	trigger = {
		OR = {
			tag = SAU
			tag = UAE
			tag = BHR
			tag = KUW
			tag = EGY
			tag = JOR
			tag = MOR
			tag = SEN
			tag = SUD
			tag = YEM
			}
		}
	}
}

# SAU Coalition Gathers
country_event = {
	id = Saleh.14
	title = Saleh.14.t
	desc = Saleh.14.d
	
	is_triggered_only = yes
	fire_only_once = yes
	
	immediate = {
	SAU = {
		country_event = { id = Saleh.15 } }
	}
	
	option = {
	name = Saleh.14.a
	log = "[GetDateText]: [This.GetName]: Saleh.14.a executed"
	trigger = {
		OR = {
			tag = BHR
			tag = KUW
			tag = EGY
			tag = JOR
			tag = MOR
			tag = SEN
			tag = SUD
			}
		}
		add_opinion_modifier = { target = HOU modifier = Attended_UAE_summit }
		add_opinion_modifier = { target = UAE modifier = Attended_UAE_summit }
		add_opinion_modifier = { target = SAU modifier = Attended_UAE_summit }
		add_opinion_modifier = { target = YEM modifier = Attended_UAE_summit }
	}
	
	option = {
	name = Saleh.14.b
	log = "[GetDateText]: [This.GetName]: Saleh.14.b executed"
	trigger = {
		OR = {
			tag = BHR
			tag = KUW
			tag = EGY
			tag = JOR
			tag = MOR
			tag = SEN
			tag = SUD
			}
		}
	}
	
	option = {
	name = Saleh.14.c
	log = "[GetDateText]: [This.GetName]: Saleh.14.c executed"
	trigger = {
		tag = UAE
	}
		add_opinion_modifier = { target = HOU modifier = Hosted_UAE_summit }
		add_opinion_modifier = { target = SAU modifier = Hosted_UAE_summit }
		add_opinion_modifier = { target = YEM modifier = Hosted_UAE_summit }
	}
}

# SAU Summit Commences
country_event = {
	id = Saleh.15
	title = Saleh.15.t
	desc = Saleh.15.d
	
	is_triggered_only = yes
	fire_only_once = yes
	
	option = { #Demand Houthi Surrender
	name = Saleh.15.a
	log = "[GetDateText]: [This.GetName]: Saleh.15.a executed"
	HOU = {
		country_event = { id = Saleh.16 } }
	}
	
	option = { #Demand immediate closure to the war, both countries remain independent
	name = Saleh.15.b
	log = "[GetDateText]: [This.GetName]: Saleh.15.b executed"
	HOU = {
		country_event = { id = Saleh.17 }
		}
	}
	
	option = { #Houthi-held land declared Arabian state
	name = Saleh.15.c
	log = "[GetDateText]: [This.GetName]: Saleh.15.c executed"
	HOU = {
		country_event = { id = Saleh.18 } }
	}
}

# HOU Houthi Surrender Choices
country_event = {
	id = Saleh.16
	title = Saleh.16.t
	desc = Saleh.16.d
	
	is_triggered_only = yes
	fire_only_once = yes
	
	option = { #Accept
	name = Saleh.16.a
	log = "[GetDateText]: [This.GetName]: Saleh.16.a executed"
	}
	
	option = { #Refuse
	name = Saleh.16.b
	log = "[GetDateText]: [This.GetName]: Saleh.16.b executed"
	}
}

# HOU Houthi Independence Choices
country_event = {
	id = Saleh.17
	title = Saleh.17.t
	desc = Saleh.17.d
	
	is_triggered_only = yes
	fire_only_once = yes
	
	option = { #Accept
	name = Saleh.17.a
	log = "[GetDateText]: [This.GetName]: Saleh.17.a executed"
	}
	
	option = { #Refuse
	name = Saleh.17.b
	log = "[GetDateText]: [This.GetName]: Saleh.17.b executed"
	}
}