# -*- ck2.decisions -*-

targeted_decisions = {
	convert_to_liege_religion = {
		only_playable = yes

		filter = self
		ai_target_filter = self

		potential = {
			ai = no
			is_playable = yes
			liege = {
				NOT = { character = ROOT }
				NOT = { religion = ROOT }
				religion_group = ROOT
			}
			controls_religion = no
		}
		allow = {
			NOT = { trait = zealous }
			custom_tooltip = { text = NEEDS_250_PRESTIGE_COST hidden_tooltip = { prestige = 250 } }
		}
		effect = {
			hidden_tooltip = {
			remove_character_modifier = patron_forseti
			remove_character_modifier = patron_thor
			remove_character_modifier = patron_njordr
			remove_character_modifier = patron_loki
			remove_character_modifier = patron_odin
			remove_character_modifier = patron_freyja
			remove_character_modifier = patron_dazbog
			remove_character_modifier = patron_perun
			remove_character_modifier = patron_porewit
			remove_character_modifier = patron_crnobog
			remove_character_modifier = patron_rod
			remove_character_modifier = patron_jarilo
			remove_character_modifier = patron_jupiter
			remove_character_modifier = patron_mars
			remove_character_modifier = patron_pluto
			remove_character_modifier = patron_mercury
			remove_character_modifier = patron_minerva
			remove_character_modifier = patron_bacchus
			remove_character_modifier = patron_dievas
			remove_character_modifier = patron_perkunas
			remove_character_modifier = patron_zemyna
			remove_character_modifier = patron_velnias
			remove_character_modifier = patron_laima
			remove_character_modifier = patron_ausrine
			remove_character_modifier = patron_jumala
			remove_character_modifier = patron_ukko
			remove_character_modifier = patron_akka
			remove_character_modifier = patron_kuu
			remove_character_modifier = patron_antero_vipunen
			remove_character_modifier = patron_akras
			remove_character_modifier = patron_nsamanfo
			remove_character_modifier = patron_tano
			remove_character_modifier = patron_abosom
			remove_character_modifier = patron_anansi
			remove_character_modifier = patron_nyame
			remove_character_modifier = patron_asase_ya
			remove_character_modifier = patron_yer
			remove_character_modifier = patron_kayra
			remove_character_modifier = patron_gun_ana
			remove_character_modifier = patron_ay_dede
			remove_character_modifier = patron_ulgan
			remove_character_modifier = patron_umay
			remove_character_modifier = patron_peter
			remove_character_modifier = patron_george
			remove_character_modifier = patron_ambrose
			remove_character_modifier = patron_gregory
			remove_character_modifier = patron_augustine
			remove_character_modifier = patron_anthony
			remove_character_modifier = patron_mary
			remove_character_modifier = patron_thomas
			remove_character_modifier = patron_john
			remove_character_modifier = patron_vohu_manah
			remove_character_modifier = patron_khshathra_vairya
			remove_character_modifier = patron_haurvatat
			remove_character_modifier = patron_asha_vahishta
			remove_character_modifier = patron_armaiti
			remove_character_modifier = patron_ameretat
			remove_character_modifier = patron_angus
			remove_character_modifier = patron_nuada
			remove_character_modifier = patron_manannan
			remove_character_modifier = patron_daghda
			remove_character_modifier = patron_ogma
			remove_character_modifier = patron_dana
			remove_character_modifier = patron_israfil
			remove_character_modifier = patron_mikail
			remove_character_modifier = patron_dardail
			remove_character_modifier = patron_gibrail
			remove_character_modifier = patron_shimnail
			remove_character_modifier = patron_nurail
			}
			clr_character_flag = patron_chosen					 								 
			prestige = -250
			piety = 100
			if = {
				limit = { higher_tier_than = BARON }
				religion_authority = {
					modifier = ruler_converted_from
				}
			}
			liege = {
				reverse_religion = ROOT
			}
			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
			}
		}
		ai_will_do = {
			factor = 0
		}
	}

	convert_to_liege_religion_on_liege = {
		only_playable = yes

		filter = liege
		ai_target_filter = liege

		from_potential = {
			ai = no
			is_playable = yes
			controls_religion = no
		}
		potential = {
			NOT = { character = FROM }
			NOT = { religion = FROM }
			religion_group = FROM
		}

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

		effect = {
			FROM = {
				prestige = -500
				piety = 250
				if = {
					limit = { higher_tier_than = BARON }
					religion_authority = {
						modifier = ruler_converted_from
					}
				}
				religion = ROOT
				if = {
					limit = { higher_tier_than = BARON }
					hidden_tooltip = {
						religion_authority = {
							modifier = ruler_converted_to
						}
					}
				}
				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
				}
				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
				}
				if = {
					limit = { ROOT = { trait = digambara_jain } }
					add_trait = digambara_jain
				}
				if = {
					limit = { ROOT = { trait = svetambara_jain } }
					add_trait = svetambara_jain
				}
			}
		}
		ai_will_do = {
			factor = 0
		}
	}

	convert_to_liege_culture_on_liege = {
		only_playable = yes

		filter = liege
		ai_target_filter = liege

		from_potential = {
			is_playable = yes
		}

		potential = {
			NOT = { character = FROM }
			NOT = { culture = FROM }
		}
		allow = {
			FROM = { prestige = 200 }
		}
		effect = {
			FROM = {
				prestige = -200
				culture = ROOT
			}
		}
		ai_will_do = {
			factor = 0
		}
	}

	convert_to_liege_culture = {
		only_playable = yes

		filter = self
		ai_target_filter = self

		potential = {
			ai = no # EMF
			is_playable = yes
			liege = {
				NOT = { character = ROOT }
				NOT = { culture = ROOT }
			}
		}
		allow = {
			custom_tooltip = { text = NEEDS_200_PRESTIGE_COST hidden_tooltip = { prestige = 200 } }
		}
		effect = {
			prestige = -200
			liege = { ROOT = { culture = PREV } }
		}
		ai_will_do = {
			factor = 0
		}
	}

	convert_to_local_culture = {
		only_playable = yes

		filter = self
		ai_target_filter = self

		potential = {
			ai = no
			is_nomadic = no
			capital_scope = {
				NOT = { culture = ROOT }
			}
			holy_order = no
			mercenary = no
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			custom_tooltip = { text = NEEDS_250_PRESTIGE_COST hidden_tooltip = { prestige = 250 } }
		}
		effect = {
			prestige = -250
			capital_scope = { ROOT = { culture = PREV } }
			hidden_tooltip = {
				any_child = {
					limit = {
						is_ruler = no
						liege = { character = ROOT }
					}
					culture = ROOT
				}
			}
		}
		ai_will_do = {
			factor = 0
			modifier = {
				factor = 0.01
			}
			modifier = {
				factor = 0
				primary_title = {
					is_conquered = yes
					conquest_culture = ROOT
				}
			}
			modifier = {
				factor = 0
				any_vassal = {
					culture = ROOT
					OR = {
						tier = DUKE
						tier = KING
						AND = {
							tier = COUNT
							ROOT = { tier = DUKE }
						}
					}
				}
			}
			modifier = {
				factor = 0
				capital_scope = {
					OR = {
						AND = {
							culture = norse
							NOT = {	has_global_flag = norse_culture_flipping }
							ROOT = {
								OR = {
									culture = swedish
									culture = norwegian
									culture = danish
									culture = norman
									culture = gothic
									culture = icelandic
								}
							}
						}
						AND = {
							culture = saxon
							ROOT = {
								OR = {
									culture = norman
									culture = english
								}
							}
						}
						AND = {
							culture = norman
							ROOT = {
								OR = {
									culture = english
									culture = saxon
								}
							}
						}
						AND = {
							culture_group = east_slavic
							ROOT = {
								culture = russian
							}
						}
						AND = {
							culture = pictish
							ROOT = {
								culture = scottish
							}
						}
						AND = {
							culture = lombard
							ROOT = {
								culture = italian
							}
						}
						AND = {
							culture = old_frankish
							ROOT = {
								culture = frankish
							}
						}
						AND = {
							culture = frisian
							ROOT = {
								culture = dutch
							}
						}
						AND = {
							culture = old_saxon
							ROOT = {
								culture = german
							}
						}
						AND = {
							culture = visigothic
							ROOT = {
								OR = {
									culture_group = iberian
									culture = andalusian_arabic
									culture = occitan
									religion_group = muslim
								}
							}
						}
					}
				}
			}
			modifier = {
				factor = 0
				culture = nahuatl
			}
			modifier = {
				factor = 0
				has_landed_title = e_china_west_governor
			}
			modifier = {
				factor = 0
				government = chinese_imperial_government
			}
		}
	}

	convert_to_local_religion = {
		only_playable = yes

		filter = self
		ai_target_filter = self

		potential = {
			ai = no
			is_playable = yes
			is_nomadic = no
			capital_scope = {
				NOT = { religion = ROOT }
			}
			# The Indian religions can convert to each other anyway
			OR = {
				NOT = { has_dharmic_religion_trigger = yes }
				capital_scope = {
					NOT = { has_dharmic_religion_trigger = yes }
				}
			}

			controls_religion = no
			holy_order = no

			NOT = {
				AND = {
					has_dlc = "Charlemagne"
					has_landed_title = e_byzantium  # May instead renounce iconoclasm
					has_landed_title = c_byzantion
					religion = iconoclast
					capital_scope = { religion = orthodox }
				}
			}
		}
		allow = {
			NOT = { trait = zealous }
			OR = {
				AND = {
					custom_tooltip = { text = NEEDS_250_PRESTIGE_COST hidden_tooltip = { prestige = 250 } }
					capital_scope = {
						religion_group = ROOT
					}
				}
				AND = {
					custom_tooltip = { text = NEEDS_500_PRESTIGE_COST hidden_tooltip = { prestige = 500 } }
					capital_scope = {
						NOT = { religion_group = ROOT }
					}
				}
			}
		}
		effect = {
			hidden_tooltip = {
			remove_character_modifier = patron_forseti
			remove_character_modifier = patron_thor
			remove_character_modifier = patron_njordr
			remove_character_modifier = patron_loki
			remove_character_modifier = patron_odin
			remove_character_modifier = patron_freyja
			remove_character_modifier = patron_dazbog
			remove_character_modifier = patron_perun
			remove_character_modifier = patron_porewit
			remove_character_modifier = patron_crnobog
			remove_character_modifier = patron_rod
			remove_character_modifier = patron_jarilo
			remove_character_modifier = patron_jupiter
			remove_character_modifier = patron_mars
			remove_character_modifier = patron_pluto
			remove_character_modifier = patron_mercury
			remove_character_modifier = patron_minerva
			remove_character_modifier = patron_bacchus
			remove_character_modifier = patron_dievas
			remove_character_modifier = patron_perkunas
			remove_character_modifier = patron_zemyna
			remove_character_modifier = patron_velnias
			remove_character_modifier = patron_laima
			remove_character_modifier = patron_ausrine
			remove_character_modifier = patron_jumala
			remove_character_modifier = patron_ukko
			remove_character_modifier = patron_akka
			remove_character_modifier = patron_kuu
			remove_character_modifier = patron_antero_vipunen
			remove_character_modifier = patron_akras
			remove_character_modifier = patron_nsamanfo
			remove_character_modifier = patron_tano
			remove_character_modifier = patron_abosom
			remove_character_modifier = patron_anansi
			remove_character_modifier = patron_nyame
			remove_character_modifier = patron_asase_ya
			remove_character_modifier = patron_yer
			remove_character_modifier = patron_kayra
			remove_character_modifier = patron_gun_ana
			remove_character_modifier = patron_ay_dede
			remove_character_modifier = patron_ulgan
			remove_character_modifier = patron_umay
			remove_character_modifier = patron_peter
			remove_character_modifier = patron_george
			remove_character_modifier = patron_ambrose
			remove_character_modifier = patron_gregory
			remove_character_modifier = patron_augustine
			remove_character_modifier = patron_anthony
			remove_character_modifier = patron_mary
			remove_character_modifier = patron_thomas
			remove_character_modifier = patron_john
			remove_character_modifier = patron_vohu_manah
			remove_character_modifier = patron_khshathra_vairya
			remove_character_modifier = patron_haurvatat
			remove_character_modifier = patron_asha_vahishta
			remove_character_modifier = patron_armaiti
			remove_character_modifier = patron_ameretat
			remove_character_modifier = patron_angus
			remove_character_modifier = patron_nuada
			remove_character_modifier = patron_manannan
			remove_character_modifier = patron_daghda
			remove_character_modifier = patron_ogma
			remove_character_modifier = patron_dana
			remove_character_modifier = patron_israfil
			remove_character_modifier = patron_mikail
			remove_character_modifier = patron_dardail
			remove_character_modifier = patron_gibrail
			remove_character_modifier = patron_shimnail
			remove_character_modifier = patron_nurail
			}
			clr_character_flag = patron_chosen	
			if = {
				limit = {
					capital_scope = {
						NOT = { religion_group = ROOT }
					}
				}
				prestige = -500
			}
			if = {
				limit = {
					capital_scope = {
						religion_group = ROOT
					}
				}
				prestige = -250
			}
			piety = 100
			religion_authority = {
				modifier = ruler_converted_from
			}
			if = {
				limit = {
					independent = yes
					higher_real_tier_than = DUKE
					NOT = { religion_group = christian }
					capital_scope = { religion_group = christian }
				}
				set_character_flag = king_converted
			}
			if = {
				limit = {
					religion_group = christian
					NOT = { trait = sympathy_christendom }
					capital_scope = {
						NOT = { religion_group = ROOT }
					}
				}
				random = {
					chance = 60
					add_trait = sympathy_christendom
				}
			}
			if = {
				limit = {
					religion_group = muslim
					NOT = { trait = sympathy_islam }
					capital_scope = {
						NOT = { religion_group = ROOT }
					}
				}
				random = {
					chance = 60
					add_trait = sympathy_islam
				}
			}
			if = {
				limit = {
					religion_group = pagan_group
					NOT = { trait = sympathy_pagans }
					capital_scope = {
						NOT = { religion_group = ROOT }
					}
				}
				random = {
					chance = 60
					add_trait = sympathy_pagans
				}
			}
			if = {
				limit = {
					religion_group = zoroastrian_group
					NOT = { trait = sympathy_zoroastrianism }
					capital_scope = {
						NOT = { religion_group = ROOT }
					}
				}
				random = {
					chance = 60
					add_trait = sympathy_zoroastrianism
				}
			}
			if = {
				limit = {
					religion_group = jewish_group
					NOT = { trait = sympathy_judaism }
					capital_scope = {
						NOT = { religion_group = ROOT }
					}
				}
				random = {
					chance = 60
					add_trait = sympathy_judaism
				}
			}
			custom_tooltip = { text = local_religion_conversion_tooltip }
			hidden_tooltip = {
				capital_scope = {
					reverse_religion = ROOT
				}
			}
			hidden_tooltip = {
				religion_authority = {
					modifier = ruler_converted_to
				}
			}
		}
		ai_will_do = {
			factor = 0
		}
	}

	convert_to_parent_religion = {
		only_playable = yes

		filter = self
		ai_target_filter = self

		potential = {
			ai = no
			is_playable = yes
			independent = yes
			controls_religion = no
			is_heretic = yes
			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 }
			custom_tooltip = { text = NEEDS_250_PRESTIGE_COST hidden_tooltip = { prestige = 250 } }
		}
		effect = {
			hidden_tooltip = {
			remove_character_modifier = patron_forseti
			remove_character_modifier = patron_thor
			remove_character_modifier = patron_njordr
			remove_character_modifier = patron_loki
			remove_character_modifier = patron_odin
			remove_character_modifier = patron_freyja
			remove_character_modifier = patron_dazbog
			remove_character_modifier = patron_perun
			remove_character_modifier = patron_porewit
			remove_character_modifier = patron_crnobog
			remove_character_modifier = patron_rod
			remove_character_modifier = patron_jarilo
			remove_character_modifier = patron_jupiter
			remove_character_modifier = patron_mars
			remove_character_modifier = patron_pluto
			remove_character_modifier = patron_mercury
			remove_character_modifier = patron_minerva
			remove_character_modifier = patron_bacchus
			remove_character_modifier = patron_dievas
			remove_character_modifier = patron_perkunas
			remove_character_modifier = patron_zemyna
			remove_character_modifier = patron_velnias
			remove_character_modifier = patron_laima
			remove_character_modifier = patron_ausrine
			remove_character_modifier = patron_jumala
			remove_character_modifier = patron_ukko
			remove_character_modifier = patron_akka
			remove_character_modifier = patron_kuu
			remove_character_modifier = patron_antero_vipunen
			remove_character_modifier = patron_akras
			remove_character_modifier = patron_nsamanfo
			remove_character_modifier = patron_tano
			remove_character_modifier = patron_abosom
			remove_character_modifier = patron_anansi
			remove_character_modifier = patron_nyame
			remove_character_modifier = patron_asase_ya
			remove_character_modifier = patron_yer
			remove_character_modifier = patron_kayra
			remove_character_modifier = patron_gun_ana
			remove_character_modifier = patron_ay_dede
			remove_character_modifier = patron_ulgan
			remove_character_modifier = patron_umay
			remove_character_modifier = patron_peter
			remove_character_modifier = patron_george
			remove_character_modifier = patron_ambrose
			remove_character_modifier = patron_gregory
			remove_character_modifier = patron_augustine
			remove_character_modifier = patron_anthony
			remove_character_modifier = patron_mary
			remove_character_modifier = patron_thomas
			remove_character_modifier = patron_john
			remove_character_modifier = patron_vohu_manah
			remove_character_modifier = patron_khshathra_vairya
			remove_character_modifier = patron_haurvatat
			remove_character_modifier = patron_asha_vahishta
			remove_character_modifier = patron_armaiti
			remove_character_modifier = patron_ameretat
			remove_character_modifier = patron_angus
			remove_character_modifier = patron_nuada
			remove_character_modifier = patron_manannan
			remove_character_modifier = patron_daghda
			remove_character_modifier = patron_ogma
			remove_character_modifier = patron_dana
			remove_character_modifier = patron_israfil
			remove_character_modifier = patron_mikail
			remove_character_modifier = patron_dardail
			remove_character_modifier = patron_gibrail
			remove_character_modifier = patron_shimnail
			remove_character_modifier = patron_nurail
			}
			clr_character_flag = patron_chosen
			prestige = -250
			piety = 100
			if = {
				limit = { higher_tier_than = BARON }
				religion_authority = {
					modifier = ruler_converted_from
				}
			}

			abandon_heresy = yes

			if = {
				limit = { higher_tier_than = BARON }
				hidden_tooltip = {
					religion_authority = {
						modifier = ruler_converted_to
					}
				}
			}
		}
		ai_will_do = {
			factor = 0
		}
	}

	convert_to_swedish = {
		only_playable = yes

		filter = self
		ai_target_filter = self

		potential = {
			is_playable = yes
			culture = norse
			capital_scope = {
				region = custom_swedish
			}
			any_realm_province = {
				culture = swedish
			}
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			culture = norse
		}
		effect = {
			culture = swedish
			any_courtier = {
				limit = {
					culture = norse
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = swedish
			}
		}
		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 = 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

		filter = self
		ai_target_filter = self
		
			hidden_tooltip = {
			remove_character_modifier = patron_forseti
			remove_character_modifier = patron_thor
			remove_character_modifier = patron_njordr
			remove_character_modifier = patron_loki
			remove_character_modifier = patron_odin
			remove_character_modifier = patron_freyja
			remove_character_modifier = patron_dazbog
			remove_character_modifier = patron_perun
			remove_character_modifier = patron_porewit
			remove_character_modifier = patron_crnobog
			remove_character_modifier = patron_rod
			remove_character_modifier = patron_jarilo
			remove_character_modifier = patron_jupiter
			remove_character_modifier = patron_mars
			remove_character_modifier = patron_pluto
			remove_character_modifier = patron_mercury
			remove_character_modifier = patron_minerva
			remove_character_modifier = patron_bacchus
			remove_character_modifier = patron_dievas
			remove_character_modifier = patron_perkunas
			remove_character_modifier = patron_zemyna
			remove_character_modifier = patron_velnias
			remove_character_modifier = patron_laima
			remove_character_modifier = patron_ausrine
			remove_character_modifier = patron_jumala
			remove_character_modifier = patron_ukko
			remove_character_modifier = patron_akka
			remove_character_modifier = patron_kuu
			remove_character_modifier = patron_antero_vipunen
			remove_character_modifier = patron_akras
			remove_character_modifier = patron_nsamanfo
			remove_character_modifier = patron_tano
			remove_character_modifier = patron_abosom
			remove_character_modifier = patron_anansi
			remove_character_modifier = patron_nyame
			remove_character_modifier = patron_asase_ya
			remove_character_modifier = patron_yer
			remove_character_modifier = patron_kayra
			remove_character_modifier = patron_gun_ana
			remove_character_modifier = patron_ay_dede
			remove_character_modifier = patron_ulgan
			remove_character_modifier = patron_umay
			remove_character_modifier = patron_peter
			remove_character_modifier = patron_george
			remove_character_modifier = patron_ambrose
			remove_character_modifier = patron_gregory
			remove_character_modifier = patron_augustine
			remove_character_modifier = patron_anthony
			remove_character_modifier = patron_mary
			remove_character_modifier = patron_thomas
			remove_character_modifier = patron_john
			remove_character_modifier = patron_vohu_manah
			remove_character_modifier = patron_khshathra_vairya
			remove_character_modifier = patron_haurvatat
			remove_character_modifier = patron_asha_vahishta
			remove_character_modifier = patron_armaiti
			remove_character_modifier = patron_ameretat
			remove_character_modifier = patron_angus
			remove_character_modifier = patron_nuada
			remove_character_modifier = patron_manannan
			remove_character_modifier = patron_daghda
			remove_character_modifier = patron_ogma
			remove_character_modifier = patron_dana
			remove_character_modifier = patron_israfil
			remove_character_modifier = patron_mikail
			remove_character_modifier = patron_dardail
			remove_character_modifier = patron_gibrail
			remove_character_modifier = patron_shimnail
			remove_character_modifier = patron_nurail
			}
			clr_character_flag = patron_chosen
		potential = {
			is_playable = yes
			culture = norse
			capital_scope = {
				region = custom_norwegian
			}
			any_realm_province = {
				culture = norwegian
			}
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			culture = norse
		}
		effect = {
			culture = norwegian
			any_courtier = {
				limit = {
					culture = norse
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = norwegian
			}
		}
		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 = 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

		filter = self
		ai_target_filter = self

		potential = {
			is_playable = yes
			culture = norse
			capital_scope = {
				region = custom_danish
			}
			any_realm_province = {
				culture = danish
			}
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			culture = norse
		}
		effect = {
			culture = danish
			any_courtier = {
				limit = {
					culture = norse
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = danish
			}
		}
		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 = 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

		filter = self
		ai_target_filter = self

		potential = {
			is_playable = yes
			culture = norse
			capital_scope = {
				culture = norman
			}
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			culture = norse
		}
		effect = {
			culture = norman
			any_courtier = {
				limit = {
					culture = norse
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = norman
			}
		}
		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_icelandic = {
		only_playable = yes

		filter = self
		ai_target_filter = self

		potential = {
			is_playable = yes
			culture = norse
			capital_scope = {
				culture = icelandic
			}
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			culture = norse
		}
		effect = {
			culture = icelandic
			any_courtier = {
				limit = {
					culture = norse
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = icelandic
			}
		}
		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
					tier = emperor
				}
			}
			modifier = {
				factor = 2.0
				liege = { culture = icelandic }
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = icelandic
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = icelandic
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = icelandic
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = icelandic
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = icelandic
				}
			}
		}
	}
	convert_to_gothic = {
		only_playable = yes

		filter = self
		ai_target_filter = self

		potential = {
			is_playable = yes
			culture = norse
			capital_scope = {
				culture = gothic
			}
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			culture = norse
		}
		effect = {
			culture = gothic
			any_courtier = {
				limit = {
					culture = norse
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = gothic
			}
		}
		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
					tier = emperor
				}
			}
			modifier = {
				factor = 2.0
				liege = { culture = gothic }
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = gothic
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = gothic
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = gothic
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = gothic
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = gothic
				}
			}
		}
	}

	convert_to_reformed = {
		only_playable = yes

		filter = self
		ai_target_filter = self

		potential = {
			is_playable = yes
			is_heretic = yes
			OR = {
				religion = norse_pagan
				religion = finnish_pagan
				religion = baltic_pagan
				religion = tengri_pagan
				religion = slavic_pagan
				religion = aztec
				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 = aztec }
				religion = aztec_reformed
			}
			if = {
				limit = { religion = west_african_pagan }
				religion = west_african_pagan_reformed
			}

			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
					}
				}
			}
		}
		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 = 2.0
				OR = {
					trait = quick
					trait = shrewd
				}
			}
			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
				}
			}
		}
	}

	convert_to_hinduism = {
		only_playable = yes
		icon_religion = hindu

		filter = self
		ai_target_filter = self

		potential = {
			ai = no
			is_playable = yes
			has_dharmic_religion_trigger = yes
			NOT = { religion = hindu }
			is_theocracy = no
		}
		allow = {
			is_adult = yes
			prestige = 500
			NOT = { trait = zealous }
			any_realm_province = {
				religion = hindu
			}
			custom_tooltip = {
				text = indian_has_not_converted
				NOT = { has_character_flag = india_converted }
			}
		}
		effect = {
			if = {
				limit = { higher_tier_than = BARON }
				religion_authority = {
					modifier = ruler_converted_from
				}
			}
			religion = hindu
			if = {
				limit = { higher_tier_than = BARON }
				hidden_tooltip = {
					religion_authority = {
						modifier = ruler_converted_to
					}
				}
			}
			set_character_flag = india_converted
			prestige = -500
			piety = 100
			hidden_tooltip = { character_event = { id = RoI.110 } } # Choose branch
		}
		ai_will_do = {
			factor = 0
		}
	}

	convert_to_buddhism = {
		only_playable = yes
		icon_religion = buddhist

		filter = self
		ai_target_filter = self

		potential = {
			ai = no
			is_playable = yes
			has_dharmic_religion_trigger = yes
			NOT = { religion = buddhist }
			is_theocracy = no
		}
		allow = {
			is_adult = yes
			prestige = 500
			NOT = { trait = zealous }
			any_realm_province = {
				religion = buddhist
			}
			custom_tooltip = {
				text = indian_has_not_converted
				NOT = { has_character_flag = india_converted }
			}
		}
		effect = {
			if = {
				limit = { higher_tier_than = BARON }
				religion_authority = {
					modifier = ruler_converted_from
				}
			}
			religion = buddhist
			if = {
				limit = { higher_tier_than = BARON }
				hidden_tooltip = {
					religion_authority = {
						modifier = ruler_converted_to
					}
				}
			}
			set_character_flag = india_converted
			prestige = -500
			piety = 100
			hidden_tooltip = { character_event = { id = RoI.111 } } # Choose branch
		}
		ai_will_do = {
			factor = 0
		}
	}

	convert_to_jainism = {
		only_playable = yes
		icon_religion = jain

		filter = self
		ai_target_filter = self

		potential = {
			ai = no
			is_playable = yes
			has_dharmic_religion_trigger = yes
			NOT = { religion = jain }
			is_theocracy = no
		}
		allow = {
			is_adult = yes
			prestige = 500
			NOT = { trait = zealous }
			any_realm_province = {
				religion = jain
			}
			custom_tooltip = {
				text = indian_has_not_converted
				NOT = { has_character_flag = india_converted }
			}
		}
		effect = {
			if = {
				limit = { higher_tier_than = BARON }
				religion_authority = {
					modifier = ruler_converted_from
				}
			}
			religion = jain
			if = {
				limit = { higher_tier_than = BARON }
				hidden_tooltip = {
					religion_authority = {
						modifier = ruler_converted_to
					}
				}
			}
			set_character_flag = india_converted
			prestige = -500
			piety = 100
			hidden_tooltip = { character_event = { id = RoI.112 } } # Choose branch
		}
		ai_will_do = {
			factor = 0
		}
	}

	convert_indian_branch = {
		only_playable = yes

		filter = self
		ai_target_filter = self

		potential = {
			ai = no
			is_playable = yes
			is_adult = yes
			is_theocracy = no
			has_dharmic_religion_trigger = yes
		}
		allow = {
			NOT = { trait = zealous }
			prestige = 50
			custom_tooltip = {
				text = indian_has_not_converted
				NOT = { has_character_flag = india_branch_converted }
			}
		}
		effect = {
			set_character_flag = india_branch_converted
			prestige = -50
			piety = 25
			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
			}
		}
		ai_will_do = {
			factor = 0
		}
	}

	# Carolingian renaissance - Old Frankish conversion to French
	convert_to_french = {
		only_playable = yes

		filter = self
		ai_target_filter = self

		potential = {
			is_playable = yes
			culture = old_frankish
			capital_scope = {
				region = world_europe_west_francia
			}
			any_realm_province = {
				culture = frankish
			}
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			culture = old_frankish
		}
		effect = {
			culture = frankish
			any_courtier = {
				limit = {
					culture = old_frankish
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = frankish
			}
		}
		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

		filter = self
		ai_target_filter = self

		potential = {
			is_playable = yes
			culture = pictish
			capital_scope = {
				region = custom_scotland
			}
			any_realm_province = {
				culture = scottish
			}
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			culture = pictish
		}
		effect = {
			culture = scottish
			any_courtier = {
				limit = {
					culture = pictish
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = scottish
			}
		}
		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

		filter = self
		ai_target_filter = self

		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
			}
			NOT = { government = chinese_imperial_government }
		}
		effect = {
			any_courtier = {
				limit = {
					culture = ROOT
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = andalusian_arabic
			}
			culture = andalusian_arabic
		}
		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

		filter = self
		ai_target_filter = self

		potential = {
			is_playable = yes
			culture = visigothic
			religion_group = christian
			capital_scope = {
				region = custom_castillian
			}
			any_realm_province = {
				culture = castillan
			}
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			culture = visigothic
		}
		effect = {
			any_courtier = {
				limit = {
					culture = ROOT
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = castillan
			}
			culture = castillan
		}
		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

		filter = self
		ai_target_filter = self

		potential = {
			is_playable = yes
			culture = visigothic
			religion_group = christian
			capital_scope = {
				region = custom_catalan
			}
			any_realm_province = {
				culture = catalan
			}
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			culture = visigothic
		}
		effect = {
			any_courtier = {
				limit = {
					culture = ROOT
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = catalan
			}
			culture = catalan
		}
		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

		filter = self
		ai_target_filter = self

		potential = {
			is_playable = yes
			OR = {
				culture = suebi
				culture = visigothic
			}
			religion_group = christian
			capital_scope = {
				region = custom_portuguese
			}
			any_realm_province = {
				culture = portuguese
			}
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			OR = {
				culture = suebi
				culture = visigothic
			}
		}
		effect = {
			any_courtier = {
				limit = {
					culture = ROOT
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = portuguese
			}
			culture = portuguese
		}
		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

		filter = self
		ai_target_filter = self

		potential = {
			is_playable = yes
			OR = {
				culture = old_frankish
				culture = old_saxon
				culture = frisian
			}
			capital_scope = {
				region = custom_frisia
			}
			any_realm_province = {
				culture = dutch
			}
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			culture = ROOT
		}
		effect = {
			any_courtier = {
				limit = {
					culture = ROOT
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = dutch
			}
			culture = dutch
		}
		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

		filter = self
		ai_target_filter = self

		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 }
				}
			}
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			culture = lombard
			capital_scope = {
				region = world_europe_south_italy
			}
			any_realm_province = {
				culture = italian
			}
		}
		effect = {
			any_courtier = {
				limit = {
					culture = ROOT
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = italian
			}
			culture = italian
		}
		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

		filter = self
		ai_target_filter = self

		potential = {
			is_playable = yes
			religion_group = christian
			culture = visigothic
			capital_scope = {
				region = world_europe_west_francia
			}
			any_realm_province = {
				culture = occitan
			}
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			culture = ROOT
		}
		effect = {
			any_courtier = {
				limit = {
					culture = ROOT
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = occitan
			}
			culture = occitan
		}
		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
				}
			}
		}
	}

	# East Slavic character may convert to Russian
	convert_to_russian = {
		only_playable = yes

		filter = self
		ai_target_filter = self

		potential = {
			is_playable = yes
			culture_group = east_slavic
			NOT = { culture = russian }
			any_realm_province = {
				culture = russian
			}
			NOT = { government = chinese_imperial_government }
		}
		allow = {
			culture_group = east_slavic
			NOT = { culture = russian }
		}
		effect = {
			any_courtier = {
				limit = {
					culture_group = east_slavic
					NOT = { culture = russian }
					employer = { character = ROOT }
					dynasty = ROOT
				}
				culture = russian
			}
			culture = russian
		}
		ai_will_do = {
			factor = 1

			modifier = {
				factor = 0.2 # Slow it down a bit
			}

			modifier = {
				factor = 0.01
				capital_scope = {
					NOT = { culture = russian }
				}
			}
			modifier = {
				factor = 2.0
				liege = { culture = russian }
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 2
					culture = russian
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 4
					culture = russian
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 6
					culture = russian
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 8
					culture = russian
				}
			}
			modifier = {
				factor = 1.1
				num_culture_realm_provs = {
					value = 10
					culture = russian
				}
			}
		}
	}

	convert_to_spouse_religion= {
		only_playable = yes

		filter = home_court
		ai_target_filter = home_court

		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

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


		ai_will_do = {
			factor = 0
		}
	}
}

