KoK_YEM_missions_1 = {
	slot = 1
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		YEM_is_yemeni_nation = yes
		has_dlc = "King of Kings"
		NOT = { map_setup = map_setup_random }
		
		#added
		NOT = {
			tag = HIM
			was_tag = HIM
		}
	}
	has_country_shield = yes
	
	YEM_rassids = {
		icon = mission_reclaim_morocco
		required_missions = { YEM_an_imminent_collapse }
		position = 2
		provinces_to_highlight = {
			OR = {
				province_id = 390
				province_id = 2346
				province_id = 391
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			390 = { country_or_non_sovereign_subject_holds = ROOT }
			2346 = { country_or_non_sovereign_subject_holds = ROOT }
			391 = { country_or_non_sovereign_subject_holds = ROOT }
		}
		effect = {
			add_mil_power = 50
			
			custom_tooltip = " "
			
			if = {
				limit = {
					religion = shiite
				}
				add_country_modifier = {
					name = YEM_the_dawah
					duration = 7300
				}
				
				custom_tooltip = YEM_for_every_shia_province
				hidden_effect = {
					if = {
						limit = {
							num_of_owned_provinces_with = {
								religion = shiite
								value = 6
							}
						}
						add_yearly_manpower = 1.5
					}
					else = {
						every_owned_province = {
							limit = {
								religion = shiite
							}
							ROOT = {
								add_yearly_manpower = 0.25
							}
						}
					}
				}
			}
			else = {
				add_country_modifier = {
					name = YEM_defeated_the_zindiqs
					duration = 10950
				}
			}
		}
	}
	
	YEM_islamic_ambitions = {
		icon = mission_into_arabia
		required_missions = { YEM_unite_yemen YEM_rassids }
		position = 4
		provinces_to_highlight = {
			OR = {
				province_id = 384 
				province_id = 385
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			384 = { country_or_non_sovereign_subject_holds = ROOT }
			385 = { country_or_non_sovereign_subject_holds = ROOT }
		}
		effect = {
			give_claims = { region = arabia_region }
			
			custom_tooltip = " "
			
			if = {
				limit = {
					has_dlc = "Leviathan"
				}
				custom_tooltip = YEM_upgrade_kaaba
				custom_tooltip = " "
			}
			else = {
				add_country_modifier = {
					name = YEM_caravans_to_mecca
					duration = -1
				}
			}
			
			if = {
				limit = {
					has_dlc = "Mandate of Heaven"
				}
				add_splendor = 400
			}
			else = {
				add_prestige_or_monarch_power = { amount = 25 }
			}
		}
	}
	
	YEM_arabian_ambitions = {
		icon = mission_arabian_fort
		required_missions = { YEM_islamic_ambitions }
		position = 5
		provinces_to_highlight = {
			region = arabia_region
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				region = arabia_region
				value = 40 
			}
			total_development = 300
		}
		effect = {
			give_claims = { region = egypt_region }
			give_claims = { region = mashriq_region }
			
			custom_tooltip = " "
			
			add_permanent_power_projection = {
				type = yem_permanent_power_projection
				amount = 5
			}
			
			custom_tooltip = " "
			
			custom_tooltip = YEM_no_more_tech_req
			set_country_flag = free_arabia_forming_flag
		}
	}
}

