namespace = PlusFaction

#reserved: PlusFaction.100 to PlusFaction.199

##################################
# FACTION MEMBERSHIP EVENTS
# Original Faction System by Wiz
# Re-Written by Rylock
##################################

# Joining a faction
character_event = {
	id = PlusFaction.100
	
	hide_window = yes
	
	only_playable = yes
	only_rulers = yes
	min_age = 16
	capable_only = yes
	prisoner = no
	ai = yes
	
	trigger = {
		independent = no
		#need a barony/county so they can potentially rebel
		is_landed = yes # (just a family palace doesn't count, had problems with these kind of patricians revolting)
		NOR = {
			is_inaccessible_trigger = yes
			liege = { current_heir = { character = ROOT } }
			has_character_flag = faction_court_supporter
			has_character_flag = faction_prosperity_supporter
			has_character_flag = faction_glory_supporter
			has_character_flag = faction_tradition_supporter
		}
	}
	
	mean_time_to_happen = {
		days = 7
	}
	
	immediate = {
		set_character_flag = has_picked_faction
		random_list = {
			25 = {
				modifier = {
					factor = 1.5
					OR = {
						trait = amateurish_plotter
						trait = flamboyant_schemer
					}
				}
				modifier = {
					factor = 3.0
					OR = {
						trait = intricate_webweaver
						trait = elusive_shadow
					}
				}
				modifier = {
					factor = 0.75
					NOR = {
						trait = amateurish_plotter
						trait = flamboyant_schemer
						trait = intricate_webweaver
						trait = elusive_shadow
						trait = naive_appeaser
						trait = underhanded_rogue
						trait = charismatic_negotiator
						trait = grey_eminence
					}
				}
				modifier = {
					factor = 1.5
					trait = ambitious
				}
				modifier = {
					factor = 1.5
					trait = proud
				}
				modifier = {
					factor = 1.5
					trait = greedy
				}
				modifier = {
					factor = 1.5
					trait = envious
				}
				modifier = {
					factor = 1.5
					trait = gluttonous
				}
				modifier = {
					factor = 1.5
					OR = {
						trait = schemer
						trait = gamer
					}
				}
				modifier = {
					factor = 0.5
					trait = charitable
				}
				modifier = {
					factor = 0.5
					trait = humble
				}
				modifier = {
					factor = 0.5
					trait = content
				}
				modifier = {
					factor = 0.5
					OR = {
						is_patrician = yes
						is_republic = yes
						is_merchant_republic = yes
						capital_holding = { holding_type = temple }
					}
				}
				modifier = {
					factor = 1.25
					liege = {
						any_vassal = {
							leads_faction = faction_court
							reverse_opinion = { who = ROOT value = 25 }
						}
					}
				}
				modifier = {
					factor = 1.25
					liege = {
						any_vassal = {
							leads_faction = faction_court
							reverse_opinion = { who = ROOT value = 50 }
						}
					}
				}
				modifier = {
					factor = 1.25
					liege = {
						any_vassal = {
							leads_faction = faction_court
							reverse_opinion = { who = ROOT value = 75 }
						}
					}
				}
				modifier = {
					factor = 0.8
					liege = {
						any_vassal = {
							leads_faction = faction_court
							NOT = { reverse_opinion = { who = ROOT value = -25 } }
						}
					}
				}
				modifier = {
					factor = 0.8
					liege = {
						any_vassal = {
							leads_faction = faction_court
							NOT = { reverse_opinion = { who = ROOT value = -50 } }
						}
					}
				}
				modifier = {
					factor = 0.8
					liege = {
						any_vassal = {
							leads_faction = faction_court
							NOT = { reverse_opinion = { who = ROOT value = -75 } }
						}
					}
				}
				set_character_flag = faction_court_supporter
			}
			25 = {
				modifier = {
					factor = 3.0
					OR = {
						is_patrician = yes
						is_republic = yes
						is_merchant_republic = yes
					}
				}
				modifier = {
					factor = 1.5
					OR = {
						trait = indulgent_wastrel
						trait = thrifty_clerk
					}
				}
				modifier = {
					factor = 3.0
					OR = {
						trait = fortune_builder
						trait = midas_touched
					}
				}
				modifier = {
					factor = 0.75
					NOR = {
						trait = indulgent_wastrel
						trait = thrifty_clerk
						trait = fortune_builder
						trait = midas_touched
						is_patrician = yes
						is_republic = yes
						is_merchant_republic = yes
					}
				}
				modifier = {
					factor = 2.0
					trait = greedy
				}
				modifier = {
					factor = 1.5
					trait = diligent
				}
				modifier = {
					factor = 1.5
					OR = {
						trait = gardener
						trait = administrator
						trait = architect
					}
				}
				modifier = {
					factor = 0.5
					trait = charitable
				}
				modifier = {
					factor = 0.5
					trait = slothful
				}
				modifier = {
					factor = 0.5
					trait = trusting
				}
				modifier = {
					factor = 0.5
					capital_holding = { holding_type = temple }
				}
				modifier = {
					factor = 1.25
					liege = {
						any_vassal = {
							leads_faction = faction_prosperity
							reverse_opinion = { who = ROOT value = 25 }
						}
					}
				}
				modifier = {
					factor = 1.25
					liege = {
						any_vassal = {
							leads_faction = faction_prosperity
							reverse_opinion = { who = ROOT value = 50 }
						}
					}
				}
				modifier = {
					factor = 1.25
					liege = {
						any_vassal = {
							leads_faction = faction_prosperity
							reverse_opinion = { who = ROOT value = 75 }
						}
					}
				}
				modifier = {
					factor = 0.8
					liege = {
						any_vassal = {
							leads_faction = faction_prosperity
							NOT = { reverse_opinion = { who = ROOT value = -25 } }
						}
					}
				}
				modifier = {
					factor = 0.8
					liege = {
						any_vassal = {
							leads_faction = faction_prosperity
							NOT = { reverse_opinion = { who = ROOT value = -50 } }
						}
					}
				}
				modifier = {
					factor = 0.8
					liege = {
						any_vassal = {
							leads_faction = faction_prosperity
							NOT = { reverse_opinion = { who = ROOT value = -75 } }
						}
					}
				}
				set_character_flag = faction_prosperity_supporter
			}
			25 = {
				modifier = {
					factor = 1.5
					OR = {
						trait = misguided_warrior
						trait = tough_soldier
						martial = 15
					}
				}
				modifier = {
					factor = 3.0
					OR = {
						trait = skilled_tactician
						trait = brilliant_strategist
					}
				}
				modifier = {
					factor = 0.75
					NOR = {
						trait = misguided_warrior
						trait = tough_soldier
						trait = skilled_tactician
						trait = brilliant_strategist
						martial = 15
					}
				}
				modifier = {
					factor = 2.0
					OR = {
						trait = viking
						trait = berserker
					}
				}
				modifier = {
					factor = 1.5
					OR = {
						trait = crusader
						trait = mujahid
						trait = holy_crusader
					}
				}
				modifier = {
					factor = 1.5
					trait = brave
				}
				modifier = {
					factor = 1.5
					trait = wroth
				}
				modifier = {
					factor = 1.5
					trait = cruel
				}
				modifier = {
					factor = 1.5
					OR = {
						trait = hunter
						trait = duelist
						trait = impaler
						trait = strategist
					}
				}
				modifier = {
					factor = 0.5
					trait = kind
				}
				modifier = {
					factor = 0.5
					trait = patient
				}
				modifier = {
					factor = 0.5
					trait = craven
				}
				modifier = {
					factor = 0.5
					OR = {
						is_patrician = yes
						is_republic = yes
						is_merchant_republic = yes
						is_theocracy = yes
					}
				}
				modifier = {
					factor = 0.25
					pacifist = yes
				}
				modifier = {
					factor = 1.25
					liege = {
						any_vassal = {
							leads_faction = faction_glory
							reverse_opinion = { who = ROOT value = 25 }
						}
					}
				}
				modifier = {
					factor = 1.25
					liege = {
						any_vassal = {
							leads_faction = faction_glory
							reverse_opinion = { who = ROOT value = 50 }
						}
					}
				}
				modifier = {
					factor = 1.25
					liege = {
						any_vassal = {
							leads_faction = faction_glory
							reverse_opinion = { who = ROOT value = 75 }
						}
					}
				}
				modifier = {
					factor = 0.8
					liege = {
						any_vassal = {
							leads_faction = faction_glory
							NOT = { reverse_opinion = { who = ROOT value = -25 } }
						}
					}
				}
				modifier = {
					factor = 0.8
					liege = {
						any_vassal = {
							leads_faction = faction_glory
							NOT = { reverse_opinion = { who = ROOT value = -50 } }
						}
					}
				}
				modifier = {
					factor = 0.8
					liege = {
						any_vassal = {
							leads_faction = faction_glory
							NOT = { reverse_opinion = { who = ROOT value = -75 } }
						}
					}
				}
				set_character_flag = faction_glory_supporter
			}
			25 = {
				modifier = {
					factor = 0
					OR = {
						trait = cynical
						trait = excommunicated
						NOT = { liege = { religion = ROOT } }
					}
				}
				modifier = {
					factor = 3.0
					is_theocracy = yes
				}
				modifier = {
					factor = 1.5
					OR = {
						trait = detached_priest
						trait = martial_cleric
					}
				}
				modifier = {
					factor = 3.0
					OR = {
						trait = scholarly_theologian
						trait = mastermind_theologian
					}
				}
				modifier = {
					factor = 0.75
					NOR = {
						trait = detached_priest
						trait = martial_cleric
						trait = scholarly_theologian
						trait = mastermind_theologian
						trait = zealous
						is_theocracy = yes
					}
				}
				modifier = {
					factor = 3.0
					trait = zealous
				}
				modifier = {
					factor = 1.5
					OR = {
						trait = hafiz
						trait = faqih
						trait = theologian
					}
				}
				modifier = {
					factor = 1.5
					trait = content
				}
				modifier = {
					factor = 1.5
					trait = humble
				}
				modifier = {
					factor = 1.5
					trait = temperate
				}
				modifier = {
					factor = 1.5
					trait = proud
				}
				modifier = {
					factor = 0.25
					OR = {
						trait = hedonist
						trait = scholar
						trait = mystic
					}
				}
				modifier = {
					factor = 0.5
					OR = {
						is_patrician = yes
						is_republic = yes
						is_merchant_republic = yes
					}
				}
				modifier = {
					factor = 1.25
					liege = {
						any_vassal = {
							leads_faction = faction_tradition
							reverse_opinion = { who = ROOT value = 25 }
						}
					}
				}
				modifier = {
					factor = 1.25
					liege = {
						any_vassal = {
							leads_faction = faction_tradition
							reverse_opinion = { who = ROOT value = 50 }
						}
					}
				}
				modifier = {
					factor = 1.25
					liege = {
						any_vassal = {
							leads_faction = faction_tradition
							reverse_opinion = { who = ROOT value = 75 }
						}
					}
				}
				modifier = {
					factor = 0.8
					liege = {
						any_vassal = {
							leads_faction = faction_tradition
							NOT = { reverse_opinion = { who = ROOT value = -25 } }
						}
					}
				}
				modifier = {
					factor = 0.8
					liege = {
						any_vassal = {
							leads_faction = faction_tradition
							NOT = { reverse_opinion = { who = ROOT value = -50 } }
						}
					}
				}
				modifier = {
					factor = 0.8
					liege = {
						any_vassal = {
							leads_faction = faction_tradition
							NOT = { reverse_opinion = { who = ROOT value = -75 } }
						}
					}
				}
				set_character_flag = faction_tradition_supporter
			}
		}
	}
}

