##################
# CK2Plus PLOTS
##################

# Character plots to lower skill of a councillor whose job they want
plot_discredit_councillor = {
	type = realm_characters # All characters in the same realm, plus rivals and relatives of self, parents, children and spouse
	intrigue_plot = yes

	# Plotter scope
	potential = {
		prisoner = no
		independent = no
		is_adult = yes
		NOT = { trait = incapable }
		OR = {
			diplomacy = 10
			stewardship = 10
			intrigue = 10
			martial = 10
			learning = 10
		}
		is_councillor = no
		liege = { NOT = { has_character_flag = lifetime_appointments } }
		liege = { NOT = { has_character_flag = no_council_requests } }
		liege = { primary_title = { NOT = { has_law = council_privileges_1 } } }
		NOT = { has_opinion_modifier = { who = liege modifier = opinion_refused_council } }
		hidden_tooltip = {
			OR = {
				ai = no
				has_character_flag = allow_plotting
			}
		}
	}
	
	# Target scope
	target_potential = {
		same_liege = FROM
		is_councillor = yes
	}

	# Target scope
	allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		NOT = { liege = { spouse = { character = FROM } } }
		OR = {
			#chancellor
			AND = {
				has_job_title = job_chancellor
				NOT = {
					attribute_diff = {
						character = FROM
						attribute = diplomacy
						value = 5
					}
				}
				FROM = {
					diplomacy = 10
					can_be_chancellor_trigger = yes
				}
			}
			#steward
			AND = {
				has_job_title = job_treasurer
				NOT = {
					attribute_diff = {
						character = FROM
						attribute = stewardship
						value = 5
					}
				}
				FROM = {
					stewardship = 10
					can_be_treasurer_trigger = yes
				}
			}
			#spymaster
			AND = {
				has_job_title = job_spymaster
				NOT = {
					attribute_diff = {
						character = FROM
						attribute = intrigue
						value = 5
					}
				}
				FROM = {
					intrigue = 10
					can_be_spymaster_trigger = yes
				}
			}
			#marshal
			AND = {
				has_job_title = job_marshal
				NOT = {
					attribute_diff = {
						character = FROM
						attribute = martial
						value = 5
					}
				}
				FROM = {
					martial = 10
					can_be_marshal_trigger = yes
				}
			}
			#court chaplain
			AND = {
				has_job_title = job_spiritual
				NOT = {
					attribute_diff = {
						character = FROM
						attribute = learning
						value = 5
					}
				}
				FROM = {
					learning = 10
					can_be_spiritual_trigger = yes
				}
			}
		}
	}

	chance = {
		factor = 1
		modifier = {
			factor = 10
			FROM = {
				OR = {
					has_ambition = obj_become_chancellor
					has_ambition = obj_become_marshal
					has_ambition = obj_become_treasurer
					has_ambition = obj_become_spymaster
					has_ambition = obj_become_spiritual
				}
			}
		}
		modifier = {
			factor = 10
			is_rival = FROM
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = content
					trait = honest
					trait = kind
					trait = just
					trait = charitable
				}
			}
		}
		modifier = {
			factor = 0.5
			FROM = { is_close_relative = ROOT }
		}
		modifier = {
			factor = 0
			FROM = { opinion = { who = ROOT value = 50 } }
		}
		modifier = {
			factor = 0.25
			FROM = { opinion = { who = ROOT value = 25 } }
		}
		modifier = {
			factor = 1.5
			FROM = { NOT = { opinion = { who = ROOT value = -25 } } }
		}
		modifier = {
			factor = 1.5
			FROM = { NOT = { opinion = { who = ROOT value = -50 } } }
		}
		modifier = {
			factor = 2.0
			FROM = { NOT = { opinion = { who = ROOT value = -75 } } }
		}
		modifier = {
			factor = 0.5
			FROM = { NOT = { intrigue = 5 } }
		}
		modifier = {
			factor = 0.5
			FROM = { NOT = { intrigue = 10 } }
		}
		modifier = {
			factor = 2
			FROM = { intrigue = 15 }
		}
		modifier = {
			factor = 2
			FROM = { intrigue = 20 }
		}
		modifier = {
			factor = 2.0
			FROM = { trait = envious }
		}
		modifier = {
			factor = 4.0
			FROM = { trait = ambitious }
		}
	}

	success = {
		hidden_tooltip = { FROM = { has_character_flag = plot_success } }
		custom_tooltip = { text = CUSTOMTOOLTIP29 }
	}
	
	abort = {
		OR = {
			FROM = { is_councillor = yes }
			AND = {
				is_councillor = no
				FROM = { NOT = { has_character_flag = plot_success } }
			}
			is_alive = no
			FROM = { has_character_flag = abort_plot }
			FROM = { prisoner = yes }
			FROM = { trait = incapable }
		}
	}
	
	abort_effect = {
		FROM = {
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = event7040
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
		}
	}
	
	effect = {
		FROM = {
			any_plot_backer = {
				reverse_opinion = {
					modifier = opinion_grateful
					who = FROM
					years = 5
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = event7040
				clr_character_flag = plot_success
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
				change_variable = { which = "lifestyle_intrigue" value = 1 }
			}
		}
	}
}

# Character plots to steal from liege
plot_embezzle_from_liege = {
	type = realm_characters # All characters in the same realm, plus rivals and relatives of self, parents, children and spouse
	intrigue_plot = yes

	# Plotter scope
	potential = {
		prisoner = no
		independent = no
		is_adult = yes
		NOT = { trait = incapable }
		is_councillor = yes
		hidden_tooltip = {
			OR = {
				ai = no
				has_character_flag = allow_plotting
			}
		}
	}
	
	# Target scope
	target_potential = {
		is_liege_of = FROM
	}

	# Target allow trigger for when players target a specific character in the GUI
	player_allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		wealth = 0
	}

	# Target scope
	allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		wealth = 0
	}

	chance = {
		factor = 1
		modifier = {
			factor = 0
			war = yes
			NOT = { wealth = 500 }
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = content
					trait = honest
					trait = kind
					trait = just
					trait = charitable
				}
			}
		}
		modifier = {
			factor = 0.25
			FROM = { is_ruler = yes }
		}
		modifier = {
			factor = 0
			FROM = { opinion = { who = ROOT value = 50 } }
		}
		modifier = {
			factor = 0
			FROM = { 
				opinion = { who = ROOT value = 25 }
				NOT = {
					OR = {
						trait = greedy
						trait = envious
					}
				}
			}
		}
		modifier = {
			factor = 0.25
			FROM = {
				opinion = { who = ROOT value = 0 }
				NOT = {
					OR = {
						trait = greedy
						trait = envious
					}
				}
			}
		}
		modifier = {
			factor = 1.5
			FROM = { NOT = { opinion = { who = ROOT value = -25 } } }
		}
		modifier = {
			factor = 1.5
			FROM = { NOT = { opinion = { who = ROOT value = -50 } } }
		}
		modifier = {
			factor = 2.0
			FROM = { NOT = { opinion = { who = ROOT value = -75 } } }
		}
		modifier = {
			factor = 10.0
			FROM = {
				OR = {
					has_ambition = obj_amass_wealth
					has_ambition = obj_amass_wealth_2
					has_ambition = obj_amass_wealth_3
					has_ambition = obj_amass_wealth_4
				}
			}
		}
		modifier = {
			factor = 2.0
			FROM = { has_job_title = job_treasurer }
		}
		modifier = {
			factor = 0.5
			FROM = { NOT = { intrigue = 5 } }
		}
		modifier = {
			factor = 0.5
			FROM = { NOT = { intrigue = 10 } }
		}
		modifier = {
			factor = 2
			FROM = { intrigue = 15 }
		}
		modifier = {
			factor = 2
			FROM = { intrigue = 20 }
		}
		modifier = {
			factor = 2.0
			FROM = { trait = envious }
		}
		modifier = {
			factor = 4.0
			FROM = { trait = greedy }
		}
		modifier = {
			factor = 4.0
			FROM = { trait = decadent }
		}
		modifier = {
			factor = 2
			trait = trusting
		}
		modifier = {
			factor = 1.5
			trait = charitable
		}
		modifier = {
			factor = 1.5
			wealth = 100
		}
		modifier = {
			factor = 1.5
			wealth = 200
		}
		modifier = {
			factor = 1.5
			wealth = 300
		}
		modifier = {
			factor = 1.5
			wealth = 400
		}
		modifier = {
			factor = 1.5
			wealth = 500
		}
		modifier = {
			factor = 0.5
			NOT = { wealth = 50 }
		}
	}

	success = {
		hidden_tooltip = { FROM = { has_character_flag = plot_success } }
		custom_tooltip = { text = CUSTOMTOOLTIP30 }
	}
	
	abort = {
		OR = {
			NOT = { treasury = -100 }
			FROM = { has_character_flag = abort_plot }
			FROM = { prisoner = yes }
			FROM = { trait = incapable }
			FROM = { is_councillor = no }
			NOT = { is_liege_of = FROM }
			is_ruler = no
			is_alive = no
		}
	}
	
	abort_effect = {
		FROM = {
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = event7040
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
		}
	}
	
	effect = {
		FROM = {
			any_plot_backer = {
				reverse_opinion = {
					modifier = opinion_grateful
					who = FROM
					years = 5
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = plot_success
				clr_character_flag = event7040
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
				change_variable = { which = "lifestyle_intrigue" value = 1 }
			}
		}
	}
}