KoK_YEM_missions_2 = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		YEM_is_yemeni_nation = yes
		has_dlc = "King of Kings"
		NOT = { map_setup = map_setup_random }	
		
		#added
		NOT = {
			tag = HIM
			was_tag = HIM
		}
	}
	has_country_shield = yes
	
	YEM_an_imminent_collapse = {
		icon = mission_imperial_cities
		required_missions = { }
		position = 1
		provinces_to_highlight = {
		}
		trigger = {
			OR = {
				army_size_percentage = 0.9
				is_at_war = yes
			}
			num_of_generals = 1
		}
		effect = {
			give_claims = { area = yemen_area }
			give_claims = { area = upper_yemen_area }
			give_claims = { area = hadramut_area }
			give_claims = { area = mahra_area }
			give_claims = { area = asir_area }
			give_claims = { area = tihama_al_yemen_area }
			
			custom_tooltip = " "
			
			if = {
				limit = {
					tag = RAS
				}
				add_country_modifier = {
					name = YEM_to_play_the_cards_right
					duration = 3650
				}
			}
			
			if = {
				limit = {
					tag = YEM
				}
				add_country_modifier = {
					name = YEM_fight_for_survival
					duration = 3650
				}
			}
			
			if = {
				limit = {
					tag = ADE
				}
				add_country_modifier = {
					name = YEM_triumph_of_the_tahirids
					duration = 3650
				}
			}
			
			if = {
				limit = {
					NOT = {
						OR = {
							tag = ADE
							tag = YEM
							tag = RAS
						}
					}
				}
				add_country_modifier = {
					name = YEM_exploit_the_chaos
					duration = 3650
				}
			}
		}
	}
	
	YEM_rasulids = {
		icon = mission_break_sicily
		required_missions = { YEM_an_imminent_collapse }
		position = 2
		provinces_to_highlight = {
			if = {
				limit = {
					root = {
						tag = YEM
						not = { has_country_flag = formed_yemen_flag }
					}
				}
				province_id = 390
			}
			else = {
				OR = {
					owned_by = YEM
					province_id = 4280 # Taiz
				}
			}
			not = { owned_by = root }
		}
		trigger = {
			OR = {
				tag = YEM
				NOT = { exists = YEM }
			}
			if = {
				limit = {
					tag = YEM
					not = { has_country_flag = formed_yemen_flag }
				}
				390 = { owned_by = ROOT }
			}
			else = {
				4280 = { owned_by = ROOT }
			}
		}
		effect = {
			if = {
				limit = {
					tag = YEM
					not = { has_country_flag = formed_yemen_flag }
				}
				390 = {
					add_base_tax = 1
					add_base_production = 1
					add_base_manpower = 1
				}
			}
			else = {
				4280 = {
					add_base_tax = 1
					add_base_production = 1
					add_base_manpower = 1
				}
			}
			custom_tooltip = " "
			
			add_country_modifier = {
				name = YEM_capture_of_taiz
				duration = 9125
			}
			
			add_dip_power = 50
		}
	}
	
	YEM_unite_yemen = {
		icon = mission_pacify_the_berbers
		required_missions = { YEM_rassids YEM_rasulids YEM_tahirids }
		position = 3
		provinces_to_highlight = {
			OR = {
				area = tihama_al_yemen_area
				area = yemen_area
				area = asir_area
				area = mahra_area
				area = upper_yemen_area
				area = hadramut_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = tihama_al_yemen_area
					area = yemen_area
					area = asir_area
					area = mahra_area
					area = upper_yemen_area
					area = hadramut_area
				}
				value = 14
			}
		}
		effect = {
			add_stability_or_adm_power = yes
			
			custom_tooltip = " "
			
			give_claims = { area = tabuk_area }
			give_claims = { area = mecca_area }
			give_claims = { area = medina_area }
			
			give_claims = { area = aussa_area }
			give_claims = { area = ifat_area }
			give_claims = { area = somaliland_area }
			give_claims = { area = majarteen_area }
			
			custom_tooltip = " "
			
			if = {
				limit = {
					NOT = { government_rank = 2 }
				}
				set_government_rank = 2
				custom_tooltip = " "
			}
			
			if = {
				limit = {
					NOT = { current_age = age_of_discovery } 
				}
				add_mil_power = 200
			}
			else = {
				add_country_modifier = {
					name = YEM_rise_of_yemen
					duration = -1
					desc = YEM_age_of_discovery
				}
			}
		}
	}
	
	YEM_across_the_strait = {
		icon = mission_retake_ceuta
		required_missions = { YEM_unite_yemen }
		position = 4
		provinces_to_highlight = {
			OR = {
				area = aussa_area
				area = ifat_area
				area = somaliland_area
				area = majarteen_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = aussa_area
					area = ifat_area
					area = somaliland_area
					area = majarteen_area
				}
				value = 14
			}
		}
		effect = {
			give_claims = { area = mogadishu_area }
			give_claims = { area = red_sea_coast_area }
			
			custom_tooltip = " "
			
			create_general_with_pips = {
				tradition = 70
				add_manuever = 2
			}
			
			custom_tooltip = " "
			
			country_event_with_option_insight = {
				id = flavor_YEM.2
				option_1 = "
					add_years_of_owned_provinces_production_income = {
						years = 20
						trigger = {
							trade_goods = incense
						}
						custom_tooltip = YEM_prod_from_incense
					}
				"
				option_2 = "
					add_accepted_culture_or_dip_power = { culture = somali dip_reward = yes }
				"
			}
		}
	}
}

