targeted_decisions = {

	convert_to_liege_religion = {
		filter = self

		ai = no

		potential = {
			independent = no
			NOT = { religion = liege }
			religion_group = liege
			controls_religion = no
			holy_order = no
		}

		allow = {
			NOT = { trait = zealous }

			trigger_if = {
				limit = { is_nomadic = no }

				liege = {
					show_scope_change = no

					has_safe_religion = yes
				}
			}
		}

		effect = {
			tooltip = {
				religion = liege
			}

			prestige = -500
			piety = 250

			if = {
				limit = { higher_tier_than = BARON }

				religion_authority = {
					name = ruler_converted_from
				}

				liege = {
					show_scope_change = no

					religion_authority = {
						name = ruler_converted_to
					}
				}
			}

			hidden_effect = {
				religion = liege
			}

			liege = {
				trigger_switch = {
					on_trigger = trait

					shaivist_hindu     = { ROOT = { add_trait = shaivist_hindu } }
					vaishnavist_hindu  = { ROOT = { add_trait = vaishnavist_hindu } }
					shaktist_hindu     = { ROOT = { add_trait = shaktist_hindu } }
					smartist_hindu     = { ROOT = { add_trait = smartist_hindu } }
					mahayana_buddhist  = { ROOT = { add_trait = mahayana_buddhist } }
					vajrayana_buddhist = { ROOT = { add_trait = vajrayana_buddhist } }
					theravada_buddhist = { ROOT = { add_trait = theravada_buddhist } }
					digambara_jain     = { ROOT = { add_trait = digambara_jain } }
					svetambara_jain    = { ROOT = { add_trait = svetambara_jain } }
					pagan_branch_1     = { ROOT = { add_trait = pagan_branch_1 } }
					pagan_branch_2     = { ROOT = { add_trait = pagan_branch_2 } }
					pagan_branch_3     = { ROOT = { add_trait = pagan_branch_3 } }
					pagan_branch_4     = { ROOT = { add_trait = pagan_branch_4 } }
					### ACR ###
					pagan_branch_5_animist		= { ROOT = { add_trait = pagan_branch_5_animist } }
					pagan_branch_6_theist		= { ROOT = { add_trait = pagan_branch_6_theist } }
					pagan_branch_7_intellect	= { ROOT = { add_trait = pagan_branch_7_intellect } }
					pagan_branch_8_might		= { ROOT = { add_trait = pagan_branch_8_might } }
					pagan_branch_9_egoist		= { ROOT = { add_trait = pagan_branch_9_egoist  } }
					pagan_branch_10_altruist	= { ROOT = { add_trait = pagan_branch_10_altruist } }
				}
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

	convert_to_liege_religion_on_liege = {
		filter = liege

		ai = no

		from_potential = {
			controls_religion = no
		}

		potential = {
			religion_group = FROM
			NOT = { religion = FROM }
		}

		allow = {
			FROM = {
				NOT = { trait = zealous }
			}
		}

		effect = {
			FROM = {
				show_scope_change = no

				tooltip = {
					religion = ROOT
				}

				prestige = -500
				piety = 250

				if = {
					limit = { higher_tier_than = BARON }

					religion_authority = {
						name = ruler_converted_from
					}

					ROOT = {
						show_scope_change = no

						religion_authority = {
							name = ruler_converted_to
						}
					}
				}

				hidden_effect = {
					religion = ROOT
				}
			}

			ROOT = {
				show_scope_change = no

				trigger_switch = {
					on_trigger = trait

					shaivist_hindu     = { FROM = { show_scope_change = no add_trait = shaivist_hindu } }
					vaishnavist_hindu  = { FROM = { show_scope_change = no  add_trait = vaishnavist_hindu } }
					shaktist_hindu     = { FROM = { show_scope_change = no  add_trait = shaktist_hindu } }
					smartist_hindu     = { FROM = { show_scope_change = no  add_trait = smartist_hindu } }
					mahayana_buddhist  = { FROM = { show_scope_change = no  add_trait = mahayana_buddhist } }
					vajrayana_buddhist = { FROM = { show_scope_change = no  add_trait = vajrayana_buddhist } }
					theravada_buddhist = { FROM = { show_scope_change = no  add_trait = theravada_buddhist } }
					digambara_jain     = { FROM = { show_scope_change = no  add_trait = digambara_jain } }
					svetambara_jain    = { FROM = { show_scope_change = no  add_trait = svetambara_jain } }
					pagan_branch_1     = { FROM = { show_scope_change = no  add_trait = pagan_branch_1 } }
					pagan_branch_2     = { FROM = { show_scope_change = no  add_trait = pagan_branch_2 } }
					pagan_branch_3     = { FROM = { show_scope_change = no  add_trait = pagan_branch_3 } }
					pagan_branch_4     = { FROM = { show_scope_change = no  add_trait = pagan_branch_4 } }
					### ACR ###
					pagan_branch_5_animist		= { FROM = { show_scope_change = no  add_trait = pagan_branch_5_animist } }
					pagan_branch_6_theist		= { FROM = { show_scope_change = no  add_trait = pagan_branch_6_theist } }
					pagan_branch_7_intellect	= { FROM = { show_scope_change = no  add_trait = pagan_branch_7_intellect } }
					pagan_branch_8_might		= { FROM = { show_scope_change = no  add_trait = pagan_branch_8_might } }
					pagan_branch_9_egoist		= { FROM = { show_scope_change = no  add_trait = pagan_branch_9_egoist  } }
					pagan_branch_10_altruist	= { FROM = { show_scope_change = no  add_trait = pagan_branch_10_altruist } }
				}
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

	convert_to_liege_culture_on_liege = {
		filter = liege
		ai_target_filter = liege
		ai_check_interval = 60

		ai = no

		potential = {
			NOT = { culture = FROM }
		}

		allow = {
			FROM = {
				show_scope_change = no

				prestige >= 200
			}
		}

		effect = {
			FROM = {
				show_scope_change = no

				prestige = -200
				culture = ROOT
			}
		}

		ai_will_do = {
			factor = 0
		}

	}

	convert_to_liege_culture = {
		filter = self

		ai = no

		potential = {
			independent = no
			NOT = { culture = liege }
		}

		allow = {
			prestige >= 200
		}

		effect = {
			prestige = -200
			culture = liege
		}

		ai_will_do = {
			factor = 0
		}
	}

	convert_to_local_culture = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 24

		only_playable = yes

		potential = {
			has_dlc = "Rajas of India"
			is_nomadic = no
			holy_order = no
			mercenary = no

			NOR = {
				culture = capital_scope
				government = chinese_imperial_government
			}

			trigger_if = {
				limit = { independent = no }
				NOT = { culture = liege }
			}
		}

		allow = {
			prestige >= 500
		}

		effect = {
			prestige = -500
			culture = capital_scope

			hidden_effect = {
				any_child = {
					limit = {
						is_ruler = no
						vassal_of = ROOT
					}

					culture = ROOT
				}
			}
		}

		ai_will_do = {
			factor = 0.25

			trigger = {
				NOR = {
					has_landed_title = e_china_west_governor
					has_landed_title = e_latin_empire
					has_landed_title = e_outremer
					has_landed_title = k_jerusalem

					any_liege = {
						OR = {
							has_landed_title = k_jerusalem
							has_landed_title = e_outremer
						}
					}

					primary_title = {
						is_conquered = yes
						conquest_culture = ROOT
					}

					any_vassal = {
						culture = ROOT
						is_powerful_vassal = yes
					}

					AND = {
						NOR = {
							year >= 1150
							non_historical_culture_names_in_alt_start_trigger = yes
						}

						capital_scope = { culture = norse }

						OR = {
							culture = swedish
							culture = norwegian
							culture = danish
							culture = norman
						}
					}

					AND = {
						capital_scope = {
							OR = {
								culture = anglo-saxon
								culture = norman
							}
						}

						OR = {
							culture = anglo-saxon
							culture = norman
							culture = english
						}
					}

					AND = {
						capital_scope = { culture_group = east_slavic }
						culture = russian
					}

					AND = {
						capital_scope = { culture = pictish }
						culture = scottish
					}

					AND = {
						capital_scope = { culture = lombard }
						culture = italian
					}

					AND = {
						capital_scope = { culture = frankish }
						culture = french
					}

					AND = {
						capital_scope = { culture = frisian }
						culture = dutch
					}

					AND = {
						capital_scope = { culture = saxon }
						culture = german
					}

					AND = {
						capital_scope = { culture = visigothic }
						OR = {
							culture_group = iberian
							culture = andalusian_arabic
							culture = occitan
							religion_group = muslim
						}
					}

					culture = nahua
				}
			}
		}
	}

	convert_to_local_religion = {
		filter = self

		ai = no

		potential = {
			has_dlc = "Rajas of India"
			is_nomadic = no
			controls_religion = no
			holy_order = no
			NOT = { religion = capital_scope }

			trigger_if = {
				limit = { independent = no }
				NOT = { religion = liege }
			}

			# The Indian religions can convert to each other anyway
			NAND = {
				has_dharmic_religion_trigger = yes
				capital_scope = { has_dharmic_religion_trigger = yes }
			}

			# May instead renounce Iconoclasm
			NOT = { is_decision_potential = renounce_iconoclasm }
		}

		allow = {
			NOT = { trait = zealous }

			trigger_if = {
				limit = { true_religion_group = capital_scope }
				prestige >= 500
			}
			trigger_else = {
				prestige >= 1000
			}

			capital_scope = {
				show_scope_change = no

				has_safe_religion = yes
			}
		}

		effect = {
			piety = 250

			tooltip = {
				religion = capital_scope
			}

			if = {
				limit = { true_religion_group = capital_scope }
				prestige = -500
			}
			else = {
				prestige = -1000
			}

			if = {
				limit = {
					has_any_sympathy_trait_trigger = no
					NOT = { true_religion_group = capital_scope }
				}

				random = {
					chance = 60

					trigger_switch = {
						on_trigger = true_religion_group

						christian         = { add_trait = sympathy_christendom }
						muslim            = { add_trait = sympathy_islam }
						indian_group      = { add_trait = sympathy_indian }
						jewish_group      = { add_trait = sympathy_judaism }
						pagan_group       = { add_trait = sympathy_pagans }
						zoroastrian_group = { add_trait = sympathy_zoroastrianism }
					}
				}
			}

			custom_tooltip = { text = local_religion_conversion_tooltip }

			religion_authority = {
				name = ruler_converted_from
			}

			capital_scope = {
				show_scope_change = no

				religion_authority = {
					name = ruler_converted_to
				}
			}

			hidden_effect = {
				religion = capital_scope
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

	convert_to_parent_religion = {
		filter = self
		ai_target_filter = self

		ai = no

		potential = {
			is_heretic = yes
			independent = yes
			controls_religion = no
			holy_order = no

			# May instead renounce Iconoclasm
			NOT = { is_decision_potential = renounce_iconoclasm }

			# Can convert to Reformed instead
			trigger_if = {
				limit = { religion_group = pagan_group }
				is_reformed_religion = yes
			}
		}

		allow = {
			NOT = { trait = zealous }
		}

		effect = {
			tooltip = {
				abandon_heresy = yes
			}

			prestige = -500
			piety = 250

			if = {
				limit = { higher_real_tier_than = BARON }

				religion_authority = {
					name = ruler_converted_from
				}

				parent_religion = {
					show_scope_change = no

					religion_authority = {
						name = ruler_converted_to
					}
				}
			}

			hidden_effect = {
				abandon_heresy = yes
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

	convert_to_swedish = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			culture = norse

			capital_scope = {
				region = custom_swedish
			}

			any_realm_province = {
				culture = swedish
			}

			NOR = {
				government = chinese_imperial_government

				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}
			}
		}

		allow = {
		}

		effect = {
			culture = swedish

			any_dynasty_member = {
				show_scope_change = no

				limit = {
					culture = norse
					employer = { character = ROOT }
				}

				culture = swedish
			}
		}

		ai_will_do = {
			factor = 0.5

			trigger = {
				# Do not flip if we're in a huge Norse empire
				NAND = {
					top_liege = { culture = norse }

					OR = {
						top_liege = {
							real_tier = EMPEROR
						}

						AND = {
							c_uppland = {
								holder_scope = {
									same_realm = ROOT
								}
							}

							c_akershus = {
								holder_scope = {
									same_realm = ROOT
								}
							}

							c_sjaelland = {
								holder_scope = {
									same_realm = ROOT
								}
							}
						}
					}
				}
			}

			mult_modifier = {
				factor = 0.01

				capital_scope = {
					NOT = { culture = swedish }
				}
			}

			mult_modifier = {
				factor = 2.0
				liege = { culture = swedish }
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = swedish
					value >= 2
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = swedish
					value >= 4
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = swedish
					value >= 6
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = swedish
					value >= 8
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = swedish
					value >= 10
				}
			}

		}
	}

	convert_to_norwegian = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			culture = norse

			capital_scope = {
				region = custom_norwegian
			}

			any_realm_province = {
				culture = norwegian
			}

			NOR = {
				government = chinese_imperial_government

				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}
			}
		}

		allow = {
		}

		effect = {
			culture = norwegian

			any_dynasty_member = {
				show_scope_change = no

				limit = {
					culture = norse
					employer = { character = ROOT }
				}

				culture = norwegian
			}
		}

		ai_will_do = {
			factor = 0.5

			trigger = {
				# Do not flip if we're in a huge Norse empire
				NAND = {
					top_liege = { culture = norse }

					OR = {
						top_liege = {
							real_tier = EMPEROR
						}

						AND = {
							c_uppland = {
								holder_scope = {
									same_realm = ROOT
								}
							}

							c_akershus = {
								holder_scope = {
									same_realm = ROOT
								}
							}

							c_sjaelland = {
								holder_scope = {
									same_realm = ROOT
								}
							}
						}
					}
				}
			}

			mult_modifier = {
				factor = 0.01

				capital_scope = {
					NOT = { culture = norwegian }
				}
			}

			mult_modifier = {
				factor = 2.0
				liege = { culture = norwegian }
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = norwegian
					value >= 2
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = norwegian
					value >= 4
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = norwegian
					value >= 6
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = norwegian
					value >= 8
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = norwegian
					value >= 10
				}
			}

		}
	}

	convert_to_danish = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			culture = norse

			capital_scope = {
				region = custom_danish
			}

			any_realm_province = {
				culture = danish
			}

			NOR = {
				government = chinese_imperial_government
				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}
			}
		}

		allow = {
		}

		effect = {
			culture = danish

			any_dynasty_member = {
				show_scope_change = no

				limit = {
					culture = norse
					employer = { character = ROOT }
				}

				culture = danish
			}
		}

		ai_will_do = {
			factor = 0.5

			trigger = {
				# Do not flip if we're in a huge Norse empire
				NAND = {
					top_liege = { culture = norse }

					OR = {
						top_liege = {
							real_tier = EMPEROR
						}

						AND = {
							c_uppland = {
								holder_scope = {
									same_realm = ROOT
								}
							}

							c_akershus = {
								holder_scope = {
									same_realm = ROOT
								}
							}

							c_sjaelland = {
								holder_scope = {
									same_realm = ROOT
								}
							}
						}
					}
				}
			}

			mult_modifier = {
				factor = 0.01

				capital_scope = {
					NOT = { culture = danish }
				}
			}

			mult_modifier = {
				factor = 2.0
				liege = { culture = danish }
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = danish
					value >= 2
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = danish
					value >= 4
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = danish
					value >= 6
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = danish
					value >= 8
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = danish
					value >= 10
				}
			}

		}
	}

	convert_to_norman = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			culture = norse

			capital_scope = {
				culture = norman
			}

			NOR = {
				government = chinese_imperial_government

				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}
			}
		}

		allow = {
		}

		effect = {
			culture = norman

			any_dynasty_member = {
				show_scope_change = no

				limit = {
					culture = norse
					employer = { character = ROOT }
				}

				culture = norman
			}
		}

		ai_will_do = {
			factor = 0.5

			trigger = {
				# Do not flip if we're in a huge Norse empire
				NAND = {
					top_liege = { culture = norse }

					OR = {
						top_liege = {
							real_tier = EMPEROR
						}

						AND = {
							c_uppland = {
								holder_scope = {
									same_realm = ROOT
								}
							}

							c_akershus = {
								holder_scope = {
									same_realm = ROOT
								}
							}

							c_sjaelland = {
								holder_scope = {
									same_realm = ROOT
								}
							}
						}
					}
				}
			}

			mult_modifier = {
				factor = 1.2
				liege = { culture = norman }
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = norman
					value >= 2
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = norman
					value >= 4
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = norman
					value >= 6
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = norman
					value >= 8
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = norman
					value >= 10
				}
			}
		}
	}

	convert_to_reformed = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			religion_group = pagan_group
			is_reformed_religion = no
			is_heretic = yes
			holy_order = no
		}

		allow = {
			NOT = { trait = zealous }
			piety >= 50
		}

		effect = {
			piety = -50
			tooltip = { abandon_heresy = yes }

			hidden_effect = {
				# Workaround for automatic usurption of theocratic characters
				set_character_flag = convert_abandon_heresy
				convert_religion_failsafe_effect = yes

				any_courtier = {
					limit = {
						is_heresy_of = ROOT
						employer = { character = ROOT }
					}

					religion = ROOT
				}

				any_vassal = {
					limit = {
						is_playable = no
						is_heresy_of = ROOT
					}

					religion = ROOT
				}

				capital_scope = {
					if = {
						limit = { is_heresy_of = ROOT }
						religion = ROOT
					}
				}
			}
		}

		ai_will_do = {
			factor = 0.1

			trigger = {
				trigger_if = {
					limit = { independent = no }

					NOT = {
						any_liege = {
							religion = ROOT
						}
					}
				}
			}

			mult_modifier = {
				factor = 0.5
				is_dumb_trigger = yes
			}

			mult_modifier = {
				factor = 0.1
				trait = imbecile
			}

			mult_modifier = {
				factor = 0.5
				trait = content
			}

			mult_modifier = {
				factor = 2.0
				OR = {
					trait = quick
					trait = shrewd
				}
			}

			mult_modifier = {
				factor = 4.0
				trait = genius
			}

			mult_modifier = {
				factor = 5.0
				trait = cynical # It's the future..
			}

			mult_modifier = {
				factor = 2.0
				trait = ambitious
			}

			mult_modifier = { # Easier for Proselytizers
				factor = 2.0
				parent_religion = { has_religion_feature = religion_proselytizing }
			}
		}
	}

	convert_to_hinduism = {
		icon_religion = hindu

		filter = self

		ai = no

		potential = {
			has_dharmic_religion_trigger = yes
			any_realm_province = { religion = hindu }
			is_adult = yes
			holy_order = no

			NOR = {
				has_alternate_start_parameter = {
					key = religion_names
					value = random
				}

				has_character_flag = india_converted # CleanSlate: This is also in allow. Put here to prevent UI clutter
				religion = hindu
			}
		}

		allow = {
			prestige >= 500
			NOT = { trait = zealous }

			custom_tooltip = {
				text = indian_has_not_converted

				NOT = { has_character_flag = india_converted }
			}
		}

		effect = {
			tooltip = {
				religion = hindu
			}

			if = {
				limit = { higher_real_tier_than = BARON }

				religion_authority = {
					name = ruler_converted_from
				}

				hindu = {
					show_scope_change = no

					religion_authority = {
						name = ruler_converted_to
					}
				}
			}

			set_character_flag = india_converted
			prestige = -500
			piety = 100

			hidden_effect = {
				religion = hindu
				character_event = { id = RoI.110 } # Choose branch
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

	convert_to_buddhism = {
		icon_religion = buddhist

		filter = self

		ai = no

		potential = {
			has_dharmic_religion_trigger = yes
			any_realm_province = { religion = buddhist }
			is_adult = yes
			holy_order = no

			NOR = {
				has_alternate_start_parameter = {
					key = religion_names
					value = random
				}

				has_character_flag = india_converted # CleanSlate: This is also in allow. Put here to prevent UI clutter
				religion = buddhist
			}
		}

		allow = {
			prestige >= 500
			NOT = { trait = zealous }

			custom_tooltip = {
				text = indian_has_not_converted

				NOT = { has_character_flag = india_converted }
			}
		}

		effect = {
			tooltip = {
				religion = buddhist
			}

			if = {
				limit = { higher_real_tier_than = BARON }

				religion_authority = {
					name = ruler_converted_from
				}

				buddhist = {
					show_scope_change = no

					religion_authority = {
						name = ruler_converted_to
					}
				}
			}

			set_character_flag = india_converted
			prestige = -500
			piety = 100

			hidden_effect = {
				religion = buddhist
				character_event = { id = RoI.111 } # Choose branch
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

	convert_to_jainism = {
		icon_religion = jain

		filter = self

		ai = no

		potential = {
			has_dharmic_religion_trigger = yes
			any_realm_province = { religion = jain }
			is_adult = yes
			holy_order = no

			NOR = {
				has_alternate_start_parameter = {
					key = religion_names
					value = random
				}

				has_character_flag = india_converted # CleanSlate: This is also in allow. Put here to prevent UI clutter
				religion = jain
			}
		}

		allow = {
			prestige >= 500
			NOT = { trait = zealous }

			custom_tooltip = {
				text = indian_has_not_converted

				NOT = { has_character_flag = india_converted }
			}
		}

		effect = {
			tooltip = {
				religion = jain
			}

			if = {
				limit = { higher_real_tier_than = BARON }

				religion_authority = {
					name = ruler_converted_from
				}

				jain = {
					show_scope_change = no

					religion_authority = {
						name = ruler_converted_to
					}
				}
			}

			set_character_flag = india_converted
			prestige = -500
			piety = 100

			hidden_effect = {
				religion = jain
				character_event = { id = RoI.112 } # Choose branch
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

	convert_indian_branch = {
		filter = self

		ai = no

		potential = {
			has_dharmic_religion_trigger = yes
			is_adult = yes
		}

		allow = {
			NOT = { trait = zealous }
			prestige >= 50

			custom_tooltip = {
				text = indian_has_not_converted

				NOT = { has_character_flag = india_branch_converted }
			}
		}

		effect = {
			set_character_flag = india_branch_converted
			prestige = -50
			piety = 25

			trigger_switch = {
				on_trigger = religion

				hindu = { character_event = { id = RoI.115 } }
				buddhist = { character_event = { id = RoI.116 } }
				jain = { character_event = { id = RoI.117 } }
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

	# Carolingian renaissance - Old Frankish conversion to French
	convert_to_french = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			culture = frankish

			capital_scope = {
				region = world_europe_west_francia
			}

			any_realm_province = {
				culture = french
			}

			NOR = {
				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}

				government = chinese_imperial_government
			}
		}

		allow = {
		}

		effect = {
			culture = french

			any_dynasty_member = {
				show_scope_change = no

				limit = {
					culture = frankish
					employer = { character = ROOT }
				}

				culture = french
			}
		}

		ai_will_do = {
			factor = 0.5

			mult_modifier = {
				factor = 0.01

				capital_scope = {
					NOT = { culture = french }
				}
			}

			mult_modifier = {
				factor = 2.0
				liege = { culture = french }
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = french
					value >= 2
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = french
					value >= 4
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = french
					value >= 6
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = french
					value >= 8
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = french
					value >= 10
				}
			}
		}
	}

	# Pictish character may convert to Scottish
	convert_to_scottish = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			culture = pictish

			capital_scope = {
				region = custom_scotland
			}

			any_realm_province = {
				culture = scottish
			}

			NOR = {
				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}

				government = chinese_imperial_government
			}
		}

		allow = {
		}

		effect = {
			culture = scottish

			any_dynasty_member = {
				show_scope_change = no

				limit = {
					culture = pictish
					employer = { character = ROOT }
				}

				culture = scottish
			}
		}

		ai_will_do = {
			factor = 0.5

			mult_modifier = {
				factor = 0.01

				capital_scope = {
					NOT = { culture = scottish }
				}
			}

			mult_modifier = {
				factor = 2.0
				liege = { culture = scottish }
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = scottish
					value >= 2
				}
			}

			mult_modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					culture = scottish
					value >= 4
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = scottish
					value >= 6
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = scottish
					value >= 8
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = scottish
					value >= 10
				}
			}
			
			### ACR ###
			mult_modifier = {
				factor = 0
				
				religion_openly_in_celtic_subgroup_trigger = yes
				NOT = {
					any_realm_province = {
						culture = scottish
						religion_openly_in_celtic_subgroup_trigger = yes
					}
				}
			}
		}
	}

	# Arabic and Visigothic characters may convert to Andalusian
	convert_to_andalusian = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			OR = {
				culture = visigothic
				culture_group = arabic
			}

			OR = {
				religion_group = muslim
				top_liege = { religion_group = muslim }
			}

			capital_scope = {
				region = custom_andalusian
			}

			any_realm_province = {
				culture = andalusian_arabic
			}

			NOR = {
				culture = andalusian_arabic
				government = chinese_imperial_government

				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}
			}
		}

		effect = {
			culture = andalusian_arabic

			any_dynasty_member = {
				show_scope_change = no

				limit = {
					culture = ROOT
					employer = { character = ROOT }
				}

				culture = andalusian_arabic
			}
		}

		ai_will_do = {
			factor = 0.5

			mult_modifier = {
				factor = 0.01

				capital_scope = {
					NOT = { culture = andalusian_arabic }
				}
			}

			mult_modifier = {
				factor = 2.0
				liege = { culture = andalusian_arabic }
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = andalusian_arabic
					value >= 2
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = andalusian_arabic
					value >= 4
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = andalusian_arabic
					value >= 6
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = andalusian_arabic
					value >= 8
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = andalusian_arabic
					value >= 10
				}
			}
		}
	}

	# Visigothic character may convert to Castilian
	convert_to_castilian = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			culture = visigothic
			religion_group = christian

			capital_scope = {
				region = custom_castillian
			}

			any_realm_province = {
				culture = castilian
			}

			NOR = {
				government = chinese_imperial_government

				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}
			}
		}

		allow = {
		}

		effect = {
			culture = castilian

			any_dynasty_member = {
				show_scope_change = no

				limit = {
					culture = ROOT
					employer = { character = ROOT }
				}

				culture = castilian
			}
		}

		ai_will_do = {
			factor = 0.5

			mult_modifier = {
				factor = 0.01

				capital_scope = {
					NOT = { culture = castilian }
				}
			}

			mult_modifier = {
				factor = 2.0
				liege = { culture = castilian }
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = castilian
					value >= 2
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = castilian
					value >= 4
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = castilian
					value >= 6
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = castilian
					value >= 8
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = castilian
					value >= 10
				}
			}
		}
	}

	# Visigothic character may convert to catalan
	convert_to_catalan = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			culture = visigothic
			religion_group = christian

			capital_scope = {
				region = custom_catalan
			}

			any_realm_province = {
				culture = catalan
			}

			NOR = {
				government = chinese_imperial_government

				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}
			}
		}

		allow = {
		}

		effect = {
			culture = catalan

			any_dynasty_member = {
				show_scope_change = no

				limit = {
					culture = ROOT
					employer = { character = ROOT }
				}

				culture = catalan
			}
		}

		ai_will_do = {
			factor = 0.5

			mult_modifier = {
				factor = 0.01

				capital_scope = {
					NOT = { culture = catalan }
				}
			}

			mult_modifier = {
				factor = 2.0
				liege = { culture = catalan }
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = catalan
					value >= 2
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = catalan
					value >= 4
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = catalan
					value >= 6
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = catalan
					value >= 8
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = catalan
					value >= 10
				}
			}
		}
	}

	# Suebi or Visigothic character may convert to Portuguese
	convert_to_portuguese = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			OR = {
				culture = suebi
				culture = visigothic
			}

			religion_group = christian

			capital_scope = {
				region = custom_portuguese
			}

			any_realm_province = {
				culture = portuguese
			}

			NOR = {
				government = chinese_imperial_government

				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}
			}
		}

		allow = {
		}

		effect = {
			culture = portuguese

			any_dynasty_member = {
				show_scope_change = no

				limit = {
					culture = ROOT
					employer = { character = ROOT }
				}

				culture = portuguese
			}
		}

		ai_will_do = {
			factor = 0.5

			mult_modifier = {
				factor = 0.01

				capital_scope = {
					NOT = { culture = portuguese }
				}
			}

			mult_modifier = {
				factor = 2.0
				liege = { culture = portuguese }
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = portuguese
					value >= 2
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = portuguese
					value >= 4
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = portuguese
					value >= 6
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = portuguese
					value >= 8
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = portuguese
					value >= 10
				}
			}
		}
	}

	# Old Frankish or Old Saxon character may convert to dutch
	convert_to_dutch = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			OR = {
				culture = frankish
				culture = saxon
				culture = frisian
			}

			capital_scope = {
				region = custom_frisia
			}

			any_realm_province = {
				culture = dutch
			}

			NOR = {
				government = chinese_imperial_government

				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}
			}
		}

		allow = {
		}

		effect = {
			culture = dutch

			any_dynasty_member = {
				show_scope_change = no

				limit = {
					culture = ROOT
					employer = { character = ROOT }
				}

				culture = dutch
			}
		}

		ai_will_do = {
			factor = 0.5

			mult_modifier = {
				factor = 0.01

				capital_scope = {
					NOT = { culture = dutch }
				}
			}

			mult_modifier = {
				factor = 2.0
				liege = { culture = dutch }
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = dutch
					value >= 2
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = dutch
					value >= 4
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = dutch
					value >= 6
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = dutch
					value >= 8
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = dutch
					value >= 10
				}
			}
		}
	}

	# Lombard character may convert to italian
	convert_to_italian = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			culture = lombard

			capital_scope = {
				region = world_europe_south_italy
			}

			any_realm_province = {
				culture = italian
			}

			trigger_if = {
				limit = { year < 786 }

				top_liege = {
					NOT = { culture = lombard }
				}
			}

			NOR = {
				government = chinese_imperial_government

				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}
			}
		}

		allow = {
			culture = lombard

			capital_scope = {
				region = world_europe_south_italy
			}

			any_realm_province = {
				culture = italian
			}
		}

		effect = {
			culture = italian

			any_dynasty_member = {
				show_scope_change = no

				limit = {
					culture = ROOT
					employer = { character = ROOT }
				}

				culture = italian
			}
		}

		ai_will_do = {
			factor = 0.5

			trigger = {
				independent = no
				top_liege = {
					NOT = { culture = lombard }
				}
			}

			mult_modifier = {
				factor = 0.01

				capital_scope = {
					NOT = { culture = italian }
				}
			}

			mult_modifier = {
				factor = 2.0
				liege = { culture = italian }
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = italian
					value >= 2
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = italian
					value >= 4
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = italian
					value >= 6
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = italian
					value >= 8
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = italian
					value >= 10
				}
			}
		}
	}

	# Visigothic character may convert to occitan
	convert_to_occitan = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			culture = visigothic
			religion_group = christian

			capital_scope = {
				region = world_europe_west_francia
			}

			any_realm_province = {
				culture = occitan
			}

			NOR = {
				government = chinese_imperial_government

				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}
			}
		}

		allow = {
		}

		effect = {
			culture = occitan

			any_dynasty_member = {
				show_scope_change = no

				limit = {
					culture = ROOT
					employer = { character = ROOT }
				}

				culture = occitan
			}
		}

		ai_will_do = {
			factor = 0.5

			mult_modifier = {
				factor = 0.01

				capital_scope = {
					NOT = { culture = occitan }
				}
			}

			mult_modifier = {
				factor = 2.0
				liege = { culture = occitan }
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = occitan
					value >= 2
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = occitan
					value >= 4
				}
			}

			mult_modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					culture = occitan
					value >= 6
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = occitan
					value >= 8
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = occitan
					value >= 10
				}
			}
		}
	}

	# East Slavic character may convert to Russian
	convert_to_russian = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			culture_group = east_slavic

			any_realm_province = {
				culture = russian
			}

			NOR = {
				culture = russian
				government = chinese_imperial_government

				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}
			}
		}

		allow = {
		}

		effect = {
			culture = russian

			any_dynasty_member = {
				show_scope_change = no

				limit = {
					culture_group = east_slavic
					employer = { character = ROOT }
				}

				culture = russian
			}
		}

		ai_will_do = {
			factor = 0.5

			mult_modifier = {
				factor = 0.01

				capital_scope = {
					NOT = { culture = russian }
				}
			}

			mult_modifier = {
				factor = 2.0
				liege = { culture = russian }
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = russian
					value >= 2
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = russian
					value >= 4
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = russian
					value >= 6
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = russian
					value >= 8
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = russian
					value >= 10
				}
			}
		}
	}

	# Latin character may convert to Outremer
	convert_to_outremer = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 60

		only_playable = yes

		potential = {
			has_global_flag = christian_crusades_unlocked

			capital_scope = {
				OR = {
					region = world_africa
					region = world_middle_east
					region = world_persia
				}
			}

			trigger_if = {
				limit = { culture_group = arabic }

				religion_group = christian

				liege = {
					culture_group = latin
					religion_group = christian
				}

				OR = {
					any_realm_province = { culture = outremer}
					top_liege = { culture = outremer }
					liege = { culture = outremer }
				}
			}
			trigger_else_if = {
				limit = { culture_group = latin }

				OR = {
					religion_group = christian
					top_liege = { religion_group = christian }
				}

				any_realm_province = {
					OR = {
						culture_group = arabic
						culture = outremer
					}
				}
			}

			NOR = {
				culture = roman
				culture = outremer
				government = chinese_imperial_government

				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}
			}
		}

		allow = {
			trigger_if = {
				limit = { ai = yes }

				top_liege = { culture = outremer }
			}

			OR = {
				prestige >= 10000
				has_landed_title = e_outremer

				top_liege = {
					OR = {
						has_landed_title = e_outremer
						culture = outremer
					}
				}
			}
		}

		effect = {
			culture = outremer

			capital_scope = {
				show_scope_change = no

				if = {
					limit = { culture_group = arabic }

					custom_tooltip = {
						text = tooltip_capital_embrace_outremer

						culture = outremer
					}
				}
			}

			custom_tooltip = {
				text = tooltip_courtiers_embrace_outremer

				any_dynasty_member = {
					limit = {
						culture = ROOT
						employer = { character = ROOT }
					}

					culture = outremer
				}
			}

			custom_tooltip = {
				text = tooltip_provinces_embrace_outremer

				any_demesne_province = {
					limit = { culture_group = ROOT }
					culture = outremer
				}
			}
		}

		ai_will_do = {
			factor = 1

			trigger = {
				# Small Crusader States will balkanize with their own culture or go native
				top_liege = {
					higher_real_tier_than = DUKE
				}
			}

			mult_modifier = {
				factor = 30

				top_liege = {
					culture = outremer
					has_landed_title = e_outremer
				}
			}

			mult_modifier = {
				factor = 1.5

				capital_scope = {
					region = world_middle_east_jerusalem
				}
			}

			mult_modifier = {
				factor = 2.0
				liege = { culture = outremer }
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = outremer
					value >= 2
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = outremer
					value >= 4
				}
			}

			mult_modifier = {
				factor = 1.1

				num_culture_realm_provs = {
					culture = outremer
					value >= 6
				}
			}

			mult_modifier = {
				factor = 1.25

				num_culture_realm_provs = {
					culture = outremer
					value >= 8
				}
			}

			mult_modifier = {
				factor = 1.5

				num_culture_realm_provs = {
					culture = outremer
					value >= 10
				}
			}
		}
	}

	convert_to_spouse_religion = {
		filter = spouse

		ai = no

		from_potential = {
			controls_religion = no
			religion_group = pagan_group
			### ACR ###
			is_unreformed_pagan_trigger = yes
		}

		potential = {
			OR = {
				is_married = FROM
				is_consort = FROM
			}

			### ACR ###
			is_not_unreformed_pagan_trigger = yes
		}

		allow = {
			FROM = { NOT = { trait = zealous } }
			has_safe_religion = yes
		}

		effect = {
			FROM = {
				show_scope_change = no

				tooltip = {
					religion = ROOT
				}

				prestige = -500
				piety = 200

				religion_authority = {
					name = ruler_converted_from
				}

				ROOT = {
					show_scope_change = no

					religion_authority = {
						name = ruler_converted_to
					}
				}

				random = {
					chance = 50

					mult_modifier = {
						factor = 1.2 # Cynics more likely to gain sympathy
						trait = cynical
					}

					add_trait = sympathy_pagans
				}

				hidden_effect = {
					religion = ROOT
				}

				ROOT = {
					show_scope_change = no

					# When spouse has a religious branch
					trigger_switch = {
						on_trigger = trait

						# Hindu
						shaivist_hindu     = { FROM = { show_scope_change = no add_trait = shaivist_hindu } }
						vaishnavist_hindu  = { FROM = { show_scope_change = no add_trait = vaishnavist_hindu } }
						shaktist_hindu     = { FROM = { show_scope_change = no add_trait = shaktist_hindu } }
						smartist_hindu     = { FROM = { show_scope_change = no add_trait = smartist_hindu } }
						# Buddhist
						mahayana_buddhist  = { FROM = { show_scope_change = no add_trait = mahayana_buddhist } }
						vajrayana_buddhist = { FROM = { show_scope_change = no add_trait = vajrayana_buddhist } }
						theravada_buddhist = { FROM = { show_scope_change = no add_trait = theravada_buddhist } }
						# Jain
						digambara_jain     = { FROM = { show_scope_change = no add_trait = digambara_jain } }
						svetambara_jain    = { FROM = { show_scope_change = no add_trait = svetambara_jain } }
						# Pagan
						pagan_branch_1     = { FROM = { show_scope_change = no add_trait = pagan_branch_1 } }
						pagan_branch_2     = { FROM = { show_scope_change = no add_trait = pagan_branch_2 } }
						pagan_branch_3     = { FROM = { show_scope_change = no add_trait = pagan_branch_3 } }
						pagan_branch_4     = { FROM = { show_scope_change = no add_trait = pagan_branch_4 } }
						### ACR ###
						pagan_branch_5_animist		= { FROM = { show_scope_change = no  add_trait = pagan_branch_5_animist } }
						pagan_branch_6_theist		= { FROM = { show_scope_change = no  add_trait = pagan_branch_6_theist } }
						pagan_branch_7_intellect	= { FROM = { show_scope_change = no  add_trait = pagan_branch_7_intellect } }
						pagan_branch_8_might		= { FROM = { show_scope_change = no  add_trait = pagan_branch_8_might } }
						pagan_branch_9_egoist		= { FROM = { show_scope_change = no  add_trait = pagan_branch_9_egoist  } }
						pagan_branch_10_altruist	= { FROM = { show_scope_change = no  add_trait = pagan_branch_10_altruist } }
					}
				}
			}
		}

		ai_will_do = {
			factor = 0
		}
	}
}

