namespace = coronation_events

#####################################
# Coronation - Flavour Events		#
# coronation_events - 1000-1999		#
#####################################

# Bard disses you at your coronation
coronation_events.1000 = {
	type = activity_event
	title = coronation_events.1000.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = has_rival
				}
				desc = coronation_events.1000.rival.desc
			}
			triggered_desc = {
				trigger = {
					has_character_flag = low_county_opinion
				}
				desc = coronation_events.1000.low_county_opinion.desc
			}
			triggered_desc = {
				trigger = {
					has_character_flag = tyrant
				}
				desc = coronation_events.1000.tyrant.desc
			}
			desc = coronation_events.1000.desc_fallback
		}
	}
	right_portrait = {
		trigger = { exists = scope:rival }
		character = scope:rival
		animation = schadenfreude
	}
	center_portrait = {
		character = scope:bard
		animation = instrument_active
	}
	left_portrait = {
		character = root
		animation = boredom
	}
	theme = coronation_activity
	cooldown = { years = 5 }

	trigger = {
		OR = {
			scope:activity = {
				any_attending_character = {
					has_relation_rival = root
					NOT = {
						has_dread_level_towards = {
							target = root
							level >= 2
						}
					}
				}
			}
			scope:activity.activity_location.county = {
				county_opinion < 0
			}
			tyranny >= 20
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		grab_appropriate_bard_effect = yes
		if = {
			limit = {
				scope:activity = {
					any_attending_character = {
						has_relation_rival = root
					}
				}
			}
			scope:activity = {
				random_attending_character = {
					limit = {
						has_relation_rival = root
						NOT = {
							has_dread_level_towards = {
								target = root
								level >= 2
							}
						}
					}
					save_scope_as = rival
				}
			}
			add_character_flag = {
				flag = has_rival
			}
		}
		if = {
			limit = {
				scope:activity.activity_location.county = {
					county_opinion < 0
				}
			}
			add_character_flag = {
				flag = low_county_opinion
			}
		}
		if = {
			limit = {
				tyranny > 20
			}
			add_character_flag = {
				flag = tyrant
			}
		}
	}

	# bribe
	option = {
		name = coronation_events.1000.bribe
		pay_short_term_gold = {
			target = scope:bard
			gold = activity_minor_gold_value
		}
		if = {
        	limit = {
        		government_allows = administrative
        		top_liege = scope:activity.activity_host
        	}
        	change_influence = medium_influence_gain
        }
        else = {
        	add_prestige = medium_prestige_gain
        }
		stress_impact = {
			base = minor_stress_impact_loss
			greedy = medium_stress_impact_gain
  		}
  		ai_chance = {
  			base = 50
  			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					short_term_gold < activity_minor_gold_value
				}
			}
  		}
	}

	# diplo duel rap battle
	option = {
		name = coronation_events.1000.epic_rap_battle
		trigger = {
			OR = {
				has_trait = lifestyle_poet
				has_trait = violet_poet
				has_trait = gregarious
				has_trait = eccentric
				has_trait_xp = {
					trait = tourney_participant
					track = wit
					value >= 50
				}
				diplomacy > 18
				has_trait = lifestyle_reveler
			}

		}
		duel = {
			skill = diplomacy
			target = scope:bard
			# the bard gets destroyed by you
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = coronation_events.1000.epic_rap_battle.tt.success
				send_interface_toast = {
					title = coronation_events.1000.epic_rap_battle.tt.success
					left_icon = scope:bard
					custom_tooltip = coronation_tt_positive_tiny
					scope:activity = { activity_special_type_progression_tiny = yes }
					coronation_add_magnificence_log_effect = {
						VALUE = flag:positive_tiny
						CHAR = root
					}
				}
			}
			# the bard destroys you
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = coronation_events.1000.epic_rap_battle.tt.failure
				send_interface_toast = {
					title = coronation_events.1000.epic_rap_battle.tt.failure
					left_icon = scope:bard
					add_prestige = minor_prestige_loss
				}
			}
		}
		stress_impact = {
			shy = medium_stress_impact_gain
  		}
		ai_chance = {
  			base = 50
  			modifier = {
				factor = 0
				diplomacy < 15
			}
			modifier = {
				factor = 0
				has_trait = shy
			}
  		}
	}

	# remove the bard by force
	option = {
		name = coronation_events.1000.guards
		if = {
			limit = {
				scope:bard = {
					is_ai = yes
				}
			}
			rightfully_imprison_character_less_verbose_effect = {
				TARGET = scope:bard
				IMPRISONER = root
			}
		}

		add_dread = medium_dread_gain
		stress_impact = {
			humble = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
  		}
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = humble
				}
			}
			ai_value_modifier = {
				ai_vengefulness = 50
			}
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes

		if = {
			limit = {
				has_character_flag = low_county_opinion
			}
			remove_character_flag = low_county_opinion
		}
		if = {
			limit = {
				has_character_flag = has_rival
			}
			remove_character_flag = has_rival
		}
		if = {
			limit = {
				has_character_flag = tyrant
			}
			remove_character_flag = tyrant
		}
	}
}

# Crown has disappeared!
coronation_events.1002 = {
	type = activity_event
	title = coronation_events.1002.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:rival
				}
				desc = coronation_events.1002.rival.desc
			}
			desc = coronation_events.1002.desc
		}
	}
	left_portrait = {
		trigger = { exists = scope:rival }
		character = scope:rival
		animation = schadenfreude
	}

	right_portrait = {
		character = scope:helper
		animation = worry
	}

	center_portrait = {
		character = root
		animation = survey
		camera = camera_event_left
	}
	theme = coronation_activity
	cooldown = { years = 5 }
	override_background = {
		reference = sitting_room
	}

	trigger = {
		scope:activity = {
			any_guest_subset = {
				name = supporter
			}
		}
		OR = {
			stewardship < 9
			scope:activity = {
				any_attending_character = {
					has_relation_rival = root
				}
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		root.involved_activity = { save_scope_as = activity }
		scope:activity = {
			random_attending_character = {
				limit = {
					has_relation_rival = root
				}
				save_scope_as = rival
			}

			random_guest_subset = {
				name = supporter
				save_scope_as = helper
			}
		}
	}

	# organize the mess
	option = {
		name = coronation_events.1002.find
		trigger = {
			stewardship >= high_skill_rating
		}

		add_stewardship_lifestyle_xp = medium_lifestyle_xp
		custom_tooltip = coronation_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}

		ai_chance = {
  			base = 50
  			modifier = {
				factor = 0
				intrigue > stewardship
			}
  		}
	}

	# counterfeit the missing thing
	option = {
		name = coronation_events.1002.counterfeit
		trigger = {
			intrigue >= high_skill_rating
		}

		add_intrigue_lifestyle_xp = medium_lifestyle_xp
		custom_tooltip = coronation_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}

		ai_chance = {
  			base = 50
  			modifier = {
				factor = 0
				stewardship > intrigue
			}
  		}
	}

	# lash the servants
	option = {
		name = coronation_events.1002.hold
		trigger = {
			NOT = {
				exists = scope:rival
			}
		}

		add_dread = minor_dread_gain
		custom_tooltip = coronation_tt_negative
 		scope:activity = { activity_special_type_progression_negative = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:negative
			CHAR = root
		}

		stress_impact = {
			compassionate = minor_stress_impact_gain
			wrathful = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
  		}

  		ai_chance = {
  			base = 0
  			modifier = {
				factor = 50
				OR = {
					AND = {
						intrigue < 10
						stewardship < 12
					}
					OR = {
						has_trait = sadistic
						has_trait = wrathful
					}
				}
			}
  		}
	}

	# Well you...
	option = {
		name = coronation_events.1002.accuse
		flavor = coronation_events.1002.accuse.flavor
		trigger = {
			exists = scope:rival
		}

		scope:rival = {
			increase_wounds_no_death_effect = { REASON = fight }
		}
		if = {
			limit = {
				OR = {
					scope:rival = { is_ai = yes }
					AND = {
						scope:rival = {
							is_ai = no
						}
						is_ai = no
					}
				}
			}
			progress_towards_nemesis_effect = {
				REASON = rival_crown_stolen
				CHARACTER = scope:rival
				OPINION = 0
			}
		}

		stress_impact = {
			wrathful = minor_stress_impact_loss
			calm = minor_stress_impact_gain
  		}

  		ai_chance = {
  			base = 0
  			modifier = {
				factor = 50
				has_trait = wrathful
			}
			ai_value_modifier = {
				ai_vengefulness = 50
			}
  		}
	}

	# you got a friend in me
	option = {
		name = coronation_events.1002.friend
		trigger = {
			scope:helper ?= {
				intrigue >= 12
			}
		}

		custom_tooltip = coronation_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}
		if = {
			limit = {
				reverse_opinion = {
					target = scope:helper
					value >= 30
				}
				OR = {
					scope:helper = { is_ai = yes }
					AND = {
						scope:helper = {
							is_ai = no
						}
						is_ai = no
					}
				}
			}
			progress_towards_friend_effect = {
				REASON = friend_help_with_crown
				CHARACTER = scope:helper
				OPINION = 20
			}
		}
		else = {
			reverse_add_opinion = {
				target = scope:helper
				modifier = friendliness_opinion
				opinion = 25
			}
		}
		coronation_move_towards_supporter_effect = { CHARACTER = scope:helper }

		ai_chance = {
  			base = 50
  			modifier = {
				add = 50
				has_trait = gregarious
			}
			ai_value_modifier = {
				ai_vengefulness = -50
			}
  		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# Guest overhears some pretty secret conversation (feast shared event)
coronation_events.1004 = {
	type = activity_event
	title = coronation_events.1004.t
	desc = coronation_events.1004.desc
	right_portrait = {
		character = scope:spy
		camera = camera_event_right
		animation = war_over_tie
	}

	center_portrait = {
		character = scope:confidant
		camera = camera_event_right
		animation = flirtation_left
	}

	left_portrait = {
		character = root
		animation = worry
		camera = camera_event_left
	}

	theme = feast_activity

	cooldown = { years = 5 }

	trigger = {
		is_ruler = yes
		scope:activity = {
			any_attending_character = {
				is_ai = yes
				is_adult = yes
				NOT = {
					this = root
				}
				any_secret = {
					is_known_by = root
				}
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity.activity_host ?= { save_scope_as = host }
		scope:activity = {
			random_attending_character = {
				limit = {
					is_ai = yes
					is_adult = yes
					NOT = {
						this = root
					}
					any_secret = {
						is_known_by = root
					}
				}
				save_scope_as = confidant
			}
		}

		random_known_secret = {
			limit = {
				secret_owner = scope:confidant
				is_known_by = root
			}

			save_scope_as = secret_to_reveal
		}

		create_character = {
			template = intrigue_court_position_holder_template
			location = root.location
			faith = scope:activity.activity_location.faith
			culture = scope:activity.activity_location.culture
			gender_female_chance = 50
			save_scope_as = spy
		}
		scope:spy = {
			add_to_activity_without_travel = scope:activity
		}
	}

	# bribe the spy
	option = {
		name = coronation_events.1004.bribe
		trigger = {
			short_term_gold >= activity_minor_gold_value
			NOT = { intrigue >= high_skill_rating }
		}
		pay_short_term_gold = {
			target = scope:spy
			gold = activity_minor_gold_value
		}
		if = {
			limit = {
				reverse_opinion = {
					target = scope:confidant
					value > 30
				}
				OR = {
					scope:confidant = { is_ai = yes }
					AND = {
						scope:confidant = {
							is_ai = no
						}
						is_ai = no
					}
				}
			}
			progress_towards_friend_effect = {
				REASON = friend_kept_secret
				CHARACTER = scope:confidant
				OPINION = 20
			}
		}
		else = {
			reverse_add_opinion = {
				target = scope:confidant
				modifier = trust_opinion
				opinion = 25
			}
		}
		if = {
			limit = {
				this = scope:host
			}
			coronation_move_towards_supporter_effect = { CHARACTER = scope:confidant }
		}

		stress_impact = {
			greedy = medium_stress_impact_gain
  		}
  		ai_chance = {
  			base = 50
  			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					short_term_gold < activity_minor_gold_value
				}
			}
  		}
	}

	# wow, cool. Come work for me.
	option = {
		name = coronation_events.1004.recruit
		trigger = {
			intrigue >= high_skill_rating
		}
		add_courtier = scope:spy
		scope:secret_to_reveal = {
			reveal_to = scope:spy
		}
		ai_chance = {
  			base = 50
  			ai_value_modifier = {
				ai_sociability = 50
			}
  			modifier = {
				factor = 0
				has_trait = paranoid
			}
  		}
	}

	# not so fast, you little rat!
	option = {
		name = coronation_events.1004.intimidation
		duel = {
			skills = { intrigue prowess }
			target = scope:spy
			# the spy cowers
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = coronation_events.1004.intimidation.tt.success
				send_interface_toast = {
					title = coronation_events.1004.intimidation.tt.success
					left_icon = scope:spy
					add_dread = minor_dread_gain
					if = {
						limit = {
							reverse_opinion = {
								target = scope:confidant
								value > 30
							}
							OR = {
								scope:confidant = { is_ai = yes }
								AND = {
									scope:confidant = {
										is_ai = no
									}
									is_ai = no
								}
							}
						}
						progress_towards_friend_effect = {
							REASON = friend_kept_secret
							CHARACTER = scope:confidant
							OPINION = 20
						}
					}
					else = {
						reverse_add_opinion = {
							target = scope:confidant
							modifier = trust_opinion
							opinion = 25
						}
					}
					if = {
						limit = {
							this = scope:host
						}
						coronation_move_towards_supporter_effect = { CHARACTER = scope:confidant }
					}
				}
			}
			# the spy scoffs
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = coronation_events.1004.intimidation.tt.failure
				send_interface_toast = {
					title = coronation_events.1004.intimidation.tt.failure
					left_icon = scope:spy
					scope:secret_to_reveal = {
						expose_secret = scope:spy
					}
				}
			}
		}
		ai_chance = {
  			base = 50
  			modifier = {
				factor = 0
				OR = {
				 intrigue < 15
				 prowess < 15
				}
			}
  		}
	}

	# call the guards
	option = {
		name = coronation_events.1004.guards
		trigger = {
			this = scope:host
		}
		rightfully_imprison_character_less_verbose_effect = {
			TARGET = scope:spy
			IMPRISONER = root
		}

		scope:secret_to_reveal = {
			reveal_to = scope:spy
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = 50
			}
		}
	}

	# opt-out
	option = {
		name = coronation_events.1004.opt-out
		trigger = {
			this != scope:host
		}

		scope:secret_to_reveal = {
			expose_secret = scope:spy
		}

		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				scope:secret_to_reveal.secret_owner = {
					OR = {
						is_of_major_interest_to_root_trigger = yes
						is_of_minor_interest_to_root_trigger = yes
					}
				}
			}
		}
	}
	after = {
		# For MP
		coronation_ready_effect = yes

		if = {
			limit = {
				is_ai = yes
			}
			scope:spy ?= {
				if = {
					limit = {
						NOT = {
							is_courtier_of = root
							is_imprisoned_by = root
						}
					}
					silent_disappearance_effect = yes
				}
			}
		}
	}
}

