﻿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
			}
			else_if = {
				limit = { has_doctrine = tenet_divine_marriage }
				multiply = faith_changed_doctrine_cost_mult_four_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
			}
			else_if = {
				limit = { has_doctrine = tenet_divine_marriage }
				multiply = faith_changed_doctrine_cost_mult_three_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
			}
			else_if = {
				limit = { has_doctrine = tenet_divine_marriage }
				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
		}
	}
	tenet_divine_marriage = {
		name = {
			first_valid = {
				triggered_desc = {
					trigger = {
						religion_tag = zoroastrianism_religion
					}
					desc = tenet_divine_marriage_xwedodah 
				}
				desc = tenet_divine_marriage_name
			}
		}
		piety_cost = {
			value = faith_doctrine_cost_high
			if = {
				limit = { has_doctrine = tenet_divine_marriage }
				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_cousins }
				multiply = faith_changed_doctrine_cost_mult_three_step
			}			
			else_if = {
				limit = { has_doctrine = doctrine_consanguinity_restricted }
				multiply = faith_changed_doctrine_cost_mult_four_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			
			divine_marriage_opinion = 10
			divine_marriage_piety_gain_active = yes
		}
	}
}

doctrine_mz_relationships = {
	group = "marriage"	
	
	doctrine_mz_monogamy = {
		piety_cost = {
			value = 0
			if = {
				limit = { has_doctrine = doctrine_mz_monogamy }
				value = 0
			}
			else_if = {
				limit = { has_doctrine = tenet_polyamory }
				value = faith_tenet_cost_high
			}
		}
		character_modifier = {
			spouse_opinion = 10
		}
	}

	tenet_polyamory = {
		icon = core_tenet_followers
		piety_cost = {
			if = {
				limit = {
					religion_tag = hinduism_religion
				}
				value = faith_tenet_cost_low
			}
			else_if = {
				limit = {
					OR = {
						religion_tag = christianity_religion
						religion_tag = judaism_religion
						religion_tag = islam_religion
						religion_tag = buddhism_religion
						religion_tag = jainism_religion
					}
				}
				value = faith_tenet_cost_high
			}
			else = {
				value = faith_tenet_cost_mid
			}

			# Multiplier for keeping same tenet
			if = {
				limit = { has_doctrine = tenet_polyamory }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}

		can_pick = {
			custom_description = {
				text = ADULTERY_MUST_BE_FULLY_ACCEPTED
				NOR = {
					doctrine:doctrine_adultery_women_crime = { is_in_list = selected_doctrines }
					doctrine:doctrine_adultery_women_shunned = { is_in_list = selected_doctrines }
					doctrine:doctrine_adultery_men_crime = { is_in_list = selected_doctrines }
					doctrine:doctrine_adultery_men_shunned = { is_in_list = selected_doctrines }
				}
			}
		}

		parameters = {
			no_unfaithfulness_penalty_active = yes
		}
	}
}

### Syncretism 

doctrine_mz_syncretism = {
	group = "church_group"
	tenet_no_syncretism = {
		piety_cost = {
			value = 0
			if = {
				limit = { has_doctrine = tenet_no_syncretism }
				value = 0
			}
			else_if = {
				limit = { 
					OR = { 	
						has_doctrine = tenet_eastern_syncretism
						has_doctrine = tenet_unreformed_syncretism
						has_doctrine = tenet_christian_syncretism
						has_doctrine = tenet_islamic_syncretism
						has_doctrine = tenet_jewish_syncretism
						has_doctrine = tenet_pantheon_syncretism
					} 
				}
				value = faith_tenet_cost_high
			}
		}
		character_modifier = {
			name = tenet_no_syncretism_effect
			same_faith_opinion = 5
		}
	}

	tenet_eastern_syncretism = {
		piety_cost = {
			if = {
				limit = {
					OR = {
						religion_tag = dualism_religion
						has_doctrine = pagan_hostility_doctrine
					}
				}
				value = faith_tenet_cost_low
			}
			else_if = {
				limit = {
					religion_tag = islam_religion
				}
				value = faith_tenet_cost_high
			}
			else = {
				value = faith_tenet_cost_mid
			}

			# Multiplier for keeping same tenet
			if = {
				limit = { has_doctrine = tenet_eastern_syncretism }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}

		is_shown = {
			OR = {
				has_doctrine = abrahamic_hostility_doctrine
				has_doctrine = pagan_hostility_doctrine
			}
		}
		can_pick = {
			custom_description = {
				text = incompatible_tenet_gnosticism_trigger
				NOT = {
					doctrine:tenet_gnosticism = { is_in_list = selected_doctrines }
				}
			}
			custom_description = {
				text = incompatible_tenet_other_syncretism_trigger
				NOR = {
					doctrine:tenet_unreformed_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_christian_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_islamic_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_jewish_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_pantheon_syncretism = { is_in_list = selected_doctrines } #TROME
				}
			}
		}
		parameters = {
			hostility_override_eastern_hostility_doctrine = 1
			#For loc:
			is_eastern_faith_bilateral_loc_override = 1
			eastern_syncretic_actor_opinion_active = yes
			opinion_of_eastern_syncretic_recipient_opinion_active = 30 #Sync this to syncretic_mutual_opinion_bonus_value
		}
		traits = {
			virtues = { honest }
			sins = { wrathful }
		}
	}

	tenet_unreformed_syncretism = {
		piety_cost = {
			if = {
				limit = { doctrine:doctrine_pluralism_pluralistic = {is_in_list = selected_doctrines} }
				value = faith_tenet_cost_low
			}
			else_if = {
				limit = { doctrine:doctrine_pluralism_fundamentalist = {is_in_list = selected_doctrines} }
				value = faith_tenet_cost_high
			}
			else = {
				value = faith_tenet_cost_mid
			}

			# Multiplier for keeping same tenet
			if = {
				limit = { has_doctrine = tenet_unreformed_syncretism }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}


		is_shown = {
			NOT = { has_doctrine = pagan_hostility_doctrine }
		}
		can_pick = {
			custom_description = {
				text = incompatible_tenet_other_syncretism_trigger
				NOR = {
					doctrine:tenet_eastern_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_christian_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_islamic_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_jewish_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_pantheon_syncretism = { is_in_list = selected_doctrines } #TROME
				}
			}
		}
		parameters = {
			hostility_override_unreformed_faith_doctrine = 2
			hostility_override_west_african_unreformed_faith_doctrine = 2
			unreformed_syncretic_actor_opinion_active = yes
			opinion_of_unreformed_syncretic_recipient_opinion_active = 30 #Sync this to syncretic_mutual_opinion_bonus_value
			unreformed_syncretic_conversion_malus_active = yes
		}
		traits = {
			virtues = { humble }
			sins = { arrogant }
		}
	}

	tenet_christian_syncretism = {
		piety_cost = {
			if = {
				limit = {
					OR = {
						religion_tag = islam_religion
						religion_tag = dualism_religion
					}
				}
				value = faith_tenet_cost_low
			}
			else = {
				value = faith_tenet_cost_mid
			}

			# Multiplier for keeping same tenet
			if = {
				limit = { has_doctrine = tenet_christian_syncretism }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}

		is_shown = {
			NOT = { religion_tag = christianity_religion }
		}
		can_pick = {
			custom_description = {
				text = incompatible_tenet_other_syncretism_trigger
				NOR = {
					doctrine:tenet_eastern_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_unreformed_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_islamic_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_jewish_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_pantheon_syncretism = { is_in_list = selected_doctrines } #TROME
				}
			}
		}

		parameters = {
			hostility_override_special_doctrine_is_christian_faith = 2
			#For loc:
			is_christian_faith_bilateral_loc_override = 2
			# This parameter is empty; the syncretic religious trigger checks against the doctrine, as that's much clearer in tooltips and allows us to use a unified syncretic trigger per-religion rather than having bitty situational triggers.
			can_use_christian_artefacts = yes
			christian_syncretic_actor_opinion_active = yes
			opinion_of_christian_syncretic_recipient_opinion_active = 30 #Sync this to syncretic_mutual_opinion_bonus_value
		}

		traits = {
			virtues = { compassionate }
			sins = { callous sadistic }
		}
	}

	tenet_islamic_syncretism = {
		piety_cost = {
			if = {
				limit = {
					OR = {
						religion_tag = christianity_religion
						religion_tag = dualism_religion
					}
				}
				value = faith_tenet_cost_low
			}
			else = {
				value = faith_tenet_cost_mid
			}

			# Multiplier for keeping same tenet
			if = {
				limit = { has_doctrine = tenet_islamic_syncretism }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}

		is_shown = {
			NOT = { religion_tag = islam_religion }
		}
		can_pick = {
			custom_description = {
				text = incompatible_tenet_other_syncretism_trigger
				NOR = {
					doctrine:tenet_eastern_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_unreformed_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_christian_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_jewish_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_pantheon_syncretism = { is_in_list = selected_doctrines } #TROME
				}
			}
		}

		parameters = {
			hostility_override_special_doctrine_is_alb_faith = 1
			hostility_override_special_doctrine_is_islamic_faith = 2
			# This parameter is empty; the syncretic religious trigger checks against the doctrine, as that's much clearer in tooltips and allows us to use a unified syncretic trigger per-religion rather than having bitty situational triggers.
			can_use_islamic_artefacts = yes
			islamic_syncretic_actor_opinion_active = yes
			opinion_of_islamic_syncretic_recipient_opinion_active = 30 #Sync this to syncretic_mutual_opinion_bonus_value
		}

		traits = {
			virtues = { generous }
			sins = { greedy arbitrary }
		}
	}

	tenet_jewish_syncretism = {
		piety_cost = {
			if = {
				limit = {
					OR = {
						religion_tag = judaism_religion
						religion_tag = christianity_religion
						religion_tag = dualism_religion
					}
				}
				value = faith_tenet_cost_low
			}
			else = {
				value = faith_tenet_cost_mid
			}

			# Multiplier for keeping same tenet
			if = {
				limit = { has_doctrine = tenet_jewish_syncretism }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}

		is_shown = {
			NOT = { religion_tag = judaism_religion }
		}
		can_pick = {
			custom_description = {
				text = incompatible_tenet_other_syncretism_trigger
				NOR = {
					doctrine:tenet_eastern_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_unreformed_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_christian_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_islamic_syncretism = { is_in_list = selected_doctrines }
					doctrine:tenet_pantheon_syncretism = { is_in_list = selected_doctrines } #TROME
				}
			}
		}

		parameters = {
			hostility_override_special_doctrine_is_jewish_faith = 2
			# This parameter is empty; the syncretic religious trigger checks against the doctrine, as that's much clearer in tooltips and allows us to use a unified syncretic trigger per-religion rather than having bitty situational triggers.
			can_use_jewish_artefacts = yes
			jewish_syncretic_actor_opinion_active = yes
			opinion_of_jewish_syncretic_recipient_opinion_active = 30 #Sync this to syncretic_mutual_opinion_bonus_value
		}

		traits = {
			virtues = { patient }
			sins = { cynical greedy }
		}
	}

	#TROME
	tenet_pantheon_syncretism = {
		icon = core_tenet_household_gods
		piety_cost = {
			if = {
				limit = { doctrine:doctrine_pluralism_pluralistic = {is_in_list = selected_doctrines} }
				value = faith_tenet_cost_low
			}
			else_if = {
				limit = { doctrine:doctrine_pluralism_fundamentalist = {is_in_list = selected_doctrines} }
				value = faith_tenet_cost_high
			}
			else = {
				value = faith_tenet_cost_mid
			}

			# Multiplier for keeping same tenet
			if = {
				limit = { has_doctrine = tenet_unreformed_syncretism }
				multiply = faith_unchanged_doctrine_cost_mult
			}
		}


		is_shown = {
		}
		can_pick = {
		religion_tag = romanism_religion
		custom_description = {
			text = incompatible_tenet_other_syncretism_trigger
			NOR = {
				doctrine:tenet_eastern_syncretism = { is_in_list = selected_doctrines }
				doctrine:tenet_unreformed_syncretism = { is_in_list = selected_doctrines }
				doctrine:tenet_christian_syncretism = { is_in_list = selected_doctrines }
				doctrine:tenet_islamic_syncretism = { is_in_list = selected_doctrines }
				doctrine:tenet_communal_identity = { is_in_list = selected_doctrines }
			}
		}
		}
		parameters = {
			hostility_override_unreformed_faith_doctrine = 1
			hostility_override_west_african_unreformed_faith_doctrine = 1
			unreformed_syncretic_actor_opinion_active = yes
			opinion_of_unreformed_syncretic_recipient_opinion_active = 30 #Sync this to syncretic_mutual_opinion_bonus_value
			unreformed_syncretic_conversion_malus_active = yes
			same_culture_conversion_bonus_active = yes
			same_faith_promote_culture_bonus_active = yes
		}
		character_modifier = {
			ignore_opinion_of_different_faith = yes
			different_faith_county_opinion_mult = -0.25
			different_faith_liege_opinion = 15
			opinion_of_different_faith_liege = 15
			faith_conversion_piety_cost_mult = -0.15
		}
	}
	#/TROME

}

nudity_doctrine = {
	group = "crimes"	
	doctrine_mz_no_nudity = {
		piety_cost = {
			value = 0
			if = {
				limit = { has_doctrine = doctrine_mz_no_nudity }
				value = 0
			}
			else_if = {
				limit = { has_doctrine = special_doctrine_naked_priests }
				value = 100
			}
			else_if = {
				limit = { has_doctrine = doctrine_mz_full_nudity }
				value = 200
			}
		}
		parameters = {
			mz_no_nudity_active = yes
		}
	}
	special_doctrine_naked_priests = {
		piety_cost = {
			value = 0
			if = {
				limit = { has_doctrine = special_doctrine_naked_priests }
				value = 0
			}
			else_if = {
				limit = { has_doctrine = doctrine_mz_full_nudity }
				value = 100
			}
			else_if = {
				limit = { has_doctrine = doctrine_mz_no_nudity }
				value = 100
			}
		}
		parameters = {
			naked_priests_active = yes
		}
	}
	doctrine_mz_full_nudity = {
		piety_cost = {
			value = 0
			if = {
				limit = { has_doctrine = doctrine_mz_full_nudity }
				value = 0
			}
			else_if = {
				limit = { has_doctrine = special_doctrine_naked_priests }
				value = 100
			}
			else_if = {
				limit = { has_doctrine = doctrine_mz_no_nudity }
				value = 200
			}
		}
		parameters = {
			naked_adherents_active = yes
		}
	}
}