# The ruler leaves their faction
character_event = {
	id = PlusFaction.104
	
	hide_window = yes
	
	min_age = 16
	has_character_flag = has_picked_faction
	
	trigger = {
		OR = {
			had_character_flag = { flag = faction_court_supporter days = 30 }
			had_character_flag = { flag = faction_prosperity_supporter days = 30 }
			had_character_flag = { flag = faction_glory_supporter days = 30 }
			had_character_flag = { flag = faction_tradition_supporter days = 30 }
		}
		OR = {
			ai = no
			independent = yes
			is_playable = no
			trait = incapable
			liege = { current_heir = { character = ROOT } }
			is_landed = no
			pf_member_trigger = no
			AND = {
				has_character_flag = faction_tradition_supporter
				OR = {
					liege = { NOT = { religion = ROOT } }
					trait = cynical
					trait = excommunicated
				}
			}
		}
	}
	
	mean_time_to_happen = {
		days = 30
		modifier = {
			factor = 6
			is_landed = yes
			independent = no
			NOR = {
				trait = incapable
				liege = { current_heir = { character = ROOT } }
			}
			pf_member_trigger = no
		}
		modifier = {
			factor = 0.1
			has_character_flag = faction_tradition_supporter
			OR = {
				liege = { NOT = { religion = ROOT } }
				trait = cynical
				trait = excommunicated
			}
		}
	}
	
	immediate = {
		clr_character_flag = has_picked_faction
		pf_clear_supporter_flags_effect = yes
	}
}

### FACTION RECRUITMENT EVENTS

# Faction leader sets out to recruit a fellow vassal
character_event = {
	id = PlusFaction.110
	desc = EVTDESC_PlusFaction_110
	picture = GFX_evt_carriage
	
	is_triggered_only = yes
	
	option = {
		name = OK
		add_character_modifier = {
			name = do_not_disturb
			duration = 15
			hidden = yes
		}
	}
}