# two guests arguing to see who goes in first
coronation_events.1007 = {
	type = activity_event
	title = coronation_events.1007.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					this = scope:host
				}
				desc = coronation_events.1007.desc
			}
			desc = coronation_events.1007.guest.desc
		}
	}
	left_portrait = {
		character = scope:host
		camera = camera_event_chariot_very_left_hippodrome
		animation = schadenfreude
	}

	center_portrait = {
		character = scope:first_guest
		scripted_animation = {
				triggered_animation = {
					trigger = {
						OR = {
							scope:first_guest = { number_of_commander_traits >= 1 }
							scope:first_guest = { is_knight = yes }
						}
					}
					animation = marshal_random_weapon
				}
			animation = disapproval
		}
	}

	right_portrait = {
		character = scope:second_guest
		animation = interested
	}
	theme = coronation_activity

	override_background = {
		trigger = {
			#Don't want Constantinople background for depth perspective chars
			location.county = title:c_byzantion
		}
		reference = bp2_courtyard
	}

	cooldown = { years = 5 }

	trigger = {
		scope:activity = {
			any_attending_character = {
				is_ai = yes
				is_adult = yes
				OR = {
					is_of_major_interest_trigger = { CHARACTER = scope:activity.activity_host }
					is_of_minor_interest_trigger = { CHARACTER = scope:activity.activity_host }
				}
				NOR = {
					this = root
					this = scope:activity.activity_host
				}
				count >= 2
			}
		}
		trigger_if = {
			limit = {
				NOT = {
					this = scope:activity.activity_host
				}
			}
			OR = {
				is_of_major_interest_trigger = { CHARACTER = scope:activity.activity_host }
				is_of_minor_interest_trigger = { CHARACTER = scope:activity.activity_host }
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity.activity_host ?= { save_scope_as = host }

		if = {
			limit = {
				this = scope:host
			}
			scope:activity = {
				random_attending_character = {
					limit = {
						is_ai = yes
						is_adult = yes
						NOR = {
							this = root
							this = scope:host
						}
						is_of_major_interest_trigger = { CHARACTER = scope:activity.activity_host }
					}
					alternative_limit = {
						is_ai = yes
						is_adult = yes
						NOR = {
							this = root
							this = scope:host
						}
						is_of_minor_interest_trigger = { CHARACTER = scope:activity.activity_host }
					}
					save_scope_as = first_guest
				}
			}
			scope:activity = {
				random_attending_character = {
					limit = {
						is_ai = yes
						is_adult = yes
						NOR = {
							this = root
							this = scope:host
							this = scope:first_guest
						}
						is_of_major_interest_trigger = { CHARACTER = scope:activity.activity_host }
					}
					alternative_limit = {
						is_ai = yes
						is_adult = yes
						NOR = {
							this = root
							this = scope:host
							this = scope:first_guest
						}
						is_of_minor_interest_trigger = { CHARACTER = scope:activity.activity_host }
					}
					save_scope_as = second_guest
				}
			}
		}
		else = {
			save_scope_as = first_guest
			scope:activity = {
				random_attending_character = {
					limit = {
						is_ai = yes
						is_adult = yes
						NOR = {
							this = root
							this = scope:host
							this = scope:first_guest
						}
						is_of_major_interest_trigger = { CHARACTER = involved_activity.activity_host }
					}
					alternative_limit = {
						is_ai = yes
						is_adult = yes
						NOR = {
							this = root
							this = scope:host
							this = scope:first_guest
						}
						is_of_minor_interest_trigger = { CHARACTER = involved_activity.activity_host }
					}
					save_scope_as = second_guest
				}
			}
		}
	}

	# guest option: be the bigger person
	option = {
		trigger = {
			root = scope:first_guest
		}
		name = coronation_events.1007.bigger

		add_piety = minor_piety_gain

		stress_impact = {
			arbitrary = minor_stress_impact_gain
			impatient = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = -50
			}
		}
	}

	# guest option: demand to go first
	option = {
		trigger = {
			root = scope:first_guest
		}
		name = coronation_events.1007.demand
		if = {
			limit = {
				OR = {
					scope:second_guest = { is_ai = yes }
					AND = {
						scope:second_guest = {
							is_ai = no
						}
						is_ai = no
					}
				}
			}
			progress_towards_rival_effect = {
				REASON = rival_demanded_to_go_first
				CHARACTER = scope:second_guest
				OPINION = 0
			}
		}

		stress_impact = {
			patient = minor_stress_impact_gain
			temperate = minor_stress_impact_gain
			content = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = 50
			}
		}
	}

	# host option: diplo solution
	option = {
		trigger = {
			root = scope:host
			diplomacy >= high_skill_rating
		}
		show_as_unavailable = {
			diplomacy < high_skill_rating
			root = scope:host
		}
		name = coronation_events.1007.appease
		custom_tooltip = coronation_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}
		scope:first_guest = {
			add_opinion = {
				target = root
				modifier = impressed_opinion
				opinion = 15
			}
		}
		scope:second_guest = {
			add_opinion = {
				target = root
				modifier = impressed_opinion
				opinion = 15
			}
		}
		stress_impact = {
			impatient = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = diplomacy
			}
			modifier = {
			add = -20
				OR = {
					has_trait = impatient
					has_trait = callous
					has_trait = lazy
				}
			}
		}
	}

	# host option: choose first guest
	option = {
		trigger = {
			root = scope:host
		}
		name = coronation_events.1007.first_guest

		if = {
			limit = {
				can_add_hook = {
					type = favor_hook
					target = scope:first_guest
				}
			}
			add_hook = {
				type = favor_hook
				target = scope:first_guest
			}
		}
		reverse_add_opinion = {
			target = scope:first_guest
			modifier = grateful_opinion
			opinion = 25
		}
		if = {
			limit = {
				this = scope:host
			}
			coronation_move_towards_supporter_effect = { CHARACTER = scope:first_guest }
		}


		stress_impact = {
			impatient = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			opinion_modifier = {
				opinion_target = scope:first_guest
				multiplier = 0.5
			}
			modifier = {
				scope:second_guest.current_military_strength > scope:first_guest.current_military_strength
				add = -50
			}
		}
	}

	# host option: choose second guest
	option = {
		trigger = {
			root = scope:host
		}
		name = coronation_events.1007.second_guest

		if = {
			limit = {
				can_add_hook = {
					type = favor_hook
					target = scope:second_guest
				}
			}
			add_hook = {
				type = favor_hook
				target = scope:second_guest
			}
		}

		reverse_add_opinion = {
			target = scope:second_guest
			modifier = grateful_opinion
			opinion = 25
		}

		if = {
			limit = {
				this = scope:host
			}
			coronation_move_towards_supporter_effect = { CHARACTER = scope:second_guest }
		}

		stress_impact = {
			impatient = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			opinion_modifier = {
				opinion_target = scope:second_guest
				multiplier = 0.5
			}
			modifier = {
				scope:first_guest.current_military_strength > scope:second_guest.current_military_strength
				add = -50
			}
		}
	}

	#opt-out
	option = {
		trigger = {
			root = scope:host
		}
		name = coronation_events.1007.opt_out

		stress_impact = {
			base = minor_stress_impact_loss
			patient = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
			diligent = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			modifier = {
			add = 20
				OR = {
					has_trait = impatient
					has_trait = callous
					has_trait = lazy
				}
			}
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

scripted_effect coronation_events_1011_reward_effect = {
    switch = {
    	trigger = has_trait
        education_$SKILL$_1 = {
            scope:ancestor_artifact = {
                add_artifact_modifier = artifact_monthly_$SKILL$_lifestyle_xp_1_modifier
            }
        }
        education_$SKILL$_2 = {
            scope:ancestor_artifact = {
                add_artifact_modifier = artifact_monthly_$SKILL$_lifestyle_xp_2_modifier
            }
        }
        education_$SKILL$_3 = {
            scope:ancestor_artifact = {
                add_artifact_modifier = artifact_monthly_$SKILL$_lifestyle_xp_3_modifier
            }
        }
        education_$SKILL$_4 = {
            scope:ancestor_artifact = {
                add_artifact_modifier = artifact_monthly_$SKILL$_lifestyle_xp_4_modifier
            }
        }
        education_$SKILL$_5 = {
            scope:ancestor_artifact = {
                add_artifact_modifier = artifact_monthly_$SKILL$_lifestyle_xp_4_modifier
                #add_artifact_modifier = artifact_$SKILL$_per_prestige_level_modifier
            }
        }
    }
    custom_tooltip = coronation_events.1011.root_reward.tt
}

# decide upon new bonuses for your crown
coronation_events.1011 = {
	type = activity_event
	title = coronation_events.1011.t
	desc = coronation_events.1011.desc
	override_background = {
		reference = relaxing_room
	}
	left_portrait = {
		character = root
		animation = admiration
		camera = camera_event_center
	}
	right_portrait = {
		character = scope:priest
		animation = crowning
	}

	lower_right_portrait = {
		character = scope:previous_holder
	}

	artifact = {
		position = lower_left_portrait
		target = scope:ancestor_artifact
		trigger = { exists = scope:ancestor_artifact }
	}
	theme = coronation_activity

	cooldown = { years = 5 }

	trigger = {
		coronation_living_officiator_trigger = yes
		has_activity_intent = coronation_exalt_crown
		exists = primary_title.previous_holder
		primary_title.previous_holder = {
			has_same_education_trait_as_root_trigger = no
		}
		trigger_if = {
			limit = {
				coronation_proper_artifact_crown_trigger = yes
			}
			any_character_artifact = {
				artifact_slot_type = helmet
			}
		}
		trigger_else_if = {
			limit = {
				coronation_proper_artifact_regalia_trigger = yes
			}
			any_character_artifact = {
				artifact_slot_type = regalia
			}
		}
		trigger_else = {
			any_character_artifact = {
				OR = {
					artifact_slot_type = helmet
					artifact_slot_type = regalia
				}
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		involved_activity.var:officiator ?= {
			save_scope_as = priest
		}
		if = {
			limit = {
				coronation_proper_artifact_crown_trigger = yes
			}
			random_character_artifact = {
				limit = {
					artifact_slot_type = helmet
				}
				save_scope_as = ancestor_artifact
			}
		}
		else_if = {
			limit = {
				coronation_proper_artifact_regalia_trigger = yes
			}
			random_character_artifact = {
				limit = {
					artifact_slot_type = regalia
				}
				save_scope_as = ancestor_artifact
			}
		}
		else = {
			random_character_artifact = {
				limit = {
					OR = {
						artifact_slot_type = helmet
						artifact_slot_type = regalia
					}
				}
				save_scope_as = ancestor_artifact
			}
		}

		primary_title = {
			previous_holder ?= { save_scope_as = previous_holder }
		}
	}

	# refit
	option = {
		name = coronation_events.1011.refit
		add_prestige = medium_prestige_gain
		switch = {
			trigger = has_trait
		    education_diplomacy = {
		        coronation_events_1011_reward_effect = { SKILL = diplomacy }
		    }
		    education_martial = {
		        coronation_events_1011_reward_effect = { SKILL = martial }
		    }
		    education_stewardship = {
		        coronation_events_1011_reward_effect = { SKILL = stewardship }
		    }
		    education_intrigue = {
		        coronation_events_1011_reward_effect = { SKILL = intrigue }
		    }
		    education_learning = {
		        coronation_events_1011_reward_effect = { SKILL = learning }
		    }
		}

		stress_impact = {
			humble = minor_stress_impact_gain
  		}

  		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = -50
			}
		}
	}

	# roll with it
	option = {
		name = coronation_events.1011.previous
		if = {
			limit =	{
				exists = root.dynasty
				scope:previous_holder = {
					dynasty ?= root.dynasty
				}
			}
			dynasty = { add_dynasty_prestige = miniscule_dynasty_prestige_gain }
		}
		else = {
			add_legitimacy = miniscule_legitimacy_gain
		}
		scope:previous_holder = {
			switch = {
			trigger = has_trait
			    education_diplomacy = {
			        coronation_events_1011_reward_effect = { SKILL = diplomacy }
			    }
			    education_martial = {
			        coronation_events_1011_reward_effect = { SKILL = martial }
			    }
			    education_stewardship = {
			        coronation_events_1011_reward_effect = { SKILL = stewardship }
			    }
			    education_intrigue = {
			        coronation_events_1011_reward_effect = { SKILL = intrigue }
			    }
			    education_learning = {
			        coronation_events_1011_reward_effect = { SKILL = learning }
			    }
			}
		}

		stress_impact = {
			ambitious = medium_stress_impact_gain
  		}

  		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 50
			}
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}


# Main dish in the banquet is undercooked (feast shared event)
coronation_events.1012 = {
	type = activity_event
	title = coronation_events.1012.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					this = scope:host
				}
				desc = coronation_events.1012.host.desc
			}
			desc = coronation_events.1012.guest.desc
		}
	}
	center_portrait = {
		character = scope:guest
		camera = camera_event_center
		animation = anger
	}

	left_portrait = {
		character = scope:host
		animation = stunned
		camera = camera_event_left
	}

	theme = feast_activity

	cooldown = { years = 5 }

	trigger = {
		is_vegetarian_trigger = no
		trigger_if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_coronation
				}
			}
			scope:activity = {
				has_activity_option = {
					category = ceremony_feast_type
					option = ceremony_feast_type_austere
				}
			}
		}
		trigger_if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_feast
				}
			}
			scope:activity = {
					has_activity_option = {
					category = feast_option_food
					option = feast_food_bad
				}
			}
		}
		# to avoid getting similar accident-adjacent events in succession
		NOT = {
			has_character_flag = poor_activity_option_accident
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		add_character_flag = {
			flag = poor_activity_option_accident
			years = 5
		}
		scope:activity.activity_host ?= { save_scope_as = host }

		if = {
			limit = {
				this = scope:host
			}
			scope:activity = {
				random_attending_character = {
					limit = {
						is_ai = yes
						is_adult = yes
						NOT = {
							this = root
						}
					}
					save_scope_as = guest
				}
			}
		}
		else = {
			save_scope_as = guest
		}
	}

	# EAT IT.
	option = {
		name = coronation_events.1012.eat_it
		trigger = {
			this = scope:host
			has_activity_intent = coronation_weaken_detractors
			scope:guest = {
				is_in_guest_subset = { name = detractor }
			}
		}

		scope:guest = {
			show_as_tooltip = { add_trait = ill }
			hidden_effect = {
				trigger_event = {
					id = health.1001
					days = { 3 10 }
				}
			}
		}
		if = {
			limit = {
				OR = {
					scope:guest = { is_ai = yes }
					AND = {
						scope:guest = {
							is_ai = no
						}
						is_ai = no
					}
				}
			}
			progress_towards_rival_effect = {
				REASON = rival_forced_bad_food
				CHARACTER = scope:guest
				OPINION = -20
			}
		}

		coronation_weaken_detractors_opinion_effect = yes

		stress_impact = {
			vengeful = minor_stress_impact_loss
			callous = minor_stress_impact_loss
  		}

  		ai_chance = {
  			base = 50
			modifier = {
				add = 20
				OR = {
					has_trait = vengeful
					has_trait = callous
				}
			}
  		}
	}

	# send back
	option = {
		name = coronation_events.1012.back
		trigger = {
			this = scope:host
		}

		reverse_add_opinion = {
			target = scope:guest
			modifier = grateful_opinion
			opinion = 25
		}
		coronation_move_towards_supporter_effect = { CHARACTER = scope:guest }

		custom_tooltip = coronation_tt_negative
 		scope:activity = { activity_special_type_progression_negative = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:negative
			CHAR = root
		}

		stress_impact = {
			temperate = minor_stress_impact_loss
			gluttonous = medium_stress_impact_gain
  		}

  		ai_chance = {
  			base = 50
  			modifier = {
				factor = 0
				has_trait = gluttonous
			}
			modifier = {
				add = 20
				has_trait = temperate
			}
  		}
	}

	# new trend
	option = {
		name = coronation_events.1012.trend
		trigger = {
			this = scope:host
			stewardship >= high_skill_rating
		}
		show_as_unavailable = {
			this = scope:host
			stewardship < high_skill_rating
		}

		random = {
			chance = 10
			show_as_tooltip = { add_trait = ill }
			hidden_effect = {
				trigger_event = {
					id = health.1001
					days = { 3 10 }
				}
			}
		}
		if = {
        	limit = {
        		government_allows = administrative
        		top_liege = scope:activity.activity_host
        	}
        	change_influence = minor_influence_gain
        }
        else = {
        	add_prestige = minor_prestige_gain
        }
		ai_chance = {
  			base = 0
  		}
	}

	# complain
	option = {
		name = coronation_events.1012.complain
		trigger = {
			this = scope:guest
		}

		if = {
        	limit = {
        		government_allows = administrative
        		top_liege = scope:activity.activity_host
        	}
        	change_influence = minor_influence_gain
        }
        else = {
        	add_prestige = minor_prestige_gain
        }

		stress_impact = {
			base = minor_stress_impact_gain
			gluttonous = medium_stress_impact_gain
  		}

  		ai_chance = {
  			base = 50
  			modifier = {
				factor = 0
				has_trait = gluttonous
			}
  		}
	}

	# just munch down
	option = {
		name = coronation_events.1012.munch
		trigger = {
			this = scope:guest
		}

		random = {
			chance = 10
			show_as_tooltip = { add_trait = ill }
			hidden_effect = {
				trigger_event = {
					id = health.1001
					days = { 3 10 }
				}
			}
		}

		scope:host = {
			add_opinion = {
				target = root
				modifier = friendliness_opinion
				opinion = 20
			}
		}

		stress_impact = {
			gluttonous = medium_stress_impact_loss
  		}

  		ai_chance = {
  			base = 0
  			modifier = {
				factor = 50
				has_trait = gluttonous
			}
  		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# A torch accident sets something on fire (feast shared event)
coronation_events.1013 = {
	type = activity_event
	title = coronation_events.1013.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					this = scope:host
				}
				desc = coronation_events.1013.host.desc
			}
			desc = coronation_events.1013.guest.desc
		}
	}
	right_portrait = {
		character = scope:guest
		camera = camera_event_right
		animation = drink
	}

	center_portrait = {
		character = root
		animation = shock
		camera = camera_event_left
	}

	theme = feast_activity

	cooldown = { years = 5 }

	override_effect_2d = {
		reference = smoke
	}

	trigger = {
		trigger_if = {
			limit = {
				involved_activity = {
					has_activity_type = activity_coronation
				}
			}
			involved_activity = {
				has_activity_option = {
					category = ceremony_feast_type
					option = ceremony_feast_type_austere
				}
			}
		}
		trigger_if = {
			limit = {
				involved_activity = {
					has_activity_type = activity_feast
				}
			}
			involved_activity = {
					has_activity_option = {
					category = feast_option_food
					option = feast_food_bad
				}
			}
		}
		# to avoid getting similar accident-adjacent events in succession
		NOT = {
			has_character_flag = poor_activity_option_accident
		}
		involved_activity = {
			any_attending_character = {
				is_ai = yes
				is_adult = yes
				NOR = {
					this = root
					this = scope:host
					involved_activity.var:officiator ?= this
				}
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity.activity_host ?= { save_scope_as = host }
		add_character_flag = {
			flag = poor_activity_option_accident
			years = 5
		}

		if = {
			limit = {
				this = scope:host
			}
			custom_tooltip = coronation_tt_negative
 			scope:activity = { activity_special_type_progression_negative = yes }
			coronation_add_magnificence_log_effect = {
				VALUE = flag:negative
				CHAR = root
			}

		}
		if = {
			limit = {
				is_ai = yes
			}
			scope:activity = {
				random_attending_character = {
					limit = {
						is_ai = yes
						is_adult = yes
						NOR = {
							this = root
							this = scope:host
							involved_activity.var:officiator ?= this
						}
					}
					save_scope_as = guest
				}
			}
		}
		else = {
			scope:activity = {
				random_attending_character = {
					limit = {
						is_ai = yes
						is_adult = yes
						NOT = {
							this = root
						}
					}
					save_scope_as = guest
				}
			}
		}
	}

	# burn!
	option = {
		name = coronation_events.1013.burn
		trigger = {
			OR = {
				AND = {
					root = scope:host
					has_activity_intent = coronation_weaken_detractors
					scope:guest = {
						is_in_guest_subset = { name = detractor }
					}
				}
				AND = {
					NOT = {
						this = scope:host
					}
					has_activity_intent = coronation_offer_support
					scope:guest = {
						is_in_guest_subset = { name = detractor }
					}
				}
				AND = {
					NOT = {
						this = scope:host
					}
					has_activity_intent = coronation_disrupt_loyalists
					scope:guest = {
						is_in_guest_subset = { name = supporter }
					}
				}
			}
		}

		scope:guest = {
			increase_wounds_no_death_effect = { REASON = burned }
		}

		if = {
			limit = {
				this = scope:host
			}
			custom_tooltip = coronation_tt_negative
 			scope:activity = { activity_special_type_progression_negative = yes }
			coronation_add_magnificence_log_effect = {
				VALUE = flag:negative
				CHAR = root
			}
		}

		if = {
			limit = {
				has_activity_intent = coronation_weaken_detractors
			}
			coronation_weaken_detractors_opinion_effect = yes
		}

		stress_impact = {
			base = medium_stress_impact_loss
  		}

  		ai_chance = {
  			base = 50
  		}
	}

	# make sure guest doesn't get hurt
	option = {
		name = coronation_events.1013.hero
		trigger = {
			OR = {
				has_trait = brave
				has_trait = compassionate
				has_trait = reckless
				AND = {
					root = scope:host
					has_activity_intent = coronation_embrace_supporters
					scope:guest = {
						is_in_guest_subset = { name = supporter }
					}
				}
				AND = {
					root = scope:host
					has_activity_intent = coronation_impress_attendees
				}
			}
		}

		increase_wounds_no_death_effect = { REASON = burned }

		add_prestige = medium_prestige_gain

		if = {
			limit = {
				root = scope:host
				has_activity_intent = coronation_impress_attendees
			}
			custom_tooltip = coronation_tt_positive_tiny
			scope:activity = { activity_special_type_progression_tiny = yes }
			coronation_add_magnificence_log_effect = {
				VALUE = flag:positive_tiny
				CHAR = root
			}
		}

		if = {
			limit = {
				has_activity_intent = coronation_embrace_supporters
				scope:guest = {
					is_in_guest_subset = { name = supporter }
				}
			}
			if = {
				limit = {
					OR = {
						scope:guest = { is_ai = yes }
						AND = {
							scope:guest = {
								is_ai = no
							}
							is_ai = no
						}
					}
				}
				progress_towards_friend_effect = {
					REASON = friend_saved_fire
					CHARACTER = scope:guest
					OPINION = 20
				}
			}
			coronation_embrace_supporters_opinion_effect = yes
		}

		stress_impact = {
			brave = medium_stress_impact_loss
  		}

  		ai_chance = {
  			base = 50
  		}
	}

	# snuff out the fire
	option = {
		name = coronation_events.1013.snuff_out
		trigger = {
			learning >= high_skill_rating
		}
		show_as_unavailable = {
			learning < high_skill_rating
		}
		if = {
			limit = {
				OR = {
					is_ai = no
					this = scope:activity.activity_host
					is_in_guest_subset = { name = supporter }
					has_activity_intent = coronation_offer_support
				}
			}
			custom_tooltip = coronation_tt_positive_tiny
			scope:activity = { activity_special_type_progression_tiny = yes }
			coronation_add_magnificence_log_effect = {
				VALUE = flag:positive_tiny
				CHAR = root
			}
		}
		if = {
			limit = {
				has_activity_intent = coronation_embrace_supporters
				scope:guest = {
					is_in_guest_subset = { name = supporter }
				}
			}
			if = {
				limit = {
					OR = {
						scope:guest = { is_ai = yes }
						AND = {
							scope:guest = {
								is_ai = no
							}
							is_ai = no
						}
					}
				}
				progress_towards_friend_effect = {
					REASON = friend_saved_fire
					CHARACTER = scope:guest
					OPINION = 20
				}
			}
			coronation_embrace_supporters_opinion_effect = yes
		}
		add_learning_lifestyle_xp = medium_lifestyle_xp
		stress_impact = {
			brave = minor_stress_impact_loss
			craven = minor_stress_impact_gain
  		}
  		ai_chance = {
  			base = 100
  			modifier = {
				factor = 0
				has_trait = craven
			}
			modifier = {
				add = 25
				has_trait = brave
			}
  		}
	}

	# effortlessly douse the fire
	option = {
		name = coronation_events.1013.douse
		trigger = {
			prowess >= high_skill_rating
		}
		show_as_unavailable = {
			prowess < high_skill_rating
		}
		add_prestige = minor_prestige_gain
		if = {
			limit = {
				OR = {
					is_ai = no
					this = scope:activity.activity_host
					is_in_guest_subset = { name = supporter }
					has_activity_intent = coronation_offer_support
				}
			}
			custom_tooltip = coronation_tt_positive_tiny
			scope:activity = { activity_special_type_progression_tiny = yes }
			coronation_add_magnificence_log_effect = {
				VALUE = flag:positive_tiny
				CHAR = root
			}
		}
		if = {
			limit = {
				has_activity_intent = coronation_embrace_supporters
				scope:guest = {
					is_in_guest_subset = { name = supporter }
				}
			}
			if = {
				limit = {
					OR = {
						scope:guest = { is_ai = yes }
						AND = {
							scope:guest = {
								is_ai = no
							}
							is_ai = no
						}
					}
				}
				progress_towards_friend_effect = {
					REASON = friend_saved_fire
					CHARACTER = scope:guest
					OPINION = 20
				}
			}
			coronation_embrace_supporters_opinion_effect = yes
		}
		stress_impact = {
			brave = minor_stress_impact_loss
			craven = minor_stress_impact_gain
  		}
  		ai_chance = {
  			base = 100
  			modifier = {
				factor = 0
				has_trait = craven
			}
			modifier = {
				add = 25
				has_trait = brave
			}
  		}
	}

	# run!
	option = {
		name = coronation_events.1013.run

		scope:guest = {
			increase_wounds_no_death_effect = { REASON = burned }
		}

		add_prestige = minor_prestige_loss

		stress_impact = {
			brave = medium_stress_impact_gain
			craven = minor_stress_impact_loss
  		}

  		ai_chance = {
  			base = 100
  			modifier = {
				factor = 0
				has_trait = brave
			}
			modifier = {
				add = 25
				has_trait = craven
			}
  		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# Guests stampede over a rumor of food scarcity (feast shared event)
coronation_events.1014 = {
	type = activity_event
	title = coronation_events.1014.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					this = scope:host
				}
				desc = coronation_events.1014.host.desc
			}
			desc = coronation_events.1014.guest.desc
		}
	}
	right_portrait = {
		character = scope:guest
		camera = camera_event_left
		animation = disbelief
	}

	left_portrait = {
		character = root
		animation = paranoia
		camera = camera_event_left
	}

	theme = feast_activity

	cooldown = { years = 5 }

	trigger = {
		trigger_if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_feast
				}
			}
			scope:activity = {
					has_activity_option = {
					category = feast_option_food
					option = feast_food_bad
				}
			}
		}
		trigger_if = {
			limit = {
				scope:activity = {
					has_activity_type = activity_coronation
				}
			}
			scope:activity = {
					has_activity_option = {
						category = ceremony_feast_type
						option = ceremony_feast_type_austere
				}
			}
		}
		# to avoid getting similar accident-adjacent events in succession
		NOT = {
			has_character_flag = poor_activity_option_accident
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		add_character_flag = {
			flag = poor_activity_option_accident
			years = 5
		}
		scope:activity.activity_host ?= { save_scope_as = host }
		if = {
			limit = {
				this = scope:host
			}
			custom_tooltip = coronation_tt_negative
 			scope:activity = { activity_special_type_progression_negative = yes }
			coronation_add_magnificence_log_effect = {
				VALUE = flag:negative
				CHAR = root
			}
		}

		if = {
			limit = {
				is_ai = yes
			}
			scope:activity = {
				random_attending_character = {
					limit = {
						is_ai = yes
						is_adult = yes
						NOT = {
							this = root
							this = scope:host
							involved_activity.var:officiator ?= this
						}
					}
					save_scope_as = guest
				}
			}
		}
		else = {
			scope:activity = {
				random_attending_character = {
					limit = {
						is_ai = yes
						is_adult = yes
						NOT = {
							this = root
						}
					}
					save_scope_as = guest
				}
			}
		}
	}

	# join the stampede
	option = {
		name = coronation_events.1014.join

		random = {
			chance = 10
			increase_wounds_no_death_effect = { REASON = accident }
			if = {
				limit = {
					OR = {
						is_ai = no
						this = scope:activity.activity_host
						scope:activity = {
							is_target_in_variable_list = {
								name = major_detractor
								target = root
							}
						}
						has_activity_intent = coronation_disrupt_loyalists
					}
				}
				custom_tooltip = coronation_tt_negative
 				scope:activity = { activity_special_type_progression_negative = yes }
				coronation_add_magnificence_log_effect = {
					VALUE = flag:negative
					CHAR = root
				}
			}
		}
		hidden_effect = {
			change_current_weight = 20
		}
		add_character_modifier = {
			modifier = full_of_dessert_modifier
			years = 5
		}
		scope:guest = {
			increase_wounds_no_death_effect = { REASON = accident }
		}

		stress_impact = {
			base = minor_stress_impact_gain
			gluttonous = minor_stress_impact_loss
  		}
  		ai_chance = {
  			base = 0
  			modifier = {
				factor = 50
				has_trait = gluttonous
			}
  		}
	}

	# calm down the crowd
	option = {
		name = coronation_events.1014.calm
		trigger = {
			diplomacy >= high_skill_rating
		}
		show_as_unavailable = {
			diplomacy < high_skill_rating
		}
		if = {
			limit = {
				OR = {
					is_ai = no
					this = scope:activity.activity_host
					is_in_guest_subset = { name = supporter }
					has_activity_intent = coronation_offer_support
				}
			}
			coronation_add_magnificence_log_effect = {
				VALUE = flag:positive_tiny
				CHAR = root
			}
			custom_tooltip = coronation_tt_positive_tiny
			scope:activity = {
				activity_special_type_progression_tiny = yes
				every_attending_character = {
					limit = {
						NOR = { this = scope:host }
						this = root
					}
					custom = custom.every_attending_character
					add_opinion = {
						target = root
						modifier = impressed_opinion
						opinion = 15
					}
				}
			}
		}
		else = {
			scope:activity = {
				every_attending_character = {
					limit = { NOT = { this = scope:host } }
					custom = custom.every_attending_character
					add_opinion = {
						target = root
						modifier = impressed_opinion
						opinion = 15
					}
				}
			}
		}
		stress_impact = {
			brave = minor_stress_impact_loss
			craven = minor_stress_impact_gain
  		}
  		ai_chance = {
  			base = 50
  			modifier = {
				factor = 0
				has_trait = craven
			}
  		}
	}

	# run!
	option = {
		name = coronation_events.1014.run

		scope:guest = {
			increase_wounds_no_death_effect = { REASON = accident }
		}

		add_prestige = minor_prestige_loss

		stress_impact = {
			brave = medium_stress_impact_gain
			craven = minor_stress_impact_loss
  		}
  		ai_chance = {
  			base = 50
  			modifier = {
				add = 50
				has_trait = craven
			}
			modifier = {
				factor = 0
				has_trait = brave
			}
  		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# Friendly religious figure raises a toast in your name at your coronation banquet
coronation_events.1015 = {
	type = activity_event
	title = coronation_events.1015.t
	desc = coronation_events.1015.desc
	right_portrait = {
		character = scope:guest
		animation = toast
	}

	left_portrait = {
		character = root
		animation = drink
	}

	theme = feast_activity

	override_effect_2d = {
		reference = legend_glow
	}

	cooldown = { years = 5 }

	trigger = {
		piety_level >= high_piety_level
		drinks_alcohol_trigger = yes
		scope:activity = {
			any_attending_character = {
				is_ai = yes
				is_adult = yes
				NOT = {
					this = root
				}
				this.faith = root.faith
				drinks_alcohol_trigger = yes
				OR = {
					has_trait = zealous
					piety_level >= high_piety_level
				}
				is_clergy = yes
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity = {
			random_attending_character = {
				limit = {
					is_ai = yes
					is_adult = yes
					NOT = {
						this = root
					}
					is_clergy = yes
				}
				save_scope_as = guest
			}
		}
	}

	# hell yeah it's divine
	option = {
		name = coronation_events.1015.divine
		trigger = {
			has_activity_intent = coronation_impress_attendees
		}

		scope:activity = {
			custom_tooltip = coronation_tt_positive_tiny
			activity_special_type_progression_tiny = yes
			coronation_add_magnificence_log_effect = {
				VALUE = flag:positive_tiny
				CHAR = root
			}
			every_attending_character = {
				limit = {
					has_trait = zealous
					 NOT = { this = scope:host }
				}
				custom = custom.every_zealous_attending_character
				add_opinion = {
					target = root
					modifier = impressed_opinion
					opinion = 15
				}
			}
		}

		coronation_impress_attendees_opinion_effect = yes

		stress_impact = {
			shy = minor_stress_impact_gain
			gregarious = minor_stress_impact_loss
			cynical = minor_stress_impact_gain
			zealous = medium_stress_impact_loss
		}
		ai_chance = {
			base = 5
			ai_value_modifier = {
				ai_zeal = high_chance_impact_positive_ai_value
				ai_sociability = high_chance_impact_positive_ai_value
			}
		}
	}

	# cherish the toast
	option = {
		name = coronation_events.1015.cherish

		if = {
			limit = {
				reverse_opinion = {
					target = scope:guest
					value > 30
				}
				OR = {
					scope:guest = { is_ai = yes }
					AND = {
						scope:guest = {
							is_ai = no
						}
						is_ai = no
					}
				}
			}
			progress_towards_friend_effect = {
				REASON = friend_toasted_coronation
				CHARACTER = scope:guest
				OPINION = 20
			}
		}
		else = {
			reverse_add_opinion = {
				target = scope:guest
				modifier = grateful_opinion
				opinion = 25
			}
		}

		stress_impact = {
			base = minor_stress_impact_loss
			shy = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
			gregarious = minor_stress_impact_loss
			zealous = minor_stress_impact_loss
  		}
  		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_zeal = high_chance_impact_positive_ai_value
				ai_sociability = high_chance_impact_positive_ai_value
			}
			modifier = {
				stress_level >= 1
				add = 2
			}
		}
	}

	# the audacity
	option = {
		name = coronation_events.1015.hush

		add_dread = minor_dread_gain

		scope:guest = {
			add_stress = medium_stress_gain
		}

		stress_impact = {
			cynical = minor_stress_impact_loss
			gregarious = minor_stress_impact_gain
			zealous = medium_stress_impact_gain
  		}

		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_vengefulness = high_chance_impact_positive_ai_value
				ai_zeal = high_chance_impact_negative_ai_value
			}
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# You have the opportunity to raise a toast at your coronation banquet
coronation_events.1016 = {
	type = activity_event
	title = coronation_events.1016.t
	desc = coronation_events.1016.desc
	right_portrait = {
		character = scope:guest
		animation = wedding_drunk
		camera = camera_event_very_right
	}

	center_portrait = {
		character = scope:guest_2
		animation = drink_goblet
		camera = camera_event_right
	}

	left_portrait = {
		character = scope:host
		animation = toast_goblet
	}

	theme = feast_activity

	cooldown = { years = 5 }

	trigger = {
		scope:activity = {
			any_guest_subset = {
				name = detractor
				is_ai = yes
				OR = {
					is_of_major_interest_to_root_trigger = yes
					is_of_minor_interest_to_root_trigger = yes
				}
				count >= 2
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity.activity_host ?= { save_scope_as = host }

		scope:activity = {
			random_guest_subset = {
				name = detractor
				limit = {
					is_ai = yes
					OR = {
						is_of_major_interest_to_root_trigger = yes
						is_of_minor_interest_to_root_trigger = yes
					}
				}
				save_scope_as = guest
			}
		}

		scope:activity = {
			random_guest_subset = {
				name = detractor
				limit = {
					is_ai = yes
					OR = {
						is_of_major_interest_to_root_trigger = yes
						is_of_minor_interest_to_root_trigger = yes
					}
					NOT = {
						this = scope:guest
					}
				}
				save_scope_as = guest_2
			}
		}
	}

	# great toast
	option = {
		name = coronation_events.1016.great
		trigger = {
			has_activity_intent = coronation_impress_attendees
		}

		duel = {
			skill = diplomacy
			value = high_skill_rating
			# you manage to win them over
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = coronation_events.1016.great.tt.success
				send_interface_toast = {
					title = coronation_events.1016.great.tt.success
					left_icon = root
					custom_tooltip = coronation_tt_positive_tiny
					scope:activity = { activity_special_type_progression_tiny = yes }
					coronation_add_magnificence_log_effect = {
						VALUE = flag:positive_tiny
						CHAR = root
					}
					scope:guest = {
						add_opinion = {
							target = root
							modifier = friendliness_opinion
							opinion = 20
						}
					}
					scope:guest_2 = {
						add_opinion = {
							target = root
							modifier = friendliness_opinion
							opinion = 20
						}
					}
					coronation_impress_attendees_opinion_effect = yes
				}
			}
			# they don't think it's good enough
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = coronation_events.1016.great.tt.failure
				send_interface_toast = {
					title = coronation_events.1016.great.tt.failure
					left_icon = root
					if = {
        				limit = {
        					government_allows = administrative
        					top_liege = scope:activity.activity_host
        				}
        				change_influence = minor_influence_loss
        			}
        			else = {
        				add_prestige = minor_prestige_loss
        			}
				}
			}
		}
		ai_chance = {
			base = 5
		}
	}

	# embarrass guests toast
	option = {
		name = coronation_events.1016.embarrass
		trigger = {
			has_activity_intent = coronation_weaken_detractors
			intrigue >= high_skill_rating
		}
		show_as_unavailable = {
			has_activity_intent = coronation_weaken_detractors
			intrigue < high_skill_rating
		}

		add_dread = medium_dread_gain

		scope:guest = {
			add_stress = medium_stress_gain
		}

		scope:guest_2 = {
			add_stress = medium_stress_gain
		}

		scope:guest = {
			add_opinion = {
				target = root
				modifier = insult_opinion
				opinion = -20
			}
		}

		scope:guest_2 = {
			add_opinion = {
				target = root
				modifier = insult_opinion
				opinion = -20
			}
		}

		coronation_weaken_detractors_opinion_effect = yes

		ai_chance = {
			base = 5
		}
	}

	# why bother?
	option = {
		name = coronation_events.1016.nah
		stress_impact = {
			base = minor_stress_impact_loss
  		}
  		ai_chance = {
			base = 1
			modifier = {
				stress_level >= 1
				add = 2
			}
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# Participants bring their local beverages for you to try on at your coronation banquet
coronation_events.1017 = {
	type = activity_event
	title = coronation_events.1017.t
	desc = coronation_events.1017.desc
	right_portrait = {
		character = scope:supporter
		animation = debating
	}

	center_portrait = {
		character = scope:detractor
		animation = disgust
		camera = camera_event_right
	}

	left_portrait = {
		character = root
		animation = drink_goblet
	}

	theme = feast_activity

	cooldown = { years = 5 }

	trigger = {
		root.culture != scope:activity.activity_location.culture
		scope:activity = {
			any_guest_subset = {
				name = detractor
				OR = {
					is_of_major_interest_to_root_trigger = yes
					is_of_minor_interest_to_root_trigger = yes
				}
				is_ai = yes
				NOT = {
					this.culture = root.culture
					this.culture = scope:activity.activity_location.culture
				}
			}
			any_guest_subset = {
				name = supporter
				OR = {
					is_of_major_interest_to_root_trigger = yes
					is_of_minor_interest_to_root_trigger = yes
				}
				is_ai = yes
				this.culture = scope:activity.activity_location.culture
			}
		}
		faith_forbids_alcohol_trigger = no
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity = {
			random_guest_subset = {
				name = detractor
				limit = {
					OR = {
						is_of_major_interest_to_root_trigger = yes
						is_of_minor_interest_to_root_trigger = yes
					}
					is_ai = yes
					NOT = {
						this.culture = root.culture
						this.culture = scope:activity.activity_location.culture
					}
				}
				save_scope_as = detractor
			}
		}

		scope:activity = {
			random_guest_subset = {
				name = supporter
				limit = {
					OR = {
						is_of_major_interest_to_root_trigger = yes
						is_of_minor_interest_to_root_trigger = yes
					}
					is_ai = yes
					this.culture = scope:activity.activity_location.culture
				}
				save_scope_as = supporter
			}
		}
	}

	# praise all the beverages, making a speech about the land
	option = {
		name = coronation_events.1017.diplo
		trigger = {
			has_activity_intent = coronation_impress_attendees
			diplomacy >= high_skill_rating
		}

		scope:activity = {
			custom_tooltip = coronation_tt_positive_tiny
			activity_special_type_progression_tiny = yes
			coronation_add_magnificence_log_effect = {
				VALUE = flag:positive_tiny
				CHAR = root
			}
			activity_location.county = {
				add_county_modifier = {
					modifier = bp4_coronation_good_harvest_modifier
					years = 10
				}
			}
		}

		coronation_impress_attendees_opinion_effect = yes

		stress_impact = {
			paranoid = minor_stress_impact_gain
			inappetetic = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			gluttonous = minor_stress_impact_loss
  		}

  		ai_chance = {
			base = 5
			modifier = {
				has_trait = paranoid
				add = -2
			}
			modifier = {
				has_trait = inappetetic
				add = -2
			}
			modifier = {
				has_trait = arrogant
				add = -2
			}
			modifier = {
				has_trait = gluttonous
				add = 2
			}
		}
	}

	# praise all the beverages, making a speech about the land (watered down)
	option = {
		name = coronation_events.1017.diplo
		trigger = {
			NOT = {
				has_activity_intent = coronation_impress_attendees
			}
			diplomacy < high_skill_rating
		}

		scope:activity = {
			activity_location.county = {
				add_county_modifier = {
					modifier = bp4_coronation_good_harvest_modifier
					years = 5
				}
			}
		}

		coronation_impress_attendees_opinion_effect = yes

		stress_impact = {
			paranoid = minor_stress_impact_gain
			inappetetic = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			gluttonous = minor_stress_impact_loss
  		}

  		ai_chance = {
			base = 5
			modifier = {
				has_trait = paranoid
				add = -2
			}
			modifier = {
				has_trait = inappetetic
				add = -2
			}
			modifier = {
				has_trait = arrogant
				add = -2
			}
			modifier = {
				has_trait = gluttonous
				add = 2
			}
		}
	}

	# humiliate dissenter
	option = {
		name = coronation_events.1017.isolate
		trigger = {
			has_activity_intent = coronation_weaken_detractors
		}

		if = {
			limit = {
				has_royal_court = yes
			}
			change_current_court_grandeur = medium_court_grandeur_gain
		}
		else = {
			every_courtier = {
				custom = custom.every_courtier
				limit = {
					is_adult = yes
				}
				add_opinion = {
					target = root
					modifier = grateful_opinion
					opinion = 10
				}
			}
		}

		scope:detractor = {
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -25
			}
			if = {
        		limit = {
        			government_allows = administrative
        			top_liege = scope:activity.activity_host
        		}
        		change_influence = medium_influence_loss
        	}
        	else = {
        		add_prestige = medium_prestige_loss
        	}
		}

		coronation_weaken_detractors_opinion_effect = yes

		stress_impact = {
			paranoid = minor_stress_impact_gain
			inappetetic = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			gluttonous = minor_stress_impact_loss
  		}

  		ai_chance = {
			base = 5
			modifier = {
				has_trait = paranoid
				add = -2
			}
			modifier = {
				has_trait = inappetetic
				add = -2
			}
			modifier = {
				has_trait = arrogant
				add = -2
			}
			modifier = {
				has_trait = gluttonous
				add = 2
			}
		}
	}

	# praise supporter
	option = {
		name = coronation_events.1017.empower
		trigger = {
			has_activity_intent = coronation_embrace_supporters
		}
		if = {
			limit = {
				OR = {
					scope:supporter = { is_ai = yes }
					AND = {
						scope:supporter = {
							is_ai = no
						}
						is_ai = no
					}
				}
			}
			progress_towards_friend_effect = {
				REASON = friend_praised_vintage
				CHARACTER = scope:supporter
				OPINION = 20
			}
		}
		if = {
			limit = {
				is_valid_to_hire_court_position_type = court_brewmaster_court_position
			}
			show_as_tooltip = {
				appoint_court_position = {
					recipient = scope:supporter
					court_position = court_brewmaster_court_position
				}
			}
		}

		hidden_effect = {
			if = {
				limit = {
					is_valid_to_hire_court_position_type = court_brewmaster_court_position
					NOT = { employs_court_position = court_brewmaster_court_position }
				}
				appoint_court_position = {
					recipient = scope:supporter
					court_position = court_brewmaster_court_position
				}
			}
			else_if = {
				limit = {
					is_valid_to_hire_court_position_type = court_brewmaster_court_position
					employs_court_position = court_brewmaster_court_position
				}
				add_character_flag = temporary_court_position_cost_removal
				replace_court_position = {
					recipient = scope:supporter
					holder = court_position:court_brewmaster_court_position
					court_position = court_brewmaster_court_position
				}
				remove_character_flag = temporary_court_position_cost_removal
			}
		}

		coronation_embrace_supporters_opinion_effect = yes

		stress_impact = {
			paranoid = minor_stress_impact_gain
			inappetetic = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			gluttonous = minor_stress_impact_loss
  		}

  		ai_chance = {
			base = 5
			modifier = {
				has_trait = paranoid
				add = -2
			}
			modifier = {
				has_trait = inappetetic
				add = -2
			}
			modifier = {
				has_trait = arrogant
				add = -2
			}
			modifier = {
				has_trait = gluttonous
				add = 2
			}
		}
	}

	# praise supporter (watered down)
	option = {
		name = coronation_events.1017.empower
		trigger = {
			NOT = {
				has_activity_intent = coronation_embrace_supporters
			}
		}

		show_as_tooltip = {
			appoint_court_position = {
				recipient = scope:supporter
				court_position = court_brewmaster_court_position
			}
		}
		hidden_effect = {
			if = {
				limit = {
					is_valid_to_hire_court_position_type = court_brewmaster_court_position
					NOT = { employs_court_position = court_brewmaster_court_position }
				}
				appoint_court_position = {
					recipient = scope:supporter
					court_position = court_brewmaster_court_position
				}
			}
			else_if = {
				limit = {
					is_valid_to_hire_court_position_type = court_brewmaster_court_position
					employs_court_position = court_brewmaster_court_position
				}
				add_character_flag = temporary_court_position_cost_removal
				replace_court_position = {
					recipient = scope:supporter
					holder = court_position:court_brewmaster_court_position
					court_position = court_brewmaster_court_position
				}
				remove_character_flag = temporary_court_position_cost_removal
			}
		}

		stress_impact = {
			paranoid = minor_stress_impact_gain
			inappetetic = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			gluttonous = minor_stress_impact_loss
  		}

  		ai_chance = {
			base = 5
			modifier = {
				has_trait = paranoid
				add = -2
			}
			modifier = {
				has_trait = inappetetic
				add = -2
			}
			modifier = {
				has_trait = arrogant
				add = -2
			}
			modifier = {
				has_trait = gluttonous
				add = 2
			}
		}
	}

	# I couldn't possibly drink first
	option = {
		name = coronation_events.1017.nah

		scope:activity = {
			every_attending_character = {
				limit = {
					NOT = { this = root }
				}
				custom = custom.every_attending_character
				add_opinion = {
					target = root
					modifier = respect_opinion
					opinion = 5
				}
			}
		}

		stress_impact = {
			paranoid = minor_stress_impact_loss
			inappetetic = minor_stress_impact_loss
			arrogant = minor_stress_impact_loss
			gluttonous = minor_stress_impact_gain
  		}

  		ai_chance = {
			base = 1
			modifier = {
				has_trait = paranoid
				add = 2
			}
			modifier = {
				has_trait = inappetetic
				add = 2
			}
			modifier = {
				has_trait = arrogant
				add = 2
			}
			modifier = {
				has_trait = gluttonous
				add = -2
			}
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# While arranging seats at the table at your coronation banquet, you make a decision about where your detractors will sit
coronation_events.1018 = {
	type = activity_event
	title = coronation_events.1018.t
	desc = {
		desc = coronation_events.1018.desc
		triggered_desc = {
			trigger = { has_trait = wrathful }
			desc = coronation_events.1018.desc.wrathful
		}
		triggered_desc = {
			trigger = { diplomacy > 10 }
			desc = coronation_events.1018.desc.diplo
		}
	}
	center_portrait = {
		character = scope:detractor
		animation = flirtation
	}

	right_portrait = {
		character = scope:supporter
		animation = happiness

	}

	left_portrait = {
		character = scope:host
		animation = scheme
		camera = camera_event_left_wedding
	}

	theme = feast_activity

	cooldown = { years = 5 }

	trigger = {
		scope:activity = {
			any_guest_subset = {
				name = supporter
				is_ai = yes
				OR = {
					is_of_major_interest_to_root_trigger = yes
					is_of_minor_interest_to_root_trigger = yes
				}
			}
			any_guest_subset = {
				name = detractor
				is_ai = yes
				OR = {
					is_of_major_interest_to_root_trigger = yes
					is_of_minor_interest_to_root_trigger = yes
				}
			}
		}
		has_activity_intent = coronation_weaken_detractors
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity.activity_host ?= { save_scope_as = host }
		custom_tooltip = happened_because_intent_tt
		scope:activity = {
			random_guest_subset = {
				name = detractor
				limit = {
					is_ai = yes
					OR = {
						is_of_major_interest_to_root_trigger = yes
						is_of_minor_interest_to_root_trigger = yes
					}
				}
				save_scope_as = detractor
			}
		}

		scope:activity = {
			random_guest_subset = {
				name = supporter
				limit = {
					is_ai = yes
					OR = {
						is_of_major_interest_to_root_trigger = yes
						is_of_minor_interest_to_root_trigger = yes
					}
				}
				save_scope_as = supporter
			}
		}
	}

	# deal
	option = {
		name = coronation_events.1018.deal
		add_hook_if_possible_default_length_effect = {
			TARGET = scope:detractor
			TYPE = favor_hook
		}

		stress_impact = {
			gregarious = minor_stress_impact_loss
			trusting = minor_stress_impact_loss
			just = minor_stress_impact_loss
  		}

		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_vengefulness = high_chance_impact_negative_ai_value
				ai_sociability = high_chance_impact_positive_ai_value
			}
		}
	}

	# switch
	option = {
		name = coronation_events.1018.switch
		add_character_modifier = {
			modifier = bp4_shielded_reign_modifier
			years = 10
		}
		scope:detractor = {
			add_stress = medium_stress_gain
		}

		stress_impact = {
			paranoid = minor_stress_impact_loss
			deceitful = minor_stress_impact_loss
  		}

		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_vengefulness = high_chance_impact_positive_ai_value
				ai_sociability = high_chance_impact_negative_ai_value
			}
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

scripted_effect coronation_events_1019_memory_reward_effect = {
	custom_tooltip = coronation_events.1019.memory_reward.tt
	add_prestige = minor_prestige_gain
	if = {
		limit = {
			scope:$SCOPE$_memory = {
				has_memory_category = marriage
			}
		}
		progress_towards_lover_effect = {
			REASON = lover_coronation_gifts
			CHARACTER = scope:$SCOPE$
			OPINION = 20
		}
	}
	if = {
		limit = {
			scope:$SCOPE$_memory = {
				OR = {
					has_memory_category = war
					has_memory_category = martial
				}
			}
		}
		add_martial_lifestyle_xp = minor_lifestyle_xp
	}
	if = {
		limit = {
			scope:$SCOPE$_memory = {
				has_memory_category = major
			}
		}
		add_prestige = minor_prestige_gain
	}
	if = {
		limit = {
			scope:$SCOPE$_memory = {
				has_memory_category = family
			}
		}
		dynasty = {
				add_dynasty_prestige = minor_dynasty_prestige_gain
			}
	}
	if = {
		limit = {
			scope:$SCOPE$_memory = {
				has_memory_category = travel
			}
		}
		traveler_travel_xp_effect = {
			MIN = 3
			MAX = 5
		}
	}

	if = {
		limit = {
			scope:$SCOPE$_memory = {
				has_memory_category = travel
			}
		}
		traveler_travel_xp_effect = {
			MIN = 3
			MAX = 5
		}
	}

	if = {
		limit = {
			scope:$SCOPE$_memory = {
				has_memory_category = childhood
			}
		}
		if = {
			limit = {
				reverse_opinion = {
					target = scope:$SCOPE$
					value > 40
				}
				OR = {
					scope:$SCOPE$ = { is_ai = yes }
					AND = {
						scope:$SCOPE$ = {
							is_ai = no
						}
						is_ai = no
					}
				}
			}
			progress_towards_friend_effect = {
				REASON = friend_coronation_gifts
				CHARACTER = scope:$SCOPE$
				OPINION = 20
			}
		}
		else = {
			reverse_add_opinion = {
				target = scope:$SCOPE$
				modifier = grateful_opinion
				opinion = 25
			}
		}
	}
}

# You distribute gifts to your supporters at your coronation banquet
coronation_events.1019 = {
	type = activity_event
	title = coronation_events.1019.t
	desc = coronation_events.1019.desc
	right_portrait = {
		character = scope:supporter
		animation = throne_room_conversation_4
	}

	center_portrait = {
		character = scope:supporter_2
		animation = throne_room_bow_1
		camera = camera_event_right
	}

	left_portrait = {
		character = root
		animation = wedding_bride_left
	}

	theme = feast_activity

	cooldown = { years = 5 }

	trigger = {
		has_activity_intent = coronation_embrace_supporters
		scope:activity = {
			any_guest_subset = {
				name = supporter
				any_memory = {
					has_memory_category = positive
					has_memory_participant = root
				}
				count >= 2
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity = {
			random_guest_subset = {
				name = supporter
				limit = {
					any_memory = {
						has_memory_category = positive
						has_memory_participant = root
					}
				}
				save_scope_as = supporter
			}
			random_guest_subset = {
				name = supporter
				limit = {
					NOT = {
						this = scope:supporter
					}
					any_memory = {
						has_memory_category = positive
						has_memory_participant = root
					}
				}
				save_scope_as = supporter_2
			}
		}

		scope:supporter = {
			random_memory = {
				limit = {
					has_memory_category = positive
					has_memory_participant = root
				}
				save_scope_as = supporter_memory
			}
		}

		scope:supporter_2 = {
			random_memory = {
				limit = {
					has_memory_category = positive
					has_memory_participant = root
				}
				save_scope_as = supporter_2_memory
			}
		}
	}

	# give them both gifts
	option = {
		name = coronation_events.1019.both

		pay_short_term_gold = {
			target = scope:supporter
			gold = minor_gold_value
		}

		pay_short_term_gold = {
			target = scope:supporter_2
			gold = minor_gold_value
		}
		if = {
			limit = {
				reverse_opinion = {
					target = scope:supporter
					value > 40
				}
				OR = {
					scope:supporter = { is_ai = yes }
					AND = {
						scope:supporter = {
							is_ai = no
						}
						is_ai = no
					}
				}
			}
			progress_towards_friend_effect = {
				REASON = friend_coronation_gifts
				CHARACTER = scope:supporter
				OPINION = 20
			}
		}
		else = {
			reverse_add_opinion = {
				target = scope:supporter
				modifier = grateful_opinion
				opinion = 25
			}
		}
		if = {
			limit = {
				reverse_opinion = {
					target = scope:supporter_2
					value > 40
				}
				OR = {
					scope:supporter_2 = { is_ai = yes }
					AND = {
						scope:supporter_2 = {
							is_ai = no
						}
						is_ai = no
					}
				}
			}
			progress_towards_friend_effect = {
				REASON = friend_coronation_gifts
				CHARACTER = scope:supporter_2
				OPINION = 20
			}
		}
		else = {
			reverse_add_opinion = {
				target = scope:supporter_2
				modifier = grateful_opinion
				opinion = 25
			}
		}



		stress_impact = {
			gregarious = minor_stress_impact_loss
			trusting = minor_stress_impact_loss
			just = minor_stress_impact_loss
  		}

		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_greed = high_chance_impact_negative_ai_value
				ai_sociability = high_chance_impact_positive_ai_value
			}
			modifier = {
				short_term_gold <= medium_gold_value
				add = -2
			}
		}
	}

	# give supporter a gift
	option = {
		name = coronation_events.1019.supporter
		remove_short_term_gold = minor_gold_value

		coronation_events_1019_memory_reward_effect = { SCOPE = supporter }

		stress_impact = {
			gregarious = minor_stress_impact_loss
			trusting = minor_stress_impact_loss
  		}


		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_greed = medium_chance_impact_negative_ai_value
				ai_sociability = medium_chance_impact_positive_ai_value
			}
			modifier = {
				short_term_gold <= minor_gold_value
				add = -2
			}
			modifier = {
				scope:supporter_2.current_military_strength > scope:supporter.current_military_strength
				add = -2
			}
		}
	}

	# give supporter_2 a gift
	option = {
		name = coronation_events.1019.supporter_2
		remove_short_term_gold = minor_gold_value

		coronation_events_1019_memory_reward_effect = { SCOPE = supporter_2 }

		stress_impact = {
			gregarious = minor_stress_impact_loss
			trusting = minor_stress_impact_loss
  		}

		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_greed = medium_chance_impact_negative_ai_value
				ai_sociability = medium_chance_impact_positive_ai_value
			}
			modifier = {
				short_term_gold <= minor_gold_value
				add = -2
			}
			modifier = {
				scope:supporter.current_military_strength > scope:supporter_2.current_military_strength
				add = -2
			}
		}
	}

	# don't give any gifts
	option = {
		name = coronation_events.1019.nah
		add_stewardship_lifestyle_xp = medium_lifestyle_xp

		stress_impact = {
			paranoid = minor_stress_impact_loss
			shy = minor_stress_impact_loss
			arrogant = minor_stress_impact_loss
  		}

  		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_greed = high_chance_impact_positive_ai_value
				ai_sociability = high_chance_impact_negative_ai_value
			}
			modifier = {
				has_lifestyle = stewardship_lifestyle
				add = 2
			}
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# Clan vassals show their concerns
coronation_events.1020 = {
	type = activity_event
	title = coronation_events.1020.t
	desc = coronation_events.1020.desc
	right_portrait = {
		character = scope:dynasty_vassal
		animation = throne_room_conversation_4
	}

	center_portrait = {
		character = scope:not_dynasty_vassal
		animation = throne_room_bow_1
		camera = camera_event_right
	}

	left_portrait = {
		character = root
		animation = wedding_bride_left
	}

	theme = feast_activity

	cooldown = { years = 5 }

	trigger = {
		government_has_flag = government_is_clan
		scope:activity = {
			any_attending_character = {
				is_ai = yes
				government_has_flag = government_is_clan
				NOT = {
					dynasty = root.dynasty
				}
				is_vassal_of = root
			}
		}
		scope:activity = {
			any_attending_character = {
				is_ai = yes
				government_has_flag = government_is_clan
				dynasty = root.dynasty
				is_vassal_of = root
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity = {
			random_attending_character = {
				limit = {
					is_ai = yes
					government_has_flag = government_is_clan
					dynasty = root.dynasty
					is_vassal_of = root
				}
				save_scope_as = dynasty_vassal
			}
			random_attending_character = {
				limit = {
					is_ai = yes
					government_has_flag = government_is_clan
					NOT = {
						dynasty = root.dynasty
					}
					is_vassal_of = root
				}
				save_scope_as = not_dynasty_vassal
			}
		}
	}

	# embrace supporter
	option = {
		trigger = {
			has_activity_intent = coronation_embrace_supporters
			OR = {
				scope:not_dynasty_vassal = {
					is_in_guest_subset = { name = supporter }
				}
				scope:dynasty_vassal = {
					is_in_guest_subset = { name = supporter }
				}
			}
		 }
		name = coronation_events.1020.embrace_supporters
		custom_tooltip = coronation_events.1020.embrace_supporters.tt

		if = {
			limit = {
				scope:not_dynasty_vassal = {
					is_in_guest_subset = { name = supporter }
				}
			}
			add_hook_if_possible_default_length_effect = {
				TARGET = scope:not_dynasty_vassal
				TYPE = favor_hook
			}
			scope:not_dynasty_vassal = {
				add_opinion = {
					target = root
					modifier = impressed_opinion
					opinion = 15
				}
				add_prestige = medium_prestige_gain
			}
		}

		if = {
			limit = {
				scope:dynasty_vassal = {
					is_in_guest_subset = { name = supporter }
				}
			}
			house = {
				add_unity_value = {
					value = medium_unity_gain
					character = root
					desc = clan_unity_coronation_increased
				}
			}
			scope:dynasty_vassal = {
				add_opinion = {
					target = root
					modifier = impressed_opinion
					opinion = 15
				}
				add_prestige = medium_prestige_gain
			}
		}


		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = high_chance_impact_positive_ai_value
				ai_rationality = high_chance_impact_positive_ai_value
			}
		}
	}

	# weaken detractor
	option = {
		trigger = {
			has_activity_intent = coronation_weaken_detractors
			OR = {
				scope:not_dynasty_vassal = {
					is_in_guest_subset = { name = detractor }
				}
				scope:dynasty_vassal = {
					is_in_guest_subset = { name = detractor }
				}
			}
		 }
		name = coronation_events.1020.weaken_detractors

		if = {
			limit = {
				scope:not_dynasty_vassal = {
					is_in_guest_subset = { name = detractor }
				}
			}
			house = {
				add_unity_value = {
					value = medium_unity_gain
					character = root
					desc = clan_unity_coronation_increased
				}
			}
			scope:not_dynasty_vassal = {
				add_opinion = {
					modifier = angry_opinion
					target = root
					opinion = -20
				}
				add_stress = medium_stress_gain
			}
		}

		if = {
			limit = {
				scope:dynasty_vassal = {
					is_in_guest_subset = { name = detractor }
				}
			}
			if = {
				limit = {
					scope:not_dynasty_vassal = {
						NOT = { is_in_guest_subset = { name = detractor } }
					}
				}
				house = {
					add_unity_value = {
						value = medium_unity_loss
						character = root
						desc = clan_unity_coronation_decreased
					}
				}
			}
			scope:dynasty_vassal = {
				add_opinion = {
					modifier = angry_opinion
					target = root
					opinion = -20
				}
				add_stress = medium_stress_gain
			}
		}
		custom_tooltip = coronation_events.1020.weaken_detractors.tt

		coronation_weaken_detractors_opinion_effect = yes

		stress_impact = {
			arrogant = minor_stress_impact_loss
			vengeful = minor_stress_impact_loss
			stubborn = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = high_chance_impact_positive_ai_value
				ai_rationality = high_chance_impact_positive_ai_value
			}
		}
	}

	# talk your way out of it
	option = {
		trigger = { diplomacy >= high_skill_rating }
		name = coronation_events.1020.a
		flavor = coronation_events.1020.a.flavor

		house = {
			add_unity_value = {
				value = minor_unity_gain
				character = root
				desc = clan_unity_coronation_increased
			}
		}

		custom_tooltip = coronation_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}

		scope:dynasty_vassal = {
			add_opinion = {
				modifier = pleased_opinion
				target = root
				opinion = 10
			}
		}
		scope:not_dynasty_vassal = {
			add_opinion = {
				modifier = pleased_opinion
				target = root
				opinion = 10
			}
		}

		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_sociability = high_chance_impact_positive_ai_value
				ai_rationality = high_chance_impact_positive_ai_value
			}
		}
	}

	# support the vassal that is not part of your house
	option = {
		name = coronation_events.1020.b
		flavor = coronation_events.1020.b.tt
		scope:not_dynasty_vassal = {
			add_opinion = {
				modifier = pleased_opinion
				target = root
				opinion = 20
			}
		}

		add_hook_if_possible_default_length_effect = {
			TARGET = scope:not_dynasty_vassal
			TYPE = favor_hook
		}

		house = {
			add_unity_value = {
				value = medium_unity_loss
				character = root
				desc = clan_unity_coronation_decreased
			}
		}

		every_vassal_or_below = {
			limit = { dynasty = root.dynasty }
			custom = coronation_events.1020.b.custom
			add_opinion = {
				modifier = angry_opinion
				target = root
				opinion = -10
			}
		}

		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_honor = high_chance_impact_positive_ai_value
				ai_rationality = high_chance_impact_positive_ai_value
			}
		}
	}

	# imprison the non dynastic vassal for the impertinence
	option = {
		name = coronation_events.1020.c

		add_dread = minor_dread_gain

		house = {
			add_unity_value = {
				value = medium_unity_gain
				character = root
				desc = clan_unity_coronation_increased
			}
		}
		if = {
			limit = {
				OR = {
					scope:not_dynasty_vassal = {
						is_ai = yes
					}
					is_ai = no
				}
			}
			imprison_character_effect = {
				IMPRISONER = root
				TARGET = scope:not_dynasty_vassal
			}
		}


		stress_impact = { just = medium_stress_gain }

		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_vengefulness = high_chance_impact_positive_ai_value
				ai_rationality = high_chance_impact_negative_ai_value
			}
		}
	}

	# focus on family
	option = {
		name = coronation_events.1020.d

		house = {
			add_unity_value = {
				value = medium_unity_gain
				character = root
				desc = clan_unity_coronation_increased
			}
		}

		scope:not_dynasty_vassal = {
			add_opinion = {
				modifier = refusal_opinion
				target = root
				opinion = -20
			}
		}
		every_vassal_or_below = {
			limit = {
				government_has_flag = government_is_clan
				NOT = {
					dynasty = root.dynasty
				}
				NOT = { this = scope:not_dynasty_vassal }
			}
			custom = clan.1101.d.custom

			add_opinion = {
				modifier = disappointed_opinion
				target = root
				opinion = -10
			}
		}
		stress_impact = {
			forgiving = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			generous = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			just = medium_stress_impact_gain
			craven = minor_stress_impact_gain
			trusting = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_sociability = high_chance_impact_positive_ai_value
				ai_rationality = high_chance_impact_negative_ai_value
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = forgiving
					has_trait = compassionate
					has_trait = generous
					has_trait = humble
					has_trait = just
					has_trait = craven
					has_trait = trusting
				}
			}
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# Powerful taxman approaches host
coronation_events.1021 = {
	type = activity_event
	title = coronation_events.1021.t
	desc = coronation_events.1021.desc
	left_portrait = {
		character = root
		animation = disapproval
	}

	right_portrait = {
		character = scope:supporter
		animation = eavesdrop
		camera = camera_event_very_right
	}

	center_portrait = {
		character = scope:taxman
		animation = betting
		camera = camera_event_center_pointing_left
	}
	override_background = {
		reference = relaxing_room
	}

	theme = coronation_activity

	cooldown = { years = 5 }

	trigger = {
		government_has_flag = government_is_clan

		scope:activity = {
			any_attending_character = {
				is_ai = yes
				is_tax_collector = yes
				is_vassal_of = root
				tax_slot = {
					any_tax_slot_vassal = {
						count >= 1
					}
				}
				ai_greed > 0
			}
			any_guest_subset = {
				name = supporter
				is_ai = yes
				is_tax_collector = no
				OR = {
					is_courtier_of = root
					is_vassal_of = root
				}
				trigger_if = {
					limit = {
						root = {
							has_activity_intent = coronation_embrace_supporters
						}
					}
					OR = {
						is_powerful_vassal_of = root
						is_councillor_of = root
					}
				}
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity = {
			random_attending_character = {
				limit = {
					is_ai = yes
					is_tax_collector = yes
					is_vassal_of = root
					tax_slot = {
						any_tax_slot_vassal = {
							count >= 1
						}
					}
					ai_greed > 0
				}
				save_scope_as = taxman
				save_scope_as = tax_collector
			}
			random_guest_subset = {
				name = supporter
				limit = {
					is_ai = yes
					is_powerful_vassal_of = root
					is_councillor_of = root
				}
				alternative_limit = {
					is_ai = yes
					is_powerful_vassal_of = root
				}
				alternative_limit = {
					is_ai = yes
					is_vassal_of = root
				}
				save_scope_as = supporter
			}
		}
	}

	# embrace_supporters
	option = {
		trigger = {
			has_activity_intent = coronation_embrace_supporters
		}
		name = coronation_events.1021.embrace_supporters
		flavor = coronation_events.1021.embrace_supporters.flavor

		scope:supporter = {
			add_opinion = {
				target = root
				modifier = loyalty_opinion
				opinion = 20
			}
		}
		add_character_modifier = {
			modifier = coronation_tax_collectors_watched_modifier
			years = 10
		}
		scope:taxman = {
			add_character_modifier = {
				modifier = coronation_tax_collector_scrutiny_modifier
				years = 10
			}
		}

		stress_impact = { greedy = minor_stress_impact_gain }

		ai_chance = {
			base = 5
			ai_value_modifier = {
				ai_greed = high_chance_impact_negative_ai_value
				ai_honor = high_chance_impact_positive_ai_value
			}
		}
	}

	# impress_attendees
	option = {
		trigger = {
			has_activity_intent = coronation_impress_attendees
			diplomacy >= high_skill_rating
		}
		show_as_unavailable = {
			has_activity_intent = coronation_impress_attendees
			diplomacy < high_skill_rating
		}
		name = coronation_events.1021.impress_attendees
		flavor = coronation_events.1021.impress_attendees.flavor

		house = {
			add_unity_value = {
				value = minor_unity_gain
				character = root
				desc = clan_unity_coronation_nepotism.desc
			}
		}
		scope:taxman = {
			tax_slot = {
				every_tax_slot_vassal = {
					custom = custom.every_tax_slot_vassal
					limit = {
						is_ai = yes
					}
					add_opinion = {
						target = root
						modifier = respect_opinion
						opinion = 10
					}
				}
			}
		}


		coronation_impress_attendees_opinion_effect = yes

		stress_impact = { greedy = minor_stress_impact_gain }

		ai_chance = {
			base = 5
			ai_value_modifier = {
				ai_greed = high_chance_impact_negative_ai_value
				ai_honor = high_chance_impact_positive_ai_value
			}
		}
	}

	# you're not that important
	option = {
		name = coronation_events.1021.a
		flavor = coronation_events.1021.a.flavor

		house = {
			add_unity_value = {
				value = minor_unity_gain
				character = root
				desc = clan_unity_coronation_nepotism.desc
			}
		}

		add_legitimacy = minor_legitimacy_gain

		scope:taxman = {
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -30
			}
		}

		stress_impact = { greedy = minor_stress_impact_gain }

		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_greed = high_chance_impact_negative_ai_value
				ai_honor = high_chance_impact_positive_ai_value
			}
		}
	}

	# empower tax collector
	option = {
		name = coronation_events.1021.c
		flavor = coronation_events.1021.c.flavor

		house = {
			add_unity_value = {
				value = minor_unity_loss
				character = root
				desc = clan_unity_refused_nepotism.desc
			}
		}
		add_character_modifier = {
			modifier = bp4_empowered_tax_collectors_modifier
			years = 10
		}
		scope:taxman = {
			if = {
				limit = {
					highest_skill = diplomacy
				}
				add_diplomacy_skill = 1
			}
			else_if = {
				limit = {
					highest_skill = intrigue
				}
				add_intrigue_skill = 1
			}
			else = {
				add_stewardship_skill = 1
			}
		}


		stress_impact = {
			honest = minor_stress_impact_gain
			greedy = minor_stress_impact_loss
		}

		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_greed = high_chance_impact_positive_ai_value
				ai_sociability = high_chance_impact_negative_ai_value
			}
		}
	}

	# strike a deal with the tax collector
	option = {
		name = coronation_events.1021.b
		flavor = coronation_events.1021.b.flavor
		scope:taxman = {
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 30
			}
			add_character_modifier = {
				modifier = coronation_thriving_collector_modifier
				years = 5
			}
			tax_slot = {
				every_tax_slot_vassal = {
					custom = custom.every_tax_slot_vassal
					limit = {
						is_ai = yes
					}
					add_character_modifier = {
						modifier = coronation_harsh_collector_modifier
						years = 5
					}
				}
			}
		}


		stress_impact = {
			honest = minor_stress_impact_gain
			greedy = minor_stress_impact_loss
		}

		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_greed = medium_chance_impact_positive_ai_value
				ai_sociability = medium_chance_impact_negative_ai_value
			}
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# A supporter offers you a gift during the feast in exchange for better court clothing
coronation_events.1022 = {
	type = activity_event
	title = coronation_events.1022.t
	desc = coronation_events.1022.desc
	right_portrait = {
		character = scope:supporter
		animation = throne_room_conversation_4
	}

	left_portrait = {
		character = root
		animation = wedding_bride_left
	}

	theme = feast_activity

	cooldown = { years = 5 }

	trigger = {
		has_activity_intent = coronation_embrace_supporters
		scope:activity = {
			any_guest_subset = {
				name = supporter
				is_ai = yes
				#Needs enough money to afford silken robes
				OR = {
					is_ruler = yes
					gold >= 100
				}
				#Needs appropriate personality
				NOR = {
					has_trait = greedy
					has_trait = temperate
					has_trait = humble
					has_trait = peasant_leader
				}
				any_memory = {
					has_memory_category = positive
					has_memory_participant = root
				}
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity = {
			random_guest_subset = {
				name = supporter
				limit = {
					#Needs enough money to afford silken robes
					OR = {
						is_ruler = yes
						gold >= 100
					}
					#Needs appropriate personality
					NOR = {
						has_trait = greedy
						has_trait = temperate
						has_trait = humble
						has_trait = peasant_leader
					}
					any_memory = {
						has_memory_category = positive
						has_memory_participant = root
					}
					is_ai = yes
				}
				save_scope_as = supporter
			}
		}

		scope:supporter = {
			hidden_effect = {
				add_gold = major_gold_value
			}
			random_memory = {
				limit = {
					has_memory_category = positive
					has_memory_participant = root
				}
				save_scope_as = supporter_memory
			}
		}
	}

	# accept the gift and the deal
	option = {
		name = coronation_events.1022.a

		scope:supporter = {
			pay_short_term_gold = {
				target = root
				gold = minor_gold_value
			}
		}

		if = {
			limit = { has_dlc_feature = royal_court }
			custom_tooltip = free_fashion_for_15_years
			add_character_flag = {
				flag = court_free_fashion
				years = 15
			}
		}
		else = {
			if = {
        		limit = {
        			government_allows = administrative
        			top_liege = scope:activity.activity_host
        		}
        		change_influence = medium_influence_gain
        	}
        	else = {
        		add_prestige = medium_prestige_gain
        	}
		}

		reverse_add_opinion = {
			target = scope:supporter
			modifier = pleased_opinion
			opinion = 30
		}

		stress_impact = {
			greedy = minor_stress_impact_loss
			arbitrary = minor_stress_impact_gain
  		}

		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_greed = high_chance_impact_positive_ai_value
				ai_sociability = high_chance_impact_positive_ai_value
			}
			modifier = {
				short_term_gold <= medium_gold_value
				add = 2
			}
		}
	}

	# ask for more gold in exchange for a future deal
	option = {
		name = coronation_events.1022.b
		scope:supporter = {
			pay_short_term_gold = {
				target = root
				gold = major_gold_value
			}
			if = {
				limit = {
					can_add_hook = {
						type = favor_hook
						target = root
					}
				}
				add_hook = {
					type = favor_hook
					target = root
				}
			}
		}

		reverse_add_opinion = {
			target = scope:supporter
			modifier = pleased_opinion
			opinion = 30
		}

		stress_impact = {
			greedy = minor_stress_impact_loss
			diligent = minor_stress_impact_gain
			content = minor_stress_impact_gain
  		}


		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_greed = medium_chance_impact_positive_ai_value
				ai_sociability = medium_chance_impact_positive_ai_value
			}
			modifier = {
				short_term_gold <= minor_gold_value
				add = 4
			}
		}
	}

	# redirect the gift towards the realm
	option = {
		name = coronation_events.1022.c

		scope:supporter = {
			add_stewardship_skill = 1
		}

		add_stewardship_lifestyle_xp = medium_lifestyle_xp

		stress_impact = {
			greedy = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
  		}

		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_greed = medium_chance_impact_negative_ai_value
				ai_sociability = medium_chance_impact_positive_ai_value
			}
			modifier = {
				has_lifestyle = stewardship_lifestyle
				add = 2
			}
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# Detractor makes a backhanded compliment in a toast
coronation_events.1023 = {
	type = activity_event
	title = coronation_events.1023.t
	desc = {
		desc = coronation_events.1023.desc
		triggered_desc = {
			trigger = {
				exists = scope:supporter
			}
			desc = coronation_events.1023.supporter.desc
		}
	 }
	right_portrait = {
		character = scope:detractor
		animation = toast
	}

	center_portrait = {
		character = root
		animation = drink
	}

	left_portrait = {
		trigger = {
			exists = scope:supporter
		}
		character = scope:supporter
		animation = shock
	}

	theme = feast_activity

	cooldown = { years = 5 }

	trigger = {
		drinks_alcohol_trigger = yes
		scope:activity = {
			any_guest_subset = {
				name = detractor
				is_ai = yes
				OR = {
					is_of_major_interest_to_root_trigger = yes
					is_of_minor_interest_to_root_trigger = yes
				}
				NOT = {
					has_dread_level_towards = {
						target = root
						level >= 2
					}
				}
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

		scope:activity = {
			random_guest_subset = {
				name = detractor
				limit = {
					is_ai = yes
					OR = {
						is_of_major_interest_to_root_trigger = yes
						is_of_minor_interest_to_root_trigger = yes
					}
					NOT = {
						has_dread_level_towards = {
							target = root
							level >= 2
						}
					}
				}
				save_scope_as = detractor
			}
		}

		if = {
			limit = {
				has_activity_intent = coronation_embrace_supporters
				scope:activity = {
					any_guest_subset = {
						name = supporter
						is_ai = yes
						OR = {
							is_of_major_interest_to_root_trigger = yes
							is_of_minor_interest_to_root_trigger = yes
						}
					}
				}
			}
			scope:activity = {
				random_guest_subset = {
					name = supporter
					limit = {
						is_ai = yes
						OR = {
							is_of_major_interest_to_root_trigger = yes
							is_of_minor_interest_to_root_trigger = yes
						}
					}
					save_scope_as = supporter
				}
			}
		}
	}

	# boldly make a retort
	option = {
		name = coronation_events.1023.a
		trigger = {
			has_activity_intent = coronation_impress_attendees
		}
		scope:activity = {
			custom_tooltip = coronation_tt_positive_tiny
			activity_special_type_progression_tiny = yes
		}
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}
		coronation_impress_attendees_opinion_effect = yes

		stress_impact = {
			shy = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			brave = medium_stress_impact_loss
		}
		ai_chance = {
			base = 5
			ai_value_modifier = {
				ai_boldness = high_chance_impact_positive_ai_value
				ai_sociability = high_chance_impact_positive_ai_value
				ai_rationality = high_chance_impact_positive_ai_value
			}
		}
	}

	# redirect toast to supporter
	option = {
		name = coronation_events.1023.b
		trigger = {
			has_activity_intent = coronation_embrace_supporters
			exists = scope:supporter
		}
		if = {
			limit = {
				scope:supporter = {
					opinion = {
						target = root
						value > 30
					}
				}
				OR = {
					scope:supporter = { is_ai = yes }
					AND = {
						scope:supporter = {
							is_ai = no
						}
						is_ai = no
					}
				}
			}
			progress_towards_friend_effect = {
				REASON = friend_toasted_coronation
				CHARACTER = scope:supporter
				OPINION = 20
			}
		}
		else = {
			reverse_add_opinion = {
				target = scope:supporter
				modifier = grateful_opinion
				opinion = 25
			}
		}

		coronation_embrace_supporters_opinion_effect = yes

		stress_impact = {
			shy = minor_stress_impact_gain
			gregarious = minor_stress_impact_loss
			vengeful = medium_stress_impact_gain
			wrathful = minor_stress_impact_gain
		}

		ai_chance = {
			base = 5
			ai_value_modifier = {
				ai_vengefulness = high_chance_impact_negative_ai_value
				ai_sociability = high_chance_impact_positive_ai_value
			}
		}
	}

	# answer the toast directly and imprison detractor
	option = {
		name = coronation_events.1023.c
		trigger = {
			has_activity_intent = coronation_weaken_detractors
			scope:detractor = {
				is_ai = yes
			}
		}
		hard_imprison_character_effect = {
			TARGET = scope:detractor
			IMPRISONER = root
		}
		add_dread = medium_dread_gain
		scope:detractor = {
			if = {
				limit = {
					government_allows = administrative
					top_liege = scope:activity.activity_host
				}
				change_influence = medium_influence_loss
			}
			else = {
				add_prestige = medium_prestige_loss
			}
			if = {
				limit = {
					OR = {
						is_ai = yes
						AND = {
							root = {
								is_ai = no
							}
							is_ai = no
						}
					}
				}
				progress_towards_rival_effect = {
					REASON = rival_unjustified_imprisonment
					CHARACTER = root
					OPINION = -50
				}
			}
		}
		if = {
			limit = {
				scope:detractor = {
					is_a_faction_member = yes
				}
			}
			scope:detractor.joined_faction = {
				add_faction_discontent = major_discontent_gain
			}
		}

		coronation_weaken_detractors_opinion_effect = yes

		stress_impact = {
			shy = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
			vengeful = medium_stress_impact_loss
			wrathful = minor_stress_impact_loss
			humble = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}

		ai_chance = {
			base = 5
			ai_value_modifier = {
				ai_vengefulness = high_chance_impact_positive_ai_value
				ai_zeal = high_chance_impact_negative_ai_value
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = humble
					has_trait = compassionate
				}
			}
		}
	}

	# remove the detractor by force
	option = {
		name = coronation_events.1023.d
		trigger = {
			NOT = {
				has_activity_intent = coronation_weaken_detractors
			}
		}
		scope:detractor = { remove_from_activity = scope:activity }
		add_dread = minor_dread_gain
		if = {
			limit = {
				scope:detractor = {
					is_a_faction_member = yes
				}
			}
			scope:detractor.joined_faction = {
				add_faction_discontent = minor_discontent_gain
			}
		}
		scope:detractor = {
			add_opinion = {
				modifier = humiliated_opinion
				target = root
				opinion = -25
			}
		}
		stress_impact = {
			humble = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
  		}
		ai_chance = {
			base = 1
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = humble
				}
			}
			modifier = {
				factor = 0.5
				scope:detractor = {
					is_a_faction_member = yes
				}
			}
			ai_value_modifier = {
				ai_vengefulness = high_chance_impact_positive_ai_value
				ai_zeal = high_chance_impact_negative_ai_value
			}
		}
	}

	# gracefully ignore
	option = {
		name = coronation_events.1023.e

		if = {
			limit = {
				government_allows = administrative
				top_liege = scope:activity.activity_host
			}
			change_influence = minor_influence_gain
		}
		else = {
			add_prestige = minor_prestige_gain
		}

		scope:detractor = {
			add_opinion = {
				target = root
				modifier = insult_opinion
				opinion = -10
			}
		}

		stress_impact = {
			shy = minor_stress_impact_loss
			vengeful = medium_stress_impact_gain
			wrathful = minor_stress_impact_gain
		}

		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_vengefulness = high_chance_impact_negative_ai_value
				ai_zeal = high_chance_impact_positive_ai_value
			}
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# Foreign guest brings a gift of friendship
coronation_events.1024 = {
	type = activity_event
	title = coronation_events.1024.t
	desc = {
		random_valid = {
			triggered_desc = {
				trigger = {
					NOT = {
						scope:foreign.faith = root.faith
					}
				}
				desc = coronation_events.1024.intro_diff_faith
			}
			triggered_desc = {
				trigger = {
					NOT = {
						scope:foreign.culture = root.culture
					}
				}
				desc = coronation_events.1024.intro_diff_culture
			}
			desc = coronation_events.1024.intro_diff_neither
		}
		desc = coronation_events.1024.desc
		triggered_desc = {
			trigger = {
				has_activity_intent = coronation_embrace_supporters
			}
			desc = coronation_events.1024.supporter.desc
		}
		triggered_desc = {
			trigger = {
				has_activity_intent = coronation_weaken_detractors
			}
			desc = coronation_events.1024.detractor.desc
		}
	}
	left_portrait = {
		character = scope:guest
		trigger = {
			exists = scope:guest
		}
		triggered_animation = {
			trigger = {
				scope:guest = {
					is_in_guest_subset = { name = supporter }
				}
			}
			animation = admiration
		}
		animation = scheme
	}

	right_portrait = {
		character = scope:foreign
		animation = throne_room_bow_1
		camera = camera_event_right
	}

	center_portrait = {
		character = root
		animation = happiness
	}

	theme = feast_activity

	cooldown = { years = 5 }

	trigger = {
		scope:activity = {
			any_attending_character = {
				is_ai = yes
				is_independent_ruler = yes
				NOT = {
					culture = root.culture
					has_relation_rival = root
					is_in_guest_subset = { name = detractor }
				}
				save_temporary_scope_as = foreign_temp
				trigger_if = {
					limit = {
						root = { has_activity_intent = coronation_weaken_detractors }
					}
					scope:activity = {
						any_guest_subset = {
							name = detractor
							is_ai = yes
							highest_held_title_tier >= tier_county
							opinion = {
								target = scope:foreign_temp
								value <= 0
							}
							NOT = {
								has_relation_rival = scope:foreign_temp
							}
						}
					}
				}
			}
		}
		trigger_if = {
			limit = {
				has_activity_intent = coronation_embrace_supporters
			}
			scope:activity = {
				any_guest_subset = {
					name = supporter
					is_ai = yes
				}
			}
		}
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes
		scope:activity = {
			activity_host = { save_scope_as = host }
			random_attending_character = {
				limit = {
					is_ai = yes
					is_independent_ruler = yes
					NOT = {
						culture = root.culture
						has_relation_rival = root
						is_in_guest_subset = { name = detractor }
					}
				}
				save_scope_as = foreign
			}
			if = {
				limit = {
					root = {
						has_activity_intent = coronation_embrace_supporters
					}
				}
				random_guest_subset = {
					name = supporter
					limit = {
						is_ai = yes
					}
					save_scope_as = guest
				}
			}
			if = {
				limit = {
					root = {
						has_activity_intent = coronation_weaken_detractors
					}
				}
				random_guest_subset = {
					name = detractor
					limit = {
						is_ai = yes
						highest_held_title_tier >= tier_county
						opinion = {
							target = scope:foreign
							value <= 0
						}
						NOT = {
							has_relation_rival = scope:foreign
						}
					}
					save_scope_as = guest
				}
			}
		}
	}

	# use the situation to awe the people present
	option = {
		trigger = {
			has_activity_intent = coronation_impress_attendees
		 }
		name = coronation_events.1024.impress_attendees

		scope:foreign = {
			pay_short_term_gold = {
				target = root
				gold = activity_minor_gold_value
			}
		}
		culture = {
			change_cultural_acceptance = {
				target = scope:foreign.culture
				value = low_positive_culture_acceptance
				desc = cultural_acceptance_gain_event
			}
		}

		custom_tooltip = coronation_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}

		coronation_impress_attendees_opinion_effect = yes

		stress_impact = {
			content = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = high_chance_impact_positive_ai_value
				ai_rationality = high_chance_impact_positive_ai_value
			}
		}
	}

	# use the situation to bolster a supporter
	option = {
		trigger = {
			has_activity_intent = coronation_embrace_supporters
			scope:foreign = {
				NOR = {
					is_at_war_with = root
					is_allied_to = root
				}
				highest_held_title_tier >= tier_county
				is_in_guest_subset = { name = supporter }
				#Not way way stronger than root
				half_max_military_strength < root.max_military_strength
			}
		}
		name = coronation_events.1024.embrace_supporters

		scope:foreign = {
			pay_short_term_gold = {
				target = root
				gold = activity_minor_gold_value
			}
			add_opinion = {
				target = root
				modifier = event_negotiated_alliance_opinion
			}
			save_scope_as = recipient
		}

		scope:guest = {
			if = {
				limit = {
					highest_held_title_tier < root.highest_held_title_tier
				}
				if = {
					limit = {
						government_allows = administrative
						top_liege = scope:activity.activity_host
					}
					change_influence = medium_influence_gain
				}
				else = {
					add_prestige = medium_prestige_gain
				}
			}
		}

		custom_tooltip = negotiate_alliance_effect_tooltip
		create_alliance = {
			target = scope:foreign
			allied_through_owner = root
			allied_through_target = scope:foreign
		}

		stress_impact = {
			arrogant = minor_stress_impact_gain
			fickle = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
			}
			#Root is much stronger
			modifier = {
				add = -100
				root.half_max_military_strength > scope:foreign.max_military_strength
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = paranoid
					has_trait = fickle
					has_trait = arrogant
				}
			}
		}
	}

	# use the situation to stress out a detractor
	option = {
		trigger = {
			has_activity_intent = coronation_weaken_detractors
			exists = scope:guest
		 }
		name = coronation_events.1024.weaken_detractors

		scope:foreign = {
			pay_short_term_gold = {
				target = root
				gold = activity_minor_gold_value
			}
		}

		scope:guest = {
			add_stress = medium_stress_gain
			if = {
				limit = {
					OR = {
						root = { is_ai = no }
						AND = {
							is_ai = yes
							scope:foreign = { is_ai = yes }
						}
					}
				}
				progress_towards_rival_effect = {
					REASON = rival_foreign_threat
					CHARACTER = scope:foreign
					OPINION = -30
				}
			}
			if = {
				limit = {
					OR = {
						is_ai = yes
						AND = {
							root = { is_ai = no }
							is_ai = no
						}
					}
				}
				progress_towards_rival_effect = {
					REASON = rival_foreign_threat
					CHARACTER = scope:foreign
					OPINION = -30
				}
			}
		}

		coronation_weaken_detractors_opinion_effect = yes

		stress_impact = {
			compassionate = medium_stress_impact_gain
			craven = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_compassion = -1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = craven
				}
			}
		}
	}

	# use the situation to ensnare them as tributary
	option = {
		trigger = {
			has_activity_intent = coronation_exalt_crown
			scope:foreign = {
				is_tributary = no
				highest_held_title_tier < root.highest_held_title_tier
				is_landed = yes
			}
		}
		name = coronation_events.1024.exalt_crown

		scope:foreign = {
			add_opinion = {
				modifier = audacity_opinion
				target = root
				opinion = -30
			}
			pay_short_term_gold = {
				target = root
				gold = activity_minor_gold_value
			}
		}
		start_tributary_interaction_effect = {
			TRIBUTARY = scope:foreign
			SUZERAIN = root
		}
		if = {
			limit = {
				scope:foreign = {
					OR = {
						highest_held_title_tier >= tier_kingdom
						max_military_strength >= root.max_military_strength
					}
				}
			}
			add_tyranny = medium_tyranny_gain
		}
		else_if = {
			limit = {
				scope:foreign = {
					OR = {
						highest_held_title_tier >= tier_duchy
						max_military_strength >= root.half_max_military_strength
					}
				}
			}
			add_tyranny = minor_tyranny_gain
		}


		stress_impact = {
			content = medium_stress_impact_gain
			generous = medium_stress_impact_gain
			humble = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_honor = -1
				ai_greed = 1
			}
			modifier = {
				add = 50
				scope:foreign = {
					highest_held_title_tier < tier_kingdom
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = content
					has_trait = generous
					has_trait = humble
					has_trait = just
				}
			}
		}
	}

	# rudely decline
	option = {
		name = coronation_events.1024.a

		add_prestige = medium_prestige_gain

		scope:foreign = {
			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -20
			}
		}

		stress_impact = {
			greedy = minor_stress_impact_gain
			trusting = minor_stress_impact_gain
		}

		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_compassion = -1
				ai_greed = -1
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = trusting
				}
			}
		}
	}

	# politely accept
	option = {
		name = coronation_events.1024.b

		scope:foreign = {
			pay_short_term_gold = {
				target = root
				gold = activity_minor_gold_value
			}
		}

		culture = {
			change_cultural_acceptance = {
				target = scope:foreign.culture
				value = miniscule_positive_culture_acceptance
				desc = cultural_acceptance_gain_event
			}
		}

		scope:foreign = {
			add_opinion = {
				target = root
				modifier = impressed_opinion
				opinion = 10
			}
		}

		stress_impact = {
			callous = miniscule_stress_impact_gain
		}

		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_compassion = 0.5
			}
		}
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# two guests argue during the feast
coronation_events.1025 = {
    type = activity_event
    title = coronation_events.1025.t

    desc = {
    	desc = coronation_events.1025.desc.intro
        triggered_desc = {
            trigger = { exists = scope:supporter }
            desc = coronation_events.1025.desc.supporter
        }
        triggered_desc = {
            trigger = { exists = scope:detractor }
            desc = coronation_events.1025.desc.detractor
        }
    }

    left_portrait = {
        trigger = { exists = scope:supporter }
        character = scope:supporter
        animation = drink_goblet
        camera = camera_event_very_right
    }

    center_portrait = {
        character = root
        animation = wedding_objection_start
    }

    right_portrait = {
        trigger = { exists = scope:detractor }
        character = scope:detractor
        animation = drink_goblet
        camera = camera_event_very_left
    }

    theme = feast_activity
    cooldown = { years = 5 }

    trigger = {
        scope:activity = {
            any_attending_character = {
                is_ai = yes
                is_adult = yes
                is_in_guest_subset = { name = supporter }
            }
            any_attending_character = {
                is_ai = yes
                is_adult = yes
                is_in_guest_subset = { name = detractor }
            }
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        scope:activity = {
            random_attending_character = {
                limit = {
                    is_ai = yes
                    is_adult = yes
                    is_in_guest_subset = { name = supporter }
                }
                save_scope_as = supporter
            }
            random_attending_character = {
                limit = {
                    is_ai = yes
                    is_adult = yes
                    is_in_guest_subset = { name = detractor }
                }
                save_scope_as = detractor
            }
        }
    }

   	option = {
        name = coronation_events.1025.a
        trigger = {
            has_activity_intent = coronation_embrace_supporters
            exists = scope:supporter
        }
        if = {
        	limit = {
        		reverse_opinion = {
        			target = scope:supporter
        			value > 40
        		}
				OR = {
					scope:supporter = { is_ai = yes }
					AND = {
						scope:supporter = {
							is_ai = no
						}
						is_ai = no
					}
				}
        	}
        	progress_towards_friend_effect = {
				REASON = friend_took_side_in_fight
				CHARACTER = scope:supporter
				OPINION = 30
			}
        }
        else = {
        	scope:supporter = {
        		add_opinion = {
        			target = root
        			modifier = grateful_opinion
        			opinion = 30
        		}
        	}
        }
        if = {
			limit = {
				government_allows = administrative
				top_liege = scope:activity.activity_host
			}
			change_influence = minor_influence_gain
		}
		else = {
			add_prestige = minor_prestige_gain
		}
        scope:detractor = {
        	add_opinion = {
        		modifier = contempt_opinion
        		target = root
        		opinion = -20
        	}
        }

        stress_impact = {
            gregarious = minor_stress_impact_loss
            shy = minor_stress_impact_gain
        }

        coronation_embrace_supporters_opinion_effect = yes

        ai_chance = {
            base = 30
            ai_value_modifier = {
                ai_greed = high_chance_impact_negative_ai_value
                ai_honor = high_chance_impact_positive_ai_value
            }
        }
    }

    option = {
        name = coronation_events.1025.b
        trigger = {
            has_activity_intent = coronation_impress_attendees
        }

        custom_tooltip = coronation_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}

        coronation_impress_attendees_opinion_effect = yes

        stress_impact = {
            brave = minor_stress_impact_loss
            craven = minor_stress_impact_gain
        }

        ai_chance = {
            base = 25
            ai_value_modifier = {
                ai_sociability = high_chance_impact_positive_ai_value
                ai_rationality = high_chance_impact_positive_ai_value
            }
        }
    }

    option = {
        name = coronation_events.1025.d
        trigger = {
            has_activity_intent = coronation_weaken_detractors
            exists = scope:detractor
        }

        scope:detractor = {
            add_opinion = {
                target = root
                modifier = insulted_opinion
                opinion = -25
            }
            add_stress = medium_stress_gain
        }

        coronation_weaken_detractors_opinion_effect = yes

        stress_impact = {
            vengeful = minor_stress_impact_loss
            compassionate = minor_stress_impact_gain
        }

        ai_chance = {
            base = 20
            ai_value_modifier = {
                ai_vengefulness = high_chance_impact_positive_ai_value
                ai_rationality = high_chance_impact_positive_ai_value
            }
        }
    }

    option = {
        name = coronation_events.1025.e
        trigger = {
            has_activity_intent = coronation_exalt_crown
            any_vassal = {
            	has_vassal_stance = parochial
            }
        }

        coronation_exalt_crown_opinion_effect = yes

        stress_impact = {
            arrogant = minor_stress_impact_gain
            content = minor_stress_impact_gain
        }

        ai_chance = {
            base = 50
            ai_value_modifier = {
                ai_sociability = high_chance_impact_positive_ai_value
                ai_rationality = high_chance_impact_positive_ai_value
            }
        }
    }

    option = {
        name = coronation_events.1025.c

        if = {
        	limit = {
        		reverse_opinion = {
        			target = scope:supporter
        			value > 40
        		}
				OR = {
					scope:supporter = { is_ai = yes }
					AND = {
						scope:supporter = {
							is_ai = no
						}
						is_ai = no
					}
				}
        	}
        	progress_towards_friend_effect = {
				REASON = friend_took_side_in_fight
				CHARACTER = scope:supporter
				OPINION = 20
			}
        }
        else = {
        	scope:supporter = {
        		add_opinion = {
        			target = root
        			modifier = grateful_opinion
        			opinion = 20
        		}
        	}
        }
        scope:detractor = {
        	add_opinion = {
        		modifier = contempt_opinion
        		target = root
        		opinion = -10
        	}
        }

        stress_impact = {
            ambitious = minor_stress_impact_gain
            shy = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40
            ai_value_modifier = {
                ai_rationality = high_chance_impact_positive_ai_value
                ai_sociability = medium_chance_impact_positive_ai_value
            }
        	opinion_modifier = {
				opinion_target = scope:supporter
				multiplier = 0.5
			}
			modifier = {
				scope:detractor.current_military_strength > scope:supporter.current_military_strength
				add = -50
			}
        }
    }

    option = {
        name = coronation_events.1025.f

        if = {
        	limit = {
        		reverse_opinion = {
        			target = scope:detractor
        			value >= 0
        		}
				OR = {
					scope:detractor = { is_ai = yes }
					AND = {
						scope:detractor = {
							is_ai = no
						}
						is_ai = no
					}
				}
        	}
        	progress_towards_friend_effect = {
				REASON = friend_took_side_in_fight
				CHARACTER = scope:detractor
				OPINION = 20
			}
        }
        else = {
        	scope:detractor = {
        		add_opinion = {
        			target = root
        			modifier = grateful_opinion
        			opinion = 30
        		}
        	}
        }
        scope:supporter = {
        	add_opinion = {
        		modifier = angry_opinion
        		target = root
        		opinion = -10
        	}
        }

        stress_impact = {
            ambitious = minor_stress_impact_gain
            shy = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40
            ai_value_modifier = {
                ai_rationality = high_chance_impact_positive_ai_value
                ai_sociability = medium_chance_impact_positive_ai_value
            }
        	opinion_modifier = {
				opinion_target = scope:detractor
				multiplier = 0.5
			}
			modifier = {
				scope:supporter.current_military_strength > scope:detractor.current_military_strength
				add = -50
			}
        }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}

# coronation cake token hunt
coronation_events.1026 = {
    type = activity_event
    title = coronation_events.1026.t

    desc = {
    	desc = coronation_events.1026.desc
        first_valid = {
            triggered_desc = {
                trigger = { root = scope:token_finder }
                desc = coronation_events.1026.special_desc
            }
            triggered_desc = {
                trigger = {
                	scope:token_finder = {
                		is_in_guest_subset = { name = supporter }
                	}
                }
                desc = coronation_events.1026.supporter_desc
            }
            triggered_desc = {
                trigger = {
                	scope:token_finder = {
                		is_in_guest_subset = { name = detractor }
                	}
                }
                desc = coronation_events.1026.detractor_desc
            }
            desc = coronation_events.1026.fallback_desc
        }
    }

    left_portrait = {
    	trigger = {
    		NOT = {
    			scope:token_finder = root
    		}
    	}
        character = root
        animation = ecstasy
    }
    center_portrait = {
        character = scope:token_finder
        animation = toast
        camera = camera_event_left
    }
    right_portrait = {
        character = scope:guest
        trigger = { exists = scope:guest }
        animation = throne_room_cheer_1
        camera = camera_event_right
    }

    theme = feast_activity
    cooldown = { years = 5 }

    trigger = {
    	scope:activity = {
            has_activity_option = {
                category = ceremony_feast_type
                option = ceremony_feast_type_lavish
            }
            any_attending_character = {
                count >= 2
                is_ai = yes
                is_adult = yes
                NOT = { this = root }
            }
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        scope:activity = {
            random_attending_character = {
            	limit = {
            		trigger_if = {
            			limit = {
            				root = {
            					has_activity_intent = coronation_embrace_supporters
            				}
            			}
            			OR = {
            				is_in_guest_subset = { name = supporter }
            				this = root
            			}
            		}
            		trigger_if = {
            			limit = {
            				root = {
            					has_activity_intent = coronation_weaken_detractors
            				}
            			}
            			OR = {
            				is_in_guest_subset = { name = detractor }
            				this = root
            			}
            		}
            	}
                save_scope_as = token_finder
            }
            random_attending_character = {
                limit = {
                	is_ai = yes
                	is_adult = yes
                	NOT = { this = root }
                	NOT = { this = scope:token_finder }
                }
                save_scope_as = guest
            }
        }
    }

    option = {
        name = coronation_events.1026.special
        trigger = {
        	scope:token_finder = root
        }

        add_prestige = medium_prestige_gain
        add_legitimacy = minor_legitimacy_gain

        scope:activity = {
        	every_attending_character = {
	            limit = { NOT = { this = root } }
				custom = custom.every_attending_character
	            add_opinion = {
	                target = root
	                modifier = impressed_opinion
	                opinion = 10
	            }
	        }
        }


        custom_tooltip = coronation_tt_positive_tiny
        scope:activity = { activity_special_type_progression_tiny = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}

        stress_impact = {
            arrogant = minor_stress_impact_loss
            humble = minor_stress_impact_gain
        }

        ai_chance = {
        	base = 500
        }
    }

    option = {
        name = coronation_events.1026.a
        trigger = {
        	has_activity_intent = coronation_impress_attendees
        	NOT = {
        		root = scope:token_finder
        	}
        }

		coronation_impress_attendees_opinion_effect = yes
		custom_tooltip = coronation_tt_positive_tiny

        coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}
        scope:activity = {
        	every_attending_character = {
	            limit = {
	            	is_ai = yes
	            	NOT = { this = root }
	            }
	            custom = custom.every_attending_character
	            add_opinion = {
	                target = root
	                modifier = impressed_opinion
	                opinion = 5
	            }
	        }
        	activity_special_type_progression_tiny = yes
        }

        if = {
			limit = {
				government_allows = administrative
				top_liege = scope:activity.activity_host
			}
			change_influence = minor_influence_gain
		}
		else = {
			add_prestige = minor_prestige_gain
		}

        stress_impact = {
            brave = minor_stress_impact_loss
            craven = minor_stress_impact_gain
        }

        ai_chance = {
            base = 30
            modifier = {
                factor = 0.5
                has_trait = craven
            }
            ai_value_modifier = {
				ai_honor = high_chance_impact_positive_ai_value
				ai_sociability = high_chance_impact_positive_ai_value
			}
        }
    }

   	option = {
        name = coronation_events.1026.b
        trigger = {
        	has_activity_intent = coronation_embrace_supporters
        	scope:token_finder = {
				is_in_guest_subset = { name = supporter }
			}
        	NOT = {
        		root = scope:token_finder
        	}
        }

        pay_short_term_gold = {
			target = scope:token_finder
			gold = activity_minor_gold_value
		}

		if = {
			limit = {
				reverse_opinion = {
					target = scope:token_finder
					value > 50
				}
				OR = {
					scope:token_finder = { is_ai = yes }
					AND = {
						scope:token_finder = {
							is_ai = no
						}
						is_ai = no
					}
				}
			}
			  progress_towards_friend_effect = {
				REASON = friend_token_reward
				CHARACTER = scope:token_finder
				OPINION = 20
			}
		}
        else = {
        	scope:token_finder = {
        		add_opinion = {
        			target = root
        			modifier = grateful_opinion
        			opinion = 20
        		}
        	}
        }


		coronation_embrace_supporters_opinion_effect = yes

        stress_impact = {
            generous = minor_stress_impact_loss
            greedy = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40
            modifier = {
                factor = 2
                has_trait = generous
            }
            modifier = {
                factor = 0.5
                has_trait = greedy
            }
            ai_value_modifier = {
				ai_greed = high_chance_impact_negative_ai_value
				ai_sociability = high_chance_impact_positive_ai_value
			}
        }
    }

    option = {
        name = coronation_events.1026.c
        trigger = {
        	has_activity_intent = coronation_weaken_detractors
        	scope:token_finder = {
				is_in_guest_subset = { name = detractor }
			}
        	NOT = {
        		root = scope:token_finder
        	}
        }

        scope:token_finder = {
            add_stress = medium_stress_gain
            add_opinion = {
                target = root
                modifier = insulted_opinion
                opinion = -15
            }
        }
        if = {
			limit = {
				government_allows = administrative
				top_liege = scope:activity.activity_host
			}
			change_influence = minor_influence_gain
		}
		else = {
			add_prestige = minor_prestige_gain
		}

        coronation_weaken_detractors_opinion_effect = yes

        stress_impact = {
            vengeful = minor_stress_impact_loss
            compassionate = minor_stress_impact_gain
        }

        ai_chance = {
            base = 25
            modifier = {
                add = 20
                has_trait = vengeful
            }
            modifier = {
                factor = 0.5
                has_trait = compassionate
            }
            ai_value_modifier = {
				ai_honor = high_chance_impact_negative_ai_value
				ai_sociability = high_chance_impact_negative_ai_value
			}
        }
    }

    option = {
        name = coronation_events.1026.d
        trigger = {
        	has_activity_intent = coronation_exalt_crown
        	NOT = {
        		root = scope:token_finder
        	}
        	exists = dynasty
        	scope:token_finder.dynasty ?= root.dynasty
        }
        dynasty = { add_dynasty_prestige = minor_dynasty_prestige_gain }

		coronation_exalt_crown_opinion_effect = yes

        stress_impact = {
            arrogant = minor_stress_impact_loss
            content = minor_stress_impact_gain
        }

        ai_chance = {
            base = 50
            modifier = {
                add = 10
                has_trait = arrogant
            }
            modifier = {
                factor = 0.5
                has_trait = content
            }
            ai_value_modifier = {
				ai_honor = high_chance_impact_negative_ai_value
				ai_sociability = high_chance_impact_negative_ai_value
			}
        }
    }

    option = {
        name = coronation_events.1026.e

        stress_impact = {
            base = minor_stress_impact_loss
            gluttonous = minor_stress_impact_loss
            temperate = minor_stress_impact_gain
        }

        ai_chance = {
            base = 60
            modifier = {
                add = 20
                has_trait = gluttonous
            }
            modifier = {
                factor = 0.5
                has_trait = temperate
            }
            ai_value_modifier = {
				ai_sociability = medium_chance_impact_negative_ai_value
				ai_honor = medium_chance_impact_negative_ai_value
			}
        }
    }

    option = {
        name = coronation_events.1026.f

        add_piety = minor_piety_gain
        stress_impact = {
            gluttonous = minor_stress_impact_gain
            temperate = minor_stress_impact_loss
        }

        ai_chance = {
            base = 30
            modifier = {
                add = 30
                has_trait = temperate
            }
            modifier = {
                factor = 0.5
                has_trait = gluttonous
            }
            ai_value_modifier = {
				ai_sociability = high_chance_impact_positive_ai_value
				ai_honor = medium_chance_impact_positive_ai_value
			}
        }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}

# a guest is highlighted during a choreography
coronation_events.1027 = {
    type = activity_event
    title = coronation_events.1027.t
    desc = {
        desc = coronation_events.1027.desc
        first_valid = {
            triggered_desc = {
                trigger = { root = scope:highlighted_guest }
                desc = coronation_events.1027.special_desc
            }
            triggered_desc = {
                trigger = {
                    scope:highlighted_guest = {
                        is_in_guest_subset = { name = supporter }
                    }
                }
                desc = coronation_events.1027.supporter_desc
            }
            triggered_desc = {
                trigger = {
                    scope:highlighted_guest = {
                        is_in_guest_subset = { name = detractor }
                    }
                }
                desc = coronation_events.1027.detractor_desc
            }
            desc = coronation_events.1027.fallback_desc
        }
    }

    left_portrait = {
		character = root
		animation = throne_room_applaud_1
	}

	right_portrait = {
		trigger = {
			NOT = {
				scope:highlighted_guest = root
			}
		}
		character = scope:highlighted_guest
		animation = dancing
	}

    theme = feast_activity
    cooldown = { years = 5 }

    trigger = {
		scope:activity = {
			NOT = {
				has_activity_option = {
	                category = ceremony_feast_type
	                option = ceremony_feast_type_austere
	            }
			}
			any_attending_character = {
                is_adult = yes
                is_ai = yes
            }
        }
	}

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        scope:activity = {
            random_attending_character = {
                limit = {
                    is_adult = yes
                    is_ai = yes
                }
                create_character_memory = {
					type = coronation_highlighted_memory
					participants = {
						host = scope:host
					}
				}
                save_scope_as = highlighted_guest
            }
        }
    }

    option = {
        name = coronation_events.1027.special
        trigger = {
            root = scope:highlighted_guest
        }

        add_prestige = medium_prestige_gain
        add_legitimacy = minor_legitimacy_gain

        scope:activity = {
            every_attending_character = {
                limit = { NOT = { this = root } }
                add_opinion = {
                    target = root
                    modifier = impressed_opinion
                    opinion = 10
                }
            }
        }

        custom_tooltip = coronation_tt_positive_tiny
        scope:activity = { activity_special_type_progression_tiny = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}

        stress_impact = {
            gregarious = minor_stress_impact_loss
            shy = minor_stress_impact_gain
        }

        ai_chance = {
        	base = 500
        	ai_value_modifier = {
				ai_sociability = high_chance_impact_positive_ai_value
			}
        }
    }

    option = {
        name = coronation_events.1027.a
        trigger = {
            has_activity_intent = coronation_impress_attendees
            NOT = { root = scope:highlighted_guest }
        }

        custom_tooltip = coronation_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}

		coronation_impress_attendees_opinion_effect = yes

        stress_impact = {
            gregarious = minor_stress_impact_loss
            shy = minor_stress_impact_gain
        }

        ai_chance = {
            base = 30
            ai_value_modifier = {
				ai_sociability = medium_chance_impact_positive_ai_value
			}
        }
    }

    option = {
        name = coronation_events.1027.b
        trigger = {
        	has_activity_intent = coronation_embrace_supporters
            scope:highlighted_guest = {
                is_in_guest_subset = { name = supporter }
            }
        }
        if = {
        	limit = {
        		reverse_opinion = {
        			target = scope:highlighted_guest
        			value > 50
        		}
				OR = {
					scope:highlighted_guest = { is_ai = yes }
					AND = {
						scope:highlighted_guest = {
							is_ai = no
						}
						is_ai = no
					}
				}
        	}
        	progress_towards_friend_effect = {
        	   CHARACTER = scope:highlighted_guest
        	   REASON = friend_dance
        	   OPINION = 20
       		}
        }
       	else = {
       		reverse_add_opinion = {
       			target = scope:highlighted_guest
       			modifier = spirits_lifted_opinion
       			opinion = 20
       		}
       	}

       	scope:highlighted_guest = {
       		if = {
				limit = {
					government_allows = administrative
					top_liege = scope:activity.activity_host
				}
				change_influence = minor_influence_gain
			}
			else = {
				add_prestige = minor_prestige_gain
			}
       	}

       	coronation_embrace_supporters_opinion_effect = yes

        stress_impact = {
            generous = minor_stress_impact_loss
            arrogant = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40
            ai_value_modifier = {
				ai_greed = medium_chance_impact_negative_ai_value
				ai_compassion = medium_chance_impact_positive_ai_value
				ai_sociability = high_chance_impact_positive_ai_value
			}
        }
    }

    option = {
        name = coronation_events.1027.c
        trigger = {
            has_activity_intent = coronation_weaken_detractors
            scope:highlighted_guest = {
                is_in_guest_subset = { name = detractor }
            }
        }

        scope:highlighted_guest = {
            add_stress = medium_stress_gain
            add_opinion = {
                target = root
                modifier = insulted_opinion
                opinion = -15
            }
        }

        if = {
			limit = {
				government_allows = administrative
				top_liege = scope:activity.activity_host
			}
			change_influence = minor_influence_gain
		}
		else = {
			add_prestige = minor_prestige_gain
		}

        coronation_weaken_detractors_opinion_effect = yes

        stress_impact = {
            vengeful = minor_stress_impact_loss
            compassionate = minor_stress_impact_gain
        }

        ai_chance = {
            base = 25
            ai_value_modifier = {
				ai_honor = high_chance_impact_negative_ai_value
				ai_sociability = high_chance_impact_negative_ai_value
			}
        }
    }

    option = {
        name = coronation_events.1027.d
        trigger = {
            has_activity_intent = coronation_exalt_crown
            NOT = { root = scope:highlighted_guest }
        }

        dynasty = {
			add_dynasty_prestige = minor_dynasty_prestige_gain
		}

		coronation_exalt_crown_opinion_effect = yes

        stress_impact = {
            arrogant = minor_stress_impact_loss
            humble = minor_stress_impact_gain
        }

        ai_chance = {
            base = 50
            ai_value_modifier = {
				ai_zeal = medium_chance_impact_positive_ai_value
			}
        }
    }

    option = {
	    name = coronation_events.1027.e

	    scope:activity = {
	        every_attending_character = {
	            limit = {
	                is_ai = yes
	                NOT = { this = root }
	            }
	            custom = custom.every_attending_character
	            add_opinion = {
	                target = root
	                modifier = friendliness_opinion
	                opinion = 10
	            }
	        }
	    }

	    stress_impact = {
	    	gregarious = minor_stress_impact_loss
	        shy = minor_stress_impact_gain
	    }

	    ai_chance = {
	        base = 45
	        modifier = {
	            add = 10
	            has_trait = gregarious
	        }
	        modifier = {
	            factor = 0.5
	            has_trait = shy
	        }
	        ai_value_modifier = {
	            ai_sociability = high_chance_impact_positive_ai_value
	        }
	    }
    }

    option = {
	    name = coronation_events.1027.f

	    scope:activity = {
	        every_attending_character = {
	            limit = {
	                is_ai = yes
	                NOT = { this = root }
	            }
	            custom = custom.every_attending_character
	            add_opinion = {
	                target = root
	                modifier = disappointed_opinion
	                opinion = -5
	            }
	        }
	    }

	    stress_impact = {
	    	base = minor_stress_impact_loss
	        shy = minor_stress_impact_loss
	        gregarious = minor_stress_impact_gain
	    }

	    ai_chance = {
	        base = 35
	        modifier = {
	            add = 15
	            has_trait = shy
	        }
	        modifier = {
	            factor = 0.4
	            has_trait = gregarious
	        }
	        ai_value_modifier = {
	            ai_sociability = high_chance_impact_negative_ai_value
	        }
	    }
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# Multi-faith blessing offer during the Coronation Ceremony
coronation_events.1028 = {
    type = activity_event
    title = coronation_events.1028.t

    theme = coronation_activity
    cooldown = { years = 5 }

    left_portrait = {
        character = root
        animation = interested
    }

    center_portrait = {
        character = scope:clergy_representative
        animation = ecstasy
        camera = camera_event_right
    }

    right_portrait = {
    	character = scope:guest
    	animation = stunned
    }

    desc = {
    	first_valid = {
    		triggered_desc = {
				trigger = {
					scope:guest = {
						is_in_guest_subset = { name = detractor }
					}
				}
				desc = coronation_events.1028.detractor.desc
			}
			triggered_desc = {
				trigger = {
					scope:guest = {
						is_in_guest_subset = { name = supporter }
					}
				}
				desc = coronation_events.1028.supporter.desc
			}
			desc = coronation_events.1028.fallback.desc
    	}
    }

    trigger = {
        faith = {
			NOT = {
				has_doctrine = doctrine_pluralism_pluralistic
			}
		}
        scope:activity = {
            any_attending_character = {
                is_adult = yes
                is_ai = yes
                NOT = {
                	faith = root.faith
                	has_trait = cynical
                }
            }
            trigger_if = {
            	limit = {
            		root = { has_activity_intent = coronation_weaken_detractors }
            	}
            	any_attending_character = {
	                is_adult = yes
	                is_ai = yes
	                is_in_guest_subset = { name = detractor }
	                faith = root.faith
	            }
            }
            trigger_if = {
            	limit = {
            		root = { has_activity_intent = coronation_embrace_supporters }
            	}
            	any_attending_character = {
	                is_adult = yes
	                is_ai = yes
	                is_in_guest_subset = { name = supporter }
	                faith = root.faith
	            }
            }
            trigger_else = {
            	any_attending_character = {
	                is_adult = yes
	                is_ai = yes
	                faith = root.faith
	            }
            }
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

    	if = {
    		limit = {
    			has_activity_intent = coronation_weaken_detractors
    		}
    		scope:activity = {
    			random_attending_character = {
	                limit = {
	                    is_adult = yes
		                is_ai = yes
		                is_in_guest_subset = { name = detractor }
		                faith = root.faith
	                }
	                save_scope_as = guest
	            }
    		}
    	}
    	else_if = {
    		limit = {
    			has_activity_intent = coronation_embrace_supporters
    		}
    		scope:activity = {
    			random_attending_character = {
	                limit = {
	                    is_adult = yes
		                is_ai = yes
		                is_in_guest_subset = { name = supporter }
		                faith = root.faith
	                }
	                save_scope_as = guest
	            }
    		}
    	}
    	else = {
    		scope:activity = {
    			random_attending_character = {
	                limit = {
	                    is_adult = yes
		                is_ai = yes
		                faith = root.faith
	                }
	                save_scope_as = guest
	            }
    		}
    	}
        scope:activity = {
            random_attending_character = {
                limit = {
                    is_adult = yes
                    NOT = {
	                	faith = root.faith
	                	has_trait = cynical
	                }
                }
                save_scope_as = clergy_representative
            }
        }
    }

    option = {
        name = coronation_events.1028.supporter
        trigger = {
        	has_activity_intent = coronation_embrace_supporters
        	scope:guest = {
				is_in_guest_subset = { name = supporter }
			}
        }
        add_learning_lifestyle_xp = medium_lifestyle_xp
        add_piety = medium_piety_gain
        if = {
			limit = {
				can_set_relation_friend_trigger = { CHARACTER = scope:guest }
				scope:guest = {
					opinion = {
						target = root
						value > 0
					}
				}
				OR = {
					scope:guest = { is_ai = yes }
					AND = {
						scope:guest = {
							is_ai = no
						}
						is_ai = no
					}
				}
			}
			progress_towards_friend_effect = {
				REASON = friend_matters_of_faith
				CHARACTER = scope:guest
				OPINION = default_friend_opinion
			}
		}
		else = {
			reverse_add_opinion = {
       			target = scope:guest
       			modifier = kindness_opinion
       			opinion = 20
       		}
		}



		scope:guest = {
			add_piety = medium_piety_gain
		}

		coronation_embrace_supporters_opinion_effect = yes

		stress_impact = {
            shy = minor_stress_impact_gain
            gregarious = minor_stress_impact_loss
        }

        ai_chance = {
            base = 50
            ai_value_modifier = {
                ai_zeal = high_chance_impact_negative_ai_value
                ai_sociability = medium_chance_impact_positive_ai_value
            }
        }
    }

    option = {
        name = coronation_events.1028.detractor
        trigger = {
        	has_activity_intent = coronation_weaken_detractors
        	scope:guest = {
				is_in_guest_subset = { name = detractor }
			}
            faith = {
            	faith_hostility_level = {
					target = scope:clergy_representative.faith
					value > faith_astray_level
				}
            }
        }
        add_intrigue_lifestyle_xp = medium_lifestyle_xp


		scope:guest = {
			add_piety = medium_piety_loss
			add_stress = major_stress_gain
		}

		scope:activity = {
            every_attending_character = {
            	limit = {
					NOT = {
						has_trait = cynical
					}
					faith = root.faith
				}

				custom = coronation_events.1028.detractor.tt

                add_opinion = {
                    target = scope:guest
                    modifier = impious_opinion
                    opinion = -10
                }
            }
        }

        coronation_weaken_detractors_opinion_effect = yes

		stress_impact = {
            forgiving = minor_stress_impact_gain
            vengeful = minor_stress_impact_loss
        }

        ai_chance = {
            base = 50
            ai_value_modifier = {
                ai_honor = high_chance_impact_negative_ai_value
                ai_vengefulness = medium_chance_impact_positive_ai_value
            }
        }
    }

    option = {
        name = coronation_events.1028.c # Publicly rebuke the request

        trigger = {
        	has_trait = zealous
        }
        add_piety = major_piety_gain

        random = {
			chance = {
				value = 10
				if = {
					limit = {
						scope:clergy_representative.faith = {
							faith_hostility_level = {
								target = root.faith
								value >= faith_astray_level
							}
						}
					}
					add = 10
				}
				else_if = {
					limit = {
						scope:clergy_representative.faith = {
							faith_hostility_level = {
								target = root.faith
								value >= faith_hostile_level
							}
						}
					}
					add = 20
				}
				else_if = {
					limit = {
						scope:clergy_representative.faith = {
							faith_hostility_level = {
								target = root.faith
								value >= faith_evil_level
							}
						}
					}
					add = 30
				}
			}
			add_trait = holy_warrior
		}

        scope:clergy_representative = {
            add_opinion = {
                target = root
                modifier = insulted_opinion
                opinion = -15
            }
            add_stress = minor_stress_gain
        }

        scope:activity = {
            every_attending_character = {
                limit = {
                	NOT = {
                		this = scope:clergy_representative
                	}
                    has_trait = zealous
                    faith = root.faith
                    NOT = { this = root }
                }
                custom = coronation_events.1028.c.tt
                add_opinion = {
                    target = root
                    modifier = pious_opinion
                    opinion = 20
                }
            }
        }

        stress_impact = {
            zealous = minor_stress_impact_loss
            cynical = major_stress_impact_gain
            compassionate = minor_stress_impact_gain
        }

        ai_chance = {
            base = 30
            ai_value_modifier = {
                ai_zeal = high_chance_impact_positive_ai_value
                ai_sociability = high_chance_impact_negative_ai_value
            }
        }
    }

    option = {
        name = coronation_events.1028.a
        trigger = {
        	has_trait = cynical
        }
		add_character_modifier = {
			modifier = tolerant_opinion_modifier
			years = 25
		}

        scope:guest = {
       		coronation_move_towards_supporter_effect = { CHARACTER = scope:guest }
       		add_opinion = {
       			target = root
       			modifier = kindness_opinion
       			opinion = 20
       		}
       	}
		add_piety = {
			value = miniscule_piety_loss
			if = {
				limit = {
					scope:clergy_representative.faith = {
						faith_hostility_level = {
							target = root.faith
							value = faith_astray_level
						}
					}
				}
				add = minor_piety_loss
			}
			else_if = {
				limit = {
					scope:clergy_representative.faith = {
						faith_hostility_level = {
							target = root.faith
							value >= faith_hostile_level
						}
					}
				}
				add = medium_piety_loss
			}
			else_if = {
				limit = {
					scope:clergy_representative.faith = {
						faith_hostility_level = {
							target = root.faith
							value >= faith_evil_level
						}
					}
				}
				add = major_piety_loss
			}
		}

		random = {
			chance = {
				value = 10
				if = {
					limit = {
						scope:clergy_representative.faith = {
							faith_hostility_level = {
								target = root.faith
								value >= faith_astray_level
							}
						}
					}
					add = 10
				}
				else_if = {
					limit = {
						scope:clergy_representative.faith = {
							faith_hostility_level = {
								target = root.faith
								value >= faith_hostile_level
							}
						}
					}
					add = 20
				}
				else_if = {
					limit = {
						scope:clergy_representative.faith = {
							faith_hostility_level = {
								target = root.faith
								value >= faith_evil_level
							}
						}
					}
					add = 30
				}
			}
			add_perk = apostate_perk
		}

		scope:activity = {
            every_attending_character = {
            	limit = {
					has_trait = zealous
					faith = root.faith
				}

				custom = coronation_events.1028.a.tt

				add_opinion = {
					target = root
					modifier = impious_opinion
					opinion = -10
				}
            }
        }

        if = {
        	limit = {
        		scope:activity = {
        			any_attending_character = {
        				faith = scope:clergy_representative.faith
        				this != scope:clergy_representative
        			}
        		}
        	}
        	scope:activity = {
	            every_attending_character = {
	            	limit = {
						faith = scope:clergy_representative.faith
						NOT = {
							this = scope:clergy_representative
						}
					}
					custom = coronation_events.1028.a.tt3
					add_opinion = {
						target = root
						modifier = pleased_opinion
						opinion = 10
					}
	            }
	        }
        }

        stress_impact = {
            cynical = minor_stress_impact_loss
        }

        ai_chance = {
            base = 50
            ai_value_modifier = {
                ai_zeal = high_chance_impact_negative_ai_value
                ai_sociability = medium_chance_impact_positive_ai_value
            }
        }
    }

    option = {
        name = coronation_events.1028.b # Politely decline alternative blessings

        trigger = {
        	NOT = {
        		has_trait = zealous
        		has_trait = cynical
        	}
        }
        add_piety = medium_piety_gain

        scope:activity = {
            every_attending_character = {
            	limit = {
					has_trait = zealous
					faith = root.faith
				}

				custom = coronation_events.1028.b.tt

                add_opinion = {
                    target = root
                    modifier = pious_opinion
                    opinion = 10
                }
            }
        }

        stress_impact = {
            zealous = minor_stress_impact_loss
            cynical = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40
            ai_value_modifier = {
                ai_zeal = high_chance_impact_positive_ai_value
            }
        }
    }

    option = {
        name = coronation_events.1028.c # Publicly rebuke the request
        add_piety = major_piety_gain
        scope:clergy_representative = {
            add_opinion = {
                target = root
                modifier = insulted_opinion
                opinion = -25
            }
        }
		if = {
			limit = {
				scope:clergy_representative = { is_courtier_of = root }
			}
			remove_courtier_or_guest = scope:clergy_representative
		}

        scope:activity = {
            every_attending_character = {
                limit = {
                	NOR = {
                		this = scope:clergy_representative
                		this = root
                	}
                    has_trait = zealous
                    faith = root.faith
                }
                custom = coronation_events.1028.c.tt
                add_opinion = {
                    target = root
                    modifier = pious_opinion
                    opinion = 20
                }
            }
        }
		 random = {
			chance = {
				value = 10
				if = {
					limit = {
						scope:clergy_representative.faith = {
							faith_hostility_level = {
								target = root.faith
								value >= faith_astray_level
							}
						}
					}
					add = 10
				}
				else_if = {
					limit = {
						scope:clergy_representative.faith = {
							faith_hostility_level = {
								target = root.faith
								value >= faith_hostile_level
							}
						}
					}
					add = 20
				}
				else_if = {
					limit = {
						scope:clergy_representative.faith = {
							faith_hostility_level = {
								target = root.faith
								value >= faith_evil_level
							}
						}
					}
					add = 30
				}
			}
			add_trait = holy_warrior
		}

        stress_impact = {
            zealous = minor_stress_impact_loss
            cynical = major_stress_impact_gain
            compassionate = minor_stress_impact_gain
        }

        ai_chance = {
            base = 30
            ai_value_modifier = {
                ai_zeal = high_chance_impact_positive_ai_value
                ai_sociability = high_chance_impact_negative_ai_value
            }
        }
    }

    option = {
        name = coronation_events.1028.d # Evade the question entirely
        if = {
        	limit = {
        		government_allows = administrative
        		top_liege = scope:activity.activity_host
        	}
        	change_influence = minor_influence_gain
        }
        else = {
        	add_prestige = minor_prestige_gain
        }

        stress_impact = {
            cynical = minor_stress_impact_loss
            honest = minor_stress_impact_gain
        }

        ai_chance = {
            base = 20
            ai_value_modifier = {
                ai_honor = medium_chance_impact_negative_ai_value
            }
        }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}

# you discover some forgotten ancient rights
coronation_events.1029 = {
    type = activity_event
    title = coronation_events.1029.t

    desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_activity_intent = coronation_embrace_supporters
				}
				desc = coronation_events.1029.supporter.desc
			}
			triggered_desc = {
				trigger = {
					has_activity_intent = coronation_weaken_detractors
				}
				desc = coronation_events.1029.detractor.desc
			}
			desc = coronation_events.1029.desc
		}
	}

	left_portrait = {
		character = scope:guest
		triggered_animation = {
			trigger = { scope:guest = { is_in_guest_subset = { name = detractor } } }
			animation = rage
		}
		triggered_animation = {
			trigger = { scope:guest = { is_in_guest_subset = { name = supporter } } }
			animation = ecstasy
		}
	}

    center_portrait = {
        character = root
        animation = interested
        camera = camera_event_left
    }

    right_portrait = {
    	character = scope:priest
    	animation = chancellor
    }

    theme = coronation_activity
    cooldown = { years = 5 }

    trigger = {
    	coronation_living_officiator_trigger = yes
        primary_title.previous_holder ?= {
            exists = yes
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

    	grab_mythical_founder_effect = yes
    	involved_activity.var:officiator ?= {
    		save_scope_as = priest
    	}
        root.primary_title = {
            save_scope_as = primary_title
        }

        if = {
        	limit = {
        		has_activity_intent = coronation_embrace_supporters
        	}
        	scope:activity = {
	            random_guest_subset = {
	                name = supporter
	                save_scope_as = guest
	            }
	        }
        }
        else_if = {
	        limit = {
        		has_activity_intent = coronation_weaken_detractors
        	}
        	scope:activity = {
	            random_guest_subset = {
	                name = detractor
	                save_scope_as = guest
	            }
	        }
        }
        else = {
        	scope:activity = {
        		random_attending_character = {
		            limit = { is_ai = yes }
		            save_scope_as = guest
		        }
        	}
        }
    }

    option = {
        name = coronation_events.1029.a
        trigger = {
        	has_activity_intent = coronation_exalt_crown
        	has_ce1_dlc_trigger = yes
        }

       	gain_legitimizing_legend_seed_tooltip_effect = yes
	    legend_seed_great_deed_title_effect = {
	     	TITLE = root.primary_title
	    }

		coronation_exalt_crown_opinion_effect = yes

        stress_impact = { ambitious = minor_stress_impact_loss }
        ai_chance = { base = 50 }
    }

    option = {
        name = coronation_events.1029.b
        trigger = {
            has_activity_intent = coronation_embrace_supporters
        }
        if = {
        	limit = {
        		reverse_opinion = {
        			target = scope:guest
        			value > 30
        		}
				OR = {
					scope:guest = { is_ai = yes }
					AND = {
						scope:guest = {
							is_ai = no
						}
						is_ai = no
					}
				}
        	}
        	 scope:guest = {
        	    progress_towards_friend_effect = {
        	        REASON = friend_ancestral_vow
        	        CHARACTER = root
        	        OPINION = 20
        	    }
        	}
        }
        else = {
        	reverse_add_opinion = {
        		target = scope:guest
        		modifier = loyalty_opinion
        		opinion = 25
        	}
        }

        coronation_embrace_supporters_opinion_effect = yes

        stress_impact = { generous = minor_stress_impact_loss }
        ai_chance = {
            base = 40
            ai_value_modifier = {
                ai_sociability = high_chance_impact_positive_ai_value
            }
        }
    }

    option = {
        name = coronation_events.1029.c
        trigger = {
            has_activity_intent = coronation_weaken_detractors
        }
        if = {
        	limit = {
        		scope:guest = { is_ai = yes }
        	}
        	 add_hook_if_possible_default_length_effect = {
				TARGET = scope:guest
				TYPE = manipulation_hook
			}
        }

		coronation_move_towards_supporter_effect = { CHARACTER = scope:guest }

        scope:guest = {
            add_opinion = {
                target   = root
                modifier = insulted_opinion
                opinion  = -15
            }
            add_stress = minor_stress_gain
        }

        coronation_weaken_detractors_opinion_effect = yes
        stress_impact = { vengeful = minor_stress_impact_loss }
        ai_chance = {
            base = 30
            ai_value_modifier = {
                ai_vengefulness = high_chance_impact_positive_ai_value
            }
        }
    }

    option = {
        name = coronation_events.1029.d
        trigger = {
            has_activity_intent = coronation_impress_attendees
            diplomacy >= medium_skill_rating
        }
        show_as_unavailable = {
        	has_activity_intent = coronation_impress_attendees
        	diplomacy < medium_skill_rating
        }

        skill = diplomacy

        custom_tooltip = coronation_tt_positive_tiny
        scope:activity = {
        	activity_special_type_progression_tiny = yes
        }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}

		coronation_impress_attendees_opinion_effect = yes

        stress_impact = { brave = minor_stress_impact_loss }
        ai_chance = { base = 100 }
    }

    option = {
        name = coronation_events.1029.e
        add_piety = minor_piety_gain
        stress_impact = { shy = minor_stress_impact_loss }

        ai_chance = {
            base = 20
            ai_value_modifier = {
                ai_honor = high_chance_impact_negative_ai_value
            }
        }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}

# Scholar offers to include the coronation in their chronicle
scripted_trigger coronation_events_1030_valid_scholar = {
	learning > 10
	is_ai = yes
	is_in_guest_subset = { name = supporter }
	OR = {
		is_vassal_of = root
		is_courtier_of = root
	}
}

coronation_events.1030 = {
    type = activity_event
    title = coronation_events.1030.t

    desc = {
        first_valid = {
            triggered_desc = {
                trigger = { has_activity_intent = coronation_exalt_crown }
                desc = coronation_events.1030.exalt.desc
            }
            triggered_desc = {
                trigger = { has_activity_intent = coronation_impress_attendees }
                desc = coronation_events.1030.impress.desc
            }
            triggered_desc = {
                trigger = { has_activity_intent = coronation_embrace_supporters }
                desc = coronation_events.1030.supporters.desc
            }
            triggered_desc = {
                trigger = { has_activity_intent = coronation_weaken_detractors }
                desc = coronation_events.1030.detractors.desc
            }
        }
    }

    center_portrait = {
        character = root
        animation = interested
        camera = camera_event_left
    }

    right_portrait = {
        character = scope:scholar
        animation = storyteller
    }

    theme = coronation_activity
    cooldown = { years = 5 }

    trigger = {
        involved_activity = {
			any_attending_character = {
				coronation_events_1030_valid_scholar = yes
			}
		}
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        involved_activity = {
			random_attending_character = {
				limit = {
					coronation_events_1030_valid_scholar = yes
				}
				weight = {
					base = 1
					modifier = {
						add = learning
					}
					modifier = {
						is_vassal_of = root
						add = 5
					}
				}
				save_scope_as = scholar
			}
		}
    }

    option = {
        name = coronation_events.1030.a
        trigger = {
            has_activity_intent = coronation_exalt_crown
        }

        scope:scholar = {
        	duel = {
				skills = { learning diplomacy }
				value = high_skill_rating
				# the scholar gets it right
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -49
					}
					desc = coronation_events.1030.tt.success
					send_interface_toast = {
						title = coronation_events.1030.tt.success
						left_icon = scope:scholar
						root = {
							if = {
								limit = {
									has_ce1_dlc_trigger = yes
									has_legend_chapter_trigger = { CHAPTER = extra_deed }
								}
								add_character_modifier = {
									modifier = bp4_chronicled_coronation_modifier
									years = 5
								}
								promoted_legend ?= {
									change_legend_quality_effect = {
										VALUE = major_legend_quality_increase
									}
									set_legend_chapter = {
										name = extra_deed
										localization_key = legend_chapter_great_coronation
									}
								}
							}
							else = {
								add_prestige = medium_prestige_gain
	        					add_legitimacy = minor_legitimacy_gain
							}
						}
					}
				}
				# the scholar gets it wrong
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
						min = -49
					}
					desc = coronation_events.1030.tt.failure
					send_interface_toast = {
						title = coronation_events.1030.tt.failure
						left_icon = scope:scholar
						add_prestige = minor_prestige_loss
						add_stress = minor_stress_gain
					}
				}
			}
        }



        stress_impact = { arrogant = minor_stress_impact_loss }

        ai_chance = {
            base = 40
        }
    }

    option = {
        name = coronation_events.1030.b
        trigger = {
            has_activity_intent = coronation_impress_attendees
        }

        scope:scholar = {
        	duel = {
				skills = { learning diplomacy }
				value = high_skill_rating
				# the scholar gets it right
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -49
					}
					desc = coronation_events.1030.tt.success
					send_interface_toast = {
						title = coronation_events.1030.tt.success
						left_icon = scope:scholar
						custom_tooltip = coronation_tt_positive_tiny
        				scope:activity = { activity_special_type_progression_tiny = yes }
						coronation_add_magnificence_log_effect = {
							VALUE = flag:positive_tiny
							CHAR = root
						}
					}
				}
				# the scholar gets it wrong
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
						min = -49
					}
					desc = coronation_events.1030.tt.failure
					send_interface_toast = {
						title = coronation_events.1030.tt.failure
						left_icon = scope:scholar
						add_prestige = minor_prestige_loss
						add_stress = minor_stress_gain
					}
				}
			}
        }

        stress_impact = { gregarious = minor_stress_impact_loss }

        ai_chance = { base = 50 }
    }

    option = {
        name = coronation_events.1030.c
        trigger = {
            has_activity_intent = coronation_embrace_supporters
        }

        scope:scholar = {
        	duel = {
				skills = { learning diplomacy }
				value = high_skill_rating
				# the scholar gets it right
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -49
					}
					desc = coronation_events.1030.tt.success
					send_interface_toast = {
						title = coronation_events.1030.tt.success
						left_icon = scope:scholar
						scope:activity = {
				            every_guest_subset = {
				                name = supporter
				                limit = { is_ai = yes }
				                custom = every_supporter_activity
				                add_opinion = {
				                    target = root
				                    modifier = grateful_opinion
				                    opinion = 10
				                }
				            }
				        }
					}
				}
				# the scholar gets it wrong
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
						min = -49
					}
					desc = coronation_events.1030.tt.failure
					send_interface_toast = {
						title = coronation_events.1030.tt.failure
						left_icon = scope:scholar
						add_prestige = minor_prestige_loss
						add_stress = minor_stress_gain
					}
				}
			}
        }



        stress_impact = { compassionate = minor_stress_impact_loss }

        ai_chance = { base = 35 }
    }

    option = {
        name = coronation_events.1030.d
        trigger = {
            has_activity_intent = coronation_weaken_detractors
        }

        scope:scholar = {
        	duel = {
				skills = { learning diplomacy }
				value = high_skill_rating
				# the scholar gets it right
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -49
					}
					desc = coronation_events.1030.tt.success
					send_interface_toast = {
						title = coronation_events.1030.tt.success
						left_icon = scope:scholar
						scope:activity = {
				            every_guest_subset = {
				                name = detractor
				                limit = { is_ai = yes }
				                custom = every_detractor_tt
						        add_opinion = {
						           	target = root
						            modifier = insulted_opinion
						            opinion = -10
						        }
						        add_stress = minor_stress_gain
						        add_legitimacy = miniscule_legitimacy_loss
				            }
				        }
					}
				}
				# the scholar gets it wrong
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
						min = -49
					}
					desc = coronation_events.1030.tt.failure
					send_interface_toast = {
						title = coronation_events.1030.tt.failure
						left_icon = scope:scholar
						add_prestige = minor_prestige_loss
						add_stress = minor_stress_gain
					}
				}
			}
        }

        stress_impact = { vengeful = minor_stress_impact_loss }

        ai_chance = { base = 30 }
    }

    option = {
        name = coronation_events.1030.e

        add_piety = minor_piety_gain

        stress_impact = {
        	shy = minor_stress_impact_loss
        	zealous = minor_stress_impact_loss
        }

        ai_chance = {
            base = 20
            ai_value_modifier = {
                ai_zeal = high_chance_impact_positive_ai_value
            }
        }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}

