﻿# Events for handling the Feast activity
# Main events are handled in separate event files


namespace = feast


# 0000-0999: Maintenance and selection events
# 0100-0199: Special Main Event selection
# 1000-1999: Host preparation events
# 2000-2999: Guest preparation events
# 3000-3999: Host regular start events
# 4000-4999: Host special start events
# 5000-5999: Guest regular start events
# 6000-6999: Guest special start events


# MAINTENANCE EVENTS
# 0000 - 0999


feast.0001 = {
	hidden = yes
	# Deprecated, here for reference
	orphan = yes

	immediate = {
	#Look for various conditions for host events to address:

		# Look for a target you're trying to befriend
		if = {
			limit = {
				any_scheme = {
					type = befriend
					scheme_target_character = {
						involved_activity ?= scope:activity
					}
				}
			}
			random_scheme = {
				type = befriend
				limit = {
					scheme_target_character = {
						involved_activity ?= scope:activity
					}
				}
				scheme_target_character = {
					scope:activity = {
						set_variable = {
							name = potential_friend
							value = prev
						}
					}
				}
				scheme_freeze = {
					reason = "BEFRIENDING_AT_FEAST"
					days = 10
				}
			}
		}

		#Give all participants start feast events
		scope:activity = {
			every_attending_character = {
				if = { #You're busy at another party! (invites were sent the same day, but you agreed to another party after this one )
					limit = {
						exists = var:booked_for_a_party
						var:booked_for_a_party = { this != scope:activity.activity_host }
					}
					trigger_event = feast.0010
				}
				else = {
					trigger_event = {
						on_action = feast_start_events
					}
				}
			}
		}
	}
}

#####################
# Double booked - cancellation event
# by Linnéa Thimrén
#####################
feast.0010 = {
	type = letter_event
	opening = {
		desc = feast.1501.opening
	}
	desc = feast.0010.desc
	sender = scope:activity.activity_host

	immediate = {
		var:booked_for_a_party = {
			save_scope_as = other_host
		}
		decline_activity_invite = scope:activity
		scope:activity.activity_host = {
			add_opinion = {
				target = root
				modifier = insult_opinion
				opinion = -10
			}
		}
	}

	option = {
		name = feast.0010.a

	}
}

#######################
#	Reveler trait gain
#	by Joe Parkin
#######################

feast.0050 = {
	type = activity_event
	title = feast.0050.t
	desc = feast.0050.desc
	theme = feast_activity
	override_background = { reference = feast }
	left_portrait = {
		character = root
		animation = toast_goblet
	}
	cooldown = { years = 15 }

	option = { # Yes
		name = feast.0050.a
		add_trait = lifestyle_reveler
		if = {
			limit = {
				culture = { has_cultural_parameter = reveler_traits_more_valued }
			}
			add_prestige = miniscule_prestige_gain
		}
		stress_impact = {
			shy = minor_stress_impact_gain
			reclusive = medium_stress_impact_gain
		}
		ai_chance = {
			base = 25
			modifier = {
				culture = { has_cultural_parameter = reveler_traits_more_valued }
				factor = 2
			}
			modifier = {
				has_trait = education_diplomacy
				factor = 2
			}
			modifier = {
				trigger_if = {
					limit = {
						is_ai = yes
						is_vassal_of = scope:host
					}
					has_vassal_stance = courtly
				}
				factor = 2
			}
			ai_value_modifier = {
				ai_energy = 0.5
				ai_boldness = 0.5
				ai_sociability = 0.5
				ai_zeal = -1
			}
		}
	}

	option = { # No
		name = feast.0050.b
		stress_impact = {
			gregarious = minor_stress_impact_gain
			drunkard = medium_stress_impact_gain
			hashishiyah = medium_stress_impact_gain
		}
		ai_chance = {
			base = 25
			modifier = {
				is_clergy = yes
				factor = 2
			}
			modifier = {
				trigger_if = {
					limit = {
						is_ai = yes
						is_vassal_of = scope:host
					}
					has_vassal_stance = courtly
				}
				factor = 2
			}
			ai_value_modifier = {
				ai_energy = -0.5
				ai_boldness = -0.5
				ai_sociability = -0.5
				ai_zeal = 1
			}
		}
	}
}

######################
# INVITATION EVENTS
# 1500 - 1999
# by Petter Vilberg
######################

#Vassals
feast.1501 = {
	type = letter_event
	opening = {
		desc = feast.1501.opening
	}
	desc = {
		desc = feast.1501.opening_desc
		first_valid = {
			triggered_desc = {
				trigger = {
					reverse_opinion = {
						target = scope:sender
						value > 50
					}
				}
				desc = feast.1501.host_likes_me
			}
			triggered_desc = {
				trigger = {
					reverse_opinion = {
						target = scope:sender
						value > -1
					}
				}
				desc = feast.1501.host_gets_along_with_me
			}
			desc = feast.1501.host_dislikes_me
		}
	}
	sender = scope:sender

	trigger = {
		is_available_for_activity_trigger = yes
		exists = scope:activity.activity_host
		target_is_liege_or_above = scope:activity.activity_host
		NOT = { exists = var:is_handling_feast_invitation }
	}

	on_trigger_fail = { #Trigger invitation again if it was blocked because the character was handling another invitation
		if = {
			limit = {
				is_available_for_activity_trigger = yes
				exists = var:is_handling_feast_invitation
			}
			trigger_event = {
				id = feast.1501
				days = 1
			}
		}
	}

	immediate = {
		scope:activity.activity_host = {
			save_scope_as = sender
		}
		scope:activity.activity_location = {
			barony = {
				save_scope_as = barony
			}
		}
		set_variable = {
			name = is_handling_feast_invitation
			value = scope:sender
			days = 20
		}
	}

	option = {
		name = feast.1501.a
		trigger = {
			opinion = {
				target = liege
				value >= 0
			}
		}
		play_music_cue = mx_cue_banquet
		accept_activity_invite = scope:activity
		set_variable = {
			name = booked_for_a_party
			value = scope:sender
			days = 20
		}
		stress_impact = {
			comfort_eater = minor_stress_loss
			drunkard = minor_stress_loss
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:sender
			}
		}
	}

	option = {
		name = feast.1501.b
		trigger = {
			opinion = {
				target = liege
				value < 0
			}
		}
		play_music_cue = mx_cue_banquet
		accept_activity_invite = scope:activity
		set_variable = {
			name = booked_for_a_party
			value = scope:sender
			days = 20
		}
		stress_impact = {
			comfort_eater = minor_stress_loss
			drunkard = minor_stress_loss
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:sender
			}
		}
	}

	option = {
		name = feast.1501.c
		trigger = {
			opinion = {
				target = liege
				value > -1
			}
		}
		decline_activity_invite = scope:activity
		stress_impact = {
			inappetetic = minor_stress_loss
			reclusive = minor_stress_loss
		}
		if = {
			limit = {
				faith = {
					has_doctrine_parameter = mandatory_feast_attendance
				}
			}
			add_piety = medium_piety_loss
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 0.2
			}
			modifier = {
				add = -50
				faith = {
					has_doctrine_parameter = mandatory_feast_attendance
				}
			}
		}
	}

	option = {
		name = feast.1501.d
		trigger = {
			opinion = {
				target = liege
				value < 0
			}
		}
		decline_activity_invite = scope:activity
		stress_impact = {
			inappetetic = minor_stress_loss
			reclusive = minor_stress_loss
		}
		if = {
			limit = {
				faith = {
					has_doctrine_parameter = mandatory_feast_attendance
				}
			}
			add_piety = medium_piety_loss
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 0.2
				ai_vengefulness = 0.5
			}
			modifier = {
				add = -50
				faith = {
					has_doctrine_parameter = mandatory_feast_attendance
				}
			}
		}
	}

	after = {
		remove_variable = is_handling_feast_invitation
	}
}


