﻿is_christian_faith = {
	group = "special"
	
	is_available_on_create = {
		has_doctrine = special_doctrine_is_christian_faith
	}

	special_doctrine_is_christian_faith = {
		parameters = {
			# Since doctrines cannot modify other faith's views of us, only our view of others, all Christian faiths are given this special doctrine which makes them friendlier to Faiths with the Christian Syncretism tenet.
			hostility_override_tenet_christian_syncretism = 2
			christian_syncretic_recipient_opinion_active = yes
			opinion_of_christian_syncretic_actor_opinion_active = 30
			# We don't localise these because Adoptionists are supposed to be a bit of a surprise.
			hostility_override_special_doctrine_adoptionist_school_felicitous_doctrine = 3
			hostility_override_special_doctrine_adoptionist_school_radical_doctrine = 3
		}
	}
}

is_islamic_faith = {
	group = "special"
	
	is_available_on_create = {
		has_doctrine = special_doctrine_is_islamic_faith
	}

	special_doctrine_is_islamic_faith = {
		parameters = {
			# Since doctrines cannot modify other faith's views of us, only our view of others, all Islamic faiths are given this special doctrine which makes them friendlier to Faiths with the Christian Syncretism tenet.
			hostility_override_tenet_islamic_syncretism = 2
			islamic_syncretic_recipient_opinion_active = yes
			opinion_of_islamic_syncretic_actor_opinion_active = 30
		}
	}
}

is_jewish_faith = {
	group = "special"
	
	is_available_on_create = {
		has_doctrine = special_doctrine_is_jewish_faith
	}

	special_doctrine_is_jewish_faith = {
		parameters = {
			# Since doctrines cannot modify other faith's views of us, only our view of others, all Jewish faiths are given this special doctrine which makes them friendlier to Faiths with the Christian Syncretism tenet.
			hostility_override_tenet_jewish_syncretism = 2
			jewish_syncretic_recipient_opinion_active = yes
			opinion_of_jewish_syncretic_actor_opinion_active = 30
		}
	}
}

is_eastern_faith = {
	group = "special"
	
	is_available_on_create = {
		has_doctrine = special_doctrine_is_eastern_faith
	}

	special_doctrine_is_eastern_faith = {
		parameters = {
			# Since doctrines cannot modify other faith's views of us, only our view of others, all Eastern faiths are given this special doctrine which makes them friendlier to Faiths with the Eastern Syncretism tenet.
			hostility_override_tenet_eastern_syncretism = 1
			eastern_syncretic_recipient_opinion_active = yes
			opinion_of_eastern_syncretic_actor_opinion_active = 30
		}
	}
}

is_gnostic_faith = {
	group = "special"
	
	is_available_on_create = {
		has_doctrine = special_doctrine_is_gnostic_faith
	}

	special_doctrine_is_gnostic_faith = {
		parameters = {
			hostility_override_tenet_gnosticism = 0
			hostility_override_special_doctrine_is_gnostic_faith = 0
			granting_titles_gives_stress = yes
		}

		traits = {
			virtues = { temperate }
			sins = { gluttonous }
		}

		character_modifier = {
			learning = 2
			stewardship = -2
		}
	}
}

special_tolerance = {
	group = "main_group"
	number_of_picks = 2	
	is_available_on_create = {
		always = no # Goes away when creating a new Faith
	}
	
	special_doctrine_ecumenical_christian = {
		parameters = {
			hostility_override_special_doctrine_ecumenical_christian = 1
		}
	}
	special_doctrine_catholic_rite = {
		parameters = {
			hostility_override_special_doctrine_catholic_rite = 0
		}
	}
	special_doctrine_via_media = {
		parameters = {
			hostility_override_special_doctrine_christian = 1
		}
	}
	special_doctrine_christian = {
		visible = no 
	}
	special_doctrine_novelist = {
		visible = no 
	}
	special_doctrine_esoteric_witchcraft = {
		visible = no 
	}
	special_doctrine_novelist_kinship = {
		parameters = {
			hostility_override_special_doctrine_novelist_kinship = 0
			hostility_override_special_doctrine_novelist_cousin = 1
		}
	}
	special_doctrine_novelist_cousin = {
		parameters = {
			hostility_override_special_doctrine_novelist_kinship = 1
		}
	}
}

heresy_hostility = {
	group = "not_creatable"
	is_available_on_create = {
		has_doctrine = heresy_hostility_doctrine
	}
	heresy_hostility_doctrine = {
		parameters = {
			hostility_same_religion = 2
		}
	}
}

nudity_doctrine = {
	group = "special"
	is_available_on_create = {
		has_doctrine = special_doctrine_naked_priests
	}

	special_doctrine_naked_priests = {
		parameters = {
			naked_priests_active = yes
		}
	}
}

