﻿
##################################################
# Triggers related to the tour activity

ep2_phase_general_location_checks = {
	# Don't localize all the other stuff if you have no province owner anyway
	trigger_if = {
		limit = { has_province_owner = yes }
		province_owner = {
			liege ?= scope:host
			this != scope:host
			highest_held_title_tier >= tier_county
			capital_province ?= root
			is_available = yes
			age >= 12
		}
	}
	trigger_else = {
		has_province_owner = yes
	}
}

ep2_tour_phase_invalidation_check = {
	scope:activity = {
		NOT = {
			any_activity_phase_location_past = {
				province_owner = scope:province.province_owner
			}
		}
	}
	scope:province = {
		province_owner != scope:host
		province_owner = {
			liege ?= scope:host
			location = scope:province
			highest_held_title_tier >= tier_county
			#Checks mostly matching is_available:
			is_in_army = no
			is_travelling = no
			is_imprisoned = no
			has_contagious_deadly_disease_trigger = no
			NOT = { has_trait = incapable }
			# Variable set within the adventure inspiration events
			NOT = { has_variable = gone_adventuring }
			#We don't invalidate if it stopped being the capital province.
			is_at_war = no
		}
	}
}

travel_lifestyle_track_greater_equal_trigger = {
	has_trait = lifestyle_traveler
	has_trait_xp = {
		trait = lifestyle_traveler
		track = $TRACK$
		value >= $GREATER_EQUAL$
	}
}

travel_lifestyle_track_less_trigger = {
	has_trait = lifestyle_traveler
	has_trait_xp = {
		trait = lifestyle_traveler
		track = $TRACK$
		value < $LESS_THAN$
	}
}

is_being_visited_on_tour_strict = {
	has_character_flag = being_visited_on_tour
	# Extra sanity check to verify that our liege is actually still on a tour
	liege ?= {
		involved_activity ?= { has_activity_type = activity_tour }
	}
}
