﻿# scope:ttd_newlywed - character travelling to new court for marriage
# scope:ttd_spouse - character to which the newlywed was just married
# scope:ttd_host - character to which court the newlywed is travelling
on_ttd_newlywed_depart_for_hosts_court = {
	effect = {
		scope:ttd_newlywed = {
			remove_variable = ttd_start_location # Clean up, here so it for sure is removed after councillor_leaving_effect
			set_variable = { # Used to prevent interaction and cancel travel plan if the newlywed inherits title
				name = ttd_newlywed_traveling_to_court_of
				value = scope:ttd_host
				years = 5 # So it will eventually go away if travel plan somehow gets cancelled
			}
		}
		scope:ttd_host = {
			send_interface_toast = {
				title = ttd_newlywed_departs_title
				left_icon = scope:ttd_newlywed
				right_icon = scope:ttd_spouse
				custom_tooltip = ttd_newlywed_departs_tt
			}
		}
	}
}

# scope:ttd_newlywed - character travelling to new court for marriage
# scope:ttd_spouse - character to which the newlywed was just married
# scope:ttd_host - character to which court the newlywed is travelling
on_ttd_newlywed_cancels_departure_for_hosts_court = {
	effect = {
		scope:ttd_newlywed = { ttd_newlywed_travel_to_hosts_court_clean_up_effect = yes }
	}
}

# scope:ttd_newlywed - character travelling to new court for marriage
# scope:ttd_spouse - character to which the newlywed was just married
# scope:ttd_host - character to which court the newlywed is travelling
on_ttd_newlywed_arrive_at_hosts_court = {
	effect = {
		scope:ttd_newlywed = {
			if = {
				limit = { any_spouse = { this = scope:ttd_spouse } } # Make sure they are still married
				scope:ttd_spouse = {
					send_interface_message = {
						type = event_generic_good_text
						title = ttd_newlywed_returned_home_title
						desc = ttd_newlywed_returned_home_desc
						left_icon = scope:ttd_newlywed
						ao_ttd_add_character_to_same_court_effect = { CHARACTER = scope:ttd_newlywed }
					}
				}
			}
			ttd_newlywed_travel_to_hosts_court_clean_up_effect = yes
		}
	}
}