#################################### THE DUKE AND THE BODENSEE ######################################
#																									#
# The Duke of Swabia sat by the shores of the Bodensee with his fishing rod for many months without #
# reward. He had even put a lovely slice of dove pie on the hook, but his bucket remained empty.	#
# "Are there no characters in the lake?" he thought to himself and sighed. "At this rate, my court 	#
# will become desolate within a generation! My heir will have no diligent councillors, no brave 	#
# knights, and no wise crones to help him rule the lands!" 											#		
#																									#
# The Duke cried for a long, long while, and then stood up to gathering his things.					#
# "Thank God!" he suddenly exclaimed. "I have an idea!"												#
# If the lake was empty, could he not create some new characters and release them into the waters?  #
# If some of them married, the Bodensee would surely be repopulated in just a few years!			#
#																									#
# The clever Duke quickly got to work. He made maidens and adventurers, matrons and fools. Young	#
# and old he made them, weak and strong, wicked and pious. The sun rose in the sky and set again.	#
# Under the light of moon and stars, the Duke put the final touch on his creation. 					#
#																									#
# The next morning, he gently released the little characters into the waters. He watched them swim 	#
# away with tears of happiness trailing down his whiskered cheeks. This was farewell, but he was 	#
# certain - they would not be gone for long.														#
#																									#
# And this is the story behind why pools spawn new characters for the royal courts all over the 	#
# world. Whenever we throw our hook into the depths, we send a thought of gratitude to the noble 	#
# Duke of Swabia, and his marvelous creation.														#
#																									#
#####################################################################################################





#Notes
#Random Traits List contains relevant lifestyle traits and all personality traits exist in 1 template
#Template-specific skill min/max regulated through scripted values
#Template-specific education trait is weighted

pool_repopulate_prowess = {
	age = { 20 40 }
	random_traits = yes
	gender_female_chance = root_soldier_female_chance
	culture = root.culture
	faith = root.faith
	prowess = {
		min_guest_template_skill max_guest_template_skill
	}
	random_traits_list = {
		education_martial_1 = { weight = { base = 35 } }
		education_martial_2 = { weight = { base = 35 } }
		education_martial_3 = { weight = { base = 20 } }
		education_martial_4 = { weight = { base = 10 } }
	}
	random_traits_list = {
		count = { 0 1 }
		lifestyle_blademaster = {}
		gallant = {}
		brave = {}
		gluttonous = {}
		strong = {}
		athletic = {}
		lifestyle_hunter = {}
	}
	dynasty = none
	after_creation = {
		random_list = {
			200 = {
				# Character is of average weight, nothing happens	
			}
			25 = {
				change_current_weight = -25
			}
			25 = {
				change_current_weight = -75
			}
			25 = {
				change_current_weight = 25
			}
			25 = {
				change_current_weight = 75
			}
			5 = {
				change_current_weight = 100
			}
			5 = {
				change_current_weight = 200
			}
		}
		random = {
			chance = 1
			
			add_trait = lifestyle_poet
			
			modifier = {
				add = 10
				culture = { has_cultural_parameter = poet_trait_more_common }
			}
			modifier = {
				add = 5
				OR = {
					culture = { has_cultural_pillar = heritage_north_germanic }
					religion = religion:germanic_religion
				}
			}
		}
		
		# Cultural Traditions
		if = {
			limit = {
				culture = {
					has_cultural_parameter = winter_soldier_trait_more_common
				}
				NOT = {
					has_trait = winter_soldier
				}
			}
			random = {
				chance = 10
				add_trait = winter_soldier
			}
		}
		if = {
			limit = {
				culture = {
					has_cultural_parameter = forest_fighter_trait_more_common
				}
				NOT = {
					has_trait = forest_fighter
				}
			}
			random = {
				chance = 10
				add_trait = forest_fighter
			}
		}
		if = {
			limit = {
				culture = {
					has_cultural_parameter = rough_terrain_expert_trait_more_common
				}
				NOT = {
					has_trait = rough_terrain_expert
				}
			}
			random = {
				chance = 10
				add_trait = rough_terrain_expert
			}
		}
		if = {
			limit = {
				culture = {
					has_cultural_parameter = desert_warrior_trait_more_common
				}
				NOT = {
					has_trait = desert_warrior
				}
			}
			random = {
				chance = 10
				add_trait = desert_warrior
			}
		}
		if = {
			limit = {
				culture = {
					has_cultural_parameter = jungle_stalker_trait_more_common
				}
				NOT = {
					has_trait = jungle_stalker
				}
			}
			random = {
				chance = 10
				add_trait = jungle_stalker
			}
		}
		set_interesting_traits_and_modifiers_effect = yes
		add_random_tiered_trait_xp_effect = {
			TRAIT = lifestyle_blademaster
			LEVEL_1 = yes
			LEVEL_3 = yes
		}
		add_random_tiered_trait_track_xp_effect = {
			TRAIT = lifestyle_hunter
			TRACK = hunter
			LEVEL_1 = yes
			LEVEL_3 = no
		}
		# ToTo Hastiluder
		if = {
			limit = { has_dlc_feature = tours_and_tournaments }
			random = {
				chance = 33
				add_trait = tourney_participant
				add_random_tourney_participant_level_effect = yes
			}
		}
	}
}

