﻿# Ask an in-law ruler you chose Truce or Neither with for a full alliance after all.
# Only shown for rulers with a recorded Truce/Neither choice (nmt_bond_memory_effects.txt).
nmt_propose_inlaw_alliance_interaction = {
	category = interaction_category_diplomacy
	icon = alliance
	desc = nmt_propose_inlaw_alliance_interaction_desc
	interface_priority = 55
	greeting = positive
	ai_min_reply_days = 1
	ai_max_reply_days = 5

	cooldown_against_recipient = { years = 3 }

	is_shown = {
		NOT = { scope:recipient = scope:actor }
		scope:actor = {
			is_ai = no
			OR = {
				is_target_in_variable_list = { name = nmt_choice_truce_v1 target = scope:recipient }
				is_target_in_variable_list = { name = nmt_choice_neither_v1 target = scope:recipient }
			}
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			NOT = { is_allied_to = scope:recipient }
			NOT = { is_at_war_with = scope:recipient }
			# The game will not ally two rulers with a truce, and a truce from a war (which
			# the marriage truce is waiting on) cannot be cancelled.
			custom_tooltip = {
				text = nmt_propose_inlaw_alliance_war_truce
				NOT = { is_target_in_variable_list = { name = nmt_waiting_truce_v1 target = scope:recipient } }
			}
		}
		scope:recipient = {
			is_imprisoned = no
			nmt_valid_truce_pair_trigger = { PLAYER = scope:actor }
		}
	}

	cost = {
		prestige = 100
	}

	ai_accept = {
		base = 0

		opinion_modifier = {
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 1
			desc = AI_OPINION_REASON
		}
		modifier = {
			add = 20
			desc = nmt_ai_reason_family_ties
			scope:recipient = { is_alive = yes }
		}
		modifier = {
			add = 25
			desc = nmt_ai_reason_needs_allies
			scope:recipient = { is_at_war = yes }
		}
		modifier = {
			add = -15
			desc = nmt_ai_reason_your_wars
			scope:actor = { is_at_war = yes }
		}
		modifier = {
			add = 15
			desc = nmt_ai_reason_powerful_inlaw
			scope:actor.primary_title.tier > scope:recipient.primary_title.tier
		}
		modifier = {
			add = 10
			desc = nmt_ai_reason_ambitious
			scope:recipient = { has_trait = ambitious }
		}
		modifier = {
			add = -25
			desc = nmt_ai_reason_paranoid
			scope:recipient = { has_trait = paranoid }
		}
	}

	on_accept = {
		scope:actor = {
			nmt_upgrade_to_alliance_effect = { RULER = scope:recipient }
		}
	}

	on_decline = {
		scope:actor = {
			send_interface_toast = {
				type = event_toast_effect_bad
				title = nmt_propose_inlaw_alliance_declined
				left_icon = scope:recipient
			}
		}
	}

	# Player-only: without ai_frequency the AI never sends this.
}
