MEE_BYZ_conquest_1 = {
	slot = 1
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1
	}
	has_country_shield = yes

	BYZ_false_despots = {
		icon = the_latin_empire
		required_missions = { BYZ_impending_doom }
		position = 2
		provinces_to_highlight = {
			OR = {
				owned_by = EPI
				province_id = 4699
			}
		}
		trigger = {
			OR = {
				AND = {
					owns_or_non_sovereign_subject_of = 4699
					NOT = { exists = EPI }
				}
				EPI = { is_subject_of = ROOT }
			}
		}
		effect = {
			simple_dynamic_effect = {
				first_custom_tooltip = BYZ_if_done_via_conquest
				first_limit = "
					owns_or_non_sovereign_subject_of = 4699 #arta
					NOT = { exists = EPI }
				"
				first_effect = "
					add_country_modifier = {
						name = EPI_epirote_forces
						duration = 5475
					}
				"
				second_custom_tooltip = BYZ_if_done_via_vassalization
				second_limit = "
					EPI = { is_subject_of = ROOT }
				"
				second_effect = "
					add_dip_power = 75
					
					custom_tooltip = \" \" 
					
					add_core = 4698 #cephalonia
					
					custom_tooltip = \" \"
				"
			}
			
			give_claims = { area = albania_area }
			
			give_claims = { area = apulia_area }
			give_claims = { area = calabria_area }
			give_claims = { area = sicily_area }
			give_claims = { area = western_sicily_area }
		}
	}
	
	BYZ_magna_graecia = {
		icon = dalmatian_conquest
		required_missions = { BYZ_false_despots }
		position = 5
		provinces_to_highlight = {
			OR = {
				area = apulia_area
				area = calabria_area
				area = sicily_area
				area = western_sicily_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = apulia_area
					area = calabria_area
					area = sicily_area
					area = western_sicily_area
				}
				value = 7 
			}
			
			owns = 123 #Calabria
			owns = 122 #Salento
		}
		effect = {
			create_admiral = { tradition = 60 }
			
			custom_tooltip = " "
			
			give_claims = { area = lazio_area }
			give_claims = { area = central_italy_area }
			give_claims = { area = naples_area }
			
			give_claims = { area = corsica_sardinia_area }
			give_claims = { area = barbary_coast_area }
			give_claims = { area = kabylia_area }
			give_claims = { area = tunisia_area }
			give_claims = { area = djerba_area }
			give_claims = { area = tripolitania_area }
			
			custom_tooltip = " "
			
			country_event_with_effect_insight = {
				id = MEE_Byzantine_Events.2 
				effect = "
					123 = {
						change_culture = griko
						add_base_tax = 1
						add_base_production = 1
					}
					122 = {
						change_culture = griko
						add_base_tax = 1
						add_base_production = 1
					}
					
					custom_tooltip = BYZ_3_other_provs
					
					add_years_of_trade_income = {
						years = 1
						custom_tooltip = BYZ_add_1_years_of_trade_income
					}
				"
			}
		}
	}
	
	BYZ_carthage = {
		icon = mission_conquer_tunis
		required_missions = { BYZ_magna_graecia }
		position = 6
		provinces_to_highlight = {
			OR = {
				area = corsica_sardinia_area
				area = barbary_coast_area
				area = kabylia_area
				area = tunisia_area
				area = djerba_area
				area = tripolitania_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = corsica_sardinia_area
					area = barbary_coast_area
					area = kabylia_area
					area = tunisia_area
					area = djerba_area
					area = tripolitania_area
				}
				value = 14 
			}
		}
		effect = {
			add_country_modifier = { 
				name = BYZ_southern_provinces_1
				duration = -1
			}
			
			give_claims = { region = iberia_region }
			give_claims = { region = maghreb_region }
			
			custom_tooltip = " "
			
			add_country_modifier = {
				name = BYZ_africa_proconsularis
				duration = 10950
			}
		}
	}
}

MEE_BYZ_conquest_2 = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1		#added to MMETR to avoid conflict
	}
	has_country_shield = yes

	BYZ_impending_doom = {
		icon = mission_the_roman_sultan
		required_missions = { }
		position = 1
		provinces_to_highlight = {
		}
		trigger = {
			OR = {
				num_of_allies = 2
				army_size_percentage = 0.9
				army_size = 10
			}
		}
		effect = {
			add_country_modifier = {
				name = BYZ_dreams_of_restoration
				duration = 5475
			}
			
			give_claims = { area = hudavendigar_area }
			give_claims = { area = aydin_area }
			give_claims = { area = bulgaria_area }
			give_claims = { area = silistria_area }
			give_claims = { area = macedonia_area }
			
			custom_tooltip = " "
			
			complex_dynamic_effect = {
				first_custom_tooltip = BYZ_if_we_are_allied_with_PAP
				first_limit = "
					alliance_with = PAP
				"
				first_effect = "
					custom_tooltip = BYZ_extra_mercenary_cost_for_union_tt
					hidden_effect = {
						add_country_modifier = {
							name = BYZ_extra_mercenary_cost_for_union
							duration = 5475
							hidden = yes
						}
					}
				"
			}
		}
	}
	
	BYZ_bar = {
		icon = tame_the_magnates
		required_missions = { BYZ_false_despots BYZ_greece }
		position = 3
		provinces_to_highlight = {
			OR = {
				area = rascia_area
				area = serbia_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = rascia_area
					area = serbia_area
				}
				value = 7 #out of 9 
			}
		}
		effect = {
			give_claims = { region = balkan_region }
			give_claims = { area = carinthia_area }
			
			custom_tooltip = " "
			
			add_country_modifier = {
				name = BYZ_western_flank_1
				duration = -1
			}
			
			country_event_with_option_insight = { 
				id = MEE_Byzantine_Events.1
				option_1 = "
					add_country_modifier = {
						name = MEE_strong_example_against_the_serbian_aristocrats
						duration = 10950
					}
					
					add_mil_power = 100
				"
				option_2 = "
					add_country_modifier = {
						name = MEE_amiable_treatment
						duration = 9125
					}
					
					add_dip_power = 100
				"
			}
		}
	}
	
	BYZ_illyria = {
		icon = secure_the_sava
		required_missions = { BYZ_bar }
		position = 4
		provinces_to_highlight = {
			OR = {
				area = croatia_area
				area = east_adriatic_coast_area
				area = bosnia_area
				area = slavonia_area
				area = carinthia_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = croatia_area
					area = east_adriatic_coast_area
					area = bosnia_area
					area = slavonia_area
					area = carinthia_area
				}
				value = 15
			}
		}
		effect = {
			custom_tooltip = BYZ_western_flank_1_2
			hidden_effect = {
				remove_country_modifier = BYZ_western_flank_1
				add_country_modifier = {
					name = BYZ_western_flank_2
					duration = -1
				}
			}
			
			custom_tooltip = " "
			
			give_claims = { area = transdanubia_area }
			give_claims = { area = alfold_area }
			give_claims = { area = venetia_area }
			give_claims = { area = po_valley_area }
			give_claims = { area = emilia_romagna_area }
			give_claims = { area = lombardy_area }
			give_claims = { area = piedmont_area }
			give_claims = { area = liguria_area }
			
			custom_tooltip = " "
			
			add_army_tradition_or_mil_power = { amount = 10 }
		}
	}
	
	BYZ_belisarius_foe = {
		icon = kingdom_of_lombardy
		required_missions = { BYZ_illyria }
		position = 5
		provinces_to_highlight = {
			OR = {
				area = venetia_area
				area = po_valley_area
				area = emilia_romagna_area
				area = lombardy_area
				area = piedmont_area
				area = liguria_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = venetia_area
					area = po_valley_area
					area = emilia_romagna_area
					area = lombardy_area
					area = piedmont_area
					area = liguria_area
				}
				value = 18
			}
		}
		effect = {
			custom_tooltip = BYZ_western_flank_2_3
			hidden_effect = {
				remove_country_modifier = BYZ_western_flank_2
				add_country_modifier = {
					name = BYZ_western_flank_3
					duration = -1
				}
			}
			
			custom_tooltip = " "
			
			give_claims = { area = tuscany_area }
			give_claims = { area = lazio_area }
			give_claims = { area = central_italy_area }
			give_claims = { area = tuscany_area }
			
			give_claims = { area = inner_austria_area }
			give_claims = { area = austria_proper_area }
			give_claims = { area = tirol_area }
			give_claims = { area = east_bavaria_area }
			give_claims = { area = lower_bavaria_area }
			give_claims = { area = upper_bavaria_area }
			give_claims = { area = upper_swabia_area }
			give_claims = { area = lower_swabia_area }
			give_claims = { area = switzerland_area }
			
			give_claims = { area = france_region }
			
			custom_tooltip = " "
			
			country_event_with_insight = {
				id = MEE_Byzantine_Events.3
				insight_tooltip = BYZ_great_general
			} 
		}
	}
	
	BYZ_justinians_ambition = {
		icon = byz_justinians_ambition
		required_missions = { BYZ_belisarius_foe BYZ_magna_graecia }
		position = 6
		provinces_to_highlight = {
			province_id = 118
		}
		trigger = {
			BYZ_is_not_latin_empire = yes
			118 = {
				owned_by = ROOT
				is_state_core = ROOT
			}
		}
		effect = {
			country_event_with_effect_insight = { 
				id = MEE_Byzantine_Events.4
				
				effect = "
					custom_tooltip = BYZ_unlock_justinians_empire_decision 
					
					custom_tooltip = \" \" 
				
					add_permanent_power_projection = {
						type = byz_permanent_power_projection
						amount = 5
					}
					
					if = {
						limit = {
							BYZ_has_rights_of_man = yes
						}
						custom_tooltip = \" \"
						custom_tooltip = BYZ_double_conquer_chance
					}
				"
			}
		}
	}
	
	BYZ_iberia = {
		icon = mission_plus_ultra
		required_missions = { BYZ_carthage }
		position = 7
		provinces_to_highlight = {
			region = iberia_region
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				region = iberia_region
				value = 40 #out of 64
			}
		}
		effect = {
			custom_tooltip = BYZ_southern_provinces_1_2
			hidden_effect = {
				remove_country_modifier = BYZ_southern_provinces_1
				add_country_modifier = {
					name = BYZ_southern_provinces_2
					duration = -1
				}
			}
			
			custom_tooltip = " "
			
			add_country_modifier_for_age = {
				name = BYZ_roman_vigour
				age = age_of_reformation
				else = "
					add_army_tradition_or_mil_power = { amount = 25 }
					
					custom_tooltip = \" \"
					
					add_mil_power = 100
				"
			}
		}
	}
}