# Character plots to imprison a character
plot_kidnapping = {
	type = realm_characters_plus # All characters in the same realm, plus rivals and relatives of self, parents, children and spouse
	intrigue_plot = yes
	murder_plot = yes

	# Plotter scope
	potential = {
		prisoner = no
		is_adult = yes
		is_ruler = yes
		NOT = { trait = incapable }
		hidden_tooltip = {
			OR = {
				ai = no
				has_character_flag = allow_plotting
			}
		}
	}

	# Target allow trigger for when players target a specific character in the GUI
	player_allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		prisoner = no
		is_within_diplo_range = FROM
	}

	# Target scope
	allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		prisoner = no
		is_within_diplo_range = FROM
		OR = {
			NOT = { reverse_opinion = { who = FROM value = -25 } }
			NOT = { is_close_relative = FROM }
		}
		NOT = { reverse_opinion = { who = FROM value = 0 } }
		OR = {
			# declared war on me
			any_war = {
				attacker = { character = ROOT }
				defender = { character = FROM }
			}
			any_war = {
				attacker = { character = FROM }
				defender = { character = ROOT }
			}
			# has my de jure vassal in a kingdom where inter-vassal fighting isn't allowed
			AND = {
				same_liege = FROM
				FROM = {
					liege = {
						NOR = {
							is_mother = ROOT
							is_father = ROOT
							is_child_of = ROOT
							sibling = ROOT
							is_married = ROOT
						}
					}
				}
				any_vassal = {
					lower_tier_than = FROM
					higher_tier_than = BARON
					OR = {
						de_jure_liege = FROM
						dejure_liege_title = {
							has_holder = yes
							claimed_by = FROM
						}
					}
					war = no
					is_patrician = no
				}
			}
			# holds a county claim of mine in a kingdom where inter-vassal fighting isn't allowed
			AND = {
				same_liege = FROM
				FROM = {
					liege = {
						NOR = {
							is_mother = ROOT
							is_father = ROOT
							is_child_of = ROOT
							sibling = ROOT
							is_married = ROOT
						}
					}
				}
				any_demesne_title = {
					lower_tier_than = DUKE
					can_be_given_away = yes
					is_primary_holder_title = no
					location = { is_capital = no }
					OR = {
						claimed_by = FROM
						dejure_liege_title = { claimed_by = FROM }
						de_jure_liege_or_above = FROM
					}
				}
			}
			# I need to stop their plot but can't arrest them
			AND = {
				NOT = { is_liege_or_above = FROM }
				FROM = {
					liege = {
						NOR = {
							is_mother = ROOT
							is_father = ROOT
							is_child_of = ROOT
							sibling = ROOT
							is_married = ROOT
						}
					}
					any_known_plotter = {
						character = ROOT
						plot_target_char = {
							OR = {
								character = PREVPREV
								is_child_of = PREVPREV
								is_mother = PREVPREV
								is_father = PREVPREV
								is_married = PREVPREV
							}
						}
					}
				}
			}
			# I want to execute them but can't arrest them
			AND = {
				NOT = { is_liege_or_above = FROM }
				OR = {
					reverse_has_opinion_modifier = { who = FROM modifier = opinion_targeted_by_adventurer }
					reverse_has_opinion_modifier = { who = FROM modifier = opinion_traitor }
					reverse_has_opinion_modifier = { who = FROM modifier = declared_war }
					reverse_has_opinion_modifier = { who = FROM modifier = opinion_dishonorable }
					reverse_has_opinion_modifier = { who = FROM modifier = opinion_rebel_traitor }
					reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_spouse }
					reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_vassal }
					reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder }
					reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_child }
					reverse_has_opinion_modifier = { who = FROM modifier = opinion_spouse_slayer }
					reverse_has_opinion_modifier = { who = FROM modifier = opinion_murder_attempt }
					reverse_has_opinion_modifier = { who = FROM modifier = opinion_killed_close_kin }
					reverse_has_opinion_modifier = { who = FROM modifier = opinion_witch }
					reverse_has_opinion_modifier = { who = FROM modifier = opinion_takfir }
					reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_close_kin }
					reverse_has_opinion_modifier = { who = FROM modifier = killed_vassal }
					reverse_has_opinion_modifier = { who = FROM modifier = opinion_civil_war_loser }
					reverse_has_opinion_modifier = { who = FROM modifier = devious_plotter }
					reverse_has_opinion_modifier = { who = FROM modifier = attempted_kidnapping }
				}
			}
		}
	}

	chance = {
		factor = 1
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = kind
					trait = craven
					trait = content
					trait = humble
					NOT = { intrigue = 6 }
				}
			}
		}
		modifier = {
			factor = 2.0
			FROM = {
				OR = {
					trait = wroth
					trait = just
					trait = diligent
				}
			}
			OR = {
				any_war = {
					attacker = { character = ROOT }
					defender = { character = FROM }
				}
				any_war = {
					attacker = { character = FROM }
					defender = { character = ROOT }
				}
				FROM = {
					any_known_plotter = {
						character = ROOT
						plot_target_char = {
							OR = {
								character = PREVPREV
								is_child_of = PREVPREV
								is_mother = PREVPREV
								is_father = PREVPREV
								is_married = PREVPREV
							}
						}
					}
				}
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_targeted_by_adventurer }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_traitor }
				reverse_has_opinion_modifier = { who = FROM modifier = declared_war }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_dishonorable }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_rebel_traitor }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_spouse }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_vassal }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_child }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_spouse_slayer }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_murder_attempt }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_killed_close_kin }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_witch }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_takfir }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_close_kin }
				reverse_has_opinion_modifier = { who = FROM modifier = killed_vassal }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_civil_war_loser }
				reverse_has_opinion_modifier = { who = FROM modifier = devious_plotter }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_kidnapping }
			}
		}
		modifier = {
			factor = 0.25
			FROM = {
				NOT = {
					crownlaw_title = {
						OR = {
							has_law = crown_authority_3
							has_law = crown_authority_4
						}
					}
				}
			}
			NOR = {
				any_war = {
					attacker = { character = ROOT }
					defender = { character = FROM }
				}
				any_war = {
					attacker = { character = FROM }
					defender = { character = ROOT }
				}
				FROM = {
					any_known_plotter = {
						character = ROOT
						plot_target_char = {
							OR = {
								character = PREVPREV
								is_child_of = PREVPREV
								is_mother = PREVPREV
								is_father = PREVPREV
								is_married = PREVPREV
							}
						}
					}
				}
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_targeted_by_adventurer }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_traitor }
				reverse_has_opinion_modifier = { who = FROM modifier = declared_war }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_dishonorable }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_rebel_traitor }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_spouse }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_vassal }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_child }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_spouse_slayer }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_murder_attempt }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_killed_close_kin }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_witch }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_takfir }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_close_kin }
				reverse_has_opinion_modifier = { who = FROM modifier = killed_vassal }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_civil_war_loser }
				reverse_has_opinion_modifier = { who = FROM modifier = devious_plotter }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_kidnapping }
			}
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = honest
					trait = just
					trait = humble
				}
			}
			NOR = {
				any_war = {
					attacker = { character = ROOT }
					defender = { character = FROM }
				}
				any_war = {
					attacker = { character = FROM }
					defender = { character = ROOT }
				}
				FROM = {
					any_known_plotter = {
						character = ROOT
						plot_target_char = {
							OR = {
								character = PREVPREV
								is_child_of = PREVPREV
								is_mother = PREVPREV
								is_father = PREVPREV
								is_married = PREVPREV
							}
						}
					}
				}
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_targeted_by_adventurer }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_traitor }
				reverse_has_opinion_modifier = { who = FROM modifier = declared_war }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_dishonorable }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_rebel_traitor }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_spouse }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_vassal }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_child }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_spouse_slayer }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_murder_attempt }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_killed_close_kin }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_witch }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_takfir }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_close_kin }
				reverse_has_opinion_modifier = { who = FROM modifier = killed_vassal }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_civil_war_loser }
				reverse_has_opinion_modifier = { who = FROM modifier = devious_plotter }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_kidnapping }
			}
		}
		modifier = {
			factor = 1.5
			FROM = { trait = cruel }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = wroth }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = brave }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = deceitful }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = honest }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = humble }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = patient }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = just }
			same_liege = FROM
			liege = {
				NOR = {
					is_mother = ROOT
					is_father = ROOT
					is_child_of = ROOT
					sibling = ROOT
					is_married = ROOT
				}
			}
			OR = {
				any_vassal = {
					lower_tier_than = FROM
					OR = {
						de_jure_liege = FROM
						dejure_liege_title = { claimed_by = FROM }
					}
					war = no
					is_patrician = no
				}
				any_demesne_title = {
					lower_tier_than = DUKE
					can_be_given_away = yes
					is_primary_holder_title = no
					location = { is_capital = no }
					OR = {
						claimed_by = FROM
						dejure_liege_title = { claimed_by = FROM }
						de_jure_liege_or_above = FROM
					}
				}
			}
		}
		modifier = {
			factor = 2.0
			FROM = { trait = ambitious }
			same_liege = FROM
			liege = {
				NOR = {
					is_mother = ROOT
					is_father = ROOT
					is_child_of = ROOT
					sibling = ROOT
					is_married = ROOT
				}
			}
			OR = {
				any_vassal = {
					lower_tier_than = FROM
					OR = {
						de_jure_liege = FROM
						dejure_liege_title = { claimed_by = FROM }
					}
					war = no
					is_patrician = no
				}
				any_demesne_title = {
					lower_tier_than = DUKE
					can_be_given_away = yes
					is_primary_holder_title = no
					location = { is_capital = no }
					OR = {
						claimed_by = FROM
						dejure_liege_title = { claimed_by = FROM }
						de_jure_liege_or_above = FROM
					}
				}
			}
		}
		modifier = {
			factor = 1.5
			FROM = {
				OR = {
					trait = envious
					trait = greedy
				}
			}
			same_liege = FROM
			liege = {
				NOR = {
					is_mother = ROOT
					is_father = ROOT
					is_child_of = ROOT
					sibling = ROOT
					is_married = ROOT
				}
			}
			OR = {
				any_vassal = {
					lower_tier_than = FROM
					OR = {
						de_jure_liege = FROM
						dejure_liege_title = { claimed_by = FROM }
					}
					war = no
					is_patrician = no
				}
				any_demesne_title = {
					lower_tier_than = DUKE
					can_be_given_away = yes
					is_primary_holder_title = no
					location = { is_capital = no }
					OR = {
						claimed_by = FROM
						dejure_liege_title = { claimed_by = FROM }
						de_jure_liege_or_above = FROM
					}
				}
			}
		}
		modifier = {
			factor = 1.5
			NOT = { reverse_opinion = { who = FROM value = -50 } }
		}
		modifier = {
			factor = 1.5
			NOT = { reverse_opinion = { who = FROM value = -75 } }
		}
		modifier = {
			factor = 0.75
			FROM = { NOT = { intrigue = 7 } }
		}
		modifier = {
			factor = 0.75
			FROM = { NOT = { intrigue = 9 } }
		}
		modifier = {
			factor = 1.25
			FROM = { intrigue = 12 }
		}
		modifier = {
			factor = 1.25
			FROM = { intrigue = 15 }
		}
		modifier = {
			factor = 1.25
			FROM = { intrigue = 18 }
		}
	}

	success = {
		prisoner = yes
		host = { character = FROM }
	}
	
	abort = {
		OR = {
			AND = {
				prisoner = yes
				host = { NOT = { character = FROM } }
			}
			FROM = { has_character_flag = abort_plot }
			FROM = { prisoner = yes }
			FROM = { trait = incapable }
			FROM = { is_ruler = no }
			AND = {
				FROM = { ai = yes }
				NOR = {
					# declared war on me
					any_war = {
						attacker = { character = ROOT }
						defender = { character = FROM }
					}
					any_war = {
						attacker = { character = FROM }
						defender = { character = ROOT }
					}
					# holds a county claim of mine in a kingdom where inter-vassal fighting isn't allowed
					AND = {
						same_liege = FROM
						FROM = {
							crownlaw_title = {
								OR = {
									has_law = crown_authority_3
									has_law = crown_authority_4
								}
							}
						}
						any_demesne_title = {
							lower_tier_than = DUKE
							can_be_given_away = yes
							is_primary_holder_title = no
							location = { is_capital = no }
							OR = {
								claimed_by = FROM
								dejure_liege_title = { claimed_by = FROM }
								de_jure_liege_or_above = FROM
							}
						}
					}
					# I need to stop their plot but can't arrest them
					AND = {
						NOT = { is_liege_or_above = FROM }
						FROM = {
							any_known_plotter = {
								character = ROOT
								plot_target_char = {
									OR = {
										character = PREVPREV
										is_child_of = PREVPREV
										is_mother = PREVPREV
										is_father = PREVPREV
										is_married = PREVPREV
									}
								}
							}
						}
					}
					# I want to execute them but can't arrest them
					AND = {
						NOT = { is_liege_or_above = FROM }
						OR = {
							reverse_has_opinion_modifier = { who = FROM modifier = opinion_targeted_by_adventurer }
							reverse_has_opinion_modifier = { who = FROM modifier = opinion_traitor }
							reverse_has_opinion_modifier = { who = FROM modifier = declared_war }
							reverse_has_opinion_modifier = { who = FROM modifier = opinion_dishonorable }
							reverse_has_opinion_modifier = { who = FROM modifier = opinion_rebel_traitor }
							reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_spouse }
							reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_vassal }
							reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder }
							reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_child }
							reverse_has_opinion_modifier = { who = FROM modifier = opinion_spouse_slayer }
							reverse_has_opinion_modifier = { who = FROM modifier = opinion_murder_attempt }
							reverse_has_opinion_modifier = { who = FROM modifier = opinion_killed_close_kin }
							reverse_has_opinion_modifier = { who = FROM modifier = opinion_witch }
							reverse_has_opinion_modifier = { who = FROM modifier = opinion_takfir }
							reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_close_kin }
							reverse_has_opinion_modifier = { who = FROM modifier = killed_vassal }
							reverse_has_opinion_modifier = { who = FROM modifier = opinion_civil_war_loser }
							reverse_has_opinion_modifier = { who = FROM modifier = devious_plotter }
							reverse_has_opinion_modifier = { who = FROM modifier = attempted_kidnapping }
							reverse_has_opinion_modifier = { who = FROM modifier = attempted_kidnapping_of_kin }
							reverse_has_opinion_modifier = { who = FROM modifier = attempted_kidnapping_of_vassal }
							reverse_has_opinion_modifier = { who = FROM modifier = opinion_kidnapped_kin }
						}
					}
				}
			}
		}
	}
	
	abort_effect = {
		FROM = {
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = event7040
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = kidnap_attempt
				clr_character_flag = abort_plot
				clr_character_flag = kidnap_in_transit
				clr_character_flag = kidnap_in_bed
				clr_character_flag = kidnap_while_hunting
				clr_character_flag = kidnap_while_carousing
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
		}
	}
	
	effect = {
		FROM = {
			any_plot_backer = {
				reverse_opinion = {
					modifier = opinion_grateful
					who = FROM
					years = 5
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = event7040
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = kidnap_attempt
				clr_character_flag = abort_plot
				clr_character_flag = kidnap_in_transit
				clr_character_flag = kidnap_in_bed
				clr_character_flag = kidnap_while_hunting
				clr_character_flag = kidnap_while_carousing
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
				change_variable = { which = "lifestyle_intrigue" value = 1 }
			}
		}
	}
}

