doctrine_marriage_type = {
	group = "marriage"
	doctrine_monogamy = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_monogamy }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			number_of_spouses = 1
			marriage_event = yes
		}
	}

	doctrine_polygamy = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_polygamy }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			number_of_spouses = 4
			spouse_piety_loss = yes
		}
	}

	doctrine_concubines = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_concubines }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			number_of_spouses = 1
			number_of_consorts = 3
		}
	}
}

doctrine_divorce = {
	group = "marriage"
	doctrine_divorce_disallowed = {
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_divorce_disallowed }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_divorce_allowed }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}

		}
		parameters = {
			divorce_disallowed = yes
		}
	}
	doctrine_divorce_approval = {
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_divorce_approval }
				multiply = faith_unchanged_doctrine_cost_mult
			}

		}
		parameters = {
			divorce_approval = yes
		}
	}
	doctrine_divorce_allowed = {
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_divorce_allowed }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_divorce_disallowed }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			divorce_allowed = yes
		}
	}
}

doctrine_bastardry = {
	group = "marriage"
	doctrine_bastardry_none = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_bastardry_none }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_bastardry_all }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			bastards_none = yes
		}
	}
	doctrine_bastardry_legitimization = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_bastardry_legitimization }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			bastards_legitimize = yes
		}
	}
	doctrine_bastardry_all = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_bastardry_all }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_bastardry_none }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			bastards_always = yes
		}
	}
}

doctrine_homosexuality = {
	group = "crimes"
	doctrine_homosexuality_crime = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_homosexuality_crime }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_homosexuality_accepted }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			homosexuality_illegal = yes
		}
	}
	doctrine_homosexuality_shunned = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_homosexuality_shunned }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			homosexuality_shunned = yes
		}
	}
	doctrine_homosexuality_accepted = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_homosexuality_accepted }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_homosexuality_crime }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			homosexuality_accepted = yes
		}
	}
}

doctrine_deviancy = {
	group = "crimes"
	doctrine_deviancy_crime = {
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_deviancy_crime }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_deviancy_accepted }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
			else_if = {
				limit = { has_doctrine = doctrine_deviancy_virtuous }
				multiply = faith_changed_doctrine_cost_mult_three_step
			}
		}
		parameters = {
			deviancy_illegal = yes
		}
	}
	doctrine_deviancy_shunned = {
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_deviancy_shunned }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_deviancy_virtuous }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			deviancy_shunned = yes
		}
	}
	doctrine_deviancy_accepted = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_deviancy_accepted }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_deviancy_crime }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			deviancy_accepted = yes
		}
	}
	doctrine_deviancy_virtuous = {
		can_pick = {
			custom_description = {
				text = must_select_carnal_exaltation
				doctrine:tenet_carnal_exaltation = { is_in_list = selected_doctrines }
			}
		}
		piety_cost = {
			value = faith_doctrine_cost_massive
			if = {
				limit = { has_doctrine = doctrine_deviancy_virtuous }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_deviancy_shunned }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
			else_if = {
				limit = { has_doctrine = doctrine_deviancy_crime }
				multiply = faith_changed_doctrine_cost_mult_three_step
			}
		}
		traits = {
			virtues = { deviant }
		}
		parameters = {
			deviancy_accepted = yes
		}
	}
}

doctrine_adultery_men = {
	group = "crimes"
	doctrine_adultery_men_crime = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_adultery_men_crime }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_adultery_men_accepted }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			adultery_male_crime = yes
		}
	}
	doctrine_adultery_men_shunned = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_adultery_men_shunned }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			adultery_male_shunned = yes
		}
	}
	doctrine_adultery_men_accepted = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_adultery_men_accepted }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_adultery_men_crime }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			adultery_male_accepted = yes
		}
	}
}

doctrine_adultery_women = {
	group = "crimes"
	doctrine_adultery_women_crime = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_adultery_women_crime }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_adultery_women_accepted }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			adultery_female_crime = yes
		}
	}
	doctrine_adultery_women_shunned = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_adultery_women_shunned }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			adultery_female_shunned = yes
		}
	}
	doctrine_adultery_women_accepted = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_adultery_women_accepted }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_adultery_women_crime }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			adultery_female_accepted = yes
		}
	}
}

