#Written by Dub
#I split it all up from a single event namespace in order to more easily rearrange things so that they fit in order. This is why some numbers are missing and such. //Dub
#I think it's funny to look at it now, considering I removed most things I once had in this mod since I deemed them too "not EU4". Probably wrote a good 50 or so other events that are now put elsewhere. Oh well.
namespace = resurgent_BYZ


country_event = { #1 Mending the East-Oriental schism
	id = resurgent_BYZ.1
	title = "resurgent_BYZ.1.t" 
	desc = "resurgent_BYZ.1.d"
	picture = ORTHODOX_eventPicture
	
	major = yes
	
	fire_only_once = yes
	
	is_triggered_only = yes
	
	trigger = {
		religion = orthodox
	}
	
	option = { #The wound has finally been healed!
		name = "resurgent_BYZ.1.a"
		add_prestige = 25
		add_legitimacy = 25
	}
}

country_event = { #2 The Genoese Merchants
	id = resurgent_BYZ.2
	title = "resurgent_BYZ.2.t" 
	desc = "resurgent_BYZ.2.d"
	picture = BURGHER_ESTATE_eventPicture
	
	major = yes
	
	fire_only_once = yes
	
	trigger = {
		tag = BYZ
		exists = GEN
		GEN = { 
			capital_scope = {
				region = italy_region
			}
			ai = yes
		}
		capital_scope = {
			is_strongest_trade_power = ROOT
		}
		OR = {
			NOT = {
				military_strength = {
					who = GEN
					value = 3.0
				}
			}
			alliance_with = GEN
		}
		has_opinion = {
			who = GEN
			value = 150
		}
		any_province = {
			OR = {
				region = balkan_region
				region = anatolia_region
				area = erzurum_area
				area = crimea_area
				province_id = 286
				province_id = 2447
			}
			owned_by = GEN
		}
	}
	
	mean_time_to_happen = {
		months = 60
	}
	
	option = { #Sign the treaty!
		name = "resurgent_BYZ.2.a"
		capital_scope = {
            add_trade_modifier = {
                who = GEN
                duration = -1
                power = 200
                key = granted_black_sea_trade_privileges
            }
        }
		add_mercantilism = 1
		add_country_modifier = {
			name = "byz_genoese_merchants"
			duration = -1
		}
		GEN = {
			add_opinion = {
				who = BYZ 
				modifier = byz_granted_trade
			}
		}
		every_province = {
			limit = {
				owned_by = GEN
				OR = {
					#Greece-Anatolia
					region = balkan_region
					region = anatolia_region
					area = erzurum_area
					#Cherson
					area = crimea_area
					province_id = 286
					province_id = 2447
				}
			}
			remove_core = GEN
			add_core = BYZ
			cede_province = BYZ
		}
		#I cannot see why I set this flag to begin with, so I remove it and hope nothing breaks.
		#set_global_flag = byz_granted_genoese_trade_privileges_black_sea
		
		ai_chance = {
			factor = 33
		} #The Byzantines did not look down all too much on the Genoese, actually
	}
	option = { #Deny the Genoese
		name = "resurgent_BYZ.2.b"
		GEN = {
			add_opinion = {
				who = BYZ
				modifier = byz_denied_trade
			}
		}
		#I cannot see why I set this flag to begin with, so I remove it and hope nothing breaks.
		#set_global_flag = byz_denied_genoese_trade_privilegies_black_sea
		
		ai_chance = {
			factor = 66
			modifier = {
				factor = 2
				NOT = { trade_income_percentage = 0.25 }
			} #Low trade income may influence the Basileus
			modifier = {
				factor = 4
				NOT = { trade_income_percentage = 0.15 }
			} #Low trade income may influence the Basileus
			modifier = {
				factor = 6
				NOT = { trade_income_percentage = 0.05 }
			} #Low trade income may influence the Basileus
		}
	}
}

country_event = { #3 The Cimmerian Bosporus
	id = resurgent_BYZ.3
	title = "resurgent_BYZ.3.t" 
	desc = "resurgent_BYZ.3.d"
	picture = SHIP_SAILING_eventPicture
		
	immediate = {
		hidden_effect = {
			save_event_target_as = cimmerian_bosporus_owner
			set_country_flag = had_cimmerian_bosporus_event
		}
	}
	
	trigger = {
		owns = 3245
		owns = 2447
		2447 = {
			is_strongest_trade_power = ROOT
			NOT = { has_province_modifier = cimmerian_bosporus_sound_toll }
		}
		NOT = { has_country_flag = had_cimmerian_bosporus_event }
	}
	
	mean_time_to_happen = {
		months = 6
	}
	
	option = { #Let's use this to our advantage!
		name = "resurgent_BYZ.3.a"
		2447 = {
			add_permanent_province_modifier = {
				name = "cimmerian_bosporus_sound_toll"
				duration = -1
			}
		}
		1322 = {
			every_trade_node_member_country = {
				add_opinion = { 
					who = event_target:cimmerian_bosporus_owner
					modifier = byz_established_sound_toll 
				}
			}
		}
		add_mercantilism = 1
		
		ai_chance = {
			factor = 90
		}
	}
	option = { #Let's not
		name = "resurgent_BYZ.3.b"
		add_prestige = -5
		ai_chance = {
			factor = 10
		}
	}
}

country_event = { #4 The reintroduction of the Cataphract
	id = resurgent_BYZ.4
	title = "resurgent_BYZ.4.t"
	desc = "resurgent_BYZ.4.d"
	picture = CATAPHRACT_BATTLE_eventPicture

	fire_only_once = yes

	trigger = {
		tag = BYZ
		is_free_or_tributary_trigger = yes
		OR = {
			MIL = 5
			consort_mil = 5
		}
		army_tradition = 75
		cavalry_fraction = 0.05 #Changing this yet again - You simply need to have some amount of cav in your army for this to be applicable. The other conditions are hard enough as is.
		#It's really funny actually, because I would hope this fraction would exclude the amount of artillery you have, meaning I could put something like 0.3. 
		#Basically there'd be no way to get this event late-game then if you don't use a LOT of cavalry. Example army stacks of 20/6/20, which are cav-heavy already, wouldn't do as that would be less than 15% (6/46)
	}

	mean_time_to_happen = {
		years = 50
		modifier = {
			factor = 0.75
			MIL = 6
		}
	}


	option = {	#Bring back the Cataphract!
		name = "resurgent_BYZ.4.a"
		ai_chance = { factor = 80 }
		add_country_modifier = {
			name = byz_cataphracts
			duration = -1
		}
	}
	option = {	#Focus efforts on the rest of the army instead
		name = "resurgent_BYZ.4.b"
		ai_chance = { factor = 20 }
		add_mil_power = 100
	}
}

province_event = { #5 The Restoration of Constantinopolitan Manufactories
	id = resurgent_BYZ.5
	title = "resurgent_BYZ.5.t"
	desc = "resurgent_BYZ.5.d"
	picture = CONSTANTINOPLE_eventPicture

	fire_only_once = yes

	major = yes
	
	trigger = {
		has_global_flag = constantinople_restored
		province_id = 151
		NOT = { trade_goods = gems } #If has Faceting event, abort.
		religion = ROOT
		culture = greek
		owner = {
			tag = BYZ
		}
	}

	mean_time_to_happen = {
		years = 10
	}


	option = {	#Favor the glassmakers!
		name = "resurgent_BYZ.5.a"
		ai_chance = { factor = 75 }
		
		if = {
			limit = {
				NOT = {
					renaissance = 100
				}
			}
			add_institution_embracement = {
				which = renaissance
				value = 100
			}
		}
		change_trade_goods = glass
		change_price = {
			trade_goods = glass
			key = byz_byzantine_glass
			value = 0.15
			duration = -1
		}
		
	}
	option = {	#Let's reintroduce the Byzantine Silk!
		name = "resurgent_BYZ.5.b"
		ai_chance = { factor = 25 }
		
		
		if = {
			limit = {
				NOT = {
					renaissance = 100
				}
			}
			add_institution_embracement = {
				which = renaissance
				value = 100
			}
			
		}
		change_trade_goods = silk
		change_price = {
			trade_goods = silk
			key = byz_byzantine_silk
			value = 0.1
			duration = -1
		}
		#To allow the re-establishment of Tyrian Purple production event in Colophon, which lies in the Smyrna province.
		set_global_flag = byz_byzantine_silk_restored
	}
}

country_event = { #6 Rebuilding the Great Palace
	id = resurgent_BYZ.6
	title = "resurgent_BYZ.6.t"
	desc = "resurgent_BYZ.6.d"
	picture = CONSTANTINOPLE_eventPicture

	fire_only_once = yes

	trigger = {
		has_global_flag = constantinople_restored
		tag = BYZ
		capital = 151
		is_year = 1500
	}

	mean_time_to_happen = {
		years = 100
		modifier = {
			factor = 0.9
			is_at_war = no
		}
		modifier = {
			factor = 0.8
			ADM = 5
		}
		modifier = {
			factor = 0.8
			ADM = 6
		}
		modifier = {
			factor = 0.5
			151 = {
				OR = {
					has_province_modifier = byz_hippodrome_restored 
					has_province_flag = byz_hippodrome_foundation
					AND = {
						has_dlc = "Leviathan"
						has_great_project = {
							type = hippodrome_of_constantinople
							tier = 1
						}
					}
				}
			}
		}
	}


	option = {	#Rebuild the Great Palace!
		name = "resurgent_BYZ.6.a"
		ai_chance = { factor = 75 }
		
		add_years_of_income = -1.0
		add_prestige = 20
		add_legitimacy = 20
		151 = {
			add_base_tax = 2
			add_base_production = 2
			add_province_modifier = {
				name = "byz_rebuilt_great_palace"
				duration = -1
			}
		}
	}
	option = {	#Continue using the Blachernae palace
		name = "resurgent_BYZ.6.b"
		ai_chance = { factor = 25 }
		
		add_prestige = -5
	}
}

