﻿
namespace = roman_restoration

##################################################

### Roman Restoration Major Decision Events
# by Flavio Verna

# 0001 - Restoring Roman Empire as Byzantium
# 0003 - Restoring Roman Empire as HRE
# 0005 - New Emperor becomes Augustus
# 0006 - Old Emperor loses Augustus
# 0010/0024 - Old Roman Provinces are Restored
# 0100 - Schism is mended
# 0199, 0104, 0105, 0106, 0107 - Restored Patriarchate Events
# 0120 - Imposing the Iconoclast Patriarchate
# 0122 - Restoring the Ecumenical Patriarchate
# 0124 - Restoring the Papacy
# 0130 - Destroying the Papacy
# 0140 - Unifying Italy
# 0150 - Restoring Roman Empire as Italy
# 0160/0175 - Roman Empire dismantles pretenders

##################################################

##################################################
# Restoring the Roman Empire
##################################################
roman_restoration.0001 = {
	type = character_event
	title = roman_restoration.0001.t
	desc = {
		desc = roman_restoration.0001.desc.intro
		first_valid = {
			# Doing it as the Greeks.
			triggered_desc = {
				trigger = {
					root.culture = culture:greek
				}
				desc = roman_restoration.0001.desc.greeks
			}
			# Doing it as somebody else.
			desc = roman_restoration.0001.desc.other
		}
		first_valid = {
			# Doing it as Christians.
			triggered_desc = {
				trigger = {
					faith.OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
				}
				desc = roman_restoration.0001.desc.christians
			}
			# Doing it as Hellenics
			triggered_desc = {
				trigger = {
					faith.religion = faith:hellenic_pagan.religion
				}
				desc = roman_restoration.0001.desc.hellenics
			}
			desc = roman_restoration.0001.desc.fallback
		}
	}
	theme = emperor
	left_portrait = {
		character = scope:scoped_emperor
		animation = personality_honorable
	}

	immediate = {
		play_music_cue = "mx_cue_epic_sacral_moment"
		save_scope_as = scoped_emperor
		create_roman_empire_scripted_effect = yes
		create_story = restoring_roman_provinces_story
	}
	option = {
		name = roman_restoration.0001.a
		set_nickname_effect = { NICKNAME = nick_the_glorious }
		# Send narrative fluff to other players (if any).
		every_player = {
			limit = {
				this != root
				is_within_diplo_range = { CHARACTER = root }
			}
			trigger_event = roman_restoration.0002
		}
	}
}

# Players informed of some fucko declaring a new Rome
roman_restoration.0002 = {
	type = character_event
	title = roman_restoration.0002.t
	desc = {
		desc = roman_restoration.0002.desc
		first_valid = {
			# Christians freaking out.
			triggered_desc = {
				trigger = {
					scope:scoped_emperor = { faith.religion = faith:hellenic_pagan.religion }
					faith.religion = faith:catholic.religion
				}
				desc = roman_restoration.0002.desc.hellenics
			}
			# Regular.
			desc = roman_restoration.0002.desc.christians
		}
	}
	theme = realm
	left_portrait = {
		character = scope:scoped_emperor
		animation = personality_honorable
	}

	immediate = {
		#Same-faith non-empire tier rulers are over-awed.
		if = {
			limit = { faith = scope:scoped_emperor.faith }
			play_music_cue = "mx_cue_epic_sacral_moment"
		}
		#Otherwise, this is a tacit statement of imperial threat.
		else = { play_music_cue = "mx_cue_combat_2" }
	}

	option = {
		name = { # Regular
			trigger = {
				NAND = {
					scope:scoped_emperor = { faith.religion = faith:hellenic_pagan.religion }
					faith.religion = faith:catholic.religion
				}
				NOT = {
					has_title = title:e_hre
				}
			}
			text = roman_restoration.0002.a
		}
		name = { # Regular HRE
			trigger = {
				NAND = {
					scope:scoped_emperor = { faith.religion = faith:hellenic_pagan.religion }
					faith.religion = faith:catholic.religion
				}
				has_title = title:e_hre
			}
			text = roman_restoration.0002.b
		}
		name = { # Crazy Hellenics
			trigger = {
				scope:scoped_emperor = { faith.religion = faith:hellenic_pagan.religion }
				faith.religion = faith:catholic.religion
				NOT = {
					has_title = title:e_hre
				}
			}
			text = roman_restoration.0002.c
		}
		name = { # Crazy Hellenics HRE
			trigger = {
				scope:scoped_emperor = { faith.religion = faith:hellenic_pagan.religion }
				faith.religion = faith:catholic.religion
				has_title = title:e_hre
			}
			text = roman_restoration.0002.d
		}
	}
	option = {
		name = roman_restoration.0002.e
		fallback = yes
	}
}

##################################################
# Holy Roman Empire for realsies this time.
##################################################

roman_restoration.0003 = {
	type = character_event
	title = roman_restoration.0003.t
	desc = {
		first_valid = {
			# Doing it as the Greeks.
			triggered_desc = {
				trigger = {
					root.culture = culture:greek
				}
				desc = roman_restoration.0003.desc.greeks
			}
			# Doing it as somebody else.
			triggered_desc = {
				trigger = {
					NOT = {
						root.culture = culture:greek
					}
				}
				desc = roman_restoration.0003.desc.other
			}
		}
		desc = roman_restoration.0003.desc
	}
	theme = realm
	left_portrait = {
		character = scope:scoped_emperor
		animation = personality_honorable
	}

	immediate = {
		play_music_cue = "mx_cue_epic_sacral_moment"
		save_scope_as = scoped_emperor
		create_roman_empire_holy_scripted_effect = yes
	}

	option = {
		name = roman_restoration.0003.a
		set_nickname_effect = { NICKNAME = nick_the_glorious }
		# Send narrative fluff to other players (if any).
		every_player = {
			limit = {
				this != root
				is_within_diplo_range = { CHARACTER = root }
			}
			trigger_event = roman_restoration.0004
		}
	}
}

# Players informed of (Holy) Roman Empire being reborn.
roman_restoration.0004 = {
	type = character_event
	title = roman_restoration.0004.t
	desc = {
		first_valid = {
			# Reaction of the Byzantines (if they are even still around)
			triggered_desc = {
				trigger = {
					OR = {
						has_title = title:e_byzantium
						any_liege_or_above = {
							has_title = title:e_byzantium
						}
					}
				}
				desc = roman_restoration.0004.desc.byzantines
			}
			# Everybody else.
			triggered_desc = {
				trigger = {
					NOR = {
						has_title = title:e_byzantium
						any_liege_or_above = {
							has_title = title:e_byzantium
						}
					}
				}
				desc = roman_restoration.0004.desc.others
			}
		}
	}
	theme = realm
	left_portrait = {
		character = scope:scoped_emperor
		animation = personality_honorable
	}

	immediate = {
		#Same-faith non-empire tier rulers are over-awed.
		if = {
			limit = { faith = scope:scoped_emperor.faith }
			play_music_cue = "mx_cue_epic_sacral_moment"
		}
		#Otherwise, this is a tacit statement of imperial threat.
		else = { play_music_cue = "mx_cue_combat_2" }
	}

	option = {
		name = roman_restoration.0004.a
		trigger = {
			NOT = {
				has_title = title:e_byzantium
			}
		}
	}
	option = {
		name = roman_restoration.0004.b
		trigger = {
			has_title = title:e_byzantium
		}
		stress_impact = {
			base = medium_stress_impact_gain
		}
	}
}

# on_new_holder: New Emperor gets the Augustus Trait.
roman_restoration.0005 = {
	type = character_event
	title = roman_restoration.0005.t
	desc = {
		first_valid = {
			# Regular Roman Empire
			triggered_desc = {
				trigger = {
					NOT = {
						exists = title:h_roman_empire.var:variable_restored_hre
					}
				}
				desc = roman_restoration.0005.desc.regular
			}
			# Holy Roman Empire
			triggered_desc = {
				trigger = {
					exists = title:h_roman_empire.var:variable_restored_hre
				}
				desc = roman_restoration.0005.desc.holy
			}
		}
	}
	theme = realm
	left_portrait = {
		character = root
		animation = personality_bold
	}

	trigger = {
		OR = {
			scope:title = title:h_roman_empire
			scope:title = title:h_eastern_roman_empire
		}
		NOT = { has_trait = augustus }
	}

	immediate = {
		if = {
			limit = {
				scope:previous_holder = {
					any_owned_story = {
						type = restoring_roman_provinces_story
					}
				}
			}
			hidden_effect = {
				scope:previous_holder = {
					random_owned_story = {
						type = restoring_roman_provinces_story
						end_story = yes
					}
				}
				create_story = restoring_roman_provinces_story
			}
		}

		if = {
			limit = { scope:previous_holder = { is_alive = yes has_trait = augustus } }
			save_scope_as = new_holder
			scope:previous_holder = { trigger_event = roman_restoration.0006 }
		}
	}

	option = {
		name = roman_restoration.0005.a
		add_trait = augustus
	}
}