doctrine_kinslaying = {
	group = "crimes"
	doctrine_kinslaying_any_dynasty_member_crime = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_kinslaying_any_dynasty_member_crime }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_kinslaying_close_kin_crime }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
			else_if = {
				limit = { has_doctrine = doctrine_kinslaying_shunned }
				multiply = faith_changed_doctrine_cost_mult_three_step
			}
			else_if = {
				limit = { has_doctrine = doctrine_kinslaying_accepted }
				multiply = faith_changed_doctrine_cost_mult_four_step
			}
		}
		parameters = {
			kinslaying_any_dynasty_member_crime = yes
		}
	}
	doctrine_kinslaying_extended_family_crime = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_kinslaying_extended_family_crime }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_kinslaying_shunned }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
			else_if = {
				limit = { has_doctrine = doctrine_kinslaying_accepted }
				multiply = faith_changed_doctrine_cost_mult_three_step
			}
		}
		parameters = {
			kinslaying_extended_family_crime = yes
		}
	}
	doctrine_kinslaying_close_kin_crime = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_kinslaying_close_kin_crime }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = {
					OR = {
						has_doctrine = doctrine_kinslaying_accepted
						has_doctrine = doctrine_kinslaying_any_dynasty_member_crime
					}
				}
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			kinslaying_close_kin_crime = yes
		}
	}
	doctrine_kinslaying_shunned = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_kinslaying_shunned }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_kinslaying_extended_family_crime }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
			else_if = {
				limit = { has_doctrine = doctrine_kinslaying_any_dynasty_member_crime }
				multiply = faith_changed_doctrine_cost_mult_three_step
			}
		}
		parameters = {
			kinslaying_shunned = yes
		}
	}
	doctrine_kinslaying_accepted = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_kinslaying_accepted }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_kinslaying_close_kin_crime }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
			else_if = {
				limit = { has_doctrine = doctrine_kinslaying_extended_family_crime }
				multiply = faith_changed_doctrine_cost_mult_three_step
			}
			else_if = {
				limit = { has_doctrine = doctrine_kinslaying_any_dynasty_member_crime }
				multiply = faith_changed_doctrine_cost_mult_four_step
			}

		}
		parameters = {
			kinslaying_accepted = yes
		}
	}
}

doctrine_witchcraft = {
	group = "crimes"
	doctrine_witchcraft_crime = {
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_witchcraft_crime }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_witchcraft_accepted }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
			else_if = {
				limit = { has_doctrine = doctrine_witchcraft_virtuous }
				multiply = faith_changed_doctrine_cost_mult_three_step
			}
		}
		parameters = {
			witchcraft_illegal = yes
		}
	}
	doctrine_witchcraft_shunned = {
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_witchcraft_shunned }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_witchcraft_virtuous }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			witchcraft_shunned = yes
		}
	}
	doctrine_witchcraft_accepted = {
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_witchcraft_accepted }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_witchcraft_crime }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			witchcraft_accepted = yes
		}
	}
	doctrine_witchcraft_virtuous = {
		piety_cost = {
			value = faith_tenet_cost_massive
			if = {
				limit = { has_doctrine = doctrine_witchcraft_virtuous }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_witchcraft_shunned }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
			else_if = {
				limit = { has_doctrine = doctrine_witchcraft_crime }
				multiply = faith_changed_doctrine_cost_mult_three_step
			}
		}
		traits = {
			virtues = { witch }
		}
		parameters = {
			witchcraft_accepted = yes
		}
	}
}


