﻿#Needs to be loaded after
# 	* medium_gold_value (01_dynamic_values)

#Religious war CB levels
faith_fully_accepted_level = 0
faith_astray_level = 1
faith_hostile_level = 2
faith_evil_level = 3

faith_hostility_prevents_marriage_level = faith_evil_level

religious_cb_enabled_hostility_level = faith_hostile_level
religious_cb_evil_hostility_level = faith_evil_level

religious_cb_ally_prestige_kingdom = 500
religious_cb_ally_prestige_duchy = 200
religious_cb_ally_prestige_county = 100

religious_cb_piety_gain_evil_foe = 200
religious_cb_piety_gain_empire = 200
religious_cb_piety_loss_empire = -200
religious_cb_piety_gain_kingdom = 150
religious_cb_piety_loss_kingdom = -150
religious_cb_piety_gain_duchy = 100
religious_cb_piety_loss_duchy = -100
religious_cb_piety_gain_county = 50
religious_cb_piety_loss_county = -50
religious_cb_piety_white_peace = -50

excommunication_cb_piety_change_multiplier = 4
excommunication_cb_piety_white_peace = -50

faith_doctrine_cost_none = 0
faith_doctrine_cost_low = 200
faith_doctrine_cost_mid = 400
faith_doctrine_cost_high = 600
faith_doctrine_cost_massive = 1000

faith_tenet_cost_none = 0
faith_tenet_cost_low = 500
faith_tenet_cost_mid = 1000
faith_tenet_cost_high = 1500
faith_tenet_cost_massive = 2000

faith_unchanged_doctrine_cost_none = 0
faith_unchanged_doctrine_cost_mult = 0.5
faith_changed_doctrine_cost_mult_two_step = 1.50
faith_changed_doctrine_cost_mult_three_step = 2.25
faith_changed_doctrine_cost_mult_four_step = 3.50

hostility_multiplier_pluralism = 0.5
hostility_multiplier_righteous = 1
hostility_multiplier_fundamentalist = 2
hostility_multiplier_reduction_adaptive = -0.25

regional_heresy_factor = {
	if = {
		limit = { has_game_rule = default_regional_heresy }
		value = 5
	}
	else_if = {
		limit = { has_game_rule = strict_regional_heresy }
		value = 200
	}
	else = {
		value = 1
	}
}

meditation_duration = 185 # In days

faction_county_opinion_astray = {
	value = county_opinion
	multiply = -1.0
}
faction_county_opinion_hostile = {
	value = county_opinion
	multiply = -2.5
}
faction_county_opinion_evil = {
	value = county_opinion
	multiply = -5.0
}

head_of_faith_selection_weight = {
	value = 1

	# Strong weight for preferred gender
	if = {
		limit = {
			faith = { has_doctrine = doctrine_gender_male_dominated }
			is_male = yes
		}
		add = 50
	}
	else_if = {
		limit = {
			faith = { has_doctrine = doctrine_gender_female_dominated }
			is_female = yes
		}
		add = 50
	}

	# Bonus for holding land, especially if it is a holy site.
	if = {
		limit = {
			any_sub_realm_barony = {
				is_holy_site_of = root.faith
			}
		}
		add = 40
	}
	add = {
		value = highest_held_title_tier
		multiply = 20
	}

	# Bonus for piousness/learnedness
	add = {
		value = num_virtuous_traits
		multiply = 30
	}
	add = {
		value = num_sinful_traits
		multiply = -30
	}
	add = {
		value = piety_level
		multiply = 10
	}
	add = {
		value = learning
		multiply = 2
	}
	add = {
		value = diplomacy
		multiply = 1
	}	
}
################
# Demand Conversion chance calculation
################

#Calculated in scope:recipient
demand_conversion_learning_difference = {
	add = scope:actor.learning
	subtract = learning
	multiply = 5
}

demand_conversion_fervor_difference = {
	add = scope:actor.faith.fervor
	subtract = faith.fervor
}

demand_conversion_tenet_impact = {
	value = 0
	if = {
		limit = {
			faith = {
				has_doctrine_parameter = sanctioned_false_conversion
				NOT = { has_doctrine_parameter = unattractive_for_character_conversions }
			}
		}
		add = -20
	}
	if = {
		limit = {
			faith = { has_doctrine_parameter = tenet_adaptive_conversion_resistance }
		}
		add = -20
	}
	if = {
		limit = {
			faith = { has_doctrine_parameter = unattractive_for_character_conversions }
		}
		add = 20
	}
}

demand_conversion_likelihood_calculation = {
	#Five times actor's-recipient's learning
	add = demand_conversion_learning_difference

	#Calculate each faith's fervor
	add = demand_conversion_fervor_difference

	#Calculate various Doctrines and Tenets
	add = demand_conversion_tenet_impact

	if = {
		limit = {
			opinion = {
				target = scope:actor
				value < medium_negative_opinion
			}
		}
		add = -50
	}
	else_if = {
		limit = {
			opinion = {
				target = scope:actor
				value < neutral_opinion
			}
		}
		add = -25
	}
	else_if = {
		limit = {
			opinion = {
				target = scope:actor
				value >= medium_positive_opinion
			}
		}
		add = 50
	}
	else_if = {
		limit = {
			opinion = {
				target = scope:actor
				value > neutral_opinion
			}
		}
		add = 25
	}

	if = {
		limit = {
			scope:actor = { has_trait = savior }
		}
		add = 30
	}
	if = {
		limit = {
			scope:actor = { has_trait = divine_blood }
		}
		add = 15
	}
	
	if = {
		limit = {
			has_trait = zealous
		}
		add = -50
	}
	if = {
		limit = {
			has_trait = cynical
		}
		add = 30
	}

	if = {
		limit = {
			has_trait = heresiarch
		}
		add = -100
	}

	#Add value if refusing is a Crime
	if = {
		limit = {
			scope:actor = {
				refusing_conversion_is_crime_trigger = {
					CHARACTER = scope:recipient
				}
			}
		}
		add = 50
	}
	
	
		
	if = {
		limit = {
			scope:recipient = {
				has_dread_level_towards = {
					target = scope:actor
					level = 1
				}
			}
		}
		add = 10
	}
	if = {
		limit = {
			scope:recipient = {
				has_dread_level_towards = {
					target = scope:actor
					level = 2
				}
			}
		}
		add = 20
	}

	max = 100
}

demand_conversion_bribe_size = {
	value = medium_gold_value
}

demand_conversion_piety_cost = {
	value = medium_piety_value
}


#Religious Legal Pronouncement requirements
religious_legal_pronouncement_target_value = -20

religious_legal_pronouncement_sinful_value = {
	value = 0
	add = scope:recipient.num_sinful_traits
	multiply = 6
}

religious_legal_pronouncement_virtuous_value = {
	value = 0
	add = scope:recipient.num_virtuous_traits
	multiply = 5
}

religious_legal_pronouncement_requirements = {
	value = religious_legal_pronouncement_target_value
	add = religious_legal_pronouncement_sinful_value
	subtract = religious_legal_pronouncement_virtuous_value
	add = scope:actor.learning
}

religious_legal_pronouncement_learning_requirement = {
	value = 0
	subtract = religious_legal_pronouncement_sinful_value
	add = religious_legal_pronouncement_virtuous_value
	subtract = religious_legal_pronouncement_target_value
}

claim_piety_value = {
	value = {
		add = minor_piety_value
		multiply = 2
		if = {
			limit = {
				scope:target = {
					tier = tier_duchy
				}
			}
			multiply = 2
		}
		if = {
			limit = {
				scope:target = {
					tier = tier_kingdom
				}
			}
			multiply = 4
		}
		if = {
			limit = {
				scope:target = {
					tier = tier_empire
				}
			}
			multiply = 8
		}
		add = {
			value = scope:actor.sub_realm_size
			multiply = 10
		}
	}
}

minor_claim_piety_value = {
	value = minor_piety_value
	multiply = 2
}
medium_claim_piety_value = {
	value = minor_claim_piety_value
	multiply = 2
}
major_claim_piety_value = {
	value = medium_claim_piety_value
	multiply = 2
}
massive_claim_piety_value = {
	value = major_claim_piety_value
	multiply = 2
}
minor_claim_piety_loss = {
	value = 0
	subtract = minor_claim_piety_value
}
medium_claim_piety_loss = {
	value = 0
	subtract = medium_claim_piety_value
}
major_claim_piety_loss = {
	value = 0
	subtract = major_claim_piety_value
}
massive_claim_piety_loss = {
	value = 0
	subtract = massive_claim_piety_value
}

