should_be_naked_trigger = {
	# Character must be an adult.
	exists = this
	is_adult = yes

	# Character must have a valid reasion to be naked.
	OR = {
		faith = {
			has_doctrine_parameter = naked_adherents_active
		}
		AND = {
			faith = {
				has_doctrine_parameter = naked_priests_active
			}
			OR = {
				ai_zeal >= 50
				has_trait = devoted
				has_trait = zealous
				government_has_flag = government_is_theocracy
				has_council_position = councillor_court_chaplain
			}
		}
		has_character_modifier = diplomacy_majesty_4090_no_raiment_modifier # Lunatic event where character goes naked instead of buying new clothes.
		has_character_flag = is_naked # Special flag used in certain events.
	}

}

# Can only be checked in the interface since the setting isn't synced
should_be_fully_naked_portrait_trigger = {
	should_be_naked_trigger = yes
	should_show_nudity = yes
}

should_be_topless_portrait_trigger = {
	exists = this
	OR = {
		has_character_flag = should_be_topless
		has_character_flag = single_combat_stripped_to_waist
		activity_tournament_shirtless_trigger = yes
	}
	should_show_nudity = yes
}

portrait_wear_no_headgear_trigger = {
	OR = {
		scope:age < 16 # No headgear for children under 16 #
		has_character_flag = no_hat
		portrait_prisoner_trigger = yes
		has_character_modifier = hajj_halq_modifier # To show shaved hair

		has_character_flag = roaming_character

		AND = { # No headgear for characters who sold their crown
			exists = this
			has_character_flag = sold_crown_charmod
			# Should still wear armor when going to war
			NOT = { portrait_wear_armor_trigger = yes }
		}

		AND = { # No headgear for characters with an active Vow of Poverty
			exists = this
			has_character_modifier = vow_of_poverty_modifier
			# Should still wear armor when going to war
			NOT = { portrait_wear_armor_trigger = yes }
		}

		AND = {
			OR = {

				should_be_naked_trigger = yes # Deliberately not the "fully naked" one since dropping your crown's intended even if nudity is disabled

				AND = {
					highest_held_title_tier < tier_duchy # Should wear ducal or royal crown instead.
					OR = {
						has_short_disease_trigger = yes # Affliction that would plausibly leave them bedridden for treatment
						has_character_flag = use_sickness_clothes
					}
				}

				AND = {
					exists = this
					has_character_modifier = fp1_abased_before_highgod_modifier	# Refuses to wear a crown due to HighGod
				}

				activity_tournament_shirtless_trigger = yes
			}

			NOR = { # Exceptions for dukes, kings, popes
				highest_held_title_tier >= tier_duchy # Should wear ducal or royal crown instead.
				AND = {
					religion = religion:christianity_religion
					faith.religious_head = this
				}
			}
		}

		AND = { # No headgear for vanity characters with the no_headgear flag, unless they are dukes or higher
			exists = this
			has_character_flag = no_headgear
			highest_held_title_tier < tier_duchy
		}

		portrait_ep2_ihram_clothes_trigger = yes # Remove headgear if you are undertaking the Hajj and meet the requirements for the Ihram clothes (Halq modifier and male)

		AND = { # No headgear for charioteers
			exists = this
			has_any_charioteer_trait = yes
		}
	}
}

portrait_wear_armor_trigger = {
	exists = this
	trigger_if = {
		limit = { exists = involved_activity }
		involved_activity = {
			NOR = {
				has_activity_type = activity_hunt
				has_activity_type = activity_pilgrimage
				has_activity_type = activity_roaming
			}
		}
	}
	is_incapable = no
	NOT = { has_any_charioteer_trait = yes }
	is_imprisoned = no
	portrait_ep2_wedding_clothes_trigger = no
	trigger_if = {
		limit = { portrait_sickness_trigger = yes }
		is_in_army = yes
	}
	OR = {
		# Mercenaries
		AND = {
			is_ruler = yes
			government_has_flag = government_is_mercenary
		}
		# Adventurers
		AND = {
			is_ruler = yes
			government_has_flag = government_is_landless_adventurer
			OR = {
				has_realm_law = camp_purpose_mercenaries
				has_realm_law = camp_purpose_brigands
			}
		}
		# Holy Orders
		AND = {
			is_ruler = yes
			government_has_flag = government_is_holy_order
		}
		has_trait = order_member
		# Commanding an army
		is_commanding_army = yes
		# Knight in an army
		exists = knight_army
		AND = {
			OR = {
				AND = {
					is_knight = yes
					NAND = {
						is_ruler = no
						government_has_flag = government_is_landless_adventurer
						liege ?= {
							NOR = {
								has_realm_law = camp_purpose_mercenaries
								has_realm_law = camp_purpose_brigands
							}
							is_at_war = no
						}
					}
				}
				has_court_position = bodyguard_court_position
				has_court_position = champion_court_position
				has_court_position = garuda_court_position
				has_court_position = akolouthos_court_position
				has_court_position = master_of_arms_camp_officer
				has_court_position = light_cavalry_captain_camp_officer
				has_court_position = camelry_captain_camp_officer
				has_court_position = elephantry_captain_camp_officer
				has_court_position = heavy_cavalry_captain_camp_officer
				has_court_position = horse_archer_captain_camp_officer
				has_court_position = archer_captain_camp_officer
				has_court_position = heavy_infantry_captain_camp_officer
				has_court_position = light_infantry_captain_camp_officer
				has_court_position = pike_captain_camp_officer
			}
			is_councillor = no
			OR = {
				is_playable_character = no
				liege = { is_at_war = yes }
			}
		}
		# Marshal lower than Duke
		AND = {
			has_council_position = councillor_marshal
			OR = {
				is_playable_character = no
				primary_title.tier < tier_kingdom
			}
		}
		has_character_flag = wear_armor
		# Serving Varangian
		has_character_flag = is_currently_varangian
		# In a Duel
		has_character_flag = single_combat_duel_armor
		has_character_flag = forced_knight_armor
		# In a Tournament
		activity_tournament_armor_trigger = yes
		AND = { # In case these characters become landed they should stop wearing armor
			has_character_flag = military_outfit
			is_ruler = no
		}
	}
}

portrait_wear_armor_currently_in_army_trigger = {
	exists = this
	OR = {
		is_commanding_army = yes
		exists = knight_army
	}
}

portrait_wear_no_armor_trigger = {
	NOR = {
		portrait_wear_armor_trigger = yes
		portrait_wear_armor_currently_in_army_trigger = yes
	}
}

portrait_accoladed_knight_trigger = {
	exists = this
	exists = liege
	is_acclaimed = yes
	OR = {
		AND = {
			liege ?= {
				highest_held_title_tier = tier_duchy
			}
			accolade = {
				is_accolade_active = yes
				accolade_rank >= 5
			}
		}
		AND = {
			liege ?= {
				highest_held_title_tier = tier_kingdom
			}
			accolade = {
				is_accolade_active = yes
				accolade_rank >= 3
			}
		}
		AND = {
			liege ?= {
				highest_held_title_tier = tier_empire
			}
			accolade = {
				is_accolade_active = yes
			}
		}
	}
}