doctrine_gender = {
	group = "main_group"

	doctrine_gender_male_dominated = {
		is_shown = {
			NOT = { has_game_rule = full_gender_equality }
		}
		piety_cost = {
			value = faith_doctrine_cost_high
			if = {
				limit = { has_doctrine = doctrine_gender_male_dominated }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_gender_female_dominated }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			male_dominated_law = yes
			female_claims_are_weak = yes
			women_cannot_inherit_implicit_claims = yes
			women_cannot_be_granted_titles = yes
			male_dominated_council = yes
			combatant_must_be_male_if_no_roco = yes
		}
		character_modifier = {
			name = female_ruler_male_dominant
			opinion_of_female_rulers = -10
		}

		can_pick = {
			NAND = {
				exists = religious_head
				religious_head.culture = { has_cultural_parameter = female_only_inheritance }
			}
		}
	}
	doctrine_gender_equal = {
		piety_cost = {
			value = faith_doctrine_cost_high
			if = {
				limit = { has_doctrine = doctrine_gender_equal }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			gender_equal_law = yes
			combatant_can_be_either_gender_if_no_roco = yes
		}
	}
	doctrine_gender_female_dominated = {
		is_shown = {
			NOT = { has_game_rule = full_gender_equality }
		}
		piety_cost = {
			value = faith_doctrine_cost_high
			if = {
				limit = { has_doctrine = doctrine_gender_female_dominated }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_gender_male_dominated }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			female_dominated_law = yes
			male_claims_are_weak = yes
			men_cannot_inherit_implicit_claims = yes
			men_cannot_be_granted_titles = yes
			female_dominated_council = yes
			combatant_must_be_female_if_no_roco = yes
		}
		character_modifier = {
			name = male_ruler_female_dominant
			opinion_of_male_rulers = -10
		}

		can_pick = {
			NAND = {
				exists = religious_head
				religious_head.culture = { has_cultural_parameter = male_only_inheritance }
			}
		}
	}
}

doctrine_consanguinity = {
	group = "marriage"
	doctrine_consanguinity_restricted = {
		piety_cost = {
			value = faith_doctrine_cost_high
			if = {
				limit = { has_doctrine = doctrine_consanguinity_restricted }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_consanguinity_aunt_nephew_and_uncle_niece }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
			else_if = {
				limit = { has_doctrine = doctrine_consanguinity_unrestricted }
				multiply = faith_changed_doctrine_cost_mult_three_step
			}
		}
		parameters = {
			consanguinity_restricted_marriage = yes
			consanguinity_restricted_close_kin_incest = yes
		}
	}
	doctrine_consanguinity_cousins = {
		piety_cost = {
			value = faith_doctrine_cost_high
			if = {
				limit = { has_doctrine = doctrine_consanguinity_cousins }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_consanguinity_unrestricted }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			consanguinity_cousins_marriage = yes
			consanguinity_cousins_incest = yes
			allows_cousin_marriage = yes
		}
	}
	doctrine_consanguinity_aunt_nephew_and_uncle_niece = {
		piety_cost = {
			value = faith_doctrine_cost_high
			if = {
				limit = { has_doctrine = doctrine_consanguinity_aunt_nephew_and_uncle_niece }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_consanguinity_restricted }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			consanguinity_aunt_nephew_and_uncle_niece_marriage = yes
			consanguinity_aunt_nephew_and_uncle_niece_incest = yes
			allows_cousin_marriage = yes
			allows_aunt_nephew_and_uncle_niece_marriage = yes
		}
	}
	doctrine_consanguinity_unrestricted = {
		piety_cost = {
			value = faith_doctrine_cost_high
			if = {
				limit = { has_doctrine = doctrine_consanguinity_unrestricted }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_consanguinity_cousins }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
			else_if = {
				limit = { has_doctrine = doctrine_consanguinity_restricted }
				multiply = faith_changed_doctrine_cost_mult_three_step
			}
		}
		parameters = {
			consanguinity_unrestricted_marriage = yes
			consanguinity_unrestricted_incest = yes
			allows_cousin_marriage = yes
			allows_aunt_nephew_and_uncle_niece_marriage = yes
			allows_unrestricted_marriage = yes
		}
	}
}

doctrine_pluralism = {
	group = "main_group"

	doctrine_pluralism_fundamentalist = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_pluralism_fundamentalist }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_pluralism_pluralistic }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			hostility_towards_us_mult = 2
			
			pluralism_fundamentalist_proselytization_bonus = yes
			pluralism_fundamentalist_faction_join_chance = yes
			pluralism_fundamentalist_vulnerable_to_heresy = yes
			pluralism_fundamentalist_revocation_tyranny_minimal = yes
		}
		character_modifier = {
			minority_different_faith_opinion = -20
		}
	}
	doctrine_pluralism_righteous = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_pluralism_righteous }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			hostility_towards_us_mult = 1
			pluralism_righteous_revocation_tyranny_reduced = yes
		}
		character_modifier = {
			minority_different_faith_opinion = -10
		}
	}
	doctrine_pluralism_pluralistic = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_pluralism_pluralistic }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_pluralism_fundamentalist }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}

		can_pick = {
			custom_description = {
				text = incompatible_tenet_pentarchy_trigger
				NOT = { doctrine:tenet_pentarchy = { is_in_list = selected_doctrines } }
			}
		}

		parameters = {
			hostility_towards_us_mult = 0.5
			pluralism_pluralistic_proselytization_penalty = yes
			pluralism_pluralistic_faction_join_chance = yes
			pluralism_pluralistic_resistant_to_heresy = yes
			pluralism_pluralistic_holy_wars_preserve_vassals = yes
			
		}
	}
}

