# Rules for picking clothing sets.

# Royalty ranks.
blg_royalty = {
	OR = {
		higher_real_tier_than = duke
		is_or_was_offmap_power_ruler = yes
		spouse_even_if_dead = {
			OR = {
				higher_real_tier_than = duke
				is_or_was_offmap_power_ruler = yes
			}
		}
		blg_royal_title = yes
	}
	blg_republic = no
	blg_mercenary = no
	blg_holy_order = no
	blg_peasant = no
}

# Has been coronated if necessary.
blg_crowned = {
	trigger_if = {
		limit = { is_alive = no }
		NOT = { trait = uncrowned }
	}
	trigger_else_if = {
		limit = {
			has_dlc = "Holy Fury"
			are_coronations_active_trigger = yes
			religion_group = christian
			is_feudal = yes
			primary_title = { is_vice_royalty = no }
			OR = {
				has_game_started = yes
				is_save_game = yes
			}
		}
		OR = {
			trait = crowned_by_priest
			trait = crowned_by_bishop
			trait = crowned_by_pope
			trait = crowned_by_myself
		}
	}
}

# Uses extra jewelry.
blg_jewelry = {
	OR = {
		higher_tier_than = count
		is_or_was_offmap_power_ruler = yes
		spouse_even_if_dead = {
			OR = {
				higher_tier_than = count
				is_or_was_offmap_power_ruler = yes
			}
		}
	}
}

# Facial makeup expected for those under traditional Han filial piety rules.
blg_chinese_makeup = {
	always = no
}

# Prepared for battle.
blg_warrior = {
	OR = {
		AND = {
			in_command = yes
			OR = {
				war = yes
				liege = { war = yes }
				in_battle = yes
				in_siege = yes
				is_landed = no
				employer = { mercenary = yes }
				employer = { holy_order = yes }
			}
		}
		has_job_title = job_marshal
		death_reason = death_battle
		death_reason = death_duel
		death_reason = death_legendary_win_duel
		death_reason = death_legendary_fail_duel
		death_reason = death_mission_duel
		death_reason = death_battle_duel
		death_reason = death_claim_duel_attacker
		death_reason = death_claim_duel_defender
		AND = {
			blg_mercenary = yes
			blg_mercenary_fleet = no
		}
	}
}

# Commander with fancier armour.
blg_elite_commander = {
	OR = {
		higher_real_tier_than = count
		spouse_even_if_dead = { higher_real_tier_than = count }
	}
}

# Early era headgear designs.
blg_style_early = {
	year_of_birth < 1160
}

# Middle era headgear designs.
blg_style_mid = {
	year_of_birth < 1250
}

# Later era headgear designs.
blg_style_late = {
	year_of_birth >= 1160
}

### Headgear:

# Emperors crown.
blg_crown_emperor = {
	OR = {
		AND = {
			real_tier = emperor
			blg_crowned = yes
			trigger_if = {
				limit = { is_nomadic = yes }
				population_and_manpower >= 10000
			}
			NOR = {
				is_tributary = yes
				is_offmap_governor = yes
				blg_republic = yes
				blg_mercenary = yes
				blg_holy_order = yes
				blg_peasant = yes
			}
		}
		is_or_was_offmap_power_ruler = yes
	}
}

# Kings crown.
blg_crown_king = {
	OR = {
		AND = {
			higher_real_tier_than = duke
			blg_crowned = yes
			trigger_if = {
				limit = {
					is_nomadic = yes
					has_game_started = yes
				}
				population_and_manpower >= 5000
			}
			NOR = {
				blg_republic = yes
				blg_mercenary = yes
				blg_holy_order = yes
				blg_peasant = yes
			}
		}
		is_or_was_offmap_power_ruler = yes
		blg_royal_title = yes
	}
}

# Dress like an emperor.
blg_headgear_emperor = {
	OR = {
		blg_crown_emperor = yes
		AND = {
			is_main_spouse = yes
			spouse_even_if_dead = {
				blg_crown_emperor = yes
			}
		}
	}
}