#Liege
feast.1502 = {
	type = letter_event
	opening = {
		desc = feast.1501.opening
	}
	desc = feast.1502.desc
	sender = scope:sender

	trigger = {
		is_available_for_activity_trigger = yes
		NOT = { exists = var:is_handling_feast_invitation }
		exists = scope:activity.activity_host #In case the activity owner dies waiting...
	}

	on_trigger_fail = { #Trigger invitation again if it was blocked because the character was handling another invitation
		if = {
			limit = {
				is_available_for_activity_trigger = yes
				exists = var:is_handling_feast_invitation
			}
			trigger_event = {
				id = feast.1502
				days = 1
			}
		}
	}

	immediate = {
		scope:activity.activity_host = {
			save_scope_as = sender
		}
		scope:activity.activity_location = {
			barony = {
				save_scope_as = barony
			}
		}
		set_variable = {
			name = is_handling_feast_invitation
			value = scope:sender
			days = 20
		}
	}

	option = {
		name = feast.1502.a
		play_music_cue = mx_cue_banquet
		accept_activity_invite = scope:activity
		set_variable = {
			name = booked_for_a_party
			value = scope:sender
			days = 20
		}
		stress_impact = {
			comfort_eater = minor_stress_loss
			drunkard = minor_stress_loss
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:sender
			}
		}
	}

	option = {
		name = feast.1502.b
		ai_chance = {
			base = 10
			modifier = {
				add = 15
				target_is_liege_or_above = scope:sender
			}
			ai_value_modifier = {
				ai_boldness = 0.2
			}
		}
		decline_activity_invite = scope:activity
		stress_impact = {
			inappetetic = minor_stress_loss
			reclusive = minor_stress_loss
		}
	}

	after = {
		remove_variable = is_handling_feast_invitation
	}
}


#Other relations
feast.1503 = {
	type = letter_event
	opening = {
		desc = feast.1501.opening
	}
	desc = feast.1503.desc
	sender = scope:sender

	trigger = {
		is_available_for_activity_trigger = yes
		NOT = { exists = var:is_handling_feast_invitation }
	}

	on_trigger_fail = { #Trigger invitation again if it was blocked because the character was handling another invitation
		if = {
			limit = {
				is_available_for_activity_trigger = yes
				exists = var:is_handling_feast_invitation
			}
			trigger_event = {
				id = feast.1503
				days = 1
			}
		}
	}

	immediate = {
		scope:activity.activity_host = {
			save_scope_as = sender
		}
		scope:activity.activity_location = {
			barony = {
				save_scope_as = barony
			}
		}
		set_variable = {
			name = is_handling_feast_invitation
			value = scope:sender
			days = 20
		}
	}

	option = {
		name = feast.1503.a
		play_music_cue = mx_cue_banquet
		accept_activity_invite = scope:activity
		set_variable = {
			name = booked_for_a_party
			value = scope:sender
			days = 20
		}
		stress_impact = {
			comfort_eater = minor_stress_loss
			drunkard = minor_stress_loss
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:sender
			}
		}
	}

	option = {
		name = feast.1503.b
		decline_activity_invite = scope:activity
		stress_impact = {
			inappetetic = minor_stress_loss
			reclusive = minor_stress_loss
		}
		ai_chance = {
			base = 10
			modifier = {
				add = 15
				scope:sender = {
					target_is_liege_or_above = scope:sender
				}
			}
			ai_value_modifier = {
				ai_boldness = 0.2
			}
		}
	}

	after = {
		remove_variable = is_handling_feast_invitation
	}
}


#################
# START EVENTS FOR HOST
# 2000 - 2499
#################

