########################################
# Events for The Mamelukes
#
# written by Johan Andersson
########################################

namespace = flavor_mam
normal_or_historical_nations = yes

# Turks take Constantinople
country_event = {
	id = flavor_mam.1
	title = flavor_mam.1.t
	desc = flavor_mam.1.d
	picture = HORDE_ON_HORSEBACK_eventPicture
	
	fire_only_once = yes

	trigger = {
		tag = MAM
		NOT = { is_rival = TUR }		#Ottomans are not our rival.
		TUR = { owns = 151 }			#Constantinople
		151 = { NOT = { months_since_defection = 24 } }	#within 2 years.
	}
	
	mean_time_to_happen = {
		months = 7
	}
	
	option = {
		ai_chance = { factor = 90 }
		name = flavor_mam.1.b
		TUR = {
			add_opinion = {
				who = root
				modifier = mam_poem_recieved
			}		
		}
	}
	option = {
		name = flavor_mam.1.a
		add_country_modifier = {
			name = mam_large_festitives
			duration = 3650
		}
	}
	
}

#The Public works of Cairo
country_event = {
	id = flavor_mam.2
	title = flavor_mam.2.t
	desc = flavor_mam.2.d
	picture = UNIVERSITY_eventPicture

	fire_only_once = yes
	
	trigger = {
		OR = {
			AND = {
				tag = MAM
				is_year = 1457
				owns = 361			#we have to own cairo
				NOT = { is_year = 1459 }
				has_regency = no
				is_female = no
			}
			mission_completed = mam_city_thousand_minarets
		}
	}
	mean_time_to_happen = {
		months = 12
		modifier = {
			factor = 0.01
			mission_completed = mam_city_thousand_minarets
		}
	}
	option = {
		name = flavor_mam.2.a
		add_piety = 0.10
		361 = { 
			add_province_modifier = {
				name = "public_works_of_cairo"
				duration = -1
			}
		}
		
	}
}

# Install a vassal ruler on Cyprus... 'James II'
country_event = {
	id = flavor_mam.3
	title = flavor_mam.3.t
	desc = flavor_mam.3.d
	picture = NEW_HEIR_eventPicture

	fire_only_once = yes
	
	trigger = {
		tag = MAM
		is_year = 1458
		is_at_war = no
		exists = CYP
		CYP = { 
			owns = 321
			is_subject = no 
			is_at_war = no
			government = monarchy
			OR = {
				is_female = yes
				has_regency = yes
			}
			religion_group = christian
		}
	}
	mean_time_to_happen = {
		months = 5
	}
	option = {
		name = flavor_mam.3.a
		
		ai_chance = { factor = 90 }
		CYP = {
			country_event = { 
				id = flavor_mam.4
				days = 5
				random = 8
				tooltip = flavor_mam.3.4
			}
		}
		add_prestige = -10
	}
	option = {
		name = flavor_mam.3.b
		ai_chance = { factor = 10 }
		add_prestige = 10
	}
}

# Cyprus response
country_event = {
	id = flavor_mam.4
	title = flavor_mam.4.t
	desc = flavor_mam.4.d
	picture = DIPLOMACY_eventPicture
	
	is_triggered_only = yes
	
	option = {		
		name = flavor_mam.4.a		#Accept James as ruler.
		MAM = {
			country_event = { 
				id = flavor_mam.5
				days = 2
				random = 7
				tooltip = flavor_mam.4.5
			}
		}
		add_prestige = -5
		if = {
			limit = {
				has_heir = yes
			}
			hidden_effect = {
				kill_heir = { allow_new_heir = no }
			}
		}
		define_ruler = {
			name = "Jacques"
			dynasty = "de Lusignan"
		}
	}
	option = {		
		name = flavor_mam.4.b		#Bribe the Mamelukes
		ai_chance = { factor = 0 }
		add_years_of_income = -1.0
		MAM = {
			country_event = { 
				id = flavor_mam.6
				days = 2
				random = 7
				tooltip = flavor_mam.4.6
			}
		}		
	}
	option = {		
		name = flavor_mam.4.c		#Refuse the demands!
		ai_chance = { factor = 0 }
		add_prestige = 5
		MAM = {
			country_event = { 
				id = flavor_mam.7
				days = 2
				random = 7
				tooltip = flavor_mam.4.7
			}
			add_opinion = {
				who = root
				modifier = mam_refused_james
			}		
		}		
	}	
}

# CYP has installed him
country_event = {
	id = flavor_mam.5
	title = flavor_mam.5.t
	desc = flavor_mam.5.d
	picture = NEW_HEIR_eventPicture
	
	is_triggered_only = yes
	
	option = {	
		name = flavor_mam.5.a
		CYP = {
			add_opinion = {
				who = root
				modifier = mam_installed_ruler
			}		
		}	
		vassalize = CYP
		add_prestige = 20
	}
}