# Host sets the tone for the choir
coronation_events.1031 = {
    type = activity_event
    title = coronation_events.1031.t

    desc = {
        first_valid = {
            triggered_desc = {
                trigger = { has_activity_intent = coronation_exalt_crown }
                desc = coronation_events.1031.exalt.desc
            }
            triggered_desc = {
                trigger = { has_activity_intent = coronation_impress_attendees }
                desc = coronation_events.1031.impress.desc
            }
            triggered_desc = {
                trigger = { has_activity_intent = coronation_embrace_supporters }
                desc = coronation_events.1031.supporters.desc
            }
            triggered_desc = {
                trigger = { has_activity_intent = coronation_weaken_detractors }
                desc = coronation_events.1031.detractors.desc
            }
        }
    }

    left_portrait = {
        character = root
        animation = personality_honorable
    }

    center_portrait = {
		trigger = { exists = involved_activity.var:officiator }
		character = involved_activity.var:officiator
		animation = chancellor
		camera = camera_event_right
	}

    theme = coronation_activity
    cooldown = { years = 5 }

    trigger = {
    	coronation_living_officiator_trigger = yes
        scope:activity = {
	    	NOT = {
	    		has_activity_option = {
					category = ceremony_size
					option = coronation_small_ceremony
				}
	    	}
        }
		OR = {
			faith.religion = religion:eastern_orthodox_religion 
			faith.religion = religion:catholic_religion 
			faith.religion = religion:protestant_religion 
		}
        NOR = {
        	government_has_flag = government_is_nomadic
        	government_has_flag = government_is_tribal
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        involved_activity.var:officiator ?= {
        	save_scope_as = priest
        }
    }

    option = {
	    name = coronation_events.1031.e

	    trigger = {
	        OR = {
	            culture = {
	                has_cultural_tradition = tradition_music_theory
	            }
	            has_trait = lifestyle_poet
	        }
	    }

	    custom_tooltip = coronation_tt_positive_medium
		scope:activity = { activity_special_type_progression_medium = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_medium
			CHAR = root
		}
	    add_learning_skill = 1

	    scope:activity = {
	        if = {
	            limit = { exists = var:officiator }
	            var:officiator ?= {
	                add_opinion = {
	                    target = root
	                    modifier = impressed_opinion
	                    opinion = 15
	                }
	            }
	        }
	        every_attending_character = {
	            limit = {
	                is_ai = yes
	                OR = {
	                    has_trait = lifestyle_poet
	                    has_trait = scholar
	                }
	                NOT = {
	                	this = root
	                }
	            }
	            custom = every_poet_scholar
	            add_opinion = {
	                target = root
	                modifier = amazed_opinion
	                opinion = 10
	            }
	        }
	    }

	    stress_impact = {
	        shy = minor_stress_impact_gain
	    }

	    ai_chance = {
	        base = 300
	    }
	}


    option = {
        name = coronation_events.1031.a

        trigger = {
	        NOR = {
	            culture = {
	                has_cultural_tradition = tradition_music_theory
	            }
	            has_trait = lifestyle_poet
	        }
	    }
        custom_tooltip = coronation_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}

        scope:activity = {
        	every_attending_character = {
	            limit = {
	            	is_ai = yes
	            	is_vassal_of = root
	            }
	            custom = every_attending_vassal
	            add_opinion = {
	                target = root
	                modifier = impressed_opinion
	                opinion = 10
	            }
	        }
        }

        stress_impact = { arrogant = minor_stress_impact_loss }

        ai_chance = { base = 40 }
    }

    option = {
        name = coronation_events.1031.b
        add_diplomacy_skill = 1
        scope:activity = {
        	every_attending_character = {
	            limit = {
	                is_ai = yes
	                OR = {
	                    is_in_guest_subset = { name = detractor }
	                    has_trait = compassionate
	                }
	            }
	            custom = every_attending_detractor_or_compassionate
	            add_opinion = {
	                target = root
	                modifier = kindness_opinion
	                opinion = 10
	            }
	        }
        }

        stress_impact = { compassionate = minor_stress_impact_loss }

        ai_chance = { base = 30 }
    }

    option = {
        name = coronation_events.1031.c
        custom_tooltip = coronation_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}

        root.dynasty = {
			add_dynasty_prestige = minor_dynasty_prestige_gain
		}

        scope:activity = {
            every_guest_subset = {
                name = detractor
                limit = { is_ai = yes }
                custom = every_detractor_tt
                add_opinion = {
                    target = root
                    modifier = insulted_opinion
                    opinion = -10
                }
                add_stress = minor_stress_gain
            }
        }

        stress_impact = { vengeful = minor_stress_impact_loss }

        ai_chance = { base = 20 }
    }

    option = {
        name = coronation_events.1031.d
        add_stress = minor_stress_loss
        stress_impact = { shy = minor_stress_impact_loss }
        ai_chance = { base = 10 }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}