# If old holder is still alive, he will lose the trait.
roman_restoration.0006 = {
	type = character_event
	title = roman_restoration.0006.t
	desc = roman_restoration.0006.desc
	theme = realm
	left_portrait = {
		character = root
		animation = shame
	}

	immediate = {
		#This is so sad: Alexios, play dungeonito.
		play_music_cue = "mx_cue_prison"
	}

	trigger = {
		is_alive = yes
		has_trait = augustus
	}

	option = {
		name = roman_restoration.0006.a
		remove_trait = augustus
		stress_impact = {
			base = minor_stress_impact_gain
		}
	}
}

##################################################
# Recovering old Provinces.
##################################################

# All events fired on_yearly pulses, checking for dejure Duchies.
# Mostly just for flavor.

scripted_trigger roman_restoration_0010_is_valid_roman_empire_trigger = {
	is_ai = no
	is_roman_emperor_trigger = yes
	OR = {
		faith.religion = faith:catholic.religion # Either Christian
		faith.religion = faith:hellenic_pagan.religion # Or Hellenic
	}
}

# Provincia Syria Palaestina
# Provincia Aegyptus
# Provincia Cyrenaica
# Provincia Africa
# Provincia Illyricum
# Provincia Italia
# Provincia Gallia
# Provincia Germania
# Provincia Britannia
# Provincia Hispania
# Provincia Mauretania
# Provincia Mesopotamia
# Provincia Caledonia
# Provincia Hibernia
# Imperial Borders (all provinces restored)

# Provincia Syria Palaestina
roman_restoration.0010 = {
	type = character_event
	title = roman_restoration.0010.t
	desc = roman_restoration.0010.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_honorable
	}

	trigger = {
		roman_restoration_0010_is_valid_roman_empire_trigger = yes
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_roman_provinces_variable_list
				target = flag:flag_re_restored_syria
			}
		}
		NOT = { has_character_flag = flag_roman_province_cooldown }
		completely_controls_region = custom_roman_syria_palestina
	}

	immediate = {
		add_to_global_variable_list = {
			name = restored_roman_provinces_variable_list
			target = flag:flag_re_restored_syria
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_roman_province_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0010.a
		add_prestige = major_prestige_gain
	}
}

# Provincia Aegyptus
roman_restoration.0011 = {
	type = character_event
	title = roman_restoration.0011.t
	desc = roman_restoration.0011.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_honorable
	}

	trigger = {
		roman_restoration_0010_is_valid_roman_empire_trigger = yes
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_roman_provinces_variable_list
				target = flag:flag_re_restored_aegyptus
			}
		}
		NOT = { has_character_flag = flag_roman_province_cooldown }
		completely_controls_region = custom_roman_aegyptus
	}

	immediate = {
		add_to_global_variable_list = {
			name = restored_roman_provinces_variable_list
			target = flag:flag_re_restored_aegyptus
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_roman_province_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0010.a
		add_prestige = major_prestige_gain
	}
}
# Provincia Cyrenaica
roman_restoration.0012 = {
	type = character_event
	title = roman_restoration.0012.t
	desc = roman_restoration.0012.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_honorable
	}

	trigger = {
		roman_restoration_0010_is_valid_roman_empire_trigger = yes
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_roman_provinces_variable_list
				target = flag:flag_re_restored_cyrenaica
			}
		}
		NOT = { has_character_flag = flag_roman_province_cooldown }
		completely_controls_region = custom_roman_cyrenaica
	}

	immediate = {
		add_to_global_variable_list = {
			name = restored_roman_provinces_variable_list
			target = flag:flag_re_restored_cyrenaica
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_roman_province_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0010.a
		add_prestige = major_prestige_gain
	}
}
# Provincia Africa
roman_restoration.0013 = {
	type = character_event
	title = roman_restoration.0013.t
	desc = roman_restoration.0013.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_honorable
	}

	trigger = {
		roman_restoration_0010_is_valid_roman_empire_trigger = yes
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_roman_provinces_variable_list
				target = flag:flag_re_restored_africa
			}
		}
		NOT = { has_character_flag = flag_roman_province_cooldown }
		completely_controls_region = custom_roman_africa
	}

	immediate = {
		add_to_global_variable_list = {
			name = restored_roman_provinces_variable_list
			target = flag:flag_re_restored_africa
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_roman_province_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0010.a
		add_prestige = major_prestige_gain
	}
}
# Provincia Illyricum
roman_restoration.0014 = {
	type = character_event
	title = roman_restoration.0014.t
	desc = roman_restoration.0014.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_honorable
	}

	trigger = {
		roman_restoration_0010_is_valid_roman_empire_trigger = yes
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_roman_provinces_variable_list
				target = flag:flag_re_restored_illyricum
			}
		}
		NOT = { has_character_flag = flag_roman_province_cooldown }
		completely_controls_region = custom_roman_illyricum
	}

	immediate = {
		add_to_global_variable_list = {
			name = restored_roman_provinces_variable_list
			target = flag:flag_re_restored_illyricum
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_roman_province_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0010.a
		add_prestige = major_prestige_gain
	}
}
# Provincia Italia
roman_restoration.0015 = {
	type = character_event
	title = roman_restoration.0015.t
	desc = roman_restoration.0015.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_honorable
	}

	trigger = {
		roman_restoration_0010_is_valid_roman_empire_trigger = yes
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_roman_provinces_variable_list
				target = flag:flag_re_restored_italia
			}
		}
		NOT = { exists = title:h_roman_empire.var:variable_restored_italy }
		NOT = { has_character_flag = flag_roman_province_cooldown }
		completely_controls_region = world_europe_south_italy
	}

	immediate = {
		add_to_global_variable_list = {
			name = restored_roman_provinces_variable_list
			target = flag:flag_re_restored_italia
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_roman_province_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0010.a
		add_prestige = major_prestige_gain
	}
}
# Provincia Gallia
roman_restoration.0016 = {
	type = character_event
	title = roman_restoration.0016.t
	desc = roman_restoration.0016.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_honorable
	}

	trigger = {
		roman_restoration_0010_is_valid_roman_empire_trigger = yes
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_roman_provinces_variable_list
				target = flag:flag_re_restored_gallia
			}
		}
		NOT = { has_character_flag = flag_roman_province_cooldown }
		completely_controls_region = world_europe_west_francia
	}

	immediate = {
		add_to_global_variable_list = {
			name = restored_roman_provinces_variable_list
			target = flag:flag_re_restored_gallia
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_roman_province_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0010.a
		add_prestige = major_prestige_gain
	}
}
# Provincia Germania
roman_restoration.0017 = {
	type = character_event
	title = roman_restoration.0017.t
	desc = roman_restoration.0017.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_honorable
	}

	trigger = {
		roman_restoration_0010_is_valid_roman_empire_trigger = yes
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_roman_provinces_variable_list
				target = flag:flag_re_restored_germania
			}
		}
		NOT = { exists = title:h_roman_empire.var:variable_restored_hre }
		NOT = { has_character_flag = flag_roman_province_cooldown }
		completely_controls_region = world_europe_west_germania
	}

	immediate = {
		add_to_global_variable_list = {
			name = restored_roman_provinces_variable_list
			target = flag:flag_re_restored_germania
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_roman_province_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0010.a
		add_prestige = major_prestige_gain
	}
}
# Provincia Britannia
roman_restoration.0018 = {
	type = character_event
	title = roman_restoration.0018.t
	desc = roman_restoration.0018.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_honorable
	}

	trigger = {
		roman_restoration_0010_is_valid_roman_empire_trigger = yes
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_roman_provinces_variable_list
				target = flag:flag_re_restored_britannia
			}
		}
		NOT = { has_character_flag = flag_roman_province_cooldown }
		completely_controls_region = custom_wales
		completely_controls_region = custom_england
	}

	immediate = {
		add_to_global_variable_list = {
			name = restored_roman_provinces_variable_list
			target = flag:flag_re_restored_britannia
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_roman_province_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0010.a
		add_prestige = major_prestige_gain
	}
}
# Provincia Hispania
roman_restoration.0019 = {
	type = character_event
	title = roman_restoration.0019.t
	desc = roman_restoration.0019.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_honorable
	}

	trigger = {
		roman_restoration_0010_is_valid_roman_empire_trigger = yes
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_roman_provinces_variable_list
				target = flag:flag_re_restored_hispania
			}
		}
		NOT = { has_character_flag = flag_roman_province_cooldown }
		completely_controls_region = custom_roman_hispania
	}

	immediate = {
		add_to_global_variable_list = {
			name = restored_roman_provinces_variable_list
			target = flag:flag_re_restored_hispania
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_roman_province_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0010.a
		add_prestige = major_prestige_gain
	}
}
# Provincia Mauretania
roman_restoration.0020 = {
	type = character_event
	title = roman_restoration.0020.t
	desc = roman_restoration.0020.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_honorable
	}

	trigger = {
		roman_restoration_0010_is_valid_roman_empire_trigger = yes
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_roman_provinces_variable_list
				target = flag:flag_re_restored_mauretania
			}
		}
		NOT = { has_character_flag = flag_roman_province_cooldown }
		completely_controls_region = custom_roman_mauretania
	}

	immediate = {
		add_to_global_variable_list = {
			name = restored_roman_provinces_variable_list
			target = flag:flag_re_restored_mauretania
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_roman_province_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0010.a
		add_prestige = major_prestige_gain
	}
}
# Provincia Mesopotamia
roman_restoration.0021 = {
	type = character_event
	title = roman_restoration.0021.t
	desc = roman_restoration.0021.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_honorable
	}

	trigger = {
		roman_restoration_0010_is_valid_roman_empire_trigger = yes
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_roman_provinces_variable_list
				target = flag:flag_re_restored_mesopotamia
			}
		}
		NOT = { has_character_flag = flag_roman_province_cooldown }
		completely_controls_region = custom_roman_mesopotamia
	}

	immediate = {
		add_to_global_variable_list = {
			name = restored_roman_provinces_variable_list
			target = flag:flag_re_restored_mesopotamia
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_roman_province_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0010.a
		add_prestige = major_prestige_gain
	}
}
# Provincia Caledonia
roman_restoration.0022 = {
	type = character_event
	title = roman_restoration.0022.t
	desc = roman_restoration.0022.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_honorable
	}

	trigger = {
		roman_restoration_0010_is_valid_roman_empire_trigger = yes
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_roman_provinces_variable_list
				target = flag:flag_re_restored_caledonia
			}
		}
		NOT = { has_character_flag = flag_roman_province_cooldown }
		completely_controls_region = custom_roman_caledonia
	}

	immediate = {
		add_to_global_variable_list = {
			name = restored_roman_provinces_variable_list
			target = flag:flag_re_restored_caledonia
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_roman_province_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0010.a
		add_prestige = major_prestige_gain
	}
}
# Provincia Hibernia
roman_restoration.0023 = {
	type = character_event
	title = roman_restoration.0023.t
	desc = roman_restoration.0023.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_honorable
	}

	trigger = {
		roman_restoration_0010_is_valid_roman_empire_trigger = yes
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_roman_provinces_variable_list
				target = flag:flag_re_restored_hibernia
			}
		}
		NOT = { has_character_flag = flag_roman_province_cooldown }
		completely_controls_region = custom_roman_hibernia
	}

	immediate = {
		add_to_global_variable_list = {
			name = restored_roman_provinces_variable_list
			target = flag:flag_re_restored_hibernia
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_roman_province_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0010.a
		add_prestige = major_prestige_gain
	}
}

