namespace = faction

###########################################
# Lower Crown Levy ultimatum
###########################################
# Lower Crown Levy ultimatum
letter_event = {
	id = faction.1
	desc = EVTDESCfaction.1
	
	is_triggered_only = yes
	
	trigger = {
		FROM = { in_faction = faction_lower_crown_levy }
	}
	
	immediate = {
		FROM = { 
			diplomatic_immunity = yes 
			any_faction_backer = {
				faction = faction_lower_crown_levy
				diplomatic_immunity = yes
			}
		}
	}
	
	option = {
		name = EVTOPTA8000
		ai_chance = {
			factor = 10
			modifier = { factor = 0 NOT = { FROM = { faction_power = { faction = faction_lower_crown_levy power = 1.0 } } } }
			modifier = { factor = 0 FROM = { NOT = { plot_power = 1.0 } } }
			modifier = { factor = 1.25 is_weak_trigger = yes }
			modifier = { factor = 1.25 trait = craven }
			modifier = { factor = 1.25 trait = humble }
			modifier = { factor = 1.25 trait = kind }
			modifier = { factor = 1.25 trait = charitable }
			modifier = { factor = 1.25 trait = patient }
			modifier = { factor = 1.25 trait = content }
		}
		
		hidden_tooltip = {
			any_vassal = {
				limit = {
					ai = no
					NOT = { in_faction = faction_lower_crown_levy }
				}
				character_event = { id = faction.3 }
			}
			FROM = {
				letter_event = { id = faction.4 }
				any_faction_backer = {
					faction = faction_lower_crown_levy
					letter_event = { id = faction.5 }
					diplomatic_immunity = no
				}
				diplomatic_immunity = no
			}
		}
		FROM = {
			faction_lower_crown_levy = { # The target (title) of the faction
				if = {
					limit = { has_law = crown_levy_2 }
					add_law_w_cooldown = crown_levy_1
				}
				if = {
					limit = { has_law = crown_levy_3 }
					add_law_w_cooldown = crown_levy_2
				}
			}
			opinion = { modifier = opinion_lowered_crown_levy who = ROOT months = 12 }
		}
	}
	option = {
		name = EVTOPTB8000
		ai_chance = {
			factor = 90
			modifier = { factor = 1.25 is_strong_trigger = yes }
			modifier = { factor = 1.25 trait = brave }
			modifier = { factor = 1.25 trait = proud }
			modifier = { factor = 1.25 trait = envious }
			modifier = { factor = 1.25 trait = greedy }
			modifier = { factor = 1.25 trait = wroth }
			modifier = { factor = 1.25 trait = ambitious }
			modifier = { factor = 0.75 FROM = { faction_power =  { faction = faction_lower_crown_levy power = 1.5 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_lower_crown_levy power = 1.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_lower_crown_levy power = 2.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_lower_crown_levy power = 3.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_lower_crown_levy power = 4.0 } } }
		}
		hidden_tooltip = {
			if = {
				limit = { FROM = { faction_power = { faction = faction_lower_crown_levy power = 1.0 } } }
				random = {
					chance = 25
					character_event = { id = 45002 days = 120 } # Loyalists flock to the liege's banner
				}
			}
		}
		FROM = {
			letter_event = { id = faction.6 days = 3 tooltip = EVTTOOLTIP8100 }
			tooltip = { any_faction_backer = { faction = faction_lower_crown_levy } }
			hidden_tooltip = {
				if = {
					limit = {
						NOT = { faction_power = { faction = faction_lower_crown_levy power = 0.75 } }
					}
					random_list = {
						50 = { }
						30 = { character_event = { id = 45000 days = 17 } } # A great number of rebels flock to the revolter's banner
						20 = { character_event = { id = 45004 days = 17 } } # Rebels flock to the revolter's banner
					}
				}
				if = {
					limit = {
						faction_power = { faction = faction_lower_crown_levy power = 0.75 }
						NOT = { faction_power = { faction = faction_lower_crown_levy power = 1.5 } }
					}
					random_list = {
						75 = { }
						5 = { character_event = { id = 45000 days = 17 } } # A great number of rebels flock to the revolter's banner
						20 = { character_event = { id = 45004 days = 17 } } # Rebels flock to the revolter's banner
					}
				}
			}
		}
	}
}
# Regent is in on the plot
letter_event = {
	id = faction.2
	desc = EVTDESCfaction.2
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA8026
		hidden_tooltip = {
			FROM = {
				letter_event = { id = faction.4 }
				any_plot_backer = { letter_event = { id = faction.5 } }
			}
		}
		FROM = {
			crownlaw_title = {
				if = {
					limit = { has_law = crown_levy_2 }
					add_law_w_cooldown = crown_levy_1
				}
				if = {
					limit = { has_law = crown_levy_3 }
					add_law_w_cooldown = crown_levy_2
				}
			}
		}
		FROM = { opinion = { modifier = opinion_lowered_crown_levy who = ROOT months = 12 } }
	}
}
# Inform other vassals
character_event = {
	id = faction.3
	desc = EVTDESCfaction.3
	picture = GFX_evt_council
	border = GFX_event_normal_frame_intrigue
	
	show_from_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "I_SEE"
	}
}
# Demand accepted
letter_event = {
	id = faction.4
	desc = EVTDESCfaction.4
	
	is_triggered_only = yes
	
	option = {
		name = "EXCELLENT"
		clr_character_flag = faction_lower_crown_levy_ultimatum_taken
		add_character_modifier = { name = faction_lower_crown_levy_ultimatum_timer hidden = yes duration = 3650 }
	}
}
# Inform faction backer
letter_event = {
	id = faction.5
	desc = EVTDESCfaction.5
	
	show_from_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "GOOD"
		reverse_opinion = { modifier = opinion_grateful who = FROMFROM years = 5 }
		add_character_modifier = { name = faction_lower_crown_levy_ultimatum_timer hidden = yes duration = 3650 }
	}
}
# Demand rejected 
letter_event = {
	id = faction.6
	desc = EVTDESC8100
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA8100
		clr_character_flag = faction_lower_crown_levy_ultimatum_taken
		faction_lower_crown_levy = { # The target (title) of the faction
			reverse_war = { 
				target = ROOT 
				casus_belli = lower_crown_levy_law 
				faction = faction_lower_crown_levy
			}
		} 
	}
}

