decisions = {
catholic_crisis_of_faith = { 
  ai_check_interval = 100 # Determines how seldom the AI checks whether they can and should do the decision, in months. By default 1 (every month).
  only_rulers = yes

  potential = {
	religion = catholic
	controls_religion = yes
  }
  
  allow = {
	NOR = {
		has_global_flag = ciml_catholic_crisis_ongoing
		has_global_flag = ciml_catholic_crisis_over
	}
	is_heretic = no
	OR = {
		has_game_rule = {
			name = ciml_catholic_crisis
			value = ciml_anytime 
		}
		AND = {
			has_game_rule = {
				name = ciml_catholic_crisis
				value = ciml_if_huge 
			}
			catholic = { num_religion_provinces = 750 }
		}
		AND = {
			has_game_rule = {
				name = ciml_catholic_crisis
				value = ciml_delayed 
			}
			year = 1181
		}
	}
	OR = {
		trait = slothful
		trait = incapable
		trait = lunatic
		trait = possessed
		AND = {
			trait = greedy
			NOT = { trait = diligent }
		}
		AND = {
			trait = lustful
			NOT = { trait = diligent }
		}
		AND = {
			trait = bad_priest_christian
			NOT = { trait = diligent }
		}
	}
  }
  
  effect = {
	if = { 
		limit = {
			has_game_rule = {
				name = ciml_catholic_crisis
				value = ciml_if_huge 
			}
		}
		religion_authority = {
			modifier = crisis_of_faith
			years = 70
		}
		set_global_flag = ciml_catholic_crisis_ongoing
		any_playable_ruler = {
			limit = {
				ai = no
				religion_group = christian
			}
			narrative_event = { id = CIML.750 }
		}
	}
	if = { 
		limit = {
			has_game_rule = {
				name = ciml_catholic_crisis
				value = ciml_anytime 
			}
		}
		religion_authority = {
			modifier = crisis_of_faith_short
			years = 50
		}
		set_global_flag = ciml_catholic_crisis_ongoing
		any_playable_ruler = {
			limit = {
				ai = no
				religion_group = christian
			}
			narrative_event = { id = CIML.755 }
		}
	}
	if = { 
		limit = {
			has_game_rule = {
				name = ciml_catholic_crisis
				value = ciml_delayed 
			}
		}
		religion_authority = {
			modifier = crisis_of_faith_short
			years = 50
		}
		set_global_flag = ciml_catholic_crisis_ongoing
		any_playable_ruler = {
			limit = {
				ai = no
				religion_group = christian
			}
			narrative_event = { id = CIML.755 }
		}
	}
  }
  ai_will_do = {
	factor = 1
  }
}

}