# Imperial Borders (all provinces restored)
roman_restoration.0024 = {
	type = character_event
	title = roman_restoration.0024.t
	desc = {
		desc = roman_restoration.0024.desc.intro
		first_valid = {
			# Christian Roman Empire
			triggered_desc = {
				trigger = {
					faith.religion = faith:catholic.religion
				}
				desc = roman_restoration.0024.desc.christian
			}
			# Hellenic Roman Empire
			triggered_desc = {
				trigger = {
					faith.religion = faith:hellenic_pagan.religion
				}
				desc = roman_restoration.0024.desc.hellenic
			}
			# Fallback Roman Empire
			triggered_desc = {
				trigger = {
					NOR = {
						faith.religion = faith:catholic.religion
						faith.religion = faith:hellenic_pagan.religion
					}
				}
				desc = roman_restoration.0024.desc.fallback
			}
		}
	}
	theme = realm
	left_portrait = {
		character = root
		animation = personality_honorable
	}

	trigger = {
		roman_restoration_0010_is_valid_roman_empire_trigger = yes
		is_roman_emperor_excluding_byzantium_trigger = yes
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_roman_provinces_variable_list
				target = flag:flag_re_restored_all
			}
		}
		NOT = { has_character_flag = flag_roman_province_cooldown }
		completely_controls_region = custom_roman_full_borders
	}

	immediate = {
		play_music_cue = "mx_cue_epic_sacral_moment"
		add_to_global_variable_list = {
			name = restored_roman_provinces_variable_list
			target = flag:flag_re_restored_all
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_roman_province_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0010.a
		add_prestige = major_prestige_gain
		hidden_effect = {
			random_owned_story = {
				type = restoring_roman_provinces_story
				end_story = yes
			}
		}
	}
}

##################################################
# Schism events.
##################################################

roman_restoration.0100 = {
	type = character_event
	title = roman_restoration.0100.t
	desc = {
		desc = roman_restoration.0100.desc.intro
		first_valid = {
			# As an Orthodox
			triggered_desc = {
				trigger = {
					faith = faith:orthodox
				}
				desc = roman_restoration.0100.desc.orthodox
			}
			# As a Catholic
			triggered_desc = {
				trigger = {
					faith = faith:catholic
				}
				desc = roman_restoration.0100.desc.catholic
			}
			# And Everybody else
			triggered_desc = {
				trigger = {
					NOR = {
						faith = faith:catholic
						faith = faith:orthodox
					}
				}
				desc = roman_restoration.0100.desc.generic
			}
		}
	}
	theme = realm
	left_portrait = {
		character = scope:scoped_emperor
		animation = personality_zealous
	}

	immediate = {
		play_music_cue = "mx_cue_faith_conversion"
		save_scope_as = scoped_emperor
		faith = { save_scope_as = mending_faith }
		mend_great_schism_scripted_effect = yes
		if = {
			limit = {
				scope:mending_faith = faith:orthodox
			}
			faith:catholic = {
				save_scope_as = loser_faith
			}
		}
		else_if = {
			limit = {
				scope:mending_faith = faith:catholic
			}
			faith:orthodox = {
				save_scope_as = loser_faith
			}
		}
		else = {
			religion = {
				random_faith = {
					limit = {
						exists = religious_head
						this != scope:mending_faith
					}
					save_scope_as = loser_faith
				}
			}
		}
		legend_seed_great_deed_faith_effect = {
			ANTAGONIST = scope:loser_faith.religious_head
			OLD_FAITH = scope:loser_faith
		}
	}

	option = {
		name = roman_restoration.0100.a
	}
}

# Ecumenical followers get chance to convert.
roman_restoration.0101 = {
	type = character_event
	title = roman_restoration.0100.t
	desc = {
		desc = roman_restoration.0101.desc.intro
		first_valid = {
			# As an Orthodox
			triggered_desc = {
				trigger = {
					scope:mending_faith = faith:orthodox
				}
				desc = roman_restoration.0101.desc.orthodox
			}
			# As a Catholic
			triggered_desc = {
				trigger = {
					scope:mending_faith = faith:catholic
				}
				desc = roman_restoration.0101.desc.catholic
			}
			# And Everybody else
			triggered_desc = {
				trigger = {
					NOR = {
						scope:mending_faith = faith:catholic
						scope:mending_faith = faith:orthodox
					}
				}
				desc = roman_restoration.0101.desc.generic
			}
		}
	}
	theme = realm
	left_portrait = {
		character = scope:scoped_emperor
		animation = personality_zealous
	}

	immediate = {
		play_music_cue = "mx_cue_faith_conversion"
		faith = { save_scope_as = old_faith }
	}

	option = {
		name = roman_restoration.0101.a
		trigger = {
			OR = {
				is_ai = no
				NOT = { has_trait = zealous } # Never!
			}
		}
		set_character_faith = scope:mending_faith
		every_held_title = {
			title_tier = county
			set_county_faith = scope:mending_faith
		}
		ai_chance = {
			base = 80
			modifier = { # Where the wind blows, I sail.
				add = 20
				has_trait = cynical
			}
		}
	}
	option = {
		name = roman_restoration.0101.b
		ai_chance = {
			base = 20
			ai_value_modifier = {
				ai_zeal = 1.0
			}
			modifier = {
				add = 20
				has_trait = zealous
			}
			modifier = {
				add = 10
				OR = {
					has_title = title:e_byzantium
					has_title = title:e_hre
				}
			}
		}
	}
}

# Heretics and Heathens are only notified.
roman_restoration.0102 = {
	type = character_event
	title = roman_restoration.0100.t
	desc = {
		desc = roman_restoration.0101.desc.intro
		first_valid = {
			# As an Orthodox
			triggered_desc = {
				trigger = {
					scope:mending_faith = faith:orthodox
				}
				desc = roman_restoration.0101.desc.orthodox
			}
			# As a Catholic
			triggered_desc = {
				trigger = {
					scope:mending_faith = faith:catholic
				}
				desc = roman_restoration.0101.desc.catholic
			}
			# And Everybody else
			triggered_desc = {
				trigger = {
					NOR = {
						scope:mending_faith = faith:catholic
						scope:mending_faith = faith:orthodox
					}
				}
				desc = roman_restoration.0101.desc.generic
			}
		}
	}
	theme = realm
	left_portrait = {
		character = scope:scoped_emperor
		animation = personality_zealous
	}

	immediate = {
		#Even if you're not converting, it's still all rather momentous.
		play_music_cue = "mx_cue_faith_conversion"
	}

	option = {
		name = roman_restoration.0102.a
	}
}

# Faithful players notified.
roman_restoration.0103 = {
	type = character_event
	title = roman_restoration.0100.t
	desc = {
		desc = roman_restoration.0100.desc.intro
		first_valid = {
			# As an Orthodox
			triggered_desc = {
				trigger = {
					scope:mending_faith = faith:orthodox
				}
				desc = roman_restoration.0100.desc.orthodox
			}
			# As a Catholic
			triggered_desc = {
				trigger = {
					scope:mending_faith = faith:catholic
				}
				desc = roman_restoration.0100.desc.catholic
			}
			# And Everybody else
			triggered_desc = {
				trigger = {
					NOR = {
						scope:mending_faith = faith:catholic
						scope:mending_faith = faith:orthodox
					}
				}
				desc = roman_restoration.0100.desc.generic
			}
		}
	}
	theme = realm
	left_portrait = {
		character = scope:scoped_emperor
		animation = personality_zealous
	}

	immediate = {
		#Even if you're not converting, it's still all rather momentous.
		play_music_cue = "mx_cue_faith_conversion"
	}

	option = {
		name = roman_restoration.0100.a
	}
}