MEE_BYZ_conquest_3 = {
	slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1
	}
	has_country_shield = yes

	BYZ_greece = {
		icon = cross_the_pindus
		required_missions = { BYZ_impending_doom }
		position = 2
		provinces_to_highlight = {
			OR = {
				area = thrace_area
				area = macedonia_area
				area = northern_greece_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = thrace_area
					area = macedonia_area
					area = northern_greece_area
				}
				value = 9
			}
		}
		effect = {
			give_claims = { area = rascia_area }
			give_claims = { area = serbia_area }
			give_claims = { area = aegean_archipelago_area }
			give_claims = { id = 163 } #Crete
			give_claims = { id = 321 } #Cyprus
			
			custom_tooltip = " "
			
			add_years_of_income = 0.5
			add_yearly_manpower = 0.5
			
			custom_tooltip = " "
			
			country_event_with_effect_insight = {
				id = MEE_Byzantine_Events.6
				
				effect = "
					add_country_modifier = {
						name = BYZ_reversal_of_downfall
						duration = 10950 
					}
					
					add_power_projection_mission = {
						amount = 25
					}
				"
			}
		}
	}
	
	BYZ_bulgaria = {
		icon = despot_stefans_legacy
		required_missions = { BYZ_greece }
		position = 3
		provinces_to_highlight = {
			OR = {
				area = bulgaria_area
				area = silistria_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			bulgaria_area = {
				country_or_non_sovereign_subject_holds = ROOT
				type = all
			}
			silistria_area = {
				country_or_non_sovereign_subject_holds = ROOT
				type = all
			}			
		}
		effect = {
			hidden_effect = {
				add_country_modifier = {
					name = BYZ_no_slot_bulgarian
					duration = -1
				}
			}
			add_accepted_culture = bulgarian
			custom_tooltip = BYZ_bulgarian_no_slot_taken
		
			custom_tooltip = " "
			
			create_general_with_pips = { tradition = 50 add_shock = 1 }
			
			custom_tooltip = " "
			
			give_claims = { area = wallachia_area }
			give_claims = { area = moldavia_area }
			
			custom_tooltip = " "
			
			4704 = {
				add_permanent_province_modifier = {
					name = BYZ_new_constantinople
					duration = -1
				}
			}
		}
	}
	
	BYZ_aegean_islands = {
		icon = byz_aegean_islands
		required_missions = { BYZ_coast }
		position = 4
		provinces_to_highlight = {
			OR = {
				area = aegean_archipelago_area
				province_id = 163 #crete
			}
		}
		trigger = {
			aegean_archipelago_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			163 = { country_or_non_sovereign_subject_holds = ROOT }
		}
		effect = {
			151 = {
				add_trade_modifier = {
					who = ROOT
					duration = -1
					power = 50
					key = BYZ_latin_delusions
				}
			}
			
			custom_tooltip = " "
			
			custom_tooltip = BYZ_distribute_5_base_tax_among_greek_provinces
			hidden_effect = {
				for = {
					amount = 5
					effect = "
						random_owned_province = {
							limit = {
								culture = greek
							}
							add_base_tax = 1
						}
					"
				}
			}
		}
	}
	
	BYZ_venetian_avarice = {
		icon = overshadow_venice
		required_missions = { BYZ_illyria }
		position = 5
		provinces_to_highlight = {
			province_id = 112
		}
		trigger = {
			owns = 112
		}
		effect = {
			add_navy_tradition = 20
			
			custom_tooltip = " "
			
			country_event_with_option_insight = {
				id = flavor_byz.1
				option_1 = "
					112 = {
						custom_tooltip = BYZ_this_province_will_lose_development
						custom_tooltip = \" \"
						add_permanent_province_modifier = {
							name = BYZ_chastening_of_venice
							duration = -1
						}
					}
					capital_scope = {
						add_province_modifier = {
							name = byzantine_treasures_returned
							duration = 7300
						}
					}
				"
				option_2 = "
					if = {
						limit = {
							has_dlc = \"Domination\"
						}
						add_country_modifier = { 
							name = BYZ_may_construct_galleass
							duration = -1
						}
						custom_tooltip = BYZ_may_only_build_in_112
					}
					else = {
						112 = {
							add_province_modifier = {
								name = BYZ_arsenal
								duration = -1
							}
						}
					}
				"
			}
		}
	}
	
	BYZ_france = {
		icon = mission_the_french_menace
		required_missions = { BYZ_belisarius_foe }
		position = 6
		provinces_to_highlight = {
			region = france_region
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				region = france_region
				value = 56 #out of 70
			}
		}
		effect = {
			custom_tooltip = BYZ_western_flank_3_4
			hidden_effect = {
				remove_country_modifier = BYZ_western_flank_3
				add_country_modifier = {
					name = BYZ_western_flank_4
					duration = -1
				}
			}
			
			custom_tooltip = " "
			
			add_country_modifier_for_age = {
				name = BYZ_ceasarean_conquests
				age = age_of_reformation
				else = "
					add_army_tradition_or_mil_power = { amount = 25 }
					
					custom_tooltip = \" \"
					
					add_mil_power = 100
				"
			}
			
			custom_tooltip = BYZ_france_ct
			hidden_effect = {
				give_claims = { area = east_midlands_area }
				give_claims = { area = west_midlands_area }
				give_claims = { area = scottish_marches_area }
				give_claims = { area = yorkshire_area }
				give_claims = { area = wessex_area }
				give_claims = { area = home_counties_area }
				give_claims = { area = east_anglia_area }
				give_claims = { area = wales_area }
				
				give_claims = { area = romandie_area }
				give_claims = { area = upper_rhineland_area }
				give_claims = { area = romandie_area }
				give_claims = { area = alsace_area }
				give_claims = { area = palatinate_area }
				give_claims = { area = lower_rhineland_area }
				give_claims = { id = 85 } #cologne
				give_claims = { area = north_brabant_area }
				give_claims = { area = brabant_area }
				give_claims = { area = flanders_area }
				give_claims = { area = wallonia_area }
				give_claims = { id = 96 } #zeeland
			}
			
			custom_tooltip = " "
			
			add_permanent_power_projection = {
				type = byz_permanent_power_projection
				amount = 5
			}
		}
	}
	
	BYZ_roman_empire = {
		icon = a_place_among_the_great_powers
		required_missions = { BYZ_egypt BYZ_france BYZ_iberia }
		position = 8
		provinces_to_highlight = {
			BYZ_roman_empire_decision_trigger = yes
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			tag = ROM
		}
		effect = {
			custom_tooltip = BYZ_unite_all_modifiers_into_one
			hidden_effect = {
				remove_country_modifier = BYZ_western_flank_4
				remove_country_modifier = BYZ_southern_provinces_2
				remove_country_modifier = BYZ_eastern_flank_3
				add_country_modifier = {
					name = BYZ_united_modifier
					duration = -1
				}
			}
			
			custom_tooltip = " "
			
			custom_tooltip = BYZ_rebel_sentiment_will_fire_more_rarely
			set_country_flag = BYZ_less_rebel_sentiment
			
			custom_tooltip = " "
			
			add_permanent_power_projection = {
				type = byz_permanent_power_projection
				amount = 10
			}
		}
	}
}

MEE_BYZ_defense_4 = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1
	}
	has_country_shield = yes

	BYZ_hexamilion = {
		icon = pacify_the_albanian_lands
		required_missions = { }
		position = 1
		provinces_to_highlight = {
			province_id = 4701
			OR = {
				NOT = { owned_by = ROOT }
				NOT = { base_manpower = 4 }
			}
		}
		trigger = {
			4701 = {
				base_manpower = 4
				owned_by = ROOT
			}
			employed_advisor = { category = mil }
		}
		effect = {
			country_event_with_option_insight = {
				id = MEE_Byzantine_Events.11
				option_1 = "
					if = {
						limit = {
							145 = { owned_by = ROOT has_building = fort_15th }
						}
						145 = { remove_building = fort_15th }
					}
					if = {
						limit = {
							4701 = { owned_by = ROOT NOT = { has_fort_building_trigger = yes } }					
						}
						4701 = {
							add_building = fort_15th
						}
					}
					custom_tooltip = \" \"
					custom_tooltip = BYZ_unlock_decision_to_upgrade_hexamilion_wall
				"
				option_2 = "
					custom_tooltip = BYZ_upgrading_theodosian_walls_will_be_25_cheaper
				"
			}
		}
	}
}

