decisions = {
	
	# New Schism Decisions

	mend_great_schism = {
		is_high_prio = yes
		only_playable = yes
		ai_check_interval = 12
		potential = {
			has_dlc = "Legacy of Rome"
			is_playable = yes
			has_regent = no
			is_nomadic = no
			is_tribal = no
			OR = {
				controls_religion = yes
				real_tier = EMPEROR
			}
			OR = {
				religion = catholic
				religion = fraticelli
				religion = cathar
				religion = orthodox
				religion = monothelite
				religion = iconoclast
				religion = bogomilist
			}
			is_heretic = no
			#either a religion head or one exists for your religion
			OR = {
				controls_religion = yes
				religion_head = { always = yes }
			}
			#there must be a non-heretic religion head with whom to negotiate
			OR = {
				AND = {
					OR = {
						religion = catholic
						religion = fraticelli
						religion = cathar
					}
					OR = {
						k_orthodox = { holder_scope = { is_heretic = no } }
						d_monothelite = { holder_scope = { is_heretic = no } }
						d_iconoclast = { holder_scope = { is_heretic = no } }
						d_bogomilist = { holder_scope = { is_heretic = no } }
					}
				}
				AND = {
					OR = {
						religion = orthodox
						religion = monothelite
						religion = iconoclast
						religion = bogomilist
					}
					OR = {
						k_papal_state = { holder_scope = { is_heretic = no } }
						d_fraticelli = { holder_scope = { is_heretic = no } }
						d_cathar = { holder_scope = { is_heretic = no } }
					}
				}
			}
			k_papal_state = { has_title_flag = schism_happened }
			NOR = {
				has_global_flag = schism_mending
				has_global_flag = schism_mended
				has_character_flag = schism_mender
			}
		}
		allow = {
			custom_tooltip = {
				text = IS_NOT_BUSY
				hidden_tooltip = {
					war = no
					NOT = { is_inaccessible_trigger = yes }
					is_not_busy_trigger = yes
				}
			}
			piety = 2000
			religion_authority = 0.9
			OR = {
				controls_religion = yes
				religion_head = { is_liege_or_above = ROOT }
				completely_controls = c_byzantion
				completely_controls = c_jerusalem
				completely_controls = c_roma
			}
			b_hagiasophia = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_antiocheia = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_jerusalem = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_alexandria = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_roma = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
		}
		effect = {
			narrative_event = { id = Plus.2230 tooltip = EVTTOOLTIPLoR.210 }
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				OR = {
					trait = cynical
					trait = bad_priest_christian
				}
			}
		}
	}
	
	enforce_ephesus = {
		is_high_prio = yes
		only_playable = yes
		ai_check_interval = 12
		potential = {
			has_dlc = "Legacy of Rome"
			is_playable = yes
			has_regent = no
			is_nomadic = no
			is_tribal = no
			OR = {
				controls_religion = yes
				real_tier = EMPEROR
			}
			OR = {
				religion = chalcedonian
				religion = catholic
				religion = fraticelli
				religion = cathar
				religion = orthodox
				religion = monothelite
				religion = iconoclast
				religion = bogomilist
				AND = {
					OR = {
						religion = miaphysite
						religion = monophysite
						religion = apostolic
						religion = paulician
					}
					has_global_flag = chalcedon_repudiated
				}
			}
			is_heretic = no
			#either a religion head or one exists for your religion
			OR = {
				controls_religion = yes
				religion_head = { always = yes }
			}
			#there must be a non-heretic religion head with whom to negotiate
			OR = {
				d_nestorian = { holder_scope = { is_heretic = no } }
				d_messalian = { holder_scope = { is_heretic = no } }
			}
			OR = {
				AND = {
					OR = {
						religion = miaphysite
						religion = monophysite
						religion = apostolic
						religion = paulician
					}
					has_global_flag = chalcedon_repudiated
				}
				has_global_flag = schism_mended
				NOT = { k_papal_state = { has_title_flag = schism_happened } }
			}
			NOR = {
				has_global_flag = ephesus_enforced
				has_global_flag = enforcing_ephesus
				has_global_flag = ephesus_repudiated
				has_character_flag = schism_mender
			}
		}
		allow = {
			custom_tooltip = {
				text = IS_NOT_BUSY
				hidden_tooltip = {
					war = no
					NOT = { is_inaccessible_trigger = yes }
					is_not_busy_trigger = yes
				}
			}
			piety = 1000
			religion_authority = 0.9
			OR = {
				controls_religion = yes
				religion_head = { is_liege_or_above = ROOT }
				completely_controls = c_byzantion
				completely_controls = c_jerusalem
				completely_controls = c_roma
			}
			b_hagiasophia = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_antiocheia = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_alexandria = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_bagdad = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_roudehen = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}			
		}
		effect = {
			narrative_event = { id = Plus.2234 tooltip = NESTORIAN_SCHISM_ENDED }
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				OR = {
					trait = cynical
					trait = bad_priest_christian
				}
			}
		}
	}
	
	enforce_chalcedon = {
		is_high_prio = yes
		only_playable = yes
		ai_check_interval = 12
		potential = {
			has_dlc = "Legacy of Rome"
			is_playable = yes
			has_regent = no
			is_nomadic = no
			is_tribal = no
			OR = {
				controls_religion = yes
				real_tier = EMPEROR
			}
			OR = {
				religion = chalcedonian
				religion = catholic
				religion = fraticelli
				religion = cathar
				religion = orthodox
				religion = monothelite
				religion = iconoclast
				religion = bogomilist
				AND = {
					OR = {
						religion = nestorian
						religion = messalian
					}
					has_global_flag = ephesus_repudiated
				}
			}
			is_heretic = no
			#either a religion head or one exists for your religion
			OR = {
				controls_religion = yes
				religion_head = { always = yes }
			}
			#there must be a non-heretic religion head with whom to negotiate
			OR = {
				d_miaphysite = { holder_scope = { is_heretic = no } }
				d_monophysite = { holder_scope = { is_heretic = no } }
			}
			OR = {
				d_apostolic = { holder_scope = { is_heretic = no } }
				d_paulician = { holder_scope = { is_heretic = no } }
			}
			OR = {
				AND = {
					OR = {
						religion = nestorian
						religion = messalian
					}
					has_global_flag = ephesus_repudiated
				}
				has_global_flag = schism_mended
				NOT = { k_papal_state = { has_title_flag = schism_happened } }
			}
			NOR = {
				has_global_flag = chalcedon_enforced
				has_global_flag = enforcing_chalcedon
				has_global_flag = chalcedon_repudiated
				has_character_flag = schism_mender
			}
		}
		allow = {
			custom_tooltip = {
				text = IS_NOT_BUSY
				hidden_tooltip = {
					war = no
					NOT = { is_inaccessible_trigger = yes }
					is_not_busy_trigger = yes
				}
			}
			piety = 1000
			religion_authority = 0.9
			OR = {
				controls_religion = yes
				religion_head = { is_liege_or_above = ROOT }
				completely_controls = c_byzantion
				completely_controls = c_jerusalem
				completely_controls = c_roma
			}
			b_hagiasophia = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_antiocheia = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_alexandria = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_etchmiadzin = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_aksum = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}			
		}
		effect = {
			narrative_event = { id = Plus.2238 tooltip = MIAPHYSITE_SCHISM_ENDED }
			set_global_flag = chalcedon_enforced
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				OR = {
					trait = cynical
					trait = bad_priest_christian
				}
			}
		}
	}
	
	nestorian_repudiate_ephesus = {
		is_high_prio = yes
		only_playable = yes
		ai_check_interval = 12
		potential = {
			has_dlc = "Legacy of Rome"
			is_playable = yes
			has_regent = no
			is_nomadic = no
			is_tribal = no
			OR = {
				controls_religion = yes
				real_tier = EMPEROR
			}
			OR = {
				religion = nestorian
				religion = messalian
			}
			is_heretic = no
			#either a religion head or one exists for your religion
			OR = {
				controls_religion = yes
				religion_head = { always = yes }
			}
			#there must be a non-heretic religion head with whom to negotiate
			OR = {
				k_orthodox = { holder_scope = { is_heretic = no } }
				d_monothelite = { holder_scope = { is_heretic = no } }
				d_iconoclast = { holder_scope = { is_heretic = no } }
				d_bogomilist = { holder_scope = { is_heretic = no } }
			}
			NOR = {
				has_global_flag = ephesus_repudiated
				has_global_flag = repudiating_ephesus
				has_global_flag = chalcedon_repudiated
				has_global_flag = ephesus_enforced
				has_global_flag = schism_mended
				has_character_flag = schism_mender
			}
			k_papal_state = { has_title_flag = schism_happened }
		}
		allow = {
			custom_tooltip = {
				text = IS_NOT_BUSY
				hidden_tooltip = {
					war = no
					NOT = { is_inaccessible_trigger = yes }
					is_not_busy_trigger = yes
				}
			}
			piety = 2000
			religion_authority = 0.8
			OR = {
				controls_religion = yes
				religion_head = { is_liege_or_above = ROOT }
				completely_controls = c_byzantion
				completely_controls = c_jerusalem
			}
			b_hagiasophia = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_antiocheia = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_jerusalem = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_alexandria = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
		}
		effect = {
			narrative_event = { id = Plus.2242 tooltip = ORTHODOX_SCHISM_ENDED }
			set_global_flag = ephesus_repudiated
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				OR = {
					trait = cynical
					trait = bad_priest_christian
				}
			}
		}
	}
	
	miaphysite_repudiate_chalcedon = {
		is_high_prio = yes
		only_playable = yes
		ai_check_interval = 12
		potential = {
			has_dlc = "Legacy of Rome"
			is_playable = yes
			has_regent = no
			is_nomadic = no
			is_tribal = no
			OR = {
				controls_religion = yes
				real_tier = EMPEROR
			}
			OR = {
				religion = miaphysite
				religion = monophysite
				religion = apostolic
				religion = paulician
			}
			is_heretic = no
			#either a religion head or one exists for your religion
			OR = {
				controls_religion = yes
				religion_head = { always = yes }
			}
			#there must be a non-heretic religion head with whom to negotiate
			OR = {
				k_orthodox = { holder_scope = { is_heretic = no } }
				d_monothelite = { holder_scope = { is_heretic = no } }
				d_iconoclast = { holder_scope = { is_heretic = no } }
				d_bogomilist = { holder_scope = { is_heretic = no } }
			}
			NOR = {
				has_global_flag = chalcedon_repudiated
				has_global_flag = repudiating_chalcedon
				has_global_flag = ephesus_repudiated
				has_global_flag = chalcedon_enforced
				has_global_flag = schism_mended
				has_character_flag = schism_mender
			}
			k_papal_state = { has_title_flag = schism_happened }
		}
		allow = {
			custom_tooltip = {
				text = IS_NOT_BUSY
				hidden_tooltip = {
					war = no
					NOT = { is_inaccessible_trigger = yes }
					is_not_busy_trigger = yes
				}
			}
			piety = 2000
			religion_authority = 0.8
			OR = {
				controls_religion = yes
				religion_head = { is_liege_or_above = ROOT }
				completely_controls = c_byzantion
				completely_controls = c_jerusalem
			}
			b_hagiasophia = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_antiocheia = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_jerusalem = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_alexandria = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
		}
		effect = {
			narrative_event = { id = Plus.2246 tooltip = ORTHODOX_SCHISM_ENDED }
			set_global_flag = chalcedon_repudiated
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				OR = {
					trait = cynical
					trait = bad_priest_christian
				}
			}
		}
	}
	
	unite_christianity = {
		is_high_prio = yes
		only_playable = yes
		ai_check_interval = 12
		potential = {
			has_dlc = "Legacy of Rome"
			is_playable = yes
			has_regent = no
			is_nomadic = no
			is_tribal = no
			OR = {
				controls_religion = yes
				real_tier = EMPEROR
			}
			OR = {
				AND = {
					OR = {
						religion = miaphysite
						religion = monophysite
						religion = apostolic
						religion = paulician
					}
					has_global_flag = chalcedon_repudiated
					has_global_flag = ephesus_enforced
				}
				AND = {
					OR = {
						religion = nestorian
						religion = messalian
					}
					has_global_flag = ephesus_repudiated
					has_global_flag = chalcedon_enforced
				}
			}
			is_heretic = no
			#either a religion head or one exists for your religion
			OR = {
				controls_religion = yes
				religion_head = { always = yes }
			}
			#there must be a non-heretic religion head with whom to negotiate
			OR = {
				k_papal_state = { holder_scope = { is_heretic = no } }
				d_fraticelli = { holder_scope = { is_heretic = no } }
				d_cathar = { holder_scope = { is_heretic = no } }
			}
			NOR = {
				has_global_flag = christianity_united
				has_global_flag = uniting_christianity
				has_character_flag = schism_mender
			}
		}
		allow = {
			custom_tooltip = {
				text = IS_NOT_BUSY
				hidden_tooltip = {
					war = no
					NOT = { is_inaccessible_trigger = yes }
					is_not_busy_trigger = yes
				}
			}
			piety = 2000
			religion_authority = 0.9
			OR = {
				controls_religion = yes
				religion_head = { is_liege_or_above = ROOT }
				completely_controls = c_byzantion
				completely_controls = c_jerusalem
				completely_controls = c_roma
			}
			b_hagiasophia = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_antiocheia = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_jerusalem = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_alexandria = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
			b_roma = {
				custom_tooltip = { text = CONTROL_RELIGION_NO_WAR }
				hidden_tooltip = {
					has_holder = yes
					holder_scope = {
						religion = ROOT
						war = no
					}
				}
			}
		}
		effect = {
			narrative_event = { id = Plus.2250 tooltip = CATHOLIC_SCHISM_ENDED }
			set_global_flag = christianity_united
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				OR = {
					trait = cynical
					trait = bad_priest_christian
				}
			}
		}
	}

	# Chalcedonian Decisions
	
	chalcedonian_rome_held = {
		is_high_prio = yes
		ai_check_interval = 3
		potential = {
			has_landed_title = d_pentarch_rome
			religion = chalcedonian
			NOT = { religion_head = { always = yes } }
			NOT = { e_placeholder = { had_title_flag = { flag = startup days = 18250 } } }
		}
		allow = {
			333 = {
				NOT = { has_province_modifier = pope_in_rome }
				religion = chalcedonian
			}
		}
		effect = {
			religion_authority = {
				modifier = pope_in_rome_MA
	        }
			333 = {
				add_province_modifier = {
					name = pope_in_rome
					duration = 3650
				}
			}
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	chalcedonian_constantinople_held = {
		is_high_prio = yes
		ai_check_interval = 3
		potential = {
			has_landed_title = d_pentarch_constantinople
			religion = chalcedonian
			NOT = { religion_head = { always = yes } }
			NOT = { e_placeholder = { had_title_flag = { flag = startup days = 18250 } } }
		}
		allow = {
			496 = {
				NOT = { has_province_modifier = patriarch_in_constantinople }
				religion = chalcedonian
			}
		}
		effect = {
			religion_authority = {
				modifier = patriarch_in_constantinople_MA
	        }
			496 = {
				add_province_modifier = {
					name = patriarch_in_constantinople
					duration = 3650
				}
			}
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	chalcedonian_patriarch_rome = {
		is_high_prio = yes
		ai_check_interval = 3
		icon_religion = catholic
		
		potential = {
			religion = chalcedonian
			OR = {
				higher_tier_than = DUKE
				has_landed_title = d_pentarch_rome
			}
			d_pentarch_rome = {
				has_holder = yes
				holder_scope = {
					religion = ROOT
					trait = latin_rites
				}
			}
			NOR = {
				culture = greek
				has_landed_title = e_byzantium
				k_papal_state = { has_title_flag = schism_happened }
				has_global_flag = patriarch_supreme_created
			}
		}
		allow = {
			war = no
			has_regent = no
			independent = yes
			piety = 2500
			OR = {
				has_landed_title = d_pentarch_rome
				real_tier = EMPEROR
			}
			OR = {
				has_landed_title = d_pentarch_rome
				prestige = 2500
			}
			NOR = {
				trait = bad_priest_christian
				trait = excommunicated
			}
			OR = {
				custom_tooltip = {
					text = ROME_IS_YOUR_VASSAL
					hidden_tooltip = {
						any_vassal = { has_landed_title = d_pentarch_rome }
					}
				}
				custom_tooltip = {
					text = RELIGION_HEAD_IS_LATIN
					hidden_tooltip = {
						rightful_religious_head_scope = { trait = latin_rites }
					}
				}
			}
			OR = {
				custom_tooltip = {
					text = CONSTANTINOPLE_DOES_NOT_EXIST
					hidden_tooltip = {
						b_hagiasophia = {
							holder_scope = {
								NOT = { has_landed_title = d_pentarch_constantinople }
								OR = {
									is_theocracy = no
									NOT = { religion_group = christian }
								}
							}
						}
					}
				}
				custom_tooltip = {
					text = ECUMENICAL_PATRIARCH_IS_LATIN
					hidden_tooltip = {
						d_pentarch_constantinople = { holder_scope = { trait = latin_rites } }
					}
				}
				custom_tooltip = {
					text = TWO_OTHER_LATIN_PATRIARCHS
					hidden_tooltip = {
						calc_true_if = {
							amount = 2
							d_pentarch_alexandria = { holder_scope = { trait = latin_rites } }
							d_pentarch_antioch = { holder_scope = { trait = latin_rites } }
							d_pentarch_jerusalem = { holder_scope = { trait = latin_rites } }
						}
					}
				}
			}
		}
		effect = {
			set_global_flag = patriarch_supreme_created
			set_global_flag = patriarch_supreme_is_latin
			add_trait = paragon
			prestige = 1000
			custom_tooltip = {
				text = ROME_BECOMES_PATRIARCH_SUPREME
				hidden_tooltip = {
					activate_title = { title = k_chalcedonian status = yes }
					d_pentarch_rome = {
						holder_scope = {
							any_liege = {
								limit = { tier = EMPEROR }
								save_event_target_as = new_liege
							}
							k_chalcedonian = { gain_title = PREV }
							if = {
								limit = { event_target:new_liege = { is_alive = yes } }
								set_defacto_liege = event_target:new_liege
								pf_liege_change_effect = yes
							}
							if = {
								limit = { NOT = { character = ROOT } }
								add_friend = ROOT
								piety = 250
								prestige = 250
							}
							narrative_event = { id = Plus.2288 }
						}
					}
				}
			}
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	chalcedonian_patriarch_constantinople = {
		is_high_prio = yes
		ai_check_interval = 3
		icon_religion = orthodox
		
		potential = {
			religion = chalcedonian
			OR = {
				higher_tier_than = DUKE
				has_landed_title = d_pentarch_constantinople
			}
			d_pentarch_constantinople = {
				has_holder = yes
				holder_scope = {
					religion = ROOT
					trait = greek_rites
				}
			}
			NOR = {
				culture = italian
				culture = longobard
				trait = crowned_by_pope
				k_papal_state = { has_title_flag = schism_happened }
				has_global_flag = patriarch_supreme_created
			}
		}
		allow = {
			war = no
			has_regent = no
			independent = yes
			piety = 2500
			OR = {
				has_landed_title = d_pentarch_constantinople
				real_tier = EMPEROR
			}
			OR = {
				has_landed_title = d_pentarch_constantinople
				prestige = 2500
			}
			NOR = {
				trait = bad_priest_christian
				trait = excommunicated
			}
			OR = {
				custom_tooltip = {
					text = CONSTANTINOPLE_IS_YOUR_VASSAL
					hidden_tooltip = {
						any_vassal = { has_landed_title = d_pentarch_constantinople }
					}
				}
				custom_tooltip = {
					text = RELIGION_HEAD_IS_GREEK
					hidden_tooltip = {
						rightful_religious_head_scope = { trait = greek_rites }
					}
				}
			}
			OR = {
				custom_tooltip = {
					text = ROME_DOES_NOT_EXIST
					hidden_tooltip = {
						b_roma = {
							holder_scope = {
								NOT = { has_landed_title = d_pentarch_rome }
								OR = {
									is_theocracy = no
									NOT = { religion_group = christian }
								}
							}
						}
					}
				}
				custom_tooltip = {
					text = PAPACY_IS_GREEK
					hidden_tooltip = {
						d_pentarch_rome = { holder_scope = { trait = greek_rites } }
					}
				}
				custom_tooltip = {
					text = TWO_OTHER_GREEK_PATRIARCHS
					hidden_tooltip = {
						calc_true_if = {
							amount = 2
							d_pentarch_alexandria = { holder_scope = { trait = greek_rites } }
							d_pentarch_antioch = { holder_scope = { trait = greek_rites } }
							d_pentarch_jerusalem = { holder_scope = { trait = greek_rites } }
						}
					}
				}
			}
		}
		effect = {
			set_global_flag = patriarch_supreme_created
			add_trait = paragon
			prestige = 1000
			custom_tooltip = {
				text = CONSTANTINOPLE_BECOMES_PATRIARCH_SUPREME
				hidden_tooltip = {
					activate_title = { title = k_chalcedonian status = yes }
					d_pentarch_constantinople = {
						holder_scope = {
							any_liege = {
								limit = { tier = EMPEROR }
								save_event_target_as = new_liege
							}
							k_chalcedonian = { gain_title = PREV }
							if = {
								limit = { event_target:new_liege = { is_alive = yes } }
								set_defacto_liege = event_target:new_liege
								pf_liege_change_effect = yes
							}
							if = {
								limit = { NOT = { character = ROOT } }
								add_friend = ROOT
								piety = 250
								prestige = 250
							}
							narrative_event = { id = Plus.2288 }
						}
					}
				}
			}
		}
		ai_will_do = {
			factor = 1
		}
	}

	chalcedonian_become_cardinal = {
		is_high_prio = yes
		only_rulers = yes
		ai_check_interval = 12
		potential = {
			religion = chalcedonian
			is_ruler = yes
			is_female = no
			is_theocracy = yes
			k_papal_chalcedon = { has_holder = yes }
			rightful_religious_head_scope = { has_landed_title = k_papal_chalcedon }
			NOR = {
				any_demesne_title = { temporary = yes }
				rightful_religious_head = ROOT
				trait = bad_priest_christian
				trait = chalc_cardinal
				chalc_cardinal = {
					is_alive = yes
					count = 9
				}
			}
		}
		allow = {
			piety = 0
			has_regent = no
			rightful_religious_head_scope = {
				OR = {
					AND = {
						trait = latin_rites
						ROOT = { trait = latin_rites }
					}
					AND = {
						trait = greek_rites
						ROOT = { trait = greek_rites }
					}
				}
				is_within_diplo_range = ROOT
				opinion = { who = ROOT value = 0 }
				OR = {
					NOT = { has_character_flag = cardinal_pick_timer }
					had_character_flag = { flag = cardinal_pick_timer days = 45 }
				}
			}
		}
		effect = {
			log = "[Root.GetBestName] appointed as cardinal"
			piety = 50
			add_trait = chalc_cardinal
			rightful_religious_head_scope = {
				set_character_flag = cardinal_pick_timer
				reverse_opinion = { who = ROOT modifier = opinion_pleased years = 5 }
				save_event_target_as = current_pope
			}
			any_playable_ruler = {
				limit = {
					ai = no
					religion = chalcedonian
					rightful_religious_head_scope = { has_landed_title = k_papal_chalcedon }
					is_liege_of = ROOT
				}
				character_event = { id = Plus.2291 } # Notification to liege
			}
			any_playable_ruler = {
				limit = {
					ai = no
					religion = chalcedonian
					rightful_religious_head_scope = { has_landed_title = k_papal_chalcedon }
					NOT = { is_liege_of = ROOT }
				}
				character_event = { id = Plus.2292 } # Notification
			}
			set_special_character_title = CHALCEDONIAN_CARDINAL
			set_character_flag = is_chalcedonian_cardinal
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 5
				tier = COUNT
			}
			modifier = {
				factor = 10
				higher_tier_than = COUNT
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 1.5
				trait = zealous
			}
			modifier = {
				factor = 1.25
				OR = {
					trait = theologian
					trait = schemer
					trait = socializer
				}
			}
			modifier = {
				factor = 1.25
				trait = proud
			}
			modifier = {
				factor = 1.25
				trait = diligent
			}
			modifier = {
				factor = 1.25
				trait = gregarious
			}
			modifier = {
				factor = 0.1
				trait = cynical
			}
			modifier = {
				factor = 0.5
				trait = content
			}
			modifier = {
				factor = 0.5
				trait = humble
			}
			modifier = {
				factor = 0.75
				trait = slothful
			}
			modifier = {
				factor = 0.75
				trait = shy
			}
			modifier = {
				factor = 0.75
				NOR = {
					trait = detached_priest
					trait = martial_cleric
					trait = scholarly_theologian
					trait = mastermind_theologian
				}
			}
			modifier = {
				factor = 1.25
				trait = scholarly_theologian
			}
			modifier = {
				factor = 1.5
				trait = mastermind_theologian
			}
			modifier = {
				factor = 0.75
				NOR = {
					culture = italian
					culture = longobard
					rightful_religious_head_scope = { culture = ROOT }
				}
			}
			modifier = {
				factor = 0.75
				NOT = { piety = 50 }
			}
			modifier = {
				factor = 0.75
				NOT = { piety = 100 }
			}
			modifier = {
				factor = 1.1
				piety = 200
			}
			modifier = {
				factor = 1.1
				piety = 300
			}
			modifier = {
				factor = 1.1
				piety = 400
			}
			modifier = {
				factor = 1.1
				piety = 500
			}
			modifier = {
				factor = 0.5
				NOR = {
					culture = italian
					culture = longobard
					rightful_religious_head_scope = { culture = ROOT }
				}
				chalc_cardinal = {
					is_alive = yes
					distance = { who = ROOT value = 50 }
				}
			}
			modifier = {
				factor = 1.25
				rightful_religious_head_scope = {
					NOT = { distance = { who = ROOT value = 75 } }
				}
			}
			modifier = {
				factor = 1.25
				rightful_religious_head_scope = {
					NOT = { distance = { who = ROOT value = 150 } }
				}
			}
			modifier = {
				factor = 1.25
				rightful_religious_head_scope = {
					NOT = { distance = { who = ROOT value = 300 } }
				}
			}
			modifier = {
				factor = 0.5
				rightful_religious_head_scope = {
					distance = { who = ROOT value = 400 }
				}
			}
			modifier = {
				factor = 1.25
				rightful_religious_head_scope = {
					opinion = { who = ROOT value = 20 }
				}
			}
			modifier = {
				factor = 1.25
				rightful_religious_head_scope = {
					opinion = { who = ROOT value = 40 }
				}
			}
			modifier = {
				factor = 1.5
				rightful_religious_head_scope = {
					opinion = { who = ROOT value = 60 }
				}
			}
			modifier = {
				factor = 1.5
				rightful_religious_head_scope = {
					opinion = { who = ROOT value = 80 }
				}
			}
		}
	}
}