#First slot
mutapa_vassal_missions_slot = {
	slot = 1
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Origins"
	}
	potential = {
		has_dlc = "Origins"
		NOT = { map_setup = map_setup_random }
		OR = {
			tag = GZI
			tag = RZI
			tag = ZIM
		}
	}
	has_country_shield = yes

	#Annex subjects
	zim_annex_vassals = {
		icon = mission_have_two_subjects
		required_missions = {  }
		position = 1
		provinces_to_highlight = {
			OR = {
				owner = {
					tag = RZW
				}
				AND = {
					province_id = 1185
					OR = {
						NOT = { is_core = ROOT }
						NOT = { owned_by = ROOT }
					}
				}
			}
		}
		trigger = {
			NOT = { exists = RZW }
			owns_core_province = 1185
		}
		effect = {
			custom_tooltip = zim_annex_vassals_ct
			hidden_effect = {
				set_country_flag = zim_enabled_butua_warriors
			}
			add_dip_power = 50
		}
		ai_weight = {
			factor = 500	#Integrate Vassal
		}
	}

	#Strengthen ruler
	zim_strong_rulership = {
		icon = mission_zim_strong_rulership
		required_missions = {
			zim_annex_vassals
			zim_cults
		}
		position = 2
		trigger = {
			OR = {
				has_reform = sacred_kingdom
				AND = {
					legitimacy = 100
					has_adm_advisor_2 = yes
					has_dip_advisor_2 = yes
					has_mil_advisor_2 = yes
				}
			}
		}
		effect = {
			add_country_modifier = {
				name = zim_sacred_court
				duration = 9125
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#Dominate South Africa
	zim_dominate_south_africa = {
		icon = colonize_the_cape
		required_missions = { 
			zim_strong_rulership
			zim_discover_the_cape
		}
		position = 4
		provinces_to_highlight = {
			region = south_africa_region
			OR = {
				NOT = { is_core = ROOT }
				NOT = { owned_by = ROOT }
			}
		}
		trigger = {
			south_africa_region = {
				owned_by = ROOT
				is_core = ROOT
				type = all
			}
		}
		effect = {
			south_africa_region = {
				add_province_modifier = {
					name = zim_mutapan_influence
					duration = 9125
				}
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#Become a great power
	zim_amongst_the_great_powers = {
		icon = mission_zim_amongst_the_great_powers
		required_missions = { 
			zim_dominate_south_africa
			zim_modernize_state
		}
		position = 6
		trigger = {
			if = {
				limit = {
					OR = {
						has_dlc = "Emperor"
						has_dlc = "Rights of Man"
					}
				}
				NOT = { great_power_rank = 3 }
			}
			else = {
				total_own_and_non_tributary_subject_development = 700
			}
			army_size = 100
		}
		effect = {
			add_power_projection = {
				type = zim_african_great_power
				amount = 25
			}
			custom_tooltip = zim_amongst_the_great_powers_tt
			add_prestige = 100
		}
		ai_weight = {
			factor = 75	#Default
		}
	}
}

#Second slot
mutapa_conquer_africa_missions_slot = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Origins"
	}
	potential = {
		has_dlc = "Origins"
		NOT = { map_setup = map_setup_random }
		OR = {
			tag = GZI
			tag = RZI
			tag = ZIM
		}
	}
	has_country_shield = yes

	#Build temples
	zim_cults = {
		icon = mission_zim_cults
		required_missions = {  }
		position = 1
		provinces_to_highlight = {
			owned_by = ROOT
			has_tax_building_trigger = no
		}
		trigger = {
			stability = 1
			religion = shamanism
			num_of_owned_provinces_with = {
				has_tax_building_trigger = yes
				value = 5
			}
			if = {
				limit = {
					has_dlc = "Rights of Man"
				}
				has_adopted_cult = mwari_cult
				has_estate_privilege = estate_church_embrace_singluar_cult
			}
			else = {
				religion = shamanism
				religious_unity = 1
			}
		}
		effect = {
			add_stability = 1
			add_estate_loyalty = {
				estate = estate_church
				loyalty = 15
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#Conquer Kalonga
	zim_conquer_north = {
		icon = mission_son_own_develop_clothes_and_salt
		required_missions = { zim_decline_of_zimbabwe }
		position = 2
		provinces_to_highlight = {
			OR = {
				province_id = 4040
				province_id = 4039
			}
			NOT = { owned_by = ROOT }
		}
		trigger = {
			owns = 4039
			owns = 4040
		}
		effect = {
			4040 = {
				add_province_modifier = {
					name = zim_weapon_forgery
					duration = 9125
				}
			}
			4039 = {
				add_province_modifier = {
					name = zim_uniform_tailoring
					duration = 9125
				}
			}
			create_conquistador = {
				tradition = 25
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#Discover the South
	zim_discover_the_cape = {
		icon = mission_sw_against_the_desert
		required_missions = { 
			zim_conquer_north
			zim_restore_the_city
		}
		position = 3
		provinces_to_highlight = {
			province_id = 1177
			NOT = { has_discovered = ROOT }
		}
		trigger = {
			has_discovered = 1177
		}
		effect = {
			south_africa_region = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			if = {
				limit = {
					1177 = {
						is_empty = yes
					}
				}
				create_colony_mission_reward = {
					province = 1177
				}
			}
			add_temporary_colonist = {
				duration = 36500
			}
		}
		ai_weight = {
			factor = 0	#Should not take the Cape away from European colonists
		}
	}

	#
	zim_modernize_state = {
		icon = mission_mal_fighting_musa
		required_missions = { 
			zim_discover_the_cape
			zim_european_contact
		}
		position = 5
		trigger = {
			reform_level = 4
			has_better_tech_than_westerns = yes
			has_more_institutions_than_westerns = yes
		}
		effect = {
			#if = {
			#	limit = {
			#		has_reform = sacred_kingdom
			#	}
			#	country_event = {
			#		id = flavor_zim.3
			#	}
			#}
			#else = {
				add_stability = 1
			#}
			if = {
				limit = {
					has_dlc = "Rule Britannia"
				}
				change_innovativeness = 5
			}
			else = {
				add_adm_power = 100
				add_dip_power = 100
				add_mil_power = 100
			}
		}
		ai_weight = {
			factor = 0	#Tech difference should persist
		}
	}
}

#Third slot
mutapa_restore_zimbabwe_missions_slot = {
	slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Origins"
	}
	potential = {
		has_dlc = "Origins"
		NOT = { map_setup = map_setup_random }
		OR = {
			tag = GZI
			tag = RZI
			tag = ZIM
		}
	}
	has_country_shield = yes

	#Introduction mission
	zim_decline_of_zimbabwe = {
		icon = mission_cope_with_refugees
		required_missions = {  }
		position = 1
		provinces_to_highlight = {
			province_id = 1184
			OR = {
				NOT = { owned_by = ROOT }
				NOT = { is_core = ROOT }
			}
		}
		trigger = {
			owns_core_province = 1184
			if = {
				limit = {
					tag = ZIM
				}
				custom_trigger_tooltip = {
					tooltip = zim_decline_of_zimbabwe_tt
					has_global_flag = zim_zimbabwe_mass_movement
				}
			}
			stability = 1
		}
		effect = {
			enable_development_on_buildings_built = yes
			shire_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			ngonde_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			upper_zambezi_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			quelimane_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			mozambique_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			central_swahili_coast_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#Develop capital back to former glory
	zim_restore_the_city = {
		icon = mission_sw_paquime
		required_missions = { zim_decline_of_zimbabwe }
		position = 2
		provinces_to_highlight = {
			province_id = 1184
			OR = {
				NOT = { owned_by = ROOT }
				NOT = { is_core = ROOT }
			}
		}
		trigger = {
			owns_core_province = 1184
			1184 = {
				development = 20
				has_tax_building_trigger = yes
				has_trade_building_trigger = yes
			}
			stability = 2
		}
		effect = {
			1184 = {
				remove_province_modifier = zim_declining_city
				add_province_modifier = {
					name = zim_restored_capital
					duration = -1
				}
				if = {
					limit = {
						NOT = { province_has_center_of_trade_of_level = 2 }
					}
					add_center_of_trade_level = 1
				}
				if = {
					limit = {
						has_dlc = "Leviathan"
					}
					set_great_project_tier_2 = {
						type = khami_ruins
					}
				}
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#Restore Great Zimbabwe
	zim_restore_old_empire = {
		icon = mission_empire
		required_missions = { zim_restore_the_city }
		position = 3
		provinces_to_highlight = {
			OR = {
				area = butua_area
				area = lower_zambezi_area
				area = zimbabwe_area
				area = quelimane_area
			}
			NOT = { owned_by = ROOT }
		}
		trigger = {
			total_development = 400
			butua_area = {
				owned_by = ROOT
				type = all
			}
			lower_zambezi_area = {
				owned_by = ROOT
				type = all
			}
			zimbabwe_area = {
				owned_by = ROOT
				type = all
			}
			quelimane_area = {
				owned_by = ROOT
				type = all
			}
		}
		effect = {
			if = {
				limit = {
					NOT = { government_rank = 3 }
				}
				set_government_rank = 3
			}
			country_event = {
				id = flavor_zim.2
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#Have contact with the Europeans
	zim_european_contact = {
		icon = mission_son_fetishist_alliances
		required_missions = { zim_build_navy }
		position = 4
		trigger = {
			custom_trigger_tooltip = {
				tooltip = zim_european_contact_tt
				europe = {
					is_capital = yes
					owner = {
						OR = {
							alliance_with = ROOT
							has_opinion = {
								who = ROOT
								value = 75
							}
							has_guaranteed = ROOT
							overlord_of = ROOT
							is_subject_of = ROOT
						}
						religion_group = christian
					}
				}
			}
		}
		effect = {
			country_event = {
				id = flavor_zim.5
			}
		}
		ai_weight = {
			factor = 0	#Too complicated for the AI
		}
	}
}

#Forth slot
mutapa_trade_missions_slot = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Origins"
	}
	potential = {
		has_dlc = "Origins"
		NOT = { map_setup = map_setup_random }
		OR = {
			tag = GZI
			tag = RZI
			tag = ZIM
		}
	}
	has_country_shield = yes

	#Develop Gold
	zim_develop_gold = {
		icon = mission_war_chest
		required_missions = {  }
		position = 1
		provinces_to_highlight = {
			trade_goods = gold
			owned_by = ROOT
			NOT = { development = 10 }
		}
		trigger = {
			num_of_owned_provinces_with = {
				trade_goods = gold
				development = 10
				value = 3
			}
		}
		effect = {
			add_prestige = 20
			add_years_of_owned_provinces_production_income = {
				years = 2
				trigger = {
					trade_goods = gold
				}
				custom_tooltip = MONOPOLY_INCOME_GOLD_DESC
			}
			unlock_estate_privilege = {
				estate_privilege = estate_burghers_control_over_the_mint
			}
		}
		ai_weight = {
			factor = 500	#Gold = Good
		}
	}

	#Sea access please
	zim_conquer_coast = {
		icon = mission_great_trading_houses
		required_missions = { 
			zim_develop_gold
			zim_decline_of_zimbabwe
		}
		position = 2
		provinces_to_highlight = {
			province_id = 1186
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			owns_or_non_sovereign_subject_of = 1186
		}
		effect = {
			country_event = {
				id = flavor_zim.7
			}
			1186 = {
				if = {
					limit = {
						NOT = { province_has_center_of_trade_of_level = 2 }
					}
					add_center_of_trade_level = 1
				}
				add_latest_building = {
					trade = yes
					builder = ROOT
				}
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#Trade fleet
	zim_build_navy = {
		icon = mission_polynesian_navy_build
		required_missions = {
			zim_conquer_coast
		}
		position = 3
		provinces_to_highlight = {
			province_id = 1448
		}
		trigger = {
			num_of_light_ship = 20
			1448 = {
				OR = {
					is_strongest_trade_power = ROOT
					trade_share = {
						country = ROOT
						share = 30
					}
				}
			}
		}
		effect = {
			add_mercantilism = 5
			country_event = {
				id = flavor_zim.8
			}
			custom_tooltip = zim_build_navy_tt
			hidden_effect = {
				horn_of_africa_region = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
						has_port = yes
					}
					add_permanent_claim = ROOT
				}
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#Conquer more coast
	zim_dominate_upstream_trade = {
		icon = mission_african_gold
		required_missions = { zim_build_navy }
		position = 5
		provinces_to_highlight = {
			OR = {
				AND = {
					region = horn_of_africa_region
					NOT = { country_or_non_sovereign_subject_holds = ROOT }
					has_port = yes
				}
				province_id = 4346
			}
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				custom_trigger_tooltip = {
					tooltip = zim_dominate_upstream_trade_at
					has_port = yes
					region = horn_of_africa_region
				}
				value = 5
			}
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				custom_trigger_tooltip = {
					tooltip = zim_dominate_upstream_trade_at
					region = horn_of_africa_region
					has_port = yes
				}
				province_has_center_of_trade_of_level = 2
				value = 2
			}
			4346 = {
				OR = {
					is_strongest_trade_power = ROOT
					trade_share = {
						country = ROOT
						share = 25
					}
				}
			}
		}
		effect = {
			add_years_of_trade_income = {
				years = 2
				custom_tooltip = zim_dominate_upstream_trade_ct
			}
			4346 = {
				add_trade_modifier = {
					who = ROOT
					duration = -1
					power = 10
					key = zim_dominate_upstream_trade_tt
				}
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#Become filthy rich
	zim_zanzibar_greatest_market = {
		icon = mission_african_trade_post
		required_missions = { zim_dominate_upstream_trade }
		position = 6
		trigger = {
			trade_income_percentage = 0.4
			treasury = 5000
			NOT = { num_of_loans = 1 }
			custom_trigger_tooltip = {
				tooltip = zim_zanzibar_greatest_market_at
				OR = {
					1460 = {
						is_strongest_trade_power = ROOT
						highest_value_trade_node = yes
					}
					1448 = {
						is_strongest_trade_power = ROOT
						highest_value_trade_node = yes
					}
					4346 = {
						is_strongest_trade_power = ROOT
						highest_value_trade_node = yes
					}
				}
			}
			custom_trigger_tooltip = {
				tooltip = zim_zanzibar_greatest_market_bt
				OR = {
					504 = {
						OR = {
							is_strongest_trade_power = ROOT
							trade_share = {
								country = ROOT
								share = 10
							}
						}
					}
					1340 = {
						OR = {
							is_strongest_trade_power = ROOT
							trade_share = {
								country = ROOT
								share = 10
							}
						}
					}
					1361 = {
						OR = {
							is_strongest_trade_power = ROOT
							trade_share = {
								country = ROOT
								share = 10
							}
						}
					}
				}
			}
		}
		effect = {
			custom_tooltip = zim_zanzibar_greatest_market_tt
			hidden_effect = {
				1460 = {
					add_trade_modifier = {
						who = ROOT
						duration = -1
						power = 15
						key = ZIM_TRADE_DOMINANCE
					}
				}
				1448 = {
					add_trade_modifier = {
						who = ROOT
						duration = -1
						power = 15
						key = ZIM_TRADE_DOMINANCE
					}
				}
				4346 = {
					add_trade_modifier = {
						who = ROOT
						duration = -1
						power = 15
						key = ZIM_TRADE_DOMINANCE
					}
				}
				504 = {
					add_trade_modifier = {
						who = ROOT
						duration = -1
						power = 15
						key = ZIM_TRADE_DOMINANCE
					}
				}
				1340 = {
					add_trade_modifier = {
						who = ROOT
						duration = -1
						power = 15
						key = ZIM_TRADE_DOMINANCE
					}
				}
				1361 = {
					add_trade_modifier = {
						who = ROOT
						duration = -1
						power = 15
						key = ZIM_TRADE_DOMINANCE
					}
				}
				1371 = {
					add_trade_modifier = {
						who = ROOT
						duration = -1
						power = 15
						key = ZIM_TRADE_DOMINANCE
					}
				}
				684 = {
					add_trade_modifier = {
						who = ROOT
						duration = -1
						power = 15
						key = ZIM_TRADE_DOMINANCE
					}
				}
				4233 = {
					add_trade_modifier = {
						who = ROOT
						duration = -1
						power = 15
						key = ZIM_TRADE_DOMINANCE
					}
				}
			}
			add_country_modifier = {
				name = zim_trade_dominance
				duration = -1
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}
}

#Fith slot
mutapa_modernize_missions_slot = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Origins"
	}
	potential = {
		has_dlc = "Origins"
		NOT = { map_setup = map_setup_random }
		OR = {
			tag = GZI
			tag = RZI
			tag = ZIM
		}
	}
	has_country_shield = yes

	#Estate loyalty
	zim_council = {
		icon = mission_noble_council
		required_missions = {  }
		position = 1
		trigger = {
			OR = {
				NOT = { has_estate = estate_nobles }
				estate_loyalty = {
					estate = estate_nobles
					loyalty = 65
				}
			}
		}
		effect = {
			add_adm_power = 50
			add_dip_power = 50
			add_mil_power = 50
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#Reform army
	zim_reform_army = {
		icon = mission_african_soldier
		required_missions = { zim_council }
		position = 2
		trigger = {
			if = {
				limit = {
					has_dlc = "Cradle of Civilization"
				}
				army_professionalism = 25
			}
			else = {
				army_tradition = 25
			}
			has_mil_advisor_3 = yes
		}
		effect = {
			add_country_modifier = {
				name = zim_advanced_military
				duration = 9125
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#The Nguni
	zim_militarize_the_nguni = {
		icon = mission_kon_conquer_kub
		required_missions = { zim_reform_army }
		position = 3
		provinces_to_highlight = {
			OR = {
				AND = {
					OR = {
						province_id = 789
						province_id = 1181
					}
					OR = {
						NOT = { owned_by = ROOT }
						NOT = { base_manpower = 8 }
					}
				}
				owned_by = ZUL
			}
		}
		trigger = {
			789 = {
				owned_by = ROOT
				base_manpower = 8
			}
			1181 = {
				owned_by = ROOT
				base_manpower = 8
			}
			if = {	#For the case you want to have the Zulu on the map, the country should not be lost to them
				limit = {
					NOT = { num_of_cities = 3 }
				}
				num_of_cities = 3
			}
			adm_tech = 15
			if = {
				limit = { exists = ZUL }
				NOT = { exists = ZUL }
			}
		}
		effect = {
			country_event = {
				id = flavor_zim.3
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	#The Nguni
	zim_learn_from_the_nguni = {
		icon = mission_kon_conquer_ksj
		required_missions = { zim_militarize_the_nguni }
		position = 4
		provinces_to_highlight = {
			has_discovered = ROOT
			culture = nguni
			owned_by = ROOT
			OR = {
				NOT = { base_manpower = 5 }
				has_manpower_building_trigger = no
			}
		}
		trigger = {
			OR = {
				num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
					culture = nguni
					base_manpower = 5
					has_manpower_building_trigger = yes
					value = 4
				}
				any_subject_country = {
					primary_culture = nguni
					land_forcelimit = 20
					has_global_modifier_value = {
						which = discipline
						value = 0.1
					}
				}
			}
		}
		effect = {
			add_yearly_manpower = 2
			add_army_tradition = 15
			add_army_professionalism = 3
		}
		ai_weight = {
			factor = 75	#Default
		}
	}
}