﻿can_be_knight_trigger = {
	## mr_mod
	trigger_if = {
		limit = {
			has_game_rule = player_can_be_knight_enabled
			is_ai = no
		}
		NOT = { has_variable = mr_player_un_knight }
		is_travelling = no
		trigger_if = {
			limit = { exists = involved_activity }
			involved_activity = { has_activity_type = activity_tournament }
		}
	}
	## end
	is_available_quick = {
		ai = yes
		hostage = no
	}
	can_be_warrior_trigger = { ARMY_OWNER = $ARMY_OWNER$ }
	trigger_if = { # Admin governors cannot be knights
		limit = {
			$ARMY_OWNER$ = { government_allows = administrative }
			is_courtier = no
		}
		primary_title ?= {
			tier < tier_duchy
			trigger_if = {
				limit = { is_noble_family_title = yes }
				always = no
			}
		}
	}
	trigger_if = {
		limit = {
			$ARMY_OWNER$.culture = {
				has_cultural_parameter = minimum_prowess_for_knights
			}
		}
		prowess >= 12
	}
	trigger_if = {
		limit = {
			is_clergy = yes
		}
		OR = {
			faith = { has_doctrine_parameter = clergy_can_fight }
			culture = { has_cultural_parameter = culture_clergy_can_fight }
			AND = {
				$ARMY_OWNER$.culture = {
					has_cultural_parameter = high_prowess_ignores_knight_restrictions
				}
				prowess >= 10
			}
		}
	}
	OR = {
		AND = {
			$ARMY_OWNER$.culture = {
				has_cultural_parameter = high_prowess_ignores_knight_restrictions
			}
			prowess >= 10
		}
		has_trait = order_member # Order Members will fight for their faith even if their faith says no
		NOR = {
			has_trait = blind
			has_court_position = master_assassin_court_position #FP3 addition
		}
	}
	trigger_if = {
		limit = {
			exists = liege.diarch
		}
		this != liege.diarch
	}
	## mr_mod replace
	trigger_if = {
		limit = { has_game_rule = player_can_be_knight_disabled }
		is_ai = yes
	}
	trigger_if = {
		limit = {
			OR = {
				prowess < 25
				has_game_rule = player_can_be_knight_disabled
			}
		}
		is_ai = yes
		#KMC Conditions
		KM_can_be_knight_trigger = { ARMY_OWNER = $ARMY_OWNER$ }
	}
	## end
}

## mr_mod triggers

has_army_in_ruler_realm = {
	any_army = {
		location ?= {
			province_owner ?= {
				OR = {
					this = $RULER$
					any_liege_or_above = { this = $RULER$ }
				}
			}
		}
	}
}