country_event = {
	
	id = 7501
	trigger = {
		religion = sunni
		owns = 382 #Ash-Sham (Damascus)
		owns = 410 #Baghdad
		owns = 361 #Cairo
		num_of_cities = 20
		war = no
		OR = {
			government = emirate
			government = sultanate
			government = shahdom
			government = khanate
			}
		regency = no
		NOT = { has_country_flag = is_caliph }
		NOT = { has_country_flag = not_caliph }
		}
	mean_time_to_happen = {
		months = 120
		modifier = {
			factor = 0.25
			owns = 385 #Mecca
			}
		modifier = {
			factor = 0.5
			owns = 384 #Medina
			}
		modifier = {
			factor = 0.75
			owns = 456 #Turkestan
			}
		modifier = {
			factor = 0.75
			owns = 408 #Basra
			}
		modifier = {
			factor = 0.5
			owns = 151 #Thrace
			}
		modifier = {
			factor = 0.5
			has_country_modifier = piouscountry
			}
		modifier = {
			factor = 0.5
			defender_of_faith = yes
			}
		}
	name = "The Caliphate"
	desc = "We are a force to be reckoned with in the Islamic world. Our vizier urges us to claim the title of Caliph and reign supreme over Islam. What shall we do?"
	option = {
		ai_chance = { factor = 90 }
		name = "Yes! I am the rightful Caliph!"
		prestige = .15
		badboy = 8
		add_core = 382
		add_core = 384
		add_core = 385
		add_core = 361
		add_core = 408
		add_core = 410
		add_core = 456
		add_core = 151
		set_country_flag = is_caliph
		}
	option = {
		ai_chance = { factor = 10 }
		name = "No, we cannot declare it so"
		badboy = -2
		set_country_flag = not_caliph
		}
	}

country_event = {
	
	id = 7502
	trigger = {
		religion = shiite
		owns =  428 #Jibal (Ajam)
		owns = 410 #Baghdad
		owns = 409 #Karbala
		num_of_cities = 20
		war = no
		OR = {
			government = emirate
			government = sultanate
			government = shahdom
			government = khanate
			}
		regency = no
		NOT = { has_country_flag = is_caliph }
		NOT = { has_country_flag = not_caliph }
		}
	mean_time_to_happen = {
		months = 120
		modifier = {
			factor = 0.25
			owns = 385 #Mecca
			}
		modifier = {
			factor = 0.5
			owns = 384 #Medina
			}
		modifier = {
			factor = 0.75
			owns = 382 #Damascus
			}
		modifier = {
			factor = 0.75
			owns = 408 #Basra
			}
		modifier = {
			factor = 0.5
			owns = 151 #Thrace
			}
		modifier = {
			factor = 0.5
			has_country_modifier = piouscountry
			}
		modifier = {
			factor = 0.5
			defender_of_faith = yes
			}
		}
	name = "The Caliphate"
	desc = "We are a force to be reckoned with in the Islamic world. Our vizier urges us to claim the title of Caliph and reign supreme over Islam. What shall we do?"
	option = {
		ai_chance = { factor = 90 }
		name = "Yes! I am the rightful Caliph!"
		prestige = .15
		badboy = 8
		add_core = 382
		add_core = 384
		add_core = 385
		add_core = 428
		add_core = 408
		add_core = 410
		add_core = 409
		add_core = 151
		set_country_flag = is_caliph
		}
	option = {
		ai_chance = { factor = 10 }
		name = "No, we cannot declare it so"
		badboy = -2
		set_country_flag = not_caliph
		}
	}

