﻿namespace = guest_intent_coronation_events

#####################################
# guest_intent_coronation_events.0001 - Bear Witness
# guest_intent_coronation_events.0010 - Offer Support
# guest_intent_coronation_events.0020 - Advocate Domain
# guest_intent_coronation_events.0030 - Profess Rights
# guest_intent_coronation_events.0040 - Seize Advantages
# guest_intent_coronation_events.0050 - Disrupt Loyalists
# guest_intent_coronation_events.0100 - HOST: Accept/Deny petition
#####################################

# Bear Witness
guest_intent_coronation_events.0001 = {
	type = activity_event
	title = guest_intent_coronation_events.0001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:guest }
				desc = guest_intent_coronation_events.0001.desc.collective
			}
			desc = guest_intent_coronation_events.0001.desc.alone
		}
	}
	theme = coronation_activity
	left_portrait = {
		trigger = { exists = scope:guest }
		character = scope:guest
		animation = debating
	}
	center_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:host
		animation = interested
	}
	
	cooldown = { years = 1 }
	
	trigger = {
		has_activity_intent = coronation_bear_witness
		involved_activity.activity_host = {
			NOT = { has_variable = attended_coronation_bear_witness_var }
		}
		NOR = { # The Bear Witness intent becomes the default if you complete one of the others, so it is possible for you to get two rewards
			has_completed_activity_intent = coronation_advocate_domain
			has_completed_activity_intent = coronation_offer_support
			has_completed_activity_intent = coronation_profess_rights
			has_completed_activity_intent = coronation_seize_advantages
			has_completed_activity_intent = coronation_disrupt_loyalists
		}
		OR = {
			is_ai = no
			AND = {
				is_ai = yes
				involved_activity = {
					any_attending_character = {
						has_activity_intent = coronation_bear_witness
						count >= 5 # There's quorum
					}
				}
			}
		}
		#Hasn't had an intent event from the same coronation
		NAND = {
			has_variable = coronation_had_intent_event
			var:coronation_had_intent_event = scope:activity
		}
	}
	
	weight_multiplier = {
		base = 1
		modifier = {
			is_ai = no
			add = 1
		}
		modifier = { # AI doesn't get the event if there is a human player with the same intent
			is_ai = yes
			involved_activity = {
				any_attending_character = {
					is_ai = no
					has_activity_intent = coronation_bear_witness
				}
			}
			factor = 0
		}
	}

	immediate = {
		save_scope_as = petition_sender
		involved_activity = { save_scope_as = activity }
		involved_activity.activity_host = { save_scope_as = host }
		if = {
			limit = {
				involved_activity = {
					any_attending_character = {
						has_activity_intent = coronation_bear_witness
						this != root
					}
				}
			}
			involved_activity = {
				random_attending_character = {
					limit = {
						has_activity_intent = coronation_bear_witness
						this != root
						is_ai = yes
					}
					weight = {
						base = 1
						modifier = {
							add = 5
							is_landed = yes
						}
					}
					save_scope_as = guest
				}
				every_attending_character = {
					limit = {
						has_activity_intent = coronation_bear_witness
						this != root
					}
					add_to_list = petitioner_list
				}
			}
		}
		if = {
			limit = {
				scope:guest.culture != root.culture
				scope:guest.culture != scope:host.culture
			}
			scope:guest = { set_variable = guest_different_culture_var }
		}
		if = {
			limit = {
				involved_activity = {
					any_attending_character = {
						culture != scope:host.culture
						culture != root.culture
						culture != scope:guest.culture
						has_activity_intent = coronation_bear_witness
					}
				}
			}
			involved_activity = {
				random_attending_character = {
					limit = {
						culture != scope:host.culture
						culture != root.culture
						culture != scope:guest.culture
						has_activity_intent = coronation_bear_witness
					}
					save_scope_as = guest_2
				}
			}
		}
		set_variable = {
			name = coronation_had_intent_event
			value = scope:activity
			years = 1
		}
	}
	
	option = { # Cultural Acceptance
		name = guest_intent_coronation_events.0001.a
		trigger = {
			culture != scope:host.culture
		}
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		show_as_tooltip = {
			culture = {
				change_cultural_acceptance = {
					target = scope:host.culture
					value = major_cultural_acceptance_value
					desc = cultural_acceptance_coronation_bear_witness
				}
			}
			if = {
				limit = {
					exists = scope:guest
					scope:guest = { has_variable = guest_different_culture_var }
				}
				scope:guest = {
					culture = {
						change_cultural_acceptance = {
							target = scope:host.culture
							value = major_cultural_acceptance_value
							desc = cultural_acceptance_coronation_bear_witness
						}
					}
				}
			}
			if = {
				limit = {
					exists = scope:guest_2
				}
				scope:guest_2 = {
					culture = {
						change_cultural_acceptance = {
							target = scope:host.culture
							value = major_cultural_acceptance_value
							desc = cultural_acceptance_coronation_bear_witness
						}
					}
				}
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_cultural_acceptance
			days = 60
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = shy
				factor = 2
			}
		}
	}
	
	option = { # Piety
		name = guest_intent_coronation_events.0001.b
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		show_as_tooltip = {
			add_piety = major_piety_gain
			custom_tooltip = {
				text = guest_intent_coronation_events.0100.a.piety_tt
				every_in_list = {
					list = petitioner_list
					add_piety = major_piety_gain
				}
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_piety
			days = 60
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = greedy
				factor = 2
			}
			modifier = {
				OR = {
					has_trait = generous
					has_trait = shy
				}
				factor = 0
			}
		}
	}
	
	option = { # Legitimacy
		name = guest_intent_coronation_events.0001.c
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		trigger = { has_legitimacy = yes }
		show_as_tooltip = {
			involved_activity = {
				every_attending_character = {
					limit = {
						has_legitimacy = yes
						has_activity_intent = coronation_bear_witness
					}
					add_legitimacy = medium_legitimacy_gain
				}
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_legitimacy
			days = 60
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = greedy
				factor = 2
			}
			modifier = {
				OR = {
					has_trait = generous
					has_trait = shy
				}
				factor = 0
			}
		}
	}
	
	after = {
		scope:host = {
			trigger_event = {
				id = guest_intent_coronation_events.0100
				days = 3
			}
		}
	}
}

# Offer Support
guest_intent_coronation_events.0010 = {
	type = activity_event
	title = guest_intent_coronation_events.0010.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:guest }
				desc = guest_intent_coronation_events.0010.desc.collective
			}
			desc = guest_intent_coronation_events.0010.desc.alone
		}
	}
	theme = coronation_activity
	left_portrait = {
		trigger = { exists = scope:guest }
		character = scope:guest
		animation = happy_teacher
	}
	center_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:host
		animation = personality_content
	}
	
	cooldown = { years = 1 }
	
	trigger = {
		has_activity_intent = coronation_offer_support
		involved_activity.activity_host = {
			NOT = { has_variable = attended_coronation_offer_support_var }
		}
		OR = {
			is_ai = no
			AND = {
				is_ai = yes
				involved_activity = {
					any_attending_character = {
						has_activity_intent = coronation_offer_support
						count >= 5 # There's quorum
					}
				}
			}
		}
		#Hasn't had an intent event from the same coronation
		NAND = {
			has_variable = coronation_had_intent_event
			var:coronation_had_intent_event = scope:activity
		}
	}
	
	weight_multiplier = {
		base = 1
		modifier = {
			is_ai = no
			add = 1
		}
		modifier = { # AI doesn't get the event if there is a human player with the same intent
			is_ai = yes
			involved_activity = {
				any_attending_character = {
					is_ai = no
					has_activity_intent = coronation_offer_support
				}
			}
			factor = 0
		}
	}

	immediate = {
		save_scope_as = petition_sender
		involved_activity = { save_scope_as = activity }
		involved_activity.activity_host = { save_scope_as = host }
		if = {
			limit = {
				involved_activity = {
					any_attending_character = {
						has_activity_intent = coronation_offer_support
						this != root
					}
				}
			}
			involved_activity = {
				random_attending_character = {
					limit = {
						has_activity_intent = coronation_offer_support
						this != root
					}
					weight = {
						base = 1
						modifier = {
							add = 5
							is_landed = yes
						}
					}
					save_scope_as = guest
					assign_quirk_effect = yes
				}
				every_attending_character = {
					limit = {
						has_activity_intent = coronation_offer_support
						this != root
					}
					add_to_list = petitioner_list
				}
			}
		}
		set_variable = {
			name = coronation_had_intent_event
			value = scope:activity
			years = 1
		}
	}
	
	option = { # Opinion
		name = guest_intent_coronation_events.0010.a
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		custom_tooltip = every_offer_support_guest_opinion # Shows the effect in the tooltip
		set_variable = {
			name = coronation_guest_intent_petition_var_opinion
			days = 60
		}
		ai_chance = {
			base = 100
		}
	}
	
	option = { # Special Relation
		name = guest_intent_coronation_events.0010.b
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		trigger = {
			NOT = { has_relation_friend = scope:host }
		}
		show_as_tooltip = {
			if = {
				limit = {
					exists = scope:guest
				}
				add_prestige = major_prestige_loss # You're betraying the rest lol
			}
			if = {
				limit = { has_relation_rival = scope:host }
				remove_relation_rival = scope:host
			}
			else = {
				scope:host = {
					set_relation_friend = {
						target = root
						reason = friend_coronation_offer_support
					}
				}
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_friend
			days = 60
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = gregarious
				factor = 2
			}
			modifier = {
				num_of_relation_friend > 3
				factor = 0
			}
		}
	}
	
	option = { # Alliance
		name = guest_intent_coronation_events.0010.c
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		trigger = {
			NOT = { is_allied_to = scope:host }
			OR = {
				is_landed = yes
				is_landless_adventurer = yes
			}
		}
		show_as_tooltip = {
			if = {
				limit = {
					exists = scope:guest
				}
				add_prestige = medium_prestige_loss # You're betraying the rest lol
			}
			custom_tooltip = {
				text = create_alliance_guest_tt
				create_alliance = {
					target = scope:host
					allied_through_owner = root
					allied_through_target = scope:host
				}
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_alliance
			days = 60
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = ambitious
				factor = 2
			}
		}
	}
	
	after = {
		scope:host = {
			trigger_event = {
				id = guest_intent_coronation_events.0100
				days = 3
			}
		}
	}
}

