﻿###################
# MARTIAL CUSTOMS #
###################
# The conditions for each martial custom depends on the active game rules.

martial_custom_male_only = {
	type = martial_custom
	
	parameters = {
		martial_custom_male_only_combatant = yes
	}
	
	can_pick = {
		trigger_if = {
			limit = {
				has_game_rule = default_gender_equality
			}
			always = yes
		}
		custom_tooltip = {
			text = martial_customs_trigger_maleonly_malepref_or_equal
			
			trigger_if = {
				limit = {
					has_game_rule = full_gender_equality
				}
				OR = {
					scope:character = { has_realm_law = male_only_law }
					scope:character = { has_realm_law = male_preference_law }
					scope:character = { has_realm_law = equal_law }
				}
			}
		}
		custom_tooltip = {
			text = martial_customs_trigger_maleonly_or_male_pref
			
			trigger_if = {
				limit = {
					has_game_rule = inversed_gender_equality
				}
				OR = {
					scope:character = { has_realm_law = male_only_law }
					scope:character = { has_realm_law = male_preference_law }
				}
			}
		}
	}
	
	ai_will_do = {
		value = 1
	}
}

martial_custom_equal = {
	type = martial_custom
	
	parameters = {
		martial_custom_equal_combatant = yes
	}
	
	can_pick = {
		custom_tooltip = {
			text = martial_customs_trigger_femaleonly_femalepref_or_equal
			
			trigger_if = {
				limit = {
					has_game_rule = default_gender_equality
				}
				OR = {
					scope:character = { has_realm_law = female_only_law }
					scope:character = { has_realm_law = female_preference_law }
					scope:character = { has_realm_law = equal_law }
				}
			}
		}
		custom_tooltip = {
			text = martial_customs_trigger_malepref_felamepref_or_equal
			
			trigger_if = {
				limit = {
					has_game_rule = full_gender_equality
				}
				OR = {
					scope:character = { has_realm_law = male_preference_law }
					scope:character = { has_realm_law = female_preference_law }
					scope:character = { has_realm_law = equal_law }
				}
			}
		}
		custom_tooltip = {
			text = martial_customs_trigger_maleonly_malepref_or_equal
			
			trigger_if = {
				limit = {
					has_game_rule = inversed_gender_equality
				}
				OR = {
					scope:character = { has_realm_law = male_only_law }
					scope:character = { has_realm_law = male_preference_law }
					scope:character = { has_realm_law = equal_law }
				}
			}
		}
	}
	
	ai_will_do = {
		value = 0
		
		if = {
			limit = {
				any_in_list = { list = traits this = flag:ethos_egalitarian }
				scope:character = {
					any_vassal = {
						count >= 5
						is_female = yes
						has_education_martial_trigger = yes
						highest_held_title_tier >= tier_county
					}
					any_vassal = {
						count >= 5
						is_female = no
						has_education_martial_trigger = yes
						highest_held_title_tier >= tier_county
					}
				}
			}
			add = 1
		}
	}
}

martial_custom_female_only = {
	type = martial_custom
	
	parameters = {
		martial_custom_female_only_combatant = yes
	}
	
	can_pick = {
		custom_tooltip = {
			text = martial_customs_trigger_femaleonly
			
			trigger_if = {
				limit = {
					has_game_rule = default_gender_equality
				}
				scope:character = { has_realm_law = female_only_law }
			}
		}
		custom_tooltip = {
			text = martial_customs_trigger_femaleonly_femalepref_or_equal
			
			trigger_if = {
				limit = {
					has_game_rule = full_gender_equality
				}
				OR = {
					scope:character = { has_realm_law = female_only_law }
					scope:character = { has_realm_law = female_preference_law }
					scope:character = { has_realm_law = equal_law }
				}
			}
		}
		trigger_if = {
			limit = {
				has_game_rule = inversed_gender_equality
			}
			always = yes
		}
	}
	
	ai_will_do = {
		value = 0
		
		if = {
			limit = {
				scope:character = {
					is_female = yes
					has_education_martial_trigger = yes
					any_vassal = {
						count >= 10
						is_female = yes
						has_education_martial_trigger = yes
						highest_held_title_tier >= tier_county
					}
				}
			}
			add = 1
		}
	}
}
