﻿# Make sure the weights here match up best as possible with the custom_beards set
beards = {

	usage = game

    selection_behavior = weighted_random

	no_beard_for_children = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = no_beard
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 100
                scope:age < 18
            }
        }
    }

	has_no_beard = { # This is to give a random chance of a clean shaven look
		dna_modifiers = {
			accessory = {
				mode = add
				gene = beards
				template = no_beard
				range = { 0 1 } # For the randomness to work correctly
			}
		}   
		weight = {
			base = 30 
			modifier = {
				add = -50
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
			modifier = {
				add = 666
				exists = this
				exists = character:easteregg_daan_broekhof
				this = character:easteregg_daan_broekhof
			}
			modifier = {
				add = 1000
				exists = this
				OR = { # Japanese monks shave their beards
					has_character_flag = no_beard
					AND = {
						has_trait = devoted
						religion = religion:buddhism_religion
						culture = { has_clothing_gfx = japanese_clothing_gfx }
					}
				}
			}
			modifier = {
				add = -20
				exists = this
				portrait_steppe_clothing_trigger = yes
			}
			portrait_clean_shaven_clothing_modifier = yes
		}
	}

    western_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = western_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                portrait_western_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
				OR = {
					scope:faith.religion = religion:islam_religion
					is_culture_or_descended_from_trigger = { CULTURE = culture:emishi }
				}
                portrait_western_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    western_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = western_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                     has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                portrait_western_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_western_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    mena_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = mena_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
				OR = {
					portrait_mena_clothing_trigger = yes
					portrait_african_clothing_trigger = yes
                    portrait_fp2_iberian_muslim_clothing_trigger = yes					
				}
				NOT = {
				 	portrait_fp3_iranian_clothing_trigger = yes
				}				
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_mena_clothing_trigger = yes
					portrait_african_clothing_trigger = yes
                    portrait_fp2_iberian_muslim_clothing_trigger = yes					
				}
				NOT = {
				 	portrait_fp3_iranian_clothing_trigger = yes
				}				
                NAND = { # The Prophet Muhammad does not have a portrait
                    exists = this
                    this = character:33922 # Prophet Muhammad
                }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                    this = character:33922 # Prophet Muhammad
                }
            }
        }
    }

    mena_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = mena_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                OR = {
					portrait_mena_clothing_trigger = yes
					portrait_african_clothing_trigger = yes
                    portrait_fp2_iberian_muslim_clothing_trigger = yes					
				}
				NOT = {
				 	portrait_fp3_iranian_clothing_trigger = yes
				}				
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_mena_clothing_trigger = yes
					portrait_african_clothing_trigger = yes
                    portrait_fp2_iberian_muslim_clothing_trigger = yes					
				}
				NOT = {
				 	portrait_fp3_iranian_clothing_trigger = yes
				}				
                NAND = { # The Prophet Muhammad does not have a portrait
                    exists = this
                    this = character:33922 # Prophet Muhammad
                }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                    this = character:33922 # Prophet Muhammad
                }
            }
        }
    }

    byzantine_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = byzantine_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 80
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                portrait_byzantine_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_byzantine_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    byzantine_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = byzantine_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 80
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                portrait_byzantine_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_byzantine_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    indian_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = indian_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                portrait_indian_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_indian_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    indian_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = indian_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                portrait_indian_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_indian_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

	thin_beards = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = beards
				template = thin_beards_straight
				range = { 0 1 } # For the randomness to work correctly
			}
		}   
		# outfit_tags = { no_clothes }
		weight = {
			base = 0
			modifier = {
				add = 70
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_straight_thin_beard
				}
			}
			modifier = { # Muslims should always have a beard
				add = 200
				OR = {
					scope:faith.religion = religion:islam_religion
					is_culture_or_descended_from_trigger = { CULTURE = culture:emishi }
				}
				trigger_if = {
					limit = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
			modifier = {
				add = -40
				portrait_chinese_clothing_trigger = yes
			}
			modifier = {
				add = -65
				OR = {
					portrait_malay_clothing_trigger = yes
					portrait_southeast_asian_clothing_trigger = yes
				}
			}
		}
	}

    steppe_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = steppe_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 50
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                portrait_steppe_clothing_trigger = yes
				NOT = {
				 	portrait_epe_eastern_turk_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_eastern_turk_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_western_turk_clothing_trigger = yes
				}				
				NOT = {
				 	portrait_epe_seljuk_clothing_trigger = yes
				}
				
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_steppe_clothing_trigger = yes
				NOT = {
				 	portrait_epe_eastern_turk_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_eastern_turk_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_western_turk_clothing_trigger = yes
				}				
				NOT = {
				 	portrait_epe_seljuk_clothing_trigger = yes
				}
				
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
			modifier = {
				factor = 0
				portrait_chinese_clothing_trigger = yes
				has_tgp_dlc_trigger = yes 
			}			
        }
    }
	
    mpo_mongol_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = mpo_mongol_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 51
                OR = {
                    NOT = { exists = this }
                    # has_gene = {
                    #     category = gene_hair_type
                    #     template = hair_straight
                    # }  
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight_thin_beard
                    }      
                    # has_gene = {
                    #     category = gene_hair_type
                    #     template = hair_wavy
                    # }            
                }
                portrait_steppe_clothing_trigger = yes
						
                has_mpo_dlc_trigger = yes 
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_steppe_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }	

    steppe_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = steppe_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 50
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                portrait_steppe_clothing_trigger = yes
				NOT = {
				 	portrait_epe_eastern_turk_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_eastern_turk_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_seljuk_clothing_trigger = yes
				}			
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_steppe_clothing_trigger = yes
				NOT = {
				 	portrait_epe_eastern_turk_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_eastern_turk_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_seljuk_clothing_trigger = yes
				}
				
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    northern_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = northern_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 50
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                portrait_northern_clothing_trigger = yes
				NOT = {
				 	portrait_epe_balto_finnic_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_east_slav_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_west_slav_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_gaelic_clothing_trigger = yes
				}				
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_northern_clothing_trigger = yes
				NOT = {
				 	portrait_epe_balto_finnic_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_east_slav_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_west_slav_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_gaelic_clothing_trigger = yes
				}				
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    northern_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = northern_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 90
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
				OR = {
					portrait_northern_clothing_trigger = yes
					portrait_sami_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_balto_finnic_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_east_slav_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_west_slav_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_gaelic_clothing_trigger = yes
				}				
            }
            modifier = { # Muslims should always have a beard
                add = 200
					scope:faith.religion = religion:islam_religion
					is_culture_or_descended_from_trigger = { CULTURE = culture:emishi }
				}
				OR = {
					portrait_northern_clothing_trigger = yes
					portrait_sami_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_balto_finnic_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_east_slav_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_west_slav_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_gaelic_clothing_trigger = yes
				}				
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    african = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = sub_saharan_beards_afro
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                exists = this
                 has_gene = {
                    category = gene_hair_type
                    template = hair_afro
                }              
            }
            modifier = { # Muslims should always have a beard
                add = 200
				OR = {
					scope:faith.religion = religion:islam_religion
					is_culture_or_descended_from_trigger = { CULTURE = culture:emishi }
				}
				OR = {
					portrait_african_clothing_trigger = yes
					portrait_papuan_clothing_trigger = yes
				}
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

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

	sp2_beards_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = sp2_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }
        weight = {
            base = 0
            modifier = {
                add = 4
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                    	category = gene_hair_type
                    	template = hair_straight
                    }       
                    has_gene = {
                    	category = gene_hair_type
                    	template = hair_wavy
                    }            
                }
				OR = {
					portrait_sp2_western_clothing_trigger = yes 
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_sp2_western_clothing_trigger = yes
				}
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

	# ### FP3 Beards ###
    
    # #iranian
    # fp3_iranian_beards_straight = {
    #     dna_modifiers = {
    #         accessory = {
    #             mode = add
    #             gene = beards
    #             template = fp3_iranian_beards_straight
    #             range = { 0 1 } # For the randomness to work correctly
    #         }
    #     }   
    #     # outfit_tags = { no_clothes }
    #     weight = {
    #         base = 0
    #         modifier = {
    #             add = 70
    #             OR = {
    #                 NOT = { exists = this }
    #                 has_gene = {
    #                     category = gene_hair_type
    #                     template = hair_straight
    #                 }       
    #                 has_gene = {
    #                     category = gene_hair_type
    #                     template = hair_wavy
    #                 }            
    #             }
    #             portrait_fp3_iranian_clothing_trigger = yes
    #         }
    #         modifier = { # Muslims should always have a beard
    #             add = 200
    #             scope:faith.religion = religion:islam_religion
    #             portrait_fp3_iranian_clothing_trigger = yes
    #         }
    #         modifier = {
    #             add = -100
    #             exists = this
    #             OR = {
    #                 is_from_ruler_designer = yes
    #                 has_character_flag = has_scripted_appearance
    #             }
    #         }
    #     }
    # }

    # fp3_iranian_beards_curly = {
    #     dna_modifiers = {
    #         accessory = {
    #             mode = add
    #             gene = beards
    #             template = fp3_iranian_beards_curly
    #             range = { 0 1 } # For the randomness to work correctly
    #         }
    #     }   
    #     # outfit_tags = { no_clothes }
    #     weight = {
    #         base = 0
    #         modifier = {
    #             add = 70
    #             OR = {
    #                 NOT = { exists = this }
    #                 has_gene = {
    #                     category = gene_hair_type
    #                     template = hair_wavy
    #                 }       
    #                 has_gene = {
    #                     category = gene_hair_type
    #                     template = hair_curly
    #                 }            
    #             }
    #             portrait_fp3_iranian_clothing_trigger = yes
    #         }
    #         modifier = { # Muslims should always have a beard
    #             add = 200
    #             scope:faith.religion = religion:islam_religion
    #             portrait_fp3_iranian_clothing_trigger = yes
    #         }
    #         modifier = {
    #             add = -100
    #             exists = this
    #             OR = {
    #                 is_from_ruler_designer = yes
    #                 has_character_flag = has_scripted_appearance
    #             }
    #         }
    #     }
    # }


    ### FP2 Beards ###

    fp2_beards_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = fp2_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
				OR = {
					portrait_fp2_iberian_muslim_clothing_trigger = yes
					portrait_fp2_iberian_christian_clothing_trigger = yes
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_fp2_iberian_muslim_clothing_trigger = yes
					portrait_fp2_iberian_christian_clothing_trigger = yes
				}
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    fp2_beards_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = fp2_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                OR = {
					portrait_fp2_iberian_muslim_clothing_trigger = yes
					portrait_fp2_iberian_christian_clothing_trigger = yes
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_fp2_iberian_muslim_clothing_trigger = yes
					portrait_fp2_iberian_christian_clothing_trigger = yes
				}
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    ### FP1 Beards ###

    fp1_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = fp1_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 90
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                OR = {
					portrait_epe_norse_clothing_trigger = yes
					portrait_fp1_norse_clothing_trigger = yes
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_epe_norse_clothing_trigger = yes
					portrait_fp1_norse_clothing_trigger = yes
				}
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    fp1_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = fp1_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                OR = {
					portrait_epe_norse_clothing_trigger = yes
					portrait_fp1_norse_clothing_trigger = yes
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_epe_norse_clothing_trigger = yes
					portrait_fp1_norse_clothing_trigger = yes
				}
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    orthodox_beards = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = orthodox_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = { # Orthodox priests
                add = 200
                exists = this
                OR = {
                    has_character_flag = need_priest_outfit
                    is_theocratic_lessee = yes
                    AND = { is_ruler = yes government_has_flag = government_is_theocracy }
                    AND = { # Orthodox patriarch
                        exists = primary_title
                        primary_title = {
                            any_controlled_faith = {
                                this = faith:orthodox
                            }
                        }                    
                    }
                }
                OR = {
                    faith = faith:orthodox
                    faith = faith:armenian_apostolic
                    faith = faith:coptic
                    faith = faith:messalian
                    faith = faith:bogomilist
                    faith = faith:paulician
                    faith = faith:nestorian
                }
            }
        }
    }

    ultimate_beards = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = rtt_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 2000
                exists = this
				OR = {
					has_nickname = nick_the_beautiful_beard
					has_nickname = nick_the_bearded
					has_character_flag = mystic_beard_var
				}
            }
        }
    }

    ### EP2 beards ###

    ep2_beards_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = ep2_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 55
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                }
                portrait_western_clothing_trigger = yes
                has_ep2_dlc_trigger = yes
            }
            modifier = {
                add = 20
                portrait_era1_trigger = yes
            }
            modifier = {
                add = -20
                portrait_era2_trigger = yes
            }
            modifier = {
                add = -40
                OR = {
                    portrait_era3_trigger = yes
                    portrait_era4_trigger = yes
                }                
            }
            modifier = {
                factor = 0
                portrait_western_clothing_trigger = no
            }
        }
    }

    ### EP3 beards ###

    ep3_beards_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = ep3_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 75
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                }
                portrait_byzantine_clothing_trigger = yes
                has_ep3_dlc_trigger = yes
            }
        }
    }

    ep3_beards_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = ep3_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 75
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }
                }
                portrait_byzantine_clothing_trigger = yes
                has_ep3_dlc_trigger = yes
            }
        }
    }
	
	
	
	
	
    ############################################################################################################################################
    ######################################################### EPE ADDED BEARDS ###############################################################
    ############################################################################################################################################
        

	
			##########################################################################
			####East Slav 
			##########################################################################	
			
			
    east_slav_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = east_slav_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                OR = {
                    portrait_epe_east_slav_clothing_trigger = yes	
					portrait_epe_balto_finnic_clothing_trigger = yes
                    portrait_sami_clothing_trigger = yes
                    portrait_ugro_permian_clothing_trigger = yes					
                }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_epe_east_slav_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    east_slav_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = east_slav_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                     has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                OR = {
                    portrait_epe_east_slav_clothing_trigger = yes
					portrait_epe_balto_finnic_clothing_trigger = yes
                    portrait_sami_clothing_trigger = yes
                    portrait_ugro_permian_clothing_trigger = yes					
                }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_epe_east_slav_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }	

			##########################################################################
			####Gaelic/Irish
			##########################################################################	
			
			
    gaelic_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = gaelic_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                OR = {
                    portrait_epe_gaelic_clothing_trigger = yes	
                }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_epe_gaelic_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    gaelic_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = gaelic_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                     has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                OR = {
                    portrait_epe_gaelic_clothing_trigger = yes
                }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_epe_gaelic_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }
	
    ##########################################################################
    ####Eastern Turkic/Default Turk
    ##########################################################################	 
 
 
    turkic_thin_beards = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = turkic_thin_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_straight_thin_beard
				}
                OR = {
                    portrait_epe_eastern_turk_clothing_trigger = yes	
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era1_trigger = yes  							
                        }
					}						
                }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
                    portrait_epe_eastern_turk_clothing_trigger = yes	
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era1_trigger = yes  							
                        }
					}						
                }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }	
	
    turkic_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = turkic_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
				OR = {							
                    portrait_epe_eastern_turk_clothing_trigger = yes							
				}
				NOT = {
				 	portrait_epe_seljuk_clothing_trigger = yes
				}				
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
				OR = {							
                    portrait_epe_eastern_turk_clothing_trigger = yes							
				}
				NOT = {
				 	portrait_epe_seljuk_clothing_trigger = yes
				}				
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    turkic_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = turkic_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                     has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
				OR = {							
                    portrait_epe_eastern_turk_clothing_trigger = yes						
				}
				NOT = {
				 	portrait_epe_seljuk_clothing_trigger = yes
				}				
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
				OR = {							
                    portrait_epe_eastern_turk_clothing_trigger = yes							
				}
				NOT = {
				 	portrait_epe_seljuk_clothing_trigger = yes
				}				
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }	
	
    seljuk_turkic_straight_era1 = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = turkic_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
				OR = {							
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era1_trigger = yes  							
                        }
					}						
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
				OR = {							
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era1_trigger = yes  							
                        }
					}						
				}
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    seljuk_turkic_curly_era1 = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = turkic_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                     has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
				OR = {							
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era1_trigger = yes  							
                        }
					}						
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
				OR = {							
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era1_trigger = yes  							
                        }
					}						
				}
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }	
	
	
    ##########################################################################
    ####Seljuk Turk
    ##########################################################################	 
 
 
    seljuk_thin_beards = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = seljuk_thin_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_straight_thin_beard
				}
                OR = {
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era2_trigger = yes  
                            portrait_era3_trigger = yes 
 							portrait_era4_trigger = yes 
                        }
					}
					portrait_epe_eastern_turk_muslim_clothing_trigger = yes
                }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era2_trigger = yes  
                            portrait_era3_trigger = yes 
 							portrait_era4_trigger = yes 
                        }
					}
					portrait_epe_eastern_turk_muslim_clothing_trigger = yes
					portrait_epe_western_turk_clothing_trigger = yes					
                }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }	
	
    seljuk_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = seljuk_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                OR = {
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era2_trigger = yes  
                            portrait_era3_trigger = yes  							
                        }
					}
					portrait_epe_western_turk_clothing_trigger = yes					
					portrait_epe_eastern_turk_muslim_clothing_trigger = yes
                }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		 
                            portrait_era2_trigger = yes  
                            portrait_era3_trigger = yes  							
                        }
					}
					portrait_epe_western_turk_clothing_trigger = yes					
					portrait_epe_eastern_turk_muslim_clothing_trigger = yes
                }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    seljuk_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = seljuk_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                OR = {
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era2_trigger = yes  
                            portrait_era3_trigger = yes  							
                        }
					}
					portrait_epe_western_turk_clothing_trigger = yes					
					portrait_epe_eastern_turk_muslim_clothing_trigger = yes
                }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era2_trigger = yes  
                            portrait_era3_trigger = yes  							
                        }
					}
					portrait_epe_western_turk_clothing_trigger = yes					
					portrait_epe_eastern_turk_muslim_clothing_trigger = yes
                }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }
		
	
    ##########################################################################
    ####Han Chinese
    ##########################################################################	 
 
 
    han_thin_beards = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = han_thin_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_straight_thin_beard
				}
                OR = {
                    portrait_chinese_clothing_trigger = yes		
                    portrait_epe_uyghur_clothing_trigger = yes	
                    portrait_epe_balto_finnic_clothing_trigger = yes
                    portrait_sami_clothing_trigger = yes
                    portrait_ugro_permian_clothing_trigger = yes						
                    portrait_epe_sino_iranian_clothing_trigger = yes							
                }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
			OR = {
                portrait_chinese_clothing_trigger = yes
                portrait_epe_uyghur_clothing_trigger = yes
                portrait_epe_balto_finnic_clothing_trigger = yes
                portrait_sami_clothing_trigger = yes
                portrait_ugro_permian_clothing_trigger = yes				
                portrait_epe_sino_iranian_clothing_trigger = yes					
                }				
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }


    han_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = turkic_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
			OR = {
                portrait_chinese_clothing_trigger = yes
					AND = {
						portrait_epe_uyghur_clothing_trigger = yes
						has_tgp_dlc_trigger = no
						}
					AND = {
						portrait_epe_uyghur_clothing_trigger = yes
						has_tgp_dlc_trigger = yes
                        OR = {					
                            portrait_era1_trigger = yes  					
                            portrait_era2_trigger = yes   							 
                          }							
						}
                portrait_epe_balto_finnic_clothing_trigger = yes
                portrait_sami_clothing_trigger = yes
                portrait_ugro_permian_clothing_trigger = yes				
                # portrait_epe_sino_iranian_clothing_trigger = yes				
                }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
			OR = {
                portrait_chinese_clothing_trigger = yes
					AND = {
						portrait_epe_uyghur_clothing_trigger = yes
						has_tgp_dlc_trigger = no
						}
					AND = {
						portrait_epe_uyghur_clothing_trigger = yes
						has_tgp_dlc_trigger = yes
                        OR = {					
                            portrait_era1_trigger = yes  					
                            portrait_era2_trigger = yes   							 
                          }							
						}
                portrait_epe_balto_finnic_clothing_trigger = yes
                portrait_sami_clothing_trigger = yes
                portrait_ugro_permian_clothing_trigger = yes					
                # portrait_epe_sino_iranian_clothing_trigger = yes				
                }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    han_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = han_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
			OR = {
                portrait_chinese_clothing_trigger = yes
					AND = {
						portrait_epe_uyghur_clothing_trigger = yes
						has_tgp_dlc_trigger = no
						}
					AND = {
						portrait_epe_uyghur_clothing_trigger = yes
						has_tgp_dlc_trigger = yes
                        OR = {					
                            portrait_era1_trigger = yes  					
                            portrait_era2_trigger = yes   							 
                          }							
						}
                portrait_epe_balto_finnic_clothing_trigger = yes
                portrait_sami_clothing_trigger = yes
                portrait_ugro_permian_clothing_trigger = yes				
                # portrait_epe_sino_iranian_clothing_trigger = yes					
                }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
                    portrait_chinese_clothing_trigger = yes
					AND = {
						portrait_epe_uyghur_clothing_trigger = yes
						has_tgp_dlc_trigger = no
						}
					AND = {
						portrait_epe_uyghur_clothing_trigger = yes
						has_tgp_dlc_trigger = yes
                        OR = {					
                            portrait_era1_trigger = yes  					
                            portrait_era2_trigger = yes   							 
                          }							
						}
                    portrait_epe_balto_finnic_clothing_trigger = yes
                    portrait_sami_clothing_trigger = yes
                    portrait_ugro_permian_clothing_trigger = yes					
                    # portrait_epe_sino_iranian_clothing_trigger = yes					
                }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }		
	
	## TGP - Chinese ##

	tgp_beards_chinese = { 
		dna_modifiers = {
			accessory = {
				mode = add
				gene = beards
				template = tgp_chinese_beards
				range = { 0 1 } # For the randomness to work correctly
			}
		}   
		weight = {
			base = 0
			modifier = {
				add = 80
				OR = {
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
				}
                OR = {
                    portrait_chinese_clothing_trigger = yes
                    portrait_epe_uyghur_clothing_trigger = yes
					AND = {
						portrait_epe_sino_iranian_chinese_clothing_trigger = yes
                        OR = {
                            portrait_era1_trigger = yes  					
                            portrait_era2_trigger = yes  				 
                          }							
						has_tgp_dlc_trigger = yes
					}
					AND = {
						portrait_epe_sino_iranian_clothing_trigger = yes
						has_tgp_dlc_trigger = yes
                        OR = {					
                            portrait_era3_trigger = yes  
                            portrait_era4_trigger = yes   							 
                          }							
						}					
                }
			}
			modifier = {
				add = 80
				OR = {
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_wavy
					}
				}
				portrait_steppe_clothing_trigger = yes
				OR = {
					culture = culture:khitan
					culture = {
						any_parent_culture_or_above = {
							this = culture:khitan
						}
					}
				}
			}			
		}
	} 

	tgp_beards_japanese = { 
		dna_modifiers = {
			accessory = {
				mode = add
				gene = beards
				template = tgp_japanese_beards
				range = { 0 1 } # For the randomness to work correctly
			}
		}   
		weight = {
			base = 0
			modifier = {
				add = 80
				OR = {
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_wavy
					}
				}
				portrait_japanese_clothing_trigger = yes
                has_tgp_dlc_trigger = yes
			}
		}
	}

	tgp_beards_sea = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = beards
				template = tgp_sea_beards
				range = { 0 1 } # For the randomness to work correctly
			}
		}   
		weight = {
			base = 0
			modifier = {
				add = 70
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_straight_thin_beard
				}
				OR = {
					portrait_malay_clothing_trigger = yes
					portrait_southeast_asian_clothing_trigger = yes
				}
			}
			modifier = { # Muslims should always have a beard
				add = 200
				OR = {
					scope:faith.religion = religion:islam_religion
					is_culture_or_descended_from_trigger = { CULTURE = culture:emishi }
				}
				trigger_if = {
					limit = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				OR = {
					portrait_malay_clothing_trigger = yes
					portrait_southeast_asian_clothing_trigger = yes
				}
			}
		}
	}  

    tgp_beards_ainu = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = tgp_ainu_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 170
                exists = this
                portrait_ainu_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                OR = {
                    scope:faith.religion = religion:islam_religion
                    is_culture_or_descended_from_trigger = { CULTURE = culture:emishi }
                }
                portrait_ainu_clothing_trigger = yes
            }
        }
    } 

    cp7_beards_emishi_straight = {	# very similar to tgp ainu stuff above but checks for hair type genes - i made this before the gene tgp gene was added so i consolidated them together for cp7 --aj
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = cp7_emishi_ainu_beards
                range = { 0 0.37 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 170
                exists = this
                portrait_emishi_clothing_trigger = yes
				has_gene = {
					category = gene_hair_type
					template = hair_straight
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                OR = {
                    scope:faith.religion = religion:islam_religion
                    is_culture_or_descended_from_trigger = { CULTURE = culture:emishi }
                }
                portrait_emishi_clothing_trigger = yes
            }
        }
    }  
    cp7_beards_emishi_wavy = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = cp7_emishi_ainu_beards
                range = { 0.42 0.83 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 170
                exists = this
                portrait_emishi_clothing_trigger = yes
				has_gene = {
					category = gene_hair_type
					template = hair_wavy
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                OR = {
                    scope:faith.religion = religion:islam_religion
                    is_culture_or_descended_from_trigger = { CULTURE = culture:emishi }
                }
                portrait_emishi_clothing_trigger = yes
            }
        }
    } 
    cp7_beards_emishi_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = cp7_emishi_ainu_beards
                range = { 0.89 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 170
                exists = this
                portrait_emishi_clothing_trigger = yes
				OR = {
					has_gene = {
						category = gene_hair_type
						template = hair_curly
					}
					has_gene = {
						category = gene_hair_type
						template = hair_afro
					}
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                OR = {
                    scope:faith.religion = religion:islam_religion
                    is_culture_or_descended_from_trigger = { CULTURE = culture:emishi }
                }
                portrait_emishi_clothing_trigger = yes
            }
        }
    }  
    cp7_beards_emishi_straight_thin = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = tgp_chinese_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 170
                exists = this
                portrait_emishi_clothing_trigger = yes
				has_gene = {
					category = gene_hair_type
					template = hair_straight_thin_beard
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                OR = {
                    scope:faith.religion = religion:islam_religion
                    is_culture_or_descended_from_trigger = { CULTURE = culture:emishi }
                }
                portrait_emishi_clothing_trigger = yes
            }
        }
    }  
  ### SP5 Beard ###

	sp5_western_beards = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = beards
				template = sp5_western_beards
				range = { 0 1 } # For the randomness to work correctly
			}
		}   
		weight = {
			base = 0
			modifier = {
				add = 15
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_curly
					}
					has_gene = {
						category = gene_hair_type
						template = hair_wavy
					}
				}
				OR = {
					portrait_western_clothing_trigger = yes
					portrait_byzantine_clothing_trigger = yes
				}

				has_sp5_dlc_triggers = yes
			}
			modifier = {
				factor = 0
				portrait_western_clothing_trigger = no
			}
		}
	}
	
    ##########################################################################
    ####North africa/maghreb/Berber
    ##########################################################################	 

    fp2_maghreb_beards_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = fp2_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
				OR = {
					portrait_afr_berber_clothing_trigger = yes
				}
				has_fp2_dlc_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_afr_berber_clothing_trigger = yes
				}
				has_fp2_dlc_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    fp2_maghreb_beards_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = fp2_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                OR = {
					portrait_afr_berber_clothing_trigger = yes
				}
				has_fp2_dlc_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_afr_berber_clothing_trigger = yes
				}
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
				has_fp2_dlc_trigger = yes
            }
        }
    }		
	
    ##########################################################################
    #### Hindu Iranian 
    ##########################################################################		
			
    hindu_iranian_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = eastern_iranian_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                OR = {
                    portrait_epe_hindu_iranian_clothing_trigger = yes
					portrait_epe_sino_iranian_clothing_trigger = yes	
					AND = {
						portrait_epe_uyghur_clothing_trigger = yes
						has_tgp_dlc_trigger = yes
                        OR = {					
                            portrait_era3_trigger = yes  
                            portrait_era4_trigger = yes   							 
                          }							
						}					
                }
			
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
                    portrait_epe_hindu_iranian_clothing_trigger = yes	
					portrait_epe_sino_iranian_clothing_trigger = yes
					AND = {
						portrait_epe_uyghur_clothing_trigger = yes
						has_tgp_dlc_trigger = yes
                        OR = {					
                            portrait_era3_trigger = yes  
                            portrait_era4_trigger = yes   							 
                          }							
						}					
                }
			
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    hindu_iranian_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = eastern_iranian_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                OR = {
                    portrait_epe_hindu_iranian_clothing_trigger = yes	
					portrait_epe_sino_iranian_clothing_trigger = yes
					AND = {
						portrait_epe_uyghur_clothing_trigger = yes
						has_tgp_dlc_trigger = yes
                        OR = {					
                            portrait_era3_trigger = yes  
                            portrait_era4_trigger = yes   							 
                          }							
						}					
                }
			
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
                    portrait_epe_hindu_iranian_clothing_trigger = yes
					portrait_epe_sino_iranian_clothing_trigger = yes
					AND = {
						portrait_epe_uyghur_clothing_trigger = yes
						has_tgp_dlc_trigger = yes
                        OR = {					
                            portrait_era3_trigger = yes  
                            portrait_era4_trigger = yes   							 
                          }							
						}					
                }
				
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }		
	

    ##########################################################################
    #### Islamic Iranian 
    ##########################################################################		
			
    islamic_iranian_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = iranian_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                OR = {
                    portrait_epe_islamic_iranian_clothing_trigger = yes	
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era3_trigger = yes  
                        }
					}						
                }
				# NOT = {
				# 	portrait_epe_sino_iranian_clothing_trigger = yes
				# }				
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
                    portrait_epe_islamic_iranian_clothing_trigger = yes	
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era3_trigger = yes  
                        }
					}					
                }
				# NOT = {
				# 	portrait_epe_sino_iranian_clothing_trigger = yes
				# }				
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    islamic_iranian_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = iranian_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                OR = {
                    portrait_epe_islamic_iranian_clothing_trigger = yes		
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era3_trigger = yes  
                        }
					}						
                }
				# NOT = {
				# 	portrait_epe_sino_iranian_clothing_trigger = yes
				# }				
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
                    portrait_epe_islamic_iranian_clothing_trigger = yes		
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era3_trigger = yes  
                        }
					}					
                }
				# NOT = {
				# 	portrait_epe_sino_iranian_clothing_trigger = yes
				# }				
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }	


    ##########################################################################
    ####eastern Iranian non-muslim 
    ##########################################################################		
			
    eastern_non_islamic_iranian_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = eastern_iranian_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
				portrait_epe_non_islamic_iranian_clothing_trigger = yes				
				portrait_epe_eastern_non_islamic_iranian_clothing_trigger = yes		
				NOT = {
				 	portrait_epe_hindu_iranian_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_western_non_islamic_iranian_clothing_trigger = yes
				}				
				# NOT = {
				# 	portrait_epe_sino_iranian_clothing_trigger = yes
				# }				
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
				portrait_epe_non_islamic_iranian_clothing_trigger = yes				
				portrait_epe_eastern_non_islamic_iranian_clothing_trigger = yes		
				NOT = {
				 	portrait_epe_hindu_iranian_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_western_non_islamic_iranian_clothing_trigger = yes
				}				
				# NOT = {
				# 	portrait_epe_sino_iranian_clothing_trigger = yes
				# }				
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    eastern_non_islamic_iranian_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = eastern_iranian_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
				portrait_epe_non_islamic_iranian_clothing_trigger = yes				
				portrait_epe_eastern_non_islamic_iranian_clothing_trigger = yes		
				NOT = {
				 	portrait_epe_hindu_iranian_clothing_trigger = yes
				}
				# NOT = {
				# 	portrait_epe_sino_iranian_clothing_trigger = yes
				# }				
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
				portrait_epe_non_islamic_iranian_clothing_trigger = yes				
				portrait_epe_eastern_non_islamic_iranian_clothing_trigger = yes		
				NOT = {
				 	portrait_epe_hindu_iranian_clothing_trigger = yes
				}
				# NOT = {
				# 	portrait_epe_sino_iranian_clothing_trigger = yes
				# }				
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    ##########################################################################
    ####western Iranian non-muslim 
    ##########################################################################		
			
    western_non_islamic_iranian_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = western_iranian_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
				portrait_epe_non_islamic_iranian_clothing_trigger = yes				
				portrait_epe_western_non_islamic_iranian_clothing_trigger = yes		
				NOT = {
				 	portrait_epe_hindu_iranian_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_eastern_non_islamic_iranian_clothing_trigger = yes
				}
				# NOT = {
				# 	portrait_epe_sino_iranian_clothing_trigger = yes
				# }				
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
				portrait_epe_non_islamic_iranian_clothing_trigger = yes				
				portrait_epe_western_non_islamic_iranian_clothing_trigger = yes		
				NOT = {
				 	portrait_epe_hindu_iranian_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_eastern_non_islamic_iranian_clothing_trigger = yes
				}
				# NOT = {
				# 	portrait_epe_sino_iranian_clothing_trigger = yes
				# }				
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    western_non_islamic_iranian_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = western_iranian_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
				portrait_epe_non_islamic_iranian_clothing_trigger = yes				
				portrait_epe_western_non_islamic_iranian_clothing_trigger = yes		
				NOT = {
				 	portrait_epe_hindu_iranian_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_eastern_non_islamic_iranian_clothing_trigger = yes
				}
				# NOT = {
				# 	portrait_epe_sino_iranian_clothing_trigger = yes
				# }				
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
				portrait_epe_non_islamic_iranian_clothing_trigger = yes				
				portrait_epe_western_non_islamic_iranian_clothing_trigger = yes		
				NOT = {
				 	portrait_epe_hindu_iranian_clothing_trigger = yes
				}
				NOT = {
				 	portrait_epe_eastern_non_islamic_iranian_clothing_trigger = yes
				}
				# NOT = {
				# 	portrait_epe_sino_iranian_clothing_trigger = yes
				# }				
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }


