### Also see CK2Plus_faction_decisions

plot_decisions = {

	faction_succ_seniority_ultimatum = {
		ai_check_interval = 3

		is_high_prio = yes

		ai = no

		potential = {
			always = no
			leads_faction = faction_succ_seniority

			trigger_if = {
				limit = { has_character_flag = faction_succ_seniority_ultimatum_taken }

				had_character_flag = {
					flag = faction_succ_seniority_ultimatum_taken
					days >= 7
				}
			}
		}

		allow = {
			show_only_failed_conditions = yes

			war = no
			prisoner = no

			NOR = {
				war_with = liege
				has_truce = liege
			}

			liege = {
				in_revolt = no

				trigger_if = {
					limit = { independent = no }

					liege = {
						will_liege_enforce_peace = no
						has_liege_enforced_peace = no
					}
				}
			}

			custom_tooltip = {
				text = tt_no_occupied_titles_in_realm

				NOT = {
					any_realm_title = {
						lower_tier_than = DUKE
						is_occupied = yes
					}
				}
			}
		}

		effect = {
			set_character_flag = faction_succ_seniority_ultimatum_taken

			liege = {
				show_scope_change = no

				letter_event = {
					id = 8005
					days = 3
					tooltip = tt_faction_ultimatum
				}
			}
		}

		ai_will_do = {
			factor = 1

			trigger = {
				faction_power = {
					faction = faction_succ_seniority
					power >= 0.75
				}

				liege = {
					NOT = {
						any_war = {
							trigger_if = {
								limit = {
									defender = { character = PREVPREV }
								}

								NOR = {
									using_cb = depose_liege
									using_cb = overthrow_ruler
									using_cb = overthrow_ruler_no_calls
								}
							}

							trigger_else = {
								attacker = { character = PREVPREV }

								OR = {
									using_cb = invasion
									using_cb = religious
									using_cb = tribal_invasion
									using_cb = muslim_invasion
									using_cb = viking_invasion
									using_cb = claim_all
									using_cb = claim
									using_cb = other_claim
								}
							}
						}
					}
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_succ_seniority
					power < 1
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_succ_seniority
					power < 1.5
				}
			}
		}
	}

	faction_succ_primogeniture_ultimatum = {
		ai_check_interval = 3

		is_high_prio = yes

		ai = no

		potential = {
			always = no
			leads_faction = faction_succ_primogeniture

			trigger_if = {
				limit = { has_character_flag = faction_succ_primogeniture_ultimatum_taken }

				had_character_flag = {
					flag = faction_succ_primogeniture_ultimatum_taken
					days >= 7
				}
			}
		}

		allow = {
			show_only_failed_conditions = yes

			war = no
			prisoner = no

			NOR = {
				war_with = liege
				has_truce = liege
			}

			liege = {
				in_revolt = no

				trigger_if = {
					limit = { independent = no }

					liege = {
						will_liege_enforce_peace = no
						has_liege_enforced_peace = no
					}
				}
			}

			custom_tooltip = {
				text = tt_no_occupied_titles_in_realm

				NOT = {
					any_realm_title = {
						lower_tier_than = DUKE
						is_occupied = yes
					}
				}
			}
		}

		effect = {
			set_character_flag = faction_succ_primogeniture_ultimatum_taken

			liege = {
				show_scope_change = no

				letter_event = {
					id = 8010
					days = 3
					tooltip = tt_faction_ultimatum
				}
			}
		}

		ai_will_do = {
			factor = 1

			trigger = {
				faction_power = {
					faction = faction_succ_primogeniture
					power >= 0.75
				}

				liege = {
					NOT = {
						any_war = {
							trigger_if = {
								limit = {
									defender = { character = PREVPREV }
								}

								NOR = {
									using_cb = depose_liege
									using_cb = overthrow_ruler
									using_cb = overthrow_ruler_no_calls
								}
							}

							trigger_else = {
								attacker = { character = PREVPREV }

								OR = {
									using_cb = invasion
									using_cb = religious
									using_cb = tribal_invasion
									using_cb = muslim_invasion
									using_cb = viking_invasion
									using_cb = claim_all
									using_cb = claim
									using_cb = other_claim
								}
							}
						}
					}
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_succ_primogeniture
					power < 1
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_succ_primogeniture
					power < 1.5
				}
			}
		}
	}

	faction_succ_feudal_elective_ultimatum = {
		ai_check_interval = 3

		is_high_prio = yes

		ai = no

		potential = {
			always = no
			leads_faction = faction_succ_feudal_elective

			trigger_if = {
				limit = { has_character_flag = faction_succ_feudal_elective_ultimatum_taken }

				had_character_flag = {
					flag = faction_succ_feudal_elective_ultimatum_taken
					days >= 7
				}
			}
		}
		allow = {
			show_only_failed_conditions = yes

			war = no
			prisoner = no

			NOR = {
				war_with = liege
				has_truce = liege
			}

			liege = {
				in_revolt = no

				trigger_if = {
					limit = { independent = no }

					liege = {
						will_liege_enforce_peace = no
						has_liege_enforced_peace = no
					}
				}
			}

			custom_tooltip = {
				text = tt_no_occupied_titles_in_realm

				NOT = {
					any_realm_title = {
						lower_tier_than = DUKE
						is_occupied = yes
					}
				}
			}
		}

		effect = {
			set_character_flag = faction_succ_feudal_elective_ultimatum_taken

			liege = {
				show_scope_change = no

				letter_event = {
					id = 8015
					days = 3
					tooltip = tt_faction_ultimatum
				}
			}
		}

		ai_will_do = {
			factor = 1

			trigger = {
				faction_power = {
					faction = faction_succ_feudal_elective
					power >= 0.75
				}

				liege = {
					NOT = {
						any_war = {
							trigger_if = {
								limit = {
									defender = { character = PREVPREV }
								}

								NOR = {
									using_cb = depose_liege
									using_cb = overthrow_ruler
									using_cb = overthrow_ruler_no_calls
								}
							}

							trigger_else = {
								attacker = { character = PREVPREV }

								OR = {
									using_cb = invasion
									using_cb = religious
									using_cb = tribal_invasion
									using_cb = muslim_invasion
									using_cb = viking_invasion
									using_cb = claim_all
									using_cb = claim
									using_cb = other_claim
								}
							}
						}
					}
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_succ_feudal_elective
					power < 1
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_succ_feudal_elective
					power < 1.5
				}
			}
		}
	}

	faction_succ_gavelkind_ultimatum = {
		ai_check_interval = 3

		is_high_prio = yes

		ai = no

		potential = {
			always = no
			leads_faction = faction_succ_gavelkind

			trigger_if = {
				limit = { has_character_flag = faction_succ_gavelkind_ultimatum_taken }

				had_character_flag = {
					flag = faction_succ_gavelkind_ultimatum_taken
					days >= 7
				}
			}
		}

		allow = {
			show_only_failed_conditions = yes

			war = no
			prisoner = no

			NOR = {
				war_with = liege
				has_truce = liege
			}

			liege = {
				in_revolt = no

				trigger_if = {
					limit = { independent = no }

					liege = {
						will_liege_enforce_peace = no
						has_liege_enforced_peace = no
					}
				}
			}

			custom_tooltip = {
				text = tt_no_occupied_titles_in_realm

				NOT = {
					any_realm_title = {
						lower_tier_than = DUKE
						is_occupied = yes
					}
				}
			}
		}

		effect = {
			set_character_flag = faction_succ_gavelkind_ultimatum_taken

			liege = {
				show_scope_change = no

				letter_event = {
					id = 8020
					days = 3
					tooltip = tt_faction_ultimatum
				}
			}
		}

		ai_will_do = {
			factor = 1

			trigger = {
				faction_power = {
					faction = faction_succ_gavelkind
					power >= 0.75
				}

				liege = {
					NOT = {
						any_war = {
							trigger_if = {
								limit = {
									defender = { character = PREVPREV }
								}

								NOR = {
									using_cb = depose_liege
									using_cb = overthrow_ruler
									using_cb = overthrow_ruler_no_calls
								}
							}

							trigger_else = {
								attacker = { character = PREVPREV }

								OR = {
									using_cb = invasion
									using_cb = religious
									using_cb = tribal_invasion
									using_cb = muslim_invasion
									using_cb = viking_invasion
									using_cb = claim_all
									using_cb = claim
									using_cb = other_claim
								}
							}
						}
					}
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_succ_gavelkind
					power < 1
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_succ_gavelkind
					power < 1.5
				}
			}
		}
	}

	faction_lower_crown_authority_ultimatum = {
		ai_check_interval = 3

		is_high_prio = yes

		ai = no

		potential = {
			always = no
			leads_faction = faction_lower_crown_authority

			trigger_if = {
				limit = { has_character_flag = faction_lower_CA_ultimatum_taken }

				had_character_flag = {
					flag = faction_lower_CA_ultimatum_taken
					days >= 7
				}
			}
		}

		allow = {
			show_only_failed_conditions = yes

			war = no
			prisoner = no

			NOR = {
				war_with = liege
				has_truce = liege
			}

			liege = {
				in_revolt = no

				trigger_if = {
					limit = { independent = no }

					liege = {
						will_liege_enforce_peace = no
						has_liege_enforced_peace = no
					}
				}
			}

			custom_tooltip = {
				text = tt_no_occupied_titles_in_realm

				NOT = {
					any_realm_title = {
						lower_tier_than = DUKE
						is_occupied = yes
					}
				}
			}
		}

		effect = {
			set_character_flag = faction_lower_CA_ultimatum_taken

			liege = {
				show_scope_change = no

				if = {
					limit = { has_regent = yes }

					letter_event = {
						id = 8026
						days = 3
						tooltip = tt_faction_ultimatum
					}
				}
				else = {
					letter_event = {
						id = 8025
						days = 3
						tooltip = tt_faction_ultimatum
					}
				}
			}
		}

		ai_will_do = {
			factor = 1

			trigger = {
				faction_power = {
					faction = faction_lower_crown_authority
					power >= 0.75
				}

				liege = {
					NOT = {
						any_war = {
							trigger_if = {
								limit = {
									defender = { character = PREVPREV }
								}

								NOR = {
									using_cb = depose_liege
									using_cb = overthrow_ruler
									using_cb = overthrow_ruler_no_calls
								}
							}

							trigger_else = {
								attacker = { character = PREVPREV }

								OR = {
									using_cb = invasion
									using_cb = religious
									using_cb = tribal_invasion
									using_cb = muslim_invasion
									using_cb = viking_invasion
									using_cb = claim_all
									using_cb = claim
									using_cb = other_claim
								}
							}
						}
					}
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_lower_crown_authority
					power < 1
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_lower_crown_authority
					power < 1.5
				}
			}
		}
	}

	faction_lower_tribal_organization_ultimatum = {
		ai_check_interval = 3

		is_high_prio = yes

		ai = no

		potential = {
			always = no
			leads_faction = faction_lower_tribal_organization

			trigger_if = {
				limit = { has_character_flag = faction_lower_TO_ultimatum_taken }

				had_character_flag = {
					flag = faction_lower_TO_ultimatum_taken
					days >= 7
				}
			}
		}

		allow = {
			show_only_failed_conditions = yes

			war = no
			prisoner = no

			NOR = {
				war_with = liege
				has_truce = liege
			}

			liege = {
				in_revolt = no

				trigger_if = {
					limit = { independent = no }

					liege = {
						will_liege_enforce_peace = no
						has_liege_enforced_peace = no
					}
				}
			}

			custom_tooltip = {
				text = tt_no_occupied_titles_in_realm

				NOT = {
					any_realm_title = {
						lower_tier_than = DUKE
						is_occupied = yes
					}
				}
			}
		}

		effect = {
			set_character_flag = faction_lower_TO_ultimatum_taken

			liege = {
				show_scope_change = no

				if = {
					limit = { has_regent = yes }

					letter_event = {
						id = 8031
						days = 3
						tooltip = tt_faction_ultimatum
					}
				}
				else = {
					letter_event = {
						id = 8027
						days = 3
						tooltip = tt_faction_ultimatum
					}
				}
			}
		}

		ai_will_do = {
			factor = 1

			trigger = {
				faction_power = {
					faction = faction_lower_tribal_organization
					power >= 0.75
				}

				liege = {
					NOT = {
						any_war = {
							trigger_if = {
								limit = {
									defender = { character = PREVPREV }
								}

								NOR = {
									using_cb = depose_liege
									using_cb = overthrow_ruler
									using_cb = overthrow_ruler_no_calls
								}
							}

							trigger_else = {
								attacker = { character = PREVPREV }

								OR = {
									using_cb = invasion
									using_cb = religious
									using_cb = tribal_invasion
									using_cb = muslim_invasion
									using_cb = viking_invasion
									using_cb = claim_all
									using_cb = claim
									using_cb = other_claim
								}
							}
						}
					}
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_lower_tribal_organization
					power < 1
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_lower_tribal_organization
					power < 1.5
				}
			}
		}
	}

	faction_independence_ultimatum = {
		ai_check_interval = 3

		is_high_prio = yes

		ai = no

		potential = {
			always = no
			leads_faction = faction_independence

			trigger_if = {
				limit = { has_character_flag = faction_independence_ultimatum_taken }

				had_character_flag = {
					flag = faction_independence_ultimatum_taken
					days >= 7
				}
			}

			liege = {
				independent = yes
			}
		}

		allow = {
			show_only_failed_conditions = yes

			war = no
			prisoner = no

			NOR = {
				war_with = liege
				has_truce = liege
			}

			liege = {
				in_revolt = no

				trigger_if = {
					limit = { independent = no }

					liege = {
						will_liege_enforce_peace = no
						has_liege_enforced_peace = no
					}
				}
			}

			custom_tooltip = {
				text = tt_no_occupied_titles_in_realm

				NOT = {
					any_realm_title = {
						lower_tier_than = DUKE
						is_occupied = yes
					}
				}
			}
		}

		effect = {
			set_character_flag = faction_independence_ultimatum_taken

			liege = {
				show_scope_change = no

				letter_event = {
					id = 8035
					days = 3
					tooltip = tt_faction_ultimatum
				}
			}
		}

		ai_will_do = {
			factor = 1

			trigger = {
				faction_power = {
					faction = faction_independence
					power >= 0.75
				}

				liege = {
					NAND = {
						religion = ROOT

						any_war = {
							trigger_if = {
								limit = {
									defender = { character = PREVPREV }
								}

								NOR = {
									using_cb = depose_liege
									using_cb = overthrow_ruler
									using_cb = overthrow_ruler_no_calls
								}
							}

							trigger_else = {
								attacker = { character = PREVPREV }

								OR = {
									using_cb = invasion
									using_cb = religious
									using_cb = tribal_invasion
									using_cb = muslim_invasion
									using_cb = viking_invasion
									using_cb = claim_all
									using_cb = claim
									using_cb = other_claim
								}
							}
						}
					}
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_independence
					power < 1
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_independence
					power < 1.5
				}
			}
		}
	}

	faction_claimant_ultimatum = {
		ai_check_interval = 3

		is_high_prio = yes

		ai = no

		potential = {
			always = no # Replaced by follow-up event to preparation decision
			leads_faction = faction_pretender
			has_character_flag = preparing_claimant_faction_war
			has_character_flag = civil_war_faction_leader

			trigger_if = {
				limit = { has_character_flag = faction_claimant_ultimatum_taken }

				had_character_flag = {
					flag = faction_claimant_ultimatum_taken
					days >= 7
				}
			}

			supported_claimant = {
				is_alive = yes
			}
		}

		allow = {
			show_only_failed_conditions = yes

			NOR = {
				war_with = liege
				has_truce = liege
			}

			liege = {
				in_revolt = no

				custom_tooltip = {
					text = HAS_NO_CIVIL_WAR

					pf_war_flag_trigger = no
				}

				trigger_if = {
					limit = { independent = no }

					liege = {
						will_liege_enforce_peace = no
						has_liege_enforced_peace = no
					}
				}
			}

			custom_tooltip = {
				text = tt_no_occupied_titles_in_realm

				NOT = {
					any_realm_title = {
						lower_tier_than = DUKE
						is_occupied = yes
					}
				}
			}

			liege_before_war = {
				custom_tooltip = {
					text = emf_faction_ctt_no_liege_in_revolt

					in_revolt = no

					liege_before_war = {
						in_revolt = no

						liege_before_war = {
							in_revolt = no
						}
					}
				}
			}
		}

		effect = {
			set_character_flag = faction_claimant_ultimatum_taken
			pf_punish_deceitful_player_effect = yes
			clr_character_flag = preparing_claimant_faction_war
			log = "[Root.GetTitledName] has issued a claimant faction ultimatum to [Root.Liege.GetTitledName]"

			liege = {
				show_scope_change = no

				letter_event = {
					id = 8036
					days = 7
					tooltip = tt_faction_ultimatum
				}
			}

			if = {
				limit = {
					supported_claimant = {
						NOT = { character = ROOT }

						NAND = {
							same_liege = ROOT
							in_faction = faction_pretender
							supported_claimant = { character = PREV }
						}
					}
				}

				supported_claimant = {
					letter_event = {
						id = 8037
						days = 1
					}
				}
			}
		}

		ai_will_do = {
			factor = 1

			# AI will not take war while 30-day timer lasts
			# unless there are no vassals left to join the faction
			trigger = {
				trigger_if = {
					limit = { has_character_modifier = declare_civil_war_timer }

					liege = {
						NOT = {
							any_vassal = {
								has_character_flag = will_join_civil_war
								NOT = { in_faction = faction_pretender }
							}
						}
					}
				}

				# Still has the power to have the revolt
				faction_power = {
					faction = faction_pretender
					power >= 0.75
				}
			}

			# trigger = {
			# 	faction_power = {
			# 		faction = faction_claimant
			# 		power >= 0.75
			# 	}
			#
			# 	trigger_if = {
			# 		limit = {
			# 			faction_claimant = {
			# 				OR = {
			# 					has_law = succ_feudal_elective
			# 					has_law = succ_hre_elective
			# 				}
			# 			}
			# 		}
			#
			# 		liege = {
			# 			ROOT = {
			# 				supported_claimant = {
			# 					NAND = {
			# 						religion = PREVPREV
			# 						culture = PREVPREV
			# 					}
			# 				}
			# 			}
			# 		}
			# 	}
			#
			# 	# Claimant isn't fighting a war alongside liege
			# 	supported_claimant = {
			# 		NOT = {
			# 			any_war = {
			# 				OR = {
			# 					AND = {
			# 						any_attacker = {
			# 							character = PREVPREV # claimant
			# 						}
			#
			# 						any_attacker = {
			# 							is_liege_of = ROOT # liege
			# 						}
			# 					}
			#
			# 					AND = {
			# 						any_defender = {
			# 							character = PREVPREV # claimant
			# 						}
			#
			# 						any_defender = {
			# 							is_liege_of = ROOT # liege
			# 						}
			# 					}
			# 				}
			# 			}
			# 		}
			# 	}
			#
			# 	liege = {
			# 		NOT = {
			# 			any_war = {
			# 				# Liege is defending a war for the same title as the claimant's claim
			# 				trigger_if = {
			# 					limit = {
			# 						defender = { character = PREVPREV }
			# 					}
			#
			# 					NOR = {
			# 						using_cb = depose_liege
			# 						using_cb = overthrow_ruler
			# 						using_cb = overthrow_ruler_no_calls
			# 					}
			#
			# 					thirdparty_title_scope = {
			# 						ROOT = {
			# 							supported_claimant_title = {
			# 								title = PREVPREV
			# 							}
			# 						}
			#
			# 						trigger_if = {
			# 							limit = { is_conquered = yes }
			# 							conquest_culture = ROOT
			# 						}
			# 					}
			#
			# 					attacker = {
			# 						trigger_if = {
			# 							limit = { in_revolt = yes }
			#
			# 							liege_before_war = {
			# 								NOT = { character = PREVPREVPREV }
			# 							}
			# 						}
			# 					}
			# 				}
			#
			# 				# Liege is attacking
			# 				trigger_else = {
			# 					attacker = {
			# 						character = PREVPREV
			#
			# 						ROOT = {
			# 							supported_claimant = {
			# 								religion = PREVPREV
			# 								culture = PREVPREV
			# 							}
			# 						}
			# 					}
			#
			# 					OR = {
			# 						using_cb = religious
			# 						using_cb = crusade
			# 						using_cb = new_crusade
			# 						using_cb = muslim_invasion
			# 						using_cb = viking_invasion
			# 						using_cb = invasion
			# 						using_cb = tribal_invasion
			# 						using_cb = claim_all
			# 						using_cb = claim
			# 					}
			# 				}
			# 			}
			# 		}
			# 	}
			# }
			#
			# mult_modifier = {
			# 	factor = 0.1
			#
			# 	faction_power = {
			# 		faction = faction_claimant
			# 		power < 1.0
			# 	}
			# }
			#
			# mult_modifier = {
			# 	factor = 0.1
			#
			# 	faction_power =	{
			# 		faction = faction_claimant
			# 		power < 1.5
			# 	}
			# }
			#
			# mult_modifier = { # If liege is already fighting a claimant war, slow it down to avoid war spam
			# 	factor = 0.05
			#
			# 	liege = {
			# 		any_war = {
			# 			using_cb = claim_on_liege
			# 		}
			# 	}
			# }
		}
	}

	faction_antiking_ultimatum = {
		ai_check_interval = 3

		is_high_prio = yes

		only_playable = yes

		potential = {
			leads_faction = faction_antiking

			trigger_if = {
				limit = { has_character_flag = faction_install_antiking_ultimatum_taken }

				had_character_flag = {
					flag = faction_install_antiking_ultimatum_taken
					days >= 7
				}
			}
		}

		allow = {
			show_only_failed_conditions = yes

			war = no
			has_regent = no

			NOR = {
				war_with = liege
				has_truce = liege
			}

			liege = {
				trigger_if = {
					limit = { independent = no }

					liege = {
						will_liege_enforce_peace = no
						has_liege_enforced_peace = no
					}
				}
			}

			custom_tooltip = {
				text = tt_no_occupied_titles_in_realm

				NOT = {
					any_realm_title = {
						lower_tier_than = DUKE
						is_occupied = yes
					}
				}
			}
		}

		effect = {
			set_character_flag = faction_install_antiking_ultimatum_taken
			log = "[Root.GetTitledName] has issued an Antiking ultimatum to [Root.Liege.GetTitledName]"

			liege = {
				show_scope_change = no

				letter_event = {
					id = 8200
					days = 3
					tooltip = tt_faction_ultimatum
				}
			}
		}


		ai_will_do = {
			factor = 0.5

			trigger = {
				faction_power = {
					faction = faction_antiking
					power >= 0.50
				}

				liege = {
					NOT = {
						any_war = {
							trigger_if = {
								limit = {
									defender = { character = PREVPREV }
								}

								NOR = {
									using_cb = depose_liege
									using_cb = overthrow_ruler
									using_cb = overthrow_ruler_no_calls
									using_cb = claim_on_liege_plot
									using_cb = other_claim_on_liege_plot
									using_cb = cb_faction_overthrow_ruler
								}
							}

							trigger_else = {
								attacker = { character = PREVPREV }

								OR = {
									using_cb = invasion
									using_cb = holy_war
									using_cb = tribal_invasion
									using_cb = manifest_destiny_invasion
									using_cb = viking_invasion
								}
							}
						}
					}
				}
			}
		}
	}

	faction_overthrow_ultimatum = {
		ai_check_interval = 3

		is_high_prio = yes

		only_playable = yes

		potential = {
			leads_faction = faction_overthrow

			trigger_if = {
				limit = { has_character_flag = faction_overthrow_ultimatum_taken }

				had_character_flag = {
					flag = faction_overthrow_ultimatum_taken
					days >= 7
				}
			}
		}

		allow = {
			show_only_failed_conditions = yes

			war = no
			prisoner = no

			NOR = {
				war_with = liege
				has_truce = liege
			}

			liege = {
				in_revolt = no

				trigger_if = {
					limit = { independent = no }

					liege = {
						will_liege_enforce_peace = no
						has_liege_enforced_peace = no
					}
				}
			}

			custom_tooltip = {
				text = tt_no_occupied_titles_in_realm

				NOT = {
					any_realm_title = {
						lower_tier_than = DUKE
						is_occupied = yes
					}
				}
			}
		}

		effect = {
			set_character_flag = faction_overthrow_ultimatum_taken
			log = "[Root.GetTitledName] has issued a nomadic Overthrow ultimatum to [Root.Liege.GetTitledName]"

			liege = {
				show_scope_change = no

				letter_event = {
					id = 8210
					days = 3
					tooltip = tt_faction_ultimatum
				}
			}
		}

		ai_will_do = {
			factor = 0.5

			trigger = {
				total_years_played >= 2

				faction_power = {
					faction = faction_overthrow
					power >= 0.5
				}

				liege = {
					trigger_if = {
						limit = { war = yes }
						NOT = { has_character_flag = has_current_revolt }
					}

					NOT = {
						any_war = {
							trigger_if = {
								limit = {
									defender = { character = PREVPREV }
								}

								NOR = {
									using_cb = depose_liege
									using_cb = overthrow_ruler
									using_cb = overthrow_ruler_no_calls
								}
							}

							trigger_else = {
								attacker = { character = PREVPREV }

								OR = {
									using_cb = invasion
									using_cb = holy_war
									using_cb = tribal_invasion
									using_cb = viking_invasion
									using_cb = claim_all
									using_cb = claim
									using_cb = other_claim
								}
							}
						}
					}
				}
			}
		}
	}

	faction_increase_council_power_ultimatum = {
		ai_check_interval = 3

		is_high_prio = yes

		only_playable = yes

		potential = {
			leads_faction = faction_increase_council_power

			trigger_if = {
				limit = { has_character_flag = faction_council_power_ultimatum_taken }

				had_character_flag = {
					flag = faction_council_power_ultimatum_taken
					days >= 7
				}
			}
		}

		allow = {
			show_only_failed_conditions = yes

			war = no
			prisoner = no

			NOR = {
				war_with = liege
				has_truce = liege
			}

			liege = {
				trigger_if = {
					limit = { independent = no }

					liege = {
						will_liege_enforce_peace = no
						has_liege_enforced_peace = no
					}
				}

				custom_tooltip = {
					text = HAS_NO_CIVIL_WAR

					pf_war_flag_trigger = no
				}
			}

			custom_tooltip = {
				text = NO_PENDING_CIVIL_WAR

				pf_pending_civil_war_trigger = no
			}

			custom_tooltip = {
				text = tt_no_occupied_titles_in_realm

				NOT = {
					any_realm_title = {
						lower_tier_than = DUKE
						is_occupied = yes
					}
				}
			}
		}

		effect = {
			set_character_flag = faction_council_power_ultimatum_taken

			liege = {
				show_scope_change = no

				letter_event = {
					id = 8215
					days = 3
					tooltip = tt_faction_ultimatum
				}
			}
		}

		ai_will_do = {
			factor = 0.5

			trigger = {
				total_years_played >= 2

				faction_power = {
					faction = faction_increase_council_power
					power >= 0.75
				}

				liege = {
					NOT = {
						any_war = {
							trigger_if = {
								limit = {
									defender = { character = PREVPREV }
								}

								NOR = {
									using_cb = depose_liege
									using_cb = overthrow_ruler
									using_cb = overthrow_ruler_no_calls
								}
							}

							trigger_else = {
								attacker = { character = PREVPREV }

								OR = {
									using_cb = invasion
									using_cb = holy_war
									using_cb = tribal_invasion
									using_cb = viking_invasion
									using_cb = claim_all
									using_cb = claim
									using_cb = other_claim
								}
							}
						}
					}
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_increase_council_power
					power < 1.0
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_increase_council_power
					power < 1.5
				}
			}
		}
	}

	faction_powerful_vassal_takeover_ultimatum = {
		ai_check_interval = 3

		is_high_prio = yes

		only_playable = yes

		potential = {
			leads_faction = faction_powerful_vassal_takeover

			trigger_if = {
				limit = { has_character_flag = faction_powerful_vassal_takeover_ultimatum_taken }

				had_character_flag = {
					flag = faction_powerful_vassal_takeover_ultimatum_taken
					days >= 7
				}
			}
		}

		allow = {
			show_only_failed_conditions = yes

			war = no
			prisoner = no

			NOR = {
				war_with = liege
				has_truce = liege
			}

			liege = {
				in_revolt = no

				trigger_if = {
					limit = { independent = no }

					liege = {
						will_liege_enforce_peace = no
						has_liege_enforced_peace = no
					}
				}
			}

			custom_tooltip = {
				text = tt_no_occupied_titles_in_realm

				NOT = {
					any_realm_title = {
						lower_tier_than = DUKE
						is_occupied = yes
					}
				}
			}
		}

		effect = {
			set_character_flag = faction_powerful_vassal_takeover_ultimatum_taken

			liege = {
				show_scope_change = no

				letter_event = {
					id = 8220
					days = 3
					tooltip = tt_faction_ultimatum
				}
			}
		}

		ai_will_do = {
			factor = 0.5

			trigger = {
				total_years_played >= 2

				faction_power = {
					faction = faction_powerful_vassal_takeover
					power >= 0.75
				}

				liege = {
					NOT = {
						any_war = {
							trigger_if = {
								limit = {
									defender = { character = PREVPREV }
								}

								NOR = {
									using_cb = depose_liege
									using_cb = overthrow_ruler
									using_cb = overthrow_ruler_no_calls
								}
							}

							trigger_else = {
								attacker = { character = PREVPREV }

								OR = {
									using_cb = invasion
									using_cb = holy_war
									using_cb = tribal_invasion
									using_cb = viking_invasion
									using_cb = claim_all
									using_cb = claim
									using_cb = other_claim
								}
							}
						}
					}
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_powerful_vassal_takeover
					power < 1.0
				}
			}

			mult_modifier = {
				factor = 0.1

				faction_power = {
					faction = faction_powerful_vassal_takeover
					power < 1.5
				}
			}
		}
	}
}