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

title_decisions = {
	set_crown_focus = { # High Prio version
		only_playable = yes
		filter = owned
		ai_target_filter = owned
		is_high_prio = yes
		ai_check_interval = 12
		
		from_potential = {
			is_playable = yes
			has_dlc = "Reapers"
			is_nomadic = no
			NOT = {
				any_demesne_province = {
					has_province_flag = crown_focus_province
				}
			}
		}
		
		potential = {
			owner = { character = FROM }
			tier = count
		}

		allow = {
			hidden_tooltip = {
				OR = {
					FROM = {
						ai = no
					}
					FROM = {
						NOT = {
							any_demesne_province = {
								has_province_flag = crown_focus_province
							}
						}
					}
				}
			}

			location = {
				capital_holding = {
					NOR = {
						has_siege = yes
						is_occupied = yes 
					}
				}
			}
			
			FROM = {	
				always = yes
			}
		}

		effect = {
			FROM = {
				any_demesne_province = {
					limit = {
						has_province_flag = crown_focus_province
					}
					clr_province_flag = crown_focus_province
				}
			}
			location = { set_province_flag = crown_focus_province }
		}

		revoke_allowed = {
			always = no
		}

		ai_will_do = {
			factor = 1
		}
	}
	
	move_crown_focus = {
		only_playable = yes
		filter = owned
		ai_target_filter = owned
		
		from_potential = {
			is_playable = yes
			has_dlc = "Reapers"
			is_nomadic = no
			any_demesne_province = {
				has_province_flag = crown_focus_province
			}
		}
		
		potential = {
			owner = { character = FROM }
			tier = count
			NOT = { location = { has_province_flag = crown_focus_province } }
		}

		allow = {
			hidden_tooltip = {
				OR = {
					FROM = {
						ai = no
					}
					FROM = {
						NOT = {
							any_demesne_province = {
								has_province_flag = crown_focus_province
							}
						}
					}
				}
			}

			location = {
				capital_holding = {
					NOR = {
						has_siege = yes
						is_occupied = yes 
					}
				}
			}
			
			FROM = {
				always = yes
			}
		}

		effect = {
			FROM = {
				any_demesne_province = {
					limit = {
						has_province_flag = crown_focus_province
					}
					clr_province_flag = crown_focus_province
				}
			}
			location = { set_province_flag = crown_focus_province }
		}

		revoke_allowed = {
			always = no
		}

		ai_will_do = {
			factor = 1
		}
	}
}