####################################################################################################
##################
###Norman-Sicilian era 2-4
##################
####################################################################################################
    ep3_epe_norman_beards_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = ep3_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 75
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                }
				OR = {
					portrait_epe_norman_sicily_clothing_trigger = yes 
					portrait_epe_sicilian_clothing_trigger = yes
				}
                has_ep3_dlc_trigger = yes
            }
        }
    }

    ep3_epe_norman_beards_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = ep3_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 75
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }
                }
				OR = {
					portrait_epe_norman_sicily_clothing_trigger = yes 
					portrait_epe_sicilian_clothing_trigger = yes
				}
                has_ep3_dlc_trigger = yes
            }
        }
    }











	
	

	####################################################################################################################
	#####No Facial hair gene
	##straight
	no_beard_for_gene_straight = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = beards
				template = no_beard
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		# outfit_tags = { no_clothes }
		weight = {
			base = 0
			modifier = {
				add = 70
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_straight_no_beard
				}
			}
			modifier = {
				# Muslims should always have a beard
				add = 200
				scope:faith.religion = religion:islam_religion
				has_gene = {
					category = gene_hair_type
					template = hair_straight_no_beard
				}
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}
	##	wavy
	no_beard_for_gene_wavy = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = beards
				template = no_beard
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		# outfit_tags = { no_clothes }
		weight = {
			base = 0
			modifier = {
				add = 70
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_wavy_no_beard
				}
			}
			modifier = {
				# Muslims should always have a beard
				add = 200
				scope:faith.religion = religion:islam_religion
				has_gene = {
					category = gene_hair_type
					template = hair_wavy_no_beard
				}
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}
	##	curly
	no_beard_for_gene_curly = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = beards
				template = no_beard
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		# outfit_tags = { no_clothes }
		weight = {
			base = 0
			modifier = {
				add = 70
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_curly_no_beard
				}
			}
			modifier = {
				# Muslims should always have a beard
				add = 200
				scope:faith.religion = religion:islam_religion
				has_gene = {
					category = gene_hair_type
					template = hair_curly_no_beard
				}
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}
	##	afro
	no_beard_for_gene_afro = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = beards
				template = no_beard
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		# outfit_tags = { no_clothes }
		weight = {
			base = 0
			modifier = {
				add = 70
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_afro_no_beard
				}
			}
			modifier = {
				# Muslims should always have a beard
				add = 200
				scope:faith.religion = religion:islam_religion
				has_gene = {
					category = gene_hair_type
					template = hair_afro_no_beard
				}
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

    ### SP4 - Crowns of the World ###

    sp4_beards_mena = { 
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = sp4_mena_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 30
                OR = {
                    portrait_mena_clothing_trigger = yes
                    portrait_epe_islamic_iranian_clothing_trigger = yes
				    portrait_epe_non_islamic_iranian_clothing_trigger = yes		
				    portrait_fp3_iranian_clothing_trigger = yes
                    portrait_epe_bedouin_clothing_trigger = yes
                }
                has_sp4_dlc_trigger = yes
            }
            modifier = {
                add = 30
                OR = {
					AND = {
					  portrait_epe_seljuk_clothing_trigger = yes
                         OR = {		
                            portrait_era2_trigger = yes  
                            portrait_era3_trigger = yes 
                        }
					}
                }				
                has_sp4_dlc_trigger = yes
            }
            modifier = {
                add = 30
                OR = {
                    portrait_turkic_clothing_trigger = yes
                }	
				NOT = {
				 	portrait_epe_seljuk_clothing_trigger = yes
				}					
                has_sp4_dlc_trigger = yes
            }			
            modifier = {
                factor = 0
                NOR = {
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight_thin_beard
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }
                }
            }
        }
    }

    sp4_beards_rus = { 
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = sp4_rus_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 50
                portrait_rus_clothing_trigger = yes
                portrait_epe_east_slav_clothing_trigger = yes
                portrait_epe_west_slav_clothing_trigger = yes
                has_sp4_dlc_trigger = yes
            }
            modifier = {
                factor = 0
                NOR = {
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight_thin_beard
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                }
            }
        }
    }
	
	
    ### Ottomans era4 Beards ###

    epe_ottomans_beards_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = ottomans_beards_era4
                range = { 0 0.57 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
			  ####Ottomans
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    } 
                }
                portrait_epe_seljuk_clothing_trigger = yes
				portrait_era4_trigger = yes 
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_epe_seljuk_clothing_trigger = yes
				}
				portrait_era4_trigger = yes 			
            }			
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    epe_ottomans_beards_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = ottomans_beards_era4
                range = { 0.60 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
			  ####Ottomans
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    } 
                }
                portrait_epe_seljuk_clothing_trigger = yes
				portrait_era4_trigger = yes 
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_epe_seljuk_clothing_trigger = yes
				}
				portrait_era4_trigger = yes 			
            }			
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }	


}