KoK_YEM_missions_3 = {
	slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		YEM_is_yemeni_nation = yes
		has_dlc = "King of Kings"
		NOT = { map_setup = map_setup_random }	

		#added
		NOT = {
			tag = HIM
			was_tag = HIM
		}		
	}
	has_country_shield = yes
	
	YEM_tahirids = {
		icon = mission_control_surat
		required_missions = { YEM_an_imminent_collapse }
		position = 2
		provinces_to_highlight = {
			OR = {
				province_id = 388
				if = {
					limit = {
						ROOT = {
							NOT = { tag = ADE }
						}
					}
					owned_by = ADE
				}
				else = { always = no }
			}
		}
		trigger = {
			388 = { owned_by = ROOT }
			OR = {
				NOT = { exists = ADE }
				tag = ADE
			}
		}
		effect = {
			give_claims = { area = dhofar_area }
			give_claims = { area = mascat_area }
			give_claims = { area = pirate_coast_area  }
			give_claims = { area = oman_area }
			give_claims = { area = mogostan_area }
			
			custom_tooltip = " "
			
			add_adm_power = 50 
			
			custom_tooltip = " "
			
			if = {
				limit = {
					tag = YEM
					NOT = { was_tag = ADE }
				}
				add_country_modifier = {
					name = YEM_tahirid_magnates
					duration = 7300
				}
			}
			else = {
				add_country_modifier = {
					name = YEM_seizure_of_aden
					duration = 7300
				}
			}
		}
	}
	
	YEM_defeat_hormuz = {
		icon = mission_dharma_mission_arabian_trade
		required_missions = { YEM_tahirids }
		position = 3
		provinces_to_highlight = {
			OR = {
				AND = {
					OR = {
						owned_by = ORM
						owned_by = OMA
					}
					NOT = { owned_by = ROOT }
				}
				AND = {
					OR = {
						area = dhofar_area
						area = mascat_area
						area = pirate_coast_area 
						area = oman_area
						area = mogostan_area
					}
					NOT = { country_or_non_sovereign_subject_holds = ROOT }
				}
			}
		}
		trigger = {
			NOT = { exists = ORM }
			NOT = { exists = OMA }
			OR = {
				num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
					OR = {
						area = dhofar_area
						area = mascat_area
						area = pirate_coast_area 
						area = oman_area
						area = mogostan_area
					}
					value = 14
				}
				400 = {
					trade_share = {
						country = ROOT
						share = 15
					}
				}
			}
		}
		effect = {
			country_event_with_effect_insight = {
				id = flavor_YEM.1
				effect = "	
					add_power_projection_mission = { amount = 30 }
					custom_tooltip = \" \"
					4346 = {
						add_trade_modifier = {
							who = ROOT
							duration = -1
							power = 100
							key = YEM_competition_less
						}
					}
					custom_tooltip = \" \"
					create_admiral = { tradition = 60 }
				"
			}
		}
	}
}

