decisions = { 

	mend_schism_catholic = {
		only_independent = yes
		is_high_prio = yes
		ai_check_interval = 3
		
		potential = {
			is_playable = yes
			is_adult = yes
			prisoner = no
			independent = yes
			religion = catholic
			NOT = { trait = incapable }
			OR = {
				has_landed_title = e_byzantium
				has_landed_title = e_roman_empire
				has_landed_title = e_abyssinia
			}
			is_heretic = no
			NOT = { has_global_flag = schism_mended }
			k_papal_state = {
				holder_scope = {
					is_heretic = no # If the Pope (and thus Catholicism) is heretical, mending the schism is no longer possible
				}
			}
			NOT = {
				has_alternate_start_parameter = { key = religion_names value = random }
			}
		}
		allow = {
			year = 1060
			piety = 200
			religion_authority = 0.8
			is_heretic = no
			learning = 8
			diplomacy = 15
			OR = {
				completely_controls = c_byzantion
				completely_controls = c_alexandria
			}
		}
		effect = {
			narrative_event = { id = CIML.210 }
			set_global_flag = schism_mended
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	ciml_start_great_schism = {
		only_independent = yes
		is_high_prio = yes
		ai_check_interval = 24
		
		potential = {
			religion = catholic
			controls_religion = yes
			NOT = {
				has_alternate_start_parameter = { key = religion_names value = random }
			}
			NOT = { has_global_flag = ciml_great_schism_started }
		}
		
		allow = {
			is_heretic = no
			year = 1045
			NOT = { year = 1060 }
		}
		effect = {
			hidden_tooltip = {
				any_playable_ruler = {
					limit = {
						OR = {
							religion = catholic
						}
						controls_religion = no
					}
					narrative_event = { id = CIML.803 }
				}
				any_playable_ruler = {
					limit = {
						OR = {
							religion = orthodox
							religion = barlaamite
						}
						controls_religion = no
						NOT = {
							culture = sardinian
						}
					}
					narrative_event = { id = CIML.804 }
				}
				any_playable_ruler = {
					limit = {
						OR = {
							religion = orthodox
							religion = barlaamite
						}
						controls_religion = no
						culture = sardinian
					}
					narrative_event = { id = CIML.805 }
				}
				any_playable_ruler = {
					limit = {
						religion = iconoclast
						controls_religion = no
					}
					narrative_event = { id = CIML.806 }
				}
				any_playable_ruler = {
					limit = {
						NOR = {
							religion = orthodox
							religion = iconoclast
							religion = barlaamite
							religion = catholic
						}
					}
					narrative_event = { id = CIML.807 }
				}
			}
			set_global_flag = ciml_great_schism_started
		}
		
		ai_will_do = {
			factor = 1
		}
	}

}