targeted_decisions = {

	convert_to_liege_religion = {
		filter = self

		ai = no

		potential = {
			independent = no
			religion_group = liege
			controls_religion = no
			holy_order = no

			NOR = {
				religion = liege
				rightful_religious_head = ROOT
				has_character_flag = converted_religion
			}
		}

		allow = {
			NOT = { trait = zealous }

			trigger_if = {
				limit = { is_nomadic = no }

				liege = {
					show_scope_change = no

					has_safe_religion = yes
				}
			}
		}

		effect = {
			tooltip = {
				religion = liege
			}

			set_character_flag = converted_religion
			piety = -100

			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 } }
				}
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

	convert_to_liege_religion_on_liege = {
		filter = liege

		ai = no

		from_potential = {
			controls_religion = no
			holy_order = no
			NOT = { rightful_religious_head = THIS }
		}

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

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

		effect = {
			FROM = {
				show_scope_change = no

				tooltip = {
					religion = ROOT
				}

				set_character_flag = converted_religion
				piety = -100

				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 } }
				}
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

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

		ai = no

		from_potential = {
			NOT = { has_character_flag = converted_culture }
		}

		potential = {
			NOT = { culture = FROM }
		}

		allow = {
			FROM = {
				show_scope_change = no

				prestige >= 100
			}
		}

		effect = {
			FROM = {
				show_scope_change = no

				prestige = -100
				culture = liege
				set_character_flag = converted_culture

				liege = {
					save_event_target_as = liege_culture
				}

				any_courtier = {
					show_scope_change = no

					limit = {
						dynasty = ROOT
						is_adult = no
						is_ruler = no
					}

					culture = event_target:liege_culture
				}

				clear_event_target = liege_culture
			}
		}

		ai_will_do = {
			factor = 0
		}

	}

	convert_to_liege_culture = {
		filter = self

		ai = no

		potential = {
			independent = no
			is_nomadic = no
			mercenary = no

			NOR = {
				culture = liege
				has_character_flag = converted_culture
			}
		}

		allow = {
			prestige >= 100
		}

		effect = {
			prestige = -100
			culture = liege
			set_character_flag = converted_culture

			liege = {
				save_event_target_as = liege_culture
			}

			any_courtier = {
				show_scope_change = no

				limit = {
					dynasty = ROOT
					is_adult = no
					is_ruler = no
				}

				culture = event_target:liege_culture
			}

			clear_event_target = liege_culture
		}

		ai_will_do = {
			factor = 0
		}
	}

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

		ai = no

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

			NOR = {
				culture = capital_scope
				government = chinese_imperial_government
				has_character_flag = converted_culture


				# Convert to liege culture instead
				is_targeted_decision_potential = {
					key = convert_to_liege_culture
					character = ROOT
				}
			}

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

			trigger_if = {
				limit = { culture = norse }

				capital_scope = {
					NOR = {
						culture = swedish
						culture = norwegian
						culture = danish
						culture = icelandic
						culture = norman
					}
				}
			}
		}

		allow = {
			prestige >= 100
		}

		effect = {
			prestige = -100
			culture = capital_scope
			set_character_flag = converted_culture

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

					culture = ROOT
				}
			}
		}

		ai_will_do = {
			factor = 0

			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"
			religion_group = capital_scope
			is_nomadic = no
			controls_religion = no
			holy_order = no
			mercenary = no

			NOR = {
				religion = capital_scope
				rightful_religious_head = ROOT
				has_character_flag = converted_religion

				# Convert to liege religion instead
				is_targeted_decision_potential = {
					key = convert_to_liege_religion
					character = ROOT
				}

				# May instead renounce Iconoclasm
				is_decision_potential = renounce_iconoclasm
			}

			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 }
		#	}
		}

		allow = {
			NOT = { trait = zealous }

			capital_scope = {
				show_scope_change = no

				has_safe_religion = yes
			}
		}

		effect = {
			piety = -100
			set_character_flag = converted_religion

			tooltip = {
				religion = capital_scope
			}

			add_character_modifier = {
				name = recently_converted
				years = 2
			}

			if = {
				limit = {
					NOR = {
						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 }

			if = {
				limit = { higher_real_tier_than = BARON }

				religion_authority = {
					name = ruler_converted_from
				}

				capital_scope = {
					show_scope_change = no

					religion_authority = {
						name = ruler_converted_to
					}
				}
			}

			hidden_effect = {
				religion = capital_scope

				any_courtier = {
					limit = {
						dynasty = ROOT
						is_adult = no
						is_ruler = no
					}

					religion = ROOT
				}
			}
		}

		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

			NOT = {
				rightful_religious_head = THIS

				# May instead renounce Iconoclasm
				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
			}

			piety = -100
			set_character_flag = converted_religion

			add_character_modifier = {
				name = recently_converted
				years = 2
			}

			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
				held_under_PREV = yes
			}

			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
				held_under_PREV = yes
			}

			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
				held_under_PREV = yes
			}

			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

			any_demesne_province = {
				culture = norman
				owned_by = PREV
			}

			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
			}

			add_character_modifier = {
				name = recently_converted
				years = 2
			}

			hidden_effect = {
				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 = {
			always = no # Disabled in CK2Plus
			has_dharmic_religion_trigger = yes
			is_adult = yes
			holy_order = no

			any_realm_province = {
				religion = hindu
				held_under_PREV = yes
			}

			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 = {
			always = no # Disabled in CK2Plus
			has_dharmic_religion_trigger = yes
			is_adult = yes
			holy_order = no

			any_realm_province = {
				religion = buddhist
				held_under_PREV = yes
			}

			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 = {
			always = no # Disabled in CK2Plus
			has_dharmic_religion_trigger = yes
			is_adult = yes
			holy_order = no

			any_realm_province = {
				religion = jain
				held_under_PREV = yes
			}

			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
			holy_order = no
		}

		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 = custom_france
			}

			any_realm_province = {
				culture = french
				held_under_PREV = yes
			}

			top_liege = {
				german_cultures_trigger = no
			}

			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

			trigger = {
				year >= 800
			}

			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
				}
			}

			# CK2Plus
			mult_modifier = {
				factor = 2
				year >= 850
			}
		}
	}

	# 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
				held_under_PREV = yes
			}

			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
				}
			}
		}
	}

	# 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
				held_under_PREV = yes
			}

			NOR = {
				culture = andalusian_arabic
				government = chinese_imperial_government

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

		allow = {
		}

		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
				held_under_PREV = yes
			}

			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
				held_under_PREV = yes
			}

			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
				held_under_PREV = yes
			}

			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
				held_under_PREV = yes
			}

			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 = longobard

			capital_scope = {
				region = world_europe_south_italy
			}

			any_realm_province = {
				is_italian_trigger = yes
				held_under_PREV = yes
			}

			trigger_if = {
				limit = { year < 786 }

				top_liege = {
					NOT = { culture = longobard }
				}
			}

			NOR = {
				government = chinese_imperial_government

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

		allow = {
			culture = longobard

			capital_scope = {
				region = world_europe_south_italy
			}

			any_realm_province = {
				is_italian_trigger = yes
				held_under_PREV = yes

				OR = {
					region = custom_emilian_cultural_area
					region = custom_veneto_cultural_area
					region = custom_ligurian_cultural_area
					region = custom_lombard_cultural_area
					region = custom_umbrian_cultural_area
					region = custom_neapolitan_cultural_area
					region = custom_tuscan_cultural_area
				}
			}
		}

		effect = {
			hidden_effect = {
				location = {
					show_scope_change = no

					trigger_switch = {
						on_trigger = region

						custom_emilian_cultural_area = { emilian = { save_event_target_as = italian_culture } }
						custom_veneto_cultural_area = { veneto = { save_event_target_as = italian_culture } }
						custom_ligurian_cultural_area = { ligurian = { save_event_target_as = italian_culture } }
						custom_lombard_cultural_area = { lombard = { save_event_target_as = italian_culture } }
						custom_umbrian_cultural_area = { umbrian = { save_event_target_as = italian_culture } }
						custom_neapolitan_cultural_area = { neapolitan = { save_event_target_as = italian_culture } }
						custom_tuscan_cultural_area = { tuscan = { save_event_target_as = italian_culture } }
					}
				}
			}

			culture = event_target:italian_culture

			any_dynasty_member = {
				show_scope_change = no

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

				culture = event_target:italian_culture
			}
		}

		ai_will_do = {
			factor = 0.5

			trigger = {
				independent = no

				top_liege = {
					NOT = { culture = longobard }
				}
			}

			mult_modifier = {
				factor = 0.01

				capital_scope = {
					is_italian_trigger = no
				}
			}

			mult_modifier = {
				factor = 2.0
				liege = { is_italian_trigger = yes }
			}

			mult_modifier = {
				factor = 1.1

				any_realm_province = {
					count = 2
					is_italian_trigger = yes
					held_under_PREV = yes
				}
			}

			mult_modifier = {
				factor = 1.1

				any_realm_province = {
					count = 4
					is_italian_trigger = yes
					held_under_PREV = yes
				}
			}

			mult_modifier = {
				factor = 1.1

				any_realm_province = {
					count = 6
					is_italian_trigger = yes
					held_under_PREV = yes
				}
			}

			mult_modifier = {
				factor = 1.1

				any_realm_province = {
					count = 8
					is_italian_trigger = yes
					held_under_PREV = yes
				}
			}

			mult_modifier = {
				factor = 1.1

				any_realm_province = {
					count = 10
					is_italian_trigger = yes
					held_under_PREV = yes
				}
			}
		}
	}

	# 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
				held_under_PREV = yes
			}

			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
				held_under_PREV = yes
			}

			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
						held_under_PREV = yes
					}

					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 = {
					held_under_PREV = yes

					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
						owned_by = PREV
					}

					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
			is_reformed_religion = no
		}

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

			trigger_if = {
				limit = { religion_group = pagan_group }
				is_reformed_religion = 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 } }
					}
				}
			}
		}

		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

			NOR = {
				has_character_modifier = baptism_request_cooldown
				rightful_religious_head = THIS
			}

			trigger_if = {
				limit = { is_unreformed_pagan_trigger = yes }
				NOT = { religion_authority >= 0.4 }
			}
			trigger_else = {
				OR = {
					religion_group = zoroastrian_group
					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 = 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 = 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

			add_character_modifier = {
				name = recently_converted
				years = 2
			}

			# If possible, perform mass baptism
			if = {
				limit = {
					has_dlc = "Holy Fury"
					religion_group = pagan_group
					is_reformed_religion = no
					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.1

			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 = holy_war
					}

					war_score >= 75
				}
			}

			# CK2Plus
			mult_modifier = {
				factor = 100

				any_war = {
					defender = { character = ROOT }

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

						ROOT = {
							secret_religion = {
								target = PREV
								target_type = true
							}
						}
					}

					OR = {
						using_cb = crusade
						using_cb = new_crusade
						using_cb = holy_war
					}
				}
			}
		}
	}

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

		ai_check_interval = 60

		only_playable = yes

		potential = {
			has_landed_title = e_byzantium
			has_dlc = "Charlemagne"
			year < 900

			trigger_if = {
				limit = { religion = chalcedonian }

				k_orthodox = {
					holder_scope = {
						is_vassal_or_below_of = ROOT
						religion = chalcedonian
						trait = iconoclast_rites
					}
				}

				NOT = { has_global_flag = great_schism_happened }
			}
			trigger_else = {
				religion = iconoclast

				any_realm_province = {
					religion = orthodox
					held_under_PREV = yes
				}

				d_iconoclast = {
					holder_scope = {
						is_vassal_or_below_of = ROOT
						religion = iconoclast
					}
				}
			}

			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

			if = {
				limit = { religion = chalcedonian }

				remove_trait = iconoclast_rites
				add_trait = greek_rites
			}
			else = {
				tooltip = {
					religion = orthodox
				}

				religion_authority = {
					name = ruler_converted_from
				}

				orthodox = {
					show_scope_change = no

					religion_authority = {
						name = ruler_converted_to
					}
				}

				hidden_effect = {
					religion = orthodox
				}
			}

			# TODO: Add some religion modifier to boost Chalcedonian MA a bit
			# TODO: Adjust global_schism_tracker?

			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 = {
					limit = {
						OR = {
							religion = chalcedonian
							religion = iconoclast
						}

						held_under_PREV = yes
					}

					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 = {
				if = {
					limit = { religion = chalcedonian }

					k_orthodox = {
						holder_scope = {
							add_trait = greek_rites
						}
					}
				}
				else = {
					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
						}
					}
				}

				any_character = {
					limit = {
						trigger_if = {
							limit = { religion = chalcedonian }
							trait = iconoclast_rites
						}
						trigger_else = {
							religion = iconoclast
							can_change_religion = yes
						}
					}

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

		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 = italian_group
				culture_group = latin
				culture_group = byzantine
			}

			OR = {
				religion_group = christian
				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 = {
						held_under_PREV = yes

						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 = italian_group
							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 = { religion_openly_hellenic_or_reformed_trigger = yes }

					any_realm_province = {
						limit = {
							held_under_PREV = yes

							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 = {
							count >= 10
							religion_group = christian
							held_under_PREV = yes
						}
					}

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

			}

		}

		ai_will_do = {
			factor = 1

			mult_modifier = {
				factor = 3
				religion = hellenic_pagan_reformed
			}

			mult_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 = italian_group
				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 = {
						owned_by = PREV

						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 = { religion_openly_hellenic_or_reformed_trigger = yes }

					any_demesne_province = {
						limit = {
							owned_by = PREV

							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
			}
		}
	}
}