country_event = { #7 The Loss of Constantinople
	id = resurgent_BYZ.7
	title = "resurgent_BYZ.7.t"
	desc = "resurgent_BYZ.7.d"
	picture = COUNTRY_COLLAPSE_eventPicture

	major = yes
	
	fire_only_once = yes

	trigger = {
		tag = BYZ
		151 = {
			NOT = { owned_by = ROOT }
		}
		NOT = { is_year = 1500 }
		NOT = { is_at_war = yes } #Because it introduced an edge-case bug where if any of their vassals declared independence while they lost Constantinople, the vassal could not demand land in peace deal.
		NOT = { exists = MOE }
	}

	mean_time_to_happen = {
		days = 7
	}


	option = {	#We'll rule from Mystras instead, waiting for our time to strike... or our doom.
		name = "resurgent_BYZ.7.a"
		trigger = {
			owns = 145
		}
		
		set_government_rank = 1
		add_prestige = -100
		change_tag = MOE
		hidden_effect = { #To prevent OPM Morea on Lemnos
			add_historical_rival = TUR
			TUR = {
				add_historical_rival = ROOT
			}
		}
		145 = { move_capital_effect = yes }
		every_country = {
			limit = {
				vassal_of = ROOT
			}
			grant_independence = yes
			create_alliance = ROOT #To simulate some sort of common enemy in the Ottomans
		}
		if = { #Special-case for Trebizond players to get a permaclaim on Constantinople, now that their PU is invalid.
			limit = {
				TRE = {
					mission_completed = tre_marry_into_palaiologos
				}
			}
			151 = {
				add_permanent_claim = TRE
			}
		}
	}
	
	option = {	#We'll rule from [Root.Capital.GetName] instead, waiting for our time to strike... or our doom.
		name = "resurgent_BYZ.7.b"
		trigger = { #In case Ottomans took Mystras as well
			NOT = {
				owns = 145
			}
		}
		
		set_government_rank = 1
		add_prestige = -100
		change_tag = MOE
		hidden_effect = { #To prevent OPM Morea on Lemnos
			add_historical_rival = TUR
			TUR = {
				add_historical_rival = ROOT
			}
		}
		every_country = {
			limit = {
				vassal_of = ROOT
			}
			grant_independence = yes
			create_alliance = ROOT #To simulate some sort of common enemy in the Ottomans
		}
	}
	
	option = {	#Jake, fix your game!
		name = "resurgent_BYZ.7.c"
		trigger = { #Apparently this event can fire if you still own Constantinople, so this fixes that.
			owns = 151
		}
		highlight = yes
		
		custom_tooltip = resurgent_BYZ.7.c_tooltip
	}
}

province_event = { #8 Reestablishing the Tyrian Purple
	id = resurgent_BYZ.8
	title = "resurgent_BYZ.8.t"
	desc = "resurgent_BYZ.8.d"
	picture = TRADEGOODS_eventPicture

	fire_only_once = yes

	major = yes
	
	trigger = {
		has_global_flag = byz_byzantine_silk_restored
		province_id = 318 #Smyrna
		religion = ROOT
		owner = {
			tag = BYZ
		}
	}

	mean_time_to_happen = {
		years = 5
	}
	
	option = {	#Settle the land to bring back the Tyrian Purple!
		name = "resurgent_BYZ.8.a"
		ai_chance = { factor = 75 }
		
		owner = {
			add_years_of_income = -1
			add_adm_power = -100
			add_dip_power = -100
		}
		add_base_tax = 4
		add_base_production = 4
		add_or_spawn_center_of_trade = { level = 1 } #Change level of center of trade
		change_culture = greek
		if = {
			limit = {
				NOT = {
					renaissance = 100
				}
			}
			add_institution_embracement = {
				which = renaissance
				value = 100
			}
			
		}
		change_trade_goods = dyes
		change_price = {
			trade_goods = dyes
			key = byz_tyrian_purple
			value = 0.25
			duration = -1
		}
		change_price = { #Silk is good with Tyrian Purple!
			trade_goods = silk
			key = byz_tyrian_purple
			value = 0.15
			duration = -1
		}
		#To allow the expansion of the Tyrian Purple industry event to occur.
		set_global_flag = byz_tyrian_purple_restored
	}
	
	option = {	#Do not
		name = "resurgent_BYZ.8.b"
		ai_chance = { factor = 25 }
		
		owner = {
			add_prestige = -5
		}
	}
}

country_event = { #9 Expanding the Tyrian Purple Industry
	id = resurgent_BYZ.9
	title = "resurgent_BYZ.9.t"
	desc = "resurgent_BYZ.9.d"
	picture = TRADEGOODS_eventPicture

	fire_only_once = yes
	
	trigger = {
		tag = BYZ
		has_global_flag = byz_tyrian_purple_restored
		6074 = { #Tyros
			religion = ROOT
			owner = {
				tag = BYZ
			}
		}  
		
	}

	mean_time_to_happen = {
		years = 5
	}
	
	option = {	#Expand the Tyrian Purple industry!
		name = "resurgent_BYZ.9.a"
		ai_chance = { factor = 25 }
		add_years_of_income = -1
		add_adm_power = -100
		add_dip_power = -100
		6074 = { #Tyros
			add_base_tax = 3
			add_base_production = 3
			add_or_spawn_center_of_trade = { level = 1 } #Change level of center of trade
			change_trade_goods = dyes
		}
		if = { #Finding these clams in Anatolia
			limit = {
				any_owned_province = {
					has_port = yes
					region = anatolia_region
					NOT = { trade_goods = dyes }
					NOT = { trade_goods = cloth }
					NOT = { trade_goods = silk }
					NOT = {
						any_neighbor_province = {
							OR = {
								trade_goods = dyes
								trade_goods = cloth
								trade_goods = silk
							}
							
						}
					}
				}
			}
			random_owned_province = { 
				limit = {
					has_port = yes
					region = anatolia_region
					NOT = { trade_goods = dyes }
					NOT = { trade_goods = cloth }
					NOT = { trade_goods = silk }
					NOT = {
						any_neighbor_province = {
							OR = {
								trade_goods = dyes
								trade_goods = cloth
								trade_goods = silk
							}
						}
					}
				}
				add_base_tax = 1
				add_base_production = 1
				change_trade_goods = dyes
			}
			random_owned_province = { 
				limit = {
					trade_goods = cloth
					OR = {
						region = anatolia_region
						region = balkan_region
						region = mashriq_region
					}
				}
				add_base_tax = 1
				add_base_production = 1
				change_trade_goods = silk
			}
		}
		if = { #Finding these clams in the Levant
			limit = {
				any_owned_province = {
					has_port = yes
					region = mashriq_region
					NOT = { trade_goods = dyes }
					NOT = { trade_goods = cloth }
					NOT = { trade_goods = silk }
					NOT = {
						any_neighbor_province = {
							OR = {
								trade_goods = dyes
								trade_goods = cloth
								trade_goods = silk
							}
						}
					}
					NOT = { #Should prevent the province from being next to Tyros, because it has yet to be designated Dyes
						any_neighbor_province = { 
							province_id = 6074
						}
					}
				}
			}
			random_owned_province = { 
				limit = {
					has_port = yes
					region = mashriq_region
					NOT = { trade_goods = dyes }
					NOT = { trade_goods = cloth }
					NOT = { trade_goods = silk }
					NOT = {
						any_neighbor_province = {
							OR = {
								trade_goods = dyes
								trade_goods = cloth
								trade_goods = silk
							}
						}
					}
					NOT = { #Should prevent the province from being next to Tyros, because it has yet to be designated Dyes
						any_neighbor_province = { 
							province_id = 6074
						}
					}
				}
				add_base_tax = 1
				add_base_production = 1
				change_trade_goods = dyes
			}
			random_owned_province = { 
				limit = {
					trade_goods = cloth
					OR = {
						region = anatolia_region
						region = balkan_region
						region = mashriq_region
					}
				}
				add_base_tax = 1
				add_base_production = 1
				change_trade_goods = silk
			}
		}
		custom_tooltip = byz_tyrian_purple_depletion_tooltip
		set_global_flag = byz_tyrian_purple_expanded
	}
	
	option = {	#Avoid potentially depleting the Murex Snails
		name = "resurgent_BYZ.9.b"
		ai_chance = { factor = 75 }
		add_prestige = -5
	}
	
	option = { 	#Limit expansion to Tyros, calm version
		name = "resurgent_BYZ.9.c"
		ai_chance = { factor = 1000 }
		highlight = yes
		trigger = {
			ruler_has_personality_ancestor = { key = calm }
		}
		
		add_years_of_income = -0.5
		add_adm_power = -50
		add_dip_power = -50
		6074 = { #Tyros
			add_base_tax = 3
			add_base_production = 3
			add_or_spawn_center_of_trade = { level = 1 }
			change_trade_goods = dyes
		}
	}
	
	option = { 	#Limit expansion to Tyros, careful version.
		name = "resurgent_BYZ.9.c"
		ai_chance = { factor = 1000 }
		highlight = yes
		trigger = {
			ruler_has_personality_ancestor = { key = careful }
		}
		
		add_years_of_income = -0.5
		add_adm_power = -50
		add_dip_power = -50
		6074 = { #Tyros
			add_base_tax = 3
			add_base_production = 3
			add_or_spawn_center_of_trade = { level = 1 }
			change_trade_goods = dyes
		}
	}
}