# Character plots to fabricate evidence of treason
plot_fabricate_treason = {
	type = realm_characters # All characters in the same realm, plus rivals and relatives of self, parents, children and spouse
	vassal_intrigue_plot = yes

	# Plotter scope
	potential = {
		prisoner = no
		is_adult = yes
		is_ruler = yes
		NOT = { trait = incapable }
		OR = {
			higher_tier_than = baron
			is_patrician = yes
		}
		hidden_tooltip = {
			OR = {
				ai = no
				has_character_flag = allow_plotting
			}
		}
	}
	
	# Target scope
	target_potential = {
		same_liege = FROM
		is_ruler = yes
	}

	# Target allow trigger for when players target a specific character in the GUI
	player_allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		is_adult = yes
		prisoner = no
		independent = no
		OR = {
			higher_tier_than = baron
			is_patrician = yes
		}
		NOT = { FROM = { is_liege_of = ROOT } }
		NOT = { liege = { opinion = { who = ROOT value = 25 } } }
		NOT = { reverse_has_truce = FROM }
		NOT = { has_non_aggression_pact_with = FROM }
	}

	# Target scope
	allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		is_adult = yes
		prisoner = no
		independent = no
		OR = {
			higher_tier_than = baron
			is_patrician = yes
		}
		NOT = { FROM = { is_liege_of = ROOT } }
		NOT = { liege = { opinion = { who = ROOT value = 25 } } }
		NOT = { reverse_has_truce = FROM }
		NOT = { is_allied_with = FROM }
		NOT = { has_non_aggression_pact_with = FROM }
		OR = {
			#at war
			war_with = FROM
			
			#are rivals
			FROM = { is_rival = ROOT }
			
			#have a claim on their lands
			FROM = {
				any_claim = { holder_scope = { character = ROOT } }
			}
			
			#they are a different culture from both you and their liege
			AND = {
				NOT = { reverse_opinion = { who = FROM value = 0 } }
				NOT = { culture = FROM }
				liege = { NOT = { culture = ROOT } }
			}
			
			#they are a different religion from both you and their liege
			AND = {
				NOT = { reverse_opinion = { who = FROM value = 0 } }
				NOT = { religion = FROM }
				liege = { NOT = { religion = ROOT } }
			}
			
			#wants revenge
			FROM = { has_opinion_modifier = { who = ROOT modifier = scheming_bastard } }
			FROM = { has_opinion_modifier = { who = ROOT modifier = devious_plotter } }
			FROM = { has_opinion_modifier = { who = ROOT modifier = declared_war } }
			
			#dislike them, and liege really dislikes them
			AND = {
				NOT = { reverse_opinion = { who = FROM value = 0 } }
				liege = { NOT = { opinion = { who = ROOT value = -50 } } }
			}
		}
	}

	chance = {
		factor = 1
		modifier = {
			factor = 0
			FROM = { lower_tier_than = count }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = dishonorable1 }
		}
		modifier = {
			factor = 0.4
			FROM = { trait = dishonorable2 }
		}
		modifier = {
			factor = 0.3
			FROM = { trait = dishonorable3 }
		}
		modifier = {
			factor = 0.2
			FROM = { trait = dishonorable4 }
		}
		modifier = {
			factor = 0.1
			FROM = { trait = dishonorable5 }
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = dishonorable6
					trait = dishonorable7
					trait = dishonorable8
					trait = dishonorable9
					trait = dishonorable10
				}
			}
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = content
					trait = honest
					trait = kind
					trait = just
					trait = charitable
				}
				NOT = { trait = lunatic }
				NOT = { trait = possessed }
			}
		}
		modifier = {
			factor = 2.0
			FROM = { independent = no reverse_opinion = { who = liege value = 100 } }
		}
		modifier = {
			factor = 1.5
			FROM = { independent = no reverse_opinion = { who = liege value = 75 } }
		}
		modifier = {
			factor = 1.5
			FROM = { independent = no reverse_opinion = { who = liege value = 50 } }
		}
		modifier = {
			factor = 1.5
			FROM = { independent = no reverse_opinion = { who = liege value = 25 } }
		}
		modifier = {
			factor = 0.5
			FROM = { independent = no NOT = { reverse_opinion = { who = liege value = 0 } } }
		}
		modifier = {
			factor = 0.25
			FROM = { independent = no NOT = { reverse_opinion = { who = liege value = -25 } } }
		}
		modifier = {
			factor = 0
			FROM = { independent = no NOT = { reverse_opinion = { who = liege value = -50 } } }
		}
		modifier = {
			factor = 0
			FROM = { opinion = { who = ROOT value = 0 } }
		}
		modifier = {
			factor = 0
			FROM = { 
				opinion = { who = ROOT value = -25 }
				NOR = {
					trait = lunatic
					trait = possessed
					trait = ambitious
					trait = deceitful
					trait = paranoid
				}
			}
		}
		modifier = {
			factor = 2.0
			FROM = { NOT = { opinion = { who = ROOT value = -50 } } }
		}
		modifier = {
			factor = 2.0
			FROM = { NOT = { opinion = { who = ROOT value = -75 } } }
		}
		modifier = {
			factor = 0.5
			FROM = { NOT = { intrigue = 5 } }
		}
		modifier = {
			factor = 0.5
			FROM = { NOT = { intrigue = 10 } }
		}
		modifier = {
			factor = 2
			FROM = { intrigue = 15 }
		}
		modifier = {
			factor = 2
			FROM = { intrigue = 20 }
		}
		modifier = {
			factor = 2.0
			FROM = { trait = paranoid }
		}
		modifier = {
			factor = 4.0
			FROM = { trait = deceitful }
		}
	}

	success = {
		custom_tooltip = {
			text = CUSTOMTOOLTIP31
			FROM = {
				has_character_flag = plot_success
			}
		}
	}

	abort = {
		OR = {
			liege = { opinion = { who = ROOT value = 50 } }
			FROM = { is_liege_of = ROOT }
			NOT = { same_liege = FROM }
			independent = yes
			prisoner = yes
			FROM = { has_character_flag = abort_plot }
			FROM = { prisoner = yes }
			is_alive = no
			FROM = { trait = incapable }
		}
	}
	
	abort_effect = {
		FROM = {
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = event7040
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
		}
	}
	effect = {
		FROM = {
			any_plot_backer = {
				reverse_opinion = {
					modifier = opinion_grateful
					who = FROM
					years = 5
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = plot_success
				clr_character_flag = event7040
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
				change_variable = { which = "lifestyle_intrigue" value = 1 }
			}
		}
	}
}

# Character plots to fabricate evidence of treason
plot_fabricate_treason_liege = {
	type = realm_characters # All characters in the same realm, plus rivals and relatives of self, parents, children and spouse
	intrigue_plot = yes
	murder_plot = yes

	# Plotter scope
	potential = {
		prisoner = no
		is_adult = yes
		is_ruler = yes
		NOT = { trait = incapable }
		OR = {
			higher_tier_than = baron
			is_patrician = yes
		}
		hidden_tooltip = {
			OR = {
				ai = no
				has_character_flag = allow_plotting
			}
		}
	}
	
	# Target scope
	target_potential = {
		is_ruler = yes
		independent = no
		FROM = { is_liege_of = ROOT }
	}

	# Target allow trigger for when players target a specific character in the GUI
	player_allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		is_adult = yes
		prisoner = no
	}

	# Target scope
	allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		is_adult = yes
		prisoner = no
		OR = {
			higher_tier_than = baron
			is_patrician = yes
		}
		NOT = { reverse_has_truce = FROM }
		NOT = { is_allied_with = FROM }
		NOT = { has_non_aggression_pact_with = FROM }
		NOT = { liege = { opinion = { who = ROOT value = 25 } } }
		OR = {
			#at war
			war_with = FROM
			
			#are rivals
			FROM = { is_rival = ROOT }
			
			#have a claim on their lands
			FROM = {
				any_claim = { holder_scope = { character = ROOT } }
			}
			
			#they are a different culture from both you and their liege
			AND = {
				NOT = { reverse_opinion = { who = FROM value = 0 } }
				NOT = { culture = FROM }
				liege = { NOT = { culture = ROOT } }
			}
			
			#they are a different religion from both you and their liege
			AND = {
				NOT = { reverse_opinion = { who = FROM value = 0 } }
				NOT = { religion = FROM }
				liege = { NOT = { religion = ROOT } }
			}
			
			#wants revenge
			FROM = { has_opinion_modifier = { who = ROOT modifier = scheming_bastard } }
			FROM = { has_opinion_modifier = { who = ROOT modifier = devious_plotter } }
			FROM = { has_opinion_modifier = { who = ROOT modifier = declared_war } }
			
			#dislike them, and liege really dislikes them
			AND = {
				NOT = { reverse_opinion = { who = FROM value = 0 } }
				liege = { NOT = { opinion = { who = ROOT value = -50 } } }
			}
		}
	}

	chance = {
		factor = 1
		modifier = {
			factor = 0
			FROM = { lower_tier_than = count }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = dishonorable1 }
		}
		modifier = {
			factor = 0.4
			FROM = { trait = dishonorable2 }
		}
		modifier = {
			factor = 0.3
			FROM = { trait = dishonorable3 }
		}
		modifier = {
			factor = 0.2
			FROM = { trait = dishonorable4 }
		}
		modifier = {
			factor = 0.1
			FROM = { trait = dishonorable5 }
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = dishonorable6
					trait = dishonorable7
					trait = dishonorable8
					trait = dishonorable9
					trait = dishonorable10
				}
			}
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = content
					trait = honest
					trait = kind
					trait = just
					trait = charitable
				}
				NOT = { trait = lunatic }
				NOT = { trait = possessed }
			}
		}
		modifier = {
			factor = 2.0
			FROM = { independent = no reverse_opinion = { who = liege value = 100 } }
		}
		modifier = {
			factor = 1.5
			FROM = { independent = no reverse_opinion = { who = liege value = 75 } }
		}
		modifier = {
			factor = 1.5
			FROM = { independent = no reverse_opinion = { who = liege value = 50 } }
		}
		modifier = {
			factor = 1.5
			FROM = { independent = no reverse_opinion = { who = liege value = 25 } }
		}
		modifier = {
			factor = 0.5
			FROM = { independent = no NOT = { reverse_opinion = { who = liege value = 0 } } }
		}
		modifier = {
			factor = 0.25
			FROM = { independent = no NOT = { reverse_opinion = { who = liege value = -25 } } }
		}
		modifier = {
			factor = 0
			FROM = { independent = no NOT = { reverse_opinion = { who = liege value = -50 } } }
		}
		modifier = {
			factor = 0
			FROM = { opinion = { who = ROOT value = 0 } }
		}
		modifier = {
			factor = 0
			FROM = { 
				opinion = { who = ROOT value = -25 }
				NOR = {
					trait = lunatic
					trait = possessed
					trait = ambitious
					trait = deceitful
					trait = paranoid
				}
			}
		}
		modifier = {
			factor = 2.0
			FROM = { NOT = { opinion = { who = ROOT value = -50 } } }
		}
		modifier = {
			factor = 2.0
			FROM = { NOT = { opinion = { who = ROOT value = -75 } } }
		}
		modifier = {
			factor = 0.5
			FROM = { NOT = { intrigue = 5 } }
		}
		modifier = {
			factor = 0.5
			FROM = { NOT = { intrigue = 10 } }
		}
		modifier = {
			factor = 2
			FROM = { intrigue = 15 }
		}
		modifier = {
			factor = 2
			FROM = { intrigue = 20 }
		}
		modifier = {
			factor = 2.0
			FROM = { trait = paranoid }
		}
		modifier = {
			factor = 4.0
			FROM = { trait = deceitful }
		}
	}

	success = {
		hidden_tooltip = { FROM = { has_character_flag = plot_success } } 
		custom_tooltip = { text = CUSTOMTOOLTIP31 }
	}
	
	abort = {
		OR = {
			liege = { NOT = { character = FROM } }
			independent = yes
			prisoner = yes
			FROM = { has_character_flag = abort_plot }
			FROM = { prisoner = yes }
			is_alive = no
			FROM = { trait = incapable }
		}
	}
	
	abort_effect = {
		FROM = {
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = event7040
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
		}
	}
	
	effect = {
		FROM = {
			any_plot_backer = {
				reverse_opinion = {
					modifier = opinion_grateful
					who = FROM
					years = 5
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = plot_success
				clr_character_flag = event7040
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
				change_variable = { which = "lifestyle_intrigue" value = 1 }
			}
		}
	}
}