portrait_wear_helmet_trigger = { # Different from Armor, as Kings and Emperors should show their crowns!
	exists = this
	trigger_if = {
		limit = { exists = involved_activity }
		involved_activity = {
			NOR = {
				has_activity_type = activity_hunt
				has_activity_type = activity_pilgrimage
				has_activity_type = activity_roaming
			}
		}
	}
	is_incapable = no
	is_imprisoned = no
	trigger_if = {
		limit = { portrait_sickness_trigger = yes }
		is_in_army = yes
	}
	OR = {
		# Adventurers
		AND = {
			is_ruler = yes
			government_has_flag = government_is_landless_adventurer
			has_realm_law = camp_purpose_mercenaries
		}
		# Holy Orders
		AND = {
			is_ruler = yes
			government_has_flag = government_is_holy_order
		}
		has_trait = order_member
		# Commanding and lower than a King
		AND = {
			is_commanding_army = yes
			OR = {
				is_landed_or_landless_administrative = no
				AND = {
					exists = primary_title
					primary_title.tier < tier_kingdom
				}
			}
		}
		# Knight in an army
		exists = knight_army
		# Non-Council Knight lower than King and liege is at war
		AND = {
			is_knight = yes
			is_councillor = no
			OR = {
				is_landed_or_landless_administrative = no
				AND = {
					exists = primary_title
					primary_title.tier < tier_kingdom
					liege = { is_at_war = yes }
				}
			}
			NAND = {
				is_ruler = no
				government_has_flag = government_is_landless_adventurer
				liege ?= {
					is_at_war = no
					NOT = { has_realm_law = camp_purpose_mercenaries }
				}
			}
		}
		# Marshal lower than Duke
		AND = {
			has_council_position = councillor_marshal
			OR = {
				is_landed_or_landless_administrative = no
				primary_title.tier < tier_duchy
			}
		}
		has_character_flag = wear_armor
		# Serving Varangian
		has_character_flag = is_currently_varangian
		# In a Duel
		has_character_flag = single_combat_duel_armor
		# In a Tournament
		activity_tournament_armor_trigger = yes
		AND = { # In case these characters become landed they should stop wearing armor
			has_character_flag = military_outfit
			is_ruler = no
		}
	}
	NOR = {
		activity_tournament_shirtless_trigger = yes
		has_character_flag = no_hat
	}
	# Not peasants leading revolts
	NAND = {
		has_trait = peasant_leader
		OR = {
			is_ruler = no
			is_leading_faction_type = peasant_faction
			AND = {
				is_ruler = yes
				is_landed_or_landless_administrative = no
				OR = {
					government_has_flag = government_is_feudal
					government_has_flag = government_is_clan
				}
			}
		}
	}
}

portrait_wear_christian_holy_order_trigger = { # Christian holy order members/vassals should wear different armor
	OR = {
		AND = { # Is a Christian holy order member
			religion = religion:christianity_religion
			government_has_flag = government_is_holy_order
		}
		AND = { # Is a Christian holy order vassal
			religion = religion:christianity_religion
			is_playable_character = no
			portrait_wear_armor_trigger = yes
			exists = liege
			liege = {  government_has_flag = government_is_holy_order }
		}
	}
}

portrait_has_trait_trigger = {
	trait:$TRAIT$ = { is_in_list = traits }
}

is_dwarf_height = {
	OR = {
		has_trait = dwarf
		morph_gene_attribute = {
			category = gene_height
			attribute = body_height
			value < -0.26
		}
	}
}

portrait_shared_clothing_contents_trigger = {
	trigger_if = {
		limit = { exists = top_liege.var:adopted_cultural_style }
		top_liege.var:adopted_cultural_style = flag:$CULTURE_FLAG$
	}
	trigger_else_if = {
		limit = {
			exists = this
			exists = var:adopted_cultural_style
		}

		var:adopted_cultural_style = flag:$CULTURE_FLAG$
		has_variable = years_as_varangian
		is_landed = no
	}
	trigger_else = {
		$CULTURE_SCOPE$ ?= { has_clothing_gfx = $CULTURE_FLAG$_clothing_gfx }
	}
}

portrait_byzantine_clothing_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = scope:culture
		CULTURE_FLAG = byzantine
	}
}

portrait_byzantine_clothing_spouse_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = culture
		CULTURE_FLAG = byzantine
	}
}

portrait_indian_clothing_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = scope:culture
		CULTURE_FLAG = indian
	}
}

portrait_indian_clothing_spouse_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = culture
		CULTURE_FLAG = indian
	}
}

portrait_mena_clothing_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = scope:culture
		CULTURE_FLAG = mena
	}
}

portrait_mena_clothing_spouse_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = culture
		CULTURE_FLAG = mena
	}
}

portrait_african_clothing_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = scope:culture
		CULTURE_FLAG = african
	}
}

portrait_african_clothing_spouse_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = culture
		CULTURE_FLAG = african
	}
}

portrait_northern_clothing_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = scope:culture
		CULTURE_FLAG = northern
	}
}

portrait_northern_clothing_spouse_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = culture
		CULTURE_FLAG = northern
	}
}


### FP2 - Fate of Iberia ###

portrait_fp2_iberian_muslim_clothing_trigger = {
	has_fp2_dlc_trigger = yes
	OR = {
		portrait_shared_clothing_contents_trigger = {
			CULTURE_SCOPE = scope:culture
			CULTURE_FLAG = iberian_muslim
		}
		trigger_if = {
			limit = { exists = this	}
			AND = {
				is_playable_character = yes
				religion = religion:islam_religion
				capital_province = {
					geographical_region = world_europe_west_iberia
				}
			}
		}
	}
}

portrait_fp2_iberian_muslim_clothing_spouse_trigger = {
	has_fp2_dlc_trigger = yes
	OR = {
		portrait_shared_clothing_contents_trigger = {
			CULTURE_SCOPE = culture
			CULTURE_FLAG = iberian_muslim
		}
		AND = {
			is_playable_character = yes
			religion = religion:islam_religion
			capital_province = {
				geographical_region = world_europe_west_iberia
			}
		}
	}
}

portrait_fp2_iberian_christian_clothing_trigger = {
	has_fp2_dlc_trigger = yes
	OR = {
		portrait_shared_clothing_contents_trigger = {
			CULTURE_SCOPE = scope:culture
			CULTURE_FLAG = iberian_christian
		}
		trigger_if = {
			limit = { exists = this }
			AND = {
				is_playable_character = yes
				religion = religion:christianity_religion
				capital_province = {
					geographical_region = world_europe_west_iberia
				}
			}
		}
	}
}

portrait_fp2_iberian_christian_clothing_spouse_trigger = {
	has_fp2_dlc_trigger = yes
	OR = {
		portrait_shared_clothing_contents_trigger = {
			CULTURE_SCOPE = culture
			CULTURE_FLAG = iberian_christian
		}
		AND = {
			is_playable_character = yes
			religion = religion:christianity_religion
			capital_province = {
				geographical_region = world_europe_west_iberia
			}
		}
	}
}

### FP3 - Sands of Time  ###
#iranian
portrait_fp3_iranian_clothing_trigger = {
	has_fp3_dlc_trigger = yes
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = scope:culture
		CULTURE_FLAG = iranian
	}
}

portrait_fp3_iranian_clothing_spouse_trigger = {
	has_fp3_dlc_trigger = yes
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = culture
		CULTURE_FLAG = iranian
	}
}

#turkic
portrait_fp3_turkic_clothing_trigger = {
	has_fp3_dlc_trigger = yes
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = scope:culture
		CULTURE_FLAG = turkic
	}
}

portrait_fp3_turkic_clothing_spouse_trigger = {
	has_fp3_dlc_trigger = yes
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = culture
		CULTURE_FLAG = turkic
	}
}

### AFR ###

portrait_afr_berber_clothing_trigger = {
	has_afr_dlc_trigger = yes
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = scope:culture
		CULTURE_FLAG = afr_berber
	}
	trigger_if = {
		limit = { exists = this	}
		NAND = {
			is_landed = yes
			capital_province = { geographical_region = world_europe_west_iberia	}
		}
	}
}

