#################################
# Yemen Events					#
#################################
# By Raptor_Jesus and Beelzebub #
#################################

add_namespace = yemen

country_event = { #Intro Event
	id = yemen.1
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.1" }
	title = yemen.1.t
	desc = yemen.1.d
	picture = GFX_report_event_sana
	is_triggered_only = yes
	
	trigger = {
		is_ai = no
		NOT = { has_global_flag = player_dislikes_colonial_flavour_flag }
	}
	#minor_flavor = yes

	option = {
		name = yemen.1.a
	}
}

country_event = { #Black Monday Reaches Yemen
	id = yemen.2
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.2" }
	title = yemen.2.t
	desc = yemen.2.d
	picture = GFX_report_event_arabs
	is_triggered_only = yes

	option = {
		name = yemen.2.a
			if = {
				limit = {
					tag = YEM
					}
			add_ideas = YEM_black_monday
			add_stability = -0.05
			add_political_power = -50
			hidden_effect = {
				country_event = {
					id = yemen.37
					days = 13
				}
			}
		}
	}
}

country_event = { #Rebel Issue event1
	id = yemen.3
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.3" }
	title = yemen.3.t
	desc = yemen.3.d
	picture = GFX_report_event_oasis
	is_triggered_only = yes

	option = { #purge em
		name = yemen.3.a
		add_stability = .05
		set_country_flag = {
			flag = Purges_yes
			value = 0
		}
		hidden_effect = {
			country_event = {
				id = yemen.4
				days = 30
			}
		}
	}
}

country_event = { #Rebels of Asir
	id = yemen.4
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.4" }
	title = yemen.4.t
	desc = yemen.4.d
	picture = GFX_report_event_nomads
	is_triggered_only = yes

	option = { #"I pray God I do not die before I colour my sword here with the blood of these modernists."
		name = yemen.4.a
		custom_effect_tooltip = YEM_authoritarian_tooltip
		add_war_support = -0.03
		add_popularity = {
			ideology = paternal_autocrat
			popularity = 0.03
		}
		modify_country_flag = {
			flag = Purges_yes
			value = 2
		}
		hidden_effect = {
			country_event = {
				id = yemen.5
				days = 30
			}
		}
		ai_chance = {
			factor = 70
			modifier = {
				factor = 0.8
				has_country_flag = YEM_refugees
			}
			modifier = {
				factor = 0
				OR = {
					has_game_rule = {
						rule = YEM_rebel
						option = YEM_IMAM_SOCCON
					}
					has_game_rule = {
						rule = YEM_rebel
						option = YEM_IMAM_SOCLIB
					}
				}
			}
		}
	}

	option = { #we aren't memri
		name = yemen.4.b
		custom_effect_tooltip = YEM_democracy_tooltip
		add_stability = -0.03
		add_popularity = {
			ideology = social_conservative
			popularity = 0.01
		}
		add_popularity = {
			ideology = social_liberal
			popularity = 0.01
		}
		hidden_effect = {
			country_event = {
				id = yemen.5
				days = 30
			}
		}
		ai_chance = {
			factor = 30
			modifier = {
				factor = 0
				has_game_rule = {
					rule = YEM_rebel
					option = YEM_IMAM_SECURE
				}
			}
		}
	}
}

country_event = { #Rebels of Aden
	id = yemen.5
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.5" }
	title = yemen.5.t
	desc = yemen.5.d
	picture = GFX_report_event_minaret
	is_triggered_only = yes

	option = { #"I pray God I do not die before I colour my sword here with the blood of these modernists."
		name = yemen.5.a
		custom_effect_tooltip = YEM_authoritarian_tooltip
		modify_country_flag = {
			flag = Purges_yes
			value = 2
		}
		add_popularity = {
			ideology = paternal_autocrat
			popularity = 0.05
		}
		add_war_support = -0.05
		hidden_effect = {
			country_event = {
				id = yemen.6
				days = 30
			}
		}
		ai_chance = {
			factor = 70
			modifier = {
				factor = 0.8
				has_country_flag = YEM_refugees
			}
			modifier = {
				factor = 0
				OR = {
					has_game_rule = {
						rule = YEM_rebel
						option = YEM_IMAM_SOCCON
					}
					has_game_rule = {
						rule = YEM_rebel
						option = YEM_IMAM_SOCLIB
					}
				}
			}
		}
	}

	option = { #we aren't memri
		name = yemen.5.b
		custom_effect_tooltip = YEM_democracy_tooltip
		add_stability = -0.05
		add_popularity = {
			ideology = social_conservative
			popularity = 0.02
		}
		add_popularity = {
			ideology = social_liberal
			popularity = 0.02
		}
		hidden_effect = {
			country_event = {
				id = yemen.6
				days = 30
			}
		}
		ai_chance = {
			factor = 30
			modifier = {
				factor = 0
				has_game_rule = {
					rule = YEM_rebel
					option = YEM_IMAM_SECURE
				}
			}
		}
	}
}

