#First slot
oyo_cavalry_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 = OYO
	}
	has_country_shield = yes

	oyo_trade_with_the_muslims = {
		icon = mission_bedouins
		required_missions = {  }
		position = 2
		provinces_to_highlight = {
			province_has_center_of_trade_of_level = 1
			OR = {
				area = western_sahara_area
				area = niger_bend_area
				area = dendi_area
				area = baghena_area
				area = atacora_oueme_area
				area = lower_volta_area
				area = kong_area
				area = upper_volta_area
				area = jenne_area
				area = massina_area
				area = manding_area
				area = tekrur_area
			}
		}
		trigger = {
			OR = {
				custom_trigger_tooltip = {
					tooltip = oyo_trade_with_the_muslims_at
					any_owned_province = {
						province_has_center_of_trade_of_level = 1
						OR = {
							area = western_sahara_area
							area = niger_bend_area
							area = dendi_area
							area = baghena_area
							area = atacora_oueme_area
							area = lower_volta_area
							area = kong_area
							area = upper_volta_area
							area = jenne_area
							area = massina_area
							area = manding_area
							area = tekrur_area
						}
					}
				}
				AND = {
					custom_trigger_tooltip = {
						tooltip = oyo_trade_with_the_muslims_bt
						any_known_country = {
							any_owned_province = {
								province_has_center_of_trade_of_level = 1
								OR = {
									area = western_sahara_area
									area = niger_bend_area
									area = dendi_area
									area = baghena_area
									area = atacora_oueme_area
									area = lower_volta_area
									area = kong_area
									area = upper_volta_area
									area = jenne_area
									area = massina_area
									area = manding_area
									area = tekrur_area
								}
							}
							OR = {
								is_subject_of = ROOT
								has_opinion = {
									who = ROOT
									value = 90
								}
							}
						}
					}
					treasury = 50
				}
			}
		}
		effect = {
			if = {
				limit = {
					any_known_country = {
						any_owned_province = {
							province_has_center_of_trade_of_level = 1
							OR = {
								area = western_sahara_area
								area = niger_bend_area
								area = dendi_area
								area = baghena_area
								area = atacora_oueme_area
								area = lower_volta_area
								area = kong_area
								area = upper_volta_area
								area = jenne_area
								area = massina_area
								area = manding_area
								area = tekrur_area
							}
						}
						OR = {
							is_subject_of = ROOT
							has_opinion = {
								who = ROOT
								value = 90
							}
						}
					}
				}
				country_event = {
					id = flavor_oyo.1
				}
			}
			else = {
				add_country_modifier = {
					name = oyo_access_to_horses
					duration = 9125
				}
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	oyo_found_the_cavalry_regiment = {
		icon = mission_crusade_for_varna
		required_missions = { oyo_trade_with_the_muslims }
		position = 3
		provinces_to_highlight = {
		}
		trigger = {
			num_of_cavalry = 2 # modified
			has_mil_advisor = yes
		}
		effect = {
			unlock_merc_company = {
				merc_company = merc_oyo_cavalry
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	oyo_chaaargee = {
		icon = mission_non-western_cavalry_raid
		required_missions = { oyo_found_the_cavalry_regiment }
		position = 4
		provinces_to_highlight = {
			is_capital = yes
			owner = {
				OR = {
					is_rival = ROOT
					is_enemy = ROOT
					total_development = ROOT
					is_great_power = yes
				}
			}
			has_discovered = ROOT
		}
		trigger = {
			custom_trigger_tooltip = {
				tooltip = oyo_chaaargee_ct
				any_known_country = {
					OR = {
						is_rival = ROOT
						is_enemy = ROOT
						total_development = ROOT
						is_great_power = yes
					}
					war_with = ROOT
					capital_scope = {
						controlled_by = ROOT
					}
				}
			}
		}
		effect = {
			add_power_projection = {
				type = mission_rewards_power_projection
				amount = 40
			}
			custom_tooltip = oyo_chaaargee_tt
			hidden_effect = {
				set_country_flag = oyo_cavalry_do_not_consume_ap
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}
}

#Second slot
oyo_oyo_mesi_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 = OYO
	}
	has_country_shield = yes

	oyo_appease_the_oyo_mesi = {
		icon = mission_mal_jihad_upon_own_population
		required_missions = {  }
		position = 1
		trigger = {
			OR = {
				NOT = { has_estate = estate_nobles }
				estate_loyalty = {
					estate = estate_nobles
					loyalty = 60
				}
			}
		}
		effect = {
			create_general = {
				tradition = 40
			}
			if = {
				limit = {
					mission_completed = oyo_appease_the_ogboni
				}
				custom_tooltip = oyo_perma_claims_tt
				hidden_effect = {
					benin_area = {
						limit = {
							NOT = { is_permanent_claim = ROOT }
							NOT = { is_core = ROOT }
						}
						add_permanent_claim = ROOT
					}
					lower_niger_area = {
						limit = {
							NOT = { is_permanent_claim = ROOT }
							NOT = { is_core = ROOT }
						}
						add_permanent_claim = ROOT
					}
					zazzau_area = {
						limit = {
							NOT = { is_permanent_claim = ROOT }
							NOT = { is_core = ROOT }
						}
						add_permanent_claim = ROOT
					}
					atacora_oueme_area = {
						limit = {
							NOT = { is_permanent_claim = ROOT }
							NOT = { is_core = ROOT }
						}
						add_permanent_claim = ROOT
					}
					lower_volta_area = {
						limit = {
							NOT = { is_permanent_claim = ROOT }
							NOT = { is_core = ROOT }
						}
						add_permanent_claim = ROOT
					}
				}
			}
			else = {
				custom_tooltip = oyo_appease_the_oyo_mesi_ct
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	oyo_push_north = {
		icon = mission_mal_subjugate_zaf
		required_missions = { 
			oyo_appease_the_oyo_mesi
			oyo_growth_of_power
		}
		position = 3
		provinces_to_highlight = {
			region = sahel_region
			NOT = { country_or_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_subjects_with = {
				region = sahel_region
				value = 8
			}
		}
		effect = {
			custom_tooltip = oyo_push_north_tt
			hidden_effect = {
				sahel_region = {
					limit = {
						NOT = { religion = ROOT }
						NOT = { is_permanent_claim = ROOT }
						NOT = { is_core = ROOT }
					}
					add_permanent_claim = ROOT
				}
				niger_region = {
					limit = {
						NOT = { religion = ROOT }
						NOT = { is_permanent_claim = ROOT }
						NOT = { is_core = ROOT }
					}
					add_permanent_claim = ROOT
				}
				guinea_region = {
					limit = {
						NOT = { religion = ROOT }
						NOT = { is_permanent_claim = ROOT }
						NOT = { is_core = ROOT }
					}
					add_permanent_claim = ROOT
				}
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	oyo_eradicate_the_muslims = {
		icon = mission_mosque
		required_missions = { oyo_push_north }
		position = 4
		provinces_to_highlight = {
			OR = {
				region = sahel_region
				region = niger_region
				region = guinea_region
			}
			owner = { NOT = { religion = ROOT } }
			NOT = { country_or_subject_holds = ROOT }
		}
		trigger = {
			sahel_region = {
				OR = {
					is_empty = yes
					custom_trigger_tooltip = {
						tooltip = oyo_eradicate_the_muslims_ct
						owner = { 
							OR = {
								religion = ROOT
								is_subject_of = ROOT
							}
						}
					}
				}
				type = all
			}
			niger_region = {
				OR = {
					is_empty = yes
					custom_trigger_tooltip = {
						tooltip = oyo_eradicate_the_muslims_ct
						owner = { 
							OR = {
								religion = ROOT
								is_subject_of = ROOT
							}
						}
					}
				}
				type = all
			}
			guinea_region = {
				OR = {
					is_empty = yes
					custom_trigger_tooltip = {
						tooltip = oyo_eradicate_the_muslims_ct
						owner = { 
							OR = {
								religion = ROOT
								is_subject_of = ROOT
							}
						}
					}
				}
				type = all
			}
		}
		effect = {
			add_power_projection = {
				type = zim_african_great_power
				amount = 25
			}
			custom_tooltip = zim_amongst_the_great_powers_tt
		}
		ai_weight = {
			factor = 75	#Default
		}
	}
}

#Third slot
oyo_imperial_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 = OYO
	}
	has_country_shield = yes

	oyo_growth_of_power = {
		icon = mission_kon_conquer_ckw
		required_missions = {
			oyo_appease_the_oyo_mesi
			oyo_appease_the_ogboni
		}
		position = 2
		provinces_to_highlight = {
		}
		trigger = {
			grown_by_development = 75
			num_of_cities = 10
		}
		effect = {
			add_adm_power = 100
			dendi_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			upper_volta_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			katsina_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	oyo_develop_the_capital = {
		icon = mission_arabian_fort
		required_missions = { oyo_growth_of_power }
		position = 3
		provinces_to_highlight = {
			is_capital_of = ROOT
			NOT = { development = 15 }
		}
		trigger = {
			capital_scope = {
				controlled_by = ROOT
				development = 15
			}
		}
		effect = {
			if = {
				limit = {
					capital_scope = {
						NOT = { province_has_center_of_trade_of_level = 1 }
					}
				}
				capital_scope = {
					center_of_trade = 2
				}
			}
			else = {
				capital_scope = {
					if = {
						limit = {
							province_has_center_of_trade_of_level = 2
						}
						add_base_production = 3
					}
					else = {
						add_center_of_trade_level = 1
					}
				}
			}
			add_years_of_owned_provinces_production_income = {
				years = 5
				trigger = {
					is_capital_of = ROOT
				}
				custom_tooltip = CAPITAL_MONOPOLY
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	oyo_reform_the_government = {
		icon = mission_zim_strong_rulership
		required_missions = {  }
		position = 4
		provinces_to_highlight = {
		}
		trigger = {
			NOT = { government = tribal }
		}
		effect = {
			unlock_estate_privilege = {
				estate_privilege = estate_nobles_grant_power_to_the_bashorun
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	oyo_imperial_oyo = {
		icon = mission_mal_west_african_great_power
		required_missions = {
			oyo_reform_the_government
			oyo_gather_cults
			oyo_eradicate_the_muslims
		}
		position = 5
		provinces_to_highlight = {
		}
		trigger = {
			OR = {
				num_of_subjects = 6
				total_development = 300
			}
		}
		effect = {
			if = {
				limit = { NOT = { government_rank = 3 } }
				set_government_rank = 3
			}
			add_country_modifier = {
				name = oyo_empire
				duration = -1
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}
}

#Fourth slot
oyo_ogboni_missions_slot = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Origins"
	}
	potential = {
		has_dlc = "Origins"
		NOT = { map_setup = map_setup_random }
		tag = OYO
	}
	has_country_shield = yes

	oyo_appease_the_ogboni = {
		icon = mission_son_fetishist_alliances
		required_missions = {  }
		position = 1
		trigger = {
			OR = {
				NOT = { has_estate = estate_church }
				estate_loyalty = {
					estate = estate_church
					loyalty = 60
				}
			}
		}
		effect = {
			capital_scope = {
				add_building = temple
			}
			if = {
				limit = {
					mission_completed = oyo_appease_the_oyo_mesi
				}
				custom_tooltip = oyo_perma_claims_tt
				hidden_effect = {
					benin_area = {
						limit = {
							NOT = { is_permanent_claim = ROOT }
							NOT = { is_core = ROOT }
						}
						add_permanent_claim = ROOT
					}
					lower_niger_area = {
						limit = {
							NOT = { is_permanent_claim = ROOT }
							NOT = { is_core = ROOT }
						}
						add_permanent_claim = ROOT
					}
					zazzau_area = {
						limit = {
							NOT = { is_permanent_claim = ROOT }
							NOT = { is_core = ROOT }
						}
						add_permanent_claim = ROOT
					}
					atacora_oueme_area = {
						limit = {
							NOT = { is_permanent_claim = ROOT }
							NOT = { is_core = ROOT }
						}
						add_permanent_claim = ROOT
					}
					lower_volta_area = {
						limit = {
							NOT = { is_permanent_claim = ROOT }
							NOT = { is_core = ROOT }
						}
						add_permanent_claim = ROOT
					}
				}
			}
			else = {
				custom_tooltip = oyo_appease_the_ogboni_ct
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	oyo_unite_the_fetishists = {
		icon = mission_mal_more_tolerance_to_heathens
		required_missions = { oyo_appease_the_ogboni }
		position = 3
		provinces_to_highlight = {
			religion = ROOT
			NOT = { country_or_subject_holds = ROOT }
			region = niger_region
		}
		trigger = {
			calc_true_if = {
				all_province = {
					region = niger_region
					religion = ROOT
					country_or_subject_holds = ROOT
				}
				amount = 15
			}
		}
		effect = {
			if = {
				limit = {
					has_dlc = "Rights of Man"
				}
				unlock_cult_through_selection = yes
			}
			else = {
				add_stability = 1
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	oyo_gather_cults = {
		icon = mission_kon_collect_cults
		required_missions = { 
			oyo_develop_the_capital
			oyo_unite_the_fetishists
		}
		position = 4
		provinces_to_highlight = {
			religion = ROOT
			NOT = { country_or_subject_holds = ROOT }
			region = niger_region
		}
		trigger = {
			if = {
				limit = {
					has_dlc = "Rights of Man"
				}
				num_of_unlocked_cults = 6
			}
			else = {
				theologian = 3
				estate_influence = {
					estate = estate_church
					influence = 70
				}
			}
			estate_loyalty = {
				estate = estate_church
				loyalty = 70
			}
		}
		effect = {
			if = {
				limit = {
					has_dlc = "Rights of Man"
				}
				enable_cult_switching_mission = yes
			}
			add_country_modifier = {
				name = oyo_shaman_gathering
				duration = 9125
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}
}