pool_repopulate_diplomacy = {
	age = { 20 40 }
	gender_female_chance = root_faith_dominant_gender_adjusted_female_chance #because chancellor gender is doctrine dependent
	random_traits = yes
	culture = root.culture
	faith = root.faith
	diplomacy = {
		min_guest_template_skill max_guest_template_skill
	}
	random_traits_list = {
		education_diplomacy_1 = { weight = { base = 35 } }
		education_diplomacy_2 = { weight = { base = 35 } }
		education_diplomacy_3 = { weight = { base = 20 } }
		education_diplomacy_4 = { weight = { base = 10 } }
	}
	random_traits_list = {
		count = { 0 1 }
		diplomat = {}
		family_first = {}
		august = {}
		lifestyle_reveler = {}
		generous = {}
		arrogant = {}
		honest = {}
		gregarious = {}
		trusting = {}
		compassionate = {}
		fickle = {}
		forgiving = {}
		lifestyle_poet = {}
		tourney_participant = {}
		lifestyle_traveler = {}
	}
	dynasty = none
	after_creation = {
		random_list = {
			200 = {
				# Character is of average weight, nothing happens	
			}
			25 = {
				change_current_weight = -25
			}
			25 = {
				change_current_weight = -75
			}
			25 = {
				change_current_weight = 25
			}
			25 = {
				change_current_weight = 75
			}
			5 = {
				change_current_weight = 100
			}
			5 = {
				change_current_weight = 200
			}
		}
		random = {
			chance = 1
			
			add_trait = lifestyle_poet
			
			modifier = {
				add = 15
				culture = { has_cultural_parameter = poet_trait_more_common }
			}
			modifier = {
				add = 10
				OR = {
					culture = { has_cultural_pillar = heritage_north_germanic }
					religion = religion:germanic_religion
				}
			}
		}
		set_interesting_traits_and_modifiers_effect = yes
		if = {
			limit = { has_trait = lifestyle_reveler }
			add_trait_xp = {
				trait = lifestyle_reveler
				value = {
					integer_range = {
						min = small_lifestyle_random_xp_low
						max = small_lifestyle_random_xp_high
					}
				}
			}
		}
		add_random_tiered_trait_track_xp_effect = {
			TRAIT = tourney_participant
			TRACK = wit
			LEVEL_1 = yes
			LEVEL_3 = no
		}
	}
}

pool_repopulate_martial = {
	age = { 30 45 }
	gender_female_chance = root_faith_dominant_gender_adjusted_female_chance #because marshal gender is doctrine dependent
	random_traits = yes
	culture = root.culture
	faith = root.faith
	martial = {
		min_guest_template_skill max_guest_template_skill
	}
	random_traits_list = {
		education_martial_1 = { weight = { base = 35 } }
		education_martial_2 = { weight = { base = 35 } }
		education_martial_3 = { weight = { base = 20 } }
		education_martial_4 = { weight = { base = 10 } }
	}
	random_traits_list = {
		count = { 0 1 }
		strategist = {}
		overseer = {}
		wrathful = {}
		zealous = {}
		impatient = {}
		lifestyle_hunter = {}
		tourney_participant = {}
	}
	dynasty = none
	after_creation = {
		random_list = {
			200 = {
				# Character is of average weight, nothing happens	
			}
			25 = {
				change_current_weight = -25
			}
			25 = {
				change_current_weight = -75
			}
			25 = {
				change_current_weight = 25
			}
			25 = {
				change_current_weight = 75
			}
			5 = {
				change_current_weight = 100
			}
			5 = {
				change_current_weight = 200
			}
		}
		if = {
			limit = {
				OR = {
					culture = { has_cultural_pillar = heritage_north_germanic }
					religion = religion:germanic_religion
				}
			}
			random_list = {
				65 = {}
				15 = {
					add_trait = varangian
				}
				15 = {
					add_trait = berserker
				}
				5 = {
					add_trait = lifestyle_poet
				}
			}
		}
		
		# Cultural Traditions
		if = {
			limit = {
				culture = {
					has_cultural_parameter = poet_trait_more_common
				}
				NOT = {
					has_trait = lifestyle_poet
				}
			}
			random = {
				chance = 10
				add_trait = lifestyle_poet
			}
		}
		if = {
			limit = {
				culture = {
					has_cultural_parameter = winter_soldier_trait_more_common
				}
				NOT = {
					has_trait = winter_soldier
				}
			}
			random = {
				chance = 10
				add_trait = winter_soldier
			}
		}
		if = {
			limit = {
				culture = {
					has_cultural_parameter = forest_fighter_trait_more_common
				}
				NOT = {
					has_trait = forest_fighter
				}
			}
			random = {
				chance = 10
				add_trait = forest_fighter
			}
		}
		if = {
			limit = {
				culture = {
					has_cultural_parameter = rough_terrain_expert_trait_more_common
				}
				NOT = {
					has_trait = rough_terrain_expert
				}
			}
			random = {
				chance = 10
				add_trait = rough_terrain_expert
			}
		}
		if = {
			limit = {
				culture = {
					has_cultural_parameter = desert_warrior_trait_more_common
				}
				NOT = {
					has_trait = desert_warrior
				}
			}
			random = {
				chance = 10
				add_trait = desert_warrior
			}
		}
		if = {
			limit = {
				culture = {
					has_cultural_parameter = jungle_stalker_trait_more_common
				}
				NOT = {
					has_trait = jungle_stalker
				}
			}
			random = {
				chance = 10
				add_trait = jungle_stalker
			}
		}
		set_interesting_traits_and_modifiers_effect = yes
		add_random_tiered_trait_track_xp_effect = {
			TRAIT = lifestyle_hunter
			TRACK = hunter
			LEVEL_1 = yes
			LEVEL_3 = no
		}
		add_random_tiered_trait_track_xp_effect = {
			TRAIT = tourney_participant
			TRACK = wit
			LEVEL_1 = yes
			LEVEL_3 = no
		}
	}
}