country_event = { #10 The Depletion of the Murex snails 
	id = resurgent_BYZ.10
	title = "resurgent_BYZ.10.t"
	desc = "resurgent_BYZ.10.d"
	picture = TRADEGOODS_eventPicture

	fire_only_once = yes
	
	major = yes
	
	trigger = {
		tag = BYZ
		any_owned_province = {			
			OR = {
				region = anatolia_region
				region = mashriq_region
			}
			trade_goods = dyes
		}
		had_global_flag = {
			flag = byz_tyrian_purple_expanded
			days = 36500 #100 years
		}
	}

	mean_time_to_happen = {
		years = 100
	}
	
	option = {	#Now what do we do?
		name = "resurgent_BYZ.10.a"
		ai_chance = { factor = 1 }
		every_owned_province = { #Targeting all provinces producing dyes in Anatolia & The Levant
			limit = {
				trade_goods = dyes
				OR = {
					region = anatolia_region
					region = mashriq_region
				}
			}
			add_base_tax = -1
			add_base_production = -2
			change_trade_goods = unknown
		}
		change_price = {
			trade_goods = dyes
			key = byz_tyrian_purple_depleted
			value = -0.25
			duration = -1
		}
		change_price = { #Silk is dependent on tyrian purple.
			trade_goods = silk
			key = byz_tyrian_purple_depleted
			value = -0.25
			duration = -1
		}
		
	}
}

country_event = { #11 City of the World's Desire
	id = resurgent_BYZ.11
	title = "resurgent_BYZ.11.t"
	desc = "resurgent_BYZ.11.d"
	picture = BATTLE_eventPicture

	fire_only_once = yes
	
	major = yes
	
	trigger = {
		tag = TUR
		151 = { 
			owned_by = BYZ 
		}
		BYZ = {
			NOT = { num_of_cities = 20 }
		} 
		is_year = 1450
		NOT = { war_with = BYZ }
		NOT = { truce_with = BYZ }
		has_ruler = "Mehmed II Fatih" #Apparently Fatih is part of it?
		dynasty = "Osmanoglu"
		is_at_war = no
	}

	mean_time_to_happen = {
		years = 5
		modifier = {
			factor = 0.2
			is_year = 1453
		}
	}
	
	option = {	#Our Ghazi shall storm the gates!
		name = "resurgent_BYZ.11.a"
		ai_chance = {
			factor = 80
			modifier = {
				factor = 0.5
				NOT = {
					military_strength = {
						who = BYZ
						value = 2.0
					}
				}
			}
			modifier = {
				factor = 0.05
				#Takes care of Austria, Hungary and the PLC, sometimes also the Mamluks.
				OR = {
					any_country = {
						is_rival = TUR
						alliance_with = BYZ
					}
					any_country = {
						is_rival = TUR
						has_guaranteed = BYZ #Had almost forgotten you could guarantee them as a player.
					}
				}
			}
		}
		
		add_prestige = 10
		thrace_area = {
			add_claim = TUR
		}
		declare_war_with_cb = {
			who = BYZ
			casus_belli = cb_conquest
			war_goal_province = 151 #Apparently you need to declare the province. Makes sense, I suppose, but wow, to think the effect just breaks without it...
		}		
	}
	
	option = {	#Let's reconsider...
		name = "resurgent_BYZ.11.b"
		ai_chance = {
			factor = 20
		}
		
		add_prestige = -20
		add_legitimacy = -10
	}
}

country_event = { #12 Growth of Constantinople
	id = resurgent_BYZ.12
	title = "resurgent_BYZ.12.t"
	desc = "resurgent_BYZ.12.d"
	picture = CONSTANTINOPLE_eventPicture

	trigger = {
		has_global_flag = constantinople_restored
		tag = BYZ
		capital = 151
		151 = {
			has_province_modifier = byz_rebuilt_great_palace
			OR = {
				has_province_modifier = byz_hippodrome_restored
				AND = {
					has_dlc = "Leviathan"
					has_great_project = {
						type = hippodrome_of_constantinople
					}
				}
			}
		}
	}

	mean_time_to_happen = {
		years = 150
		modifier = {
			factor = 0.9
			is_at_war = no
		}
		modifier = {
			factor = 0.8
			ADM = 5
		}
		modifier = {
			factor = 0.8
			ADM = 6
		}
	}


	option = { #So it shall be!
		name = "resurgent_BYZ.12.a"
		ai_chance = { factor = 1 }
		
		add_prestige = 5
		151 = {
			add_base_tax = 1
			add_base_production = 1
		}
	}
}

country_event = { #13 The Hippodrome of Constantinople
	id = resurgent_BYZ.13
	title = "resurgent_BYZ.13.t"
	desc = { #If event fires after Chastening of Venice
		trigger = { 112 = {	has_province_modifier = BYZ_chastening_of_venice } }
		desc = "resurgent_BYZ.13.da"
	}
	desc = { #If event fires before Chastening of Venice
		trigger = { NOT = { 112 = {	has_province_modifier = BYZ_chastening_of_venice } } }
		desc = "resurgent_BYZ.13.db"
	}
	picture = CONSTANTINOPLE_eventPicture

	fire_only_once = yes

	trigger = {
		has_global_flag = constantinople_restored
		tag = BYZ
		capital = 151
		OR = {
			is_year = 1500
			112 = {
				has_province_modifier = BYZ_chastening_of_venice
			}
		}
	}

	mean_time_to_happen = {
		years = 100
		modifier = {
			factor = 0.9
			is_at_war = no
		}
		modifier = {
			factor = 0.8
			ADM = 5
		}
		modifier = {
			factor = 0.8
			ADM = 6
		}
		modifier = {
			factor = 0.5
			151 = { has_province_modifier = byz_rebuilt_great_palace }
		}
		modifier = {
			factor = 0.05
			112 = {
				has_province_modifier = BYZ_chastening_of_venice
			}
		}
	}


	option = {	#Chariot races shall return to Constantinople once more!
		name = "resurgent_BYZ.13.a"
		ai_chance = { factor = 75 }
		
		add_years_of_income = -1.0
		add_prestige = 10
		if = { #Venice has been chastised
			limit = {
				112 = {
					has_province_modifier = BYZ_chastening_of_venice
				}
			}
			151 = {
				if = {
					limit = {
						has_dlc = "Leviathan"
					}
					set_province_flag = br_leviathan_hippodrome_flag_set
					add_great_project = {
						type = hippodrome_of_constantinople
						instant = yes
					}
					custom_tooltip = resurgent_BYZ.13.a_tooltip
				}
				else = {
					add_province_modifier = {
						name = "byz_hippodrome_restored"
						duration = -1
					}
				}
			}
		}
		else = {
			151 = {
				custom_tooltip = byz_hippodrome_foundation_tooltip
				set_province_flag = byz_hippodrome_foundation
			}
			112 = {
				add_claim = ROOT
			}
		}
	}
	option = {	#This is a waste of our precious time and resources.
		name = "resurgent_BYZ.13.b"
		ai_chance = { factor = 25 }
		
		add_prestige = -5
	}
}

country_event = { #14 The Purchase of the Maona of Chios and Phocaea - Byzantine Proposal
	id = resurgent_BYZ.14
	title = "resurgent_BYZ.14.t" 
	desc = "resurgent_BYZ.14.d"
	picture = BURGHER_ESTATE_eventPicture
	
	#major = yes
	
	fire_only_once = yes
	
	is_triggered_only = yes
	
	immediate = {
		hidden_effect = {
			save_global_event_target_as = byz_country_to_sell_to
		}
	}
	
	trigger = {
		tag = BYZ
		exists = GEN
		GEN = { 
			capital_scope = {
				region = italy_region
			}
			OR = {
				owns = 2348 #Chios
				owns = 6005 #Phocaea
				owns = 6096 #Samos
			}
		}
	}
	
	option = { #Attempt the purchase
		name = "resurgent_BYZ.14.a"
		ai_chance = { factor = 33 } #The Byzantines did not look down all too much on the Genoese, actually
		GEN = {
			country_event = {
				id = resurgent_BYZ.15
				days = 5
				random = 5
			}
		}
		custom_tooltip = chios_purchase_effects_if_signs_treaty
		tooltip = {
			add_years_of_income = -0.25
			capital_scope = {
				if = { #Chios
					limit = {
						GEN = { owns = 2348 }
					}
					add_trade_modifier = {
						who = GEN
						duration = -1
						power = 20
						key = ceded_chios_for_trade_privileges
					}
				}
				if = { #Phocaea
					limit = {
						GEN = { owns = 6005 }
					}
					add_trade_modifier = {
						who = GEN
						duration = -1
						power = 15
						key = ceded_phocaea_for_trade_privileges
					}
				}
				if = { #Samos
					limit = {
						GEN = { owns = 6096 }
					}
					add_trade_modifier = {
						who = GEN
						duration = -1
						power = 10
						key = ceded_samos_for_trade_privileges
					}
				}
			}
			GEN = {
				add_opinion = {
					who = BYZ 
					modifier = byz_granted_trade
				}
			}
			if = { #Chios
				limit = {
					GEN = { owns = 2348 }
				}
				2348 = {
					remove_core = GEN
					add_core = ROOT
					cede_province = ROOT
				}
			}
			if = { #Phocaea
				limit = {
					GEN = { owns = 6005 }
				}
				6005 = {
					remove_core = GEN
					add_core = ROOT
					cede_province = ROOT
				}
			}
			if = { #Samos
				limit = {
					GEN = { owns = 6096 }
				}
				6096 = {
					remove_core = GEN
					add_core = ROOT
					cede_province = ROOT
				}
			}
		}
		
		
	}
	option = { #Do not
		name = "resurgent_BYZ.14.b"
		ai_chance = { factor = 66 }
		
		add_mercantilism = 1
		GEN = {
			add_opinion = {
				who = BYZ
				modifier = byz_denied_trade
			}
		}
	}
	option = { #Negotiate an offer they cannot refuse!
		name = "resurgent_BYZ.14.c"
		ai_chance = { factor = 1000 }
		highlight = yes
		trigger = {
			ruler_has_personality_ancestor = { key = charismatic_negotiator }
			GEN = { ai = yes } #To prevent the player getting gimped.
		}
		
		add_years_of_income = -0.35
		capital_scope = {
			if = { #Chios
				limit = {
					GEN = { owns = 2348 }
				}
				add_trade_modifier = {
					who = GEN
					duration = -1
					power = 40
					key = ceded_chios_for_trade_privileges
				}
			}
			if = { #Phocaea
				limit = {
					GEN = { owns = 6005 }
				}
				add_trade_modifier = {
					who = GEN
					duration = -1
					power = 30
					key = ceded_phocaea_for_trade_privileges
				}
			}
			if = { #Samos
				limit = {
					GEN = { owns = 6096 }
				}
				add_trade_modifier = {
					who = GEN
					duration = -1
					power = 20
					key = ceded_samos_for_trade_privileges
				}
			}
		}
		GEN = {
			add_opinion = {
				who = BYZ 
				modifier = byz_granted_trade
			}
		}
		if = { #Chios
			limit = {
				GEN = { owns = 2348 }
			}
			2348 = {
				remove_core = GEN
				add_core = ROOT
				cede_province = ROOT
			}
		}
		if = { #Phocaea
			limit = {
				GEN = { owns = 6005 }
			}
			6005 = {
				remove_core = GEN
				add_core = ROOT
				cede_province = ROOT
			}
		}
		if = { #Samos
			limit = {
				GEN = { owns = 6096 }
			}
			6096 = {
				remove_core = GEN
				add_core = ROOT
				cede_province = ROOT
			}
		}
	}
}