###########################################
# Lower Crown Obligation ultimatum
###########################################
# Lower Crown Obligation ultimatum
letter_event = {
	id = faction.10
	desc = EVTDESCfaction.10
	
	is_triggered_only = yes
	
	trigger = {
		FROM = { in_faction = faction_lower_crown_obligation }
	}
	
	immediate = {
		FROM = { 
			diplomatic_immunity = yes 
			any_faction_backer = {
				faction = faction_lower_crown_obligation
				diplomatic_immunity = yes
			}
		}
	}
	
	option = {
		name = EVTOPTA8000
		ai_chance = {
			factor = 10
			modifier = { factor = 0 NOT = { FROM = { faction_power = { faction = faction_lower_crown_obligation power = 1.0 } } } }
			modifier = { factor = 0 FROM = { NOT = { plot_power = 1.0 } } }
			modifier = { factor = 1.25 is_weak_trigger = yes }
			modifier = { factor = 1.25 trait = craven }
			modifier = { factor = 1.25 trait = humble }
			modifier = { factor = 1.25 trait = kind }
			modifier = { factor = 1.25 trait = charitable }
			modifier = { factor = 1.25 trait = patient }
			modifier = { factor = 1.25 trait = content }
		}
		
		hidden_tooltip = {
			any_vassal = {
				limit = {
					ai = no
					NOT = { in_faction = faction_lower_crown_obligation }
				}
				character_event = { id = faction.12 }
			}
			FROM = {
				letter_event = { id = faction.13 }
				any_faction_backer = {
					faction = faction_lower_crown_obligation
					letter_event = { id = faction.14 }
					diplomatic_immunity = no
				}
				diplomatic_immunity = no
			}
		}
		FROM = {
			faction_lower_crown_obligation = { # The target (title) of the faction
				if = {
					limit = { has_law = crown_authority_1 }
					add_law_w_cooldown = crown_authority_0
				}
				if = {
					limit = { has_law = crown_authority_2 }
					add_law_w_cooldown = crown_authority_1
				}
				if = {
					limit = { has_law = crown_authority_3 }
					add_law_w_cooldown = crown_authority_2
				}
				if = {
					limit = { has_law = crown_authority_4 }
					add_law_w_cooldown = crown_authority_3
				}
			}
			opinion = { modifier = opinion_lowered_crown_obligation who = ROOT months = 12 }
		}
	}
	option = {
		name = EVTOPTB8000
		ai_chance = {
			factor = 90
			modifier = { factor = 1.25 is_strong_trigger = yes }
			modifier = { factor = 1.25 trait = brave }
			modifier = { factor = 1.25 trait = proud }
			modifier = { factor = 1.25 trait = envious }
			modifier = { factor = 1.25 trait = greedy }
			modifier = { factor = 1.25 trait = wroth }
			modifier = { factor = 1.25 trait = ambitious }
			modifier = { factor = 0.75 FROM = { faction_power =  { faction = faction_lower_crown_obligation power = 1.5 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_lower_crown_obligation power = 1.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_lower_crown_obligation power = 2.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_lower_crown_obligation power = 3.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_lower_crown_obligation power = 4.0 } } }
		}
		hidden_tooltip = {
			if = {
				limit = { FROM = { faction_power = { faction = faction_lower_crown_obligation power = 1.0 } } }
				random = {
					chance = 25
					character_event = { id = 45002 days = 120 } # Loyalists flock to the liege's banner
				}
			}
		}
		FROM = {
			letter_event = { id = faction.15 days = 3 tooltip = EVTTOOLTIP8100 }
			tooltip = { any_faction_backer = { faction = faction_lower_crown_obligation } }
			hidden_tooltip = {
				if = {
					limit = {
						NOT = { faction_power = { faction = faction_lower_crown_obligation power = 0.75 } }
					}
					random_list = {
						50 = { }
						30 = { character_event = { id = 45000 days = 17 } } # A great number of rebels flock to the revolter's banner
						20 = { character_event = { id = 45004 days = 17 } } # Rebels flock to the revolter's banner
					}
				}
				if = {
					limit = {
						faction_power = { faction = faction_lower_crown_obligation power = 0.75 }
						NOT = { faction_power = { faction = faction_lower_crown_obligation power = 1.5 } }
					}
					random_list = {
						75 = { }
						5 = { character_event = { id = 45000 days = 17 } } # A great number of rebels flock to the revolter's banner
						20 = { character_event = { id = 45004 days = 17 } } # Rebels flock to the revolter's banner
					}
				}
			}
		}
	}
}
# Regent is in on the plot
letter_event = {
	id = faction.11
	desc = EVTDESCfaction.11
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA8026
		hidden_tooltip = {
			FROM = {
				letter_event = { id = faction.13 }
				any_plot_backer = { letter_event = { id = faction.14 } }
			}
		}
		FROM = {
			crownlaw_title = {
				if = {
					limit = { has_law = crown_authority_1 }
					add_law_w_cooldown = crown_authority_0
				}
				if = {
					limit = { has_law = crown_authority_2 }
					add_law_w_cooldown = crown_authority_1
				}
				if = {
					limit = { has_law = crown_authority_3 }
					add_law_w_cooldown = crown_authority_2
				}
				if = {
					limit = { has_law = crown_authority_4 }
					add_law_w_cooldown = crown_authority_3
				}
			}
		}
		FROM = { opinion = { modifier = opinion_lowered_crown_obligation who = ROOT months = 12 } }
	}
}
# Inform other vassals
character_event = {
	id = faction.12
	desc = EVTDESCfaction.12
	picture = GFX_evt_council
	border = GFX_event_normal_frame_intrigue
	
	show_from_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "I_SEE"
	}
}
# Demand accepted
letter_event = {
	id = faction.13
	desc = EVTDESCfaction.13
	
	is_triggered_only = yes
	
	option = {
		name = "EXCELLENT"
		clr_character_flag = faction_lower_crown_obligation_ultimatum_taken
		add_character_modifier = { name = faction_lower_crown_obligation_ultimatum_timer hidden = yes duration = 3650 }
	}
}
# Inform faction backer
letter_event = {
	id = faction.14
	desc = EVTDESCfaction.14
	
	show_from_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "GOOD"
		reverse_opinion = { modifier = opinion_grateful who = FROMFROM years = 5 }
		add_character_modifier = { name = faction_lower_crown_obligation_ultimatum_timer hidden = yes duration = 3650 }
	}
}
# Demand rejected 
letter_event = {
	id = faction.15
	desc = EVTDESC8100
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA8100
		clr_character_flag = faction_lower_crown_obligation_ultimatum_timer
		faction_lower_crown_obligation = {  # The target (title) of the faction
			reverse_war = { 
				target = ROOT 
				casus_belli = lower_crown_obligation_law 
				faction = faction_lower_crown_obligation
			}
		}
	}
}

