﻿# Pilgrims and Preachers - scripted triggers (second batch of contracts)

# Barony scope (a holy site barony). A fitting destination for pilgrims setting
# out from $EMPLOYER$'s capital: close enough, but not the capital itself.
ppr_escort_holy_site_trigger = {
	title_province ?= {
		NOT = { this = $EMPLOYER$.capital_province }
		squared_distance = {
			target = $EMPLOYER$.capital_province
			value < squared_distance_large
		}
	}
}

# Employer scope. Can this ruler send pilgrims to a holy site of their faith?
ppr_can_offer_escort_pilgrims_contract_trigger = {
	# Saved because prev changes meaning inside the nested blocks of the target trigger
	save_temporary_scope_as = ppr_escort_employer
	is_landed = yes
	exists = capital_province
	faith = {
		any_holy_site_barony = {
			ppr_escort_holy_site_trigger = { EMPLOYER = scope:ppr_escort_employer }
		}
	}
}

# Barony scope. A temple holding: a monastery, abbey or other religious house.
ppr_religious_house_barony_trigger = {
	title_province = { has_holding_type = church_holding }
}

# Employer scope. Is there a religious house in this ruler's realm that needs scribes?
ppr_can_offer_copy_scripture_contract_trigger = {
	is_landed = yes
	any_sub_realm_barony = { ppr_religious_house_barony_trigger = yes }
}

# Employer scope. Are there two religious houses in this ruler's realm to quarrel?
ppr_can_offer_monastic_dispute_contract_trigger = {
	is_landed = yes
	any_sub_realm_barony = {
		count >= 2
		ppr_religious_house_barony_trigger = yes
	}
}

# Employer scope. Does this ruler own a holy relic worth parading?
ppr_can_offer_relic_procession_contract_trigger = {
	has_pam_dlc_trigger = yes
	is_landed = yes
	any_character_artifact = { has_variable = pam_saint_relic_saint }
}