# HOST: Time to start the feast!
# Generic start event.
# by Petter Vilberg and Linnéa Thimrén & Veronica Pazos
######
feast.2001 = {
	type = activity_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					is_murder_feast = yes
				}
				desc = feast.2001.t_murder
			}
			desc = feast.2001.t
		}
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					is_murder_feast = yes
				}
				desc = feast.2001.desc_murder_feast
			}
			random_valid = {
				triggered_desc = {
					trigger = {
						is_murder_feast = no
						OR = {
							has_trait = comfort_eater
							has_trait = drunkard
							has_trait = lifestyle_reveler
							has_trait = gregarious
							has_education_diplomacy_trigger = yes
						}
					}
					desc = feast.2001.desc_gregarious
				}
				triggered_desc = {
					trigger = {
						is_murder_feast = no
						OR = {
							has_trait = shy
							has_trait = reclusive
							has_trait = paranoid
							has_trait = craven
						}
					}
					desc = feast.2001.desc_shy
				}
				triggered_desc = {
					trigger = {
						is_murder_feast = no
						OR = {
							has_trait = ambitious
							has_trait = arrogant
							has_trait = deceitful
							has_trait = cynical
							has_education_intrigue_trigger = yes
						}
					}
					desc = feast.2001.desc_ambitious
				}
				triggered_desc = {
					trigger = {
						is_murder_feast = no
						OR = {
							has_trait = scholar
							has_trait = theologian
							has_education_learning_trigger = yes
						}
					}
					desc = feast.2001.desc_nerd
				}
				triggered_desc = {
					trigger = {
						is_murder_feast = no
						OR = {
							has_trait = brave
							has_trait = impatient
							has_trait = wrathful
							has_education_martial_trigger = yes
						}
					}
					desc = feast.2001.desc_martial
				}
				triggered_desc = {
					trigger = {
						is_murder_feast = no
						has_lustful_adjacent_trait_trigger = yes
					}
					desc = feast.2001.desc_lustful
				}
				desc = feast.2001.desc_fallback
			}
		}
	}
	theme = feast_activity
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { is_murder_feast = yes }
			animation = scheme
		}
		animation = toast_goblet
	}
	center_portrait = {
		trigger = { exists = scope:honorary_guest }
		character = scope:honorary_guest
		animation = personality_honorable
	}
	right_portrait = {
		trigger = {
			exists = scope:my_spouse
			NOT = { scope:honorary_guest ?= scope:my_spouse }
		}
		character = scope:my_spouse
		animation = ecstasy
	}

	trigger = {
		this = scope:activity.activity_host
	}

	immediate = {
		play_music_cue = grandfeast_cue
		if = {
			limit = {
				scope:activity = {
					any_attending_character = {
						is_spouse_of = root
						is_healthy = yes
					}
				}
			}
			scope:activity = {
				random_attending_character = {
					limit = {
						is_spouse_of = root
						is_healthy = yes
					}
					save_scope_as = my_spouse
				}
			}
		}
		if = {
			limit = {
				is_murder_feast = yes
				exists = scope:activity.special_guest:honorary_guest
			}
			scope:activity.special_guest:honorary_guest = { save_scope_as = honorary_guest }
		}
		else_if = {
			limit = { exists = scope:activity.special_guest:honorary_guest_regular }
			scope:activity.special_guest:honorary_guest_regular = { save_scope_as = honorary_guest }
		}
		if = {
			limit = { #The murder feast will only happen for players
				is_ai = no
				NOT = { #Blocked (for now) if any participant is a player
					scope:activity = {
						any_attending_character = {
							this != root
							is_ai = no
						}
					}
				}
			}
			if = {
				limit = {
					any_scheme = {
						type = murder
						scheme_target_character = {
							is_ai = yes
							is_participant_in_activity = scope:activity
						}
					}
				}
				every_scheme = {
					type = murder
					limit = {
						scheme_target_character = {
							is_ai = yes
							is_participant_in_activity = scope:activity
						}
					}
					scheme_target_character = {
						add_to_list = murder_feast_enemies
					}
				}
			}
			if = {
				limit = {
					any_relation = {
						type = rival
						is_ai = yes
						is_participant_in_activity = scope:activity
					}
				}
				every_relation = {
					type = rival
					limit = {
						is_ai = yes
						is_participant_in_activity = scope:activity
					}
					add_to_list = murder_feast_enemies
				}
			}
		}
	}

	option = {
		name = feast.2001.a
		trigger ={
			is_murder_feast = no
		}
		exclusive = yes
		custom_tooltip = feast.2001.a.tt
	}

	option = { #Murder everyone
		name = feast.2001.b
		trigger = {
			is_murder_feast = yes
		}
		custom_tooltip = feast.2001.a.tt
		set_variable = murder_feast_entourage_murder_var

		ai_chance = {
			base = 50
			modifier = {
				OR = {
					has_trait = compassionate
					has_trait = forgiving
					has_trait = just
					has_trait = calm
				}
				add = -50
			}
			modifier = {
				OR = {
					has_trait = sadistic
					has_trait = callous
					has_trait = torturer
					has_trait = wrathful
					has_trait = vengeful
				}
				add = 75
			}
		}
	}

	option = { #Murder ONLY your target
		name = feast.2001.c
		trigger = {
			is_murder_feast = yes
		}
		set_variable = {
			name = murder_feast
			value = 0
		}
		custom_tooltip = feast.2001.a.tt
		set_variable = murder_feast_target_murder_var

		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = sadistic
					has_trait = callous
					has_trait = torturer
					has_trait = wrathful
					has_trait = vengeful
				}
				add = -50
			}
		}
	}

	option = { #Murder your target - sneakily
		name = feast.2001.d
		trigger = {
			is_murder_feast = yes
			scope:honorary_guest = { is_ai = yes } #too complicated to have it open
		}
		set_variable = murder_feast_target_sneak_murder_var
		custom_tooltip = feast.2001.d.tt

		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = vengeful
					has_trait = wrathful
					has_trait = sadistic
					has_trait = callous
					has_trait = torturer
				}
				add = -50
			}
			modifier = {
				OR = {
					has_trait = paranoid
					has_trait = deceitful
					has_trait = craven
				}
				add = 75
			}
		}
	}

	option = { #Back down
		name = feast.2001.e
		custom_tooltip = feast.2001.e.tt
		set_variable = murder_feast_murder_back_down

		ai_chance = {
			base = 0 #AI would never back down when going this far
			modifier = {
				OR = {
					has_trait = compassionate
					has_trait = forgiving
					has_trait = just
					has_trait = calm
				}
				add = 100
			}
		}
	}
}


# HOST: No guests showed up
# You're so alone.
# by Petter Vilberg
###
feast.2003 = {
	type = character_event
	title = feast.2003.t
	desc = feast.2003.desc
	theme = feast_activity
	left_portrait = {
		character = root
		animation = sadness
	}

	option = {
		name = feast.2003.a
		stress_impact = {
			base = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
		}
	}

	option = {
		name = feast.2003.b
		trigger = {
			has_trait = shy
		}
		exclusive = yes
		trait = shy
		stress_impact = {
			base = minor_stress_impact_loss
		}
	}
}


####################
# START EVENTS FOR GUESTS
# 2500 - 2999
####################

# GUESTS: TIME TO START THE FEAST!
# Generic start event
# by Petter Vilberg
###
feast.2501 = {
	type = activity_event
	title = feast.2501.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_relation_rival = scope:activity.activity_host
					}
					reverse_opinion = {
						target = scope:activity.activity_host
						value < -40
					}
				}
				desc = feast.2501.dislikes_host
			}
			desc = feast.2501.likes_host
		}
	}
	theme = feast_activity
	left_portrait = {
		character = root
		animation = admiration
	}
	right_portrait = {
		trigger = { 
			root != scope:host
		}
		character = scope:activity.activity_host
		animation = happiness
	}

	trigger = {
		# Guests only.
		this != scope:activity.activity_host
	}

	immediate = {
		play_music_cue = mx_cue_banquet
	}

	option = {
		name = {
			trigger = { has_trait = gluttonous }
			text = feast.2501.a.gluttonous
		}
		name = {
			trigger = { has_trait = drunkard }
			text = feast.2501.a.drunkard
		}
		name = {
			trigger = { has_trait = gregarious }
			text = feast.2501.a.gregarious
		}
		name = {
			trigger = { has_trait = shy }
			text = feast.2501.a.shy
		}
		name = {
			text = feast.2501.a
		}
	}

	option = {
		trigger = {
			opinion = {
				target = scope:activity.activity_host
				value < 0
			}
		}
		exclusive = yes
		name = feast.2501.b
	}
}


####################################
# FEAST INTERRUPTION NOTIFICATIONS
# 5000-5999
####################################