# Faction leader tries to recruit fellow vassal
character_event = {
	id = PlusFaction.111
	picture = GFX_evt_shadowy_cabal
	
	is_triggered_only = yes
	
	desc = {
		text = EVTDESC_PlusFaction_111A
		trigger = {
			FROMFROM = { leads_faction = faction_court }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_111B
		trigger = {
			FROMFROM = { leads_faction = faction_prosperity }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_111C
		trigger = {
			FROMFROM = { leads_faction = faction_glory }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_111D
		trigger = {
			FROMFROM = { leads_faction = faction_tradition }
		}
	}
	
	trigger = {
		pf_leader_trigger = no
		FROMFROM = { pf_leader_trigger = yes }
	}
	
	immediate = {
		if = {
			limit = { in_faction = faction_court }
			liege = {
				random_vassal = {
					limit = { leads_faction = faction_court }
					save_event_target_as = target_faction_leader
				}
			}
		}
		if = {
			limit = { in_faction = faction_prosperity }
			liege = {
				random_vassal = {
					limit = { leads_faction = faction_prosperity }
					save_event_target_as = target_faction_leader
				}
			}
		}
		if = {
			limit = { in_faction = faction_glory }
			liege = {
				random_vassal = {
					limit = { leads_faction = faction_glory }
					save_event_target_as = target_faction_leader
				}
			}
		}
		if = {
			limit = { in_faction = faction_tradition }
			liege = {
				random_vassal = {
					limit = { leads_faction = faction_tradition }
					save_event_target_as = target_faction_leader
				}
			}
		}
	}
	
	option = {
		name = EVTOPTA_PlusFaction_111 #Agree to join his faction
		trigger = {
			ai = yes
			pf_member_trigger = yes
			FROMFROM = {
				OR = {
					AND = {
						leads_faction = faction_court
						ROOT = { NOT = { in_faction = faction_court } }
					}
					AND = {
						leads_faction = faction_prosperity
						ROOT = { NOT = { in_faction = faction_prosperity } }
					}
					AND = {
						leads_faction = faction_glory
						ROOT = { NOT = { in_faction = faction_glory } }
					}
					AND = {
						leads_faction = faction_tradition
						ROOT = {
							religion = FROMFROM
							NOR = {
								in_faction = faction_tradition
								trait = excommunicated
								trait = cynical
							}
						}
					}
				}
			}
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.5
				FROMFROM = { leads_faction = faction_court }
				OR = {
					trait = charitable
					trait = humble
					trait = content
				}
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_court }
				OR = {
					trait = ambitious
					trait = proud
					trait = greedy
					trait = envious
					trait = gluttonous
				}
			}
			modifier = {
				factor = 0.5
				FROMFROM = { leads_faction = faction_prosperity }
				OR = {
					trait = charitable
					trait = slothful
					trait = trusting
					is_theocracy = yes
				}
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_prosperity }
				OR = {
					trait = greedy
					trait = diligent
					trait = gardener
					trait = administrator
					trait = architect
				}
			}
			modifier = {
				factor = 0.5
				FROMFROM = { leads_faction = faction_glory }
				OR = {
					trait = kind
					trait = patient
					trait = craven
				}
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_glory }
				OR = {
					trait = brave
					trait = wroth
					trait = cruel
					trait = hunter
					trait = duelist
					trait = impaler
					trait = strategist
				}
			}
			modifier = {
				factor = 0.5
				FROMFROM = { leads_faction = faction_tradition }
				OR = {
					trait = proud
					is_patrician = yes
					is_republic = yes
					is_merchant_republic = yes
				}
			}
			modifier = {
				factor = 1.5
				FROMFROM = { leads_faction = faction_tradition }
				trait = zealous
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_tradition }
				OR = {
					trait = content
					trait = humble
					trait = temperate
					trait = hafiz
					trait = faqih
					trait = theologian
				}
			}
			modifier = {
				factor = 1.5
				FROMFROM = { leads_faction = faction_prosperity }
				OR = {
					is_patrician = yes
					is_republic = yes
					is_merchant_republic = yes
					trait = greedy
				}
			}
			modifier = {
				factor = 1.5
				FROMFROM = { leads_faction = faction_tradition }
				OR = {
					is_theocracy = yes
					trait = zealous
				}
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_court }
				OR = {
					trait = amateurish_plotter
					trait = flamboyant_schemer
					trait = intricate_webweaver
					trait = elusive_shadow
				}
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_prosperity }
				OR = {
					trait = indulgent_wastrel
					trait = thrifty_clerk
					trait = fortune_builder
					trait = midas_touched
				}
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_glory }
				OR = {
					trait = misguided_warrior
					trait = tough_soldier
					trait = skilled_tactician
					trait = brilliant_strategist
				}
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_tradition }
				OR = {
					trait = detached_priest
					trait = martial_cleric
					trait = scholarly_theologian
					trait = mastermind_theologian
				}
			}
			modifier = {
				factor = 0.9
				FROMFROM = { NOT = { diplomacy = 3 } }
			}
			modifier = {
				factor = 0.9
				FROMFROM = { NOT = { diplomacy = 5 } }
			}
			modifier = {
				factor = 1.1
				FROMFROM = { diplomacy = 14 }
			}
			modifier = {
				factor = 1.1
				FROMFROM = { diplomacy = 16 }
			}
			modifier = {
				factor = 1.1
				FROMFROM = { diplomacy = 18 }
			}
			modifier = {
				factor = 1.1
				FROMFROM = { diplomacy = 20 }
			}
			modifier = {
				factor = 0
				NOT = { opinion = { who = FROMFROM value = 0 } }
			}
			modifier = {
				factor = 1.2
				opinion = { who = FROMFROM value = 25 }
			}
			modifier = {
				factor = 1.2
				opinion = { who = FROMFROM value = 50 }
			}
			modifier = {
				factor = 1.2
				opinion = { who = FROMFROM value = 75 }
			}
			modifier = {
				factor = 0.6
				opinion = { who = event_target:target_faction_leader value = 25 }
			}
			modifier = {
				factor = 0.6
				opinion = { who = event_target:target_faction_leader value = 50 }
			}
			modifier = {
				factor = 0.6
				opinion = { who = event_target:target_faction_leader value = 75 }
			}
			modifier = {
				factor = 1.2
				NOT = { opinion = { who = event_target:target_faction_leader value = -25 } }
			}
			modifier = {
				factor = 1.2
				NOT = { opinion = { who = event_target:target_faction_leader value = -50 } }
			}
			modifier = {
				factor = 1.2
				NOT = { opinion = { who = event_target:target_faction_leader value = -75 } }
			}
			modifier = {
				factor = 0.5
				likes_better_than = { who = event_target:target_faction_leader than = FROMFROM }
			}
		}
		pf_clear_supporter_flags_effect = yes
		if = {
			limit = { FROMFROM = { leads_faction = faction_court } }
			set_character_flag = faction_court_supporter
		}
		if = {
			limit = { FROMFROM = { leads_faction = faction_prosperity } }
			set_character_flag = faction_prosperity_supporter
		}
		if = {
			limit = { FROMFROM = { leads_faction = faction_glory } }
			set_character_flag = faction_glory_supporter
		}
		if = {
			limit = { FROMFROM = { leads_faction = faction_tradition } }
			set_character_flag = faction_tradition_supporter
		}
		opinion = { who = FROMFROM modifier = pleasant_meeting multiplier = 2 months = 60 }
		FROMFROM = { character_event = { id = PlusFaction.112 } }
		random = {
			chance = 50
			modifier = {
				factor = 0.75
				event_target:target_faction_leader = { NOT = { intrigue = 3 } }
			}
			modifier = {
				factor = 0.75
				event_target:target_faction_leader = { NOT = { intrigue = 6 } }
			}
			modifier = {
				factor = 1.25
				event_target:target_faction_leader = { intrigue = 10 }
			}
			modifier = {
				factor = 1.25
				event_target:target_faction_leader = { intrigue = 15 }
			}
			event_target:target_faction_leader = { character_event = { id = PlusFaction.113 } }
		}
	}
	option = {
		name = EVTOPTA_PlusFaction_111 #Agree to join his faction
		trigger = {
			ai = yes
			pf_member_trigger = no
			FROMFROM = {
				OR = {
					AND = {
						leads_faction = faction_court
						ROOT = { NOT = { in_faction = faction_court } }
					}
					AND = {
						leads_faction = faction_prosperity
						ROOT = { NOT = { in_faction = faction_prosperity } }
					}
					AND = {
						leads_faction = faction_glory
						ROOT = { NOT = { in_faction = faction_glory } }
					}
					AND = {
						leads_faction = faction_tradition
						ROOT = {
							religion = FROMFROM
							NOR = {
								in_faction = faction_tradition
								trait = excommunicated
								trait = cynical
							}
						}
					}
				}
			}
		}
		ai_chance = {
			factor = 30
			modifier = {
				factor = 0.5
				FROMFROM = { leads_faction = faction_court }
				OR = {
					trait = charitable
					trait = humble
					trait = content
				}
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_court }
				OR = {
					trait = ambitious
					trait = proud
					trait = greedy
					trait = envious
					trait = gluttonous
				}
			}
			modifier = {
				factor = 0.5
				FROMFROM = { leads_faction = faction_prosperity }
				OR = {
					trait = charitable
					trait = slothful
					trait = trusting
					capital_holding = { holding_type = temple }
				}
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_prosperity }
				OR = {
					trait = greedy
					trait = diligent
					trait = gardener
					trait = administrator
					trait = architect
				}
			}
			modifier = {
				factor = 0.5
				FROMFROM = { leads_faction = faction_glory }
				OR = {
					trait = kind
					trait = patient
					trait = craven
				}
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_glory }
				OR = {
					trait = brave
					trait = wroth
					trait = cruel
					trait = hunter
					trait = duelist
					trait = impaler
					trait = strategist
				}
			}
			modifier = {
				factor = 0.5
				FROMFROM = { leads_faction = faction_tradition }
				OR = {
					trait = proud
					is_patrician = yes
					is_republic = yes
					is_merchant_republic = yes
				}
			}
			modifier = {
				factor = 1.5
				FROMFROM = { leads_faction = faction_tradition }
				trait = zealous
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_tradition }
				OR = {
					trait = content
					trait = humble
					trait = temperate
					trait = hafiz
					trait = faqih
					trait = theologian
				}
			}
			modifier = {
				factor = 1.5
				FROMFROM = { leads_faction = faction_prosperity }
				OR = {
					is_patrician = yes
					is_republic = yes
					is_merchant_republic = yes
					trait = greedy
				}
			}
			modifier = {
				factor = 1.5
				FROMFROM = { leads_faction = faction_tradition }
				OR = {
					is_theocracy = yes
					trait = zealous
				}
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_court }
				OR = {
					trait = amateurish_plotter
					trait = flamboyant_schemer
					trait = intricate_webweaver
					trait = elusive_shadow
				}
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_prosperity }
				OR = {
					trait = indulgent_wastrel
					trait = thrifty_clerk
					trait = fortune_builder
					trait = midas_touched
				}
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_glory }
				OR = {
					trait = misguided_warrior
					trait = tough_soldier
					trait = skilled_tactician
					trait = brilliant_strategist
				}
			}
			modifier = {
				factor = 1.2
				FROMFROM = { leads_faction = faction_tradition }
				OR = {
					trait = detached_priest
					trait = martial_cleric
					trait = scholarly_theologian
					trait = mastermind_theologian
				}
			}
			modifier = {
				factor = 0.9
				FROMFROM = { NOT = { diplomacy = 3 } }
			}
			modifier = {
				factor = 0.9
				FROMFROM = { NOT = { diplomacy = 5 } }
			}
			modifier = {
				factor = 1.1
				FROMFROM = { diplomacy = 14 }
			}
			modifier = {
				factor = 1.1
				FROMFROM = { diplomacy = 16 }
			}
			modifier = {
				factor = 1.1
				FROMFROM = { diplomacy = 18 }
			}
			modifier = {
				factor = 1.1
				FROMFROM = { diplomacy = 20 }
			}
			modifier = {
				factor = 0
				NOT = { opinion = { who = FROMFROM value = 0 } }
			}
			modifier = {
				factor = 1.2
				opinion = { who = FROMFROM value = 25 }
			}
			modifier = {
				factor = 1.2
				opinion = { who = FROMFROM value = 50 }
			}
			modifier = {
				factor = 1.2
				opinion = { who = FROMFROM value = 75 }
			}
		}
		pf_clear_supporter_flags_effect = yes
		if = {
			limit = { FROMFROM = { leads_faction = faction_court } }
			set_character_flag = faction_court_supporter
		}
		if = {
			limit = { FROMFROM = { leads_faction = faction_prosperity } }
			set_character_flag = faction_prosperity_supporter
		}
		if = {
			limit = { FROMFROM = { leads_faction = faction_glory } }
			set_character_flag = faction_glory_supporter
		}
		if = {
			limit = { FROMFROM = { leads_faction = faction_tradition } }
			set_character_flag = faction_tradition_supporter
		}
		opinion = { who = FROMFROM modifier = pleasant_meeting multiplier = 2 months = 60 }
		FROMFROM = { character_event = { id = PlusFaction.112 } }
	}
	option = {
		name = EVTOPTB_PlusFaction_111 #Have a pleasant chat, but promise nothing
		ai_chance = {
			factor = 100
			modifier = {
				factor = 0.75
				FROMFROM = { leads_faction = faction_court }
				OR = {
					trait = charitable
					trait = humble
					trait = content
				}
			}
			modifier = {
				factor = 1.5
				FROMFROM = { leads_faction = faction_court }
				OR = {
					trait = ambitious
					trait = proud
					trait = greedy
					trait = envious
					trait = gluttonous
				}
			}
			modifier = {
				factor = 0.75
				FROMFROM = { leads_faction = faction_prosperity }
				OR = {
					trait = charitable
					trait = slothful
					trait = trusting
					capital_holding = { holding_type = temple }
				}
			}
			modifier = {
				factor = 1.5
				FROMFROM = { leads_faction = faction_prosperity }
				OR = {
					trait = greedy
					trait = diligent
					trait = gardener
					trait = administrator
					trait = architect
				}
			}
			modifier = {
				factor = 0.75
				FROMFROM = { leads_faction = faction_glory }
				OR = {
					trait = kind
					trait = patient
					trait = craven
				}
			}
			modifier = {
				factor = 1.5
				FROMFROM = { leads_faction = faction_glory }
				OR = {
					trait = brave
					trait = wroth
					trait = cruel
					trait = hunter
					trait = duelist
					trait = impaler
					trait = strategist
				}
			}
			modifier = {
				factor = 0.75
				FROMFROM = { leads_faction = faction_tradition }
				OR = {
					trait = proud
					is_patrician = yes
					is_republic = yes
					is_merchant_republic = yes
				}
			}
			modifier = {
				factor = 1.5
				FROMFROM = { leads_faction = faction_tradition }
				OR = {
					trait = zealous
					trait = content
					trait = humble
					trait = temperate
					trait = hafiz
					trait = faqih
					trait = theologian
				}
			}
			modifier = {
				factor = 1.5
				FROMFROM = { leads_faction = faction_prosperity }
				OR = {
					is_patrician = yes
					is_republic = yes
					is_merchant_republic = yes
					trait = greedy
				}
			}
			modifier = {
				factor = 1.5
				FROMFROM = { leads_faction = faction_tradition }
				OR = {
					is_theocracy = yes
					trait = zealous
				}
			}
			modifier = {
				factor = 0.9
				FROMFROM = { NOT = { diplomacy = 3 } }
			}
			modifier = {
				factor = 0.9
				FROMFROM = { NOT = { diplomacy = 5 } }
			}
			modifier = {
				factor = 1.1
				FROMFROM = { diplomacy = 14 }
			}
			modifier = {
				factor = 1.1
				FROMFROM = { diplomacy = 16 }
			}
			modifier = {
				factor = 1.1
				FROMFROM = { diplomacy = 18 }
			}
			modifier = {
				factor = 1.1
				FROMFROM = { diplomacy = 20 }
			}
		}
		opinion = { who = FROMFROM modifier = pleasant_meeting months = 60 }
		hidden_tooltip = {
			FROMFROM = { character_event = { id = PlusFaction.114 } }
		}
	}
	option = {
		name = {
			text = EVTOPTC_PlusFaction_111 #Send him away, but tell no-one
			trigger = { pf_member_trigger = yes }
		}
		name = {
			text = EVTOPTD_PlusFaction_111 #Send him on his way
			trigger = { pf_member_trigger = no }
		}
		ai_chance = {
			factor = 100
			modifier = {
				factor = 1.1
				FROMFROM = { NOT = { diplomacy = 3 } }
			}
			modifier = {
				factor = 1.1
				FROMFROM = { NOT = { diplomacy = 5 } }
			}
			modifier = {
				factor = 0.9
				FROMFROM = { diplomacy = 14 }
			}
			modifier = {
				factor = 0.9
				FROMFROM = { diplomacy = 16 }
			}
			modifier = {
				factor = 0.9
				FROMFROM = { diplomacy = 18 }
			}
			modifier = {
				factor = 0.9
				FROMFROM = { diplomacy = 20 }
			}
			modifier = {
				factor = 2
				NOT = { opinion = { who = FROMFROM value = -25 } }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = FROMFROM value = 0 } }
			}
			modifier = {
				factor = 0.8
				opinion = { who = FROMFROM value = 25 }
			}
			modifier = {
				factor = 0.8
				opinion = { who = FROMFROM value = 50 }
			}
			modifier = {
				factor = 0.8
				opinion = { who = FROMFROM value = 75 }
			}
			modifier = {
				factor = 0.5
				pf_member_trigger = no
			}
		}
		opinion = { who = FROMFROM modifier = unpleasant_meeting months = 60 }
		hidden_tooltip = {
			FROMFROM = { character_event = { id = PlusFaction.115 } }
		}
	}
	option = {
		name = EVTOPTE_PlusFaction_111 #Send him away and tell faction leader
		trigger = { pf_member_trigger = yes }
		ai_chance = {
			factor = 50
			modifier = {
				factor = 1.1
				FROMFROM = { NOT = { diplomacy = 3 } }
			}
			modifier = {
				factor = 1.1
				FROMFROM = { NOT = { diplomacy = 5 } }
			}
			modifier = {
				factor = 0.9
				FROMFROM = { diplomacy = 14 }
			}
			modifier = {
				factor = 0.9
				FROMFROM = { diplomacy = 16 }
			}
			modifier = {
				factor = 0.9
				FROMFROM = { diplomacy = 18 }
			}
			modifier = {
				factor = 0.9
				FROMFROM = { diplomacy = 20 }
			}
			modifier = {
				factor = 2
				NOT = { opinion = { who = FROMFROM value = -25 } }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = FROMFROM value = 0 } }
			}
			modifier = {
				factor = 0.6
				opinion = { who = FROMFROM value = 25 }
			}
			modifier = {
				factor = 0.6
				opinion = { who = FROMFROM value = 50 }
			}
			modifier = {
				factor = 0.6
				opinion = { who = FROMFROM value = 75 }
			}
			modifier = {
				factor = 1.5
				opinion = { who = event_target:target_faction_leader value = 25 }
			}
			modifier = {
				factor = 1.5
				opinion = { who = event_target:target_faction_leader value = 50 }
			}
			modifier = {
				factor = 1.5
				opinion = { who = event_target:target_faction_leader value = 75 }
			}
			modifier = {
				factor = 0.5
				NOT = { opinion = { who = event_target:target_faction_leader value = -25 } }
			}
			modifier = {
				factor = 0
				NOT = { opinion = { who = event_target:target_faction_leader value = -50 } }
			}
		}
		opinion = { who = FROMFROM modifier = unpleasant_meeting multiplier = 2 months = 60 }
		event_target:target_faction_leader = { letter_event = { id = PlusFaction.117 tooltip = INFORM_FACTION_LEADER } }
		hidden_tooltip = {
			FROMFROM = { character_event = { id = PlusFaction.116 } }
		}
	}
}

