# Geographic region character diversity script.
blg_regional_diversity = {
}

# Spawned character processing.
blg_character_processing = {
	# Fix noculture generated characters.
	if = {
		limit= {
			NOT = { gfx_culture_scope = { always = yes } }
			culture_scope = { always = yes }
		}
		set_graphical_culture = ROOT
	}

	if = {
		limit = {
			blg_ethnicity_static = no
		}

		random_list = {
			2 = { add_trait = freckles_5 }
			6 = { add_trait = freckles_4 }
			7 = { add_trait = freckles }
			7 = { add_trait = freckles_2 }
			10 = { add_trait = freckles_3 }
			4500 = {
				modifier = {
					factor = 0.025
					blg_ethnicity_dutch = yes
				}
				modifier = {
					factor = 0.05
					blg_ethnicity_english = yes
				}
				modifier = {
					factor = 0.075
					OR = {
						blg_ethnicity_german = yes
						blg_ethnicity_celtic = yes
					}
				}
				modifier = {
					factor = 0.1
					blg_ethnicity_lombard = yes
				}
				modifier = {
					factor = 0.25
					OR = {
						blg_ethnicity_northman = yes
						blg_ethnicity_occitan = yes
					}
				}
				modifier = {
					factor = 0.5
					OR = {
						graphical_culture = ironborngfx
						graphical_culture = hoaregfx
						graphical_culture = greyjoygfx
						graphical_culture = redbeardgfx
						blg_ethnicity_iberian = yes
					}
				}
				modifier = {
					factor = 0.6
					OR = {
						graphical_culture = pentosigfx
						graphical_culture = braavosigfx
						graphical_culture = norvosigfx
						graphical_culture = myrmangfx
						graphical_culture = ghiscarigfx
					}
				}
				modifier = {
					factor = 0.75
					OR = {
						graphical_culture = freefolkgfx
						graphical_culture = firstmangfx
						graphical_culture = saltdornishgfx
						graphical_culture = sanddornishgfx
						graphical_culture = martellgfx
					}
				}
			}
		}
	}

	blg_tattoos = yes

	if = {
		limit = { blg_ethnicity_static = yes }
		add_trait = blgcaoff
	}
}

blg_tattoos = {
	# Add tattoos.
	if = {
		limit = { employer = { primary_title = { title = c_fiery_hand } } }
		add_trait = african_tattoo_10
	}
	else_if = {
		limit = {
			trait = slave
			OR = {
				culture = volantene
				employer = { culture = volantene }
				employer = { culture = eastern_valyrian }
			}
		}

		if = {
			limit = { trait = red_priest }
			add_character_modifier = { name = zun_warpaint_1 duration = -1 }
		}
		else_if = {
			limit = { has_minor_title = court_jester }
			add_character_modifier = { name = aztec_warpaint_1 duration = -1 }
		}
		else_if = {
			limit = {
				OR = {
					has_minor_title = title_commander
					employer = { primary_title = { mercenary = yes } }
				}
			}
			add_trait = african_tattoo_9
		}
		else = {
			random_list = {
				10 = { add_character_modifier = { name = finnish_warpaint_1 duration = -1 } }
				10 = { add_character_modifier = { name = finnish_warpaint_2 duration = -1 } }
				10 = { add_character_modifier = { name = zun_warpaint_2 duration = -1 } }
				10 = { add_trait = african_tattoo_2 }
				10 = { add_trait = african_tattoo_3 }
			}
		}
	}
	else_if = {
		limit = { culture = shadowlander }

		random_list = {
			10 = { add_trait = norse_tattoo_1 }
			10 = { add_trait = norse_tattoo_2 }
			10 = { add_trait = norse_tattoo_3 }
			10 = { add_trait = norse_tattoo_4 }
			10 = { add_trait = norse_tattoo_5 }
			10 = { add_trait = norse_tattoo_6 }
			10 = { add_trait = slavic_tattoo_1 }
			10 = { add_trait = slavic_tattoo_2 }
			10 = { add_trait = slavic_tattoo_3 }
			10 = { add_trait = slavic_tattoo_4 }
			10 = { add_trait = slavic_tattoo_5 }
			10 = { add_trait = slavic_tattoo_6 }
		}
	}
}

# Refresh portrait trick by removing harmless trait.
refresh_portrait = {
	remove_trait = blgspawn
}

commence_duel_engine_effect = { # Refresh portraits.
	event_target:combatant_1 = {
		refresh_portrait = yes
	}
	event_target:combatant_2 = {
		refresh_portrait = yes
	}
}

spawn_creature_champion_effect = { # Too messy with bear clothes.
	new_character = {
		set_graphical_culture = bear
	}
}
