# Settlement decisions are possible vs _all_ settlements and are shown in the Settlement Diplomacy View, not the Intrigue View. The taker is in the FROM scope.
#
# filter = [capital/owned/vassal_owned/sub_realm_owned/realm_owned/dynasty_owned/all]
# ai_target_filter = [capital/owned/vassal_owned/sub_realm_owned/realm_owned/dynasty_owned/all] (which settlements for which the AI evaluates the decision.)
#	owned: all settlements owned by the AI
#	vassal_owned: all settlements owned by direct vassal rulers of the AI's employer
#	sub_realm_owned: all settlements below the AI's employer
#	realm_owned: all settlements in the same top realm as the AI
#	dynasty_owned: all settlements owned by members of the same dynasty
#	all: all settlements (Avoid if possible. VERY CPU-HEAVY!)
#	

settlement_decisions = {

	get_rid_of_settlement = {
		filter = owned
		ai_target_filter = owned
		
		from_potential = {
			ai = no
			is_nomadic = no
		}	
		potential = {
			has_siege = no
			controlled_by = FROM
			owner = { character = FROM }
		}
		allow = {
			is_capital = no
			FROM = {
				war = no
				independent = yes
			}
			custom_tooltip = {
				text = ONE_OTHER_HOLDING_TYPE
				hidden_tooltip = {
					OR = {
						AND = {
							holding_type = castle
							location = {
								any_province_holding = {
									holding_type = castle
									count = 2
								}
							}
						}
						AND = {
							holding_type = city
							location = {
								any_province_holding = {
									holding_type = city
									count = 2
								}
							}
						}
						AND = {
							holding_type = temple
							location = {
								any_province_holding = {
									holding_type = temple
									count = 2
								}
							}
						}
					}
				}
			}
			location = {
				NOT = { has_province_modifier = province_chaos }
				owner = { character = FROM }
				duchy = { holder = FROM }
			}
		}
		effect = {
			destroy_settlement = THIS
		}
		ai_will_do = {
			factor = 0
		}
	}
	
	nomad_absorb_tribal = {
		filter = vassal_owned
		ai_target_filter = vassal_owned
		is_high_prio = yes
		ai_check_interval = 3
		from_potential = {
			is_nomadic = yes
		}
		potential = {
			holding_type = tribal
			has_siege = no
			owner = {
				tier = BARON
				vassal_of = FROM
			}
		}
		allow = {
			FROM = { war = no }
			location = {
				culture = FROM
				religion = FROM
			}
		}
		effect = {
			holder_scope = { save_event_target_as = old_holder }
			location = { county = { save_event_target_as = county_title } }
			FROM = {
				wealth = 10
				random_list = {
					10 = { military_techpoints = 2 }
					10 = { economy_techpoints = 2 }
					10 = { culture_techpoints = 2 }
				}
			}
			destroy_settlement = THIS
			hidden_tooltip = {
				event_target:old_holder = {
					if = {
						limit = {
							culture = FROM
							religion = FROM
						}
						move_character = FROM
						break = yes
					}
					banish = yes
					opinion = { who = FROM modifier = opinion_hate }
					event_target:county_title = { add_pressed_claim = PREV }
				}
			}
		}
		ai_will_do = {
			factor = 1
		}
	}
}