country_event = { #Ending Anarchy
	id = yemen.6
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.6" }
	title = yemen.6.t
	desc = yemen.6.d
	picture = GFX_report_event_sana
	is_triggered_only = yes

	option = { #end of purges
		name = yemen.6.a
		add_stability = 0.1
		hidden_effect = {
			country_event = {
				id = yemen.7
				days = 8
			}
		}
	}
}

country_event = { #Purge results
	id = yemen.7
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.7" }
	is_triggered_only = yes
	hidden = yes

	immediate = {
		if = {
			limit = {
				has_country_flag = {
					flag = Purges_yes
					value = 0
				}
			}
			country_event = yemen.8
		}
		else_if = {
			limit = {
				has_country_flag = {
					flag = Purges_yes
					value = 2
				}
			}
			country_event = yemen.9
		}
		else = {
			country_event = yemen.10
		}
	}
}

country_event = { #Niceboi
	id = yemen.8
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.8" }
	title = yemen.8.t
	desc = yemen.8.d
	picture = GFX_report_event_oranport
	is_triggered_only = yes

	option = {
		name = yemen.8.a
		add_stability = 0.1
		set_country_flag = {
			flag = woke_rebels
			value = 4
		}
		add_popularity = {
			ideology = social_conservative
			popularity = 0.05
		}
		add_popularity = {
			ideology = social_liberal
			popularity = 0.04
		}
	}
}

country_event = { #half the job
	id = yemen.9
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.9" }
	title = yemen.9.t
	desc = yemen.9.d
	picture = GFX_report_event_oranport
	is_triggered_only = yes

	option = {
		name = yemen.9.a
		set_country_flag = {
			flag = woke_rebels
			value = 2
		}
		add_stability = 0.025
		add_timed_idea = {
			idea = YEM_Purges
			days = 25
		}
		add_popularity = {
			ideology = social_conservative
			popularity = 0.02
		}
		add_popularity = {
			ideology = social_liberal
			popularity = 0.01
		}
	}
}

country_event = { #full purge
	id = yemen.10
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.10" }
	title = yemen.10.t
	desc = yemen.10.d
	picture = GFX_report_event_oranport
	is_triggered_only = yes

	option = {
		name = yemen.10.a
		set_country_flag = {
			flag = complete_purge
			value = 4
		}
		add_stability = -0.1
		add_timed_idea = {
			idea = YEM_Purges
			days = 75
		}
		add_popularity = {
			ideology = social_conservative
			popularity = -0.05
		}
		add_popularity = {
			ideology = social_liberal
			popularity = -0.05
		}
	}
}

country_event = { #Proclamation of the Kingdom
	id = yemen.11
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.11" }
	title = yemen.11.t
	desc = yemen.11.d
	picture = GFX_report_event_sana
	is_triggered_only = yes

	option = {
		name = yemen.11.a
		complete_national_focus = YEM_Free_Kingdom
		add_stability = 0.02
		add_war_support = 0.02
		hidden_effect = {
			news_event = {
				id = worldnews.183
			}
		}
	}
}

country_event = { #Beggining of Rebel Troubles
	id = yemen.12
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.12" }
	is_triggered_only = yes
	hidden = yes

	immediate = {
		if = {
			limit = {
				has_country_flag = {
					flag = woke_rebels
					value > 3
				}
			}
			country_event = yemen.16
		}
		if = {
			limit = {
				has_country_flag = {
					flag = woke_rebels
					value < 3
				}
			}
			country_event = yemen.17
		}
		if = {
			limit = {
				has_country_flag = {
					flag = complete_purge
					value > 3
				}
			}
			country_event = yemen.14
		}
	}
}

### event 13

country_event = { #Purged everything, no revolution
	id = yemen.14
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.14" }
	title = yemen.14.t
	desc = yemen.14.d
	picture = GFX_report_event_sana
	is_triggered_only = yes

	option = {
		name = yemen.14.a
		complete_national_focus = YEM_Rebels_Crushed
		add_stability = 0.1
		add_political_power = -250
	}
}