# Ruler agreed to join the faction
character_event = {
	id = PlusFaction.112
	desc = EVTDESC_PlusFaction_112
	picture = GFX_evt_shadowy_cabal
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
		opinion = { who = FROM modifier = pleasant_meeting multiplier = 2 months = 60 }
	}
}

# Ruler's faction leader learned about the poaching
character_event = {
	id = PlusFaction.113
	desc = EVTDESC_PlusFaction_113
	picture = GFX_evt_shadowy_cabal
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_PlusFaction_113
		opinion = { who = FROM modifier = opinion_disappointed months = 60 }
		opinion = { who = FROMFROMFROM modifier = poached_faction_member months = 60 }
	}
}

# Ruler refused to join the faction, but the meeting went well
character_event = {
	id = PlusFaction.114
	desc = EVTDESC_PlusFaction_114
	picture = GFX_evt_shadowy_cabal
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_PlusFaction_114
		opinion = { who = FROM modifier = pleasant_meeting months = 60 }
	}
}

# Faction leader was sent away
character_event = {
	id = PlusFaction.115
	desc = EVTDESC_PlusFaction_115
	picture = GFX_evt_shadowy_cabal
	
	is_triggered_only = yes
	
	option = {
		name = CURSES
		opinion = { who = FROM modifier = opinion_rebuffed_recruitment months = 60 }
	}
}

# Faction leader was sent away and own faction told
character_event = {
	id = PlusFaction.116
	desc = EVTDESC_PlusFaction_116
	picture = GFX_evt_shadowy_cabal
	
	is_triggered_only = yes
	
	option = {
		name = CURSES
		opinion = { who = FROM modifier = opinion_rebuffed_recruitment months = 120 }
	}
}

# Ruler's own faction leader informed about the poaching attempt
letter_event = {
	id = PlusFaction.117
	desc = EVTDESC_PlusFaction_117
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_PlusFaction_113
		opinion = { who = FROM modifier = opinion_pleased months = 60 }
		opinion = { who = FROMFROMFROM modifier = attempted_poach_faction months = 120 }
	}
}

### FACTION DISPUTE EVENTS

# Faction member has a dispute with faction leader
character_event = {
	id = PlusFaction.120
	desc = EVTDESC_PlusFaction_120
	picture = GFX_evt_rival_rulers
	
	only_playable = yes
	min_age = 16
	capable_only = yes
	prisoner = no
	war = no
	is_sick = no
	is_triggered_only = yes
	
	trigger = {
		#is_ill = no
		pf_leader_trigger = yes
		liege = {
			any_vassal = {
				ai = yes
				war = no
				is_adult = yes
				prisoner = no
				is_ill = no
				NOR = {
					character = ROOT
					trait = incapable
					is_inaccessible_trigger = yes
					opinion = { who = ROOT value = 0 }
				}
				is_not_busy_trigger = yes
				pf_root_faction_backer_trigger = yes
			}
		}
		NOT = {
			is_inaccessible_trigger = yes
		}
		is_not_busy_trigger = yes
		OR = {
			NOT = { has_character_flag = had_faction_dispute }
			had_character_flag = { flag = had_faction_dispute days = 1825 }
		}
	}
	
	weight_multiplier = {
		days = 1
		modifier = {
			factor = 1.5
			liege = {
				any_vassal = {
					ai = yes
					war = no
					is_adult = yes
					prisoner = no
					is_ill = no
					NOR = {
						character = ROOT
						trait = incapable
						is_inaccessible_trigger = yes
						opinion = { who = ROOT value = -50 }
					}
					pf_root_faction_backer_trigger = yes
					is_not_busy_trigger = yes
				}
			}
		}
	}

	immediate = {
		set_character_flag = had_faction_dispute
		liege = {
			random_vassal = {
				limit = {
					ai = yes
					war = no
					is_adult = yes
					prisoner = no
					is_ill = no
					NOR = {
						character = ROOT
						trait = incapable
						is_inaccessible_trigger = yes
						opinion = { who = ROOT value = -50 }
					}
					is_not_busy_trigger = yes
					pf_root_faction_backer_trigger = yes
				}
				save_event_target_as = target_faction_dispute
				break = yes
			}
			random_vassal = {
				limit = {
					ai = yes
					war = no
					is_adult = yes
					prisoner = no
					is_ill = no
					NOR = {
						character = ROOT
						trait = incapable
						is_inaccessible_trigger = yes
						opinion = { who = ROOT value = 0 }
					}
					is_not_busy_trigger = yes
					pf_root_faction_backer_trigger = yes
				}
				save_event_target_as = target_faction_dispute
				break = yes
			}
		}
	}
	
	option = {
		name = EVTOPTA_PlusFaction_120 # So be it
		reverse_opinion = { who = event_target:target_faction_dispute modifier = opinion_dispute months = 60 }
		hidden_tooltip = {
			opinion = { who = event_target:target_faction_dispute modifier = opinion_dispute months = 60 }
			event_target:target_faction_dispute = {
				if = {
					limit = { is_rival = ROOT }
					pf_clear_supporter_flags_effect = yes
				}
				if = {
					limit = {
						NOT = { opinion = { who = ROOT value = -50 } }
						NOT = { is_rival = ROOT }
					}
					random_list = {
						50 = { add_rival = ROOT }
						50 = { pf_clear_supporter_flags_effect = yes }
					}
				}
			}
		}
	}
	option = {
		name = EVTOPTB_PlusFaction_120 # Try to sweet talk him
		trigger = { diplomacy = 12 }
		tooltip_info = diplomacy
		random_list = {
			50 = {
				modifier = {
					factor = 1.2
					diplomacy = 14
				}
				modifier = {
					factor = 1.2
					diplomacy = 16
				}
				modifier = {
					factor = 1.2
					diplomacy = 18
				}
				modifier = {
					factor = 1.2
					diplomacy = 20
				}
				custom_tooltip = { text = SMOOTH_THINGS_OVER }
				hidden_tooltip = {
					clr_character_flag = had_faction_dispute
					break = yes
				}
			}
			50 = {
				reverse_opinion = { who = event_target:target_faction_dispute modifier = opinion_dispute months = 60 }
			}
			10 = {
				custom_tooltip = { text = MAKE_THINGS_WORSE }
				reverse_opinion = { who = event_target:target_faction_dispute modifier = opinion_dispute multiplier = 2 months = 60 }
			}
		}
		hidden_tooltip = {
			event_target:target_faction_dispute = {
				if = {
					limit = { is_rival = ROOT }
					pf_clear_supporter_flags_effect = yes
				}
				if = {
					limit = {
						NOT = { opinion = { who = ROOT value = -50 } }
						NOT = { is_rival = ROOT }
					}
					random_list = {
						50 = { add_rival = ROOT }
						50 = { pf_clear_supporter_flags_effect = yes }
					}
				}
			}
		}
	}
	option = {
		name = EVTOPTC_PlusFaction_120 # Put him in his place
		trigger = {
			intrigue = 12
			higher_tier_than = event_target:target_faction_dispute
		}
		tooltip_info = intrigue
		random_list = {
			50 = {
				modifier = {
					factor = 1.2
					intrigue = 14
				}
				modifier = {
					factor = 1.2
					intrigue = 16
				}
				modifier = {
					factor = 1.2
					intrigue = 18
				}
				modifier = {
					factor = 1.2
					intrigue = 20
				}
				custom_tooltip = { text = SMOOTH_THINGS_OVER }
				hidden_tooltip = {
					clr_character_flag = had_faction_dispute
					break = yes
				}
			}
			50 = {
				reverse_opinion = { who = event_target:target_faction_dispute modifier = opinion_dispute months = 60 }
			}
			10 = {
				custom_tooltip = { text = MAKE_THINGS_WORSE }
				reverse_opinion = { who = event_target:target_faction_dispute modifier = opinion_dispute multiplier = 2 months = 60 }
			}
		}
		hidden_tooltip = {
			event_target:target_faction_dispute = {
				if = {
					limit = { is_rival = ROOT }
					pf_clear_supporter_flags_effect = yes
				}
				if = {
					limit = {
						NOT = { opinion = { who = ROOT value = -50 } }
						NOT = { is_rival = ROOT }
					}
					random_list = {
						50 = { add_rival = ROOT }
						50 = { pf_clear_supporter_flags_effect = yes }
					}
				}
			}
		}
	}
}

### FACTION COURTING EVENTS

