﻿MTXXX_liege_flouts_council_faith_tradition_trigger = {
	$LIEGE$ = { save_temporary_scope_as = MTXXX_liege }

	scope:MTXXX_liege = {
		culture = { has_cultural_parameter = MTXXX_council_ignores_faith_traditions }
	}
	or = {
		and = {
			is_female = yes
			scope:MTXXX_liege.faith = { has_doctrine_parameter = male_dominated_council }
		}
		and = {
			is_male = yes
			scope:MTXXX_liege.faith = { has_doctrine_parameter = female_dominated_council }
		}
	}
}

MTXXX_dislikes_liege_flouting_council_faith_tradition_trigger = {
	liege.culture = { has_cultural_parameter = MTXXX_council_ignores_faith_traditions }
	or = {
		and = {
			is_male = yes
			liege = {
				faith = { has_doctrine_parameter = male_dominated_council }
				any_councillor = {
					is_female = yes
					or = {
						has_council_position = councillor_chancellor
						has_council_position = councillor_steward
						has_council_position = councillor_marshal
					}
				}
			}
		}
		and = {
			is_female = yes
			liege = {
				faith = { has_doctrine_parameter = female_dominated_council }
				any_councillor = {
					is_male = yes
					or = {
						has_council_position = councillor_chancellor
						has_council_position = councillor_steward
						has_council_position = councillor_marshal
					}
				}
			}
		}
	}
}

can_be_chancellor_trigger = {
	can_be_councillor_basics_trigger = yes
	$COURT_OWNER$ ?= {
		NOT = { government_has_flag = government_is_nomadic }
	}
	NAND = {
		has_council_position = councillor_court_chaplain
		faith = { has_doctrine_parameter = clerical_appointment_fixed }
	}
	NOT = {
		OR = { 
			has_council_position = councillor_spouse
			AND = {
				this = liege.diarch
				liege = { has_diarchy_active_parameter = diarchy_is_vizierate }
			}
		}
	}
	OR = {
		MTXXX_liege_flouts_council_faith_tradition_trigger = { LIEGE = $COURT_OWNER$ }
		is_ruler = yes
		AND = {
			is_female = yes
			$COURT_OWNER$.faith = { NOT = { has_doctrine_parameter = male_dominated_council } }
		}
		AND = {
			is_male = yes
			$COURT_OWNER$.faith = { NOT = { has_doctrine_parameter = female_dominated_council } }
		}
	}
}

can_be_steward_trigger = {
	can_be_councillor_basics_trigger = yes
	$COURT_OWNER$ ?= {
		NOT = { government_has_flag = government_is_nomadic }
	}
	NAND = {
		has_council_position = councillor_court_chaplain
		faith = { has_doctrine_parameter = clerical_appointment_fixed }
	}
	NOT = {
		OR = { 
			has_council_position = councillor_spouse
			AND = {
				this = liege.diarch
				liege = { has_diarchy_active_parameter = diarchy_is_vizierate }
			}
		}
	}
	OR = {
		MTXXX_liege_flouts_council_faith_tradition_trigger = { LIEGE = $COURT_OWNER$ }
		is_ruler = yes
		AND = {
			is_female = yes
			$COURT_OWNER$.faith = { NOT = { has_doctrine_parameter = male_dominated_council } }
		}
		AND = {
			is_male = yes
			$COURT_OWNER$.faith = { NOT = { has_doctrine_parameter = female_dominated_council } }
		}
	}
}

can_be_marshal_trigger = {
	can_be_councillor_basics_trigger = yes
	$COURT_OWNER$ ?= {
		NOT = { government_has_flag = government_is_nomadic }
	}
	is_hostage = no	
	NAND = {
		has_council_position = councillor_court_chaplain
		faith = { has_doctrine_parameter = clerical_appointment_fixed }
	}
	NOR = {
		has_council_position = councillor_spouse
		AND = {
			this = liege.diarch
			liege = { has_diarchy_active_parameter = diarchy_is_vizierate }
		}
	}
	OR = {
		MTXXX_liege_flouts_council_faith_tradition_trigger = { LIEGE = $COURT_OWNER$ }
		is_ruler = yes
		AND = {
			is_female = yes
			$COURT_OWNER$.faith = { NOT = { has_doctrine_parameter = male_dominated_council } }
		}
		AND = {
			is_male = yes
			$COURT_OWNER$.faith = { NOT = { has_doctrine_parameter = female_dominated_council } }
		}
		AND = {
			has_trait = shieldmaiden
			$COURT_OWNER$.culture = { has_cultural_parameter = has_access_to_shieldmaidens }
		}
	}
}

councillor_loyalty_trigger = {
	weighted_calc_true_if_value >= 50
}