# CYP bribes us
country_event = {
	id = flavor_mam.6
	title = flavor_mam.6.t
	desc = flavor_mam.6.d
	picture = DIPLOMACY_eventPicture
	
	is_triggered_only = yes
	
	option = {	
		name = flavor_mam.6.a
		add_years_of_income = 0.25
		add_prestige = 5
	}
}

# CYP confronts us
country_event = {
	id = flavor_mam.7
	title = flavor_mam.7.t
	desc = flavor_mam.7.d
	picture = DIPLOMACY_eventPicture
	
	is_triggered_only = yes
	
	option = {	
		name = flavor_mam.7.a
		add_claim = 321
	}
}

# Ibn Taghribirdi
country_event = {
	id = flavor_mam.8
	title = flavor_mam.8.t
	desc = flavor_mam.8.d
	picture = ADVISOR_eventPicture

	fire_only_once = yes
	
	trigger = {
		tag = MAM
		is_year = 1460
		dip_power = 50
	}
	mean_time_to_happen = {
		months = 120
	}
	option = {
		name = flavor_mam.8.a
		ai_chance = { factor = 90 }
		add_dip_power = -20
		add_years_of_income = -0.25
		add_legitimacy = 10
		add_prestige = 25
	}
	option = {
		name = flavor_mam.8.b
		add_prestige = -5
	}
}

# Nobility demands
country_event = {
	id = flavor_mam.9
	title = flavor_mam.9.t
	desc = flavor_mam.9.d
	picture = DEBATE_REPUBLICAN_eventPicture

	fire_only_once = yes
	
	trigger = {
		tag = MAM
		is_year = 1465
		adm_power = 50
	}
	mean_time_to_happen = {
		months = 12
	}
	option = {
		name = flavor_mam.9.a
		ai_chance = { factor = 90 }
		add_adm_power = -50
	}
	option = {
		name = flavor_mam.9.b
		361 = { 
			noble_rebels = 1
		}
	}
}

# Fire in Medina
country_event = {
	id = flavor_mam.10
	title = flavor_mam.10.t
	desc = flavor_mam.10.d
	picture = REVOLUTION_eventPicture

	fire_only_once = yes
	
	trigger = {
		tag = MAM
		is_year = 1481
		adm_power = 20
		owns = 384
	}
	mean_time_to_happen = {
		months = 12
	}
	option = {
		name = flavor_mam.10.a
		ai_chance = { factor = 90 }
		add_adm_power = -20
		add_legitimacy = 5
	}
	option = {
		name = flavor_mam.10.b
		add_legitimacy = -5
	}
}

# Spanish friends...
country_event = {
	id = flavor_mam.11
	title = flavor_mam.11.t
	desc = flavor_mam.11.d
	picture = DIPLOMACY_eventPicture

	fire_only_once = yes

	trigger = {
		tag = MAM
		is_year = 1480
		
		TUR = { is_neighbor_of = MAM }
		OR = {
			TUR = { is_rival = MAM }
			is_rival = TUR
		}
		NOT = { is_rival = SPA }
		NOT = { SPA = { is_rival = MAM } }
		
		NOT = { war_with = SPA }
		NOT = { truce_with = SPA }
		
		TUR = {
			owns = 141 #serbia
			owns = 151 #constantinople
			owns = 146 #athens
			
		}
		
		#if spain exists and have an interest in the med..
		exists = SPA
		SPA = {
			owns = 333 # baleares
			owns = 213 # barcelona
			owns = 126 # malta
		}
		
	}
	
	mean_time_to_happen = {
		months = 12
	}
	option = {
		name = flavor_mam.11.a
		SPA = {
			add_opinion = {
				who = root
				modifier = mam_anti_ottoman_friends
			}	
			country_event = { 
				id = flavor_mam.12
				days = 1
				tooltip = flavor_mam.11.12
			}	
		}	
	}	
}

# SPA gets to know it...
country_event = {
	id = flavor_mam.12
	title = flavor_mam.12.t
	desc = flavor_mam.12.d
	picture = DIPLOMACY_eventPicture
	
	is_triggered_only = yes
	
	option = {	
		name = flavor_mam.12.a
		MAM = {
			add_opinion = {
				who = root
				modifier = mam_anti_ottoman_friends
			}	
		}
	}
}

# Plague in Cairo
country_event = {
	id = flavor_mam.13
	title = flavor_mam.13.t
	desc = flavor_mam.13.d
	picture = PLAGUE_eventPicture

	fire_only_once = yes

	trigger = {
		tag = MAM
		is_year = 1492
		owns = 361
	}
	
	mean_time_to_happen = {
		months = 12
	}
	
	option = {	
		name = flavor_mam.13.a
		361 = {
			add_province_modifier = {
				name = "mam_recover_from_plague"
				duration = 1825
			}
		}
	}
}