##################################################
# Flavor for restoring the Pentarchy as the Orthodox ERE.
##################################################

# All on_yearly_action pulse.

# Patriarchate of Antioch
# Patriarchate of Jerusalem
# Patriarchate of Alexandria
# Patriarchate of Rome

scripted_trigger roman_restoration_0104_is_valid_roman_empire_trigger = {
	is_roman_emperor_trigger = yes
	faith = faith:orthodox
	faith = { has_doctrine = special_doctrine_ecumenical_christian }
}

# on_new_holder hidden event to check title and conqueror.
roman_restoration.0199 = {
	type = character_event
	hidden = yes

	trigger = {
		OR = {
			scope:title = title:c_antiocheia
			scope:title = title:c_jerusalem
			scope:title = title:c_alexandria
			scope:title = title:c_roma
		}
		OR = {
			AND = {
				roman_restoration_0104_is_valid_roman_empire_trigger = yes
				faith = faith:orthodox
			}
			any_liege_or_above = {
				roman_restoration_0104_is_valid_roman_empire_trigger = yes
				faith = faith:orthodox
			}
		}
	}

	immediate = {
		if = {
			limit = {
				any_liege_or_above = {
					roman_restoration_0104_is_valid_roman_empire_trigger = yes
					faith = faith:orthodox
				}
			}
			random_liege_or_above = {
				limit = {
					roman_restoration_0104_is_valid_roman_empire_trigger = yes
					faith = faith:orthodox
				}
				trigger_event = {
					on_action = on_action_orthodox_pentarchy_pulse
				}
			}
		}
		else = {
			trigger_event = {
				on_action = on_action_orthodox_pentarchy_pulse
			}
		}
	}
}

# Patriarchate of Antioch
roman_restoration.0104 = {
	type = character_event
	title = roman_restoration.0104.t
	desc = roman_restoration.0104.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_zealous
	}

	trigger = {
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_pentarchy_seants_variable_list
				target = flag:flag_re_restored_antioch
			}
		}
		NOT = { has_character_flag = flag_orthodox_patriarchate_cooldown }
		roman_restoration_0104_is_valid_roman_empire_trigger = yes
		scope:title = title:c_antiocheia
		#title:c_antiocheia.holder.faith = root.faith #Not under an infidel vassal.
	}

	immediate = {
		play_music_cue = "mx_cue_sacredrite"
		add_to_global_variable_list = {
			name = restored_pentarchy_seants_variable_list
			target = flag:flag_re_restored_antioch
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_orthodox_patriarchate_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0104.a
		add_piety = major_piety_gain
	}
}

# Patriarchate of Jerusalem
roman_restoration.0105 = {
	type = character_event
	title = roman_restoration.0105.t
	desc = roman_restoration.0105.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_zealous
	}

	trigger = {
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_pentarchy_seants_variable_list
				target = flag:flag_re_restored_jerusalem
			}
		}
		NOT = { has_character_flag = flag_orthodox_patriarchate_cooldown }
		roman_restoration_0104_is_valid_roman_empire_trigger = yes
		scope:title = title:c_jerusalem
		#title:c_jerusalem.holder.faith = root.faith #Not under an infidel vassal.
	}

	immediate = {
		play_music_cue = "mx_cue_sacredrite"
		add_to_global_variable_list = {
			name = restored_pentarchy_seants_variable_list
			target = flag:flag_re_restored_jerusalem
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_orthodox_patriarchate_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0104.a
		add_piety = major_piety_gain
	}
}

# Patriarchate of Alexandria
roman_restoration.0106 = {
	type = character_event
	title = roman_restoration.0106.t
	desc = roman_restoration.0106.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_zealous
	}

	trigger = {
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_pentarchy_seants_variable_list
				target = flag:flag_re_restored_alexandria
			}
		}
		NOT = { has_character_flag = flag_orthodox_patriarchate_cooldown }
		roman_restoration_0104_is_valid_roman_empire_trigger = yes
		scope:title = title:c_alexandria
		#title:c_alexandria.holder.faith = root.faith #Not under an infidel vassal.
	}

	immediate = {
		play_music_cue = "mx_cue_sacredrite"
		add_to_global_variable_list = {
			name = restored_pentarchy_seants_variable_list
			target = flag:flag_re_restored_alexandria
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_orthodox_patriarchate_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0104.a
		add_piety = major_piety_gain
	}
}

# Patriarchate of Rome
roman_restoration.0107 = {
	type = character_event
	title = roman_restoration.0107.t
	desc = roman_restoration.0107.desc
	theme = emperor
	left_portrait = {
		character = root
		animation = personality_zealous
	}

	trigger = {
		NOT = { # Only happens once.
			is_target_in_global_variable_list = {
				name = restored_pentarchy_seants_variable_list
				target = flag:flag_re_restored_roma
			}
		}
		NOT = { has_character_flag = flag_orthodox_patriarchate_cooldown }
		roman_restoration_0104_is_valid_roman_empire_trigger = yes
		scope:title = title:c_roma
		#title:c_roma.holder.faith = root.faith #Not under an infidel vassal.
	}

	immediate = {
		play_music_cue = "mx_cue_sacredrite"
		add_to_global_variable_list = {
			name = restored_pentarchy_seants_variable_list
			target = flag:flag_re_restored_roma
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_orthodox_patriarchate_cooldown
				days = 400
			}
		}
	}

	option = {
		name = roman_restoration.0104.a
		add_piety = major_piety_gain
	}
}



##################################################
# Imposing Iconoclast Patriarchate
##################################################

roman_restoration.0120 = {
	type = character_event
	title = roman_restoration.0120.t
	desc = roman_restoration.0120.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_vengeful
	}
	right_portrait = {
		character = scope:new_pope
		animation = personality_zealous
	}

	immediate = {
		play_music_cue = "mx_cue_sacredrite"
		save_scope_as = reformer
		if = { # Pick your chaplain first.
			limit = {
				exists = cp:councillor_court_chaplain
				cp:councillor_court_chaplain = { faith = faith:iconoclast }
			}
			cp:councillor_court_chaplain = { save_scope_as = new_pope }
		}
		else = {
		 	hidden_effect = {
				create_character = {
					employer = root
					template = religious_leader_character
					random_traits = no
					save_scope_as = new_pope
					dynasty = generate
				}
			}
			scope:new_pope = {
				add_trait = education_learning_3
				add_trait = zealous
				add_trait = intellect_good_1
				random_list = {
					1 = { add_trait = lustful }
					1 = { add_trait = chaste }
					1 = { add_trait = wrathful }
					1 = { add_trait = diligent }
					1 = { add_trait = impatient }
					1 = { add_trait = arrogant }
					1 = { add_trait = humble }
					1 = { add_trait = gregarious }
				}
				random_list = {
					1 = { add_trait = honest }
					1 = { add_trait = ambitious }
					1 = { add_trait = just }
					1 = { add_trait = cynical }
					1 = { add_trait = zealous }
					1 = { add_trait = compassionate }
					1 = { add_trait = stubborn }
				}
			}
		}
		create_title_and_vassal_change = {
			type = returned
			save_scope_as = change
			add_claim_on_loss = no
		}
		title:d_iconoclast = {
			change_title_holder = {
				holder = scope:new_pope
				change = scope:change
			}
		}
		resolve_title_and_vassal_change = scope:change
		root = { destroy_title = title:k_orthodox }
		faith:iconoclast = {
			change_fervor = {
				value = 15
				desc = fervor_gain_iconoclast_patriarchate
			}
			if = {
				limit = { NOT = { has_doctrine = special_doctrine_ecumenical_christian } }
				add_doctrine = special_doctrine_ecumenical_christian
			}
		}
		faith:orthodox = {
			change_fervor = {
				value = -30
				desc = fervor_loss_iconoclast_patriarchate
			}
			if = {
				limit = { has_doctrine = special_doctrine_ecumenical_christian }
				remove_doctrine = special_doctrine_ecumenical_christian
			}
		}
	}

	option = {
		name = roman_restoration.0120.a
		add_piety = major_piety_gain
		every_player = {
			limit = {
				this != root
				faith.religion = faith:orthodox.religion
			}
			trigger_event = roman_restoration.0121 # Notification.
		}
		if = { # Vassalize if possible/needed.
			limit = {
				highest_held_title_tier > scope:new_pope.highest_held_title_tier
				NOT = { scope:new_pope = { any_liege_or_above = { this = root } } }
			}
			create_title_and_vassal_change = {
				type = usurped
				save_scope_as = change
				add_claim_on_loss = no
			}
			scope:new_pope = {
				change_liege = {
					liege = root
					change = scope:change
				}
			}
			resolve_title_and_vassal_change = scope:change
		}
	}
}

