targetted_decisions = {
	release_as_tributary = {
		from_potential = {
			ai = no
			independent = yes
			is_ruler = yes
		}
		potential = {
			liege = { character = FROM }
			is_patrician = no 
			higher_tier_than = baron
		}
		allow = {
		    FROM = {
				war = no
			}
			liege = { 
				character = FROM 
			}
			war = no
		}
		effect = {
			set_defacto_liege = ROOT
		    FROM = {
			    show_scope_change = no
			    make_tributary = { who = ROOT percentage = 0.4 }
		    }
		}
		ai_will_do = {
			factor = 0
		}
	}
	
	release_as_tributary_state = {
		from_potential = {
			ai = no
			independent = yes
			is_ruler = yes
		}
		potential = {
			liege = { character = FROM }
			is_patrician = no 
			higher_tier_than = baron
		}
		allow = {
		    FROM = {
				TECH_MAJESTY = 4
				war = no
			}
			liege = { 
				character = FROM 
			}
			war = no
		}
		effect = {
			set_defacto_liege = ROOT
			FROM = {
				make_tributary = { 
					who = PREV
					tributary_type = permanent
				}
			}
		}
		ai_will_do = {
			factor = 0
		}
	}
}

decisions = {

    AE_abdication = { #Abdication decision
		ai_check_interval = 180
		potential = {
			age = 16
		}
	    allow = {
			war = no
		    prisoner = no
			in_command = no
			NOT = { is_inaccessible_trigger = yes }
			current_heir = {
 			    dynasty = ROOT
				NOT = { is_rival = ROOT }
			}
			OR = {
			    age = 50
				trait = infirm
			    trait = inbred
				trait = imbecile
			}
			NOT = {
				trait = incapable
			}
		}
		effect = {
		    prestige = -500
			current_heir = {
				save_event_target_as = target_abdicate_heir
			}
			any_artifact = {
				limit = { 
				    NOT = { has_artifact_flag = no_inherit }
				}
				transfer_artifact = {
					from = ROOT
					to = event_target:target_abdicate_heir
				}
			}
			current_heir = {
				inherit = ROOT
				wealth = ROOT
				clear_event_target = target_abdicate_heir
			}
			clear_wealth = yes
			ROOT = { #Claim cleanup
			    character_event = { id = AE.10 }
			}
		}
		ai_will_do = {
			factor = 10
			modifier = {
			    factor = 100
				OR = {
				    trait = depressed
					trait = content
					trait = humble
				}
			}
			modifier = {
			    factor = 100
				OR = {
					trait = imbecile
					trait = inbred
				}
			}
			modifier = {
			    factor = 50
			    trait = stressed
				NOR = {
				    trait = diligent
					trait = ambitious
					trait = proud
					trait = envious
					trait = greedy
				}
			}
			modifier = {
			    factor = 50
				trait = infirm
			}
			modifier = {
			    factor = 25
				age = 60
				NOR = {
				    trait = diligent
					trait = ambitious
					trait = proud
					trait = envious
					trait = greedy
				}
			}
			modifier = {
			    factor = 0
				OR = {
					trait = ambitious
					trait = proud
					trait = envious
					trait = greedy
				}
			}
		}
	}

	restore_scotland = {
		only_independent = yes
		is_high_prio = yes
		ai_check_interval = 60
		
		potential = {
			has_landed_title = d_albany
			OR = {
			    culture = pictish
				culture = scottish
			}
			k_scotland = {
				has_holder = no
			}
			k_scotland = {
				is_titular = yes
			}
			NOR = {
				has_alternate_start_setting = {
					setting = dejure
					option = random
				}
				has_alternate_start_setting = {
					setting = title_names
					option = random
				}
				has_alternate_start_setting = {
					setting = title_names
					option = random_including_duchies
				}
			}
		}
		allow = {
			is_adult = yes
			independent = yes
			war = no
			NOT = { trait = incapable }
			completely_controls = d_albany
			conditional_tooltip = {
				trigger = {
					ai = no
				}

				prestige = 1000
			}
			wealth = 100
		}
		effect = {
			wealth = -100
			prestige = 500
			primary_title = {
				save_event_target_as = current_primary_title
			}
			k_scotland = {
				show_scope_change = no
				grant_title = ROOT
				copy_title_laws = event_target:current_primary_title
			}
			d_albany = {
				show_scope_change = no
				de_jure_liege = k_scotland
			}
			if = {
				limit = { completely_controls = d_lothian }
				d_lothian = {
					show_scope_change = no
					de_jure_liege = k_scotland
				}
			}
			if = {
				limit = { completely_controls = d_western_isles }
				d_western_isles = {
					show_scope_change = no
					de_jure_liege = k_scotland
				}
			}
			if = {
				limit = { completely_controls = d_galloway }
				d_galloway = {
					show_scope_change = no
					de_jure_liege = k_scotland
				}
			}
			if = {
				limit = { completely_controls = d_the_isles }
				d_the_isles = {
					show_scope_change = no
					de_jure_liege = k_scotland
				}
			}
			if = {
				limit = { completely_controls = d_moray }
				d_moray = {
					show_scope_change = no
					de_jure_liege = k_scotland
				}
			}
			if = {
				limit = {
					has_landed_title = c_gowrie
					NOT = { capital_scope = { province_id = 43 } }

				}
				c_gowrie = { 
					show_scope_change = no
					ROOT = { 
						show_scope_change = no
						capital = PREV 
					} 
				}
			}
			if = {
				limit = { has_nickname = no }
				give_nickname = nick_the_restorer
			}
			hidden_tooltip = { character_event = { id = AE.1 } }
		}
		ai_will_do = {
			factor = 10
		}
	}
	
	restore_ireland = {
		only_independent = yes
		is_high_prio = yes
		ai_check_interval = 60
		
		potential = {
			has_landed_title = d_meath
			culture = irish
			k_ireland = {
				has_holder = no
			}
			k_ireland = {
				is_titular = yes
			}
			NOR = {
				has_alternate_start_setting = {
					setting = dejure
					option = random
				}
				has_alternate_start_setting = {
					setting = title_names
					option = random
				}
				has_alternate_start_setting = {
					setting = title_names
					option = random_including_duchies
				}
			}
		}
		allow = {
			is_adult = yes
			independent = yes
			war = no
			NOT = { trait = incapable }
			completely_controls = d_meath
			conditional_tooltip = {
				trigger = {
					ai = no
				}

				prestige = 1000
			}
			wealth = 100
		}
		effect = {
			wealth = -100
			prestige = 500
			primary_title = {
				save_event_target_as = current_primary_title
			}
			k_ireland = {
				show_scope_change = no
				grant_title = ROOT
				copy_title_laws = event_target:current_primary_title
			}
			d_meath = {
				show_scope_change = no
				de_jure_liege = k_ireland
			}
			if = {
				limit = { completely_controls = d_ulster }
				d_ulster = {
					show_scope_change = no
					de_jure_liege = k_ireland
				}
			}
			if = {
				limit = { completely_controls = d_connacht }
				d_connacht = {
					show_scope_change = no
					de_jure_liege = k_ireland
				}
			}
			if = {
				limit = { completely_controls = d_galloway }
				d_leinster = {
					show_scope_change = no
					de_jure_liege = k_ireland
				}
			}
			if = {
				limit = { completely_controls = d_munster }
				d_munster = {
					show_scope_change = no
					de_jure_liege = k_ireland
				}
			}
			if = {
				limit = {
					has_landed_title = c_dublin
					NOT = { capital_scope = { province_id = 11 } }

				}
				c_dublin = { 
					show_scope_change = no
					ROOT = { 
						show_scope_change = no
						capital = PREV 
					} 
				}
			}
			if = {
				limit = { has_nickname = no }
				give_nickname = nick_the_restorer
			}
			hidden_tooltip = { character_event = { id = AE.2 } }
		}
		ai_will_do = {
			factor = 10
		}
	}
}