# Faction member begins to court another faction member
character_event = {
	id = PlusFaction.125
	picture = GFX_evt_shadowy_cabal
	
	desc = {
		text = EVTDESC_PlusFaction_125A
		trigger = { in_faction = faction_court }
	}
	desc = {
		text = EVTDESC_PlusFaction_125B
		trigger = { in_faction = faction_prosperity }
	}
	desc = {
		text = EVTDESC_PlusFaction_125C
		trigger = { in_faction = faction_glory }
	}
	desc = {
		text = EVTDESC_PlusFaction_125D
		trigger = { in_faction = faction_tradition }
	}
	
	show_from_from = yes
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_PlusFaction_125
		random_list = {
			40 = {
				modifier = {
					factor = 1.2
					diplomacy = 12
				}
				modifier = {
					factor = 1.2
					diplomacy = 14
				}
				modifier = {
					factor = 1.2
					diplomacy = 16
				}
				modifier = {
					factor = 1.2
					diplomacy = 18
				}
				modifier = {
					factor = 1.2
					diplomacy = 20
				}
				modifier = {
					factor = 1.5
					OR = {
						dynasty = FROM
						is_close_relative = FROM
						is_lover = FROM
						is_married = FROM
					}
				}
				modifier = {
					factor = 1.2
					OR = {
						trait = trusting
						FROM = { trait = trusting }
					}
				}
				modifier = {
					factor = 0.8
					trait = greedy
					FROM = { trait = charitable }
				}
				modifier = {
					factor = 0.8
					trait = charitable
					FROM = { trait = greedy }
				}
				modifier = {
					factor = 0.8
					trait = kind
					FROM = { trait = cruel }
				}
				modifier = {
					factor = 0.8
					trait = cruel
					FROM = { trait = kind }
				}
				modifier = {
					factor = 0.8
					trait = deceitful
					FROM = { trait = honest }
				}
				modifier = {
					factor = 0.8
					trait = honest
					FROM = { trait = deceitful }
				}
				modifier = {
					factor = 0.8
					trait = zealous
					FROM = { trait = cynical }
				}
				modifier = {
					factor = 0.8
					trait = cynical
					FROM = { trait = zealous }
				}
				modifier = {
					factor = 0.8
					trait = just
					FROM = { trait = arbitrary }
				}
				modifier = {
					factor = 0.8
					trait = arbitrary
					FROM = { trait = just }
				}
				modifier = {
					factor = 0.8
					OR = {
						trait = paranoid
						FROM = { trait = paranoid }
					}
				}
				modifier = {
					factor = 0.8
					OR = {
						trait = shy
						FROM = { trait = shy }
					}
				}
				custom_tooltip = { text = COURT_GOOD_MEETING }
				hidden_tooltip = { character_event = { id = PlusFaction.126 days = 15 } }
			}
			40 = {
				custom_tooltip = { text = COURT_NOTHING_HAPPENS }
				hidden_tooltip = { character_event = { id = PlusFaction.127 days = 15 } }
			}
			20 = {
				modifier = {
					factor = 2
					FROM = {
						any_claim = { holder_scope = { character = ROOT } }
					}
				}
				modifier = {
					factor = 2
					OR = {
						trait = lunatic
						trait = possessed
						FROM = { trait = lunatic }
						FROM = { trait = possessed }
					}
				}
				modifier = {
					factor = 1.5
					NOT = { culture = FROM }
				}
				modifier = {
					factor = 2
					NOT = { culture_group = FROM }
				}
				modifier = {
					factor = 1.5
					NOT = { religion = FROM }
				}
				modifier = {
					factor = 2
					NOT = { religion_group = FROM }
				}
				modifier = {
					factor = 1.5
					NOT = { reverse_opinion = { who = FROM value = 0 } }
				}
				modifier = {
					factor = 1.2
					NOT = { diplomacy = 8 }
				}
				modifier = {
					factor = 1.2
					NOT = { diplomacy = 6 }
				}
				modifier = {
					factor = 1.2
					NOT = { diplomacy = 4 }
				}
				modifier = {
					factor = 1.2
					NOT = { diplomacy = 2 }
				}
				modifier= {
					factor = 0.8
					opinion = { who = FROM value = 0 }
					reverse_opinion = { who = FROM value = 0 }
				}
				modifier= {
					factor = 0.8
					opinion = { who = FROM value = 25 }
					reverse_opinion = { who = FROM value = 25 }
				}
				custom_tooltip = { text = COURT_POOR_MEETING }
				hidden_tooltip = { character_event = { id = PlusFaction.128 days = 15 } }
			}
		}
	}
}

# The meeting with the faction member goes well
character_event = {
	id = PlusFaction.126
	desc = EVTDESC_PlusFaction_126
	picture = GFX_evt_shadowy_cabal
	
	show_from_from = yes
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
		prestige = 25
		random_list = {
			75 = {
				reverse_opinion = { who = FROMFROM modifier = pleasant_meeting months = 60 }
			}
			25 = {
				modifier = {
					factor = 1.2
					diplomacy = 12
				}
				modifier = {
					factor = 1.2
					diplomacy = 14
				}
				modifier = {
					factor = 1.2
					diplomacy = 16
				}
				modifier = {
					factor = 1.2
					diplomacy = 18
				}
				modifier = {
					factor = 1.2
					diplomacy = 20
				}
				modifier = {
					factor = 0.8
					NOT = { diplomacy = 8 }
				}
				modifier = {
					factor = 0.8
					NOT = { diplomacy = 6 }
				}
				modifier = {
					factor = 0.8
					NOT = { diplomacy = 4 }
				}
				modifier = {
					factor = 0.8
					NOT = { diplomacy = 2 }
				}
				reverse_opinion = { who = FROMFROM modifier = pleasant_meeting multiplier = 2 months = 60 }
			}
		}
	}
}

# The meeting with the faction member produces no results
character_event = {
	id = PlusFaction.127
	desc = EVTDESC_PlusFaction_127
	picture = GFX_evt_shadowy_cabal
	
	show_from_from = yes
	is_triggered_only = yes
	
	option = {
		name = OK
	}
}

# The meeting with the faction member goes poorly
character_event = {
	id = PlusFaction.128
	desc = EVTDESC_PlusFaction_128
	picture = GFX_evt_shadowy_cabal
	
	show_from_from = yes
	is_triggered_only = yes
	
	option = {
		name = CURSES
		prestige = -25
		random_list = {
			75 = {
				reverse_opinion = { who = FROMFROM modifier = unpleasant_meeting months = 60 }
			}
			25 = {
				modifier = {
					factor = 0.8
					diplomacy = 12
				}
				modifier = {
					factor = 0.8
					diplomacy = 14
				}
				modifier = {
					factor = 0.8
					diplomacy = 16
				}
				modifier = {
					factor = 0.8
					diplomacy = 18
				}
				modifier = {
					factor = 0.8
					diplomacy = 20
				}
				modifier = {
					factor = 1.2
					NOT = { diplomacy = 8 }
				}
				modifier = {
					factor = 1.2
					NOT = { diplomacy = 6 }
				}
				modifier = {
					factor = 1.2
					NOT = { diplomacy = 4 }
				}
				modifier = {
					factor = 1.2
					NOT = { diplomacy = 2 }
				}
				reverse_opinion = { who = FROMFROM modifier = unpleasant_meeting multiplier = 2 months = 60 }
			}
		}
	}
}

### SEEKING SUPPORT FOR A PRETENDER