MEE_BYZ_conquest_4 = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_coast = {
		icon = capture_adriatic_ports
		required_missions = { BYZ_greece }
		position = 3
		provinces_to_highlight = {
			OR = {
				area = aydin_area
				area = hudavendigar_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			aydin_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			hudavendigar_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			owns = 318 #sugla - smyrna
		}
		effect = {
			if = {
				limit = {
					culture_group = byzantine
				}
				318 = {
					change_culture = greek
				}
				
				custom_tooltip = " "
				
				set_country_flag = BYZ_conversions
				custom_tooltip = BYZ_provinces_will_convert_to_greek_in_asia_minor
				#.7
				
				custom_tooltip = " "
			}
			else = {
				add_accepted_culture_or_dip_power = { culture = turkish dip_reward = yes }
				
				custom_tooltip = " "
			}
			
			give_claims = { region = anatolia_region }
			give_claims = { id = 2410 } #theodoro
			give_claims = { id = 2447 } #mantrega
			give_claims = { id = 285 } #caffa
		}
	}
	
	BYZ_avenge_1071 = {
		icon = byz_avenge_1071
		required_missions = { BYZ_coast }
		position = 5
		provinces_to_highlight = {
			region = anatolia_region
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				region = anatolia_region
				value = 35 #out of 45
			}
		}
		effect = {
			add_country_modifier = {
				name = BYZ_eastern_flank_1
				duration = -1
			}
		
			give_claims = { region = mashriq_region }
			
			custom_tooltip = " "
			
			if = {
				limit = {
					culture_group = byzantine
				}
				custom_tooltip = BYZ_culture_conversion_will_extend 
				custom_tooltip = " "
			}
			
			country_event_with_option_insight = {
				id = MEE_Byzantine_Events.8
				
				option_1 = "
					add_accepted_culture_or_dip_power = { culture = turkish dip_reward = yes }
			
					custom_tooltip = \" \"
					
					custom_tooltip = BYZ_every_turkish_province
					tooltip = {
						add_nationalism = -10
					}
				"
				option_2 = "
					custom_tooltip = BYZ_culture_conversion_will_be_faster
				"
				option_3 = "
					custom_tooltip = BYZ_every_turkish_province
					tooltip = {
						add_province_modifier = {
							name = BYZ_janissary_recruitment
							duration = 9125
						}
					}
					
					custom_tooltip = BYZ_unlock_janissary_mercenary_company
				"
			}
		}
	}
	
	BYZ_syria = {
		icon = jerusalem
		required_missions = { BYZ_avenge_1071 }
		position = 6
		provinces_to_highlight = {
			OR = {
				area = aleppo_area
				area = syria_area
				area = syrian_desert_area
				area = palestine_area
				area = trans_jordan_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = aleppo_area
					area = syria_area
					area = syrian_desert_area
					area = palestine_area
					area = trans_jordan_area
				}
				value = 13
			}
		}
		effect = {
			custom_tooltip = BYZ_eastern_flank_1_2
			hidden_effect = {
				remove_country_modifier = BYZ_eastern_flank_1
				add_country_modifier = {
					name = BYZ_eastern_flank_2
					duration = -1
				}
			}
		
			custom_tooltip = " "
			
			give_claims = { region = egypt_region }
			
			custom_tooltip = " "
			
			if = {
				limit = {
					has_dlc = "Third Rome"
				}
				custom_tooltip = " "
				
				set_country_flag = BYZ_extra_patriarch_authority
				custom_tooltip = BYZ_consecrating_metropolitan
			}
		}
	}
	
	BYZ_egypt = {
		icon = control_the_means_of_transaction
		required_missions = { BYZ_syria }
		position = 7
		provinces_to_highlight = {
			region = egypt_region
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
			NOT = { area = lower_nubia_area }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				region = egypt_region
				NOT = { area = lower_nubia_area }
				value = 22
			}
		}
		effect = {
			custom_tooltip = BYZ_eastern_flank_2_3
			hidden_effect = {
				remove_country_modifier = BYZ_eastern_flank_2
				add_country_modifier = {
					name = BYZ_eastern_flank_3
					duration = -1
				}
			}
			
			custom_tooltip = " "
			
			give_claims = { area = tabuk_area }
			give_claims = { area = medina_area }
			give_claims = { area = mecca_area }
			
			give_claims = { area = corsica_sardinia_area }
			give_claims = { area = barbary_coast_area }
			give_claims = { area = kabylia_area }
			give_claims = { area = tunisia_area }
			give_claims = { area = djerba_area }
			give_claims = { area = tripolitania_area }
		}
	}
	
	BYZ_breadbasket = {
		icon = prosperity_for_all
		required_missions = { BYZ_egypt }
		position = 8
		provinces_to_highlight = {
			OR = {
				province_id = 2316 #al gharbia
				province_id = 362 #rashid
				province_id = 363 #dumyat
				province_id = 4316 #sharqiya
			}
			OR = {
				NOT = { owned_by = ROOT }
				NOT = { has_production_building_trigger = yes }
				NOT = { development = 20 }
				NOT = { has_manufactory_trigger = yes }
			}
		}
		trigger = {
			2316 = {
				owned_by = ROOT
				has_production_building_trigger = yes
				development = 20
				has_manpower_building_trigger = yes
			}
			362 = {
				owned_by = ROOT
				has_production_building_trigger = yes
				development = 20
				has_manpower_building_trigger = yes
			}
			363 = {
				owned_by = ROOT
				has_production_building_trigger = yes
				development = 20
				has_manpower_building_trigger = yes
			}
			4316 = {
				owned_by = ROOT
				has_production_building_trigger = yes
				development = 20
				has_manpower_building_trigger = yes
			}
		}
		effect = {
			358 = {
				add_trade_modifier = {
					who = ROOT
					duration = -1
					power = 100
					key = BYZ_annona_shipments
				}
			}
			
			custom_tooltip = " "
			
			capital_scope = {
				add_permanent_province_modifier = {
					name = BYZ_grain_shipments
					duration = -1
				}
			}
			
			# custom_tooltip = " "
			
			custom_tooltip = BYZ_distribute_10_10_0_dev_in_anatolia_and_balkans
			hidden_effect = {
				for = {
					amount = 10
					effect = "
						random_owned_province = {
							limit = {
								OR = {
									region = balkan_region
									region = anatolia_region
								}
							}
							add_base_tax = 1
						}
					"
				}
				for = {
					amount = 10
					effect = "
						random_owned_province = {
							limit = {
								OR = {
									region = balkan_region
									region = anatolia_region
								}
							}
							add_base_production = 1
						}
					"
				}
			}
		}
	}
}

MEE_BYZ_defense_5 = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1
	}
	has_country_shield = yes

	BYZ_reinforce_constantinople = {
		icon = byz_reinforce_constantinople
		required_missions = { }
		position = 1
		provinces_to_highlight = {
			province_id = 151
			OR = {
				NOT = { owned_by = ROOT }
				NOT = { base_manpower = 7 }
			}
		}
		trigger = {
			OR = {
				151 = {
					base_manpower = 7
					owned_by = ROOT
				}
				has_mil_advisor_2 = yes
				fortification_expert = 1
				if = {
					limit = {
						OR = {
							has_dlc = "Common Sense"
							has_dlc = "Res Publica"
						}
					}
					national_focus = mil
				}
				else = { hidden_trigger = { always = no } }
			}
		}
		effect = {
			custom_tooltip = BYZ_unlock_decision_for_theodosian_walls
			set_country_flag = BYZ_unlock_decision_to_upgrade_theodosian_wall_flag
			
			custom_tooltip = " "
			
			country_event_with_option_insight = {
				id = MEE_Byzantine_Events.12
				option_1 = "
					custom_tooltip = BYZ_we_will_ask_for_serbian_help
					SER = {
						country_event = { id = MEE_Byzantine_Events.15 }
					}
				"
				option_2 = "
					151 = {
						add_base_tax = -2
						add_province_modifier = {
							name = BYZ_theodosian_wall_1
							duration = -1
						}
					}
					
					custom_tooltip = BYZ_if_it_is_being_upgraded
				"
				option_3 = "
					add_prestige_or_monarch_power = { amount = 20 }
				"
			}
		}
	}
	
	BYZ_defence_in_depth = {
		icon = mission_conquer_mewar
		required_missions = { BYZ_reinforce_constantinople BYZ_hexamilion }
		position = 2
		provinces_to_highlight = {
		}
		trigger = {
			OR = {
				num_of_hired_mercenary_companies = 3
				AND = {
					army_size_percentage = 1
					NOT = { num_of_mercenaries = 1 }
				}
				custom_trigger_tooltip = {
					tooltip = BYZ_upgraded_either_walls_to_level_2
					OR = {
						151 = { has_province_modifier = BYZ_theodosian_wall_2 } #should't be possible without ownership anyway.
						4701 = { has_province_modifier = BYZ_hexamilion_wall_2 }
					}
				}
			}
		}
		effect = {
			add_army_tradition_or_mil_power = { amount = 10 }
			
			custom_tooltip = " "
			
			complex_dynamic_effect = { #I will not rethink this mission reward!
				first_custom_tooltip = BYZ_if_done_via_mercenary_companies
				first_limit = "num_of_hired_mercenary_companies = 3"
				first_effect = "
					add_country_modifier = {
						name = BYZ_reliance_on_mercenaries
						duration = 7300
					}
				"
				second_custom_tooltip = BYZ_if_done_via_army_size
				second_limit = "
					army_size_percentage = 1
					NOT = { num_of_mercenaries = 1 }
				"
				second_effect = "
					add_country_modifier = {
						name = BYZ_paroikoi_recruimtnet
						duration = 5475
					}
				"
				third_custom_tooltip = BYZ_if_done_via_upgrading_walls
				third_limit = "
					OR = {
						151 = { has_province_modifier = BYZ_theodosian_wall_2 } #should't be possible without ownership anyway.
						4701 = { has_province_modifier = BYZ_hexamilion_wall_2 }
					}
				"
				third_effect = "
					add_country_modifier = {
						name = BYZ_spirit_of_resistance
						duration = 7300
					}
				"
			}
		}
	}
}