portrait_afr_berber_clothing_spouse_trigger = {
	has_afr_dlc_trigger = yes
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = culture
		CULTURE_FLAG = afr_berber
	}
	NAND = {
		is_landed = yes
		capital_province = { geographical_region = world_europe_west_iberia }
	}
}

### FP1 ###

portrait_fp1_norse_clothing_trigger = {
	has_fp1_dlc_trigger = yes
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = scope:culture
		CULTURE_FLAG = fp1_norse
	}
}

portrait_fp1_norse_clothing_spouse_trigger = {
	has_fp1_dlc_trigger = yes
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = culture
		CULTURE_FLAG = fp1_norse
	}
}

portrait_steppe_clothing_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = scope:culture
		CULTURE_FLAG = mongol
	}
}

portrait_steppe_clothing_spouse_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = culture
		CULTURE_FLAG = mongol
	}
}

portrait_western_clothing_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = scope:culture
		CULTURE_FLAG = western
	}
}

portrait_western_clothing_spouse_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = culture
		CULTURE_FLAG = western
	}
}

portrait_french_clothing_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = scope:culture
		CULTURE_FLAG = french
	}
}

portrait_french_clothing_spouse_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = culture
		CULTURE_FLAG = french
	}
}

portrait_dde_hre_clothing_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = scope:culture
		CULTURE_FLAG = dde_hre
	}
	has_dlc = "Garments of the Holy Roman Empire"
}

portrait_dde_hre_clothing_spouse_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = culture
		CULTURE_FLAG = dde_hre
	}
	has_dlc = "Garments of the Holy Roman Empire"
}

portrait_dde_abbasid_clothing_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = scope:culture
		CULTURE_FLAG = dde_abbasid
	}
	has_dlc = "Fashion of the Abbasid Court"
}

portrait_dde_abbasid_clothing_spouse_trigger = {
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = culture
		CULTURE_FLAG = dde_abbasid
	}
	has_dlc = "Fashion of the Abbasid Court"
}

### SP2 - Elegance of the Empire ###

portrait_sp2_western_clothing_trigger = {
	has_dlc_feature = elegance_of_the_empire
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = scope:culture
		CULTURE_FLAG = western
	}
}

portrait_sp2_western_clothing_spouse_trigger = {
	has_dlc_feature = elegance_of_the_empire
	portrait_shared_clothing_contents_trigger = {
		CULTURE_SCOPE = culture
		CULTURE_FLAG = western
	}
}

portrait_can_use_noble_headgear_trigger = {
	NAND = {
		portrait_has_trait_trigger = { TRAIT = peasant_leader }
		OR = {
			is_ruler = no
			is_leading_faction_type = peasant_faction
			AND = {
				is_playable_character = no
				OR = {
					government_has_flag = government_is_feudal
					government_has_flag = government_is_clan
				}
			}
		}
	}
}


### General clothing triggers ###

portrait_era1_trigger = { # Intended to primarily cover the years 850 to 1000
	scope:year_of_birth < 1000
	NAND = { # People from 16 to 25 will be the first to adopt new fashion
		current_year >= 1000
		scope:year_of_birth >= 975
		scope:year_of_birth < 1125
		scope:age >= 16
	}
}

portrait_era2_trigger = { # Intended to primarily cover the years 1000 to 1150
	current_year >= 1000
	OR = {
		AND = { # People from 16 to 25 will be the first to adopt new fashion
			scope:year_of_birth >= 975
			scope:year_of_birth < 1125
			scope:age >= 16
		}
		AND = {
			scope:year_of_birth >= 1010
			scope:year_of_birth < 1150
			OR = {
				current_year < 1150
				is_alive = no
			}
		}
		AND = { # Children under 16 will not be early adopters
			scope:year_of_birth >= 1010
			scope:year_of_birth < 1166
			scope:age < 16
		}
	}
}

portrait_era3_trigger = { # Intended to primarily cover the years 1150 to 1300
	current_year >= 1150
	OR = {
		AND = { # People from 16 to 25 will be the first to adopt new fashion
			scope:year_of_birth >= 1125
			scope:year_of_birth < 1275
			scope:age >= 16
		}
		AND = {
			scope:year_of_birth >= 1160
			scope:year_of_birth < 1300
			OR = {
				current_year < 1300
				is_alive = no
			}
		}
		AND = { # Children under 16 will not be early adopters
			scope:year_of_birth >= 1160
			scope:year_of_birth < 1316
			scope:age < 16
		}
	}
}

portrait_era4_trigger = { # Intended to primarily cover the years 1300 to 1450
	current_year >= 1300
	OR = {
		AND = { # People from 16 to 25 will be the first to adopt new fashion
			scope:year_of_birth >= 1275
			scope:year_of_birth < 1425
			scope:age >= 16
		}
		AND = {
			scope:year_of_birth >= 1310
			#scope:year_of_birth < 1425
		}
	}
}

portrait_era1_armor_trigger = {
	current_year >= 0
	current_year < 1020
}

portrait_era2_armor_trigger = {
	current_year >= 1000
	current_year < 1130 # 1170
}

portrait_era3_armor_trigger = {
	current_year >= 1065 # This is anachronistic and should historically be around 1150 (armor with surcoat)
	current_year < 1270 # 1320
}

portrait_era4_armor_trigger = {
	current_year >= 1240 # This is anachronistic and should historically be around 1300 (transitional mail and plate armor)
}


court_fashion_level_4_trigger = {
	scope:highest_held_title_tier < tier_duchy
	NOT = {
		AND = {
			exists = primary_spouse
			primary_spouse = {
				highest_held_title_tier >= tier_county
			}
		}
	}
	exists = court_owner
	court_owner = {
		has_royal_court = yes
		has_dlc_feature = royal_court
		amenity_level = { type = court_fashion value = 4 }
	}
	portrait_$CULTURE_INPUT$_clothing_trigger = yes
}

court_fashion_level_4_headgear_trigger = {
	scope:highest_held_title_tier < tier_duchy
	NOT = {
		AND = {
			exists = primary_spouse
			primary_spouse = {
				highest_held_title_tier >= tier_duchy
			}
		}
	}
	exists = court_owner
	court_owner = {
		has_royal_court = yes
		has_dlc_feature = royal_court
		amenity_level = { type = court_fashion value >= 4 }
	}
	portrait_$CULTURE_INPUT$_clothing_trigger = yes
}

court_fashion_level_5_trigger = {
	scope:highest_held_title_tier < tier_duchy
	NOT = {
		AND = {
			exists = primary_spouse
			primary_spouse = {
				highest_held_title_tier >= tier_duchy
			}
		}
	}
	exists = court_owner
	court_owner = {
		has_royal_court = yes
		has_dlc_feature = royal_court
		amenity_level = { type = court_fashion value = 5 }
	}
	portrait_$CULTURE_INPUT$_clothing_trigger = yes
}

portrait_poverty_robes_trigger = {
	exists = this
	has_character_modifier = vow_of_poverty_modifier
	# Should still wear armor when going to war
	NOT = { portrait_wear_armor_trigger = yes }
	portrait_ep2_wedding_clothes_trigger = no
}

portrait_ruler_designer_trigger = {
	exists = scope:ruler_designer
}