#The host has died during the feast - event for guests
# by Linnéa Thimrén
feast.5003 = {
	type = character_event
	title = feast.5003.t
	desc = feast.3601.desc
	theme = feast_activity
	override_icon = {
		reference = "gfx/interface/icons/event_types/type_illness.dds"
	}
	left_portrait = {
		character = scope:host
	}

	option = {
		name = feast.3601.a
		custom_tooltip = feast.3601.a.tt
	}
}


#The host has been imprisoned - for host
# by Linnéa Thimrén
feast.5004 = {
	type = character_event
	title = feast.5003.t
	desc = feast.5004.desc
	theme = feast_activity
	override_icon = {
		reference = "gfx/interface/icons/event_types/type_prison.dds"
	}
	left_portrait = {
		character = scope:host
		animation = prisondungeon
	}

	immediate = {
		hosted_successful_feast_interrupted_effect = yes
	}

	option = {
		name = feast.5002.a
	}

	after = {
		if = {
			limit = {
				has_character_flag = murdered_someone_during_feast
			}
			remove_character_flag = murdered_someone_during_feast
		}
	}
}

#The host has been imprisoned - for guests
# by Linnéa Thimrén
feast.5005 = {
	type = character_event
	title = feast.5003.t
	desc = feast.5005.desc
	theme = feast_activity
	override_icon = {
		reference = "gfx/interface/icons/event_types/type_prison.dds"
	}
	left_portrait = {
		character = scope:host
		animation = prisondungeon
	}

	option = {
		name = feast.5002.a
	}
}



##################################################
# REWORKED FEAST CONTENT
# Veronica Pazos

# Enter passive state - you arrived

feast.7002 = {
	type = activity_event
	title = feast.7002.t
	desc = {
		desc = feast.7002.desc_intro
		first_valid = {
			triggered_desc = {
				trigger = {
					this != scope:host 
					OR = {
						has_relation_rival = scope:activity.activity_host
						reverse_opinion = {
							target = scope:activity.activity_host
							value < 0
						}
					}
				}
				desc = feast.7002.dislikes_host
			}
			triggered_desc = {
				trigger = {
					this != scope:host 
					OR = {
						has_relation_rival = scope:activity.activity_host
						reverse_opinion = {
							target = scope:activity.activity_host
							value >= 40
						}
					}
				}
				desc = feast.7002.likes_host
			}
			desc = feast.7002.neutral
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					intent_target.location ?= root.location
				}
				desc = feast.7002.intent_arrived
			}
			triggered_desc = {
				trigger = { exists = intent_target }
				desc = feast.7002.intent
			}
		}
	}
	theme = feast_activity
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				this != scope:host
				opinion = {
					target = scope:activity.activity_host
					value < 0
				}
			}
			animation = boredom
		}
		animation = happiness
	}
	center_portrait = {
		trigger = { root != scope:host }
		character = scope:host
		animation = toast_goblet
	}
	right_portrait = {
		character = scope:center_portrait
		animation = drink_goblet
	}
	cooldown = { years = 1 }

	immediate = {
		play_music_cue = mx_cue_banquet
		if = {
			limit = {
				exists = involved_activity.special_guest:honorary_guest
				NOT = { this = involved_activity.special_guest:honorary_guest }
			}
			involved_activity.special_guest:honorary_guest = { save_scope_as = center_portrait }
		}
		else_if = {
			limit = {
				exists = involved_activity.special_guest:honorary_guest_regular
				NOT = { this = involved_activity.special_guest:honorary_guest_regular }
			}
			involved_activity.special_guest:honorary_guest_regular = { save_scope_as = center_portrait }
		}
		else_if = {
			limit = {
				involved_activity = {
					any_attending_character = {
						is_adult = yes
						NOR = {
							this = root
							this = scope:host
						}
						is_travelling = no
					}
				}
			}
			involved_activity = {
				random_attending_character = {
					limit = {
						is_adult = yes
						NOR = {
							this = root
							this = scope:host
						}
						is_travelling = no
					}
					save_scope_as = center_portrait
				}
			}
		}
	}

	option = {
		name = {
			trigger = {
				opinion = {
					target = scope:activity.activity_host
					value < 0
				}
			}
			text = feast.7002.a.bad
		}
		name = {
			trigger = {
				opinion = {
					target = scope:activity.activity_host
					value >= 0
				}
			}
			text = feast.7002.a.good
		}
		add_prestige = miniscule_prestige_gain
	}
}

# Guest introduction.
feast.7051 = {
	type = activity_event
	title = feast.2501.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_relation_rival = scope:activity.activity_host
						reverse_opinion = {
							target = scope:activity.activity_host
							value < -40
						}
					}
				}
				desc = feast.2501.dislikes_host
			}
			desc = feast.2501.likes_host
		}
	}
	theme = feast_activity
	left_portrait = {
		character = scope:activity.activity_host
		animation = flirtation
	}
	center_portrait = {
		character = scope:center_portrait
		animation = toast_goblet
	}
	right_portrait = {
		trigger = { 
			root != scope:center_portrait
		}
		character = root
		animation = happiness
	}

	immediate = {
		play_music_cue = mx_cue_banquet
		if = {
			limit = {
				exists = involved_activity.special_guest:honorary_guest
			}
			involved_activity.special_guest:honorary_guest = { save_scope_as = center_portrait }
		}
		else_if = {
			limit = {
				exists = involved_activity.special_guest:honorary_guest_regular
			}
			involved_activity.special_guest:honorary_guest_regular = { save_scope_as = center_portrait }
		}
		else = {
			involved_activity = {
				random_attending_character = {
					limit = {
						is_adult = yes
						this != root
						this != scope:host
					}
					save_scope_as = center_portrait
				}
			}
		}
	}

	option = {
		name = {
			trigger = {
				opinion = {
					target = scope:activity.activity_host
					value < 0
				}
			}
			text = feast.2501.b
		}
		name = {
			trigger = { has_trait = gluttonous }
			text = feast.2501.a.gluttonous
		}
		name = {
			trigger = { has_trait = drunkard }
			text = feast.2501.a.drunkard
		}
		name = {
			trigger = { has_trait = gregarious }
			text = feast.2501.a.gregarious
		}
		name = {
			trigger = { has_trait = shy }
			text = feast.2501.a.shy
		}
		name = { text = feast.2501.a }
		custom_tooltip = feast.2001.a.tt
	}
}