# Character plots to fabricate evidence of heresy
plot_fabricate_heresy = {
	type = realm_characters_plus # All characters in the same realm, plus rivals and relatives of self, parents, children and spouse
	intrigue_plot = yes
	murder_plot = yes

	# Plotter scope
	potential = {
		prisoner = no
		is_adult = yes
		is_ruler = yes
		NOT = { trait = incapable }
		can_excommunicate_trigger = yes
		rightful_religious_head_scope = { always = yes }
		NOT = { trait = excommunicated }
		piety = 0
		hidden_tooltip = {
			OR = {
				ai = no
				has_character_flag = allow_plotting
			}
		}
	}
	
	# Target scope
	target_potential = {
		religion = FROM
		same_liege = FROM
		controls_religion = no
		NOT = { trait = excommunicated }
		NOT = { rightful_religious_head = FROM }
		NOT = { FROM = { rightful_religious_head = ROOT } }
	}

	# Target allow trigger for when players target a specific character in the GUI
	player_allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		is_adult = yes
		NOT = { piety = 250 }
		NOT = {
			rightful_religious_head_scope = {
				NOT = { character = FROM }
				opinion = {
					who = ROOT
					value = 0
				}
			}
		}
	}

	# Target scope
	allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		is_adult = yes
		is_ruler = yes
		NOT = { piety = 250 }
		NOT = {
			rightful_religious_head_scope = {
				NOT = { character = FROM }
				opinion = {
					who = ROOT
					value = 0
				}
			}
		}
		OR = {
			#at war
			war_with = FROM
			
			#are rivals
			FROM = { is_rival = ROOT }
			
			#have a claim on their lands
			FROM = {
				any_claim = { holder_scope = { character = ROOT } }
			}
			
			#dislike them and they are cynical
			AND = {
				NOT = { reverse_opinion = { who = FROM value = 0 } }
				FROM = { trait = zealous }
				trait = cynical
			}
			
			#wants revenge
			FROM = { has_opinion_modifier = { who = ROOT modifier = scheming_bastard } }
			FROM = { has_opinion_modifier = { who = ROOT modifier = devious_plotter } }
			FROM = { has_opinion_modifier = { who = ROOT modifier = declared_war } }
		}
	}

	chance = {
		factor = 1
		modifier = {
			factor = 0
			FROM = { lower_tier_than = count }
		}
		modifier = {
			factor = 0
			FROM = { opinion = { who = ROOT value = -50 } }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = dishonorable1 }
		}
		modifier = {
			factor = 0.4
			FROM = { trait = dishonorable2 }
		}
		modifier = {
			factor = 0.3
			FROM = { trait = dishonorable3 }
		}
		modifier = {
			factor = 0.2
			FROM = { trait = dishonorable4 }
		}
		modifier = {
			factor = 0.1
			FROM = { trait = dishonorable5 }
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = dishonorable6
					trait = dishonorable7
					trait = dishonorable8
					trait = dishonorable9
					trait = dishonorable10
				}
			}
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = content
					trait = honest
					trait = kind
					trait = just
					trait = charitable
				}
				NOT = { trait = lunatic }
				NOT = { trait = possessed }
			}
		}
		modifier = {
			factor = 2.0
			FROM = { rightful_religious_head_scope = { opinion = { who = FROM value = 100 } } }
		}
		modifier = {
			factor = 1.5
			FROM = { rightful_religious_head_scope = { opinion = { who = FROM value = 75 } } }
		}
		modifier = {
			factor = 1.5
			FROM = { rightful_religious_head_scope = { opinion = { who = FROM value = 50 } } }
		}
		modifier = {
			factor = 1.5
			FROM = { rightful_religious_head_scope = { opinion = { who = FROM value = 25 } } }
		}
		modifier = {
			factor = 0.5
			FROM = { NOT = { rightful_religious_head_scope = { opinion = { who = FROM value = 0 } } } }
		}
		modifier = {
			factor = 0.25
			FROM = { NOT = { rightful_religious_head_scope = { opinion = { who = FROM value = -25 } } } }
		}
		modifier = {
			factor = 0
			FROM = { NOT = { rightful_religious_head_scope = { opinion = { who = FROM value = -50 } } } }
		}
		modifier = {
			factor = 0
			FROM = { opinion = { who = ROOT value = 0 } }
		}
		modifier = {
			factor = 2.0
			FROM = { NOT = { opinion = { who = ROOT value = -50 } } }
		}
		modifier = {
			factor = 2.0
			FROM = { NOT = { opinion = { who = ROOT value = -75 } } }
		}
		modifier = {
			factor = 0.5
			FROM = { NOT = { intrigue = 5 } }
		}
		modifier = {
			factor = 0.5
			FROM = { NOT = { intrigue = 10 } }
		}
		modifier = {
			factor = 2
			FROM = { intrigue = 15 }
		}
		modifier = {
			factor = 2
			FROM = { intrigue = 20 }
		}
		modifier = {
			factor = 2.0
			FROM = { trait = paranoid }
		}
		modifier = {
			factor = 4.0
			FROM = { trait = zealous }
		}
	}

	success = {
		trait = excommunicated
		FROM = { has_character_flag = plot_success }
	}
	
	abort = {
		OR = {
			AND = {
				trait = excommunicated
				FROM = { NOT = { has_character_flag = plot_success } }
			}
			FROM = { trait = excommunicated }
			NOT = { religion = FROM }
			piety = 500
			rightful_religious_head_scope = {
				NOT = { character = FROM }
				opinion = {
					who = ROOT
					value = 25
				}
			}
			FROM = { has_character_flag = abort_plot }
			FROM = { prisoner = yes }
			is_alive = no
			FROM = { trait = incapable }
		}
	}
	
	abort_effect = {
		FROM = {
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = event7040
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
				clr_character_flag = plot_success
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
		}
	}
	effect = {
		FROM = {
			any_plot_backer = {
				reverse_opinion = {
					modifier = opinion_grateful
					who = FROM
					years = 5
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = event7040
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
				clr_character_flag = plot_success
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
				change_variable = { which = "lifestyle_intrigue" value = 1 }
			}
		}
	}
}

# Kidnap liege and force him to give you a piece of land
plot_kidnap_liege = {
	type = realm_characters # All characters in the same realm, plus rivals and relatives of self, parents, children and spouse
	intrigue_plot = yes
	murder_plot = yes

	# Plotter scope
	potential = {
		prisoner = no
		is_ruler = no
		is_adult = yes
		NOT = { trait = incapable }
		has_character_flag = allow_plotting
	}
	
	# Target scope
	target_potential = {
		is_vassal_or_below  = FROM
	}

	# Target scope
	allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		NOT = { has_opinion_modifier = { who = FROM modifier = kidnapped_me } }
		NOT = { is_married = FROM }
		any_demesne_title = {
			can_be_given_away = yes
			tier = COUNT
			location = { is_capital = no }
			OR = {
				claimed_by = FROM
				FROM = { has_opinion_modifier = { who = ROOT modifier = opinion_denied_title } }
				FROM = { has_opinion_modifier = { who = ROOT modifier = opinion_broken_title_promise } }
				FROM = { has_opinion_modifier = { who = ROOT modifier = disinherited_me } }
				FROM = { has_opinion_modifier = { who = ROOT modifier = succ_law_disinherit } }
			}
		}
	}

	chance = {
		factor = 1
		modifier = {
			factor = 0
			FROM = {
				is_female = yes
				NOR = {
					trait = ambitious
					trait = lunatic
					trait = possessed
				}
			}
			NOT = {
				any_demesne_title = {
					can_be_given_away = yes
					tier = COUNT
					location = { is_capital = no }
					NOR = {
						has_law = agnatic_succession
						has_law = cognatic_succession
					}
					OR = {
						claimed_by = FROM
						FROM = { has_opinion_modifier = { who = ROOT modifier = opinion_denied_title } }
						FROM = { has_opinion_modifier = { who = ROOT modifier = opinion_broken_title_promise } }
						FROM = { has_opinion_modifier = { who = ROOT modifier = disinherited_me } }
						FROM = { has_opinion_modifier = { who = ROOT modifier = succ_law_disinherit } }
					}
				}
			}
		}
		modifier = {
			factor = 0
			FROM = {
				is_female = no
				NOR = {
					trait = ambitious
					trait = lunatic
					trait = possessed
				}
			}
			NOT = {
				any_demesne_title = {
					can_be_given_away = yes
					tier = COUNT
					location = { is_capital = no }
					NOR = {
						has_law = enatic_succession
						has_law = enatic_cognatic_succession
					}
					OR = {
						claimed_by = FROM
						FROM = { has_opinion_modifier = { who = ROOT modifier = opinion_denied_title } }
						FROM = { has_opinion_modifier = { who = ROOT modifier = opinion_broken_title_promise } }
						FROM = { has_opinion_modifier = { who = ROOT modifier = disinherited_me } }
						FROM = { has_opinion_modifier = { who = ROOT modifier = succ_law_disinherit } }
					}
				}
			}
		}
		modifier = {
			factor = 0
			FROM = {
				any_heir_title = { always = yes }
				NOR = {
					has_opinion_modifier = { who = ROOT modifier = opinion_denied_title }
					has_opinion_modifier = { who = ROOT modifier = opinion_broken_title_promise }
				}
			}
		}
		modifier = {
			factor = 0.5
			NOT = { is_liege_of = FROM }
		}
		modifier = {
			factor = 0.5
			NOT = {
				any_demesne_title = {
					can_be_given_away = yes
					tier = COUNT
					location = { is_capital = no }
					OR = {
						FROM = { has_strong_claim = PREV }
						FROM = { has_opinion_modifier = { who = ROOT modifier = opinion_denied_title } }
						FROM = { has_opinion_modifier = { who = ROOT modifier = opinion_broken_title_promise } }
						FROM = { has_opinion_modifier = { who = ROOT modifier = disinherited_me } }
						FROM = { has_opinion_modifier = { who = ROOT modifier = succ_law_disinherit } }
					}
				}
			}
		}
		modifier = {
			factor = 0
			FROM = { war = yes }
		}
		modifier = {
			factor = 0.5
			FROM = {
				NOT = { is_child_of = ROOT }
				OR = {
					has_character_modifier = estates_1
					has_character_modifier = estates_2
					has_character_modifier = estates_3
					has_character_modifier = estates_4
					has_character_modifier = estates_5
				}
			}
		}
		modifier = {
			factor = 0.85
			FROM = { has_character_modifier = estates_1 }
		}
		modifier = {
			factor = 0.70
			FROM = { has_character_modifier = estates_2 }
		}
		modifier = {
			factor = 0.55
			FROM = { has_character_modifier = estates_3 }
		}
		modifier = {
			factor = 0.40
			FROM = { has_character_modifier = estates_4 }
		}
		modifier = {
			factor = 0.25
			FROM = { has_character_modifier = estates_5 }
		}
		modifier = {
			factor = 2.0
			FROM = { religion_group = muslim }
		}
		modifier = {
			factor = 3.0
			FROM = { trait = decadent }
		}
		modifier = {
			factor = 3.0
			OR = {
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_broken_title_promise }
				reverse_has_opinion_modifier = { who = FROM modifier = disinherited_me }
				reverse_has_opinion_modifier = { who = FROM modifier = succ_law_disinherit }
			}
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = craven
					trait = imbecile
					trait = content
				}
			}
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = honest
					trait = humble
					trait = kind
					trait = just
				}
				NOR = {
					trait = lunatic
					trait = possessed
				}
			}
		}
		modifier = {
			factor = 0.2
			FROM = {
				OR = {
					trait = slow
					trait = dull
				}
			}
		}
		modifier = {
			factor = 0
			reverse_opinion = { who = FROM value = 50 }
		}
		modifier = {
			factor = 0.25
			reverse_opinion = { who = FROM value = 25 }
			FROM = {
				NOR = {
					trait = envious
					trait = deceitful
					trait = ambitious
				}
			}
		}
		modifier = {
			factor = 0.5
			reverse_opinion = { who = FROM value = 0 }
		}
		modifier = {
			factor = 1.5
			NOT = { reverse_opinion = { who = FROM value = -25 } }
		}
		modifier = {
			factor = 1.5
			NOT = { reverse_opinion = { who = FROM value = -50 } }
		}
		modifier = {
			factor = 1.5
			NOT = { reverse_opinion = { who = FROM value = -75 } }
		}
		modifier = {
			factor = 0
			FROM = { NOT = { intrigue = 6 } }
		}
		modifier = {
			factor = 1.5
			FROM = { intrigue = 10 }
		}
		modifier = {
			factor = 1.5
			FROM = { intrigue = 15 }
		}
		modifier = {
			factor = 1.5
			FROM = { intrigue = 20 }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = charitable }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = patient }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = slothful }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = wroth }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = proud }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = brave }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = deceitful }
		}
		modifier = {
			factor = 2.0
			FROM = { trait = greedy }
		}
		modifier = {
			factor = 2.0
			FROM = { trait = envious }
		}
		modifier = {
			factor = 4.0
			FROM = { trait = ambitious }
		}
	}

	success = {
		FROM = {
			has_character_flag = kidnap_attempt
			is_ruler = yes
		}
	}
	
	abort = {
		OR = {
			FROM = { has_character_flag = abort_plot }
			FROM = { prisoner = yes }
			FROM = { 
				is_ruler = yes
				NOT = { has_character_flag = kidnap_attempt }
			}
			is_married = FROM
			FROM = { trait = incapable }
			NOT = { is_vassal_or_below = FROM }
			NOT = {
				any_demesne_title = {
					can_be_given_away = yes
					tier = COUNT
					location = { is_capital = no }
					OR = {
						claimed_by = FROM
						FROM = { has_opinion_modifier = { who = ROOT modifier = opinion_denied_title } }
						FROM = { has_opinion_modifier = { who = ROOT modifier = opinion_broken_title_promise } }
						FROM = { has_opinion_modifier = { who = ROOT modifier = disinherited_me } }
						FROM = { has_opinion_modifier = { who = ROOT modifier = succ_law_disinherit } }
					}
				}
			}
		}
	}
	
	abort_effect = {
		FROM = {
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = event7040
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
				clr_character_flag = kidnap_attempt
				clr_character_flag = kidnap_in_transit
				clr_character_flag = kidnap_in_bed
				clr_character_flag = kidnap_while_hunting
				clr_character_flag = kidnap_while_carousing
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
				set_character_flag = obj_landed_title
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
		}
	}
	
	effect = {
		FROM = {
			any_plot_backer = {
				reverse_opinion = {
					modifier = opinion_grateful
					who = FROM
					years = 5
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = event7040
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
				clr_character_flag = kidnap_attempt
				clr_character_flag = kidnap_in_transit
				clr_character_flag = kidnap_in_bed
				clr_character_flag = kidnap_while_hunting
				clr_character_flag = kidnap_while_carousing
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
				change_variable = { which = "lifestyle_intrigue" value = 1 }
				set_character_flag = obj_landed_title
			}
		}
	}
}