KoK_YEM_missions_4 = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		YEM_is_yemeni_nation = yes
		has_dlc = "King of Kings"
		NOT = { map_setup = map_setup_random }
		
		#added
		NOT = {
			tag = HIM
			was_tag = HIM
		}
	}
	has_country_shield = yes
	
	YEM_taiz = {
		icon = mission_patronize_art_and_religion
		required_missions = { }
		position = 1
		provinces_to_highlight = {
			province_id = 4280
		}
		trigger = {
			4280 = {
				has_tax_building_trigger = yes
				num_of_times_improved = 5
				owned_by = ROOT
			}
		}
		effect = {
			4280 = {
				upgrade_tax_building = yes
				
				custom_tooltip = " "
				
				add_province_modifier = {
					name = YEM_ashrafiya_mosque
					duration = -1
				}
			}
			
			add_country_modifier = {
				name = YEM_peaceful_investments
				duration = 10950
			}
		}
	}
	
	YEM_aden = {
		icon = mission_bengal_entrepot
		required_missions = { YEM_tahirids YEM_taiz }
		position = 3
		provinces_to_highlight = {
			province_id = 388
		}
		trigger = {
			388 = {
				owned_by = ROOT
				has_trade_building_trigger = yes
				if = {
					limit = {
						has_dlc = "Dharma"
					}
					province_has_center_of_trade_of_level = 2
				}
				development = 15
			}
		}
		effect = {
			388 = {
				upgrade_trade_building = yes
				
				custom_tooltip = " "
				
				add_province_modifier = { 
					name = YEM_city_of_prosperity
					duration = -1
				}
			}
			
			add_years_of_trade_income = {
				years = 2
				custom_tooltip = BYZ_add_2_years_of_trade_income
			}
		}
	}
	
	YEM_masters_of_arabian_sea = {
		icon = mission_coromandel_trade
		required_missions = { YEM_aden YEM_defeat_hormuz YEM_secure_indian_trade }
		position = 4
		provinces_to_highlight = {
			OR = {
				province_id = 504
				province_id = 1340
			}
			NOT = {
				trade_share = {
					country = ROOT
					share = 25
				}
			}
		}
		trigger = {
			num_of_centers_of_trade = 15
			504 = {
				trade_share = {
					country = ROOT
					share = 25 
				}
			}
			1340 = {
				trade_share = {
					country = ROOT
					share = 25 
				}
			}
			monthly_income = 50
		}
		effect = {
			if = {
				limit = {
					has_dlc = "Cradle of Civilization"
				}
				custom_tooltip = YEM_upgrade_propagate_religion_to_30
				set_country_flag = 30_trade_power_for_propogate_religion
			}	
			else = {
				custom_tooltip = YEM_upgrade_trade_ships_privilege_to_30_ship_trade_power
				set_country_flag = YEM_upgrade_trade_ships_priv_2
			}
			
			custom_tooltip = " "
			
			add_country_modifier = {
				name = ARB_arabian_sea_trade
				duration = -1
			}
		}
	}
	
	YEM_eastern_hub = {
		icon = mission_coromandel_expansion
		required_missions = { YEM_masters_of_arabian_sea YEM_coffee }
		position = 6
		provinces_to_highlight = {
			any_trade_node_member_province = {
				is_capital_of = ROOT
			}
			is_trade_node_province = yes
		}
		trigger = {
			home_trade_node = {
				highest_value_trade_node = yes
			}
			monthly_income = 300
		}
		effect = {
			custom_tooltip = YEM_master_of_mint
			
			custom_tooltip = " "
			
			add_country_modifier = {
				name = "thalassocracy"
				duration = -1
			}
			unlock_government_reform = {
				government_reform = thalassocracy_reform
			}
			change_government_reform_progress = 50
		}
	}
}