# Host ending event
feast.7101 = {
	type = activity_event
	title = feast.7101.t
	desc = {
		desc = feast.7101.desc
		first_valid = { #extra flavour
			triggered_desc = {
				trigger = {
					scope:activity = {
						has_activity_option = {
							category = feast_option_food
							option = feast_food_good
						}
					}
				}
				desc = feast_default.9001.desc_exotic
			}
			triggered_desc = {
				trigger = {
					scope:activity = {
						has_activity_option = {
							category = feast_option_food
							option = feast_food_normal
						}
					}
				}
				desc = feast_default.9001.desc_lavish
			}
			triggered_desc = {
				trigger = {
					scope:activity = {
						has_activity_option = {
							category = feast_option_food
							option = feast_food_bad
						}
					}
				}
				desc = feast_default.9001.desc_meager
			}
			desc = feast_default.9001.desc
		}
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:spouse }
				desc = feast_default.9001.spouse
			}
			desc = feast_default.9001.no_spouse
		}
	}
	theme = feast_activity
	center_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		trigger = { exists = scope:activity.special_guest:honorary_guest }
		character = scope:honorary_guest
		animation = personality_honorable
	}

	immediate = {
		save_scope_as = root_scope
		play_music_cue = grandfeast_cue
		if = {
			limit = {
				NOT = { exists = scope:spouse }
				is_married = yes
			}
			random_spouse = {
				limit = {
					is_available = yes
					this = root.primary_spouse
				}
				alternative_limit = {
					is_available = yes
				}
				save_scope_as = spouse
			}
		}
	}

	# Nice
	option = {
		name = feast.7101.a
		hidden_effect = {
			reveler_lifestyle_rank_up_check_effect = yes
		}
		show_as_tooltip = { #we give these out in the on_complete of the activity
			disburse_feast_activity_rewards = yes #includes magnificence and stress loss rewards
		}
	}
}

# Murder Feast host ending event
# by Veronica Pazos

feast.7110 = {
	type = activity_event
	title = feast.7110.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { #entourage
					has_variable = murder_feast_entourage_murder_var
				}
				desc = feast.7110.desc.entourage
			}
			triggered_desc = { #only target
				trigger = {
					has_variable = murder_feast_target_murder_var
				}
				desc = feast.7110.desc.target
			}
			triggered_desc = { #poison
				trigger = {
					has_variable = murder_feast_target_sneak_murder_var
				}
				desc = feast.7110.desc.sneaky
			}
			triggered_desc = { #failed
				trigger = {
					has_variable = murder_feast_murder_failure_var
				}
				desc = feast.7110.desc.failed
			}
		}
	}
	theme = feast_activity
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = murder_feast_murder_failure_var }
			animation = anger
		}
		animation = schadenfreude
	}
	center_portrait = {
		character = scope:my_knight
		animation = marshal
	}
	right_portrait = {
		trigger = { has_variable = murder_feast_murder_failure_var }
		character = scope:honorary_guest
		animation = dismissal
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/MX/Cuetracks/mx_cuetrack_13_murder_feast"
		hidden_effect = {
			if = {
				limit = {
					any_knight = {
						location = root.location
					}
				}
				random_knight = {
					limit = { location = root.location }
					save_scope_as = my_knight
				}
			}
			else = {
				set_variable = new_knight_var
				create_character = {
					template = knight
					dynasty = none
					location = root.location
					culture = root.location.culture
					faith = root.location.faith
					gender_female_chance = root_soldier_female_chance
					save_scope_as = my_knight
				}
			}
			scope:my_knight = { add_character_flag = wear_armor }
		}
	}

	option = {
		name = {
			trigger = { has_variable = murder_feast_murder_failure_var }
			text = feast.7110.a.failure
		}
		name = {
			trigger = { NOT = { has_variable = murder_feast_murder_failure_var } }
			text = feast.7110.a
		}
		show_as_tooltip = { #we actually give these out in the on_complete of the activity
			disburse_murder_feast_activity_rewards = yes
		}
		hidden_effect = {
			if = {
				limit = { #if they have an avenging family member we send a letter
					exists = scope:activity.var:avenging_family_var
				}
				scope:activity.var:avenging_family_var = { save_scope_as = avenging_family }
				random_list = {
					0 = {
						modifier = { #less likely to happen if you only killed the target
							add = 50
							has_variable = murder_feast_target_murder_var
						}
						modifier = { #much less likely to happen if you were sneaky
							add = 150
							has_variable = murder_feast_target_sneak_murder_var
						}
					}
					100 = {
						trigger_event = {
							id = feast.7102
							days = 3
						}
					}
				}
			}
		}
		stress_impact = {
			paranoid = massive_stress_impact_loss
			callous = massive_stress_impact_loss
			sadistic = massive_stress_impact_loss
			compassionate = major_stress_impact_gain
			just = major_stress_impact_gain
			calm = major_stress_impact_gain
		}
	}

	after = {
		remove_variable ?= murder_feast_entourage_murder_var
		remove_variable ?= murder_feast_target_murder_var
		remove_variable ?= murder_feast_target_sneak_murder_var
		remove_variable ?= murder_feast_liege_var
		remove_variable ?= murder_feast_head_of_faith_var
		if = {
			limit = { has_variable = new_knight_var }
			scope:my_knight = { silent_disappearance_effect = yes }
		}
	}
}

# Murder Feast follow up event

feast.7102 = {
	type = letter_event
	opening = {
		desc = feast.7102.opening
	}
	desc = feast.7102.desc
	sender = scope:avenging_family

	trigger = {
		scope:avenging_family = { is_alive = yes }
	}

	option = {
		name = feast.7102.a
		if = {
			limit = {
				#DLC check
				has_bp1_dlc_trigger = yes
				scope:avenging_family = {
					valid_for_feud_events_with_target_trigger = { TARGET = root }
				}
			}
			scope:avenging_family = {
				save_ongoing_house_relation_effect = { TARGET = root }
			}
		    house_feud_start_effect = {
	            # Feuding House Head
	            ACTOR = scope:avenging_family
	            # Target House Head
	            TARGET = root
	            # Feud Reason
	            REASON = murder_feast
	            # House Member attacker if relevant
	            ATTACKER = root
	            # House Member victim if relevant
	            VICTIM = scope:murder_guest
	        }
		}
		else_if = {
			limit = {
				can_set_relation_rival_trigger = { CHARACTER = scope:avenging_family }
			}
			set_relation_rival = {
				target = scope:avenging_family
				reason = rival_murder_feast_family
			}
		}
		scope:murder_guest = {
			every_close_family_member = {
				custom = feast.7102.a.tt
				limit = {
					is_close_family_or_spouse_of_root_trigger = no
					this != root
				}
				add_opinion = {
					target = root
					modifier = murder_feast_family_opinion
				}
			}
		}
		set_variable = murder_feast_perpetrator_var #people are less likely to accept your feast invite
		add_prestige = minor_prestige_loss
	}
}