# Seduce someone.
plot_seduce = {
	type = realm_characters
	intrigue_plot = yes
	
	# Plotter scope
	potential = {		
		NOT = { has_dlc = "Way of Life" }		
		prisoner = no
		is_adult = yes
		is_pregnant = no
		OR = {
			has_lover = no
			AND = {
				OR = {
					trait = lustful
					trait = hedonist
					trait = lunatic
				}
				OR = {
					NOT = { num_of_lovers = 2 }
					AND = {
						NOT = { num_of_lovers = 3 }
						intrigue = 20
					}
					AND = {
						NOT = { num_of_lovers = 4 }
						intrigue = 25
					}
					AND = {
						NOT = { num_of_lovers = 5 }
						intrigue = 30
					}
				}
			}
		}
		NOT = { trait = incapable }
		NOT = { trait = imbecile }
		NOT = { trait = clubfooted }
		NOT = { trait = hunchback }
		NOT = { trait = harelip }
		NOT = { trait = ugly }
		NOT = { trait = lisp }
		NOT = { trait = inbred }
		NOT = { trait = dwarf }
		NOT = { trait = homosexual }
		NOT = { trait = chaste }
		NOT = { trait = celibate }
		NOT = { trait = eunuch }
		NOT = { has_character_modifier = messalian_prayer }
		OR = {
			NOT = { health_traits = 1 }
			trait = lunatic
			trait = possessed
		}
		NOT = { health_traits = 2 }
		hidden_tooltip = {
			OR = {
				ai = no
				has_character_flag = allow_plotting
			}
		}
	}
	
	# Target scope
	target_potential = {
		NOT = { character = FROM }
		OR = {
			AND = {
				same_sex = FROM
				FROM = { trait = homosexual }
			}
			AND = {
				is_opposite_sex = FROM
				FROM = { NOT = { trait = homosexual } }
			}
		}
		same_realm = FROM
	}
	
	# Target allow trigger for when players target a specific character in the GUI
	player_allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		is_adult = yes
		is_pregnant = no
		NOT = { trait = celibate }
		NOT = { trait = chaste }
		NOT = { any_spouse = { character = FROM } }
		OR = {
			NOT = { is_close_relative = FROM }
			AND = {
				OR = {
					religion_group = zoroastrian_group
					religion = messalian
				}
				OR = {
					FROM = { religion_group = zoroastrian_group }
					FROM = { religion = messalian }
				}
			}
		}
		OR = {
			has_lover = no
			AND = {
				NOT = { num_of_lovers = 3 }
				trait = lustful
				trait = hedonist
				trait = lunatic
			}
		}
		FROM = {
			NOT = { has_opinion_modifier = { who = ROOT modifier = love_scorned } }
		}
	}
	
	# Target character scope
	allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		is_adult = yes
		is_pregnant = no
		NOT = { trait = celibate }
		NOT = { trait = chaste }
		NOT = { any_spouse = { character = FROM } }
		NOT = { any_lover = { character = FROM } }
		NOT = { any_consort = { character = FROM } }
		OR = {
			NOT = { is_close_relative = FROM }
			AND = {
				OR = {
					religion_group = zoroastrian_group
					religion = messalian
				}
				OR = {
					FROM = { religion_group = zoroastrian_group }
					FROM = { religion = messalian }
				}
			}
		}
		OR = {
			has_lover = no
			AND = {
				NOT = { num_of_lovers = 5 }
				trait = lustful
				trait = hedonist
				trait = lunatic
			}
		}
		FROM = {
			NOT = { has_opinion_modifier = { who = ROOT modifier = love_scorned } }
		}
		
		OR = {
			#  liege or liege spouse
			is_liege_of = FROM
			spouse = { is_liege_of = FROM }
			
			# child of liege
			father = { is_liege_of = FROM }
			mother = { is_liege_of = FROM }
		}
	}
	
	chance = {
		factor = 1
		modifier = {
			factor = 0
			has_game_rule = {
				name = ai_seduction
				value = off
			}
		}
		modifier = {
			factor = 0
			FROM = { trait = content }
		}
		modifier = {
			factor = 0
			NOT = { opinion = { who = FROM value = 0 } }
		}
		modifier = {
			factor = 0.3
			opinion = { who = FROM value = 20 }
		}
		modifier = {
			factor = 0.4
			opinion = { who = FROM value = 40 }
		}
		modifier = {
			factor = 0.5
			opinion = { who = FROM value = 60 }
		}
		modifier = {
			factor = 0.6
			opinion = { who = FROM value = 80 }
		}
		modifier = {
			factor = 0.5
			NOT = { is_liege_of = FROM }
		}
		modifier = {
			factor = 1.1
			FROM = { trait = arbitrary }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = deceitful }
		}
		modifier = {
			factor = 2.0
			FROM = { trait = ambitious }
		}
		modifier = {
			factor = 4.0
			FROM = {
				OR = {
					trait = lustful
					trait = hedonist
				}
			}
		}
		modifier = {
			factor = 1.5
			FROM = { trait = genius }
		}
		modifier = {
			factor = 1.25
			FROM = { trait = gregarious }
		}
		modifier = {
			factor = 1.25
			FROM = { trait = fair }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = honest }
		}
		modifier = {
			factor = 0.5
			FROM = {
				OR = {
					trait = slow
					trait = dull
				}
			}
		}
		modifier = {
			factor = 0.85
			FROM = { age = 25 }
		}
		modifier = {
			factor = 0.5
			FROM = { age = 30 }
		}
		modifier = {
			factor = 0.05
			FROM = { age = 45 }
		}
		modifier = {
			factor = 0.4
			FROM = { num_of_children = 1 }
		}
		modifier = {
			factor = 0.25
			FROM = { num_of_lovers = 1 }
		}
		modifier = {
			factor = 2.0
			OR = {
				FROM = { trait = lunatic }
				FROM = { trait = possessed }
			}
		}
		modifier = {
			factor = 0.20
			FROM = {
				any_child = { trait = bastard }
			}
		}
		modifier = {
			factor = 0.20
			is_ruler = no
			trait = bastard
		}
		modifier = {
			factor = 0.5
			FROM = { is_married = yes }
		}
		modifier = {
			factor = 1.10
			tier = duke
		}
		modifier = {
			factor = 1.5
			trait = fair
		}
		modifier = {
			factor = 1.20
			OR = {
				tier = king
				tier = emperor
			}
		}
		modifier = {
			factor = 0.01
			FROM = { is_priest = yes }
		}
		modifier = {
			factor = 0.35
			FROM = {
				spouse = { is_ruler = yes }
			}
		}
	}
	
	success = {
		any_lover = { character = FROM }
	}
	
	abort = {
		OR = {
			is_alive = no
			AND = {
				has_lover = yes
				NOT = { trait = lustful }
				NOT = { trait = hedonist }
				NOT = { trait = lunatic }
				FROM = { NOT = { has_character_flag = plot_seducer } }
			}
			AND = {
				num_of_lovers = 5
				trait = lustful
				trait = hedonist
				trait = lunatic
				FROM = { NOT = { has_character_flag = plot_seducer } }
			}
			trait = celibate
			trait = chaste
			FROM = { trait = celibate }
			FROM = { 
				has_lover = yes
				NOT = { trait = lustful }
				NOT = { trait = hedonist }
				NOT = { trait = lunatic }
				NOT = { has_character_flag = plot_seducer }
			}
			FROM = { has_character_flag = abort_plot }
			FROM = {
				health_traits = 1
				NOT = { trait = lunatic }
				NOT = { trait = possessed }
			}
			FROM = { health_traits = 2 }
			AND = {
				is_pregnant = yes
				FROM = { NOT = { has_character_flag = plot_seducer } }
			}
			FROM = {
				is_pregnant = yes
				NOT = { has_character_flag = plot_seducer }
			}
		}
	}
	
	abort_effect = {
		FROM = {
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = plot_seduce_decision_100_taken
				clr_character_flag = seduce_in_motion
				clr_character_flag = abort_plot
				clr_character_flag = allow_plotting
				clr_character_flag = plot_check
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
		}
	}
	
	effect = {
		FROM = {
			prestige = 25
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = plot_seduce_decision_100_taken
				clr_character_flag = seduce_in_motion
				clr_character_flag = abort_plot
				clr_character_flag = plot_seducer
				clr_character_flag = allow_plotting
				clr_character_flag = plot_check
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
				change_variable = { which = "lifestyle_intrigue" value = 1 }
			}
		}
	}
}

# Murder someone out of revenge
plot_take_revenge = {
	type = realm_characters_plus # All characters in the same realm, plus rivals and relatives of self, parents, children and spouse
	intrigue_plot = yes
	murder_plot = yes
	
	# Plotter scope
	potential = {
		prisoner = no
		is_adult = yes
		NOT = { trait = incapable }
		hidden_tooltip = {
			OR = {
				ai = no
				has_character_flag = allow_plotting
			}
		}
	}
	
	# Target scope
	target_potential = {
		OR = {
			FROM = { is_foe = ROOT }
			AND = {
				OR = {
					has_plot = plot_kill_character
					has_plot = plot_kill_spouse
					has_plot = plot_take_revenge
				}
				plot_is_known_by = FROM
				plot_target_char = {
					OR = {
						character = FROM
						is_child_of = FROM
						is_mother = FROM
						is_father = FROM
						is_married = FROM
					}
				}
			}
		}
	}
	
	# Target allow trigger for when players target a specific character in the GUI
	player_allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		NOT = { character = FROM }
		is_within_diplo_range = FROM
	}
	
	# Target character scope
	allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		NOT = { character = FROM }
		is_within_diplo_range = FROM
	}
	
	chance = {
		factor = 20
		modifier = {
			factor = 0.5
			FROM = { trait = dishonorable1 }
		}
		modifier = {
			factor = 0.4
			FROM = { trait = dishonorable2 }
		}
		modifier = {
			factor = 0.3
			FROM = { trait = dishonorable3 }
		}
		modifier = {
			factor = 0.2
			FROM = { trait = dishonorable4 }
		}
		modifier = {
			factor = 0.1
			FROM = { trait = dishonorable5 }
		}
		modifier = {
			factor = 0
			FROM = {
				ai = yes
				OR = {
					trait = dishonorable6
					trait = dishonorable7
					trait = dishonorable8
					trait = dishonorable9
					trait = dishonorable10
				}
			}
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = kind
					trait = just
				}
				NOT = { trait = lunatic } 
				NOT = { trait = possessed }
			}
		}		
		modifier = {
			factor = 0.1
			FROM = {
				trait = content
				NOT = { trait = lunatic } 
				NOT = { trait = possessed }
			}
		}
		modifier = {
			factor = 0.1
			FROM = {
				trait = honest
				NOT = { trait = lunatic } 
				NOT = { trait = possessed }
			}
		}
		modifier = {
			factor = 0.1
			FROM = { trait = slothful }
		}
		modifier = {
			factor = 0.1
			FROM = { trait = craven }
		}
		modifier = {
			factor = 0
			FROM = { pacifist = yes }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = deceitful }
		}
		modifier = {
			factor = 2.0
			FROM = { trait = impaler }
		}
		modifier = {
			factor = 2.0
			FROM = { trait = brave }
		}
		modifier = {
			factor = 3.0
			FROM = { trait = wroth }
		}
		modifier = {
			factor = 3.0
			FROM = { trait = lunatic }
		}
		modifier = {
			factor = 10.0
			FROM = { trait = possessed }
		}
		modifier = {
			factor = 0
			FROM = { opinion = { who = ROOT value = 0 } }
		}
		modifier = {
			factor = 1.5
			NOT = { their_opinion = { who = FROM value = -25 } }
		}
		modifier = {
			factor = 2.0
			NOT = { their_opinion = { who = FROM value = -50 } }
		}
		modifier = {
			factor = 2.0
			NOT = { their_opinion = { who = FROM value = -75 } }
		}
		modifier = {
			factor = 0.25
			FROM = { NOT = { intrigue = 8 } }
		}
		modifier = {
			factor = 2
			FROM = { intrigue = 15 }
		}
		modifier = {
			factor = 2
			FROM = { intrigue = 20 }
		}
	}
	
	success = {
		is_alive = no
		hidden_tooltip = {
			FROM = {
				OR = {
					has_character_flag = murder_in_motion
					has_character_flag = hiding_murder_in_motion
				}
			}
		}
	}
	
	abort = {
		OR = {
			FROM = { has_character_flag = abort_plot }
			FROM = { prisoner = yes }
			FROM = { trait = incapable }
			AND = {
				is_alive = no
				NOR = {
					FROM = { has_character_flag = murder_in_motion }
					FROM = { has_character_flag = hiding_murder_in_motion }
				}
			}
		}
	}
	
	abort_effect = {
		FROM = {
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = event7040
				clr_character_flag = event1007003
				clr_character_flag = murder_in_motion
				clr_character_flag = hiding_murder_in_motion
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
		}
	}
	
	effect = {
		FROM = {
			any_plot_backer = {
				reverse_opinion = {
					modifier = opinion_grateful
					who = FROM
					years = 5
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = event7040
				clr_character_flag = event1007003
				clr_character_flag = murder_in_motion
				clr_character_flag = hiding_murder_in_motion
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
				change_variable = { which = "lifestyle_intrigue" value = 1 }
			}
		}
	}
}