country_event = { #15 The Purchase of Chios - Genoese response
	id = resurgent_BYZ.15
	title = "resurgent_BYZ.15.t" 
	desc = "resurgent_BYZ.15.d"
	picture = BURGHER_ESTATE_eventPicture
		
	fire_only_once = yes
	
	is_triggered_only = yes
	
	trigger = {
		tag = GEN
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = { #Accept the purchase
		name = "resurgent_BYZ.15.a"
		ai_chance = { 
			factor = 50 
			modifier = {
				factor = 5
				has_opinion = {
					who = event_target:byz_country_to_sell_to #I don't know if FROM works here, so just to be safe.
					value = 50
				}
			}
		}
		
		add_mercantilism = 1
		add_years_of_income = 0.5
		reverse_add_opinion = {
			who = BYZ 
			modifier = byz_granted_trade
		}
		if = { #Chios
			limit = {
				owns = 2348
			}
			2348 = {
				remove_core = ROOT
				add_core = event_target:byz_country_to_sell_to
				cede_province = event_target:byz_country_to_sell_to
				set_province_flag = br_genoese_sold
			}
		}
		if = { #Phocaea
			limit = {
				owns = 6005
			}
			6005 = {
				remove_core = ROOT
				add_core = event_target:byz_country_to_sell_to
				cede_province = event_target:byz_country_to_sell_to
				set_province_flag = br_genoese_sold
			}
		}
		if = { #Samos
			limit = {
				owns = 6096
			}
			6096 = {
				remove_core = ROOT
				add_core = event_target:byz_country_to_sell_to
				cede_province = event_target:byz_country_to_sell_to
				set_province_flag = br_genoese_sold
			}
		}
		event_target:byz_country_to_sell_to = {
			country_event = {
				id = resurgent_BYZ.16
			}
			capital_scope = {
				if = { #Chios
					limit = {
						ROOT = { owns = 2348 }
					}
					add_trade_modifier = {
						who = ROOT
						duration = -1
						power = 20
						key = ceded_chios_for_trade_privileges
					}
				}
				if = { #Phocaea
					limit = {
						ROOT = { owns = 6005 }
					}
					add_trade_modifier = {
						who = ROOT
						duration = -1
						power = 15
						key = ceded_phocaea_for_trade_privileges
					}
				}
				if = { #Samos
					limit = {
						ROOT = { owns = 6096 }
					}
					add_trade_modifier = {
						who = ROOT
						duration = -1
						power = 10
						key = ceded_samos_for_trade_privileges
					}
				}
			}
		}
		clear_global_event_target  = byz_country_to_sell_to
	}
	option = { #Do not
		name = "resurgent_BYZ.15.b"
		ai_chance = { factor = 50 }
		
		event_target:byz_country_to_sell_to = {
			country_event = {
				id = resurgent_BYZ.17
			}
		}
		clear_global_event_target  = byz_country_to_sell_to
		reverse_add_opinion = {
			who = BYZ 
			modifier = byz_denied_trade
		}
	}
	option = { #Make a counter-proposal
		name = "resurgent_BYZ.15.c"
		ai_chance = { factor = 1000 }
		highlight = yes
		trigger = {
			ruler_has_personality_ancestor = { key = entrepreneur }
			BYZ = { ai = yes } #To prevent the player getting gimped.
		}
		
		add_years_of_income = 1
		
		
		add_opinion = {
			who = BYZ 
			modifier = byz_granted_trade
		}
		if = { #Chios
			limit = {
				owns = 2348
			}
			2348 = {
				remove_core = ROOT
				add_core = event_target:byz_country_to_sell_to
				cede_province = event_target:byz_country_to_sell_to
				set_province_flag = br_genoese_sold
			}
		}
		if = { #Phocaea
			limit = {
				owns = 6005
			}
			6005 = {
				remove_core = ROOT
				add_core = event_target:byz_country_to_sell_to
				cede_province = event_target:byz_country_to_sell_to
				set_province_flag = br_genoese_sold
			}
		}
		if = { #Samos
			limit = {
				owns = 6096
			}
			6096 = {
				remove_core = ROOT
				add_core = event_target:byz_country_to_sell_to
				cede_province = event_target:byz_country_to_sell_to
				set_province_flag = br_genoese_sold
			}
		}
		event_target:byz_country_to_sell_to = {
			country_event = {
				id = resurgent_BYZ.16
			}
			capital_scope = {
				if = { #Chios
					limit = {
						ROOT = { owns = 2348 }
					}
					add_trade_modifier = {
						who = ROOT
						duration = -1
						power = 40
						key = ceded_chios_for_trade_privileges
					}
				}
				if = { #Phocaea
					limit = {
						ROOT = { owns = 6005 }
					}
					add_trade_modifier = {
						who = ROOT
						duration = -1
						power = 30
						key = ceded_phocaea_for_trade_privileges
					}
				}
				if = { #Samos
					limit = {
						ROOT = { owns = 6096 }
					}
					add_trade_modifier = {
						who = ROOT
						duration = -1
						power = 20
						key = ceded_samos_for_trade_privileges
					}
				}
			}
		}
		clear_global_event_target = byz_country_to_sell_to
	}
}

country_event = { #16 The Genoese Accept our Offer!
	id = resurgent_BYZ.16
	title = "resurgent_BYZ.16.t"
	desc = "resurgent_BYZ.16.d"
	picture = GOOD_WITH_MONARCH_eventPicture
	
	fire_only_once = yes
	
	is_triggered_only = yes
	
	trigger = {
		tag = event_target:byz_country_to_sell_to
	}
	
	option = { #Great!
		name = "resurgent_BYZ.16.a"
		ai_chance = { factor = 1 }
			
		add_years_of_income = -0.25
		tooltip = {
			GEN = {
				add_opinion = {
					who = BYZ 
					modifier = byz_granted_trade
				}
			}
			capital_scope = {
				if = {
					limit = {
						GEN = {
							ruler_has_personality_ancestor = { key = entrepreneur }
						}
					}
					if = { #Chios
						limit = {
							2348 = { has_province_flag = br_genoese_sold }
						}
						add_trade_modifier = {
							who = GEN
							duration = -1
							power = 40
							key = ceded_chios_for_trade_privileges
						}
					}
					if = { #Phocaea
						limit = {
							6005 = { has_province_flag = br_genoese_sold }
						}
						add_trade_modifier = {
							who = GEN
							duration = -1
							power = 30
							key = ceded_phocaea_for_trade_privileges
						}
					}
					if = { #Samos
						limit = {
							6096 = { has_province_flag = br_genoese_sold }
						}
						add_trade_modifier = {
							who = GEN
							duration = -1
							power = 20
							key = ceded_samos_for_trade_privileges
						}
					}
				}
				else = {
					if = { #Chios
						limit = {
							2348 = { has_province_flag = br_genoese_sold }
						}
						add_trade_modifier = {
							who = GEN
							duration = -1
							power = 20
							key = ceded_chios_for_trade_privileges
						}
					}
					if = { #Phocaea
						limit = {
							6005 = { has_province_flag = br_genoese_sold }
						}
						add_trade_modifier = {
							who = GEN
							duration = -1
							power = 15
							key = ceded_phocaea_for_trade_privileges
						}
					}
					if = { #Samos
						limit = {
							2348 = { has_province_flag = br_genoese_sold }
						}
						add_trade_modifier = {
							who = GEN
							duration = -1
							power = 10
							key = ceded_samos_for_trade_privileges
						}
					}
				}
			}
			if = { #Chios
				limit = {
					2348 = { has_province_flag = br_genoese_sold }
				}
				2348 = {
					remove_core = GEN
					add_core = ROOT
					cede_province = ROOT
				}
			}
			if = { #Phocaea
				limit = {
					6005 = { has_province_flag = br_genoese_sold }
				}
				6005 = {
					remove_core = GEN
					add_core = ROOT
					cede_province = ROOT
				}
			}
			if = { #Samos
				limit = {
					6096 = { has_province_flag = br_genoese_sold }
				}
				6096 = {
					remove_core = GEN
					add_core = ROOT
					cede_province = ROOT
				}
			}
		}
		#Clear flags because in this event Genoa doesn't own them any more for tooltip's sake.
		if = {
			limit = {
				2348 = { has_province_flag = br_genoese_sold }
			}
			2348 = { clr_province_flag = br_genoese_sold }
		}
		if = {
			limit = {
				6005 = { has_province_flag = br_genoese_sold }
			}
			2348 = { clr_province_flag = br_genoese_sold }
		}
		if = {
			limit = {
				6096 = { has_province_flag = br_genoese_sold }
			}
			2348 = { clr_province_flag = br_genoese_sold }
		}
	}
}

country_event = { #17 The Genoese Decline our Offer...
	id = resurgent_BYZ.17
	title = "resurgent_BYZ.17.t"
	desc = "resurgent_BYZ.17.d"
	picture = BAD_WITH_MONARCH_eventPicture
	
	fire_only_once = yes
	
	is_triggered_only = yes
	
	trigger = {
		tag = BYZ #I think the event target has been cleared at this rate, so to be sure, let's just use the tag.
	}
	
	option = { #I guess we'll have to take it by force...
		name = "resurgent_BYZ.17.a"
		ai_chance = { factor = 1 }
		
		tooltip = {
			add_opinion = {
				who = GEN 
				modifier = byz_denied_trade
			}
		}
		
	}
}

country_event = { #18 The Return of the Triumphal Quadriga
	id = resurgent_BYZ.18
	title = "resurgent_BYZ.18.t"
	desc = "resurgent_BYZ.18.d"
	picture = CONSTANTINOPLE_eventPicture

	fire_only_once = yes

	trigger = {
		has_global_flag = constantinople_restored
		tag = BYZ
		capital = 151
		112 = {
			has_province_modifier = BYZ_chastening_of_venice
		}
		151 = {
			has_province_flag = byz_hippodrome_foundation
		}
	}
	
	mean_time_to_happen = {
		days = 60
	}
	
	option = {	#Chariot races shall return to Constantinople once more!
		name = "resurgent_BYZ.18.a"
		ai_chance = { factor = 75 }
		
		151 = {
			if = {
				limit = {
					has_dlc = "Leviathan"
				}
				set_province_flag = br_leviathan_hippodrome_flag_set
				add_great_project = {
					type = hippodrome_of_constantinople
					instant = yes
				}
				custom_tooltip = resurgent_BYZ.13.a_tooltip
			}
			else = {
				add_province_modifier = {
					name = "byz_hippodrome_restored"
					duration = -1
				}
			}
			clr_province_flag = byz_hippodrome_foundation
		}
	}
}

country_event = { #19 The Fall of Constantinople?
	id = resurgent_BYZ.19
	title = "resurgent_BYZ.19.t"
	desc = "resurgent_BYZ.19.d"
	picture = BATTLE_eventPicture

	fire_only_once = yes

	major = yes
	
	trigger = {
		BYZ = {
			is_in_war = {
				attacker_leader = TUR
				defender_leader = BYZ
			}
			capital = 151
			owns = 3195 #Lemnos
		}
		tag = ARA
		NOT = { is_subject = yes }
		NOT = { is_year = 1475 }
		NAP = { is_subject_of = ROOT }
		NOT = { is_rival = BYZ }
	}
	
	mean_time_to_happen = {
		days = 60
	}
	
	option = {	#Offer our assistance
		name = "resurgent_BYZ.19.a"
		ai_chance = { factor = 90 }
		
		BYZ = {
			country_event = {
				id = resurgent_BYZ.20
				days = 10
			}
		}
		custom_tooltip = fall_of_constantinople_tooltip
		tooltip = {
			join_all_defensive_wars_of = BYZ
			3195 = {
				remove_core = BYZ
				add_core = ARA
				cede_province = ARA
			}
		}
	}
	
	option = {	#Do not
		name = "resurgent_BYZ.19.b"
		ai_chance = { factor = 10 }
	}
}

country_event = { #20 The Fall of Constantinople? - Byzantine response
	id = resurgent_BYZ.20
	title = "resurgent_BYZ.20.t"
	desc = "resurgent_BYZ.20.d"
	picture = BYZANTINE_EMPEROR_eventPicture

	fire_only_once = yes
	is_triggered_only = yes
	
	major = yes
	
	trigger = {
		tag = BYZ
		is_in_war = {
			attacker_leader = TUR
			defender_leader = ROOT
		}
		capital = 151
		owns = 3195 #Lemnos
		ARA = {
			NOT = { is_subject = yes }
			NAP = { is_subject_of = ARA }
			NOT = { is_rival = BYZ }
		}
	}
	
	option = {	#Accept their demands
		name = "resurgent_BYZ.20.a"
		ai_chance = { factor = 10 }
		
		ARA = {
			join_all_defensive_wars_of = BYZ
		}
		3195 = {
			remove_core = BYZ
			add_core = ARA
			cede_province = ARA
		}
	}
	
	option = {	#Promise the lands to Giovanni Guistiniani
		name = "resurgent_BYZ.20.b"
		ai_chance = { factor = 80 }
		trigger = {
			has_global_flag = integrated_byz_events_used #Because without this, Giovanni Guistiniani can appear twice.
		}
		set_global_flag = byz_promised_genoese_lemnos #Set to check when the war is over whether Giovanni Guistiniani is still alive, if Byzantium owns Myrina and Constantinople, eventually ceding the province to Genoa.
		custom_tooltip = byz_promised_genoese_lemnos
		define_general = { #Buffed from 2/2/3/0 because there's no way in hell a player would actually pick this leader. He's still too weak, honestly.
			name = "Giovanni Giustiniani"
			fire = 3
			shock = 3
			manuever = 5
			siege = 2
			trait = defensive_planner_personality
		}
		reverse_add_opinion = {
			who = GEN
			modifier = giovanni_giustiniani
		}
	}
	
	option = { #We do not need any help from either!
		name = "resurgent_BYZ.20.c"
		ai_chance = { factor = 10 }
		
		add_prestige = 5
	}
}

country_event = { #21 Lemnos is Ours!
	id = resurgent_BYZ.21
	title = "resurgent_BYZ.21.t"
	desc = "resurgent_BYZ.21.d"
	picture = GOOD_WITH_MONARCH_eventPicture

	fire_only_once = yes
	is_triggered_only = yes
	
	#major = yes
	
	trigger = {
		BYZ = {
			#defensive_war_with = TUR
			capital = 151
			#owns = 3195 #Myrina
		}
		tag = ARA
		NOT = { is_subject = yes }
		NOT = { is_year = 1475 }
		NAP = { is_subject_of = ROOT }
	}
	
	option = {	#Let's relieve the city of its besiegers!
		name = "resurgent_BYZ.21.a"
		ai_chance = { factor = 1 }
		
		tooltip = {
			join_all_defensive_wars_of = BYZ
			3195 = {
				remove_core = BYZ
				add_core = ARA
				cede_province = ARA
			}
		}
	}
}

country_event = { #22 The Turks have been repelled!
	id = resurgent_BYZ.22
	title = "resurgent_BYZ.22.t"
	desc = "resurgent_BYZ.22.d"
	picture = GOOD_WITH_MONARCH_eventPicture

	fire_only_once = yes
	
	major = yes
	
	trigger = {
		has_global_flag = byz_promised_genoese_lemnos
		tag = BYZ
		capital = 151
		owns = 3195 #Myrina
		NOT = { is_at_war = yes }
		GEN = { owns = 2348 } #Chios
		has_leader = "Giovanni Guistiniani"
	}
	
	mean_time_to_happen = {
		days = 30
	}
	
	option = {	#He deserved it, for he let us live to fight another day.
		name = "resurgent_BYZ.22.a"
		ai_chance = { factor = 1 }
		
		# hidden_effect = {
			# kill_leader = "Giovanni Guistiniani"
		# }
		
		3195 = {
			remove_core = BYZ
			add_core = GEN
			cede_province = GEN
		}
	}
}

country_event = { #23 The Purchase of Amastris - Trebizonder Proposal
	id = resurgent_BYZ.23
	title = "resurgent_BYZ.23.t" 
	desc = "resurgent_BYZ.23.d"
	picture = BURGHER_ESTATE_eventPicture
	
	#major = yes
	
	fire_only_once = yes
	
	is_triggered_only = yes
	
	immediate = {
		hidden_effect = {
			save_global_event_target_as = byz_country_to_sell_to
		}
	}
	
	trigger = {
		tag = TRE
		exists = GEN
		GEN = { 
			capital_scope = {
				region = italy_region
			}
			owns_or_non_sovereign_subject_of = 2299 #Amastris
		}
	}
	
	option = { #Attempt the purchase
		name = "resurgent_BYZ.14.a"
		ai_chance = { factor = 33 } #The Byzantines did not look down all too much on the Genoese, actually
		GEN = {
			country_event = {
				id = resurgent_BYZ.24
				days = 5
				random = 5
			}
		}
		custom_tooltip = chios_purchase_effects_if_signs_treaty
		tooltip = {
			add_years_of_income = -0.50
			capital_scope = {
				add_trade_modifier = {
					who = GEN
					duration = -1
					power = 20
					key = ceded_amastris_for_trade_privileges
				}
			}
			GEN = {
				add_opinion = {
					who = TRE 
					modifier = byz_granted_trade
				}
			}
			2299 = {
				remove_core = GEN
				remove_core = GZR
				add_core = ROOT
				cede_province = ROOT
			}
		}
		
		
	}
	option = { #Do not
		name = "resurgent_BYZ.14.b"
		ai_chance = { factor = 66 }
		
		add_mercantilism = 1
		GEN = {
			add_opinion = {
				who = TRE
				modifier = byz_denied_trade
			}
		}
	}
	option = { #Negotiate an offer they cannot refuse!
		name = "resurgent_BYZ.14.c"
		ai_chance = { factor = 1000 }
		highlight = yes
		trigger = {
			ruler_has_personality_ancestor = { key = charismatic_negotiator }
			GEN = { ai = yes } #To prevent the player getting gimped.
		}
		
		add_years_of_income = -0.35
		capital_scope = {
			add_trade_modifier = {
				who = GEN
				duration = -1
				power = 30
				key = ceded_chios_for_trade_privileges
			}
		}
		GEN = {
			add_opinion = {
				who = TRE 
				modifier = byz_granted_trade
			}
		}
		2299 = {
			remove_core = GEN
			remove_core = GZR
			add_core = ROOT
			cede_province = ROOT
		}
	}
}

country_event = { #24 The Purchase of Amastris - Genoese response
	id = resurgent_BYZ.24
	title = "resurgent_BYZ.24.t" 
	desc = "resurgent_BYZ.24.d"
	picture = BURGHER_ESTATE_eventPicture
		
	fire_only_once = yes
	
	is_triggered_only = yes
	
	trigger = {
		tag = GEN
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = { #Accept the purchase
		name = "resurgent_BYZ.15.a"
		ai_chance = { 
			factor = 50 
			modifier = {
				factor = 5
				has_opinion = {
					who = event_target:byz_country_to_sell_to #I don't know if PREV works here, so just to be safe.
					value = 50
				}
			}
		}
		
		add_mercantilism = 1
		add_years_of_income = 0.5
		330 = {
			add_trade_modifier = {
				who = GEN
				duration = -1
				power = 20
				key = ceded_amastris_for_trade_privileges
			}
		}
		reverse_add_opinion = {
			who = TRE 
			modifier = byz_granted_trade
		}
		2299 = {
			remove_core = GEN
			remove_core = GZR
			add_core = event_target:byz_country_to_sell_to
			cede_province = event_target:byz_country_to_sell_to
		}
		event_target:byz_country_to_sell_to = {
			country_event = {
				id = resurgent_BYZ.25
			}
		}
		clear_global_event_target = byz_country_to_sell_to
	}
	option = { #Do not
		name = "resurgent_BYZ.15.b"
		ai_chance = { factor = 50 }
		
		event_target:byz_country_to_sell_to = {
			country_event = {
				id = resurgent_BYZ.26
			}
		}
		clear_global_event_target  = byz_country_to_sell_to
		reverse_add_opinion = {
			who = TRE 
			modifier = byz_denied_trade
		}
	}
	option = { #Make a counter-proposal
		name = "resurgent_BYZ.15.c"
		ai_chance = { factor = 1000 }
		highlight = yes
		trigger = {
			ruler_has_personality_ancestor = { key = entrepreneur }
			TRE = { ai = yes } #To prevent the player getting gimped.
		}
		
		add_years_of_income = 1
		
		
		add_opinion = {
			who = BYZ 
			modifier = byz_granted_trade
		}
		2299 = {
			remove_core = ROOT
			add_core = event_target:byz_country_to_sell_to
			cede_province = event_target:byz_country_to_sell_to
		}
		event_target:byz_country_to_sell_to = {
			country_event = {
				id = resurgent_BYZ.25
			}
			capital_scope = {
				add_trade_modifier = {
					who = GEN
					duration = -1
					power = 30
					key = ceded_chios_for_trade_privileges
				}
			}
		}
		clear_global_event_target = byz_country_to_sell_to
	}
}

country_event = { #25 The Genoese Accept our Offer!
	id = resurgent_BYZ.25
	title = "resurgent_BYZ.25.t"
	desc = "resurgent_BYZ.25.d"
	picture = GOOD_WITH_MONARCH_eventPicture
	
	fire_only_once = yes
	
	is_triggered_only = yes
	
	trigger = {
		tag = event_target:byz_country_to_sell_to
	}
	
	option = { #Great!
		name = "resurgent_BYZ.16.a"
		ai_chance = { factor = 1 }
			
		add_years_of_income = -0.50
		tooltip = {
			GEN = {
				add_opinion = {
					who = TRE 
					modifier = byz_granted_trade
				}
			}
			capital_scope = {
				add_trade_modifier = {
					who = GEN
					duration = -1
					power = 30
					key = ceded_amastris_for_trade_privileges
				}
			}
			2299 = {
				remove_core = GEN
				remove_core = GZR
				add_core = event_target:byz_country_to_sell_to
				cede_province = event_target:byz_country_to_sell_to
			}
		}
		
	}
}

country_event = { #26 The Genoese Decline our Offer...
	id = resurgent_BYZ.26
	title = "resurgent_BYZ.26.t"
	desc = "resurgent_BYZ.26.d"
	picture = BAD_WITH_MONARCH_eventPicture
	
	fire_only_once = yes
	
	is_triggered_only = yes
	
	trigger = {
		tag = event_target:byz_country_to_sell_to
	}
	
	option = { #I guess we'll have to take it by force...
		name = "resurgent_BYZ.17.a"
		ai_chance = { factor = 1 }
		
		tooltip = {
			add_opinion = {
				who = GEN 
				modifier = byz_denied_trade
			}
		}
		
	}
}

country_event = { #27 The Return of De Architectura
	id = resurgent_BYZ.27
	title = "resurgent_BYZ.27.t"
	desc = "resurgent_BYZ.27.d"
	picture = BIG_BOOK_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		358 = { 
			has_great_project = {
				type = library_of_alexandria
				tier = 1
			}
		}
		tag = BYZ
		#NOT = { is_at_war = yes }
	}
	
	mean_time_to_happen = {
		months = 1200 #100 years
		modifier = { #1/100th if Scholar
			factor = 0.01
			ruler_has_personality_ancestor = { key = scholar }
		}
		modifier = { #Halved if Printing Press is embraced
			factor = 0.5
			has_institution = printing_press
		}
	}
	
	option = {	#We shall invest in how to construct magnificent monuments!
		name = "resurgent_BYZ.27.a"
		ai_chance = { factor = 10 }
		
		add_country_modifier = { #-20% great project upgrade cost
			name = "byz_de_architectura_magnificent_monuments"
			duration = -1
		}
	}
	option = { #Let's install these water drainage wheels in our production facilities!
		name = "resurgent_BYZ.27.b"
		ai_chance = { factor = 10 }
		
		add_country_modifier = { #+10% goods produced modifier
			name = "byz_de_architectura_water_drainage_wheels"
			duration = -1
		}
	}
	option = { #Look into the Aeolipile.
		name = "resurgent_BYZ.27.c"
		ai_chance = { factor = 10 }
		
		custom_tooltip = resurgent_BYZ.27.c.tooltip
		set_country_flag = byz_looked_into_aeolipile
	}
	option = { #This Caeruleum substance looks interesting...
		name = "resurgent_BYZ.27.e"
		ai_chance = { factor = 70 }
		
		custom_tooltip = resurgent_BYZ.27.e.tooltip
		hidden_effect = {
			country_event = {
				id = resurgent_BYZ.28
				days = 30
			}
		}
	}
	option = { #I will not rest until I have finished this entire book myself!
		name = "resurgent_BYZ.27.f"
		ai_chance = { factor = 1000 }
		highlight = yes
		trigger = {
			ruler_has_personality_ancestor = { key = scholar }
		}
		
		custom_tooltip = resurgent_BYZ.27.f.tooltip
		add_country_modifier = { #-20% great project upgrade cost
			name = "byz_de_architectura_magnificent_monuments"
			duration = -1
		}
		add_country_modifier = { #+10% goods produced modifier
			name = "byz_de_architectura_water_drainage_wheels"
			duration = -1
		}
		custom_tooltip = resurgent_BYZ.27.c.tooltip
		set_country_flag = byz_looked_into_aeolipile
		custom_tooltip = resurgent_BYZ.27.e.tooltip
		hidden_effect = {
			country_event = {
				id = resurgent_BYZ.28
				days = 60
			}
		}
	}
}

country_event = { #28 The Rediscovery of Egyptian Blue
	id = resurgent_BYZ.28
	title = "resurgent_BYZ.28.t"
	desc = "resurgent_BYZ.28.d"
	picture = TRADEGOODS_eventPicture
	
	fire_only_once = yes
	is_triggered_only = yes
	
	major = yes #To notify others because price change.
	
	trigger = {
		358 = { 
			has_great_project = {
				type = library_of_alexandria
				tier = 1
			}
		}
		tag = BYZ
		calc_true_if = {
			amount = 10
			egypt_region = {
				type = all
				owned_by = ROOT
			}
		}
	}
	
	option = { #Let us create an industry centered around this new dye!
		name = "resurgent_BYZ.28.a" 
		ai_chance = { factor = 80 }
		
		random_owned_province = {
			limit = {
				region = egypt_region
				NOT = { has_province_flag = br_egyptian_blue }
			}
			change_trade_goods = dyes
			add_permanent_province_modifier = {
				name = "br_egyptian_blue"
				duration = -1
			}
			set_province_flag = br_egyptian_blue
		}
		random_owned_province = {
			limit = {
				region = egypt_region
				NOT = { has_province_flag = br_egyptian_blue }
			}
			change_trade_goods = dyes
			add_permanent_province_modifier = {
				name = "br_egyptian_blue"
				duration = -1
			}
			set_province_flag = br_egyptian_blue
		}
		
		random_owned_province = {
			limit = {
				region = egypt_region
				NOT = { has_province_flag = br_egyptian_blue }
			}
			change_trade_goods = dyes
			add_permanent_province_modifier = {
				name = "br_egyptian_blue"
				duration = -1
			}
			set_province_flag = br_egyptian_blue
		}
		change_price = {
			trade_goods = dyes
			key = byz_egyptian_blue
			value = -0.25
			duration = -1
		}
		hidden_effect = {
			every_owned_province = {
				clr_province_flag = br_egyptian_blue
			}
		}
	}
	
	option = { #Let us take care not to impact the overall price of dyes too much
		name = "resurgent_BYZ.28.b" 
		ai_chance = { factor = 10 }
		
		
		random_owned_province = {
			limit = {
				region = egypt_region
				NOT = { has_province_flag = br_egyptian_blue }
			}
			change_trade_goods = dyes
			set_province_flag = br_egyptian_blue
		}
		random_owned_province = {
			limit = {
				region = egypt_region
				NOT = { has_province_flag = br_egyptian_blue }
			}
			change_trade_goods = dyes
			set_province_flag = br_egyptian_blue
		}
		change_price = {
			trade_goods = dyes
			key = byz_egyptian_blue
			value = -0.1
			duration = -1
		}
		hidden_effect = {
			every_owned_province = {
				clr_province_flag = br_egyptian_blue
			}
		}
		
	}
	
	option = { #We shall forget we ever discovered this substance
		name = "resurgent_BYZ.28.c" 
		ai_chance = { factor = 10 }
		
		custom_tooltip = resurgent_BYZ.28.c.tooltip
	}
}

country_event = { #29 The Return of Pneumatica
	id = resurgent_BYZ.29
	title = "resurgent_BYZ.29.t"
	desc = "resurgent_BYZ.29.d"
	picture = BIG_BOOK_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		is_institution_enabled = manufactories
		358 = { 
			has_great_project = {
				type = library_of_alexandria
				tier = 1
			}
		}
		tag = BYZ
		has_country_flag = byz_looked_into_aeolipile
		
	}
	
	mean_time_to_happen = {
		years = 20
	}
	
	option = { #It appears that the Aeolipile has some practical use!
		name = "resurgent_BYZ.29.a"
		ai_chance = { factor = 1 }
		151 = {  #Constantinople lacks Manufactories
			if = {
				limit = {
					NOT = { manufactories = 100 }
				}
				add_institution_embracement = {
					which = manufactories
					value = 100
				}
			}
			else = {
				add_base_tax = 1
				add_base_production = 1
			}
		}
		358 = { #Alexandria lacks Manufactories
			if = { 
				limit = {
					NOT = { manufactories = 100 }
				}
				add_institution_embracement = {
					which = manufactories
					value = 100
				}
			}
			else = {
				add_base_tax = 1
				add_base_production = 1
			}
		}
		add_country_modifier = {
			name = "byz_steam_powered_boats"
			duration = -1
		}
	}
}

