﻿# 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
			}
            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
                    }            
                }
                OR = {
                    portrait_western_clothing_trigger = yes
                    portrait_byzantine_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
                }
            }
        }
    }

    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
                    }            
                }
                OR = {
                    portrait_western_clothing_trigger = yes
                    portrait_byzantine_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
				}
            }
            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
				}
                NAND = { # The Prophet Muhammad does not have a portrait
                    exists = this
                    this = character:33922 # Prophet Muhammad
                }
                NAND = { # The Prophet Muhammad does not have a portrait
                    exists = this
                    OR = {
                        has_character_flag = islam_prophet
                        trigger_if = {
                            limit = {
                                exists = global_var:prophet
                            }
                            THIS = global_var:prophet
                        }
                    }
                }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                    this = character:33922 # Prophet Muhammad
                    has_character_flag = islam_prophet
                    trigger_if = {
                        limit = {
                            exists = global_var:prophet
                        }
                        THIS = global_var:prophet
                    }
                }
            }
        }
    }

    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
				}
            }
            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
				}
                NAND = { # The Prophet Muhammad does not have a portrait
                    exists = this
                    this = character:33922 # Prophet Muhammad
                }
                NAND = {
                    exists = this
                    has_character_flag = islam_prophet
                } 
                NAND = {
                    exists = this
                    trigger_if = {
                        limit = {
                            exists = global_var:prophet
                        }
                        THIS = global_var:prophet
                    }
                }  
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                    this = character:33922 # Prophet Muhammad
                    has_character_flag = islam_prophet
                    trigger_if = {
                        limit = {
                            exists = global_var:prophet
                        }
                        THIS = global_var:prophet
                    }
                }
            }
        }
    }

    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
                scope:faith.religion = religion:islam_religion
                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
                }
            }
        }
    }

    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
            }
            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
            }
            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
                }
            }
        }
    }

    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
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_northern_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
                    }            
                }
                portrait_northern_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_northern_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
                scope:faith.religion = religion:islam_religion
                portrait_african_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
                }
            }
        }
    }

    ### 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
                    }            
                }
                portrait_fp1_norse_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                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
                    }            
                }
                portrait_fp1_norse_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_northern_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
                }                
            }
        }
    }
}