# Dress like a king.
blg_headgear_king = {
	OR = {
		blg_crown_king = yes
		spouse_even_if_dead = {
			blg_crown_king = yes
		}
		blg_petty_king = yes
	}
}

# Dress like a duke.
blg_headgear_duke = {
	OR = {
		higher_real_tier_than = count
		spouse_even_if_dead = { higher_real_tier_than = count }
		is_or_was_offmap_power_ruler = yes
		has_minor_title = title_prince
		has_minor_title = title_queen_mother
		blg_royal_title = yes
	}

	blg_mercenary = no
	blg_peasant = no
}

# Dress with common headgear.
blg_headgear_common = {
	OR = {
		blg_headgear_duke = no
		blg_common_ducal_headgear = yes

		trait = in_hiding
		trait = leper
		blg_pilgrimage = yes
	}
}

# Wears a helmet.
blg_headgear_military = {
	OR = {
		blg_fighting = yes
		blg_headgear_military_on_rule = yes
	}

	blg_headgear_military_off_rule = no
}

# Dress shady.
blg_headgear_intrigue = {
	trigger_if = {
		limit = { has_job_title = job_spymaster }
		lower_real_tier_than = king
	}
	trigger_else = {
		intrigue >= 18
		lower_real_tier_than = duke
	}
}

# More common to cover hair.
blg_headgear_covered = {
	true_religion_scope = {
		OR = {
			religion_group = muslim
			religion_group = jewish_group
			religion_group = gnostic_group
		}
	}
}

### Clothes:

# Dress like royalty.
blg_clothes_royal = {
	OR = {
		higher_real_tier_than = duke
		is_or_was_offmap_power_ruler = yes
		spouse_even_if_dead = {
			OR = {
				higher_real_tier_than = duke
				is_or_was_offmap_power_ruler = yes
			}
		}
		blg_royal_title = yes
		blg_prince_title = yes
		blg_merchant_clothes = yes
	}
	blg_mercenary = no
	blg_holy_order = no
	blg_peasant = no
}

# Dress like nobility.
blg_clothes_noble = {
	OR = {
		is_landed = yes
		higher_real_tier_than = count
		spouse_even_if_dead = {
			OR = {
				is_landed = yes
				higher_real_tier_than = count
			}
		}
		blg_royal_title = yes
		blg_prince_title = yes
		blg_fashionable = yes
		has_minor_title = title_regent
	}
	blg_peasant = no
}

# Dress like a commoner.
blg_clothes_common = {
	OR = {
		NOR = {
			is_landed = yes
			spouse_even_if_dead = { higher_real_tier_than = count }
			is_or_was_offmap_power_ruler = yes
			blg_royal_title = yes
			blg_prince_title = yes
		}
		trait = humble
		blg_peasant = yes
	}
}

# Dress in armour.
blg_clothes_military = {
	OR = {
		AND = {
			in_command = yes
			OR = {
				war = yes
				liege = { war = yes }
				in_battle = yes
				in_siege = yes
				is_landed = no
			}
		}
		blg_duelling = yes
		has_job_title = job_marshal
		death_reason = death_battle
		death_reason = death_duel
		death_reason = death_legendary_win_duel
		death_reason = death_legendary_fail_duel
		death_reason = death_mission_duel
		death_reason = death_battle_duel
		death_reason = death_claim_duel_attacker
		death_reason = death_claim_duel_defender
		employer = {
			blg_mercenary = yes
			blg_mercenary_fleet = no
		}
		employer = { blg_holy_order = yes }
		AND = {
			blg_guard = yes
			OR = {
				is_landed = no
				trait = travelling
			}
		}
	}
}

# Dress shady.
blg_clothes_intrigue = {
	OR = {
		has_job_title = job_spymaster
		trait = schemer
		AND = {
			intrigue >= 16
			lower_real_tier_than = duke
		}
	}
}
