#######################################
#
# Schism Events
#
# Event ID ID LoR.200 - LoR.399 reserved
# Event ID hellenic.200 - hellenic.219 reserved
#
#######################################

namespace = LoR
namespace = hellenic

### The Pentarchy

# Patriarchate of Antioch
character_event = {
	id = LoR.200
	desc = EVTDESCLoR.200
	picture = GFX_evt_bishop_byzantine

	ai = no
	has_dlc = "Legacy of Rome"

	trigger = {
		OR = {
			has_landed_title = e_byzantium
			has_landed_title = e_roman_empire
		}
		is_orthodox_branch = yes	### ACR ###
		NOT = { has_global_flag = pat_antioch }
		completely_controls = c_antioch
	}

	mean_time_to_happen = {
		days = 1
	}

	immediate = {
		set_global_flag = pat_antioch
	}

	option = {
		name = EVTOPTALoR.200

		piety = 100
	}
}

character_event = {		### ACR ###
	id = hellenic.200
	desc = hellenic.200.desc
	picture = GFX_evt_bishop
	
	ai = no
	has_dlc = "Legacy of Rome"
	
	trigger = {
		OR = {
			has_landed_title = k_papacy
			tier = emperor
		}
		is_catholic_branch = yes
		NOT = { has_global_flag = lat_pat_antioch }
		completely_controls = c_antioch
	}
	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		name = EVTOPTALoR.200
		set_global_flag = lat_pat_antioch
		piety = 100
	}
}

# Patriarchate of Jerusalem
character_event = {
	id = LoR.201
	desc = EVTDESCLoR.201
	picture = GFX_evt_bishop_byzantine

	ai = no
	has_dlc = "Legacy of Rome"

	trigger = {
		OR = {
			has_landed_title = e_byzantium
			has_landed_title = e_roman_empire
		}
		is_orthodox_branch = yes	### ACR ###
		NOT = { has_global_flag = pat_jerusalem }
		completely_controls = c_jerusalem
	}

	mean_time_to_happen = {
		days = 1
	}

	immediate = {
		set_global_flag = pat_jerusalem
	}

	option = {
		name = EVTOPTALoR.200

		piety = 100
	}
}

character_event = {		### ACR ###
	id = hellenic.201
	desc = hellenic.201.desc
	picture = GFX_evt_bishop
	
	ai = no
	has_dlc = "Legacy of Rome"
	
	trigger = {
		OR = {
			has_landed_title = k_papacy
			tier = emperor
		}
		is_catholic_branch = yes
		NOT = { has_global_flag = lat_pat_jerusalem }
		completely_controls = c_jerusalem
	}
	mean_time_to_happen = {
		days = 1
	}
	option = {
		name = EVTOPTALoR.200
		set_global_flag = lat_pat_jerusalem
		piety = 100
	}
}

# Patriarchate of Alexandria
character_event = {
	id = LoR.202
	desc = EVTDESCLoR.202
	picture = GFX_evt_bishop_byzantine

	ai = no
	has_dlc = "Legacy of Rome"

	trigger = {
		OR = {
			has_landed_title = e_byzantium
			has_landed_title = e_roman_empire
		}
		is_orthodox_branch = yes	### ACR ###
		NOT = { has_global_flag = pat_alexandria }
		completely_controls = c_alexandria
	}

	mean_time_to_happen = {
		days = 1
	}

	immediate = {
		set_global_flag = pat_alexandria
	}

	option = {
		name = EVTOPTALoR.200

		piety = 100
	}
}

character_event = {		### ACR ###
	id = hellenic.202
	desc = hellenic.202.desc
	picture = GFX_evt_bishop
	
	ai = no
	has_dlc = "Legacy of Rome"
	
	trigger = {
		OR = {
			has_landed_title = k_papacy
			tier = emperor
		}
		is_catholic_branch = yes
		NOT = { has_global_flag = lat_pat_alexandria }
		completely_controls = c_alexandria
	}
	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		name = EVTOPTALoR.200
		set_global_flag = lat_pat_alexandria
		piety = 100
	}
}

