﻿# Revealing Clothing Portrait modifiers
# Has our portrait modifiers for revealing clothing from CBO

# Revealing Clothing enabled
# This enables revealing clothing via the clothing_type gene (CBO clothing)
regula_revealing_clothing_rule = {
	usage = game
    selection_behavior = max
    priority = 10	# We want to set this last, after we've chosen the correct clothing below

	# Three different settings
	# Famuli Only (any females who follow the regula religion)
	famuli_only = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = clothing_type
				template = revealing_2
				range = { 0 1 }
			}

			# Remove pants
			accessory = {
				mode = add
				gene = legwear
				template = no_legwear
				value = 0
			}
		}

		weight = {
			# This should be our "goto" solution, as it simplifies everything for us
			base = 1000

			# Always enabled for Regula
            modifier = {
                factor = 0
                OR = {
                    religion != religion:regula_religion
                    is_adult = no
					age < 18
                    is_female = no
                    should_be_naked_trigger = yes
                    NOT = { has_game_rule = regula_portraits_revealing_clothing_enabled_famuli_only }
                }
            }
		}
	}

	# All Females
	all_females = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = clothing_type
				template = revealing_2
				range = { 0 1 }
			}

			# Remove pants
			accessory = {
				mode = add
				gene = legwear
				template = no_legwear
				value = 0
			}
		}

		weight = {
			# This should be our "goto" solution, as it simplifies everything for us
			base = 1000

			# Always enabled for females
            modifier = {
                factor = 0
                OR = {
                    is_adult = no
					age < 18
                    is_female = no
                    should_be_naked_trigger = yes
                    NOT = { has_game_rule = regula_portraits_revealing_clothing_enabled_all_females }
                }
            }
		}
	}

	# Everyone (including men!)
	everyone = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = clothing_type
				template = revealing_2
				range = { 0 1 }
			}

			# Remove pants
			accessory = {
				mode = add
				gene = legwear
				template = no_legwear
				value = 0
			}
		}

		outfit_tags = { regula_revealing_clothing }

		weight = {
			# This should be our "goto" solution, as it simplifies everything for us
			base = 1000

			# Enabled for everyone!
            modifier = {
                factor = 0
                OR = {
                    is_adult = no
					age < 18
                    should_be_naked_trigger = yes
                    NOT = { has_game_rule = regula_portraits_revealing_clothing_enabled_everyone }
                }
            }
		}
	}
}

# CBO Clothing
# Dont really need this anymore, as the above rule does it for us
# We can setup any special rules here though if we want, like priestess clothing etc.
regula_clothing = {
	usage = game
    selection_behavior = max
    priority = 9

	regula_priestess = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = clothes
                template = religious_catholic_devoted_clothes
                range = { 0 1 } # For the randomness to work correctly
            }
            accessory = {
                mode = add
                gene = hairstyles
                template = catholic_devoted_hairstyles
                range = { 0 1 } # For the randomness to work correctly
            }
			accessory = {
				mode = add
				gene = headgear
				template = no_headgear
				range = { 0 1 } # For the randomness to work correctly
			}
        }
        outfit_tags = { regula_priestess }
        weight = {
            base = 0
            modifier = {
                add = 100
				OR = {
					portrait_has_trait_trigger = { TRAIT = devoted }
					OR = {
						faith = {
							has_doctrine_parameter = vows_of_poverty_active
						}
						OR = {
							AND = {
								has_council_position = councillor_court_chaplain
								faith = {
									has_doctrine = doctrine_theocracy_lay_clergy
								}
							}
							is_theocratic_lessee = yes
							AND = { is_ruler = yes government_has_flag = government_is_theocracy }
						}
					}
				}
				religion = religion:regula_religion
            }
			modifier = {
                factor = 0
                OR = {
                    religion != religion:regula_religion
                    is_adult = no
                    age < 18
                    is_female = no
                    should_be_naked_trigger = yes
                    has_game_rule = regula_portraits_revealing_clothing_disabled
                }
            }
        }
    }
}