country_event = { #No purge result
	id = yemen.16
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.16" }
	title = yemen.16.t
	desc = yemen.16.d
	picture = GFX_report_event_square
	is_triggered_only = yes

	option = { #embrace the revolution
		name = yemen.16.a
		hidden_effect = {
			end_coalition = yes
		}
		complete_national_focus = YEM_Remove_Imam
		set_politics = {
			ruling_party = social_conservative
			last_election = "1888.6.15"
			election_frequency = 48
			elections_allowed = no
		}

		set_popularities = {
			totalist = 0
			radical_socialist = 0
			syndicalist = 0
			social_democrat = 0
			social_liberal = 34
			market_liberal = 7
			social_conservative = 38
			authoritarian_democrat = 13
			paternal_autocrat = 8
			national_populist = 0
		}

		remove_all_ministers = yes
		add_ideas = {
			YEM_Hassan_Ali_Bayoumi_hog_sli
			YEM_Muhammad_Ragib_for_sco
			YEM_Abdullah_Al_Wazir_eco_sco
			YEM_Abdullah_bin_Al_Mutawakkil_Ala_Allah_Yahya_sec_sli
		}

		ai_chance = {
			factor = 50
		}
	}

	option = { #RIP Revolution
		name = yemen.16.b
		add_stability = -0.17
		add_political_power = -150
		country_event = {
			id = yemen.18
			days = 5
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0
				OR = {
					has_game_rule = {
						rule = YEM_rebel
						option = YEM_IMAM_SOCCON
					}
					has_game_rule = {
						rule = YEM_rebel
						option = YEM_IMAM_SOCLIB
					}
				}
			}
		}
	}
}

country_event = { #Moderate Purge result, less likely to fall
	id = yemen.17
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.17" }
	title = yemen.17.t
	desc = yemen.17.d
	picture = GFX_report_event_sana
	is_triggered_only = yes

	option = { #You're a Republic
		name = yemen.17.a
		hidden_effect = {
			end_coalition = yes
		}
		complete_national_focus = YEM_Remove_Imam
		set_politics = {
			ruling_party = social_conservative
			last_election = "1888.6.15"
			election_frequency = 48
			elections_allowed = no
		}

		set_popularities = {
			totalist = 0
			radical_socialist = 0
			syndicalist = 0
			social_democrat = 0
			social_liberal = 34
			market_liberal = 7
			social_conservative = 38
			authoritarian_democrat = 13
			paternal_autocrat = 8
			national_populist = 0
		}

		remove_all_ministers = yes
		add_ideas = {
			YEM_Hassan_Ali_Bayoumi_hog_sli
			YEM_Muhammad_Ragib_for_sco
			YEM_Abdullah_Al_Wazir_eco_sco
			YEM_Abdu'llah_bin_Al_Mutawakkil_'Ala_Allah_Yahya_sec_sli
		}
		ai_chance = {
			factor = 30
		}
	}

	option = { #RIP Revolution
		name = yemen.17.b
		add_stability = -.15
		country_event = {
			id = yemen.19
			days = 5
		}
		ai_chance = {
			factor = 70
		}
	}
}

country_event = { #No purge failed revolution
	id = yemen.18
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.18" }
	title = yemen.18.t
	desc = yemen.18.d
	picture = GFX_report_event_sana
	is_triggered_only = yes

	option = {
		name = yemen.18.a #add some other options to expand the chain
		add_stability = -.05
		add_timed_idea = {
			idea = YEM_Purges
			days = 100
		}
		complete_national_focus = YEM_Rebels_Crushed
	}
}

country_event = { #Moderate purge failed revolution
	id = yemen.19
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.19" }
	title = yemen.19.t
	desc = yemen.19.d
	picture = GFX_report_event_sana
	is_triggered_only = yes

	option = {
		name = yemen.19.a #add some other options to expand the chain
		add_stability = -.05
		add_timed_idea = {
			idea = YEM_Purges
			days = 50
		}
		complete_national_focus = YEM_Rebels_Crushed
	}
}

