﻿# Pick a favorite child to pre-select when choosing your destiny
choose_favorite_interaction = {
	category = interaction_category_friendly
	icon = designate_favorite

	desc = choose_favorite_interaction_desc

	is_shown = {
		scope:actor = { is_ai = no }
		scope:recipient.dynasty = scope:actor.dynasty
		NOT = { scope:actor = scope:recipient }
	}

	is_valid_showing_failures_only = {
		scope:actor = { is_alive = yes }
		scope:recipient = { is_favorite_child = no }
		scope:recipient = {
			custom_tooltip = {
				text = cant_be_another_player_tt
				is_ai = yes
			}
			custom_tooltip = {
				text = must_be_direct_descendant_tt
				OR = {
					is_child_of = scope:actor
					is_grandchild_of = scope:actor
					is_great_grandchild_of = scope:actor
				}
			}
			custom_tooltip = {
				text = favorite_child_must_be_in_good_health_tt
				NOR = {
					has_trait = incapable
					health <= 2.5
				}
			}
			custom_tooltip = {
				text = cant_be_hostage_tt
				is_hostage = no
			}
			custom_tooltip = {
				text = cant_already_be_your_heir
				NOT = {
					this = scope:actor.player_heir
				}
			}
		}
	}

	on_auto_accept = {
		scope:recipient = {
			send_interface_message = {
				title = choose_favorite_interaction_notification
				left_icon = scope:actor
				show_as_tooltip = {
					scope:actor = {
						set_relation_favorite_child = { reason = favorite_child_chosen target = scope:recipient }
					}
				}
			}
		}
	}

	on_accept = {
		assign_favourite_child_effect = {
			ACTOR = scope:actor
			RECIPIENT = scope:recipient
		}
	}

	auto_accept = yes
}