###########################################
# Tanistry ultimatum
###########################################
# Tanistry ultimatum
letter_event = {
	id = faction.20
	desc = EVTDESCfaction.20
	
	is_triggered_only = yes
	
	trigger = {
		FROM = { in_faction = faction_succ_tanistry }
	}
	
	immediate = {
		FROM = { 
			diplomatic_immunity = yes 
			any_faction_backer = {
				faction = faction_succ_tanistry
				diplomatic_immunity = yes
			}
		}
	}
	
	option = {
		name = EVTOPTA8000
		ai_chance = {
			factor = 20
			modifier = { factor = 0 NOT = { FROM = { faction_power = { faction = faction_succ_tanistry power = 0.5 } } } }
			modifier = { factor = 1.25 is_weak_trigger = yes }
			modifier = { factor = 1.25 trait = craven }
			modifier = { factor = 1.25 trait = humble }
			modifier = { factor = 1.25 trait = kind }
			modifier = { factor = 1.25 trait = charitable }
			modifier = { factor = 1.25 trait = patient }
			modifier = { factor = 1.25 trait = content }
		}
		hidden_tooltip = {
			any_vassal = {
				limit = {
					ai = no
					NOT = { in_faction = faction_succ_tanistry }
				}
				character_event = { id = faction.21 }
			}
			FROM = {
				letter_event = { id = faction.22 }
				any_faction_backer = {
					faction = faction_succ_tanistry
					letter_event = { id = faction.23 }
					diplomatic_immunity = no
				}
				diplomatic_immunity = no
			}
		}
		FROM = {
			faction_succ_tanistry = { succession = primogeniture } # The target (title) of the faction
		}
	}
	option = {
		name = EVTOPTB8000
		ai_chance = {
			factor = 80
			modifier = { factor = 1.25 is_strong_trigger = yes }
			modifier = { factor = 1.25 trait = brave }
			modifier = { factor = 1.25 trait = proud }
			modifier = { factor = 1.25 trait = envious }
			modifier = { factor = 1.25 trait = greedy }
			modifier = { factor = 1.25 trait = wroth }
			modifier = { factor = 1.25 trait = ambitious }
			modifier = { factor = 0.75 FROM = { faction_power =  { faction = faction_succ_tanistry power = 1.5 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_succ_tanistry power = 1.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_succ_tanistry power = 2.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_succ_tanistry power = 3.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_succ_tanistry power = 4.0 } } }
		}
		hidden_tooltip = {
			if = {
				limit = { FROM = { faction_power = { faction = faction_succ_tanistry power = 1.0 } } }
				random = {
					chance = 25
					character_event = { id = 45002 days = 120 } # Loyalists flock to the liege's banner
				}
			}
		}
		FROM = {
			letter_event = { id = faction.24 days = 3 tooltip = EVTTOOLTIP8100 }
			tooltip = { any_faction_backer = { faction = faction_succ_tanistry } }
			hidden_tooltip = {
				if = {
					limit = {
						NOT = { faction_power = { faction = faction_succ_tanistry power = 0.75 } }
					}
					random_list = {
						50 = { }
						30 = { character_event = { id = 45000 days = 17 } } # A great number of rebels flock to the revolter's banner
						20 = { character_event = { id = 45004 days = 17 } } # Rebels flock to the revolter's banner
					}
				}
				if = {
					limit = {
						faction_power = { faction = faction_succ_tanistry power = 0.75 }
						NOT = { faction_power = { faction = faction_succ_tanistry power = 1.5 } }
					}
					random_list = {
						75 = { }
						5 = { character_event = { id = 45000 days = 17 } } # A great number of rebels flock to the revolter's banner
						20 = { character_event = { id = 45004 days = 17 } } # Rebels flock to the revolter's banner
					}
				}
			}
		}
	}
}
# Inform other vassals
character_event = {
	id = faction.21
	desc = EVTDESCfaction.21
	
	picture = GFX_evt_council
	border = GFX_event_normal_frame_intrigue
	
	show_from_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "I_SEE"
	}
}
# Demand accepted
letter_event = {
	id = faction.22
	desc = EVTDESCfaction.22
	
	is_triggered_only = yes
	
	option = {
		name = "EXCELLENT"
		clr_character_flag = faction_succ_tanistry_ultimatum_taken
		add_character_modifier = { name = faction_succ_tanistry_ultimatum_timer hidden = yes duration = 3650 }
	}
}
# Inform faction backer
letter_event = {
	id = faction.23
	desc = EVTDESCfaction.23
	
	show_from_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "GOOD"
		reverse_opinion = { modifier = opinion_grateful who = FROMFROM years = 5 }
		add_character_modifier = { name = faction_succ_tanistry_ultimatum_timer hidden = yes duration = 3650 }
	}
}
# Demand rejected
letter_event = {
	id = faction.24
	desc = EVTDESC8100
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA8100
		clr_character_flag = faction_succ_tanistry_ultimatum_taken
		faction_succ_tanistry = { reverse_war = { target = ROOT casus_belli = change_tanistry_succession_law faction = faction_succ_tanistry } } # The target (title) of the faction
	}
}