# Christians notified.
roman_restoration.0121 = {
	type = character_event
	title = roman_restoration.0120.t
	desc = {
		first_valid = {
			# Orthodox Reaction
			triggered_desc = {
				trigger = {
					root.faith = faith:orthodox
				}
				desc = roman_restoration.0121.desc.orthodox
			}
			# Iconoclast reaction
			triggered_desc = {
				trigger = {
					root.faith = faith:iconoclast
				}
				desc = roman_restoration.0121.desc.iconoclast
			}
			# Every other Christian
			triggered_desc = {
				trigger = {
					NOR = {
						root.faith = faith:orthodox
						root.faith = faith:iconoclast
					}
				}
				desc = roman_restoration.0121.desc.other
			}
		}
	}
	theme = realm
	left_portrait = {
		character = scope:reformer
		animation = personality_vengeful
	}
	right_portrait = {
		character = scope:new_pope
		animation = personality_zealous
	}

	immediate = {
		#Iconoclasts consider this great.
		if = {
			limit = { root.faith = faith:iconoclast }
			play_music_cue = "mx_cue_sacredrite"
		}
		#Orthodox consider it monstrous.
		if = {
			limit = { root.faith = faith:orthodox }
			play_music_cue = "mx_cue_combat_2"
		}
	}

	option = {
		name = {
			trigger = {
				root.faith = faith:orthodox
			}
			text = roman_restoration.0121.a
		}
		name = {
			trigger = {
				root.faith = faith:iconoclast
			}
			text = roman_restoration.0121.b
		}
		if = {
			limit = {
				root.faith = faith:orthodox
			}
			stress_impact = {
				zealous = medium_stress_impact_gain
			}
		}
	}
	option = {
		name = roman_restoration.0121.c
		fallback = yes
	}
}

##################################################
# Restoring Ecumenical Patriarchate
##################################################

roman_restoration.0122 = {
	type = character_event
	title = roman_restoration.0122.t
	desc = roman_restoration.0122.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_vengeful
	}
	right_portrait = {
		character = scope:new_pope
		animation = personality_zealous
	}

	immediate = {
		play_music_cue = "mx_cue_sacredrite"
		save_scope_as = reformer
		if = { # Pick your chaplain first.
			limit = {
				exists = cp:councillor_court_chaplain
				cp:councillor_court_chaplain = { faith = faith:orthodox }
			}
			cp:councillor_court_chaplain = { save_scope_as = new_pope }
		}
		else = {
		 	hidden_effect = {
				create_character = {
					employer = root
					template = religious_leader_character
					random_traits = no
					save_scope_as = new_pope
					dynasty = generate
				}
			}
			scope:new_pope = {
				add_trait = education_learning_3
				add_trait = zealous
				add_trait = intellect_good_1
				random_list = {
					1 = { add_trait = lustful }
					1 = { add_trait = chaste }
					1 = { add_trait = wrathful }
					1 = { add_trait = diligent }
					1 = { add_trait = impatient }
					1 = { add_trait = arrogant }
					1 = { add_trait = humble }
					1 = { add_trait = gregarious }
				}
				random_list = {
					1 = { add_trait = honest }
					1 = { add_trait = ambitious }
					1 = { add_trait = just }
					1 = { add_trait = cynical }
					1 = { add_trait = zealous }
					1 = { add_trait = compassionate }
					1 = { add_trait = stubborn }
				}
			}
		}
		create_title_and_vassal_change = {
			type = returned
			save_scope_as = change
			add_claim_on_loss = no
		}
		title:k_orthodox = {
			change_title_holder = {
				holder = scope:new_pope
				change = scope:change
			}
		}
		resolve_title_and_vassal_change = scope:change
		root = { destroy_title = title:d_iconoclast }
		faith:orthodox = {
			change_fervor = {
				value = 15
				desc = fervor_gain_ecumenical_patriarchate
			}
			if = {
				limit = { NOT = { has_doctrine = special_doctrine_ecumenical_christian } }
				add_doctrine = special_doctrine_ecumenical_christian
			}
		}
		faith:iconoclast = {
			change_fervor = {
				value = -30
				desc = fervor_loss_ecumenical_patriarchate
			}
			if = {
				limit = { has_doctrine = special_doctrine_ecumenical_christian }
				remove_doctrine = special_doctrine_ecumenical_christian
			}
		}
	}

	option = {
		name = roman_restoration.0122.a
		add_piety = major_piety_gain
		every_player = {
			limit = {
				this != root
				faith.religion = faith:orthodox.religion
			}
			trigger_event = roman_restoration.0123 # Notification.
		}
		if = { # Vassalize if possible/needed.
			limit = {
				highest_held_title_tier > scope:new_pope.highest_held_title_tier
				NOT = { scope:new_pope = { any_liege_or_above = { this = root } } }
			}
			create_title_and_vassal_change = {
				type = returned
				save_scope_as = change
				add_claim_on_loss = no
			}
			scope:new_pope = {
				change_liege = {
					liege = root
					change = scope:change
				}
			}
			resolve_title_and_vassal_change = scope:change
		}
	}
}

# Christians notified.
roman_restoration.0123 = {
	type = character_event
	title = roman_restoration.0122.t
	desc = {
		first_valid = {
			# Orthodox Reaction
			triggered_desc = {
				trigger = {
					root.faith = faith:orthodox
				}
				desc = roman_restoration.0123.desc.orthodox
			}
			# Iconoclast reaction
			triggered_desc = {
				trigger = {
					root.faith = faith:iconoclast
				}
				desc = roman_restoration.0123.desc.iconoclast
			}
			#Every other Christian
			triggered_desc = {
				trigger = {
					NOR = {
						root.faith = faith:orthodox
						root.faith = faith:iconoclast
					}
				}
				desc = roman_restoration.0123.desc.other
			}
		}
	}
	theme = realm
	left_portrait = {
		character = scope:reformer
		animation = personality_vengeful
	}
	right_portrait = {
		character = scope:new_pope
		animation = personality_zealous
	}

	immediate = {
		#Orthodox consider this great.
		if = {
			limit = { root.faith = faith:orthodox }
			play_music_cue = "mx_cue_sacredrite"
		}
		#Iconoclasts consider it monstrous.
		if = {
			limit = { root.faith = faith:iconoclast }
			play_music_cue = "mx_cue_combat_2"
		}
	}

	option = {
		name = roman_restoration.0123.a
		trigger = {
			root.faith = faith:orthodox
		}
	}
	option = {
		name = roman_restoration.0123.b
		trigger = {
			root.faith = faith:iconoclast
		}
		stress_impact = {
			zealous = medium_stress_impact_gain
		}
	}
	option = {
		name = roman_restoration.0123.c
		trigger = {
			NOR = {
				root.faith = faith:orthodox
				root.faith = faith:iconoclast
			}
		}
	}
}

##################################################
# Restoring Papacy
##################################################

roman_restoration.0124 = {
	type = character_event
	title = roman_restoration.0124.t
	desc = roman_restoration.0124.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_vengeful
	}
	right_portrait = {
		character = scope:new_pope
		animation = personality_zealous
	}

	immediate = {
		play_music_cue = "mx_cue_sacredrite"
		restore_papacy_scripted_effect = yes
	}

	option = {
		name = roman_restoration.0124.a
		add_piety = major_piety_gain
		every_player = {
			limit = {
				this != root
				faith.religion = faith:catholic.religion
			}
			trigger_event = roman_restoration.0125 # Notification.
		}
		if = { # Vassalize if possible/needed.
			limit = {
				highest_held_title_tier > scope:new_pope.highest_held_title_tier
				NOT = { scope:new_pope = { any_liege_or_above = { this = root } } }
			}
			create_title_and_vassal_change = {
				type = returned
				save_scope_as = change
				add_claim_on_loss = no
			}
			scope:new_pope = {
				change_liege = {
					liege = root
					change = scope:change
				}
			}
			resolve_title_and_vassal_change = scope:change
		}
	}
}

# Christians notified.
roman_restoration.0125 = {
	type = character_event
	title = roman_restoration.0124.t
	desc = {
		first_valid = {
			# Catholic Reaction
			triggered_desc = {
				trigger = {
					root.faith = faith:catholic
				}
				desc = roman_restoration.0125.desc.catholic
			}
			# Every other Christian
			triggered_desc = {
				trigger = {
					NOT = {
						root.faith = faith:catholic
					}

				}
				desc = roman_restoration.0125.desc.other
			}
		}
	}
	theme = realm
	left_portrait = {
		character = scope:reformer
		animation = personality_vengeful
	}
	right_portrait = {
		character = scope:new_pope
		animation = personality_zealous
	}

	immediate = {
		#Catholics are happy!
		if = {
			limit = { faith = faith:catholic }
			play_music_cue = "mx_cue_sacredrite"
		}
	}

	option = {
		name = roman_restoration.0125.a
		trigger = {
			root.faith = faith:catholic
		}
	}
	option = {
		name = roman_restoration.0125.b
		trigger = {
			NOT = {
				root.faith = faith:catholic
			}
		}
	}
}

##################################################
# Destroying the Papacy as a Muslim/Pagan
##################################################