# Guest ending event
feast.7151 = {
	type = activity_event
	title = feast.7151.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					root = { has_government = landless_adventurer_government }
					scope:activity = {
						has_variable = roughed_up
					}
				}
				desc = feast.7151.desc.desc_roughed_up
			}
			desc = feast.7151.desc
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					root = { has_government = landless_adventurer_government }
					scope:activity = {
						has_variable = roughed_up
					}
				}
				desc = feast_default.9002.desc_roughed_up
			}
			triggered_desc = {
				trigger = {
					OR = {
						scope:host = {
							has_royal_court = yes
							has_dlc_feature = royal_court
							amenity_level = { target = court_food_quality value >= 5 }
						}
						scope:activity = {
							has_activity_option = {
								category = feast_option_courses
								option = feast_courses_good
							}
						}
					}
				}
				desc = feast_default.9002.desc_exotic
			}
			triggered_desc = {
				trigger = {
					OR = {
						scope:host = {
							has_royal_court = yes
							has_dlc_feature = royal_court
							amenity_level = { target = court_food_quality value >= 3 }
						}
						scope:activity = {
							has_activity_option = {
								category = feast_option_courses
								option = feast_courses_normal
							}
						}
					}
				}
				desc = feast_default.9002.desc_lavish
			}
			triggered_desc = {
				trigger = {
					OR = {
						scope:host = {
							has_royal_court = yes
							has_dlc_feature = royal_court
							amenity_level = { target = court_food_quality value <= 1 }
						}
						scope:activity = {
							has_activity_option = {
								category = feast_option_courses
								option = feast_courses_normal
							}
						}
					}
				}
				desc = feast_default.9002.desc_meager
			}
			desc = feast_default.9002.desc_ending
		}
	}
	theme = feast_activity
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:host
		triggered_animation = {
			trigger = {
				root = { has_government = landless_adventurer_government }
				scope:activity = {
					has_variable = roughed_up
				}
			}
  			animation = stayback
  		}
		animation = toast_goblet
	}
	cooldown = { years = 5 }

	immediate = {
		play_music_cue = "mx_cue_in_taberna_instrumental"
	}

	# Time to go home
	option = {
		name = feast.7151.a
		hidden_effect = {
			reveler_lifestyle_rank_up_check_effect = yes
		}
		show_as_tooltip = {
			disburse_feast_reveler_rewards = yes
		}
		#Stress loss
		if = {
			limit = {
				OR = {
					has_trait = shy
					has_trait = reclusive
				}
			}
			custom_tooltip = host_feast_decision_desc_shy
		}
		else = {
			if = {
				limit = {
					has_royal_court = yes
					has_dlc_feature = royal_court
					amenity_level = { target = court_food_quality value >= 5 }
				}
				stress_impact = {
					base = exotic_feast_stress_loss_value
					gluttonous = feast_stress_loss_value
					gregarious = feast_stress_loss_value
					lifestyle_reveler = feast_stress_loss_value
					drunkard = feast_stress_loss_value
					comfort_eater = feast_stress_loss_value
					generous = feast_stress_loss_value
					greedy = activity_stress_gain_impact
				}
			}
			else_if = {
				limit = {
					has_royal_court = yes
					has_dlc_feature = royal_court
					amenity_level = { target = court_food_quality value >= 4 }
				}
				stress_impact = {
					base = lavish_feast_stress_loss_value
					gluttonous = feast_stress_loss_value
					gregarious = feast_stress_loss_value
					lifestyle_reveler = feast_stress_loss_value
					drunkard = feast_stress_loss_value
					comfort_eater = feast_stress_loss_value
					generous = feast_stress_loss_value
					greedy = activity_stress_gain_impact
				}
			}
		    else_if = {
				limit = {
					has_royal_court = yes
					has_dlc_feature = royal_court
					amenity_level = { target = court_food_quality value >= 3 }
				}
				stress_impact = {
					base = medium_feast_stress_loss_value
					gluttonous = feast_stress_loss_value
					gregarious = feast_stress_loss_value
					lifestyle_reveler = feast_stress_loss_value
					drunkard = feast_stress_loss_value
					comfort_eater = feast_stress_loss_value
					generous = feast_stress_loss_value
					greedy = activity_stress_gain_impact
				}
			}
			else_if = {
				limit = {
					has_royal_court = yes
					has_dlc_feature = royal_court
					amenity_level = { target = court_food_quality value <= 1 }
				}
				stress_impact = {
					base = meager_feast_stress_loss_value
					gluttonous = feast_stress_loss_value
					gregarious = feast_stress_loss_value
					lifestyle_reveler = feast_stress_loss_value
					drunkard = feast_stress_loss_value
					comfort_eater = feast_stress_loss_value
					generous = feast_stress_loss_value
					greedy = activity_stress_gain_impact
				}
			}
			else = {
				stress_impact = {
					base = feast_stress_loss_value
					gluttonous = activity_stress_loss_impact
					gregarious = activity_stress_loss_impact
					lifestyle_reveler = activity_stress_loss_impact
					drunkard = activity_stress_loss_impact
					comfort_eater = activity_stress_loss_impact
					generous = activity_stress_loss_impact
					greedy = activity_stress_gain_impact
				}
			}
		}
	}
}

##################################################
# Guest of (Dis)Honour
# by Ewan Cowhig Croft
# 7201 - 7210
##################################################

scripted_effect feast_7201_give_goh_prestige_effect = {
	scope:goh = {
		add_prestige = medium_prestige_gain
		add_character_modifier = {
			modifier = feast_7201_goh_honoured_modifier
			years = 10
		}
		add_opinion = {
			target = scope:host
			modifier = pleased_opinion
			opinion = 30
		}
	}
}

scripted_effect feast_7201_subtract_goh_prestige_effect = {
	# If scope:goh is landed and your tier or higher, or your direct vassal, gain prestige of your own.
	## This is to stop you inviting nobodies to the ball then bullying them for prestige.
	### I know you.
	#### You were going to.
	##### Pick on someone your own size.
	if = {
		limit = {
			scope:goh = {
				is_landed = yes
				OR = {
					highest_held_title_tier >= scope:host.highest_held_title_tier
					liege ?= scope:host
					# You can also bully rivals for prestige at any tier.
					has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:host }
				}
			}
		}
		scope:host = { add_prestige = minor_prestige_gain }
	}
	# Scope:goh isn't best pleased.
	scope:goh = {
		add_prestige = medium_prestige_loss
		add_opinion = {
			target = scope:host
			modifier = humiliated_opinion
			opinion = -40
		}
	}
}

scripted_effect feast_7201_host_takes_credit_effect = {
	scope:host = {
		add_prestige = minor_prestige_gain
		reverse_add_opinion = {
			target = scope:goh
			modifier = neglected_opinion
			opinion = -20
		}
	}
}

