OMA_1 = {
	slot = 1
	generic = no
	ai = yes
	has_country_shield = yes
	potential_on_load = {
		has_dlc = "Winds of Change"
	}
	potential = {
		tag = OMA
		NOT = { map_setup = map_setup_random }
		has_dlc = "Winds of Change"
	}

	OMA_mahra = {
		icon = mission_spoils_of_war
		position = 2
		required_missions = { OMA_hormuz } 
		provinces_to_highlight = {  
			OR = {
				area = dhofar_area
				area = mahra_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		} 

		trigger = {  
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value = 5
				OR = {
					area = dhofar_area
					area = mahra_area
				}
			}
		} 

		effect = {  
			custom_tooltip = ORM_REMOVE_AUTONOMY_IN_OWNED_PROVINCES
			hidden_effect = {
				every_owned_province = {
					limit = {
						OR = {
							area = dhofar_area
							area = mahra_area
						}
					}
					add_local_autonomy = -25
					add_nationalism = -5
				}
			}
			custom_tooltip = " "
			complex_dynamic_effect = {
				first_custom_tooltip = ORM_IF_1099_IS_OWNED_BY_US
				first_limit = "
					1099 = {
						country_or_non_sovereign_subject_holds = ROOT
					}
				"
				first_effect = "
					1099 = {
						center_of_trade = 1
						add_or_upgrade_shipyard_building = yes
						change_religion = ROOT
					}
				"
			}
		} 
	}

	OMA_holy_cities = {
		icon = kok_mam_holy_cities
		position = 3
		required_missions = { OMA_mahra } 
		provinces_to_highlight = {  
			OR = {
				area = medina_area
				area = mecca_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		} 

		trigger = {  
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value = 6
				OR = {
					area = medina_area
					area = mecca_area
				}
			}
		} 

		effect = {  
			custom_tooltip = ORM_BUFF_RELIGIOUS_DIPLOMATS
			set_country_flag = orm_religious_diplomats_buff_flag
			custom_tooltip = " "
			give_claims = { region = egypt_region }
		} 
	}

	OMA_india = {
		icon = mission_indian_trade_company
		position = 6
		required_missions = { OMA_trading_outposts } 
		provinces_to_highlight = {  
			OR = {
				region = deccan_region
				region = coromandel_region
				region = west_india_region
				region = bengal_region
			}
			province_has_center_of_trade_of_level = 1
			has_port = yes
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		} 

		trigger = {  
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					region = deccan_region
					region = coromandel_region
					region = west_india_region
					region = bengal_region
				}
				province_has_center_of_trade_of_level = 1
				has_port = yes
				value = 4
			}
		} 

		effect = {  
			add_government_power = {
				mechanic_type = arabic_trade_influence
				power_type = arabic_trade_influence_power
				value = 25
			}
			custom_tooltip = " "
			custom_tooltip = ORM_GRANT_CLAIM_ON_MALAY_SPICES
			custom_tooltip = " "
			give_claims = { id = 667 }
			give_claims = { id = 668 }
			hidden_effect = {
				malaya_region = {
					limit = {
						trade_goods = spices
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
			}
		} 
	}

	OMA_malay = {
		icon = mission_malayan_viceroyalty
		position = 7
		required_missions = { OMA_india } 
		provinces_to_highlight = {  
			province_id = 596
		} 

		trigger = {  
			596 = {
				is_strongest_trade_power = ROOT
			}
		} 

		effect = {  
			custom_tooltip = ORM_GRANT_CLAIMS_ON_ALL_SPICE_PROVINCES_IN_SEA
			if = {
				limit = {
					has_dlc = "Cradle of Civilization"
				}
				custom_tooltip = " "
				set_country_flag = orm_better_sea_religious_propagation
				custom_tooltip = ORM_BUFF_RELIGIOUS_PROPAGATION_ON_SEA_PROVINCES
				custom_tooltip = " "
			}
			else = {
				add_country_modifier = {
					name = orm_propogation_of_the_islamic_faith
					duration = -1
				}
			}
			add_mercantilism = 2
			hidden_effect = {
				indonesia_region = {
					limit = {
						trade_goods = spices
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				moluccas_region = {
					limit = {
						trade_goods = spices
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
			}
		} 
	}

	OMA_spice_trade = {
		icon = mission_rb_colonise_spice_islands
		position = 8
		required_missions = {
			OMA_malay
			OMA_china
		}
		provinces_to_highlight = {  
			OR = {
				region = malaya_region
				region = indonesia_region
				region = moluccas_region
			}
			trade_goods = spices
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		} 

		trigger = {  
			OR = {
				trade_goods_produced_amount = {
					trade_goods = spices
					amount = 65
				}
				trading_part = {
					trade_goods = spices
					value = 0.3
				}
			}
		} 

		effect = {  
			capital_scope = {
				add_trade_node_income = 15
			}
			custom_tooltip = " "
			complex_dynamic_effect = {
				first_custom_tooltip = ORM_IF_NO_SPICE_TRADE_EVENT
				first_limit = "
					NOT = { has_global_flag = spice_trade_happened }
				"
				first_effect = "
					set_country_flag = orm_spice_trade_trigger_flag
					country_event = { id = prices.8 }
					set_global_flag = spice_trade_happened #So that it will not fire twice
				"
				second_custom_tooltip = ORM_IF_YES_SPICE_TRADE_EVENT
				second_limit = "
					has_global_flag = spice_trade_happened
				"
				second_effect = "
					add_mercantilism = 5
					add_government_power = {
						mechanic_type = arabic_trade_influence
						power_type = arabic_trade_influence_power
						value = 20
					}
				"
			}
		} 
	}
}
OMA_2 = {
	slot = 2
	generic = no
	ai = yes
	has_country_shield = yes
	potential_on_load = {
		has_dlc = "Winds of Change"
	}
	potential = {
		tag = OMA
		NOT = { map_setup = map_setup_random }
		has_dlc = "Winds of Change"
	}

	OMA_hormuz = {
		icon = mission_portuguese_oman
		position = 1
		provinces_to_highlight = {  
			OR = {
				province_id = 399
				province_id = 400
				province_id = 4286
				province_id = 2341
			}
		} 

		trigger = {  
			399 = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			400 = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			4286 = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			2341 = {
				country_or_non_sovereign_subject_holds = ROOT
			}
		} 

		effect = {  
			give_claims = { area = pirate_coast_area }
			give_claims = { id = 2999 }
			give_claims = { area = bahrain_area }
			give_claims = { area = yamamah_area }
			give_claims = { area = nafud_area }
			give_claims = { area = qasim_area }
			give_claims = { area = dhofar_area }
			give_claims = { area = mahra_area }
			custom_tooltip = " "
			400 = {
				add_center_of_trade_level = 1
				add_or_upgrade_shipyard_building = yes
			}
		} 
	}

	OMA_haasa = {
		icon = mission_haasa
		position = 2
		required_missions = { OMA_hormuz } 
		provinces_to_highlight = {  
			area = bahrain_area
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		} 

		trigger = {  
			bahrain_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		} 

		effect = {  
			add_mercantilism = 2
			custom_tooltip = " "
			395 = {
				add_province_modifier = {
					name = orm_exploiting_the_gems_of_arabia
					duration = 5475
				}
			}
			396 = {
				add_province_modifier = {
					name = orm_exploiting_the_gems_of_arabia
					duration = 5475
				}
			}
			add_years_of_owned_provinces_production_income = {
				years = 8
				trigger = {
					OR = {
						is_capital = yes #So that it doesn't display 0
						AND = {
							area = bahrain_area
							trade_goods = gems
						}
					}
				}
				custom_tooltip = FROM_BAHRAIN_GEMS
			}
		} 
	}

	OMA_Baghdad = {
		icon = mam_baghdad
		position = 3
		required_missions = {
			OMA_haasa
			OMA_central_arabia
			OMA_mahra
		}
		provinces_to_highlight = {  
			OR = {
				area = basra_area
				area = iraq_arabi_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		} 

		trigger = {  
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = basra_area
					area = iraq_arabi_area
				}
				value = 6
			}
			2339 = {
				owned_by = ROOT
			}
		}   

		effect = {  
			410 = {
				add_or_upgrade_university_building = yes
			}
			change_innovativeness = 5
			give_claims = { region = mashriq_region }

		} 
	}

	OMA_unify_arabia = {
		icon = arb_unite_arabia
		position = 4
		required_missions = {
			OMA_yemen
			OMA_Baghdad
			OMA_holy_cities
		}
		provinces_to_highlight = { 
			OR = {
				province_id = 358			#Alexandria
				province_id = 361			#Cairo
				province_id = 377			#Aleppo
				province_id = 379			#Jerusalem
				province_id = 382			#Damascus
				province_id = 384			#Medina
				province_id = 385			#Mecca
				province_id = 388			#Aden
				province_id = 390			#Sanaa
				province_id = 392			#Al-Arid
				province_id = 394			#Qatif
				province_id = 400			#Muscat
				province_id = 403			#Nizwa
				province_id = 410			#Baghdad
			}
			OR = {
				NOT = { owned_by = ROOT }
				NOT = { is_core = ROOT }
			}
		} 

		trigger = {  
			owns_core_province = 358			#Alexandria
			owns_core_province = 361			#Cairo
			owns_core_province = 377			#Aleppo
			owns_core_province = 379			#Jerusalem
			owns_core_province = 382			#Damascus
			owns_core_province = 384			#Medina
			owns_core_province = 385			#Mecca
			owns_core_province = 388			#Aden
			owns_core_province = 390			#Sanaa
			owns_core_province = 392			#Al-Arid
			owns_core_province = 394			#Qatif
			owns_core_province = 400			#Muscat
			owns_core_province = 403			#Nizwa
			owns_core_province = 410			#Baghdad
		} 

		effect = {  
			set_country_flag = free_arabia_forming_flag
			custom_tooltip = YEM_no_more_tech_req
			custom_tooltip = " "
			distribute_development = {
				type = manpower
				amount = 10
			}
			add_permanent_power_projection = {
				type = orm_permanent_power_projection
				amount = 5
			}
		} 
	}

	OMA_trading_outposts = {
		icon = mission_south_indian_trade
		position = 5
		trigger = {  
			num_of_light_ship = 10
			OR = {
				navy_size = 10 # modified
				navy_size_percentage = 1
			}
		}

		effect = {  
			custom_tooltip = ORM_GRANT_PERMANENT_CLAIMS_ON_LEVEL_2_COT_INDIAN_PROVINCES
			custom_tooltip = " "
			hidden_effect = {
				every_province = {
					limit = {
						OR = {
							region = coromandel_region
							region = deccan_region
							region = west_india_region
							region = bengal_region
						}
						has_port = yes
						province_has_center_of_trade_of_level = 2
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
			}
			add_country_modifier = {
				name = orm_beyond_arabic_ports
				duration = 7300
			}
		} 
	}

	OMA_china = {
		icon = mission_open_up_china
		position = 7
		required_missions = { OMA_india } 
		provinces_to_highlight = {  
			OR = {
				province_id = 667
				province_id = 668
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		} 

		trigger = {  
			OR = {
				668 = {
					trade_share = {
						country = ROOT
						share = 55
					}
				}
				AND = {
					668 = {
						country_or_non_sovereign_subject_holds = ROOT
					}
					667 = {
						country_or_non_sovereign_subject_holds = ROOT
					}
				}
			}
		} 

		effect = { 
			country_event_with_effect_insight = {
				id = flavor_ormoma.5
				effect = "
					add_country_modifier = {
						name = orm_far_east_company
						duration = -1
					}
					add_government_power = {
						mechanic_type = arabic_trade_influence
						power_type = arabic_trade_influence_power
						value = 15
					}
				"
			}
		} 
	}

	OMA_thalassocracy = {
		icon = mission_arabian_thalassocracy
		position = 9
		required_missions = {
			OMA_indian_ocean_supremacy
			OMA_spice_trade
		}
		provinces_to_highlight = {  
			OR = {
				province_id = 541
				province_id = 596
				province_id = 564
			}
			NOT = {
				trade_share = {
					country = ROOT
					share = 50
				}
			}
		} 

		trigger = {  
			monthly_income = 250
			capital_scope = {
				highest_value_trade_node = yes
				is_strongest_trade_power = ROOT
			}
			541 = {
				trade_share = {
					country = ROOT
					share = 50
				}
			}
			596 = {
				trade_share = {
					country = ROOT
					share = 50
				}
			}
			564 = {
				trade_share = {
					country = ROOT
					share = 50
				}
			}
		} 

		effect = {
			custom_tooltip = ORM_BUFF_ARABIC_TRADE_INFLUENCE_TO_GIVE_EXTRA_TRADE_EFFICIENCY
			set_country_flag = orm_arabic_influence_trade_eff_buff_flag
			custom_tooltip = " "
			if = {
				limit = {
					has_country_modifier = thalassocracy
				}
				add_mercantilism_or_monarch_power = { amount = 5 }
				add_prestige_or_monarch_power = { amount = 10 }
				add_stability_or_adm_power = yes
			}
			else = {
				add_country_modifier = {
					name = "thalassocracy"
					duration = -1
				}
				unlock_government_reform = {
					government_reform = thalassocracy_reform
				}
			}
		} 
	}
}
OMA_3 = {
	slot = 3
	generic = no
	ai = yes
	has_country_shield = yes
	potential_on_load = {
		has_dlc = "Winds of Change"
	}
	potential = {
		tag = OMA
		NOT = { map_setup = map_setup_random }
		has_dlc = "Winds of Change"
	}

	OMA_central_arabia = {
		icon = mam_arabia
		position = 2
		required_missions = { OMA_hormuz } 
		provinces_to_highlight = {  
			OR = {
				area = yamamah_area
				area = qasim_area
				area = nafud_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		} 

		trigger = {  
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = yamamah_area
					area = qasim_area
					area = nafud_area
				}
				value = 6
			}
			2339 = {
				owned_by = ROOT
			}
		}  

		effect = {  
			add_country_modifier = {
				name = orm_subduing_arabian_tribes
				duration = 7300
			}
			2339 = {
				add_unit_construction = {
					type = cavalry
					amount = 5
					speed = 0.5
					cost = 0
				}
			}
			add_army_tradition_or_mil_power = { amount = 10 }
		} 
	}

	OMA_yemen = {
		icon = yem_unite_yemen
		position = 3
		required_missions = { OMA_central_arabia } 
		provinces_to_highlight = {  
			OR = {
				area = asir_area
				area = upper_yemen_area
				area = tihama_al_yemen_area
				area = yemen_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		} 

		trigger = {  
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = asir_area
					area = upper_yemen_area
					area = tihama_al_yemen_area
					area = yemen_area
				}
				value = 8
			}
		} 

		effect = {  
			add_years_of_owned_provinces_production_income = {
				years = 8
				trigger = {
					OR = {
						is_capital = yes #So that it doesn't display 0
						AND = {
							OR = {
								area = asir_area
								area = upper_yemen_area
								area = tihama_al_yemen_area
								area = yemen_area
							}
							trade_goods = coffee
						}
					}
				}
				custom_tooltip = FROM_YEMENI_COFFEE
			}
			custom_tooltip = " "
			add_country_modifier = {
				name = orm_conquest_of_yemen
				duration = 5475
			}
			change_mil = 1
		} 
	}

	OMA_exaploiting_the_secret = {
		icon = yem_coffee
		position = 4
		required_missions = { OMA_yemen } 
		provinces_to_highlight = {  
			OR = {
				province_id = 4280
				province_id = 4279
				province_id = 387
			}
			OR = {
				NOT = { country_or_non_sovereign_subject_holds = ROOT }
				NOT = { base_production = 6 }
				NOT = { num_of_buildings_in_province = 2 }
			}
		} 

		trigger = {  
			4280 = {
				country_or_non_sovereign_subject_holds = ROOT
				base_production = 6
				num_of_buildings_in_province = 2
			}
			4279 = {
				country_or_non_sovereign_subject_holds = ROOT
				base_production = 6
				num_of_buildings_in_province = 2
			}
			387 = {
				country_or_non_sovereign_subject_holds = ROOT
				base_production = 6
				num_of_buildings_in_province = 2
			}
		} 

		effect = {  
			custom_tooltip = ORM_EXPAND_COFFEA_ARABICA_IN_OTHER_PROVINCES_AND_ADD_MANUFACTORY
			custom_tooltip = " "
			if = {
				limit = {
					has_dlc = "Rights of Man"
				}
				add_ruler_personality = industrious_personality
			}
			else = {
				add_mercantilism = 5
			}
			hidden_effect = {
				4280 = {
					add_permanent_province_modifier = {
						name = coffea_arabica_modifier
						duration = -1
					}
					add_manufactory =  yes
				}
				4279 = {
					add_permanent_province_modifier = {
						name = coffea_arabica_modifier
						duration = -1
					}
					add_manufactory = yes
				}
				387 = {
					add_manufactory = yes
				}
			}
		} 
	}

	OMA_buffing_outposts = {
		icon = invest_in_the_rich_trades
		position = 6
		required_missions = {
			OMA_trading_outposts
			OMA_end_hormuz_toll
		}
		trigger = {  
			if = {
				limit = {
					OR = {
						has_dlc = "Wealth of Nations"
						has_dlc = "Dharma"
					}
				}
				num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
					value = 5
					province_has_center_of_trade_of_level = 2
					development = 20
					is_owned_by_trade_company = yes
				}
			}
			else = {
				num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
					value = 5
					province_has_center_of_trade_of_level = 2
					development = 20
				}
			}
			capital_scope = {
				trade_node_value = 35
			}
		} 

		effect = {  
			if = {
				limit = { has_dlc = "Dharma" }
				custom_tooltip = ORM_BUFF_STRENGTHEN_OVERSEAS_OUTPOST_INTERACTION
			}
			else = {
				custom_tooltip = ORM_BUFF_STRENGTHEN_OVERSEAS_OUTPOST_INTERACTION_BUDGET_EDITION
			}
			set_country_flag = orm_trade_outposts_interaction_buff_flag
			custom_tooltip = " "
			custom_tooltip = ORM_GRANT_DIPLO_POWER_PER_PROVINCE_THAT_MEETS_REQUIREMENTS
			hidden_effect = {
				if = {
					limit = {
						OR = {
							has_dlc = "Wealth of Nations"
							has_dlc = "Dharma"
						}
					}
					if = {
						limit = {
							num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
								value = 10
								province_has_center_of_trade_of_level = 2
								is_owned_by_trade_company = yes
								development = 20
							}
						}
						add_dip_power = 250
					}
					else = {
						every_owned_province = {
							limit = {
								province_has_center_of_trade_of_level = 2
								is_owned_by_trade_company = yes
								development = 20
							}
							owner = {
								add_dip_power = 25
							}
						}
					}
				}
				else = {
					if = {
						limit = {
							num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
								value = 10
								province_has_center_of_trade_of_level = 2
								development = 20
							}
						}
						add_dip_power = 250
					}
					else = {
						every_owned_province = {
							limit = {
								province_has_center_of_trade_of_level = 2
								development = 20
							}
							owner = {
								add_dip_power = 25
							}
						}
					}
				}
			}
		} 
	}

	OMA_finest_arabic_seafarers = {
		icon = mission_explore_the_world
		position = 7
		required_missions = {
			OMA_buffing_outposts
			OMA_forts_of_oman
		}
		trigger = {  
			has_government_power = {
				mechanic_type = arabic_trade_influence
				power_type = arabic_trade_influence_power
				value = 50
			}
			trader = 3
			navy_size = 65 # modified
		} 

		effect = {
			custom_tooltip = ORM_UNLOCK_ARABIC_MERCHANTS_BURGHERS_PRIVILEGE
			set_country_flag = orm_arabic_merchants_flag
			custom_tooltip = " "
			if = {
				limit = {
					has_dlc = "Wealth of Nations"
				}
				country_event_with_option_insight = {
					id = flavor_ormoma.2
					option_1 = "
						custom_tooltip = ORM_BUFF_ARABIC_MERCHANTS_PRIVILEGE_MERCHANT_BUFF
					"
					option_2 = "
						custom_tooltip = ORM_BUFF_ARABIC_MERCHANTS_PRIVILEGE_LIGHT_SHIPS_BUFF
					"
					option_3 = "
						custom_tooltip = ORM_BUFF_ARABIC_MERCHANTS_PRIVILEGE_DIPLOMATIC_BUFF
					"
				}
			}
			else = {
				country_event_with_option_insight = {
					id = flavor_ormoma.2
					option_1 = "
						custom_tooltip = ORM_BUFF_ARABIC_MERCHANTS_PRIVILEGE_MERCHANT_BUFF
					"
					option_2 = "
						custom_tooltip = ORM_BUFF_ARABIC_MERCHANTS_PRIVILEGE_LIGHT_SHIPS_BUFF
					"
				}
			}
		}  
	}

	OMA_indian_ocean_supremacy = {
		icon = mission_indian_ocean_supremacy
		position = 8
		required_missions = {
			OMA_china
			OMA_finest_arabic_seafarers
		}
		trigger = {  
			capital_scope = {
				trade_node_value = 90
			}
			OR = {
				full_idea_group = trade_ideas
				dip = 5
			}
			if = {
				limit = {
					OR = {
						has_dlc = "Dharma"
						has_dlc = "Wealth of Nations"
					}
				}
				num_of_strong_trade_companies = 6
			}
			else = {
				trader = 3
				monthly_income = 200
			}
		} 

		effect = {  
			custom_tooltip = ORM_BUFF_ARABIAN_MERCHANTS_PRIVILEGE_ARABIAN_TRADE_INFLUENCE
			set_country_flag = orm_arabian_merchants_privilege_buff
			custom_tooltip = " "
			if = {
				limit = {
					OR = {
						has_dlc = "Dharma"
						has_dlc = "Wealth of Nations"
					}
				}
				custom_tooltip = ORM_BUFF_FAR_EAST_COMPANY_MODIFIER
				hidden_effect = {
					remove_country_modifier = orm_far_east_company
					add_country_modifier = {
						name = orm_arabian_indian_ocean_supremacy
						duration = -1
					}
				}
			}
			else = {
				custom_tooltip = ORM_BUFF_FAR_EAST_COMPANY_MODIFIER_NO_DLC
				hidden_effect = {
					remove_country_modifier = orm_far_east_company
					add_country_modifier = {
						name = orm_arabian_indian_ocean_supremacy_no_dlc
						duration = -1
					}
				}
			}
		} 
	}
}
OMA_4 = {
	slot = 4
	generic = no
	ai = yes
	has_country_shield = yes
	potential_on_load = {
		has_dlc = "Winds of Change"
	}
	potential = {
		tag = OMA
		NOT = { map_setup = map_setup_random }
		has_dlc = "Winds of Change"
	}

	OMA_arabian_naval_bases = {
		icon = mission_arabian_ports
		position = 1
		provinces_to_highlight = {
			region = arabia_region
			NOT = { has_shipyard_building_trigger = yes }
			has_port = yes
		} 
		trigger = {  
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				region = arabia_region
				has_shipyard_building_trigger = yes
				value = 3
			}
		} 

		effect = {  
			distribute_development = {
				type = production
				amount = 5
				limit = "
					region = arabia_region
					has_shipyard_building_trigger = yes
				"
				tooltip = OMA_DISTRIBUTE_ONLY_IN_REQUIRED_PROVINCES
			}
			add_country_modifier = {
				name = oma_constructing_omani_fleet
				duration = 5475
			}
		} 
	}

	OMA_shipbuilding_masters = {
		icon = mission_galleys_in_port
		position = 2
		required_missions = { OMA_arabian_naval_bases }

		trigger = {  
			navy_size = 20 # modified
			if = {
				limit = {
					has_estate = estate_burghers
				}
				estate_loyalty = {
					estate = estate_burghers
					loyalty = 65
				}
			}
			sailors_percentage = 0.75
		} 

		effect = {  
			east_africa_region = {
				discover_country = ROOT
			}
			give_claims = { area = northern_swahili_coast_area }
			give_claims = { area = mombasa_area }
			give_claims = { area = central_swahili_coast_area }
			give_claims = { area = mozambique_area }
			give_claims = { area = sakalava_area }
			give_claims = { area = southern_madagascar }
			give_claims = { area = madagascar_highlands_area }
			give_claims = { area = betsimasaraka_area }
			custom_tooltip = " "
			custom_tooltip = OMA_BUFF_PRIVATE_TRADING_FLEETS
			set_country_flag = oma_private_trading_fleets_buff_flag
		} 
	}

	OMA_madagascar = {
		icon = mission_invade_island
		position = 3
		required_missions = { OMA_shipbuilding_masters } 
		provinces_to_highlight = {  
			OR = {
				area = madagascar_highlands_area
				area = sakalava_area
				area = southern_madagascar
				area = betsimasaraka_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		} 

		trigger = {  
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = madagascar_highlands_area
					area = sakalava_area
					area = southern_madagascar
					area = betsimasaraka_area
				}
				value = 7
			}
		} 

		effect = {  
			custom_tooltip = OMA_GAIN_MERCANTILISM_PER_SLAVE_PROVINCE_IN_MADAGASCAR
			custom_tooltip = " "
			if = {
				limit = {
					1103 = {
						is_empty = yes
					}
				}
				1103 = {
					add_siberian_construction = 10
				}
			}
			if = {
				limit = {
					1102 = {
						is_empty = yes
					}
				}
				1102 = {
					add_siberian_construction = 10
				}
			}
			if = {
				limit = {
					4020 = {
						is_empty = yes
					}
				}
				4020 = {
					add_siberian_construction = 10
				}
			}
			if = {
				limit = {
					1100 = {
						is_empty = yes
					}
				}
				1100 = {
					add_siberian_construction = 10
				}
			}
			hidden_effect = {
				every_owned_province = {
					limit = {
						OR = {
							area = madagascar_highlands_area
							area = sakalava_area
							area = southern_madagascar
							area = betsimasaraka_area
						}
						trade_goods = slaves
					}
					owner = {
						add_mercantilism = 1
					}
				}
			}
		} 
	}

	OMA_zanzibar_trade_dominance = {
		icon = mission_zanzibari_trade
		position = 4
		required_missions = {
			OMA_madagascar
			OMA_zanzibar
		}
		
		provinces_to_highlight = {
			province_id = 1448
			NOT = {
				trade_share = {
					country = ROOT
					share = 75
				}
			}
		}
	
		trigger = {  
			1448 = {
				trade_share = {
					country = ROOT
					share = 75
				}
			}
			trade_goods_produced_amount = {
				trade_goods = ivory
				amount = 30
			}
		} 

		effect = {
			custom_tooltip = OMA_TRADER_GRANTS_EXTRA_ARABIC_TRADE_INFLUENCE
			set_country_flag = oma_trader_advisor_trade_influence_buff_flag
			custom_tooltip = " "
			custom_tooltip = OMA_GRANT_FOLLOWING_BONUS_TO_ALL_IVORY_PROVINCES
			tooltip = {
				add_base_production = 1
				add_province_modifier = {
					name = oma_zanzibar_ivory_trade
					duration = -1
				}
			}
			hidden_effect = {
				every_owned_province = {
					limit = {
						region = east_africa_region
						trade_goods = ivory
					}
					add_base_production = 1
					add_province_modifier = {
						name = oma_zanzibar_ivory_trade
						duration = -1
					}
				}
			}
		} 
	}

	OMA_end_hormuz_toll = {
		icon = mam_hormuz_straits
		position = 5
		provinces_to_highlight = {  
			OR = {
				province_id = 2999
				province_id = 400
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
			if = {
				limit = {
					province_id = 2999
				}
				NOT = { has_trade_building_trigger = yes }
			}
		} 

		trigger = {  
			2999 = {
				country_or_non_sovereign_subject_holds = ROOT
				has_trade_building_trigger = yes
			}
			400 = {
				country_or_non_sovereign_subject_holds = ROOT
			}
		} 

		effect = {  
			country_event_with_option_insight = {
				id = flavor_ormoma.4
				option_1 = "
					2999 = {
						add_or_upgrade_trade_building = yes
						add_center_of_trade_level = 1
					}
				"
				option_2 = "
					400 = {
						add_or_upgrade_trade_building = yes
						add_province_modifier = {
							name = oma_development_of_masqat_port
							duration = -1
						}
					}
				"
			}
		} 
	}

	OMA_forts_of_oman = {
		icon = mission_fortifying_the_plain
		position = 6
		required_missions = { OMA_end_hormuz_toll } 
		provinces_to_highlight = {  
			province_id = 403
			if = {
				limit = {
					has_dlc = "Leviathan"
				}
				OR = {
					NOT = {
						has_great_project = {
							type = nizwa_fort
							tier = 2
						}
					}
					NOT = { country_or_non_sovereign_subject_holds = ROOT }
				}
			}
			else = {
				OR = {
					NOT = { has_fort_building_trigger = yes }
					NOT = { country_or_non_sovereign_subject_holds = ROOT }
				}
			}
		} 

		trigger = {  
			403 = {
				country_or_non_sovereign_subject_holds = ROOT
				if = {
					limit = {
						has_dlc = "Leviathan"
					}
					has_great_project = {
						type = nizwa_fort
						tier = 2
					}
				}
				else = {
					has_fort_building_trigger = yes
				}
			}
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				base_manpower = 4
				has_fort_building_trigger = yes
				value = 3
			}
		} 

		effect = {  
			if = {
				limit = {
					has_dlc = "Leviathan"
				}
				403 = {
					add_great_project_tier = {
						type = nizwa_fort
						tier = 1
					}
					custom_tooltip = " "
					custom_tooltip = OMA_GRANT_NIZWA_FORT_UPGRADE
					set_province_flag = oma_niwa_fort_upgrade_buff
				}
			}
			else = {
				403 = {
					add_province_modifier = {
						name = oma_nizwa_fort_modifier
						duration = -1
					}
					add_or_upgrade_fort_building = yes
				}
			}
		} 
	}

	OMA_religious_propogation = {
		icon = mission_dhimmi
		position = 8
		required_missions = {
			OMA_finest_arabic_seafarers
			OMA_spreading_the_ibadi_faith
		} 
		trigger = {  
			if = {
				limit = {
					has_dlc = "Cradle of Civilization"
				}
				custom_trigger_tooltip = {
					tooltip = ORM_NUM_OF_PROVINCES_PROPAGATED
					check_variable = {
						which = propogation_counter
						value = 30
					}
				}
			}
			else = {
				num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
					value = 50
					religion = ROOT
				}
			}
		} 

		effect = {
			if = {
				limit = {
					has_dlc = "Cradle of Civilization"
				}
				set_country_flag = hormuz_religious_propagations_buffs_flag
				custom_tooltip = ORM_RELIGIOUS_CULTURE_GRANTS_EXTRA_MODIFIERS
				custom_tooltip = " "  
				custom_tooltip = ORM_RELIGIOUS_PROPAGATION_NOW_GRANTS_PROVINCE_FOLLOWING_MODIFIER
				tooltip = {
					add_province_modifier = {
						name = orm_hormuz_merchants_influence
						duration = 7300
					}
				}
			}
			else = {
				define_advisor = {
					type = inquisitor
					skill = 3
					cost_multiplier = 0.25
				}
				
				add_mercantilism_or_monarch_power = { amount = 3 }
			}
		} 
	}
}
OMA_5 = {
	slot = 5
	generic = no
	ai = yes
	has_country_shield = yes
	potential_on_load = {
		has_dlc = "Winds of Change"
	}
	potential = {
		tag = OMA
		NOT = { map_setup = map_setup_random }
		has_dlc = "Winds of Change"
	}

	OMA_omani_marines = {
		icon = mission_omani_marines
		position = 2
		required_missions = { OMA_arabian_naval_bases }

		trigger = {  
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				has_dock_building_trigger = yes
				development = 10
				value = 15
			}
			navy_tradition = 35
		} 

		effect = {
			if = {
				limit = {
					OR = {
						has_dlc = "Rule Britannia"
						has_dlc = "Golden Century"
						has_dlc = "Lions of the North"
						has_dlc = "Domination"
					}
				}
				add_country_modifier = {
					name = oma_omani_marines
					duration = -1
				}
				custom_tooltip = OMA_UNLOCK_MERCHANT_PRIVILEGE_OF_OMANI_MARINES
				set_country_flag = oma_omani_marines_privilege_flag
			}
			else = {
				capital_scope = {
					add_or_upgrade_shipyard_building = yes
					add_or_upgrade_dock_building = yes
					add_base_production = 3
				}
			}
		}  
	}

	OMA_zanzibar = {
		icon = mission_african_trade_post
		position = 3
		required_missions = { OMA_shipbuilding_masters } 
		provinces_to_highlight = {
			OR = {
				area = northern_swahili_coast_area
				area = mombasa_area
				area = central_swahili_coast_area
				area = mozambique_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		} 

		trigger = {  
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = northern_swahili_coast_area
					area = mombasa_area
					area = central_swahili_coast_area
					area = mozambique_area
				}
				value = 10
			}
			1196 = {
				country_or_non_sovereign_subject_holds = ROOT
			}
		} 

		effect = {
			if = {
				limit = {
					has_dlc = "Leviathan"
				}
				custom_tooltip = OMA_UPGRADE_KILWA_MONUMENT
				set_country_flag = oma_kilwa_buff_flag
			}
			else = {
				1196 = {
					add_base_production = 2
					add_base_tax = 2
					add_base_manpower = 2
				}
			}
			country_event_with_effect_insight = {
				id = flavor_ormoma.3
				effect = "
					override_country_name = OMAN_ZANZIBAR
					add_prestige_or_monarch_power = { amount = 20 }
				"
			}
		}
	}

	OMA_spreading_the_ibadi_faith = {
		icon = per_muslim_integration
		position = 7
		trigger = {  
			reform_level = 4
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value = 20
				religion = ROOT
			}
			if = {
				limit = {
					has_estate = estate_church
				}
				estate_loyalty = {
					estate = estate_church
					loyalty = 70
				}
			}
		} 

		effect = {  
			set_country_flag = oma_church_admin_privileges_buff_flag
			custom_tooltip = OMA_BUFF_CHURCH_ADMIN_PRIVILEGES
			custom_tooltip = " "
			define_advisor = {
				type = theologian
				skill = 3
				cost_multiplier = 0.75
			}
			custom_tooltip = " "
			add_adm_power = 100
		} 
	}
}
