byz_western = {
	slot = 1 #upper left column
	generic = no #if a mission without generic = yes wants this slot then it overrides this.
	ai = yes
	potential = {
		tag = BYZ
		NOT = { map_setup = map_setup_random }
		NOT = { has_dlc = "King of Kings" }
		OR = {
			NOT = { started_in = 641.1.1 }		#MMETR prevent overlap with new pre-Islam Byzantine Empire tree
			started_in = 1261.1.1
		}
	}
	has_country_shield = yes
	
	recover_greece = {
		icon = mission_assemble_an_army
		required_missions = {  } #None
		provinces_to_highlight = {
			OR = {
				province_id = 144
				province_id = 145
				province_id = 146
				province_id = 147
				province_id = 148
				province_id = 148
				province_id = 4779
				province_id = 1773
				province_id = 1853
				province_id = 4699
				province_id = 4701
				province_id = 4705
				province_id = 4702
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			owns_or_non_sovereign_subject_of = 144
			owns_or_non_sovereign_subject_of = 145
			owns_or_non_sovereign_subject_of = 146
			owns_or_non_sovereign_subject_of = 147
			owns_or_non_sovereign_subject_of = 148
			owns_or_non_sovereign_subject_of = 4779
			owns_or_non_sovereign_subject_of = 1773
			owns_or_non_sovereign_subject_of = 1853
			owns_or_non_sovereign_subject_of = 4699
			owns_or_non_sovereign_subject_of = 4701
			owns_or_non_sovereign_subject_of = 4705
			owns_or_non_sovereign_subject_of = 4702
		}
		effect = {
			if = {
				limit = { started_in = 1261.1.1 }
				add_country_modifier = {
					name = "byzantium_resurgent"
					duration = 5475
				}
				bulgaria_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				silistria_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				thrace_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				hudavendigar_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}	
				aydin_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				if = {
					limit = {
						has_dlc = "Purple Phoenix" #For the PP mission to conquer Albania
					}
					albania_area = {
						limit = {
							NOT = { is_core = ROOT }
							NOT = { is_permanent_claim = ROOT }
						}
						add_permanent_claim = ROOT
					}
					3001 = {
						if = {
							limit = {
								NOT = { is_core = ROOT }
								NOT = { is_permanent_claim = ROOT }
							}
							add_permanent_claim = ROOT
						}
								   
					}
					4780 = {
						if = {
							limit = {
								NOT = { is_core = ROOT }
								NOT = { is_permanent_claim = ROOT }
							}
							add_permanent_claim = ROOT
						}
					}
				}
			}
		}
		ai_weight = {
			factor = 500	#Byzantium is basically Ottomans in its conquest behavior
		}
	}
	recover_the_balkans = {
		icon = mission_eastern_european_city
		required_missions = { recover_greece }
		position = 3
		provinces_to_highlight = {
			OR = {
				area = bulgaria_area
				area = silistria_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			bulgaria_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			silistria_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			apulia_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			calabria_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			naples_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
		ai_weight = {
			factor = 500	#Byzantium is basically Ottomans in its conquest behavior
		}
	}
	recover_south_italy = {
		icon = mission_italian_condottiere
		required_missions = { recover_the_balkans }
		position = 5
		provinces_to_highlight = {
			OR = {
				area = apulia_area
				area = calabria_area
				area = naples_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			naples_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			apulia_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			calabria_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			capital_scope = {
				add_base_manpower = 2
				add_base_tax = 2
				add_base_production = 2
			}
			lazio_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			western_sicily_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			lazio_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			add_permanent_claim = 124
			add_permanent_claim = 2982
		}
		ai_weight = {
			factor = 500	#Byzantium is basically Ottomans in its conquest behavior
		}
	}
	recover_sicily = {
		icon = mission_sea_battles
		required_missions = { recover_south_italy }
		provinces_to_highlight = {
			OR = {
				area = western_sicily_area
				province_id = 124
				province_id = 2982
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			western_sicily_area = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			owns_or_non_sovereign_subject_of = 124
			owns_or_non_sovereign_subject_of = 2982
		}
		effect = {
			add_country_modifier = {
				name = "theme_of_sicily"
				duration = 5475
			}
		}
		ai_weight = {
			factor = 500	#Byzantium is basically Ottomans in its conquest behavior
		}
	}
}

byz_generic_slot_2 = {
	slot = 2
	generic = no #Needs to be replaced by similar missions for Purple Phoenix
	ai = yes
	potential = {
		NOT = { map_setup = map_setup_random }
		tag = BYZ
		OR = {
			AND = {
				NOT = { has_dlc = "Purple Phoenix" }
				NOT = { has_dlc = "King of Kings" }
			}
			NOT = { started_in = 641.1.1 }
		}
		OR = {
			NOT = { started_in = 641.1.1 }
			started_in = 1204.1.1
		}
	}
	has_country_shield = yes
	
	recover_rome = {
		position = 6
		icon = mission_religious
		required_missions = { recover_south_italy }
		provinces_to_highlight = {
			province_id = 118
			NOT = { owned_by = ROOT }
		}
		trigger = {
			owns = 118
		}
		effect = {
			add_country_modifier = {
				name = "roman_italy"
				duration = 5475
			}
			venetia_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			if = {
				limit = {
					NOT = { has_dlc = "Purple Phoenix" }
				}
				add_country_modifier = {
					name = "conversion_of_rome"
					duration = 7300
				}
				hidden_effect = {
					every_country = {
						limit = { 
							religion = catholic 
							knows_country = BYZ
						}
						country_event = { id = flavor_byz.2 }
					}
				}
			}
		}
		ai_weight = {
			factor = 500	#Byzantium is basically Ottomans in its conquest behavior
		}
	}
	
	destroy_venice = {
		icon = mission_monarch_in_throne_room
		required_missions = { recover_rome }
		provinces_to_highlight = {
			area = venetia_area
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			venetia_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			add_prestige = 20
			add_adm_power = 100
			country_event = { id = flavor_byz.1 }
			venetia_area = {
				add_province_modifier = {
					name = "faster_integration"
					duration = 5475
				}
			}
		}
		ai_weight = {
			factor = 500	#Byzantium is basically Ottomans in its conquest behavior
		}
	}
}

byz_east = {
	slot = 5
	generic = no
	ai = yes
	
	potential = {
		NOT = { map_setup = map_setup_random }
		tag = BYZ
		NOT = { has_dlc = "King of Kings" }
		started_in = 1204.1.1
	}
	
	has_country_shield = yes
	
	recover_the_coast_of_asia_minor = {
		icon = mission_galleys_in_port
		required_missions = {  }
		provinces_to_highlight = {
			OR = {
				area = hudavendigar_area
				area = aydin_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			hudavendigar_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			aydin_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			if = {
				limit = { NOT = { has_dlc = "Purple Phoenix" } }
				germiyan_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				ankara_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				karaman_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				kastamonu_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				rum_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				thrace_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				erzurum_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				add_permanent_claim = 327 # Adana
				add_permanent_claim = 2302 # Icel
				add_permanent_claim = 2750 # Plovdiv
				add_permanent_claim = 4310 # Divrigi
			}
			else = {
				germiyan_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				ankara_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				kastamonu_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
			}
		}
		ai_weight = {
			factor = 500	#Byzantium is basically Ottomans in its conquest behavior
		}
	}
}

byz_generic_slot_5 = {
	slot = 5
	generic = no #Needs to be replaced by similar missions for Purple Phoenix
	ai = yes
	potential = {
		NOT = { map_setup = map_setup_random }
		tag = BYZ
		NOT = { has_dlc = "Purple Phoenix" }
		NOT = { has_dlc = "King of Kings" }
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	reestablish_the_theme_system = {
		icon = mission_non-western_cavalry_raid
		required_missions = { recover_the_coast_of_asia_minor }
		position = 3
		provinces_to_highlight = {
			OR = {
				area = hudavendigar_area
				area = germiyan_area
				area = aydin_area
				area = ankara_area
				area = karaman_area
				area = kastamonu_area
				area = rum_area
				area = thrace_area
				area = erzurum_area
				province_id = 327 # Adana
				province_id = 2302 # Icel
				province_id = 4310 # Divrigi
				province_id = 2750 # Plovdiv
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			hudavendigar_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			germiyan_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			aydin_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			ankara_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			karaman_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			kastamonu_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			rum_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			thrace_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			erzurum_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			owns = 327 # Adana
			owns = 2302 # Icel
			owns = 4310 # Divrigi
			owns = 2750 # Plovdiv
				
		}
		effect = {
			hidden_effect = {
				149 = { rename_capital = Adrianopolis }
				151 = { rename_capital = Konstantinopolis }
				316 = { rename_capital = Nikomedeia }
				317 = { rename_capital = Prussa }
				318 = { rename_capital = Smyrna }
				319 = { rename_capital = Mougla }
				322 = { rename_capital = Kotyaion }
				323 = { rename_capital = Iconion }
				324 = { rename_capital = Laranda }
				325 = { rename_capital = Timonio }
				326 = { rename_capital = Ancyra }
				327 = { rename_capital = Atana }
				328 = { rename_capital = Sinop }
				329 = { rename_capital = Sebastopolis }
				330 = { rename_capital = Trapezous }
				331 = { rename_capital = Theodosiopolis }
				1764 = { rename_capital = Mesambria }
				1846 = { rename_capital = Amasea }
				1848 = { rename_capital = Baris }
				2296 = { rename_capital = Pigai }
				2297 = { rename_capital = Magnesia }
				2298 = { rename_capital = Attalia }
				2299 = { rename_capital = Klaudiopol}
				2300 = { rename_capital = Tavium }
				2301 = { rename_capital = Ceasarea }
				2302 = { rename_capital = Kermarage }
				2304 = { rename_capital = Amissos}
				2305 = { rename_capital = Acilisene }
				2750 = { rename_capital = Philippopolis}
				4307 = { rename_capital = Colonia }
				4308 = { rename_capital = Laodicea }
				4309 = { rename_capital = Tralles }
				4310 = { rename_capital = Tephrike }
				4311 = { rename_capital = Polydorion }
				4312 = { rename_capital = Dorylaeum }
				4313 = { rename_capital = Gangra }
				4314 = { rename_capital = Justinianopolis }
				4315 = { rename_capital = Evdoksia }
				
			}
			custom_tooltip = reestablishing_themes_names_tooltip
			if = {
				limit = {
					NOT = { has_global_flag = constantinople_restored }
				}
				151 = {
					add_base_tax = 4
					add_base_production = 4
					add_base_manpower = 3
				}
				set_global_flag = constantinople_restored
			}
						
			add_country_modifier = {
				name = "the_theme_system"
				duration = -1
			}
		}
		ai_weight = {
			factor = 500	#Byzantium is basically Ottomans in its conquest behavior
		}
	}
	
	convert_asia_minor = {
		icon = mission_non-western_soldiers
		required_missions = { reestablish_the_theme_system }
		position = 5
		provinces_to_highlight = {
			OR = {
				area = aydin_area
				area = hudavendigar_area
			}
			OR = {
				NOT = { religion = orthodox }
				NOT = { owned_by = ROOT }
			}
		}
		trigger = {
			religion = orthodox
			aydin_area = {
				type = all
				owned_by = ROOT
				religion = orthodox
			}
			hudavendigar_area = {
				type = all
				owned_by = ROOT
				religion = orthodox
			}
		}
		effect = {
			add_country_modifier = {
				name = "growth_of_the_orthodox_church"
				duration = 7300
			}
			add_patriarch_authority = 0.1
			add_permanent_claim = 358
			add_permanent_claim = 379
			add_permanent_claim = 2313
		}
		ai_weight = {
			factor = 500	#Byzantium is basically Ottomans in its conquest behavior
		}
	}
	
	the_pentarchy = {
		icon = mission_empire
		position = 7
		required_missions = {
			recover_rome
			convert_asia_minor
		}
		provinces_to_highlight = {
			OR = {
				province_id = 118
				province_id = 151
				province_id = 358
				province_id = 379
				province_id = 2313
			}
		}
		trigger = {
			owns = 118 #Rome
			owns = 151 #Constantinople
			owns = 358 #Alexandria
			owns = 379 #Jerusalem
			owns = 2313 #Antioch
		}
		effect = {
			add_country_modifier = {
				name = "healing_the_schism"
				duration = -1
			}
			country_event = { id = catholic_flavor.3 }
		}
		ai_weight = {
			factor = 500	#Byzantium is basically Ottomans in its conquest behavior
		}
	}
}