portrait_commoner_trigger = {
	OR = {
		AND = {
			scope:highest_held_title_tier < tier_barony
			NOT = {
				portrait_mayor_trigger = {
					CULTURE_INPUT = $CULTURE_INPUT$
				}
			}
		}
		AND = {
			government_has_flag = government_is_landless_adventurer
			has_realm_law = camp_purpose_scholars
		}
	}
	NOR = {
		portrait_low_nobles_trigger = {
			CULTURE_INPUT = $CULTURE_INPUT$ 
		}
		portrait_high_nobles_trigger = {
			CULTURE_INPUT = $CULTURE_INPUT$ 
		}
		portrait_royalty_trigger = {
			CULTURE_INPUT = $CULTURE_INPUT$ 
		}
		portrait_imperial_trigger = {
			CULTURE_INPUT = $CULTURE_INPUT$ 
		}
	}
	trigger_if = {
		limit = { exists = this } # To check if this is an actual character
		NOR = {
			AND = {
				exists = primary_spouse
				primary_spouse ?= {
					AND = {
						highest_held_title_tier > tier_barony
						NAND = {
							government_has_flag = government_is_landless_adventurer
							has_realm_law = camp_purpose_legitimists
						}
					}
				}
			}
			AND = {
				government_has_flag = government_is_republic
				primary_title.tier > tier_barony
			}
			AND = {
				is_ruler = yes
				government_has_flag = government_is_theocracy
			}
			AND = {
				is_ruler = no
				government_has_flag = government_is_landless_adventurer
				liege ?= {
					has_realm_law = camp_purpose_legitimists
				}
			}
			has_no_particular_noble_roots_trigger = no
			AND = { # Members of Council
				liege ?= {
					highest_held_title_tier >= tier_duchy
				}
				OR = { 
    				has_council_position = councillor_chancellor
    				has_council_position = councillor_steward
   				}	
   				portrait_$CULTURE_INPUT$_clothing_trigger = yes			
			}
		}
	}
	trigger_if = {
		limit = {
			exists = this
			exists = court_owner
			court_owner = { has_royal_court = yes }
			has_dlc_feature = royal_court
		}
		court_owner = {
			amenity_level = { type = court_fashion value < 4 }
		}
	}
	portrait_$CULTURE_INPUT$_clothing_trigger = yes
}

portrait_commoner_clothing_trigger = {
	portrait_commoner_trigger = {
		CULTURE_INPUT = $CULTURE_INPUT$
	}
	portrait_wear_no_armor_trigger = yes
}

portrait_commoner_no_mayors_trigger = {
	OR = {
		scope:highest_held_title_tier < tier_barony
		AND = {
			government_has_flag = government_is_landless_adventurer
			has_realm_law = camp_purpose_scholars
		}
	}
	trigger_if = {
		limit = { exists = this } # To check if this is an actual character
		NOR = {
			AND = {
				exists = primary_spouse
				primary_spouse = {
					AND = {
						highest_held_title_tier > tier_county
						NAND = {
							government_has_flag = government_is_landless_adventurer
							has_realm_law = camp_purpose_legitimists
						}
					}
				}
			}
			government_has_flag = government_is_republic
			AND = {
				is_ruler = yes
				government_has_flag = government_is_theocracy
			}
		}
	}
	trigger_if = {
		limit = {
			exists = this
			exists = court_owner
			court_owner = { has_royal_court = yes }
			has_dlc_feature = royal_court
		}
		court_owner = {
			amenity_level = { type = court_fashion value < 4 }
		}
	}
	portrait_$CULTURE_INPUT$_clothing_trigger = yes
	portrait_wear_no_armor_trigger = yes
}

portrait_commoner_headgear_fallback_trigger = {
	exists = this
	portrait_can_use_noble_headgear_trigger = no
	portrait_$CULTURE_INPUT$_clothing_trigger = yes
}

portrait_low_nobles_trigger = {
	trigger_if = {
		limit = { exists = this } # To check if this is an actual character
		NOT = {
			AND = {
				exists = primary_spouse
				primary_spouse = {
					highest_held_title_tier >= tier_duchy
					trigger_if = {
						limit = {
							government_has_flag = government_is_landless_adventurer
						}
						has_realm_law = camp_purpose_legitimists
					}
				}
			}
		}
		NOR = {
			portrait_high_nobles_trigger = {
				CULTURE_INPUT = $CULTURE_INPUT$ 
			}
			portrait_royalty_trigger = {
				CULTURE_INPUT = $CULTURE_INPUT$ 
			}
			portrait_imperial_trigger = {
				CULTURE_INPUT = $CULTURE_INPUT$ 
			}
		}
		OR = {
			AND = { # Nobles in general
				has_no_particular_noble_roots_trigger = no
				portrait_$CULTURE_INPUT$_clothing_trigger = yes
			}
			AND = { # Members of Council
				liege ?= {
					highest_held_title_tier >= tier_duchy
				}
				OR = { 
    				has_council_position = councillor_chancellor
    				has_council_position = councillor_steward
   				}	
   				portrait_$CULTURE_INPUT$_clothing_trigger = yes			
			}
			AND = { # Courtiers
				highest_held_title_tier < tier_county 
				exists = this
				exists = court_owner
				court_owner = {
					highest_held_title_tier > tier_duchy
				}
				portrait_$CULTURE_INPUT$_clothing_trigger = yes
			}
			AND = { # Mayors
				portrait_mayor_trigger = {
					CULTURE_INPUT = $CULTURE_INPUT$
				}
			}
			AND = { # Mercenaries
				government_has_flag = government_is_mercenary
				portrait_$CULTURE_INPUT$_clothing_trigger = yes
			}
			AND = { # Adventurers
				government_has_flag = government_is_landless_adventurer
				NOR = {
					has_realm_law = camp_purpose_legitimists
					liege ?= { has_realm_law = camp_purpose_legitimists }
				}
				portrait_$CULTURE_INPUT$_clothing_trigger = yes
			}
			AND = {
				OR = {
					highest_held_title_tier = tier_barony
					highest_held_title_tier = tier_county
				}
				NOR = {
					# has_dynasty = no
					AND = {
						government_has_flag = government_is_republic
						primary_title.tier > tier_barony
					}
					AND = {
						is_ruler = yes
						government_has_flag = government_is_theocracy
					}
				}
				portrait_$CULTURE_INPUT$_clothing_trigger = yes
			}
			AND = {
				exists = primary_spouse
				OR = {
					is_ruler = no
					highest_held_title_tier = tier_barony
				}
				primary_spouse = {
					OR = {
						highest_held_title_tier = tier_county
						government_has_flag = government_is_mercenary
						AND = {
							government_has_flag = government_is_landless_adventurer
							NOT = {
								has_realm_law = camp_purpose_legitimists
							}
						}
					}
					NOR = {
						# has_dynasty = no
						AND = {
							government_has_flag = government_is_republic
							primary_title.tier > tier_barony
						}
						AND = {
							is_ruler = yes
							government_has_flag = government_is_theocracy
						}
					}
					portrait_$CULTURE_INPUT$_clothing_spouse_trigger = yes
				}
			}
			AND = { # Viziers of rulers
				OR = {
					is_ruler = no
					highest_held_title_tier = tier_barony
				}
				exists = liege
				is_diarch = yes
				liege = {
					has_diarchy_active_parameter = diarchy_is_vizierate
					highest_held_title_tier = tier_county
					portrait_$CULTURE_INPUT$_clothing_trigger = yes
				}
			}
		}
	}
	trigger_else = {
		scope:highest_held_title_tier = tier_county # We use scope in case this is not an actual character (for example the Hybrid Culture preview window)
		portrait_$CULTURE_INPUT$_clothing_trigger = yes
	}
}

