#First slot
adal_conquest_missions_slot = {
	slot = 1
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Origins"
	}
	potential = {
		has_dlc = "Origins"
		NOT = { map_setup = map_setup_random }
		tag = ADA
	}
	has_country_shield = yes

	#Build to force limit
	ada_prepare_second_invasion = {
		icon = mission_son_military_expertise
		required_missions = {  }
		position = 1
		provinces_to_highlight = {
		}
		trigger = {
			army_size_percentage = 1
			num_of_generals = 2
		}
		effect = {
			add_country_modifier = {
				name = ada_preperation_for_war
				duration = 18250
			}
			custom_tooltip = ada_prepare_second_invasion_tt
		}
		ai_weight = {
			factor = 500	#Objective: SURVIVE
		}
	}

	#Destroy Ethiopia
	ada_destroy_ethiopia = {
		icon = mission_kon_repel_the_missionaries
		required_missions = {
			ada_prepare_second_invasion
			ada_turkish_alliance
		}
		position = 3
		provinces_to_highlight = {
			owner = {
				tag = ETH
			}
		}
		trigger = {
			total_development = ETH
			ETH = {
				OR = {
					exists = no
					NOT = { num_of_cities = 4 }
				}
			}
		}
		effect = {
			add_piety = 0.15
			add_power_projection = {
				type = mission_rewards_power_projection
				amount = 25
			}
			southern_ethiopia_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			upper_nubia_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			dongola_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			red_sea_coast_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
		ai_weight = {
			factor = 500
		}
	}

	#Consolidate the Region
	ada_push_further_north = {
		icon = mission_unite_home_region
		required_missions = { ada_destroy_ethiopia }
		position = 4
		provinces_to_highlight = {
			owner = {
				NOT = { religion = ROOT }
			}
			OR = {
				area = dongola_area
				area = upper_nubia_area
				area = sennar_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			custom_trigger_tooltip = {
				tooltip = ada_push_further_north_ct
				dongola_area = {
					owner = {
						OR = {
							religion = ROOT
							is_subject_of = ROOT
						}
					}
					type = all
				}
				upper_nubia_area = {
					owner = {
						OR = {
							religion = ROOT
							is_subject_of = ROOT
						}
					}
					type = all
				}
				sennar_area = {
					owner = {
						OR = {
							religion = ROOT
							is_subject_of = ROOT
						}
					}
					type = all
				}
			}
		}
		effect = {
			add_country_modifier = {
				name = ada_expelling_of_the_christians
				duration = 9125
			}
			kurdufan_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			darfur_central_sahara_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			add_temporary_colonist = {
				duration = 18250
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#Go west
	ada_the_sahel_corridor = {
		icon = mission_sw_against_the_desert
		required_missions = { ada_push_further_north }
		position = 6
		provinces_to_highlight = {
			OR = {
				area = kurdufan_area
				area = darfur_central_sahara_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			kurdufan_area = {
				country_or_non_sovereign_subject_holds = ROOT
				type = all
			}
			darfur_central_sahara_area = {
				country_or_non_sovereign_subject_holds = ROOT
				type = all
			}
		}
		effect = {
			kurdufan_area = {
				add_base_tax = 1
				add_base_production = 1
				add_base_manpower = 1
			}
			darfur_central_sahara_area = {
				add_base_tax = 1
				add_base_production = 1
				add_base_manpower = 1
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}
}

#Second slot
adal_alliances_missions_slot = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Origins"
	}
	potential = {
		has_dlc = "Origins"
		NOT = { map_setup = map_setup_random }
		tag = ADA
	}
	has_country_shield = yes

	#Build mosque
	ada_restore_the_old_mosque = {
		icon = mission_mal_jihad_upon_own_population
		required_missions = {  }
		position = 1
		provinces_to_highlight = {
			province_id = 1212
			OR = {
				NOT = { owned_by = ROOT }
				has_tax_building_trigger = no
				NOT = { is_core = ROOT }
				NOT = { development = 10 }
			}
		}
		trigger = {
			owns_core_province = 1212
			1212 = {
				development = 10
				has_tax_building_trigger = yes
			}
		}
		effect = {
			1212 = {
				add_base_tax = 4
				add_building = cathedral
			}
		}
		ai_weight = {
			factor = 500	#Free Cathedral is always nice
		}
	}

	#Ally with the Turks
	ada_turkish_alliance = {
		icon = mission_non-western_soldiers
		required_missions = { ada_restore_the_old_mosque }
		position = 2
		provinces_to_highlight = {
			OR = {
				AND = {
					OR = {
						region = egypt_region
						region = mashriq_region
					}
					NOT = { province_id = 408 }
					NOT = { area = gulf_of_arabia_area }
					has_port = yes
				}
				owner = {
					primary_culture = turkish
				}
			}
			has_discovered = ROOT
		}
		trigger = {
			custom_trigger_tooltip = {
				tooltip = ada_turkish_alliance_ct
				OR = {
					egypt_region = {
						NOT = { area = gulf_of_arabia_area }
						OR = {
							owner = { primary_culture = turkish }
							has_port = yes
						}
						has_discovered = ROOT
						OR = {
							infantry_in_province = ROOT
							cavalry_in_province = ROOT
							artillery_in_province = ROOT
						}
					}
					mashriq_region = {
						NOT = { province_id = 408 }
						OR = {
							owner = { primary_culture = turkish }
							has_port = yes
						}
						has_discovered = ROOT
						OR = {
							infantry_in_province = ROOT
							cavalry_in_province = ROOT
							artillery_in_province = ROOT
						}
					}
					anatolia_region = {
						owner = { primary_culture = turkish }
						has_discovered = ROOT
						OR = {
							infantry_in_province = ROOT
							cavalry_in_province = ROOT
							artillery_in_province = ROOT
						}
					}
				}
			}
		}
		effect = {
			custom_tooltip = ada_turkish_alliance_tt
			hidden_effect = {
				random_province = {
					limit = {
						OR = {
							AND = {
								OR = {
									region = egypt_region
									region = mashriq_region
								}
								NOT = { province_id = 408 }
								NOT = { area = red_sea_coast_area }
								has_port = yes
							}
							owner = {
								primary_culture = turkish
							}
						}
						has_discovered = ROOT
						OR = {
							infantry_in_province = ROOT
							cavalry_in_province = ROOT
							artillery_in_province = ROOT
						}
					}
					if = {
						limit = { infantry_in_province = ROOT }
						kill_units = {
							who = ROOT
							type = infantry
							amount = 1
						}
					}
					else_if = {
						limit = { cavalry_in_province = ROOT }
						kill_units = {
							who = ROOT
							type = cavalry
							amount = 1
						}
					}
					else = {
						kill_units = {
							who = ROOT
							type = artillery
							amount = 1
						}
					}
				}
				country_event = {
					id = flavor_ada.1
					days = 30
				}
			}
			hadiya_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			shewa_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			tigray_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			central_ethiopia_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			damot_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			add_permanent_claim = 2768
		}
		ai_weight = {
			factor = 500	#I have no idea if the AI can actually understand the goal to move troops to Mamluk territory which they don't own. I highly doubt it, but just in case, AI Adal should try it.
		}
	}

	#Modernize the Army
	ada_modernize_army = {
		icon = mission_cannons_firing
		required_missions = { ada_turkish_alliance }
		position = 3
		provinces_to_highlight = {
		}
		trigger = {
			monthly_mil = 10
			has_completed_idea_group_of_category = {
				mil_ideas = yes
			}
		}
		effect = {
			add_army_professionalism = 5
			add_army_tradition = 20
			add_country_modifier = {
				name = ada_professional_army
				duration = 9125
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#Ethiopian Gold
	ada_the_gold_of_ethiopia = {
		icon = mission_high_income
		required_missions = { ada_destroy_ethiopia }
		position = 4
		provinces_to_highlight = {
			OR = {
				province_id = 2762
				province_id = 2757
			}
			OR = {
				NOT = { owned_by = ROOT }
				NOT = { is_state_core = ROOT }
			}
		}
		trigger = {
			2762 = {
				owned_by = ROOT
				is_state_core = ROOT
			}
			2757 = {
				owned_by = ROOT
				is_state_core = ROOT
			}
		}
		effect = {
			unlock_estate_privilege = {
				estate_privilege = estate_burghers_control_over_the_mint
			}
			2762 = {
				add_local_autonomy = -100
				add_province_modifier = {
					name = eth_increased_gold_mining
					duration = 9125
				}
			}
			2757 = {
				add_local_autonomy = -100
				add_province_modifier = {
					name = eth_increased_gold_mining
					duration = 9125
				}
			}
		}
		ai_weight = {
			factor = 500	#I like money
		}
	}

	#Religious Unity
	ada_convert_the_horn = {
		icon = mission_central_asian_city
		required_missions = { ada_push_further_north }
		position = 5
		provinces_to_highlight = {
			NOT = { religion = ROOT }
			region = horn_of_africa_region
		}
		trigger = {
			religious_unity = 1
			horn_of_africa_region = {
				religion = ROOT
				type = all
			}
		}
		effect = {
			add_country_modifier = {
				name = ada_religious_unity_in_the_horn
				duration = -1
			}
		}
		ai_weight = {
			factor = 500	#Default
		}
	}
}

#First slot
adal_unification_missions_slot = {
	slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Origins"
	}
	potential = {
		has_dlc = "Origins"
		NOT = { map_setup = map_setup_random }
		tag = ADA
	}
	has_country_shield = yes

	#Get cb against Somali clans
	ada_justification_for_unity = {
		icon = mission_kon_greatest_power_kongo
		required_missions = {  }
		position = 1
		provinces_to_highlight = {
			owner = {
				primary_culture = somali
				NOT = { tag = ROOT }
				NOT = { is_subject_of = ROOT }
			}
		}
		trigger = {
			OR = {
				custom_trigger_tooltip = {
					tooltip = ada_justification_for_unity_at
					NOT = {
						any_known_country = {
							primary_culture = somali
						}
					}
				}
				tag = SOM
				custom_trigger_tooltip = {
					tooltip = ada_justification_for_unity_bt
					any_known_country = {
						primary_culture = somali
						ROOT = {
							has_casus_belli = {
								type = cb_conquest
								target = PREV
							}
						}
					}
				}
			}
		}
		effect = {
			somaliland_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			ogaden_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			majarteen_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
		ai_weight = {
			factor = 100	#Adal is more busy with Ethiopia than with the Somalian clans
		}
	}

	#Conquer Warsangali and Marehan
	ada_conquer_war_mre = {
		icon = mission_zim_strong_rulership
		required_missions = { ada_justification_for_unity }
		position = 2
		provinces_to_highlight = {
			OR = {
				area = somaliland_area
				area = majarteen_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			somaliland_area = {
				country_or_non_sovereign_subject_holds = ROOT
				type = all
			}
			majarteen_area = {
				country_or_non_sovereign_subject_holds = ROOT
				type = all
			}
		}
		effect = {
			add_yearly_manpower = 1
			ajuuran_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			mogadishu_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#Conquer Ogaadeen, Ajuuraan and Mogadishu
	ada_conquer_ogd_aju = {
		icon = mission_ottoman_harem
		required_missions = { ada_conquer_war_mre }
		position = 3
		provinces_to_highlight = {
			OR = {
				area = ajuuran_area
				area = mogadishu_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			ajuuran_area = {
				country_or_non_sovereign_subject_holds = ROOT
				type = all
			}
			mogadishu_area = {
				country_or_non_sovereign_subject_holds = ROOT
				type = all
			}
		}
		effect = {
			yemen_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			tihama_al_yemen_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			mecca_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#Conquer Mecca
	ada_expand_into_arabia = {
		icon = mission_arabian_fort
		required_missions = { ada_conquer_ogd_aju }
		position = 4
		provinces_to_highlight = {
			region = arabia_region
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			owns_or_non_sovereign_subject_of = 385
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				region = arabia_region
				value = 8
			}
		}
		effect = {
			add_accepted_culture_or_dip_power = { culture = yemeni_culture value = 100 }
			add_accepted_culture_or_dip_power = { culture = hejazi_culture value = 100 }
			385 = {
				set_great_project_tier_2 = {
					type = kaaba
				}
			}
			asir_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			upper_yemen_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			hadramut_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			medina_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
		ai_weight = {
			factor = 50	#Unlikely
		}
	}

	#Get cb against Somali clans
	ada_somali_empire = {
		icon = mission_empire
		required_missions = {
			ada_convert_the_horn
			ada_expand_into_arabia
		}
		position = 6
		provinces_to_highlight = {
			region = horn_of_africa_region
			NOT = { owned_by = ROOT }
		}
		trigger = {
			total_development = 600
			stability = 3
			prestige = 50
			legitimacy_equivalent = 90
			has_any_disaster = no
			NOT = { num_of_rebel_armies = 1 }
			NOT = { num_of_rebel_controlled_provinces = 1 }
			is_at_war = no
			horn_of_africa_region = {
				owned_by = ROOT
				type = all
			}
		}
		effect = {
			if = {
				limit = { NOT = { government_rank = 3 } }
				set_government_rank = 3
			}
			add_country_modifier = {
				name = ada_imperial_adal_sultanate
				duration = -1
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}
}