# You prepare a grand gesture for the ceremony
coronation_events.1032 = {
    type = activity_event
    title = coronation_events.1032.t

    desc = coronation_events.1032.desc

    left_portrait = {
        character = root
        animation = personality_compassionate
    }

    center_portrait = {
        trigger = { exists = scope:supporter }
        character = scope:supporter
        camera = camera_event_right
        animation = interested_left
    }

    right_portrait = {
    	trigger = { exists = scope:detractor }
        character = scope:detractor
        animation = war_over_win
    }

    theme = coronation_activity
    cooldown = { years = 5 }

    trigger = {
        scope:activity = {
			any_guest_subset = {
				name = supporter
				is_ai = yes
			}
			any_guest_subset = {
				name = detractor
				is_ai = yes
			}
		}
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

		involved_activity.var:officiator ?= {
			save_scope_as = priest
		}

        scope:activity = {
	        random_guest_subset = {
	        	name = supporter
	        	limit = {
	        		is_ai = yes
	        	}
	        	save_scope_as = supporter
	        }
	        random_guest_subset = {
	        	name = detractor
	        	limit = {
	        		is_ai = yes
	        	}
	        	save_scope_as = detractor
	        }
        }

        if = {
        	limit = {
        		NOT = {
					faith = {
						any_faith_holy_order = {
							holy_order_patron = root
							save_temporary_scope_as = order
						}
					}
				}
				# Jomsvikings should use their special decision if appropriate.
				trigger_if = {
					limit = { has_fp1_dlc_trigger = yes }
					faith = {
						NOT = { fp1_valid_norse_faith_for_jomsvikings_trigger = yes }
					}
				}
				trigger_if = {
					limit = {
						any_character_struggle = {
							involvement = involved
							has_struggle_phase_parameter = holy_order_can_be_created_by_dukes
						}
						highest_held_title_tier >= tier_duchy
					}
					NOT = {
						any_sub_realm_barony = {
							is_under_holy_order_lease = yes
						}
					}
				}

	        	OR = {
					AND = {
						any_character_struggle = {
							involvement = involved
							has_struggle_phase_parameter = holy_order_can_be_created_by_dukes
						}
						highest_held_title_tier >= tier_duchy
					}
					highest_held_title_tier >= tier_kingdom
					any_held_county = {
						any_in_de_jure_hierarchy = {
							tier = tier_barony
							is_capital_barony = no
							barony_is_valid_for_holy_order_lease_trigger = { CHARACTER = root }
						}
					}
				}
        	}
        	random_held_county = {
        		limit = {
        			any_in_de_jure_hierarchy = {
						tier = tier_barony
						is_capital_barony = no
						barony_is_valid_for_holy_order_lease_trigger = { CHARACTER = root }
					}
        		}
        		random_in_de_jure_hierarchy = {
					limit = {
						tier = tier_barony
						is_capital_barony = no
						barony_is_valid_for_holy_order_lease_trigger = { CHARACTER = root }
					}
        			save_scope_as = barony
        		}
        	}
        }
    }

    option = {
        name = coronation_events.1032.c
        flavor = coronation_events.1032.c.flavor

        trigger = {
        	exists = scope:barony
        	NOT = {
				faith = {
					any_faith_holy_order = {
						holy_order_patron = root
						save_temporary_scope_as = order
					}
				}
			}
			# Jomsvikings should use their special decision if appropriate.
			trigger_if = {
				limit = { has_fp1_dlc_trigger = yes }
				faith = {
					NOT = { fp1_valid_norse_faith_for_jomsvikings_trigger = yes }
				}
			}
			trigger_if = {
				limit = {
					any_character_struggle = {
						involvement = involved
						has_struggle_phase_parameter = holy_order_can_be_created_by_dukes
					}
					highest_held_title_tier >= tier_duchy
				}
				NOT = {
					any_sub_realm_barony = {
						is_under_holy_order_lease = yes
					}
				}
			}

        	OR = {
				AND = {
					any_character_struggle = {
						involvement = involved
						has_struggle_phase_parameter = holy_order_can_be_created_by_dukes
					}
					highest_held_title_tier >= tier_duchy
				}
				highest_held_title_tier >= tier_kingdom
				any_held_county = {
					any_in_de_jure_hierarchy = {
						tier = tier_barony
						is_capital_barony = no
						barony_is_valid_for_holy_order_lease_trigger = { CHARACTER = root }
					}
				}
			}
        }

        custom_tooltip = create_holy_order_decision_effect_message_coronation

		if = {
			limit = {
				exists = scope:barony
			}
			hidden_effect = {
				if = {
					limit = { NOT = { scope:barony.holder = root } }
					create_title_and_vassal_change = {
						type = leased_out
						save_scope_as = change
						add_claim_on_loss = no
					}
					scope:barony = {
						change_title_holder_include_vassals = {
							holder = root
							change = scope:change
						}
					}
					resolve_title_and_vassal_change = scope:change
				}
			}

			create_character = {
				template = holy_order_leader_character
				location = scope:barony.title_province
				save_scope_as = leader
			}

			create_holy_order_neutral_effect = {
				LEADER = scope:leader
				CAPITAL = scope:barony
				NEW_HO_SCOPE = new_holy_order
				FOUNDER = root
			}
		}
		create_holy_order_effect = yes

		add_piety = medium_piety_loss


        stress_impact = { impatient = minor_stress_impact_loss }

        ai_chance = { base = 20 }
    }

    option = {
        name = coronation_events.1032.d
        flavor = coronation_events.1032.d.flavor

        trigger = {
        	OR = {
        		dread >= major_dread_value
        		has_trait = wrathful
        	}
        	scope:detractor = {
        		NAND = {
        			has_trait = blind
        			has_trait = disfigured
        		}
        	}
        }

        add_dread = medium_dread_gain
        scope:detractor = {
        	if = {
				limit = {
					NOT = {
						has_trait = blind
					}
				}
				add_trait = blind
				add_opinion = {
					modifier = blinded_me
					target = root
				}
			}
			else = {
				add_trait = disfigured
				add_opinion = {
					modifier = disfigured_me
					target = root
				}
			}
        }
        add_tyranny = medium_tyranny_gain

        stress_impact = {
        	vengeful = medium_stress_impact_loss
        	sadistic = medium_stress_impact_loss
        	compassionate = major_stress_impact_gain
        	forgiving = major_stress_impact_gain
        }

        ai_chance = {
        	base = 15
        	modifier = {
        		factor = 0
        		OR = {
        			has_trait = compassionate
        			has_trait = forgiving
        			ai_compassion >= low_positive_ai_value
        		}
        	}
        }
    }
    option = {
        name = coronation_events.1032.a
        flavor = coronation_events.1032.a.flavor

        custom_tooltip = coronation_tt_positive_tiny
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}
		scope:activity = {
			activity_special_type_progression_tiny = yes
			every_attending_character = {
	            limit = {
	                is_ai = yes
	                is_in_guest_subset = { name = supporter }
	                NOT = {
	                	this = root
	                }
	            }
	            custom = every_supporter_activity
	            add_opinion = {
	                target = root
	                modifier = amused_opinion
	                opinion = 10
	            }
	        }
		}
		remove_short_term_gold = medium_gold_value

        stress_impact = { compassionate = minor_stress_impact_loss }

        ai_chance = { base = 35 }
    }

    option = {
        name = coronation_events.1032.b
        trigger = {
        	scope:supporter = {
				OR = {
					highest_held_title_tier >= tier_kingdom
					AND = {
						highest_held_title_tier < tier_kingdom
			    			is_landed = yes
						is_independent_ruler = yes
						is_tributary = no
					}
					is_landed = no
				}
			}
        }

        if = {
        	limit = {
        		scope:supporter = {
        			highest_held_title_tier >= tier_kingdom
	        	}
        	}
        	scope:supporter = {
				add_opinion = {
					target = root
					modifier = event_negotiated_alliance_opinion
				}
			}
        	custom_tooltip = {
				text = create_alliance_supporter_tt
				create_alliance = {
					target = scope:supporter
					allied_through_owner = root
					allied_through_target = scope:supporter
				}
			}
        }
        else_if = {
        	limit = {
        		scope:supporter = {
        			highest_held_title_tier < tier_kingdom
        			is_landed = yes
					is_independent_ruler = yes
					is_tributary = no
	        	}
        	}
        	create_title_and_vassal_change = {
				type = swear_fealty
				save_scope_as = change
				add_claim_on_loss = no
			}
			scope:supporter = {
				change_liege = {
					liege = root
					change = scope:change
				}
			}
			resolve_title_and_vassal_change = scope:change
        }
        else_if = {
        	limit = {
        		scope:supporter = {
        			is_landed = no
	        	}
				OR = {
					scope:supporter = { is_ai = yes }
					AND = {
						scope:supporter = {
							is_ai = no
						}
						is_ai = no
					}
				}
        	}
        	set_relation_friend = {
				reason = friend_coronation_honor
				target = scope:supporter
			}
			hidden_effect = {
				add_opinion = {
					target = scope:supporter
					modifier = friendliness_opinion
					opinion = 50
				}
			}

			reverse_add_opinion = {
				target = scope:supporter
				modifier = friendliness_opinion
				opinion = 50
			}
        }

        stress_impact = { arrogant = minor_stress_impact_loss }

        ai_chance = { base = 30 }
    }
    option = {
        name = coronation_events.1032.e

        scope:detractor = {
        	add_opinion = {
        		target = root
        		opinion = 15
        		modifier = commiseration_opinion
        	}
        }
        stress_impact = {
        	shy = minor_stress_impact_loss
        	ambitious = minor_stress_impact_gain
        	arrogant = minor_stress_impact_gain
        }
        ai_chance = {
        	base = 50
        }
    }


    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}

