priest_character_template = {
	age = { 30 60 }
	dynasty = none
	random_traits_list = {
		count = 1
		education_learning_2 = {}
		education_learning_3 = {}
		education_learning_4 = {}
	}
	random_traits = yes
	
	faith = root.faith
	culture = root.culture
	gender_female_chance = root_faith_clergy_gender_female_chance
	learning = {
		min_template_high_skill
		max_template_high_skill
	}

	after_creation = {
		add_character_flag = {
			flag = need_priest_outfit
		}
	}
}

simple_priest_character_template = {
	age = { 30 60 }
	dynasty = none
	random_traits_list = {
		count = 1
		education_learning_2 = {}
		education_learning_3 = {}
		education_learning_4 = {}
	}
	random_traits = yes
	learning = {
		min_template_high_skill
		max_template_high_skill
	}

	after_creation = {
		add_character_flag = {
			flag = need_priest_outfit
		}
	}
}

virtuous_priest_character_template = {
	age = { 30 60 }
	dynasty = none
	random_traits_list = {
		count = 1
		education_learning_3 = {}
		education_learning_4 = {}
	}
	#Virtue Personality
	#Give them traits which are considered virtuous in their faith. Traits which would be the opposite of a neutral personality are omitted.
	random_traits_list = {
		count = 3
		lustful = {
			trigger = {
				root.faith = { trait_is_virtue = lustful }
			}
		}
		chaste = {
			trigger = {
				root.faith = { trait_is_virtue = chaste }
			}
		}
		gluttonous = {
			trigger = {
				root.faith = { trait_is_virtue = gluttonous }
			}
		}
		temperate = {
			trigger = {
				root.faith = { trait_is_virtue = temperate }
			}
		}
		greedy = {
			trigger = {
				root.faith = { trait_is_virtue = greedy }
			}
		}
		generous = {
			trigger = {
				root.faith = { trait_is_virtue = generous }
			}
		}
		wrathful = {
			trigger = {
				root.faith = { trait_is_virtue = wrathful }
			}
		}
		calm = {
			trigger = {
				root.faith = { trait_is_virtue = calm }
			}
		}
		patient = {
			trigger = {
				root.faith = { trait_is_virtue = patient }
			}
		}
		impatient = {
			trigger = {
				root.faith = { trait_is_virtue = impatient }
			}
		}
		arrogant = {
			trigger = {
				root.faith = { trait_is_virtue = arrogant }
			}
		}
		humble = {
			trigger = {
				root.faith = { trait_is_virtue = humble }
			}
		}
		deceitful = {
			trigger = {
				root.faith = { trait_is_virtue = deceitful }
			}
		}
		honest = {
			trigger = {
				root.faith = { trait_is_virtue = honest }
			}
		}
		craven = {
			trigger = {
				root.faith = { trait_is_virtue = craven }
			}
		}
		brave = {
			trigger = {
				root.faith = { trait_is_virtue = brave }
			}
		}
		ambitious = {
			trigger = {
				root.faith = { trait_is_virtue = ambitious }
			}
		}
		content = {
			trigger = {
				root.faith = { trait_is_virtue = content }
			}
		}
		arbitrary = {
			trigger = {
				root.faith = { trait_is_virtue = arbitrary }
			}
		}
		just = {
			trigger = {
				root.faith = { trait_is_virtue = just }
			}
		}
		paranoid = {
			trigger = {
				root.faith = { trait_is_virtue = paranoid }
			}
		}
		trusting = {
			trigger = {
				root.faith = { trait_is_virtue = trusting }
			}
		}
		compassionate = {
			trigger = {
				root.faith = { trait_is_virtue = compassionate }
			}
		}
		callous = {
			trigger = {
				root.faith = { trait_is_virtue = callous }
			}
		}
		sadistic = {
			trigger = {
				root.faith = { trait_is_virtue = sadistic }
			}
		}
		stubborn = {
			trigger = {
				root.faith = { trait_is_virtue = stubborn }
			}
		}
		fickle = {
			trigger = {
				root.faith = { trait_is_virtue = fickle }
			}
		}
		vengeful = {
			trigger = {
				root.faith = { trait_is_virtue = vengeful }
			}
		}
		forgiving = {
			trigger = {
				root.faith = { trait_is_virtue = forgiving }
			}
		}
	}
	
	faith = root.faith
	culture = root.culture
	gender_female_chance = root_faith_clergy_gender_female_chance
	learning = {
		min_template_high_skill
		max_template_high_skill
	}

	after_creation = {
		add_character_flag = {
			flag = need_priest_outfit
		}
	}
}

