﻿is_tributary_or_independent_neighbor_of_china_trigger = {
	NOT = { has_title = title:h_china }
	OR = {
		custom_tooltip = {
			text = suzerain_is_china
			is_tributary_of = title:h_china.holder
		}
		custom_tooltip = {
			text = neighbor_is_china
			is_tributary = no
			is_independent_ruler = yes
			OR = {
				has_variable = wants_to_become_tributary_of_china
				any_neighboring_top_liege_realm_owner = {
					primary_title = title:h_china
				}
			}
		}
	}
}

is_already_tribute_missioning_trigger = {
	# set once we start travelling, if it becomes invalid we should no longer be treated as being on the mission
	exists = var:tribute_mission_target_scope
	# assure we are currently going to our overlord's capital, or else we're no longer on the mission 
	current_travel_plan ?= {
		final_destination_province = prev.var:tribute_mission_target_scope.capital_province
	}
}

has_gold_tribute_trigger = {
	short_term_gold >= small_gold_tribute_value
}

has_herd_tribute_trigger = {
	trigger_if = {
		limit = { government_has_flag = government_is_nomadic }
		domicile ?= { herd >= minor_herd_value }
	}
	trigger_else = {
		government_has_flag = government_is_nomadic
	}
}

is_suitable_artifact_tribute_trigger = {
	NOR = {
		has_variable = 1025_treasure_map
		has_variable = ungiftable
		has_variable = cursed_artifact
		has_variable = gifted_artifact
	}
	is_equipped = no
}

has_artifact_tribute_trigger = {
	custom_tooltip = {
		text = tribute_mission_concubine_interaction.no_valid_artifacts
		any_character_artifact = { is_suitable_artifact_tribute_trigger = yes }
	}
}

has_concubine_tribute_trigger = {
	overlord = { 
		is_adult = yes
		save_temporary_scope_as = overlord_check
	}
	custom_tooltip = {
		text = tribute_mission_concubine_interaction.no_valid_concubines
		any_courtier_or_guest = {
			can_become_concubine_of_character_valid_trigger = { CHARACTER = scope:overlord_check }
		}
	}
}

tribute_mission_is_available_eunuch_trigger = {
	is_available = yes
	is_ruler = no
	is_playable_character = no
	OR = {
		is_eunuch_trigger = yes
		AND = {
			is_female = no
			is_adult = yes
		}		
	}
	NOT = {
		faith = { has_doctrine = doctrine_theocracy_temporal }
	}
	trigger_if = {
		limit = { exists = root.cp:councillor_court_chaplain }
		NOT = { this = root.cp:councillor_court_chaplain }
	}
	has_any_disease_trigger = no
}

has_eunuch_tribute_trigger = {
	custom_tooltip = {
		text = tribute_mission_eunuch_interaction.no_valid_eunuchs
		any_courtier = { tribute_mission_is_available_eunuch_trigger = yes }	
	}
}