country_event = { #Elections
	id = yemen.20
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.20" }
	title = yemen.20.t
	desc = yemen.20.d
	picture = GFX_report_event_arabs
	is_triggered_only = yes
	fire_only_once = yes

	option = { #SocCons
		name = yemen.20.a
		ai_chance = {
			factor = 60
			modifier = {
				factor = 0
				has_game_rule = {
					rule = YEM_rebel
					option = YEM_IMAM_SOCLIB
				}
			}
		}
		complete_national_focus = YEM_Soc_Cons
		add_political_power = 35
		effect_tooltip = {
			set_politics = {
				ruling_party = social_conservative
				elections_allowed = yes
				election_frequency = 48
			}
		}
		hidden_effect = {
			meta_effect = {
				text = {
					set_politics = {
						ruling_party = social_conservative
						last_election = "[CURRENT_DATE]"
						election_frequency = 48
						elections_allowed = yes
					}
				}
				CURRENT_DATE = "[?global.date.GetDateStringNoHour]"
			}
		}
		add_popularity = {
			ideology = social_conservative
			popularity = 0.05
		}
		remove_all_ministers = yes
		add_ideas = {
			YEM_Ali_Nasser_Al_Qardai_hog_sco
			YEM_Muhammad_Ragib_for_sco
			YEM_Abdullah_Al_Wazir_eco_sco
			YEM_Jamal_Jamil_sec_sco
		}
	}

	option = { #SocLibs
		name = yemen.20.b
		ai_chance = {
			factor = 40
			modifier = {
				factor = 0
				has_game_rule = {
					rule = YEM_rebel
					option = YEM_IMAM_SOCCON
				}
			}
		}
		complete_national_focus = YEM_Soc_Libs
		add_stability = -0.01
		effect_tooltip = {
			set_politics = {
				ruling_party = social_liberal
				elections_allowed = yes
				election_frequency = 48
			}
		}
		hidden_effect = {
			meta_effect = {
				text = {
					set_politics = {
						ruling_party = social_liberal
						last_election = "[CURRENT_DATE]"
						election_frequency = 48
						elections_allowed = yes
					}
				}
				CURRENT_DATE = "[?global.date.GetDateStringNoHour]"
			}
		}
		add_popularity = {
			ideology = social_liberal
			popularity = 0.05
		}
		remove_all_ministers = yes
		add_ideas = {
			YEM_Hassan_Ali_Bayoumi_hog_sli
			YEM_Mohammed_Mahmoud_Al_Zubairi_for_sli
			YEM_Abdul_Qawi_al_Mukhabrabash_eco_sli
			YEM_Abdu'llah_bin_Al_Mutawakkil_'Ala_Allah_Yahya_sec_sli
		}
	}
}

country_event = { #Sending equipment to Jabal
	id = yemen.27
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.27" }
	title = yemen.27.t
	desc = yemen.27.d
	picture = GFX_report_event_JBS_Horses

	trigger = {
		JBS = { has_war_with = SAU }
	}

	is_triggered_only = yes

	option = {
		name = yemen.27.a
		ai_chance = {
			factor = 90
		}
		add_equipment_to_stockpile = {
			type = infantry_equipment_1
			amount = -300
		}
		add_war_support = 0.02
		JBS = {
			country_event = {
				id = yemen.28
				days = 1
			}
		}
	}

	option = {
		name = yemen.27.b
		ai_chance = {
			factor = 10
		}
		add_political_power = -20
	}
}

country_event = { #Jabal getting the supplies
	id = yemen.28
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.28" }
	title = yemen.28.t
	desc = yemen.28.d
	picture = GFX_report_event_sana
	is_triggered_only = yes
	fire_only_once = yes

	option = {
		name = yemen.28.a
		add_equipment_to_stockpile = {
			type = infantry_equipment_1
			amount = 300
		}
	}
}

country_event = { #White peace with Oman
	id = yemen.29
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.29" }
	title = yemen.29.t
	desc = yemen.29.d
	picture = GFX_report_event_oasis
	trigger = {
		tag = YEM
		is_valid_peace_target = yes
		has_war_with = OMA
		OMA = {
			is_valid_peace_target = yes
			owns_state = 1024 #Dhofar
		}
		controls_state = 1024
		OR = {
			controls_state = 294 #Muscat
			controls_state = 859 #Oman
		}
	}
	fire_only_once = yes
	mean_time_to_happen = {
		days = 90
	}

	option = { #Peace
		name = yemen.29.a
		ai_chance = {
			factor = 100
		}
		transfer_state = 1024
		OMA = { white_peace_with_ROOT = yes }
		hidden_effect = {
			country_event = {
				id = yemen.30
				days = 127
			}
		}
	}
	option = { #No peace
		name = yemen.29.b
		ai_chance = {
			factor = 0
		}
		add_war_support = -0.1
		every_state = {
				limit = { is_core_of = OMA }
				add_claim_by = YEM
			}
		hidden_effect = {
			country_event = {
				id = yemen.31
				days = 40
				random_days = 40
			}
		}
	}
}