monk_character_template = {
	age = { 25 60 }
	dynasty = none
	random_traits_list = {
		count = 1
		education_learning_2 = {}
		education_learning_3 = {}
		education_learning_4 = {}
	}
	trait = devoted
	random_traits = yes
	faith = root.faith
	culture = root.culture
	gender_female_chance = root_faith_clergy_gender_female_chance
	learning = {
		min_template_high_skill
		max_template_high_skill
	}
}

location_pilgrim_template = {
	age = { 20 65 }
	dynasty = none
	# Education.
	random_traits_list = {
		count = 1
		education_diplomacy_1 = {}
		education_diplomacy_2 = {}
		education_martial_1 = {}
		education_martial_2 = {}
		education_stewardship_1 = {}
		education_stewardship_2 = {}
		education_intrigue_1 = {}
		education_intrigue_2 = {}
		education_learning_1 = {}
		education_learning_2 = {}
	}
	# Personality
	## Everybody gets zealous.
	trait = zealous
	## Everybody gets _one_ trait that matters, either a pious one they celebrate or a sinful one they're looking to atone for.
	random_traits_list = {
		count = 1
		lustful = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = lustful
						trait_is_sin = lustful
					}
				}
			}
		}
		chaste = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = chaste
						trait_is_sin = chaste
					}
				}
			}
		}
		gluttonous = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = gluttonous
						trait_is_sin = gluttonous
					}
				}
			}
		}
		temperate = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = temperate
						trait_is_sin = temperate
					}
				}
			}
		}
		greedy = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = greedy
						trait_is_sin = greedy
					}
				}
			}
		}
		generous = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = generous
						trait_is_sin = generous
					}
				}
			}
		}
		wrathful = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = wrathful
						trait_is_sin = wrathful
					}
				}
			}
		}
		calm = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = calm
						trait_is_sin = calm
					}
				}
			}
		}
		patient = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = patient
						trait_is_sin = patient
					}
				}
			}
		}
		impatient = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = impatient
						trait_is_sin = impatient
					}
				}
			}
		}
		arrogant = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = arrogant
						trait_is_sin = arrogant
					}
				}
			}
		}
		humble = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = humble
						trait_is_sin = humble
					}
				}
			}
		}
		deceitful = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = deceitful
						trait_is_sin = deceitful
					}
				}
			}
		}
		honest = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = honest
						trait_is_sin = honest
					}
				}
			}
		}
		craven = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = craven
						trait_is_sin = craven
					}
				}
			}
		}
		brave = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = brave
						trait_is_sin = brave
					}
				}
			}
		}
		ambitious = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = ambitious
						trait_is_sin = ambitious
					}
				}
			}
		}
		content = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = content
						trait_is_sin = content
					}
				}
			}
		}
		arbitrary = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = arbitrary
						trait_is_sin = arbitrary
					}
				}
			}
		}
		just = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = just
						trait_is_sin = just
					}
				}
			}
		}
		paranoid = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = paranoid
						trait_is_sin = paranoid
					}
				}
			}
		}
		trusting = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = trusting
						trait_is_sin = trusting
					}
				}
			}
		}
		compassionate = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = compassionate
						trait_is_sin = compassionate
					}
				}
			}
		}
		callous = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = callous
						trait_is_sin = callous
					}
				}
			}
		}
		sadistic = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = sadistic
						trait_is_sin = sadistic
					}
				}
			}
		}
		stubborn = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = stubborn
						trait_is_sin = stubborn
					}
				}
			}
		}
		fickle = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = fickle
						trait_is_sin = fickle
					}
				}
			}
		}
		vengeful = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = vengeful
						trait_is_sin = vengeful
					}
				}
			}
		}
		forgiving = {
			trigger = {
				faith = {
					OR = {
						trait_is_virtue = forgiving
						trait_is_sin = forgiving
					}
				}
			}
		}
	}
	## And finally everyone gets one of the remaining traits.
	random_traits_list = {
		count = 1
		lustful = {
			trigger = {
				NOT = { has_trait = chaste }
				faith = {
					NOR = {
						trait_is_virtue = lustful
						trait_is_sin = lustful
					}
				}
			}
		}
		chaste = {
			trigger = {
				NOT = { has_trait = lustful }
				faith = {
					NOR = {
						trait_is_virtue = chaste
						trait_is_sin = chaste
					}
				}
			}
		}
		gluttonous = {
			trigger = {
				NOT = { has_trait = temperate }
				faith = {
					NOR = {
						trait_is_virtue = gluttonous
						trait_is_sin = gluttonous
					}
				}
			}
		}
		temperate = {
			trigger = {
				NOT = { has_trait = gluttonous }
				faith = {
					NOR = {
						trait_is_virtue = temperate
						trait_is_sin = temperate
					}
				}
			}
		}
		greedy = {
			trigger = {
				NOT = { has_trait = generous }
				faith = {
					NOR = {
						trait_is_virtue = greedy
						trait_is_sin = greedy
					}
				}
			}
		}
		generous = {
			trigger = {
				NOT = { has_trait = greedy }
				faith = {
					NOR = {
						trait_is_virtue = generous
						trait_is_sin = generous
					}
				}
			}
		}
		wrathful = {
			trigger = {
				NOT = { has_trait = calm }
				faith = {
					NOR = {
						trait_is_virtue = wrathful
						trait_is_sin = wrathful
					}
				}
			}
		}
		calm = {
			trigger = {
				NOT = { has_trait = wrathful }
				faith = {
					NOR = {
						trait_is_virtue = calm
						trait_is_sin = calm
					}
				}
			}
		}
		patient = {
			trigger = {
				NOT = { has_trait = impatient }
				faith = {
					NOR = {
						trait_is_virtue = patient
						trait_is_sin = patient
					}
				}
			}
		}
		impatient = {
			trigger = {
				NOT = { has_trait = patient }
				faith = {
					NOR = {
						trait_is_virtue = impatient
						trait_is_sin = impatient
					}
				}
			}
		}
		arrogant = {
			trigger = {
				NOT = { has_trait = humble }
				faith = {
					NOR = {
						trait_is_virtue = arrogant
						trait_is_sin = arrogant
					}
				}
			}
		}
		humble = {
			trigger = {
				NOT = { has_trait = arrogant }
				faith = {
					NOR = {
						trait_is_virtue = humble
						trait_is_sin = humble
					}
				}
			}
		}
		deceitful = {
			trigger = {
				NOT = { has_trait = honest }
				faith = {
					NOR = {
						trait_is_virtue = deceitful
						trait_is_sin = deceitful
					}
				}
			}
		}
		honest = {
			trigger = {
				NOT = { has_trait = deceitful }
				faith = {
					NOR = {
						trait_is_virtue = honest
						trait_is_sin = honest
					}
				}
			}
		}
		craven = {
			trigger = {
				NOT = { has_trait = brave }
				faith = {
					NOR = {
						trait_is_virtue = craven
						trait_is_sin = craven
					}
				}
			}
		}
		brave = {
			trigger = {
				NOT = { has_trait = craven }
				faith = {
					NOR = {
						trait_is_virtue = brave
						trait_is_sin = brave
					}
				}
			}
		}
		ambitious = {
			trigger = {
				NOT = { has_trait = content }
				faith = {
					NOR = {
						trait_is_virtue = ambitious
						trait_is_sin = ambitious
					}
				}
			}
		}
		content = {
			trigger = {
				NOT = { has_trait = ambitious }
				faith = {
					NOR = {
						trait_is_virtue = content
						trait_is_sin = content
					}
				}
			}
		}
		arbitrary = {
			trigger = {
				NOT = { has_trait = just }
				faith = {
					NOR = {
						trait_is_virtue = arbitrary
						trait_is_sin = arbitrary
					}
				}
			}
		}
		just = {
			trigger = {
				NOT = { has_trait = arbitrary }
				faith = {
					NOR = {
						trait_is_virtue = just
						trait_is_sin = just
					}
				}
			}
		}
		paranoid = {
			trigger = {
				NOT = { has_trait = trusting }
				faith = {
					NOR = {
						trait_is_virtue = paranoid
						trait_is_sin = paranoid
					}
				}
			}
		}
		trusting = {
			trigger = {
				NOT = { has_trait = paranoid }
				faith = {
					NOR = {
						trait_is_virtue = trusting
						trait_is_sin = trusting
					}
				}
			}
		}
		compassionate = {
			trigger = {
				NOR = {
					has_trait = callous
					has_trait = sadistic
				}
				faith = {
					NOR = {
						trait_is_virtue = compassionate
						trait_is_sin = compassionate
					}
				}
			}
		}
		callous = {
			trigger = {
				NOR = {
					has_trait = compassionate
					has_trait = sadistic
				}
				faith = {
					NOR = {
						trait_is_virtue = callous
						trait_is_sin = callous
					}
				}
			}
		}
		sadistic = {
			trigger = {
				NOR = {
					has_trait = compassionate
					has_trait = callous
				}
				faith = {
					NOR = {
						trait_is_virtue = sadistic
						trait_is_sin = sadistic
					}
				}
			}
		}
		stubborn = {
			trigger = {
				NOT = { has_trait = fickle }
				faith = {
					NOR = {
						trait_is_virtue = stubborn
						trait_is_sin = stubborn
					}
				}
			}
		}
		fickle = {
			trigger = {
				NOT = { has_trait = stubborn }
				faith = {
					NOR = {
						trait_is_virtue = fickle
						trait_is_sin = fickle
					}
				}
			}
		}
		vengeful = {
			trigger = {
				NOT = { has_trait = forgiving }
				faith = {
					NOR = {
						trait_is_virtue = vengeful
						trait_is_sin = vengeful
					}
				}
			}
		}
		forgiving = {
			trigger = {
				NOT = { has_trait = vengeful }
				faith = {
					NOR = {
						trait_is_virtue = forgiving
						trait_is_sin = forgiving
					}
				}
			}
		}
	}
	
	faith = root.faith
	culture = root.location.culture
	gender_female_chance = 50
	random_traits = no
	# Skills.
	## Generally, we let people have a range of decent-ish competencies; they're the pilgrims a ruler takes not of, after all.
	diplomacy = {
		min_template_low_skill
		max_template_high_skill
	}
	martial = {
		min_template_low_skill
		max_template_high_skill
	}
	stewardship = {
		min_template_low_skill
		max_template_high_skill
	}
	intrigue = {
		min_template_low_skill
		max_template_high_skill
	}
	learning = {
		min_template_low_skill
		max_template_high_skill
	}

	after_creation = {
		# Now we want to add a little spice to some of them, sprinkled evenly.
		## Some get lifestyles.
		random = {
			chance = 20
			random_list = {
				# Reveler.
				100 = { add_trait = lifestyle_reveler }
				# Blademaster.
				100 = { add_trait = lifestyle_blademaster }
				# Hunter.
				100 = {
					trigger = { is_vegetarian_trigger = no }
					add_trait = lifestyle_hunter
				}
				# Mystic.
				100 = {
					trigger = {
						NOT = {
							faith = { has_doctrine_parameter = witchcraft_illegal }
						}
					}
					add_trait = lifestyle_mystic
				}
				# Physician.
				100 = { add_trait = lifestyle_physician }
				# Herbalist.
				100 = { add_trait = lifestyle_herbalist }
				# Gardener.
				100 = { add_trait = lifestyle_gardener }
				# Traveller.
				100 = { add_trait = lifestyle_traveler }
				# Plus some that _aren't_ lifestyles but which fit most here.
				## Poet.
				100 = { add_trait = lifestyle_poet }
				## Loyal.
				100 = { add_trait = loyal }
				## Disloyal.
				100 = { add_trait = disloyal }
			}
		}
		# Some get stress coping traits.
		random = {
			chance = 20
			random_list = {
				# Drunkard.
				## We allow this for everyone despite zeal because we want the pilgrims to feel a bit more complex.
				100 = { add_trait = drunkard }
				# Hashishiyah.
				100 = {
					trigger = { can_be_hashishiyah = yes }
					add_trait = hashishiyah
				}
				# Rakish.
				100 = { add_trait = rakish }
				# Reclusive.
				100 = { add_trait = reclusive }
				# Irritable.
				100 = { add_trait = irritable }
				# Flagellant.
				100 = { add_trait = flagellant }
				# Profligate.
				100 = { add_trait = profligate }
				# Improvident.
				100 = { add_trait = improvident }
				# Contrite.
				100 = { add_trait = contrite }
				# Comfort Eater.
				100 = { add_trait = comfort_eater }
				# Inappetetic.
				100 = { add_trait = inappetetic }
				# Journaller.
				100 = { add_trait = journaller }
				# Confider.
				100 = { add_trait = confider }
				# Athletic.
				100 = { add_trait = athletic }
			}
		}
		# Some get health conditions.
		random = {
			chance = 5
			random_list = {
				# Depression.
				100 = {
					random_list = {
						100 = { add_trait = depressed_genetic }
						100 = { add_trait = depressed_1 }
					}
				}
				# Schizophrenia.
				100 = {
					random_list = {
						100 = { add_trait = lunatic_genetic }
						100 = { add_trait = lunatic_1 }
					}
				}
				# Epilepsy.
				100 = {
					random_list = {
						100 = { add_trait = possessed_genetic }
						100 = { add_trait = possessed_1 }
					}
				}
				# Leprosy.
				100 = { add_trait = leper }
				# Syphilis.
				100 = { add_trait = great_pox }
				# Lover's Pox.
				100 = { add_trait = lovers_pox }
				# Eunuch.
				100 = {
					trigger = { is_male = yes }
					if = {
						limit = {
							age >= 12
						}
						add_trait = eunuch_1
					}
					else = {
						add_trait = beardless_eunuch
					}
				}
			}
		}
		# Some have religious convictions of note.
		random = {
			chance = 5
			random_list = {
				# Celibate.
				100 = {
					trigger = {
						NOT = {
							faith = { trait_is_virtue = celibate}
						}
					}
					add_trait = celibate
				}
				# Pilgrim.
				100 = {
					trigger = {
						NOT = { religion = religion:islam_religion }
					}
					add_trait = pilgrim
				}
				# Hajjaj.
				100 = {
					trigger = { religion = religion:islam_religion}
					add_trait = hajjaj
				}
				# Devoted.
				100 = { add_trait = devoted }
				# Faith Warrior.
				100 = {
					trigger = {
						# Check that a GHW has actually happened that they could've fought in.
						faith = { has_variable = variable_ghw_cooldown }
						# And that they're the right gender to fight for their faith/culture.
						save_temporary_scope_as = char_temp
						can_be_knight_trigger = { ARMY_OWNER = scope:char_temp }
					}
					add_trait = faith_warrior
					# We don't want age to look wonky here, so we'll need to set a minimum.
					## GHWs have a cooldown of 30 years, and our minimum age is 20.
					### So assuming our crusader was at least 20 when they fought, and the war was at most 30 years ago, we need to be 50 to ensure we were old enough to fight.
					if = {
						limit = { age < 50 }
						set_age = 50
					}
				}
			}
		}
	}
}