#Revenue Administration
country_event = {
	id = flavor_mam.14
	title = flavor_mam.14.t
	desc = flavor_mam.14.d
	picture = ECONOMY_eventPicture

	fire_only_once = yes

	trigger = {
		tag = MAM
		is_year = 1490
		has_regency = no
		
		NOT = { months_of_ruling = 12 }
		NOT = { years_of_income = 0.5 }
		
		adm_power = 1
	}
	
	mean_time_to_happen = {
		months = 3
	}
	
	option = {
		ai_chance = { factor = 90 }
		name = flavor_mam.14.a
		add_years_of_income = 2.0
		add_adm_power = -50
		random_owned_province = {
			anti_tax_rebels = 1
		}
		random_owned_province = {
			anti_tax_rebels = 1
		}
		capital_scope = {
			anti_tax_rebels = 2
		}
	}	
	option = {
		name = flavor_mam.14.b
		add_years_of_income = 0.10
	}
}

# Portugese - Mamluk - Trade Conflict
country_event = {
	id = flavor_mam.15
	title = flavor_mam.15.t
	desc = flavor_mam.15.d
	picture = MERCHANTS_TALKING_eventPicture
	
	fire_only_once = yes

	trigger = {
		tag = MAM
		is_year = 1490

		exists = POR
		manpower_percentage = 0.5
		owns = 2315
		4346 = {				#Gulf of Aden
			is_strongest_trade_power = POR
		}
		
		NOT = { num_of_light_ship = POR }	# we have to have less lightships.
	}
	
	mean_time_to_happen = {
		months = 3
	}
	
	option = {
		ai_chance = { factor = 90 }
		name = flavor_mam.15.a
		set_country_flag = MAM_POR_conflict
		if = {
			limit = {
				manpower_percentage = 0.5
			}
			add_manpower = -40
			
			2315 = {
				add_unit_construction = {
					type = light_ship
					amount = 20
					speed = 0.1
					cost = 0
				}
			}
		}
		POR = {
			add_opinion = {
				who = root
				modifier = mam_por_confronted
			}	
			
			country_event = { 
				id = flavor_mam.16
				days = 2
				random = 4
				tooltip = flavor_mam.15.16
			}
				
		}
		
		
	}
	option = {
		name = flavor_mam.15.b
		add_prestige = -25
		4346 = {
			add_trade_modifier = {
				who = root
				duration = 3650
				power = -5
				key = surrender_the_trade
			}
		}
	}
}

# POR gets a cb!
country_event = {
	id = flavor_mam.16
	title = flavor_mam.16.t
	desc = flavor_mam.16.d
	picture = MERCHANTS_TALKING_eventPicture
	
	is_triggered_only = yes
	
	option = {	
		name = flavor_mam.16.a
		add_navy_tradition = 5
		add_casus_belli = {	
			target = MAM
			type = cb_trade_war_triggered
			months = 36
		}		
	}
}

# The anti-ottoman coalition of Shah Ismail
country_event = {
	id = flavor_mam.17
	title = flavor_mam.17.t
	desc = flavor_mam.17.d
	picture = DIPLOMACY_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		tag = PER
		is_year = 1500
		NOT = { is_year = 1520 }
		exists = MAM
		exists = VEN
		exists = TUR
		MAM = { is_in_coalition = no }
		PER = { is_in_coalition = no }
		VEN = { is_in_coalition = no }
		PER = { is_neighbor_of = TUR }
		MAM = { is_neighbor_of = TUR }
		NOT = {
			PER = { alliance_with = TUR }
			VEN = { alliance_with = TUR }
			MAM = { alliance_with = TUR }
		}
		TUR = {
			owns = 141 # Serbia
			owns = 151 # Constantinople
			owns = 146 # Athens
		}
		TUR = {
			NOT = { has_opinion = { who = PER value = 0 } }
		}
		num_of_ports = 1
	}
	
	mean_time_to_happen = {
		months = 36
	}
	
	option = {
		name = flavor_mam.17.a
		ai_chance = { factor = 99 }
		MAM = {
			country_event = { 
				id = flavor_mam.18
				days = 2
				random = 4
				tooltip = flavor_mam.17.18
			}	
		}	
		add_piety = -0.05
		TUR = {
			add_opinion = {
				who = root
				modifier = mam_persian_scheming
			}		
		}
	}
	option = {
		name = flavor_mam.17.b
		add_piety = 0.05
	}
}