# Plot to take control of your wife's realm through Jure Uxoris
plot_usurp_wife = {
	type = spouse
	vassal_intrigue_plot = yes
	intrigue_plot = yes
	
	#Plotter scope
	potential = {
		prestige = 1
		is_female = no
		OR = {
			is_ruler = no
			AND = {
				is_ruler = yes
				is_feudal = yes
				is_patrician = no
				demesne_efficiency = 1.0
			}
		}
		prisoner = no
		is_married = yes
		OR = {
			diplomacy = 8
			stewardship = 8
			martial = 8
			intrigue = 8
		}
		NOR = {
			dynasty = 0
			trait = excommunicated
			trait = incapable
			trait = bastard
			is_dumb_trigger = yes
			trait = content
			trait = eunuch
			trait = monk
			health_traits = 1
			has_character_modifier = failed_to_usurp_wife
		}
		hidden_tooltip = {
			OR = {
				ai = no
				has_character_flag = allow_plotting
			}
		}
	}
	
	# Target scope
	target_potential = {
		is_married = FROM
		is_female = yes
		is_ruler = yes
	}
	
	#Target scope
	allow = {
		is_feudal = yes
		is_pregnant = no
		OR = {
			FROM = { is_ruler = no }
			is_vassal_or_below = FROM
			same_realm = FROM
			AND = {
				independent = yes
				FROM = { independent = yes }
			}
		}
		primary_title = {
			OR = {
				has_law = succ_gavelkind
				has_law = succ_seniority
				has_law = succ_primogeniture
				has_law = succ_ultimogeniture
			}
			NOR = {
				has_law = enatic_cognatic_succession
				has_law = enatic_succession
			}
		}
		OR = {
			AND = {
				culture_group = FROM
				religion_group = FROM
			}
			capital_scope = {
				culture_group = FROM
				religion_group = FROM
			}
			dynasty = FROM
			FROM = {
				is_ruler = yes
				OR = {
					trait = ambitious
					trait = gregarious
					trait = lunatic
					trait = possessed
				}
			}
		}
		NOR = {
			AND = {
				trait = proud
				FROM = { trait = humble }
			}
			AND = {
				trait = brave
				FROM = { trait = craven }
			}
			AND = {
				trait = diligent
				FROM = { trait = slothful }
			}
			AND = {
				trait = gregarious
				FROM = { trait = shy }
			}
		}
		OR = {
			NOT = { trait = elusive_shadow }
			FROM = {
				OR = {
					trait = ambitious
					trait = genius
					trait = elusive_shadow
				}
			}
		}
		OR = {
			NOT = { trait = genius }
			FROM = {
				OR = {
					trait = ambitious
					trait = genius
					trait = elusive_shadow
				}
			}
		}
		OR = {
			NOT = { trait = ambitious }
			FROM = {
				OR = {
					trait = ambitious
					trait = genius
					trait = elusive_shadow
				}
			}
		}
		OR = {
			trait = excommunicated
			trait = infirm
			trait = incapable
			trait = depressed
			trait = blinded
			trait = content
			trait = drunkard
			trait = lunatic
			trait = possessed
			trait = leper
			trait = inbred
			is_dumb_trigger = yes
			calc_true_if = {
				amount = 2
				trait = trusting
				trait = shy
				trait = craven
				trait = humble
			}
		}
		OR = {
			NOT = { has_law = true_cognatic_succession }
			AND = {
				is_married_matrilineally = no
				OR = {
					trait = incapable
					trait = lunatic
					trait = possessed
					trait = imbecile
				}
			}
		}
	}

	chance = {
		factor = 10
		modifier = {
			factor = 0
			reverse_opinion = {	who = FROM value = 0 }
		}
		modifier = {
			factor = 10
			NOT = { reverse_opinion = {	who = FROM value = -50 } }
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = kind
					trait = honest
					trait = humble
				}
			}
		}
		modifier = {
			factor = 0.1
			FROM = {
				OR = {
					trait = slothful
					trait = craven
				}
			}
		}		
		modifier = {
			factor = 2
			FROM = { trait = envious }
		}
		modifier = {
			factor = 2
			FROM = { trait = greedy }
		}
		modifier = {
			factor = 2
			FROM = {
				OR = {
					trait = ambitious
					trait = deceitful
					trait = proud
					trait = cruel
				}
			}
		}
	}

	success = {
		FROM = { has_character_flag = usurp_wife_plot_success }
	}

	abort = {
		OR = {
			AND = {
				FROM = { NOT = { has_character_flag = usurp_wife_plot_success } }
				NOR = {
					FROM = { is_ruler = no }
					is_vassal_or_below = FROM
					same_realm = FROM
					AND = {
						independent = yes
						FROM = { independent = yes }
					}
				}
			}
			NOT = { any_spouse = { character = FROM } }
			has_law = enatic_cognatic_succession
			has_law = enatic_succession
			NOR = {
				has_law = succ_gavelkind
				has_law = succ_seniority
				has_law = succ_primogeniture
				has_law = succ_ultimogeniture
			}
			FROM = { has_character_flag = abort_plot }
			FROM = { trait = incapable }
			FROM = { prisoner = yes }
			FROM = { trait = content }
			FROM = { independent = no }
		}
	}

	abort_effect = {
		opinion = { who = FROM modifier = opinion_recent_plot months = 60 }
		FROM = {
			if = {
				limit = { is_married = yes }
				hidden_tooltip = {
					add_character_modifier = {
						name = failed_to_usurp_wife
						days = 1825
						hidden = yes
					}
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			clr_character_flag = abort_plot
			clr_character_flag = allow_plotting
			clr_character_flag = plot_check
			clr_character_flag = plot_usurp_wife_decision_taken
		}
	}

	effect = {
		opinion = { who = FROM modifier = opinion_recent_plot months = 60 }
		FROM = {
			change_intrigue = 1
			any_plot_backer = {
				reverse_opinion = {
					who = FROM
					modifier = opinion_grateful
					years = 5
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			clr_character_flag = usurp_wife_plot_success
			clr_character_flag = abort_plot
			clr_character_flag = allow_plotting
			clr_character_flag = plot_check
			set_character_flag = usurped_my_wife
			change_variable = { which = "lifestyle_intrigue" value = 1 }
		}
	}
}

# Replace your liege's current regent
plot_replace_regent = {
	type = realm_characters
	vassal_intrigue_plot = yes
	
	# Plotter scope
	potential = {
		prisoner = no
		independent = no
		is_adult = yes
		NOR = {
			trait = incapable
			has_minor_title = title_regent
			has_character_modifier = replace_regent_timer
		}
		hidden_tooltip = {
			OR = {
				ai = no
				has_character_flag = allow_plotting
			}
		}
	}
	
	# Target scope
	target_potential = {
		independent = no
		NOT = { character = FROM }
		same_liege = FROM
		has_minor_title = title_regent
	}
	
	# Target allow trigger for when players target a specific character in the GUI
	player_allow = {
		liege = {
			num_of_vassals = 3
			has_regent = yes
			OR = {
				any_courtier = { character = FROM }
				FROM = { is_councillor = yes }
			}
			# Must be a spouse, lover, close relative, councillor or heir
			OR = {
				is_married = FROM
				is_lover = FROM
				is_close_relative = FROM
				FROM = { is_councillor = yes }
				current_heir = { character = FROM }
			}
			# No women unless they are mothers/wives/councillors or title is true cognatic or enatic
			OR = {
				FROM = { is_female = no }
				FROM = { is_councillor = yes }
				is_married = FROM
				is_mother = FROM
				current_heir = { character = FROM }
				NOR = {
					has_law = cognatic_succession
					has_law = agnatic_succession
				}
			}
			# No men unless they are fathers/husbands/councillors or title is true cognatic, cognatic, or agnatic
			OR = {
				FROM = { is_female = yes }
				FROM = { is_councillor = yes }
				is_married = FROM
				is_father = FROM
				current_heir = { character = FROM }
				NOR = {
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
		}
	}
	
	# Target character scope
	allow = {
		liege = {
			num_of_vassals = 3
			has_regent = yes
			OR = {
				any_courtier = { character = FROM }
				FROM = { is_councillor = yes }
			}
			# Must be a spouse, lover, close relative, councillor or heir
			OR = {
				is_married = FROM
				is_lover = FROM
				is_close_relative = FROM
				FROM = { is_councillor = yes }
				current_heir = { character = FROM }
			}
			# No women unless they are mothers/wives/councillors or title is true cognatic or enatic
			OR = {
				FROM = { is_female = no }
				FROM = { is_councillor = yes }
				is_married = FROM
				is_mother = FROM
				current_heir = { character = FROM }
				NOR = {
					has_law = cognatic_succession
					has_law = agnatic_succession
				}
			}
			# No men unless they are fathers/husbands/councillors or title is true cognatic, cognatic, or agnatic
			OR = {
				FROM = { is_female = yes }
				FROM = { is_councillor = yes }
				is_married = FROM
				is_father = FROM
				current_heir = { character = FROM }
				NOR = {
					has_law = enatic_cognatic_succession
					has_law = enatic_succession
				}
			}
		}
	}
	
	chance = {
		factor = 5
		modifier = {
			factor = 0.75
			reverse_opinion = { who = FROM value = 0 }
		}
		modifier = {
			factor = 0.75
			reverse_opinion = { who = FROM value = 20 }
		}
		modifier = {
			factor = 0.5
			reverse_opinion = { who = FROM value = 30 }
		}
		modifier = {
			factor = 0.5
			reverse_opinion = { who = FROM value = 40 }
		}
		modifier = {
			factor = 0
			reverse_opinion = { who = FROM value = 50 }
		}
		modifier = {
			factor = 1.5
			NOT = { reverse_opinion = { who = FROM value = -20 } }
		}
		modifier = {
			factor = 1.5
			NOT = { reverse_opinion = { who = FROM value = -40 } }
		}
		modifier = {
			factor = 1.5
			NOT = { reverse_opinion = { who = FROM value = -60 } }
		}
		modifier = {
			factor = 1.5
			NOT = { reverse_opinion = { who = FROM value = -80 } }
		}
		modifier = {
			factor = 0.75
			attribute_diff = {
				character = FROM
				attribute = intrigue
				value = 2
			}
		}
		modifier = {
			factor = 0.75
			attribute_diff = {
				character = FROM
				attribute = intrigue
				value = 4
			}
		}
		modifier = {
			factor = 0.5
			attribute_diff = {
				character = FROM
				attribute = intrigue
				value = 6
			}
		}
		modifier = {
			factor = 1.25
			FROM = {
				attribute_diff = {
					character = ROOT
					attribute = intrigue
					value = 2
				}
			}
		}
		modifier = {
			factor = 1.25
			FROM = {
				attribute_diff = {
					character = ROOT
					attribute = intrigue
					value = 4
				}
			}
		}
		modifier = {
			factor = 1.5
			FROM = {
				attribute_diff = {
					character = ROOT
					attribute = intrigue
					value = 6
				}
			}
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					is_ill = yes
					is_dumb_trigger = yes
					trait = humble
					trait = content
					trait = trusting
				}
			}
		}
		modifier = {
			factor = 5.0
			FROM = {
				OR = {
					trait = lunatic
					trait = possessed
				}
			}
		}
		modifier = {
			factor = 2.0
			FROM = { trait = ambitious }
		}
		modifier = {
			factor = 2.0
			FROM = { trait = paranoid }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = greedy }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = envious }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = deceitful }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = proud }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = slothful }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = kind }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = shy }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = craven }
		}
	}
	
	success = {
		same_liege = FROM
		FROM = { has_minor_title = title_regent }
	}
	
	abort = {
		OR = {
			FROM = { has_character_flag = abort_plot }
			FROM = { prisoner = yes }
			FROM = { trait = incapable }
			FROM = {
				NOR = {
					is_councillor = yes
					liege = { any_courtier = { character = PREVPREV } }
				}
			}
			NOT = { same_liege = FROM }
			liege = { has_regent = no }
			liege = {
				regent = {
					NOT = { character = FROM }
					NOT = { character = ROOT }
				}
			}
		}
	}
	
	abort_effect = {
		FROM = {
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = allow_plotting
				clr_character_flag = abort_plot
				clr_character_flag = plot_check
				clr_character_flag = speed_up_replace_regent
				clr_character_flag = replace_regent_plot_discovery
				add_character_modifier = {
					name = replace_regent_timer
					hidden = yes
					duration = 3650
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
		}
	}
	
	effect = {
		FROM = {
			change_intrigue = 1
			any_plot_backer = {
				reverse_opinion = {
					who = FROM
					modifier = opinion_grateful
					years = 5
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			hidden_tooltip = {
				clr_character_flag = allow_plotting
				clr_character_flag = abort_plot
				clr_character_flag = plot_check
				clr_character_flag = speed_up_replace_regent
				clr_character_flag = replace_regent_plot_discovery
				change_variable = { which = "lifestyle_intrigue" value = 1 }
			}
		}
	}
}

# Usurp an incapable liege's titles
plot_incapable_usurp = {
	type = realm_characters
	vassal_intrigue_plot = yes
	
	# Plotter scope
	potential = {
		OR = {
			is_tribal = yes
			is_feudal = yes
		}
		prisoner = no
		independent = no
		is_adult = yes
		NOR = {
			trait = incapable
			is_dumb_trigger = yes
			trait = inbred
		}
		hidden_tooltip = {
			OR = {
				ai = no
				has_character_flag = allow_plotting
			}
		}
	}
	
	# Target scope
	target_potential = {
		is_liege_of = FROM
		trait = incapable
	}
	
	# Target allow trigger for when players target a specific character in the GUI
	player_allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		OR = {
			is_tribal = yes
			is_feudal = yes
		}
		num_of_vassals = 3
		is_adult = yes
		regent = { character = FROM }
		primary_title = {
			NOR = {
				has_law = succ_elective_gavelkind
				has_law = succ_feudal_elective
				has_law = succ_tanistry
			}
		}
	}
	
	# Target character scope
	allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		OR = {
			is_tribal = yes
			is_feudal = yes
		}
		num_of_vassals = 3
		is_adult = yes
		regent = { character = FROM }
		primary_title = {
			NOR = {
				has_law = succ_elective_gavelkind
				has_law = succ_feudal_elective
				has_law = succ_tanistry
			}
		}
	}
	
	chance = {
		factor = 1
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = content
					trait = humble
					trait = stressed
					trait = depressed
					NOT = { intrigue = 8 }
				}
			}
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					is_married = ROOT
					is_mother = ROOT
					is_father = ROOT
					sibling = ROOT
				}
				liege = {
					current_heir = {
						NOR = {
							character = ROOT
							trait = incapable
							trait = lunatic
							reverse_opinion = { who = ROOT value = -50 }
						}
						OR = {
							dynasty = ROOT
							dynasty = PREV
						}
					}
				}
				NOR = {
					trait = greedy
					trait = envious
					trait = deceitful
					trait = proud
				}
				NOT = { trait = ambitious }
			}
		}
		modifier = {
			factor = 0
			FROM = {
				NOR = {
					is_married = ROOT
					is_mother = ROOT
					is_father = ROOT
					sibling = ROOT
					is_primary_heir = yes
				}
				NOR = {
					trait = greedy
					trait = envious
					trait = deceitful
					trait = proud
				}
				NOT = { trait = ambitious }
			}
		}
		modifier = {
			factor = 0
			FROM = {
				NOR = {
					is_married = ROOT
					is_mother = ROOT
					is_father = ROOT
					sibling = ROOT
					is_primary_heir = yes
				}
				opinion = { who = ROOT value = 0 }
			}
		}
		modifier = {
			factor = 1.5
			NOT = { reverse_opinion = { who = FROM value = -25 } }
		}
		modifier = {
			factor = 1.5
			NOT = { reverse_opinion = { who = FROM value = -50 } }
		}
		modifier = {
			factor = 1.5
			NOT = { reverse_opinion = { who = FROM value = -75 } }
		}
		modifier = {
			factor = 0.5
			NOT = { dynasty = FROM }
		}
		modifier = {
			factor = 5
			FROM = {
				OR = {
					is_married = ROOT
					is_mother = ROOT
					is_father = ROOT
					sibling = ROOT
					is_primary_heir = yes
				}
				OR = {
					trait = proud
					trait = ambitious
					trait = paranoid
				}
			}
		}
		modifier = {
			factor = 5
			FROM = {
				OR = {
					is_married = ROOT
					is_mother = ROOT
					is_father = ROOT
				}
			}
			NOT = { current_heir = { dynasty = ROOT } }
		}
		modifier = {
			factor = 1.2
			FROM = { intrigue = 12 }
		}
		modifier = {
			factor = 1.2
			FROM = { intrigue = 14 }
		}
		modifier = {
			factor = 1.2
			FROM = { intrigue = 16 }
		}
		modifier = {
			factor = 1.2
			FROM = { intrigue = 18 }
		}
		modifier = {
			factor = 1.2
			FROM = { intrigue = 20 }
		}
		modifier = {
			factor = 2.0
			FROM = {
				OR = {
					trait = lunatic
					trait = possessed
				}
			}
		}
		modifier = {
			factor = 5
			prisoner = yes
		}
		modifier = {
			factor = 5
			prisoner = yes
			host = { character = FROM }
		}
	}
	
	success = {
		FROM = { has_character_flag = regent_usurp_titles }
	}
	
	abort = {
		OR = {
			FROM = { has_character_flag = abort_plot }
			FROM = { prisoner = yes }
			has_regent = no
			NOT = { regent = { character = FROM } }
		}
	}
	
	abort_effect = {
		FROM = {
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = allow_plotting
				clr_character_flag = abort_plot
				clr_character_flag = plot_check
				clr_character_flag = plot_incapable_usurp_underway
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 12 }
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
		}
	}
	
	effect = {
		FROM = {
			change_intrigue = 1
			any_plot_backer = {
				reverse_opinion = {
					who = PREV
					modifier = opinion_very_grateful
					years = 10
				}
				opinion = {
					who = PREV
					modifier = opinion_fought_for_claimant
					years = 10
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			hidden_tooltip = {
				clr_character_flag = allow_plotting
				clr_character_flag = abort_plot
				clr_character_flag = plot_check
				clr_character_flag = plot_incapable_usurp_underway
				clr_character_flag = regent_usurp_titles
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 12 }
				change_variable = { which = "lifestyle_intrigue" value = 1 }
			}
		}
	}
}