#	Host POV: how do you honour your GoH?
feast.7201 = {
	type = activity_event
	title = feast.7201.t
	desc = feast.7201.desc
	theme = feast_activity
	left_portrait = {
		character = scope:host
		animation = toast
	}
	right_portrait = {
		character = scope:goh
		animation = toast_goblet
	}

	trigger = {
		# Because prior checks don't always seem to catch it.
		exists = scope:goh
		scope:goh = {
			is_alive = yes
			involved_activity ?= scope:activity
		}
	}

	# A toast, to scope:goh!
	option = {
		name = feast.7201.a

		# What option did we pick?
		save_scope_value_as = {
			name = honoured_goh
			value = flag:honoured
		}
		# And action some effects.
		feast_7201_give_goh_prestige_effect = yes

		stress_impact = {
			humble = miniscule_stress_impact_loss
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			# Higher base value, since we want this to be the default.
			base = 100
			ai_value_modifier = { ai_honor = 2 }
			opinion_modifier = {
				opinion_target = scope:goh
				multiplier = 2
			}
		}
	}

	# You know what? Screw this guy.
	option = {
		name = feast.7201.b
		flavor = feast.7201.b.tt

		# What option did we pick?
		save_scope_value_as = {
			name = honoured_goh
			value = flag:slagged_off
		}
		# And action some effects.
		feast_7201_subtract_goh_prestige_effect = yes

		# Stress impact variable depending on whether you hate scope:goh or not.
		if = {
			limit = {
				has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:goh }
			}
			stress_impact = {
				vengeful = major_stress_impact_loss
				arrogant = miniscule_stress_impact_loss
				humble = minor_stress_impact_gain
				forgiving = major_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				arrogant = miniscule_stress_impact_loss
				humble = minor_stress_impact_gain
			}
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_honor = -1
			}
			opinion_modifier = {
				opinion_target = scope:goh
				multiplier = -2
			}
		}
	}

	# And you're aaaaalllll welcome for the feast.
	option = {
		name = feast.7201.c
		trigger = {
			NOT = { has_activity_intent = legitimacy_intent }
		}

		# What option did we pick?
		save_scope_value_as = {
			name = honoured_goh
			value = flag:bragged
		}
		# And action some effects.
		feast_7201_host_takes_credit_effect = yes

		stress_impact = {
			arrogant = medium_stress_impact_loss
			humble = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = -1
			}
			opinion_modifier = {
				opinion_target = scope:goh
				multiplier = -1
			}
			modifier = {
				add = 75
				has_trait = arrogant
			}
		}
	}

	# A toast to my rule!
	option = {
		name = feast.7201.d
		trigger = {
			has_activity_intent = legitimacy_intent
		}

		# What option did we pick?
		save_scope_value_as = {
			name = honoured_goh
			value = flag:bragged
		}
		feast_7201_host_takes_credit_effect = yes
		add_legitimacy = medium_legitimacy_gain

		stress_impact = {
			arrogant = medium_stress_impact_loss
			humble = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = -1
			}
			opinion_modifier = {
				opinion_target = scope:goh
				multiplier = -1
			}
			modifier = {
				add = 75
				has_trait = arrogant
			}
		}
	}

	after = {
		scope:goh = { trigger_event = feast.7202 }
		scope:activity = {
			every_attending_character = {
				limit = {
					this != scope:host
					this != scope:goh
				}
				trigger_event = feast.7203
			}
		}
	}
}

#	GoH POV: were you well-honoured?
feast.7202 = {
	type = activity_event
	title = feast.7202.t
	desc = {
		desc = feast.7202.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { scope:honoured_goh = flag:honoured }
				desc = feast.7202.desc.honoured
			}
			triggered_desc = {
				trigger = { scope:honoured_goh = flag:slagged_off }
				desc = feast.7202.desc.slagged_off
			}
			triggered_desc = {
				trigger = { scope:honoured_goh = flag:bragged }
				desc = feast.7202.desc.bragged
			}
		}
	}
	theme = feast_activity
	left_portrait = {
		character = scope:goh
		triggered_animation = {
			trigger = { scope:honoured_goh = flag:honoured }
			animation = drink
		}
		triggered_animation = {
			trigger = {
				NOT = { scope:honoured_goh = flag:honoured }
			}
			animation = shock
		}
	}
	right_portrait = {
		character = scope:host
		animation = toast
	}

	immediate = {
		# Show what's been goin' on.
		show_as_tooltip = {
			if = {
				limit = { scope:honoured_goh = flag:honoured }
				feast_7201_give_goh_prestige_effect = yes
			}
			else_if = {
				limit = { scope:honoured_goh = flag:slagged_off }
				feast_7201_subtract_goh_prestige_effect = yes
			}
			else_if = {
				limit = { scope:honoured_goh = flag:bragged }
				feast_7201_host_takes_credit_effect = yes
			}
		}
	}

	# It's nice to be appreciated.
	option = {
		name = feast.7202.a
		trigger = { scope:honoured_goh = flag:honoured }

		# We show some opinion gain, mostly for RP purposes.
		add_opinion = {
			target = scope:host
			modifier = pleased_opinion
			opinion = 30
		}

		stress_impact = {
			base = major_stress_impact_loss
			# Should never erase the base stress loss, but might mitigate it down a bit.
			humble = medium_stress_impact_gain
		}
		ai_chance = {
			# No AI chance needed for the only option.
			base = 1
		}
	}

	# Assault the host, take their stuff
	option = {
		name = feast.7202.adventurer_loot
		trigger = {
			NOT = { scope:honoured_goh = flag:honoured }
			has_government = landless_adventurer_government
			scope:host = { is_ai = yes }
		}
		if = {
			limit = {
				NOT = { has_trait = gallowsbait }
			}
			add_trait = gallowsbait
		}
		add_trait_xp = {
			trait = gallowsbait
			track = bandit
			value = 15
		}
		scope:host = {
			if = {
				limit = {
					can_set_relation_rival_trigger = { CHARACTER = scope:goh }
				}
				set_relation_rival = {
					target = scope:goh
					reason = rival_goh_humiliated_at_feast
				}
			}
			pay_short_term_gold = {
				target = scope:goh
				gold = medium_gold_value
			}
			increase_wounds_no_death_effect = { REASON = fight }
		}
		domicile ?= {
			change_provisions = major_provisions_gain
		}
		hidden_effect = {
			scope:activity = {
				set_variable = {
					name = roughed_up
				}
			}
		}
		stress_impact = {
			forgiving = massive_stress_impact_gain
			compassionate = major_stress_impact_gain
			sadistic = medium_stress_impact_loss
			arrogant = medium_stress_impact_loss
			callous = medium_stress_impact_loss
			vengeful = medium_stress_impact_loss
		}
		ai_chance = {
			base = 0
		}
	}

	# How could you do this to me?
	option = {
		name = feast.7202.b
		trigger = {
			NOT = { scope:honoured_goh = flag:honoured }
		}

		# You let it pass. For now.

		stress_impact = {
			forgiving = miniscule_stress_impact_loss
			humble = miniscule_stress_impact_loss
			arrogant = major_stress_impact_gain
			vengeful = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_vengefulness = -1
			}
		}
	}

	# I'll remember this.
	option = {
		name = feast.7202.c
		trigger = {
			NOT = { scope:honoured_goh = flag:honoured }
		}

		scope:host = {
			send_interface_toast = {
				title = feast.7202.c.tt
				left_icon = scope:goh
				progress_towards_rival_effect = {
					REASON = rival_goh_humiliated_at_feast
					CHARACTER = scope:goh
					# Reduced opinion loss because there was a hefty hit earlier in the chain.
					OPINION = -10
				}
			}
		}

		stress_impact = {
			vengeful = miniscule_stress_impact_loss
			arrogant = miniscule_stress_impact_loss
			humble = medium_stress_impact_gain
			forgiving = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_compassion = -0.5
			}
		}
	}
}

