﻿lwxxx_give_claim_interaction = {
	category = interaction_category_diplomacy
	desc = lwxxx_give_claim_interaction_desc

	ignores_pending_interaction_block = yes
	use_diplomatic_range = no
	auto_accept = yes
	show_effects_in_notification = no

	is_shown = {
		scope:actor = {
			is_ai = no
			is_landed = yes
			has_realm_law = last_will_succession_law
			any_held_title = {
				has_title_law = lwxxx_last_will_elective_succession_law
			}
		}
		not = { scope:recipient = scope:actor }
	}
	
	on_send = {
		scope:actor = {
			lwxxx_build_titles_list_effect = { MODE = claim }
			set_variable = lwxxx_title_interaction_claim
			lwxxx_window_open_effect = { CHARACTER = scope:recipient }
		}
	}
}

lwxxx_select_abdication_title_interaction = {
	category = interaction_category_diplomacy
	desc = lwxxx_select_abdication_title_interaction_desc

	ignores_pending_interaction_block = yes
	use_diplomatic_range = no
	auto_accept = yes
	show_effects_in_notification = no

	is_shown = {
		scope:actor = {
			is_ai = no
			is_landed = yes
			has_realm_law = last_will_succession_law
		}
		scope:recipient = scope:actor
	}
	
	on_send = {
		scope:actor = {
			lwxxx_build_titles_list_effect = { MODE = abdication }
			set_variable = lwxxx_title_interaction_abdication
			lwxxx_window_open_effect = { CHARACTER = scope:actor }
		}
	}
}

lwxxx_abdication_interaction = {
	category = interaction_category_diplomacy
	desc = lwxxx_abdication_interaction_desc

	common_interaction = no
	use_diplomatic_range = no
	auto_accept = yes

	is_shown = {
		scope:actor = {
			is_ai = no
			or = {
				is_landed_or_landless_administrative = yes
				is_landless_adventurer = yes
			}
			has_realm_law = last_will_succession_law
			exists = player_heir
		}
		scope:recipient = scope:actor
	}

	on_accept = {
		scope:actor = {
			if = {
				limit = {
					any_held_title = {
						has_variable = lwxxx_title_abdicator
					}
					number_of_concubines > 0
				}
	
				every_concubine = {
					limit = { is_alive = yes }

					save_temporary_scope_as = lwxxx_concubine
					scope:actor = { add_to_variable_list = { name = lwxxx_concubines_list target = scope:lwxxx_concubine } }
				}
			}

			save_scope_as = lwxxx_deposed_character

			player_heir = {
				trigger_event = { id = lwxxx_event.0100 days = 1 }
			}

			hidden_effect = {
				depose = yes
			}
		}
	}

	ai_will_do = {
		base = 0
	}
}