MEE_BYZ_conquest_5 = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1
	}
	has_country_shield = yes

	BYZ_pontic_empire = {
		icon = byz_pontic_empire
		required_missions = { BYZ_coast }
		position = 4
		provinces_to_highlight = {
			OR = {
				AND = {
					OR = {
						province_id = 330
						province_id = 2410
					}
					NOT = { country_or_non_sovereign_subject_holds = ROOT }
				}
				owned_by = TRE 
				owned_by = FEO
			}
		}
		trigger = {
			owns_or_non_sovereign_subject_of = 330
			owns_or_non_sovereign_subject_of = 2410
			NOT = { exists = TRE }
			NOT = { exists = FEO }
		}
		effect = {
			give_claims = { area = imereti_area }
			give_claims = { area = kartli_kakheti_area }
			give_claims = { area = samtskhe_area }
			give_claims = { area = circassia_area }
			give_claims = { area = armenia_area }
			give_claims = { area = shirvan_area }
			
			custom_tooltip = " "
			
			country_event_with_effect_insight = {
				id = MEE_Byzantine_Events.10
				effect = "
					330 = {
						set_center_level_2_center_of_trade = yes #NOTE: this vanilla scripted effect is overwritten
					}
					custom_tooltip = \" \"
					add_country_modifier = {
						name = BYZ_offshoots_defeated
						duration = -1
					}
					add_power_projection_mission = { amount = 25 }
				"
			}
		}
	}
	
	BYZ_persians = {
		icon = mission_persian_soldiers
		required_missions = { BYZ_pontic_empire }
		position = 5
		provinces_to_highlight = {
			OR = {
				AND = {
					OR = {
						area = imereti_area
						area = kartli_kakheti_area
						area = samtskhe_area
						area = circassia_area
						area = armenia_area
						area = shirvan_area
					}
					NOT = { country_or_non_sovereign_subject_holds = ROOT }
				}
				AND = {
					owner = {
						culture_group = iranian
						total_development = 300
						NOT = {
							ROOT = {
								has_won_war_against = {
									who = PREV
									max_years_since = 10
								}
							}
						}
					}
				}
			}
		}
		trigger = {
			OR = {
				custom_trigger_tooltip = {
					tooltip = BYZ_won_war_against_persian
					any_country = {
						culture_group = iranian
						total_development = 300
						ROOT = {
							has_won_war_against = {
								who = PREV
								max_years_since = 10
							}
						}
					}
				}
				num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
					OR = {
						area = imereti_area
						area = kartli_kakheti_area
						area = samtskhe_area
						area = circassia_area
						area = armenia_area
						area = shirvan_area
					}
					value = 18
				}
			}
		}
		effect = {
			add_country_modifier = {
				name = BYZ_champions_of_the_east
				duration = 14600
			}
			
			add_permanent_power_projection = {
				type = byz_permanent_power_projection
				amount = 5
			}
			
			custom_tooltip = " "
			
			simple_dynamic_effect = {
				first_custom_tooltip = BYZ_if_done_via_conquest
				first_limit = "
					num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
						OR = {
							area = imereti_area
							area = kartli_kakheti_area
							area = samtskhe_area
							area = circassia_area
							area = armenia_area
							area = shirvan_area
						}
						value = 18
					}
				"
				first_effect = "
					custom_tooltip = BYZ_the_conquered_areas_will_get_separatism
					hidden_effect = {
						every_owned_province = {
							limit = {
								OR = {
									area = imereti_area
									area = kartli_kakheti_area
									area = samtskhe_area
									area = circassia_area
									area = armenia_area
									area = shirvan_area
								}
							}
							add_nationalism = -10
						}
					}
				"
				second_custom_tooltip = BYZ_if_done_via_war
				second_limit = "
					any_country = {
						culture_group = iranian
						total_development = 300
						ROOT = {
							has_won_war_against = {
								who = PREV
								max_years_since = 10
							}
						}
					}
				"
				second_effect = "
					create_general_with_pips = { tradition = 80 add_siege = 1 }
				"
			}
		}
	}
	
	BYZ_mesopotamia = {
		icon = mission_into_persia_2
		required_missions = { BYZ_avenge_1071 }
		position = 6
		provinces_to_highlight = {
			OR = {
				area = al_jazira_area
				area = iraq_arabi_area
				area = basra_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = al_jazira_area
					area = iraq_arabi_area
					area = basra_area
				}
				value = 10
			}
		}
		effect = {
			custom_tooltip = BYZ_every_province_for_mission
			tooltip = {
				add_province_modifier = {
					name = BYZ_fertile_valleys
					duration = 9125
				}
			}
			hidden_effect = {
				al_jazira_area = {
					limit = {
						country_or_non_sovereign_subject_holds = ROOT
					}
					add_province_modifier = {
						name = BYZ_fertile_valleys
						duration = 9125
					}
				}
				iraq_arabi_area = {
					limit = {
						country_or_non_sovereign_subject_holds = ROOT
					}
					add_province_modifier = {
						name = BYZ_fertile_valleys
						duration = 9125
					}
				}
				basra_area = {
					limit = {
						country_or_non_sovereign_subject_holds = ROOT
					}
					add_province_modifier = {
						name = BYZ_fertile_valleys
						duration = 9125
					}
				}
			}
		
			add_stability_or_adm_power = yes 
		}
	}
	
	BYZ_mecca = {
		icon = mission_into_arabia
		required_missions = { BYZ_egypt }
		position = 8
		provinces_to_highlight = {
			OR = {
				province_id = 384
				province_id = 385
			}
			NOT = { owned_by = ROOT }
		}
		trigger = {
			owns = 384
			owns = 385
		}
		effect = {
			add_power_projection_mission = { amount = 25 }
			
			custom_tooltip = " "
			
			country_event_with_option_insight = {
				id = MEE_Byzantine_Events.9
				option_1 = "
					add_adm_power = 100
					custom_tooltip = \" \"
					385 = {
						if = {
							limit = {
								NOT = { has_tax_building_trigger = yes }
							}
							add_building = cathedral
						}
						else = {
							add_or_upgrade_tax_building = yes
						}
					}
					if = {
						limit = {
							BYZ_has_leviathan = yes
						}
						custom_tooltip = \" \"
						custom_tooltip = BYZ_kaaba_but_only_gives_prestige_and_half_of_religious_unity
					}
				"
				option_2 = "
					add_dip_power = 100
					custom_tooltip = \" \"
					custom_tooltip = BYZ_relations
					custom_tooltip = \" \"
					385 = {
						add_province_modifier = {
							name = BYZ_masjid_local_pilgrimages
							duration = -1
						}
					}
				"
			}
		}
	}
}

MEE_BYZ_economy_1 = {
	slot = 1
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_economic_independence = {
		icon = medici_bank_ledgers
		required_missions = { BYZ_tarnished_state }
		position = 10
		provinces_to_highlight = {
			OR = {
				AND = {
					OR = {
						owned_by = GEN
						owned_by = VEN
					}
					NOT = {
						owner = {
							ROOT = {
								has_won_war_against = { who = PREV max_years_since = 50 }
							}
						}
					}
				}
				province_id = 151
			}
		}
		trigger = {
			custom_trigger_tooltip = {
				tooltip = BYZ_has_integrated_galata
				NOT = {
					151 = {
						has_province_modifier = BYZ_galata 
					}
				}
			}
			NOT = { has_estate_privilege = estate_burghers_reliance_on_republics }
			NOT = { has_estate_privilege = estate_burghers_exkousseiai_for_latins }
			OR = {
				151 = {
					trade_share = {
						country = ROOT
						share = 80
					}
				}
				AND = {
					if = {
						limit = {
							exists = GEN
						}
						has_won_war_against = { who = GEN max_years_since = 50 }
					}
					else = {
						GEN = {
							any_core_province = {
								country_or_non_sovereign_subject_holds = ROOT
							}
						}
					}
					if = {
						limit = {
							exists = VEN
						}
						has_won_war_against = { who = VEN max_years_since = 50 }
					}
					else = {
						VEN = {
							any_core_province = {
								country_or_non_sovereign_subject_holds = ROOT
							}
						}
					}
				}
			}
		}
		effect = {
			custom_tooltip = BYZ_buff_burgher_loans_no_mercantilism_loss #done via mission_completed
			
			custom_tooltip = " "
			
			complex_dynamic_effect = {
				first_custom_tooltip = BYZ_if_done_via_war
				first_limit = "
					if = {
						limit = { exists = GEN }
						has_won_war_against = { who = GEN max_years_since = 50 }
					}
					else = {
						GEN = {
							any_core_province = { country_or_non_sovereign_subject_holds = ROOT }
						}
					}
					if = {
						limit = { exists = VEN }
						has_won_war_against = { who = VEN max_years_since = 50 }
					}
					else = {
						VEN = {
							any_core_province = { country_or_non_sovereign_subject_holds = ROOT }
						}
					}
				"
				first_effect = "
					add_country_modifier = {
						name = BYZ_dominance
						duration = 7300
					}
				"
				second_custom_tooltip = BYZ_if_done_via_trade_share
				second_limit = "
					151 = {
						trade_share = {
							country = ROOT
							share = 80
						}
					}
				"
				second_effect = "
					add_country_modifier = {
						name = BYZ_maintaining_relations
						duration = 5475
					}
				"
			}
		}
	}
	
	BYZ_return_to_gold = {
		icon = dominant_economy
		required_missions = { BYZ_economic_independence }
		position = 11
		provinces_to_highlight = {
			OR = {
				AND = {
					province_id = 1766
					OR = {
						NOT = { owned_by = ROOT }
						NOT = { base_production = 8 }
						NOT = { development = 20 }
					}
				}
				AND = {
					OR = {
						province_id = 148
						province_id = 330
					}
					OR = {
						NOT = { owned_by = ROOT }
						NOT = { has_production_building_trigger = yes }
					}
				}
			}
		}
		trigger = {
			1766 = {
				owned_by = ROOT
				OR = {
					base_production = 8
					development = 20
				}
			}
			148 = {
				owned_by = ROOT
				has_production_building_trigger = yes
			}
			330 = {
				owned_by = ROOT
				has_production_building_trigger = yes
			}
			
			gold_income = 10
			share_of_starting_income = 5
		}
		effect = {
			define_advisor = {
				type = master_of_mint 
				skill = 2
				culture = ROOT
				religion = ROOT
				cost_multiplier = 0.5
			}
			
			custom_tooltip = " "
			
			add_country_modifier = {
				name = BYZ_coin_of_pure_gold
				duration = 10950
			}
			
			add_years_of_trade_income = {
				years = 2
				custom_tooltip = BYZ_add_2_years_of_trade_income
			}
		}
	}
	
	BYZ_support_weavers = {
		icon = purely_for_commerce
		required_missions = { BYZ_book_of_the_eparch }
		position = 12
		provinces_to_highlight = {
			OR = {
				province_id = 4701
				province_id = 1773
				province_id = 317
			}
			OR = {
				NOT = { owned_by = ROOT }
				NOT = { has_production_building_trigger = yes }
				NOT = { development = 20 }
			}
		}
		trigger = {
			4701 = {
				owned_by = ROOT
				has_production_building_trigger = yes 
				development = 20
			}
			1773 = {
				owned_by = ROOT
				has_production_building_trigger = yes 
				development = 20
			}
			317 = {
				owned_by = ROOT
				has_production_building_trigger = yes 
				development = 20
			}
		}
		effect = {
			317 = {
				add_or_upgrade_production_building = yes
			}
			
			1773 = {
				add_or_upgrade_production_building = yes 
				set_province_flag = BYZ_may_convert_to_silk
				province_event = { id = MEE_Byzantine_Events.23 }
			}
			
			4701 = {
				add_or_upgrade_production_building = yes 
				set_province_flag = BYZ_may_convert_to_silk
				province_event = { id = MEE_Byzantine_Events.23 days = 180 } #the events cannot be fired at the same time
			}
			
			custom_tooltip = " "
			
			country_event_with_effect_insight = {
				id = MEE_Byzantine_Events.26
				effect = "
					change_price = {
						trade_goods = silk
						key = BYZ_growing_demand
						value = 0.2
						duration = -1
					}
				"
			}
		}
	}
}