# Emissaries going through Mamelukes, we can decide
country_event = {
	id = flavor_mam.18
	title = flavor_mam.18.t
	desc = flavor_mam.18.d
	picture = DIPLOMACY_eventPicture
	
	is_triggered_only = yes
	
	option = {	
		name = flavor_mam.18.a
		ai_chance = { factor = 99 }
		
		VEN = {
			country_event = { 
				id = flavor_mam.19
				days = 2
				random = 4
				tooltip = flavor_mam.18.19
			}	
		}	
		add_piety = -0.05
	}
	option = {	
		name = flavor_mam.18.b
		add_piety = 0.05
	}
}

# Venice response
country_event = {
	id = flavor_mam.19
	title = flavor_mam.19.t
	desc = flavor_mam.19.d
	picture = DIPLOMACY_eventPicture
	
	is_triggered_only = yes
	
	option = {	
		name = flavor_mam.19.a
		ai_chance = { factor = 99 }
		MAM = {
			country_event = { 
				id = flavor_mam.20
				days = 2
				random = 4
				tooltip = flavor_mam.19.20
			}	
		}	
		add_piety = -0.05
	}
	option = {	
		name = flavor_mam.19.b
		add_prestige = -5
	}
}

# MAM, final decision
country_event = {
	id = flavor_mam.20
	title = flavor_mam.20.t
	desc = flavor_mam.20.d
	picture = DIPLOMACY_eventPicture
	
	is_triggered_only = yes
	
	option = {	
		name = flavor_mam.20.a
		ai_chance = { factor = 100 }
		hidden_effect = {
			VEN = {
				country_event = { id = flavor_mam.21 days = 1 }	
			}
			PER = {
				country_event = { id = flavor_mam.21 days = 1 }
			}
		}
		TUR = {
			country_event = { 
				id = flavor_mam.22
				days = 1
				tooltip = flavor_mam.20.TUR
			}	
		}
		PER = {
			form_coalition_against = TUR
		}	
		VEN = {
			form_coalition_against = TUR
		}
		add_piety = -0.05
	}
	option = {	
		name = flavor_mam.20.b
		ai_chance = { factor = 0 }
		add_piety = 0.05
	}
}

# Inform new coalition members
country_event = {
	id = flavor_mam.21
	title = flavor_mam.21.t
	desc = flavor_mam.21.d
	picture = DIPLOMACY_eventPicture
	
	is_triggered_only = yes
	
	option = {	
		name = flavor_mam.21.a
		add_prestige = 5
	}	
}

# Turkey gets chance to eliminate them for good
country_event = {
	id = flavor_mam.22
	title = flavor_mam.22.t
	desc = flavor_mam.22.d
	picture = DIPLOMACY_eventPicture
	
	is_triggered_only = yes
	
	option = {	
		name = flavor_mam.22.a
		MAM = {
			every_owned_province = {
				limit = {
					NOT = { is_claim = TUR }
					NOT = { is_core = TUR }
				}
				add_claim = TUR
			}
		}
		add_manpower = 12
		add_war_exhaustion = -5
	}	
}

# The Holy Cities
country_event = {
	id = flavor_mam.23
	title = flavor_mam.23.t
	desc = flavor_mam.23.d
	picture = DIPLOMACY_eventPicture
	
	is_triggered_only = yes
	
	option = {
		ai_chance = { factor = 90 }
		trigger = {
			HED = {
				is_subject_of = ROOT
				owns_core_province = 385
					}
			MDA = {
				is_subject_of = ROOT
				owns_core_province = 384
			}
			
		}
		name = flavor_mam.23.a
		HED = {
			inherit = MDA
		}
		add_prestige = 20
		385 = {
			add_base_tax = 2
			add_base_production = 2
			add_base_manpower = 2
		}
	}	
	option = {
		ai_chance = { factor = 10 }
		trigger = {
			HED = {
				is_subject_of = ROOT
				owns_core_province = 385
					}
			MDA = {
				is_subject_of = ROOT
				owns_core_province = 384
			}
			
		}
		name = flavor_mam.23.b
		add_prestige = 10
		385 = {
			add_base_tax = 2
			add_base_production = 2
			add_base_manpower = 2
		}
	}
	option = {
		ai_chance = { factor = 5 }
		name = flavor_mam.23.c
		385 = {
			add_base_tax = 2
			add_base_production = 2
			add_base_manpower = 2
		}
	}
}

#1.36