country_event = { #30 Coal to Power the Aeolipile
	id = resurgent_BYZ.30
	title = "resurgent_BYZ.30.t"
	desc = "resurgent_BYZ.30.d"
	picture = TRADE_GOODS_METALS_AND_MINING_EQUIPENT_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		has_institution = manufactories
		358 = { 
			has_great_project = {
				type = library_of_alexandria
				tier = 1
			}
		}
		tag = BYZ
		has_country_flag = byz_looked_into_aeolipile
		has_country_modifier = byz_steam_powered_boats
	}
	
	
	mean_time_to_happen = {
		years = 20
	}
	
	option = { #Let us dig greedily and deep!
		name = "resurgent_BYZ.30.a"
		ai_chance = { factor = 1 }
		
		if = {
			limit = { has_dlc = "Rule Britannia" }
			custom_tooltip = earlier_coal_available_tt
		}
		set_country_flag = earlier_coal_available
	}
}

country_event = { #32 The city of Ailia and the Jews
	id = resurgent_BYZ.32
	title = "resurgent_BYZ.32.t" 
	desc = "resurgent_BYZ.32.d"
	picture = JERUSALEM_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		tag = BYZ
		religion_group = christian
		379 = { owned_by = ROOT }
	}
	
	mean_time_to_happen = {
		months = 6
	}
	
	option = {
		name = "resurgent_BYZ.32.a" #Keep the ban on the Jews
		add_ruler_modifier = {
			name = "ruler_kept_jewish_ban"
		}
		add_patriarch_authority = 0.10
		set_country_flag = byz_kept_jewish_ban #For follow-up events or such
		
		ai_chance = {
			factor = 95
			modifier = {
				factor = 2
				patriarch_authority = 0.25
			} #Patriarch authority may influence the Basileus
			modifier = {
				factor = 2
				patriarch_authority = 0.50
			} #Patriarch authority may influence the Basileus
			modifier = {
				factor = 2
				patriarch_authority = 0.75
			} #Patriarch authority may influence the Basileus
			modifier = {
				factor = 0
				has_idea_group = humanist_ideas
			}
		}
	}
	option = {
		name = "resurgent_BYZ.32.b" #Lift the ban and build a Third Temple
		379 = {
			change_religion = jewish
			on_province_religion_converted_estate_privileges_effect = yes
			add_province_modifier = {
				name = "built_third_temple"
				duration = -1
			} #To counteract Tolerance True Faith -> Tolerance Heathen, whose difference is likely to be this high for the Byzantines even without religious ideas
			add_province_modifier = {
				name = "religious_center"
				duration = -1
			}
			add_base_tax = 2
			add_base_production = 2
			change_province_name = "Hierosolyma"
		}
		add_years_of_income = -2.50
		add_ruler_modifier = {
			name = "ruler_lifted_jewish_ban"
		}
		add_patriarch_authority = -0.10
		set_country_flag = byz_lifted_jewish_ban #For follow-up events or such
		
		ai_chance = {
			factor = 5 #It is highly unlikely a Basileus would do this unless specifically not in tune with the church or wishes religious freedom (humanist ideas).
			modifier = {
				factor = 2
				NOT = { patriarch_authority = 5 }
			} #Low patriarch authority may influence the Basileus
			modifier = {
				factor = 10
				jewish = 0
			} #Good tolerance of jewish may influence the Basileus
			modifier = {
				factor = 10
				jewish = 2
			} #Good tolerance of jewish may influence the Basileus
			modifier = {
				factor = 0
				has_idea_group = religious_ideas
			}
		}
		
		
		
		
	}
}