portrait_low_nobles_clothing_trigger = {
	portrait_low_nobles_trigger = {
		CULTURE_INPUT = $CULTURE_INPUT$
	}
	portrait_wear_no_armor_trigger = yes
}

portrait_high_nobles_trigger = {
	trigger_if = {
		limit = { exists = this } # To check if this is an actual character
		OR = {
			AND = { # Rulers
				OR = {
					highest_held_title_tier >= tier_duchy # Most cultures do not have specific clothes for royalty and imperial tier, so we use the high nobility for anything from duke/duchess and up
					AND = {
						government_has_flag = government_is_republic
						primary_title.tier > tier_barony
					}
					AND = {
						is_ruler = yes
						government_has_flag = government_is_theocracy
					}
					AND = {
						is_ruler = no
						government_has_flag = government_is_landless_adventurer
						liege ?= {  has_realm_law = camp_purpose_legitimists }
					}
				}
				NOR = { # Blocked for mercenaries and adventurers
					government_has_flag = government_is_mercenary
					AND = {
						government_has_flag = government_is_landless_adventurer
						NOR = {
							has_realm_law = camp_purpose_legitimists
							liege ?= {  has_realm_law = camp_purpose_legitimists }
						}
					}
				}
				portrait_$CULTURE_INPUT$_clothing_trigger = yes
			}
			AND = { # Spouses of rulers
				exists = primary_spouse
				OR = {
					is_ruler = no
					highest_held_title_tier <= tier_county
				}
				primary_spouse = {
					OR = {
						highest_held_title_tier >= tier_duchy
						AND = {
							government_has_flag = government_is_republic
							primary_title.tier > tier_barony
						}
						AND = {
							is_ruler = yes
							government_has_flag = government_is_theocracy
						}
					}
					NOR = { # Blocked for mercenaries and adventurers
						government_has_flag = government_is_mercenary
						AND = {
							government_has_flag = government_is_landless_adventurer
							NOR = {
								has_realm_law = camp_purpose_legitimists
								liege ?= {  has_realm_law = camp_purpose_legitimists }
							}
						}
					}
					portrait_$CULTURE_INPUT$_clothing_spouse_trigger = yes
				}
			}
			AND = { # Viziers of rulers
				exists = liege
				is_diarch = yes
				OR = {
					is_ruler = no
					highest_held_title_tier = tier_barony
				}
				liege = {
					has_diarchy_active_parameter = diarchy_is_vizierate
					highest_held_title_tier >= tier_duchy
					portrait_$CULTURE_INPUT$_clothing_trigger = yes
				}
			}
			AND = { # Family members of rulers
				any_close_family_member = {
					is_ruler = yes
					highest_held_title_tier > tier_duchy
				}
				portrait_$CULTURE_INPUT$_clothing_trigger = yes
			}
			has_character_flag = high_noble_clothing
		}
	}
	trigger_else = { # Fallback
		scope:highest_held_title_tier >= tier_duchy # We use scope in case this is not an actual character (for the Hybrid Culture preview window)
		portrait_$CULTURE_INPUT$_clothing_trigger = yes
	}
}

portrait_high_nobles_clothing_trigger = {
	portrait_high_nobles_trigger = {
		CULTURE_INPUT = $CULTURE_INPUT$
	}
	portrait_wear_no_armor_trigger = yes
}

portrait_high_nobles_headgear_trigger = {
	exists = this
	portrait_can_use_noble_headgear_trigger = yes
	OR = {
		AND = { # Rulers
			OR = {
				highest_held_title_tier = tier_duchy
				AND = {
					government_has_flag = government_is_republic
					primary_title.tier > tier_county
				}
				AND = {
					is_ruler = yes
					government_has_flag = government_is_theocracy
				}
				AND = {
					highest_held_title_tier = tier_kingdom
					is_governor = yes
				}
			}
			NOR = { # Blocked for mercenaries and adventurers
				government_has_flag = government_is_mercenary
				AND = {
					government_has_flag = government_is_landless_adventurer
					NOT = {
						has_realm_law = camp_purpose_legitimists
					}
				}
			}
			portrait_$CULTURE_INPUT$_clothing_trigger = yes
		}
		AND = { # Spouses of rulers
			exists = primary_spouse
			OR = {
				is_ruler = no
				highest_held_title_tier <= tier_county
			}
			primary_spouse = {
				OR = {
					highest_held_title_tier = tier_duchy
					AND = {
						government_has_flag = government_is_republic
						primary_title.tier > tier_county
					}
					AND = { is_ruler = yes government_has_flag = government_is_theocracy }
				}
				NOR = { # Blocked for mercenaries and adventurers
					government_has_flag = government_is_mercenary
					AND = {
						government_has_flag = government_is_landless_adventurer
						NOT = {
							has_realm_law = camp_purpose_legitimists
						}
					}
				}
				portrait_$CULTURE_INPUT$_clothing_spouse_trigger = yes
			}
		}
		AND = { # Viziers of rulers
			exists = liege
			is_diarch = yes
			OR = {
				is_ruler = no
				highest_held_title_tier = tier_barony
			}
			liege = {
				has_diarchy_active_parameter = diarchy_is_vizierate
				highest_held_title_tier >= tier_duchy
				portrait_$CULTURE_INPUT$_clothing_trigger = yes
			}
		}
		AND = { # Family members of rulers
			any_close_family_member = {
				is_ruler = yes
				highest_held_title_tier > tier_duchy
			}
			portrait_$CULTURE_INPUT$_clothing_trigger = yes
		}
	}
	NAND = { # Exclude high ranking Co-Rulers
		exists = liege
		is_diarch = yes
		liege = {
			has_diarchy_active_parameter = diarchy_is_co_rulership
			highest_held_title_tier >= tier_kingdom
			NOR = {
				AND = {
					government_has_flag = government_is_republic
					primary_title.tier > tier_barony
				}
				AND = {
					is_ruler = yes
					government_has_flag = government_is_theocracy
				}
			}
			portrait_$CULTURE_INPUT$_clothing_trigger = yes
		}
	}	
}

portrait_royalty_trigger = {
	trigger_if = {
		limit = { exists = this } # To check if this is an actual character
		OR = {
			# Rulers
			AND = {
				is_governor = no
				highest_held_title_tier = tier_kingdom
				NOR = {
					AND = {
						government_has_flag = government_is_republic
						primary_title.tier > tier_barony
					}
					AND = {
						is_ruler = yes
						government_has_flag = government_is_theocracy
					}
				}
				portrait_$CULTURE_INPUT$_clothing_trigger = yes
			}
			# Spouses
			AND = {
				exists = primary_spouse
				OR = {
					is_ruler = no
					highest_held_title_tier = tier_barony
				}
				primary_spouse = {
					is_governor = no
					highest_held_title_tier = tier_kingdom
					NOR = {
						AND = {
							government_has_flag = government_is_republic
							primary_title.tier > tier_barony
						}
						AND = {
							is_ruler = yes
							government_has_flag = government_is_theocracy
						}
					}
					portrait_$CULTURE_INPUT$_clothing_spouse_trigger = yes
				}
			}
			# Co-Rulers
			AND = {
				exists = liege
				is_diarch = yes
				liege = {
					has_diarchy_active_parameter = diarchy_is_co_rulership
					highest_held_title_tier >= tier_kingdom
					NOR = {
						AND = {
							government_has_flag = government_is_republic
							primary_title.tier > tier_barony
						}
						AND = {
							is_ruler = yes
							government_has_flag = government_is_theocracy
						}
					}
					portrait_$CULTURE_INPUT$_clothing_trigger = yes
				}
			}
		}
	}
	trigger_else = {
		scope:highest_held_title_tier = tier_kingdom # We use scope in case this is not an actual character (for the Hybrid Culture preview window)
		portrait_$CULTURE_INPUT$_clothing_trigger = yes
	}
}

