# p5 Headgear
5 = {
	0 = { # 0 - Imperial crown/Caliph turban
		factor = 99

		trigger = {
			OR = {
				AND = {
					real_tier = emperor
					trigger_if = {
						limit = { is_alive = no }
						NOT = { trait = uncrowned }
					}
					trigger_else_if = {
						limit = {
							has_dlc = "Holy Fury"
							is_feudal = yes
							primary_title = { is_vice_royalty = no }
							OR = {
								religion = catholic
								religion = fraticelli
							}
							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
						}
					}
					trigger_if = {
								limit = { is_nomadic = yes }
								population_and_manpower >= 10000
					}
					NOR = {
						is_tributary = yes
						is_offmap_governor = yes
						AND = {
							is_republic = yes
							NOT = { government = confucian_bureaucracy }
						}
						mercenary = yes
						holy_order = yes
						trait = peasant_leader
						trait = heresiarch
					}
				}
				is_or_was_offmap_power_ruler = yes
				AND = {
					is_main_spouse = yes
					spouse_even_if_dead = {
						OR = {
							AND = {
								real_tier = emperor
								trigger_if = {
									limit = { is_alive = no }
									NOT = { trait = uncrowned }
								}
								trigger_else_if = {
									limit = {
										has_dlc = "Holy Fury"
										is_feudal = yes
										primary_title = { is_vice_royalty = no }
										OR = {
											religion = catholic
											religion = fraticelli
										}
										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
									}
								}
								trigger_if = {
									limit = { is_nomadic = yes }
									population_and_manpower >= 10000
								}
								NOR = {
									is_tributary = yes
									is_offmap_governor = yes
									AND = {
										is_republic = yes
										NOT = { government = confucian_bureaucracy }
									}
									mercenary = yes
									holy_order = yes
									trait = peasant_leader
									trait = heresiarch
								}
							}
							is_or_was_offmap_power_ruler = yes
						}
					}
				}
				AND = {
					OR = {
						AND = {
							is_alive = yes
							employer = { is_patrician = yes }
						}
						AND = {
							higher_tier_than = baron
							government = republic_government
						}
					}
					in_command = no
					OR = {
						culture_group = latin
						culture_group = iberian
						culture_group = celtic
						culture_group = central_germanic
						culture_group = west_germanic
						culture_group = east_slavic
						culture_group = west_slavic
						culture_group = south_slavic
						culture_group = magyar
					}
				}
			}
			NOR = {
				trait = in_hiding
				trait = on_pilgrimage
				trait = on_indian_pilgrimage
			}
		}

		modifier = {
			factor = 0.01
			OR = {
				AND = {
					is_alive = yes
					employer = { is_patrician = yes }
				}
				AND = {
					higher_tier_than = baron
					government = republic_government
				}
			}
			in_command = no
			OR = {
				culture_group = latin
				culture_group = iberian
				culture_group = celtic
				culture_group = central_germanic
				culture_group = west_germanic
				culture_group = east_slavic
				culture_group = west_slavic
				culture_group = south_slavic
				culture_group = magyar
			}
		}
	}

	1 = { # a - Royal crown/turban 1
		factor = 1

		trigger = {
			OR = {
				AND = {
					higher_real_tier_than = duke
					trigger_if = {
						limit = { is_alive = no }
						NOT = { trait = uncrowned }
					}
					trigger_else_if = {
						limit = {
							has_dlc = "Holy Fury"
							is_feudal = yes
							primary_title = { is_vice_royalty = no }
							OR = {
								religion = catholic
								religion = fraticelli
							}
							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
						}
					}
					trigger_if = {
						limit = {
							is_nomadic = yes
							has_game_started = yes
						}
						population_and_manpower >= 5000
					}
					NOR = {
						AND = {
							is_republic = yes
							NOT = { government = confucian_bureaucracy }
						}
						mercenary = yes
						holy_order = yes
						trait = peasant_leader
						trait = heresiarch
					}
				}
				is_or_was_offmap_power_ruler = yes
				has_minor_title = title_despot
				has_minor_title = title_augusta
				spouse_even_if_dead = {
					OR = {
						AND = {
							higher_real_tier_than = duke
							trigger_if = {
								limit = { is_alive = no }
								NOT = { trait = uncrowned }
							}
							trigger_else_if = {
								limit = {
									has_dlc = "Holy Fury"
									is_feudal = yes
									primary_title = { is_vice_royalty = no }
									OR = {
										religion = catholic
										religion = fraticelli
									}
									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
								}
							}
							trigger_if = {
								limit = {
									is_nomadic = yes
									has_game_started = yes
								}
								population_and_manpower >= 5000
							}
							NOR = {
								AND = {
									is_republic = yes
									NOT = { government = confucian_bureaucracy }
								}
								mercenary = yes
								holy_order = yes
								trait = peasant_leader
								trait = heresiarch
							}
						}
						is_or_was_offmap_power_ruler = yes
						has_minor_title = title_despot
						has_minor_title = title_augusta
					}
				}
				AND = {
					OR = {
						AND = {
							real_tier = duke
							independent = yes
							NOR = {
								AND = {
									is_republic = yes
									NOT = { government = confucian_bureaucracy }
								}
								mercenary = yes
								holy_order = yes
								trait = peasant_leader
								trait = heresiarch
							}
						}
						spouse_even_if_dead = {
							real_tier = duke
							independent = yes
							NOR = {
								AND = {
									is_republic = yes
									NOT = { government = confucian_bureaucracy }
								}
								mercenary = yes
								holy_order = yes
								trait = peasant_leader
								trait = heresiarch
							}
						}
					}
					OR = {
						culture_group = north_germanic
						culture_group = finno_ugric
						culture_group = celtic
						culture = saxon
						culture = nepali
						culture_group = arabic
						culture = sogdian
						culture = saka
						culture = tocharian
						culture_group = east_african
						culture_group = tibetan_group
					}
				}
				AND = {
					OR = {
						AND = {
							is_alive = yes
							employer = { is_patrician = yes }
						}
						AND = {
							higher_tier_than = baron
							government = republic_government
						}
					}
					in_command = no
					OR = {
						culture_group = latin
						culture_group = iberian
						culture_group = celtic
						culture_group = central_germanic
						culture_group = west_germanic
						culture_group = east_slavic
						culture_group = west_slavic
						culture_group = south_slavic
						culture_group = magyar
					}
				}
			}
			NOR = {
				trait = in_hiding
				trait = on_pilgrimage
				trait = on_indian_pilgrimage
			}
		}

		modifier = {
			factor = 0.01
			OR = {
				has_portrait_property = { layer = 5 index = 2 }
				has_portrait_property = { layer = 5 index = 3 }
				has_portrait_property = { layer = 5 index = 4 }
			}
		}
	}

	2 = { # b - Royal crown/turban 2
		factor = 1

		trigger = {
			OR = {
				AND = {
					higher_real_tier_than = duke
					trigger_if = {
						limit = { is_alive = no }
						NOT = { trait = uncrowned }
					}
					trigger_else_if = {
						limit = {
							has_dlc = "Holy Fury"
							is_feudal = yes
							primary_title = { is_vice_royalty = no }
							OR = {
								religion = catholic
								religion = fraticelli
							}
							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
						}
					}
					trigger_if = {
						limit = {
							is_nomadic = yes
							has_game_started = yes
						}
						population_and_manpower >= 5000
					}
					NOR = {
						AND = {
							is_republic = yes
							NOT = { government = confucian_bureaucracy }
						}
						mercenary = yes
						holy_order = yes
						trait = peasant_leader
						trait = heresiarch
					}
				}
				is_or_was_offmap_power_ruler = yes
				has_minor_title = title_despot
				has_minor_title = title_augusta
				spouse_even_if_dead = {
					OR = {
						AND = {
							higher_real_tier_than = duke
							trigger_if = {
								limit = { is_alive = no }
								NOT = { trait = uncrowned }
							}
							trigger_else_if = {
								limit = {
									has_dlc = "Holy Fury"
									is_feudal = yes
									primary_title = { is_vice_royalty = no }
									OR = {
										religion = catholic
										religion = fraticelli
									}
									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
								}
							}
							trigger_if = {
								limit = {
									is_nomadic = yes
									has_game_started = yes
								}
								population_and_manpower >= 5000
							}
							NOR = {
								AND = {
									is_republic = yes
									NOT = { government = confucian_bureaucracy }
								}
								mercenary = yes
								holy_order = yes
								trait = peasant_leader
								trait = heresiarch
							}
						}
						is_or_was_offmap_power_ruler = yes
						has_minor_title = title_despot
						has_minor_title = title_augusta
					}
				}
				AND = {
					OR = {
						AND = {
							real_tier = duke
							independent = yes
							NOR = {
								AND = {
									is_republic = yes
									NOT = { government = confucian_bureaucracy }
								}
								mercenary = yes
								holy_order = yes
								trait = peasant_leader
								trait = heresiarch
							}
						}
						spouse_even_if_dead = {
							real_tier = duke
							independent = yes
							NOR = {
								AND = {
									is_republic = yes
									NOT = { government = confucian_bureaucracy }
								}
								mercenary = yes
								holy_order = yes
								trait = peasant_leader
								trait = heresiarch
							}
						}
					}
					OR = {
						culture_group = north_germanic
						culture_group = finno_ugric
						culture_group = celtic
						culture = saxon
						culture = nepali
						culture_group = arabic
						culture = sogdian
						culture = saka
						culture = tocharian
						culture_group = east_african
						culture_group = tibetan_group
					}
				}
				AND = {
					OR = {
						AND = {
							is_alive = yes
							employer = { is_patrician = yes }
						}
						AND = {
							higher_tier_than = baron
							government = republic_government
						}
					}
					in_command = no
					OR = {
						culture_group = latin
						culture_group = iberian
						culture_group = celtic
						culture_group = central_germanic
						culture_group = west_germanic
						culture_group = east_slavic
						culture_group = west_slavic
						culture_group = south_slavic
						culture_group = magyar
					}
				}
			}
			NOR = {
				trait = in_hiding
				trait = on_pilgrimage
				trait = on_indian_pilgrimage
			}
		}

		modifier = {
			factor = 0.01
			OR = {
				has_portrait_property = { layer = 5 index = 1 }
				has_portrait_property = { layer = 5 index = 3 }
				has_portrait_property = { layer = 5 index = 4 }
			}
		}
	}

	3 = { # c - Royal crown/turban 3
		factor = 1

		trigger = {
			OR = {
				AND = {
					higher_real_tier_than = duke
					trigger_if = {
						limit = { is_alive = no }
						NOT = { trait = uncrowned }
					}
					trigger_else_if = {
						limit = {
							has_dlc = "Holy Fury"
							is_feudal = yes
							primary_title = { is_vice_royalty = no }
							OR = {
								religion = catholic
								religion = fraticelli
							}
							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
						}
					}
					trigger_if = {
						limit = {
							is_nomadic = yes
							has_game_started = yes
						}
						population_and_manpower >= 5000
					}
					NOR = {
						AND = {
							is_republic = yes
							NOT = { government = confucian_bureaucracy }
						}
						mercenary = yes
						holy_order = yes
						trait = peasant_leader
						trait = heresiarch
					}
				}
				is_or_was_offmap_power_ruler = yes
				has_minor_title = title_despot
				has_minor_title = title_augusta
				spouse_even_if_dead = {
					OR = {
						AND = {
							higher_real_tier_than = duke
							trigger_if = {
								limit = { is_alive = no }
								NOT = { trait = uncrowned }
							}
							trigger_else_if = {
								limit = {
									has_dlc = "Holy Fury"
									is_feudal = yes
									primary_title = { is_vice_royalty = no }
									OR = {
										religion = catholic
										religion = fraticelli
									}
									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
								}
							}
							trigger_if = {
								limit = {
									is_nomadic = yes
									has_game_started = yes
								}
								population_and_manpower >= 5000
							}
							NOR = {
								AND = {
									is_republic = yes
									NOT = { government = confucian_bureaucracy }
								}
								mercenary = yes
								holy_order = yes
								trait = peasant_leader
								trait = heresiarch
							}
						}
						is_or_was_offmap_power_ruler = yes
						has_minor_title = title_despot
						has_minor_title = title_augusta
					}
				}
				AND = {
					OR = {
						AND = {
							real_tier = duke
							independent = yes
							NOR = {
								AND = {
									is_republic = yes
									NOT = { government = confucian_bureaucracy }
								}
								mercenary = yes
								holy_order = yes
								trait = peasant_leader
								trait = heresiarch
							}
						}
						spouse_even_if_dead = {
							real_tier = duke
							independent = yes
							NOR = {
								AND = {
									is_republic = yes
									NOT = { government = confucian_bureaucracy }
								}
								mercenary = yes
								holy_order = yes
								trait = peasant_leader
								trait = heresiarch
							}
						}
					}
					OR = {
						culture_group = north_germanic
						culture_group = finno_ugric
						culture_group = celtic
						culture = saxon
						culture = nepali
						culture_group = arabic
						culture = sogdian
						culture = saka
						culture = tocharian
						culture_group = east_african
						culture_group = tibetan_group
					}
				}
				AND = {
					OR = {
						AND = {
							is_alive = yes
							employer = { is_patrician = yes }
						}
						AND = {
							higher_tier_than = baron
							government = republic_government
						}
					}
					in_command = no
					OR = {
						culture_group = latin
						culture_group = iberian
						culture_group = celtic
						culture_group = central_germanic
						culture_group = west_germanic
						culture_group = east_slavic
						culture_group = west_slavic
						culture_group = south_slavic
						culture_group = magyar
					}
				}
			}
			NOR = {
				trait = in_hiding
				trait = on_pilgrimage
				trait = on_indian_pilgrimage
			}
			trigger_if = {
				limit = {
					OR = {
						culture_group = chinese_group
						culture = tangut
					}
				}
				song_dynasty_futou_trigger = yes
			}
		}

		modifier = {
			factor = 0.01
			OR = {
				has_portrait_property = { layer = 5 index = 1 }
				has_portrait_property = { layer = 5 index = 2 }
				has_portrait_property = { layer = 5 index = 4 }
			}
		}

		modifier = {
			factor = 1000
			song_dynasty_futou_trigger = yes
		}

		modifier = {
			factor = 99
			is_female = no
			culture = persian
			religion_group = zoroastrian_group
		}
	}

	4 = { # d - Simple golden band/turban
		factor = 5

		trigger = {
			OR = {
				higher_real_tier_than = count
				spouse_even_if_dead = { higher_real_tier_than = count }
				has_minor_title = title_prince
				has_minor_title = title_queen_mother
			}
			NOR = {
				mercenary = yes
				trait = peasant_leader
				trait = heresiarch
				AND = {
					higher_real_tier_than = duke
					trigger_if = {
						limit = { is_alive = no }
						NOT = { trait = uncrowned }
					}
					trigger_else_if = {
						limit = {
							has_dlc = "Holy Fury"
							is_feudal = yes
							primary_title = { is_vice_royalty = no }
							OR = {
								religion = catholic
								religion = fraticelli
							}
							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
						}
					}
					trigger_if = {
						limit = {
							is_nomadic = yes
							has_game_started = yes
						}
						population_and_manpower >= 5000
					}
					NOR = {
						AND = {
							is_republic = yes
							NOT = { government = confucian_bureaucracy }
						}
						holy_order = yes
					}
				}
				is_or_was_offmap_power_ruler = yes
				has_minor_title = title_despot
				has_minor_title = title_augusta
				spouse_even_if_dead = {
					OR = {
						AND = {
							higher_real_tier_than = duke
							trigger_if = {
								limit = { is_alive = no }
								NOT = { trait = uncrowned }
							}
							trigger_else_if = {
								limit = {
									has_dlc = "Holy Fury"
									is_feudal = yes
									primary_title = { is_vice_royalty = no }
									OR = {
										religion = catholic
										religion = fraticelli
									}
									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
								}
							}
							trigger_if = {
								limit = {
									is_nomadic = yes
									has_game_started = yes
								}
								population_and_manpower >= 5000
							}
							NOR = {
								AND = {
									is_republic = yes
									NOT = { government = confucian_bureaucracy }
								}
								holy_order = yes
							}
						}
						is_or_was_offmap_power_ruler = yes
						has_minor_title = title_despot
						has_minor_title = title_augusta
					}
				}
				AND = {
					OR = {
						AND = {
							real_tier = duke
							independent = yes
							NOR = {
								AND = {
									is_republic = yes
									NOT = { government = confucian_bureaucracy }
								}
								holy_order = yes
							}
						}
						spouse_even_if_dead = {
							real_tier = duke
							independent = yes
							NOR = {
								AND = {
									is_republic = yes
									NOT = { government = confucian_bureaucracy }
								}
								holy_order = yes
							}
						}
					}
					OR = {
						culture_group = north_germanic
						culture_group = finno_ugric
						culture_group = celtic
						culture = saxon
						culture = nepali
						culture_group = arabic
						culture = sogdian
						culture = saka
						culture = tocharian
						culture_group = east_african
						culture_group = tibetan_group
					}
				}
				trait = in_hiding
				trait = on_pilgrimage
				trait = on_indian_pilgrimage
			}
		}

		modifier = {
			factor = 0.05
			OR = {
				has_portrait_property = { layer = 5 index = 1 }
				has_portrait_property = { layer = 5 index = 2 }
				has_portrait_property = { layer = 5 index = 3 }
				has_portrait_property = { layer = 5 index = 5 }
				has_portrait_property = { layer = 5 index = 6 }
				has_portrait_property = { layer = 5 index = 7 }
				has_portrait_property = { layer = 5 index = 8 }
				has_portrait_property = { layer = 5 index = 9 }
			}
		}

		modifier = {
			factor = 0.01
			is_female = no
			OR = {
				culture_group = chinese_group
				culture = tangut
			}
			NOT = { offmap_china = { offmap_ruler = { dynasty = 1051151 } } }
		}
	}

	5 = { # e - Common headgear 1
		factor = 1

		trigger = {
			OR = {
				NOR = {
					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
					has_minor_title = title_despot
					has_minor_title = title_augusta
				}
				AND = {
					NOR = {
						higher_real_tier_than = duke
						independent = yes
						spouse_even_if_dead = {
							OR = {
								higher_real_tier_than = duke
								independent = yes
							}
						}
					}
					OR = {
						culture_group = arabic
						culture_group = iranian
						culture_group = west_african
						culture_group = central_african
						culture_group = altaic
						culture_group = indo_aryan_group
						culture_group = dravidian_group
						culture_group = tibetan_group
						culture_group = mesoamerican
						AND = {
							is_female = no
							OR = {
								culture_group = chinese_group
								culture = tangut
							}
							NOT = { offmap_china = { offmap_ruler = { dynasty = 1051151 } } }
						}
					}
				}
				mercenary = yes
				trait = peasant_leader
				trait = heresiarch
				trait = in_hiding
				trait = leper
				trait = on_pilgrimage
				trait = on_indian_pilgrimage
			}
			trigger_if = {
				limit = {
					is_female = no
					culture_group = celtic
				}
				is_landed = no
			}
		}

		modifier = {
			factor = 0.05
			OR = {
				has_portrait_property = { layer = 5 index = 4 }
				has_portrait_property = { layer = 5 index = 6 }
				has_portrait_property = { layer = 5 index = 7 }
				has_portrait_property = { layer = 5 index = 8 }
				has_portrait_property = { layer = 5 index = 9 }
				has_portrait_property = { layer = 5 index = 11 }
				NAND = {
					year < 950
					has_portrait_property = { layer = 31 index = 0 }
				}
			}
		}

		modifier = {
			factor = 2
			is_female = yes
			is_married = no
			OR = {
				culture_group = west_slavic
				culture_group = south_slavic
				culture_group = magyar
			}
		}

		modifier = {
			factor = 1000
			trait = leper
			OR = {
				culture_group = arabic
				culture_group = iranian
				culture_group = west_african
				culture_group = east_african
				culture_group = central_african
				culture = roman
				culture_group = finno_ugric
				culture_group = magyar
				culture_group = tibetan_group
			}
		}
	}

	6 = { # f - Common headgear 2
		factor = 1
		hide_layers = { 31 = {} }

		trigger = {
			OR = {
				NOR = {
					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
					has_minor_title = title_despot
					has_minor_title = title_augusta
				}
				AND = {
					NOR = {
						higher_real_tier_than = duke
						independent = yes
						spouse_even_if_dead = {
							OR = {
								higher_real_tier_than = duke
								independent = yes
							}
						}
					}
					OR = {
						culture_group = arabic
						culture_group = iranian
						culture_group = west_african
						culture_group = central_african
						culture_group = altaic
						culture_group = indo_aryan_group
						culture_group = dravidian_group
						culture_group = tibetan_group
						culture_group = mesoamerican
						AND = {
							is_female = no
							OR = {
								culture_group = chinese_group
								culture = tangut
							}
							NOT = { offmap_china = { offmap_ruler = { dynasty = 1051151 } } }
						}
					}
				}
				mercenary = yes
				trait = peasant_leader
				trait = heresiarch
				trait = in_hiding
				trait = leper
				trait = on_pilgrimage
				trait = on_indian_pilgrimage
			}
		}

		modifier = {
			factor = 0.05
			OR = {
				has_portrait_property = { layer = 5 index = 4 }
				has_portrait_property = { layer = 5 index = 5 }
				has_portrait_property = { layer = 5 index = 7 }
				has_portrait_property = { layer = 5 index = 8 }
				has_portrait_property = { layer = 5 index = 9 }
				has_portrait_property = { layer = 5 index = 11 }
				NOT = { has_portrait_property = { layer = 31 index = 0 } }
			}
		}
	}

	7 = { # g - Common headgear 3
		factor = 1
		hide_layers = { 31 = {} }

		trigger = {
			OR = {
				NOR = {
					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
					has_minor_title = title_despot
					has_minor_title = title_augusta
				}
				AND = {
					NOR = {
						higher_real_tier_than = duke
						independent = yes
						spouse_even_if_dead = {
							OR = {
								higher_real_tier_than = duke
								independent = yes
							}
						}
					}
					OR = {
						culture_group = arabic
						culture_group = iranian
						culture_group = west_african
						culture_group = central_african
						culture_group = altaic
						culture_group = indo_aryan_group
						culture_group = dravidian_group
						culture_group = tibetan_group
						culture_group = mesoamerican
						AND = {
							is_female = no
							OR = {
								culture_group = chinese_group
								culture = tangut
							}
							NOT = { offmap_china = { offmap_ruler = { dynasty = 1051151 } } }
						}
					}
				}
				mercenary = yes
				trait = peasant_leader
				trait = heresiarch
				trait = in_hiding
				trait = leper
				trait = on_pilgrimage
				trait = on_indian_pilgrimage
			}
		}

		modifier = {
			factor = 0.05
			OR = {
				has_portrait_property = { layer = 5 index = 4 }
				has_portrait_property = { layer = 5 index = 5 }
				has_portrait_property = { layer = 5 index = 6 }
				has_portrait_property = { layer = 5 index = 8 }
				has_portrait_property = { layer = 5 index = 9 }
				has_portrait_property = { layer = 5 index = 11 }
				NOT = { has_portrait_property = { layer = 31 index = 0 } }
			}
		}
	}

	8 = { # h - Common headgear 4
		factor = 1
		hide_layers = { 31 = {} }

		trigger = {
			OR = {
				NOR = {
					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
					has_minor_title = title_despot
					has_minor_title = title_augusta
				}
				AND = {
					NOR = {
						higher_real_tier_than = duke
						independent = yes
						spouse_even_if_dead = {
							OR = {
								higher_real_tier_than = duke
								independent = yes
							}
						}
					}
					OR = {
						culture_group = arabic
						culture_group = iranian
						culture_group = west_african
						culture_group = central_african
						culture_group = altaic
						culture_group = indo_aryan_group
						culture_group = dravidian_group
						culture_group = tibetan_group
						culture_group = mesoamerican
						AND = {
							is_female = no
							OR = {
								culture_group = chinese_group
								culture = tangut
							}
							NOT = { offmap_china = { offmap_ruler = { dynasty = 1051151 } } }
						}
					}
				}
				mercenary = yes
				trait = peasant_leader
				trait = heresiarch
				trait = in_hiding
				trait = leper
				trait = on_pilgrimage
				trait = on_indian_pilgrimage
			}
			trigger_if = {
				limit = {
					is_female = yes
					OR = {
						culture_group = west_slavic
						culture_group = south_slavic
						culture_group = magyar
					}
				}
				is_married = no
			}
		}

		modifier = {
			factor = 0.05
			OR = {
				has_portrait_property = { layer = 5 index = 4 }
				has_portrait_property = { layer = 5 index = 5 }
				has_portrait_property = { layer = 5 index = 6 }
				has_portrait_property = { layer = 5 index = 7 }
				has_portrait_property = { layer = 5 index = 9 }
				has_portrait_property = { layer = 5 index = 11 }
				NOT = { has_portrait_property = { layer = 31 index = 0 } }
			}
		}

		modifier = {
			factor = 2
			is_female = yes
			is_married = no
			OR = {
				culture_group = west_slavic
				culture_group = south_slavic
				culture_group = magyar
			}
		}
	}

	9 = { # i - Shady headgear
		factor = 3
		hide_layers = { 31 = {} }
		hide_layers = { 32 = {} }
		hide_layers = { 33 = {} }

		trigger = {
			OR = {
				trigger_if = {
					limit = { has_job_title = job_spymaster }
					lower_real_tier_than = king
				}
				trigger_else = {
					intrigue >= 18
					lower_real_tier_than = duke
				}
				trait = in_hiding
				trait = leper
			}
		}

		modifier = {
			factor = 33
			OR = {
				has_job_title = job_spymaster
				trait = leper
			}
		}
	}

	10 = { # j - Martial headgear
		factor = 100
		hide_layers = { 43 = {} }

		trigger = {
			trigger_if = {
				limit = {
					OR = {
						AND = {
							is_alive = yes
							employer = { is_patrician = yes }
						}
						AND = {
							higher_tier_than = baron
							government = republic_government
						}
					}
					in_command = no
				}
				OR = {
					culture_group = latin
					culture_group = iberian
					culture_group = celtic
					culture_group = central_germanic
					culture_group = west_germanic
					culture_group = east_slavic
					culture_group = west_slavic
					culture_group = south_slavic
					culture_group = magyar
				}
			}
			trigger_else = {
				OR = {
					AND = {
						in_command = yes
						OR = {
							war = yes
							liege = { war = yes }
							in_battle = yes
							in_siege = yes
							employer = { mercenary = yes }
							employer = { holy_order = yes }
						}
					}
					has_character_flag = add_duel_xp
				}
				NOT = { has_game_rule = { name = martial_headgear value = off } }
				OR = {
					NOR = {
						higher_real_tier_than = count
						spouse_even_if_dead = { higher_real_tier_than = count }
						has_character_modifier = jd_strategist
					}
					mercenary = yes
					trait = peasant_leader
					trait = heresiarch
				}
				NOR = {
					prisoner = yes
					death_reason = death_dungeon
					trait = saint
					has_nickname = nick_the_saint
				}
			}
		}

		modifier = {
			factor = 0.01
			OR = {
				AND = {
					is_alive = yes
					employer = { is_patrician = yes }
				}
				AND = {
					higher_tier_than = baron
					government = republic_government
				}
			}
			in_command = no
			OR = {
				culture_group = latin
				culture_group = iberian
				culture_group = celtic
				culture_group = central_germanic
				culture_group = west_germanic
				culture_group = east_slavic
				culture_group = west_slavic
				culture_group = south_slavic
				culture_group = magyar
			}
		}
	}

	11 = { # k - Blank
		factor = 4

		trigger = {
			OR = {
				NOR = {
					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
					has_minor_title = title_despot
					has_minor_title = title_augusta
				}
				trait = in_hiding
				prisoner = yes
				death_reason = death_dungeon
				trait = saint
				has_nickname = nick_the_saint
				trait = on_pilgrimage
				trait = on_indian_pilgrimage
				trait = peasant_leader
				trait = heresiarch
				mercenary = yes
				holy_order = yes
			}
			trigger_if = {
				limit = {
					is_female = yes
					OR = {
						is_married = yes
						any_spouse_even_if_dead = { is_alive = no }
						age >= 40
						trait = chaste
						trait = celibate
						trait = zealous
						has_focus = focus_theology
						is_ascetic_trigger = yes
						trait = on_pilgrimage
						trait = on_indian_pilgrimage
					}
					NOT = { trait = lustful }
				}
				OR = {
					prisoner = yes
					death_reason = death_dungeon
					trait = saint
					has_nickname = nick_the_saint
					death_reason = death_slavery
				}
			}
		}

		modifier = {
			factor = 1000
			OR = {
				prisoner = yes
				death_reason = death_dungeon
				trait = saint
				has_nickname = nick_the_saint
			}
		}

		modifier = {
			factor = 10
			death_reason = death_slavery
		}

		modifier = {
			factor = 0.1
			true_religion_scope = {
				OR = {
					religion_group = muslim
					religion_group = jewish_group
					religion_group = zoroastrian_group
				}
			}
			NOT = { trait = cynical }
		}

		modifier = {
			factor = 10
			OR = {
				has_portrait_property = { layer = 3 index = 10 }
				has_portrait_property = { layer = 3 index = 12 }
				has_portrait_property = { layer = 3 index = 13 }
				has_portrait_property = { layer = 3 index = 14 }
			}
			true_religion_scope = {
				NOR = {
					religion_group = muslim
					religion_group = jewish_group
					religion_group = zoroastrian_group
				}
			}
		}

		modifier = {
			factor = 0.05
			OR = {
				has_portrait_property = { layer = 5 index = 4 }
				has_portrait_property = { layer = 5 index = 5 }
				has_portrait_property = { layer = 5 index = 6 }
				has_portrait_property = { layer = 5 index = 7 }
				has_portrait_property = { layer = 5 index = 8 }
				has_portrait_property = { layer = 5 index = 9 }
			}
		}

		modifier = {
			factor = 20
			has_dlc = "Holy Fury"
			is_female = yes
			OR = {
				culture = frankish
				culture = occitan
			}
		}

		modifier = {
			factor = 0.25
			employer = { is_patrician = yes }
		}
	}

	12 = { # l - Royal helmet
		factor = 100
		hide_layers = { 43 = {} }

		trigger = {
			trigger_if = {
				limit = {
					OR = {
						AND = {
							is_alive = yes
							employer = { is_patrician = yes }
						}
						AND = {
							higher_tier_than = baron
							government = republic_government
						}
					}
					in_command = no
				}
				OR = {
					culture_group = latin
					culture_group = iberian
					culture_group = celtic
					culture_group = central_germanic
					culture_group = west_germanic
					culture_group = east_slavic
					culture_group = west_slavic
					culture_group = south_slavic
					culture_group = magyar
				}
			}
			trigger_else = {
				OR = {
					AND = {
						in_command = yes
						OR = {
							war = yes
							liege = { war = yes }
							in_battle = yes
							in_siege = yes
							employer = { holy_order = yes }
						}
					}
					has_character_flag = add_duel_xp
				}
				NOT = { has_game_rule = { name = martial_headgear value = off } }
				OR = {
					AND = {
						higher_real_tier_than = duke
						trigger_if = {
							limit = { is_alive = no }
							NOT = { trait = uncrowned }
						}
						trigger_else_if = {
							limit = {
								has_dlc = "Holy Fury"
								is_feudal = yes
								primary_title = { is_vice_royalty = no }
								OR = {
									religion = catholic
									religion = fraticelli
								}
								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
							}
						}
						trigger_if = {
							limit = {
								is_nomadic = yes
								has_game_started = yes
							}
							population_and_manpower >= 5000
						}
						NOR = {
							AND = {
								is_republic = yes
								NOT = { government = confucian_bureaucracy }
							}
							holy_order = yes
						}
					}
					is_or_was_offmap_power_ruler = yes
					has_minor_title = title_despot
					has_minor_title = title_augusta
					spouse_even_if_dead = {
						OR = {
							AND = {
								higher_real_tier_than = duke
								trigger_if = {
									limit = { is_alive = no }
									NOT = { trait = uncrowned }
								}
								trigger_else_if = {
									limit = {
										has_dlc = "Holy Fury"
										is_feudal = yes
										primary_title = { is_vice_royalty = no }
										OR = {
											religion = catholic
											religion = fraticelli
										}
										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
									}
								}
								trigger_if = {
									limit = {
										is_nomadic = yes
										has_game_started = yes
									}
									population_and_manpower >= 5000
								}
								NOR = {
									AND = {
										is_republic = yes
										NOT = { government = confucian_bureaucracy }
									}
									holy_order = yes
								}
							}
							is_or_was_offmap_power_ruler = yes
							has_minor_title = title_despot
							has_minor_title = title_augusta
						}
					}
					AND = {
						OR = {
							AND = {
								real_tier = duke
								independent = yes
								NOR = {
									AND = {
										is_republic = yes
										NOT = { government = confucian_bureaucracy }
									}
									holy_order = yes
								}
							}
							spouse_even_if_dead = {
								real_tier = duke
								independent = yes
								NOR = {
									AND = {
										is_republic = yes
										NOT = { government = confucian_bureaucracy }
									}
									holy_order = yes
								}
							}
						}
						OR = {
							culture_group = north_germanic
							culture_group = finno_ugric
							culture_group = celtic
							culture = saxon
							culture = nepali
							culture_group = arabic
							culture = sogdian
							culture = saka
							culture = tocharian
							culture_group = east_african
							culture_group = tibetan_group
						}
					}
				}
			}
		}

		modifier = {
			factor = 0.01
			OR = {
				AND = {
					is_alive = yes
					employer = { is_patrician = yes }
				}
				AND = {
					higher_tier_than = baron
					government = republic_government
				}
			}
			in_command = no
			OR = {
				culture_group = latin
				culture_group = iberian
				culture_group = celtic
				culture_group = central_germanic
				culture_group = west_germanic
				culture_group = east_slavic
				culture_group = west_slavic
				culture_group = south_slavic
				culture_group = magyar
			}
		}
	}

	13 = { # m - Ducal helmet
		factor = 100
		hide_layers = { 43 = {} }

		trigger = {
			trigger_if = {
				limit = {
					OR = {
						AND = {
							is_alive = yes
							employer = { is_patrician = yes }
						}
						AND = {
							higher_tier_than = baron
							government = republic_government
						}
					}
					in_command = no
				}
				OR = {
					culture_group = latin
					culture_group = iberian
					culture_group = celtic
					culture_group = central_germanic
					culture_group = west_germanic
					culture_group = east_slavic
					culture_group = west_slavic
					culture_group = south_slavic
					culture_group = magyar
				}
			}
			trigger_else = {
				OR = {
					AND = {
						in_command = yes
						OR = {
							war = yes
							liege = { war = yes }
							in_battle = yes
							in_siege = yes
							employer = { holy_order = yes }
						}
					}
					has_character_flag = add_duel_xp
					has_landed_title = e_china_west_governor
				}
				NOT = { has_game_rule = { name = martial_headgear value = off } }
				OR = {
					higher_real_tier_than = count
					spouse_even_if_dead = { higher_real_tier_than = count }
					has_character_modifier = jd_strategist
				}
			}
		}

		modifier = {
			factor = 0.01
			OR = {
				AND = {
					is_alive = yes
					employer = { is_patrician = yes }
				}
				AND = {
					higher_tier_than = baron
					government = republic_government
				}
			}
			in_command = no
			OR = {
				culture_group = latin
				culture_group = iberian
				culture_group = celtic
				culture_group = central_germanic
				culture_group = west_germanic
				culture_group = east_slavic
				culture_group = west_slavic
				culture_group = south_slavic
				culture_group = magyar
			}
		}

		modifier = {
			factor = 0.99
			OR = {
				culture_group = chinese_group
				culture = tangut
			}
		}
	}

	14 = { # n - Chinese war gear
		factor = 99
		hide_layers = { 43 = {} }

		trigger = {
			trigger_if = {
				limit = {
					OR = {
						AND = {
							is_alive = yes
							employer = { is_patrician = yes }
						}
						AND = {
							higher_tier_than = baron
							government = republic_government
						}
					}
					in_command = no
				}
				OR = {
					culture_group = latin
					culture_group = iberian
					culture_group = celtic
					culture_group = central_germanic
					culture_group = west_germanic
					culture_group = east_slavic
					culture_group = west_slavic
					culture_group = south_slavic
					culture_group = magyar
				}
			}
			trigger_else = {
				has_dlc = "Jade Dragon"
				OR = {
					culture_group = chinese_group
					culture = tangut
				}
				OR = {
					AND = {
						in_command = yes
						OR = {
							war = yes
							liege = { war = yes }
							in_battle = yes
							in_siege = yes
							employer = { mercenary = yes }
							employer = { holy_order = yes }
						}
					}
					has_character_flag = add_duel_xp
				}
				NOT = { has_game_rule = { name = martial_headgear value = off } }
				OR = {
					higher_real_tier_than = count
					spouse_even_if_dead = { higher_real_tier_than = count }
					has_character_modifier = jd_strategist
				}
			}
		}

		modifier = {
			factor = 0.01
			OR = {
				AND = {
					is_alive = yes
					employer = { is_patrician = yes }
				}
				AND = {
					higher_tier_than = baron
					government = republic_government
				}
			}
			in_command = no
			OR = {
				culture_group = latin
				culture_group = iberian
				culture_group = celtic
				culture_group = central_germanic
				culture_group = west_germanic
				culture_group = east_slavic
				culture_group = west_slavic
				culture_group = south_slavic
				culture_group = magyar
			}
		}
	}
}