pool_repopulate_stewardship = {
	age = { 20 40 }
	gender_female_chance = root_faith_dominant_gender_adjusted_female_chance #because steward gender is doctrine dependent
	random_traits = yes
	culture = root.culture
	faith = root.faith
	stewardship = {
		min_guest_template_skill max_guest_template_skill
	}
	random_traits_list = {
		education_stewardship_1 = { weight = { base = 35 } }
		education_stewardship_2 = { weight = { base = 35 } }
		education_stewardship_3 = { weight = { base = 20 } }
		education_stewardship_4 = { weight = { base = 10 } }
	}
	random_traits_list = {
		count = { 0 1 }
		architect = {}
		administrator = {}
		avaricious = {}
		temperate = {}
		greedy = {}
		just = {}
		stubborn = {}
		ambitious = {}
	}
	dynasty = none
	after_creation = {
		random_list = {
			200 = {
				# Character is of average weight, nothing happens	
			}
			25 = {
				change_current_weight = -25
			}
			25 = {
				change_current_weight = -75
			}
			25 = {
				change_current_weight = 25
			}
			25 = {
				change_current_weight = 75
			}
			5 = {
				change_current_weight = 100
			}
			5 = {
				change_current_weight = 200
			}
		}
		random = {
			chance = 1
			
			add_trait = lifestyle_poet
			
			modifier = {
				add = 10
				culture = { has_cultural_parameter = poet_trait_more_common }
			}
			modifier = {
				add = 5
				OR = {
					culture = { has_cultural_pillar = heritage_north_germanic }
					religion = religion:germanic_religion
				}
			}
		}
		set_interesting_traits_and_modifiers_effect = yes
	}
}

pool_repopulate_intrigue = {
	age = { 25 40 }
	random_traits = yes
	gender_female_chance = 50 #No gender blocks for spymaster
	culture = root.culture
	faith = root.faith
	intrigue = {
		min_guest_template_skill max_guest_template_skill
	}
	random_traits_list = {
		education_intrigue_1 = { weight = { base = 35 } }
		education_intrigue_2 = { weight = { base = 35 } }
		education_intrigue_3 = { weight = { base = 20 } }
		education_intrigue_4 = { weight = { base = 10 } }
	}
	random_traits_list = {
		count = { 0 1 }
		schemer = {}
		seducer = {}
		torturer = {}
		deceitful = {}
		lustful = {}
		calm = {}
		arbitrary = {}
		paranoid = {}
		callous = {}
		sadistic = {}
		vengeful = {}
		craven = {}
	}
	dynasty = none
	after_creation = {
		random_list = {
			200 = {
				# Character is of average weight, nothing happens	
			}
			25 = {
				change_current_weight = -25
			}
			25 = {
				change_current_weight = -75
			}
			25 = {
				change_current_weight = 25
			}
			25 = {
				change_current_weight = 75
			}
			5 = {
				change_current_weight = 100
			}
			5 = {
				change_current_weight = 200
			}
		}
		random = {
			chance = 1
			
			add_trait = lifestyle_poet
			
			modifier = {
				add = 10
				culture = { has_cultural_parameter = poet_trait_more_common }
			}
			modifier = {
				add = 5
				OR = {
					culture = { has_cultural_pillar = heritage_north_germanic }
					religion = religion:germanic_religion
				}
			}
		}
		set_interesting_traits_and_modifiers_effect = yes
	}
}