KoK_YEM_missions_5 = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		YEM_is_yemeni_nation = yes
		has_dlc = "King of Kings"
		NOT = { map_setup = map_setup_random }

		#added
		NOT = {
			tag = HIM
			was_tag = HIM
		}		
	}
	has_country_shield = yes
	
	YEM_build_a_navy = {
		icon = mission_growth_of_surat
		required_missions = { }
		position = 1
		provinces_to_highlight = {
			province_id = 387
			NOT = { owned_by = ROOT }
		}
		trigger = {
			navy_size = 20
			num_of_admirals = 1
			387 = {
				owned_by = ROOT
			}
		}
		effect = {
			387 = {
				add_province_modifier = {
					name = YEM_gates_of_lamentation
					duration = -1
				}
			}
			
			complex_dynamic_effect = {
				first_custom_tooltip = YEM_if_at_least_50_fraction_of_light_ship
				first_limit = "
					light_ship_fraction = 0.5
				"
				first_effect = "
					add_mercantilism = 2
					add_country_modifier = {
						name = YEM_destined_for_spice_trade
						duration = 10950
					}
				"
			}
			complex_dynamic_effect = {
				first_custom_tooltip = YEM_if_at_least_galley_fraction
				first_limit = "
					OR = {
						galley_fraction = 0.3
						heavy_ship_fraction = 0.15
					}
				"
				first_effect = "
					add_navy_tradition = 10
					add_country_modifier = {
						name = YEM_guardians_of_the_gates
						duration = 7300
					}
				"
			}
		}
	}
	
	YEM_secure_indian_trade = {
		icon = mission_dominate_persian_gulf
		required_missions = { YEM_build_a_navy }
		position = 3
		provinces_to_highlight = {
			OR = {
				province_id = 504
				province_id = 1340
			}
			NOT = {
				trade_share = {
					country = ROOT
					share = 15
				}
			}
		}
		trigger = {
			num_ships_protecting_trade = 25
			OR = {
				504 = { #gujarat
					trade_share = {
						country = ROOT
						share = 15
					}
				}
				1340 = { #coromandel
					trade_share = {
						country = ROOT
						share = 15
					}
				}
			}
		}
		effect = {
			if = {
				limit = {
					has_dlc = "Cradle of Civilization"
				}
				custom_tooltip = YEM_upgrade_propagate_religion
				set_country_flag = YEM_propagation_gives_navy_tradition
				set_country_flag = 40_trade_power_for_propogate_religion
			}	
			else = {
				custom_tooltip = YEM_upgrade_trade_ships_privilege_to_20_ship_trade_power
				set_country_flag = YEM_upgrade_trade_ships_priv_1
			}
			
			custom_tooltip = " "
			
			add_mercantilism = 3
		}
	}
	
	YEM_mukha = {
		icon = mission_arabian_ports
		required_missions = { }
		position = 4
		provinces_to_highlight = {
			province_id = 387
		}
		trigger = {
			387 = {
				has_production_building_trigger = yes
				development = 20 
				owned_by = ROOT
				has_shipyard_building_trigger = yes 
			}
		}
		effect = {
			add_years_of_owned_provinces_production_income = {
				years = 10
				trigger = {
					trade_goods = coffee
				}
				custom_tooltip = YEM_prod_from_coffee
			}
			if = {
				limit = {
					387 = { 
						trade_goods = coffee
						NOT = { has_building = plantations }
					}
				}
				387 = {
					add_building = plantations
					custom_tooltip = " "
				}
			}
			387 = {
				upgrade_production_building = yes
			}
			
		}
	}
	
	YEM_coffee = {
		icon = yem_coffee
		required_missions = { YEM_mukha }
		position = 5
		provinces_to_highlight = {
			trade_goods = coffee
			owned_by = ROOT
		}
		trigger = {
			trading_part = {
				trade_goods = coffee
				value = 0.4
			}
			trade_goods_produced_amount = {
				trade_goods = coffee
				amount = 10
			}
			
			if = {
				limit = {
					has_dlc = "Mare Nostrum" #DLC enables promote mercantilism, making this trigger viable
				}
				mercantilism = 40
			}
		}
		effect = {
			custom_tooltip = YEM_enable_coffee_monopoly_privilege
			
			custom_tooltip = " "
			
			add_years_of_owned_provinces_production_income = {
				years = 2
				trigger = {
				}
				custom_tooltip = YEM_prod_from_all_provs
			}
			
			custom_tooltip = " "
			
			country_event_with_effect_insight = {
				id = flavor_YEM.3
				effect = "
					change_price = {
						trade_goods = coffee
						key = YEM_coffee_price_boost
						value = 0.25
						duration = -1
					}
				"
			}
		}
	}
}