MEE_BYZ_economy_2 = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_tarnished_state = {
		icon = develop_provence
		required_missions = { }
		position = 9
		provinces_to_highlight = {
		}
		trigger = {
			OR = {
				custom_trigger_tooltip = {
					tooltip = BYZ_developed_provinces_at_least_20_times
					check_variable = {
						which = num_of_times_developed
						value = 20
					}
				}
				has_idea = repopulation_of_countryside 
			}
		}
		effect = {
			add_country_modifier = {
				name = BYZ_reversing_the_decline
				duration = 7300
			}
			
			custom_tooltip = " "
			
			custom_tooltip = BYZ_revoking_disorganization_of_the_military
		}
	}
	
	BYZ_book_of_the_eparch = {
		icon = expand_the_confederacy
		required_missions = { BYZ_tarnished_state }
		position = 11
		provinces_to_highlight = {
			owned_by = ROOT 
			NOT = { has_production_building_trigger = yes }
			NOT = { trade_goods = gold }
		}
		trigger = {
			num_of_owned_provinces_with = {
				has_production_building_trigger = yes
				value = 8
			}
			if = {
				limit = {
					production_income_percentage = 0.01 #to prevent crashes
				}
				custom_trigger_tooltip = {
					tooltip = BYZ_at_least_10_production_income
					variable_arithmetic_trigger = {
						export_to_variable = {
							which = current_production_income
							value = monthly_income
						}
						export_to_variable = {
							which = production_income_share
							value = trigger_value:production_income_percentage
						}
						multiply_variable = { which = current_production_income which = production_income_share }
						check_variable = { which = current_production_income value = 10 }
					}
				}
			}
			if = {
				limit = {
					has_estate = estate_burghers
				}
				num_of_estate_agendas_completed = {
					estate = estate_burghers
					value = 2
				}
			}
		}
		effect = {
			add_country_modifier = {
				name = BYZ_supporting_the_guilds
				duration = 9125
			}
			
			add_mercantilism = 3
			
			custom_tooltip = " "
			
			if = {
				limit = {
					has_estate = estate_burghers
				}
				complex_dynamic_effect = {
					first_custom_tooltip = "BYZ_if_we_have_60_estate_loyalty"
					first_limit = "
						estate_loyalty = {
							estate = estate_burghers
							loyalty = 60 
						}
					"
					first_effect = "
						add_mercantilism = 2
					"
				}
			}
			
		}
	}
	
	BYZ_glass_ware = {
		icon = bohemian_crystal
		required_missions = { BYZ_book_of_the_eparch }
		position = 12
		provinces_to_highlight = {
			OR = {
				AND = {
					province_id = 164
					OR = {
						NOT = { owned_by = ROOT }
						NOT = { has_production_building_trigger = yes }
						NOT = { has_shipyard_building_trigger = yes }
					}
				}
				AND = {
					province_id = 151
					OR = {
						NOT = { owned_by = ROOT }
						NOT = { has_production_building_trigger = yes }
					}
				}
			}
		}
		trigger = {
			164 = {
				owned_by = ROOT
				has_production_building_trigger = yes
				has_shipyard_building_trigger = yes
			}
			151 = {
				owned_by = ROOT 
				has_production_building_trigger = yes
			}
		}
		effect = {
			164 = {
				set_province_flag = BYZ_may_convert_to_glass
				province_event = { id = MEE_Byzantine_Events.23 }
			}
			
			custom_tooltip = " "
			
			custom_tooltip = BYZ_export_mosaicists
			tooltip = {
				if = {
					limit = {
						has_dlc = "Leviathan"
					}
					add_country_modifier = {
						name = BYZ_mosaicists_Leviathan
						duration = 3650
					}
				}
				else = {
					add_country_modifier = {
						name = BYZ_mosaicists
						duration = 3650
					}
				}
			}
			
			custom_tooltip = " "
			
			if = {
				limit = {
					has_dlc = "Emperor"
				}
				custom_tooltip = BYZ_buff_glass_privilege
			}
			else = {
				custom_tooltip = BYZ_buff_patronage_of_the_arts
			}
		}
	}
}

MEE_BYZ_economy_3 = {
	slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_city_of_worlds_desire = {
		icon = take_constantinople
		required_missions = { BYZ_tarnished_state }
		position = 10
		provinces_to_highlight = {
			OR = {
				higher_development_than = 151
				AND = {
					province_id = 151
					OR = {
						NOT = { owned_by = ROOT }
						NOT = { development = 40 }
						NOT = { has_tax_building_trigger = yes }
						NOT = { has_production_building_trigger = yes }
						NOT = { has_manpower_building_trigger = yes }
					}
				}
			}
		}
		trigger = {
			151 = {
				owned_by = ROOT
				development = 40
				has_tax_building_trigger = yes
				has_production_building_trigger = yes
				has_manpower_building_trigger = yes
				custom_trigger_tooltip = {
					tooltip = BYZ_most_developed_city_in_the_world
					NOT = {
						any_province = {
							higher_development_than = PREV
						}
					}
				}
			}
		}
		effect = {
			151 = {
				add_or_upgrade_tax_building = yes
				add_or_upgrade_production_building = yes
				add_or_upgrade_manpower_building = yes
				
				custom_tooltip = " "
				
				if = {
					limit = {
						has_dlc = "Leviathan"
					}
					add_province_modifier = {
						name = BYZ_queen_of_cities
						duration = -1
					}
				}
				else = {
					add_province_modifier = {
						name = BYZ_queen_of_cities_no_dlc
						duration = -1
					}
				}
			}
			
			if = {
				limit = {
					has_dlc = "Leviathan"
				}
				add_country_modifier = {
					name = BYZ_centralize_all_wealth
					duration = -1
				}
			}
			
			custom_tooltip = BYZ_unlock_bosphorus_toll_decision
			set_country_flag = BYZ_unlocked_bosphorus_toll
		}
	}
	
	BYZ_megalopolis = {
		icon = a_strong_government
		required_missions = { BYZ_city_of_worlds_desire }
		position = 11
		provinces_to_highlight = {
			province_id = 151
			OR = {
				NOT = { owned_by = ROOT }
				NOT = { development = 65 }
				NOT = { num_of_buildings_in_province = 10 }
				NOT = {
					AND = {
						has_dlc = "Leviathan"
						NOT = {
							has_great_project = {
								type = hagia_sophia 
								tier = 3
							}
						}
					}
				}
			}
		}
		trigger = {
			151 = {
				owned_by = ROOT
				development = 65
				num_of_buildings_in_province = 10
				if = {
					limit = {
						has_dlc = "Leviathan"
					}
					has_great_project = {
						type = hagia_sophia 
						tier = 3
					}
				}
			}
		}
		effect = {
			151 = {
				add_province_modifier = {
					name = BYZ_megalopolis_modifier_1
					duration = -1
				}
				hidden_effect = {
					add_province_triggered_modifier = BYZ_megalopolis_updater #hidden Ptm that updates the modifier
				}
			}
			
			custom_tooltip = BYZ_modifier_will_double
			
			custom_tooltip = " "
			
			add_country_modifier = {
				name = BYZ_monarch_reigns_in_byzantium
				duration = -1
			}
		}
	}
	
	BYZ_royal_purple = {
		icon = mission_pf_cross
		required_missions = { BYZ_book_of_the_eparch }
		position = 12
		provinces_to_highlight = {
			province_id = 146
			OR = {
				NOT = { owned_by = ROOT }
				NOT = { development = 25 }
				NOT = { has_production_building_trigger = yes }
				NOT = { has_trade_building_trigger = yes }
			}
		}
		trigger = {
			prestige = 50
			146 = {
				owned_by = ROOT 
				development = 25
				has_production_building_trigger = yes
				has_trade_building_trigger = yes
			}
		}
		effect = {
			if = {
				limit = {
					has_dlc = "Mandate of Heaven"
				}
				add_country_modifier = {
					name = BYZ_born_in_the_purple
					duration = 10950
				}
			}
			else = {
				add_country_modifier = {
					name = BYZ_born_in_the_purple_no_dlc
					duration = 10950
				}
			}
			
			146 = {
				set_province_flag = BYZ_may_convert_to_dyes
				province_event = { id = MEE_Byzantine_Events.23 }
			}
			
			custom_tooltip = " "
			
			country_event_with_insight = {
				id = MEE_Byzantine_Events.22
				insight_tooltip = BYZ_we_will_be_able_to_change_our_map_color
			}
		}
	}	
}