portrait_royalty_clothing_trigger = {
	portrait_royalty_trigger = {
		CULTURE_INPUT = $CULTURE_INPUT$
	}
	portrait_wear_no_armor_trigger = yes
}

portrait_royalty_african_headgear_trigger = {
	trigger_if = {
		limit = { exists = this }
		portrait_can_use_noble_headgear_trigger = yes
		OR = {
			AND = {
				OR = {
					highest_held_title_tier = tier_kingdom
					AND = { is_ruler = yes government_has_flag = government_is_theocracy }
				}
				NAND = { # Blocked for mercenaries and adventurers
					is_ruler = yes
					OR = {
						government_has_flag = government_is_mercenary
						AND = {
							government_has_flag = government_is_landless_adventurer
							NOR = {
								has_realm_law = camp_purpose_legitimists
								liege ?= {  has_realm_law = camp_purpose_legitimists }
							}
						}
					}
				}
				NOT = { government_has_flag = government_is_republic }
				OR = {
					portrait_african_clothing_trigger = yes
					AND = {
						culture = {
							has_cultural_pillar = heritage_east_african
						}
						NOT = {
							religion = religion:islam_religion
						}
					}
				}
			}
			AND = {
				exists = primary_spouse
				OR = {
					is_ruler = no
					highest_held_title_tier = tier_barony
				}
				primary_spouse = {
					OR = {
						highest_held_title_tier = tier_kingdom
						AND = { is_ruler = yes government_has_flag = government_is_theocracy }
					}
					NAND = { # Blocked for mercenaries
						is_ruler = yes
						government_has_flag = government_is_mercenary
					}
					NAND = { # Blocked for adventurers
						is_ruler = yes
						AND = {
							government_has_flag = government_is_landless_adventurer
							has_realm_law = camp_purpose_legitimists
						}
					}
					NOT = { government_has_flag = government_is_republic }
					OR = {
						portrait_african_clothing_spouse_trigger = yes
						AND = {
							culture = {
								has_cultural_pillar = heritage_east_african
							}
							NOT = {
								religion = religion:islam_religion
							}
						}
					}
				}
			}
		}
	}
	trigger_else = {
		scope:highest_held_title_tier = tier_kingdom
		portrait_african_clothing_trigger = yes
	}
}

portrait_imperial_trigger = {
	trigger_if = {
		limit = { exists = this } # To check if this is an actual character
		OR = {
			# Rulers
			AND = {
				highest_held_title_tier = tier_empire
				NOR = {
					AND = {
						government_has_flag = government_is_republic
						primary_title.tier > tier_barony
					}
					AND = {
						is_ruler = yes
						government_has_flag = government_is_theocracy
					}
				}
				portrait_$CULTURE_INPUT$_clothing_trigger = yes
			}
			# Spouses
			AND = {
				exists = primary_spouse
				OR = {
					is_ruler = no
					highest_held_title_tier <= primary_spouse.highest_held_title_tier
				}
				primary_spouse = {
					highest_held_title_tier = tier_empire
					NOR = {
						AND = {
							government_has_flag = government_is_republic
							primary_title.tier > tier_barony
						}
						AND = {
							is_ruler = yes
							government_has_flag = government_is_theocracy
						}
					}
					portrait_$CULTURE_INPUT$_clothing_spouse_trigger = yes
				}
			}
		}
	}
	trigger_else = {
		scope:highest_held_title_tier = tier_empire
		portrait_$CULTURE_INPUT$_clothing_trigger = yes
	}
}

portrait_imperial_clothing_trigger = {
	portrait_imperial_trigger = {
		CULTURE_INPUT = $CULTURE_INPUT$
	}
	portrait_wear_no_armor_trigger = yes
}

portrait_imperial_nobles_headgear_trigger = {
	trigger_if = {
		limit = { exists = this }
		portrait_can_use_noble_headgear_trigger = yes
		NOR = {
			AND = {
				is_ruler = yes
				government_has_flag = government_is_mercenary
			}
			AND = {
				is_ruler = yes
				government_has_flag = government_is_landless_adventurer
			}
			government_has_flag = government_is_republic
			AND = {
				is_ruler = yes
				government_has_flag = government_is_theocracy
			}
		}
	}
	scope:highest_held_title_tier = tier_empire
	portrait_$CULTURE_INPUT$_clothing_trigger = yes
}

portrait_commoner_armor_trigger = {
	portrait_commoner_trigger = {
		CULTURE_INPUT = $CULTURE_INPUT$
	}
	OR = {
		has_character_flag = need_military_outfit
		portrait_wear_armor_trigger = yes
	}
	NOT = { portrait_accoladed_knight_trigger = yes }
}

portrait_commoner_armor_in_army_trigger = {
	portrait_commoner_trigger = {
		CULTURE_INPUT = $CULTURE_INPUT$
	}
	portrait_wear_armor_currently_in_army_trigger = yes
	NOT = { portrait_accoladed_knight_trigger = yes }
}

portrait_low_nobles_armor_trigger = {
	OR = {
		portrait_low_nobles_trigger = {
			CULTURE_INPUT = $CULTURE_INPUT$
		}
		court_fashion_level_4_trigger = {
			CULTURE_INPUT = $CULTURE_INPUT$
		}
	}
	OR = {
		has_character_flag = need_military_outfit
		portrait_wear_armor_trigger = yes
	}
	NOT = { portrait_accoladed_knight_trigger = yes }
}

portrait_low_nobles_armor_in_army_trigger = {
	OR = {
		portrait_low_nobles_trigger = {
			CULTURE_INPUT = $CULTURE_INPUT$
		}
		court_fashion_level_4_trigger = {
			CULTURE_INPUT = $CULTURE_INPUT$
		}
	}
	portrait_wear_armor_currently_in_army_trigger = yes
	NOT = { portrait_accoladed_knight_trigger = yes }
}

portrait_high_nobles_armor_trigger = {
	OR = {
		portrait_high_nobles_trigger = {
			CULTURE_INPUT = $CULTURE_INPUT$
		}
		AND = {
			portrait_accoladed_knight_trigger = yes
			portrait_$CULTURE_INPUT$_clothing_trigger = yes
		}
		court_fashion_level_5_trigger = {
			CULTURE_INPUT = $CULTURE_INPUT$
		}
	}
	OR = {
		has_character_flag = need_military_outfit
		portrait_wear_armor_trigger = yes
	}
}

portrait_high_nobles_armor_in_army_trigger = {
	OR = {
		portrait_high_nobles_trigger = {
			CULTURE_INPUT = $CULTURE_INPUT$
		}
		court_fashion_level_5_trigger = {
			CULTURE_INPUT = $CULTURE_INPUT$
		}
	}
	portrait_wear_armor_currently_in_army_trigger = yes
}

portrait_royalty_armor_trigger = {
	portrait_royalty_trigger = {
		CULTURE_INPUT = $CULTURE_INPUT$
	}
	OR = {
		has_character_flag = need_military_outfit
		portrait_wear_armor_trigger = yes
	}
}

portrait_royalty_armor_in_army_trigger = {
	portrait_royalty_trigger = {
		CULTURE_INPUT = $CULTURE_INPUT$
	}
	portrait_wear_armor_currently_in_army_trigger = yes
}