KoK_YEM_missions_2_religious = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		YEM_is_yemeni_nation = yes
		has_dlc = "King of Kings"
		NOT = {
			OR = {
				tag = RAS
				was_tag = RAS
			}
		}
		NOT = { map_setup = map_setup_random }	

		#added
		NOT = {
			tag = HIM
			was_tag = HIM
		}		
	}
	has_country_shield = yes
	
	YEM_religious_battlegrounds = {
		icon = mission_turning_the_tables
		required_missions = { }
		position = 5
		provinces_to_highlight = {
			NOT = { religion = ROOT }
			OR = {
				owned_by = ROOT
				any_neighbor_province = {
					owned_by = ROOT
				}
			}
		}
		trigger = {
			OR = {
				at_war_with_religious_enemy = yes
				custom_trigger_tooltip = {
					tooltip = YEM_converted_3_provs
					check_variable = { which = num_converted_religion value = 3 }
				}
			}
		}
		effect = {
			define_advisor = {
				type = inquisitor
				skill = 1
				culture = ROOT
				religion = ROOT
				cost_multiplier = 0.5
			}
			
			custom_tooltip = " "
			
			change_piety_effect = { amount = 0.1 }
		}
	}
	
	YEM_unite_yemen_religiously = {
		icon = yem_unite_yemen
		required_missions = { YEM_religious_battlegrounds }
		position = 6
		provinces_to_highlight = {
			OR = {
				owned_by = RAS
				AND = {
					culture = yemeni_culture
					OR = {
						NOT = { religion = ROOT }
						NOT = { owned_by = ROOT }
					}
				}
			}
		}
		trigger = {
			custom_trigger_tooltip = {
				tooltip = YEM_unified_yemen_tt
				all_province = {
					OR = {
						NOT = { culture = yemeni_culture }
						AND = {
							religion = ROOT
							owned_by = ROOT
						}
					}
				}
			}
			NOT = { exists = RAS }
			stability = 2
		}
		effect = {
			add_country_modifier = {
				name = YEM_reunited_yemen
				duration = 18250 
			}
			
			change_government_reform_progress = 100
		}
	}
}

KoK_YEM_missions_3_religious = {
	slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		YEM_is_yemeni_nation = yes
		has_dlc = "King of Kings"
		NOT = {
			OR = {
				tag = RAS
				was_tag = RAS
			}
		}
		NOT = { map_setup = map_setup_random }	

		#added
		NOT = {
			tag = HIM
			was_tag = HIM
		}		
	}
	has_country_shield = yes
	
	YEM_city_of_sanaa_non_ras = {
		icon = mission_golden_century
		required_missions = { YEM_religious_battlegrounds }
		position = 6
		provinces_to_highlight = {
			province_id = 390
		}
		trigger = {
			390 = {
				owned_by = ROOT 
				religion = ROOT
				has_tax_building_trigger = yes 
				if = {
					limit = { has_dlc = "Leviathan" }
					custom_trigger_tooltip = {
						tooltip = YEM_city_of_sanaa_ras_tt
						or = {
							has_great_project = { tier = 1 type = city_of_sanaa }
							has_great_project = { tier = 2 type = city_of_sanaa }
							has_great_project = { tier = 3 type = city_of_sanaa }
						}
					}
				}
			}
		}
		effect = {
			if = {
				limit = {
					has_dlc = "Leviathan"
				}
				390 = {
					custom_tooltip = YEM_upgrade_city_of_sanaa_non_ras
				}
				set_country_flag = YEM_upgrade_city_of_sanaa_non_ras_flag
			}
			else = {
				add_country_modifier = {
					name = YEM_developing_sanaa
					duration = 10950
				}
				390 = {
					upgrade_tax_building = yes
				}
			}
		
			custom_tooltip = " "
			
			if = {
				limit = {
					has_dlc = "Mandate of Heaven"
				}
				add_splendor = 400
			}
			else = {
				add_prestige_or_monarch_power = { amount = 25 }
			}
		}
	}
}