# Patriarchate of Rome
character_event = {
	id = LoR.203
	desc = EVTDESCLoR.203
	picture = GFX_evt_bishop_byzantine

	ai = no
	has_dlc = "Legacy of Rome"

	trigger = {
		OR = {
			has_landed_title = e_byzantium
			has_landed_title = e_roman_empire
		}
		is_orthodox_branch = yes	### ACR ###
		NOT = { has_global_flag = pat_rome }
		completely_controls = c_roma
	}

	mean_time_to_happen = {
		days = 1
	}

	immediate = {
		set_global_flag = pat_rome
	}

	option = {
		name = EVTOPTALoR.200

		piety = 100
	}
}

# Patriarchate of Constantinople
character_event = {		### ACR ###
	id = hellenic.203
	desc = hellenic.203.desc
	picture = GFX_evt_bishop
	
	ai = no
	has_dlc = "Legacy of Rome"
	
	trigger = {
		OR = {
			has_landed_title = k_papacy
			tier = emperor
		}
		is_catholic_branch = yes
		NOT = { has_global_flag = lat_pat_constantinople }
		completely_controls = c_constantinopolis
	}
	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		name = EVTOPTALoR.200
		set_global_flag = lat_pat_constantinople
		piety = 100
	}
}

### The Great Schism Mended

# The Schism Mended
narrative_event = {
	id = LoR.210
	title = EVTNAMELoR.210
	desc = EVTDESCLoR.210
	picture = GFX_evt_icon

	is_triggered_only = yes # mend_great_schism, realm_decisions.txt

	option = {
		name = EVTOPTALoR.200

		# Heresies of Catholicism follow suit
		set_parent_religion = {
			religion = catholic
			parent = religion_scope
		}

		set_global_flag = schism_mended
		give_nickname = nick_the_saint

		any_playable_ruler = {
			limit = {
				religion = catholic
				controls_religion = no
			}

			narrative_event = { id = LoR.211 }
		}
	}
}

narrative_event = {		### ACR ###
	id = hellenic.210
	title = EVTNAMELoR.210
	desc = hellenic.210.desc
	
	picture = GFX_evt_pope
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTALoR.200
		
		# Heresies of Orthodox follow suit
		set_parent_religion = {
			religion = orthodox
			parent = religion_scope
		}
		
		set_global_flag = schism_mended
		give_nickname = nick_the_saint
		
		if = {
			limit = {
				NOT = { has_landed_title = k_papacy }
				NOT = { k_papacy = { holder_scope = { is_liege_or_above = ROOT } } }
			}
			k_papacy = { holder_scope = { set_defacto_liege = ROOT } }
		}
		hidden_tooltip = {
			any_playable_ruler = {
				limit = { 
					religion = orthodox
					controls_religion = no
				}
				narrative_event = { id = hellenic.221 }
			}
		}
	}
}

# Convert or Not?
narrative_event = {
	id = LoR.211
	title = EVTNAMELoR.210
	desc = EVTDESCLoR.210
	picture = GFX_evt_icon

	is_triggered_only = yes

	option = { # Yes
		name = EVTOPTALoR.211

		# Workaround for automatic usurption of theocratic characters
		FROM = {
			religion_scope = {
				save_event_target_as = target_religion
			}
		}

		convert_religion_failsafe_effect = yes

		any_courtier = {
			limit = {
				religion = catholic
				liege = { character = ROOT }
			}

			# Workaround for automatic usurption of theocratic characters
			FROM = {
				religion_scope = {
					save_event_target_as = target_religion
				}
			}

			convert_religion_failsafe_effect = yes
		}

		capital_scope = {
			show_scope_change = no

			religion = FROM
		}

		ai_chance = { factor = 75 }
	}

	option = { # No
		name = EVTOPTBLoR.211

		ai_chance = { factor = 25 }
	}
}