﻿# Leo VI's Mass Vassal Directives - exempt toggle interactions
#
# An exempt vassal is passed over by the rules entirely, and shows their
# directive icon dimmed; set theirs by hand with vanilla's Give Vassal Directive.
#
# No ai_potential or ai_targets, so the AI never uses these - they are the
# player's way of carving a vassal out of their own automation.

leo_mvd_exempt_interaction = {
	category = interaction_category_vassal
	icon = icon_scheme_challenge_status
	interface_priority = 55
	desc = leo_mvd_exempt_interaction_desc

	auto_accept = yes

	# Shown for exactly the vassals vanilla's Give Vassal Directive is shown for,
	# and additionally only for a human actor and a vassal not already exempt.
	# That includes a puppet's vassals once the player has the rules reach them:
	# vanilla offers those a directive through the puppet, and this is offered in
	# the ordinary menu instead, since a puppet action has to be declared in the
	# game's own puppet types. The vanilla mirror lives in one place, so it cannot
	# drift between here and the rules.
	is_shown = {
		scope:actor = { is_ai = no }
		scope:recipient = {
			OR = {
				leo_mvd_directive_shown_trigger = { LIEGE = scope:actor }
				leo_mvd_puppet_directed_trigger = { ACTOR = scope:actor }
			}
			NOT = { has_variable = leo_mvd_exempt }
		}
	}

	# Grays out under exactly the same conditions as Give Vassal Directive,
	# so exemption is only offered where a directive could actually be given
	# (these mirror that interaction's is_valid / is_valid_showing_failures_only),
	# asked of whichever liege the directive would come from.
	is_valid = {
		leo_mvd_directing_liege_check_trigger = { ACTOR = scope:actor VASSAL = scope:recipient CHECK = vassal_follows_directive_trigger }
	}
	is_valid_showing_failures_only = {
		leo_mvd_directing_liege_check_trigger = { ACTOR = scope:actor VASSAL = scope:recipient CHECK = vassal_follows_directive_valid_trigger }
		scope:recipient = { is_physically_able = yes }
	}

	on_accept = {
		custom_tooltip = leo_mvd_exempt_tt
		scope:recipient = {
			set_variable = leo_mvd_exempt
		}
	}

	# No ai_frequency: the AI never evaluates this interaction (player-only,
	# also gated by is_ai = no on the actor in is_shown).
}

leo_mvd_unexempt_interaction = {
	category = interaction_category_vassal
	icon = icon_scheme_challenge_status
	interface_priority = 54
	desc = leo_mvd_unexempt_interaction_desc

	auto_accept = yes

	# Deliberately ungated beyond "is currently exempt": an exemption must
	# always be removable, even if the vassal has since become ineligible for
	# directives (rival, at war, disloyal, etc.). Gating this like the exempt
	# interaction would trap such vassals in a permanent exemption.
	is_shown = {
		scope:actor = { is_ai = no }
		scope:recipient = {
			has_variable = leo_mvd_exempt
		}
	}

	on_accept = {
		custom_tooltip = leo_mvd_unexempt_tt
		scope:recipient = {
			remove_variable = leo_mvd_exempt
		}
	}

	# No ai_frequency: the AI never evaluates this interaction (player-only,
	# also gated by is_ai = no on the actor in is_shown).
}