country_event = { #Coring Dhofar, peace variant
	id = yemen.30
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.30" }
	title = yemen.30.t
	desc = yemen.30.d
	is_triggered_only = yes
	fire_only_once = yes
	picture = GFX_report_event_oasis

	option = {
		name = yemen.30.a
		1024 = {
			add_core_of = YEM
		}
	}
}

country_event = { #Coring Dhofar, war variant
	id = yemen.31
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.31" }
	title = yemen.31.t
	desc = yemen.31.d
	picture = GFX_report_event_oasis
trigger = {
		owns_state = 1024
	}
	is_triggered_only = yes

	option = { #Peace
		name = yemen.31.a
		every_state = {
				limit = { is_core_of = OMA }
				add_core_of = YEM
		}
	}
}

country_event = { #Imam being hanged
	id = yemen.32
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.32" }
	title = yemen.32.t
	desc = yemen.32.d
	picture = GFX_report_event_sana
	is_triggered_only = yes
	fire_only_once = yes

	option = {
		name = yemen.32.a
		add_political_power = 50
		create_country_leader = {
			name = "Ahmad bin Yahya"
			picture = "gfx/leaders/YEM/Portrait_YEM_Ahmad_bin_Yahya.png"
			expire = "1.1.1"
			ideology = absolute_monarchy_subtype
		}
		create_country_leader = {
			name = "Ahmad bin Yahya"
			picture = "gfx/leaders/YEM/Portrait_YEM_Ahmad_bin_Yahya.png"
			expire = "1.1.1"
			ideology = oligarchy_subtype
		}

		add_popularity = {
			ideology = paternal_autocrat
			popularity = -0.03
		}
		add_popularity = {
			ideology = authoritarian_democrat
			popularity = -0.03
		}
	}
}

country_event = { #Killing Sauds
	id = yemen.33
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.33" }
	title = yemen.33.t
	desc = yemen.33.d
	picture = GFX_report_event_sana
	is_triggered_only = yes
	fire_only_once = yes

	option = {
		name = yemen.33.a
		add_war_support = 0.01
	}
}

country_event = { #Rassids in the house
	id = yemen.34
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.34" }
	title = yemen.34.t
	desc = yemen.34.d
	picture = GFX_report_event_JBS_Horses
	is_triggered_only = yes
	fire_only_once = yes

	option = {
		name = yemen.34.a
		add_war_support = 0.01
	}
}

country_event = { #Killing suspicous rebels
	id = yemen.35
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.35" }
	title = yemen.35.t
	desc = yemen.35.d
	picture = GFX_report_event_JBS_Horses
	is_triggered_only = yes
	fire_only_once = yes

	option = {
		name = yemen.35.a
		add_stability = 0.03
		add_popularity = {
			ideology = social_conservative
			popularity = -0.05
		}
		add_popularity = {
			ideology = social_liberal
			popularity = -0.05
		}
	}
}

country_event = { #refugees
	id = yemen.36
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.36" }
	title = yemen.36.t
	desc = yemen.36.d
	picture = GFX_report_event_sana
	is_triggered_only = yes
	fire_only_once = yes

	option = {
		name = yemen.36.a
		add_stability = -0.1
		add_popularity = {
			ideology = social_conservative
			popularity = 0.01
		}
		add_popularity = {
			ideology = social_liberal
			popularity = 0.02
		}
		set_country_flag = YEM_refugees
	}
}

country_event = { #Black Monday makes Republic popular
	id = yemen.37
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.37" }
	title = yemen.37.t
	desc = yemen.37.d
	picture = GFX_report_event_minaret
	is_triggered_only = yes
	fire_only_once = yes

	option = {
		name = yemen.37.a
		add_stability = -0.05
		add_popularity = {
			ideology = social_conservative
			popularity = 0.03
		}
		add_popularity = {
			ideology = social_liberal
			popularity = 0.02
		}
	}
}

country_event = { #Germany, Yemen wants a ship
	id = yemen.38
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.38" }
	title = yemen.38.t
	desc = yemen.38.d
	picture = GFX_report_event_GER_suez
	is_triggered_only = yes
	fire_only_once = yes

	option = {
		name = yemen.38.a
		ai_chance = {
			factor = 95
		}
		YEM = {
			country_event = {
				id = yemen.39
				days = 1
			}
		}
		add_stability = .05
	}

	option = {
		name = yemen.38.b
		ai_chance = {
			factor = 5
		}
		YEM = {
			country_event = {
				id = yemen.40
				days = 1
			}
		}
	}
}

