#######################################
#
# Roman Events
#
# Event ID LoR.1 - LoR.199 reserved
# Event ID LoR.1200 - Lor.1201 reserved
#
#######################################

# Written by Henrik Eklund

namespace = LoR

### Lost Roman Provinces

# Provincia Syria Palaestina
narrative_event = {
	id = LoR.1
	title = EVTNAMELoR.1
	desc = EVTDESCLoR.1
	picture = GFX_evt_victory_arch_byzantine
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Aegyptus
narrative_event = {
	id = LoR.2
	title = EVTNAMELoR.2
	desc = EVTDESCLoR.2
	picture = GFX_evt_victory_arch_byzantine
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Cyrenaica et Creta
narrative_event = {
	id = LoR.3
	title = EVTNAMELoR.3
	desc = EVTDESCLoR.3
	picture = GFX_evt_victory_arch_byzantine
	
	only_playable = yes
	only_independent = yes
	
	trigger = {
		has_dlc = "Legacy of Rome"
		OR = {
			has_landed_title = e_byzantium
			has_landed_title = e_roman_empire
		}
		OR = {
			religion_group = christian
			religion_group = hellenic_pagan_group
		}
		completely_controls = d_cyrenaica
		completely_controls = d_krete
		NOT = { has_global_flag = cyrenaica }
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		name = EVTOPTALoR.1
		set_global_flag = cyrenaica
		prestige = 50
	}
}

# Provincia Africa
narrative_event = {
	id = LoR.4
	title = EVTNAMELoR.4
	desc = EVTDESCLoR.4
	picture = GFX_evt_victory_arch_byzantine
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Illyricum
narrative_event = {
	id = LoR.5
	title = EVTNAMELoR.5
	desc = EVTDESCLoR.5
	picture = GFX_evt_victory_arch_byzantine
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Italia
narrative_event = {
	id = LoR.6
	title = EVTNAMELoR.6
	desc = EVTDESCLoR.6
	picture = GFX_evt_victory_arch_byzantine
	
	is_triggered_only = yes	
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Sicilia
narrative_event = {
	id = LoR.1200
	title = EVTNAME_LoR_1200
	desc = EVTDESC_LoR_1200
	
	picture = GFX_evt_victory_arch_byzantine
	
	only_playable = yes
	only_independent = yes
	
	trigger = {
		has_dlc = "Legacy of Rome"
		OR = {
			has_landed_title = e_byzantium
			has_landed_title = e_roman_empire
		}
		OR = {
			religion_group = christian
			religion_group = hellenic_pagan_group
		}
		NOT = { has_global_flag = sicilia }
		completely_controls = d_sicily
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		name = EVTOPTALoR.1
		set_global_flag = sicilia
		prestige = 50
	}
}

# Provincia Corsica et Sardinia
narrative_event = {
	id = LoR.1201
	title = EVTNAME_LoR_1201
	desc = EVTDESC_LoR_1201
	
	picture = GFX_evt_victory_arch_byzantine
	
	only_playable = yes
	only_independent = yes
	
	trigger = {
		has_dlc = "Legacy of Rome"
		OR = {
			has_landed_title = e_byzantium
			has_landed_title = e_roman_empire
		}
		OR = {
			religion_group = christian
			religion_group = hellenic_pagan_group
		}
		NOT = { has_global_flag = sardinia }
		completely_controls = d_sardinia
	}
	
	mean_time_to_happen = {
		days = 1
	}	
	
	option = {
		name = EVTOPTALoR.1
		set_global_flag = sardinia
		prestige = 50
		
		if = {
			limit = { is_title_active = k_roma }
			d_sardinia = { de_jure_liege = k_roma }
		}
	}
}

# Provincia Viennensis
narrative_event = {
	id = LoR.1202
	title = EVTNAME_LoR_1202
	desc = EVTDESC_LoR_1202	
	picture = GFX_evt_victory_arch_byzantine
	
	is_triggered_only = yes	
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Gallia
narrative_event = {
	id = LoR.7
	title = EVTNAMELoR.7
	desc = EVTDESCLoR.7
	picture = GFX_evt_victory_arch_byzantine
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Germania
narrative_event = {
	id = LoR.8
	title = EVTNAMELoR.8
	desc = EVTDESCLoR.8
	picture = GFX_evt_victory_arch_byzantine
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Britannia
narrative_event = {
	id = LoR.9
	title = EVTNAMELoR.9
	desc = EVTDESCLoR.9
	picture = GFX_evt_victory_arch_byzantine

	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Hispania
narrative_event = {
	id = LoR.10
	title = EVTNAMELoR.10
	desc = EVTDESCLoR.10
	picture = GFX_evt_victory_arch_byzantine
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Mauretania
narrative_event = {
	id = LoR.11
	title = EVTNAMELoR.11
	desc = EVTDESCLoR.11
	picture = GFX_evt_victory_arch_byzantine

	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Mesopotamia
narrative_event = {
	id = LoR.12
	title = EVTNAMELoR.12
	desc = EVTDESCLoR.12
	picture = GFX_evt_victory_arch_byzantine

	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Caledonia
narrative_event = {
	id = LoR.13
	title = EVTNAMELoR.13
	desc = EVTDESCLoR.13
	picture = GFX_evt_victory_arch_byzantine

	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Hibernia
narrative_event = {
	id = LoR.14
	title = EVTNAMELoR.14
	desc = EVTDESCLoR.14
	picture = GFX_evt_victory_arch_byzantine

	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Asia
narrative_event = {
	id = LoR.15
	title = EVTNAMELoR.15
	desc = EVTDESCLoR.15
	picture = GFX_evt_victory_arch_byzantine

	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Macedonia
narrative_event = {
	id = LoR.16
	title = EVTNAMELoR.16
	desc = EVTDESCLoR.16
	picture = GFX_evt_victory_arch_byzantine

	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Pontus
narrative_event = {
	id = LoR.17
	title = EVTNAMELoR.17
	desc = EVTDESCLoR.17
	picture = GFX_evt_victory_arch_byzantine

	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Thracia
narrative_event = {
	id = LoR.18
	title = EVTNAMELoR.18
	desc = EVTDESCLoR.18
	picture = GFX_evt_victory_arch_byzantine

	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Pannonia-Dacia
narrative_event = {
	id = LoR.100
	title = EVTNAMELoR.100
	desc = EVTDESCLoR.100
	picture = GFX_evt_victory_arch_byzantine

	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Provincia Armenia
narrative_event = {
	id = LoR.101
	title = EVTNAMELoR.101
	desc = EVTDESCLoR.101
	picture = GFX_evt_victory_arch_byzantine

	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.1
	}
}

# Jerusalem Restored
character_event = {
	id = LoR.1203
	hide_window = yes
	
	only_independent = yes
	
	trigger = {
		is_title_active = k_syria_palaestina
		has_landed_title = c_jerusalem # Just to make sure the event only fires once
		NOR = {
			is_title_active = k_jerusalem
			has_landed_title = e_roman_empire
			has_landed_title = e_byzantium
			has_landed_title = k_syria_palaestina
			any_liege = { has_landed_title = e_roman_empire }
			any_liege = { has_landed_title = e_byzantium }
			any_liege = { has_landed_title = k_syria_palaestina }
		}
		OR = {
			religion_group = christian
			religion_group = muslim
			religion_group = jewish_group
		}
		war = no
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	immediate = {
		activate_title = { title = k_jerusalem status = yes }
		d_oultrejourdain = { de_jure_liege = k_jerusalem }
		d_ascalon = { de_jure_liege = k_jerusalem }
		d_jerusalem = { de_jure_liege = k_jerusalem }
		d_galilee = { de_jure_liege = k_jerusalem }
	}
}

### Roman Empire Restored

# The Restoration of Rome
narrative_event = {
	id = LoR.20
	title = EVTNAMELoR.20
	desc = EVTDESCLoR.20
	
	picture = GFX_evt_rome_restored_byzantine
	
	is_triggered_only = yes
	
	immediate = {
		add_trait = augustus
		give_nickname = nick_the_glorious
		if = { # in case this event is called by the title being formed regularly
			limit = { NOT = { has_landed_title = e_roman_empire } }

			e_roman_empire = {
				grant_title = ROOT
				make_primary_title = yes
			}
			
			if = { # If Byzantium formed it
				limit = {
					has_landed_title = e_byzantium
					NOR = {
						has_landed_title = e_latin_empire 
						has_landed_title = e_hre
						has_landed_title = e_italy
						has_landed_title = e_karling
					}
				}
				e_roman_empire = {
					copy_title_laws = e_byzantium
					copy_title_history = e_byzantium
					set_global_flag = rome_restored_by_byzantium
				}
				e_byzantium = {
					any_direct_de_jure_vassal_title = {
						de_jure_liege = e_roman_empire
					}
					destroy_landed_title = THIS
					activate_title = { title = e_byzantium status = no }
				}
			}

			if = { # If the Latin Empire formed it
				limit = {
					has_landed_title = e_latin_empire
					NOR = {
						has_landed_title = e_byzantium
						has_landed_title = e_hre
						has_landed_title = e_italy
						has_landed_title = e_karling
					}
				}
				e_roman_empire = {
					copy_title_laws = e_latin_empire
					copy_title_history = e_latin_empire
					set_global_flag = rome_restored_by_latin_empire
				}
				e_latin_empire = {
					any_direct_de_jure_vassal_title = {
						de_jure_liege = e_roman_empire
					}
					destroy_landed_title = THIS
					activate_title = { title = e_latin_empire status = no }
				}
			}

			if = { # if the HRE formed it
				limit = {
					has_landed_title = e_hre
					NOR = {
						has_landed_title = e_byzantium
						has_landed_title = e_latin_empire
						has_landed_title = e_italy
						has_landed_title = e_karling
					}
				}
				e_roman_empire = {
					copy_title_laws = e_hre
					copy_title_history = e_hre
					set_global_flag = rome_restored_by_hre
				}
				e_hre = {
					any_direct_de_jure_vassal_title = {
						de_jure_liege = e_roman_empire
					}
					destroy_landed_title = THIS
					activate_title = { title = e_hre status = no }
				}
			}

			if = { # If the empire of Italy formed it
				limit = {
					has_landed_title = e_italy
					NOR = {
						has_landed_title = e_byzantium
						has_landed_title = e_latin_empire
						has_landed_title = e_hre
						has_landed_title = e_karling
					}
				}
				e_roman_empire = {
					copy_title_laws = e_italy
					copy_title_history = e_italy
					set_global_flag = rome_restored_by_italy
				}
				e_italy = {
					any_direct_de_jure_vassal_title = {
						de_jure_liege = e_roman_empire
					}
					destroy_landed_title = THIS
					activate_title = { title = e_italy status = no }
				}
			}

			if = { # If the Karlings formed it
				limit = {
					has_landed_title = e_karling
					NOR = {
						has_landed_title = e_byzantium
						has_landed_title = e_latin_empire
						has_landed_title = e_hre
						has_landed_title = e_italy
					}
				}
				e_roman_empire = {
					copy_title_laws = e_karling
					copy_title_history = e_karling
					set_global_flag = rome_restored_by_karling
				}
				e_karling = {
					any_direct_de_jure_vassal_title = {
						de_jure_liege = e_roman_empire
					}
					destroy_landed_title = THIS
					activate_title = { title = e_karling status = no }
				}
			}
		}

		any_playable_ruler = {
			limit = {
				NOT = { character = ROOT }
				OR = {
					ai = no
					has_landed_title = e_hre
					has_landed_title = e_byzantium
					has_landed_title = e_latin_empire
					has_landed_title = e_italy
					has_landed_title = e_karling
				}
			}
			narrative_event = { id = LoR.21 }
		}
	}
	
	option = {
		name = EVTOPTALoR.20
		set_global_flag = rome_restored
	}
}

# Informed about Restoration of Rome
narrative_event = {
	id = LoR.21
	title = EVTNAMELoR.21
	desc = EVTDESCLoR.21
	
	picture = GFX_evt_rome_restored_byzantine
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.21
		trigger = {
			NOR = {
				has_landed_title = e_hre
				has_landed_title = e_byzantium
				has_landed_title = e_latin_empire
				has_landed_title = e_italy
				has_landed_title = e_karling
			}
		}
	}
	option = {
		name = EVTOPTBLoR.21
		trigger = {
			OR = {
				has_landed_title = e_hre
				has_landed_title = e_byzantium
				has_landed_title = e_latin_empire
				has_landed_title = e_italy
				has_landed_title = e_karling
			}
		}
		prestige = -500
	}
}

### Victory Triumphs

# Triumph Expected
character_event = {
	id = LoR.30
	desc = EVTDESCLoR.30
	picture = GFX_evt_victory_arch_byzantine
	
	hide_from = yes
	
	is_triggered_only = yes
	
	trigger = {
		OR = {
			has_landed_title = e_byzantium
			has_landed_title = e_roman_empire
			AND = {
				independent = yes
				higher_tier_than = COUNT
				OR = {
					culture = roman
					religion_group = hellenic_pagan_group
				}
			}
		}
		OR = {
			religion_group = christian
			is_pagan_religion = yes
		}
	}
	
	option = {
		name = EVTOPTALoR.30
		character_event = { id = LoR.31 days = 12 tooltip = EVTTOOLTIPLoR.31 }
		scaled_wealth = -0.3
		prestige = 75
	}
	option = {
		name = EVTOPTBLoR.30
		scaled_wealth = -0.1
		prestige = 25
	}
	option = {
		name = EVTOPTCLoR.30
		prestige = -30
	}
}

# Triumph Held
character_event = {
	id = LoR.31
	desc = EVTDESCLoR.31
	picture = GFX_evt_victory_arch_byzantine
	
	hide_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.31
		custom_tooltip = {
			text = triumph_held
			hidden_tooltip = {
				any_realm_lord = {
					limit = {
						primary_title = { higher_tier_than = BARON }
						NOT = { character = ROOT }
					}
					opinion = {
						modifier = opinion_triumph_held
						who = ROOT
					}
					character_event = { id = LoR.32 }
				}
			}
		}
	}
}

# Triumph Held Vassals
character_event = {
	id = LoR.32
	desc = EVTDESCLoR.32
	picture = GFX_evt_victory_arch_byzantine
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.32
	}
}

### Roman Borders Restored

# Roman Borders
narrative_event = {
	id = LoR.40
	title = EVTNAMELoR.40
	desc = EVTDESCLoR.40
	
	picture = GFX_evt_rome_restored_byzantine
	
	only_playable = yes
	only_independent = yes
	
	trigger = {
		has_dlc = "Legacy of Rome"
		NOT = { has_global_flag = roman_borders }
		OR = {
			has_landed_title = e_byzantium
			has_landed_title = e_roman_empire
		}
		OR = {
			religion_group = christian
			religion_group = hellenic_pagan_group
		}
		
		# Provincia Britannia
		completely_controls_region = custom_england
		completely_controls_region = custom_wales
		
		# Provincia Italia
		completely_controls_region = world_europe_south_italy

		# Provincia Syria Palaestina
		completely_controls_region = world_middle_east_jerusalem
		
		# Provincia Aegyptus
		completely_controls_region = custom_egypt
		
		# Provincia Africa
		completely_controls_region = custom_africa
		
		# Provincia Illyricum
		completely_controls_region = custom_bulgaria
		completely_controls_region = custom_serbia
		completely_controls_region = custom_croatia
		
		# Provincia Viennensis
		completely_controls_region = custom_aquitaine
		
		# Provincia Gallia
		completely_controls_region = custom_france

		# Provincia Hispania
		completely_controls_region = world_europe_west_iberia
		
		# Provincia Mauretania
		completely_controls_region = custom_morocco
		
		# Provincia Macedonia
		completely_controls_region = custom_byzantium
		
		# Provincia Asia
		completely_controls_region = custom_nikaea
		
		# Provincia Pontus
		completely_controls_region = custom_trebizond
		completely_controls = d_coloneia
		completely_controls = d_mesopotamia
		completely_controls = d_armenia_minor
		
		# Provincia Pannonia-Dacia
		completely_controls_region = custom_carpathia
		completely_controls_region = custom_wallachia
		
		# Provincia Armenia
		completely_controls = d_armenia
		completely_controls = d_kartli
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		name = EVTOPTALoR.40
		set_global_flag = roman_borders
		prestige = 1000
	}
}

### The Augustus Trait

# Augustus Trait Gained
character_event = {
	id = LoR.45
	desc = EVTDESCLoR.45
	picture = GFX_evt_rome_restored_byzantine
	
	only_playable = yes
	has_global_flag = rome_restored
	has_dlc = "Legacy of Rome"
	
	trigger = {
		has_landed_title = e_roman_empire
		NOT = { trait = augustus }
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		name = EVTOPTALoR.45
		add_trait = augustus
	}
}

# Augustus Trait Lost
character_event = {
	id = LoR.46
	desc = EVTDESCLoR.46
	picture = GFX_evt_rome_restored_byzantine
	
	has_dlc = "Legacy of Rome"
	has_global_flag = rome_restored
		
	trigger = {
		trait = augustus
		NOT = { has_landed_title = e_roman_empire }
		is_alive = yes
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		name = EVTOPTALoR.46
		remove_trait = augustus
	}
}
