martial_education_valid = {
	
	OR = {
		OR = {
			AND = {
				exists = root.father 
				root.father = {
					is_ai = no
				}
			}
			AND = {
				exists = root.mother
				root.mother = {
					is_ai = no
				}
			}
		}
		AND = {
			faith = {
				has_doctrine = doctrine_gender_male_dominated
			}
			OR = {
				is_male = yes
				culture = {
					has_cultural_tradition = tradition_fp1_performative_honour
				}
			}
		}
		#In female dominated societies, only women can participate.
		AND = {
			faith = {
				has_doctrine = doctrine_gender_female_dominated
			}
			is_female = yes
		}
		#In equal gendered societies, anyone can participate.
		faith = {
			has_doctrine = doctrine_gender_equal
		}
	}
}


good_guardian_for_ai = {

	# Check if the character has a guardian.
	any_living_character = {
		has_relation_guardian = root
		save_temporary_scope_as = guardian
	}
	
	# Check to see if this is a good guardian for the character.
	OR = {
		AND = {
			has_focus = education_diplomacy
			scope:guardian = {
				OR = {
					diplomacy >= 10
					learning >= 12
					has_trait = shrewd
					has_trait = intellect_good_1
					has_trait = intellect_good_2
					has_trait = intellect_good_3
				}

				AND = {
					is_landed = yes
					any_realm_province = {
						has_university_building_trigger = yes
					}
				}
				OR = {
					is_landed = no
					location = {
						has_university_building_trigger = yes
					}
				}
			}
		}
		AND = {
			has_focus = education_martial
			scope:guardian = {
				OR = {
					martial >= 10
					learning >= 12
					has_trait = shrewd
					has_trait = intellect_good_1
					has_trait = intellect_good_2
					has_trait = intellect_good_3
				}
				AND = {
					is_landed = yes
					any_realm_province = {
						has_university_building_trigger = yes
					}
				}
				OR = {
					is_landed = no
					location = {
						has_university_building_trigger = yes
					}
				}
			}
		}
		AND = {
			has_focus = education_stewardship
			scope:guardian = {
				OR = {
					stewardship >= 10
					learning >= 12
					has_trait = shrewd
					has_trait = intellect_good_1
					has_trait = intellect_good_2
					has_trait = intellect_good_3

					AND = {
						is_landed = yes
						any_realm_province = {
							has_university_building_trigger = yes
						}
					}
					OR = {
						is_landed = no
						location = {
							has_university_building_trigger = yes
						}
					}
				}
			}
		}
		AND = {
			has_focus = education_intrigue
			scope:guardian = {
				OR = {
					intrigue >= 10
					learning >= 12
					has_trait = shrewd
					has_trait = intellect_good_1
					has_trait = intellect_good_2
					has_trait = intellect_good_3
					
				AND = {
					is_landed = yes
					any_realm_province = {
						has_university_building_trigger = yes
					}
				}
				OR = {
					is_landed = no
					location = {
						has_university_building_trigger = yes
					}
				}
				}
			}
		}
		AND = {
			has_focus = education_learning
			scope:guardian = {
				OR = {
					learning >= 10
					has_trait = shrewd
					has_trait = intellect_good_1
					has_trait = intellect_good_2
					has_trait = intellect_good_3

					AND = {
						is_landed = yes
						any_realm_province = {
							has_university_building_trigger = yes
						}
					}
					OR = {
						is_landed = no
						location = {
							has_university_building_trigger = yes
						}
					}
				}
			}
		}
	}

}