country_event = { #Germany gives ship
	id = yemen.39
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.39" }
	title = yemen.39.t
	desc = yemen.39.d
	picture = GFX_report_event_GER_suez
	is_triggered_only = yes
	fire_only_once = yes

	option = {
		name = yemen.39.a
		hidden_effect = {
			set_technology = {
				early_ship_hull_cruiser = 1
				basic_torpedo = 1
				basic_battery = 1
				coastal_defense_ships = 1
				popup = no
			}
			YEM_EVENT_CDS01_naval_variant = yes
			load_oob = YEM_Ship
		}
		custom_effect_tooltip = YEM_flagship_tooltip
	}
}

country_event = { #Germany no gives ship
	id = yemen.40
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.40" }
	title = yemen.40.t
	desc = yemen.40.d
	is_triggered_only = yes
	fire_only_once = yes
	picture = GFX_report_event_GER_suez

	option = {
		name = yemen.40.a
		add_stability = -0.02
	}
}

country_event = { #Generic Elections
	id = yemen.41
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.41" }
	title = yemen.41.t
	desc = yemen.41.d
	picture = GFX_report_event_sana
	is_triggered_only = yes
trigger = {
		OR = {
			has_government = social_conservative
			has_government = social_liberal
		}
	}

	option = { #SocCons
		name = yemen.41.a
		ai_chance = {
			factor = 60
		}
		add_political_power = 35
		set_politics = {
			ruling_party = social_conservative
			election_frequency = 48
			elections_allowed = yes
		}
		add_popularity = {
			ideology = social_conservative
			popularity = 0.05
		}
		remove_all_ministers = yes
		add_ideas = {
			YEM_Ali_Nasser_Al_Qardai_hog_sco
			YEM_Muhammad_Ragib_for_sco
			YEM_Abdullah_Al_Wazir_eco_sco
			YEM_Jamal_Jamil_sec_sco
		}
	}

	option = { #SocLibs
		name = yemen.41.b
		ai_chance = {
			factor = 40
		}
		add_political_power = -60
		add_popularity = {
			ideology = social_liberal
			popularity = 0.05
		}
		set_politics = {
			ruling_party = social_liberal
			election_frequency = 48
			elections_allowed = yes
		}
		remove_all_ministers = yes
		add_ideas = {
			YEM_Hassan_Ali_Bayoumi_hog_sli
			YEM_Mohammed_Mahmoud_Al_Zubairi_for_sli
			YEM_Abdul_Qawi_al_Mukhabrabash_eco_sli
			YEM_Abdu'llah_bin_Al_Mutawakkil_'Ala_Allah_Yahya_sec_sli
		}
	}
}

country_event = { #Saudi peace event
	id = yemen.42
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.42" }
	title = yemen.42.t
	desc = yemen.42.d
	picture = GFX_report_event_JBS_Horses
trigger = {
		tag = YEM
		has_war_with = SAU
		is_valid_peace_target = yes
		OR = {
			owns_state = 981 #Najran
			owns_state = 982 #Asir
		}
		SAU = {
			is_valid_peace_target = yes
			controls_state = 982
		}
	}

	fire_only_once = yes

	mean_time_to_happen = {
		days = 90
	}

	option = { #Offer Najd peace
		name = yemen.42.a
		ai_chance = {
			factor = 100
		}
		add_stability = -0.10
		add_war_support = -0.05
		SAU = {
			country_event = {
				id = yemen.43
				days = 1
			}
		}
	}

	option = {
		name = yemen.42.b
		ai_chance = {
			factor = 10
		}
		add_stability = -0.05
		add_war_support = -0.10
	}
}

country_event = { #Najd gets peace offer
	id = yemen.43
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.43" }
	title = yemen.43.t
	desc = yemen.43.d
	picture = GFX_report_event_sana
	is_triggered_only = yes

	option = { #Accept
		name = yemen.43.a
		ai_chance = {
			factor = 70
		}
		FROM = {
			every_owned_state = {
				limit = {
					OR = {
						state = 679 #Hejaz
						state = 754 #Medina
						state = 981 #Najran
						state = 982 #Asir
						is_claim_or_core_of_ROOT = yes
					}
				}
				ROOT = { transfer_state = PREV }
			}
			white_peace_with_ROOT = yes
			country_event = {
				id = yemen.44
				days = 1
			}
		}
	}

	option = {
		name = yemen.43.b
		ai_chance = {
			factor = 30
		}
		FROM = {
			country_event = {
				id = yemen.45
				days = 1
			}
		}
	}
}

