﻿# Read-only proposal checks. PLAYER is the human arranging the marriage.
# Existence of any qualifying candidate matches the existing picker; its
# priority/rank only matters when selecting WHICH eligible ruler to use.
nmt_partner_has_eligible_ruler_trigger = {
	OR = {
		nmt_valid_truce_pair_trigger = { PLAYER = $PLAYER$ }
		AND = {
			exists = var:nmt_prev_court
			var:nmt_prev_court = {
				nmt_valid_truce_pair_trigger = { PLAYER = $PLAYER$ }
			}
		}
		AND = {
			exists = court_owner
			court_owner = {
				nmt_valid_truce_pair_trigger = { PLAYER = $PLAYER$ }
			}
		}
		any_close_family_member = {
			nmt_valid_truce_pair_trigger = { PLAYER = $PLAYER$ }
		}
	}
}

# Only the ruler and close family qualify on the player side; courtiers do not.
nmt_spouse_reaches_player_trigger = {
	OR = {
		this = $PLAYER$
		is_close_family_of = $PLAYER$
	}
}

# Either orientation of the actual selected couple can connect the player.
# The chooser's court alone is not sufficient: check the two selected spouses.
nmt_proposal_has_foreign_connection_trigger = {
	OR = {
		AND = {
			scope:secondary_actor = {
				nmt_spouse_reaches_player_trigger = { PLAYER = scope:actor }
			}
			scope:secondary_recipient = {
				nmt_partner_has_eligible_ruler_trigger = { PLAYER = scope:actor }
			}
		}
		AND = {
			scope:secondary_recipient = {
				nmt_spouse_reaches_player_trigger = { PLAYER = scope:actor }
			}
			scope:secondary_actor = {
				nmt_partner_has_eligible_ruler_trigger = { PLAYER = scope:actor }
			}
		}
	}
}