decisions = {
	# convert_to_attacker_religion removed due to the new way in which EMF holy wars work (as well as the decision having
	# been somewhat flawed)

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

		potential = {
			is_playable = yes
			religion = iconoclast
			has_dlc = "Charlemagne"
			has_landed_title = e_byzantium
			NOT = { has_character_flag = renounced_iconoclasm }
		}
		allow = {
			has_landed_title = e_byzantium
			has_landed_title = c_byzantion
			any_realm_province = { religion = orthodox }
			NOT = { trait = zealous }
			war = no
			NOT = { year = 900 }
		}
		effect = {
			set_character_flag = renounced_iconoclasm
			religion_authority = {
				modifier = ruler_converted_from
			}
			religion = orthodox
			hidden_tooltip = {
				religion_authority = {
					modifier = ruler_converted_to
				}
			}
			custom_tooltip = {
				text = renounce_iconoclasm_muslim_opinion_tooltip
				hidden_tooltip = {
					generate_tooltip = no
					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 = orthodox }
							add_province_modifier = {
								name = appeased_religious
								months = 60
							}
						}
					}
				}
			}
			k_papal_state = {
				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 }
				}
			}
			if = {
				limit = { NOT = { is_title_active = k_orthodox } }
				activate_title = { title = k_orthodox status = yes }
			}
			d_iconoclast = {
				holder_scope = {
					k_orthodox = {
						grant_title = PREV
					}
					unsafe_religion = orthodox  # Use this effect with care
					set_defacto_liege = ROOT
				}
				hidden_tooltip = { emf_unsafe_destroy_title = yes }
			}
			activate_title = { title = d_iconoclast status = no }
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.1 # slow it down
			}
			modifier = {
				factor = 3
				trait = cynical
			}
		}
	}
}