country_event = { #33 The Patriarchate of Mecca?
	id = resurgent_BYZ.33
	title = "resurgent_BYZ.33.t" 
	desc = "resurgent_BYZ.33.d"
	picture = ORTHODOX_eventPicture
	
	fire_only_once = yes
	
	is_triggered_only = yes
	
	trigger = {
		religion = orthodox
	}
	
	option = { #Extend the Pentarchy!
		name = "resurgent_BYZ.33.a"
		385 = {
			add_province_modifier = {
				name = "patriarch_mecca_medina"
				duration = -1
			}
		}
	}
	option = { #Create an autonomous Patriarch!
		name = "resurgent_BYZ.33.b"
		custom_tooltip = resurgent_BYZ.33.b.tooltip
		hidden_effect = {
			byz_mecca_medina_provinces = {
				if = {
					limit = { is_core = ROOT }
					add_core = MKB
				}
				else = {
					add_permanent_claim = MKB
				}
			}
		}
		release = MKB
		create_march = MKB
		MKB = {
			hidden_effect = { change_government = theocracy	} #Needs to be here it seems, otherwise things just break.
			add_government_reform = leading_clergy_reform
			add_country_modifier = {
				name = "patriarch_mecca_medina"
				duration = -1
			}
		}
	}
}

country_event = { #Hidden exarch integrate event to de-lagify the exarches effect.
	id = resurgent_BYZ.34
	title = "resurgent_BYZ.34.t" 
	desc = "resurgent_BYZ.34.d"
	picture = ORTHODOX_eventPicture #Added to prevent errorlogging
	
	fire_only_once = yes
	hidden = yes
	
	is_triggered_only = yes
	
	trigger = {
	}
	
	option = { #Integrate
		name = "resurgent_BYZ.34.a"
		every_country = {
			limit = {
				is_exarch_tag_and_exarch_of_root_trigger = yes
			}
			ROOT = {
				inherit = PREV
			}
		}
	}
}