KoK_YEM_missions_1_RAS_religious = {
	slot = 1
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		YEM_is_yemeni_nation = yes
		has_dlc = "King of Kings"
		OR = {
			tag = RAS
			was_tag = RAS
		}
		NOT = { map_setup = map_setup_random }		
		
		#added
		NOT = {
			tag = HIM
			was_tag = HIM
		}
	}
	has_country_shield = yes
	
	YEM_expel_sunnites = {
		icon = mission_levantine_restoration
		required_missions = { YEM_dawah }
		position = 6
		provinces_to_highlight = {
			owner = {
				is_neighbor_of = ROOT
				NOT = { religion = ROOT }
				religion_group = ROOT
			}
		}
		trigger = {
			custom_trigger_tooltip = {
				tooltip = YEM_win_10_wars_against_heretics
				check_variable = {
					which = num_of_wars_won_against_heretics
					value = 10
				}
			}
		}
		effect = {
			add_country_modifier = {
				name = YEM_superiority_of_zaid_and_ali
				duration = 10950
			}
			
			country_event_with_option_insight = {
				id = flavor_YEM.5
				option_1 = "
					custom_tooltip = YEM_sanction_holy_war_claims_areas
				"
				option_2 = "
					custom_tooltip = YEM_sanction_holy_war_claims_permanent
				"
			}
		}
	}
}

KoK_YEM_missions_2_RAS_religious = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		YEM_is_yemeni_nation = yes
		has_dlc = "King of Kings"
		OR = {
			tag = RAS
			was_tag = RAS
		}
		NOT = { map_setup = map_setup_random }	

		#added
		NOT = {
			tag = HIM
			was_tag = HIM
		}		
	}
	has_country_shield = yes
	
	YEM_dawah = {
		icon = yem_dawah
		required_missions = { }
		position = 5
		provinces_to_highlight = {
		}
		trigger = {
			grown_by_development = 20
		}
		effect = {
			add_country_modifier = {
				name = YEM_fervent_zaidism
				duration = 5475
			}
			
			if = {
				limit = {
					has_dlc = "Cradle of Civilization"
				}
				add_army_professionalism = 0.05
			}
			else = {
				add_army_tradition_or_mil_power = { amount = 10 }
			}
			
			custom_tooltip = " "
			
			change_piety_effect = { amount = 0.15 }
		}
	}
	
	YEM_convert_sunni_mosques = {
		icon = mission_conquer_rewakantha
		required_missions = { YEM_dawah }
		position = 6
		provinces_to_highlight = {
			owned_by = ROOT 
			NOT = { religion = ROOT }
		}
		trigger = {
			custom_trigger_tooltip = {
				tooltip = YEM_converted_30_provs
				check_variable = { which = num_converted_religion value = 30 }
			}
		}
		effect = {
			custom_tooltip = YEM_gain_a_tenth_of_yearly_income
			hidden_effect = {
				if = {
					limit = {
						num_of_owned_provinces_with = {
							has_tax_building_trigger = yes
							value = 20
						}
					}
					add_years_of_income = 2
				}
				else = {
					every_owned_province = {
						limit = {
							has_tax_building_trigger = yes
						}
						ROOT = { add_years_of_income = 0.1 }
					}
				}
			}
			
			custom_tooltip = " "
			
			country_event_with_option_insight = {
				id = flavor_YEM.7
				option_1 = "
					custom_tooltip = YEM_seize_clerical_holdings_every_temple_provinces
				"
				option_2 = "
					custom_tooltip = YEM_seize_clerical_holdings_clergy_crownland
				"
			}
		}
	}
	
	YEM_spread_zaidi_zealotry = {
		icon = mission_into_persia_1
		required_missions = { YEM_convert_sunni_mosques YEM_zaidi_dominance YEM_expel_sunnites }
		position = 7
		provinces_to_highlight = {
			owner = {
				is_neighbor_of = ROOT
				NOT = { religion = ROOT }
			}
		}
		trigger = {
			custom_trigger_tooltip = {
				tooltip = YEM_win_20_wars_against_non_believers
				check_variable = {
					which = num_of_wars_won_against_non_believers
					value = 20
				}
			}
			custom_trigger_tooltip = {
				tooltip = YEM_converted_100_provs
				check_variable = { which = num_converted_religion value = 100 }
			}
		}
		effect = {
			add_country_modifier = {
				name = YEM_rise_of_the_zaidi
				duration = -1
			}
			
			custom_tooltip = YEM_gain_permanent_claim_on_all_shia_provinces
			hidden_effect = {
				every_province = {
					limit = {
						religion = shiite
						NOT = { is_permanent_claim = ROOT }
						NOT = { is_core = ROOT }
					}
					add_permanent_claim = ROOT
				}
			}
		}
	}
	
	YEM_zaidi_caliphate = {
		icon = mission_fatimid_caliphate
		required_missions = { YEM_spread_zaidi_zealotry }
		position = 8
		provinces_to_highlight = {
		}
		trigger = {
			army_size = 200
			total_development = 1000
		}
		effect = {
			add_permanent_power_projection = {
				type = yem_permanent_power_projection
				amount = 10
			}
			
			custom_tooltip = " "
			
			country_event_with_effect_insight = {
				id = flavor_ARB.5 
				effect = "
					unlock_government_reform = {
						government_reform = caliphate_reform
					}
					custom_tooltip = \" \"
					if = {
						limit = { has_country_modifier = unified_islam }
						add_country_modifier = {
							name = ARB_united_islam_upgraded
							duration = -1
						}
					}
					else = {
						set_country_flag = ARB_upgraded_uniting_islam
						custom_tooltip = ARB_uniting_islam_will_now_give_10_warscore_cost_vs_other_religions
					}
				"
			}
		}
	}
}