# Ruler approaches fellow vassal to seek support for a claimant
character_event = {
	id = PlusFaction.130
	picture = GFX_evt_shadowy_cabal
	
	show_from_from = yes
	is_triggered_only = yes
	
	desc = {
		text = EVTDESC_PlusFaction_130A
		trigger = {
			supported_claimant = { character = ROOT }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_130B
		trigger = {
			supported_claimant = { NOT = { character = ROOT } }
		}
	}
	
	immediate = {
		supported_claimant = { save_event_target_as = target_claimant }
		supported_claimant_title = {
			save_event_target_as = target_claimed_title
			holder_scope = { save_event_target_as = target_title_holder }
		}
	}
	
	option = {
		name = EVTOPTA_PlusFaction_130
		random_list = {
			60 = {
				modifier = {
					factor = 0.5
					FROM = {
						NOR = {
							dynasty = event_target:target_claimant
							is_close_relative = event_target:target_claimant
							any_spouse = { dynasty = event_target:target_claimant }
						}
					}
				}
				modifier = {
					factor = 1.5
					FROM = {
						is_close_relative = event_target:target_claimant
						NOT = { is_close_relative = event_target:target_title_holder }
					}
				}
				modifier = {
					factor = 1.25
					FROM = {
						NOT = { is_close_relative = event_target:target_claimant }
						dynasty = event_target:target_claimant
						NOT = { dynasty = event_target:target_title_holder }
					}
				}
				modifier = {
					factor = 0.75
					FROM = {
						NOT = { dynasty = event_target:target_claimant }
						dynasty = event_target:target_title_holder
					}
				}
				modifier = {
					factor = 0.75
					FROM = {
						NOT = { culture = event_target:target_claimant }
					}
				}
				modifier = {
					factor = 1.5
					FROM = {
						culture = event_target:target_claimant
						NOT = { culture = event_target:target_title_holder }
					}
				}
				modifier = {
					factor = 2
					FROM = {
						NOT = { religion = event_target:target_title_holder }
					}
				}
				modifier = {
					factor = 0.8
					NOT = { diplomacy = 8 }
				}
				modifier = {
					factor = 0.8
					NOT = { diplomacy = 6 }
				}
				modifier = {
					factor = 0.8
					NOT = { diplomacy = 4 }
				}
				modifier = {
					factor = 1.2
					diplomacy = 12
				}
				modifier = {
					factor = 1.2
					diplomacy = 14
				}
				modifier = {
					factor = 1.2
					diplomacy = 16
				}
				modifier = {
					factor = 1.2
					diplomacy = 18
				}
				modifier = {
					factor = 1.2
					diplomacy = 20
				}
				modifier = {
					factor = 0.8
					FROM = { NOT = { opinion = { who = ROOT value = 0 } } }
				}
				modifier = {
					factor = 0.5
					FROM = { NOT = { opinion = { who = ROOT value = -25 } } }
				}
				modifier = {
					factor = 0.5
					FROM = { NOT = { opinion = { who = ROOT value = -50 } } }
				}
				modifier = {
					factor = 0.5
					FROM = { NOT = { opinion = { who = ROOT value = -75 } } }
				}
				modifier = {
					factor = 1.2
					FROM = { opinion = { who = ROOT value = 25 } }
				}
				modifier = {
					factor = 1.2
					FROM = { opinion = { who = ROOT value = 50 } }
				}
				modifier = {
					factor = 1.2
					FROM = { opinion = { who = ROOT value = 75 } }
				}
				modifier = {
					factor = 1.2
					FROM = { NOT = { opinion = { who = event_target:target_title_holder value = -25 } } }
				}
				modifier = {
					factor = 1.2
					FROM = { NOT = { opinion = { who = event_target:target_title_holder value = -50 } } }
				}
				modifier = {
					factor = 1.2
					FROM = { NOT = { opinion = { who = event_target:target_title_holder value = -75 } } }
				}
				modifier = {
					factor = 0.8
					FROM = { opinion = { who = event_target:target_title_holder value = 0 } }
				}
				modifier = {
					factor = 0.8
					FROM = { opinion = { who = event_target:target_title_holder value = 25 } }
				}
				modifier = {
					factor = 0.5
					FROM = { opinion = { who = event_target:target_title_holder value = 50 } }
				}
				modifier = {
					factor = 0.5
					FROM = { opinion = { who = event_target:target_title_holder value = 75 } }
				}
				custom_tooltip = { text = RULER_SUPPORTS_CLAIMANT }
				hidden_tooltip = { character_event = { id = PlusFaction.131 days = 15 } }
			}
			30 = {
				custom_tooltip = { text = COURT_NOTHING_HAPPENS }
				hidden_tooltip = { character_event = { id = PlusFaction.132 days = 15 } }
			}
			10 = {
				custom_tooltip = { text = COURT_POOR_MEETING }
				hidden_tooltip = { character_event = { id = PlusFaction.133 days = 15 } }
			}
		}
	}
}

# Fellow vassal is convinced to support the claimant
character_event = {
	id = PlusFaction.131
	picture = GFX_evt_shadowy_cabal
	
	desc = {
		text = EVTDESC_PlusFaction_131A
		trigger = {
			supported_claimant = { character = ROOT }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_131B
		trigger = {
			supported_claimant = { NOT = { character = ROOT } }
		}
	}
	
	show_from_from = yes
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
		prestige = 25
		FROMFROM = {
			opinion = { who = event_target:target_claimant modifier = opinion_support_claimant months = 60 }
			if = {
				limit = {
					event_target:target_claimant = { NOT = { character = ROOT } }
				}
				opinion = { who = ROOT modifier = pleasant_meeting months = 60 }
			}
		}
	}
}

# The meeting with the fellow vassal goes nowhere
character_event = {
	id = PlusFaction.132
	desc = EVTDESC_PlusFaction_132
	picture = GFX_evt_shadowy_cabal
	
	show_from_from = yes
	is_triggered_only = yes
	
	option = {
		name = CURSES
		prestige = -25
	}
}

# The meeting with the fellow vassal goes poorly
character_event = {
	id = PlusFaction.133
	desc = EVTDESC_PlusFaction_133
	picture = GFX_evt_shadowy_cabal
	
	show_from_from = yes
	is_triggered_only = yes
	
	option = {
		name = CURSES
		prestige = -50
		random_list = {
			60 = {
				reverse_opinion = { who = FROMFROM modifier = unpleasant_meeting months = 60 }
			}
			40 = {
				reverse_opinion = { who = FROMFROM modifier = unpleasant_meeting multiplier = 2 months = 60 }
			}
		}
	}
}

### UNDERMINING A FACTION MEMBER

# Spymaster reports a chance to undermine a faction member
letter_event = {
	id = PlusFaction.135
	border = GFX_event_letter_frame_intrigue

	desc = {
		text = EVTDESC_PlusFaction_135_COURT
		trigger = {
			event_target:faction_member = { in_faction = faction_court }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_135_PROSPERITY
		trigger = {
			event_target:faction_member = { in_faction = faction_prosperity }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_135_GLORY
		trigger = {
			event_target:faction_member = { in_faction = faction_glory }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_135_TRADITION
		trigger = {
			event_target:faction_member = { in_faction = faction_tradition }
		}
	}	

	is_triggered_only = yes
	
	min_age = 16
	only_capable = yes
	prisoner = no
	
	option = {
		name = EVTOPTA_PlusFaction_135 # Do it secretly
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0
				opinion = { who = event_target:faction_member value = 50 }
			}
			modifier = {
				factor = 1.5
				event_target:faction_member = { trait = brave }
			}
			modifier = {
				factor = 1.5
				event_target:faction_member = { trait = wroth }
			}
			modifier = {
				factor = 1.5
				event_target:faction_member = { trait = proud }
			}
			modifier = {
				factor = 1.5
				trait = deceitful
			}
		}
		random_list = {
			50 = { # Attempt succeeds
				modifier = {
					factor = 0.8
					job_spymaster = {
						event_target:faction_member = {
							attribute_diff = {
								character = PREV
								attribute = intrigue
								value = 2
							}
						}
					}
				}
				modifier = {
					factor = 0.8
					job_spymaster = {
						event_target:faction_member = {
							attribute_diff = {
								character = PREV
								attribute = intrigue
								value = 4
							}
						}
					}
				}
				modifier = {
					factor = 0.8
					job_spymaster = {
						event_target:faction_member = {
							attribute_diff = {
								character = PREV
								attribute = intrigue
								value = 6
							}
						}
					}
				}
				modifier = {
					factor = 0.8
					job_spymaster = {
						event_target:faction_member = {
							attribute_diff = {
								character = PREV
								attribute = intrigue
								value = 8
							}
						}
					}
				}
				modifier = {
					factor = 1.2
					job_spymaster = {
						attribute_diff = {
							character = event_target:faction_member
							attribute = intrigue
							value = 2
						}
					}
				}
				modifier = {
					factor = 1.2
					job_spymaster = {
						attribute_diff = {
							character = event_target:faction_member
							attribute = intrigue
							value = 4
						}
					}
				}
				modifier = {
					factor = 1.2
					job_spymaster = {
						attribute_diff = {
							character = event_target:faction_member
							attribute = intrigue
							value = 6
						}
					}
				}
				modifier = {
					factor = 1.2
					job_spymaster = {
						attribute_diff = {
							character = event_target:faction_member
							attribute = intrigue
							value = 8
						}
					}
				}
				custom_tooltip = { text = FACTION_UNDERMINE_SUCCEEDS }
				hidden_tooltip = {
					character_event = { id = PlusFaction.141 }
				}
			}
			50 = { # Attempt fails
				modifier = {
					factor = 0.5
					event_target:faction_member = { NOT = { leads_faction = yes } }
				}
				custom_tooltip = { text = FACTION_UNDERMINE_FAILS }
				hidden_tooltip = {
					character_event = { id = PlusFaction.139 }
				}
			}
			25 = { # Attempt fails and is revealed
				modifier = {
					factor = 0
					event_target:faction_member = {
						NOT = { any_courtier = { has_job_title = job_spymaster } }
					}
				}
				modifier = {
					factor = 1.25
					event_target:faction_member = {
						job_spymaster = { intrigue = 14 }
					}
				}
				modifier = {
					factor = 1.25
					event_target:faction_member = {
						job_spymaster = { intrigue = 17 }
					}
				}
				modifier = {
					factor = 1.5
					event_target:faction_member = {
						job_spymaster = { intrigue = 20 }
					}
				}
				modifier = {
					factor = 0.75
					event_target:faction_member = {
						job_spymaster = { NOT = { intrigue = 10 } }
					}
				}
				modifier = {
					factor = 0.75
					event_target:faction_member = {
						job_spymaster = { NOT = { intrigue = 7 } }
					}
				}
				modifier = {
					factor = 0.5
					event_target:faction_member = {
						job_spymaster = { NOT = { intrigue = 4 } }
					}
				}
				custom_tooltip = { text = FACTION_UNDERMINE_DISCOVERED }
				hidden_tooltip = {
					character_event = { id = PlusFaction.140 }
				}
			}
		}
	}
	option = {
		name = EVTOPTB_PlusFaction_135 # Threaten him
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0
				opinion = { who = event_target:faction_member value = 50 }
			}
			modifier = {
				factor = 1.5
				event_target:faction_member = { trait = craven }
			}
			modifier = {
				factor = 1.5
				event_target:faction_member = { trait = paranoid }
			}
			modifier = {
				factor = 1.5
				event_target:faction_member = { trait = slothful }
			}
			modifier = {
				factor = 1.5
				trait = brave
			}
			modifier = {
				factor = 0.5
				trait = deceitful
			}
			modifier = {
				factor = 0.5
				trait = craven
			}
		}
		event_target:faction_member = { letter_event = { id = PlusFaction.136 days = 7 tooltip = FACTION_UNDERMINE_THREATEN } }
	}
	option = {
		name = EVTOPTC_PlusFaction_135 # Leave him alone
		ai_chance = {
			factor = 50
			modifier = {
				factor = 3
				opinion = { who = event_target:faction_member value = 0 }
			}
			modifier = {
				factor = 3
				opinion = { who = event_target:faction_member value = 25 }
			}
			modifier = {
				factor = 0.75
				job_spymaster = { intrigue = 14 }
			}
			modifier = {
				factor = 0.75
				job_spymaster = { intrigue = 16 }
			}
			modifier = {
				factor = 0.5
				job_spymaster = { intrigue = 18 }
			}
			modifier = {
				factor = 1.5
				job_spymaster = { NOT = { intrigue = 10 } }
			}
			modifier = {
				factor = 1.5
				job_spymaster = { NOT = { intrigue = 7 } }
			}
			modifier = {
				factor = 2
				job_spymaster = { NOT = { intrigue = 4 } }
			}
			modifier = {
				factor = 2
				trait = just
			}
			modifier = {
				factor = 5
				trait = kind
			}
			modifier = {
				factor = 5
				trait = honest
			}
		}
	}
}

# Target is openly threatened
letter_event = {
	id = PlusFaction.136
	desc = EVTDESC_PlusFaction_136
	border = GFX_event_letter_frame_intrigue
	
	is_triggered_only = yes
	
	trigger = {
		vassal_of = FROM
		pf_member_trigger = yes
	}
	
	option = {
		name = EVTOPTA_PlusFaction_136 # Submit
		ai_chance = {
			factor = 30
			modifier = {
				factor = 1.5
				NOT = { leads_faction = yes }
			}
			modifier = {
				factor = 0.5
				trait = brave
			}
			modifier = {
				factor = 0.75
				trait = proud
			}
			modifier = {
				factor = 0.75
				trait = wroth
			}
			modifier = {
				factor = 2
				trait = craven
			}
			modifier = {
				factor = 1.5
				trait = slothful
			}
			modifier = {
				factor = 1.5
				trait = paranoid
			}
		}
		custom_tooltip = { text = LEAVE_ALL_FACTIONS_10_YEARS }
		opinion = { who = FROM modifier = opinion_coerced_into_leaving_faction years = 10 }
		hidden_tooltip = {
			FROM = { letter_event = { id = PlusFaction.137 } }
		}
	}
	option = {
		name = EVTOPTB_PlusFaction_136 # Tell him to do his worst
		ai_chance = {
			factor = 70
		}
		opinion = { who = FROM modifier = opinion_furious years = 10 }
		FROM = { letter_event = { id = PlusFaction.138 tooltip = TELL_HIM_DO_HIS_WORST } }
	}
}