province_event = { #36 The Theme capital [ROOT.GetName] attracts the countryside populace
	id = resurgent_BYZ.36
	title = "resurgent_BYZ.36.t" 
	desc = "resurgent_BYZ.36.d"
	picture = CITY_DEVELOPMENT_eventPicture
	
	trigger = {
		has_province_modifier = byz_katepano_rule
		owner = {
			tag = BYZ
			has_estate = estate_generals
			any_owned_province = {
				development = 10
				NOT = { has_province_modifier = byz_katepano_rule }
				NOT = { province_has_center_of_trade_of_level = 2 }
				NOT = { province_has_center_of_trade_of_level = 3 }
			}
			NOT = { is_at_war = yes }
			NOT = { has_country_modifier = byz_disallowed_migration_country }
		}		
	}
	
	immediate = {
		hidden_effect = {
			owner = {
				random_owned_province = {
					limit = {
						development = 10
						NOT = { has_province_modifier = byz_katepano_rule }
						NOT = { province_has_center_of_trade_of_level = 2 }
						NOT = { province_has_center_of_trade_of_level = 3 }
					}
					set_province_flag = byz_emigration_province
				}
			}
			save_event_target_as = byz_immigration_province
		}
		
	}
	
	mean_time_to_happen = {
		years = 200 #As it's a province event, it needs to have a high MTTH, as multiple provinces having the potential of this to fire lowers this drastically.
	} 
	
	option = { 
		name = "resurgent_BYZ.36.a" #Let them move in
		owner = {
			every_owned_province = {
				limit = {
					has_province_flag = byz_emigration_province
				}
				random_list = {
					33 = {
						add_base_tax = -1
						event_target:byz_immigration_province = {
							add_base_tax = 1
						}
					}
					33 = {
						add_base_production = -1
						event_target:byz_immigration_province = {
							add_base_production = 1
						}
					}
					33 = {
						add_base_manpower = -1
						event_target:byz_immigration_province = {
							add_base_manpower = 1
						}
					}
				}
				clr_province_flag = byz_emigration_province
			}
		}
		
		ai_chance = {
			factor = 90
			modifier = {
				factor = 0
				owner = {
					estate_influence = { estate = estate_generals influence = 80 }
				}
			}
		}
	}
	option = {
		name = "resurgent_BYZ.36.b" #Stop the relocation attempt
		owner = {
			every_owned_province = {
				limit = {
					has_province_flag = byz_emigration_province
				}
				add_province_modifier = {
					name = "byz_disallowed_migration_province"
					duration = 3650
				}
				clr_province_flag = byz_emigration_province
			}
			add_country_modifier = {
				name = "byz_disallowed_migration_country"
				duration = 1825
			}
		}
		
		ai_chance = {
			factor = 10
		}
	}
}