###########################################
# Ultimogeniture ultimatum
###########################################
# Ultimogeniture ultimatum
letter_event = {
	id = faction.30
	desc = EVTDESCfaction.30
	
	is_triggered_only = yes
	
	trigger = {
		FROM = { in_faction = faction_succ_ultimogeniture }
	}
	
	immediate = {
		FROM = { 
			diplomatic_immunity = yes 
			any_faction_backer = {
				faction = faction_succ_ultimogeniture
				diplomatic_immunity = yes
			}
		}
	}
	
	option = {
		name =EVTOPTA8000
		ai_chance = {
			factor = 20
			modifier = { factor = 0 NOT = { FROM = { faction_power = { faction = faction_succ_ultimogeniture power = 0.5 } } } }
			modifier = { factor = 1.25 is_weak_trigger = yes }
			modifier = { factor = 1.25 trait = craven }
			modifier = { factor = 1.25 trait = humble }
			modifier = { factor = 1.25 trait = kind }
			modifier = { factor = 1.25 trait = charitable }
			modifier = { factor = 1.25 trait = patient }
			modifier = { factor = 1.25 trait = content }
		}
		hidden_tooltip = {
			any_vassal = {
				limit = {
					ai = no
					NOT = { in_faction = faction_succ_ultimogeniture }
				}
				character_event = { id = faction.31 }
			}
			FROM = {
				letter_event = { id = faction.32 }
				any_faction_backer = {
					faction = faction_succ_ultimogeniture
					letter_event = { id = faction.33 }
					diplomatic_immunity = no
				}
				diplomatic_immunity = no
			}
		}
		FROM = {
			faction_succ_ultimogeniture = { succession = primogeniture } # The target (title) of the faction
		}
	}
	option = {
		name = EVTOPTB8000
		ai_chance = {
			factor = 80
			modifier = { factor = 1.25 is_strong_trigger = yes }
			modifier = { factor = 1.25 trait = brave }
			modifier = { factor = 1.25 trait = proud }
			modifier = { factor = 1.25 trait = envious }
			modifier = { factor = 1.25 trait = greedy }
			modifier = { factor = 1.25 trait = wroth }
			modifier = { factor = 1.25 trait = ambitious }
			modifier = { factor = 0.75 FROM = { faction_power =  { faction = faction_succ_ultimogeniture power = 1.5 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_succ_ultimogeniture power = 1.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_succ_ultimogeniture power = 2.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_succ_ultimogeniture power = 3.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_succ_ultimogeniture power = 4.0 } } }
		}
		hidden_tooltip = {
			if = {
				limit = { FROM = { faction_power = { faction = faction_succ_ultimogeniture power = 1.0 } } }
				random = {
					chance = 25
					character_event = { id = 45002 days = 120 } # Loyalists flock to the liege's banner
				}
			}
		}
		FROM = {
			letter_event = { id = faction.34 days = 3 tooltip = EVTTOOLTIP8100 }
			tooltip = { any_faction_backer = { faction = faction_succ_ultimogeniture } }
			hidden_tooltip = {
				if = {
					limit = {
						NOT = { faction_power = { faction = faction_succ_ultimogeniture power = 0.75 } }
					}
					random_list = {
						50 = { }
						30 = { character_event = { id = 45000 days = 17 } } # A great number of rebels flock to the revolter's banner
						20 = { character_event = { id = 45004 days = 17 } } # Rebels flock to the revolter's banner
					}
				}
				if = {
					limit = {
						faction_power = { faction = faction_succ_ultimogeniture power = 0.75 }
						NOT = { faction_power = { faction = faction_succ_ultimogeniture power = 1.5 } }
					}
					random_list = {
						75 = { }
						5 = { character_event = { id = 45000 days = 17 } } # A great number of rebels flock to the revolter's banner
						20 = { character_event = { id = 45004 days = 17 } } # Rebels flock to the revolter's banner
					}
				}
			}
		}
	}
}
# Inform other vassals
character_event = {
	id = faction.31
	desc = EVTDESCfaction.31
	
	picture = GFX_evt_council
	border = GFX_event_normal_frame_intrigue
	
	show_from_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "I_SEE"
	}
}
# Demand accepted
letter_event = {
	id = faction.32
	desc = EVTDESCfaction.32
	
	is_triggered_only = yes
	
	option = {
		name = "EXCELLENT"
		clr_character_flag = faction_succ_ultimogeniture_ultimatum_taken
		add_character_modifier = { name = faction_succ_ultimogeniture_ultimatum_timer hidden = yes duration = 3650 }
	}
}
# Inform faction backer
letter_event = {
	id = faction.33
	desc = EVTDESCfaction.33
	
	show_from_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "GOOD"
		reverse_opinion = { modifier = opinion_grateful who = FROMFROM years = 5 }
		add_character_modifier = { name = faction_succ_ultimogeniture_ultimatum_timer hidden = yes duration = 3650 }
	}
}
# Demand rejected
letter_event = {
	id = faction.34
	desc = EVTDESC8100
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA8100
		clr_character_flag = faction_succ_ultimogeniture_ultimatum_taken
		faction_succ_ultimogeniture = { reverse_war = { target = ROOT casus_belli = change_ultimogeniture_succession_law faction = faction_succ_ultimogeniture } } # The target (title) of the faction
	}
}

