# 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 = { #Kings and Judiciars

	dispense_justice = {
		filter = sub_realm_owned
		ai_target_filter = owned
		is_high_prio = yes
		
		from_potential = {
			war = no
			NOT = {
				trait = serving_justice
			}
			any_courtier = {
				has_job_title = job_treasurer
			}
			any_courtier = {
				has_job_title = job_chancellor
			}
			
		}
		
		potential = {
			is_capital = yes
			location = {
				has_province_modifier = dm_just
			}
		}
		effect = {
			location = {
				remove_province_modifier = dm_just
			}
			FROM = {
				if = {
					limit = {
						NOT = {
							has_regent = yes
							trait = serving_justice
							is_attending_event = yes
						}
					}
					add_trait = serving_justice
					
					hidden_tooltip = {

						character_event = {
							id = DMJ.1000
							days = 1
						}
						break = yes

					}
				}
				if = {
					limit = {
						OR = {
							has_regent = yes
							trait = serving_justice
							is_attending_event = yes
						}
					}
					if = {
						limit = {
							regent = {
								NOT = {
									has_job_title = job_treasurer
								}
							}
						}
						job_treasurer = {
							if = {
								limit = {NOT = {has_minor_title = title_regent}}
								add_trait = serving_justice
							}
							if = {
								limit = {has_minor_title = title_regent}
								tooltip = {add_trait = serving_justice}
							}
							hidden_tooltip = {
								
								character_event = {
									id = DMJ.1000
									days = 1
								}

							}
						}
						break = yes
					}
					job_chancellor = {
						if = {
							limit = {NOT = {has_minor_title = title_regent}}
							add_trait = serving_justice
						}
						if = {
							limit = {has_minor_title = title_regent}
							tooltip = {add_trait = serving_justice}
						}
						hidden_tooltip = {
							
							character_event = {
								id = DMJ.1000
								days = 1
							}

						}
					}
				}
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				FROM = {is_feudal = no}
				owner = {
					is_feudal = yes
				}
			}
			modifier = {
				factor = 0.1
			}
			modifier = {
				factor = 0.2
				FROM = {trait = arbitrary}
			}
			modifier = {
				factor = 0.2
				FROM = {trait = slothful}
			}
		}
	}
}
