decisions = {
	
	convert_to_liege_religion = {
		only_playable = yes
		potential = {
			ai = no
			is_playable = yes
			liege = {
				NOT = { character = ROOT }
				NOT = { religion = ROOT }
				religion_group = ROOT
			}
			controls_religion = no
			NOT = { rightful_religious_head = ROOT }
			NOT = { has_character_flag = converted_religion }
		}
		allow = {
			NOT = { trait = zealous }
		}
		effect = {
			set_character_flag = converted_religion
			piety = -100
			if = {
				limit = { higher_tier_than = BARON }
				religion_authority = {
					modifier = ruler_converted_from
				}
			}
			liege = {
				reverse_religion = ROOT
			}
			add_character_modifier = { name = recently_converted duration = 730}
			if = {
				limit = { higher_tier_than = BARON }
				hidden_tooltip = {
					religion_authority = {
						modifier = ruler_converted_to
					}
				}
			}
			if = {
				limit = { liege = { trait = shaivist_hindu } }
				add_trait = shaivist_hindu
			}
			if = {
				limit = { liege = { trait = vaishnavist_hindu } }
				add_trait = vaishnavist_hindu
			}
			if = {
				limit = { liege = { trait = shaktist_hindu } }
				add_trait = shaktist_hindu
			}
			if = {
				limit = { liege = { trait = smartist_hindu } }
				add_trait = smartist_hindu
			}
			if = {
				limit = { liege = { trait = mahayana_buddhist } }
				add_trait = mahayana_buddhist
			}
			if = {
				limit = { liege = { trait = vajrayana_buddhist } }
				add_trait = vajrayana_buddhist
			}
			if = {
				limit = { liege = { trait = theravada_buddhist } }
				add_trait = theravada_buddhist
			}
			if = {
				limit = { liege = { trait = digambara_jain } }
				add_trait = digambara_jain
			}
			if = {
				limit = { liege = { trait = svetambara_jain } }
				add_trait = svetambara_jain
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
	}
	
	convert_to_liege_culture = {
		only_playable = yes
		potential = {
			is_playable = yes
			is_nomadic = no
			mercenary = no
			liege = {
				NOT = { character = ROOT }
				NOT = { culture = ROOT }
			}
			NOT = { has_character_flag = converted_culture }
		}
		allow = {
			prestige = 100
		}
		effect = {
			prestige = -100
			liege = {
				reverse_culture = ROOT
			}
			any_courtier = {
				limit = {
					is_ruler = no
					dynasty = ROOT
				}
				culture = ROOT
			}
			set_character_flag = converted_culture
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
	}
	
	convert_to_parent_religion = {
		only_playable = yes
		potential = {
			is_playable = yes
			is_heretic = yes
			controls_religion = no
			NOT = { rightful_religious_head = ROOT }
			NOT = {
				AND = {
					has_dlc = "Charlemagne"
					has_landed_title = e_byzantium  # May instead renounce iconoclasm
					has_landed_title = c_byzantion
					religion = iconoclast
					is_heresy_of = orthodox
				}
			}
		}
		allow = {
			NOT = { trait = zealous }
			independent = yes
		}
		effect = {
			piety = -100
			if = {
				limit = { higher_tier_than = BARON }
				religion_authority = {
					modifier = ruler_converted_from
				}
			}
			
			abandon_heresy = yes
			add_character_modifier = { name = recently_converted duration = 730}
			set_character_flag = converted_religion
			
			if = {
				limit = { higher_tier_than = BARON }
				hidden_tooltip = {
					religion_authority = {
						modifier = ruler_converted_to
					}
				}
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
	}
	
	# Weak or unreformed religions are allowed to convert to the attacker's religion when under Holy War
	convert_to_attacker_religion = {
		is_high_prio = yes
		only_playable = yes
		
		potential = {
			is_playable = yes
			OR = {
				AND = {
					religion_group = pagan_group
					is_reformed_religion = no
					NOT = { religion_authority = 0.4 }
				}
				NOT = { religion_authority = 0.3 }
				religion_group = zoroastrian_group
				religion_group = mesoamerican_group
			}
			controls_religion = no
			NOT = { rightful_religious_head = ROOT }
			war = yes
			any_war = {
				defender = { character = ROOT }
				attacker = {
					NOT = { religion = ROOT }
					religion_authority = 0.5
					OR = {
						NOT = { religion_group = pagan_group }
						is_reformed_religion = yes
					}
				}
				OR = {
					using_cb = crusade
					using_cb = holy_war
				}
			}
		}
		
		allow = {
			NOT = { trait = zealous }
		}
		
		effect = {
			prestige = -500
			religion_authority = {
				modifier = ruler_converted_from
			}
			
			hidden_tooltip = {
				any_war = {
					limit = {
						defender = { character = ROOT }
						attacker = {
							NOT = { religion = ROOT }
							religion_authority = 0.5
							OR = {
								NOT = { religion_group = pagan_group }
								is_reformed_religion = yes
							}
						}
						OR = {
							using_cb = crusade
							using_cb = holy_war
						}
					}
					attacker = {
						save_event_target_as = enemy_attacker
					}
				}
			}
			
			if = {
				limit = { event_target:enemy_attacker = { NOT = { religion_group = ROOT } } }
				if = {
					limit = { religion_group = pagan_group }
					add_trait = sympathy_pagans
				}
				
				if = {
					limit = { religion_group = zoroastrian_group }
					add_trait = sympathy_zoroastrianism
				}
				
				if = {
					limit = { religion_group = christian }
					add_trait = sympathy_christendom
				}
				
				if = {
					limit = { religion_group = muslim }
					add_trait = sympathy_islam
				}
				
				if = {
					limit = { religion_group = jewish_group }
					add_trait = sympathy_judaism
				}
				
				if = {
					limit = { religion_group = indian_group }
					add_trait = sympathy_indian
				}
			}
			
			event_target:enemy_attacker = {
				hidden_tooltip = {
					letter_event = { id = 62800 }
					ROOT = {
						any_courtier = {
							limit = {
								religion = ROOT
								employer = { character = ROOT }
							}
							religion = PREVPREV
						}
						any_vassal = {
							limit = {
								is_playable = no
								religion = ROOT
							}
							religion = PREVPREV
						}
						capital_scope = {
							if = {
								limit = { religion = ROOT }
								religion = PREVPREV
							}
						}
					}
				}
				reverse_religion = ROOT
				add_character_modifier = { name = recently_converted duration = 730}
			}
			
			hidden_tooltip = {
				religion_authority = {
					modifier = ruler_converted_to
				}
			}
			
			piety = 100
		}
		
		revoke_allowed = {
			always = no
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.1
			}
			modifier = {
				factor = 0.05
				is_hard_to_convert = yes
			}
			modifier = {
				factor = 0
				NOT = {
					any_war = {
						defender = { character = ROOT }
						attacker = {
							NOT = { religion = ROOT }
							religion_authority = 0.45
							OR = {
								NOT = { religion_group = pagan_group }
								is_reformed_religion = yes
							}
						}
						OR = {
							using_cb = crusade
							using_cb = holy_war
						}
						war_score = 50
						thirdparty_title_scope = {
							ROOT = {
								primary_title = {
									title = PREVPREV
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 2
				any_war = {
					defender = { character = ROOT }
					attacker = {
						NOT = { religion = ROOT }
						religion_authority = 0.45
						OR = {
							NOT = { religion_group = pagan_group }
							is_reformed_religion = yes
						}
					}
					OR = {
						using_cb = crusade
						using_cb = holy_war
					}
					war_score = 75
					thirdparty_title_scope = {
						ROOT = {
							primary_title = {
								title = PREVPREV
							}
						}
					}
				}
			}
		}
	}
	
	convert_to_swedish = {
		only_playable = yes
		potential = {
			is_playable = yes
			culture = norse
			capital_scope = {
				region = custom_sweden
			}
			any_realm_province = {
				culture = swedish
			}
		}
		allow = {
			culture = norse
		}
		effect = {
			culture = swedish
			any_courtier = {
				limit = {
					culture = norse
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = swedish
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.2 # Slow it down a bit
			}
			
			modifier = { # Do not flip if we're in a huge Norse empire
				factor = 0
				top_liege = { culture = norse }
				OR = {
					top_liege = {
						tier = emperor
					}
					AND = {
						290 = { # Uppland
							owner = {
								same_realm = ROOT
							}
						}
						272 = { # Akershus
							owner = {
								same_realm = ROOT
							}
						}
						266 = { # Sjaelland
							owner = {
								same_realm = ROOT
							}
						}
					}
				}
			}
			modifier = {
				factor = 0.01
				capital_scope = {
					NOT = { culture = swedish }
				}
			}
			modifier = {
				factor = 0.1
				capital_scope = {
					NOT = { region = custom_sweden }
				}
			}
			modifier = {
				factor = 2.0
				liege = { culture = swedish }
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = swedish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = swedish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = swedish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = swedish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = swedish
				}
			}
		}
	}

	convert_to_norwegian = {
		only_playable = yes
		potential = {
			is_playable = yes
			culture = norse
			capital_scope = {
				region = custom_norway
			}
			any_realm_province = {
				culture = norwegian
			}
		}
		allow = {
			culture = norse
		}
		effect = {
			culture = norwegian
			any_courtier = {
				limit = {
					culture = norse
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = norwegian
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.2 # Slow it down a bit
			}
			modifier = {
				factor = 0.1
				capital_scope = {
					NOT = { region = custom_norway }
				}
			}			
			modifier = { # Do not flip if we're in a huge Norse empire
				factor = 0
				top_liege = { culture = norse }
				290 = { # Uppland
					owner = {
						same_realm = ROOT
					}
				}
				272 = { # Akershus
					owner = {
						same_realm = ROOT
					}
				}
				266 = { # Sjaelland
					owner = {
						same_realm = ROOT
					}
				}
			}
			
			modifier = {
				factor = 0.01
				capital_scope = {
					NOT = { culture = norwegian }
				}
			}
			modifier = {
				factor = 2.0
				liege = { culture = norwegian }
			}
			
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = norwegian
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = norwegian
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = norwegian
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = norwegian
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = norwegian
				}
			}
		}
	}

	convert_to_danish = {
		only_playable = yes
		potential = {
			is_playable = yes
			culture = norse
			capital_scope = {
				region = custom_denmark
			}
			any_realm_province = {
				culture = danish
			}
		}
		allow = {
			culture = norse
		}
		effect = {
			culture = danish
			any_courtier = {
				limit = {
					culture = norse
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = danish
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.2 # Slow it down a bit
			}
			modifier = {
				factor = 0.1
				capital_scope = {
					NOT = { region = custom_denmark }
				}
			}			
			modifier = { # Do not flip if we're in a huge Norse empire
				factor = 0
				top_liege = { culture = norse }
				290 = { # Uppland
					owner = {
						same_realm = ROOT
					}
				}
				272 = { # Akershus
					owner = {
						same_realm = ROOT
					}
				}
				266 = { # Sjaelland
					owner = {
						same_realm = ROOT
					}
				}
			}
			
			modifier = {
				factor = 0.01
				capital_scope = {
					NOT = { culture = danish }
				}
			}
			modifier = {
				factor = 2.0
				liege = { culture = danish }
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = danish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = danish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = danish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = danish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = danish
				}
			}
		}
	}

	convert_to_norman = {
		only_playable = yes
		potential = {
			is_playable = yes
			culture = norse
			any_realm_province = {
				culture = norman
			}
		}
		allow = {
			culture = norse
		}
		effect = {
			culture = norman
			any_courtier = {
				limit = {
					culture = norse
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = norman
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.2 # Slow it down a bit
			}		
			modifier = { # Do not flip if we're in a huge Norse empire
				factor = 0
				top_liege = { culture = norse }
				OR = {
					top_liege = {
						tier = emperor
					}
					AND = {
						290 = { # Uppland
							owner = {
								same_realm = ROOT
							}
						}
						272 = { # Akershus
							owner = {
								same_realm = ROOT
							}
						}
						266 = { # Sjaelland
							owner = {
								same_realm = ROOT
							}
						}
					}
				}
			}
			
			modifier = {
				factor = 1.2
				liege = { culture = norman }
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = norman
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = norman
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = norman
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = norman
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = norman
				}
			}
		}
	}
	
	convert_to_reformed = {
		only_playable = yes
		potential = {
			is_playable = yes
			is_heretic = yes
			OR = {
				religion = norse_pagan
				religion = finnish_pagan
				religion = baltic_pagan
				religion = tengri_pagan
				religion = slavic_pagan
				religion = celtic_pagan
				religion = west_african_pagan
			}
		}
		allow = {
			NOT = { trait = zealous }
			piety = 50
		}
		effect = {
			piety = -50
			if = {
				limit = { religion = norse_pagan }
				religion = norse_pagan_reformed
			}
			if = {
				limit = { religion = finnish_pagan }
				religion = finnish_pagan_reformed
			}
			if = {
				limit = { religion = baltic_pagan }
				religion = baltic_pagan_reformed
			}
			if = {
				limit = { religion = tengri_pagan }
				religion = tengri_pagan_reformed
			}
			if = {
				limit = { religion = slavic_pagan }
				religion = slavic_pagan_reformed
			}
			if = {
				limit = { religion = west_african_pagan }
				religion = west_african_pagan_reformed
			}
			if = {
				limit = { religion = celtic_pagan }
				religion = celtic_pagan_reformed
			}
			add_character_modifier = { name = recently_converted duration = 730}
			hidden_tooltip = {
				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
					}
				}
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1 # On average ca 1 year before taken
			modifier = {
				factor = 0.025 # Generally quite a slow process - ca 40 years
			}
			modifier = {
				factor = 0.5
				OR = {
					trait = slow
					trait = dull
				}
			}
			modifier = {
				factor = 0.1
				trait = imbecile
			}
			modifier = {
				factor = 0.5
				trait = content
			}
			modifier = {
				factor = 1.5
				OR = {
					trait = quick				
					trait = shrewd
				}
			}
			modifier = {
				factor = 2.0
				trait = quick
			}
			modifier = {
				factor = 4.0
				trait = genius
			}
			modifier = {
				factor = 5.0
				trait = cynical # It's the future..
			}
			modifier = {
				factor = 2.0
				trait = ambitious
			}
			modifier = {
				factor = 0
				independent = no
				any_liege = {
					religion = ROOT
				}
			}
		}
	}
	
	# Carolingian renaissance - Old Frankish conversion to French
	convert_to_french = {
		only_playable = yes
		potential = {
			is_playable = yes
			culture = old_frankish
			capital_scope = {
				region = custom_france
			}
			any_realm_province = {
				culture = frankish
			}
		}
		allow = {
			culture = old_frankish
		}
		effect = {
			culture = frankish
			any_courtier = {
				limit = {
					culture = old_frankish
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = frankish
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.2 # Slow it down a bit
			}
			
			modifier = {
				factor = 0.01
				capital_scope = {
					NOT = { culture = frankish }
				}
			}
			modifier = {
				factor = 2.0
				liege = { culture = frankish }
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = frankish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = frankish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = frankish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = frankish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = frankish
				}
			}
		}
	}
	
	# Pictish character may convert to Scottish
	convert_to_scottish = {
		only_playable = yes
		potential = {
			is_playable = yes
			culture = pictish
			capital_scope = {
				region = custom_scotland
			}
			any_realm_province = {
				culture = scottish
			}
		}
		allow = {
			culture = pictish
		}
		effect = {
			culture = scottish
			any_courtier = {
				limit = {
					culture = pictish
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = scottish
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.2 # Slow it down a bit
			}
			
			modifier = {
				factor = 0.01
				capital_scope = {
					NOT = { culture = scottish }
				}
			}
			modifier = {
				factor = 2.0
				liege = { culture = scottish }
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = scottish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = scottish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = scottish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = scottish
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = scottish
				}
			}
		}
	}
	
	# Arabic or Visigothic character may convert to Andalusian
	convert_to_andalusian = {
		only_playable = yes
		potential = {
			is_playable = yes
			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
			}
			NOT = {
				culture = andalusian_arabic
			}
		}
		allow = {
		}
		effect = {
			culture = andalusian_arabic
			any_courtier = {
				limit = {
					culture = ROOT
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = andalusian_arabic
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.2 # Slow it down a bit
			}
			
			modifier = {
				factor = 0.01
				capital_scope = {
					NOT = { culture = andalusian_arabic }
				}
			}
			modifier = {
				factor = 2.0
				liege = { culture = andalusian_arabic }
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = andalusian_arabic
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = andalusian_arabic
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = andalusian_arabic
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = andalusian_arabic
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = andalusian_arabic
				}
			}
		}
	}

	# Visigothic character may convert to Castillan
	convert_to_castillan = {
		only_playable = yes
		potential = {
			is_playable = yes
			culture = visigothic
			religion_group = christian
			capital_scope = {
				region = custom_castillian
			}
			any_realm_province = {
				culture = castillan
			}
		}
		allow = {
			culture = visigothic
		}
		effect = {
			culture = castillan
			any_courtier = {
				limit = {
					culture = ROOT
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = castillan
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.2 # Slow it down a bit
			}
			
			modifier = {
				factor = 0.01
				capital_scope = {
					NOT = { culture = castillan }
				}
			}
			modifier = {
				factor = 2.0
				liege = { culture = castillan }
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = castillan
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = castillan
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = castillan
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = castillan
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = castillan
				}
			}
		}
	}	

	# Visigothic character may convert to catalan
	convert_to_catalan = {
		only_playable = yes
		potential = {
			is_playable = yes
			culture = visigothic
			religion_group = christian
			capital_scope = {
				region = custom_catalan
			}
			any_realm_province = {
				culture = catalan
			}
		}
		allow = {
			culture = visigothic
		}
		effect = {
			culture = catalan
			any_courtier = {
				limit = {
					culture = ROOT
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = catalan
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.2 # Slow it down a bit
			}
			
			modifier = {
				factor = 0.01
				capital_scope = {
					NOT = { culture = catalan }
				}
			}
			modifier = {
				factor = 2.0
				liege = { culture = catalan }
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = catalan
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = catalan
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = catalan
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = catalan
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = catalan
				}
			}
		}
	}	

	# Suebi or Visigothic character may convert to Portuguese
	convert_to_portuguese = {
		only_playable = yes
		potential = {
			is_playable = yes
			OR = {
				culture = suebi
				culture = visigothic
			}
			religion_group = christian
			capital_scope = {
				region = custom_portuguese
			}
			any_realm_province = {
				culture = portuguese
			}
		}
		allow = {
			OR = {
				culture = suebi
				culture = visigothic
			}
		}
		effect = {
			culture = portuguese
			any_courtier = {
				limit = {
					culture = ROOT
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = portuguese
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.2 # Slow it down a bit
			}
			
			modifier = {
				factor = 0.01
				capital_scope = {
					NOT = { culture = portuguese }
				}
			}
			modifier = {
				factor = 2.0
				liege = { culture = portuguese }
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = portuguese
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = portuguese
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = portuguese
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = portuguese
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = portuguese
				}
			}
		}
	}
	
	# Old Frankish or Old Saxon character may convert to dutch
	convert_to_dutch = {
		only_playable = yes
		potential = {
			is_playable = yes
			OR = {
				culture = old_frankish
				culture = old_saxon
				culture = frisian
			}
			capital_scope = {
				region = custom_frisia
			}
			any_realm_province = {
				culture = dutch
			}
		}
		allow = {
			culture = ROOT
		}
		effect = {
			culture = dutch
			any_courtier = {
				limit = {
					culture = ROOT
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = dutch
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.2 # Slow it down a bit
			}
			
			modifier = {
				factor = 0.01
				capital_scope = {
					NOT = { culture = dutch }
				}
			}
			modifier = {
				factor = 2.0
				liege = { culture = dutch }
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = dutch
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = dutch
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = dutch
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = dutch
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = dutch
				}
			}
		}
	}
	
	# Lombard character may convert to italian
	convert_to_italian = {
		only_playable = yes
		potential = {
			is_playable = yes
			culture = lombard
			capital_scope = {
				region = world_europe_south_italy
			}
			any_realm_province = {
				culture = italian
			}
			OR = {
				year = 786
				top_liege = {
					NOT = { culture = lombard }
				}
			}
		}
		allow = {
			culture = lombard
			any_realm_province = {
				culture = italian
			}
		}
		effect = {
			culture = italian
			any_courtier = {
				limit = {
					culture = ROOT
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = italian
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0
				OR = {
					independent = yes
					top_liege = { culture = lombard }
				}
			}

			modifier = {
				factor = 0.1 # Slow it down a bit
			}
			
			modifier = {
				factor = 0.01
				capital_scope = {
					NOT = { culture = italian }
				}
			}
			modifier = {
				factor = 2.0
				liege = { culture = italian }
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = italian
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = italian
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = italian
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = italian
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = italian
				}
			}
		}
	}
	
	# Visigothic character may convert to occitan
	convert_to_occitan = {
		only_playable = yes
		potential = {
			is_playable = yes
			culture = visigothic
			religion_group = christian
			capital_scope = {
				OR = {
					region = custom_aquitaine
					region = custom_burgundy
				}
			}
			any_realm_province = {
				culture = occitan
			}
		}
		allow = {
			culture = ROOT
		}
		effect = {
			culture = occitan
			any_courtier = {
				limit = {
					culture = ROOT
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = occitan
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.2 # Slow it down a bit
			}
			
			modifier = {
				factor = 0.01
				capital_scope = {
					NOT = { culture = occitan }
				}
			}
			modifier = {
				factor = 2.0
				liege = { culture = occitan }
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = occitan
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = occitan
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = occitan
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = occitan
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = occitan
				}
			}
		}
	}

	# Byzantine Emperor may renounce Iconoclasm
	renounce_iconoclasm = {
		only_playable = yes
		
		icon_religion = orthodox
		
		potential = {
			is_playable = yes
			religion = iconoclast
			has_landed_title = e_byzantium
			any_vassal = { has_landed_title = d_iconoclast }
			NOT = { has_character_flag = renounced_iconoclasm }
			NOT = { k_papal_state = { has_title_flag = schism_happened } }
			NOT = { year = 900 }
		}
		allow = {
			has_landed_title = e_byzantium
			has_landed_title = c_byzantion
			any_realm_province = { religion = chalcedonian }
			NOT = { trait = zealous }
			war = no
		}
		effect = {
			set_character_flag = renounced_iconoclasm
			religion_authority = {
				modifier = ruler_converted_from
			}
			religion = chalcedonian
			hidden_tooltip = {
				religion_authority = {
					modifier = ruler_converted_to
				}
			}
			if = {
				limit = { capital_scope = { NOT = { religion = chalcedonian } } }
				capital_scope = { religion = chalcedonian }
			}
			custom_tooltip = {
				text = renounce_iconoclasm_muslim_opinion_tooltip
				hidden_tooltip = {
					any_independent_ruler = {
						any_realm_lord = {
							limit = { religion_group = muslim }
							opinion = {
								who = ROOT
								modifier = opinion_idolater
								months = 120
							}
						}
					}
				}
			}
			custom_tooltip = {
				text = renounce_iconoclasm_province_tooltip
				hidden_tooltip = {
					any_realm_province = {
						if = {
							limit = { religion = chalcedonian }
							add_province_modifier = {
								name = appeased_religious
								months = 60
							}
						}
					}
				}
			}
			k_papal_chalcedon = {
				holder_scope = {
					opinion = {
						who = ROOT
						modifier = opinion_renounced_iconoclasm
						months = 120
					}
				}
			}
			hidden_tooltip = {
				any_realm_character = {
					limit = {
						religion = iconoclast
						NOT = { character = ROOT }
						can_change_religion = yes
					}
					character_event = { id = CM.4200 }
				}
			}
			d_iconoclast = {
				holder_scope = {
					unsafe_religion = chalcedonian  # Use this effect with care
					set_defacto_liege = ROOT
					pf_liege_change_effect = yes
				}
				hidden_tooltip = { unsafe_destroy_landed_title = THIS }
			}
			activate_title = { title = d_iconoclast status = no }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.1 # slow it down
			}
			modifier = {
				factor = 3
				trait = cynical
			}
		}
	}
	
	convert_indian_branch = {
		potential = {
			ai = no
			is_playable = yes
			is_adult = yes
			is_theocracy = no
			religion_group = indian_group
		}
		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
			if = {
				limit = { religion = hindu }
				character_event = { id = RoI.115 } # Choose branch
			}
			if = {
				limit = { religion = buddhist }
				character_event = { id = RoI.116 } # Choose branch
			}
			if = {
				limit = { religion = jain }
				character_event = { id = RoI.117 } # Confirm conversion
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
	}
}

targetted_decisions = {

	convert_to_spouse_religion= {
		filter = home_court
		ai_target_filter = home_court
		only_playable = yes
	
		from_potential = {
			ai = no
			is_playable = yes
			religion_group = pagan_group
			controls_religion = no
		}
		
		potential = {
			OR = {
				spouse = {
					character = FROM
				}
				consort = {
					character = FROM
				}
			}
			OR = {
				religion_group = christian
				religion_group = muslim
				religion_group = zoroastrian_group
				religion_group = jewish_group
				religion_group = indian_group
			}
			is_alive = yes
		}
		
		allow = {
			FROM = { NOT = { trait = zealous } }
		}
		
		effect = {
			FROM = {
				prestige = -500
				religion_authority = {
					modifier = ruler_converted_from
				}
			
				if = {
					limit = {
						trait = cynical
					}
					random = {
						chance = 60
						add_trait = sympathy_pagans
					}
				}
				if = {
					limit = {
						NOT = { trait = cynical }
					}
					random = {
						chance = 50
						add_trait = sympathy_pagans
					}
				}		
			
				religion = ROOT
				add_character_modifier = { name = recently_converted duration = 730}
				
				#When spouse is Hindu
				if = {
					limit = {
						ROOT = {
							trait = shaivist_hindu
						}
					}
					add_trait = shaivist_hindu
				}
				if = {
					limit = {
						ROOT = {
							trait = vaishnavist_hindu
						}
					}
					add_trait = vaishnavist_hindu
				}
				if = {
					limit = {
						ROOT = {
							trait = shaktist_hindu
						}
					}
					add_trait = shaktist_hindu
				}
				if = {
					limit = {
						ROOT = {
							trait = smartist_hindu
						}
					}
					add_trait = smartist_hindu
				}
				
				#When spouse is Buddhist
				if = {
					limit = {
						ROOT = {
							trait = mahayana_buddhist
						}
					}
					add_trait = mahayana_buddhist
				}
				if = {
					limit = {
						ROOT = {
							trait = vajrayana_buddhist
						}
					}
					add_trait = vajrayana_buddhist
				}
				if = {
					limit = {
						ROOT = {
							trait = theravada_buddhist
						}
					}
					add_trait = theravada_buddhist
				}
				
				#When spouse is Jain
				if = {
					limit = {
						ROOT = {
							trait = digambara_jain
						}
					}
					add_trait = digambara_jain
				}
				if = {
					limit = {
						ROOT = {
							trait = svetambara_jain
						}
					}
					add_trait = svetambara_jain
				}
				
				hidden_tooltip = {
					religion_authority = {
						modifier = ruler_converted_to
					}
				}
				piety = 200
			}
		}
		
		revoke_allowed = {
			always = no
		}
		
		ai_will_do = {
			factor = 0
		}
	}
}