# Advocate Domain
guest_intent_coronation_events.0020 = {
	type = activity_event
	title = guest_intent_coronation_events.0020.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:guest }
				desc = guest_intent_coronation_events.0020.desc.collective
			}
			desc = guest_intent_coronation_events.0020.desc.alone
		}
	}
	theme = coronation_activity
	override_background = { reference = corridor_night }
	left_portrait = {
		trigger = { exists = scope:guest }
		character = scope:guest
		animation = debating
	}
	center_portrait = {
		character = root
		triggered_animation = {
			trigger = { exists = scope:guest }
			animation = boredom
		}
		animation = admiration
	}
	right_portrait = {
		character = scope:host
		animation = lantern
	}
	
	cooldown = { years = 1 }
	
	trigger = {
		has_activity_intent = coronation_advocate_domain
		involved_activity.activity_host = {
			NOT = { has_variable = attended_coronation_advocate_domain_var }
		}
		any_held_county = {
			OR = {
				development_level < 100
				county_control < 100
				county_opinion < 100
			}
		}
		OR = {
			is_ai = no
			AND = {
				is_ai = yes
				involved_activity = {
					any_attending_character = {
						has_activity_intent = coronation_advocate_domain
						count >= 5 # There's quorum
					}
				}
			}
		}
		#Hasn't had an intent event from the same coronation
		NAND = {
			has_variable = coronation_had_intent_event
			var:coronation_had_intent_event = scope:activity
		}
	}
	
	weight_multiplier = {
		base = 1
		modifier = {
			is_ai = no
			add = 1
		}
		modifier = { # AI doesn't get the event if there is a human player with the same intent
			is_ai = yes
			involved_activity = {
				any_attending_character = {
					is_ai = no
					has_activity_intent = coronation_advocate_domain
				}
			}
			factor = 0
		}
	}

	immediate = {
		save_scope_as = petition_sender
		involved_activity = { save_scope_as = activity }
		involved_activity.activity_host = { save_scope_as = host }
		if = {
			limit = {
				involved_activity = {
					any_attending_character = {
						has_activity_intent = coronation_advocate_domain
						this != root
					}
				}
			}
			involved_activity = {
				random_attending_character = {
					limit = {
						has_activity_intent = coronation_advocate_domain
						this != root
					}
					weight = {
						base = 1
						modifier = {
							add = 5
							is_landed = yes
						}
					}
					save_scope_as = guest
				}
				every_attending_character = {
					limit = {
						has_activity_intent = coronation_advocate_domain
						this != root
					}
					add_to_list = petitioner_list
				}
			}
		}
		set_variable = {
			name = coronation_had_intent_event
			value = scope:activity
			years = 1
		}
	}
	
	option = { # Development
		name = guest_intent_coronation_events.0020.a
		trigger = {
			any_held_county = {
				development_level < 100
			}
		}
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		show_as_tooltip = {
			every_held_county = {
				limit = { development_level < 100 }
				change_development_progress_with_overflow = major_development_progress_gain
			}
			if = {
				limit = {
					involved_activity = {
						any_attending_character = {
							this != root
							has_activity_intent = coronation_advocate_domain
						}
					}
				}
				custom_tooltip = {
					text = guest_intent_coronation_events_advocate_domain_development_tt
					involved_activity = {
						every_attending_character = {
							limit = {
								this != root
								has_activity_intent = coronation_advocate_domain
								any_held_county = {
									development_level < 100
								}
							}
							every_held_county = {
								limit = { development_level < 100 }
								change_development_progress_with_overflow = major_development_progress_gain
							}
						}
					}
				}
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_development
			days = 60
		}
		ai_chance = {
			base = 100
			modifier = {
				any_held_county = {
					development_level < 15
				}
				add = 50
			}
			modifier = {
				any_held_county = {
					development_level < 25
				}
				add = 50
			}
			modifier = {
				has_trait = diligent
				factor = 2
			}
		}
	}
	
	option = { # Control
		name = guest_intent_coronation_events.0020.b
		trigger = {
			any_held_county = {
				county_control < 100
			}
		}
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		show_as_tooltip = {
			every_held_county = {
				limit = { county_control < 100 }
				change_county_control = major_county_control_gain
			}
			if = {
				limit = {
					involved_activity = {
						any_attending_character = {
							this != root
							has_activity_intent = coronation_advocate_domain
						}
					}
				}
				custom_tooltip = {
					text = guest_intent_coronation_events_advocate_domain_control_tt
					involved_activity = {
						every_attending_character = {
							limit = {
								this != root
								has_activity_intent = coronation_advocate_domain
								any_held_county = {
									county_control < 100
								}
							}
							every_held_county = {
								limit = { county_control < 100 }
								change_county_control = major_county_control_gain
							}
						}
					}
				}
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_control
			days = 60
		}
		ai_chance = {
			base = 100
			modifier = {
				any_held_county = {
					county_control < 15
				}
				add = 50
			}
			modifier = {
				any_held_county = {
					county_control < 25
				}
				add = 50
			}
			modifier = {
				dread >= medium_dread_value
				factor = 2
			}
		}
	}
	
	option = { # Popular Opinion
		name = guest_intent_coronation_events.0020.c
		trigger = {
			any_held_county = {
				county_opinion < 100
			}
		}
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		show_as_tooltip = {
			every_held_county = {
				limit = { county_opinion < 100 }
				add_county_modifier = {
					modifier = coronation_advocate_domain_county_opinion_modifier
					years = 10
				}
			}
			if = {
				limit = {
					involved_activity = {
						any_attending_character = {
							this != root
							has_activity_intent = coronation_advocate_domain
						}
					}
				}
				custom_tooltip = {
					text = guest_intent_coronation_events_advocate_domain_county_opinion_tt
					involved_activity = {
						every_attending_character = {
							limit = {
								this != root
								has_activity_intent = coronation_advocate_domain
								any_held_county = {
									county_opinion < 100
								}
							}
							every_held_county = {
								limit = { county_opinion < 100 }
								add_county_modifier = {
									modifier = coronation_advocate_domain_county_opinion_modifier
									years = 10
								}
							}
						}
					}
				}
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_popular_opinion
			days = 60
		}
		ai_chance = {
			base = 100
			modifier = {
				any_held_county = {
					county_opinion < 15
				}
				add = 50
			}
			modifier = {
				any_held_county = {
					county_opinion < 25
				}
				add = 50
			}
			modifier = {
				OR = {
					has_trait = gregarious
					has_trait = compassionate
				}
				factor = 2
			}
		}
	}
	
	after = {
		scope:host = {
			trigger_event = {
				id = guest_intent_coronation_events.0100
				days = 3
			}
		}
	}
}

# Profess Rights
guest_intent_coronation_events.0030 = {
	type = activity_event
	title = guest_intent_coronation_events.0030.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:guest }
				desc = guest_intent_coronation_events.0030.desc.collective
			}
			desc = guest_intent_coronation_events.0030.desc.alone
		}
	}
	theme = coronation_activity
	override_background = { reference = relaxing_room }
	left_portrait = {
		trigger = { exists = scope:guest }
		character = scope:guest
		animation = chess_certain_win
		camera = camera_event_right_pointing_left
	}
	center_portrait = {
		character = root
		triggered_animation = {
			trigger = { exists = scope:guest }
			animation = chess_cocky
		}
		animation = thinking
		camera = camera_event_right_pointing_right
	}
	right_portrait = {
		character = scope:host
		animation = stress
		camera = camera_event_right_pointing_left_away
	}
	
	cooldown = { years = 1 }
	
	trigger = {
		has_activity_intent = coronation_profess_rights
		involved_activity.activity_host = {
			NOT = { has_variable = attended_coronation_profess_rights_var }
		}
		OR = {
			is_ai = no
			AND = {
				is_ai = yes
				involved_activity = {
					any_attending_character = {
						has_activity_intent = coronation_profess_rights
						count >= 5 # There's quorum
					}
				}
			}
		}
		#Hasn't had an intent event from the same coronation
		NAND = {
			has_variable = coronation_had_intent_event
			var:coronation_had_intent_event = scope:activity
		}
	}
	
	weight_multiplier = {
		base = 1
		modifier = {
			is_ai = no
			add = 1
		}
		modifier = { # AI doesn't get the event if there is a human player with the same intent
			is_ai = yes
			involved_activity = {
				any_attending_character = {
					is_ai = no
					has_activity_intent = coronation_profess_rights
				}
			}
			factor = 0
		}
	}

	immediate = {
		save_scope_as = petition_sender
		involved_activity = { save_scope_as = activity }
		involved_activity.activity_host = { save_scope_as = host }
		if = {
			limit = {
				involved_activity = {
					any_attending_character = {
						has_activity_intent = coronation_profess_rights
						this != root
					}
				}
			}
			involved_activity = {
				random_attending_character = {
					limit = {
						has_activity_intent = coronation_profess_rights
						this != root
					}
					weight = {
						base = 1
						modifier = {
							add = 5
							is_landed = yes
						}
					}
					save_scope_as = guest
				}
				every_attending_character = {
					limit = {
						has_activity_intent = coronation_profess_rights
						this != root
					}
					add_to_list = petitioner_list
				}
			}
		}
		set_variable = {
			name = coronation_had_intent_event
			value = scope:activity
			years = 1
		}
	}
	
	option = { # Favor Hook
		name = guest_intent_coronation_events.0030.a
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		show_as_tooltip = {
			if = {
				limit = {
					can_add_hook = {
						target = scope:host
						type = favor_hook
					}
				}
				add_hook = {
					type = favor_hook
					target = scope:host
				}
			}
			else = { # Fallback in case you also cannot change your contract
				scope:host = {
					add_opinion = {
						target = root
						modifier = support_opinion
						opinion = 30
					}
				}
			}
			every_in_list = {
				list = petitioner_list
				limit = {
					can_add_hook = {
						target = scope:host
						type = favor_hook
					}
				}
				add_hook = {
					type = favor_hook
					target = scope:host
				}
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_hook
			days = 60
		}
		ai_chance = {
			base = 100
			modifier = {
				has_intrigue_lifestyle_trait_trigger = yes
				factor = 2
			}
		}
	}
	
	option = { # Vassal Contract - Levies
		name = guest_intent_coronation_events.0030.b
		trigger = {
			is_independent_ruler = no
			government_has_flag = government_is_feudal
			vassal_contract_obligation_level_can_be_decreased = feudal_government_levies
		}
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		show_as_tooltip = {
			vassal_contract_decrease_obligation_level = feudal_government_levies
			every_in_list = {
				list = petitioner_list
				limit = {
					vassal_contract_obligation_level_can_be_decreased = feudal_government_levies
				}
				vassal_contract_decrease_obligation_level = feudal_government_levies
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_vassal_levies
			days = 60
		}
		ai_chance = {
			base = 100
			modifier = {
				vassal_contract_obligation_level:feudal_government_levies > vassal_contract_obligation_level:feudal_government_taxes
				factor = 2
			}
		}
	}
	
	option = { # Vassal Contract - Taxes
		name = guest_intent_coronation_events.0030.c
		trigger = {
			is_independent_ruler = no
			government_has_flag = government_is_feudal
			vassal_contract_obligation_level_can_be_decreased = feudal_government_taxes
		}
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		show_as_tooltip = {
			vassal_contract_decrease_obligation_level = feudal_government_taxes
			every_in_list = {
				list = petitioner_list
				limit = {
					vassal_contract_obligation_level_can_be_decreased = feudal_government_taxes
				}
				vassal_contract_decrease_obligation_level = feudal_government_taxes
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_vassal_taxes
			days = 60
		}
		ai_chance = {
			base = 100
			modifier = {
				OR = {
					short_term_gold <= medium_gold_value
					vassal_contract_obligation_level:feudal_government_levies < vassal_contract_obligation_level:feudal_government_taxes
				}
				factor = 2
			}
		}
	}
	
	after = {
		scope:host = {
			trigger_event = {
				id = guest_intent_coronation_events.0100
				days = 3
			}
		}
	}
}

# Seize Advantages
guest_intent_coronation_events.0040 = {
	type = activity_event
	title = guest_intent_coronation_events.0040.t
	desc = {
		desc = guest_intent_coronation_events.0040.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:guest }
				desc = guest_intent_coronation_events.0040.desc.collective
			}
			desc = guest_intent_coronation_events.0040.desc.alone
		}
	}
	theme = coronation_activity
	override_background = { reference = feast }
	left_portrait = {
		trigger = { exists = scope:guest }
		character = scope:guest
		animation = toast_goblet
	}
	center_portrait = {
		character = root
		triggered_animation = {
			trigger = { exists = scope:guest }
			animation = drink
			camera = camera_event_center_pointing_left
		}
		animation = drink
	}
	right_portrait = {
		character = scope:host
		animation = drink_goblet
	}
	
	cooldown = { years = 1 }
	
	trigger = {
		has_activity_intent = coronation_seize_advantages
		involved_activity.activity_host = {
			NOT = { has_variable = attended_coronation_seize_advantages_var }
		}
		OR = {
			is_ai = no
			AND = {
				is_ai = yes
				involved_activity = {
					any_attending_character = {
						has_activity_intent = coronation_seize_advantages
						count >= 5 # There's quorum
					}
				}
			}
		}
		#Hasn't had an intent event from the same coronation
		NAND = {
			has_variable = coronation_had_intent_event
			var:coronation_had_intent_event = scope:activity
		}
	}
	
	weight_multiplier = {
		base = 1
		modifier = {
			is_ai = no
			add = 1
		}
		modifier = { # AI doesn't get the event if there is a human player with the same intent
			is_ai = yes
			involved_activity = {
				any_attending_character = {
					is_ai = no
					has_activity_intent = coronation_seize_advantages
				}
			}
			factor = 0
		}
	}

	immediate = {
		save_scope_as = petition_sender
		involved_activity = { save_scope_as = activity }
		involved_activity.activity_host = { save_scope_as = host }
		if = {
			limit = {
				involved_activity = {
					any_attending_character = {
						has_activity_intent = coronation_seize_advantages
						this != root
					}
				}
			}
			involved_activity = {
				random_attending_character = {
					limit = {
						has_activity_intent = coronation_seize_advantages
						this != root
					}
					weight = {
						base = 1
						modifier = {
							add = 5
							is_landed = yes
						}
					}
					save_scope_as = guest
				}
				every_attending_character = {
					limit = {
						has_activity_intent = coronation_seize_advantages
						this != root
					}
					add_to_list = petitioner_list
					if = {
						limit = {
							highest_held_title_tier >= tier_county
							any_neighboring_realm_same_rank_owner = {
								liege = scope:host
							}
						}
						random_neighboring_realm_same_rank_owner = {
							limit = { liege = scope:host }
							ordered_held_title = {
								order_by = {
									value = 0
									add = title_province.combined_building_level
								}
								save_scope_as = title_to_give_petitioners
							}
						}
					}
				}
			}
		}
		if = {
			limit = {
				any_neighboring_realm_same_rank_owner = {
					liege = scope:host
				}
			}
			random_neighboring_realm_same_rank_owner = {
				limit = { liege = scope:host }
				ordered_held_title = {
					order_by = {
						value = 0
						add = title_province.combined_building_level
					}
					save_scope_as = title_to_give
				}
			}
		}
		set_variable = {
			name = coronation_had_intent_event
			value = scope:activity
			years = 1
		}
	}
	
	option = { # Gold
		name = guest_intent_coronation_events.0040.a
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		show_as_tooltip = {
			scope:host = {
				pay_short_term_gold = {
					target = root
					gold = minor_gold_value
				}
			}
			every_in_list = {
				list = petitioner_list
				scope:host = {
					pay_short_term_gold = {
						target = prev
						gold = minor_gold_value
					}
				}
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_gold
			days = 60
		}
		ai_chance = {
			base = 100
			modifier = {
				NOT = { scope:host.gold >= monumental_gold_value }
				factor = 0
			}
		}
	}
	
	option = { # Prestige
		name = guest_intent_coronation_events.0040.b
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		show_as_tooltip = {
			add_prestige = medium_prestige_gain
			custom_tooltip = every_seize_advantages_guest_prestige
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_prestige
			days = 60
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = arrogant
				add = 100
			}
			modifier = {
				OR = {
					prestige <= minor_prestige_value
					prestige_level < 3
				}
				factor = 2
			}
		}
	}
	
	option = { # Claims
		name = guest_intent_coronation_events.0040.c
		flavor = guest_intent_coronation_events.0040.c.flavor
		trigger = {
			is_vassal_of = scope:host
			highest_held_title_tier >= tier_county
			is_landed = yes
			exists = scope:title_to_give
		}
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		show_as_tooltip = {
			add_unpressed_claim = scope:title_to_give
			if = {
				limit = {
					exists = scope:title_to_give_petitioners
				}
				every_in_list = {
					list = petitioner_list
					limit = { is_vassal_of = scope:host }
					add_unpressed_claim = scope:title_to_give_petitioners
				}
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_claim
			days = 60
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = ambitious
				factor = 2
			}
		}
	}
	
	after = {
		scope:host = {
			trigger_event = {
				id = guest_intent_coronation_events.0100
				days = 3
			}
		}
	}
}