country_event = { #37 The Rediscovery of Greek Fire
	id = resurgent_BYZ.37
	title = "resurgent_BYZ.37.t" 
	desc = "resurgent_BYZ.37.d"
	picture = SHIP_SAILING_eventPicture
	
	fire_only_once = yes
	major = yes
	
	trigger = {
		tag = BYZ
		OR = {
			owns = 2447 #It is theorized that Greek Fire was based on crude oil extracted from oil wells around Tmurakan
			owns = 4297 #Heliopolis in Syria, supposedly a city which has been influential in development of Greek Fire
		}
		OR = {
			galley_fraction = 0.5 #A lot of galleys. Basically more galleys than all your other ships combined, i.e heavies, transports, lights. If you do trade ships, you're probably not gonna get this.
			heavy_ship_fraction = 0.1 #This is a lot of heavies to have as an inland sea nation
		}
		NOT = { is_year = 1800 } #Around the time when fire ships became obsolete
	}
	
	mean_time_to_happen = {
		years = 400 #Adjusted from 200 due to it firing wayy too often, I feel.
		modifier = {
			factor = 0.5
			AND = { #Two important centers where the naphta used in Greek Fire was supposedly produced, or discovered.
				owns = 2447
				owns = 4297
			}
		}	
		modifier = {
			factor = 0.5
			AND = { #Very combat-focused navy.
				galley_fraction = 0.5 #A lot of galleys. Basically more galleys than all your other ships combined, i.e heavies, transports, lights. If you do trade ships, you're probably not gonna get this.
				heavy_ship_fraction = 0.1 #This is a lot of heavies to have as an inland sea nation
			}
		}	
		modifier = {
			factor = 0.5
			OR = { #Navally focused Byzantium should definitely be able to pick up Greek Fire more easily.
				full_idea_group = naval_ideas
				full_idea_group = maritime_ideas
			}
		}
		modifier = {
			factor = 0.5
			358 = { 
				has_great_project = {
					type = byz_library_of_alexandria
				}
			}
		}
	} #The rediscovery should be a lucky one, not something that should happen every game (Except if Naval Byzantium I suppose).
	
	option = { 
		name = "resurgent_BYZ.37.a" #Let's use this against our enemies once more! 
		if = {
			limit = {
				has_dlc = "Rule Britannia"
			}
			set_country_flag = br_rediscovered_greek_fire
			custom_tooltip = br_rediscovered_greek_fire_tooltip
		}
		else = {
			add_country_modifier = {
				name = "byz_greek_fire"
				duration = -1
			}
		}
		if = {
			limit = {
				owns = 2447
			}
			2447 = {
				change_trade_goods = bt_trade_good_gunpowder
			}
		}
		if = {
			limit = {
				owns = 4297
			}
			4297 = {
				change_trade_goods = bt_trade_good_gunpowder
			}
		}
		change_price = {
			trade_goods = bt_trade_good_gunpowder
			key = byz_greek_fire
			value = 0.2
			duration = -1
		}
		ai_chance = {
			factor = 90
		}
	}
	option = {
		name = "resurgent_BYZ.37.b" #Let's sell it to one of our allies
		trigger = {
			any_country = {
				alliance_with = BYZ
			}
		}
		add_years_of_income = 3.0
		random_country = {
			limit = {
				alliance_with = BYZ
			}
			add_country_modifier = {
				name = "byz_greek_fire"
				duration = -1
			}
		}
		if = {
			limit = {
				owns = 2447
			}
			2447 = {
				change_trade_goods = bt_trade_good_gunpowder
			}
		}
		if = {
			limit = {
				owns = 4297
			}
			4297 = {
				change_trade_goods = bt_trade_good_gunpowder
			}
		}
		change_price = {
			trade_goods = bt_trade_good_gunpowder
			key = byz_greek_fire
			value = 0.2
			duration = -1
		}
		ai_chance = {
			factor = 5
			modifier = {
				factor = 10
				ruler_has_personality = embezzler_personality
			}
		}
	}
	option = {
		name = "resurgent_BYZ.37.c" #Let's burn the documents and refrain from using it
		add_prestige = -5
		ai_chance = {
			factor = 5
		}
	}
}

country_event = { #38 The Return of Byzantine Freethinkers?
	id = resurgent_BYZ.38
	title = "resurgent_BYZ.38.t" 
	desc = "resurgent_BYZ.38.d"
	picture = BIG_BOOK_eventPicture
	
	fire_only_once = yes
	
	major = yes
	
	major_trigger = {
		capital_scope = { region = italy_region }
	}
	
	is_triggered_only = yes
	
	immediate = {
		hidden_effect = {
			capital_scope = { 
				save_global_event_target_as = byz_capital 
				set_variable = {
					which = byzConstantinopleFreeThinkers
					value = 0
				}
			}
		}
	}
	
	option = { #Invite the freethinkers!
		name = "resurgent_BYZ.38.a"
		ai_chance = { factor = 90 }
		add_prestige = 5
		every_country = {
			limit = {
				capital_scope = { region = italy_region }
				any_owned_province = { development = 20 }
			}
			country_event = {
				id = resurgent_BYZ.39
				days = 5
				random = 5
			}
		}
		country_event = {
			id = resurgent_BYZ.40
			days = 180
			random = 30
		}
	}
	
	option = { #Do not
		name = "resurgent_BYZ.38.b"
		ai_chance = { factor = 10 }
		add_prestige = -5
	}
}

country_event = { #39 Do we let Byzantine Freethinkers go?
	id = resurgent_BYZ.39
	title = "resurgent_BYZ.39.t" 
	desc = "resurgent_BYZ.39.d"
	picture = BIG_BOOK_eventPicture
	
	major = yes
	
	major_trigger = {
		tag = BYZ
	}
	
	is_triggered_only = yes

	option = { #Let them go
		name = "resurgent_BYZ.39.a"
		ai_chance = {
			factor = 25
		}
		random_owned_province = {
			limit = { development = 20 }
			add_base_tax = -1
			add_base_production = -1
			add_base_manpower = -1
		}
		event_target:byz_capital = {
			change_variable = {
				which = byzConstantinopleFreeThinkers
				value = 1
			}
		}
	}
	
	option = { #We must keep them here!
		name = "resurgent_BYZ.39.b"
		ai_chance = {
			factor = 75
			modifier = {
				factor = 0
				has_opinion = {
					who = BYZ
					value = 50
				}
			}
		}
		random_owned_province = {
			limit = { development = 20 }
			add_unrest = 5
		}
		
	}
}

country_event = { #40 The Freethinkers return!
	id = resurgent_BYZ.40
	title = "resurgent_BYZ.40.t"
	desc = { #If someone let freethinkers go
		trigger = {
			event_target:byz_capital = {
				check_variable = {
					which = byzConstantinopleFreeThinkers
					value = 1
				}
			}
		}
		desc = "resurgent_BYZ.40.da"
	}
	desc = { #If nobody let freethinkers go
		trigger = {
			NOT = {
				event_target:byz_capital = {
					check_variable = {
						which = byzConstantinopleFreeThinkers
						value = 1
					}
				}
			}
		}
		desc = "resurgent_BYZ.40.db"
	}
	picture = { #If someone let freethinkers go
		trigger = {
			event_target:byz_capital = {
				check_variable = {
					which = byzConstantinopleFreeThinkers
					value = 1
				}
			}
		}
		picture = GOOD_WITH_MONARCH_eventPicture
	}
	picture = { #If nobody let freethinkers go
		trigger = {
			NOT = {
				event_target:byz_capital = {
					check_variable = {
						which = byzConstantinopleFreeThinkers
						value = 1
					}
				}
			}
		}
		picture = BAD_WITH_MONARCH_eventPicture
	}
	
	fire_only_once = yes
	
	is_triggered_only = yes
	
	after = {
		hidden_effect = {
			event_target:byz_capital = {
				set_variable = {
					which = byzConstantinopleFreeThinkers
					value = 0
				}
			}
			clear_global_event_target = byz_capital
		}
	}
	
	option = { #Guards! Let them in!
		name = "resurgent_BYZ.40.a"
		trigger = {
			event_target:byz_capital = {
				check_variable = {
					which = byzConstantinopleFreeThinkers
					value = 1
				}
			}
		}
		event_target:byz_capital = { #Cannot use for-loop scripted effect because amount is a variable. Scripted triggers/effects do not support exporting variables apparently.
			custom_tooltip = byz_refugees_return_tooltip
			while = {
				limit = {
					check_variable = {
						which = byzConstantinopleFreeThinkers
						value = 1
					}
				}
				add_base_tax = 1
				add_base_production = 1
				add_base_manpower = 1
				subtract_variable = {
					which = byzConstantinopleFreeThinkers
					value = 1
				}
			}
		}
	}
	
	option = { #We'll have to take back our people by force!
		name = "resurgent_BYZ.40.b"
		trigger = {
			NOT = {
				event_target:byz_capital = {
					check_variable = {
						which = byzConstantinopleFreeThinkers
						value = 1
					}
				}
			}
		}
	}
}