# Rival speaks up
coronation_events.1033 = {
    type = activity_event
    title = coronation_events.1033.t
    desc = coronation_events.1033.desc

    left_portrait = {
        character = root
        animation = disapproval
    }

    right_portrait = {
        character = scope:rival
        animation = anger
    }

    theme = coronation_activity
    cooldown = { years = 5 }

    trigger = {
    	has_activity_intent = coronation_weaken_detractors
        scope:activity = {
            any_attending_character = {
                has_relation_rival = root
                OR = {
                	is_powerful_vassal = yes
                	highest_held_title_tier >= tier_kingdom
                }
                drinks_alcohol_trigger = yes
                NOT = {
                	has_trait = temperate
                }
                OR = {
                	has_trait = drunkard
                	has_trait = lifestyle_reveler
                	ai_rationality < medium_positive_ai_value
                }
            }
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

    	custom_tooltip = happened_because_intent_tt
        scope:activity = {
            random_attending_character = {
                limit = {
                    has_relation_rival = root
	                OR = {
	                	is_powerful_vassal = yes
	                	highest_held_title_tier >= tier_kingdom
	                }
                	drinks_alcohol_trigger = yes
                	NOT = {
                		has_trait = temperate
                	}
                	OR = {
                		has_trait = drunkard
                		has_trait = lifestyle_reveler
                		ai_rationality < medium_positive_ai_value
                	}
                }
                save_scope_as = rival
            }
            var:officiator ?= {
                save_scope_as = priest
            }
        }
    }

	 option = {
        name = coronation_events.1033.c

        add_dread = minor_dread_gain
        rightfully_imprison_character_effect = {
			IMPRISONER = root
			TARGET = scope:rival
		}
		scope:activity = {
			every_guest_subset = {
				name = detractor
				custom = every_detractor_activity
				add_opinion = {
					target = root
					modifier = angry_opinion
					opinion = -30
				}
			}
		}

        stress_impact = {
        	sadistic = minor_stress_impact_loss
        	callous = minor_stress_impact_loss
        	compassionate = minor_stress_impact_gain
        	forgiving = minor_stress_impact_gain
        }

        ai_chance = {
        	base = 20
        	modifier = {
        		factor = 0
        		OR = {
        			has_trait = compassionate
        			has_trait = forgiving
        		}
        	}
        }
    }

    option = {
        name = coronation_events.1033.a
        add_legitimacy = minor_legitimacy_gain
       	add_piety = minor_piety_gain
		if = {
			limit = {
				NOT = { has_relation_nemesis = scope:rival }
				OR = {
					scope:rival = { is_ai = yes }
					AND = {
						scope:rival = {
							is_ai = no
						}
						is_ai = no
					}
				}
			}
			set_relation_nemesis = {
				target = scope:rival
				reason = rival_publicly_denounced_at_coronation
			}
		}
		else = {
			scope:rival = {
				add_opinion = {
					target = root
					modifier = humiliated_opinion
					opinion = -50
				}
			}
		}
        stress_impact = {
        	base = medium_stress_gain
        	cynical = minor_stress_impact_gain
        }

        ai_chance = {
        	base = 40
        	modifier = {
        		factor = 0
        		has_trait = cynical
        	}
        }
    }

    option = {
        name = coronation_events.1033.b

        trigger = {
            diplomacy >= 14
        }

        add_legitimacy = minor_legitimacy_gain
        if = {
        	limit = {
        		government_allows = administrative
        		top_liege = scope:activity.activity_host
        	}
        	change_influence = minor_influence_gain
        }
        else = {
        	add_prestige = minor_prestige_gain
        }
        add_diplomacy_skill = 1

        if = {
        	limit = {
				OR = {
					scope:rival = { is_ai = yes }
					AND = {
						scope:rival = {
							is_ai = no
						}
						is_ai = no
					}
				}
        	}
        	scope:rival = {
        	    remove_relation_rival = root
        	    add_opinion = {
        	        target = root
        	        modifier = humbled_opinion
        	        opinion = 25
        	    }
        	}
        }

        scope:activity = {
        	every_attending_character = {
	            limit = {
	                is_ai = yes
	                OR = {
	                    has_trait = compassionate
	                    has_trait = trusting
	                    is_in_guest_subset = { name = supporter }
	                }
	            }
	            custom = custom.every_compassionate_trusting_supporter
	            add_opinion = {
	                target = root
	                modifier = loyalty_opinion
	                opinion = 10
	            }
	        }
        }

        stress_impact = { forgiving = minor_stress_impact_loss }

        ai_chance = { base = 30 }
    }

    option = {
        name = coronation_events.1033.d
        add_legitimacy = minor_legitimacy_loss
        stress_impact = {
        	calm = minor_stress_impact_loss
        	humble = minor_stress_impact_loss
        	vengeful = medium_stress_impact_gain
        	arrogant = medium_stress_impact_gain
        }

        ai_chance = {
        	base = 10
        	modifier = {
        		factor = 0
        		OR = {
        			has_trait = vengeful
        			has_trait = arrogant
        		}
        	}
        }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}

# choose a robe for the coronation
coronation_events.1034 = {
    type = activity_event
    title = coronation_events.1034.t
    desc = coronation_events.1034.desc

    theme = coronation_activity

    cooldown = { years = 5 }

    left_portrait = {
        character = root
        animation = shock
        camera = camera_event_left
    }

    center_portrait = {
        character = scope:supporter
        animation = debating
        camera = camera_event_center
    }

    right_portrait = {
    	character = scope:detractor
        animation = anger
        camera = camera_event_right
    }

    lower_right_portrait = {
    	character = scope:host
    }

    trigger = {
    	faith = {
	    	NOR = {
				has_doctrine_parameter = naked_adherents_active
				has_doctrine_parameter = naked_priests_active
			}
		}
    	scope:host = {
	        culture = { has_graphical_east_asia_culture_group_trigger = yes }
	        faith = {
		    	NOR = {
					has_doctrine_parameter = naked_adherents_active
					has_doctrine_parameter = naked_priests_active
				}
			}
	    }
	    scope:activity = {
            any_guest_subset = {
            	name = detractor
            	this != root
            	culture = { has_graphical_east_asia_culture_group_trigger = yes }
            	faith = {
			    	NOR = {
						has_doctrine_parameter = naked_adherents_active
						has_doctrine_parameter = naked_priests_active
					}
				}
            }
            any_guest_subset = {
            	name = supporter
            	this != root
            	culture = { has_graphical_east_asia_culture_group_trigger = yes }
            	faith = {
			    	NOR = {
						has_doctrine_parameter = naked_adherents_active
						has_doctrine_parameter = naked_priests_active
					}
				}
            }
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes
    	scope:activity = {
    		random_guest_subset = {
            	name = detractor
            	limit = {
            		this != root
            		culture = { has_graphical_east_asia_culture_group_trigger = yes }
            		faith = {
				    	NOR = {
							has_doctrine_parameter = naked_adherents_active
							has_doctrine_parameter = naked_priests_active
						}
					}
            	}
            	save_scope_as = detractor
            }
            random_guest_subset = {
            	name = supporter
            	limit = {
            		this != root
            		culture = { has_graphical_east_asia_culture_group_trigger = yes }
            		faith = {
				    	NOR = {
							has_doctrine_parameter = naked_adherents_active
							has_doctrine_parameter = naked_priests_active
						}
					}
            	}
            	save_scope_as = supporter
            }
    	}
    }

    option = {
        name = coronation_events.1034.a # "I shall wear a robe finer than theirs — let them take the hint."
        trigger = {
        	highest_held_title_tier >= scope:host.highest_held_title_tier
        	OR = {
        		is_in_guest_subset = { name = detractor }
        		dislikes_character_trigger = { CHARACTER = scope:host }
        	}
        }

        custom_tooltip = coronation_events.1034.a.tt

        add_intrigue_lifestyle_xp = minor_lifestyle_xp

        add_character_flag = outshining_host
        scope:host = {
        	trigger_event = coronation_events.1035
        }

        stress_impact = {
            ambitious = minor_stress_impact_loss
            arrogant = minor_stress_impact_loss
            humble = minor_stress_impact_gain
        }

        ai_chance = {
            base = 30
            modifier = {
            	add = 25
            	has_trait = arrogant
            }
            modifier = {
            	add = 10
            	has_trait = ambitious
            }
            modifier = {
            	add = -20
            	has_trait = humble
            }
        }
    }

    option = {
        name = coronation_events.1034.b # "I will match the Host’s colors, a silent sign of my allegiance."
        trigger = {
        	OR = {
        		likes_character_trigger = { CHARACTER = scope:host }
        		is_in_guest_subset = { name = supporter }
        	}
        }

        add_diplomacy_lifestyle_xp = minor_lifestyle_xp

        add_opinion = {
            target = scope:host
            modifier = respect_opinion
            opinion = 10
        }

        stress_impact = {
            trusting = minor_stress_impact_loss
            deceitful = minor_stress_impact_gain
        }

        ai_chance = {
            base = 30
            modifier = {
            	add = 20
            	has_trait = trusting
            }
            modifier = {
            	add = -10
            	has_trait = deceitful
            }
        }
    }

    option = {
        name = coronation_events.1034.c # "Tradition guides me — I will wear what is proper."
        add_piety = minor_piety_gain

        if = {
            limit = { has_trait = confucian_education }
            add_trait_xp = {
                trait = confucian_education
                value = lifestyle_confucian_education_xp_gain_minor_value
            }
        }
        else = {
        	add_learning_lifestyle_xp = minor_lifestyle_xp
        }

        stress_impact = {
            zealous = minor_stress_impact_loss
            arbitrary = minor_stress_impact_gain
        }

        ai_chance = {
            base = 10
            modifier = {
            	add = 20
            	has_trait = zealous
            }
            modifier = {
            	add = -15
            	has_trait = arbitrary
            }
        }
    }

    option = {
        name = coronation_events.1034.d # "Let fashion speak — I’ll wear what the capital wears."
        add_prestige = minor_prestige_gain
        add_diplomacy_lifestyle_xp = minor_lifestyle_xp

        stress_impact = {
            gregarious = minor_stress_impact_loss
            zealous = minor_stress_impact_gain
        }

        ai_chance = {
            base = 10
            modifier = {
            	add = 15
            	has_trait = gregarious
            }
            modifier = {
            	add = -15
            	has_trait = zealous
            }
        }
    }

    after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# some awful guest is trying to outshine you
coronation_events.1035 = {
    type = activity_event
    title = coronation_events.1035.t
    desc = coronation_events.1035.desc

    theme = coronation_activity

    cooldown = { years = 5 }

    left_portrait = {
        character = root
        animation = disapproval
        camera = camera_event_left
    }

    center_portrait = {
        character = scope:offending_guest
        animation = fanning_coyly
        camera = camera_event_center
    }

    trigger = {
    	scope:host = {
    		culture = { has_graphical_east_asia_culture_group_trigger = yes }
    	}
        scope:activity = {
            any_attending_character = {
                has_character_flag = outshining_host
            }
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes
        scope:activity = {
            random_attending_character = {
                limit = {
                    has_character_flag = outshining_host
                }
                save_scope_as = offending_guest
            }
        }
    }

    option = {
        name = coronation_events.1035.a # "Let them have their moment. My mandate stands above fabric."

        if = {
            limit = { government_allows = merit }
            change_merit = minor_merit_gain
        }
        else = {
        	add_prestige = minor_prestige_gain
        }

        scope:offending_guest = {
            add_opinion = {
                target = root
                modifier = weak_opinion
                opinion = 10
            }
        }

        custom_tooltip = coronation_tt_negative
 		scope:activity = { activity_special_type_progression_negative = yes }

        hidden_effect = {
        	scope:offending_guest = {
        		send_interface_toast = {
					title = coronation_events.1035.a.toast
					left_icon = root
					add_prestige = minor_prestige_gain
				}
        	}
        }

        stress_impact = {
            humble = minor_stress_impact_loss
            arrogant = minor_stress_impact_gain
        }

        ai_chance = {
            base = 50
            modifier = {
            	add = 20
            	has_trait = humble
            }
            modifier = {
            	add = -10
            	has_trait = arrogant
            }
        }
    }

    option = {
        name = coronation_events.1035.b # "Their insult will not be forgotten."

        progress_towards_rival_effect = {
			REASON = rival_outshine_coronation
			CHARACTER = scope:offending_guest
			OPINION = -20
		}

		hidden_effect = {
        	scope:offending_guest = {
        		send_interface_toast = {
					title = coronation_events.1035.b.toast
					left_icon = root
					show_as_tooltip = {
						root = {
							progress_towards_rival_effect = {
								REASON = rival_outshine_coronation
								CHARACTER = scope:offending_guest
								OPINION = -20
							}
						}
					}
				}
        	}
        }

        stress_impact = {
            wrathful = minor_stress_impact_loss
            forgiving = minor_stress_impact_gain
        }

        ai_chance = {
            base = 30
            modifier = {
            	add = 20
            	has_trait = wrathful
            }
            modifier = {
            	add = -15
            	has_trait = forgiving
            }
        }
    }

    option = {
        name = coronation_events.1035.c # "A gentle word in private should suffice."

        scope:offending_guest = {
            add_opinion = {
                target = root
                modifier = annoyed_opinion
                opinion = -5
            }
        }

        add_diplomacy_lifestyle_xp = minor_lifestyle_xp

        hidden_effect = {
        	scope:offending_guest = {
        		send_interface_toast = {
					title = coronation_events.1035.c.toast
					left_icon = root
					add_stress = minor_stress_gain
				}
        	}
        }

        stress_impact = {
            just = minor_stress_impact_loss
            callous = minor_stress_impact_gain
        }

        ai_chance = {
            base = 20
            modifier = {
            	add = 15
            	has_trait = just
            }
            modifier = {
            	add = -10
            	has_trait = callous
            }
        }
    }
    after = {
		# For MP
		coronation_ready_effect = yes

    	scope:activity = {
    		every_attending_character = {
    			remove_character_flag = outshining_host
    		}
    	}
    }
}

# People are reciting verses in honor of the coronation
coronation_events.1036 = {
    type = activity_event
    title = coronation_events.1036.t
    desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:host.culture = { has_cultural_pillar = heritage_chinese }
				}
				desc = coronation_events.1036.china.desc
			}
			triggered_desc = {
				trigger = {
					scope:host.culture = { has_cultural_pillar = heritage_japonic }
				}
				desc = coronation_events.1036.japan.desc
			}
			triggered_desc = {
				trigger = {
					scope:host.culture = { has_cultural_pillar = heritage_korean }
				}
				desc = coronation_events.1036.korea.desc
			}
			desc = coronation_events.1036.desc
		}
	}

    theme = coronation_activity

    cooldown = { years = 5 }

    left_portrait = {
        character = root
        animation = fanning
    }

    center_portrait = {
        character = scope:verse_initiator
        animation = storyteller
    }

    right_portrait = {
    	character = scope:host
        animation = throne_room_bow_1
    }

    trigger = {
    	scope:host = {
    		culture = { has_graphical_east_asia_culture_group_trigger = yes }
    	}
    	scope:activity = {
            any_attending_character = {
                this != root
                OR = {
                	likes_character_trigger = { CHARACTER = scope:host }
        			is_in_guest_subset = { name = supporter }
                }
            	OR = {
					has_trait = lifestyle_poet
					has_trait = violet_poet
					AND = {
						has_trait = tourney_participant
						has_trait_xp = {
							trait = tourney_participant
							track = wit
							value >= 25
						}
					}
				}
            }
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes
        scope:activity = {
            random_attending_character = {
                limit = {
                	this != root
                	OR = {
						has_trait = lifestyle_poet
						has_trait = violet_poet
						AND = {
							has_trait = tourney_participant
							has_trait_xp = {
								trait = tourney_participant
								track = wit
								value >= 25
							}
						}
					}
                }
                save_scope_as = verse_initiator
            }
        }
    }

    option = {
        name = coronation_events.1036.a # Praise Host in verse

        trigger = {
        	OR = {
				has_trait = lifestyle_poet
				has_trait = violet_poet
				AND = {
					has_trait = tourney_participant
					has_trait_xp = {
						trait = tourney_participant
						track = wit
						value >= 25
					}
				}
			}
        	OR = {
        		likes_character_trigger = { CHARACTER = scope:host }
        		is_in_guest_subset = { name = supporter }
        	}
        }

        progress_towards_friend_effect = {
			REASON = best_friend_poetry
			CHARACTER = scope:host
			OPINION = 15
		}

		if = {
			limit = {
				NOT = { has_trait = lifestyle_poet }
			}
			add_trait = lifestyle_poet
		}
		else_if = {
			limit = {
				has_trait = lifestyle_poet
				has_trait_xp = {
					trait = lifestyle_poet
					value < 100
				}
			}
			add_trait_xp = {
				trait = lifestyle_poet
				value = 10
			}
		}

		stress_impact = {
			gregarious = minor_stress_impact_loss
		}

		ai_chance = {
        	base = 40
	        modifier = {
	            add = 20
	            has_trait = gregarious
	        }
	        modifier = {
	            add = 15
	            likes_character_trigger = { CHARACTER = scope:host }
	        }
	        ai_value_modifier = {
	            ai_sociability = 1
	        }
	    }
    }

    option = {
        name = coronation_events.1036.b # Veiled critique of Host

        trigger = {
        	OR = {
				has_trait = lifestyle_poet
				has_trait = violet_poet
				AND = {
					has_trait = tourney_participant
					has_trait_xp = {
						trait = tourney_participant
						track = wit
						value >= 25
					}
				}
			}
        	OR = {
        		dislikes_character_trigger = { CHARACTER = scope:host }
        		is_in_guest_subset = { name = detractor }
        	}
        }

        if = {
			limit = {
				NOT = { has_trait = lifestyle_poet }
			}
			add_trait = lifestyle_poet
		}
		else_if = {
			limit = {
				has_trait = lifestyle_poet
				has_trait_xp = {
					trait = lifestyle_poet
					value < 100
				}
			}
			add_trait_xp = {
				trait = lifestyle_poet
				value = 10
			}
		}

        scope:activity.host = {
            progress_towards_rival_effect = {
                CHARACTER = root
                REASON = rival_poetry
                OPINION = -10
            }
        }

        stress_impact = {
			cynical = minor_stress_impact_loss
		}

        ai_chance = {
	        base = 30
	        modifier = {
	            add = 20
	            has_trait = cynical
	        }
	        modifier = {
	            add = 20
	            dislikes_character_trigger = { CHARACTER = scope:host }
	        }
	        ai_value_modifier = {
	            ai_vengefulness = 1
	        }
	    }
    }

    option = {
        name = coronation_events.1036.c # Compose formal verse

        trigger = {
        	OR = {
				has_trait = lifestyle_poet
				has_trait = violet_poet
				AND = {
					has_trait = tourney_participant
					has_trait_xp = {
						trait = tourney_participant
						track = wit
						value >= 25
					}
				}
			}
        }

        if = {
            limit = { has_trait = confucian_education }
            add_trait_xp = {
                trait = confucian_education
                value = lifestyle_confucian_education_xp_gain_minor_value
            }
        }
        else = {
        	add_learning_lifestyle_xp = minor_lifestyle_xp
        }
        if = {
			limit = {
				NOT = { has_trait = lifestyle_poet }
			}
			add_trait = lifestyle_poet
		}
		else_if = {
			limit = {
				has_trait = lifestyle_poet
				has_trait_xp = {
					trait = lifestyle_poet
					value < 100
				}
			}
			add_trait_xp = {
				trait = lifestyle_poet
				value = 10
			}
		}

        stress_impact = {
			ambitious = minor_stress_impact_loss
		}

        ai_chance = {
	        base = 35
	        modifier = {
	            add = 20
	            has_trait = ambitious
	        }
	        ai_value_modifier = {
	            ai_zeal = 1
	        }
	    }
    }

    option = {
        name = coronation_events.1036.d # Praise the recital

        progress_towards_friend_effect = {
			REASON = friend_praised_poetry
			CHARACTER = scope:verse_initiator
			OPINION = 15
		}

		stress_impact = {
			trusting = minor_stress_impact_loss
		}

		ai_chance = {
	        base = 35
	        modifier = {
	            add = 15
	            has_trait = trusting
	        }
	        ai_value_modifier = {
	            ai_sociability = 1
	        }
	    }
    }

    option = {
        name = coronation_events.1036.e # Subtle critique of recital

        add_intrigue_lifestyle_xp = minor_lifestyle_xp
        scope:verse_initiator = {
            add_opinion = {
				target = root
				modifier = frustrated_opinion
				opinion = -15
			}
        }

        stress_impact = {
			arrogant = minor_stress_impact_loss
		}

        ai_chance = {
	        base = 25
	        modifier = {
	            add = 20
	            has_trait = arrogant
	        }
	        ai_value_modifier = {
	            ai_greed = 1
	            ai_vengefulness = 1
	        }
	    }
    }

    after = {
		# For MP
		coronation_ready_effect = yes
	}
}

# someone is taking a natural occurrence as an omen
coronation_events.1037 = {
    type = activity_event
    title = coronation_events.1037.t
    desc = coronation_events.1037.desc
    theme = coronation_activity
    cooldown = { years = 10 }

    left_portrait = {
        character = scope:host
        animation = stress
        camera = camera_event_center_pointing_right
    }

    center_portrait = {
        character = scope:skeptical_guest
        animation = shock
        camera = camera_event_center_pointing_left
    }

    right_portrait = {
    	trigger = { exists = scope:respected_elder }
        character = scope:respected_elder
        animation = personality_zealous
    }

    trigger = {
    	culture = { has_graphical_east_asia_culture_group_trigger = yes }
    	OR = {
    		location.county = {
				any_county_situation = {
					OR = {
						situation_type = natural_disaster_flood
						situation_type = natural_disaster_earthquake
					}
				}
			}
			# Ongoing plague
			any_sub_realm_county = {
				any_county_province = {
					any_province_epidemic = {
						outbreak_intensity > minor
					}
				}
			}
    	}
    	scope:activity = {
            any_attending_character = {
                is_ai = yes
                has_trait = zealous
                culture = { has_graphical_east_asia_culture_group_trigger = yes }
            }
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes
    	scope:activity = {
            random_attending_character = {
                limit = {
                    is_ai = yes
                    has_trait = zealous
                    culture = { has_graphical_east_asia_culture_group_trigger = yes }
                }
                save_scope_as = skeptical_guest
            }
            random_attending_character ?= {
            	limit = {
            		age > 60
            		OR = {
            			AND = {
            				has_trait = confucian_education
							has_trait_xp = {
								trait = confucian_education
								value > 70
							}
            			}
		                learning >= high_skill_rating
		                has_relation_elder = root
		            }
            	}
            	save_scope_as = respected_elder
            }
        }
        location.county = {
        	random_county_situation ?= {
            	limit = {
            		OR = {
						situation_type = natural_disaster_flood
						situation_type = natural_disaster_earthquake
					}
            	}
            	save_scope_as = omen_happening
			}
        }
        if = {
            limit = {
            	NOT = {
            		exists = scope:omen_happening
            	}
            }
           	random_sub_realm_county = {
				random_county_province = {
					random_province_epidemic = {
						limit = {
							outbreak_intensity > minor
						}
						save_scope_as = omen_happening
					}
				}
			}
        }
    }

    option = {
        name = coronation_events.1037.a # Invoke scripture, poetry, or history

        trigger = {
            OR = {
                has_trait = confucian_education
                learning >= high_skill_rating
            }
        }

        custom_tooltip = coronation_tt_positive_tiny
		scope:activity = { activity_special_type_progression_tiny = yes }
		coronation_add_magnificence_log_effect = {
			VALUE = flag:positive_tiny
			CHAR = root
		}
        add_learning_lifestyle_xp = medium_lifestyle_xp

        scope:skeptical_guest = {
            add_opinion = {
                target = scope:host
                modifier = impressed_opinion
                opinion = 15
            }
        }

        stress_impact = {
            arrogant = minor_stress_impact_loss
            diligent = minor_stress_impact_loss
        }

        ai_chance = {
            base = 35
            modifier = {
                add = 20
                has_trait = confucian_education
            }
            modifier = {
                add = 15
                learning >= high_skill_rating
            }
            modifier = {
                add = 15
                has_trait = arrogant
            }
            modifier = {
                add = 15
                has_trait = diligent
            }
            ai_value_modifier = {
                ai_honor = 1
            }
        }
    }

    option = {
        name = coronation_events.1037.b # Invite a respected elder to speak

        trigger = {
        	exists = scope:respected_elder
        }

        if = {
            limit = { has_trait = confucian_education }
            add_trait_xp = {
                trait = confucian_education
                value = lifestyle_confucian_education_xp_gain_minor_value
            }
        }
        else_if = {
        	limit = {
        		location = {
					is_province_valid_confucian_education_trigger = yes
				}
    			has_government = celestial_government
        	}
        	add_trait = confucian_education
        }
        else = {
        	add_learning_lifestyle_xp = minor_lifestyle_xp
        }

        stress_impact = {
            zealous = minor_stress_impact_loss
            temperate = minor_stress_impact_loss
        }

        ai_chance = {
            base = 30
            modifier = {
                add = 20
                has_trait = temperate
            }
            modifier = {
                add = 20
                has_trait = zealous
            }
            ai_value_modifier = {
                ai_honor = 1
                ai_zeal = 2
            }
        }
    }

    option = {
        name = coronation_events.1037.c # Expel them from the ceremony

        add_dread = medium_dread_gain
		add_prestige = minor_prestige_loss

        scope:skeptical_guest = {
            remove_from_activity = scope:activity
        }

        stress_impact = {
            wrathful = minor_stress_impact_loss
            arbitrary = minor_stress_impact_loss
            just = minor_stress_impact_gain
        }

        ai_chance = {
            base = 20
            modifier = {
                add = 20
                has_trait = wrathful
            }
            modifier = {
                add = 10
                has_trait = arbitrary
            }
            modifier = {
                add = -10
                has_trait = just
            }
            ai_value_modifier = {
                ai_greed = 1
                ai_vengefulness = 2
            }
        }
    }

    option = {
        name = coronation_events.1037.d # Laugh it off

        scope:skeptical_guest = {
            add_opinion = {
                target = scope:host
                modifier = dismissed_me_opinion
                opinion = -5
            }
        }

        stress_impact = {
            base = minor_stress_impact_loss
            zealous = minor_stress_impact_gain
            cynical = minor_stress_impact_loss
        }

        ai_chance = {
            base = 25
            modifier = {
                add = -10
                has_trait = zealous
            }
            modifier = {
                add = -10
                has_trait = cynical
            }
            ai_value_modifier = {
                ai_zeal = -1
            }
        }
    }
    after = {
		# For MP
		coronation_ready_effect = yes
	}
}
