decisions = {

	restore_visigothic_kingdom = {
		only_independent = yes
		is_high_prio = yes
		ai_check_interval = 12
		
		potential = {
			is_playable = yes
			has_landed_title = k_asturias
			OR = {
				culture = visigothic
				culture = old_visigothic
			}
			religion_group = christian
		}
		
		allow = {
			primary_title = { title = k_asturias }
			completely_controls = c_toledo
			completely_controls = c_sevilla
			completely_controls = c_granada
			completely_controls = c_cordoba
			completely_controls = c_santiago
			completely_controls = c_barcelona
			completely_controls = c_lisboa
			is_adult = yes
			prisoner = no
			is_incapable = no
			war = no
			wealth = 400
			piety = 200
		}
		
		effect = {
			wealth = -400
			piety = -200
			culture = old_visigothic
			
			hidden_tooltip = {
			if = {
				limit = { has_nickname = no }
				give_nickname = nick_the_great
			}
			add_dynasty_modifier = ruling_in_crusader_kingdom
			primary_title = {
				any_direct_de_jure_vassal_title = {
					de_jure_liege = e_visigothica
				}
			}
			
			capital_scope = { culture = old_visigothic }
			any_courtier_or_vassal = {
				limit = { lower_tier_than = DUKE }
				culture = old_visigothic
			}
			any_realm_province = {
				if = {
					limit = { any_neighbor_province = { province = 197 } }
					culture = old_visigothic
				}
				if = {
					limit = { 
						OR = { 
							culture_group = iberian 
							culture_group = latin
							culture = andalusian_arabic
						}
						NOT = { distance = { where = 197 distance = 4 } }
					}
					random = {
						chance = 40
						culture = old_visigothic
					}
				}
				if = {
					limit = { 
						OR = { 
							culture_group = iberian 
							culture_group = latin
							culture = andalusian_arabic
						}
						NOT = { distance = { where = 197 distance = 6 } }
					}
					random = {
						chance = 20
						culture = old_visigothic
					}
				}
				if = {
					limit = { 
						OR = { 
							culture_group = iberian 
							culture_group = latin
							culture = andalusian_arabic
						}
						NOT = { distance = { where = 197 distance = 26 } }
					}
					random = {
						chance = 10
						culture = old_visigothic
					}
				}
			}
			
			
			d_asturias = {
				de_jure_liege = e_visigothica
			}
			d_leon = {
				de_jure_liege = e_visigothica
			}
			k_asturias = {
				de_jure_liege = e_visigothica
			}
			
			succession = feudal_elective
			gender_succ = cognatic
			
			e_visigothica = {
			show_scope_change = no
			grant_title = ROOT
			hidden_tooltip = { make_primary_title = yes }
			copy_title_laws = k_asturias
			copy_title_history = k_asturias
			}
			
			k_asturias = {
			show_scope_change = no
			destroy_landed_title = THIS
			}
			
			activate_title = { title = k_asturias status = no }
			
			create_bloodline = {
				type = visigothic_restorer_bloodline
			}
			
			sound_effect = bloodline_added
		   }
		}
	}
	
}