# Liege informed that target submitted
letter_event = {
	id = PlusFaction.137
	desc = EVTDESC_PlusFaction_137
	border = GFX_event_letter_frame_intrigue
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
	}
}

# Liege informed that target refused to submit
letter_event = {
	id = PlusFaction.138
	desc = EVTDESC_PlusFaction_138
	border = GFX_event_letter_frame_intrigue
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_PlusFaction_138 # Press forward, then
		ai_chance = {
			factor = 50
		}
		random_list = {
			50 = { # Attempt succeeds
				modifier = {
					factor = 0.8
					job_spymaster = {
						event_target:faction_member = {
							attribute_diff = {
								character = PREV
								attribute = intrigue
								value = 2
							}
						}
					}
				}
				modifier = {
					factor = 0.8
					job_spymaster = {
						event_target:faction_member = {
							attribute_diff = {
								character = PREV
								attribute = intrigue
								value = 4
							}
						}
					}
				}
				modifier = {
					factor = 0.8
					job_spymaster = {
						event_target:faction_member = {
							attribute_diff = {
								character = PREV
								attribute = intrigue
								value = 6
							}
						}
					}
				}
				modifier = {
					factor = 0.8
					job_spymaster = {
						event_target:faction_member = {
							attribute_diff = {
								character = PREV
								attribute = intrigue
								value = 8
							}
						}
					}
				}
				modifier = {
					factor = 1.2
					job_spymaster = {
						attribute_diff = {
							character = event_target:faction_member
							attribute = intrigue
							value = 2
						}
					}
				}
				modifier = {
					factor = 1.2
					job_spymaster = {
						attribute_diff = {
							character = event_target:faction_member
							attribute = intrigue
							value = 4
						}
					}
				}
				modifier = {
					factor = 1.2
					job_spymaster = {
						attribute_diff = {
							character = event_target:faction_member
							attribute = intrigue
							value = 6
						}
					}
				}
				modifier = {
					factor = 1.2
					job_spymaster = {
						attribute_diff = {
							character = event_target:faction_member
							attribute = intrigue
							value = 8
						}
					}
				}
				custom_tooltip = { text = FACTION_UNDERMINE_SUCCEEDS }
				hidden_tooltip = {
					character_event = { id = PlusFaction.141 }
				}
			}
			100 = { # Attempt fails and is revealed
				modifier = {
					factor = 0
					event_target:faction_member = {
						NOT = { any_courtier = { has_job_title = job_spymaster } }
					}
				}
				modifier = {
					factor = 1.25
					event_target:faction_member = {
						job_spymaster = { intrigue = 14 }
					}
				}
				modifier = {
					factor = 1.25
					event_target:faction_member = {
						job_spymaster = { intrigue = 17 }
					}
				}
				modifier = {
					factor = 1.5
					event_target:faction_member = {
						job_spymaster = { intrigue = 20 }
					}
				}
				modifier = {
					factor = 0.75
					event_target:faction_member = {
						job_spymaster = { NOT = { intrigue = 10 } }
					}
				}
				modifier = {
					factor = 0.75
					event_target:faction_member = {
						job_spymaster = { NOT = { intrigue = 7 } }
					}
				}
				modifier = {
					factor = 0.5
					event_target:faction_member = {
						job_spymaster = { NOT = { intrigue = 4 } }
					}
				}
				custom_tooltip = { text = FACTION_UNDERMINE_DISCOVERED }
				hidden_tooltip = {
					character_event = { id = PlusFaction.140 }
				}
			}
		}
	}
	option = {
		name = EVTOPTB_PlusFaction_138 # Drop it
		ai_chance = {
			factor = 150
		}
	}
}

# Attempt to undermine target fails
character_event = {
	id = PlusFaction.139
	desc = EVTDESC_PlusFaction_139
	picture = GFX_evt_courtiers_talking
	border = GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	hide_from = yes
	
	option = {
		name = CURSES
		prestige = -25
	}
}

# Attempt to undermine target revealed
character_event = {
	id = PlusFaction.140
	desc = EVTDESC_PlusFaction_140
	picture = GFX_evt_scandal
	border = GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	hide_from = yes
	
	option = {
		name = CURSES
		prestige = -50
		hidden_tooltip = {
			any_vassal = {
				limit = {
					OR = {
						AND = {
							in_faction = faction_court
							event_target:faction_member = { in_faction = faction_court }
						}
						AND = {
							in_faction = faction_prosperity
							event_target:faction_member = { in_faction = faction_prosperity }
						}
						AND = {
							in_faction = faction_glory
							event_target:faction_member = { in_faction = faction_glory }
						}
						AND = {
							in_faction = faction_tradition
							event_target:faction_member = { in_faction = faction_tradition }
						}
					}
				}
				character_event = { id = PlusFaction.142 }
			}
		}
	}
}

# Attempt to undermine target succeeded
character_event = {
	id = PlusFaction.141
	desc = EVTDESC_PlusFaction_141
	picture = GFX_evt_scandal
	border = GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	hide_from = yes
	
	option = {
		name = EXCELLENT
		prestige = 50
		hidden_tooltip = {
			any_vassal = {
				limit = {
					NOT = { character = event_target:faction_member }
					OR = {
						AND = {
							in_faction = faction_court
							event_target:faction_member = { in_faction = faction_court }
						}
						AND = {
							in_faction = faction_prosperity
							event_target:faction_member = { in_faction = faction_prosperity }
						}
						AND = {
							in_faction = faction_glory
							event_target:faction_member = { in_faction = faction_glory }
						}
						AND = {
							in_faction = faction_tradition
							event_target:faction_member = { in_faction = faction_tradition }
						}
					}
				}
				character_event = { id = PlusFaction.143 }
			}
		}
	}
}

# Faction members learn about liege's attempt to undermine
character_event = {
	id = PlusFaction.142
	desc = EVTDESC_PlusFaction_142
	picture = GFX_evt_scandal
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_PlusFaction_142
		if = {
			limit = {
				NOT = { has_opinion_modifier = { who = FROM modifier = opinion_furious } }
			}
			opinion = { who = FROM modifier = opinion_furious years = 5 }
		}
	}
}

# Faction members informed of target's scandal
character_event = {
	id = PlusFaction.143
	desc = EVTDESC_PlusFaction_143
	picture = GFX_evt_scandal
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes
	hide_from = yes
	
	option = {
		name = EVTOPTA_PlusFaction_143
		opinion = { who = event_target:faction_member modifier = opinion_furious years = 10 }
	}
}


### NEGOTIATING WITH FACTION