country_event = { #Najd accepts peace offer
	id = yemen.44
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.44" }
	title = yemen.44.t
	desc = yemen.44.d
	picture = GFX_report_event_nomads
	is_triggered_only = yes

	option = {
		name = yemen.44.a
		add_stability = 0.01
	}
}

country_event = { #Najd denies peace offer
	id = yemen.45
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.45" }
	title = yemen.45.t
	desc = yemen.45.d
	picture = GFX_report_event_nomads
	is_triggered_only = yes

	option = {
		name = yemen.45.a
		add_war_support = 0.02
	}
}

country_event = { #Imam Yahya Declares His Independence
	id = yemen.46
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.46" }
	title = yemen.46.t
	desc = yemen.46.d
	picture = GFX_report_event_minaret

	is_triggered_only = yes
	fire_only_once = yes

	option = {
		name = yemen.46.a
		ai_chance = {
			factor = 30
		}
		679 = {
			ott_increase_revolt_risk = yes
		}
		754 = {
			ott_increase_revolt_risk = yes
		}
		658 = {
			ott_increase_revolt_risk = yes
		}
		993 = {
			ott_increase_revolt_risk = yes
		}
		907 = {
			ott_increase_revolt_risk = yes
		}
	}

	option = {
		name = yemen.46.b
		ai_chance = {
			factor = 70
		}
		trigger = {
			can_declare_war_on = YEM
		}
		declare_war_on = {
			target = YEM
			type = annex_everything
		}
		set_country_flag = YEM_CONQ
	}
}

country_event = { #
	id = yemen.47
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.47" }
	title = yemen.47.t
	desc = yemen.47.d
	picture = GFX_report_event_JBS_Horses
	is_triggered_only = yes
	fire_only_once = yes

	option = {
		name = yemen.47.a
		ai_chance = {
			factor = 100
		}
		add_political_power = 75
		add_stability = 0.075
		increase_ruling_party_popularity_by_2 = yes
	}
	option = {
		name = yemen.47.b
		ai_chance = {
			factor = 0
		}
		add_political_power = -50
		add_war_support = 0.075
		increase_ruling_party_popularity_by_3 = yes
		every_state = {
				limit = { is_core_of = OMA }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = SYR }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = IRQ }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = LBA }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = LEB }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = EGY }
				add_core_of = YEM
		}
		hidden_effect = {
		819 = {	add_core_of = YEM }
		352 = {	add_core_of = YEM }
		350 = {	add_core_of = YEM }
		905 = { add_core_of = YEM }
		}
	}
	option = {
		name = yemen.47.c
		ai_chance = {
			factor = 0
		}
		add_political_power = -75
		add_war_support = 0.10
		increase_ruling_party_popularity_by_5 = yes
		every_state = {
				limit = { is_core_of = OMA }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = SYR }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = IRQ }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = LBA }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = LEB }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = EGY }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = LBA }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = TRP }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = TUN }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = ALG }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = MOR }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = MRT }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = ERI }
				add_core_of = YEM
		}
		every_state = {
				limit = { is_core_of = DJI }
				add_core_of = YEM
		}
		every_state = {
				limit = {
				OR = {
					is_core_of = SOM
					is_claimed_by = SOM
					}
				}
				add_core_of = YEM
			}
		hidden_effect = {
		819 = {	add_core_of = YEM }
		352 = {	add_core_of = YEM }
		350 = {	add_core_of = YEM }
		450 = {	add_core_of = YEM }
		905 = { add_core_of = YEM }
		}
	}
}

country_event = { #Yemen ideology change
	id = yemen.48
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.48" }
	title = yemen.48.t
	desc = yemen.48.d
	picture = GFX_report_event_nomads
	is_triggered_only = yes

	option = {
		name = yemen.48.a
			set_politics = {
			ruling_party = authoritarian_democrat
			last_election = "1888.6.15"
			election_frequency = 48
			elections_allowed = no
		}
		create_country_leader = {
			name = "Yahya al Hamid"
			desc = "POLITICS_YAHYA_HAMID_DESC"
			picture = "gfx/leaders/YEM/Portrait_YEM_imam_yaha_kr.png"
			expire = "1.1.1"
			ideology = oligarchy_subtype
		}
	}
	
	option = {
		name = yemen.48.b
		add_stability = 0.01
	}
	
	option = {
		name = yemen.48.c
			set_politics = {
			ruling_party = national_populist
			last_election = "1888.6.15"
			election_frequency = 48
			elections_allowed = no
		}
		create_country_leader = {
			name = "Yahya al Hamid"
			desc = "POLITICS_YAHYA_HAMID_DESC"
			picture = "gfx/leaders/YEM/Portrait_YEM_imam_yaha_kr.png"
			expire = "1.1.1"
			ideology = natpop_islamism_subtype
		}
	}
}

