﻿councillor_leaving_effect = {
	if = {
		limit = {
			NOT = { is_councillor_of = scope:old_employer } 
			scope:old_employer = {
				government_allows = council
			}
			NAND = { # Work around to hide the fact they are kicked from your court when travelling for marriage
				is_married = yes
				has_variable = ttd_start_location
				scope:old_employer.primary_spouse ?= this
			}
		}
		scope:old_employer = {
			send_interface_message = {
				type = event_generic_neutral
				title = councillor_leaving_court_message_title
				left_icon = scope:councillor
				# Councillor leaving because of marriage
				scope:councillor = {
					if = {
						limit = {
							is_playable_character = no
							is_married = yes
							primary_spouse = { is_playable_character = yes }
						}
						custom_tooltip = councillor_leaving_court_marriage_notification
					}
					# Councillor leaving because of title inheritance
					else_if = {
						limit = {
							is_playable_character = yes
							NOT = { is_vassal_of = scope:old_employer }
						}
						custom_tooltip = councillor_leaving_court_landed_notification
					}
					# Generic fallback
					else = { custom_tooltip = councillor_leaving_court_generic_fallback_notification }
				}
			}
		}
	}
}