# 
country_event = {
	id = flavor_mam.100
	title = flavor_mam.100.t
	desc = flavor_mam.100.d
	picture = SHIP_SAILING_eventPicture
	
	is_triggered_only = yes

	option = {
		name = flavor_mam.100.a

		trigger = { 
			has_dlc = "Rule Britannia"
		}

		custom_tooltip = mam_unlock_galley_doctrine_tt

		clr_country_flag = mam_unlock_galley_doctrine_flag
		clr_country_flag = mam_unlock_light_doctrine_flag
		clr_country_flag = mam_unlock_warships_doctrine_flag
		clr_country_flag = mam_unlock_transports_doctrine_flag

		set_country_flag = mam_unlock_galley_doctrine_flag
	}

	option = {
		name = flavor_mam.100.b

		trigger = { 
			has_dlc = "Rule Britannia"
		}

		custom_tooltip = mam_unlock_light_doctrine_tt

		clr_country_flag = mam_unlock_galley_doctrine_flag
		clr_country_flag = mam_unlock_light_doctrine_flag
		clr_country_flag = mam_unlock_warships_doctrine_flag
		clr_country_flag = mam_unlock_transports_doctrine_flag

		set_country_flag = mam_unlock_light_doctrine_flag
	}

	option = {
		name = flavor_mam.100.c

		trigger = { 
			has_dlc = "Rule Britannia"
		}

		custom_tooltip = mam_unlock_warships_doctrine_tt

		clr_country_flag = mam_unlock_galley_doctrine_flag
		clr_country_flag = mam_unlock_light_doctrine_flag
		clr_country_flag = mam_unlock_warships_doctrine_flag
		clr_country_flag = mam_unlock_transports_doctrine_flag

		set_country_flag = mam_unlock_warships_doctrine_flag
	}

	option = {
		name = flavor_mam.100.e

		trigger = { has_dlc = "Rule Britannia" }

		custom_tooltip = mam_unlock_transports_doctrine_tt
		
		clr_country_flag = mam_unlock_galley_doctrine_flag
		clr_country_flag = mam_unlock_light_doctrine_flag
		clr_country_flag = mam_unlock_warships_doctrine_flag
		clr_country_flag = mam_unlock_transports_doctrine_flag

		set_country_flag = mam_unlock_transports_doctrine_flag
	}

	option = {
		name = flavor_mam.100.f

		trigger = { 
			NOT = { has_dlc = "Rule Britannia" }
		}

		create_admiral = { tradition = 80 }
		add_navy_tradition = 10
		
	}
}

#Renovating the Zahiriyya Library
country_event = { 
	id = flavor_mam.101
	title = flavor_mam.101.t
	desc = flavor_mam.101.d
	picture = GREAT_BUILDING_eventPicture
	
	is_triggered_only = yes

	option = {
		name = flavor_mam.101.a

		if = {
			limit = {
				has_dlc = "Rule Britannia"
			}
			change_innovativeness = 3
		}
		else = {
			add_adm_power = 100
			add_dip_power = 100
			add_mil_power = 100
		}
	}

	option = {
		name = flavor_mam.101.b

		add_years_of_income = -2
		unlock_government_reform = {
			government_reform = state_madrasas_reform
		}
	}
}

#The Grain Trade in Egypt
country_event = { 
	id = flavor_mam.102
	title = flavor_mam.102.t
	desc = flavor_mam.102.d
	picture = muslimgfx_DIPLOMACY_eventPicture
	
	is_triggered_only = yes

	option = {
		name = flavor_mam.102.a 

		custom_tooltip = mam_expand_nile_estuaries_tt
		hidden_effect = {
			every_owned_province = {
				limit = {
					has_province_modifier = nile_estuary_modifier
				}
				remove_province_modifier = nile_estuary_modifier
				add_province_modifier = {
					name = expanded_nile_estuary_modifier
					duration = -1 
				}
				add_base_production = 1
			}
		}
	}

	option = {
		name = flavor_mam.102.b

		add_mercantilism = 2
		custom_tooltip = mam_expand_grain_production_tt
		custom_tooltip = mam_more_exports_2_tt
		hidden_effect = {
			every_owned_province = {
				limit = {
					has_province_modifier = granary_of_the_mediterranean
				}
				remove_province_modifier = granary_of_the_mediterranean
				add_province_modifier = {
					name = expanded_granary_of_the_mediterranean_modifier
					duration = -1 
				}
			}
			set_country_flag = increase_exports_to_6_flag
		}
	}
}