country_event = {
	
	id = 7503
	trigger = {
		religion = wahhabi
		owns = 385 #Mecca
		owns = 384 #Medina
		num_of_cities = 20
		war = no
		OR = {
			government = emirate
			government = sultanate
			government = shahdom
			government = khanate
			}
		regency = no
		NOT = { has_country_flag = is_caliph }
		NOT = { has_country_flag = not_caliph }
		}
	mean_time_to_happen = {
		months = 120
		modifier = {
			factor = 0.25
			owns = 361 #Cairo
			modifier = {
				factor = 0.75
				owns = 382 #Ash-Sham (Damascus)
				}
			modifier = {
				factor = 0.75
				owns = 408 #Basra
				}
			modifier = {
				factor = 0.5
				owns = 410 #Baghdad
				}
			modifier = {
				factor = 0.5
				has_country_modifier = piouscountry
				}
			modifier = {
				factor = 0.5
				defender_of_faith = yes
				}
			}
		name = "The Caliphate"
		desc = "We are a force to be reckoned with in the Islamic world. Our vizier urges us to claim the title of Caliph and reign supreme over Islam. What shall we do?"
		option = {
			ai_chance = { factor = 90 }
			name = "Yes! I am the rightful Caliph!"
			prestige = .15
			badboy = 8
			add_core = 382
			add_core = 384
			add_core = 385
			add_core = 361
			add_core = 408
			add_core = 410
			add_core = 456
			add_core = 151
			set_country_flag = is_caliph
			}
		option = {
			ai_chance = { factor = 10 }
			name = "No, we cannot declare it so"
			badboy = -2
			set_country_flag = not_caliph
			}
		}
	}

country_event = {

	id = 7504
	trigger = {
		religion = ibadi
		owns = 382 #Ash-Sham (Damascus)
		owns = 410 #Baghdad
		owns = 400 #Muscat
		num_of_cities = 20
		war = no
		OR = {
			government = emirate
			government = sultanate
			government = shahdom
			government = khanate
			}
		regency = no
		NOT = { has_country_flag = is_caliph }
		NOT = { has_country_flag = not_caliph }
		}
	mean_time_to_happen = {
		months = 120
		modifier = {
			factor = 0.25
			owns = 385 #Mecca
			}
		modifier = {
			factor = 0.5
			owns = 384 #Medina
			}
		modifier = {
			factor = 0.75
			owns = 336 #Tlemcen
			}
		modifier = {
			factor = 0.75
			owns = 408 #Basra
			}
		modifier = {
			factor = 0.5
			owns = 151 #Thrace
			}
		modifier = {
			factor = 0.5
			has_country_modifier = piouscountry
			}
		modifier = {
			factor = 0.5
			defender_of_faith = yes
			}
		}
		name = "The Caliphate"
		desc = "We are a force to be reckoned with in the Islamic world. Our vizier urges us to claim the title of Caliph and reign supreme over Islam. What shall we do?"
		option = {
			ai_chance = { factor = 90 }
			name = "Yes! I am the rightful Caliph!"
			prestige = .15
			badboy = 8
			add_core = 382
			add_core = 384
			add_core = 385
			add_core = 336
			add_core = 408
			add_core = 410
			add_core = 400
			add_core = 151
			set_country_flag = is_caliph
			}
		option = {
			ai_chance = { factor = 10 }
			name = "No, we cannot declare it so"
			badboy = -2
			set_country_flag = not_caliph
			}
	}
	
country_event = {
	id = 7505
	trigger = {
		has_country_flag = is_caliph
		OR = {
			government = sultanate
			government = shahdom
			}
		defender_of_faith = yes
		war = no
		NOT = {has_country_flag = nopadishah}
		}
	mean_time_to_happen = {
	months = 20
	modifier = {
		factor = 0.5
		has_country_modifier = piouscountry
		}
	}
	name = "Padishah"
	desc = "As the Caliph, we may rightly claim the title of the Padishah."
	option = {
		name = "Ma ša' Allah!"
		government = padishahdom
		prestige = 0.1
		}
	option = {
		name = "We are content as we are"
		stability = 1
		prestige = -0.1
		set_country_flag = nopadishah
		}
	}

country_event = {
	id = 7506
	trigger = {
		owns = 385
		NOT = { has_country_flag = is_caliph }
		religion = sunni
		NOT = { exists = HED }
		NOT = { has_country_flag = keepingmecca }
		}
	mean_time_to_happen = {
		months = 20
		}
	name = "Mecca"
	desc = "We have control of the holy city of Mecca. It will upset the rest of the Islamic world if we fail to release it. What shall we do?"
	option = {
		name = "Keep control of Mecca to ourselves!"
		ai_chance = { factor = 5 }
		prestige = -0.02
		badboy = 3
		any_country = {
			limit = {
				neighbour = THIS
				religion = sunni
				}
			relation = { who = THIS value = -100 }
			}
		set_country_flag = keepingmecca
		}
	option = {
		name = "Appoint a new Sharif of Mecca"
		ai_chance = { factor = 95 }
		385 = { secede_province = HED }
		prestige = 0.025
		}
	}