roman_restoration.0130 = {
	type = character_event
	title = roman_restoration.0130.t
	desc = {
		first_valid = {
			# Muslim Reaction
			triggered_desc = {
				trigger = {
					root.faith.religion = faith:ashari.religion
				}
				desc = roman_restoration.0130.desc.muslim
			}
			# Hellenic Reaction
			triggered_desc = {
				trigger = {
					root.faith.religion = faith:hellenic_pagan.religion
				}
				desc = roman_restoration.0130.desc.hellenic
			}
			# And the rest
			triggered_desc = {
				trigger = {
					NOR = {
						root.faith.religion = faith:ashari.religion
						root.faith.religion = faith:hellenic_pagan.religion
					}
				}
				desc = roman_restoration.0130.desc.fallback
			}
		}
		first_valid = {
			# No current Pope
			triggered_desc = {
				trigger = {
					NOT = {
						exists = scope:scoped_pope
					}
				}
				desc = roman_restoration.0130.desc.no_pope
			}
			# Current Pope is crucified
			triggered_desc = {
				trigger = {
					root.faith.religion = faith:hellenic_pagan.religion
				}
				desc = roman_restoration.0130.desc.pope.crucifixion
			}
			# Current Pope is sacrificed
			triggered_desc = {
				trigger = {
					root.faith = {
						has_doctrine_parameter = human_sacrifice_active
					}
				}
				desc = roman_restoration.0130.desc.pope.sacrificed
			}
			# Current Pope converts
			desc = roman_restoration.0130.desc.pope.submission
		}
	}
	theme = faith
	override_background = {
		trigger = {	
			root.faith = {
				OR = {
					religion = faith:hellenic_pagan.religion
					has_doctrine_parameter = human_sacrifice_active
				}
			}
		}
		reference = burning_building
	}
	left_portrait = {
		character = scope:scoped_destroyer
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:scoped_pope
		animation = fear
	}

	immediate = {
		play_music_cue = "mx_cue_sacredrite"
		save_scope_as = scoped_destroyer
		if = {
			limit = { exists = title:k_papal_state.holder }
			title:k_papal_state.holder = { save_scope_as = scoped_pope }
		}
		faith:catholic = { save_scope_as = catholic }
		destroy_papacy_scripted_effect = yes
	}

	option = {
		name = {
			trigger = {
				faith.religion = faith:ashari.religion
			}
			text = roman_restoration.0130.a.a
		}
		name = {
			trigger = {
				faith.religion = faith:hellenic_pagan.religion
			}
			text = roman_restoration.0130.a.b
		}
		name = {
			trigger = {
				NOR = {
					faith.religion = faith:ashari.religion
					faith.religion = faith:hellenic_pagan.religion
				}
			}
			text = roman_restoration.0130.a.c
		}
		every_player = {
			limit = {
				this != root
				OR = {
					faith.religion = faith:catholic.religion
					faith.religion = root.faith.religion
				}
			}
			trigger_event = roman_restoration.0131 # Notification.
		}
	}
}

# Other players notified.
roman_restoration.0131 = {
	type = character_event
	title = roman_restoration.0130.t
	desc = {
		first_valid = {
			# Muslim/Pagan Reaction
			triggered_desc = {
				trigger = {
					root.faith.religion = scope:scoped_destroyer.faith.religion
				}
				desc = roman_restoration.0131.desc.faithful
			}
			# Christian Reaction
			triggered_desc = {
				trigger = {
					root.faith.religion = faith:catholic.religion
				}
				desc = roman_restoration.0131.desc.christians
			}
			# Fallback
			triggered_desc = {
				trigger = {
					NOR = {
						root.faith.religion = faith:catholic.religion
						root.faith.religion = scope:scoped_destroyer.faith.religion
					}
				}
				desc = roman_restoration.0131.desc.fallback
			}
		}
	}
	theme = faith
	override_background = {
		trigger = {	
			scope:scoped_destroyer.faith = {
				OR = {
					religion = faith:hellenic_pagan.religion
					has_doctrine_parameter = human_sacrifice_active
				}
			}
		}
		reference = burning_building
	}
	left_portrait = {
		character = scope:scoped_destroyer
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:scoped_pope
		animation = fear
	}

	immediate = { play_music_cue = "mx_cue_combat_2" }

	option = {
		name = {
			trigger = {
				faith.religion = scope:scoped_destroyer.faith.religion
			}
			text = roman_restoration.0131.a.a
		}
		name = {
			trigger = {
				faith.religion = faith:catholic.religion
			}
			text = roman_restoration.0131.a.b
		}
		name = {
			trigger = {
				NOR = {
					faith.religion = faith:catholic.religion
					faith.religion = scope:scoped_destroyer.faith.religion
				}
			}
			text = roman_restoration.0131.a.c
		}
		if = {
			limit = {
				root.faith = faith:catholic
				NOT = { has_trait = cynical }
			}
			add_opinion = {
				target = scope:scoped_destroyer
				modifier = destroyed_papacy_opinion
			}
			stress_impact = {
				base = minor_stress_impact_gain
				zealous = minor_stress_impact_gain
			}
		}
	}
}

##################################################
# Unifying Italy as Italian.
##################################################
scripted_effect add_innovation_if_missing_effect = {	
	if = {
		limit = {
			NOT = {
				has_innovation = $INNOVATION$
			}
		}
		add_innovation = $INNOVATION$
	}
}


roman_restoration.0140 = {
	type = character_event
	title = roman_restoration.0140.t
	desc = roman_restoration.0140.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_greedy
	}

	immediate = {
		play_music_cue = "mx_cue_positive_effect"
		save_scope_as = scoped_ruler
		# De jure shifts.
		hidden_effect = {
			title:d_istria = { # Bite Croatia.
				set_de_jure_liege_title = title:k_italy
			}
			title:d_krain = {
				set_de_jure_liege_title = title:k_italy
			}
			title:d_tyrol = {
				set_de_jure_liege_title = title:k_italy
			}
			title:d_carinthia = {
				set_de_jure_liege_title = title:k_italy
			}
			title:k_sicily = { # Then shift all Kingdoms.
				set_de_jure_liege_title = title:e_italy
			}
			title:k_italy = {
				set_de_jure_liege_title = title:e_italy
			}
			title:k_venice = {
				set_de_jure_liege_title = title:e_italy
			}
			title:k_croatia = {
				set_de_jure_liege_title = title:e_italy
			}
			title:k_serbia = {
				set_de_jure_liege_title = title:e_italy
			}
		}
	}
	option = {
		name = roman_restoration.0140.a
		add_prestige = major_prestige_gain

		every_culture_global = {
			limit = { has_cultural_pillar = heritage_latin }

			add_innovation_if_missing_effect = { INNOVATION = innovation_men_at_arms }
			add_innovation_if_missing_effect = { INNOVATION = innovation_pike_columns }
			add_innovation_if_missing_effect = { INNOVATION = innovation_guilds }
		}

		# Send narrative fluff to other players (if any).
		every_player = {
			limit = {
				this != root
				capital_province = { geographical_region = world_europe_west }
			}
			trigger_event = roman_restoration.0141
		}
		hidden_effect = { # Latins chance to convert to French.
			every_vassal = {
				limit = {
					capital_province = {
						geographical_region = world_europe_south_italy
					}
					is_ai = yes
				}
				random = {
					chance = 50
					set_culture_same_as = root
					capital_county = {
						set_county_culture = root.culture
					}
				}
			}
		}
		legend_seed_great_deed_region_effect = {
			REGION = geographical_region:world_europe_south_italy
		}
	}
}

roman_restoration.0141 = {
	type = character_event
	title = roman_restoration.0140.t
	desc = roman_restoration.0141.desc
	theme = realm
	left_portrait = {
		character = scope:scoped_ruler
		animation = personality_greedy
	}

	immediate = { play_music_cue = "mx_cue_positive_effect" }

	option = {
		name = roman_restoration.0141.a
		trigger = {
			OR = {
				has_title = title:e_hre
				is_roman_emperor_trigger = yes
			}
		}
	}

	option = {
		name = roman_restoration.0141.b
		trigger = {
			NOR = {
				has_title = title:e_hre
				is_roman_emperor_trigger = yes
			}
		}
	}
}

##################################################
# Italian Roman Empire rises
##################################################

roman_restoration.0150 = {
	type = character_event
	title = roman_restoration.0150.t
	desc = {
		desc = roman_restoration.0150.desc # Introduction.
		first_valid = {
			# Doing it as Christians.
			triggered_desc = {
				trigger = {
					NOT = {
						faith.religion = faith:hellenic_pagan.religion
					}
				}
				desc = roman_restoration.0001.desc.christians
			}
			# Doing it as Hellenics
			triggered_desc = {
				trigger = {
					faith.religion = faith:hellenic_pagan.religion
				}
				desc = roman_restoration.0001.desc.hellenics
			}
			desc = roman_restoration.0001.desc.fallback
		}
	}
	theme = realm
	left_portrait = {
		character = scope:scoped_emperor
		animation = personality_bold
	}

	immediate = {
		play_music_cue = "mx_cue_epic_sacral_moment"
		save_scope_as = scoped_emperor
		create_roman_empire_italy_scripted_effect = yes
	}

	option = {
		name = roman_restoration.0150.a
		set_nickname_effect = { NICKNAME = nick_the_glorious }
		# Send narrative fluff to other players (if any).
		every_player = {
			limit = {
				this != root
				is_within_diplo_range = { CHARACTER = root }
			}
			trigger_event = roman_restoration.0151
		}
	}
}