# Stir nationalist rebellion in one's own provinces
plot_stir_rebellion = {
	type = realm_characters
	vassal_intrigue_plot = yes
	
	# Plotter scope
	potential = {
		is_ruler = yes
		higher_tier_than = BARON
		independent = no
		prisoner = no
		is_adult = yes
		NOT = { trait = incapable }
		capital_scope = {
			culture = PREV
			religion = PREV
			kingdom = {
				culture = PREVPREV
				OR = {
					has_holder = no
					AND = {
						has_holder = yes
						holder_scope = { NOT = { culture = PREVPREVPREV } }
					}
					AND = {
						has_holder = yes
						holder_scope = {
							top_liege = { NOT = { any_realm_province = { province_id = PREVPREVPREVPREV } } }
						}
					}
				}
			}
		}
		hidden_tooltip = {
			OR = {
				ai = no
				has_character_flag = allow_plotting
			}
		}
	}
	
	# Target scope
	target_potential = {
		independent = yes
		NOR = {
			character = FROM
			has_truce = FROM
			has_non_aggression_pact_with = FROM
			culture = FROM
			any_demesne_title = { temporary = yes }
		}
	}
	
	# Target scope
	allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		FROM = {
			top_liege = {
				character = ROOT
				NOT = { has_character_flag = has_current_revolt }
			}
			capital_scope = {
				culture = PREV
				religion = PREV
				kingdom = {
					culture = PREVPREV
					OR = {
						has_holder = no
						AND = {
							has_holder = yes
							holder_scope = { NOT = { culture = PREVPREVPREV } }
						}
						AND = {
							has_holder = yes
							holder_scope = {
								top_liege = { NOT = { any_realm_province = { province_id = PREVPREVPREVPREV } } }
							}
						}
					}
				}
				NOT = { has_province_modifier = cultural_unrest }
			}
		}
	}
	
	chance = {
		factor = 1
		modifier = {
			factor = 0.5
			realm_size = 10
			NOT = {
				any_realm_lord = {
					NOT = { character = FROM }
					higher_tier_than = BARON
					culture = FROM
					religion = FROM
					is_adult = yes
					prisoner = no
					NOT = { trait = incapable }
				}
			}
		}
		modifier = {
			factor = 1.5
			any_realm_lord = {
				NOT = { character = FROM }
				higher_tier_than = BARON
				culture = FROM
				religion = FROM
				is_adult = yes
				prisoner = no
				NOT = { trait = incapable }
				count = 5
			}
		}
		modifier = {
			factor = 0
			is_liege_of = FROM
			FROM = {
				NOR = {
					leads_faction = faction_separatist
					in_faction = faction_separatist
				}
			}
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = paranoid
					trait = patient
					trait = content
					trait = humble
					trait = craven
					is_dumb_trigger = yes
					trait = inbred
					NOT = { intrigue = 8 }
					opinion = { who = ROOT value = 0 }
				}
			}
		}
		modifier = {
			factor = 0
			OR = {
				dynasty = FROM
				is_close_relative = FROM
				is_allied_with = FROM
				has_non_aggression_pact_with = FROM
			}
		}
		modifier = {
			factor = 2
			NOT = { culture_group = FROM }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = honest }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = just }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = greedy }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = kind }
		}
		modifier = {
			factor = 2
			FROM = { trait = ambitious }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = deceitful }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = wroth }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = brave }
		}
		modifier = {
			factor = 5
			FROM = {
				OR = {
					trait = lunatic
					trait = possessed
				}
			}
		}
	}
	
	creation_effect = {
		FROM = {
			set_character_flag = wants_to_lead_revolt
		}
	}
	
	success = {
		location = {
			has_province_modifier = cultural_unrest
		}
	}
	
	abort = {
		OR = {
			FROM = {
				capital_scope = {
					NOR = {
						culture = PREV
						religion = PREV
						kingdom = {
							culture = PREVPREV
							OR = {
								has_holder = no
								AND = {
									has_holder = yes
									holder_scope = { NOT = { culture = PREVPREVPREV } }
								}
								AND = {
									has_holder = yes
									holder_scope = {
										top_liege = { NOT = { any_realm_province = { province_id = PREVPREVPREVPREV } } }
									}
								}
							}
						}
					}
				}
			}
			FROM = {
				top_liege = {
					OR = {
						NOT = { character = ROOT }
						culture = PREV
						has_truce = PREV
						has_non_aggression_pact_with = PREV
						any_demesne_title = { temporary = yes }
					}
				}
			}
			FROM = { has_character_flag = abort_plot }
			FROM = { prisoner = yes }
			FROM = { independent = yes }
			FROM = { trait = incapable }
		}
	}
	
	abort_effect = {
		FROM = {
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = allow_plotting
				clr_character_flag = abort_plot
				clr_character_flag = plot_check
				clr_character_flag = wants_to_lead_revolt
				clr_character_flag = incite_revolt_underway
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 12 }
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
		}
	}
	
	effect = {
		FROM = {
			change_intrigue = 1
			any_plot_backer = {
				reverse_opinion = {
					who = FROM
					modifier = opinion_grateful
					years = 5
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			hidden_tooltip = {
				clr_character_flag = allow_plotting
				clr_character_flag = abort_plot
				clr_character_flag = plot_check
				clr_character_flag = incite_revolt_underway
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 12 }
				change_variable = { which = "lifestyle_intrigue" value = 1 }
			}
		}
	}
}

