﻿set_interesting_traits_and_modifiers_effect = {
	random_list = {
		50 = {
			trigger = {
				has_trait = gluttonous
			}
			change_current_weight = 150
		}
		50 = {
			trigger = {
				has_trait = gluttonous
			}
			change_current_weight = 100
		}
		10 = {
			trigger = {
				NOT = { has_trait = temperate }
			}
			change_current_weight = 50
		}
		10 = {
			change_current_weight = 25
		}
		100 = {
		}
		10 = {
			change_current_weight = -25
		}
		5 = {
			trigger = {
				NOR = {
					has_trait = temperate
					has_trait = gluttonous
				}
			}
			change_current_weight = -50
		}
	}
	random_list = {
		1 = {
			modifier = {
				add = 9
				culture = {
					has_cultural_parameter = loyal_trait_more_common
				}
			}
			add_trait = loyal
		}
		1 = {
			modifier = {
				add = 9
				culture = {
					has_cultural_parameter = disloyal_trait_more_common
				}
			}
			add_trait = disloyal
		}
		1 = {
			modifier = {
				add = 9
				culture = {
					has_cultural_parameter = scholar_official_trait_bonuses
				}
			}
			add_trait = confucian_education
		}
		98 = {}
	}
}

add_random_tiered_trait_xp_effect = {
	save_scope_value_as = {
		name = level_1_possible
		value = flag:$LEVEL_1$
	}
	save_scope_value_as = {
		name = level_3_possible
		value = flag:$LEVEL_3$
	}
	if = {
		limit = { has_trait = $TRAIT$ }
		random_list = {
			15 = {
				trigger = { scope:level_1_possible = flag:yes }
				add_trait_xp = {
					trait = $TRAIT$
					value = {
						integer_range = {
							min = small_lifestyle_random_xp_low
							max = small_lifestyle_random_xp_high
						}
					}
				}
			}
			10 = {
				add_trait_xp = {
					trait = $TRAIT$
					value = {
						integer_range = {
							min = medium_lifestyle_random_xp_low
							max = medium_lifestyle_random_xp_high
						}
					}
				}
			}
			5 = {
				trigger = { scope:level_3_possible = flag:yes }
				add_trait_xp = {
					trait = $TRAIT$
					value = 100
				}
			}
		}
	}
}

add_random_tiered_trait_track_xp_effect = {
	save_scope_value_as = {
		name = level_1_possible
		value = flag:$LEVEL_1$
	}
	save_scope_value_as = {
		name = level_3_possible
		value = flag:$LEVEL_3$
	}
	if = {
		limit = { has_trait = $TRAIT$ }
		random_list = {
			15 = {
				trigger = { scope:level_1_possible = flag:yes }
				add_trait_xp = {
					trait = $TRAIT$
					track = $TRACK$
					value = {
						integer_range = {
							min = small_lifestyle_random_xp_low
							max = small_lifestyle_random_xp_high
						}
					}
				}
			}
			10 = {
				add_trait_xp = {
					trait = $TRAIT$
					track = $TRACK$
					value = {
						integer_range = {
							min = medium_lifestyle_random_xp_low
							max = medium_lifestyle_random_xp_high
						}
					}
				}
			}
			5 = {
				trigger = { scope:level_3_possible = flag:yes }
				add_trait_xp = {
					trait = $TRAIT$
					track = $TRACK$
					value = 100
				}
			}
		}
	}
}