unreformed_faith = {
	group = "not_creatable"
	is_available_on_create = {
		# Goes away on reformation
		always = no
	}
	unreformed_faith_doctrine = {
		visible = no
		parameters = {
			# unreformed = yes also serves as the basis for the unreformed_syncretic tenet.
			unreformed = yes
			hostility_override_tenet_unreformed_syncretism = 2
			unreformed_syncretic_recipient_opinion_active = yes
			opinion_of_unreformed_syncretic_actor_opinion_active = 30
			conquest_cb_enabled = yes
			faith_can_raid = yes
		}

		character_modifier = {
			monthly_prestige_gain_mult = 0.2
			clan_government_vassal_opinion = -20
			feudal_government_vassal_opinion = -20
			republic_government_vassal_opinion = -20
		}
	}
	west_african_unreformed_faith_doctrine = {
		visible = no
		parameters = {
			# unreformed = yes also serves as the basis for the unreformed_syncretic tenet.
			unreformed = yes
			hostility_override_tenet_unreformed_syncretism = 2
			unreformed_syncretic_recipient_opinion_active = yes
			opinion_of_unreformed_syncretic_actor_opinion_active = 30
			conquest_cb_enabled = yes
			faith_can_raid = yes
		}

		character_modifier = {
			monthly_prestige_gain_mult = 0.1
		}
	}
}

divine_destiny = {
	group = "special"
	is_available_on_create = {
		has_doctrine = divine_destiny_doctrine
	}
	divine_destiny_doctrine = {
		piety_cost = {
			value = faith_doctrine_cost_low
		}
		parameters = {
			divine_destiny_holy_war_cost_reduction = yes
		}
	}
}

adoptionist_school = {
	group = "special"
	
	is_available_on_create = {
		# Removed on reformation.
		always = no
	}

	special_doctrine_adoptionist_school_elipandic_doctrine = {
		parameters = {
			# Elipandics only think other ecumenicals are astray rather than hostile.
			## We can't localise the actual parameter due to structural shenanigans, so we make a dummy one.
			hostility_override_special_doctrine_is_christian_faith = 1
			adoptionists_like_ecumenism = yes
			# ... note that they're only thought of as hostile, unlike the other two schools, who are regarded as evil.
			adoptionists_are_unilateral_hostile = yes
			# Removed on reformation.
			adoptionist_school_removed_on_reformation = yes
			# Adoptionists convert other Christians faster.
			adoptionists_attractively_intuitive_theology = yes
		}
		character_modifier = { learning_per_piety_level = 1 }
		traits = {
			virtues = { stubborn }
		}
	}

	special_doctrine_adoptionist_school_felicitous_doctrine = {
		parameters = {
			# Felicians only think other ecumenicals are astray rather than hostile.
			## We can't localise the actual parameter due to structural shenanigans, so we make a dummy one.
			hostility_override_special_doctrine_is_christian_faith = 1
			adoptionists_like_ecumenism = yes
			# ... other Christians think they're evil, though.
			adoptionists_are_unilateral_evil = yes
			# Removed on reformation.
			adoptionist_school_removed_on_reformation = yes
			# Adoptionists convert other Christians faster.
			adoptionists_attractively_intuitive_theology = yes
		}
		character_modifier = { intrigue_per_piety_level = 1 }
		traits = {
			virtues = { deceitful }
		}
	}

	special_doctrine_adoptionist_school_radical_doctrine = {
		parameters = {
			# Radicals hate & are hated by everyone.
			hostility_override_special_doctrine_is_christian_faith = 3
			adoptionists_are_mutual_evil = yes
			# Removed on reformation.
			adoptionist_school_removed_on_reformation = yes
			# Adoptionists convert other Christians faster.
			adoptionists_attractively_intuitive_theology = yes
		}
		character_modifier = {
			advantage_against_coreligionists = 5
			# And, if you're gonna build a fundamentalist movement...
			ai_war_chance = 1
			ai_war_cooldown = -0.5
		}
		traits = {
			virtues = { arrogant }
		}
	}
}
not_allowed_to_hof = {
	group = "special"

	is_available_on_create = {
		# Removed on reformation.
		always = no
	}
	
	special_doctrine_not_allowed_to_hof = {
		name = {
			first_valid = {
				triggered_desc = {
					trigger = {
						religion_tag = judaism_religion
					}
					desc = prophecy_of_malachi_name
				}
				desc = special_doctrine_not_allowed_to_hof_name
			}
		}

		desc = {
			first_valid = {
				triggered_desc = {
					trigger = {
						religion_tag = judaism_religion
					}
					desc = prophecy_of_malachi_desc
				}
				desc = special_doctrine_not_allowed_to_hof_desc
			}
		}
		parameters = {
			block_from_create_hof_parameter = yes
		}
	}
}

#Game rule only
full_tolerance = {
	group = "special"
	is_available_on_create = {
		has_doctrine = special_doctrine_full_tolerance
	}
	
	special_doctrine_full_tolerance = {
		parameters = {
			hostility_override_special_doctrine_full_tolerance = 0
		}
	}
}


has_jizya_doctrine = {
	group = "special"

	is_available_on_create = {
		OR = {
			has_doctrine = special_doctrine_jizya
			has_doctrine = special_doctrine_is_islamic_faith
		}
	}


	special_doctrine_jizya = {
		character_modifier = {
			domain_tax_different_faith_mult = 0.2
			levy_reinforcement_rate_same_faith = 0.25
			levy_reinforcement_rate_different_faith = -0.25
		}

		parameters = {
			unlock_jizya_contract = yes
		}
	}
}