doctrine_theocracy = {
	group = "main_group"
	doctrine_theocracy_temporal = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_theocracy_temporal }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_theocracy_lay_clergy }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		
		can_pick = {
			custom_description = {
				text = incompatible_doctrine_theocracy_temporal_trigger
				NOT = { doctrine:doctrine_temporal_head = { is_in_list = selected_doctrines } }
			}
		}

		parameters = {
			theocracy_temple_lease = yes
		}
	}
	doctrine_theocracy_lay_clergy = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_theocracy_lay_clergy }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_theocracy_temporal }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}

		parameters = {
			theocracy_temple_ownership = yes
			lay_clergy = yes
			allowed_holding_type_church_holding = yes
		}
	}
}

doctrine_head_of_faith = {
	group = "main_group"

	doctrine_no_head = {
		visible = no
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_no_head }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			no_head_of_faith = yes
			minimum_fervor = 25
		}
	}
	doctrine_spiritual_head = {
		visible = no
		piety_cost = {
			value = faith_doctrine_cost_high
			if = {
				limit = { has_doctrine = doctrine_spiritual_head }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			spiritual_head_of_faith = yes
			spiritual_head_of_faith_claims = yes
			spiritual_head_of_faith_gold = yes
		}
	}
	doctrine_temporal_head = {
		visible = no
		piety_cost = {
			value = faith_doctrine_cost_massive
			if = {
				limit = { has_doctrine = doctrine_temporal_head }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		can_pick = {
			custom_description = {
				text = incompatible_doctrine_theocracy_temporal_trigger
				NOT = { doctrine:doctrine_theocracy_temporal = { is_in_list = selected_doctrines } }
			}
			custom_description = {
				text = incompatible_doctrine_spiritual_appointment_temporal_trigger
				NOR = {
					doctrine:doctrine_clerical_succession_spiritual_appointment = { is_in_list = selected_doctrines }
					doctrine:doctrine_clerical_succession_spiritual_fixed_appointment = { is_in_list = selected_doctrines }
				}
			}
		}

		parameters = {
			temporal_head_of_faith = yes
			temporal_head_of_faith_directed_holy_wars = yes
		}
	}
}

doctrine_clerical_function = {
	group = "clergy"
	doctrine_clerical_function_taxation = {
		clergy_modifier = {
			#monthly_county_control_growth_add_even_if_baron = 0.2
			monthly_county_control_growth_factor_even_if_baron = 0.2
		}
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_clerical_function_taxation }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
	}
	doctrine_clerical_function_alms_and_pacification = {
		clergy_modifier = {
			county_opinion_add_even_if_baron = 10
			domain_tax_mult_even_if_baron = -0.05
		}
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_clerical_function_alms_and_pacification }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
	}
	doctrine_clerical_function_recruitment = {
		clergy_modifier = {
			domain_tax_same_faith_mult_even_if_baron = -0.03
			levy_reinforcement_rate_same_faith_even_if_baron = 0.3
			prowess = 4
		}
		parameters = {
			clergy_can_fight = yes
		}
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_clerical_function_recruitment }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
	}
}

doctrine_clerical_gender = {
	group = "clergy"
	doctrine_clerical_gender_male_only = {
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_clerical_gender_male_only }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_clerical_gender_female_only }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			clergy_must_be_male = yes
		}
	}
	doctrine_clerical_gender_female_only = {
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_clerical_gender_female_only }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_clerical_gender_male_only }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		parameters = {
			clergy_must_be_female = yes
		}
	}
	doctrine_clerical_gender_either = {
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_clerical_gender_either }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}

		parameters = {
			clergy_can_be_either_gender = yes
		}
	}
}