#	Guest POV: how did the final toast go?
feast.7203 = {
	type = activity_event
	title = feast.7203.t
	desc = {
		desc = feast.7203.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { scope:honoured_goh = flag:honoured }
				desc = feast.7203.desc.honoured
			}
			triggered_desc = {
				trigger = { scope:honoured_goh = flag:slagged_off }
				desc = feast.7203.desc.slagged_off
			}
			triggered_desc = {
				trigger = { scope:honoured_goh = flag:bragged }
				desc = feast.7203.desc.bragged
			}
		}
	}
	theme = feast_activity
	left_portrait = {
		character = scope:host
		animation = toast
	}
	right_portrait = {
		character = scope:goh
		triggered_animation = {
			trigger = { scope:honoured_goh = flag:honoured }
			animation = drink
		}
		triggered_animation = {
			trigger = {
				NOT = { scope:honoured_goh = flag:honoured }
			}
			animation = shock
		}
	}

	immediate = {
		# Show what's been goin' on.
		show_as_tooltip = {
			if = {
				limit = { scope:honoured_goh = flag:honoured }
				feast_7201_give_goh_prestige_effect = yes
			}
			else_if = {
				limit = { scope:honoured_goh = flag:slagged_off }
				feast_7201_subtract_goh_prestige_effect = yes
			}
			else_if = {
				limit = { scope:honoured_goh = flag:bragged }
				feast_7201_host_takes_credit_effect = yes
			}
		}
	}

	# Hear hear!
	option = {
		name = feast.7203.a

		# No effects, just here to let you cheer.

		# No stress impact for a notification event.
		ai_chance = {
			# No AI needed for flavour options.
			base = 1
		}
	}

	# I've never much liked scope:goh, to be honest.
	option = {
		name = {
			trigger = { scope:honoured_goh = flag:honoured }
			text = feast.7203.b.goh_honoured
		}
		name = {
			trigger = {
				NOT = { scope:honoured_goh = flag:honoured }
			}
			text = feast.7203.b.goh_dishonoured
		}

		# No effect, just here to let you mumble under your breath.

		# No stress impact for a notification event.
		ai_chance = {
			# No AI needed for flavour options.
			base = 1
		}
	}
}

# Host POV: big up your legend
feast.7204 = {
	type = activity_event
	title = feast.7204.t
	desc = feast.7204.desc
	theme = feast_activity
	left_portrait = {
		character = scope:host
		animation = ecstasy
	}
	right_portrait = {
		character = scope:bard
		animation = instrument_active
	}

	immediate = {
		grab_appropriate_bard_effect = yes
	}

	# Boost my legend pls
	option = {
		name = feast.7204.a
		trigger = {
			NOT = { has_activity_intent = legitimacy_intent }
		}
		add_character_modifier = {
			modifier = legendary_feast_legend_boost_modifier
			years = 5
		}
		ai_chance = {
			base = 150
			modifier = {
				add = -100
				OR = {
					has_trait = arrogant
					has_trait = ambitious
				}
			}
		}
	}

	# Remember who is the real hero - me!
	option = {
		name = feast.7204.b
		add_character_modifier = {
			modifier = legendary_feast_legend_modifier
			years = 10 #stackable
		}
		stress_impact = {
			humble = medium_stress_impact_gain
			content = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 50
				OR = {
					has_trait = arrogant
					has_trait = ambitious
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = humble
					has_trait = content
				}
			}
		}
	}

	# What a great performance!
	option = {
		name = feast.7204.c
		add_prestige = medium_prestige_gain
		stress_impact = {
			base = medium_stress_impact_loss
			arrogant = medium_stress_impact_gain
			callous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = arrogant
					has_trait = callous
				}
			}
		}
	}

	# Here's to many more tales exactly like this!
	option = {
		name = feast.7204.d
		trigger = {
			has_activity_intent = legitimacy_intent
		}
		add_legitimacy = medium_legitimacy_gain
		add_character_modifier = {
			modifier = legendary_feast_legend_boost_modifier
			years = 5
		}

		stress_impact = {
			arrogant = medium_stress_impact_loss
			humble = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = -1
			}
			modifier = {
				add = 75
				has_trait = arrogant
			}
		}
	}

	after = {
		scope:activity = {
			every_attending_character = {
				limit = {
					this != scope:host
				}
				trigger_event = feast.7205
			}
		}
	}
}

#	Guest POV: what do you think of the legend?
feast.7205 = {
	type = activity_event
	title = feast.7205.t
	desc = feast.7205.desc
	theme = feast_activity
	left_portrait = {
		character = scope:host
		animation = ecstasy
	}
	center_portrait = {
		character = scope:bard
		animation = instrument_active
	}
	right_portrait = {
		character = root
		animation = drink
	}

	# Happy to hear
	option = {
		name = feast.7205.a
		scope:host = {
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 30
			}
		}
		stress_impact = {
			callous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = callous
			}
		}
	}

	# Legend - who?
	option = {
		name = feast.7205.b
		scope:host = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -10
			}
		}
		stress_impact = {
			base = medium_stress_impact_loss
			compassionate = medium_stress_impact_gain
			callous = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = compassionate
			}
		}
	}
}


# # Feast Invalidation for Host Death - Player Heir
feast.0800 = {
	type = character_event
	title = feast.0800.t
	desc = {
		desc = feast.0800.desc
		desc = feast.0800.desc.entourage
		desc = feast.0800.desc.ruler
	}
	theme = realm

	left_portrait = {
		character = root
		animation = worry
	}

	immediate = {}

	option = {
		name = feast.0800.a
		custom_tooltip = feast.0800.tt
	}
}