#The Administration of the Mamluk Empire
country_event = { 
	id = flavor_mam.103
	title = flavor_mam.103.t
	desc = flavor_mam.103.d
	picture = muslimgfx_LIBERUM_VETO_eventPicture
	
	is_triggered_only = yes

	option = {
		name = flavor_mam.103.a 

		if = {
			limit = {
				NOT = { government_rank = 3 }
			}
			set_government_rank = 3
		}
		else = {
			add_power_projection = {
				type = mam_new_caliphate_pp 
				amount = 10
			}
			custom_tooltip = sca_scandinavian_european_empire_tt
		}

		capital_scope = {
			set_province_flag = chose_mam_mission_flag
		}

		if = {
			limit = { has_dlc = "Golden Century" }
			custom_tooltip = mam_enable_kashifs_local_organizations_tt
			set_country_flag = mam_enable_kashifs_local_organizations_flag
		}
		else = {
			add_adm_power = 200
			add_corruption = -2
			change_government_reform_progress = 150
		}
	}

	option = {
		name = flavor_mam.103.b 

		capital_scope = {
			set_province_flag = chose_egy_mission_flag
		}
		if = {
			limit = { stability = 0 }
			add_stability = -5
		}
		else = {
			add_adm_power = -200
			add_dip_power = -100
		}
		if = {
			limit = { 
				EGY = { exists = no }
			}
			change_tag = EGY
			swap_free_idea_group = yes
		}
		else = { add_prestige_or_monarch_power = { amount = 25 } }
		
		set_country_flag = egyptian_government_reform_flag
		add_government_reform = egyptian_government_reform
	}
}

#The Waqf of [Root.Monarch.GetName]
country_event = { 
	id = flavor_mam.104
	title = flavor_mam.104.t
	desc = flavor_mam.104.d
	picture = muslimgfx_ECONOMY_eventPicture
	
	is_triggered_only = yes

	option = {
		name = flavor_mam.104.a 

		add_years_of_income = -2
		capital_scope = {
			if = {
				limit = { has_building = university }
				add_base_production = 2
			}
			else = { add_building = university }
		}
		custom_tooltip = mam_adm_advisors_generate_idea_cost_tt
		hidden_effect = {
			add_country_modifier = {
				name = mam_adm_advisors_generate_idea_cost_modifier
				duration = 7300
				hidden = yes
			}
		}
	}

	option = {
		name = flavor_mam.104.b

		add_years_of_income = -2

		capital_scope = {
			if = {
				limit = { has_building = cathedral }
				add_base_tax = 3
			}
			else = {
				add_building = cathedral
				if = {
					limit = { has_building = temple }
					hidden_effect = {
						remove_building = temple
					}
				}
			}
		}

		custom_tooltip = mam_mosque_great_mosque_generates_crown_land_tt
		hidden_effect = {
			add_country_modifier = {
				name = mam_mosque_great_mosque_generates_crown_land_modifier
				duration = 7300
				hidden = yes
			}
		}
		custom_tooltip = add_5_crown_land_share
		hidden_effect = {
			change_estate_land_share = {
				estate = all
				share = -5
			}
		}
	}

	option = {
		name = flavor_mam.104.c

		trigger = {
			has_dlc = "Leviathan"
			361 = {
				owned_by = ROOT
				NOT = {
					has_great_project = {
						type = al_azhar_university
						tier = 3
					}
				}
			}
		}
		add_years_of_income = -2
		361 = {
			add_great_project_tier = {
				type = al_azhar_university
				tier = 1
			}
		}
		change_innovativeness = 3
	}

	option = {
		name = flavor_mam.104.e

		add_prestige_or_monarch_power = { amount = 10 }
	}
}

#Coffea Arabica
country_event = { 
	id = flavor_mam.105
	title = flavor_mam.105.t
	desc = flavor_mam.105.d
	picture = muslimgfx_MERCHANTS_TALKING_eventPicture

	is_triggered_only = yes

	option = {
		name = flavor_mam.105.a 

		custom_tooltip = mam_enable_coffee_monopoly_tt
		set_country_flag = mam_enable_coffee_monopoly_flag

		add_estate_loyalty = {
			estate = estate_burghers
			loyalty = 20
		}
	}

	option = {
		name = flavor_mam.105.b 

		add_mercantilism = 5

		custom_tooltip = mam_1_prod_in_coffee_tt
		hidden_effect = {
			every_owned_province = {
				limit = { trade_goods = coffee }
				add_base_production = 1
			}
		}
	}
}

country_event = { #The Beacons of Gonder
	id = flavor_mam.106
	title = flavor_mam.106.t
	desc = flavor_mam.106.d
	picture = muslimgfx_PILGRIMAGE_eventPicture

	is_triggered_only = yes

	option = {
		name = flavor_mam.106.a 

		custom_tooltip =  mam_eth_flavor_tt
		set_country_flag = mam_eth_flavor_flag

		if = {
			limit = {
				ETH = {
					has_opinion = {
						who = ROOT 
						value = 100
					}
					OR = {
						is_subject_of = ROOT
						alliance_with = ROOT 
					}
				}
			}
			add_historical_friend = ETH
			ETH = { add_historical_friend = ROOT }
			add_trust = {
				who = ETH
				value = 25
				mutual = yes
			}
		}
		else = {
			add_dip_power = 100
			if = {
				limit = { 
					has_dlc = "Cradle of Civilization" 
					religion_group = muslim 
				}
				if = {
					limit = { piety = 0 }
					add_piety = 0.25
				}
				else = { add_piety = -0.25 }
			}
			else = {
				add_prestige_or_monarch_power = { amount = 10 }
			}
		}
	}

	option = {
		name = flavor_mam.106.b 

		if = {
			limit = { has_dlc = "Origins" }
			set_country_flag = allow_cawa_auxiliary_forces_flag
			custom_tooltip = enable_cawa_auxiliary_forces_tt
			tooltip = {
				add_government_reform = cawa_auxiliary_forces
			}
		}
		else_if = {
			limit = { has_dlc = "Cradle of Civilization" }
			PA_random_army_exp_between_10_and_20_effect = yes    #PA: replaced flat gain with random dynamic gain. -- 200e200w
		}
		else = {
			add_army_tradition = 20
		}
	}
}