doctrine_clerical_marriage = {
	group = "clergy"
	doctrine_clerical_marriage_allowed = {
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_clerical_marriage_allowed }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_clerical_marriage_disallowed }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}
		
		parameters = {
			clergy_can_marry = yes
		}
	}
	doctrine_clerical_marriage_disallowed = {
		piety_cost = {
			value = faith_doctrine_cost_low
			if = {
				limit = { has_doctrine = doctrine_clerical_marriage_disallowed }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else_if = {
				limit = { has_doctrine = doctrine_clerical_marriage_allowed }
				multiply = faith_changed_doctrine_cost_mult_two_step
			}
		}

		parameters = {
			clergy_can_marry = no
		}
	}
}

doctrine_clerical_succession = {
	group = "clergy"
	doctrine_clerical_succession_temporal_appointment = { # Temporal, Free
		piety_cost = {
			value = faith_doctrine_cost_high
			if = {
				limit = { has_doctrine = doctrine_clerical_succession_temporal_appointment }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else = {
				if = {
					limit = {
						OR = { # Was Spiritual
							has_doctrine = doctrine_clerical_succession_spiritual_fixed_appointment
							has_doctrine = doctrine_clerical_succession_spiritual_appointment
						}
					}
					multiply = faith_changed_doctrine_cost_mult_two_step
				}
				if = {
					limit = {
						OR = {	# Was Fixed
							has_doctrine = doctrine_clerical_succession_spiritual_fixed_appointment
							has_doctrine = doctrine_clerical_succession_temporal_fixed_appointment
						}
					}
					multiply = faith_changed_doctrine_cost_mult_two_step
				}
			}
			# Round up to the nearest multiple of 25
			divide = 25
			ceiling = yes
			multiply = 25
		}

		parameters = {
			clerical_appointment_ruler = yes
			clerical_appointment_fixed = no
		}
	}
	doctrine_clerical_succession_spiritual_appointment = { # Spiritual, Free
		piety_cost = {
			value = faith_doctrine_cost_high
			if = {
				limit = { has_doctrine = doctrine_clerical_succession_spiritual_appointment }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else = {
				if = {
					limit = {
						OR = { # Was Temporal
							has_doctrine = doctrine_clerical_succession_temporal_fixed_appointment
							has_doctrine = doctrine_clerical_succession_temporal_appointment
						}
					}
					multiply = faith_changed_doctrine_cost_mult_two_step
				}
				if = {
					limit = {
						OR = {	# Was Fixed
							has_doctrine = doctrine_clerical_succession_spiritual_fixed_appointment
							has_doctrine = doctrine_clerical_succession_temporal_fixed_appointment
						}
					}
					multiply = faith_changed_doctrine_cost_mult_two_step
				}	
			}
			# Round up to the nearest multiple of 25
			divide = 25
			ceiling = yes
			multiply = 25
		}

		can_pick = {
			custom_description = {
				text = incompatible_doctrine_spiritual_appointment_temporal_trigger
				NOT = { doctrine:doctrine_temporal_head = { is_in_list = selected_doctrines } }
			}
		}		

		parameters = {
			clerical_appointment_head_of_faith = yes
			clerical_appointment_fixed = no
		}
	}
	doctrine_clerical_succession_temporal_fixed_appointment = { # Temporal, Fixed
		piety_cost = {
			value = faith_doctrine_cost_high
			if = {
				limit = { has_doctrine = doctrine_clerical_succession_temporal_fixed_appointment }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else = {
				if = {
					limit = {
						OR = { # Was Spiritual
							has_doctrine = doctrine_clerical_succession_spiritual_fixed_appointment
							has_doctrine = doctrine_clerical_succession_spiritual_appointment
						}
					}
					multiply = faith_changed_doctrine_cost_mult_two_step
				}
				if = {
					limit = {
						OR = {	# Was free
							has_doctrine = doctrine_clerical_succession_spiritual_appointment
							has_doctrine = doctrine_clerical_succession_temporal_appointment
						}
					}
					multiply = faith_changed_doctrine_cost_mult_two_step
				}
			}
			# Round up to the nearest multiple of 25
			divide = 25
			ceiling = yes
			multiply = 25
		}
		parameters = {
			clerical_appointment_ruler = yes
			clerical_appointment_fixed = yes
		}
	}
	doctrine_clerical_succession_spiritual_fixed_appointment = { # Spiritual, Fixed
		piety_cost = {
			value = faith_doctrine_cost_high
			if = {
				limit = { has_doctrine = doctrine_clerical_succession_spiritual_fixed_appointment }
				multiply = faith_unchanged_doctrine_cost_mult
			}
			else = {
				if = {
					limit = {
						OR = { # Was Temporal
							has_doctrine = doctrine_clerical_succession_temporal_fixed_appointment
							has_doctrine = doctrine_clerical_succession_temporal_appointment
						}
					}
					multiply = faith_changed_doctrine_cost_mult_two_step
				}
				if = {
					limit = {
						OR = {	# Was Free
							has_doctrine = doctrine_clerical_succession_spiritual_appointment
							has_doctrine = doctrine_clerical_succession_temporal_appointment
						}
					}
					multiply = faith_changed_doctrine_cost_mult_two_step
				}
			}
			# Round up to the nearest multiple of 25
			divide = 25
			ceiling = yes
			multiply = 25
		}

		can_pick = {
			custom_description = {
				text = incompatible_doctrine_spiritual_appointment_temporal_trigger
				NOT = { doctrine:doctrine_temporal_head = { is_in_list = selected_doctrines } }
			}
		}

		parameters = {
			clerical_appointment_head_of_faith = yes
			clerical_appointment_fixed = yes
		}
	}
}

doctrine_pilgrimage = {
	group = "main_group"
	doctrine_pilgrimage_forbidden = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_pilgrimage_forbidden }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		character_modifier = {
			monthly_piety_gain_mult = 0.2
			advantage_against_coreligionists = 5
		}
		parameters = {
			forbidden_from_pilgrimage = yes
		}
		traits = {
			sins = { hajjaj pilgrim }
		}
	}

	doctrine_pilgrimage_encouraged = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_pilgrimage_encouraged }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			can_go_on_pilgrimage = yes
			basic_pilgrimage_rewards = yes
		}
	}

	doctrine_pilgrimage_mandatory = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_pilgrimage_mandatory }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		is_shown = {
			NOT = { religion_tag = islam_religion }
		}
		character_modifier = {
			monthly_piety_gain_mult = -0.25
			same_faith_opinion = -5
		}
		parameters = {
			can_go_on_pilgrimage = yes
			mandatory_pilgrimage = yes
			basic_pilgrimage_rewards = yes
		}
	}

	doctrine_pilgrimage_mandatory_hajj = {
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_pilgrimage_mandatory_hajj }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		is_shown = {
			religion_tag = islam_religion
		}
		character_modifier = {
			monthly_piety_gain_mult = -0.25
			same_faith_opinion = -5
		}
		parameters = {
			can_go_on_pilgrimage = yes
			mandatory_hajj = yes
			basic_pilgrimage_rewards = yes
		}
	}
}