decisions = {

	# Weak or unreformed religions are allowed to convert to the attacker's religion when under Holy War
	convert_to_attacker_religion = {
		ai_check_interval = 18

		is_high_prio = yes

		only_playable = yes

		potential = {
			controls_religion = no
			NOT = { has_character_modifier = baptism_request_cooldown }

			trigger_if = {
				limit = { is_unreformed_pagan_trigger = yes }
				NOT = { religion_authority >= 0.4 }
			}
			trigger_else = {
				OR = {
					is_nomadic = yes
					NOT = { religion_authority >= 0.3 }
				}
			}

			war = yes

			any_war = {
				defender = { character = ROOT }

				attacker = {
					NOT = { religion = ROOT }
					religion_authority >= 0.5
					is_not_unreformed_pagan_trigger = yes
				}

				OR = {
					using_cb = crusade
					using_cb = new_crusade
					using_cb = religious
					using_cb = muslim_invasion
					using_cb = buddhist_holy_war
					using_cb = pagan_holy_war
				}

				trigger_if = {
					limit = { ROOT = { ai = yes } }

					war_score >= 50

					thirdparty_title_scope = {
						ROOT = {
							primary_title = {
								title = PREVPREV
							}
						}
					}
				}
			}
		}

		allow = {
			NOT = { trait = zealous }
		}

		effect = {
			hidden_effect = {
				any_war = {
					limit = {
						defender = { character = ROOT }

						attacker = {
							NOT = { religion = ROOT }
							religion_authority >= 0.50
							is_not_unreformed_pagan_trigger = yes
						}

						OR = {
							using_cb = crusade
							using_cb = new_crusade
							using_cb = religious
							using_cb = muslim_invasion
							using_cb = buddhist_holy_war
							using_cb = pagan_holy_war
						}

						trigger_if = {
							limit = { ROOT = { ai = yes } }

							war_score >= 50

							thirdparty_title_scope = {
								ROOT = {
									primary_title = {
										title = PREVPREV
									}
								}
							}
						}
					}

					attacker = {
						save_event_target_as = enemy_attacker
					}
				}
			}

			tooltip = {
				religion = event_target:enemy_attacker
			}

			religion_authority = {
				name = ruler_converted_from
			}

			event_target:enemy_attacker = {
				show_scope_change = no

				religion_authority = {
					name = ruler_converted_to
				}
			}

			prestige = -500
			piety = 100

			# If possible, perform mass baptism
			if = {
				limit = {
					has_dlc = "Holy Fury"
					religion_group = pagan_group
					### ACR ###
					is_unreformed_pagan_trigger = yes
					independent = yes
					is_incapable = no
					has_regent = no
					prisoner = no
					is_tribal = yes
					higher_real_tier_than = COUNT
					holy_order = no
					NOT = { has_character_flag = flag_converting_baptism }

					OR = {
						has_law = tribal_organization_2
						has_law = tribal_organization_3
						has_law = tribal_organization_4
					}

					any_war = {
						using_cb = new_crusade

						defender = { character = ROOT }

						attacker = { # Special case
							religion = catholic
							NOT = { has_character_flag = flag_sponsoring_baptism }
						}
					}
				}

				hidden_effect = {
					save_event_target_as = converting_king

					add_character_modifier = {
						name = baptism_request_cooldown
						months = 1
						hidden = yes
					}

					event_target:enemy_attacker = {
						add_character_modifier = {
							name = baptism_request_cooldown
							months = 1
							hidden = yes
						}
					}

					opinion = {
						name = opinion_baptism_sponsor_target
						who = event_target:enemy_attacker
						years = 20
						origin_description = EVTTOOLTIPHFA20005
					}

					event_target:enemy_attacker = {
						opinion = {
							name = opinion_baptism_sponsor_target
							who = ROOT
							years = 20
							origin_description = EVTTOOLTIPHFB20005
						}

						letter_event = {
							id = HF.20000
							tooltip = tooltip_mass_convert_during_crusade
						}
					}
				}
			}

			else = {
				if = {
					limit = {
						NOT = { religion_group = event_target:enemy_attacker }
					}

					trigger_switch = {
						on_trigger = religion_group

						pagan_group       = { add_trait = sympathy_pagans }
						zoroastrian_group = { add_trait = sympathy_zoroastrianism }
						christian         = { add_trait = sympathy_christendom }
						muslim            = { add_trait = sympathy_islam }
						jewish_group      = { add_trait = sympathy_judaism }
						indian_group      = { add_trait = sympathy_indian }
					}
				}

				hidden_effect = {
					religion = event_target:enemy_attacker

					event_target:enemy_attacker = {
						letter_event = { id = 62800 } # Notification

						ROOT = {
							any_courtier = {
								limit = {
									religion = ROOT
									employer = { character = ROOT }
								}

								religion = event_target:enemy_attacker
							}

							any_vassal = {
								limit = {
									is_playable = no
									religion = ROOT
								}

								religion = event_target:enemy_attacker
							}

							capital_scope = {
								if = {
									limit = { religion = ROOT }
									religion = event_target:enemy_attacker
								}
							}
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 0.5

			mult_modifier = {
				factor = 0.05
				is_hard_to_convert = yes
			}

			mult_modifier = {
				factor = 2

				any_war = {
					defender = { character = ROOT }

					attacker = {
						NOT = { religion = ROOT }
						religion_authority = 0.50
						is_not_unreformed_pagan_trigger = yes
					}

					OR = {
						using_cb = crusade
						using_cb = new_crusade
						using_cb = religious
						using_cb = muslim_invasion
						using_cb = buddhist_holy_war
						using_cb = pagan_holy_war
					}

					war_score >= 75
				}
			}

		}

	}

	# Byzantine Emperor may renounce Iconoclasm
	renounce_iconoclasm = {
		icon_religion = orthodox

		ai_check_interval = 60

		only_playable = yes

		potential = {
			has_landed_title = e_byzantium
			has_dlc = "Charlemagne"
			year < 900
			religion = iconoclast
			any_realm_province = { religion = orthodox }

			NOR = {
				has_character_flag = renounced_iconoclasm

				has_alternate_start_parameter = {
					key = religion_names
					value = random
				}
			}
		}

		allow = {
			has_landed_title = c_constantinopolis
			NOT = { trait = zealous }
			war = no
		}

		effect = {
			set_character_flag = renounced_iconoclasm

			tooltip = {
				religion = orthodox
			}

			religion_authority = {
				name = ruler_converted_from
			}

			orthodox = {
				show_scope_change = no

				religion_authority = {
					name = ruler_converted_to
				}
			}

			hidden_effect = {
				religion = orthodox
			}

			custom_tooltip = {
				text = renounce_iconoclasm_muslim_opinion_tooltip

				hidden_effect = {
					generate_tooltip = no

					any_independent_ruler = {
						any_realm_lord = {
							limit = { religion_group = muslim }

							opinion = {
								name = opinion_idolater
								who = ROOT
								years = 10
							}
						}
					}
				}
			}

			custom_tooltip = {
				text = renounce_iconoclasm_province_tooltip

				any_realm_province = {
					if = {
						limit = { religion = orthodox }

						add_province_modifier = {
							name = appeased_religious
							years = 5
						}
					}
				}
			}

			k_papacy = {
				show_scope_change = no

				holder_scope = {
					show_scope_change = no

					opinion = {
						name = opinion_renounced_iconoclasm
						who = ROOT
						years = 10
					}
				}
			}

			hidden_effect = {
				any_character = {
					limit = {
						religion = iconoclast
						can_change_religion = yes
					}

					character_event = { id = CM.4200 } # Chance to convert
				}
			}

			hidden_effect = {
				d_iconoclast = {
					show_scope_change = no

					holder_scope = {
						show_scope_change = no

						# Workaround for automatic usurption of theocratic characters

						set_character_flag = needs_temporary_fake_theocracy_government
						set_government_type = temporary_fake_theocracy_government
						unsafe_religion = orthodox
						set_government_type = theocracy_government
						clr_character_flag = needs_temporary_fake_theocracy_government

						activate_title = {
							title = k_orthodox
							status = yes
						}

						grant_title = k_orthodox
						set_defacto_liege = ROOT
						unsafe_destroy_landed_title = d_iconoclast

						activate_title = {
							title = d_iconoclast
							status = no
						}

						set_name = "" # Name changes upon becoming a religious head
					}
				}
			}
			
			### CIM ###
			if = {
				limit = { has_global_flag = is_kcl_CIML_save }
				any_playable_ruler = {
					narrative_event = { id = CIML.900 days = 4 }
				}
				narrative_event = { id = CIML.900 days = 4 }
			}
		}

		ai_will_do = {
			factor = 0.5

			mult_modifier = {
				factor = 3
				trait = cynical
			}
		}
	}

	# Roman Emperor may restore Roman Culture
	roman_renaissance = {
		ai_check_interval = 120

		is_high_prio = yes

		only_playable = yes

		potential = {
			has_dlc = "Holy Fury"
			has_landed_title = e_roman_empire

			OR = {
				# CleanSlate: Note: Vanilla restricts this to specifically Greek and Italian, I consider this an oversight considering the effect below and the decision directly following
				culture_group = latin
				culture_group = byzantine
			}

			OR = {
				religion_group = christian
				### ACR ###
				trigger_if = {
					limit = { has_global_flag = ancrel }
					religion_openly_in_hellenic_subgroup_trigger = yes
				}
				trigger_else = { religion_openly_hellenic_or_reformed_trigger = yes }
			}

			NOR = {
				government = chinese_imperial_government
				has_global_flag = flag_started_roman_renaissance

				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}
			}
		}

		allow = {
			capital_scope = { province = c_roma }
			ruled_years >= 10
			war = no
		}

		effect = {
			set_global_flag = flag_started_roman_renaissance
			culture = roman

			capital_scope = {
				show_scope_change = no

				culture = roman
			}

			custom_tooltip = {
				text = tooltip_roman_culture_starts_spreading

				# Spreads Roman Culture
				any_courtier_or_vassal = {
					limit = { lower_real_tier_than = COUNT }
					culture = roman
				}

				any_realm_province = {
					limit = {
						distance = {
							where = c_roma
							value <= 400
						}

						OR = {
							# CleanSlate: Note: Vanilla restricts this to Latin but the inclusion of Greek in the potential implies it was intended for both Latin and Byzantine.
							culture_group = latin
							culture_group = byzantine
						}
					}

					random = {
						chance = 5

						mult_modifier = {
							factor = 4 # 20%

							distance = {
								where = c_roma
								value < 200
							}
						}

						mult_modifier = {
							factor = 2 # 40%

							distance = {
								where = c_roma
								value < 100
							}
						}

						mult_modifier = {
							factor = 2.5 # 100%
							any_neighbor_province = { province = c_roma }
						}

						culture = roman
					}
				}

				# Spreads Roman Religion
				if = { # Hellenic Emperor gets chance to spread Hellenism a bit alongside the culture.
					limit = {
						trigger_if = {		### ACR ###
							limit = { has_global_flag = ancrel }
							religion_openly_in_hellenic_subgroup_trigger = yes
						}
						trigger_else = { religion_openly_hellenic_or_reformed_trigger = yes }
					}

					any_realm_province = {
						limit = {
							distance = {
								where = c_roma
								value < 200
							}
						}

						random = {
							chance = 5

							mult_modifier = {
								factor = 2 # 10%

								distance = {
									where = c_roma
									value < 100
								}
							}

							mult_modifier = {
								factor = 10 # 100%

								OR = {
									any_neighbor_province = { province = c_roma }
									province = c_roma
								}
							}

							religion = ROOT
						}
					}
				}

				# Special event if there are still enough christian provinces around (which is very likely)
				if = {
					limit = {
						any_realm_province = {
							religion_group = christian
							count >= 10
						}
					}

					character_event = {
						id = HF.23119 # Roman Renaissance: Christian moralizers.
						days = 150
						random = 50
					}
				}

			}

		}

		ai_will_do = {
			factor = 1

			modifier = {
				factor = 3
				religion = hellenic_pagan_reformed
			}

			modifier = {
				factor = 0.01 # Would consider it a step down
				culture = greek
			}

		}

	}

	embrace_roman_culture = {
		ai_check_interval = 120

		only_playable = yes

		potential = {
			has_dlc = "Holy Fury"
			top_liege = { has_landed_title = e_roman_empire }
			has_global_flag = flag_started_roman_renaissance

			OR = {
				culture_group = latin
				culture_group = byzantine
			}

			NOR = {
				culture = roman
				government = chinese_imperial_government

				has_alternate_start_parameter = {
					key = culture_names
					value = random
				}
			}
		}

		allow = {
		}

		effect = {
			culture = roman
			capital_scope = { culture = roman }

			custom_tooltip = {
				text = tooltip_roman_culture_spreads

				# Spreads Roman Culture
				any_courtier_or_vassal = {
					limit = { lower_real_tier_than = COUNT }
					culture = roman
				}

				any_demesne_province = {
					limit = {
						distance = {
							where = c_roma
							value <= 400
						}

						OR = {
							culture_group = latin
							culture_group = byzantine
						}
					}

					random = {
						chance = 5

						mult_modifier = {
							factor = 4 # 20%

							distance = {
								where = c_roma
								value < 200
							}
						}

						mult_modifier = {
							factor = 2 # 40%

							distance = {
								where = c_roma
								value < 100
							}
						}

						mult_modifier = {
							factor = 2.5 # 100%
							any_neighbor_province = { province = c_roma }
						}

						culture = roman
					}
				}

				# Spreads Roman Religion
				if = {
					limit = {
						trigger_if = {		### ACR ###
							limit = { has_global_flag = ancrel }
							religion_openly_in_hellenic_subgroup_trigger = yes
						}
						trigger_else = { religion_openly_hellenic_or_reformed_trigger = yes }
					}

					any_demesne_province = {
						limit = {
							distance = {
								where = c_roma
								value < 200
							}
						}

						random = {
							chance = 5

							mult_modifier = {
								factor = 2 # 10%

								distance = {
									where = c_roma
									value < 100
								}
							}

							mult_modifier = {
								factor = 10 # 100%

								OR = {
									any_neighbor_province = { province = c_roma }
									province = c_roma
								}
							}

							religion = ROOT
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 1

			mult_modifier = {
				factor = 3
				religion = hellenic_pagan_reformed
			}

			mult_modifier = {
				factor = 3
				capital_scope = { culture = roman }
			}

			mult_modifier = {
				factor = 0.01 # Would consider it a step down
				culture = greek
			}
		}
	}
}