portrait_war_nobles_accoladed_trigger = {
	OR = {
		portrait_wear_armor_trigger = yes
		portrait_wear_armor_currently_in_army_trigger = yes
	}
	portrait_accoladed_knight_trigger = yes
}

portrait_war_nobles_helmet_trigger = {
	exists = this
	OR = {
		has_character_flag = need_military_outfit
		portrait_wear_helmet_trigger = yes
	}
	portrait_$CULTURE_INPUT$_clothing_trigger = yes
	NOR = {
		AND = {
			religion = religion:christianity_religion
			government_has_flag = government_is_holy_order
		}
		AND = {
			religion = religion:christianity_religion
			is_playable_character = no
			portrait_wear_armor_trigger = yes
			exists = liege
			liege = {
				government_has_flag = government_is_holy_order
			}
		}
		AND = {
			religion = religion:christianity_religion
			portrait_wear_armor_trigger = yes
			OR = {
				any_character_war = {
					OR = {
						using_cb = undirected_great_holy_war
						using_cb = directed_great_holy_war
					}
					is_attacker = prev
				}
				any_liege_or_above = {
					faith = prev.faith
					any_character_war = {
						OR = {
							using_cb = undirected_great_holy_war
							using_cb = directed_great_holy_war
						}
						is_attacker = prev
					}
				}
			}
		}
	}
}

portrait_war_nobles_fancy_helmet_trigger = {
	portrait_can_use_noble_headgear_trigger = yes
	OR = { # This helmet is really fancy & gilded - it's nothing for commoners. We allow Dukes+ to use it sometimes, just because it suits them!
		AND = {
			has_council_position = councillor_marshal
			OR = {
				is_playable_character = no
				primary_title.tier >= tier_duchy
			}
		}
		AND = {
			is_commanding_army = yes
			AND = {
				exists = primary_title
				primary_title.tier >= tier_duchy
			}
		}
	}
}

portrait_western_crusades_trigger = {
	exists = this
	OR = {
		AND = {
			religion = religion:christianity_religion
			government_has_flag = government_is_holy_order
		}
		AND = {
			religion = religion:christianity_religion
			is_playable_character = no
			portrait_wear_armor_trigger = yes
			exists = liege
			liege = {
				government_has_flag = government_is_holy_order
			}
		}
		AND = {
			religion = religion:christianity_religion
			portrait_wear_armor_trigger = yes
			OR = {
				any_character_war = {
					OR = {
						using_cb = undirected_great_holy_war
						using_cb = directed_great_holy_war
					}
					is_attacker = prev
				}
				any_liege_or_above = {
					faith = prev.faith
					any_character_war = {
						OR = {
							using_cb = undirected_great_holy_war
							using_cb = directed_great_holy_war
						}
						is_attacker = prev
					}
				}
			}
		}
	}
}


portrait_armored_priest_trigger = {
	portrait_wear_armor_currently_in_army_trigger = yes
	religion = religion:$RELIGION$
	OR = {
		portrait_religious_devoted_trigger = yes
		portrait_religious_high_trigger = yes
		is_clergy = yes
	}
}


portrait_beggar_trigger = {
	exists = this
	portrait_has_trait_trigger = { TRAIT = peasant_leader }
	OR = {
		is_ruler = no
		is_leading_faction_type = peasant_faction
		AND = {
			is_ruler = yes
			is_playable_character = no
			OR = {
				government_has_flag = government_is_feudal
				government_has_flag = government_is_clan
			}
		}
	}
}


portrait_prisoner_trigger = {
	exists = this
	is_imprisoned = yes
	is_in_prison_type = dungeon
}


portrait_sickness_trigger = {
	exists = this
	OR = {
		has_short_disease_trigger = yes #affliction that would plausibly leave them bedridden for treatment
		has_character_flag = use_sickness_clothes
	}
	NOT = { has_dead_character_flag = ignore_sickness_clothes }
	portrait_ep2_wedding_clothes_trigger = no
}


portrait_stealth_trigger = {
	exists = this
	has_character_flag = use_stealth_clothes
}


portrait_mayor_trigger = {
	scope:highest_held_title_tier < tier_county
	scope:government = government_type:republic_government
	portrait_$CULTURE_INPUT$_clothing_trigger = yes
}

portrait_mayor_headgear_trigger = {
	exists = this
	highest_held_title_tier < tier_county
	government_has_flag = government_is_republic
	portrait_$CULTURE_INPUT$_clothing_trigger = yes
}

portrait_jester_trigger = {
	OR = {
		has_court_position = court_jester_court_position
		has_character_flag = jester_outfit
	}
	portrait_$CULTURE_INPUT$_clothing_trigger = yes
}


portrait_religious_devoted_trigger = {
	exists = this
	OR = {
		portrait_has_trait_trigger = { TRAIT = devoted }
		AND = {
			faith = {
				has_doctrine_parameter = vows_of_poverty_active
			}
			OR = {
				AND = {
					has_council_position = councillor_court_chaplain
					faith = {
						has_doctrine = doctrine_theocracy_lay_clergy
					}
				}
				is_theocratic_lessee = yes
				AND = { is_ruler = yes government_has_flag = government_is_theocracy }
			}
		}
	}
}

portrait_religious_high_trigger = {
	exists = this
	OR = {
		has_character_flag = need_priest_outfit
		is_theocratic_lessee = yes
		AND = {
			is_ruler = yes
			government_has_flag = government_is_theocracy
		}
		has_council_position = councillor_court_chaplain
	}
	NOT = {
		faith = {
			has_doctrine_parameter = vows_of_poverty_active
		}
	}
}

portrait_religious_high_no_poverty_trigger = {
	exists = this
	OR = {
		has_character_flag = need_priest_outfit
		is_theocratic_lessee = yes
		AND = { is_ruler = yes government_has_flag = government_is_theocracy }
		has_council_position = councillor_court_chaplain
	}
}

portrait_religious_high_headgear_trigger = {
	exists = this
	OR = {
		has_character_flag = need_priest_outfit
		is_theocratic_lessee = yes
		AND = { is_ruler = yes government_has_flag = government_is_theocracy }
	}
	NAND = {
		is_ruler = yes
		primary_title = {
			any_controlled_faith = {
				this = faith:$FAITH_INPUT$
			}
		}
	}
	NOT = {
		faith = {
			has_doctrine_parameter = vows_of_poverty_active
		}
	}
}

portrait_religious_head_trigger = {
	exists = this
	exists = primary_title
	primary_title = {
		is_head_of_faith = yes
	}
	NOT = {
		faith = {
			has_doctrine_parameter = vows_of_poverty_active
		}
	}
}

portrait_religious_head_no_poverty_trigger = {
	exists = this
	exists = primary_title
	primary_title = {
		is_head_of_faith = yes
	}
}

portrait_religious_head_popes_trigger = {
	exists = this
	OR = {
		AND = {
			faith = faith:catholic
			is_adult = yes
			religion = religion:christianity_religion
			exists = primary_title
			primary_title = {
				is_head_of_faith = yes
			}
		}
		AND = {
			exists = this
			any_equipped_character_artifact = {
				has_variable = pope_hat
			}
		}
	}
}

portrait_religious_head_ruler_trigger = {
	exists = this
	exists = primary_title
	primary_title = {
		is_head_of_faith = yes
	}
	is_ruler = yes
	NOT = {
		faith = {
			has_doctrine_parameter = vows_of_poverty_active
		}
	}
}

portrait_religious_head_caliph_trigger = {
	exists = this
	is_ruler = yes
	religion = religion:$RELIGION_INPUT$_religion
	any_held_title = {
		any_controlled_faith = {
			religion = religion:$RELIGION_INPUT$_religion
		}
	}
	NOT = { portrait_wear_armor_trigger = yes }
}

