plot_decisions = {
	plot_weaken_fellow_vassal_decision = {
		only_rulers = yes
		is_high_prio = yes
		ai_check_interval = 3
		
		potential = {
			is_adult = yes
			has_plot = plot_weaken_fellow_vassal
			NOT = { has_character_flag = plot_weaken_fellow_vassal_decision_taken }
		}
		allow = {
			will_liege_enforce_peace = no
			has_liege_enforced_peace = no
			plot_power = 1
			num_of_plot_backers = 1
			plot_target_char = {
				NOT = {
					any_war = {
						defender = {
							character = PREVPREV
						}
					}
				}
			}
		}
		effect = {
			plot_target_char = {
				letter_event = { id = 7505 days = 3 tooltip = "EVTTOOLTIP7505" }
			}
			hidden_tooltip = {
				set_character_flag = plot_weaken_fellow_vassal_decision_taken
				activate_plot = yes
			}
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				NOT = { plot_power = 0.9 }
			}
		}
	}
	
	plot_weaken_fellow_vassal_decision_liege = {
		only_rulers = yes
		is_high_prio = yes
		ai_check_interval = 3
		
		potential = {
			is_adult = yes
			has_plot = plot_weaken_fellow_vassal
			NOT = { 
				has_character_flag = plot_weaken_fellow_vassal_decision_liege_taken
				has_character_flag = plot_weaken_fellow_vassal_decision_taken
				plot_target_char  = {
					liege = {
						opinion = { 
							who = PREV
							value = 0
						}
					}
				}
			}
		}
		allow = {
			will_liege_enforce_peace = no
			has_liege_enforced_peace = no
			plot_power = 0.6
			num_of_plot_backers = 1
			liege = {
				opinion = {
					who = ROOT
					value = 40
				}
			}
			plot_target_char = {
				NOT = {
					any_war = {
						defender = {
							character = PREVPREV
						}
					}
				}
			}
		}
				
		effect = {
			liege = {
				letter_event = {
					id = 7500
					days = 3
					tooltip = "EVTTOOLTIP7500"
				}
			}
			hidden_tooltip = {
				set_character_flag = plot_weaken_fellow_vassal_decision_liege_taken
			}
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				NOT = { plot_power = 0.9 }
			}
		}
	}
	
	plot_gain_liege_title_decision_100 = {
		only_playable = yes
		is_high_prio = yes
		ai_check_interval = 3
		
		potential = {
			is_adult = yes
			has_plot = plot_gain_liege_title
			NOT = { has_character_flag = plot_gain_liege_title_decision_taken }
		}
		allow = {
			plot_power = 1
			num_of_plot_backers = 5
			plot_target_char = {
				NOT = {
					any_war = {
						defender = {
							character = PREVPREV
						}
					}
				}
			}
			liege = {
				OR = {
					independent = yes
					AND = {
						will_liege_enforce_peace = no
						has_liege_enforced_peace = no
					}
				}
			}
		}
		effect = {
			ROOT = {
				random_list = {
					90 = { 
						character_event = { id = 7600 tooltip = "EVTTOOLTIP7600" }
					}
					10 = {
						character_event = { id = 7601 tooltip = "EVTTOOLTIP7601" }
					}
				}
				hidden_tooltip = {
					set_character_flag = plot_gain_liege_title_decision_taken
					activate_plot = yes
				}
			}
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
			}
		}
	}
	
	plot_gain_liege_title_decision_75 = {
		only_playable = yes
		is_high_prio = yes
		ai_check_interval = 3
		
		potential = {
			is_adult = yes
			has_plot = plot_gain_liege_title
			NOT = { has_character_flag = plot_gain_liege_title_decision_taken }
		}
		allow = {
			plot_power = 0.75
			num_of_plot_backers = 3
			plot_target_char = {
				NOT = {
					any_war = {
						defender = {
							character = PREVPREV
						}
					}
				}
			}
			liege = {
				OR = {
					independent = yes
					AND = {
						will_liege_enforce_peace = no
						has_liege_enforced_peace = no
					}
				}
			}
		}
		effect = {
			ROOT = {
				random_list = {
					60 = { 
						character_event = { id = 7600 tooltip = "EVTTOOLTIP7600" }
					}
					40 = {
						character_event = { id = 7601 tooltip = "EVTTOOLTIP7601" }
					}
				}
				hidden_tooltip = {
					set_character_flag = plot_gain_liege_title_decision_taken
					activate_plot = yes
				}
			}
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				NOT = { plot_power = 0.9 }
			}
		}
	}
	
	plot_gain_fellow_vassal_title_decision_100 = {
		only_playable = yes
		is_high_prio = yes
		ai_check_interval = 3
		
		potential = {
			is_adult = yes
			has_plot = plot_gain_fellow_vassal_title
			NOT = { has_character_flag = plot_gain_fellow_vassal_title_decision_taken }
		}
		allow = {
			will_liege_enforce_peace = no
			has_liege_enforced_peace = no
			plot_power = 1
			num_of_plot_backers = 4
			plot_target_char = {
				NOT = {
					any_war = {
						defender = {
							character = PREVPREV
						}
					}
				}
			}
		}
		effect = {
			ROOT = {
				random_list = {
					90 = { 
						character_event = { id = 7600 tooltip = "EVTTOOLTIP7600" }
					}
					10 = {
						character_event = { id = 7602 tooltip = "EVTTOOLTIP7601" }
					}
				}
				hidden_tooltip = {
					set_character_flag = plot_gain_fellow_vassal_title_decision_taken
					activate_plot = yes
				}
			}
		}
		ai_will_do = {
			factor = 0

		}
	}
	
	plot_gain_fellow_vassal_title_decision_75 = {
		only_playable = yes
		is_high_prio = yes
		ai_check_interval = 3
		
		potential = {
			is_adult = yes
			has_plot = plot_gain_fellow_vassal_title
			NOT = { has_character_flag = plot_gain_fellow_vassal_title_decision_taken }
		}
		allow = {
			will_liege_enforce_peace = no
			has_liege_enforced_peace = no
			plot_power = 0.75
			num_of_plot_backers = 3
			plot_target_char = {
				NOT = {
					any_war = {
						defender = {
							character = PREVPREV
						}
					}
				}
			}
		}
		effect = {
			ROOT = {
				random_list = {
					60 = { 
						character_event = { id = 7600 tooltip = "EVTTOOLTIP7600" }
					}
					40 = {
						character_event = { id = 7602 tooltip = "EVTTOOLTIP7601" }
					}
				}
				hidden_tooltip = {
					set_character_flag = plot_gain_fellow_vassal_title_decision_taken
					activate_plot = yes
				}
			}
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				NOT = { plot_power = 0.9 }
			}
		}
	}
	
	plot_seize_trade_post_decision = {
		only_playable = yes
		is_high_prio = yes
		ai_check_interval = 3
		
		potential = {
			is_adult = yes
			has_plot = plot_seize_trade_post
			NOT = { has_character_flag = plot_seize_trade_post_decision_taken }
		}
		allow = {
			will_liege_enforce_peace = no
			has_liege_enforced_peace = no
			plot_power = 0.75
			num_of_plot_backers = 3
			plot_target_char = {
				NOT = {
					any_war = {
						defender = {
							character = PREVPREV
						}
					}
				}
			}
		}
		effect = {
			ROOT = {
				character_event = { id = REP.300 tooltip = EVTTOOLTIPREP.300 }
				set_character_flag = plot_seize_trade_post_decision_taken
				activate_plot = yes
			}
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				OR = {
					NOT = { plot_power = 0.9 }
					NOT = { wealth = 300 }
				}
			}
		}
	}

	plot_usurp_wife_decision = {
		is_high_prio = yes
		ai_check_interval = 3
		
		potential = {
			is_married = yes
			plot_target_char = {
				any_spouse = { character = ROOT }
			}
			has_plot = plot_usurp_wife
			NOT = { has_character_flag = plot_usurp_wife_decision_taken }
		}
		allow = {
			war = no
			custom_tooltip = {
				text = IS_NOT_BUSY
				hidden_tooltip = {
					is_not_busy_trigger = yes
					in_command_trigger = no
				}
			}
			plot_target_char = {
				war = no
				custom_tooltip = {
					text = IS_NOT_BUSY
					hidden_tooltip = {
						is_not_busy_trigger = yes
						in_command_trigger = no
					}
				}
			}
			OR = {
				AND = {
					plot_power = 1.0
					num_of_plot_backers = 1
					plot_target_char = { prisoner = no }
				}
				plot_target_char = {
					prisoner = yes
					host = { character = ROOT }
				}
				plot_target_char = {
					plot_power = 0.5
					trait = incapable
				}
			}
		}
		effect = {
			plot_target_char = {
				character_event = {
					id = FemRule.360
					tooltip = ATTEMPT_TO_USURP_WIFE
				}
			}
			hidden_tooltip = {
				set_character_flag = plot_usurp_wife_decision_taken
				activate_plot = yes
				add_character_modifier = {
					name = do_not_disturb
					days = 7
					hidden = yes
				}
			}
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				trait = content
			}
			modifier = {
				factor = 0
				plot_target_char = { trait = incapable }
				NOT = { plot_power = 0.75 }
			}
			modifier = {
				factor = 0
				plot_target_char = {
					NOT = { trait = incapable }
					prisoner = no
				}
				NOT = { plot_power = 1.25 }
			}
		}
	}

}

