# Targetted decisions are possible vs _all_ other characters and shown are in the Diplomacy View, not the Intrigue View. The taker is in the FROM scope.
#
# filter = [self/court/home_court/vassals/sub_realm/realm/dynasty/all] ('self' MUST be set for decisions targetting only the taker, the other filter types can be set to lessen CPU load)
# ai_target_filter = [self/court/home_court/vassals/sub_realm/realm/dynasty/all] (which characters for which the AI evaluates the decision.)
#	court: all characters in the AI's host court, including prisoners, and characters currently away (wards, prisoners, etc)
#	home_court: all characters in the AI's home court, including prisoners, and characters currently away (wards, prisoners, etc)
#	vassals: direct vassal rulers of the AI's employer
#	sub_realm: all characters below the AI's employer
#	realm: all characters in the same top realm as the AI
#	dynasty: all members of the same dynasty
#	all: all living characters (Avoid if possible. VERY CPU-HEAVY!)
#	

targetted_decisions = {
	abdicate_to_ste = {
		ai_target_filter = dynasty
		filter = dynasty
		from_potential = {
			always = no
			is_adult = yes
			always = no
		}
		potential = {
			NOT = { character = FROM }
			dynasty = FROM
		}
		allow = {
			ROOT = {
				is_adult = yes
			}
			FROM = {
				prestige = 1000
				primary_title = {
					NOT = {
						has_law = succ_feudal_elective
					}
				}
				is_adult = yes
				has_regent = no
				NOT = {
					has_character_flag = do_not_disturb
				}
				at_war = no
			}
			OR = {
				FROM = { ai = no }
				ROOT = {
							NOT = {
								OR = {
								trait = slow
								trait = inbred
								trait = imbecile
								trait = dull
								}
							}
					prestige = 500
				#	is_female = no
					FROM = { 
						
						current_heir = { 
							OR = {
								NOT = { dynasty = FROM } 
								trait = slow
								trait = inbred
								trait = imbecile
								trait = dull
							}
						}
						age = 45
					}
				}
			}	
		}
		effect = {
			FROM = {
				prestige = -1000
				abdicate_to = ROOT
				
			}
			ROOT = {
				hidden_tooltip = { character_event = { id = Stuff.100 }	}
				any_realm_lord = {
					limit = {
						NOT = { 
							tier = baron
							character = FROM
							character = ROOT
						}
					}
					opinion = { modifier = Abdicated who = ROOT years = 10 }
				}
			}
			ROOT = {
				any_vassal = {
					limit = { NOT = { tier = baron } }
					ROOT = {
						any_demesne_title = {
							add_claim = PREVPREV
						}
					}
				}
				any_close_relative = {
					ROOT = {
						any_demesne_title = {
							add_claim = PREVPREV
						}
					}
				}
			}
			FROM = {
				any_close_relative = {
					ROOT = {
						any_demesne_title = {
							add_claim = PREVPREV
						}
					}
				}
			}

			any_realm_character = {
				hidden_tooltip = { character_event = { id = Stuff.100 }	}
			}

		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.01
			}		
		}
	}
	destroy_primary_title = {
		ai_target_filter = self
		filter = self
		from_potential = {
			always = no
			is_adult = yes
		}
		potential = {
			character = FROM
		}
		allow = {
			independent = yes
			primary_title = {
				NOT = {
					has_law = succ_feudal_elective
				}
			}
		}
		effect = {
			primary_title = {
				destroy_landed_title = THIS
			}
			prestige = -1000
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
	}
}