doctrine_funeral = {
	group = "clergy"
	doctrine_funeral_stoic = { # Abrahamic funerals, stand around and try not to cry too much before the body is humbly buried
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_funeral_stoic }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			burial_funeral = yes
			stoic_funeral = yes
		}
	}
	doctrine_funeral_bewailment = { # West African funerals, strongly encouraged to show emotion before the body is humbly buried
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_funeral_bewailment }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			burial_funeral = yes
			bewailment_funeral = yes
		}
	}
	doctrine_funeral_cremation = { # Catch-all cremations, burn or otherwise dissolve the body
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_funeral_cremation }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			cremation_funeral = yes
		}
	}
	doctrine_funeral_sky_burial = { # Have the body fed to scavenging animals and birds
		piety_cost = {
			value = faith_doctrine_cost_mid
			if = {
				limit = { has_doctrine = doctrine_funeral_sky_burial }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			sky_burials_active = yes
			can_build_towers_of_silence_active = yes
		}

		character_modifier = {
			negate_health_penalty_add = 0.25
		}
	}
	doctrine_funeral_mummification = { # Fanatically preserve the body, very expensive
		piety_cost = {
			value = faith_doctrine_cost_high
			if = {
				limit = { has_doctrine = doctrine_funeral_mummification }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}
		parameters = {
			mummification_funeral = yes
		}

		can_pick = {
			custom_description = {
				text = incompatible_tenet_aniconism_trigger
				NOT = { doctrine:tenet_aniconism = { is_in_list = selected_doctrines } }
			}
		}
	}
}