country_event = { #A Competent Ethiopian Noble
	id = flavor_mam.107
	title = flavor_mam.107.t
	desc = flavor_mam.107.d
	picture = muslimgfx_THEATRE_eventPicture

	fire_only_once = yes 

	trigger = {
		has_country_flag = mam_eth_flavor_flag
	}
	mean_time_to_happen = {
		months = 240
	}

	option = {
		name = flavor_mam.107.a 

		define_advisor = {
			type = treasurer
			skill = 3
			culture = amhara
			religion = coptic
			cost_multiplier = 0.25
		}

		change_government_reform_progress = 50
	}
}

country_event = { #The Many Capitals of the Ethiopians
	id = flavor_mam.108
	title = flavor_mam.108.t
	desc = flavor_mam.108.d
	picture = muslimgfx_RELIGIOUS_CONVERSION_eventPicture

	fire_only_once = yes 

	trigger = {
		has_country_flag = mam_eth_flavor_flag
		any_owned_province = {
			culture = amhara
		}
	}
	mean_time_to_happen = {
		months = 240
	}

	option = {
		name = flavor_mam.108.a 

		random_owned_province = {
			limit = { culture = amhara }
			add_base_tax = 1 
			add_base_production = 1 
			add_base_manpower = 1
			add_prosperity = 10
		}

		add_stability_or_adm_power = yes 
	}

	option = {
		name = flavor_mam.108.b
		
		add_estate_loyalty = {
			estate = estate_nobles 
			loyalty = 20
		}
		add_prestige_or_monarch_power = { amount = 15 }
	}
}

country_event = { #Coptic Monasteries Flourish
	id = flavor_mam.109
	title = flavor_mam.109.t
	desc = flavor_mam.109.d
	picture = ORTHODOX_eventPicture

	fire_only_once = yes 

	trigger = {
		has_country_flag = mam_eth_flavor_flag
		any_province = {
			country_or_non_sovereign_subject_holds = ROOT 
			religion = coptic
		}
	}
	mean_time_to_happen = {
		months = 240
	}

	option = {
		name = flavor_mam.109.a 

		random_province = {
			limit = {
				religion = coptic 
				country_or_non_sovereign_subject_holds = ROOT
			}
			add_random_development = 1
		}
		random_province = {
			limit = {
				religion = coptic 
				country_or_non_sovereign_subject_holds = ROOT
			}
			add_random_development = 1
		}
		random_province = {
			limit = {
				religion = coptic 
				country_or_non_sovereign_subject_holds = ROOT
			}
			add_random_development = 1
		}
		random_province = {
			limit = {
				religion = coptic 
				country_or_non_sovereign_subject_holds = ROOT
			}
			add_random_development = 1
		}

		add_stability_or_adm_power = yes

	}
}

country_event = { #Ethiopian Recruits in the Army
	id = flavor_mam.110
	title = flavor_mam.110.t
	desc = flavor_mam.110.d
	picture = muslimgfx_MILITARY_CAMP_eventPicture

	fire_only_once = yes 

	trigger = {
		has_country_flag = mam_eth_flavor_flag
		any_owned_province = {
			country_or_non_sovereign_subject_holds = ROOT 
			culture = amhara
		}
	}
	mean_time_to_happen = {
		months = 240
	}

	option = {
		name = flavor_mam.110.a 

		add_yearly_manpower = 1
		add_mil_power = 100
	}
}

country_event = { #Administrating the Northern Territories
	id = flavor_mam.111
	title = flavor_mam.111.t
	desc = flavor_mam.111.d
	picture = OVEREXTENSION_eventPicture

	fire_only_once = yes 
	trigger = {
		tag = MAM
		exists = SYR
		SYR = {
			is_subject_of = ROOT
		}
	}
	is_triggered_only = yes
	goto = 382
	
	option = {
		name = flavor_mam.111.a 

		SYR = { 
			every_owned_province = {
				add_core = MAM
			}
			add_liberty_desire = 25
		}
		add_truce_with = SYR
		set_country_flag = mam_had_administration_syria_event_flag
		set_country_flag = mam_intervened_syria
		hidden_effect = {
			SYR = {
				add_manpower = 5 
				add_adm_power = 100
				add_dip_power = 100
				add_mil_power = 100
				add_treasury = 50
			}
		}
	}

	option = {
		name = flavor_mam.111.b 

		add_legitimacy = -10
		add_prestige = -10
		set_country_flag = mam_had_administration_syria_event_flag
	}
}