#GHW Targeting Multipliers
#Up the base size of kingdoms with an existing same-faith ruler a bit:
ghw_target_existing_same_faith_ruler = 20
#Prioritise reclaiming lands that are core rather than just new large kingdoms:
ghw_target_heartlands = 40
ghw_target_frontier = 30
ghw_target_fringe = 20
ghw_target_stretch = 10
#Always drastically buff any kingdom containing an uncontrolled holy site:
ghw_target_has_holy_site = 50
#Targets that should always be priorities if not controlled:
ghw_target_key_religious_holding = 100
#Distance modifiers stack:
ghw_target_distance_01_reduction = 0.8
ghw_target_distance_02_reduction = 0.8
ghw_target_distance_03_reduction = 0.8
ghw_target_distance_01_threshold = 722500
ghw_target_distance_02_threshold = 1445000
ghw_target_distance_03_threshold = 2167500

# Referenced by code when building list of ghw targets
#Logic reworked by Ewan Cowhig Croft
great_holy_war_target_kingdom_weight = {
	#WEIGHTING PROCESS
	#1. Check how many individual counties within a de jure kingdom have a top-liege with an eligible faith for GHWing. Boost the count a little for kingdoms with existing same-faith monarchs.
	#2. Modify the count by region location & relative importance to the Faith (is this kingdom in the heartlands of the faith, or one of an increasing gradiant of frontier regions?).
	#3. Modify the count by region distance from the HoF's capital, or a fallback holy site.
	#4. Weight up kingdoms containing holy sites directly.
	#5. Weight up special priority targets (e.g., Jerusalem, Mecca) directly.

	### 1 ###
	#Is the target kingdom a viable GHW target?
	every_in_de_jure_hierarchy = {
		continue = { tier > tier_county }	#Check individual counties within the potential target de jure kingdom.
		limit = {	#For every county with a GHWable liege...
			tier = tier_county
			scope:the_faith = {
					is_hostile_enough_for_holy_war_trigger = { FAITH = prev.holder.top_liege.faith }
			}
		}
		add = 1	#... Add 1 to the weighting.
	}
	#Weight up the kingdom if it either has an existing same-faith holder, or at least a same-faith claimant.
	if = {
		limit = {
			OR = {
				AND = {
					exists = holder
					holder.faith = scope:the_faith
				}
				any_claimant = {
					exists = this
					faith = scope:the_faith
					is_available_adult = no
				}
			}
		}
		multiply = ghw_target_existing_same_faith_ruler
	}
	
	### 2 ###
	###Abrahamics & Zoroastrians
	#Documentation = {
		#Avoid adding lots of reckless GHW stretch goals, as it'll mess up the targeting if every religion has a dozen apiece.

		#Below is an organised, prioritised list of the different target regions for each religion. Update it as you make changes.
		#Christianity
		#ghw_region_northern_italy					#heartlands
		#ghw_region_thessalonika					#heartlands
		#ghw_region_ethiopia						#heartlands
		#ghw_region_france							#heartlands
		#ghw_region_germany							#heartlands
		#ghw_region_greece							#heartlands
		#ghw_region_england							#heartlands
		#ghw_region_caucasus						#heartlands
		#ghw_region_anatolia						#frontier
		#ghw_region_near_east						#frontier
		#ghw_region_mediterranean					#frontier
		#ghw_region_balkans							#frontier
		#ghw_region_holy_land						#frontier
		#ghw_region_iberia							#frontier
		#ghw_region_celtic							#fringe
		#ghw_region_germanic						#fringe
		#ghw_region_central_european				#fringe
		#ghw_region_baltic							#stretch
		
		#Islam
		#ghw_region_holy_land						#heartlands
		#ghw_region_arabia							#heartlands
		#ghw_region_near_east						#heartlands
		#ghw_region_egypt							#heartlands
		#ghw_region_persia							#heartlands
		#ghw_region_north_africa					#heartlands
		#ghw_region_sicily							#frontier
		#ghw_region_iberia							#frontier
		#ghw_region_anatolia						#frontier
		#ghw_region_afghanistan						#frontier
		#ghw_region_the_sahel						#fringe
		#ghw_region_mediterranean					#fringe
		#ghw_region_western_india					#fringe
		#ghw_region_southern_france					#fringe

		#Yazidism
		#ghw_region_kurdistan						#heartlands
		#ghw_region_southern_middle_east			#frontier
		#ghw_region_eastern_middle_east				#frontier
		#ghw_region_caucasus						#frontier
		#ghw_region_caspian_steppe					#fringe
		#ghw_region_arabia							#fringe
		#ghw_region_holy_land						#fringe

		#Judaism
		#ghw_region_holy_land						#heartlands
		#ghw_region_arabia							#frontier
		#ghw_region_near_east						#frontier
		#ghw_region_egypt							#frontier
		#ghw_region_anatolia						#fringe
		#ghw_region_persia							#fringe
		#ghw_region_ethiopia						#fringe

		#Zoroastrianism/Dualism
		#ghw_region_persia							#heartlands
		#ghw_region_afghanistan						#frontier
		#ghw_region_near_east						#frontier
		#ghw_region_arabia							#fringe
		#ghw_region_holy_land						#fringe
		#ghw_region_anatolia						#fringe
		#ghw_region_mongolia						#fringe
		#ghw_region_western_india					#fringe

		#Norse Paganism
		#ghw_region_scandinavia						#heartlands
		#ghw_region_britannia						#frontier
		#ghw_region_saxony							#frontier
		#ghw_region_russia							#frontier
		#ghw_region_baltic							#fringe
		#ghw_region_poland							#fringe
		#ghw_region_thessalonika					#stretch

		#Baltic Paganism
		#ghw_region_baltic							#heartlands
		#ghw_region_poland							#frontier
		#ghw_region_russia							#frontier
		#ghw_region_scandinavia						#fringe
		#ghw_region_steppe							#fringe
		#ghw_region_hungary							#fringe

		#Slavic Paganism
		#ghw_region_wendish_lands					#heartlands
		#ghw_region_balkans							#heartlands
		#ghw_region_russia							#heartlands
		#ghw_region_hungary							#frontier
		#ghw_region_steppe							#frontier
		#ghw_region_mainland_greece					#fringe
		#ghw_region_germany							#fringe
		#ghw_region_italy							#stretch

		#Finnish Paganism
		#ghw_region_finland_&_estonia				#heartlands
		#ghw_region_northern_russia					#heartlands
		#ghw_region_steppe							#heartlands
		#ghw_region_scandinavia						#frontier
		#ghw_region_baltic							#frontier
		#ghw_region_southern_russia					#frontier
		#ghw_region_siberia							#frontier
		#ghw_region_transoxiana						#fringe
		#ghw_region_mongolia						#fringe

		#Tengri Paganism
		#ghw_region_mongolia						#heartlands
		#ghw_region_siberia							#heartlands
		#ghw_region_steppe							#heartlands
		#ghw_region_russia							#frontier
		#ghw_region_transoxiana						#frontier
		#ghw_region_hungary							#frontier
		#ghw_region_tibet							#fringe
		#ghw_region_wendish_lands					#fringe

		#Magyar Paganism
		#ghw_region_hungary							#heartlands
		#ghw_region_balkans							#frontier
		#ghw_region_crimea							#frontier
		#ghw_region_poland_bohemia_bavaria			#frontier
		#ghw_region_southern_russia					#frontier
		#ghw_region_mainland_greece					#fringe
		#ghw_region_baltic							#fringe

		#Bon Paganism, Qiangicism, Donyipoloism, & Mundhumism
		#ghw_region_tibet							#heartlands
		#ghw_region_northern_india					#frontier
		#ghw_region_khotan							#frontier
		#ghw_region_mongolia						#fringe
		#ghw_region_transoxiana						#fringe
		#ghw_region_southern_india					#stretch

		#Mande Paganism & Senegambian Paganism
		#ghw_region_the_sahel						#heartlands
		#ghw_region_subsahelian_africa				#frontier
		#ghw_region_north_african_interior			#frontier
		#ghw_region_western_sahara					#frontier
		#ghw_region_north_africa					#fringe

		#Hausan Paganism
		#ghw_region_north_african_interior			#heartlands
		#ghw_region_the_sahel						#frontier
		#ghw_region_subsahelian_africa				#frontier
		#ghw_region_ethiopia						#frontier
		#ghw_region_eastern_sahara					#frontier
		#ghw_region_horn_of_africa					#fringe
		#ghw_region_egypt_et_al						#fringe
		#ghw_region_north_africa					#fringe

		#Akan Paganism & Yoruba Paganism
		#ghw_region_subsahelian_africa				#heartlands
		#ghw_region_the_sahel						#frontier
		#ghw_region_north_african_interior			#frontier
		#ghw_region_western_sahara					#frontier
		#ghw_region_north_africa					#fringe

		#Kushite Paganism
		#ghw_region_egypt_et_al						#heartlands
		#ghw_region_north_african_interior			#frontier
		#ghw_region_ethiopia						#frontier
		#ghw_region_horn_of_africa					#frontier
		#ghw_region_the_sahel						#fringe
		#ghw_region_subsahelian_africa				#fringe
		#ghw_region_eastern_sahara					#fringe
		#ghw_region_north_africa					#fringe
		#ghw_region_holy_land						#stretch
		#ghw_region_arabia							#stretch

		#Waaqi Paganism
		#ghw_region_horn_of_africa					#heartlands
		#ghw_region_ethiopia						#frontier
		#ghw_region_egypt_et_al						#frontier
		#ghw_region_arabia							#frontier
		#ghw_region_north_african_interior			#fringe
		#ghw_region_holy_land						#fringe

		#Zunist Paganism
		#ghw_region_afghanistan						#heartlands
		#ghw_region_western_india					#frontier
		#ghw_region_persia							#frontier
		#ghw_region_transoxiana						#frontier
		#ghw_region_caucasus						#fringe
		#ghw_region_holy_land						#fringe
		#ghw_region_near_east						#fringe
		#ghw_region_southwestern_india				#fringe
		#ghw_region_egypt							#stretch

		#Hellenic Paganism
		#ghw_region_mainland_greece					#heartlands
		#ghw_region_italy							#heartlands
		#ghw_region_anatolia						#frontier
		#ghw_region_balkans							#frontier
		#ghw_region_near_east						#frontier
		#ghw_region_holy_land						#fringe
		#ghw_region_egypt							#fringe
		#ghw_region_north_africa					#fringe
		#ghw_region_southern_france					#fringe

		#Hinduism
		#Hinduism prioritises the Sacred River above the rest of the sub-continent.
		#ghw_region_the_ganges						#heartlands
		#ghw_region_non_ganges_india				#frontier
		#ghw_region_tibet							#fringe
		#ghw_region_afghanistan						#fringe
		#ghw_region_persia							#fringe

		#Jainism
		#How did you even *manage* to get a game that needs this?
		#ghw_region_gujarat_&_rajputana				#heartlands
		#ghw_region_non_gujarat_or_rajputana_india	#frontier
		#ghw_region_tibet							#fringe
		#ghw_region_afghanistan						#fringe
		#ghw_region_persia							#fringe

		#Buddhism Theravada
		#ghw_region_lanka_&_bengal					#heartlands
		#ghw_region_middle_india					#frontier
		#ghw_region_western_india					#fringe

		#Buddhism Mahayana & Vajrayana
		#ghw_region_tibet							#heartlands
		#ghw_region_mongolia						#heartlands
		#ghw_region_khotan							#frontier
		#ghw_region_siberia							#frontier
		#ghw_region_transoxiana						#fringe
		#ghw_region_afghanistan						#fringe

		#Taoism
		#ghw_region_mongolia						#heartlands
		#ghw_region_siberia							#frontier
		#ghw_region_tibet							#frontier
		#ghw_region_north_eastern_india				#fringe
	#}

	#Christian heartlands
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = {
						OR = {
							geographical_region = ghw_region_northern_italy
							geographical_region = ghw_region_france
							geographical_region = ghw_region_germany
							geographical_region = ghw_region_england
						}
					}
					scope:the_faith.religion = religion:christianity_religion
					NOR = {
						scope:the_faith = faith:orthodox
						scope:the_faith = faith:iconoclast
						scope:the_faith = faith:coptic
						scope:the_faith = faith:armenian_apostolic
					}
				}
				AND = {
					title_capital_county.title_province = {
						OR = {
							geographical_region = ghw_region_thessalonika
							geographical_region = ghw_region_greece
						}
					}
					scope:the_faith.religion = religion:christianity_religion
					NOR = {
						scope:the_faith = faith:catholic
						scope:the_faith = faith:coptic
						scope:the_faith = faith:armenian_apostolic
					}
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_ethiopia }
					scope:the_faith.religion = religion:christianity_religion
					NOR = {
						scope:the_faith = faith:catholic
						scope:the_faith = faith:orthodox
						scope:the_faith = faith:iconoclast
						scope:the_faith = faith:armenian_apostolic
					}
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_caucasus }
					scope:the_faith.religion = religion:christianity_religion
					NOR = {
						scope:the_faith = faith:catholic
						scope:the_faith = faith:orthodox
						scope:the_faith = faith:iconoclast
						scope:the_faith = faith:coptic
					}
				}
			}
		}
		multiply = ghw_target_heartlands
	}
	#Christian frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_anatolia }
					scope:the_faith.religion = religion:christianity_religion
					NOR = {
						scope:the_faith = faith:catholic
						scope:the_faith = faith:coptic
					}
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_near_east }
					scope:the_faith.religion = religion:christianity_religion
					NOT = { scope:the_faith = faith:coptic }
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_mediterranean }
					scope:the_faith.religion = religion:christianity_religion
					NOR = {
						scope:the_faith = faith:coptic
						scope:the_faith = faith:armenian_apostolic
					}
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_balkans }
					scope:the_faith.religion = religion:christianity_religion
					NOR = {
						scope:the_faith = faith:coptic
						scope:the_faith = faith:armenian_apostolic
					}
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_holy_land }
					scope:the_faith.religion = religion:christianity_religion
					NOT = { scope:the_faith = faith:coptic }
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_iberia }
					scope:the_faith.religion = religion:christianity_religion
					NOR = {
						scope:the_faith = faith:orthodox
						scope:the_faith = faith:iconoclast
						scope:the_faith = faith:coptic
						scope:the_faith = faith:armenian_apostolic
					}
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Christian fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_celtic }
					scope:the_faith.religion = religion:christianity_religion
					NOR = {
						scope:the_faith = faith:orthodox
						scope:the_faith = faith:iconoclast
						scope:the_faith = faith:coptic
						scope:the_faith = faith:armenian_apostolic
					}
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_germanic }
					scope:the_faith.religion = religion:christianity_religion
					NOR = {
						scope:the_faith = faith:orthodox
						scope:the_faith = faith:iconoclast
						scope:the_faith = faith:coptic
						scope:the_faith = faith:armenian_apostolic
					}
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_central_european }
					scope:the_faith.religion = religion:christianity_religion
					NOR = {
						scope:the_faith = faith:coptic
						scope:the_faith = faith:armenian_apostolic
					}
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Christian stretch goal
	if = {
		limit = {
			AND = {
				title_capital_county.title_province = { geographical_region = ghw_region_baltic }
				scope:the_faith.religion = religion:christianity_religion
				NOR = {
					scope:the_faith = faith:orthodox
					scope:the_faith = faith:iconoclast
					scope:the_faith = faith:coptic
					scope:the_faith = faith:armenian_apostolic
				}
			}
		}
		multiply = ghw_target_stretch
	}
	#Muslim heartlands
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_holy_land }
					scope:the_faith.religion = religion:islam_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_arabia }
					scope:the_faith.religion = religion:islam_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_near_east }
					scope:the_faith.religion = religion:islam_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_egypt }
					scope:the_faith.religion = religion:islam_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_persia }
					scope:the_faith.religion = religion:islam_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_north_africa }
					scope:the_faith.religion = religion:islam_religion
				}
			}
		}
		multiply = ghw_target_heartlands
	}
	#Muslim frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_sicily }
					scope:the_faith.religion = religion:islam_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_iberia }
					scope:the_faith.religion = religion:islam_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_anatolia }
					scope:the_faith.religion = religion:islam_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_afghanistan }
					scope:the_faith.religion = religion:islam_religion
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Muslim fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_the_sahel }
					scope:the_faith.religion = religion:islam_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_mediterranean }
					scope:the_faith.religion = religion:islam_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_western_india }
					scope:the_faith.religion = religion:islam_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_southern_france }
					scope:the_faith.religion = religion:islam_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Yazidi heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_kurdistan }
			scope:the_faith.religion = religion:yazidi_religion
		}
		multiply = ghw_target_heartlands
	}
	#Yazidi frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_southern_middle_east }
					scope:the_faith.religion = religion:yazidi_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_eastern_middle_east }
					scope:the_faith.religion = religion:yazidi_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_caucasus }
					scope:the_faith.religion = religion:yazidi_religion
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Yazidi fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_caspian_steppe }
					scope:the_faith.religion = religion:yazidi_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_arabia }
					scope:the_faith.religion = religion:yazidi_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_holy_land }
					scope:the_faith.religion = religion:yazidi_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Jewish heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_holy_land }
			scope:the_faith.religion = religion:judaism_religion
		}
		multiply = ghw_target_heartlands
	}
	#Jewish frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_arabia }
					scope:the_faith.religion = religion:judaism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_near_east }
					scope:the_faith.religion = religion:judaism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_egypt }
					scope:the_faith.religion = religion:judaism_religion
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Jewish fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_anatolia }
					scope:the_faith.religion = religion:judaism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_persia }
					scope:the_faith.religion = religion:judaism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_ethiopia }
					scope:the_faith.religion = religion:judaism_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Zoroastrian/Dualist heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_persia }
			OR = {
				scope:the_faith.religion = religion:zoroastrianism_religion
				scope:the_faith.religion = religion:dualism_religion
			}
		}
		multiply = ghw_target_heartlands
	}
	#Zoroastrian/Dualist frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_afghanistan }
					OR = {
						scope:the_faith.religion = religion:zoroastrianism_religion
						scope:the_faith.religion = religion:dualism_religion
					}
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_near_east }
					OR = {
						scope:the_faith.religion = religion:zoroastrianism_religion
						scope:the_faith.religion = religion:dualism_religion
					}
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Zoroastrian/Dualist fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_arabia }
					OR = {
						scope:the_faith.religion = religion:zoroastrianism_religion
						scope:the_faith.religion = religion:dualism_religion
					}
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_holy_land }
					OR = {
						scope:the_faith.religion = religion:zoroastrianism_religion
						scope:the_faith.religion = religion:dualism_religion
					}
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_anatolia }
					OR = {
						scope:the_faith.religion = religion:zoroastrianism_religion
						scope:the_faith.religion = religion:dualism_religion
					}
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_mongolia }
					OR = {
						scope:the_faith.religion = religion:zoroastrianism_religion
						scope:the_faith.religion = religion:dualism_religion
					}
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_western_india }
					OR = {
						scope:the_faith.religion = religion:zoroastrianism_religion
						scope:the_faith.religion = religion:dualism_religion
					}
				}
			}
		}
		multiply = ghw_target_fringe
	}
	
	###Pagans
	#Norse heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_scandinavia }
			scope:the_faith.religion = religion:germanic_religion
		}
		multiply = ghw_target_heartlands
	}
	#Norse frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_britannia }
					scope:the_faith.religion = religion:germanic_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_saxony }
					scope:the_faith.religion = religion:germanic_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_russia }
					scope:the_faith.religion = religion:germanic_religion
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Norse fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_baltic }
					scope:the_faith.religion = religion:germanic_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_poland }
					scope:the_faith.religion = religion:germanic_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Norse stretch goal
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_thessalonika }
			scope:the_faith.religion = religion:germanic_religion
		}
		multiply = ghw_target_stretch
	}
	#Baltic heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_baltic }
			scope:the_faith.religion = religion:baltic_religion
		}
		multiply = ghw_target_heartlands
	}
	#Baltic frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_poland }
					scope:the_faith.religion = religion:baltic_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_russia }
					scope:the_faith.religion = religion:baltic_religion
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Baltic fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_scandinavia }
					scope:the_faith.religion = religion:baltic_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_steppe }
					scope:the_faith.religion = religion:baltic_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_hungary }
					scope:the_faith.religion = religion:baltic_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Slavic heartlands
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_wendish_lands }
					scope:the_faith.religion = religion:slavic_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_balkans }
					scope:the_faith.religion = religion:slavic_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_russia }
					scope:the_faith.religion = religion:slavic_religion
				}
			}
		}
		multiply = ghw_target_heartlands
	}
	#Slavic frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_hungary }
					scope:the_faith.religion = religion:slavic_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_steppe }
					scope:the_faith.religion = religion:slavic_religion
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Slavic fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_mainland_greece }
					scope:the_faith.religion = religion:slavic_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_germany }
					scope:the_faith.religion = religion:slavic_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Slavic stretch goal
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_italy }
			scope:the_faith.religion = religion:slavic_religion
		}
		multiply = ghw_target_stretch
	}
	#Finnish heartlands
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_finland_&_estonia }
					scope:the_faith.religion = religion:finno_ugric_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_northern_russia }
					scope:the_faith.religion = religion:finno_ugric_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_steppe }
					scope:the_faith.religion = religion:finno_ugric_religion
				}
			}
		}
		multiply = ghw_target_heartlands
	}
	#Finnish frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_scandinavia }
					scope:the_faith.religion = religion:finno_ugric_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_baltic }
					scope:the_faith.religion = religion:finno_ugric_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_southern_russia }
					scope:the_faith.religion = religion:finno_ugric_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_siberia }
					scope:the_faith.religion = religion:finno_ugric_religion
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Finnish fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_transoxiana }
					scope:the_faith.religion = religion:finno_ugric_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_mongolia }
					scope:the_faith.religion = religion:finno_ugric_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Tengri heartlands
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_mongolia }
					scope:the_faith.religion = religion:tengrism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_siberia }
					scope:the_faith.religion = religion:tengrism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_steppe }
					scope:the_faith.religion = religion:tengrism_religion
				}
			}
		}
		multiply = ghw_target_heartlands
	}
	#Tengri frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_russia }
					scope:the_faith.religion = religion:tengrism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_transoxiana }
					scope:the_faith.religion = religion:tengrism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_hungary }
					scope:the_faith.religion = religion:tengrism_religion
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Tengri fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_tibet }
					scope:the_faith.religion = religion:tengrism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_wendish_lands }
					scope:the_faith.religion = religion:tengrism_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Magyar heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_hungary }
			scope:the_faith.religion = religion:magyar_religion
		}
		multiply = ghw_target_heartlands
	}
	#Magyar frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_balkans }
					scope:the_faith.religion = religion:magyar_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_crimea }
					scope:the_faith.religion = religion:magyar_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_poland_bohemia_bavaria }
					scope:the_faith.religion = religion:magyar_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_southern_russia }
					scope:the_faith.religion = religion:magyar_religion
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Magyar fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_mainland_greece }
					scope:the_faith.religion = religion:magyar_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_baltic }
					scope:the_faith.religion = religion:magyar_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Bon/Qiangicism/Donyipoloism/Mundhumism heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_tibet }
			OR = {
				scope:the_faith.religion = religion:bon_religion
				scope:the_faith.religion = religion:tani_religion
				scope:the_faith.religion = religion:mundhum_religion
				scope:the_faith.religion = religion:qiangic_religion
			}
		}
		multiply = ghw_target_heartlands
	}
	#Bon/Qiangicism/Donyipoloism/Mundhumism frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_northern_india }
					OR = {
						scope:the_faith.religion = religion:bon_religion
						scope:the_faith.religion = religion:tani_religion
						scope:the_faith.religion = religion:mundhum_religion
						scope:the_faith.religion = religion:qiangic_religion
					}
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_khotan }
					OR = {
						scope:the_faith.religion = religion:bon_religion
						scope:the_faith.religion = religion:tani_religion
						scope:the_faith.religion = religion:mundhum_religion
						scope:the_faith.religion = religion:qiangic_religion
					}
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Bon/Qiangicism/Donyipoloism/Mundhumism fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_mongolia }
					OR = {
						scope:the_faith.religion = religion:bon_religion
						scope:the_faith.religion = religion:tani_religion
						scope:the_faith.religion = religion:mundhum_religion
						scope:the_faith.religion = religion:qiangic_religion
					}
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_transoxiana }
					OR = {
						scope:the_faith.religion = religion:bon_religion
						scope:the_faith.religion = religion:tani_religion
						scope:the_faith.religion = religion:mundhum_religion
						scope:the_faith.religion = religion:qiangic_religion
					}
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Bon/Qiangicism/Donyipoloism/Mundhumism stretch goal
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_southern_india }
			OR = {
				scope:the_faith.religion = religion:bon_religion
				scope:the_faith.religion = religion:tani_religion
				scope:the_faith.religion = religion:mundhum_religion
				scope:the_faith.religion = religion:qiangic_religion
			}
		}
		multiply = ghw_target_stretch
	}
	#Mande Paganism & Senegambian Paganism heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_the_sahel }
			OR = {
				scope:the_faith.religion = religion:west_african_roog_religion
				scope:the_faith.religion = religion:west_african_religion
			}
		}
		multiply = ghw_target_heartlands
	}
	#Mande Paganism & Senegambian Paganism frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_subsahelian_africa }
					OR = {
						scope:the_faith.religion = religion:west_african_roog_religion
						scope:the_faith.religion = religion:west_african_religion
					}
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_north_african_interior }
					OR = {
						scope:the_faith.religion = religion:west_african_roog_religion
						scope:the_faith.religion = religion:west_african_religion
					}
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_western_sahara }
					OR = {
						scope:the_faith.religion = religion:west_african_roog_religion
						scope:the_faith.religion = religion:west_african_religion
					}
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Mande Paganism & Senegambian Paganism fringe
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_north_africa }
			OR = {
				scope:the_faith.religion = religion:west_african_roog_religion
				scope:the_faith.religion = religion:west_african_religion
			}
		}
		multiply = ghw_target_fringe
	}
	#Hausan Paganism heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_north_african_interior }
			scope:the_faith.religion = religion:west_african_bori_religion
		}
		multiply = ghw_target_heartlands
	}
	#Hausan Paganism frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_the_sahel }
					scope:the_faith.religion = religion:west_african_bori_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_subsahelian_africa }
					scope:the_faith.religion = religion:west_african_bori_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_ethiopia }
					scope:the_faith.religion = religion:west_african_bori_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_eastern_sahara }
					scope:the_faith.religion = religion:west_african_bori_religion
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Hausan Paganism fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_horn_of_africa }
					scope:the_faith.religion = religion:west_african_bori_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_egypt_et_al }
					scope:the_faith.religion = religion:west_african_bori_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_north_africa }
					scope:the_faith.religion = religion:west_african_bori_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Akan Paganism & Yoruba Paganism heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_subsahelian_africa }
			OR = {
				scope:the_faith.religion = religion:akom_religion
				scope:the_faith.religion = religion:west_african_orisha_religion
			}
		}
		multiply = ghw_target_heartlands
	}
	#Akan Paganism & Yoruba Paganism frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_the_sahel }
					OR = {
						scope:the_faith.religion = religion:akom_religion
						scope:the_faith.religion = religion:west_african_orisha_religion
					}
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_north_african_interior }
					OR = {
						scope:the_faith.religion = religion:akom_religion
						scope:the_faith.religion = religion:west_african_orisha_religion
					}
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_western_sahara }
					OR = {
						scope:the_faith.religion = religion:akom_religion
						scope:the_faith.religion = religion:west_african_orisha_religion
					}
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Akan Paganism & Yoruba Paganism fringe
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_north_africa }
			OR = {
				scope:the_faith.religion = religion:akom_religion
				scope:the_faith.religion = religion:west_african_orisha_religion
			}
		}
		multiply = ghw_target_fringe
	}
	#Kushite Paganism heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_egypt_et_al }
			scope:the_faith.religion = religion:kushitism_religion
		}
		multiply = ghw_target_heartlands
	}
	#Kushite Paganism frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_north_african_interior }
					scope:the_faith.religion = religion:kushitism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_ethiopia }
					scope:the_faith.religion = religion:kushitism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_ethiopia }
					scope:the_faith.religion = religion:kushitism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_horn_of_africa }
					scope:the_faith.religion = religion:kushitism_religion
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Kushite Paganism fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_the_sahel }
					scope:the_faith.religion = religion:kushitism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_subsahelian_africa }
					scope:the_faith.religion = religion:kushitism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_north_africa }
					scope:the_faith.religion = religion:kushitism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_north_africa }
					scope:the_faith.religion = religion:kushitism_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Kushite Paganism stretch goals
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_holy_land }
					scope:the_faith.religion = religion:kushitism_religion
				}
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_arabia }
					scope:the_faith.religion = religion:kushitism_religion
				}
			}
		}
		multiply = ghw_target_stretch
	}
	#Waaqi Paganism heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_horn_of_africa }
			scope:the_faith.religion = religion:waaqism_religion
		}
		multiply = ghw_target_heartlands
	}
	#Waaqi Paganism frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_ethiopia }
					scope:the_faith.religion = religion:waaqism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_egypt_et_al }
					scope:the_faith.religion = religion:waaqism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_arabia }
					scope:the_faith.religion = religion:waaqism_religion
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Waaqi Paganism fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_north_african_interior }
					scope:the_faith.religion = religion:waaqism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_holy_land }
					scope:the_faith.religion = religion:waaqism_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Zunist heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_afghanistan }
			scope:the_faith.religion = religion:zunism_religion
		}
		multiply = ghw_target_heartlands
	}
	#Zunist frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_western_india }
					scope:the_faith.religion = religion:zunism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_persia }
					scope:the_faith.religion = religion:zunism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_transoxiana }
					scope:the_faith.religion = religion:zunism_religion
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Zunist fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_caucasus }
					scope:the_faith.religion = religion:zunism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_holy_land }
					scope:the_faith.religion = religion:zunism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_near_east }
					scope:the_faith.religion = religion:zunism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_southwestern_india }
					scope:the_faith.religion = religion:zunism_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Zunist stretch goal
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_egypt }
			scope:the_faith.religion = religion:zunism_religion
		}
		multiply = ghw_target_stretch
	}
	#Hellenic heartlands
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_mainland_greece }
					scope:the_faith.religion = religion:hellenism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_italy }
					scope:the_faith.religion = religion:hellenism_religion
				}
			}
		}
		multiply = ghw_target_heartlands
	}
	#Hellenic frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_anatolia }
					scope:the_faith.religion = religion:hellenism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_balkans }
					scope:the_faith.religion = religion:hellenism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_near_east }
					scope:the_faith.religion = religion:hellenism_religion
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Hellenic fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_holy_land }
					scope:the_faith.religion = religion:hellenism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_egypt }
					scope:the_faith.religion = religion:hellenism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_north_africa }
					scope:the_faith.religion = religion:hellenism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_southern_france }
					scope:the_faith.religion = religion:hellenism_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	
	###Eastern
	#Hindu heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_the_ganges }
			scope:the_faith.religion = religion:hinduism_religion
		}
		multiply = ghw_target_heartlands
	}
	#Hindu frontier
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_non_ganges_india }
			scope:the_faith.religion = religion:hinduism_religion
		}
		multiply = ghw_target_frontier
	}
	#Hindu fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_tibet }
					scope:the_faith.religion = religion:hinduism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_afghanistan }
					scope:the_faith.religion = religion:hinduism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_persia }
					scope:the_faith.religion = religion:hinduism_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Jain heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_gujarat_&_rajputana }
			scope:the_faith.religion = religion:jainism_religion
		}
		multiply = ghw_target_heartlands
	}
	#Jain frontier
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_non_gujarat_or_rajputana_india }
			scope:the_faith.religion = religion:jainism_religion
		}
		multiply = ghw_target_frontier
	}
	#Jain fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_tibet }
					scope:the_faith.religion = religion:jainism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_afghanistan }
					scope:the_faith.religion = religion:jainism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_persia }
					scope:the_faith.religion = religion:jainism_religion
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Theravada Buddhist heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_lanka_&_bengal }
			scope:the_faith.religion = religion:buddhism_religion
			NOR = {
				scope:the_faith = faith:mahayana
				scope:the_faith = faith:vajrayana
			}
		}
		multiply = ghw_target_heartlands
	}
	#Theravada Buddhist frontier
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_middle_india }
			scope:the_faith.religion = religion:buddhism_religion
			NOR = {
				scope:the_faith = faith:mahayana
				scope:the_faith = faith:vajrayana
			}
		}
		multiply = ghw_target_frontier
	}
	#Theravada Buddhist fringe
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_western_india }
			scope:the_faith.religion = religion:buddhism_religion
			NOR = {
				scope:the_faith = faith:mahayana
				scope:the_faith = faith:vajrayana
			}
		}
		multiply = ghw_target_fringe
	}
	#Mahayana & Vajrayana Buddhist heartlands
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_tibet }
					scope:the_faith.religion = religion:buddhism_religion
					NOT = { scope:the_faith = faith:theravada }
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_mongolia }
					scope:the_faith.religion = religion:buddhism_religion
					NOT = { scope:the_faith = faith:theravada }
				}
			}
		}
		multiply = ghw_target_heartlands
	}
	#Mahayana & Vajrayana Buddhist frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_khotan }
					scope:the_faith.religion = religion:buddhism_religion
					NOT = { scope:the_faith = faith:theravada }
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_siberia }
					scope:the_faith.religion = religion:buddhism_religion
					NOT = { scope:the_faith = faith:theravada }
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Mahayana & Vajrayana Buddhist fringe
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_transoxiana }
					scope:the_faith.religion = religion:buddhism_religion
					NOT = { scope:the_faith = faith:theravada }
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_afghanistan }
					scope:the_faith.religion = religion:buddhism_religion
					NOT = { scope:the_faith = faith:theravada }
				}
			}
		}
		multiply = ghw_target_fringe
	}
	#Taoist heartlands
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_mongolia }
			scope:the_faith.religion = religion:taoism_religion
		}
		multiply = ghw_target_heartlands
	}
	#Taoist frontier
	if = {
		limit = {
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_siberia }
					scope:the_faith.religion = religion:taoism_religion
				}
			}
			OR = {
				AND = {
					title_capital_county.title_province = { geographical_region = ghw_region_tibet }
					scope:the_faith.religion = religion:taoism_religion
				}
			}
		}
		multiply = ghw_target_frontier
	}
	#Taoist fringe
	if = {
		limit = {
			title_capital_county.title_province = { geographical_region = ghw_region_north_eastern_india }
			scope:the_faith.religion = religion:taoism_religion
		}
		multiply = ghw_target_fringe
	}

	### 3 ###
	#Factor in the potential target's distance from the faith.
	#Distance: Rome to Jerusalem-ish
	#If the HoF is landed, use them.
	if = {
		limit = {
			scope:the_faith.religious_head = { is_landed = yes }
		}
		if = {
			limit = {
				title_capital_county = {
					squared_distance >= {
						target = scope:the_faith.religious_head.capital_county
						value = ghw_target_distance_01_threshold
					}
				}
			}
			multiply = ghw_target_distance_01_reduction
		}
	}
	#Otherwise, use a preset fallback holy site.
	else = {
		if = {
			limit = { scope:the_faith.religion = religion:christianity_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_roma
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:islam_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_mecca
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:judaism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_jerusalem
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = {
				OR = {
					scope:the_faith.religion = religion:zoroastrianism_religion
					scope:the_faith.religion = religion:dualism_religion
				}
			}
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_baduspan
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:germanic_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_upland
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:baltic_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_braslau
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:slavic_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_kiev
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:finno_ugric_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_kakisalmi
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:tengrism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_qayaliq
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:magyar_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_visegrad
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = {
				OR = {
					scope:the_faith.religion = religion:bon_religion
					scope:the_faith.religion = religion:tani_religion
					scope:the_faith.religion = religion:mundhum_religion
					scope:the_faith.religion = religion:qiangic_religion
				}
			}
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_khotan
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		#Mande Paganism 
		if = {
			limit = { scope:the_faith.religion = religion:west_african_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_awkar
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		#Senegambian Paganism
		if = {
			limit = { scope:the_faith.religion = religion:west_african_roog_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_kasa
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		#Hausan Paganism
		if = {
			limit = { scope:the_faith.religion = religion:west_african_bori_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_daura
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		#Akan Paganism
		if = {
			limit = { scope:the_faith.religion = religion:akom_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_kumasi
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		#Yoruba Paganism
		if = {
			limit = { scope:the_faith.religion = religion:west_african_orisha_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_owu
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		#Kushite Paganism
		if = {
			limit = { scope:the_faith.religion = religion:kushitism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_aswan
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		#Waaqi Paganism
		if = {
			limit = { scope:the_faith.religion = religion: }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_mogadishu
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:zunism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_kabul
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:hellenism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_roma
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:hinduism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_mathura
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:jainism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_somnath
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:buddhism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_gaya
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:taoism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_wuluhai
							value = ghw_target_distance_01_threshold
						}
					}
				}
				multiply = ghw_target_distance_01_reduction
			}
		}
	}
	#Distance: Rome to Afghanistan-ish
	#If the HoF is landed, use them.
	if = {
		limit = {
			scope:the_faith.religious_head = { is_landed = yes }
		}
		if = {
			limit = {
				title_capital_county = {
					squared_distance >= {
						target = scope:the_faith.religious_head.capital_county
						value = ghw_target_distance_02_threshold
					}
				}
			}
			multiply = ghw_target_distance_02_reduction
		}
	}
	#Otherwise, use a preset fallback holy site.
	else = {
		if = {
			limit = { scope:the_faith.religion = religion:christianity_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_roma
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:islam_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_mecca
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:judaism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_jerusalem
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = {
				OR = {
					scope:the_faith.religion = religion:zoroastrianism_religion
					scope:the_faith.religion = religion:dualism_religion
				}
			}
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_baduspan
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:germanic_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_upland
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:baltic_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_braslau
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:slavic_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_kiev
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:finno_ugric_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_kakisalmi
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:tengrism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_qayaliq
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:magyar_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_visegrad
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = {
				OR = {
					scope:the_faith.religion = religion:bon_religion
					scope:the_faith.religion = religion:tani_religion
					scope:the_faith.religion = religion:mundhum_religion
					scope:the_faith.religion = religion:qiangic_religion
				}
			}
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_khotan
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		#Mande Paganism 
		if = {
			limit = { scope:the_faith.religion = religion:west_african_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_awkar
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		#Senegambian Paganism
		if = {
			limit = { scope:the_faith.religion = religion:west_african_roog_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_kasa
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		#Hausan Paganism
		if = {
			limit = { scope:the_faith.religion = religion:west_african_bori_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_daura
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		#Akan Paganism
		if = {
			limit = { scope:the_faith.religion = religion:akom_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_kumasi
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		#Yoruba Paganism
		if = {
			limit = { scope:the_faith.religion = religion:west_african_orisha_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_owu
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		#Kushite Paganism
		if = {
			limit = { scope:the_faith.religion = religion:kushitism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_aswan
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		#Waaqi Paganism
		if = {
			limit = { scope:the_faith.religion = religion: }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_mogadishu
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:zunism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_kabul
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:hellenism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_roma
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:hinduism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_mathura
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:jainism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_somnath
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:buddhism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_gaya
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:taoism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_wuluhai
							value = ghw_target_distance_02_threshold
						}
					}
				}
				multiply = ghw_target_distance_02_reduction
			}
		}
	}
	#Distance: Rome to Bengal-ish
	#If the HoF is landed, use them.
	if = {
		limit = {
			scope:the_faith.religious_head = { is_landed = yes }
		}
		if = {
			limit = {
				title_capital_county = {
					squared_distance >= {
						target = scope:the_faith.religious_head.capital_county
						value = ghw_target_distance_03_threshold
					}
				}
			}
			multiply = ghw_target_distance_03_reduction
		}
	}
	#Otherwise, use a preset fallback holy site.
	else = {
		if = {
			limit = { scope:the_faith.religion = religion:christianity_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_roma
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:islam_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_mecca
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:judaism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_jerusalem
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = {
				OR = {
					scope:the_faith.religion = religion:zoroastrianism_religion
					scope:the_faith.religion = religion:dualism_religion
				}
			}
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_baduspan
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:germanic_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_upland
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:baltic_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_braslau
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:slavic_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_kiev
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:finno_ugric_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_kakisalmi
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:tengrism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_qayaliq
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:magyar_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_visegrad
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = {
				OR = {
					scope:the_faith.religion = religion:bon_religion
					scope:the_faith.religion = religion:tani_religion
					scope:the_faith.religion = religion:mundhum_religion
					scope:the_faith.religion = religion:qiangic_religion
				}
			}
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_khotan
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		#Mande Paganism 
		if = {
			limit = { scope:the_faith.religion = religion:west_african_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_awkar
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		#Senegambian Paganism
		if = {
			limit = { scope:the_faith.religion = religion:west_african_roog_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_kasa
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		#Hausan Paganism
		if = {
			limit = { scope:the_faith.religion = religion:west_african_bori_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_daura
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		#Akan Paganism
		if = {
			limit = { scope:the_faith.religion = religion:akom_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_kumasi
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		#Yoruba Paganism
		if = {
			limit = { scope:the_faith.religion = religion:west_african_orisha_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_owu
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		#Kushite Paganism
		if = {
			limit = { scope:the_faith.religion = religion:kushitism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_aswan
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		#Waaqi Paganism
		if = {
			limit = { scope:the_faith.religion = religion: }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_mogadishu
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:zunism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_kabul
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:hellenism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_roma
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:hinduism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_mathura
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:jainism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_somnath
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:buddhism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_gaya
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
		if = {
			limit = { scope:the_faith.religion = religion:taoism_religion }
			if = {
				limit = {
					title_capital_county = {
						squared_distance >= {
							target = title:c_wuluhai
							value = ghw_target_distance_03_threshold
						}
					}
				}
				multiply = ghw_target_distance_03_reduction
			}
		}
	}

	### 4 ###
	if = {	#Always weight-up kingdoms containing holy sites.
		limit = {
			any_in_de_jure_hierarchy = {
				tier = tier_barony
				continue = { tier > tier_barony }
				is_holy_site_of = scope:the_faith
			}
		}
		multiply = ghw_target_has_holy_site
	}

	### 5 ###
	#Christian & Jewish preference for Jerusalem
	if = {
		limit = {
			#Belongs to a Christian or Jewish religion.
			OR = {
				scope:the_faith.religion = religion:christianity_religion
				scope:the_faith.religion = religion:judaism_religion
			}
			#Not a non-Catholic standard Christian faith.
			NOR = {
				scope:the_faith = faith:orthodox
				scope:the_faith = faith:iconoclast
				scope:the_faith = faith:coptic
				scope:the_faith = faith:armenian_apostolic
			}
			#Definitely actually considers Jerusalem holy.
			title:c_jerusalem = {
				any_in_de_jure_hierarchy = {
					tier = tier_barony
					continue = { tier > tier_barony }
					is_holy_site_of = scope:the_faith
				}
			}
			#There's a GHWable kingdom in the area.
			title_capital_county.title_province = { geographical_region = ghw_region_holy_land }
		}
		multiply = ghw_target_key_religious_holding
	}
	#Muslim preference for Mecca & Medina
	if = {
		limit = {
			#Belongs to an Islamic religion.
			scope:the_faith.religion = religion:islam_religion
			#Not the Qarmatians. Since they weren't exactly fans of the Holy Cities.
			NOT = { scope:the_faith = faith:qarmatian }
			#Definitely actually considers at least Mecca or Medina holy.
			OR = {
				title:c_mecca = {
					any_in_de_jure_hierarchy = {
						tier = tier_barony
						continue = { tier > tier_barony }
						is_holy_site_of = scope:the_faith
					}
				}
				title:c_medina = {
					any_in_de_jure_hierarchy = {
						tier = tier_barony
						continue = { tier > tier_barony }
						is_holy_site_of = scope:the_faith
					}
				}
			}
			#There's a GHWable kingdom in the area.
			title_capital_county.title_province = { geographical_region = ghw_region_arabia }
		}
		multiply = ghw_target_key_religious_holding
	}
}

great_holy_war_pledge_amount = {
	value = root.yearly_character_income
	min = 10
}

# Referenced in code; don't delete this. When determining GHW participation score, the character's score from the war is multiplied by this. ROOT is the character
ghw_score_mult = {
	value = 1
	if = {
		limit = {
			this = faith.religious_head
			faith = { has_doctrine = doctrine_spiritual_head } # Temporal heads get credit
		}
		value = 0
	}
}

# Referenced in code; don't delete this. When determining GHW participation score, the character's score percentage is capped at this. ROOT is the character
ghw_max_score_percentage = {
	value = 20
}

# Referenced in code; don't delete this
# When a holy war is declared, everyone of the defender's faith that passes can_defensively_join_holy_war will be scored using this
# Scores above 0 will join
# Scope is the potential joiner
# scope:attacker is the attacker
# scope:defender is the defender
holy_war_defensive_join_value = {
	add = {
		desc = "BASE_VALUE"
		value = -1
		format = "BASE_VALUE_FORMAT"
	}
}

# Root = faith
faith_conversion_fervor_mult = {
	value = define:NReligion|MAX_FERVOR
	subtract = fervor
	multiply = define:NReligion|FAITH_CREATION_FERVOR_DISCOUNT_PER_MISSING_FERVOR
	max = define:NReligion|FAITH_CREATION_FERVOR_DISCOUNT_MAX
	divide = define:NReligion|MAX_FERVOR
}

# Modify (multiply) the doctrine cost when creating a faith.
# The returned value is interpreted as a multiplicative modifier (e.g. 0.5 means +50% cost).
# scope:character = the creation character
# scope:old_faith = the faith the character is converting from
faith_creation_cost_mult = {
	subtract = {
		value = scope:old_faith.faith_conversion_fervor_mult
		desc = "faith_creation_cost_fervor_impact"
		format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
	}
}

# Modify (multiply) the doctrine cost when converting to a faith.
# The returned value is interpreted as a multiplicative modifier (e.g. 0.5 means +50% cost).
# scope:character = the converting character
# scope:new_faith = the faith the character is converting to
faith_conversion_cost_mult = {
	add = {
		value = scope:new_faith.faith_conversion_fervor_mult
		subtract = scope:character.faith.faith_conversion_fervor_mult
		desc = "faith_conversion_cost_fervor_difference"
		format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
	}
	
	if = {
		limit = {
			scope:character.learning > 0
		}
		subtract = {  # Try to always be cheaper than creating a new faith
			desc = "learning_modifier"
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = scope:character.learning
			divide = 100
		}
	}
	
	if = {
		limit = {
			scope:new_faith.religion = scope:character.faith.religion
		}
		subtract = {  # Try to always be cheaper than creating a new faith
			desc = "faith_conversion_cost_existing_faith"
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 0.5
		}
	}
	else = {
		subtract = {  # Try to always be cheaper than creating a new faith
			desc = "faith_conversion_cost_existing_faith"
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 0.35
		}
	}
	
	if = {
		limit = {
			scope:new_faith = { has_doctrine = doctrine_pluralism_pluralistic }
			scope:character.faith = { has_doctrine = doctrine_pluralism_pluralistic }
		}
		subtract = {  # Pluralistic faiths have it easier converting to each other
			desc = "faith_conversion_cost_pluralists"
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 0.25
		}
	}
	else_if = {
		limit = {
			scope:character.faith = { has_doctrine = doctrine_pluralism_pluralistic }
		}
		subtract = {  # Pluralistic faiths have it easier converting
			desc = "faith_conversion_cost_pluralist"
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 0.15
		}
	}

	###############################################################
	# Converting TO an unreformed faith often has steep penalties #
	###############################################################
	if = {
		limit = {
			scope:new_faith = {
				has_doctrine_parameter = unreformed
			}
		}

		# Massive penalty if your current faith is reformed.
		if = {
			limit = {
				scope:character = {
					faith = {
						NOT = { has_doctrine_parameter = unreformed }
					}
				}
			}
			add = {
				desc = "faith_conversion_cost_reformed_converting_to_unreformed"
				format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
				value = 5
			}
			
		}

		# Minor stacking penalties depending on (non-tribal) government form.
		if = {
			limit = {
				scope:character = {
					has_government = clan_government
				}
			}
			add = {
				desc = "faith_conversion_cost_clan_converting_to_unreformed"
				format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
				value = 0.25
			}
		}
		else_if = {
			limit = {
				scope:character = {
					has_government = feudal_government
				}
			}
			add = {
				desc = "faith_conversion_cost_feudal_converting_to_unreformed"
				format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
				value = 0.5
			}
		}
		else_if = {
			limit = {
				scope:character = {
					has_government = republic_government
				}
			}
			add = {
				desc = "faith_conversion_cost_republic_converting_to_unreformed"
				format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
				value = 0.75
			}
		}
	}

	##################################
	# Dead Religion/Faith penalty(s) #
	##################################
	if = { #More expensive to convert to a dead religion
		limit = {
			scope:new_faith = {
				religion = {
					any_faith = {
						count = all
						has_followers_trigger = no
					}
				}
			}
		}
		add = {
			desc = faith_conversion_cost_dead_religion
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 5
		}
	}

	#######################################
	# Switching religion/family penalties #
	#######################################
	#More expensive if you convert to a faith outside of your religion's family
	if = {
		limit = {
			scope:new_faith = {
				religion = { is_in_family = rf_abrahamic }
			}
			scope:character = {
				faith = {
					religion = {
						NOT = { is_in_family = rf_abrahamic }
					}
				}
			}
		}
		add = {
			desc = faith_conversion_cost_other_religion_family
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 2
		}
	}
	if = {
		limit = {
			scope:new_faith = {
				religion = { is_in_family = rf_eastern }
			}
			scope:character = {
				faith = {
					religion = {
						NOT = { is_in_family = rf_eastern }
					}
				}
			}
		}
		add = {
			desc = faith_conversion_cost_other_religion_family
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 2
		}
	}
	if = {
		limit = {
			scope:new_faith = {
				religion = { is_in_family = rf_pagan }
			}
			scope:character = {
				faith = {
					religion = { NOT = { is_in_family = rf_pagan } }
				}
			}
		}
		add = {
			desc = faith_conversion_cost_other_religion_family
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 2
		}
	}
	
	# Unreformed Faiths have an easier way converting to Organized faiths
	if = {
		limit = {
			scope:new_faith = {
				NOT = {
					has_doctrine_parameter = unreformed
				}
			}
			scope:character = {
				faith = {
					has_doctrine_parameter = unreformed
				}
			}
		}
		add = {
			desc = faith_conversion_cost_unreformed_to_organized
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = -2.25
		}
	}
	
	#More expensive to convert to something inside your religion family that's not the same religion
	if = {
		limit = {
			scope:new_faith = {
				religion = { is_in_family = rf_abrahamic }
			}
			scope:character = {
				faith = {
					religion = {
						is_in_family = rf_abrahamic
						NOT = { this = scope:new_faith.religion}
					}
				}
			}
		}
		add = {
			desc = faith_conversion_cost_inside_religion_family
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 1
		}
	}
	if = {
		limit = {
			scope:new_faith = {
				religion = { is_in_family = rf_eastern }
			}
			scope:character = {
				faith = {
					religion = {
						is_in_family = rf_eastern
						NOT = { this = scope:new_faith.religion}
					}
				}
			}
		}
		add = {
			desc = faith_conversion_cost_inside_religion_family
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 1
		}
	}
	if = {
		limit = {
			scope:new_faith = {
				religion = { is_in_family = rf_pagan }
			}
			scope:character = {
				faith = {
					religion = {
						is_in_family = rf_pagan
						NOT = { this = scope:new_faith.religion}
					}
				}
			}
		}
		add = {
			desc = faith_conversion_cost_inside_religion_family
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 1
		}
	}

	########################
	# Conversion Discounts #
	########################

	if = { #Cheaper if you are targeted by the new Faith in a defensive Holy War
		limit = {
			scope:character = {
				any_character_war = {
					using_holy_war_cb_trigger = yes
					is_defender = scope:character
				}
			}
		}
		if = { # Even cheaper if unreformed
			limit = {
				scope:new_faith = {
					NOT = { has_doctrine_parameter = unreformed }
				}
				scope:character = {
					faith = {
						has_doctrine_parameter = unreformed
					}
				}
			}
			subtract = {
				desc = faith_conversion_cost_unreformed_holy_war
				format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
				value = 2.5
			}
		}
		else = { # But still a sizable discount otherwise.
			subtract = {
				desc = faith_conversion_cost_holy_war
				format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
				value = 0.5
			}
		}
	}
	if = { #Cheaper if your spouse is of the faith
		limit = {
			scope:character = {
				any_spouse = {
					faith = scope:new_faith
				}
			}
		}
		if = { # Even cheaper if unreformed
			limit = {
				scope:new_faith = {
					NOT = { has_doctrine_parameter = unreformed }
				}
				scope:character = {
					faith = {
						has_doctrine_parameter = unreformed
					}
				}
			}
			subtract = {
				desc = faith_conversion_cost_unreformed_spouse
				format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
				value = 2.5
			}
		}
		else = { # But still a sizable discount otherwise.		
			subtract = {
				desc = faith_conversion_cost_spouse
				format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
				value = 0.5
			}
		}
	}
	else_if = { #Does a concubine have the right religion?
		limit = {
			scope:character = {
				any_concubine = {
					faith = scope:new_faith
				}
			}
		}
		if = { # Even cheaper if unreformed
			limit = {
				scope:new_faith = {
					NOT = { has_doctrine_parameter = unreformed }
				}
				scope:character = {
					faith = {
						has_doctrine_parameter = unreformed
					}
				}
			}
			subtract = {
				desc = faith_conversion_cost_unreformed_concubine
				format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
				value = 2.25
			}
		}
		else = { # But still a sizable discount otherwise.
			subtract = {
				desc = faith_conversion_cost_concubine
				format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
				value = 0.25
			}
		}
	}
	if = { #Cheaper if the religion is present near/in your borders
		limit = {
			scope:new_faith = {
				religion = { is_in_family = rf_abrahamic }
			}
			scope:character = {
				faith = {
					religion = {
						NOT = { is_in_family = rf_abrahamic }
					}
				}
				OR = {
					any_neighboring_top_liege_realm_owner = {
						faith = scope:new_faith
					}
					any_vassal = {
						faith = scope:new_faith
					}
					any_realm_province = {
						faith = scope:new_faith
					}
					AND = {
						exists = liege
						liege = {
							faith = scope:new_faith
						}
					}
					AND = {
						exists = liege
						liege = {	
							any_vassal = {
								faith = scope:new_faith
							}
						}
					}
				}
			}
		}
		subtract = {
			desc = faith_conversion_cost_present
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 2.5
		}
	}
	else_if = { #Cheaper if the religion is present near/in your borders
		limit = {
			scope:new_faith = {
				religion = { is_in_family = rf_eastern }
			}
			scope:character = {
				faith = {
					religion = {
						NOT = { is_in_family = rf_eastern }
					}
				}
				OR = {
					any_neighboring_top_liege_realm_owner = {
						faith = scope:new_faith
					}
					any_vassal = {
						faith = scope:new_faith
					}
					any_realm_province = {
						faith = scope:new_faith
					}
					AND = {
						exists = liege
						liege = {
							faith = scope:new_faith
						}
					}
					AND = {
						exists = liege
						liege = {	
							any_vassal = {
								faith = scope:new_faith
							}
						}
					}
				}
			}
		}
		subtract = {
			desc = faith_conversion_cost_present
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 2.5
		}
	}
	else_if = { #Cheaper if the religion is present near/in your borders
		limit = {
			scope:new_faith = {
				religion = { is_in_family = rf_pagan }
			}
			scope:character = {
				faith = {
					religion = {
						NOT = { is_in_family = rf_pagan }
					}
				}
				OR = {
					any_neighboring_top_liege_realm_owner = {
						faith = scope:new_faith
					}
					any_vassal = {
						faith = scope:new_faith
					}
					any_realm_province = {
						faith = scope:new_faith
					}
					AND = {
						exists = liege
						liege = {
							faith = scope:new_faith
						}
					}
					AND = {
						exists = liege
						liege = {	
							any_vassal = {
								faith = scope:new_faith
							}
						}
					}
				}
			}
		}
		subtract = {
			desc = faith_conversion_cost_present
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 2.5
		}
	}
	else_if = { #Cheaper if the religion is present near/in your borders
		limit = {
			scope:new_faith = {
				religion = { is_in_family = rf_abrahamic }
			}
			scope:character = {
				faith = {
					religion = {
						is_in_family = rf_abrahamic
						NOT = { this = scope:new_faith.religion}
					}
				}
				OR = {
					any_neighboring_top_liege_realm_owner = {
						faith = scope:new_faith
					}
					any_vassal = {
						faith = scope:new_faith
					}
					any_realm_province = {
						faith = scope:new_faith
					}
					AND = {
						exists = liege
						liege = {
							faith = scope:new_faith
						}
					}
					AND = {
						exists = liege
						liege = {	
							any_vassal = {
								faith = scope:new_faith
							}
						}
					}
				}
			}
		}
		subtract = {
			desc = faith_conversion_cost_present
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 1.5
		}
	}
	else_if = { #Cheaper if the religion is present near/in your borders
		limit = {
			scope:new_faith = {
				religion = { is_in_family = rf_eastern }
			}
			scope:character = {
				faith = {
					religion = {
						is_in_family = rf_eastern
						NOT = { this = scope:new_faith.religion}
					}
				}
				OR = {
					any_neighboring_top_liege_realm_owner = {
						faith = scope:new_faith
					}
					any_vassal = {
						faith = scope:new_faith
					}
					any_realm_province = {
						faith = scope:new_faith
					}
					AND = {
						exists = liege
						liege = {
							faith = scope:new_faith
						}
					}
					AND = {
						exists = liege
						liege = {	
							any_vassal = {
								faith = scope:new_faith
							}
						}
					}
				}
			}
		}
		subtract = {
			desc = faith_conversion_cost_present
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 1.5
		}
	}
	else_if = { #Cheaper if the religion is present near/in your borders
		limit = {
			scope:new_faith = {
				religion = { is_in_family = rf_pagan }
			}
			scope:character = {
				faith = {
					religion = {
						is_in_family = rf_pagan
						NOT = { this = scope:new_faith.religion}
					}
				}
				OR = {
					any_neighboring_top_liege_realm_owner = {
						faith = scope:new_faith
					}
					any_vassal = {
						faith = scope:new_faith
					}
					any_realm_province = {
						faith = scope:new_faith
					}
					AND = {
						exists = liege
						liege = {
							faith = scope:new_faith
						}
					}
					AND = {
						exists = liege
						liege = {	
							any_vassal = {
								faith = scope:new_faith
							}
						}
					}
				}
			}
		}
		subtract = {
			desc = faith_conversion_cost_present
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 1.5
		}
	}
	else_if = {
		limit = {
			scope:character = {
				OR = {
					any_neighboring_top_liege_realm_owner = {
						faith = scope:new_faith
					}
					any_vassal = {
						faith = scope:new_faith
					}
					any_realm_province = {
						faith = scope:new_faith
					}
					AND = {
						exists = liege
						liege = {
							faith = scope:new_faith
						}
					}
					AND = {
						exists = liege
						liege = {	
							any_vassal = {
								faith = scope:new_faith
							}
						}
					}
				}
			}
		}
		subtract = {
			desc = faith_conversion_cost_present
			format = "BREAKDOWN_FORMAT_PIETY_PERCENTAGE_POSITIVE_IS_BAD"
			value = 0.5
		}
	}
}

reincarnation_chance = 4

holy_sites_to_create_temporal_head_of_faith = 2
holy_sites_to_create_spiritual_head_of_faith = 1

faith_military_strength = {
	every_ruler = {
		limit = {
			faith = prev
			is_at_war = no
		}
		add = max_military_strength
	}
}

syncretic_mutual_opinion_bonus_value = 30