###########################################
# Lower Tolerance ultimatum
###########################################
# Lower Crown Obligation ultimatum
letter_event = {
	id = faction.40
	desc = EVTDESCfaction.40
	
	is_triggered_only = yes
	
	trigger = {
		FROM = { in_faction = faction_lower_tolerance }
	}
	
	immediate = {
		FROM = { 
			diplomatic_immunity = yes 
			any_faction_backer = {
				faction = faction_lower_tolerance
				diplomatic_immunity = yes
			}
		}
	}
	
	option = {
		name = EVTOPTA8000
		ai_chance = {
			factor = 10
			modifier = { factor = 0 NOT = { FROM = { faction_power = { faction = faction_lower_tolerance power = 1.0 } } } }
			modifier = { factor = 0 FROM = { NOT = { plot_power = 1.0 } } }
			modifier = { factor = 1.25 is_weak_trigger = yes }
			modifier = { factor = 1.25 trait = craven }
			modifier = { factor = 1.25 trait = humble }
			modifier = { factor = 1.25 trait = kind }
			modifier = { factor = 1.25 trait = charitable }
			modifier = { factor = 1.25 trait = patient }
			modifier = { factor = 1.25 trait = content }
		}
		
		hidden_tooltip = {
			any_vassal = {
				limit = {
					ai = no
					NOT = { in_faction = faction_lower_tolerance }
				}
				character_event = { id = faction.42 }
			}
			FROM = {
				letter_event = { id = faction.43 }
				any_faction_backer = {
					faction = faction_lower_tolerance
					letter_event = { id = faction.44 }
					diplomatic_immunity = no
				}
				diplomatic_immunity = no
			}
		}
		FROM = {
			faction_lower_tolerance = { # The target (title) of the faction
				if = {
					limit = { has_law = tolerance_1 }
					add_law_w_cooldown = tolerance_0
				}
				if = {
					limit = { has_law = tolerance_2 }
					add_law_w_cooldown = tolerance_1
				}
			}
			opinion = { modifier = opinion_lowered_tolerance who = ROOT months = 12 }
		}
	}
	option = {
		name = EVTOPTB8000
		ai_chance = {
			factor = 90
			modifier = { factor = 1.25 is_strong_trigger = yes }
			modifier = { factor = 1.25 trait = brave }
			modifier = { factor = 1.25 trait = proud }
			modifier = { factor = 1.25 trait = envious }
			modifier = { factor = 1.25 trait = greedy }
			modifier = { factor = 1.25 trait = wroth }
			modifier = { factor = 1.25 trait = ambitious }
			modifier = { factor = 0.75 FROM = { faction_power =  { faction = faction_lower_tolerance power = 1.5 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_lower_tolerance power = 1.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_lower_tolerance power = 2.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_lower_tolerance power = 3.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_lower_tolerance power = 4.0 } } }
		}
		hidden_tooltip = {
			if = {
				limit = { FROM = { faction_power = { faction = faction_lower_tolerance power = 1.0 } } }
				random = {
					chance = 25
					character_event = { id = 45002 days = 120 } # Loyalists flock to the liege's banner
				}
			}
		}
		FROM = {
			letter_event = { id = faction.45 days = 3 tooltip = EVTTOOLTIP8100 }
			tooltip = { any_faction_backer = { faction = faction_lower_tolerance } }
			hidden_tooltip = {
				if = {
					limit = {
						NOT = { faction_power = { faction = faction_lower_tolerance power = 0.75 } }
					}
					random_list = {
						50 = { }
						30 = { character_event = { id = 45000 days = 17 } } # A great number of rebels flock to the revolter's banner
						20 = { character_event = { id = 45004 days = 17 } } # Rebels flock to the revolter's banner
					}
				}
				if = {
					limit = {
						faction_power = { faction = faction_lower_tolerance power = 0.75 }
						NOT = { faction_power = { faction = faction_lower_tolerance power = 1.5 } }
					}
					random_list = {
						75 = { }
						5 = { character_event = { id = 45000 days = 17 } } # A great number of rebels flock to the revolter's banner
						20 = { character_event = { id = 45004 days = 17 } } # Rebels flock to the revolter's banner
					}
				}
			}
		}
	}
}
# Regent is in on the plot
letter_event = {
	id = faction.41
	desc = EVTDESCfaction.41
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA8026
		hidden_tooltip = {
			FROM = {
				letter_event = { id = faction.43 }
				any_plot_backer = { letter_event = { id = faction.44 } }
			}
		}
		FROM = {
			crownlaw_title = {
				if = {
					limit = { has_law = tolerance_1 }
					add_law_w_cooldown = tolerance_0
				}
				if = {
					limit = { has_law = tolerance_2 }
					add_law_w_cooldown = tolerance_1
				}
			}
		}
		FROM = { opinion = { modifier = opinion_lowered_tolerance who = ROOT months = 12 } }
	}
}
# Inform other vassals
character_event = {
	id = faction.42
	desc = EVTDESCfaction.42
	picture = GFX_evt_council
	border = GFX_event_normal_frame_intrigue
	
	show_from_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "I_SEE"
	}
}
# Demand accepted
letter_event = {
	id = faction.43
	desc = EVTDESCfaction.43
	
	is_triggered_only = yes
	
	option = {
		name = "EXCELLENT"
		clr_character_flag = faction_lower_or_raise_tolerance_ultimatum_taken
		add_character_modifier = { name = faction_lower_or_raise_tolerance_ultimatum_timer hidden = yes duration = 3650 }
	}
}
# Inform faction backer
letter_event = {
	id = faction.44
	desc = EVTDESCfaction.44
	
	show_from_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "GOOD"
		reverse_opinion = { modifier = opinion_grateful who = FROMFROM years = 5 }
		add_character_modifier = { name = faction_lower_or_raise_tolerance_ultimatum_timer hidden = yes duration = 3650 }
	}
}
# Demand rejected 
letter_event = {
	id = faction.45
	desc = EVTDESC8100
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA8100
		clr_character_flag = faction_lower_or_raise_tolerance_ultimatum_taken
		faction_lower_tolerance = { reverse_war = { target = ROOT casus_belli = lower_tolerance_law faction = faction_lower_tolerance } } # The target (title) of the faction
	}
}