scripted_effect guest_intent_coronation_events_0050_opinion_tooltip = {
	show_as_tooltip = {
		scope:host = {
			add_opinion = {
				target = root
				modifier = hate_opinion
				opinion = -40
			}
		}
		custom_tooltip = coronation_disrupt_loyalists_host_rivalry_tt
	}
}

# Disrupt Loyalists
guest_intent_coronation_events.0050 = {
	type = activity_event
	title = guest_intent_coronation_events.0050.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:guest }
				desc = guest_intent_coronation_events.0050.desc.collective
			}
			desc = guest_intent_coronation_events.0050.desc.alone
		}
	}
	theme = coronation_activity
	override_background = { reference = corridor_night }
	left_portrait = {
		trigger = { exists = scope:guest }
		character = scope:guest
		animation = hunting_knife_start
		camera = camera_event_center
	}
	center_portrait = {
		character = root
		animation = personality_vengeful
		camera = camera_event_center_pointing_right
	}
	right_portrait = {
		character = scope:host
		animation = happiness
		camera = camera_event_right_pointing_left
	}
	lower_right_portrait = {
		trigger = {
			exists = scope:claimant_scope
			scope:claimant_scope != root
		}
		character = scope:claimant_scope
	}
	
	cooldown = { years = 1 }
	
	trigger = {
		is_ruler = yes
		NOT = {
			faith.religious_head = this
		}
		highest_held_title_tier >= tier_county
		has_activity_intent = coronation_disrupt_loyalists
		involved_activity.activity_host = {
			NOT = { has_variable = attended_coronation_disrupt_loyalists_var }
		}
		involved_activity = {
			any_attending_character = {
				has_activity_intent = coronation_disrupt_loyalists
				count >= 4 # There's quorum
			}
		}
		OR = {
			combined_detractor_strength > combined_supporter_strength
			involved_activity.activity_host = {
				any_targeting_faction = {
					any_faction_member = {
						involved_activity ?= root.involved_activity
					}
					faction_power > 50
				}
			}
			trigger_if = {
				limit = {
					is_vassal_of = involved_activity.activity_host
				}
				root.current_military_strength > involved_activity.activity_host.half_current_military_strength
			}
			trigger_else = {
				root.current_military_strength >= involved_activity.activity_host.current_military_strength
			}
			intrigue > extremely_high_skill_rating
		}
		trigger_if = {
			limit = {
				is_ai = yes
			}
			NOR = {
				has_dread_level_towards = {
					target = involved_activity.activity_host
					level >= 2
				}
				has_trait = craven
			}
		}
		#Hasn't had an intent event from the same coronation
		NAND = {
			has_variable = coronation_had_intent_event
			var:coronation_had_intent_event = scope:activity
		}
	}
	
	weight_multiplier = {
		base = 1
		modifier = {
			is_ai = no
			add = 1
		}
		modifier = { # AI doesn't get the event if there is a human player with the same intent
			is_ai = yes
			involved_activity = {
				any_attending_character = {
					is_ai = no
					has_activity_intent = coronation_disrupt_loyalists
				}
			}
			factor = 0
		}
	}

	immediate = {
		save_scope_as = petition_sender
		involved_activity = { save_scope_as = activity }
		involved_activity.activity_host = { save_scope_as = host }
		if = {
			limit = {
				involved_activity = {
					any_attending_character = {
						has_activity_intent = coronation_disrupt_loyalists
						this != root
					}
				}
			}
			involved_activity = {
				ordered_attending_character = {
					order_by = current_military_strength
					limit = {
						has_activity_intent = coronation_disrupt_loyalists
						this != root
						is_landed = yes
					}
					alternative_limit = {
						has_activity_intent = coronation_disrupt_loyalists
						this != root
					}
					save_scope_as = guest
				}
				every_attending_character = {
					limit = {
						has_activity_intent = coronation_disrupt_loyalists
						this != root
					}
					add_to_list = petitioner_list
				}
			}
		}
		if = {
			limit = {
				scope:host = {
					any_targeting_faction = {
						any_faction_member = { this = root }
					}
				}
			}
			scope:host = {
				random_targeting_faction = {
					limit = { any_faction_member = { this = root } }
					save_scope_as = petition_sender_faction
				}
			}
		}
		if = {
			limit = {
				any_in_list = {
					list = petitioner_list
					is_a_faction_member = yes
					joined_faction = {
						faction_target = scope:host
						trigger_if = {
							limit = {
								exists = scope:petition_sender_faction
							}
							NOT = { this = scope:petition_sender_faction }
						}
					}
				}
			}
			every_in_list = {
				list = petitioner_list
				limit = {
					is_a_faction_member = yes
					joined_faction = {
						faction_target = scope:host
						trigger_if = {
							limit = {
								exists = scope:petition_sender_faction
							}
							NOT = { this = scope:petition_sender_faction }
						}
					}
				}
				joined_faction = { save_scope_as = petition_list_faction }
			}
		}
		if = {
			limit = {
				scope:host = {
					any_targeting_faction = {
						faction_leader = root
						faction_is_type = claimant_faction
					}
				}
			}
			scope:host = {
				random_targeting_faction = {
					limit = {
						faction_leader = root
						faction_is_type = claimant_faction
					}
					special_character = { save_scope_as = claimant_scope }
				}
			}
		}
		set_variable = {
			name = coronation_had_intent_event
			value = scope:activity
			years = 1
		}
	}
	
	option = { # Make the Host Critical Fail
		name = guest_intent_coronation_events.0050.aa
		guest_intent_coronation_events_0050_opinion_tooltip = yes
		trigger = {
			scope:activity = { var:activity_special_type_progression <= 15 } # Magnificence is very low
			exists = scope:claimant_scope
		}
		add_internal_flag = special
		show_as_tooltip = {
			custom_tooltip = {
				text = guest_intent_coronation_events.0100.critical_fail.tt
				invalidate_activity = scope:activity
			}
			create_title_and_vassal_change = {
				type = faction_demand
				save_scope_as = change
				add_claim_on_loss = yes
			}
			scope:host.primary_title = {
				change_title_holder = {
					holder = scope:claimant_scope
					change = scope:change
					take_baronies = no
				}
			}
			resolve_title_and_vassal_change = scope:change
		}
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		set_variable = {
			name = coronation_guest_intent_petition_var_critical_fail
			days = 60
		}
		stress_impact = {
			craven = major_stress_impact_gain
			compassionate = major_stress_impact_gain
			content = medium_stress_impact_gain
		}
		ai_chance = {
			base = 200
			modifier = {
				OR = {
					has_trait = compassionate
					has_trait = content
					has_trait = craven
				}
				factor = 0
			}
		}
	}
	
	option = { # Faction Supporters
		name = guest_intent_coronation_events.0050.a
		guest_intent_coronation_events_0050_opinion_tooltip = yes
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		trigger = {
			exists = scope:petition_sender_faction
		}
		show_as_tooltip = {
			scope:petition_sender_faction = {
				add_faction_discontent = 25
				custom_tooltip = coronation_factions_modifier_tt
				hidden_effect = {
					every_faction_member = {
						add_character_modifier = {
							modifier = coronation_faction_bolstered_modifier
							years = 5
						} 
					}
				}
			}
			if = {
				limit = { exists = scope:petition_list_faction }
				scope:petition_list_faction = {
					add_faction_discontent = 25
					custom_tooltip = coronation_factions_modifier_tt
					hidden_effect = {
						every_faction_member = {
							add_character_modifier = {
								modifier = coronation_faction_bolstered_modifier
								years = 5
							} 
						}
					}
				}
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_faction_discontent
			days = 60
		}
		stress_impact = {
			craven = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = craven
					has_dread_level_towards = {
						target = scope:host
						level >= 2
					}
				}
			}
		}
	}
	
	option = { # Faction Members
		name = guest_intent_coronation_events.0050.b
		guest_intent_coronation_events_0050_opinion_tooltip = yes
		custom_tooltip = guest_intent_coronation_events_petition_sender_tt
		trigger = {
			exists = scope:petition_sender_faction
			any_in_list = {
				list = petitioner_list
				NOT = {	is_in_guest_subset = { name = supporter } }
				is_a_faction_member = no
				is_ruler = yes
				is_vassal_of = scope:host
				can_join_faction = scope:petition_sender_faction
				highest_held_title_tier >= tier_county
			}
		}
		show_as_tooltip = {
			every_in_list = {
				list = petitioner_list
				limit = {
					NOT = {	is_in_guest_subset = { name = supporter } }
					is_a_faction_member = no
					is_ruler = yes
					is_vassal_of = scope:host
					highest_held_title_tier >= tier_county
					can_join_faction = scope:petition_sender_faction
				}
				join_faction = scope:petition_sender_faction
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_faction_members
			days = 60
		}
		stress_impact = {
			craven = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = craven
					has_dread_level_towards = {
						target = scope:host
						level >= 2
					}
				}
			}
		}
	}
	
	option = { # Reduce Magnificence
		name = guest_intent_coronation_events.0050.c
		guest_intent_coronation_events_0050_opinion_tooltip = yes
		custom_tooltip = guest_intent_coronation_events_petition_sender_disrupt_tt
		show_as_tooltip = {
			custom_tooltip = {
				text = coronation_tt_negative_huge
				scope:activity = { activity_special_type_progression_negative_huge = yes }
			}
		}
		set_variable = {
			name = coronation_guest_intent_petition_var_magnificence_loss
			days = 60
		}
		stress_impact = {
			craven = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = content
				factor = 2
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = craven
					has_dread_level_towards = {
						target = scope:host
						level >= 2
					}
				}
			}
		}
	}
	
	#I am not willing to oppose the host openly
	option = {
		#Save someone else as petition_sender
		name = guest_intent_coronation_events.0050.d
		custom_tooltip = guest_intent_coronation_events.0050.d_tt
		custom_tooltip = guest_intent_coronation_events.0050.d_tt_acceptance
		trigger = { # Triggered if there's someone else to take the blame
			involved_activity = {
				any_attending_character = {
					NOT = { this = root }
					has_activity_intent = coronation_disrupt_loyalists
				}
			}
		}
		if = {
			limit = {
				exists = scope:guest
			}
			scope:guest = {
				save_scope_as = petition_sender
			}
			scope:activity = {
				ordered_attending_character = {
					order_by = current_military_strength
					limit = {
						has_activity_intent = coronation_disrupt_loyalists
						NOR = {
							this = root
							this = scope:guest
						}
						is_ruler = yes
					}
					save_scope_as = guest
				}
			}
		}
		else_if = {
			limit = {
				scope:activity = {
					any_attending_character = {
						has_activity_intent = coronation_disrupt_loyalists
						NOT = {
							this = root
						}
						is_ruler = yes
					}
				}
			}
			scope:activity = {
				ordered_attending_character = {
					order_by = current_military_strength
					limit = {
						has_activity_intent = coronation_disrupt_loyalists
						NOT = {
							this = root
						}
						is_ruler = yes
					}
					save_scope_as = petition_sender
				}
				
			}
		}
		scope:petition_sender = {
			set_variable = {
				name = coronation_guest_intent_petition_var_magnificence_loss
				days = 60
			}
		}
		scope:host = {
			add_character_flag = {
				flag = coronation_disrupt_loyalists_reduced_acceptance
				days = 30
			}
		}
		stress_impact = {
			brave = major_stress_impact_gain
			wrathful = medium_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		
		ai_chance = {
			base = 0
			modifier = {
				add = 50
				OR = {
					ai_boldness < 0
					current_military_strength < scope:host.half_current_military_strength
				}
			}
			modifier = {
				add = 150
				ai_boldness <= medium_negative_ai_value
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = brave
					has_trait = wrathful
					has_trait = honest
				}
			}
		}
	}
	
	option = {
		name = guest_intent_coronation_events.0050.e
		custom_tooltip = guest_intent_coronation_events.0050.e_tt
		trigger = { # Triggered if there's no one else to take the blame
			NOT = {
				involved_activity = {
					any_attending_character = {
						NOT = { this = root }
						has_activity_intent = coronation_disrupt_loyalists
					}
				}
			}
		}
		ai_chance = { # This will never trigger for the AI regardless
			base = 0
		}
	}
	
	after = {
		if = {
			limit = {
				exists = scope:petition_sender
			}
			scope:host = {
				trigger_event = {
					id = guest_intent_coronation_events.0100
					days = 3
				}
			}
		}
	}
}