KoK_YEM_missions_3_RAS_religious = {
	slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		YEM_is_yemeni_nation = yes
		has_dlc = "King of Kings"
		OR = {
			tag = RAS
			was_tag = RAS
		}
		NOT = { map_setup = map_setup_random }

		#added
		NOT = {
			tag = HIM
			was_tag = HIM
		}		
	}
	has_country_shield = yes
	
	YEM_city_of_sanaa_ras = {
		icon = mission_golden_century
		required_missions = { }
		position = 5
		provinces_to_highlight = {
			province_id = 390
		}
		trigger = {
			390 = {
				owned_by = ROOT 
				religion = ROOT
				has_tax_building_trigger = yes 
				if = {
					limit = { has_dlc = "Leviathan" }
					custom_trigger_tooltip = {
						tooltip = YEM_city_of_sanaa_ras_tt
						or = {
							has_great_project = { tier = 1 type = city_of_sanaa }
							has_great_project = { tier = 2 type = city_of_sanaa }
							has_great_project = { tier = 3 type = city_of_sanaa }
						}
					}
				}
			}
		}
		effect = {
			390 = {
				upgrade_tax_building = yes
			
				custom_tooltip = " "
			
				if = {
					limit = {
						has_dlc = "Leviathan"
					}
					custom_tooltip = YEM_upgrade_city_of_sanaa
				}
				else = {
					add_province_modifier = {
						name = YEM_center_of_zaidi_islam
						duration = -1
					}
				}
			}
			set_country_flag = YEM_upgrade_city_of_sanaa_flag
			
			complex_dynamic_effect = {
				first_custom_tooltip = YEM_if_we_are_allied_with_shiite_country
				first_limit = "
					any_ally = {
						religion = shiite
					}
				"
				first_effect = "
					390 = {
						add_base_tax = 2
						add_base_production = 2
						add_base_manpower = 1
					}
				"
			}
		}
	}
	
	YEM_zaidi_dominance = {
		icon = mission_cope_with_refugees
		required_missions = { YEM_dawah YEM_city_of_sanaa_ras }
		position = 6
		provinces_to_highlight = {
			OR = {
				province_id = 384
				province_id = 385
			}
			NOT = { owned_by = ROOT }
		}
		trigger = {
			384 = { owned_by = ROOT }
			385 = { owned_by = ROOT }
			if = {
				limit = {
					OR = {
						has_dlc = "Emperor"
						has_dlc = "Rights of Man"
					}
				}
				is_great_power = yes
			}
			else = {
				total_development = 300
			}
			army_size = 60
		}
		effect = {
			add_stability_or_adm_power = yes
			
			custom_tooltip = " "
			
			country_event_with_option_insight = {
				id = flavor_YEM.6
				option_1 = "
					custom_tooltip = YEM_invite_minorities_distribute_5_dev
				"
				option_2 = "
					custom_tooltip = YEM_invite_minorities_theologian
				"
			}
		}
	}
}