# Chancellor reports a chance to negotiate with faction
letter_event = {
	id = PlusFaction.145
	border = GFX_event_letter_frame_diplomacy

	desc = {
		text = EVTDESC_PlusFaction_145_COURT
		trigger = {
			event_target:faction_leader = { leads_faction = faction_court }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_145_PROSPERITY
		trigger = {
			event_target:faction_leader = { leads_faction = faction_prosperity }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_145_GLORY
		trigger = {
			event_target:faction_leader = { leads_faction = faction_glory }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_145_TRADITION
		trigger = {
			event_target:faction_leader = { leads_faction = faction_tradition }
		}
	}
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_PlusFaction_145 # Make the attempt
		random_list = {
			75 = {
				modifier = {
					factor = 1.05
					reverse_opinion = { who = event_target:faction_leader value = 20 }
				}
				modifier = {
					factor = 1.05
					reverse_opinion = { who = event_target:faction_leader value = 40 }
				}
				modifier = {
					factor = 1.05
					reverse_opinion = { who = event_target:faction_leader value = 60 }
				}
				modifier = {
					factor = 1.05
					reverse_opinion = { who = event_target:faction_leader value = 80 }
				}
				modifier = {
					factor = 1.05
					reverse_opinion = { who = event_target:faction_leader value = 100 }
				}
				modifier = {
					factor = 0.9
					job_chancellor = { NOT = { diplomacy = 10 } }
				}
				modifier = {
					factor = 0.9
					job_chancellor = { NOT = { diplomacy = 8 } }
				}
				modifier = {
					factor = 0.9
					job_chancellor = { NOT = { diplomacy = 6 } }
				}
				modifier = {
					factor = 0.9
					job_chancellor = { NOT = { diplomacy = 4 } }
				}
				modifier = {
					factor = 0.9
					job_chancellor = { NOT = { diplomacy = 2 } }
				}
				modifier = {
					factor = 1.1
					job_chancellor = { diplomacy = 14 }
				}
				modifier = {
					factor = 1.1
					job_chancellor = { diplomacy = 16 }
				}
				modifier = {
					factor = 1.1
					job_chancellor = { diplomacy = 18 }
				}
				modifier = {
					factor = 1.1
					job_chancellor = { diplomacy = 20 }
				}
				custom_tooltip = { text = NEGOTIATE_FACTION_SUCCEED }
				hidden_tooltip = {
					letter_event = { id = PlusFaction.146 days = 14 }
				}
			}
			50 = {
				modifier = {
					factor = 1.1
					NOT = { reverse_opinion = { who = event_target:faction_leader value = -20 } }
				}
				modifier = {
					factor = 1.1
					NOT = { reverse_opinion = { who = event_target:faction_leader value = -40 } }
				}
				modifier = {
					factor = 1.1
					NOT = { reverse_opinion = { who = event_target:faction_leader value = -60 } }
				}
				modifier = {
					factor = 1.1
					NOT = { reverse_opinion = { who = event_target:faction_leader value = -80 } }
				}
				custom_tooltip = { text = NEGOTIATE_FACTION_FAIL }
				hidden_tooltip = {
					letter_event = { id = PlusFaction.147 days = 14 }
				}
			}
			25 = {
				modifier = {
					factor = 2
					event_target:faction_leader = { leads_faction = faction_court }
					has_character_flag = faction_court_happy
				}
				modifier = {
					factor = 2
					event_target:faction_leader = { leads_faction = faction_prosperity }
					has_character_flag = faction_prosperity_angry
				}
				modifier = {
					factor = 2
					event_target:faction_leader = { leads_faction = faction_glory }
					has_character_flag = faction_glory_angry
				}
				modifier = {
					factor = 2
					event_target:faction_leader = { leads_faction = faction_tradition }
					has_character_flag = faction_tradition_angry
				}
				modifier = {
					factor = 0.25
					event_target:faction_leader = { leads_faction = faction_court }
					has_character_flag = faction_court_happy
				}
				modifier = {
					factor = 0.25
					event_target:faction_leader = { leads_faction = faction_prosperity }
					has_character_flag = faction_prosperity_happy
				}
				modifier = {
					factor = 0.25
					event_target:faction_leader = { leads_faction = faction_glory }
					has_character_flag = faction_glory_happy
				}
				modifier = {
					factor = 0.25
					event_target:faction_leader = { leads_faction = faction_tradition }
					has_character_flag = faction_tradition_happy
				}
				modifier = {
					factor = 0.5
					event_target:faction_leader = { leads_faction = faction_court }
					NOR = {
						has_character_flag = faction_court_happy
						has_character_flag = faction_court_unhappy
						has_character_flag = faction_court_angry
					}
				}
				modifier = {
					factor = 0.5
					event_target:faction_leader = { leads_faction = faction_prosperity }
					NOR = {
						has_character_flag = faction_prosperity_happy
						has_character_flag = faction_prosperity_unhappy
						has_character_flag = faction_prosperity_angry
					}
				}
				modifier = {
					factor = 0.5
					event_target:faction_leader = { leads_faction = faction_glory }
					NOR = {
						has_character_flag = faction_glory_happy
						has_character_flag = faction_glory_unhappy
						has_character_flag = faction_glory_angry
					}
				}
				modifier = {
					factor = 0.5
					event_target:faction_leader = { leads_faction = faction_tradition }
					NOR = {
						has_character_flag = faction_tradition_happy
						has_character_flag = faction_tradition_unhappy
						has_character_flag = faction_tradition_angry
					}
				}
				custom_tooltip = { text = NEGOTIATE_FACTION_WORSE }
				hidden_tooltip = {
					letter_event = { id = PlusFaction.148 days = 14 }
				}
			}
		}
	}
	option = {
		name = EVTOPTB_PlusFaction_145 # Leave it alone
		trigger = { ai = no }
	}
}

# Chancellor reports that the negotiations were successful
letter_event = {
	id = PlusFaction.146
	desc = EVTDESC_PlusFaction_146
	border = GFX_event_letter_frame_diplomacy
	
	is_triggered_only = yes
	show_from_from = yes
	
	trigger = {
		event_target:faction_leader = {
			vassal_of = ROOT
			pf_leader_trigger = yes
		}
	}
	
	option = {
		name = EXCELLENT
		prestige = 50
		if = {
			limit = { event_target:faction_leader = { leads_faction = faction_court } }
			custom_tooltip = { text = COURTFACTIONMOODPLUS }
			hidden_tooltip = {
				any_vassal = {
					limit = {
						ai = no
						in_faction = faction_court
					}
					character_event = { id = PlusFaction.149 }
				}
			}
		}
		if = {
			limit = { event_target:faction_leader = { leads_faction = faction_prosperity } }
			custom_tooltip = { text = PROSPERITYFACTIONMOODPLUS }
			hidden_tooltip = {
				any_vassal = {
					limit = {
						ai = no
						in_faction = faction_prosperity
					}
					character_event = { id = PlusFaction.149 }
				}
			}
		}
		if = {
			limit = { event_target:faction_leader = { leads_faction = faction_glory } }
			custom_tooltip = { text = GLORYFACTIONMOODPLUS }
			hidden_tooltip = {
				any_vassal = {
					limit = {
						ai = no
						in_faction = faction_glory
					}
					character_event = { id = PlusFaction.149 }
				}
			}
		}
		if = {
			limit = { event_target:faction_leader = { leads_faction = faction_tradition } }
			custom_tooltip = { text = TRADITIONFACTIONMOODPLUS }
			hidden_tooltip = {
				any_vassal = {
					limit = {
						ai = no
						in_faction = faction_tradition
					}
					character_event = { id = PlusFaction.149 }
				}
			}
		}
		hidden_tooltip = {
			event_target:faction_leader = { set_variable = { which = "faction_mood_increase" value = 2 } }
			character_event = { id = PlusFaction.200 days = 1 }
		}
	}
}

# Chancellor reports that the negotiations failed
letter_event = {
	id = PlusFaction.147
	desc = EVTDESC_PlusFaction_147
	border = GFX_event_letter_frame_diplomacy
	
	is_triggered_only = yes
	show_from_from = yes
	
	trigger = {
		event_target:faction_leader = {
			vassal_of = ROOT
			pf_leader_trigger = yes
		}
	}
	
	option = {
		name = OK
		prestige = -25
		if = {
			limit = { event_target:faction_leader = { leads_faction = faction_court } }
			hidden_tooltip = {
				any_vassal = {
					limit = {
						ai = no
						in_faction = faction_court
					}
					character_event = { id = PlusFaction.150 }
				}
			}
		}
		if = {
			limit = { event_target:faction_leader = { leads_faction = faction_prosperity } }
			hidden_tooltip = {
				any_vassal = {
					limit = {
						ai = no
						in_faction = faction_prosperity
					}
					character_event = { id = PlusFaction.150 }
				}
			}
		}
		if = {
			limit = { event_target:faction_leader = { leads_faction = faction_glory } }
			hidden_tooltip = {
				any_vassal = {
					limit = {
						ai = no
						in_faction = faction_glory
					}
					character_event = { id = PlusFaction.150 }
				}
			}
		}
		if = {
			limit = { event_target:faction_leader = { leads_faction = faction_tradition } }
			hidden_tooltip = {
				any_vassal = {
					limit = {
						ai = no
						in_faction = faction_tradition
					}
					character_event = { id = PlusFaction.150 }
				}
			}
		}
	}
}

# Chancellor reports that the negotiations made relations with the faction worse
letter_event = {
	id = PlusFaction.148
	desc = EVTDESC_PlusFaction_148
	border = GFX_event_letter_frame_diplomacy
	
	is_triggered_only = yes
	show_from_from = yes
	
	trigger = {
		event_target:faction_leader = {
			vassal_of = ROOT
			pf_leader_trigger = yes
		}
	}
	
	option = {
		name = CURSES
		prestige = -50
		if = {
			limit = { event_target:faction_leader = { leads_faction = faction_court } }
			custom_tooltip = { text = COURTFACTIONMOODMINUS }
			hidden_tooltip = {
				any_vassal = {
					limit = {
						ai = no
						in_faction = faction_court
					}
					character_event = { id = PlusFaction.151 }
				}
			}
		}
		if = {
			limit = { event_target:faction_leader = { leads_faction = faction_prosperity } }
			custom_tooltip = { text = PROSPERITYFACTIONMOODMINUS }
			hidden_tooltip = {
				any_vassal = {
					limit = {
						ai = no
						in_faction = faction_prosperity
					}
					character_event = { id = PlusFaction.151 }
				}
			}
		}
		if = {
			limit = { event_target:faction_leader = { leads_faction = faction_glory } }
			custom_tooltip = { text = GLORYFACTIONMOODMINUS }
			hidden_tooltip = {
				any_vassal = {
					limit = {
						ai = no
						in_faction = faction_glory
					}
					character_event = { id = PlusFaction.151 }
				}
			}
		}
		if = {
			limit = { event_target:faction_leader = { leads_faction = faction_tradition } }
			custom_tooltip = { text = TRADITIONFACTIONMOODMINUS }
			hidden_tooltip = {
				any_vassal = {
					limit = {
						ai = no
						in_faction = faction_tradition
					}
					character_event = { id = PlusFaction.151 }
				}
			}
		}
		hidden_tooltip = {
			event_target:faction_leader = { set_variable = { which = "faction_mood_decrease" value = 2 } }
			character_event = { id = PlusFaction.200 days = 1 }
		}
	}
}

# Inform faction members of successful negotiation
character_event = {
	id = PlusFaction.149
	picture = GFX_evt_council
	border = GFX_event_normal_frame_diplomacy
	
	desc = {
		text = EVTDESC_PlusFaction_149_COURT
		trigger = {
			event_target:faction_leader = { leads_faction = faction_court }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_149_PROSPERITY
		trigger = {
			event_target:faction_leader = { leads_faction = faction_prosperity }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_149_GLORY
		trigger = {
			event_target:faction_leader = { leads_faction = faction_glory }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_149_TRADITION
		trigger = {
			event_target:faction_leader = { leads_faction = faction_tradition }
		}
	}	

	is_triggered_only = yes
	
	option = {
		name = OK
	}
}

# Inform faction members of failed negotiation
character_event = {
	id = PlusFaction.150
	picture = GFX_evt_council
	border = GFX_event_normal_frame_diplomacy
	
	desc = {
		text = EVTDESC_PlusFaction_150_COURT
		trigger = {
			event_target:faction_leader = { leads_faction = faction_court }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_150_PROSPERITY
		trigger = {
			event_target:faction_leader = { leads_faction = faction_prosperity }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_150_GLORY
		trigger = {
			event_target:faction_leader = { leads_faction = faction_glory }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_150_TRADITION
		trigger = {
			event_target:faction_leader = { leads_faction = faction_tradition }
		}
	}

	is_triggered_only = yes
	
	option = {
		name = OK
	}
}

# Inform faction members of successful negotiation
character_event = {
	id = PlusFaction.151
	picture = GFX_evt_council
	border = GFX_event_normal_frame_diplomacy
	
	desc = {
		text = EVTDESC_PlusFaction_151_COURT
		trigger = {
			event_target:faction_leader = { leads_faction = faction_court }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_151_PROSPERITY
		trigger = {
			event_target:faction_leader = { leads_faction = faction_prosperity }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_151_GLORY
		trigger = {
			event_target:faction_leader = { leads_faction = faction_glory }
		}
	}
	desc = {
		text = EVTDESC_PlusFaction_151_TRADITION
		trigger = {
			event_target:faction_leader = { leads_faction = faction_tradition }
		}
	}

	is_triggered_only = yes
	
	option = {
		name = OK
	}
}


### VETTING A PRETENDER

# Pretender faction leader approaches pretender for confirmation
letter_event = {
	id = PlusFaction.155
	desc = EVTDESC_PlusFaction_155
	border = GFX_event_letter_frame_intrigue
	
	is_triggered_only = yes
	show_from_from = yes
	
	immediate = {
		FROMFROM = {
			supported_claimant_title = {
				save_event_target_as = faction_title
				holder_scope = { save_event_target_as = faction_title_holder }
			}
		}
	}
	
	option = {
		name = EVTOPTA_PlusFaction_155 # I agree
		custom_tooltip = { text = PRETENDER_FACTION_CONTINUES }
	}
	option = {
		name = EVTOPTB_PlusFaction_155 # I refuse
		clr_character_flag = supported_pretender_faction
		set_character_flag = refused_pretender_faction
		reverse_opinion = { who = FROMFROM modifier = opinion_very_disappointed years = 5 }
		custom_tooltip = { text = PRETENDER_FACTION_DISSOLVES }
	}
}