MEE_BYZ_economy_4 = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_promote_the_merchants = {
		icon = mission_conquer_riga
		required_missions = { }
		position = 10
		provinces_to_highlight = {
			province_id = 151
			OR = {
				NOT = { owned_by = ROOT }
				NOT = { has_trade_building_trigger = yes }
				NOT = { development = 25 }
				NOT = {
					trade_share = {
						country = ROOT
						share = 40
					}
				}
			}
		}
		trigger = {
			151 = {
				owned_by = ROOT
				has_trade_building_trigger = yes
				development = 25
				trade_share = {
					country = ROOT
					share = 40
				}
			}
		}
		effect = {
			151 = {
				add_or_upgrade_trade_building = yes
			
				custom_tooltip = " "
				
				add_trade_modifier = {
					who = ROOT
					duration = -1
					power = 50
					key = BYZ_megalopolitan_trade
				}
				
				custom_tooltip = " "
				
				add_province_modifier = {
					name = BYZ_primary_trade_capital
					duration = -1
				}
				
				set_center_level_2_center_of_trade = yes
			}
		}
	}
	
	BYZ_collect_our_profits = {
		icon = mission_african_gold
		required_missions = { BYZ_promote_the_merchants }
		position = 12
		provinces_to_highlight = {
		}
		trigger = {
			monthly_income = 50
			NOT = { inflation = 0.2 }
			NOT = { num_of_loans = 1 }
			home_trade_node = {
				trade_node_value = 25 
			}
		}
		effect = {
			country_event_with_option_insight = {
				id = MEE_Byzantine_Events.21
				option_1 = "
					custom_tooltip = BYZ_buff_private_trade_fleet
				"
				option_2 = "
					custom_tooltip = BYZ_buff_burgher_loans
				"
				option_3 = "
					custom_tooltip = BYZ_buff_free_enterprise
				"
			}
		}
	}
	
	BYZ_warehouse_of_the_east = {
		icon = saxon_manufacturing
		required_missions = { BYZ_collect_our_profits BYZ_royal_purple BYZ_wealth_from_the_east }
		position = 12
		provinces_to_highlight = {
			owned_by = ROOT 
			NOT = { has_manufactory_trigger = yes }
		}
		trigger = {
			num_of_owned_provinces_with = {
				has_manufactory_trigger = yes
				value = 50
			}
			home_trade_node = {
				trade_node_value = 100
				highest_value_trade_node = yes
			}
			
			monthly_income = 400 
		}
		effect = {
			add_country_modifier_for_age = {
				name = BYZ_economic_intimidation
				age = age_of_reformation
				else = "
					add_dip_power = 100
					add_years_of_income = 1
				"
			}
			
			# custom_tooltip = " "
			
			custom_tooltip = BYZ_naval_commander_advisor_buff #bound to mission_completed
			
			custom_tooltip = " "
			
			complex_dynamic_effect = {
				first_custom_tooltip = BYZ_if_we_have_taken_laesio_enormis
				first_limit = " has_reform = laesio_enormis_reform "
				first_effect = "
					change_government_reform_progress = 200
				"
			}
		}
	}
}

MEE_BYZ_economy_5 = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_peloponesian_renaissance = {
		icon = standardize_relazioni
		required_missions = { }
		position = 9
		provinces_to_highlight = {
			area = morea_area
		}
		trigger = {
			OR = {
				has_institution = renaissance
				development_in_provinces = {
					area = morea_area
					value = 30
				}
			}
		}
		effect = {
			define_advisor = {
				type = philosopher
				name = "Gemistos Plethon"
				skill = 2
				culture = greek
				religion = animism
				cost_multiplier = 0.25
			}
			
			custom_tooltip = " "
			
			complex_dynamic_effect = {
				first_custom_tooltip = BYZ_if_done_via_renaissance
				first_limit = "has_institution = renaissance"
				first_effect = "
					add_country_modifier = {
						name = BYZ_origins_of_renaissance
						duration = 3650
					}
				"
				second_custom_tooltip = BYZ_if_done_via_development
				second_limit = "
					development_in_provinces = {
						area = morea_area
						value = 30
					}
				"
				second_effect = "
					morea_area = {
						limit = {
							owned_by = ROOT
						}
						add_institution_embracement = {
							which = renaissance
							value = 90
						}
					}
				"
			}
		}
	}
	
	BYZ_monemvasian_merchants = {
		icon = aldine_press
		required_missions = { BYZ_peloponesian_renaissance }
		position = 10
		provinces_to_highlight = {
			province_id = 145
			OR = {
				NOT = { owned_by = ROOT }
				NOT = { num_of_times_improved = 7 }
				NOT = { has_trade_building_trigger = yes }
				AND = {
					NOT = { has_dock_building_trigger = yes }
					NOT = { has_shipyard_building_trigger = yes }
				}
			}
		}
		trigger = {
			145 = {
				owned_by = ROOT
				num_of_times_improved = 7
				has_trade_building_trigger = yes
				OR = {
					has_dock_building_trigger = yes
					has_shipyard_building_trigger = yes
				}
			}
		}
		effect = {
			145 = {
				center_of_trade = 1
				
				custom_tooltip = " "
				
				add_province_modifier = {
					name = BYZ_powerful_merchant_families
					duration = -1
				}
			}
			
			country_event_with_option_insight = {
				id = MEE_Byzantine_Events.19
				option_1 = "
					define_admiral = {
						shock = 2
						fire = 3
						manuever = 2
						siege = 0
						name = \"Loukas Notaras\"
					}
					custom_tooltip = \" \"
					add_navy_tradition = 20
				"
				option_2 = "
					add_years_of_trade_income = {
						years = 2
						custom_tooltip = BYZ_add_2_years_of_trade_income
					}
					custom_tooltip = \" \"
					define_advisor = {
						type = trader
						name = \"Notaras\"
						skill = 3
						culture = ROOT
						religion = ROOT
						cost_multiplier = 0.4 #so its slightly better than events
					}
				"
			}
		}
	}
	
	BYZ_thessaly = {
		icon = renaissance_city
		required_missions = { BYZ_promote_the_merchants }
		position = 11
		provinces_to_highlight = {
			province_id = 148
			OR = {
				NOT = { owned_by = ROOT }
				NOT = { has_trade_building_trigger = yes }
				NOT = { development = 25 }
				NOT = {
					trade_share = {
						country = ROOT
						share = 40
					}
				}
			}
		}
		trigger = {
			148 = {
				owned_by = ROOT
				has_trade_building_trigger = yes
				development = 25
				trade_share = {
					country = ROOT
					share = 40
				}
			}
		}
		effect = {
			148 = {
				add_or_upgrade_trade_building = yes
			
				custom_tooltip = " "
				
				add_trade_modifier = {
					who = ROOT
					duration = -1
					power = 50
					key = BYZ_trade_in_thessaloniki
				}
				
				custom_tooltip = " "
				
				add_province_modifier = {
					name = BYZ_secondary_trade_capital
					duration = -1
				}
			}
			
			complex_dynamic_effect = {
				first_custom_tooltip = BYZ_if_constantinople_is_world_port
				first_limit = "
					151 = {
						owned_by = ROOT
						province_has_center_of_trade_of_level = 3
					}
				"
				first_effect = "
					148 = {
						add_center_of_trade_level = 3 # max
					}
				"
			}
		}
	}
	
	BYZ_wealth_from_the_east = {
		icon = mission_pol_breadbasket_europe
		required_missions = { BYZ_thessaly }
		position = 12
		provinces_to_highlight = {
			OR = {
				province_id = 1320
				province_id = 377
				province_id = 358
			}
			NOT = {
				trade_share = {
					country = ROOT
					share = 80
				}
			}
		}
		trigger = {
			1320 = { #constantinople
				trade_share = {
					country = ROOT
					share = 80
				}
			}
			377 = { #aleppo
				trade_share = {
					country = ROOT
					share = 80
				}
			}
			358 = { #Alexandria
				trade_share = {
					country = ROOT
					share = 80
				}
			}
			
			num_of_centers_of_trade = 20
		}
		effect = {
			hidden_effect = {
				unlock_estate_privilege = {
					estate_privilege = estate_burghers_BYZ_single_market
				}
			}
			custom_tooltip = BYZ_unlock_mercantilism_privilege
			
			custom_tooltip = " "
			
			add_mercantilism = 3 
			
			custom_tooltip = " "

			
			custom_tooltip = BYZ_distribute_0_10_0_dev_in_manufactories
			hidden_effect = {
				random_owned_province = {
					limit = {
						has_manufactory_no_custom_tooltip_trigger = yes
					}
					add_base_production = 1
					type = random
					amount = 10
				}
			}
		}
	}
}