pool_repopulate_learning = {
	age = { 25 60 }
	gender_female_chance = 50 #No gender blocks for physicians
	random_traits = yes
	culture = root.culture
	faith = root.faith
	learning = {
		min_guest_template_skill max_guest_template_skill
	}
	random_traits_list = {
		education_learning_1 = { weight = { base = 35 } }
		education_learning_2 = { weight = { base = 35 } }
		education_learning_3 = { weight = { base = 20 } }
		education_learning_4 = { weight = { base = 10 } }
	}
	random_traits_list = {
		count = { 0 1 }
		scholar = {}
		theologian = {}
		whole_of_body = {}
		lifestyle_physician = {}
		lifestyle_mystic = {}
		lifestyle_herbalist = {}
		chaste = {}
		diligent = {}
		patient = {}
		humble = {}
		shy = {}
		content = {}
		cynical = {}
		lazy = {}
	}
	dynasty = none
	after_creation = {
		random_list = {
			200 = {
				# Character is of average weight, nothing happens	
			}
			25 = {
				change_current_weight = -25
			}
			25 = {
				change_current_weight = -75
			}
			25 = {
				change_current_weight = 25
			}
			25 = {
				change_current_weight = 75
			}
			5 = {
				change_current_weight = 100
			}
			5 = {
				change_current_weight = 200
			}
		}
		if = {
			limit = {
				faith = {
					has_doctrine = tenet_monasticism
				}
			}
			random_list = {
				75 = {}
				25 = {
					add_trait = devoted
				}
			}
		}
		random = {
			chance = 1
			
			add_trait = lifestyle_poet
			
			modifier = {
				add = 10
				culture = { has_cultural_parameter = poet_trait_more_common }
			}
			modifier = {
				add = 5
				OR = {
					culture = { has_cultural_pillar = heritage_north_germanic }
					religion = religion:germanic_religion
				}
			}
		}
		set_interesting_traits_and_modifiers_effect = yes
		add_random_tiered_trait_xp_effect = {
			TRAIT = lifestyle_physician
			LEVEL_1 = yes
			LEVEL_3 = yes
		}
		add_random_tiered_trait_xp_effect = {
			TRAIT = lifestyle_mystic
			LEVEL_1 = yes
			LEVEL_3 = no
		}
	}
}


pool_repopulate_spouse = {
	gender_female_chance = root.marriage_gender_adjusted_female_chance
	age = { 16 26 }
	random_traits = yes
	culture = root.culture
	faith = root.faith
	random_traits_list = {
		education_diplomacy_1 = { weight = { base = 35 } }
		education_diplomacy_2 = { weight = { base = 35 } }
		education_diplomacy_3 = { weight = { base = 20 } }
		education_diplomacy_4 = { weight = { base = 10 } }
		education_martial_1 = {
			weight = {
				base = 35
				modifier = { # Less common with martial education if character can't be combatant because of gender
					factor = 0.3
					trigger_if = {
						limit = { root = { is_female = yes } }
						dummy_male = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
					}
					trigger_else = {
						dummy_female = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
					}
				}
			}
		}
		education_martial_2 = {
			weight = {
				base = 35
				modifier = { # Less common with martial education if character can't be combatant because of gender
					factor = 0.3
					trigger_if = {
						limit = { root = { is_female = yes } }
						dummy_male = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
					}
					trigger_else = {
						dummy_female = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
					}
				}
			}
		}
		education_martial_3 = {
			weight = {
				base = 20
				modifier = { # Less common with martial education if character can't be combatant because of gender
					factor = 0.3
					trigger_if = {
						limit = { root = { is_female = yes } }
						dummy_male = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
					}
					trigger_else = {
						dummy_female = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
					}
				}
			}
		}
		education_martial_4 = {
			weight = {
				base = 10
				modifier = { # Less common with martial education if character can't be combatant because of gender
					factor = 0.3
					trigger_if = {
						limit = { root = { is_female = yes } }
						dummy_male = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
					}
					trigger_else = {
						dummy_female = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
					}
				}
			}
		}
		education_stewardship_1 = { weight = { base = 35 } }
		education_stewardship_2 = { weight = { base = 35 } }
		education_stewardship_3 = { weight = { base = 20 } }
		education_stewardship_4 = { weight = { base = 10 } }
		education_intrigue_1 = { weight = { base = 35 } }
		education_intrigue_2 = { weight = { base = 35 } }
		education_intrigue_3 = { weight = { base = 20 } }
		education_intrigue_4 = { weight = { base = 10 } }
		education_learning_1 = { weight = { base = 35 } }
		education_learning_2 = { weight = { base = 35 } }
		education_learning_3 = { weight = { base = 20 } }
		education_learning_4 = { weight = { base = 10 } }
	}
	random_traits_list = {
		count = { 0 1 }
		diplomat = {}
		strategist = {}
		architect = {}
		schemer = {}
		scholar = {}
		whole_of_body = {}
		fecund = {}
		intellect_good_1 = {}
		physique_good_1 = {}
		beauty_good_1 = {}
	}
	dynasty = none
	after_creation = {
		random_list = {
			200 = {
				# Character is of average weight, nothing happens	
			}
			25 = {
				change_current_weight = -25
			}
			25 = {
				change_current_weight = -75
			}
			25 = {
				change_current_weight = 25
			}
			25 = {
				change_current_weight = 75
			}
			5 = {
				change_current_weight = 100
			}
			5 = {
				change_current_weight = 200
			}
		}
		random = {
			chance = 1
			
			add_trait = lifestyle_poet
			
			modifier = {
				add = 10
				culture = { has_cultural_parameter = poet_trait_more_common }
			}
			modifier = {
				add = 5
				OR = {
					culture = { has_cultural_pillar = heritage_north_germanic }
					religion = religion:germanic_religion
				}
			}
		}
		set_interesting_traits_and_modifiers_effect = yes
	}
}

