﻿# Tags:
# rank_headgear: any headgear that signifies a certain title. crowns, pope hat etc.


Chinese_headgear = {
  # interface_position = 1
	usage = game
	selection_behavior = weighted_random
	
	no_hat = {
		usage = game 
		dna_modifiers = {
			accessory = {
				mode = add
		
				gene = headgear
				template = no_headgear
				value = 0
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 1000
				AND = {
					should_be_naked_trigger = yes
				}
			}
			modifier = {
				factor = 0
				OR = {
					is_adult = no
					highest_held_title_tier >= tier_duchy # Should wear ducal or royal crown instead.
					AND = {
						religion = religion:christianity_religion
						faith.religious_head = this
					}
				}
			}
		}
	}

## So that the Prophet Muhammad does not have a portrait ## 

	no_portrait = {
		dna_modifiers = {
			accessory = {
				mode = add				
				gene = headgear
				template = no_headgear
				value = 0.5
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 200
				this = character:33922
			}
		}
	}




	no_headgear = {

		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = no_headgear
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		## No headgear for children under 16 ## 
		weight = {
			base = 0
			modifier = {
				add = 100
				age < 16
			}
		}
		
	}

	
## China ##

	chinese_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = chinese_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
			    add = -1000
				OR = {
				 is_knight = yes
				 is_commanding_army = yes
				 has_council_position = councillor_marshal
				}
			}
			modifier = {
				add = 1000
				highest_held_title_tier < tier_county
				NOR = {
					AND = {
						exists = primary_spouse
						primary_spouse = {
							highest_held_title_tier > tier_county
						}
					}
					has_government = republic_government
					AND = { is_ruler = yes has_government = theocracy_government }
				}
				portrait_chinese_clothing_trigger = yes
			}
		}
	}

	chinese_mayors = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = chinese_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
			    add = -1000
				OR = {
				 is_knight = yes
				 is_commanding_army = yes
				 has_council_position = councillor_marshal
				}
			}
			modifier = {
				add = 500
				has_government = republic_government
				portrait_chinese_clothing_trigger = yes
			}
		}
	}

	chinese_low_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = chinese_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
			    add = -1000
				OR = {
				 is_knight = yes
				 is_commanding_army = yes
				 has_council_position = councillor_marshal
				}
			}
			modifier = {
				add = 1000
				OR = {
					AND = {
						highest_held_title_tier = tier_county
						NOR = {
							AND = { is_ruler = yes has_government = theocracy_government }
						}
						portrait_chinese_clothing_trigger = yes
					}
					AND = {
						exists = primary_spouse
						OR = {
							is_ruler = no
							highest_held_title_tier = tier_barony
						}
						primary_spouse = {
							highest_held_title_tier = tier_county
							NOR = {
								# has_dynasty = no
								AND = { is_ruler = yes has_government = theocracy_government }
							}
							portrait_chinese_clothing_trigger = yes
						}
					}
				}

			}
		}
	}

	chinese_high_nobles = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = chinese_high_nobility
				range = { 0 1 } # For the randomness to work correctly
			}
		}		
		weight = {
			base = 0
			modifier = {
			    add = -1000
				OR = {
				 is_knight = yes
				 is_commanding_army = yes
				 has_council_position = councillor_marshal
				}
			}
			modifier = {
				add = 1000
				OR = {
					AND = {
						OR = {
							highest_held_title_tier = tier_duchy
							AND = { is_ruler = yes has_government = theocracy_government }
						}
						NOT = { AND = { is_ruler = yes has_government = mercenary_government  } } # Blocked for mercenaries
						portrait_chinese_clothing_trigger = yes
					}
					AND = {
						exists = primary_spouse
						OR = {
							is_ruler = no
							highest_held_title_tier = tier_barony
						}
						primary_spouse = {
							OR = {
								highest_held_title_tier = tier_duchy
								AND = { is_ruler = yes has_government = theocracy_government }
							}
							portrait_chinese_clothing_trigger = yes
						}
					}
				}

			}
		}
	}

	chinese_royalty = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = chinese_royalty
				range = { 0 1 } # For the randomness to work correctly
			}
		}		
		weight = {
			base = 0
			modifier = {
			    add = -1000
				OR = {
				 is_knight = yes
				 is_commanding_army = yes
				 has_council_position = councillor_marshal
				}
			}
			modifier = {
				add = 1000
				OR = {
					AND = {
						OR = {
							highest_held_title_tier = tier_kingdom
							AND = { is_ruler = yes has_government = theocracy_government }
						}
						NOT = { AND = { is_ruler = yes has_government = mercenary_government  } } # Blocked for mercenaries
						portrait_chinese_clothing_trigger = yes
					}
					AND = {
						exists = primary_spouse
						OR = {
							is_ruler = no
							highest_held_title_tier = tier_barony
						}
						primary_spouse = {
							OR = {
								highest_held_title_tier = tier_kingdom
								AND = { is_ruler = yes has_government = theocracy_government }
							}
							NOT = { AND = { is_ruler = yes has_government = mercenary_government  } } # Blocked for mercenaries
							portrait_chinese_clothing_trigger = yes
						}
					}
				}

			}
		}
	}
	
	chinese_princes = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = chinese_prince
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
			    add = -1000
				OR = {
				 is_knight = yes
				 is_commanding_army = yes
				 has_council_position = councillor_marshal
				}
			}
			modifier = {
				add = 500
				any_parent = { highest_held_title_tier = tier_empire }
				portrait_chinese_clothing_trigger = yes
			}
		}
	}
	
	chinese_imperial = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = chinese_imperial
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
			    add = -1000
				OR = {
				 is_knight = yes
				 is_commanding_army = yes
				 has_council_position = councillor_marshal
				}
			}
			modifier = {
				add = 1000
				highest_held_title_tier = tier_empire
				NOR = {
					AND = { is_ruler = yes has_government = mercenary_government  }
					has_government = republic_government
					AND = { is_ruler = yes has_government = theocracy_government }
				}
				portrait_chinese_clothing_trigger = yes
			}
		}
	}

	chinese_war = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = headgear
				template = chinese_war
				range = { 0 1 } # For the randomness to work correctly
			}
		}	
		weight = {
			base = 0
			modifier = {
				add = 500
				portrait_wear_helmet_trigger = yes
				portrait_chinese_clothing_trigger = yes
				
				NOR = {
				    AND = {
				        religion = religion:christianity_religion
				        has_government = holy_order_government
				    }
				    AND = {
				        religion = religion:christianity_religion
				        is_landed = no
				        portrait_wear_armor_trigger = yes
				        exists = liege
				        liege = {
				            has_government = holy_order_government
				        }
				    }
				    AND = {
				        religion = religion:christianity_religion
				        portrait_wear_armor_trigger = yes
				        OR = {
				            any_character_war = {
				                OR = {
				                    using_cb = undirected_great_holy_war
				                    using_cb = directed_great_holy_war
				                }
				                is_attacker = prev
				            }
				            any_liege_or_above = {
				                faith = prev.faith
				                any_character_war = {
				                    OR = {
				                        using_cb = undirected_great_holy_war
				                        using_cb = directed_great_holy_war
				                    }
				                    is_attacker = prev
				                }
				            }
				        }
				    }
				}
			}
		}
	}
	
	## taoism ##

	religious_taoism_high_headgear = {
	    dna_modifiers = {
	        accessory = {
	            mode = add
	            gene = headgear
	            template = religious_taoism_high
	            range = { 0 1 }
	        }
	    }
	    weight = {
	        base = 0
	        modifier = {
				add = 1000
				OR = {
					is_theocratic_lessee = yes
					AND = { is_ruler = yes has_government = theocracy_government }
					has_council_position = councillor_court_chaplain
				}
				OR = {
					religion = religion:taoism_religion
				}
			}
	    }
	}
}