scripted_trigger guest_intent_coronation_events_0100_indirect_threat_trigger = {
	OR = {
		#Threatener is weak vassal
		scope:petition_sender = {
			is_vassal_of = root
			NOR = {
				government_has_flag = government_is_tribal
				government_has_flag = government_is_nomadic
				is_powerful_vassal = yes
			}
		}
		#Host is admin or japanese and petitioner is subordinate
		AND = {
			OR = {
				government_allows = administrative
				government_is_japanese_trigger = yes
			}
			scope:petition_sender = {
				OR = {
					is_vassal_of = root
					is_tributary_of = root
					highest_held_title_tier < root.highest_held_title_tier_minus_one
				}
			}
		}
	}
}

# HOST - Accept/Deny petition
guest_intent_coronation_events.0100 = {
	type = activity_event
	title = guest_intent_coronation_events.0100.t
	desc = {
		random_valid = {
			desc = guest_intent_coronation_events.0100.desc.intro
			desc = guest_intent_coronation_events.0100.desc.intro_2
			triggered_desc = {
				trigger = { scope:petition_sender = { has_activity_intent = coronation_disrupt_loyalists } }
				desc = guest_intent_coronation_events.0100.desc.intro_3
			}
			triggered_desc = {
				trigger = { scope:petition_sender = { has_activity_intent = coronation_seize_advantages } }
				desc = guest_intent_coronation_events.0100.desc.intro_4
			}
			triggered_desc = {
				trigger = {
					OR = {
						has_relation_friend = scope:petition_sender
						scope:petition_sender = {
							OR = {
								has_personality_extroverted_trigger = yes
								has_trait = drunkard
							}
						}
					}
				}
				desc = guest_intent_coronation_events.0100.desc.intro_5
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = {
						OR = {
							has_trait_submissive_trigger = yes
							has_trait_introverted_trigger = yes
						}
					}
				}
				desc = guest_intent_coronation_events.0100.desc.intro_6
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = {
						has_trait_schemy_trigger = yes
					}
				}
				desc = guest_intent_coronation_events.0100.desc.intro_7
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = {
						has_trait_dominant_trigger = yes
					}
				}
				desc = guest_intent_coronation_events.0100.desc.intro_8
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = {
						has_trait_benevolent_trigger = yes
					}
				}
				desc = guest_intent_coronation_events.0100.desc.intro_9
			}
		}
		random_valid = {
			triggered_desc = {
				trigger = { scope:petition_sender = { has_activity_intent = coronation_disrupt_loyalists } }
				desc = guest_intent_coronation_events.0100.desc.disrupt_loyalists
			}
			triggered_desc = {
				trigger = { house = scope:petition_sender.house }
				desc = guest_intent_coronation_events.0100.desc.same_house
			}
			triggered_desc = {
				trigger = { has_relation_friend = scope:petition_sender }
				desc = guest_intent_coronation_events.0100.desc.friendship
			}
			triggered_desc = {
				trigger = { current_season_trigger = { SEASON = winter } }
				desc = guest_intent_coronation_events.0100.desc.winter
			}
			triggered_desc = {
				trigger = { current_season_trigger = { SEASON = summer } }
				desc = guest_intent_coronation_events.0100.desc.summer
			}
			desc = guest_intent_coronation_events.0100.desc.neutral_1
			desc = guest_intent_coronation_events.0100.desc.neutral_2
			desc = guest_intent_coronation_events.0100.desc.neutral_3
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_cultural_acceptance }
				}
				desc = guest_intent_coronation_events.0100.desc.cultural_acceptance
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_piety }
				}
				desc = guest_intent_coronation_events.0100.desc.piety
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_legitimacy }
				}
				desc = guest_intent_coronation_events.0100.desc.legitimacy
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_opinion }
				}
				desc = guest_intent_coronation_events.0100.desc.opinion
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_friend }
				}
				desc = guest_intent_coronation_events.0100.desc.friend
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_alliance }
				}
				desc = guest_intent_coronation_events.0100.desc.alliance
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_development }
				}
				desc = guest_intent_coronation_events.0100.desc.development
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_control }
				}
				desc = guest_intent_coronation_events.0100.desc.control
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_popular_opinion }
				}
				desc = guest_intent_coronation_events.0100.desc.popular_opinion
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_hook }
				}
				desc = guest_intent_coronation_events.0100.desc.hook
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_vassal_levies }
				}
				desc = guest_intent_coronation_events.0100.desc.vassal_levies
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_vassal_taxes }
				}
				desc = guest_intent_coronation_events.0100.desc.vassal_taxes
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_gold }
				}
				desc = guest_intent_coronation_events.0100.desc.gold
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_prestige }
				}
				desc = guest_intent_coronation_events.0100.desc.prestige
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_claim }
				}
				desc = guest_intent_coronation_events.0100.desc.claim
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_faction_discontent }
				}
				desc = guest_intent_coronation_events.0100.desc.faction_discontent
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_faction_members }
				}
				desc = guest_intent_coronation_events.0100.desc.faction_members
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_magnificence_loss }
					guest_intent_coronation_events_0100_indirect_threat_trigger = yes
				}
				desc = guest_intent_coronation_events.0100.desc.magnificence_loss_subtle
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_magnificence_loss }
				}
				desc = guest_intent_coronation_events.0100.desc.magnificence_loss
			}
			triggered_desc = {
				trigger = {
					scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_critical_fail }
				}
				desc = guest_intent_coronation_events.0100.desc.critical_fail
			}
		}
	}
	theme = coronation_activity
	override_background = {
		trigger = {
			scope:petition_sender = { has_activity_intent = coronation_seize_advantages }
		}
		reference = relaxing_room
	}
	override_background = {
		trigger = {
			scope:petition_sender = { has_activity_intent = coronation_disrupt_loyalists }
		}
		reference = corridor_day
	}
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				scope:petition_sender = { has_activity_intent = coronation_disrupt_loyalists }
				has_activity_intent = coronation_weaken_detractors
			}
			animation = anger
		}
		triggered_animation = {
			trigger = {
				scope:petition_sender = { has_activity_intent = coronation_disrupt_loyalists }
				ai_boldness <= medium_negative_ai_value
				NOT = {
					root = {
						guest_intent_coronation_events_0100_indirect_threat_trigger = yes
					}
				}
			}
			animation = fear
		}
		triggered_animation = {
			trigger = {
				scope:petition_sender = { has_activity_intent = coronation_disrupt_loyalists }
				ai_boldness > medium_negative_ai_value
			}
			animation = disbelief
		}
		animation = thinking
		camera = camera_event_very_left
	}
	center_portrait = {
		character = scope:petition_sender
		triggered_animation = {
			trigger = {
				scope:petition_sender = { has_activity_intent = coronation_disrupt_loyalists }
				NOT = {
					root = { guest_intent_coronation_events_0100_indirect_threat_trigger = yes }
				}
			}
			animation = anger
		}
		triggered_animation = {
			trigger = {
				scope:petition_sender = { has_activity_intent = coronation_disrupt_loyalists }
				root = { guest_intent_coronation_events_0100_indirect_threat_trigger = yes }
			}
			animation = personality_vengeful
		}
		triggered_animation = {
			trigger = {
				NOT = {
					scope:petition_sender = { has_activity_intent = coronation_disrupt_loyalists }
				}
				highest_held_title_tier >= root.highest_held_title_tier
			}
			animation = storyteller
		}
		animation = throne_room_bow_1
		camera = camera_event_very_right
	}
	right_portrait = {
		trigger = {
			exists = scope:guest
			scope:petition_sender = { has_activity_intent = coronation_disrupt_loyalists }
		}
		character = scope:guest
		animation = war_defender
		camera = camera_event_very_right
	}
	
	trigger = {
		scope:petition_sender = {
			is_alive = yes
			involved_activity ?= scope:activity
			is_imprisoned = no
		}
		trigger_if = {
			limit = {
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_cultural_acceptance
						has_variable = coronation_guest_intent_petition_var_piety
						has_variable = coronation_guest_intent_petition_var_legitimacy
					}
				}
			}
			NOT = { has_variable = attended_coronation_bear_witness_var }
		}
		trigger_else_if = {
			limit = {
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_opinion
						has_variable = coronation_guest_intent_petition_var_friend
						has_variable = coronation_guest_intent_petition_var_alliance
					}
				}
			}
			NOT = { has_variable = attended_coronation_offer_support_var }
		}
		trigger_else_if = {
			limit = {
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_development
						has_variable = coronation_guest_intent_petition_var_control
						has_variable = coronation_guest_intent_petition_var_popular_opinion
					}
				}
			}
			NOT = { has_variable = attended_coronation_advocate_domain_var }
		}
		trigger_else_if = {
			limit = {
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_gold
						has_variable = coronation_guest_intent_petition_var_prestige
						has_variable = coronation_guest_intent_petition_var_claim
					}
				}
			}
			NOT = { has_variable = attended_coronation_profess_rights_var }
		}
		trigger_else_if = {
			limit = {
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_hook
						has_variable = coronation_guest_intent_petition_var_vassal_taxes
						has_variable = coronation_guest_intent_petition_var_vassal_levies
					}
				}
			}
			NOT = { has_variable = attended_coronation_seize_advantages_var }
		}
		trigger_else = {
			NOT = { has_variable = attended_coronation_disrupt_loyalists_var }
		}
	}
	
	immediate = {
		scope:petition_sender = { assign_quirk_effect = yes }
		if = {
			limit = {
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_cultural_acceptance
						has_variable = coronation_guest_intent_petition_var_piety
						has_variable = coronation_guest_intent_petition_var_legitimacy
					}
				}
			}
			set_variable = {
				name = attended_coronation_bear_witness_var
				years = 1
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_opinion
						has_variable = coronation_guest_intent_petition_var_friend
						has_variable = coronation_guest_intent_petition_var_alliance
					}
				}
			}
			set_variable = {
				name = attended_coronation_offer_support_var
				years = 1
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_development
						has_variable = coronation_guest_intent_petition_var_control
						has_variable = coronation_guest_intent_petition_var_popular_opinion
					}
				}
			}
			set_variable = {
				name = attended_coronation_advocate_domain_var
				years = 1
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_gold
						has_variable = coronation_guest_intent_petition_var_prestige
						has_variable = coronation_guest_intent_petition_var_claim
					}
				}
			}
			set_variable = {
				name = attended_coronation_seize_advantages_var
				years = 1
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_hook
						has_variable = coronation_guest_intent_petition_var_vassal_taxes
						has_variable = coronation_guest_intent_petition_var_vassal_levies
					}
				}
			}
			set_variable = {
				name = attended_coronation_profess_rights_var
				years = 1
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_faction_discontent
						has_variable = coronation_guest_intent_petition_var_faction_members
						has_variable = coronation_guest_intent_petition_var_magnificence_loss
						has_variable = coronation_guest_intent_petition_var_critical_fail
					}
				}
			}
			set_variable = {
				name = attended_coronation_disrupt_loyalists_var
				years = 1
			}
			play_music_cue = "mx_cue_negative"
		}
		if = {
			limit = {
				scope:petition_sender = {
					has_activity_intent = coronation_disrupt_loyalists
				}
			}
			hidden_effect = {
				scope:host = {
					add_opinion = {
						target = scope:petition_sender
						modifier = hate_opinion
						opinion = -40
					}
				}
				every_in_list = {
					limit = {
						NOT = { this = scope:petition_sender }
					}
					list = petitioner_list
					scope:host = {
						add_opinion = {
							target = prev
							modifier = hate_opinion
							opinion = -30
						}
					}
				}
			}
		}
		if = {
			limit = {
				scope:petition_sender = {
					has_activity_intent = coronation_disrupt_loyalists
				}
				OR = {
					combined_detractor_strength > combined_supporter_strength
					number_of_detractors > number_of_supporters
				}
			}
			custom_tooltip = coronation_guest_intent_disrupt_happened_tt
		}
		else_if = {
			limit = {
				scope:petition_sender = {
					has_activity_intent = coronation_disrupt_loyalists
				}
				OR = {
					scope:host = {
						any_targeting_faction = {
							any_faction_member = {
								involved_activity ?= root.involved_activity
							}
							faction_power > 50
						}
					}
					trigger_if = {
						limit = {
							scope:petition_sender = {
								is_vassal_of = scope:petition_sender
							}
						}
						scope:petition_sender.current_military_strength > scope:host.half_current_military_strength
					}
					trigger_else = {
						scope:petition_sender.current_military_strength >= scope:host.current_military_strength
					}
					scope:petition_sender = {
						intrigue > extremely_high_skill_rating
					}
				}
			}
			custom_tooltip = coronation_guest_intent_disrupt_happened_sender_tt
		}
		
	}
	
	option = { # Counter the bad guys
		name = guest_intent_coronation_events.0100.aa
		trigger = {
			scope:petition_sender = { has_activity_intent = coronation_disrupt_loyalists }
			has_activity_intent = coronation_weaken_detractors
		}
		add_internal_flag = special
		reason = activity_intent
		add_dread = medium_dread_gain
		scope:petition_sender = {
			add_prestige = medium_prestige_loss
			set_relation_rival = {
				target = scope:host
				reason = rival_opposed_coronation_openly
			}
		}
		if = {
			limit = {
				scope:petition_sender = {
					has_activity_intent = coronation_disrupt_loyalists
				}
				exists = scope:guest
			}
			scope:guest = {
				add_prestige = medium_prestige_loss
				set_relation_rival = {
					target = scope:host
					reason = rival_opposed_coronation_openly
				}
			}
		}
	}
	
	option = { # Yes
		name = {
			trigger = {
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_faction_discontent
						has_variable = coronation_guest_intent_petition_var_faction_members
						has_variable = coronation_guest_intent_petition_var_critical_fail
						has_variable = coronation_guest_intent_petition_var_magnificence_loss
					}
				}
			}
			text = guest_intent_coronation_events.0100.a.bad
		}
		name = {
			trigger = {
				scope:petition_sender = {
					NOR = {
						has_variable = coronation_guest_intent_petition_var_faction_discontent
						has_variable = coronation_guest_intent_petition_var_faction_members
						has_variable = coronation_guest_intent_petition_var_critical_fail
						has_variable = coronation_guest_intent_petition_var_magnificence_loss
					}
				}
				
			}
			text = guest_intent_coronation_events.0100.a
		}
		if = {
			limit = {
				scope:petition_sender = {
					NOR = {
						has_variable = coronation_guest_intent_petition_var_faction_discontent
						has_variable = coronation_guest_intent_petition_var_faction_members
						has_variable = coronation_guest_intent_petition_var_critical_fail
						has_variable = coronation_guest_intent_petition_var_magnificence_loss
					}
				}
			}
			custom_tooltip = {
				text = coronation_tt_positive_tiny
				involved_activity = { activity_special_type_progression_tiny = yes }
			}
			coronation_add_magnificence_log_effect = {
        	    VALUE = flag:positive_tiny
        	    CHAR = root
        	}
		}
		if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_cultural_acceptance }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					culture = {
						change_cultural_acceptance = {
							target = scope:host.culture
							value = major_cultural_acceptance_value
							desc = cultural_acceptance_coronation_bear_witness
						}
					}
					if = {
						limit = {
							exists = scope:guest
							scope:guest = { has_variable = guest_different_culture_var }
						}
						scope:guest = {
							culture = {
								change_cultural_acceptance = {
									target = scope:host.culture
									value = major_cultural_acceptance_value
									desc = cultural_acceptance_coronation_bear_witness
								}
							}
						}
					}
					if = {
						limit = {
							exists = scope:guest_2
						}
						scope:guest_2 = {
							culture = {
								change_cultural_acceptance = {
									target = scope:host.culture
									value = major_cultural_acceptance_value
									desc = cultural_acceptance_coronation_bear_witness
								}
							}
						}
					}
					scope:petition_sender = { # If host accepts the intent is complete
						create_character_memory = {
							type = coronation_cultural_acceptance_memory
							participants = {
								host = scope:host
							}
						}
					}
					scope:guest = { remove_variable = guest_different_culture_var }
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_piety }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					add_piety = major_piety_gain
					custom_tooltip = {
						text = guest_intent_coronation_events.0100.a.piety_tt
						every_in_list = {
							list = petitioner_list
							add_piety = major_piety_gain
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_legitimacy }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					involved_activity = {
						every_attending_character = {
							limit = {
								has_legitimacy = yes
								has_activity_intent = coronation_bear_witness
							}
							add_legitimacy = medium_legitimacy_gain
						}
					}
					scope:petition_sender = { # If host accepts the intent is complete
						create_character_memory = {
							type = coronation_legitimacy_memory
							participants = {
								host = scope:host
							}
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_opinion }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					custom_tooltip = every_offer_support_guest_opinion
					hidden_effect = {
						involved_activity = {
							every_attending_character = {
								limit = { has_activity_intent = coronation_offer_support }
								reverse_add_opinion = {
									target = scope:host
									modifier = impressed_opinion
									opinion = 50
								}
							}
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_friend }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					if = {
						limit = {
							exists = scope:guest
						}
						add_prestige = major_prestige_loss # You're betraying the rest lol
					}
					if = {
						limit = { has_relation_rival = scope:host }
						remove_relation_rival = scope:host
					}
					else = {
						set_relation_friend = {
							target = scope:host
							reason = friend_coronation_offer_support
						}
					}
					scope:petition_sender = { # If host accepts the intent is complete
						create_character_memory = {
							type = coronation_friend_memory
							participants = {
								host = scope:host
							}
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_alliance }
			}
			custom_tooltip = create_alliance_host_tt
			hidden_effect = {
				scope:petition_sender = {
					add_opinion = {
						target = scope:host
						modifier = event_negotiated_alliance_opinion
					}
				}
				create_alliance = {
					target = scope:petition_sender
					allied_through_owner = root
					allied_through_target = scope:petition_sender
				}
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					if = {
						limit = {
							exists = scope:guest
						}
						add_prestige = medium_prestige_loss # You're betraying the rest lol
					}
					hidden_effect = {
						custom_tooltip = {
							text = create_alliance_guest_tt
						}
					}
					scope:petition_sender = { # If host accepts the intent is complete
						create_character_memory = {
							type = coronation_alliance_memory
							participants = {
								host = scope:host
							}
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_development }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					every_held_county = {
						limit = { development_level < 100 }
						change_development_progress_with_overflow = major_development_progress_gain
					}
					root = { # To make the tooltip look nice
						custom_tooltip = {
							text = guest_intent_coronation_events_advocate_domain_development_tt
							involved_activity = {
								every_attending_character = {
									limit = {
										this != scope:petition_sender
										has_activity_intent = coronation_advocate_domain
										any_held_county = {
											development_level < 100
										}
									}
									every_held_county = {
										limit = { development_level < 100 }
										change_development_progress_with_overflow = major_development_progress_gain
									}
								}
							}
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_control }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					every_held_county = {
						limit = { county_control < 100 }
						change_county_control = major_county_control_gain
					}
					root = { # To make the tooltip look nice
						custom_tooltip = {
							text = guest_intent_coronation_events_advocate_domain_control_tt
							involved_activity = {
								every_attending_character = {
									limit = {
										this != scope:petition_sender
										has_activity_intent = coronation_advocate_domain
										any_held_county = {
											county_control < 100
										}
									}
									every_held_county = {
										limit = { county_control < 100 }
										change_county_control = major_county_control_gain
									}
								}
							}
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_popular_opinion }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					every_held_county = {
						limit = { county_opinion < 100 }
						add_county_modifier = {
							modifier = coronation_advocate_domain_county_opinion_modifier
							years = 10
						}
					}
					root = { # To make the tooltip look nice
						custom_tooltip = {
							text = guest_intent_coronation_events_advocate_domain_county_opinion_tt
							involved_activity = {
								every_attending_character = {
									limit = {
										this != scope:petition_sender
										has_activity_intent = coronation_advocate_domain
										any_held_county = {
											county_opinion < 100
										}
									}
									every_held_county = {
										limit = { county_opinion < 100 }
										add_county_modifier = {
											modifier = coronation_advocate_domain_county_opinion_modifier
											years = 10
										}
									}
								}
							}
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_hook }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					if = {
						limit = {
							can_add_hook = {
								target = scope:host
								type = favor_hook
							}
						}
						add_hook = {
							type = favor_hook
							target = scope:host
						}
					}
					else = {
						scope:host = {
							add_opinion = {
								target = scope:petition_sender
								modifier = support_opinion
								opinion = 30
							}
						}
					}
					every_in_list = {
						list = petitioner_list
						limit = {
							can_add_hook = {
								target = scope:host
								type = favor_hook
							}
						}
						add_hook = {
							type = favor_hook
							target = scope:host
						}
					}
				}
			}
			scope:petition_sender = { # If host accepts the intent is complete
				create_character_memory = {
					type = coronation_hook_memory
					participants = {
						host = scope:host
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_vassal_levies }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					vassal_contract_decrease_obligation_level = feudal_government_levies
					every_in_list = {
						list = petitioner_list
						limit = {
							vassal_contract_obligation_level_can_be_decreased = feudal_government_levies
						}
						vassal_contract_decrease_obligation_level = feudal_government_levies
					}
				}
			}
			scope:petition_sender = { # If host accepts the intent is complete
				create_character_memory = {
					type = coronation_vassal_levies_memory
					participants = {
						host = scope:host
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_vassal_taxes }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					vassal_contract_decrease_obligation_level = feudal_government_taxes
					every_in_list = {
						list = petitioner_list
						limit = {
							vassal_contract_obligation_level_can_be_decreased = feudal_government_taxes
						}
						vassal_contract_decrease_obligation_level = feudal_government_taxes
					}
				}
			}
			scope:petition_sender = { # If host accepts the intent is complete
				create_character_memory = {
					type = coronation_vassal_taxes_memory
					participants = {
						host = scope:host
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_gold }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					scope:host = {
						pay_short_term_gold = {
							target = scope:petition_sender
							gold = minor_gold_value
						}
					}
					every_in_list = {
						list = petitioner_list
						scope:host = {
							pay_short_term_gold = {
								target = prev
								gold = minor_gold_value
							}
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_prestige }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					add_prestige = medium_prestige_gain
					custom_tooltip = every_seize_advantages_guest_prestige
					hidden_effect = {
						every_in_list = {
							list = petitioner_list
							add_prestige = medium_prestige_gain
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_claim }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					add_unpressed_claim = scope:title_to_give
					every_in_list = {
						list = petitioner_list
						if = {
							limit = {
								any_neighboring_realm_same_rank_owner = {
									liege = scope:host
								}
							}
							random_neighboring_realm_same_rank_owner = {
								limit = { liege = scope:host }
								ordered_held_title = {
									order_by = {
										value = 0
										add = title_province.combined_building_level
									}
									save_scope_as = title_to_give_petitioners
								}
							}
							add_unpressed_claim = scope:title_to_give_petitioners
						}
					}
				}
			}
			scope:petition_sender = { # If host accepts the intent is complete
				create_character_memory = {
					type = coronation_claim_memory
					participants = {
						host = scope:host
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_critical_fail }
			}
			custom_tooltip = {
				text = guest_intent_coronation_events.0100.critical_fail.tt
				invalidate_activity = scope:activity
				create_character_memory = {
					type = coronation_coup_memory
					participants = {
						plotter = scope:petition_sender
					}
				}
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host 
					if = {
						limit = {
							exists = scope:claimant_scope
						}
						create_title_and_vassal_change = {
							type = faction_demand
							save_scope_as = change
							add_claim_on_loss = yes
						}
						scope:host.primary_title = {
							change_title_holder = {
								holder = scope:claimant_scope
								change = scope:change
								take_baronies = no
							}
						}
						resolve_title_and_vassal_change = scope:change
					}
					else_if = {
						limit = {
							scope:host = { has_targeting_faction = yes }
						}
						scope:host = { add_targeting_factions_discontent = 50 }
					}
					scope:host = {
						progress_towards_rival_effect = {
							REASON = rival_opposed_coronation_openly
							CHARACTER = scope:petition_sender
							OPINION = 0
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_faction_discontent }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					scope:petition_sender_faction = {
						add_faction_discontent = 25
						custom_tooltip = coronation_factions_modifier_tt
						hidden_effect = {
							every_faction_member = {
								add_character_modifier = {
									modifier = coronation_faction_bolstered_modifier
									years = 5
								} 
							}
						}
					}
					if = {
						limit = { exists = scope:petition_list_faction }
						scope:petition_list_faction = {
							add_faction_discontent = 25
							custom_tooltip = coronation_factions_modifier_tt
							hidden_effect = {
								every_faction_member = {
									add_character_modifier = {
										modifier = coronation_faction_bolstered_modifier
										years = 5
									} 
								}
							}
						}
					}
					scope:host = {
						progress_towards_rival_effect = {
							REASON = rival_opposed_coronation_openly
							CHARACTER = scope:petition_sender
							OPINION = 0
						}
					}
				}
			}
			scope:petition_sender = { # If host accepts the intent is complete
				create_character_memory = {
					type = coronation_faction_discontent_memory
					participants = {
						host = scope:host
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_faction_members }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					every_in_list = {
						list = petitioner_list
						limit = {
							NOT = {	is_in_guest_subset = { name = supporter } }
							is_a_faction_member = no
							can_join_faction = scope:petition_sender_faction
							is_ruler = yes
							is_vassal_of = scope:host
							highest_held_title_tier >= tier_county
						}
						show_as_tooltip = {
							join_faction = scope:petition_sender_faction
						}
						hidden_effect = {
							join_faction_skip_check = scope:petition_sender_faction
						}
						#Make them more likely to stay, at least for a year...
						set_variable = {
							name = detractor_faction
							value = scope:host
							years = 1
						}
					}
					scope:host = {
						progress_towards_rival_effect = {
							REASON = rival_opposed_coronation_openly
							CHARACTER = scope:petition_sender
							OPINION = 0
						}
					}
				}
			}
			scope:petition_sender = { # If host accepts the intent is complete
				create_character_memory = {
					type = coronation_faction_members_memory
					participants = {
						host = scope:host
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:petition_sender = { has_variable = coronation_guest_intent_petition_var_magnificence_loss }
			}
			scope:petition_sender = {
				send_interface_toast = {
					title = guest_intent_coronation_events.0100.a.tt
					left_icon = scope:host
					custom_tooltip = {
						text = coronation_tt_negative_huge
						scope:activity = { activity_special_type_progression_negative_huge = yes }
					}
					scope:host = {
						progress_towards_rival_effect = {
							REASON = rival_opposed_coronation_openly
							CHARACTER = scope:petition_sender
							OPINION = 0
						}
					}
				}
			}
			scope:petition_sender = { # If host accepts the intent is complete
				create_character_memory = {
					type = coronation_magnificence_loss_memory
					participants = {
						host = scope:host
					}
				}
			}
		}
		if = {
			limit = {
				scope:petition_sender = {
					has_activity_intent = coronation_disrupt_loyalists
				}
				exists = scope:guest
			}
			progress_towards_rival_effect = {
				REASON = rival_opposed_coronation_openly
				CHARACTER = scope:guest
				OPINION = 0
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = callous
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_friend
						has_variable = coronation_guest_intent_petition_var_opinion
					}
				}
				add = -20
			}
			opinion_modifier = {
				who = root
				opinion_target = scope:petition_sender
				multiplier = 1
			}
			#Should be less willing to give these to AI
			modifier = {
				add = -25
				scope:petition_sender = {
					is_ai = yes
					OR = {
						has_variable = coronation_guest_intent_petition_var_gold
						has_variable = coronation_guest_intent_petition_var_alliance
					}
				}
			}
			modifier = {
				add = -50
				scope:petition_sender = {
					is_ai = yes
					OR = {
						has_variable = coronation_guest_intent_petition_var_hook
						has_variable = coronation_guest_intent_petition_var_vassal_levies
						has_variable = coronation_guest_intent_petition_var_vassal_taxes
					}
				}
			}
		}
	}
	
	option = { # No
		name = {
			trigger = {
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_faction_discontent
						has_variable = coronation_guest_intent_petition_var_faction_members
						has_variable = coronation_guest_intent_petition_var_critical_fail
						has_variable = coronation_guest_intent_petition_var_magnificence_loss
					}
				}
				
			}
			text = guest_intent_coronation_events.0100.b.bad
		}
		name = {
			trigger = {
				scope:petition_sender = {
					NOR = {
						has_variable = coronation_guest_intent_petition_var_faction_discontent
						has_variable = coronation_guest_intent_petition_var_faction_members
						has_variable = coronation_guest_intent_petition_var_critical_fail
						has_variable = coronation_guest_intent_petition_var_magnificence_loss
					}
				}
				
			}
			text = guest_intent_coronation_events.0100.b
		}
		trigger = {
			NAND = { # You get something better for this
				scope:petition_sender = { has_activity_intent = coronation_disrupt_loyalists }
				has_activity_intent = coronation_weaken_detractors
			}
		}
		if = {
			limit = {
				scope:petition_sender = {
					NOR = {
						has_variable = coronation_guest_intent_petition_var_faction_discontent
						has_variable = coronation_guest_intent_petition_var_faction_members
						has_variable = coronation_guest_intent_petition_var_critical_fail
						has_variable = coronation_guest_intent_petition_var_magnificence_loss
					}
				}
			}
			custom_tooltip = {
				text = coronation_tt_positive_medium
				involved_activity = { activity_special_type_progression_medium = yes }
			}
			coronation_add_magnificence_log_effect = {
        	    VALUE = flag:positive_medium
        	    CHAR = root
        	}
		}
		else = {
			add_tyranny = medium_tyranny_gain
		}
		scope:petition_sender = {
			send_interface_toast = {
				title = guest_intent_coronation_events.0100.b.tt
				left_icon = scope:host
				if = {
					limit = {
						scope:petition_sender = {
							has_activity_intent = coronation_disrupt_loyalists
						}
					}
					add_opinion = {
						target = scope:host
						modifier = hate_opinion
						opinion = -40
					}
					scope:host = {
						set_relation_rival = {
							target = scope:petition_sender
							reason = rival_opposed_coronation_openly
						}
					}
					scope:host = {
						custom_tooltip = {
							text = guest_intent_coronation_events.0100.b.rejected_detractor_tt
							every_in_list = {
								list = petitioner_list
								limit = {
									NOT = { this = scope:petition_sender }
								}
								add_opinion = {
									target = scope:host
									modifier = hate_opinion
									opinion = -30
								}
							}
						}
					}
				}
				else = {
					add_opinion = {
						target = scope:host
						modifier = annoyed_opinion
						opinion = -15
					}
					scope:host = {
						custom_tooltip = {
							text = guest_intent_coronation_events.0100.b.rejected_tt
							every_in_list = {
								list = petitioner_list
								limit = {
									NOT = { this = scope:petition_sender }
								}
								add_opinion = {
									target = scope:host
									modifier = rejected_opinion
									opinion = -10
								}
							}
						}
					}
				}
			}
		}
		if = {
			limit = {
				scope:petition_sender = {
					has_activity_intent = coronation_disrupt_loyalists
				}
				exists = scope:guest
			}
			set_relation_rival = {
				target = scope:guest
				reason = rival_opposed_coronation_openly
			}
		}
		ai_chance = {
			base = 50
			modifier = { # More resistent to say yes to bad things
				NOT = { has_trait = craven }
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_faction_discontent
						has_variable = coronation_guest_intent_petition_var_faction_members
						has_variable = coronation_guest_intent_petition_var_magnificence_loss
					}
				}
				add = 20
			}
			modifier = { # Much more resistent if you are Brave
				has_trait = brave
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_faction_discontent
						has_variable = coronation_guest_intent_petition_var_faction_members
						has_variable = coronation_guest_intent_petition_var_magnificence_loss
					}
				}
				add = 100
			}
			modifier = { # Very resistent to accepting a Critical Fail
				NOT = { has_trait = craven }
				scope:petition_sender = {
					has_variable = coronation_guest_intent_petition_var_critical_fail
				}
				add = 100
			}
			modifier = { # Unless you're extremely weak
				scope:petition_sender = {
					has_variable = coronation_guest_intent_petition_var_critical_fail
				}
				current_military_strength <= scope:petition_sender.current_military_strength
				add = -100
			}
			opinion_modifier = {
				who = root
				opinion_target = scope:petition_sender
				multiplier = -1
			}
			modifier = {
				factor = 0.5
				scope:petition_sender = {
					has_activity_intent = coronation_disrupt_loyalists
				}
				has_character_flag = coronation_disrupt_loyalists_reduced_acceptance
			}
			modifier = {
				add = 25
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_alliance
						has_variable = coronation_guest_intent_petition_var_gold
						has_variable = coronation_guest_intent_petition_var_hook
						has_variable = coronation_guest_intent_petition_var_vassal_levies
						has_variable = coronation_guest_intent_petition_var_vassal_taxes
					}
				}
			}
			modifier = {
				add = 50
				scope:petition_sender = {
					OR = {
						has_variable = coronation_guest_intent_petition_var_hook
						has_variable = coronation_guest_intent_petition_var_vassal_levies
						has_variable = coronation_guest_intent_petition_var_vassal_taxes
					}
				}
				NOR = {
					has_dread_level_towards = {
						target = scope:petition_sender
						level >= 1
					}
					has_any_good_relationship_with_character_trigger = { CHARACTER = scope:petition_sender }
					AND = {
						exists = scope:petition_sender.dynasty
						dynasty ?= scope:petition_sender.dynasty
					}
				}
			}
			modifier = {
				add = 100
				scope:petition_sender = {
					has_variable = coronation_guest_intent_petition_var_gold
				}
				short_term_gold < major_gold_value
			}
			#AI less likely to accept alliance with weak chars
			modifier = {
				add = 50
				scope:petition_sender = {
					has_variable = coronation_guest_intent_petition_var_alliance
					OR = {
						current_military_strength < root.current_military_strength
						is_at_war = yes
						AND = {
							highest_held_title_tier < root.highest_held_title_tier
							NOT = {
								is_vassal_of = root
							}
						}
						root = {
							any_claim = {
								holder ?= scope:petition_sender 
							}
						}
					}
				}
			}
			modifier = {
				add = 100
				scope:petition_sender = {
					has_variable = coronation_guest_intent_petition_var_alliance
					OR = {
						current_military_strength <= root.half_current_military_strength
						highest_held_title_tier < root.highest_held_title_tier_minus_one
					}
				}
			}
		}
	}
}