MEE_BYZ_religion_1 = {
	slot = 1
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_church_in_distress = {
		icon = guardians_of_saint_sava
		required_missions = { }
		position = 13
		provinces_to_highlight = {
		}
		trigger = {
			BYZ_is_not_latin_empire = yes
			if = {
				limit = {
					has_estate = estate_church
				}
				OR = {
					estate_loyalty = {
						estate = estate_church
						loyalty = 70
					}
					num_of_estate_privileges = {
						estate = estate_church
						value = 4
					}
				}
			}
			if = {
				limit = {
					has_dlc = "Third Rome"
				}
				has_orthodox_religious_icon_trigger = yes
			}
			else = {
				patriarch_authority = 20
			}
		}
		effect = {
			add_country_modifier = { 
				name = BYZ_restoring_faith_in_the_monarchs
				duration = 7300
			}
			
			if = {
				limit = {
					has_dlc = "Third Rome"
				}
				custom_tooltip = BYZ_double_current_icon
				hidden_effect = {
					if = {
						limit = {
							current_icon = icon_eleusa
						}
						add_country_modifier = {
							name = BYZ_icon_eleusa
							duration = 5475
						}
					}
					else_if = {
						limit = {
							current_icon = icon_pancreator
						}
						add_country_modifier = {
							name = BYZ_icon_pancreator
							duration = 5475
						}
					}
					else_if = {
						limit = {
							current_icon = icon_nicholas
						}
						add_country_modifier = {
							name = BYZ_icon_nicholas
							duration = 5475
						}
					}
					else_if = {
						limit = {
							current_icon = icon_climacus
						}
						add_country_modifier = {
							name = BYZ_icon_climacus
							duration = 5475
						}
					}
					else_if = {
						limit = {
							current_icon = icon_michael
						}
						add_country_modifier = {
							name = BYZ_icon_michael
							duration = 5475
						}
					}
					else = { }
				}
			}
			else = {
				define_advisor = {
					type = theologian
					skill = 3
					culture = ROOT
					religion = ROOT
					cost_multiplier = 0.4 #so it's slightly better than event-based advisors.
				}
			}
			
			custom_tooltip = " "
			
			complex_dynamic_effect = {
				first_custom_tooltip = BYZ_if_we_have_religious_culture_privilege
				first_limit = "
					has_estate_privilege = estate_church_one_faith_one_culture
				"
				first_effect = "
					change_estate_land_share = {
						estate = estate_church
						share = -5
					}
				"
			}
		}
	}
	
	BYZ_muscovite_autocephaly = {
		icon = promote_the_patriarchate
		required_missions = { BYZ_church_in_distress }
		position = 15
		provinces_to_highlight = {
			if = {
				limit = {
					exists = RUS
				}
				owned_by = RUS
			}
			else_if = {
				limit = {
					exists = MOS
					MOS = {
						total_development = NOV
					}
				}
				owned_by = MOS
			}
			else_if = {
				limit = {
					exists = NOV
					NOV = {
						total_development = MOS
					}
				}
				owned_by = NOV
			}
			else = {
				always = no
			}
		}
		trigger = {
			BYZ_is_not_latin_empire = yes
			if = {
				limit = {
					exists = RUS
				}
				OR = {
					alliance_with = RUS
					has_won_war_against = {
						who = RUS
						max_years_since = 20
					}
					total_development = RUS
				}
			}
			else_if = {
				limit = {
					exists = MOS
					MOS = {
						total_development = NOV
					}
				}
				OR = {
					alliance_with = MOS
					has_won_war_against = {
						who = MOS
						max_years_since = 20
					}
					total_development = MOS
				}
			}
			else_if = {
				limit = {
					exists = NOV
					NOV = {
						total_development = MOS
					}
				}
				OR = {
					alliance_with = NOV
					has_won_war_against = {
						who = NOV
						max_years_since = 20
					}
					total_development = NOV
				}
			}
			else = { #Fallback.
				is_defender_of_faith = yes
				total_development = 500 
			}
		}
		effect = {
			country_event_with_effect_insight = {
				id = MEE_Byzantine_Events.16
				effect = "
					custom_tooltip = BYZ_every_orthodox_country_clerical_buff
					custom_tooltip = \" \"
					add_patriarch_authority = 0.25
					custom_tooltip = \" \"
					custom_tooltip = BYZ_countries_will_like_us_more
					custom_tooltip = \" \"
					custom_tooltip = BYZ_diplo_annexing_orthodox_countries
				"
			}
		}
	}
	
	BYZ_mend_the_schism = {
		icon = show_piety
		required_missions = { BYZ_muscovite_autocephaly BYZ_pentarchy }
		position = 17
		provinces_to_highlight = {
			OR = {
				province_id = 118
				and = {
					is_sea = no
					not = { religion = root }
					not = { owner = { religion = root } }
					continent = europe
				}
			}
		}
		trigger = {
			BYZ_is_not_latin_empire = yes
			118 = {
				owned_by = ROOT
			}
			#check_variable = {
			#	which = Byz_number_of_catholic_provinces_converted
			#	value = 75
			#}
			calc_true_if = {
				europe = {
					religion = root
					owner = { religion = root }
					type = all
				}
				amount = 300
			}
			
			total_development = 1000
		}
		effect = {
			country_event_with_effect_insight = {
				id = MEE_Byzantine_Events.48
				effect = "
					if = { limit = { religion = orthodox }
						add_patriarch_authority = 0.2
						custom_tooltip = \" \"
					}
					add_country_modifier = {
						name = conversion_of_rome
						duration = 7300
					}
					custom_tooltip = \" \"
					define_advisor = {
						type = theologian skill = 3 culture = umbrian religion = ROOT cost_multiplier = 0.25
					}
					if = { limit = { religion = orthodox }
						custom_tooltip = \" \"
						custom_tooltip = BYZ_every_catholic
					}
				"
				#Yes, I had trouble fitting it in, sorry!
			}
		}
	}
}

MEE_BYZ_religion_2 = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_church_authority = {
		icon = protectors_of_christendom
		required_missions = { BYZ_church_in_distress }
		position = 14
		provinces_to_highlight = {
			is_capital_of = ROOT
			NOT = { has_tax_building_trigger = yes }
		}
		trigger = {
			BYZ_is_not_latin_empire = yes
			NOT = { has_estate_privilege = estate_church_union_of_the_churches }
			patriarch_authority = 0.5
			capital_scope = {
				has_tax_building_trigger = yes
			}
		}
		effect = {
			custom_tooltip = BYZ_enable_privilege_support_of_dynasty
			set_country_flag = BYZ_privilege_for_support_of_dynasty
			
			custom_tooltip = " "
			
			capital_scope = {
				add_or_upgrade_tax_building = yes
			}
			
			if = {
				limit = {
					has_estate = estate_church
				}
				custom_tooltip = " "
				add_estate_loyalty = {
					estate = estate_church
					loyalty = 15
				}
			}
			
			if = {
				limit = { has_reform = byzantine_autocracy_reform }
				custom_tooltip = " "
				add_government_reform = reformed_byzantine_monarchy_reform
			}
		}
	}
	
	BYZ_new_synods = {
		icon = law_of_the_pious
		required_missions = { BYZ_church_authority }
		position = 15
		provinces_to_highlight = {
			owned_by = ROOT
			NOT = { has_tax_building_trigger = yes }
		}
		trigger = {
			BYZ_is_not_latin_empire = yes
			num_of_owned_provinces_with = {
				has_tax_building_trigger = yes
				value = 8
			}
			OR = {
				inquisitor = 2
				theologian = 2 
				has_adm_advisor_3 = yes
			}
			patriarch_authority = 0.8
			if = {
				limit = {
					has_estate = estate_church
				}
				estate_loyalty = { 
					estate = estate_church
					loyalty = 80
				}
			}
		}
		effect = {
			custom_tooltip = BYZ_upgrade_the_religious_state_estate_privilege
			set_country_flag = BYZ_upgrade_the_religious_state_estate_privilege_flag
			
			custom_tooltip = " "
			
			add_stability_or_adm_power = yes
		}
	}
	
	BYZ_pentarchy = {
		icon = mission_autocephalous_archbishopric
		required_missions = { BYZ_new_synods }
		position = 15
		provinces_to_highlight = {
			OR = {
				province_id = 151
				province_id = 2313
				province_id = 379
				province_id = 358
				province_id = 118
			}
			OR = {
				NOT = { development = 30 }
				NOT = { has_tax_building_trigger = yes }
				NOT = { owned_by = ROOT }
			}
		}
		trigger = {
			BYZ_is_not_latin_empire = yes
			151 = {
				development = 30
				has_tax_building_trigger = yes
				owned_by = ROOT
			}
			2313 = {
				development = 30
				has_tax_building_trigger = yes
				owned_by = ROOT
			}
			379 = {
				development = 30
				has_tax_building_trigger = yes
				owned_by = ROOT
			}
			358 = {
				development = 30
				has_tax_building_trigger = yes
				owned_by = ROOT
			}
			118 = {
				development = 30
				has_tax_building_trigger = yes
				owned_by = ROOT
			}
			
			patriarch_authority = 0.9
		}
		effect = {
			country_event_with_effect_insight = {
				id = MEE_Byzantine_Events.17
				effect = "
					tooltip = {
						151 = { add_province_triggered_modifier = BYZ_seat_of_a_patriarch }
						custom_tooltip = BYZ_other_provinces_will_also_receive_this_modifier
					}
					
					custom_tooltip = \" \"
					
					custom_tooltip = BYZ_enable_the_hold_ecumenical_council_decision
				"
			}
			country_event_with_effect_insight = {
				id = catholic_flavor.3
				effect = "
					add_prestige = 25
					add_legitimacy = 25
					set_religion_papacy_active = {
						religion = catholic
						active = no
					}
				"
			}
		}
	}
}

MEE_BYZ_military_3 = {
	slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_restore_navy = {
		icon = expand_the_arsenal
		required_missions = { BYZ_theme_system }
		position = 15
		provinces_to_highlight = {
		}
		trigger = {
			NOT = { has_estate_privilege = estate_burghers_reliance_on_republics }
			navy_size = 40
		}
		effect = {		
			create_admiral = { tradition = 60 }
			
			custom_tooltip = " "
			
			add_country_modifier = {
				name = BYZ_indepenence_from_the_west
				duration = 7300
			}
		}
	}
	
	BYZ_greek_fire = {
		icon = byz_greek_fire
		required_missions = { BYZ_restore_navy }
		position = 16
		provinces_to_highlight = {
		}
		trigger = {
			if = {
				limit = {
					has_dlc = "Rule Britannia"
				}
				OR = {
					navy_tradition = 60
					innovativeness = 40
				}
			}
			else = {
				navy_tradition = 60
			}
			OR = {
				has_dip_advisor_3 = yes
				naval_reformer = 1
			}
			
			num_of_galley = 50 
		}
		effect = {
			add_country_modifier = {
				name = BYZ_liquid_fire
				duration = -1
			}
			
			complex_dynamic_effect = {
				first_custom_tooltip = BYZ_if_we_have_the_largest_navy_in_the_world
				first_limit = "
					NOT = {
						any_country = {
							navy_size = ROOT
						}
					}
				"
				first_effect = "
					add_country_modifier = {
						name = BYZ_dominance_of_the_dromon
						duration = 7300 
					}
				"
			} 
		}
	}
}