tournament_priest_character_template = {
	age = { 30 60 }
	dynasty = none
	random_traits_list = {
		count = 1
		education_learning_2 = {}
		education_learning_3 = {}
		education_learning_4 = {}
	}
	random_traits = yes
	
	faith = scope:activity.activity_host.faith
	culture =  scope:activity.activity_location.culture
	gender_female_chance = activity_host_clergy_gender_female_chance
	learning = {
		min_template_high_skill
		max_template_high_skill
	}

	after_creation = {
		add_character_flag = {
			flag = need_priest_outfit
		}
	}
}

monk_brewer_template = {
	age = { 18 28 }
	dynasty = none
	random_traits_list = {
		count = 1
		education_learning_2 = {}
		education_learning_3 = {}
		education_learning_4 = {}
	}

	random_traits_list = {
		count = 1
		diligent = {}
		patient = {}
	}

	random_traits_list = {
		count = 2
		humble = {}
		content = {}
		gluttonous = {}
		chaste = {}
		generous = {}
		calm = {}
		deceitful = {}
		honest = {}
		craven = {}
		gregarious = {}
		arbitrary = {}
		just = {}
		zealous = {}
		trusting = {}
	}

	trait = devoted
	
	faith = root.faith
	culture = root.culture
	gender_female_chance = root_faith_clergy_gender_female_chance
	learning = {
		min_template_high_skill
		max_template_high_skill
	}
}