# Players informed of (Italian) Roman Empire being reborn.
roman_restoration.0151 = {
	type = character_event
	title = roman_restoration.0151.t
	desc = {
		first_valid = {
			# Reaction of the Byzantines (if they are even still around)
			triggered_desc = {
				trigger = {
					OR = {
						has_title = title:e_byzantium
						any_liege_or_above = {
							has_title = title:e_byzantium
						}
					}
				}
				desc = roman_restoration.0151.desc.byzantines
			}
			# Everybody else.
			triggered_desc = {
				trigger = {
					NOR = {
						has_title = title:e_byzantium
						any_liege_or_above = {
							has_title = title:e_byzantium
						}
					}
				}
				desc = roman_restoration.0151.desc.others
			}
			first_valid = {
				# Regular.
				triggered_desc = {
					trigger = {
						NOT = {
							scope:scoped_emperor = { faith.religion = faith:hellenic_pagan.religion }
							faith.religion = faith:catholic.religion
						}
					}
					desc = roman_restoration.0002.desc.christians
				}
				# Christians freaking out.
				triggered_desc = {
					trigger = {
						scope:scoped_emperor = { faith.religion = faith:hellenic_pagan.religion }
						faith.religion = faith:catholic.religion
					}
					desc = roman_restoration.0002.desc.hellenics
				}
			}
		}
	}
	theme = realm
	left_portrait = {
		character = scope:scoped_emperor
		animation = personality_bold
	}

	option = { # Regular
		name = roman_restoration.0002.a
		trigger = {
			NOT = {
				scope:scoped_emperor = { faith.religion = faith:hellenic_pagan.religion }
				faith.religion = faith:catholic.religion
			}
			NOR = {
				has_title = title:e_byzantium
				has_title = title:e_hre
			}
		}
	}
	option = { # Regular vs Byzantium/HRE
		name = roman_restoration.0002.b
		trigger = {
			NOT = {
				scope:scoped_emperor = { faith.religion = faith:hellenic_pagan.religion }
				faith.religion = faith:catholic.religion
			}
			OR = {
				has_title = title:e_byzantium
				has_title = title:e_hre
			}
		}
	}
	option = { # Crazy Hellenics
		name = roman_restoration.0002.c
		trigger = {
			scope:scoped_emperor = { faith.religion = faith:hellenic_pagan.religion }
			faith.religion = faith:catholic.religion
			NOR = {
				has_title = title:e_byzantium
				has_title = title:e_hre
			}
		}
	}
	option = { # Crazy Hellenics vs Byzantium/HRE
		name = roman_restoration.0002.d
		trigger = {
			scope:scoped_emperor = { faith.religion = faith:hellenic_pagan.religion }
			faith.religion = faith:catholic.religion
			OR = {
				has_title = title:e_byzantium
				has_title = title:e_hre
			}
		}
		stress_impact = {
			zealous = minor_stress_impact_gain
		}
	}
}

##################################################
# Byzantium/Roman Empire challenges HRE.
##################################################

roman_restoration.0160 = {
	type = character_event
	title = roman_restoration.0160.t
	desc = roman_restoration.0160.desc
	theme = war
	left_portrait = {
		character = scope:byz_emperor
		animation = anger
	}
	right_portrait = {
		character = scope:hre_emperor
		animation = disgust
	}

	immediate = {
		play_music_cue = "mx_cue_combat_2"
		save_scope_as = byz_emperor
		title:e_hre.holder = {
			save_scope_as = hre_emperor
			trigger_event = roman_restoration.0161
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_emperor_challenging_hre
			}
		}
	}
	option = {
		name = roman_restoration.0160.a
		start_war = {
			casus_belli = dismantle_holy_pretender_cb
			target = title:e_hre.holder
		}
	}
}

# HRE notified.
roman_restoration.0161 = {
	type = character_event
	title = roman_restoration.0161.t
	desc = roman_restoration.0161.desc
	theme = war
	left_portrait = {
		character = scope:byz_emperor
		animation = disgust
	}
	right_portrait = {
		character = scope:hre_emperor
		animation = anger
	}

	immediate = { play_music_cue = "mx_cue_combat_2" }

	option = {
		name = roman_restoration.0161.a
	}
}

# War is over:
# Byz is victorious. Byz notified.
roman_restoration.0162 = {
	type = character_event
	title = roman_restoration.0162.t
	desc = roman_restoration.0162.desc
	theme = war
	left_portrait = {
		character = scope:byz_emperor
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:hre_emperor
		animation = grief
	}

	immediate = { play_music_cue = "mx_cue_epic_sacral_moment" }

	option = {
		name = roman_restoration.0162.a
	}
}

# Byz is victorious. HRE notified.
roman_restoration.0163 = {
	type = character_event
	title = roman_restoration.0163.t
	desc = roman_restoration.0163.desc
	theme = war
	left_portrait = {
		character = scope:byz_emperor
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:hre_emperor
		animation = grief
	}

	immediate = { play_music_cue = "mx_cue_stress" }

	option = {
		name = roman_restoration.0163.a
		stress_impact = {
			base = minor_stress_impact_gain
		}
	}
}

# Byz is defeated. Byz notified.
roman_restoration.0164 = {
	type = character_event
	title = roman_restoration.0164.t
	desc = roman_restoration.0164.desc
	theme = war
	left_portrait = {
		character = scope:byz_emperor
		animation = grief
	}
	right_portrait = {
		character = scope:hre_emperor
		animation = schadenfreude
	}

	immediate = { play_music_cue = "mx_cue_stress" }

	option = {
		name = roman_restoration.0164.a
		stress_impact = {
			base = medium_stress_impact_gain
		}
	}
}

# Byz is defeated. HRE notified.
roman_restoration.0165 = {
	type = character_event
	title = roman_restoration.0165.t
	desc = roman_restoration.0165.desc
	theme = war
	left_portrait = {
		character = scope:byz_emperor
		animation = grief
	}
	right_portrait = {
		character = scope:hre_emperor
		animation = schadenfreude
	}

	immediate = { play_music_cue = "mx_cue_epic_sacral_moment" }

	option = {
		name = roman_restoration.0165.a
	}
}

##################################################
# Byzantium/Roman Empire challenges HRE.
##################################################

roman_restoration.0170 = {
	type = character_event
	title = roman_restoration.0170.t
	desc = roman_restoration.0170.desc
	theme = war
	left_portrait = {
		character = scope:hre_emperor
		animation = anger
	}
	right_portrait = {
		character = scope:byz_emperor
		animation = disgust
	}

	immediate = {
		play_music_cue = "mx_cue_combat_2"
		save_scope_as = hre_emperor
		title:e_byzantium.holder = {
			save_scope_as = byz_emperor
			trigger_event = roman_restoration.0171
		}
		hidden_effect = {
			add_character_flag = {
				flag = flag_emperor_challenging_byz
			}
		}
	}
	option = {
		name = roman_restoration.0170.a
		start_war = {
			casus_belli = dismantle_byz_pretender_cb
			target = title:e_byzantium.holder
		}
	}
}

# HRE notified.
roman_restoration.0171 = {
	type = character_event
	title = roman_restoration.0171.t
	desc = roman_restoration.0171.desc
	theme = war
	left_portrait = {
		character = scope:hre_emperor
		animation = disgust
	}
	right_portrait = {
		character = scope:byz_emperor
		animation = anger
	}

	immediate = { play_music_cue = "mx_cue_combat_2" }

	option = {
		name = roman_restoration.0171.a
	}
}

# War is over:
# HRE is victorious. HRE notified.
roman_restoration.0172 = {
	type = character_event
	title = roman_restoration.0172.t
	desc = roman_restoration.0172.desc
	theme = war
	left_portrait = {
		character = scope:hre_emperor
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:byz_emperor
		animation = grief
	}

	immediate = { play_music_cue = "mx_cue_epic_sacral_moment" }

	option = {
		name = roman_restoration.0172.a
	}
}

# HRE is victorious. Byz notified.
roman_restoration.0173 = {
	type = character_event
	title = roman_restoration.0173.t
	desc = roman_restoration.0173.desc
	theme = war
	left_portrait = {
		character = scope:hre_emperor
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:byz_emperor
		animation = grief
	}

	immediate = { play_music_cue = "mx_cue_stress" }

	option = {
		name = roman_restoration.0173.a
		stress_impact = {
			base = minor_stress_impact_gain
		}
	}
}

# Byz is defeated. HRE notified.
roman_restoration.0174 = {
	type = character_event
	title = roman_restoration.0174.t
	desc = roman_restoration.0174.desc
	theme = war
	left_portrait = {
		character = scope:hre_emperor
		animation = grief
	}
	right_portrait = {
		character = scope:byz_emperor
		animation = schadenfreude
	}

	immediate = { play_music_cue = "mx_cue_stress" }

	option = {
		name = roman_restoration.0174.a
		stress_impact = {
			base = medium_stress_impact_gain
		}
	}
}

# HRE is defeated. Byz notified.
roman_restoration.0175 = {
	type = character_event
	title = roman_restoration.0175.t
	desc = roman_restoration.0175.desc
	theme = war
	left_portrait = {
		character = scope:hre_emperor
		animation = grief
	}
	right_portrait = {
		character = scope:byz_emperor
		animation = schadenfreude
	}

	immediate = { play_music_cue = "mx_cue_epic_sacral_moment" }

	option = {
		name = roman_restoration.0175.a
	}
}