country_event = { #Chaos event
	id = yemen.49
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.49" }
	title = yemen.49.t
	desc = yemen.49.d
	picture = GFX_report_event_minaret
	is_triggered_only = yes

	option = {
		name = yemen.49.a
		add_ideas = YEM_Yemen_On_Fire
		if = {
			limit = {
				is_in_faction_with = EGY
			}
			EGY = {
				remove_from_faction = ROOT
			}
			ROOT = {
				separate_peace_all_wars = yes
			}
		}
	}
}

country_event = { #YEM - a separate peace?
	id = yemen.50
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.50" }
	title = yemen.50.t
	desc = yemen.50.d
	picture = GFX_report_event_minaret
	is_triggered_only = yes

	trigger = {
		YEM = {
			has_war_with = TUR
			is_in_faction_with = EGY
			controls_state = 293
			controls_state = 982
		}
	}

	option = {
		name = yemen.50.a
		ai_chance = {
			factor = 60
		}
		TUR = {
			country_event = {
				id = yemen.51
				days = 2
			}
		}
	}
	option = {
		name = yemen.50.b # no!
		ai_chance = {
			factor = 40
		}
		add_war_support = 0.02
	}
}

country_event = { #TUR - Yemen asks for a separate peace
	id = yemen.51
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.51" }
	title = yemen.51.t
	desc = yemen.51.d
	picture = GFX_report_event_minaret
	is_triggered_only = yes

	trigger = {
		YEM = {
			has_war_with = TUR
			is_in_faction_with = EGY
		}
	}

	option = {
		name = yemen.51.a
		ai_chance = {
			factor = 60 # sure, peace, fine
		}
		YEM = {
			country_event = {
				id = yemen.52
				days = 2
			}
		}
	}
	option = {
		name = yemen.51.b # no!
		ai_chance = {
			factor = 40 # no!
		}
		YEM = {
			country_event = {
				id = yemen.54
				days = 2
			}
		}
	}
}

country_event = { #YEM - Turks accept
	id = yemen.52
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.52" }
	title = yemen.52.t
	desc = yemen.52.d
	picture = GFX_report_event_minaret
	is_triggered_only = yes

	trigger = {
		YEM = {
			has_war_with = TUR
			is_in_faction_with = EGY
		}
	}

	option = {
		name = yemen.52.a #nice
		separate_peace_all_wars = yes
		if = {
			limit = {
				TUR = {
					owns_state = 752
				}
			}
			YEM = {
				transfer_state = 752
			}
		}
		if = {
			limit = {
				TUR = {
					owns_state = 659
				}
			}
			YEM = {
				transfer_state = 659
			}
		}
		EGY = {
			remove_from_faction = YEM
		}
		add_stability = 0.05
		EGY = {
			country_event = {
				id = yemen.53
				days = 2
			}
		}
	}
}

country_event = { #EGY - Yemen betrayed us!
	id = yemen.53
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.53" }
	title = yemen.53.t
	desc = yemen.53.d
	picture = GFX_report_event_minaret
	is_triggered_only = yes

	option = {
		name = yemen.53.a #wtf
		ai_chance = {
			factor = 80
		}
		add_political_power = -10
		add_opinion_modifier = { 
			target = YEM 
			modifier = KR_disapproves_of_govt
		}
	}
	option = {
		name = yemen.53.b #crush them!
		ai_chance = {
			factor = 20
		}
		EGY = { declare_war_on = { target = YEM type = annex_everything } }
		add_political_power = -50
		add_opinion_modifier = {
			target = YEM 
			modifier = KR_disapproves_of_govt
		}
	}
}

country_event = { #YEM - Turkey refused!
	id = yemen.54
	immediate = { log = "[GetDateText]: [Root.GetName]: event yemen.54" }
	title = yemen.54.t
	desc = yemen.54.d
	picture = GFX_report_event_minaret
	is_triggered_only = yes

	option = {
		name = yemen.54.a #wtf
		add_political_power = -30
	}
}