﻿legwear = {
	# interface_position = 1
	usage = game
	selection_behavior = max
	
	no_legwear = {
		usage = game 
		dna_modifiers = {
			accessory = {
				mode = add
		
				gene = legwear
				template = no_legwear
				value = 0
			}
		}
        outfit_tags = { no_clothes }
		weight = {
			base = 0
			modifier = {
				add = 1000
				AND = {
					# Deliberately not the "fully naked" one since you'll wear a nightgown if we don't allow full nudity
					should_be_naked_trigger = yes
				}
			}
		}
	}

## No Leg wear for children under 4 ## 

	children_no_headgear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = no_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 100
				scope:age < 4
			}
		}
	}

	default_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = western_common_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 1
		}

	}

	western_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = western_common_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 20
				portrait_western_clothing_trigger = yes
			}
		}
	}

	western_war_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = western_war_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 60
				portrait_wear_armor_trigger = yes
				OR = {
					portrait_western_clothing_trigger = yes
					portrait_byzantine_clothing_trigger = yes
				}
			}
            modifier = {
                factor = 0   
                portrait_western_clothing_trigger = yes   
                has_ep2_dlc_trigger = yes   
            }   
		}
	}

	ep2_western_era1_war_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = pol_common_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 60
				portrait_wear_armor_trigger = yes
				portrait_western_clothing_trigger = yes
                has_ep2_dlc_trigger = yes   
                portrait_era1_armor_trigger = yes  
			}
		}
	}

	ep2_western_era2_war_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = pol_common_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 60
				portrait_wear_armor_trigger = yes
				portrait_western_clothing_trigger = yes
                has_ep2_dlc_trigger = yes   
                portrait_era2_armor_trigger = yes  
			}
		}
	}

	ep2_western_era3_war_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = western_war_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 61
				portrait_wear_armor_trigger = yes
				OR = {
					portrait_western_clothing_trigger = yes
					portrait_epe_english_clothing_trigger = yes				
					portrait_dde_hre_clothing_trigger = yes							
					portrait_epe_west_slav_clothing_trigger = yes	
					portrait_epe_norse_clothing_trigger = yes						
				}
                has_ep2_dlc_trigger = yes   
                portrait_era3_armor_trigger = yes  
			}
		}
	}

	ep2_western_era4_war_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = ep2_western_war_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 100
				portrait_wear_armor_trigger = yes
				OR = {
					portrait_western_clothing_trigger = yes
					portrait_epe_english_clothing_trigger = yes				
					portrait_dde_hre_clothing_trigger = yes							
					portrait_epe_west_slav_clothing_trigger = yes	
					portrait_epe_norse_clothing_trigger = yes						
				}
                has_ep2_dlc_trigger = yes   
                portrait_era4_armor_trigger = yes  
			}
		}
	}

	ep3_byzantine_low_nobility_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = ep3_byzantine_nobility_legwear
				range = { 0 0.49 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 80
                portrait_low_nobles_clothing_trigger = { 
                    CULTURE_INPUT = byzantine
                } 
				NOT = {
					portrait_low_nobles_clothing_trigger = { 
                    CULTURE_INPUT = epe_bulgarian
                    }
				}				
                has_ep3_dlc_trigger = yes 
			}
		}
	}

	ep3_byzantine_high_nobility_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = ep3_byzantine_nobility_legwear
				range = { 0.49 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 80
                portrait_high_nobles_headgear_trigger = { 
                    CULTURE_INPUT = byzantine
                } 
                has_ep3_dlc_trigger = yes 
			}
		}
	}

	ep3_byzantine_imperial_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = ep3_byzantine_imperial_legwear
				range = { 0.49 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 80
				OR = {
	                portrait_royalty_trigger = { 
	                    CULTURE_INPUT = byzantine
	                } 
	                portrait_imperial_trigger = { 
	                    CULTURE_INPUT = byzantine
	                } 
				}
                has_ep3_dlc_trigger = yes 
			}
		}
	}

	ep3_bulgarian_low_nobility_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = pol_common_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 80
				OR = {
	                portrait_commoner_clothing_trigger = { 
	                    CULTURE_INPUT = epe_bulgarian
	                } 
	                portrait_low_nobles_clothing_trigger = { 
	                    CULTURE_INPUT = epe_bulgarian
	                } 		
				}				
                has_ep3_dlc_trigger = yes 
			}
			modifier = {
				factor = 0
				OR = {
	                portrait_high_nobles_clothing_trigger = { 
	                    CULTURE_INPUT = epe_bulgarian
	                }				
                    portrait_royalty_clothing_trigger = {
                        CULTURE_INPUT = epe_bulgarian
                    }
					portrait_imperial_clothing_trigger = {
						CULTURE_INPUT = epe_bulgarian
					}
                }
			}			
		}
	}


	mena_common_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = mena_common_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 20
				OR = {
					portrait_mena_clothing_trigger = yes
					portrait_indian_clothing_trigger = yes
					portrait_african_clothing_trigger = yes
                    portrait_fp2_iberian_muslim_clothing_trigger = yes	
				}
				NOT = {
					portrait_fp3_iranian_clothing_trigger = yes
				}
				NOT = {
					portrait_afr_berber_clothing_trigger = yes
				} 				
			}
		}
	}

	mena_nobility_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = mena_nobility_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 50
				trigger_if = {
					limit = { exists = this }
					OR = {
						AND = {
							OR = {
								highest_held_title_tier > tier_county
								AND = {
									government_has_flag = government_is_republic
									primary_title.tier > 1
								}
								AND = { is_ruler = yes government_has_flag = government_is_theocracy }
							}
							NOT = { AND = { is_ruler = yes government_has_flag = government_is_mercenary  } } # Blocked for mercenaries
							OR = {
								portrait_mena_clothing_trigger = yes
								portrait_indian_clothing_trigger = yes
								portrait_african_clothing_trigger = yes	   								
							}
							NOT = {
					          portrait_fp3_iranian_clothing_trigger = yes
				            }
							NOT = {
					          portrait_afr_berber_clothing_trigger = yes
				            }							
							NOT = {
					          portrait_fp2_iberian_muslim_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
									AND = {
										government_has_flag = government_is_republic
										primary_title.tier > 1
									}
									AND = { is_ruler = yes government_has_flag = government_is_theocracy }
								}
								OR = {
									portrait_mena_clothing_spouse_trigger = yes
									portrait_indian_clothing_spouse_trigger = yes
									portrait_african_clothing_spouse_trigger = yes  									
								}
								NOT = {
					              portrait_fp3_iranian_clothing_spouse_trigger = yes
				               }
								NOT = {
					              portrait_fp2_iberian_muslim_clothing_spouse_trigger = yes
				               }
								NOT = {
					              portrait_afr_berber_clothing_spouse_trigger = yes
				               }							   
							}
						}
					}
				}
				trigger_else = {
					scope:highest_held_title_tier > tier_county
					OR = {
						portrait_mena_clothing_trigger = yes
						portrait_indian_clothing_trigger = yes
						portrait_african_clothing_trigger = yes
						portrait_steppe_clothing_trigger = yes
					}
				    NOT = {
					   portrait_fp3_iranian_clothing_trigger = yes
				   }					
				}
			}
		}
	}

	mena_war_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = mena_war_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		outfit_tags = { mena_war_legwear }
		weight = {
			base = 0
			modifier = {
				add = 101
				portrait_wear_armor_trigger = yes
				OR = {
					portrait_mena_clothing_trigger = yes
					portrait_indian_clothing_trigger = yes
					portrait_african_clothing_trigger = yes
					portrait_steppe_clothing_trigger = yes
                    portrait_fp2_iberian_muslim_clothing_trigger = yes						
				}
			}
		}
	}
	
	## AFR ##
	
	afr_berber_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = afr_common_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 21
				portrait_afr_berber_clothing_trigger = yes
				NOT = { portrait_wear_armor_trigger = yes }
			}
		}
	}

	## POL ##
	
	pol_west_slavic_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = pol_common_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 101
				portrait_west_slavic_clothing_trigger = yes
				OR = {
					portrait_era2_trigger = yes	
					portrait_era3_trigger = yes				
					portrait_era4_trigger = yes					
                }
			}
			modifier = {
				add = 101
				portrait_west_slavic_clothing_trigger = yes
				OR = {
					portrait_era2_trigger = yes	
					portrait_era3_trigger = yes				
					portrait_era4_trigger = yes					
                }
				is_female = yes
			}
			modifier = {
				factor = 0
				has_ep2_dlc_trigger = yes
				OR = {
					portrait_era3_armor_trigger = yes
					portrait_era4_armor_trigger = yes
				}
				OR = {
                    portrait_commoner_armor_in_army_trigger = {
                        CULTURE_INPUT = west_slavic
                    }
                    portrait_low_nobles_armor_in_army_trigger = {
                        CULTURE_INPUT = west_slavic
                    }
					portrait_high_nobles_armor_in_army_trigger = {
						CULTURE_INPUT = west_slavic
					}
                }
			}
		}
	}

	## CCP4 SAMI ##
	
	ccp4_sami_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = ccp4_sami_common_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 101
				portrait_sami_clothing_trigger = yes
			}
		}
	}

	## CCP4 KHANTY / UGRO-PERMIAN ##
	
	ccp4_ugro_permian_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = ccp4_khanty_common_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 101
				portrait_ugro_permian_clothing_trigger = yes
			}
		}
	}
	
	## CCP7 AINU EMISHI ##
	
	ccp7_emishi_nob_legwear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = ccp7_emishi_nob_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 120
				OR = {
					portrait_high_nobles_clothing_trigger = {
						CULTURE_INPUT = emishi 
					}
					portrait_royalty_clothing_trigger = {
						CULTURE_INPUT = emishi 
					}
					portrait_high_nobles_clothing_trigger = {
						CULTURE_INPUT = nivkh 
					}
					portrait_royalty_clothing_trigger = {
						CULTURE_INPUT = nivkh 
					}	
				}	
			}
		}		
	}

	ccp7_emishi_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = ccp7_emishi_com_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 101
				portrait_emishi_clothing_trigger = yes
			}
		}
	}

	## CCP7 NIVKH ##
	
	ccp7_nivkh_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = ccp7_nivkh_com_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 105
				portrait_nivkh_clothing_trigger = yes
			}
		}
	}

	

	fighting_trousers = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = clothes
				template = no_clothes
				range = { 0 1 } # For the randomness to work correctly
			}
			accessory = {
				mode = add
				gene = legwear
				template = fp1_common_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 1000
				should_be_topless_portrait_trigger = yes
			}
		}
	}

	fp1_common_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = fp1_common_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 20
				OR = {
					portrait_northern_clothing_trigger = yes
					portrait_fp1_norse_clothing_trigger = yes
					portrait_epe_east_slav_clothing_trigger = yes	
					portrait_epe_balto_finnic_clothing_trigger = yes		
					portrait_epe_gaelic_clothing_trigger = yes					
				}
			}
		}
	}


	ep1_jester_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = ep1_jester_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = -100
			modifier = {
				add = 1000
				is_male = yes
				has_court_position = court_jester_court_position
			}
			modifier = {
				factor = 0
				OR = {
					is_adult = no
					should_be_naked_trigger = yes
				}
			}			
		}
	}
	
	pol_west_slavic_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = pol_common_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 101
				portrait_west_slavic_clothing_trigger = yes
			}
			modifier = {
				factor = 0
				has_ep2_dlc_trigger = yes
				OR = {
					portrait_era3_armor_trigger = yes
					portrait_era4_armor_trigger = yes
				}
				OR = {
                    portrait_commoner_armor_in_army_trigger = {
                        CULTURE_INPUT = west_slavic
                    }
                    portrait_low_nobles_armor_in_army_trigger = {
                        CULTURE_INPUT = west_slavic
                    }
					portrait_high_nobles_armor_in_army_trigger = {
						CULTURE_INPUT = west_slavic
					}
                }
			}
		}
	}	
	
	## TGP - Asia ##
	
	tgp_chinese_commoner = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = tgp_chinese_commoner_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 101
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = chinese 
				}
				has_tgp_dlc_trigger = yes
			}
		}
	}
	
	tgp_japanese_commoner = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = tgp_japanese_commoner_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 101
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = japanese 
				}
				has_tgp_dlc_trigger = yes
			}
		}
	}

	tgp_japanese_nobility = { # We can use the same type of shoes for mostly all nobility

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = tgp_japanese_imperial_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 101
				OR = {
					portrait_low_nobles_clothing_trigger = {
						CULTURE_INPUT = japanese 
					}
					portrait_high_nobles_clothing_trigger = {
						CULTURE_INPUT = japanese 
					}				 				
				}
				has_tgp_dlc_trigger = yes
			}
		}
	}

	tgp_southeast_legwear = { # Right now barefoot

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = no_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 20
				portrait_southeast_asian_clothing_trigger = yes
			}
		}

	}
	
    ####################################################################################################
    ##################
    #################################EPE Expanded
    ##################
    ####################################################################################################		



	tgp_chinese_nobility = { # We can use the same type of shoes for mostly all nobility

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = tgp_chinese_high_nobility_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 80
				is_male = yes				
				OR = {
					portrait_low_nobles_clothing_trigger = {
						CULTURE_INPUT = chinese 
					}
					portrait_high_nobles_clothing_trigger = {
						CULTURE_INPUT = chinese 
					}				 				
				}
				has_tgp_dlc_trigger = yes
			}
		}
	}	

	guiyi_circuit_chinese_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = mena_war_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 80
				portrait_epe_guiyi_circuit_chinese_clothing_trigger = yes
			}
		}
	}	
	
	persian_common_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = mena_war_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 20
				OR = {
					portrait_fp3_iranian_clothing_trigger = yes	
					portrait_steppe_clothing_trigger = yes					
					portrait_epe_eastern_turk_clothing_trigger = yes	
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                        OR = {		
                        	portrait_era1_trigger = yes  
                            portrait_era2_trigger = yes  
                            portrait_era3_trigger = yes  							
                        }
					}	
					portrait_epe_uyghur_clothing_trigger = yes	
					portrait_epe_sino_iranian_clothing_trigger = yes						
				}
			}
		}
	}	
	
	
	####Western Spymaster
	western_spymaster_legwear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = spymaster_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 200
				age > 17
				OR = {
					AND = {
						has_council_position = councillor_spymaster
						highest_held_title_tier < tier_county
					}
				}
				NOT = {
					portrait_wear_armor_trigger = yes
					OR = {
						has_government = theocracy_government
						has_court_position = court_physician_court_position
					}
				}				
				OR = {
					portrait_byzantine_clothing_trigger = yes
					portrait_western_clothing_trigger = yes
					portrait_epe_gaelic_clothing_trigger = yes
					portrait_epe_georgian_clothing_trigger = yes
					portrait_epe_bulgarian_clothing_trigger = yes
					portrait_epe_armenian_clothing_trigger = yes
					portrait_epe_south_slav_clothing_trigger = yes
				}
			}
		}
	}
	
	####MENA Spymaster
	mena_spymaster_legwear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = mena_war_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 200
				age > 17
				OR = {
					AND = {
						has_council_position = councillor_spymaster
						highest_held_title_tier < tier_county
					}
				}
				NOT = {
					portrait_wear_armor_trigger = yes
					OR = {
						has_government = theocracy_government
						has_court_position = court_physician_court_position
					}
				}				
				OR = {
					portrait_mena_clothing_trigger = yes
					portrait_afr_berber_clothing_trigger = yes
					portrait_dde_abbasid_clothing_trigger = yes	
					portrait_epe_bedouin_clothing_trigger = yes						
				}
				NOT = {
					portrait_epe_seljuk_clothing_trigger = yes
				}
				NOT = {
					portrait_fp3_iranian_clothing_trigger = yes
				}
			}
		}
	}		
	
	
	####Northern Spymaster
	northern_spymaster_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = fp1_common_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 200
				age > 17
				OR = {
					AND = {
						has_council_position = councillor_spymaster
						highest_held_title_tier < tier_county
					}
				}
				NOT = {
					portrait_wear_armor_trigger = yes
					OR = {
						has_government = theocracy_government
						has_court_position = court_physician_court_position
					}
				}				
				OR = {
					portrait_northern_clothing_trigger = yes
					portrait_fp1_norse_clothing_trigger = yes
					portrait_epe_east_slav_clothing_trigger = yes	
					portrait_epe_balto_finnic_clothing_trigger = yes		
					portrait_epe_gaelic_clothing_trigger = yes	
				}
			}
		}
	}	
	
	####Persian Spymaster
	persian_spymaster_legwear = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = mena_war_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 200
				age > 17
				OR = {
					AND = {
						has_council_position = councillor_spymaster
						highest_held_title_tier < tier_county
					}
				}
				NOT = {
					portrait_wear_armor_trigger = yes
					OR = {
						has_government = theocracy_government
						has_court_position = court_physician_court_position
					}
				}				
				OR = {
					portrait_fp3_iranian_clothing_trigger = yes
					portrait_epe_seljuk_clothing_trigger = yes
					AND = {
					  portrait_epe_eastern_turk_clothing_trigger = yes
					  portrait_epe_eastern_turk_muslim_clothing_trigger = yes
					}
					
				}
			}
		}
	}	
	
	
	andalusian_common_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = fp2_andalusian_legwear
                accessory = m_legwear_sec_andalusian_nob_01_lo
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 21
				OR = {
                    portrait_fp2_iberian_muslim_clothing_trigger = yes	
                    portrait_epe_baranis_clothing_trigger = yes						
				}				
			}
		}
	}

	andalusian_nobility_legwear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = fp2_andalusian_legwear
                accessory = m_legwear_sec_andalusian_nob_01_hi
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 100
				trigger_if = {
					limit = { exists = this }
					OR = {
						AND = {
							OR = {
								highest_held_title_tier > tier_county
								AND = {
									government_has_flag = government_is_republic
									primary_title.tier > 1
								}
								AND = { is_ruler = yes government_has_flag = government_is_theocracy }
							}
							NOT = { AND = { is_ruler = yes government_has_flag = government_is_mercenary  } } # Blocked for mercenaries
							OR = {
                                portrait_fp2_iberian_muslim_clothing_trigger = yes	
							    AND = {
                                  portrait_epe_baranis_clothing_trigger = yes	
								  has_afr_dlc_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
									AND = {
										government_has_flag = government_is_republic
										primary_title.tier > 1
									}
									AND = { is_ruler = yes government_has_flag = government_is_theocracy }
								}
								OR = {
                                    portrait_fp2_iberian_muslim_clothing_spouse_trigger = yes	  	
							        AND = {									
                                      portrait_epe_baranis_clothing_spouse_trigger = yes
									  has_afr_dlc_trigger = yes
								   }									  
								}
							}
						}
					}
				}
				trigger_else = {
					scope:highest_held_title_tier > tier_county
					OR = {
						portrait_fp2_iberian_muslim_clothing_trigger = yes
						AND = {	
						  portrait_epe_baranis_clothing_trigger = yes	
						  has_afr_dlc_trigger = yes
						}  
					}					
				}
			}
		}
	}	
	
		 ####Ottoman Turks
		 
	ottoman_turks_legwear_commoner = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = mena_war_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = epe_seljuk 
				}
                OR = {				
                    portrait_era4_trigger = yes  
                }				
			}
		}
	}
	ottoman_turks_legwear_commoner_02 = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = mena_common_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 50
				portrait_commoner_clothing_trigger = {
					CULTURE_INPUT = epe_seljuk 
				}
                OR = {				
                    portrait_era4_trigger = yes  
                }				
			}
		}
	}	
	ottoman_turks_legwear_noble = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = legwear
				template = epe_ottoman_turks_legwear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 80
				OR = {
					portrait_low_nobles_clothing_trigger = {
						CULTURE_INPUT = epe_seljuk 
					}				
	                portrait_high_nobles_clothing_trigger = { 
	                    CULTURE_INPUT = epe_seljuk
	                }				
                    portrait_royalty_clothing_trigger = {
                        CULTURE_INPUT = epe_seljuk
                    }
					portrait_imperial_clothing_trigger = {
						CULTURE_INPUT = epe_seljuk
					}
                }
                OR = {				
                    portrait_era4_trigger = yes  
                }				
			}
		}
	}	
	
	gladiator_outfit_01_legwear = {
      dna_modifiers = {
          accessory = {
              mode = add
              gene = legwear
              template = gladiator_outfit_01_legwear
              range = { 0 1 } # For the randomness to work correctly
          }
      }
      weight = {
          base = 0
          modifier = {
              add = 600
              OR = {
                  has_trait = gladiator_trait
                  has_trait = former_gladiator_trait
              }
          }
      }
  }
	
	
}