############################
# Byz Emp reclaims Constantinople
# by Joe Parkin              
############################

roman_restoration.1200 = {
	type = character_event
	title = roman_restoration.1200.t
	desc = roman_restoration.1200.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_bold
	}
	override_background = { reference = ep3_constantinople }
	override_effect_2d = legend_glow

	cooldown = { years = 10 }

	trigger = {
		has_ep3_dlc_trigger = yes
		is_roman_emperor_trigger = yes
		scope:county = {
			# Constantinople only
			this = title:c_byzantion
			previous_holder = {
				NOR = {
					root.primary_title.previous_holder ?= this
					root.top_liege.primary_title.previous_holder ?= this
				}
			}
		}
	}

	immediate = {
		play_music_cue = "mx_cue_epic_sacral_moment"
		add_prestige = major_prestige_gain
		if = {
			limit = {
				culture = { has_cultural_parameter = holds_triumphs }
			}
			custom_tooltip = {
				text = free_triumph_tooltip
				add_character_flag = free_triumph_flag
			}
		}
		if = {
			limit = {
				culture = { has_cultural_parameter = hosts_chariot_races }
			}
			custom_tooltip = {
				text = half_price_chariot_race_tooltip
				add_character_flag = half_price_chariot_race_flag
			}
		}
	}

	option = {
		name = roman_restoration.1200.a
		trigger = {
			NOT = { capital_county = title:c_byzantion }
		}
		if = {
			limit = { government_allows = administrative }
			change_influence = medium_influence_gain
		}
		add_legitimacy = minor_legitimacy_gain
		set_realm_capital = title:c_byzantion
	}

	option = {
		name = {
			text = roman_restoration.1200.b.rome
			trigger = { 
				is_roman_emperor_excluding_byzantium_trigger = yes
			}
		}
		name = {
			text = roman_restoration.1200.b
			trigger = {
				is_roman_emperor_excluding_byzantium_trigger = no
			}
		}
	}
}

#################################################
# Byz Emp reclaims Constantinople from you (you wretched boy!) by Isabella Welch
#################################################

roman_restoration.1204 = {
	type = letter_event
	opening = roman_restoration.1204.t
	sender = scope:byz_emp
	desc = roman_restoration.1204.desc_vassal
	
	trigger = {

	}

	immediate = { 
		title:e_byzantium.holder = {
			save_scope_as = byz_emp
		}	
	}

	option = { 
		name = roman_restoration.1204.a
		scope:byz_emp = {
			add_opinion = {
				modifier = grateful_opinion
 				target = root
				opinion = 30
			}
		} 
	}

	option = {
		name = roman_restoration.1204.b
		scope:byz_emp = {
			add_opinion = {
				modifier = angry_opinion
 				target = root
				opinion = -30
			}
		}
	}
}
# ^I have no idea if Isabeau chose this ID on purpose but it's bloody hilarious.

##################################################
# Byzantium is Booted out of Sicily
# by Ewan Cowhig Croft
# 1211 - 1220
##################################################

scripted_trigger roman_restoration_1211_ai_choice_trigger = {
	OR = {
		culture = { has_cultural_pillar = heritage_arabic }
		culture = { has_cultural_pillar = heritage_berber }
		religion = religion:islam_religion
		capital_county.title_province = { geographical_region = world_africa_north }
	}
}

scripted_effect roman_restoration_1211_piss_off_big_e_effect = {
	add_opinion = {
		target = scope:taker
		modifier = outraged_opinion
		opinion = -80
	}
	if = {
		limit = {
			can_set_relation_potential_rival_trigger = { CHARACTER = scope:taker }
		}
		set_relation_potential_rival = scope:taker
	}
}

#	Scope:taker chooses where their allegiances lie.
roman_restoration.1211 = {
	type = character_event
	title = roman_restoration.1211.t
	desc = {
		desc = roman_restoration.1211.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:emperor }
				desc = roman_restoration.1211.desc.body.emperor_exists
			}
			desc = roman_restoration.1211.desc.body.emperor_absent
		}
		desc = roman_restoration.1211.desc.outro
	}
	theme = realm
	left_portrait = {
		character = scope:taker
		animation = marshal
	}
	right_portrait = {
		character = scope:emperor
		animation = rage
	}
	immediate = {
		add_prestige_experience = rebuke_roman_revanchism_sicily_fame_reward_value
		# Try to grab the emperor.
		title:e_byzantium.holder ?= {
			save_scope_as = emperor
			# And piss them off.
			roman_restoration_1211_piss_off_big_e_effect = yes
		}
	}

	# We belong with Italy, forever.
	option = {
		name = roman_restoration.1211.a

		title:k_sicily = { set_de_jure_liege_title = title:e_italy }
		save_scope_value_as = {
			name = new_empire
			value = flag:italia
		}

		# No stress here.
		ai_chance = {
			base = 0
			# Anyone who isn't strongly affiliated to North Africa prefers Italy.
			modifier = {
				add = 1
				roman_restoration_1211_ai_choice_trigger = no
			}
		}
	}
	
	# Sicily's destiny lies, as it always has, across the sea.
	option = {
		name = roman_restoration.1211.b

		title:k_sicily = { set_de_jure_liege_title = title:e_maghreb }
		save_scope_value_as = {
			name = new_empire
			value = flag:maghreb
		}

		# No stress here.
		ai_chance = {
			base = 0
			# Berbers, Arabs, Muslims, and folks with their capital in North Africa prefer the Maghreb.
			modifier = {
				add = 1
				roman_restoration_1211_ai_choice_trigger = yes
			}
		}
	}
	
	# Why, with _me_ of course!
	option = {
		name = roman_restoration.1211.c
		trigger = { rebuke_roman_revanchism_sicily_controls_unlisted_empire_trigger = yes }
		show_as_unavailable = { always = yes }

		title:k_sicily = { set_de_jure_liege_title = root.primary_title }
		save_scope_value_as = {
			name = new_empire
			value = flag:own
		}

		# No stress here.
		# If the AI can take this, then they probably should.
		ai_chance = { base = 1000 }
	}

	after = {
		# If we've got one, inform the emperor.
		scope:emperor = { trigger_event = roman_restoration.1212 }
		# Then inform every player in Sicily.
		every_player = {
			limit = {
				any_held_title = {
					title_tier = county
					title_province = { geographical_region = custom_sicily }
				}
			}
			trigger_event = roman_restoration.1213
		}
	}
}

#	Scope:emperor is informed.
roman_restoration.1212 = {
	type = character_event
	title = roman_restoration.1212.t
	desc = {
		desc = roman_restoration.1212.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { scope:new_empire = flag:italia }
				desc = roman_restoration.1212.desc.new_empire.italia
			}
			triggered_desc = {
				trigger = { scope:new_empire = flag:maghreb }
				desc = roman_restoration.1212.desc.new_empire.maghreb
			}
			triggered_desc = {
				trigger = { scope:new_empire = flag:own }
				desc = roman_restoration.1212.desc.new_empire.own
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					any_county_in_region = {
						region = custom_sicily
						rebuke_roman_revanchism_counties_controlled_by_ere_trigger = yes
					}
				}
				desc = roman_restoration.1212.desc.outro.territory_left
			}
			desc = roman_restoration.1212.desc.outro.no_territory_left
		}
	}
	theme = realm
	left_portrait = {
		character = scope:emperor
		animation = rage
	}
	right_portrait = {
		character = scope:taker
		animation = marshal
	}

	immediate = {
		show_as_tooltip = { roman_restoration_1211_piss_off_big_e_effect = yes }
		# Mark us as not needing a second notification if we've got any land left.
		add_character_flag = {
			flag = informed_about_sicily_flag
			days = 7
		}
	}

	# That presumptuous lout!
	option = {
		name = roman_restoration.1212.a

		# No stress, no AI.
	}
}

#	Scope:emperor is informed.
roman_restoration.1213 = {
	type = character_event
	title = roman_restoration.1213.t
	desc = {
		desc = roman_restoration.1213.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { scope:new_empire = flag:italia }
				desc = roman_restoration.1213.desc.new_empire.italia
			}
			triggered_desc = {
				trigger = { scope:new_empire = flag:maghreb }
				desc = roman_restoration.1213.desc.new_empire.maghreb
			}
			triggered_desc = {
				trigger = { scope:new_empire = flag:own }
				desc = roman_restoration.1213.desc.new_empire.own
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:emperor }
				desc = roman_restoration.1213.desc.body.emperor_exists
			}
			desc = roman_restoration.1213.desc.body.emperor_absent
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					any_county_in_region = {
						region = custom_sicily
						rebuke_roman_revanchism_counties_controlled_by_ere_trigger = yes
					}
				}
				desc = roman_restoration.1213.desc.outro.territory_left
			}
			desc = roman_restoration.1213.desc.outro.no_territory_left
		}
	}
	theme = realm
	left_portrait = {
		character = scope:taker
		animation = marshal
	}
	right_portrait = {
		character = scope:emperor
		animation = rage
	}

	trigger = {
		NOR = {
			has_character_flag = informed_about_sicily_flag
			this = scope:taker
		}
	}

	# Good riddance!
	option = {
		name = roman_restoration.1213.a

		# No stress, no AI.
	}

	# What dark times we live in...
	option = {
		name = roman_restoration.1213.b

		# No stress, no AI.
	}
}