pool_repopulate_local_flavor = {
	age = { 25 45 }
	gender_female_chance = root_faith_dominant_gender_adjusted_female_chance #because council gender is doctrine dependent
	random_traits = yes
	faith = root.faith
	
	random_culture = {
		culture:ashkenazi = {
			trigger = {
				NOT = {
					root.faith = { religion = { is_in_family = rf_pagan } }
				}
				root.capital_province = {
					OR = {
						geographical_region = world_europe
						geographical_region = world_asia_minor
					}
				}
			}
		}
		root.culture = {
			trigger = {
				root.faith = { religion = { is_in_family = rf_pagan } }
			}
		}
		culture:NEOW_sephardi = {
			trigger = {
				root.capital_province = {
					geographical_region = world_europe
				}
			}
		}
		culture:sharoni = {
			trigger = {
				root.capital_province = {
					geographical_region = world_europe_south
				}
			}
		}
		culture:cale = {
			trigger = {
				root.capital_province = {
					OR = {
						geographical_region = world_europe_west_francia
						geographical_region = world_europe_west_iberia
					}
				}
			}
		}
		culture:atlantannach = {
			trigger = {
				root.capital_province = {
					geographical_region = world_europe
				}
			}
		}
		culture:beur = {
			trigger = {
				root.capital_province = {
					OR = {
						geographical_region = world_europe_west_francia
						geographical_region = world_europe_west_germania
					}
				}
			}
		}
		culture:turkisch = {
			trigger = {
				root.capital_province = {
					geographical_region = world_europe_west_germania
				}
			}
		}
		culture:traveller = {
			trigger = {
				root.capital_province = {
					geographical_region = world_europe_west_britannia
				}
			}
		}
		culture:kurdish = {
			trigger = {
				root.capital_province = {
					geographical_region = world_middle_east_persia
				}
			}
		}
		culture:rajput = {
			trigger = {
				root.capital_province = {
					geographical_region = world_india
				}
			}
		}
		culture:hindustani = {
			trigger = {
				root.capital_province = {
					geographical_region = world_india_rajastan
				}
			}
		}
		culture:gujarati = {
			trigger = {
				root.capital_province = {
					geographical_region = world_india_rajastan
				}
			}
		}
		culture:marathi = {
			trigger = {
				root.capital_province = {
					OR = {
						geographical_region = world_india_rajastan
						geographical_region = world_india_deccan
					}
				}
			}
		}
		culture:tamil = {
			trigger = {
				root.capital_province = {
					OR = {
						geographical_region = world_india_deccan
						geographical_region = world_asia_southeast_islands
					}
				}
			}
		}
		culture:telugu = {
			trigger = {
				root.capital_province = {
					geographical_region = world_india_deccan
				}
			}
		}
		culture:kannada = {
			trigger = {
				root.capital_province = {
					geographical_region = world_india_deccan
				}
			}
		}
		culture:bengali = {
			trigger = {
				root.capital_province = {
					OR = {
						geographical_region = world_india_bengal
						geographical_region = world_burma
					}
				}
			}
		}
		culture:burmese = {
			trigger = {
				root.capital_province = {
					OR = {
						geographical_region = world_india_bengal
						geographical_region = world_burma
					}
				}
			}
		}
		culture:butr = {
			trigger = {
				root.capital_province = {
					geographical_region = world_africa
				}
			}
		}
		culture:zaghawa = {
			trigger = {
				root.capital_province = {
					geographical_region = world_africa
				}
			}
		}
		culture:bolghar = {
			trigger = {
				root.capital_province = {
					geographical_region = world_steppe_west
				}
			}
		}
		culture:assyrian = {
			trigger = {
				root.capital_province = {
					OR = {
						geographical_region = world_steppe_east
						geographical_region = world_steppe_tarim
					}
				}
			}
		}
		culture:khitan = {
			trigger = {
				root.capital_province = {
					OR = {
						geographical_region = world_steppe_east
						geographical_region = world_steppe_tarim
						geographical_region = world_tibet
						geographical_region = world_asia_north_east
					}
				}
			}
		}
		culture:han = {
			trigger = {
				root.capital_province = {
					OR = {
						geographical_region = world_steppe_east
						geographical_region = world_steppe_tarim
						geographical_region = world_tibet
						geographical_region = world_burma
						geographical_region = world_asia_north_east
						geographical_region = world_asia_china
						geographical_region = world_asia_korea
						geographical_region = world_asia_southeast_mainland
					}
				}
			}
		}
		culture:cuman = {
			trigger = {
				root.capital_province = {
					geographical_region = world_steppe_west
				}
			}
		}
		culture:bodpa = {
			trigger = {
				root.capital_province = {
					geographical_region = world_tibet
				}
			}
		}
		culture:somali = {
			trigger = {
				root.capital_province = {
					OR = {
						geographical_region = world_middle_east
						geographical_region = world_middle_east_persia
						geographical_region = world_africa_north_east
						AND = {
							geographical_region = world_india
							county.holder.faith = {
								religion_tag = islam_religion
							}
						}
					}
				}
			}
		}
		culture:swahili = {
			trigger = {
				root.capital_province = {
					geographical_region = dlc_tgp_swahili_coast_region
				}
			}
		}
		culture:yemeni = {
			trigger = {
				root.capital_province = {
					geographical_region = dlc_tgp_swahili_coast_region
					county.holder = {
						NOT = { government_has_flag = government_is_tribal }
						faith = { religion_tag = islam_religion }
					}
				}
			}
		}
		culture:persian = {
			trigger = {
				root.capital_province = {
					geographical_region = dlc_tgp_swahili_coast_region
					county.holder = {
						NOT = { government_has_flag = government_is_tribal }
						faith = { religion_tag = islam_religion }
					}
				}
			}
		}
		culture:japanese = {
			trigger = {
				root.capital_province = { geographical_region = world_asia_japan }
			}
		}
		culture:khanty = {
			trigger = {
				root.capital_province = {
					geographical_region = world_siberia
				}
			}
		}
	}
	
	learning = {
		min_guest_template_skill max_guest_template_skill
	}
	
	stewardship = {
		min_guest_template_skill max_guest_template_skill
	}
	
	diplomacy = {
		min_guest_template_skill max_guest_template_skill
	}
	
	random_traits_list = {
		education_learning_3 = { weight = { base = 10 } }
		education_learning_4 = { weight = { base = 20 } }
		education_stewardship_3 = { weight = { base = 5 } }
		education_stewardship_4 = { weight = { base = 10 } }
		education_diplomacy_3 = { weight = { base = 10 } }
		education_diplomacy_4 = { weight = { base = 20 } }
	}
	random_traits_list = {
		scholar = {}
		theologian = {}
		lifestyle_physician = {}
		lifestyle_mystic = {}
		lifestyle_herbalist = {}
		administrator = {}
		architect = {}
		diplomat = {}
		lifestyle_hunter = {}
	}
	dynasty = none
		
	
	after_creation = {
		random_list = {
			200 = {
				# Character is of average weight, nothing happens	
			}
			25 = {
				change_current_weight = -25
			}
			25 = {
				change_current_weight = -75
			}
			25 = {
				change_current_weight = 25
			}
			25 = {
				change_current_weight = 75
			}
			5 = {
				change_current_weight = 100
			}
			5 = {
				change_current_weight = 200
			}
		}
		if = {
			limit = {
				culture = { has_cultural_pillar = heritage_israelite }
			}
			add_character_flag = ai_will_not_convert
			set_character_faith = faith:congregationist
			if = {
				limit = {
					NOT = {
						knows_language_of_culture = root.capital_province.culture
					}
				}
				learn_language_of_culture = root.capital_province.culture
			}
		}
		
		if = {
			limit = {
				culture = atlantannach
			}
			add_character_flag = ai_will_not_convert
			set_character_faith = faith:iberian
			if = {
				limit = {
					NOT = {
						knows_language_of_culture = root.capital_province.culture
					}
				}
				learn_language_of_culture = root.capital_province.culture
			}
		}
		
		if = {
			limit = {
				culture = traveller
			}
			add_character_flag = ai_will_not_convert
			set_character_faith = faith:celtic
			if = {
				limit = {
					NOT = {
						knows_language_of_culture = root.capital_province.culture
					}
				}
				learn_language_of_culture = root.capital_province.culture
			}
		}
		if = {
			limit = {
				culture = beur
			}
			add_character_flag = ai_will_not_convert
			set_character_faith = faith:simurghi
			if = {
				limit = {
					NOT = {
						knows_language_of_culture = root.capital_province.culture
					}
				}
				learn_language_of_culture = root.capital_province.culture
			}
		}
		if = {
			limit = {
				culture = turkisch
			}
			add_character_flag = ai_will_not_convert
			set_character_faith = faith:quranist
			if = {
				limit = {
					NOT = {
						knows_language_of_culture = root.capital_province.culture
					}
				}
				learn_language_of_culture = root.capital_province.culture
			}
		}
		
		else_if = {
			limit = {
				OR = {
					culture = culture:rajput
					culture = culture:marathi
					culture = culture:gujarati
					culture = culture:tamil
					culture = culture:telugu
					culture = culture:hindustani
					culture = culture:kannada
					culture = culture:bengali
					culture = culture:burmese
				}
			}
			random_list = {
				10 = {
					set_character_faith = faith:digambara
				}
				10 = {
					set_character_faith = faith:svetambara
				}
				20 = {
					set_character_faith = faith:yapaniya
				}
				35 = {
					trigger = {
						culture = culture:gujarati
					}
					set_character_faith = faith:zurvanism
				}
				100 = {
					trigger = {
						culture = culture:burmese
					}
					set_character_faith = faith:ari
				}
				5 = {
					set_character_faith = faith:nestorian
				}
				25 = {
					trigger = {
						OR = {
							culture = culture:kannada
							culture = culture:telugu
							culture = culture:tamil
						}
					}
					set_character_faith = faith:malabarism
				}
			}
		}
		else_if = {
			limit = {
				OR = {
					culture = culture:butr
					culture = culture:zaghawa
				}
			}
			random_list = {
				10 = {
					set_character_faith = faith:ibadi
				}
				10 = {
					set_character_faith = faith:sufri
				}
			}
		}
		else_if = {
			limit = {
				culture = culture:kurdish
			}
			set_character_faith = faith:yazidi
		}
		else_if = {
			limit = {
				OR = {
					culture = culture:bolghar
					culture = culture:somali
				}
			}
			set_character_faith = faith:ashari
			if = {
				limit = {
					root.capital_county.faith = {
						religion_tag = islam_religion
					}
				}
				set_character_faith = root.capital_county.faith
			}
		}
		else_if = {
			limit = {
				culture = culture:khazar
			}
			set_character_faith = faith:kabarism
		}
		else_if = {
			limit = {
				culture = culture:assyrian
			}
			set_character_faith = faith:nestorian
		}
		else_if = {
			limit = {
				culture = culture:khitan
			}
			random_list = {
				15 = {
					set_character_faith = faith:vajrayana
				}
				10 = {
					set_character_faith = faith:tengri_pagan
				}
				5 = {
					set_character_faith = faith:quanzhen
				}
			}
		}
		else_if = {
			limit = {
				culture = culture:han
			}
			random_list = {
				50 = {
					set_character_faith = faith:shangqing
					random_list = {
						50 = {}
						50 = {
							add_trait = devoted
						}
					}
				}
				15 = {
					set_character_faith = faith:mahayana
				}
				5 = {
					set_character_faith = faith:zhengyi
				}
			}
			random = {
				chance = 5
				modifier = {
					root.capital_province = {
						geographical_region = world_asia_china
					}
					add = 10
				}
				add_trait = confucian_education
				if = {
					limit = {
						OR = {
							AND = {
								is_male = yes
								root.capital_province.province_owner = {
									OR = {
										has_realm_law = male_only_law
										has_realm_law = male_preference_law
										has_realm_law = equal_law
									}
								}
							}
							AND = {
								is_female = yes
								root.capital_province.province_owner = {
									OR = {
										has_realm_law = female_only_law
										has_realm_law = female_preference_law
										has_realm_law = equal_law
									}
								}
							}
						}
					}
					change_merit = { fixed_range = { min = 1000 max = 5000 } }
					assign_completed_exams_based_on_merit_effect = yes
				}
			}
		}
		else_if = {
			limit = {
				culture = culture:bodpa
			}
			random_list = {
				10 = {
					set_character_faith = faith:bon
				}
				10 = {
					set_character_faith = faith:old_bon
				}
			}
		}
		else_if = {
			limit = {
				religion = { is_in_family = rf_pagan }
			}
			random_list = {
				10 = {
					add_trait = one_eyed
				}
				10 = {
					add_trait = albino
				}
				10 = {
					add_trait = scaly
				}
				10 = {
					add_trait = torturer
				}
				10 = {
					add_trait = whole_of_body
				}
				10 = {
					add_trait = flagellant
				}
				10 = {
					add_trait = scarred
					add_trait_xp = {
		                trait = scarred
		                value = {
		                    integer_range = {
		                        min = 5
		                        max = 100
		                    }
		                }
		            }
				}
				10 = {
					add_trait = blind
				}
				10 = {
					add_trait = shrewd
				}
				10 = {
					add_trait = strong
				}
				10 = {
					add_trait = giant
				}
				10 = {
					add_trait = lifestyle_poet
				}
				450 = {
					trigger = {
						NOT = {
							trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = this.faith GENDER_CHARACTER = this }
						}
					}
					add_trait = witch
				}
				150 = {
					trigger = {
						faith = {
							has_doctrine = tenet_warmonger
						}
						OR = {
							culture = { has_cultural_pillar = heritage_north_germanic }
							religion = religion:germanic_religion
						}
						NOR = {
							has_trait = craven
							has_trait = berserker
							has_trait = calm
						}
					}
					add_trait = berserker
				}
			}
		}
		
		# Learn flavorful & appropriate languages
		if = {
			limit = {
				OR = {
					culture = culture:butr
					culture = culture:kurdish
					culture = culture:somali
				}
			}
			
			if = {
				limit = {
					NOT = {
						knows_language = language_arabic
					}
				}
				random = {
					chance = 70
					learn_language = language_arabic
				}
			}
		}
		
		if = {
			limit = {
				culture = culture:assyrian
			}
			
			if = {
				limit = {
					NOT = {
						knows_language = language_greek
					}
				}
				random = {
					chance = 70
					learn_language = language_greek
				}
			}
		}
		
		if = { # Guaranteed warriors
			limit = {
				OR = {
					culture = culture:butr
					culture = culture:zaghawa
					culture = culture:khitan
					culture = culture:somali
				}
			}
			remove_trait = education_learning_3
			remove_trait = education_learning_4
			remove_trait = education_stewardship_3
			remove_trait = education_stewardship_4
			remove_trait = education_diplomacy_3
			remove_trait = education_diplomacy_4
			remove_trait = lifestyle_physician
			remove_trait = lifestyle_mystic
			remove_trait = theologian
			remove_trait = lifestyle_herbalist
			remove_trait = diplomat
			remove_trait = administrator
			remove_trait = architect
			remove_trait = scholar
			add_martial_skill = 4
			add_prowess_skill = 6
			random_list = {
				50 = {
					add_trait = education_martial_3
				}
				50 = {
					add_trait = education_martial_4
				}
			}
			random_list = {
				10 = {
					add_trait = strategist
				}
				30 = {
					add_trait = lifestyle_blademaster
					add_random_tiered_trait_xp_effect = {
						TRAIT = lifestyle_blademaster
						LEVEL_1 = yes
						LEVEL_3 = yes
					}
				}
				10 = {
					add_trait = tourney_participant
					add_random_tiered_trait_track_xp_effect = {
						TRAIT = tourney_participant
						TRACK = bow
						LEVEL_1 = yes
						LEVEL_3 = yes
					}
				}
				10 = {
					add_trait = overseer
				}
			}
			give_random_commander_trait_effect = yes
		}
		else_if = {
			limit = {
				OR = {
					religion = { is_in_family = rf_pagan }
					culture = culture:bolghar
					culture = culture:cuman
				}
			}
			random_list = {
				50 = {}
				50 = {
					remove_trait = education_learning_3
					remove_trait = education_learning_4
					remove_trait = education_stewardship_3
					remove_trait = education_stewardship_4
					remove_trait = education_diplomacy_3
					remove_trait = education_diplomacy_4
					remove_trait = lifestyle_physician
					remove_trait = lifestyle_mystic
					remove_trait = theologian
					remove_trait = lifestyle_herbalist
					remove_trait = diplomat
					remove_trait = administrator
					remove_trait = architect
					remove_trait = scholar
					add_martial_skill = 4
					add_prowess_skill = 6
					random_list = {
						50 = {
							add_trait = education_martial_3
						}
						50 = {
							add_trait = education_martial_4
						}
					}
					random_list = {
						10 = {
							add_trait = strategist
						}
						30 = {
							add_trait = lifestyle_blademaster
							add_random_tiered_trait_xp_effect = {
								TRAIT = lifestyle_blademaster
								LEVEL_1 = yes
								LEVEL_3 = yes
							}
						}
						10 = {
							add_trait = tourney_participant
							add_random_tiered_trait_track_xp_effect = {
								TRAIT = tourney_participant
								TRACK = bow
								LEVEL_1 = yes
								LEVEL_3 = yes
							}
						}
						10 = {
							add_trait = overseer
						}
					}
					give_random_commander_trait_effect = yes
				}
			}
		}
		set_interesting_traits_and_modifiers_effect = yes
		add_random_tiered_trait_xp_effect = {
			TRAIT = lifestyle_physician
			LEVEL_1 = yes
			LEVEL_3 = yes
		}
		add_random_tiered_trait_xp_effect = {
			TRAIT = lifestyle_mystic
			LEVEL_1 = yes
			LEVEL_3 = no
		}
		add_random_tiered_trait_track_xp_effect = {
			TRAIT = lifestyle_hunter
			TRACK = hunter
			LEVEL_1 = yes
			LEVEL_3 = no
		}
		add_random_tiered_trait_xp_effect = {
			TRAIT = confucian_education
			LEVEL_1 = yes
			LEVEL_3 = yes
		}
	}
}