# Mayor attempts to usurp county title and become merchant republic
plot_become_republic = {
	type = realm_characters
	vassal_intrigue_plot = yes
	
	# Plotter scope
	potential = {
		is_ruler = yes
		prisoner = no
		is_adult = yes
		primary_title = { tier = BARON }
		is_republic = yes
		is_patrician = no
		is_merchant_republic = no
		independent = no
		liege = {
			NOT = { is_father = PREV }
			NOT = { is_mother = PREV }
		}
		primary_title = {
			location = {
				port = yes
				TECH_TRADE_PRACTICES = 1
			}
		}
		OR = {
			primary_title = { title = b_amalfi }
			primary_title = { title = b_venezia }
			primary_title = { title = b_genoa }
			primary_title = { title = b_pisa }
			primary_title = { title = b_ancona }
			primary_title = { title = b_gaeta }
			primary_title = { title = b_novgorod }
			primary_title = { title = b_noli }
			primary_title = { title = b_lubeck }
			dejure_liege_title = { title = c_hamburg }
			dejure_liege_title = { title = c_gotland }
			primary_title = {
				location = {
					NOR = {
						duchy = { capital_scope = { province_id = PREVPREV } }
						kingdom = { capital_scope = { province_id = PREVPREV } }
					}
				}
				OR = {
					has_building = ct_port_3
					has_building = ct_port_4
					has_building = ct_port_5
				}
			}
		}
		trait = ambitious
		NOR = {
			trait = incapable
			is_dumb_trigger = yes
			trait = humble
			trait = craven
		}
		has_character_flag = allow_plotting
	}
	
	# Target scope
	target_potential = {
		ai = yes
		is_feudal = yes
		is_liege_of = FROM
	}
	
	# Target scope
	allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		NOT = { reverse_has_truce = FROM }
		NOT = { is_allied_with = FROM }
		NOT = { has_non_aggression_pact_with = FROM }
		FROM = {
			primary_title = {
				dejure_liege_title = {
					NOT = { is_tribal = yes }
					current_heir = { NOT = { character = PREVPREVPREV } }
					holder_scope = { character = ROOT }
				}
			}
		}
	}
	
	chance = {
		factor = 1
		modifier = {
			factor = 0
			FROM = {
				OR = {
					opinion = { who = liege value = 25 }
					NOT = { wealth = 100 }
					NOT = { relative_power_to_liege = 0.25 }
				}
			}
		}
		modifier = {
			factor = 5.0
			OR = {
				regent = { character = FROM }
				job_spymaster = { character = FROM }
			}
		}
		modifier = {
			factor = 2.0
			FROM = { NOT = { dynasty = none } }
		}
		modifier = {
			factor = 2.0
			FROM = { trait = greedy }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = envious }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = proud }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = deceitful }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = brave }
		}
		modifier = {
			factor = 0.5
			reverse_opinion = { who = FROM value = 0 }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = patient }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = honest }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = charitable }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = slothful }
		}
		modifier = {
			factor = 0.25
			FROM = { NOT = { intrigue = 8 } }
		}
		modifier = {
			factor = 1.5
			FROM = { intrigue = 15 }
		}
		modifier = {
			factor = 1.5
			FROM = { intrigue = 20 }
		}
	}
	
	success = {
		FROM = { tier = COUNT }
	}
	
	abort = {
		OR = {
			FROM = { has_character_flag = abort_plot }
			FROM = { is_republic = no }
			FROM = { prisoner = yes }
			FROM = { independent = yes }
			FROM = { trait = incapable }
			FROM = { NOT = { trait = ambitious } }
			ai = no
			NOT = { is_liege_of = FROM }
			is_feudal = no
			reverse_has_truce = FROM
			is_allied_with = FROM
			has_non_aggression_pact_with = FROM
		}
	}
	
	abort_effect = {
		FROM = {
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = allow_plotting
				clr_character_flag = abort_plot
				clr_character_flag = plot_check
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
		}
	}
	
	effect = {
		FROM = {
			change_intrigue = 1
			any_plot_backer = {
				reverse_opinion = {
					modifier = opinion_grateful
					who = FROM
					years = 5
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = allow_plotting
				clr_character_flag = abort_plot
				clr_character_flag = plot_check
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
				change_variable = { which = "lifestyle_intrigue" value = 1 }
			}
		}
	}
}

# Character plots to elope with lover
plot_elope = {
	type = character
	intrigue_plot = yes
	murder_plot = yes

	# Plotter scope
	potential = {
		mercenary = no
		holy_order = no
		is_female = no # For now, only do-able by males
		prisoner = no
		is_adult = yes
		is_married = no
		NOT = { trait = incapable }
		hidden_tooltip = {
			OR = {
				ai = no
				has_character_flag = allow_plotting
			}
		}
	}
	
	# Target scope
	target_potential = {
		is_female = yes
		is_ruler = no
		is_lover = FROM
		liege = { NOT = { character = FROM } }
	}

	# Target allow trigger for when players target a specific character in the GUI
	player_allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		prisoner = no
		is_married = no
		is_within_diplo_range = FROM
		custom_tooltip = {
			text = CUSTOMTOOLTIP_KNOWN_ELOPER
			NOT = { has_character_flag = known_eloper }
		}
	}

	# Target scope
	allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		prisoner = no
		is_married = no
		is_within_diplo_range = FROM
		custom_tooltip = {
			text = CUSTOMTOOLTIP_KNOWN_ELOPER
			NOT = { has_character_flag = known_eloper }
		}
	}

	chance = {
		factor = 1
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = kind
					trait = craven
					trait = content
					trait = humble
					NOT = { intrigue = 6 }
				}
			}
		}
		modifier = {
			factor = 0
			OR = {
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_traitor }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_vassal }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_child }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_spouse_slayer }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_murder_attempt }
				reverse_has_opinion_modifier = { who = FROM modifier = opinion_killed_close_kin }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_murder_of_close_kin }
				reverse_has_opinion_modifier = { who = FROM modifier = attempted_kidnapping }
			}
		}
		modifier = {
			factor = 1.5
			FROM = { trait = brave }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = deceitful }
		}
		modifier = {
			factor = 2
			FROM = { has_character_flag = disobedient_daughter_unhappy }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = honest }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = humble }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = patient }
		}
		modifier = {
			factor = 0.75
			FROM = { NOT = { intrigue = 7 } }
		}
		modifier = {
			factor = 0.75
			FROM = { NOT = { intrigue = 9 } }
		}
		modifier = {
			factor = 1.25
			FROM = { intrigue = 12 }
		}
		modifier = {
			factor = 1.25
			FROM = { intrigue = 15 }
		}
		modifier = {
			factor = 1.25
			FROM = { intrigue = 18 }
		}
	}

	success = {
		any_spouse = { character = FROM }
		hidden_tooltip = { FROM = { has_character_flag = plot_success } }
	}
	
	abort = {
		OR = {
			FROM = { has_character_flag = abort_plot }
			FROM = { prisoner = yes }
			FROM = { trait = incapable }
			FROM = { is_married = yes }
			ROOT = { is_ruler = yes }
			ROOT = { is_married = yes }
			ROOT = { prisoner = yes }
			ROOT = { trait = incapable }
		}
	}
	
	abort_effect = {
		FROM = {
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
		}
	}
	
	effect = {
		FROM = {
			any_plot_backer = {
				reverse_opinion = {
					modifier = opinion_grateful
					who = FROM
					years = 5
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = plot_check
				clr_character_flag = allow_plotting
				clr_character_flag = plot_in_action
				clr_character_flag = abort_plot
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 60 }
				change_variable = { which = "lifestyle_intrigue" value = 1 }
			}
		}
	}
}

# Councillor attempts to overthrow Imperial Government
plot_overthrow_empire = {
	type = realm_characters # All characters in the same realm, plus rivals and relatives of self, parents, children and spouse
	intrigue_plot = yes
	murder_plot = yes
	
	# Plotter scope
	potential = {
		prisoner = no
		independent = no
		is_adult = yes
		NOT = { trait = incapable }
		is_voter = yes
		hidden_tooltip = {
			OR = {
				ai = no
				has_character_flag = allow_plotting
			}
		}
	}
	
	# Target scope
	target_potential = {
		is_liege_of = FROM
		tier = EMPEROR
		has_imperial_government_trigger = yes
	}
	
	# Target scope
	allow = {
		NOT = { has_opinion_modifier = { who = FROM modifier = opinion_recent_plot } }
		prisoner = no
		NOT = { reverse_has_truce = FROM }
		NOT = { has_non_aggression_pact_with = FROM }
		primary_title = { claimed_by = FROM }
	}
	
	chance = {
		factor = 2
		modifier = {
			factor = 0
			NOR = {
				primary_title = { FROM = { has_strong_claim = PREV } }
				among_most_powerful_vassals = 5
			}
		}
		modifier = {
			factor = 0
			current_heir = { character = FROM }
		}
		modifier = {
			factor = 0
			FROM = {
				OR = {
					trait = content
					trait = humble
					trait = craven
					trait = imbecile
				}
			}
		}
		modifier = {
			factor = 0.1
			FROM = { is_dumb_trigger = yes }
		}
		modifier = {
			factor = 0.1
			FROM = { trait = just }
		}
		modifier = {
			factor = 0.25
			FROM = { trait = honest }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = diligent }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = patient }
		}
		modifier = {
			factor = 0.5
			FROM = { trait = trusting }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = dishonorable1 }
		}
		modifier = {
			factor = 2
			FROM = { trait = dishonorable2 }
		}
		modifier = {
			factor = 2.5
			FROM = { trait = dishonorable3 }
		}
		modifier = {
			factor = 3
			FROM = { trait = dishonorable4 }
		}
		modifier = {
			factor = 3.5
			FROM = { trait = dishonorable5 }
		}
		modifier = {
			factor = 5
			FROM = {
				OR = {
					trait = dishonorable6
					trait = dishonorable7
					trait = dishonorable8
					trait = dishonorable9
					trait = dishonorable10
				}
			}
		}	
		modifier = {
			factor = 0.1
			FROM = { pacifist = yes }
		}
		modifier = {
			factor = 2.0
			FROM = { trait = envious }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = arbitrary }
		}
		modifier = {
			factor = 1.5
			FROM = { trait = paranoid }
		}
		modifier = {
			factor = 2.0
			FROM = { trait = cruel }
		}
		modifier = {
			factor = 2.0
			FROM = { trait = deceitful }
		}
		modifier = {
			factor = 3.0
			FROM = { trait = ambitious }
		}
		modifier = {
			factor = 5.0
			FROM = { trait = decadent }
		}
		modifier = {
			factor = 10
			FROM = { trait = possessed }
		}
		modifier = {
			factor = 0
			opinion = { who = FROM value = 25 }
		}
		modifier = {
			factor = 0.5
			opinion = { who = FROM value = 0 }
			NOR = {
				trait = envious
				trait = deceitful
				trait = ambitious
				trait = cruel
				trait = arbitrary
				trait = lunatic
				trait = possessed
			}
		}
		modifier = {
			factor = 1.5
			NOT = { opinion = { who = FROM value = -25 } }
		}
		modifier = {
			factor = 2.0
			NOT = { opinion = { who = FROM value = -50 } }
		}
		modifier = {
			factor = 2.0
			NOT = { opinion = { who = FROM value = -75 } }
		}
		modifier = {
			factor = 0.25
			FROM = { NOT = { intrigue = 4 } }
		}
		modifier = {
			factor = 0.25
			FROM = { NOT = { intrigue = 8 } }
		}
		modifier = {
			factor = 1.5
			FROM = { intrigue = 12 }
		}
		modifier = {
			factor = 1.5
			FROM = { intrigue = 15 }
		}
		modifier = {
			factor = 1.5
			FROM = { intrigue = 18 }
		}
		modifier = {
			factor = 1.5
			FROM = { intrigue = 21 }
		}
	}

	success = {
		FROM = { has_character_flag = plot_success }
	}
	
	abort = {
		OR = {
			FROM = { has_character_flag = abort_plot }
			FROM = { prisoner = yes }
			prisoner = yes
			FROM = { trait = incapable }
			FROM = { is_voter = no }
			NOT = { is_liege_of = FROM }
			NOT = { tier = emperor }
			reverse_has_truce = FROM
			has_non_aggression_pact_with = FROM
			has_imperial_government_trigger = no
		}
	}
	
	abort_effect = {
		FROM = {
			# Clear flags
			hidden_tooltip = {
				clr_character_flag = allow_plotting
				clr_character_flag = abort_plot
				clr_character_flag = plot_check
				clr_character_flag = plot_in_action
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 12 }
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
		}
	}
	
	effect = {
		FROM = {
			change_intrigue = 1
			any_plot_backer = {
				opinion = {
					who = FROM
					modifier = opinion_very_grateful
					years = 5
				}
				reverse_opinion = {
					who = FROM
					modifier = opinion_very_grateful
					years = 5
				}
			}
			if = {
				limit = { has_character_modifier = plot_assisted_spying }
				remove_character_modifier = plot_assisted_spying
			}
			hidden_tooltip = {
				clr_character_flag = allow_plotting
				clr_character_flag = abort_plot
				clr_character_flag = plot_check
				clr_character_flag = plot_in_action
				clr_character_flag = plot_success
				reverse_opinion = { who = ROOT modifier = opinion_recent_plot months = 12 }
				change_variable = { which = "lifestyle_intrigue" value = 1 }
			}
		}
	}
}