MEE_BYZ_military_4 = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_theme_system = {
		icon = mission_pf_soldier
		required_missions = { }
		position = 14
		provinces_to_highlight = {
		}
		trigger = {
			army_size = 25
			OR = {
				manpower = 20 
				manpower_percentage = 0.8
			}
			has_mil_advisor_2 = yes
			grown_by_states = 10
		}
		effect = {
			add_mil_power = 150
			
			custom_tooltip = " "
			enable_branching_mission_review = {
				key = BYZ
				ai_event_id = MEE_Byzantine_Events.28
			}
			custom_tooltip = " "
			
			country_event_with_insight = {
				id = MEE_Byzantine_Events.27
				insight_tooltip = BYZ_unlock_theme_system_reform
			}
		}
	}
}

MEE_BYZ_military_branching_4 = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		NOT = {
			OR = {
				has_country_flag = BYZ_decentralized
				has_country_flag = BYZ_centralized
			}
		}
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_branching_top_left = {
		icon = mission_unknown_mission
		required_missions = { BYZ_theme_system }
		position = 15
		provinces_to_highlight = {
		}
		trigger = {
			BYZ_branch_trigger = yes
		}
		effect = {
			BYZ_branch_effect = yes
		}
	}
}

MEE_BYZ_military_decentralized_4 = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		has_country_flag = BYZ_decentralized
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_foreign_officers = {
		icon = shift_the_balance
		required_missions = { BYZ_theme_system }
		position = 15
		provinces_to_highlight = {
		}
		trigger = {
			not_in_mission_preview_mode = { key = BYZ }
			num_of_allies = 2 
			num_of_mercenaries = 30
			has_mil_advisor_3 = yes
		}
		effect = {
			custom_tooltip = BYZ_get_army_organizer
			hidden_effect = {
				country_event = { id = MEE_Byzantine_Events.58 } # Executes the below effect without event target not being set
				
				# random_ally = {
					# save_event_target_as = byzantium_temp_target
				# }
				# every_ally = {
					# limit = {
						# total_development = event_target:byzantium_temp_target
					# }
					# save_event_target_as = byzantium_temp_target
				# }
				# define_advisor = {
					# type = army_organiser
					# cost_multiplier = 0.4
					# skill = 2
					# culture = event_target:byzantium_temp_target
					# religion = event_target:byzantium_temp_target
				# }
			}
			
			custom_tooltip = " "
			
			add_mil_power = 100
			
			custom_tooltip = " "
			
			if = {
				limit = {
					has_dlc = "Cradle of Civilization"
				}
				add_army_professionalism = 0.05
			}
			else = {
				add_army_tradition_or_mil_power = { amount = 10 }
			}
			
			custom_tooltip = " "
			
			custom_tooltip = BYZ_army_organizer #handled by mission_completed
		}
	}
}

MEE_BYZ_military_centralized_4 = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		has_country_flag = BYZ_centralized
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_varangian_guard = {
		icon = mission_the_varangians
		required_missions = { BYZ_theme_system }
		position = 15
		provinces_to_highlight = {
		}
		trigger = {
			not_in_mission_preview_mode = { key = BYZ }
			army_tradition = 60 
			has_mil_advisor_3 = yes
			capital_scope = {
				has_manpower_building_trigger = yes
			}
		}
		effect = {
			custom_tooltip = BYZ_enable_the_varangian_guard_mercenary_company #handled by mission_completed
			
			custom_tooltip = " "
			
			add_country_modifier = {
				name = BYZ_elite_forces
				duration = 7300 
			}
		}
	}
}

MEE_BYZ_military_branching_5 = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		NOT = {
			OR = {
				has_country_flag = BYZ_decentralized
				has_country_flag = BYZ_centralized
			}
		}
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_branching_top_right = {
		icon = mission_unknown_mission
		required_missions = { BYZ_theme_system }
		position = 15
		provinces_to_highlight = {
		}
		trigger = {
			BYZ_branch_trigger = yes
		}
		effect = {
			BYZ_branch_effect = yes
		}
	}
	
	BYZ_branching_bottom = {
		icon = mission_unknown_mission
		required_missions = { BYZ_branching_top_left BYZ_branching_top_right }
		position = 16
		provinces_to_highlight = {
		}
		trigger = {
			BYZ_branch_trigger = yes
		}
		effect = {		
			BYZ_branch_effect = yes
		}
	}
}

MEE_BYZ_military_decentralized_5 = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		has_country_flag = BYZ_decentralized
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_decentralized_pronoia = {
		icon = geneva_conventions
		required_missions = { BYZ_theme_system }
		position = 15
		provinces_to_highlight = {
			owner = {
				is_subject_of = ROOT
				OR = {
					is_subject_of_type = hereditary_pronoia_subject_type
					is_subject_of_type = pronoia_subject_type
				}
				liberty_desire = 5
			}
		}
		trigger = {
			not_in_mission_preview_mode = { key = BYZ }
			calc_true_if = {
				all_subject_country = {
					OR = {
						is_subject_of_type = hereditary_pronoia_subject_type
						is_subject_of_type = pronoia_subject_type
					}
					NOT = { liberty_desire = 5 }
				}
				amount = 2
			}
			OR = {
				num_of_generals = 6
				crown_land_share = 50
			}
		}
		effect = {
			add_country_modifier = {
				name = BYZ_reliance_on_the_pronoiar
				duration = -1
			}
			
			country_event_with_option_insight = { 
				id = MEE_Byzantine_Events.29
				
				option_1 = "
					custom_tooltip = BYZ_upgrade_the_reliance_on_the_pronoiar
				"
				option_2 = "
					custom_tooltip = BYZ_pronoia_subject_no_longer_reduces_forcelimit
				"
				option_3 = "
					custom_tooltip = BYZ_pronoia_extra_forcelimit
				"
			}
		}
	}
	
	BYZ_strategoi_realms = {
		icon = moravian_arms
		required_missions = { BYZ_decentralized_pronoia BYZ_foreign_officers }
		position = 16
		provinces_to_highlight = {
		}
		trigger = {
			not_in_mission_preview_mode = { key = BYZ }
			calc_true_if = {
				all_subject_country = {
					OR = {
						is_subject_of_type = hereditary_pronoia_subject_type
						is_subject_of_type = pronoia_subject_type
					}
					NOT = { liberty_desire = 5 }
					army_size = 20
				}
				amount = 4
			}
			num_of_generals = 7
			
			if = {
				limit = { 
					has_estate = estate_nobles
				}
				estate_loyalty = {
					estate = estate_nobles
					loyalty = 60
				}
			}
			num_of_owned_provinces_with = {
				has_manpower_building_trigger = yes
				value = 20
			}
		}
		effect = {
			custom_tooltip = BYZ_pronoia_buff_army_tradition
			
			custom_tooltip = " "
			
			add_country_modifier = {
				name = BYZ_regional_mercenary_forces
				duration = -1
			}
		}
	}
}

MEE_BYZ_military_centralized_5 = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = BYZ
			AND = {
				was_tag = BYZ
				tag = ROM
			}
			AND = {
				tag = LAE
				has_country_flag = has_byz_missions
			}
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
		has_country_flag = BYZ_centralized
		started_in = 1204.1.1
	}
	has_country_shield = yes
	
	BYZ_centralized_pronoia = {
		icon = reissue_the_mining_code
		required_missions = { BYZ_theme_system }
		position = 15
		provinces_to_highlight = {
			owner = {
				is_subject_of = ROOT
				OR = {
					is_subject_of_type = hereditary_pronoia_subject_type
					is_subject_of_type = pronoia_subject_type
				}
				liberty_desire = 5
			}
		}
		trigger = {
			not_in_mission_preview_mode = { key = BYZ }
			calc_true_if = {
				all_subject_country = {
					OR = {
						is_subject_of_type = hereditary_pronoia_subject_type
						is_subject_of_type = pronoia_subject_type
					}
					NOT = { liberty_desire = 5 }
				}
				amount = 2
			}
			OR = {
				num_of_generals = 6
				crown_land_share = 50
			}
		}
		effect = {
			change_government_reform_progress = 100 
			
			custom_tooltip = " "
			
			country_event_with_option_insight = { 
				id = MEE_Byzantine_Events.30
				option_1 = "
					custom_tooltip = BYZ_pronoiars_will_be_hereditary_by_default
				"
				option_2 = "
					custom_tooltip = BYZ_inheriting_pronoia_will_now_give_5_crownland
				"
				option_3 = "
					custom_tooltip = BYZ_pronoia_subjects_get_3_yearly_army_tradition
				"
				option_4 = "
					custom_tooltip = BYZ_pronoia_will_get_5_discipline
				"
			}
		}
	}
	
	BYZ_reform_the_themata = {
		icon = fight_bosnian_heresies
		required_missions = { BYZ_centralized_pronoia BYZ_varangian_guard }
		position = 16
		provinces_to_highlight = {
			owned_by = ROOT
			NOT = { is_state = yes }
		}
		trigger = {
			not_in_mission_preview_mode = { key = BYZ }
			
			army_size = 200 
			num_of_states = 35 
			manpower = 100
			if = {
				limit = { 
					has_estate = estate_nobles
				}
				estate_loyalty = {
					estate = estate_nobles
					loyalty = 60
				}
			}
			num_of_owned_provinces_with = {
				has_manpower_building_trigger = yes
				value = 20
			}
		}
		effect = {
			custom_tooltip = BYZ_for_every_province_with_courthouse
			hidden_effect = {
				if = {
					limit = {
						num_of_owned_provinces_with = {
							has_courthouse_building_trigger = yes
							value = 25
						}
					}
					change_government_reform_progress = 100
				}
				else = {
					every_owned_province = {
						limit = {
							has_courthouse_building_trigger = yes
						}
						ROOT = { change_government_reform_progress = 4 }
					}
				}
			}
			
			custom_tooltip = " "
		
			add_country_modifier = {
				name = BYZ_professional_themata_soldiers
				duration = -1
			}
		}
	}
}