country_event = { #The Heart of an Empire
	id = flavor_mam.112
	title = flavor_mam.112.t
	desc = flavor_mam.112.d
	picture = CONSTANTINOPLE_eventPicture

	fire_only_once = yes 
	is_triggered_only = yes 

	option = {
		name = flavor_mam.112.b 

		trigger = {
			TUR = {
				NOT = { total_development = ROOT }
			}
		}
		
		unlock_government_reform = { 
			government_reform = integrated_ottoman_officials
		} 

	}

	option = {
		name = flavor_mam.112.a 

		trigger = {
			151 = { owned_by = ROOT is_core = ROOT }
		}
		set_capital = 151 

		add_power_projection = {
			type = mam_defeated_ottomans_pp 
			amount = 15
		}
		custom_tooltip = sca_scandinavian_european_empire_tt
	}

	option = {
		name = flavor_mam.112.c

		add_power_projection = {
			type = mam_defeated_ottomans_pp 
			amount = 15
		}
		custom_tooltip = sca_scandinavian_european_empire_tt
	}
}

country_event = { #The Dar al-Makhzen
	id = flavor_mam.113
	title = flavor_mam.113.t
	desc = flavor_mam.113.d
	picture = muslimgfx_GREAT_BUILDING_eventPicture

	fire_only_once = yes 
	is_triggered_only = yes 
	goto = 343
	option = {
		name = flavor_mam.113.a 

		add_years_of_income = -0.5
		343 = {
			add_base_tax = 3 
			add_base_production = 3 
			add_base_manpower = 3
			change_culture = ROOT 
			change_religion = ROOT 
			if = {
				limit = { has_dlc = "Mandate of Heaven" }
				add_devastation = -25
				add_prosperity = 25 
			}
		}
	}

	option = {
		name = flavor_mam.113.b 

		343 = {
			add_base_tax = 1 
			add_base_production = 1
			add_base_manpower = 1 
			change_religion = ROOT
		}
	}
}

country_event = { #Architecture in Safavid Persia
	id = flavor_mam.114
	title = flavor_mam.114.t
	desc = flavor_mam.114.d
	picture = muslimgfx_CITY_VIEW_eventPicture

	fire_only_once = yes 
	is_triggered_only = yes 

	option = {
		name = flavor_mam.114.a 

		if = {
			limit = { 
				has_dlc = "Mandate of Heaven"
				current_age = age_of_reformation
				NOT = { is_year = 1590 }
			}
			custom_tooltip = enable_persian_age_ability_tt
			set_country_flag = enable_persian_age_ability_flag
		}
		else = {
			add_country_modifier = {
				name = mam_adopted_persian_architecture_modifier
				duration = 9125
			}
		}
	}
}

country_event = { #Construction Commences in [4316.GetName]
	id = flavor_mam.115
	title = flavor_mam.115.t
	desc = flavor_mam.115.d
	picture = BYZ_HARBOUR_eventPicture
	is_triggered_only = yes
	major_trigger = {
		has_discovered = 2316
	}

	option = {
		name = flavor_mam.115.a 

		hidden_effect = {
			add_treasury = 20000
		}
		4316 = {
			add_great_project = {
				type = suez_canal
				instant = no
				builder = root
			}
		}
		hidden_effect = {
			add_treasury = -20000
		}
	}
	after = {
	}
}

# Extension of Coffee Monopoly
country_event = {
	id = flavor_mam.116
	title = flavor_mam.116.t
	desc = flavor_mam.116.d
	picture = TRADE_GOODS_PLANTATION_GOODS_IN_WAREHOUSE_eventPicture

	is_triggered_only = yes

	immediate = {
		remove_estate_monopoly_modifier = { privilege = estate_burghers_monopoly_of_coffee }
	}
	
	option = {
		name = monopoly_privileges.1.a
		reapply_estate_privilege = { privilege = estate_burghers_monopoly_of_coffee }
	}
	option = {
		name = monopoly_privileges.1.b
		custom_tooltip = YEM_revoke_yemen_event_tooltip

		hidden_effect = {
			every_owned_province = {
				limit = {
					trade_goods = coffee
				}
				apply_estate_monopoly_modifier = { privilege = estate_burghers_monopoly_of_coffee }
			}
		}
	}
}