targeted_decisions = {
	
	reveal_plot = {
		ai_target_filter = realm
		ai_check_interval = 5
		
		from_potential = {
			OR = {
				is_ruler = yes
				is_patrician = yes
			}
			any_courtier = { has_job_title = job_spymaster }
			NOT = { has_character_flag = attempted_blackmail }
		}
		potential = {
			has_plot = yes
			FROM = { any_known_plotter = { character = ROOT } }
			plot_target_char = {
				NOT = { character = FROM }
			}
		}
		allow = {
			FROM = { has_regent = no }
			NOT = { reverse_has_opinion_modifier = { who = FROM modifier = opinion_blackmailed } }
			plot_target_char = {
				is_adult = yes
				custom_tooltip = {
					text = NOT_AWARE_PLOT
					hidden_tooltip = {
						ROOT = { NOT = { plot_is_known_by = PREV } }
					}
				}
			}
		}
		effect = {
			tooltip = {
				ROOT = { reveal_plot = yes }
			}
			if = {
				limit = { any_plot_backer = { character = FROM } }
				FROM = { leave_plot = ROOT }
			}
			hidden_tooltip = {
				plot_target_char = { letter_event = { id = Plus.285 } }
				plot_target_char = { save_event_target_as = revealed_target }
				character_event = { id = Plus.288 days = 7 }
			}
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.5
				always = yes
			}
			modifier = {
				factor = 0
				any_plot_backer = { character = FROM }
			}
			modifier = {
				factor = 0
				plot_target_char = {
					OR = {
						FROM = { likes_better_than = { who = ROOT than = PREV } }
						NOT = { reverse_opinion = { who = FROM value = 0 } }
						has_opinion_modifier = { who = FROM modifier = opinion_recent_plot }
						has_truce = FROM
						has_non_aggression_pact_with = FROM
						war_with = FROM
					}
				}
			}
			modifier = {
				factor = 10
				plot_target_char = {
					OR = {
						is_close_relative = FROM
						any_liege = { character = FROM }
					}
				}
			}
		}
	}

	blackmail_plotter = {
		ai_target_filter = realm
		ai_check_interval = 5
		
		from_potential = {
			OR = {
				is_ruler = yes
				is_patrician = yes
			}
			has_regent = no
			any_courtier = { has_job_title = job_spymaster }
			NOT = { has_character_flag = attempted_blackmail }
		}
		potential = {
			has_plot = yes
			FROM = { any_known_plotter = { character = ROOT } }
			plot_target_char = { NOT = { character = FROM } }
			NOT = {
				has_plot = plot_seduce
				is_liege_or_above = FROM
				is_vassal_or_below = FROM
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_blackmailed }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_failed_blackmail }
			}
		}
		allow = {
			ROOT = { wealth = 100 }
			plot_target_char = {
				custom_tooltip = {
					text = NOT_AWARE_PLOT
					hidden_tooltip = {
						ROOT = { NOT = { plot_is_known_by = PREV } }
					}
				}
			}
		}
		effect = {
			FROM = {
				set_character_flag = attempted_blackmail
				hidden_tooltip = { character_event = { id = 7259 } }
				if = {
					limit = {
						NOT = { trait = honest }
						NOT = { trait = deceitful }
					}
					random = {
						chance = 50
						add_trait = deceitful
					}
				}
				if = {
					limit = { trait = honest }
					random = {
						chance = 50
						remove_trait = honest
					}
				}
				if = {
					limit = { trait = just }
					random = {
						chance = 25
						remove_trait = just
					}
				}
			}
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.5
				always = yes
			}
			modifier = {
				factor = 0
				FROM = {
					NOT = {
						trait = deceitful
						trait = greedy
						trait = envious
					}
				}
			}
			modifier = {
				factor = 0
				FROM = {
					OR = {
						trait = just
						trait = diligent
						opinion = { who = ROOT value = 0 }
					}
				}
			}
			modifier = {
				factor = 0
				any_plot_backer = { character = FROM }
			}
			modifier = {
				factor = 0
				plot_target_char = {
					OR = {
						FROM = { likes_better_than = { who = ROOT than = PREV } }
						NOT = { reverse_opinion = { who = FROM value = 0 } }
						has_opinion_modifier = { who = FROM modifier = opinion_recent_plot }
						has_truce = FROM
						has_non_aggression_pact_with = FROM
						war_with = FROM
						is_close_relative = FROM
					}
				}
			}
		}
	}
}