###########################################
# Raise Tolerance ultimatum
###########################################
# Raise Crown Obligation ultimatum
letter_event = {
	id = faction.50
	desc = EVTDESCfaction.50
	
	is_triggered_only = yes
	
	trigger = {
		FROM = { in_faction = faction_raise_tolerance }
	}
	
	immediate = {
		FROM = { 
			diplomatic_immunity = yes 
			any_faction_backer = {
				faction = faction_raise_tolerance
				diplomatic_immunity = yes
			}
		}
	}
	
	option = {
		name = EVTOPTA8000
		ai_chance = {
			factor = 10
			modifier = { factor = 0 NOT = { FROM = { faction_power = { faction = faction_raise_tolerance power = 1.0 } } } }
			modifier = { factor = 0 FROM = { NOT = { plot_power = 1.0 } } }
			modifier = { factor = 1.25 is_weak_trigger = yes }
			modifier = { factor = 1.25 trait = craven }
			modifier = { factor = 1.25 trait = humble }
			modifier = { factor = 1.25 trait = kind }
			modifier = { factor = 1.25 trait = charitable }
			modifier = { factor = 1.25 trait = patient }
			modifier = { factor = 1.25 trait = content }
		}
		
		hidden_tooltip = {
			any_vassal = {
				limit = {
					ai = no
					NOT = { in_faction = faction_raise_tolerance }
				}
				character_event = { id = faction.52 }
			}
			FROM = {
				letter_event = { id = faction.53 }
				any_faction_backer = {
					faction = faction_raise_tolerance
					letter_event = { id = faction.54 }
					diplomatic_immunity = no
				}
				diplomatic_immunity = no
			}
		}
		FROM = {
			faction_raise_tolerance = { # The target (title) of the faction
				if = {
					limit = { has_law = tolerance_1 }
					add_law_w_cooldown = tolerance_2
				}
				if = {
					limit = { has_law = tolerance_0 }
					add_law_w_cooldown = tolerance_1
				}
			}
			opinion = { modifier = opinion_raised_tolerance who = ROOT months = 12 }
		}
	}
	option = {
		name = EVTOPTB8000
		ai_chance = {
			factor = 90
			modifier = { factor = 1.25 is_strong_trigger = yes }
			modifier = { factor = 1.25 trait = brave }
			modifier = { factor = 1.25 trait = proud }
			modifier = { factor = 1.25 trait = envious }
			modifier = { factor = 1.25 trait = greedy }
			modifier = { factor = 1.25 trait = wroth }
			modifier = { factor = 1.25 trait = ambitious }
			modifier = { factor = 0.75 FROM = { faction_power =  { faction = faction_raise_tolerance power = 1.5 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_raise_tolerance power = 1.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_raise_tolerance power = 2.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_raise_tolerance power = 3.0 } } }
			modifier = { factor = 0.5 FROM = { faction_power =  { faction = faction_raise_tolerance power = 4.0 } } }
		}
		hidden_tooltip = {
			if = {
				limit = { FROM = { faction_power = { faction = faction_raise_tolerance power = 1.0 } } }
				random = {
					chance = 25
					character_event = { id = 45002 days = 120 } # Loyalists flock to the liege's banner
				}
			}
		}
		FROM = {
			letter_event = { id = faction.55 days = 3 tooltip = EVTTOOLTIP8100 }
			tooltip = { any_faction_backer = { faction = faction_raise_tolerance } }
			hidden_tooltip = {
				if = {
					limit = {
						NOT = { faction_power = { faction = faction_raise_tolerance power = 0.75 } }
					}
					random_list = {
						50 = { }
						30 = { character_event = { id = 45000 days = 17 } } # A great number of rebels flock to the revolter's banner
						20 = { character_event = { id = 45004 days = 17 } } # Rebels flock to the revolter's banner
					}
				}
				if = {
					limit = {
						faction_power = { faction = faction_raise_tolerance power = 0.75 }
						NOT = { faction_power = { faction = faction_raise_tolerance power = 1.5 } }
					}
					random_list = {
						75 = { }
						5 = { character_event = { id = 45000 days = 17 } } # A great number of rebels flock to the revolter's banner
						20 = { character_event = { id = 45004 days = 17 } } # Rebels flock to the revolter's banner
					}
				}
			}
		}
	}
}
# Regent is in on the plot
letter_event = {
	id = faction.51
	desc = EVTDESCfaction.51
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA8026
		hidden_tooltip = {
			FROM = {
				letter_event = { id = faction.53 }
				any_plot_backer = { letter_event = { id = faction.54 } }
			}
		}
		FROM = {
			crownlaw_title = {
				if = {
					limit = { has_law = tolerance_1 }
					add_law_w_cooldown = tolerance_2
				}
				if = {
					limit = { has_law = tolerance_0 }
					add_law_w_cooldown = tolerance_1
				}
			}
		}
		FROM = { opinion = { modifier = opinion_raised_tolerance who = ROOT months = 12 } }
	}
}
# Inform other vassals
character_event = {
	id = faction.52
	desc = EVTDESCfaction.52
	picture = GFX_evt_council
	border = GFX_event_normal_frame_intrigue
	
	show_from_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "I_SEE"
	}
}
# Demand accepted
letter_event = {
	id = faction.53
	desc = EVTDESCfaction.53
	
	is_triggered_only = yes
	
	option = {
		name = "EXCELLENT"
		clr_character_flag = faction_lower_or_raise_tolerance_ultimatum_taken
		add_character_modifier = { name = faction_lower_or_raise_tolerance_ultimatum_timer hidden = yes duration = 3650 }
	}
}
# Inform faction backer
letter_event = {
	id = faction.54
	desc = EVTDESCfaction.54
	
	show_from_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "GOOD"
		reverse_opinion = { modifier = opinion_grateful who = FROMFROM years = 5 }
		add_character_modifier = { name = faction_lower_or_raise_tolerance_ultimatum_timer hidden = yes duration = 3650 }
	}
}
# Demand rejected 
letter_event = {
	id = faction.55
	desc = EVTDESC8100
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA8100
		clr_character_flag = faction_lower_or_raise_tolerance_ultimatum_taken
		faction_raise_tolerance = { reverse_war = { target = ROOT casus_belli = raise_tolerance_law faction = faction_raise_tolerance } } # The target (title) of the faction
	}
}