portrait_religious_faith_or_foundational_trigger = {
	OR = {
		this = $FAITH$
		var:foundational_faith ?= $FAITH$
	}
}

portrait_religious_christian_trigger = {
	religion = religion:christianity_religion
}

portrait_religious_catholic_trigger = {
	faith = {
		portrait_religious_faith_or_foundational_trigger = { FAITH = faith:catholic }
	}
}

portrait_religious_orthodox_trigger = {
	faith = {
		OR = {
			portrait_religious_faith_or_foundational_trigger = { FAITH = faith:orthodox }
			portrait_religious_faith_or_foundational_trigger = { FAITH = faith:armenian_apostolic }
			portrait_religious_faith_or_foundational_trigger = { FAITH = faith:coptic }
			portrait_religious_faith_or_foundational_trigger = { FAITH = faith:messalian }
			portrait_religious_faith_or_foundational_trigger = { FAITH = faith:bogomilist }
			portrait_religious_faith_or_foundational_trigger = { FAITH = faith:paulician }
			portrait_religious_faith_or_foundational_trigger = { FAITH = faith:nestorian }
		}
	}
}

portrait_religious_jewish_trigger = {
	religion = religion:judaism_religion
}

portrait_religious_hellenism_trigger = {
	religion = religion:hellenism_religion
}

portrait_religious_muslim_trigger = {
	religion = religion:islam_religion
}

portrait_religious_norse_trigger = {
	OR = {
		religion = religion:germanic_religion
		religion = religion:baltic_religion
		religion = religion:finno_ugric_religion
		religion = religion:paganism_religion
		religion = religion:slavic_religion
	}
}

portrait_religious_steppe_trigger = {
	OR = {
		religion = religion:tengrism_religion
		religion = religion:qiangic_religion
		religion = religion:siberian_religion
		religion = religion:mundhum_religion
		religion = religion:tani_religion
		religion = religion:magyar_religion
		faith = {
			portrait_religious_faith_or_foundational_trigger = { FAITH = faith:old_bon }
		}
	}
}

portrait_religious_buddhist_trigger = {
	OR = {
		religion = religion:buddhism_religion
		faith = {
			portrait_religious_faith_or_foundational_trigger = { FAITH = faith:bon }
		}
		religion = religion:taoism_religion
	}
}

portrait_religious_hindu_trigger = {
	religion = religion:hinduism_religion
}

portrait_religious_jain_trigger = {
	religion = religion:jainism_religion
}

portrait_religious_zoroastrian_trigger = {
	OR = {
		religion = religion:zoroastrianism_religion
		religion = religion:yazidi_religion
		religion = religion:zunism_religion
		faith = {
			portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mandeaism }
		}
		religion = religion:dualism_religion
		religion = religion:basque_religion
	}
}

portrait_religious_african_trigger = {
	OR = {
		religion = religion:akom_religion
		religion = religion:waaqism_religion
		religion = religion:west_african_religion
		religion = religion:west_african_bori_religion
		religion = religion:west_african_roog_religion
		religion = religion:kushitism_religion
		religion = religion:west_african_orisha_religion
	}
}


### DDE HRE ###

portrait_reichskrone_trigger = { #change from OR to AND, was causing EVERYONE to have this crown if not
	exists = this
	AND = {
		has_primary_title = title:e_hre
		any_equipped_character_artifact = {
			has_variable = reichskrone
		}
	}
}


### EP2 ###

portrait_ep2_disguised_woman_trigger = {
	AND = { # Hide hair of Mulan
		has_character_modifier = ignores_gender_army_rules
		exists = involved_activity
		involved_activity = { has_activity_type = activity_tournament }
	}
}

portrait_ep2_western_travel_cloak_trigger = {
	trigger_if = {
		limit = {
			NOR = {
				has_realm_law = camp_purpose_explorers
				liege ?= { has_realm_law = camp_purpose_explorers }
			}
		}
		exists = current_travel_plan
		# Must be traveling
		is_travelling = yes
	}
	age > 4
	# thou shalt shed thy cloak whilst at an activity
	trigger_if = {
		limit = {
			exists = involved_activity
			involved_activity = { 
				NOR = {
					has_activity_type = activity_hunt 
					has_activity_type = activity_roaming
				}
			}
		}
		NOT = {
			involved_activity = { activity_location = root.location }
		}
	}
	# Used for the following cultures
	OR = {
		portrait_byzantine_clothing_trigger = yes
		portrait_western_clothing_trigger = yes
		portrait_northern_clothing_trigger = yes
	}
}

portrait_ep2_mena_travel_cloak_trigger = {
	trigger_if = {
		limit = {
			NOR = {
				has_realm_law = camp_purpose_explorers
				liege ?= { has_realm_law = camp_purpose_explorers }
			}
		}
		exists = current_travel_plan
		# Must be traveling
		is_travelling = yes
	}
	age > 4
	# thou shalt shed thy cloak whilst at an activity
	trigger_if = {
		limit = {
			exists = involved_activity
			involved_activity = { 
				NOR = {
					has_activity_type = activity_hunt 
					has_activity_type = activity_roaming
				}
			}
		}
		NOT = {
			involved_activity = { activity_location = root.location }
		}
	}
	# Used for the following cultures
	OR = {
		portrait_mena_clothing_trigger = yes
		portrait_african_clothing_trigger = yes
		portrait_indian_clothing_trigger = yes
		portrait_steppe_clothing_trigger = yes
	}
	# Exclude pilgrimages
	trigger_if = {
		limit = { exists = current_travel_plan.travel_plan_activity }
		NOT = {
			current_travel_plan = {
				travel_plan_activity = {
					has_activity_type = activity_pilgrimage
				}
			}
		}
	}
}

portrait_ep2_hajj_clothes_trigger = {
	age > 4
	# Must be traveling on a pilgrimage
	exists = current_travel_plan.travel_plan_activity
	current_travel_plan = {
		travel_plan_activity = {
			has_activity_type = activity_pilgrimage
		}
	}
	religion = religion:islam_religion
	# Used for the following cultures
	OR = {
		portrait_mena_clothing_trigger = yes
		portrait_african_clothing_trigger = yes
		portrait_indian_clothing_trigger = yes
		portrait_steppe_clothing_trigger = yes
	}
}

portrait_ep2_ihram_clothes_trigger = {
	portrait_ep2_hajj_clothes_trigger = yes
	is_male = yes
	has_character_modifier = hajj_halq_modifier
	primary_title.tier >= tier_duchy
}

portrait_ep2_western_cloak_duel_trigger = {
	has_character_flag = cloak_duelist_flag
	# Used for the following cultures
	OR = {
		portrait_byzantine_clothing_trigger = yes
		portrait_western_clothing_trigger = yes
		portrait_northern_clothing_trigger = yes
	}
}

portrait_ep2_mena_cloak_duel_trigger = {
	has_character_flag = cloak_duelist_flag
	# Used for the following cultures
	OR = {
		portrait_mena_clothing_trigger = yes
		portrait_african_clothing_trigger = yes
		portrait_indian_clothing_trigger = yes
		portrait_steppe_clothing_trigger = yes
	}
}

portrait_ep2_wedding_clothes_trigger = {
	involved_activity ?= {
		has_activity_type = activity_wedding
	}
	OR = {
		this = involved_activity.special_guest:spouse_1
		this = involved_activity.special_guest:spouse_2
	}
}

### General headgear triggers ###


