﻿#FEAST ACTIVITY DEFAULT MAIN EVENT

namespace = feast_default

#Note to CD!
#scope:activity.activity_host is how you generally find the host of the feast.
#In some contexts we instead use scope:host, which we save beforehand,
#this is because said events might be called after the activity is over!
#Be sure to only refer to scope:host if it has actually been saved first!
#When in doubt use scope:activity.activity_host

############################
## Setup and maintenance
## 0000-0999
## by Petter Vilberg
############################
#feast_default.0001 - Trigger and weight event

############################
## Events triggered by yourself
## 1000-1999
## by Linnéa Thimrén and Petter Vilberg
############################
#feast_default.1001 - A guest is impressed with your high learning!
#feast_default.1002 - You get grumpy because the food is late
#feast_default.1003 - A Guest is sarcastically impressed with your high Learning
#feast_default.1004 - Enjoy Magnificent Food!
#feast_default.1005 - You're having a hard time socializing
#feast_default.1006 - Reveler is in their element
#feast_default.1007 - Two Gluttons admire each other
#feast_default.1008 - You reveal a secret about yourself
#feast_default.1009 - You reveal a secret about someone else
#feast_default.1010 - Promise someone a favor
#feast_default.1011 - You get drunk and kill someone
#feast_default.1012 - Sneaky murder of character you dislike
#feast_default.1013 - Murder someone for attacking friend/lover/sibling
#feast_default.1014 - Murder someone, one witness!
#feast_default.1015 - Seat important people beside each other
#feast_default.1016 - Steal a trinket!
#feast_default.1020 - Dislike the host, deface a displayed Court Artifact
#feast_default.6501 - Someone says something with a lewd double-meaning
#feast_defeault.1030 - A song is sung about one of your acclaimed knights

############################
## Events triggered by other characters
## 2000-2999
## by Linnéa Thimrén and Petter Vilberg
############################
#feast_default.2001 - Glutton gets angry waiting for food
#feast_default.2002 - Someone sends you a secret love letter
#feast_default.2003 - Bond with someone you have traits in common with
#feast_default.2005 - Someone throws up on you
#feast_default.2006 - Someone has a befriend/seduce scheme against you
#feast_default.2007 - Two lovers are exposed
#feast_default.2008 - Lustful secret homosexual discovered with a servant
#feast_default.2009 - Learn a secret about someone else
#feast_default.2010 - Learn a secret about someone else from a third party
#feast_default.2011 - Someone makes grand promises to you
#feast_default.2012 - Someone is murdered, you're a witness!
#feast_default.6111 - A guest rambles on and on
#feast_default.6101 - Guest is having a hard time socializing
#feast_default.6251 - You trip - where will you spill your wine?

############################
## Relation events
## 3000-3999
## by Linnéa Thimrén and Petter Vilberg
############################
#feast_default.3001 - Have a good time with a friend
#feast_default.3002 - A chance to exchange "kisses" with a Lover
#feast_default.3003 - Altercation with a Rival
#feast_default.3004 - Insult your rival
#feast_default.3005 - Rival duel!
#feast_default.3006 - Soiree with another attendee
#feast_default.3007 - Caught committing adultery with a Lover

############################
## Events triggered by host/feast conditions
## 5000-5999
## by Linnéa Thimrén and Petter Vilberg
############################
#feast_default.5001 - Host's high Dread causes you Stress
#feast_default.5002 - Host is lunatic
#feast_default.5003 - Host is sadistic
#feast_default.5004 - Host is a reveler
#feast_default.5005 - Enjoy some good garum!
#feast_default.5010 - Time to spread my legend!

############################
## Host unique events
## 6000-6999
## by Linnéa Thimrén and Petter Vilberg
############################
#feast_default.6001 - Spouse has done a great job
#feast_default.6002 - Guest complements your feast
#feast_default.6003 - Guests getting into a fight
#feast_default.6121 - Serve a guest food you know they hate
#feast_default.6231 - There's no more wine!
#feast_default.6261 - Serve the guests something new (cannibal)
#feast_default.6301 - A guest has damaged one of your Court Artifacts on display
#feast_default.6351 - Two guests get into a fight, causing damage to one of your displayed Court Artifacts!

#################################
## Reworked MURDER FEAST EVENTS
## 8000-8999
## by Linnéa Thimrén & Veronica Pazos
#################################
#feast_default.8001 - For host - I killed everyone
#feast_default.8002 - For host - I killed only my target
#feast_default.8003 - For host - My target died in an "accident"
#feast_default.8052 - For guest - I died
#feast_default.8061 - For guest - Someone close to me tried to kill people?!

############################
## End Events
## 9000-9999
## by Petter Vilberg
############################
#feast_default.9000 - End events setup
#feast_default.9001 - Host end event
#feast_default.9002 - Guest end event

#####################################################################################


#################################
# Setup and maintenance
# 0000-0999
#################################

#################################
# SELF-TRIGGERED EVENTS
# 1000-1999
#################################

#####################
# A guest is impressed with your high learning!
# by Petter Vilberg
#####################
feast_default.1001 = {
	type = activity_event
	title = feast_default.1001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { learning >= 20 }
				desc = feast_default.1001.very_high_learning
			}
			triggered_desc = {
				trigger = { learning >= 15 }
				desc = feast_default.1001.high_learning
			}
			triggered_desc = {
				trigger = { learning >= 8 }
				desc = feast_default.1001.average_learning
			}
			triggered_desc = {
				desc = feast_default.1001.low_learning
			}
		}
	}
	left_portrait = {
		character = scope:impressed_guest
		animation = admiration
	}
	right_portrait = {
		character = root
		animation = happiness 
	}
	theme = feast_activity
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { exists = local_var:had_1001}
		scope:activity = {
			any_attending_character = {
				feast_default_participant_trigger = yes
				learning < root.learning
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_1001
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_participant_trigger = yes
					learning < root.learning
				}
				save_scope_as = impressed_guest
			}
		}
	}

	option = { #Why, of course
		name = feast_default.1001.a
		add_prestige = minor_prestige_gain
		scope:impressed_guest = {
			add_opinion = {
				target = root
				modifier = learned_at_feast_opinion
			}
		}
	}
}


#####################
# You get grumpy because the food is late
# by Petter Vilberg
#####################
scripted_trigger feast_default_1002_annoyed_guest_trigger = {
	feast_default_participant_trigger = yes
	NOT = { has_trait = gluttonous }
	NOT = { has_trait = impatient }
	NOT = {
		has_opinion_modifier = {
			target = root
			modifier = annoying_glutton_at_feast_opinion
		}
	}
}

#Triggered by being Gluttonous
feast_default.1002 = {
	type = activity_event
	title = feast_default.1002.t
	desc = feast_default.1002.desc
	theme = feast_activity
	left_portrait = {
		character = scope:other_guest
		animation = disgust
	}
	right_portrait = {
		character = root
		animation = anger
	}
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { exists = local_var:had_1002 }
		not_hosting_a_murder_feast = yes
		has_trait = gluttonous
		NOT = { has_trait = patient }
		NOT = { has_character_modifier = feast_gratifying_complaints_modifier }
		scope:activity = {
			any_attending_character = { #There needs to exist someone who can get annoyed at you
				feast_default_1002_annoyed_guest_trigger = yes
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = { #Wrathful characters are more likely to be angry
			add = 0.5
			has_trait = wrathful
		}
		modifier = { #Wrathful characters are more likely to be angry
			add = 0.5
			has_trait = impatient
		}
	}

	immediate = {
		set_local_variable = {
			name = had_1002
			value = yes
		}
		scope:activity = {	
			random_attending_character = { #Find someone who can be annoyed at you
				limit = {
					feast_default_1002_annoyed_guest_trigger = yes
				}
				save_scope_as = other_guest
			}
		}
	}


	option = {
		name = feast_default.1002.a
		add_character_modifier = {
			modifier = feast_gratifying_complaints_modifier
			years = 5
		}
		scope:activity = {
			every_attending_character = {
				custom = feast_default.1002.gluttons_and_impatients
				limit = {
					feast_default_participant_trigger = yes
					NOT = { this = scope:other_guest }
					OR = {
						has_trait = gluttonous
						has_trait = impatient
					}
				}
				add_opinion = {
					target = root
					modifier = complained_on_my_behalf_opinion
				}
			}
		}
		scope:other_guest = {
			add_opinion = {
				target = root
				modifier = annoying_glutton_at_feast_opinion
			}
		}
	}
}


#####################
# A Guest is sarcastically impressed with your high Learning
# by Petter Vilberg
#####################
scripted_trigger feast_default_1003_learned_guest_trigger = {
	feast_default_participant_trigger = yes
	learning >= 15
	OR = {
		has_relation_rival = root
		NOT = { has_any_scripted_relation = root }
	}
}

feast_default.1003 = {
	type = activity_event
	title = feast_default.1003.t
	desc = feast_default.1003.desc
	right_portrait = {
		character = scope:other_guest
		animation = schadenfreude
	}
	left_portrait = {
		character = root
		animation = admiration
	}
	theme = feast_activity
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { exists = local_var:had_1003 }
		learning <= 7
		scope:activity = {
			any_attending_character = {
				feast_default_1003_learned_guest_trigger = yes
			}
		}	
	}

	immediate = {
		set_local_variable = {
			name = had_1003
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_1003_learned_guest_trigger = yes
				}
				weight = {
					base = 1
					modifier = {
						add = 10
						is_of_major_interest_to_root_trigger = yes
					}
					modifier = {
						add = 5
						is_of_minor_interest_to_root_trigger = yes
					}
				}
				save_scope_as = other_guest
			}
		}
	}

	option = { #I feel pretty good about that!
		name = feast_default.1003.a
		trigger = {
			scope:other_guest = {
				NOT = { has_relation_rival = root }
			}
		}
		skill = learning
		add_character_modifier = {
			modifier = feast_scholarly_confidence_modifier
			years = 5
		}
		hidden_effect = {
			add_opinion = {
				target = scope:other_guest
				modifier = compliment_opinion
				opinion = 20
			}
		}
		reverse_add_opinion = {
			target = scope:other_guest
			modifier = was_unimpressed_at_feast_opinion
		}
		hidden_effect = {
			if = {
				limit = {
					can_set_relation_potential_rival_trigger = { CHARACTER = scope:other_guest }
				}
				set_relation_potential_rival = scope:other_guest
			}
		}
	}

	option = { #I didn't realise they felt that way
		name = feast_default.1003.b
		trigger = {
			scope:other_guest = {
				has_relation_rival = root
			}
		}
		skill = learning
		add_character_modifier = {
			modifier = feast_scholarly_confidence_modifier
			years = 5
		}
		hidden_effect = {
			add_opinion = {
				target = scope:other_guest
				modifier = compliment_opinion
				opinion = 20
			}
		}
		reverse_add_opinion = {
			target = scope:other_guest
			modifier = was_unimpressed_at_feast_opinion
		}
	}
}


#####################
# Enjoy Magnificent Food!
# by Petter Vilberg
#####################
feast_default.1004 = {
	type = activity_event
	title = feast_default.1004.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:activity = {
						OR = {
							AND = {
								has_activity_type = activity_wedding
								has_activity_option = {
									category = wedding_option_food
									option = wedding_food_good
								}
							}
							AND = {
								has_activity_type = activity_feast
								has_activity_option = {
									category = feast_option_food
									option = feast_food_good
								}
							}
						}
					}
				}
				desc = feast_default.1004.desc_exotic
			}
			triggered_desc = {
				trigger = {
					scope:activity = {
						OR = {
							AND = {
								has_activity_type = activity_wedding
								has_activity_option = {
									category = wedding_option_food
									option = wedding_food_normal
								}
							}
							AND = {
								has_activity_type = activity_feast
								has_activity_option = {
									category = feast_option_food
									option = feast_food_normal
								}
							}
						}
					}
				}
				desc = feast_default.1004.desc_lavish
			}
			triggered_desc = {
				trigger = {
					scope:activity = {
						OR = {
							has_activity_option = {
								category = wedding_option_food
								option = wedding_food_bad
							}
							has_activity_option = {
								category = feast_option_food
								option = feast_food_bad
							}
						}
					}
				}
				desc = feast_default.1004.desc_meager
			}
			desc = feast_default.1004.desc
		}
	}
	theme = feast_activity
	left_portrait = {
		character = root
		animation = happiness
	}
	cooldown = { years = 1 }

	trigger = {
		NOT = { exists = local_var:had_1004 }
		NOR = {
			has_trait = greedy
			has_trait = temperate
			has_trait = inappetetic
		}
		not_hosting_a_murder_feast = yes
	}

	immediate = {
		set_local_variable = {
			name = had_1004
			value = yes
		}
	}

	option = { #Amazing!
		name = {
			trigger = {
				scope:activity = {
					OR = {
						AND = {
							has_activity_type = activity_wedding
							has_activity_option = {
								category = wedding_option_food
								option = wedding_food_bad
							}
						}
						AND = {
							has_activity_type = activity_feast
							has_activity_option = {
								category = feast_option_food
								option = feast_food_bad
							}
						}
					}
				}
			}
			text = feast_default.1004.a_meager
		}
		name = {
			text = feast_default.1004.a
		}
		if = {
			limit = {
				scope:activity = {
					OR = {
						AND = {
							has_activity_type = activity_wedding
							has_activity_option = {
								category = wedding_option_food
								option = wedding_food_bad
							}
						}
						AND = {
							has_activity_type = activity_feast
							has_activity_option = {
								category = feast_option_food
								option = feast_food_bad
							}
						}
					}
				}
			}
			add_stress = minor_stress_gain
			scope:activity.activity_host = {
				add_prestige = minor_prestige_loss
			}
		}
		else = {
			add_stress = medium_stress_loss
			add_character_modifier = {
				modifier = feast_life_reaffirmed_modifier
				years = 5
			}
			scope:activity.activity_host = {
				add_prestige = minor_prestige_gain
			}
		}
	}

	option = { #INCREDIBLE!
		name = {
			trigger = {
				scope:activity = {
					OR = {
						AND = {
							has_activity_type = activity_wedding
							has_activity_option = {
								category = wedding_option_food
								option = wedding_food_bad
							}
						}
						AND = {
							has_activity_type = activity_feast
							has_activity_option = {
								category = feast_option_food
								option = feast_food_bad
							}
						}
					}
				}
			}
			text = feast_default.1004.b_meager
		}
		name = {
			text = feast_default.1004.b
		}
		trigger = {
			OR = {
				has_trait = gluttonous
				has_trait = comfort_eater
			}
		}
		exclusive = yes
		if = {
			limit = {
				scope:activity = {
					OR = {
						AND = {
							has_activity_type = activity_wedding
							has_activity_option = {
								category = wedding_option_food
								option = wedding_food_bad
							}
						}
						AND = {
							has_activity_type = activity_feast
							has_activity_option = {
								category = feast_option_food
								option = feast_food_bad
							}
						}
					}
				}
			}
			add_stress = medium_stress_gain
			scope:activity.activity_host = {
				add_prestige = minor_prestige_loss
				if = {
					limit = {
						NOT = { this = root }
					}
					add_opinion = {
						target = root
						modifier = feast_meager_food_glutton_opinion
					}
				}
			}
		}
		else = {
			stress_impact = {
				base = medium_stress_loss
				gluttonous = medium_stress_loss
				comfort_eater = medium_stress_loss
			}
			add_character_modifier = {
				modifier = feast_life_reaffirmed_modifier
				years = 5
			}
			scope:activity.activity_host = {
				add_prestige = minor_prestige_gain
				if = {
					limit = {
						NOT = { this = root }
					}
					add_opinion = {
						target = root
						modifier = feast_amazing_food_glutton_opinion
					}
				}
				hidden_effect = {
					random_spouse = {
						limit = {
							NOT = { this = root }
						}
						reverse_add_opinion = {
							target = root
							modifier = feast_amazing_food_glutton_opinion
						}	
					}
				}
			}
		}
	}	
}


#####################
# You're having a hard time socializing
# by Petter Vilberg
#####################
feast_default.1005 = {
	type = activity_event
	title = feast_default.1005.t
	desc = {
		desc = feast_default.1005.desc
		triggered_desc = {
			trigger = {
				exists = scope:friendly_guest
			}
			desc = feast_default.1005.desc_friendly_guest
		}
	}
	theme = feast_activity
	left_portrait = {
		character = root
		animation = stress
	}
	right_portrait = {
		character = scope:friendly_guest
		animation = personality_compassionate
	}
	cooldown = { years = 1 }

	trigger = {
		NOT = { exists = local_var:had_1005 }
		not_hosting_a_murder_feast = yes
		OR = {
			has_trait = shy
			has_trait = reclusive
		}
		NOT = { has_trait = lifestyle_reveler }
		scope:activity = {
			any_attending_character = {
				feast_default_participant_trigger = yes
				has_friendly_relationship_trigger = {
					CHARACTER = root
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		set_local_variable = {
			name = had_1005
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_participant_trigger = yes
					has_friendly_relationship_trigger = {
						CHARACTER = root
					}
				}
				save_scope_as = friendly_guest
			}
		}
	}

	option = { #you try to get through the party alone
		name = feast_default.1005.a
		add_prestige = medium_prestige_loss
		stress_impact = {
			base = minor_stress_impact_loss
			shy = minor_stress_impact_loss
			reclusive = minor_stress_impact_loss
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = -0.5
				ai_energy = -0.25
			}
		}
	}

	option = { #you have a friend at the party
		name = feast_default.1005.b
		trigger = {
			exists = scope:friendly_guest
		}
		hidden_effect = {
			add_opinion = {
				modifier = friendly_interaction
				target = scope:friendly_guest
			}
		}
		add_prestige = medium_prestige_gain
		scope:friendly_guest = {
			add_opinion = {
				target = root
				modifier = friendly_interaction
			}
		}
		stress_impact = {
			craven = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1000
		}
	}

	option = { #you make awkward attempts at social interaction
		name = feast_default.1005.c
		add_prestige = medium_prestige_gain
		stress_impact = {
			craven = minor_stress_impact_gain
			shy = medium_stress_impact_gain
			reclusive = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_energy = 0.25
			}
		}
	}
}


#####################
# Reveler in their element
# by Petter Vilberg
#####################

#Trigger for suitable compatriots
scripted_trigger feast_default_1006_potentially_entertained_trigger = {
	feast_default_participant_trigger = yes
	is_adult = yes
	NOT = { has_relation_rival = root }
}

feast_default.1006 = {
	type = activity_event
	title = feast_default.1006.t
	desc = feast_default.1006.desc
	theme = feast_activity
	left_portrait = {
		character = scope:guest_1
		animation = drink_goblet
	}
	center_portrait = {
		character = root
		animation = toast_goblet
	}
	right_portrait = {
		character = scope:guest_2
		animation = admiration
	}
	lower_left_portrait = scope:guest_3
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { exists = local_var:had_1006 }
		has_trait = lifestyle_reveler
		not_hosting_a_murder_feast = yes
		scope:activity = {
			any_attending_character = {
				feast_default_1006_potentially_entertained_trigger = yes
				count >= 3
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_1006
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_1006_potentially_entertained_trigger = yes
				}
				weight = {
					base = 1
					modifier = {
						add = 10
						is_of_major_interest_to_root_trigger = yes
					}
					modifier = {
						add = 5
						is_of_minor_interest_to_root_trigger = yes
					}
				}
				save_scope_as = guest_1
				add_to_list = table_companions
			}
			random_attending_character = {
				limit = {
					feast_default_1006_potentially_entertained_trigger = yes
					NOT = { this = scope:guest_1 }
				}
				weight = {
					base = 1
					modifier = {
						add = 10
						is_of_major_interest_to_root_trigger = yes
					}
					modifier = {
						add = 5
						is_of_minor_interest_to_root_trigger = yes
					}
				}
				save_scope_as = guest_2
				add_to_list = table_companions
			}
			random_attending_character = {
				limit = {
					feast_default_1006_potentially_entertained_trigger = yes
					NOT = { this = scope:guest_1 }
					NOT = { this = scope:guest_2 }
				}
				weight = {
					base = 1
					modifier = {
						add = 10
						is_of_major_interest_to_root_trigger = yes
					}
					modifier = {
						add = 5
						is_of_minor_interest_to_root_trigger = yes
					}
				}
				save_scope_as = guest_3
				add_to_list = table_companions
			}
		}
	}

	option = {
		name = feast_default.1006.a
		trigger = {
			has_trait = lifestyle_reveler
			has_trait_xp = {
				trait = lifestyle_reveler
				value < 50
			}
		}
		trait = lifestyle_reveler
		every_in_list = {
			list = table_companions
			custom = feast_default.1006.table_companions
			add_opinion = {
				modifier = feast_life_of_the_party_opinion
				target = root
				opinion = 10
			}
		}
		stress_impact = {
			lifestyle_reveler = medium_stress_loss
			gregarious = medium_stress_loss
		}
	}

	option = {
		name = feast_default.1006.b
		trigger = {
			has_trait = lifestyle_reveler
			has_trait_xp = {
				trait = lifestyle_reveler
				value >= 50
			}
			has_trait_xp = {
				trait = lifestyle_reveler
				value < 100
			}
		}
		trait = lifestyle_reveler
		every_in_list = {
			list = table_companions
			custom = feast_default.1006.table_companions
			add_opinion = {
				modifier = feast_life_of_the_party_opinion
				target = root
				opinion = 20
			}
		}
		stress_impact = {
			lifestyle_reveler = medium_stress_loss
			gregarious = medium_stress_loss
		}
	}
	
	option = {
		name = feast_default.1006.c
		trigger = {
			has_trait = lifestyle_reveler
			has_trait_xp = {
				trait = lifestyle_reveler
				value >= 100
			}
		}
		trait = lifestyle_reveler
		every_in_list = {
			list = table_companions
			custom = feast_default.1006.table_companions
			add_opinion = {
				modifier = feast_life_of_the_party_opinion
				target = root
				opinion = 30
			}
		}
		stress_impact = {
			lifestyle_reveler = major_stress_loss
			gregarious = medium_stress_loss
		}
	}
}


#####################
# Two Gluttons eat immensely
# by Petter Vilberg
#####################

scripted_trigger feast_default_1007_glutton_trigger = {
	feast_default_participant_trigger = yes
	has_trait = gluttonous
}

feast_default.1007 = {
	type = activity_event
	title = feast_default.1007.t
	desc = feast_default.1007.desc
	theme = feast_activity
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:other_glutton
		animation = ecstasy
	}
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { exists = local_var:had_1007 }
		not_hosting_a_murder_feast = yes
		has_trait = gluttonous
		scope:activity = {
			any_attending_character = {
				feast_default_1007_glutton_trigger = yes
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_1007
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_1007_glutton_trigger = yes
				}
				weight = {
					base = 1
					interesting_feast_participant_modifier = yes
				}
				save_scope_as = other_glutton
			}
		}
	}

	option = { #What an impressive eater!
		name = feast_default.1007.a
		reverse_add_opinion = {
			target = scope:other_glutton
			modifier = respect_opinion
			opinion = 20
		}
		add_opinion = {
			target = scope:other_glutton
			modifier = respect_opinion
			opinion = 20
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 0.5
			}
		}
	}

	option = { #I'll eat them under the table!
		name = feast_default.1007.b
		add_internal_flag = dangerous
		reverse_add_opinion = {
			target = scope:other_glutton
			modifier = respect_opinion
			opinion = 40
		}
		random = {
			chance = 20
			increase_wounds_effect = {
				REASON = ate_themselves_to_death
			}
		}
		ai_chance = {
			base = 20
			ai_value_modifier = {
				ai_greed = 1
				ai_rationality = -0.5
				ai_boldness = 0.5
			}
			modifier = {
				factor = 0.2
				has_trait_rank = {
					trait = wounded
					rank > 2
				}
			}
		}
	}
}



#####################
# Accidentally spill secrets about yourself
# by Petter Vilberg
#####################
scripted_trigger feast_default_1008_secret_recipient_trigger = {
	feast_default_participant_trigger = yes
	is_adult = yes
	save_temporary_scope_as = secret_recipient_check
	root = {
		any_secret = {
			NOT = { is_known_by = scope:secret_recipient_check }
		}
	}
}

feast_default.1008 = {
	type = activity_event
	title = feast_default.1008.t
	desc = feast_default.1008.desc
	theme = feast_activity
	left_portrait = {
		character = root
		animation = wedding_drunk
	}
	right_portrait = {
		character = scope:secret_recipient
		animation = schadenfreude
	}
	cooldown = { years = 2 }
	
	trigger = {
		NOT = { exists = local_var:had_1008 }
		drinks_alcohol_trigger = yes
		scope:activity = {
			any_attending_character = {
				feast_default_1008_secret_recipient_trigger = yes
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 1
			has_trait = drunkard
		}
		modifier = {
			add = -0.9
			has_trait = temperate
		}
	}

	immediate = {
		set_local_variable = {
			name = had_1008
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = { feast_default_1008_secret_recipient_trigger = yes }
				weight = {
					base = 1
					interesting_feast_participant_modifier = yes
				}
				save_scope_as = secret_recipient
			}
		}
		random_secret = {
			limit = { NOT = { is_known_by = scope:secret_recipient } }
			save_scope_as = secret_to_reveal
		}
	}

	option = {
		name = feast_default.1008.a
		flavor = feast_default.1008.a.flavor
		scope:secret_to_reveal = {
			reveal_to = scope:secret_recipient
		}
		stress_impact = {
			contrite = medium_stress_impact_loss
		}
	}
}



#####################
# Accidentally spill secrets about someone else
# by Petter Vilberg
#####################
scripted_trigger feast_default_1009_secret_recipient_trigger = {
	feast_default_participant_trigger = yes
	is_adult = yes
	save_temporary_scope_as = secret_recipient_check
	root = {
		any_known_secret = {
			NOT = { secret_owner = root }
			NOT = { is_known_by = scope:secret_recipient_check }
		}
	}
}

feast_default.1009 = {
	type = activity_event
	title = feast_default.1009.t
	desc = feast_default.1009.desc
	theme = feast_activity
	left_portrait = {
		character = scope:secret_recipient
		animation = schadenfreude
	}
	right_portrait = {
		character = root
		animation = wedding_drunk
	}
	lower_left_portrait = scope:secret_owner
	cooldown = { years = 2 }
	
	trigger = {
		NOT = { exists = local_var:had_1009 }
		drinks_alcohol_trigger = yes
		scope:activity = {
			any_attending_character = {
				feast_default_1009_secret_recipient_trigger = yes
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 1
			has_trait = drunkard
		}
		modifier = {
			add = -0.9
			has_trait = temperate
		}
	}

	immediate = {
		set_local_variable = {
			name = had_1009
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = { feast_default_1009_secret_recipient_trigger = yes }
				weight = {
					base = 1
					interesting_feast_participant_modifier = yes
				}
				save_scope_as = secret_recipient
			}
		}
		random_known_secret = {
			limit = {
				NOT = { secret_owner = root }
				NOT = { is_known_by = scope:secret_recipient }
			}
			secret_owner = {
				save_scope_as = secret_owner
			}
			save_scope_as = secret_to_reveal
		}
	}

	option = {
		name = feast_default.1009.a
		flavor = feast_default.1008.a.flavor
		scope:secret_to_reveal = {
			reveal_to = scope:secret_recipient
		}
		stress_impact = {
			contrite = minor_stress_impact_loss
		}
	}
}


#####################
# You promise someone a little too much
# by Petter Vilberg
#####################
scripted_trigger feast_default_1010_favor_recipient_trigger = {
	feast_default_participant_trigger = yes
	is_landed = yes
	can_add_hook = {
		target = root
		type = favor_hook
	}
	OR = {
		AND = {
			exists = root.liege
			this = root.liege
		}
		AND = {
			exists = liege
			liege = root
		}
	}
}

feast_default.1010 = {
	type = activity_event
	title = feast_default.1010.t
	desc = feast_default.1010.desc
	theme = feast_activity
	left_portrait = {
		character = scope:favor_recipient
		animation = happiness
	}
	right_portrait = {
		character = root
		animation = shame
	}
	cooldown = { years = 2 }
	
	trigger = {
		NOT = { exists = local_var:had_1010 }
		NOR = {
			has_trait = deceitful
			has_trait = shy
			has_trait = temperate
		}
		scope:activity = {
			any_attending_character = {
				feast_default_1010_favor_recipient_trigger = yes
			}
		}
		not_hosting_a_murder_feast = yes
		drinks_alcohol_trigger = yes
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 0.5
			has_trait = gregarious
		}
		modifier = {
			add = 0.5
			has_trait = drunkard
		}
		modifier = {
			add = 0.25
			OR = {
				has_diplomacy_lifestyle_trait_trigger = yes
				has_trait = lifestyle_reveler
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_1010
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_1010_favor_recipient_trigger = yes
				}
				save_scope_as = favor_recipient
			}
		}
	}

	option = {
		name = feast_default.1010.a
		scope:favor_recipient = {
			add_hook = {
				target = root
				type = favor_hook
			}
		}
		stress_impact = {
			deceitful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
				ai_rationality = 0.5
			}
		}
	}

	option = {
		name = feast_default.1010.b
		reverse_add_opinion = {
			modifier = liar_opinion
			target = scope:favor_recipient
			opinion = -15
		}
		scope:activity = {
			every_attending_character = {
				limit = {
					feast_default_participant_trigger = yes
					NOT = { this = scope:favor_recipient }
				}
				custom = custom.every_attending_character
				add_opinion = {
					modifier = respect_opinion
					target = root
					opinion = -5
				}
			}
		}
		stress_impact = {
			arrogant = minor_stress_impact_gain
			just = medium_stress_impact_gain
			honest = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_greed = 1
				ai_boldness = 0.5
			}
		}
	}
}



#####################
# You get drunk and kill someone
# by Linnéa Thimrén
#####################

scripted_trigger feast_default_1011_find_guest_trigger = {
	feast_default_participant_trigger = yes
	OR = {
		is_of_major_interest_trigger = {
			CHARACTER = root
		}
		is_of_minor_interest_trigger = {
			CHARACTER = root
		}
	}
	NOT = { is_powerful_vassal_of = root }
}

scripted_trigger feast_default_1011_disliked_guest_trigger = {
	feast_default_participant_trigger = yes
	reverse_opinion = {
		target = root
		value <= -10
	}
}

feast_default.1011 = {
	type = activity_event
	title = feast_default.1011.t
	desc = feast_default.1011.desc
	theme = feast_activity
	left_portrait = {
		character = scope:guest_to_murder
		animation = pain
	}
	right_portrait = {
		character = root
		animation = sword_coup_degrace
	}
	lower_left_portrait = scope:disliked_guest
	cooldown = { years = 5 }

	trigger = {
		is_ai = no
		NOR = {
			exists = local_var:had_1011
			exists = local_var:had_1012
			exists = local_var:had_1013
			exists = local_var:had_1014
		}
		OR = {
			has_trait = vengeful
			has_trait = wrathful
		}
		OR = {
			has_trait = drunkard
			has_trait = berserker
		}
		not_hosting_a_murder_feast = yes #I won't accidentally kill someone if I am planning a real murder?
		involved_activity = { #Is there _someone_ at my feast?!
			any_attending_character = {
				feast_default_1011_disliked_guest_trigger = yes
				root = { has_relation_rival = prev }
				save_temporary_scope_as = disliked
			}
			any_attending_character = {
				is_alive = yes
				NOT = { this = scope:disliked }
				feast_default_1011_find_guest_trigger = yes
			}
		}
	}

	weight_multiplier = {
		base = 0.1
		modifier = { #More likely
			add = 0.4
			has_trait = wrathful
			has_trait = berserker
		}
		modifier = { #Much more likely of you're a drunkard AND wrathful
			add = 0.5
			has_trait = drunkard
			has_trait = wrathful
		}
		ai_value_modifier = {
			ai_compassion = -0.01 # -1 to +1
		}
		modifier = { #More likely if you have someone you dislike to blame
			add = 0.2
			scope:activity = {
				any_attending_character = {
					feast_default_1011_disliked_guest_trigger = yes
					OR = {
						has_relation_rival = root
						has_relation_potential_rival = root
					}
				}
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_1011
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_1011_disliked_guest_trigger = yes
				}
				alternative_limit = {
					OR = {
						has_relation_rival = root
						has_relation_potential_rival = root
					}
				}
				save_scope_as = disliked_guest
			}
			random_attending_character = {
				limit = {
					NOT = { this = scope:disliked_guest }
					feast_default_1011_find_guest_trigger = yes
				}
				save_scope_as = guest_to_murder
			}
		}
		add_character_flag = {
			flag = murdered_someone_during_feast
			days = 100
		}
	}

	option = { #Try to convince people they deserved it
		name = feast_default.1011.a

		duel = {
			skill = diplomacy
			value = 10
			30 = {
				desc = feast_default.1011.a.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				send_interface_toast = {
					title = feast_default.1011.a.success
					left_icon = root
					scope:guest_to_murder = {
						death = { death_reason = death_accident }
					}
				}
			}
			10 = {
				desc = feast_default.1011.a.failure
				send_interface_toast = {
					title = feast_default.1011.a.failure
					left_icon = root
					known_murder_effect = {
						VICTIM = scope:guest_to_murder
						MURDERER = root
						EXPOSER = root
					}
				}
			}
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				has_trait = honest
			}
			modifier = {
				add = 25
				OR = {
					has_trait = compassionate
					has_trait = just
				}
			}
		}
	}

	option = { #Hide the body!
		name = feast_default.1011.b
		duel = {
			skill = intrigue
			value = 10
			30 = {
				desc = feast_default.1011.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				send_interface_toast = {
					title = feast_default.1011.b.success
					left_icon = root
					unknown_murder_effect = {
						VICTIM = scope:guest_to_murder
						MURDERER = root
						REASON = death_mysterious
					}
				}
			}
			10 = {
				desc = feast_default.1011.b.failure
				send_interface_toast = {
					title = feast_default.1011.b.failure
					left_icon = root
					known_murder_effect = {
						VICTIM = scope:guest_to_murder
						MURDERER = root
						EXPOSER = root
					}
				}
			}
		}

		stress_impact = {
			honest = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				intrigue >= medium_skill_rating
			}
		}
	}

	option = { #Blame another guest
		name = feast_default.1011.c
		trigger = {
			intrigue >= high_skill_rating
		}
		skill = intrigue

		known_murder_effect = {
			VICTIM = scope:guest_to_murder
			MURDERER = scope:disliked_guest
			EXPOSER = root
		}

		stress_impact = {
			honest = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			modifier = {
				add = 100
				intrigue >= high_skill_rating
			}
		}
	}
}


#####################
# Sneaky murder of character you dislike
# by Linnéa Thimrén
#####################
scripted_trigger feast_default_1012_guest_to_murder_trigger = {
	feast_default_participant_trigger = yes
	save_temporary_scope_as = murder_intent
	root = {
		has_activity_intent = murder_attendee_intent
		intent_target ?= {
			is_alive = yes
			this = scope:murder_intent
		}
	}
}

feast_default.1012 = {
	type = activity_event
	title = feast_default.1012.t
	desc = feast_default.1012.desc_opening
	theme = feast_activity
	left_portrait = {
		character = scope:guest_to_murder
		animation = poison
	}
	right_portrait = {
		character = root
		animation = schadenfreude
	}
	cooldown = { years = 2 }
	
	trigger = {
		is_ai = no
		NOR = {
			exists = local_var:had_1011
			exists = local_var:had_1012
			exists = local_var:had_1013
			exists = local_var:had_1014
		}
		OR = {
			has_lifestyle = intrigue_lifestyle
			intrigue >= high_skill_rating
			has_education_intrigue_trigger = yes
		}
		scope:activity = {
			any_attending_character = {
				feast_default_1012_guest_to_murder_trigger = yes
			}
		}
	}

	weight_multiplier = {
		base = 0.5
		modifier = {
			add = 0.5
			scope:activity = {
				any_attending_character = {
					feast_default_1012_guest_to_murder_trigger = yes
					has_trait = drunkard
				}
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_1012
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_1012_guest_to_murder_trigger = yes
				}
				save_scope_as = guest_to_murder
			}
		}
		unknown_murder_effect = {
			VICTIM = scope:guest_to_murder
			MURDERER = root
			REASON = death_mysterious
		}
	}

	option = { #Fool!
		name = feast_default.1012.a
	}
}


#####################
# Murder someone for attacking friend/lover/sibling
# by Linnéa Thimrén
#####################
scripted_trigger feast_default_1013_liked_guest_trigger = {
	feast_default_participant_trigger = yes
	OR = {
		has_relation_friend = root
		has_relation_lover = root
		AND = {
			is_sibling_of = root
			reverse_opinion = {
				target = root
				value >= 10
			}
		}
	}
}

scripted_trigger feast_default_1013_murder_guest_trigger = {
	feast_default_participant_trigger = yes
	OR = {
		has_relation_rival = scope:guest_check
		has_relation_potential_rival = scope:guest_check
		opinion = {
			target = scope:guest_check
			value <= -20
		}
	}
	OR = {
		has_trait = wrathful
		ai_compassion <= low_negative_compassion
	}
}

feast_default.1013 = {
	type = activity_event
	title = feast_default.1013.t
	desc = feast_default.1013.desc
	theme = feast_activity
	left_portrait = {
		character = scope:guest_to_save
		animation = fear
	}
	right_portrait = {
		character = scope:guest_to_kill
		animation = aggressive_dagger
	}
	cooldown = { years = 2 }
	trigger = {
		is_ai = no
		NOR = {
			exists = local_var:had_1011
			exists = local_var:had_1012
			exists = local_var:had_1013
			exists = local_var:had_1014
		}
		scope:activity = {
			any_attending_character = {
				feast_default_1013_liked_guest_trigger = yes
				is_ai = yes
				save_temporary_scope_as = guest_check
			}
			any_attending_character = {
				feast_default_1013_murder_guest_trigger = yes
				is_ai = yes
				NOT = { this = scope:guest_check }
			}
		}
	}

	weight_multiplier = {
		base = 0.5
	}

	immediate = {
		set_local_variable = {
			name = had_1013
			value = yes
		}
		scope:activity = {
			every_attending_character = {
				limit = {
					feast_default_1013_liked_guest_trigger = yes
					is_ai = yes
				}
				add_to_list = guest_to_save_list
			}
			random_attending_character = {
				limit = {
					feast_default_participant_trigger = yes
					is_ai = yes
					NOT = { is_in_list = guest_to_save_list }
					OR = {
						any_relation = {
							type = rival
							is_in_list = guest_to_save_list
						}
						any_relation = {
							type = potential_rival
							is_in_list = guest_to_save_list
						}
						any_in_list = {
							list = guest_to_save_list
							reverse_opinion = {
								target = prev
								value <= -20
							}
						}
					}
					OR = {
						has_trait = wrathful
						ai_compassion <= low_negative_compassion
					}
				}
				save_scope_as = guest_to_kill
			}
			random_in_list = {
				list = guest_to_save_list
				limit = {
					feast_default_participant_trigger = yes
					OR = {
						has_relation_rival = scope:guest_to_kill
						has_relation_potential_rival = scope:guest_to_kill
						reverse_opinion = {
							target = scope:guest_to_kill
							value <= -20
						}
					}
				}
				save_scope_as = guest_to_save
			}
		}
	}

	option = { #Kill the attacker
		name = {
			text = feast_default.1013.a
		}
		name = {
			trigger = {
				OR = {
					has_trait = wrathful
					has_trait = callous
					has_trait = sadistic
					has_trait = vengeful
				}
			}
			text = feast_default.1013.a_1
		}

		scope:guest_to_save = {
			add_opinion = {
				target = root
				modifier = feast_saved_my_life_opinion
			}
			root = {
				add_hook = {
					type = favor_hook
					target = scope:guest_to_save
				}
			}
		}
		known_murder_effect = {
			VICTIM = scope:guest_to_kill
			MURDERER = root
			EXPOSER = scope:activity.activity_host
		}
		add_character_flag = {
			flag = murdered_someone_during_feast
			days = 100
		}
		ai_chance = {
			base = 25
			ai_value_modifier = {
				ai_boldness = 0.75
			}
		}
	}

	option = { #I will deflect the knife!
		name = feast_default.1013.b
		duel = {
			skill = prowess
			target = scope:guest_to_kill
			30 = {
				desc = feast_default.1013.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				send_interface_toast = {
					title = feast_default.1013.b.success
					left_icon = scope:guest_to_save
				}
			}
			15 = {
				desc = feast_default.1013.b.failure
				send_interface_toast = {
					title = feast_default.1013.b.failure
					left_icon = scope:guest_to_save
					scope:guest_to_save = {
						increase_wounds_effect = { REASON = attacked }
					}
				}
			}
			7 = {
				desc = feast_default.1013.b.big_failure
				send_interface_toast = {
					title = feast_default.1013.b.big_failure
					left_icon = scope:guest_to_save
					known_murder_effect = {
						VICTIM = scope:guest_to_save
						MURDERER = scope:guest_to_kill
						EXPOSER = scope:guest_to_kill
					}
				}
			}
		}
		scope:guest_to_kill = {
			add_secret = {
				type = secret_murder_attempt
				target = scope:guest_to_save
			}
			random_secret = {
				limit = {
					secret_type = secret_murder_attempt
					secret_target = scope:guest_to_save
				}
				expose_secret = scope:guest_to_kill
			}
		}
		stress_impact = {
			craven = medium_stress_impact_gain
		}
		ai_chance = {
			base = 25
			modifier = {
				add = 50
				prowess >= high_skill_rating
			}
			ai_value_modifier = {
				ai_boldness = 0.75
			}
		}
	}

	option = { #I do nothing
		name = feast_default.1013.c
		known_murder_effect = {
			VICTIM = scope:guest_to_save
			MURDERER = scope:guest_to_kill
			EXPOSER = scope:guest_to_kill
		}
		stress_impact = {
			brave = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				has_trait = craven
			}
			ai_value_modifier = {
				ai_boldness = -0.5
			}
		}
	}

	option = { #Kill attacker and convince people it had to be done
		name = feast_default.1013.d
		trigger = {
			diplomacy >= high_skill_rating
		}
		skill = diplomacy
		scope:guest_to_kill = {
			death = { death_reason = death_attacked }
		}
		ai_chance = {
			base = 100
		}
	}
}


#####################
# Murder someone, one witness!
# by Linnéa Thimrén
#####################

scripted_trigger feast_default_1014_participant_basic_trigger = {
	feast_default_participant_trigger = yes
	NOT = { this = scope:activity.activity_host }
}

feast_default.1014 = {
	type = activity_event
	title = feast_default.1014.t
	desc = feast_default.1014.desc
	left_portrait = {
		character = scope:guest_to_murder
		animation = pain
	}
	right_portrait = {
		character = scope:witness
		animation = shock
	}
	theme = feast_activity
	cooldown = { years = 2 }

	
	trigger = {
		is_ai = no
		has_activity_intent = murder_attendee_intent
		NOR = {
			exists = local_var:had_1011
			exists = local_var:had_1012
			exists = local_var:had_1013
			exists = local_var:had_1014
		}
		root.intent_target ?= {
			feast_default_1014_participant_basic_trigger = yes
			is_alive = yes
			OR = {
				has_relation_rival = root
				has_relation_potential_rival = root
				opinion = {
					target = root
					value <= -30
				}
			}
		}
		scope:activity = {
			any_attending_character = {
				feast_default_1014_participant_basic_trigger = yes
				NOT = { this = root.intent_target }
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = { #More likely if you're wrathful
			add = 0.5
			has_trait = wrathful
		}
	}

	immediate = {
		set_local_variable = {
			name = had_1014
			value = yes
		}
		root.intent_target ?= {
			save_scope_as = guest_to_murder
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_1014_participant_basic_trigger = yes
					NOT = { this = scope:guest_to_murder }
				}
				save_scope_as = witness
			}
		}
		unknown_murder_effect = {
			VICTIM = scope:guest_to_murder
			MURDERER = root
			REASON = death_mysterious
		}
		add_character_flag = {
			flag = murdered_someone_during_feast
			days = 100
		}
	}

	option = {
		name = {
			text = feast_default.1014.a
		}
		name = {
			trigger = { has_trait = wrathful }
			text = feast_default.1014.a_2
		}
		random_secret = {
			limit = {
				secret_type = secret_murder
				secret_target = scope:guest_to_murder
			}
			reveal_to = scope:witness
		}
		ai_chance = {
			base = 25
			ai_value_modifier = {
				ai_compassion = 0.5
			}
			opinion_modifier = {
				opinion_target = scope:witness
			}
		}
	}

	option = { #leave no witnesses!
		name = feast_default.1014.b
		trait = wrathful
		trait = sadistic
		trait = callous
		trait = diligent

		unknown_murder_effect = {
			VICTIM = scope:witness
			MURDERER = root
			REASON = death_mysterious
		}
		ai_chance = {
			base = 25
			modifier = {
				add = 50
				OR = {
					has_trait = wrathful
					has_trait = sadistic
					has_trait = callous
					has_trait = diligent
				}
			}
		}
	}
}

#####################
# Steal a trinket!
# by Filippa Gannholm Kirsten
#####################

scripted_trigger feast_default_1016_participant_basic_trigger = {
	feast_default_participant_trigger = yes
	NOT = { this = scope:activity.activity_host }
}

scripted_effect theft_duel_feast_default_1016_effect = { 
	duel = {
		skill = $SKILL$
		value = 10	
		20 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = 1
			}
			min = 2
			#Illustrious modifier
			modifier = {
				scope:trinket_to_steal = { rarity = illustrious }
				factor = 0.1
			}
			#Famed modifier
			modifier = {
				scope:trinket_to_steal = { rarity = famed }
				factor = 0.7
			}
			#Masterwork modifier
			modifier = {
				scope:trinket_to_steal = { rarity = masterwork }
				factor = 1
			}
			#Common modifier
			modifier = {
				scope:trinket_to_steal = { rarity = common }
				factor = 2
			}
			#Your stealth went unmatched!
			desc = feast_default_1016_stealth.desc
			#We became the owner of the trinket!
			send_interface_toast = {
				title = feast_default.1016.tt
				left_icon = scope:trinket_to_steal
				#Update history
				scope:trinket_to_steal = {
					set_owner = {
						target = root 	#new owner
						history = {
							actor = scope:feast_host
							recipient = root
							type = stolen
						}
					}
				}
				#Carried away by a...
				add_character_modifier = { 
					modifier = feast_moonlight_shadow_modifier
					years = 5
				}
				#If we're honest-leaning or paranoid, this is stressful
				stress_impact = {
					honest = minor_stress_impact_gain
					just = minor_stress_impact_gain
					craven = medium_stress_impact_gain
					paranoid = major_stress_impact_gain
				}
			}
			#Setup for the follow-up event
			add_character_flag = {
				flag = successful_trinket_theft_during_feast
				days = 100
			}	
		}
		80 = {
			compare_modifier = {
				value = scope:duel_value
				multiplier = 1
			}
			min = 10
			#Your thievery did not go unnoticed...
			desc = feast_default_1016_observed.desc
			#We became the owner of the trinket!
			send_interface_toast = {
				title = feast_default.1016.tt
				left_icon = scope:trinket_to_steal
				#Update history
				scope:trinket_to_steal = {
					set_owner = {
						target = root 	#new owner
						history = {
							actor = scope:feast_host
							recipient = root
							type = stolen
						}
					}
				}
				#*failure noise*
				add_character_modifier = { 
					modifier = feast_observed_modifier
					years = 5
				}
				#If we're honest-leaning or paranoid, this is very stressful
				stress_impact = {
					honest = medium_stress_impact_gain
					just = medium_stress_impact_gain
					craven = major_stress_impact_gain
					paranoid = massive_stress_impact_gain
				}
			}
			#Setup for the follow-up event
			add_character_flag = {
				flag = discovered_trinket_theft_during_feast
				days = 100
			}	
		}
	}
}

scripted_effect feast_default_1016_duel_prowess_or_intrigue_effect = {
	#Check if we should duel using Prowess or Intrigue, we want the higher stat
	if = {
		limit = { root.prowess > root.intrigue }
		add_character_flag = higher_prowess_than_intrigue
	}
	if = {
		limit = { has_character_flag = higher_prowess_than_intrigue }
		theft_duel_feast_default_1016_effect = { SKILL = prowess }
	}
	else = {
		theft_duel_feast_default_1016_effect = { SKILL = intrigue }
	}
}

scripted_trigger feast_default_1016_procurative_personality_trigger = {
	OR = {
		has_trait = deceitful
		has_trait = greedy
		has_trait = arrogant
		has_trait = callous
	}
}

scripted_trigger feast_default_1016_honest_personality_trigger = {
	OR = {
		has_trait = honest
		has_trait = craven
		has_trait = just
	}
}

feast_default.1016 = {
	type = activity_event
	title = feast_default.1016.t
	desc = {
		desc = feast_default.1016.desc_intro 
		first_valid = { 
			#Greedy flavor
			triggered_desc = {
				trigger = { 
					feast_default_1016_procurative_personality_trigger = yes
				}
				desc = feast_default.1016.desc_greedy
			}
			#Honest/hesitant flavor
			triggered_desc = {
				trigger = { 
					feast_default_1016_honest_personality_trigger = yes
				}
				desc = feast_default.1016.desc_hesitant
			}
			#Default
			desc = feast_default.1016.desc_default
		}
	}
	left_portrait = {
		character = root
		#If we're prone to nimble fingers
		triggered_animation = {
			trigger = { 
				feast_default_1016_procurative_personality_trigger = yes
			}
  			animation = scheme
  		}
  		#If we're honest-ish
  		triggered_animation = {
			trigger = { 
				feast_default_1016_honest_personality_trigger = yes
			}
  			animation = pain
  		}
  		#Otherwise default to
		animation = worry
	}
	#Show trinket
	artifact = {
		target = scope:trinket_to_steal
		position = lower_center_portrait
		trigger = { exists = scope:trinket_to_steal }
	}
	theme = feast_activity
	cooldown = { years = 1 }
	trigger = {
		is_ai = no
		scope:activity = {
			#Do we have a potential witness to the theft
			any_attending_character = {
				feast_default_1016_participant_basic_trigger = yes
				OR = {
					has_relation_rival = root
					has_relation_potential_rival = root
					opinion = {
						target = root
						value <= -30
					}
				}
			}
			#Don't steal from yourself
			NOT = { activity_host = root }
		}
	}
	weight_multiplier = {
		base = 0.1
		modifier = { 
			#More likely if you don't mind a little deceit
			feast_default_1016_procurative_personality_trigger = yes
			add = 0.5
		}
		modifier = { 
			#More likely if you dislike the host
			OR = {
				scope:activity.activity_host = {
					has_relation_rival = root
					has_relation_potential_rival = root		
				}
				opinion = {
					target = scope:activity.activity_host
					value <= medium_negative_opinion
				}
			}
			add = 0.5
		}
		modifier = { 
			#Less likely if you're craven
			has_trait = craven
			add = -0.5
		}
	}
	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_1016_participant_basic_trigger = yes
					OR = {
						has_relation_rival = root
						has_relation_potential_rival = root
						opinion = {
							target = root
							value <= -30
						}
					}
				}
				save_scope_as = witness
			}
		}
		#Trinket setup
		scope:activity.activity_host = {
			save_scope_as = feast_host
			add_character_flag = used_in_feast_default.1016
		}
		hidden_effect = {
			scope:feast_host = {
				#Let's generate the trinket-to-steal
				generate_trinket_effect = {
					TRINKET_RECEIVER = scope:feast_host
					TRINKET_GIVER = scope:feast_host
					GRAB_ALL_TRINKETS = no
					HISTORY_TYPE = given_unknown
				}
				if = {
					limit = { exists = scope:new_trinket }
					scope:new_trinket = { save_scope_as = trinket_to_steal }
				}
			}
		}
	}
	#Let's steal
	option = {
		name = {
			text = {
				first_valid = {
					#Don't mind if I do!
					triggered_desc = {
						trigger = {
							feast_default_1016_procurative_personality_trigger = yes
						}
						desc = feast_default.1016.a_greedy
					}
					#I just can't help myself...
					triggered_desc = {		
						trigger = {
							feast_default_1016_honest_personality_trigger = yes
						}
						desc = feast_default.1016.a_hesitant
					}
					#Oh my, that's a nice-looking trinket.
					desc = feast_default.1016.a
				}
			}
		}
		#Let's run the dynamic duel effect (checking intrigue or prowess, whichever is higher)
		feast_default_1016_duel_prowess_or_intrigue_effect = yes
	}
	#No I don't want to
	option = {
		name = feast_default.1016.b
		#We were honorable
		add_character_modifier = { 
			modifier = feast_honorable_soul_modifier
			years = 5
		}
		#Setup for the follow-up event
		add_character_flag = {
			flag = did_not_steal_during_feast
			days = 100
		}
	}
	after = {
		hidden_effect = {
			if = {
				#If we stole, trigger the next event
				limit = { 
					NOT = { has_character_flag = did_not_steal_during_feast }
				}
				trigger_event = feast_default.1017
			}
			#Clean up flags
			remove_character_flag = higher_prowess_than_intrigue
			remove_character_flag = used_in_feast_default.1016
		}
	}
}

#Theft followup - successful or unsuccessful
feast_default.1017 = {
	type = activity_event
	title = feast_default.1017.t
	desc = {
		desc = feast_default.1017.desc_intro
		first_valid = { 
			#Discovered flavor
			triggered_desc = {
				trigger = { 
					has_character_flag = discovered_trinket_theft_during_feast
				}
				desc = feast_default.1017.desc_discovered
			}
			#Else we were stealthy
			desc = feast_default.1017.desc_stealth
		}
	}
	left_portrait = {
		character = root
		#If we are discovered
		##If we're prone to 'claiming' trinkets
		triggered_animation = {
			trigger = { 
				has_character_flag = discovered_trinket_theft_during_feast
				feast_default_1016_procurative_personality_trigger = yes
			}
  			animation = disgust
  		}
  		##If we're honest-ish
  		triggered_animation = {
			trigger = { 
				has_character_flag = discovered_trinket_theft_during_feast
				feast_default_1016_honest_personality_trigger = yes
			}
  			animation = paranoia
  		}
  		##Otherwise default to
  		triggered_animation = {
  			trigger = {
  				has_character_flag = discovered_trinket_theft_during_feast
  			}
  			animation = worry
  		}
  		#If we remain hidden
  		##If we're prone to 'claiming' trinkets
		triggered_animation = {
			trigger = { 
				has_character_flag = successful_trinket_theft_during_feast
				feast_default_1016_procurative_personality_trigger = yes
			}
  			animation = scheme
  		}
  		##If we're honest-ish
  		triggered_animation = {
			trigger = { 
				has_character_flag = successful_trinket_theft_during_feast
				feast_default_1016_honest_personality_trigger = yes
			}
  			animation = worry
  		}
  		##Otherwise default to
  		triggered_animation = {
  			trigger = {
  				has_character_flag = successful_trinket_theft_during_feast
  			}
  			animation = personality_compassionate
  		}
	}
	theme = feast_activity
	#If we were spotted, let's put on some gloom
	override_background = {
		trigger = { has_character_flag = discovered_trinket_theft_during_feast }
		reference = corridor_night
	}
	#Oh no...
	option = {
		name = feast_default.1017.a
		trigger = { has_character_flag = discovered_trinket_theft_during_feast }
		trigger_event = {
			id = feast_default.1018
			days = { 180 250 } #The feast should have ended and we should be back home
		}
	}
	#Success!
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { 
							has_character_flag = successful_trinket_theft_during_feast
							feast_default_1016_honest_personality_trigger = yes
						}
						desc = feast_default.1017.b_honest
					}
					#Default: We are great!
					desc = feast_default.1017.b
				}
			}
		}
		trigger = { has_character_flag = successful_trinket_theft_during_feast }
	}
}

scripted_effect feast_default_1018_extort_gold_amount_based_on_rarity_effect = {
	#Illustrious stolen trinket
	if = {
		limit = { 
			scope:trinket_to_steal = { rarity = illustrious } 
		}
		pay_short_term_gold = {
			target = scope:witness
			gold = massive_gold_value
		}
	}
	#Famed stolen trinket
	else_if = {
		limit = { 
			scope:trinket_to_steal = { rarity = famed } 
		}
		pay_short_term_gold = {
			target = scope:witness
			gold = major_gold_value
		}
	}
	#Masterwork stolen trinket
	else_if = {
		limit = { 
			scope:trinket_to_steal = { rarity = masterwork } 
		}
		pay_short_term_gold = {
			target = scope:witness
			gold = medium_gold_value
		}
	}
	#Common and worse
	else = {
		pay_short_term_gold = {
			target = scope:witness
			gold = minor_gold_value
		}
	}
}

scripted_trigger feast_default_1018_contemptful_personality_check_trigger = {
	OR = {
		has_trait = deceitful
		has_trait = greedy
		has_trait = arrogant
		has_trait = callous
		has_trait = wrathful
		has_trait = irritable
		has_trait = sadistic
	}
}

#Confronted by a proxy of the witness in feast_default.1018
feast_default.1018 = {
	type = character_event
	title = feast_default.1018.t
	desc = {
		desc = feast_default.1018.desc_intro 
		first_valid = { 
			#Contemptful approach
			triggered_desc = {
				trigger = { 
					feast_default_1018_contemptful_personality_check_trigger = yes
				}
				desc = feast_default.1018.desc_greedy
			}
			desc = feast_default.1018.desc_default
		}
	}
	left_portrait = {
		character = root
		#If we're prone to anger, that trinket was surely ours from the get-go!
		triggered_animation = {
			trigger = {
				feast_default_1018_contemptful_personality_check_trigger = yes
			}
  			animation = anger
  		}
  		#If we're honest-ish
  		triggered_animation = {
			trigger = { 
				feast_default_1016_honest_personality_trigger = yes
			}
  			animation = beg
  		}
  		#Otherwise default to
		animation = shame
	}
	right_portrait = {
		character = scope:witness_proxy
		#If we are a contemptful character, we perceive the confronting witness as smug
		triggered_animation = {
			trigger = {
				has_character_flag = feast_default_1018_perceived_with_contempt
			}
  			animation = schadenfreude
  		}
  		#Otherwise default to
		animation = disapproval
	}
	#Show feast host
	lower_center_portrait = {
		character = scope:feast_host
	}
	#Show the witness
	lower_right_portrait = {
		character = scope:witness
	}
	#Show trinket
	artifact = {
		target = scope:trinket_to_steal
		position = lower_left_portrait
		trigger = { exists = scope:trinket_to_steal }
	}
	theme = unfriendly
	trigger = {
		is_available = yes
		scope:witness = { 
			OR = {
				is_available = yes
				is_available_travelling = yes 
			}
		}
	}
	immediate = {
		create_character = {
			template = servant_character
			culture = scope:witness.culture
			faith = scope:witness.faith
			location = root.location
			save_scope_as = witness_proxy
		}
		#We interpret the event based on if we're a contemptful character
		if = {
			limit = {
				feast_default_1018_contemptful_personality_check_trigger = yes
			}
			scope:witness_proxy = {
				add_character_flag = {
					flag = feast_default_1018_perceived_with_contempt
					days = 30
				}
			}
		}
	}
	#Pay them off
	option = {
		name = {
			text = {
				first_valid = {
					#Sod off!
					triggered_desc = {
						trigger = { 
							feast_default_1018_contemptful_personality_check_trigger = yes
						}
						desc = feast_default.1018.a_contempt
					}
					#Default
					desc = feast_default.1018.a
				}
			}
		}
		flavor = feast_default.1018.a_tt
		#Figure out how much gold based on trinket rarity
		feast_default_1018_extort_gold_amount_based_on_rarity_effect = yes
		#Greedy finds this stressful
		stress_impact = {
			greedy = medium_stress_impact_gain
		}
	}
	#Intrigue duel them
	option = {
		name = {
			text = {
				first_valid = {
					#Sod off!
					triggered_desc = {
						trigger = { 
							feast_default_1018_contemptful_personality_check_trigger = yes
						}
						desc = feast_default.1018.b_contempt
					}
					#Default
					desc = feast_default.1018.b
				}
			}
		}
		duel = {
			skill = intrigue
			target = scope:witness
				
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 5
				}
				min = 2
				#You manage to convince them
				desc = feast_default_1018_success.desc
				send_interface_toast = {
					type = event_toast_effect_good
					title = feast_default_1018_success.t
					left_icon = root
					right_icon = scope:witness
					#Truth bender modifier
					add_character_modifier = { 
						modifier = feast_truth_bender_modifier
						years = 5
					}
					#They're apologetic
					reverse_add_opinion = { 
						target = scope:witness
						modifier = feast_mistaken_opinion
						opinion = 10
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -5
				}
				min = 10
				#You did not manage to convince them
				desc = feast_default_1018_failure.desc
				#Show effects on us
				send_interface_toast = {
					type = event_toast_effect_bad
					title = feast_default_1018_failure.t
					left_icon = root
					right_icon = scope:witness
					#If we're antsy
					stress_impact = {
						craven = minor_stress_impact_gain
						paranoid = medium_stress_impact_gain
					}
					#Untruthful modifier
					add_character_modifier = { 
						modifier = feast_untruthful_modifier
						years = 5
					}	
				}
				#Show effects on the witness
				send_interface_toast = {
					type = event_toast_effect_bad
					title = feast_default_1018_failure.t
					left_icon = root
					right_icon = scope:witness
					#They found you out
					reverse_add_opinion = { 
						target = scope:witness
						modifier = feast_lied_to_me_opinion
							opinion = -10
					}
					scope:witness = {
						add_hook = {
							target = root
							type = favor_hook
						}
					}	
				}
			}
		}
		#Honest no like
		stress_impact = {
			just = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
	}
	#...kill them?
	option = {
		name = feast_default.1018.c
		trigger = {
			OR = {
				has_trait = callous
				has_trait = wrathful
				has_trait = irritable
				has_trait = sadistic
				has_trait = deceitful
			}
		}
		duel = {
			skill = prowess
			target = scope:witness_proxy

			50 = {
				desc = feast_default.1011.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				send_interface_toast = {
					title = feast_default.1011.b.success
					left_icon = root
					unknown_murder_effect = {
						VICTIM = scope:witness_proxy
						MURDERER = root
						REASON = death_defenestration
					}
				}
			}
			50 = {
				desc = feast_default.1011.b.failure
				send_interface_toast = {
					title = feast_default.1011.b.failure
					left_icon = root
					known_murder_effect = {
						VICTIM = scope:witness_proxy
						MURDERER = root
						EXPOSER = root
					}
				}
			}
		}
	}
	#Diplomacy duel them (OBSOLETE)
	#option = {
	#	name = feast_default.1018.d
	#	trigger = {
	#		OR = {
	#			has_trait = compassionate
	#			has_trait = just
	#			has_trait = honest
	#			has_trait = humble
	#		}
	#	}
	#	flavor = feast_default.1018.d_tt
	#	duel = {
	#		skill = diplomacy
	#		value = 10
	#			
	#		50 = {
	#			compare_modifier = {
	#				value = scope:duel_value
	#				multiplier = 5			
	#			}
	#			min = 2
	#			modifier = {
	#				scope:witness = {
	#					OR = {
	#						has_trait = compassionate
	#						has_trait = honest
	#					}
	#				}
	#				factor = 2
	#			}
	#			#You manage to convince them
	#			desc = feast_default_1018_success.desc
	#			send_interface_toast = {
	#				type = event_toast_effect_good
	#				title = feast_default_1018_success.t
	#				left_icon = root
	#				right_icon = scope:witness
	#				#Came clean
	#				add_character_modifier = { 
	#					modifier = feast_came_clean_modifier
	#					years = 5
	#				}
	#				#They're sympathetic
	#				reverse_add_opinion = { 
	#					target = scope:witness
	#					modifier = feast_compassionate_opinion
	#					opinion = 10
	#				}
	#			}
	#			#Flags for the follow-up
	#			add_character_flag = { flag = redemption_feast_default.1018 }
	#			scope:feast_host = {
	#				add_character_flag = { flag = feast_host_redemption_feast_default.1018 }
	#			}
	#		}
	#		50 = {
	#			compare_modifier = {
	#				value = scope:duel_value
	#				multiplier = -5
	#			}
	#			min = 10
	#			#You did not manage to convince them
	#			desc = feast_default_1018_failure.desc	
	#			send_interface_toast = {
	#				type = event_toast_effect_bad
	#				title = feast_default_1018_failure.t
	#				left_icon = root
	#				right_icon = scope:witness
	#				#...is another word for admitting to theft
	#				add_character_modifier = { 
	#					modifier = feast_admitted_to_theft_modifier
	#					years = 5
	#				}
	#				#They're condemning
	#				reverse_add_opinion = { 
	#					target = scope:witness
	#					modifier = feast_condemning_opinion
	#					opinion = -10
	#				}
	#			}
	#		}
	#	}
	#	#Return-the-trinket-event (Needs to be rewritten)
	#	trigger_event = {
	#		id = feast_default.1019
	#	}
	#}
	after = {
		hidden_effect = {
			scope:witness_proxy = {
				move_to_pool_at = scope:witness.capital_province
			}
		}
	}
}

scripted_effect feast_default_1019_redemption_or_condemnation_effect = {
	#If we're redeemed
	if = {
		limit = { 
			#has_character_flag = redemption_feast_default.1018 
		}
		send_interface_toast = {
			type = event_toast_effect_good
			title = feast_default_1019_redeemed.t
			left_icon = root
			right_icon = scope:feast_host
			#Return the trinket
			scope:trinket_to_steal = { set_owner = scope:feast_host }
			#They're compassionate
			scope:feast_host = {
				add_opinion = { 
					target = root
					modifier = feast_compassionate_opinion
					opinion = 10
				}
				add_opinion = { 
					target = scope:witness
					modifier = feast_helped_me_opinion
					opinion = 20
				}
			}
		}
	}
	#If we're condemned and contemptful
	else_if = {
		limit = {
			#NOT = { has_character_flag = redemption_feast_default.1018 }
			feast_default_1018_contemptful_personality_check_trigger = yes
		}
		send_interface_toast = {
			type = event_toast_effect_bad
			title = feast_default_1019_condemned.t
			left_icon = root
			right_icon = scope:feast_host
			#Return the trinket
			scope:trinket_to_steal = { set_owner = scope:feast_host }
			#They're condemning
			scope:feast_host = {
				add_opinion = { 
					target = root
					modifier = feast_condemning_opinion
					opinion = -20
				}
				add_opinion = { 
					target = scope:witness
					modifier = feast_helped_me_opinion
					opinion = 20
				}
			}
		}
		#We're kinda scorned...
		if = {
			limit = {
				can_set_relation_potential_rival_trigger = { CHARACTER = scope:feast_host }
			}
			set_relation_potential_rival = scope:feast_host
		}
		if = {
			limit = {
				can_set_relation_potential_rival_trigger = { CHARACTER = scope:witness }
			}
			set_relation_potential_rival = scope:witness
		}
	}
	#If we're condemned
	else = {
		send_interface_toast = {
			type = event_toast_effect_bad
			title = feast_default_1019_condemned.t
			left_icon = root
			right_icon = scope:feast_host
			#Return the trinket
			scope:trinket_to_steal = { set_owner = scope:feast_host }
			#They're condemning
			scope:feast_host = {
				add_opinion = { 
					target = root
					modifier = feast_condemning_opinion
					opinion = -20
				}
				add_opinion = { 
					target = scope:witness
					modifier = feast_helped_me_opinion
					opinion = 20
				}
			}
		}
	}
}

scripted_trigger feast_default_1019_good_relationship_trigger = {
	scope:feast_host = {
		OR = {
			has_relation_friend = root
			has_relation_potential_friend = root
			opinion = {
				target = root
				value >= 20
			}
		}
	}
}

scripted_effect feast_default_1019_cheeky_item_outcome_effect = {
	#If we have a hook and are redeemed
	if = {
		limit = { 
			has_hook = scope:feast_host
			#has_character_flag = redemption_feast_default.1018
		}
		remove_hook = { target = scope:feast_host }
		send_interface_toast = {
			type = event_toast_effect_good
			title = feast_default_1019_redeemed.t
			left_icon = root
			right_icon = scope:feast_host
			#They're compassionate
			scope:feast_host = {
				add_opinion = { 
					target = root
					modifier = feast_compassionate_opinion
					opinion = 10
				}
				add_opinion = { 
					target = scope:witness
					modifier = feast_helped_me_opinion
					opinion = 20
				}
			}
		}
	}
	#If we have a hook and are condemned
	else_if = {
		limit = { 
			has_hook = scope:feast_host
			#NOT = { has_character_flag = redemption_feast_default.1018 }
		}
		remove_hook = { target = scope:feast_host }
		send_interface_toast = {
			type = event_toast_effect_bad
			title = feast_default_1019_condemned.t
			left_icon = root
			right_icon = scope:feast_host
			#They're condemning
			scope:feast_host = {
				add_opinion = { 
					target = root
					modifier = feast_condemning_opinion
					opinion = -20
				}
				add_opinion = { 
					target = scope:witness
					modifier = feast_helped_me_opinion
					opinion = 20
				}
			}
		}
		#We burned our bridge there...
		if = {
			limit = {
				can_set_relation_potential_rival_trigger = { CHARACTER = scope:feast_host }
				NOT = {
					scope:feast_host = {
						OR = {
							has_relation_soulmate = root
							has_relation_lover = root
							has_relation_best_friend = root
							has_relation_friend = root
						}
					}
				}
			}
			set_relation_potential_rival = scope:feast_host
		}
	}
	#If we're good friends with the feast_host and are redeemed
	else_if = {
		limit = { 
			#has_character_flag = redemption_feast_default.1018 
		}
		duel = {
			skill = intrigue
			target = scope:feast_host
				
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 2
				}
				min = 2
				#Illustrious modifier
				modifier = {
					scope:trinket_to_steal = { rarity = illustrious }
					factor = 0.1
				}
				#Famed modifier
				modifier = {
					scope:trinket_to_steal = { rarity = famed }
					factor = 0.7
				}
				#Masterwork modifier
				modifier = {
					scope:trinket_to_steal = { rarity = masterwork }
					factor = 1
				}
				#Common modifier
				modifier = {
					scope:trinket_to_steal = { rarity = common }
					factor = 2
				}
				#If they like us, a modifier in three parts
				modifier = {
					scope:feast_host = {
						OR = {
							has_relation_soulmate = root
							has_relation_lover = root
							has_relation_best_friend = root
						}
					}
					factor = 15
				}
				modifier = {
					scope:feast_host = {
						OR = {
							has_relation_friend = root
							has_relation_potential_friend = root
							has_relation_potential_lover = root

						}
					}
					factor = 7
				}
				modifier = {
					scope:feast_host = {
						opinion = {
							target = root
							value >= 70
						}
					}
					factor = 5
				}
				#You convince them
				desc = feast_default_1019_success.desc
				#We got to keep the trinket!
				send_interface_toast = {
					type = event_toast_effect_good
					title = feast_default_1018_success.t
					left_icon = root
					right_icon = scope:feast_host
					#They're compassionate
					scope:feast_host = {
						add_opinion = { 
							target = root
							modifier = feast_compassionate_opinion
							opinion = 10
						}
						add_opinion = { 
							target = scope:witness
							modifier = feast_helped_me_opinion
							opinion = 20
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2
				}
				min = 10
				#If they don't like us, a one-act modifier
				modifier = {
					scope:feast_host = { has_relation_potential_rival = root }
					factor = 7
				}
				#You fail to convince them
				desc = feast_default_1019_failure.desc
				send_interface_toast = {
					type = event_toast_effect_good
					title = feast_default_1018_failure.t
					left_icon = root
					right_icon = scope:feast_host
					#Return the trinket
					scope:trinket_to_steal = { set_owner = scope:feast_host }
					#They're compassionate
					scope:feast_host = {
						add_opinion = { 
							target = root
							modifier = feast_compassionate_opinion
							opinion = 10
						}
						add_opinion = { 
							target = scope:witness
							modifier = feast_helped_me_opinion
							opinion = 20
						}
					}
				}
			}
		}
	}
	#If we're good friends with the feast_host and are condemned
	else = {
		duel = {
			skill = intrigue
			target = scope:feast_host
				
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 5
				}
				min = 2
				#Illustrious modifier
				modifier = {
					scope:trinket_to_steal = { rarity = illustrious }
					factor = 0.1
				}
				#Famed modifier
				modifier = {
					scope:trinket_to_steal = { rarity = famed }
					factor = 0.7
				}
				#Masterwork modifier
				modifier = {
					scope:trinket_to_steal = { rarity = masterwork }
					factor = 1
				}
				#Common modifier
				modifier = {
					scope:trinket_to_steal = { rarity = common }
					factor = 2
				}
				#If they like us, a modifier in three parts
				modifier = {
					scope:feast_host = {
						OR = {
							has_relation_soulmate = root
							has_relation_lover = root
							has_relation_best_friend = root
						}
					}
					factor = 15
				}
				modifier = {
					scope:feast_host = {
						OR = {
							has_relation_friend = root
							has_relation_potential_friend = root
							has_relation_potential_lover = root
						}
					}
					factor = 7
				}
				modifier = {
					scope:feast_host = {
						opinion = {
							target = root
							value >= 70
						}
					}
					factor = 5
				}
				#You convince them
				desc = feast_default_1019_success.desc
				#We got to keep the trinket!
				send_interface_toast = {
					type = event_toast_effect_bad
					title = feast_default_1018_success.t
					left_icon = root
					right_icon = scope:feast_host
					#They're condemning
					scope:feast_host = {
						add_opinion = { 
							target = root
							modifier = feast_condemning_opinion
							opinion = -20
						}
						add_opinion = { 
							target = scope:witness
							modifier = feast_helped_me_opinion
							opinion = 20
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -5
				}
				min = 10
				#If they don't like us, a one-act modifier
				modifier = {
					scope:feast_host = { has_relation_potential_rival = root }
					factor = 7
				}
				#You fail to convince them
				desc = feast_default_1019_failure.desc
				send_interface_toast = {
					type = event_toast_effect_bad
					title = feast_default_1018_failure.t
					left_icon = root
					right_icon = scope:feast_host
					#Return the trinket
					scope:trinket_to_steal = { set_owner = scope:feast_host }
					#They're condemning
					scope:feast_host = {
						add_opinion = { 
							target = root
							modifier = feast_condemning_opinion
							opinion = -20
						}
						add_opinion = { 
							target = scope:witness
							modifier = feast_helped_me_opinion
							opinion = 20
						}
					}
				}
			}
		}
	}
}

#If you are redeemed or condemned - resolution with the feast_host
feast_default.1019 = {
	orphan = yes
	type = character_event
	title = feast_default.1019.t
	desc = {
		first_valid = {
			#Good relation
			triggered_desc = {
				trigger = {
					#has_character_flag = redemption_feast_default.1018
				}
				desc = feast_default.1019.desc_intro_redeemed
			}
			#Bad relation
			desc = feast_default.1019.desc_intro_condemned
		}
		first_valid = {
			#Redemption - contemptful personality
			triggered_desc = {
				trigger = { 
					feast_default_1019_good_relationship_trigger = yes
					feast_default_1018_contemptful_personality_check_trigger = yes
				}
				desc = feast_default.1019.desc_redemption_greedy
			}
			#Condemnation - contemptful personality
			triggered_desc = {
				trigger = { 
					feast_default_1019_good_relationship_trigger = no
					feast_default_1018_contemptful_personality_check_trigger = yes
				}
				desc = feast_default.1019.desc_condemnation_greedy
			}
			#Redemption outcome
			triggered_desc = {
				trigger = { 
					feast_default_1019_good_relationship_trigger = yes
					feast_default_1018_contemptful_personality_check_trigger = no
				}
				desc = feast_default.1019.desc_redemption
			}
			#Condemnation outcome
			triggered_desc = {
				trigger = { 
					feast_default_1019_good_relationship_trigger = no
					feast_default_1018_contemptful_personality_check_trigger = no
				}
				desc = feast_default.1019.desc_condemnation
			}	
		}
	}
	left_portrait = {
		character = root
		animation = shame
	}
	right_portrait = {
		character = scope:feast_host
		#triggered_animation = {
		#	trigger = { has_character_flag = feast_host_redemption_feast_default.1018 }
  		#	animation = worry
  		#}
		animation = disapproval
	}
	#Show the witness
	lower_center_portrait = {
		character = scope:witness
	}
	#Show trinket
	artifact = {
		target = scope:trinket_to_steal
		position = lower_left_portrait
		trigger = { exists = scope:trinket_to_steal }
	}
	theme = diplomacy

	#Cheeky inquiry to keep trinket
	option = {
		name = feast_default.1019.a
		trigger = {
			OR = {
				#If we have a good relation
				feast_default_1019_good_relationship_trigger = yes
				#...or a hook on them
				has_hook = scope:feast_host
			}
		}
		flavor = feast_default.1019.a_tt
		feast_default_1019_cheeky_item_outcome_effect = yes
	}

	#Forgiveness
	option = {
		name = feast_default.1019.b
		feast_default_1019_redemption_or_condemnation_effect = yes
	}

	#after = {
	#	remove_character_flag = redemption_feast_default.1018
	#	scope:feast_host = {
	#		remove_character_flag = feast_host_redemption_feast_default.1018
	#	}
	#}
}

#####################
# Dislike the host, deface a displayed Court Artifact
# by Filippa Gannholm Kirsten
#####################
scripted_effect feast_default_1020_gold_amount_based_on_rarity_effect = {
	#Illustrious court artifact
	if = {
		limit = { 
			scope:feast_target_artifact = { rarity = illustrious } 
		}
		pay_short_term_gold = { 
			target = scope:feast_host
			gold = {
				value = major_gold_value
				multiply = 0.25
			}
		}
	}
	#Famed court artifact
	else_if = {
		limit = { 
			scope:feast_target_artifact = { rarity = famed } 
		}
		pay_short_term_gold = { 
			target = scope:feast_host
			gold = {
				value = medium_gold_value
				multiply = 0.5
			}
		}
	}
	#Masterwork court artifact
	else_if = {
		limit = { 
			scope:feast_target_artifact = { rarity = masterwork } 
		}
		pay_short_term_gold = { 
			target = scope:feast_host
			gold = {
				value = minor_gold_value
				multiply = 1
			}
		}
	}
	#Common and worse
	else = {
		pay_short_term_gold = { 
			target = scope:feast_host
			gold = {
				value = tiny_gold_value
				multiply = 1
			}
		}
	}
}

scripted_effect set_worsened_relation_feast_default_1020_effect = {
	if = {
		limit = {
			can_set_relation_potential_rival_trigger = { CHARACTER = scope:feast_host }
		}
		set_relation_potential_rival = scope:feast_host
	}
	else_if = {
		limit = {
			can_set_relation_rival_trigger = { CHARACTER = scope:feast_host }
		}
		set_relation_rival = {
			target = scope:feast_host
			reason = rival_artifact_defaced
		}
	}
	else_if = {
		limit = {
			has_relation_rival = scope:feast_host
			can_set_relation_nemesis_trigger = { CHARACTER = scope:feast_host }
		}
		set_relation_nemesis = {
			reason = nemesis_artifact_defaced
			copy_reason = rival
			target = scope:feast_host
		}
	}
}

feast_default.1020 = {
	type = activity_event
	title = feast_default.1020.t
	desc = feast_default.1020.desc
	theme = feast_activity
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = just
					has_trait = honest
				}
			}
			animation = worry
		}
		animation = scheme
	}
	#Show the court artifact
	artifact = {
		target = scope:feast_target_artifact
		position = lower_center_portrait
		trigger = { exists = scope:feast_target_artifact }
	}
	
	trigger = {
		NOT = { exists = local_var:had_1020 }
		is_ai = no
		has_dlc_feature = royal_court #Court Artifacts
		#Does the host have a court artifact on display?
		NOT = { this = scope:activity.activity_host }
		scope:activity.activity_host = {
			is_ai = yes
			any_character_artifact = {
				ep1_artifact_is_court_artifact_trigger = yes
				is_equipped = yes
			}
		}
		#Do we dislike the host?
		opinion = {
			target = scope:activity.activity_host
			value < 0
		}
	}
	#More likely if we're potential rival, rivals or nemesis
	weight_multiplier = {
		base = 1	
		modifier = { 
			has_relation_nemesis = scope:activity.activity_host
			factor = 2
		}
		modifier = { 
			has_relation_rival = scope:activity.activity_host
			factor = 1.5
		}
		modifier = { 
			has_relation_potential_rival = scope:activity.activity_host
			factor = 1.25
		}
	}

	immediate = {
		set_local_variable = {
			name = had_1020
			value = yes
		}
		#Let's set our court artifact to-be defaced
		scope:activity.activity_host = {
			random_character_artifact = {
				limit = {
					ep1_artifact_is_court_artifact_trigger = yes
					is_equipped = yes
				}
				save_scope_as = feast_target_artifact
			}
			#For easy access
			save_scope_as = feast_host
		}
		scope:activity = {
			every_attending_character = {
				if = {
					limit = {
						feast_default_participant_trigger = yes
						OR = {
							has_relation_nemesis = scope:feast_host
							has_relation_rival = scope:feast_host
							has_relation_potential_rival = scope:feast_host
							opinion = {
								target = scope:feast_host
								value < 0
							}
						}
						NOR = {
							has_relation_nemesis = root
							has_relation_rival = root
							this = root
						}
					}
					add_to_list = guests_who_dislike_host
					root = {
						if = {
							limit = { 
								NOT = { exists = var:num_unhappy_guests }
							}
							set_variable = {
								name = num_unhappy_guests
								value = 1
							}
						}
						else = {
							change_variable = {
								name = num_unhappy_guests
								add = 1
							}
						}
					}
				}
			}
		}
		#Some randomization for flavor
		random_list = {
			50 = {
				add_character_flag = feast_default_1020_scratch_up_artifact
			}
			50 = {
				add_character_flag = feast_default_1020_knock_over_artifact
			}
		}
		
	}

	#Let's deface!
	option = {
		name = {
			text = {
				first_valid = {
					#I'll spill something on it!
					triggered_desc = {
						trigger = {
							has_trait = drunkard
						}
						desc = feast_default.1020.a_drunkard
					}
					#I'll _deface_ it
					triggered_desc = {
						trigger = {
							has_trait = lustful #Distastefully defaced someone else's artifact
						}
						desc = feast_default.1020.a_lustful
					}
					#I'll knock it over
					triggered_desc = {
						trigger = {
							has_character_flag = feast_default_1020_knock_over_artifact
						}
						desc = feast_default.1020.a_knock_over
					}
					#I'll scratch it up good
					triggered_desc = {
						trigger = {
							has_character_flag = feast_default_1020_scratch_up_artifact
						}
						desc = feast_default.1020.a_scratch
					}
				}
			}
		}
		duel = {
			skill = prowess
			value = scope:feast_host.intrigue
			#We defaced it, scot-free!
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 5
				}
				min = 10
				desc = feast_default.1020.a.tt_success
				#Let the player know what's going on
				send_interface_toast = {
					title = feast_default.1020.tt
					left_icon = root
					#A tasty modifier
					add_character_modifier = { 
						modifier = feast_sneakily_defaced_artifact_modifier
						years = 5
					}
				}
			}
			#We were spotted and fined
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -5
				}
				#If the host is clever, make it easier to get caught
				modifier = {
					factor = {
						value = scope:feast_host.intrigue
						divide = {
							value = 10
						}
					}
				}
				desc = feast_default.1020.a.tt_fined
				#Let the player know what's going on
				send_interface_toast = {
					title = feast_default.1020.tt
					left_icon = root
					right_icon = scope:feast_host
					#Pay up
					feast_default_1020_gold_amount_based_on_rarity_effect = yes
					#Opinion loss
					reverse_add_opinion = {
						target = scope:feast_host
						modifier = annoyed_opinion
						opinion = -15
					}
				}	
			}
			#We were spotted and imprisoned :(
			20 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -10
				}
				#If the host is clever, make it easier to get caught
				modifier = {
					factor = {
						value = scope:feast_host.intrigue
						divide = {
							value = 20
						}
					}
				}
				#If the host is prone to anger or strongly dislikes you
				modifier = {
					scope:feast_host = {
						OR = {
							has_trait = vengeful
							has_trait = callous
							has_trait = sadistic
							has_trait = wrathful
							has_trait = irritable
							opinion = {
								target = root
								value < -20
							}
						}
					}
					add = 40
				}
				#Shouldn't really happen if the host likes you
				trigger = {
					scope:feast_host = {
						NOR = {
							has_relation_soulmate = root
							has_relation_lover = root
							has_relation_best_friend = root
							has_relation_friend = root
						}
						opinion = {
							target = root
							value < 0
						}
					}
				}
				desc = feast_default.1020.a.tt_imprisoned
				#Your sadistic feast host imprisons you
				rightfully_imprison_character_less_verbose_effect = { 
					TARGET = root 
					IMPRISONER = scope:feast_host 
				}
				#Let the player know what's going on
				send_interface_toast = {
					title = feast_default.1020.tt
					left_icon = root
					right_icon = scope:feast_host
					#If we're not already rivals
					set_worsened_relation_feast_default_1020_effect = yes
					#Opinion loss
					reverse_add_opinion = {
						target = scope:feast_host
						modifier = angry_opinion
						opinion = -30
					}
				}
			}	
		}	
		#Damage the artifact
		scope:feast_target_artifact = {
			add_durability = {
				value = artifact_max_durability
				multiply = {
					value = {
						integer_range = {
							min = 20
							max = 40
						} 
					}
					multiply = -0.01
				}
			}
		}
		stress_impact = {
			just = minor_stress_impact_gain
			honest = minor_stress_impact_gain
			craven = medium_stress_impact_gain
			paranoid = major_stress_impact_gain
			#We like breaking things
			sadistic = minor_stress_impact_loss
			vengeful = minor_stress_impact_loss
		}
		#People who dislike the host appreciates what you did
		if = {
			#If the list isn't empty
			limit = { 
				any_in_list = {
					list = guests_who_dislike_host
					count > 0
				}
			}
			if = {
				limit = {
					any_in_list = {
						list = guests_who_dislike_host
						count >= 5
					}
				}
				custom_tooltip = feast_default.1020.tt_guests
			}
			else = {
				#For localization
				custom_description = { 
					text = spiteful_guests_liked_defacing 
					object = root
				}
				#To display all applicable guests
				show_as_tooltip = {
					every_in_list = {
						list = guests_who_dislike_host
						save_temporary_scope_as = current_guest
						scope:current_guest = {
							add_opinion = {
								target = root
								modifier = pleased_opinion
								opinion = 20
							}
						}
					}
				}
			}
		}	
	}

	#No I don't want to
	option = {
		name = feast_default.1020.b
		stress_impact = {
			sadistic = minor_stress_impact_gain
			vengeful = minor_stress_impact_gain
		}
	}	

	after = {
		if = {
			limit = { has_character_flag = feast_default_1020_knock_over_artifact }
			remove_character_flag = feast_default_1020_knock_over_artifact
		}
		if = {
			limit = { has_character_flag = feast_default_1020_scratch_up_artifact }
			remove_character_flag = feast_default_1020_scratch_up_artifact
		}
		if = {
			limit = { exists = var:num_unhappy_guests }
			remove_variable = num_unhappy_guests
		}
	}
}

#####################
# One of your acclaimed knights deserves a song
# by Jason Cantalini
#####################

scripted_trigger feast_default_1030_basic_minstrel_trigger = {
	is_adult = yes
	is_healthy = yes
	is_clergy = no
}

scripted_effect feast_default_1030_save_bonus_effect = {
	random_list = {
		10 = {
			modifier = {
				factor = 0
				OR = {
					scope:accolade_1 = {
						acclaimed_knight = {
							has_character_flag = bow_bonus
						}
					}
					scope:accolade_2 = {
						acclaimed_knight = {
							has_character_flag = bow_bonus
						}
					}
					scope:accolade_3 ?= {
						acclaimed_knight = {
							has_character_flag = bow_bonus
						}
					}
				}
			}
			trigger = {
				primary_type = {
					OR = {
						this = accolade_type:crossbowmen_attribute
						this = accolade_type:archer_attribute
						this = accolade_type:horse_archer_attribute
					}
				}
				accolade_owner = { has_trait = tourney_participant }
			}
			acclaimed_knight = {
				add_character_flag = bow_bonus
			}
		}
		10 = {
			modifier = {
				factor = 0
				OR = {
					scope:accolade_1 = {
						acclaimed_knight = {
							has_character_flag = equestrian_bonus
						}
					}
					scope:accolade_2 = {
						acclaimed_knight = {
							has_character_flag = equestrian_bonus
						}
					}
					scope:accolade_3 ?= {
						acclaimed_knight = {
							has_character_flag = equestrian_bonus
						}
					}
				}
			}
			trigger = {
				primary_type = {
					type_has_accolade_category = equestrian
				}
				accolade_owner = { has_trait = tourney_participant }
			}
			acclaimed_knight = {
				add_character_flag = equestrian_bonus
			}
		}
		10 = {
			modifier = {
				factor = 0
				OR = {
					scope:accolade_1 = {
						acclaimed_knight = {
							has_character_flag = subtle_bonus
						}
					}
					scope:accolade_2 = {
						acclaimed_knight = {
							has_character_flag = subtle_bonus
						}
					}
					scope:accolade_3 ?= {
						acclaimed_knight = {
							has_character_flag = subtle_bonus
						}
					}
				}
			}
			trigger = {
				primary_type = {
					type_has_accolade_category = subtle
				}
				accolade_owner = { has_trait = tourney_participant }
			}
			acclaimed_knight = {
				add_character_flag = subtle_bonus
			}
		}
		10 = {
			modifier = {
				factor = 0
				OR = {
					scope:accolade_1 = {
						acclaimed_knight = {
							has_character_flag = champion_bonus
						}
					}
					scope:accolade_2 = {
						acclaimed_knight = {
							has_character_flag = champion_bonus
						}
					}
					scope:accolade_3 ?= {
						acclaimed_knight = {
							has_character_flag = champion_bonus
						}
					}
				}
			}
			trigger = {
				primary_type = {
					type_has_accolade_category = champion
				}
				accolade_owner = { has_trait = tourney_participant }
			}
			acclaimed_knight = {
				add_character_flag = champion_bonus
			}
		}
		10 = {
			modifier = {
				factor = 0
				OR = {
					scope:accolade_1 = {
						acclaimed_knight = {
							has_character_flag = ethical_bonus
						}
					}
					scope:accolade_2 = {
						acclaimed_knight = {
							has_character_flag = ethical_bonus
						}
					}
					scope:accolade_3 ?= {
						acclaimed_knight = {
							has_character_flag = ethical_bonus
						}
					}
				}
			}
			trigger = {
				primary_type = {
					type_has_accolade_category = ethical
				}
			}
			acclaimed_knight = {
				add_character_flag = ethical_bonus
			}
		}
		10 = {
			modifier = {
				factor = 0
				OR = {
					scope:accolade_1 = {
						acclaimed_knight = {
							has_character_flag = leader_bonus
						}
					}
					scope:accolade_2 = {
						acclaimed_knight = {
							has_character_flag = leader_bonus
						}
					}
					scope:accolade_3 ?= {
						acclaimed_knight = {
							has_character_flag = leader_bonus
						}
					}
				}
			}
			trigger = {
				primary_type = {
					type_has_accolade_category = leader
				}
			}
			acclaimed_knight = {
				add_character_flag = leader_bonus
			}
		}
		10 = {
			modifier = {
				factor = 0
				OR = {
					scope:accolade_1 = {
						acclaimed_knight = {
							has_character_flag = aggro_bonus
						}
					}
					scope:accolade_2 = {
						acclaimed_knight = {
							has_character_flag = aggro_bonus
						}
					}
					scope:accolade_3 ?= {
						acclaimed_knight = {
							has_character_flag = aggro_bonus
						}
					}
				}
			}
			trigger = {
				primary_type = {
					OR = {
						type_has_accolade_category = amoral
						type_has_accolade_category = aggressive
					}
				}
			}
			acclaimed_knight = {
				add_character_flag = aggro_bonus
			}
		}
		10 = {
			modifier = {
				factor = 0
				OR = {
					scope:accolade_1 = {
						acclaimed_knight = {
							has_character_flag = noble_bonus
						}
					}
					scope:accolade_2 = {
						acclaimed_knight = {
							has_character_flag = noble_bonus
						}
					}
					scope:accolade_3 ?= {
						acclaimed_knight = {
							has_character_flag = noble_bonus
						}
					}
				}
			}
			trigger = {
				primary_type = {
					OR = {
						type_has_accolade_category = courtly
						type_has_accolade_category = defensive
					}
				}
			}
			acclaimed_knight = {
				add_character_flag = noble_bonus
			}
		}
		10 = {
			modifier = {
				factor = 0
				OR = {
					scope:accolade_1 = {
						acclaimed_knight = {
							has_character_flag = military_bonus
						}
					}
					scope:accolade_2 = {
						acclaimed_knight = {
							has_character_flag = military_bonus
						}
					}
					scope:accolade_3 ?= {
						acclaimed_knight = {
							has_character_flag = military_bonus
						}
					}
				}
			}
			trigger = {
				primary_type = {
					OR = {
						type_has_accolade_category = militant
						type_has_accolade_category = forceful
					}
				}
			}
			acclaimed_knight = {
				add_character_flag = military_bonus
			}
		}
	}
}

scripted_effect feast_default_1030_option_bonuses_effect = {
	if = {
		limit = {
			scope:host ?= {
				culture = {
					OR = {
						has_cultural_parameter = poet_trait_gives_bonuses
						has_cultural_parameter = poet_trait_more_common
						has_cultural_parameter = characters_are_better_court_musicians
						has_cultural_parameter = tells_stories
					}
				}
			}
		}
		add_glory = major_glory_gain
	}
	else = { 
		add_glory = medium_glory_gain
	}
	#accolade type specific bonuses
	if = {
		limit = {
			acclaimed_knight = {
				has_character_flag = bow_bonus
			}
		}
		accolade_owner = {
			add_trait_xp = {
				trait = tourney_participant
				track = bow
				value = 5
			}
		}
	}
	else_if = {
		limit = {
			acclaimed_knight = {
				has_character_flag = equestrian_bonus
			}
		}
		if = {
			limit = {
				accolade_owner = { has_trait = tourney_participant }
			}
			accolade_owner = {
				add_trait_xp = {
					trait = tourney_participant
					track = horse
					value = 5
				}
			}
		}
		else = {
			accolade_owner = {
				add_character_modifier = {
					modifier = riders_of_song_modifier
					years = 10
				}
			}
		}
	}
	else_if = {
		limit = {
			acclaimed_knight = {
				has_character_flag = subtle_bonus
			}
		}
		accolade_owner = {
			add_trait_xp = {
				trait = tourney_participant
				track = wit
				value = 5
			}
		}
	}
	else_if = {
		limit = {
			acclaimed_knight = {
				has_character_flag = champion_bonus
			}
		}
		if = {
			limit = {
				accolade_owner = { has_trait = tourney_participant }
			}
			accolade_owner = {
				add_trait_xp = {
					trait = tourney_participant
					track = foot
					value = 5
				}
			}
		}
		else = {
			accolade_owner = {
				add_character_modifier = {
					modifier = tales_of_knightly_valor_modifier
					years = 10
				}
			}
		}
	}
	else_if = {
		limit = {
			acclaimed_knight = {
				has_character_flag = ethical_bonus
			}
		}
		accolade_owner = {
			add_piety = minor_piety_gain
		}
	}
	else_if = {
		limit = {
			acclaimed_knight = {
				has_character_flag = leader_bonus
			}
		}
		if = {
			limit = {
				accolade_owner = {
					has_lifestyle = martial_lifestyle
				}
			}
			accolade_owner = {
				add_martial_lifestyle_xp = minor_lifestyle_xp
			}
		}
		else = {
			accolade_owner = {
				add_character_modifier = {
					modifier = tales_of_knightly_leadership_modifier
					years = 10
				}
			}
		}
	}
	else_if = {
		limit = {
			acclaimed_knight = {
				has_character_flag = aggro_bonus
			}
		}
		accolade_owner = {
			add_dread = minor_dread_gain
		}
	}
	else_if = {
		limit = {
			acclaimed_knight = {
				has_character_flag = noble_bonus
			}
		}
		scope:activity = {
			every_attending_character = {
				custom = every_guest_scope_tt
				limit = { NOT = { this = root } }
				add_opinion = {
					target = root
					modifier = respect_opinion
					opinion = 5
				}
			}
		}
	}
	else_if = {
		limit = {
			acclaimed_knight = {
				has_character_flag = military_bonus
			}
		}
		accolade_owner = {
			add_character_modifier = {
				modifier = knightly_tales_modifier
				years = 10
			}
		}
	}
}

feast_default.1030 = {
	type = activity_event
	title = feast_default.1030.t
	theme = feast_activity
	desc = {
		desc = feast_default.1030.desc
		random_valid = {
			triggered_desc = {
				trigger = {
					scope:accolade_1 = {
						has_accolade_category = ethical
					}
				}
				desc = feast_default.1030.ethical
			}
			triggered_desc = {
				trigger = {
					scope:accolade_1 = {
						OR = {
							has_accolade_category = amoral
							has_accolade_category = aggressive
						}
					}
				}
				desc = feast_default.1030.amoral
			}
			triggered_desc = {
				trigger = {
					scope:accolade_1 = {
						OR = {
							has_accolade_category = leader
							has_accolade_category = militant
						}
					}
				}
				desc = feast_default.1030.leader
			}
			desc = feast_default.1030.morally_neutral
		}
		random_valid = {
			triggered_desc = {
				trigger = {
					scope:accolade_2 = {
						OR = {
							has_accolade_category = aggressive
							has_accolade_category = equestrian
						}
					}
				}
				desc = feast_default.1030.aggressive
			}
			triggered_desc = {
				trigger = {
					scope:accolade_2 = {
						OR = {
							has_accolade_category = defensive
							has_accolade_category = champion
						}
					}
				}
				desc = feast_default.1030.defensive
			}
			triggered_desc = {
				trigger = {
					scope:accolade_2 = {
						OR = {
							has_accolade_category = champion
							has_accolade_category = amoral
						}
					}
				}
				desc = feast_default.1030.champion
			}
			desc = feast_default.1030.stance_neutral
		}
		random_valid = {
			triggered_desc = {
				trigger = {
					scope:accolade_3 ?= {
						OR = {
							has_accolade_category = subtle
							has_accolade_category = courtly
						}
					}
				}
				desc = feast_default.1030.subtle
			}
			triggered_desc = {
				trigger = {
					scope:accolade_3 ?= {
						OR = {
							has_accolade_category = forceful
							has_accolade_category = defensive
						}
					}
				}
				desc = feast_default.1030.forceful
			}
			triggered_desc = {
				trigger = {
					scope:accolade_3 ?= {
						has_accolade_category = equestrian
					}
				}
				desc = feast_default.1030.equestrian
			}
			triggered_desc = {
				trigger = {
					 exists = scope:accolade_3
				}
				desc = feast_default.1030.intensity_neutral
			}
		}
		random_valid = {
			triggered_desc = {
				trigger = {
					scope:accolade_4 ?= {
						OR = {
							has_accolade_category = courtly
							has_accolade_category = ethical
						}
					}
				}
				desc = feast_default.1030.courtly
			}
			triggered_desc = {
				trigger = {
					scope:accolade_4 ?= {
						OR = {
							has_accolade_category = militant
							has_accolade_category = forceful
						}
					}
				}
				desc = feast_default.1030.militant
			}
			triggered_desc = {
				trigger = {
					exists = scope:accolade_4
				}
				desc = feast_default.1030.fighty_neutral
			}
		}
		desc = feast_default.1030.wrap_up
	}
	theme = feast_activity
	left_portrait = {
		character = root
		animation = throne_room_conversation_4
	}

	right_portrait = {
		character = scope:minstrel
		animation = sword_coup_degrace
	}

	lower_left_portrait = scope:knight_1
	lower_center_portrait = scope:knight_2

	lower_right_portrait = {
		trigger = { exists = scope:knight_3 }
		character = scope:knight_3
	}
	
	trigger = {
		has_dlc_feature = accolades
		NOT = { exists = local_var:had_1030 }
		any_pool_character = {
			province = root.location
			feast_default_1030_basic_minstrel_trigger = yes
		}
		any_active_accolade = {
			count >= 2
			exists = acclaimed_knight
		}
		age > 5
	}
	#More likely if we're potential rival, rivals or nemesis
	weight_multiplier = {
		base = 1	
		modifier = { 
			culture = {
				OR = {
					has_cultural_parameter = poet_trait_gives_bonuses
					has_cultural_parameter = poet_trait_more_common
					has_cultural_parameter = martial_education_more_valued
					has_cultural_parameter = characters_are_better_court_musicians
					has_cultural_parameter = tells_stories
					has_cultural_parameter = strong_traits_more_valued
					has_cultural_tradition = tradition_chivalry
				}
			}
			factor = 2
		}
		modifier = { 
			culture = {
				OR = {
					has_cultural_pillar = ethos_bellicose
					has_cultural_pillar = ethos_stoic
					has_cultural_pillar = ethos_courtly
				}
			}
			factor = 1.5
		}
		modifier = {
			NOT = {
				any_active_accolade = {
					acclaimed_knight = {
						opinion = {
							target = root
							value > 0
						}
					}
				}
			}
			factor = 0.5
		}
	}

	immediate = {
		set_local_variable = {
			name = had_1030
			value = yes
		}
		# try to get an appropriate minstrel
		if = {
			limit = {
				scope:activity = {
					any_attending_character = {
						OR = {
							has_court_position = court_musician_court_position
							has_court_position = court_poet_court_position
						}
						feast_default_1030_basic_minstrel_trigger = yes
					}
				}
			}
			scope:activity = {
				random_attending_character = {
					limit = {
						OR = {
							has_court_position = court_musician_court_position
							has_court_position = court_poet_court_position
						}
						feast_default_1030_basic_minstrel_trigger = yes
					}
					save_scope_as = minstrel
				}
			}
		}
		else_if = {
			limit = {
				scope:activity = {
					any_attending_character = {
						OR = {
							has_trait = poet
							AND = {
								has_trait = tourney_participant
								has_trait_xp = {
									trait = tourney_participant
									track = wit
									value >= 50
								}
							}
						}
						feast_default_1030_basic_minstrel_trigger = yes
					}
				}
			}
			scope:activity = {
				random_attending_character = {
					limit = {
						OR = {
							has_trait = poet
							AND = {
								has_trait = tourney_participant
								has_trait_xp = {
									trait = tourney_participant
									track = wit
									value >= 50
								}
							}
						}
						feast_default_1030_basic_minstrel_trigger = yes
					}
					save_scope_as = minstrel
				}
			}
		}
		else_if = {
			limit = {
				any_pool_character = {
					province = root.location
					OR = {
						has_trait = poet
						AND = {
							has_trait = tourney_participant
							has_trait_xp = {
								trait = tourney_participant
								track = wit
								value >= 50
							}
						}
					}
					feast_default_1030_basic_minstrel_trigger = yes
					}
				}
			random_pool_character = {
				province = root.location
				limit = {
					OR = {
						has_trait = poet
						AND = {
							has_trait = tourney_participant
							has_trait_xp = {
								trait = tourney_participant
								track = wit
								value >= 50
							}
						}
					}
					feast_default_1030_basic_minstrel_trigger = yes
				}
				save_scope_as = minstrel
			}
		}
		else_if = {
			limit = {
				scope:activity = {
					any_attending_character = {
						feast_default_1030_basic_minstrel_trigger = yes
						is_landed = no
						NOT = {
							has_trait = shy

						}
					}
				}
			}
			scope:activity = {
				random_attending_character = {
					limit = {
						is_landed = no
						feast_default_1030_basic_minstrel_trigger = yes
						NOT = {
							has_trait = shy
						}
					}
					save_scope_as = minstrel
				}
			}
		}
		else = {
			random_pool_character = {
				province = root.location
				limit = {
					feast_default_1030_basic_minstrel_trigger = yes
				}
				save_scope_as = minstrel
			}
		}
		#get the first acclaimed knight
		if = {
			limit = {
				any_active_accolade = {
					exists = acclaimed_knight
					exists = accolade_rank
					accolade_rank < 6
				}
			}
			random_active_accolade = {
				limit = {
					exists = acclaimed_knight
					exists = accolade_rank
					accolade_rank < 6
				}
				save_scope_as = accolade_1
				acclaimed_knight = {
					save_scope_as = knight_1
				}
			}
		}
		else = {
			random_active_accolade = {
				limit = {
					exists = acclaimed_knight
				}
				save_scope_as = accolade_1
				acclaimed_knight = {
					save_scope_as = knight_1
				}
			}
		}
		#get the second knight
		if = {
			limit = {
				any_active_accolade = {
					exists = acclaimed_knight
					exists = accolade_rank
					accolade_rank < 6
					NOT = { this = scope:accolade_1 }
				}
			}
			random_active_accolade = {
				limit = {
					exists = acclaimed_knight
					exists = accolade_rank
					accolade_rank < 6
					NOT = { this = scope:accolade_1 }
				}
				save_scope_as = accolade_2
				acclaimed_knight = {
					save_scope_as = knight_2
				}
			}
		}
		else = {
			random_active_accolade = {
				limit = {
					exists = acclaimed_knight
					NOT = { this = scope:accolade_1 }
				}
				save_scope_as = accolade_2
				acclaimed_knight = {
					save_scope_as = knight_2
				}
			}
		}
		#get the third, if there is one
		if = {
			limit = {
				any_active_accolade = {
					exists = acclaimed_knight
					NOR = {
						this = scope:accolade_1
						this = scope:accolade_2
					}
				}
			}
			random_active_accolade = {
				limit = {
					exists = acclaimed_knight
					NOR = {
						this = scope:accolade_1
						this = scope:accolade_2
					}
				}
				save_scope_as = accolade_3
				acclaimed_knight = {
					save_scope_as = knight_3
				}
			}
		}
		#get a fourth, if there is one
		if = {
			limit = {
				any_active_accolade = {
					exists = acclaimed_knight
					NOR = {
						this = scope:accolade_1
						this = scope:accolade_2
						this = scope:accolade_3
					}
				}
			}
			random_active_accolade = {
				limit = {
					exists = acclaimed_knight
					NOR = {
						this = scope:accolade_1
						this = scope:accolade_2
						this = scope:accolade_3
					}
				}
				save_scope_as = accolade_4
				acclaimed_knight = {
					save_scope_as = knight_4
				}
			}
		}
		#save the bonuses chosen for each accolade
		scope:accolade_1 = {
			feast_default_1030_save_bonus_effect = yes
		}
		scope:accolade_2 = {
			feast_default_1030_save_bonus_effect = yes
		}
		scope:accolade_3 ?= {
			feast_default_1030_save_bonus_effect = yes
		}
		scope:accolade_4 ?= {
			feast_default_1030_save_bonus_effect = yes
		}

	}

	#First acclaimed knight
	option = {
		name = feast_default.1030.a
		flavor = feast_default.1030.a.tt
		scope:accolade_1 = {
			feast_default_1030_option_bonuses_effect = yes
		}
		if = {
			limit = {
				has_dlc_feature = legends
				NOT = { has_game_rule = historical_legends_only }
			}
			random = {
				chance = 5
				create_legend_seed = {
					type = heroic
					quality = famed
					chronicle = accolade_chronicle
					properties = {
						founder = root
						first_accolade = scope:accolade_1
						first_accolade_knight = scope:knight_1
					}
				}
			}
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				add = -75
				opinion = {
					target = scope:knight_1
					value < -20
				}
			}
			modifier = {
				add = 50
				opinion = {
					target = scope:knight_1
					value >= 50
				}
			}
			modifier = {
				factor = 3
				scope:accolade_1 = {
					accolade_rank > 3
				}
			}
		}
	}
	#Second acclaimed knight
	option = {
		name = feast_default.1030.b
		flavor = feast_default.1030.b.tt
		scope:accolade_2 = {
			feast_default_1030_option_bonuses_effect = yes
		}
		if = {
			limit = {
				has_dlc_feature = legends
				NOT = { has_game_rule = historical_legends_only }
			}
			random = {
				chance = 5
				create_legend_seed = {
					type = heroic
					quality = famed
					chronicle = accolade_chronicle
					properties = {
						founder = root
						first_accolade = scope:accolade_2
						first_accolade_knight = scope:knight_2
					}
				}
			}
		}

		ai_chance = {
			base = 100
			
			modifier = {
				add = -75
				opinion = {
					target = scope:knight_2
					value < -20
				}
			}
			modifier = {
				add = 50
				opinion = {
					target = scope:knight_2
					value >= 50
				}
			}
			modifier = {
				factor = 3
				scope:accolade_2 = {
					accolade_rank > 3
				}
			}
		}
	}
	#Third acclaimed knight
	option = {
		trigger = {
			exists = scope:knight_3
		}
		name = feast_default.1030.c
		flavor = feast_default.1030.c.tt
		scope:accolade_3 = {
			feast_default_1030_option_bonuses_effect = yes
		}
		if = {
			limit = {
				has_dlc_feature = legends
				NOT = { has_game_rule = historical_legends_only }
			}
			random = {
				chance = 5
				create_legend_seed = {
					type = heroic
					quality = famed
					chronicle = accolade_chronicle
					properties = {
						founder = root
						first_accolade = scope:accolade_3
						first_accolade_knight = scope:knight_3
					}
				}
			}
		}

		ai_chance = {
			base = 100
			
			modifier = {
				add = -75
				opinion = {
					target = scope:knight_3
					value < -20
				}
			}

			modifier = {
				add = 50
				opinion = {
					target = scope:knight_3
					value >= 50
				}
			}
			modifier = {
				factor = 3
				scope:accolade_3 = {
					accolade_rank > 3
				}
			}
		}
	}
	#Fourth acclaimed knight
	option = {
		trigger = {
			exists = scope:knight_4
		}
		name = feast_default.1030.d
		flavor = feast_default.1030.d.tt
		scope:accolade_4 = {
			feast_default_1030_option_bonuses_effect = yes
		}
		if = {
			limit = {
				has_dlc_feature = legends
				NOT = { has_game_rule = historical_legends_only }
			}
			random = {
				chance = 5
				create_legend_seed = {
					type = heroic
					quality = famed
					chronicle = accolade_chronicle
					properties = {
						founder = root
						first_accolade = scope:accolade_4
						first_accolade_knight = scope:knight_4
					}
				}
			}
		}

		ai_chance = {
			base = 100
			
			modifier = {
				add = -75
				opinion = {
					target = scope:knight_4
					value < -20
				}
			}
			modifier = {
				add = 50
				opinion = {
					target = scope:knight_4
					value >= 50
				}
			}
			modifier = {
				factor = 3
				scope:accolade_4 = {
					accolade_rank > 3
				}
			}
		}
	}
}


#################################
# "TARGET" TRIGGERED EVENTS
# 2000-2999
#################################

#####################
# Glutton gets annoyed waiting for food
# by Petter Vilberg
#####################
scripted_trigger feast_default_2001_annoying_glutton_trigger = {
	feast_default_participant_trigger = yes
	has_trait = gluttonous
	NOT = {
		reverse_has_opinion_modifier = {
			target = root
			modifier = annoying_glutton_at_feast_opinion
		}
	}
}

feast_default.2001 = {
	type = activity_event
	title = feast_default.2001.t
	desc = feast_default.2001.desc
	theme = feast_activity
	left_portrait = {
		character = scope:activity.activity_host
		animation = worry
	}
	right_portrait = {
		character = scope:glutton
		animation = anger
	}
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { exists = local_var:had_2001 }
		NOT = { has_trait = gluttonous }
		NOT = { this = scope:host }
		scope:activity = {
			any_attending_character = {
				feast_default_2001_annoying_glutton_trigger = yes
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			scope:activity = {
				any_attending_character = {
					feast_default_2001_annoying_glutton_trigger = yes
					OR = {
						has_trait = wrathful
						has_trait = impatient
					}
					NOT = {
						reverse_has_opinion_modifier = {
							target = root
							modifier = annoying_glutton_at_feast_opinion
						}
					}
				}
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_2001
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_2001_annoying_glutton_trigger = yes
					OR = {
						has_trait = wrathful
						has_trait = impatient
					}
				}
				alternative_limit = {
					feast_default_2001_annoying_glutton_trigger = yes
				}
				save_scope_as = glutton
			}
		}
	}

	option = { #They are making a fool of themselves
		name = feast_default.2001.a
		ai_chance = {
			base = 90
		}
		add_character_modifier = {
			modifier = i_am_corteous_guest_modifier
			years = 5
		}
		stress_impact = {
			impatient = minor_stress_impact_gain
			gluttonous = minor_stress_impact_gain
		}
		hidden_effect = {
			add_opinion = {
				target = scope:glutton
				modifier = annoying_glutton_at_feast_opinion
			}
		}
	}

	option = { # Yeah, where's the food?!
		name = feast_default.2001.b
		stress_impact = {
			base = medium_stress_loss
			comfort_eater = minor_stress_impact_loss
			temperate = minor_stress_impact_gain
			patient = minor_stress_impact_gain
		}
		hidden_effect = {
			add_opinion = {
				target = scope:activity.activity_host
				modifier = disorganized_feast_opinion
			}
		}
		ai_chance = {
			base = 10
			modifier = {
				add = 200
				has_trait = gluttonous
			}
			modifier = {
				add = 100
				stress >= high_medium_stress
			}
		}
	}
}


#####################
# Someone sends you a secret love letter
# by Petter Vilberg
#####################
scripted_trigger feast_default_2002_letter_author_trigger = {
	feast_default_participant_trigger = yes
	is_adult = yes
	OR = {
		AND = {
			has_activity_intent = woo_attendee_intent
			intent_target ?= {
				is_alive = yes
				this = root
			}
		}
		has_relation_crush = root
		has_relation_potential_lover = root
	}
}

scripted_trigger feast_default_2002_potentially_interested_trigger = {
	is_adult = yes
	is_ai = yes
	NOT = { this = root }
	possibly_interested_in_character_trigger = {
		CHARACTER = root
	}
}

feast_default.2002 = {
	type = activity_event
	title = feast_default.2002.t
	desc = feast_default.2002.desc
	theme = feast_activity
	left_portrait = {
		character = scope:crush_1
		animation = flirtation_left
	}
	right_portrait = {
		character = scope:crush_2
		animation = admiration
	}
	lower_center_portrait = scope:crush_3
	cooldown = { years = 2 }
	
	trigger = {
		is_ai = no
		NOT = { exists = local_var:had_2002 }
		scope:activity = {
			any_attending_character = {
				feast_default_2002_letter_author_trigger = yes
				save_temporary_scope_as = crush_check
			}
			any_attending_character = {
				count >= 2
				NOT = { this = scope:crush_check }
				feast_default_2002_potentially_interested_trigger = yes
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 2
			has_focus_or_focus_trait_trigger = { FOCUS = intrigue_temptation_focus }
		}
		modifier = {
			add = 1
			scope:activity = {
				any_attending_character = {
					feast_default_2002_letter_author_trigger = yes
					has_focus_or_focus_trait_trigger = { FOCUS = intrigue_temptation_focus }
				}
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_2002
			value = yes
		}
		hidden_effect = {
			scope:activity = {
				random_attending_character = {
					limit = {
						feast_default_2002_letter_author_trigger = yes
					}
					save_scope_as = letterAuthor
					love_letter_calculation_effect = yes
					add_to_list = letter_candidates
				}
				random_attending_character = {
					limit = {
						feast_default_2002_potentially_interested_trigger = yes
						NOT = { is_in_list = letter_candidates }
					}
					add_to_list = letter_candidates
				}
				random_attending_character = {
					limit = {
						feast_default_2002_potentially_interested_trigger = yes
						NOT = { is_in_list = letter_candidates }
					}
					add_to_list = letter_candidates
				}
				every_in_list = {
					list = letter_candidates
					random_list = {
						1 = {
							trigger = { NOT = { exists = scope:crush_1 } }
							save_scope_as = crush_1
						}
						1 = {
							trigger = { NOT = { exists = scope:crush_2 } }
							save_scope_as = crush_2
						}
						1 = {
							trigger = { NOT = { exists = scope:crush_3 } }
							save_scope_as = crush_3
						}
					}
				}
			}
			save_scope_as = letterRecipient # Saved for letter effects
		}
	}

	option = { #It must have been crush_1!
		name = feast_default.2002.a
		reverse_add_opinion = {
			target = scope:crush_1
			modifier = offered_attention_at_feast_opinion
		}
		custom_tooltip = feast_default.2002.potential_lover_tt
		hidden_effect = {
			add_opinion = {
				target = scope:crush_1
				modifier = wrote_love_letter_at_feast_opinion
			}
			if = {
				limit = { scope:crush_1 = scope:letterAuthor }
				progress_towards_lover_effect = {
					CHARACTER = scope:crush_1
					REASON = lover_feast_crush
					OPINION = 0
				}
			}
		}
	}

	option = { #Maybe it was crush_2?
		name = feast_default.2002.b
		reverse_add_opinion = {
			target = scope:crush_2
			modifier = offered_attention_at_feast_opinion
		}
		custom_tooltip = feast_default.2002.potential_lover_tt
		hidden_effect = {
			add_opinion = {
				target = scope:crush_2
				modifier = wrote_love_letter_at_feast_opinion
			}
			if = {
				limit = { scope:crush_2 = scope:letterAuthor }
				progress_towards_lover_effect = {
					CHARACTER = scope:crush_2
					REASON = lover_feast_crush
					OPINION = 0
				}
			}
		}
	}
	
	option = { #Definitely crush_3
		name = feast_default.2002.c
		reverse_add_opinion = {
			target = scope:crush_3
			modifier = offered_attention_at_feast_opinion
		}
		custom_tooltip = feast_default.2002.potential_lover_tt
		hidden_effect = {
			add_opinion = {
				target = scope:crush_3
				modifier = wrote_love_letter_at_feast_opinion
			}
			if = {
				limit = { scope:crush_3 = scope:letterAuthor }
				progress_towards_lover_effect = {
					CHARACTER = scope:crush_3
					REASON = lover_feast_crush
					OPINION = 0
				}
			}
		}
	}
}


#####################
# You really enjoy the company of someone you have a lot in common with
# by Petter Vilberg
#####################
scripted_trigger feast_default_2003_potential_friend_trigger = {
	feast_default_participant_trigger = yes
	NOT = {
		is_close_family_trigger = {
			CHARACTER = root
		}
	}
	NOT = { has_relation_friend = root }
	OR = { #Either I am trying to befriend them, or them me.
		number_of_traits_in_common = {
			target = root
			value >= 1
		}
		AND = {
			has_activity_intent = befriend_attendee_intent
			intent_target ?= {
				is_alive = yes
				this = root
			}
		}
		root = {
			has_activity_intent = befriend_attendee_intent
			intent_target ?= prev
		}
	}
}

feast_default.2003 = {
	type = activity_event
	title = feast_default.2003.t
	desc = feast_default.2003.desc
	theme = feast_activity
	left_portrait = {
		character = scope:other_guest
		animation = happiness
	}
	right_portrait = {
		character = root
		animation = admiration
	}
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { exists = local_var:had_2003 }
		scope:activity = {
			any_attending_character = {
				feast_default_2003_potential_friend_trigger = yes
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_2003
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_2003_potential_friend_trigger = yes
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						number_of_traits_in_common = {
							target = root
							value >= 2
						}
					}
					modifier = {
						add = 2
						number_of_traits_in_common = {
							target = root
							value >= 3
						}
					}
					modifier = {
						add = 2
						number_of_traits_in_common = {
							target = root
							value >= 4
						}
					}
					modifier = {
						add = 5
						has_relation_potential_friend = root
					}
					modifier = {
						add = 10
						is_of_major_interest_to_root_trigger = yes
					}
					modifier = {
						add = 20
						is_of_major_interest_to_root_trigger = yes
					}
				}
				save_scope_as = other_guest
			}
		}
	}

	option = {
		name = feast_default.2003.a
		reverse_add_opinion = {
			target = scope:other_guest
			modifier = feast_had_good_time_together_opinion
		}
		scope:activity.activity_location = { save_scope_as = relationship_reason_province }
		progress_towards_friend_effect = {
			REASON = friend_had_a_great_feast_together
			CHARACTER = scope:other_guest
			OPINION = 0
		}
		clear_saved_scope = relationship_reason_province
		hidden_effect = {
			add_opinion = {
				target = scope:other_guest
				modifier = feast_had_good_time_together_opinion
			}
		}
	}	
}


#####################
# Someone throws up on you
# by Petter Vilberg
#####################
scripted_trigger feast_default_2005_drunk_trigger = {
	feast_default_participant_trigger = yes
	OR = {
		NOT = { has_trait = temperate }
		has_trait = drunkard
	}
}

feast_default.2005 = {
	type = activity_event
	title = feast_default.2005.t
	desc = feast_default.2005.desc
	theme = feast_activity
	center_portrait = {
		character = scope:drunk
		animation = wedding_drunk
	}
	right_portrait = {
		character = root
		animation = disgust
	}
	cooldown = { years = 2 }
	
	trigger = {
		NOT = { exists = local_var:had_2005 }
		scope:activity = {
			any_attending_character = {
				feast_default_2005_drunk_trigger = yes
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_2005
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_2005_drunk_trigger = yes
				}
				weight = {
					base = 1
					modifier = {
						add = 30
						has_trait = drunkard
					}
					modifier = {
						add = 100
						root = {
							has_relation_oaf = prev
						}
					}
					modifier = {
						add = 40
						is_of_major_interest_to_root_trigger = yes
					}
					modifier = {
						add = 20
						is_of_minor_interest_to_root_trigger = yes
					}
					modifier = { # Reduce the chance of it being someone you might be forced to respect
						factor = 0.2
						highest_held_title_tier > root.highest_held_title_tier
					}
				}
				save_scope_as = drunk
			}
		}
		hidden_effect = {
			set_as_oaf_effect = {
				CHARACTER = scope:drunk
			}
		}
	}

	option = { #What shameful behavior!
		name = feast_default.2005.a
		if = {
			limit = { NOT = { has_trait = arbitrary } }
			stress_impact = {
				drunkard = minor_stress_impact_gain
				humble = minor_stress_impact_gain
				craven = minor_stress_impact_gain
				shy = minor_stress_impact_gain
				forgiving = medium_stress_impact_gain
				lifestyle_reveler = medium_stress_gain
			}
		}
		add_character_modifier = {
			modifier = feast_higher_standards_modifier
			years = 5
		}
		scope:drunk = {
			add_opinion = {
				target = root
				opinion = -10
				modifier = angry_opinion
			}
		}
		hidden_effect = {
			add_opinion = {
				target = scope:drunk
				modifier = feast_threw_up_on_me_opinion
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_rationality = 0.5
				ai_honor = 1
			}
			modifier = {
				OR = {
					has_trait = forgiving
					has_trait = lifestyle_reveler
				}
				factor = 0
			}
		}
	}

	option = { #What's a little vomit among friends
		name = feast_default.2005.b
		if = {
			limit = { NOT = { has_trait = arbitrary } }
			stress_impact = {
				base = minor_stress_impact_gain
				temperate = medium_stress_impact_gain
				diligent = minor_stress_impact_gain
				vengeful = medium_stress_impact_gain
				arrogant = minor_stress_impact_gain
				gregarious = minor_stress_impact_gain
			}
		}
		add_prestige = minor_prestige_loss
		scope:drunk = {
			add_opinion = {
				target = root
				modifier = kindness_opinion
				opinion = 30
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = -1
				ai_compassion = 0.25
			}
			modifier = {
				OR = {
					has_trait = vengeful
					has_trait = temperate
				}
				factor = 0
			}
			modifier = {
				prestige <= minor_prestige_value
				factor = 0
			}
		}
	}
}


#####################
# Someone has a befriend/seduce scheme against you
# by Linnéa Thimrén
#####################

scripted_trigger feast_default_2006_trigger = {
	feast_default_participant_trigger = yes
	NOT = { has_trait = gregarious }
	OR = {
		AND = {
			has_activity_intent = befriend_attendee_intent
			intent_target ?= root
		}
		AND = {
			has_activity_intent = woo_attendee_intent
			intent_target ?= root
		}
	}
}

feast_default.2006 = {
	type = activity_event
	title = feast_default.2006.t
	desc = feast_default.2006.desc
	theme = feast_activity
	left_portrait = {
		character = scope:befriending_guest
		animation = personality_compassionate
	}
	right_portrait = {
		character = root
		animation = admiration
	}
	cooldown = { years = 1 }

	trigger = {
		NOT = { exists = local_var:had_2006 }
		scope:activity = {
			any_attending_character = {
				feast_default_2006_trigger = yes
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_2006
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_2006_trigger = yes
				}
				save_scope_as = befriending_guest
			}
		}
	}

	option = { #Humor them
		name = feast_default.2006.a
		trigger = {
			scope:befriending_guest = {
				has_activity_intent = befriend_attendee_intent
				intent_target ?= root
			}
		}
		add_opinion = {
			modifier = friendly_interaction
			target = scope:befriending_guest
		}
		scope:befriending_guest = {
			progress_towards_friend_effect = {
				REASON = friend_showed_personal_interest
				CHARACTER = root
				OPINION = 20
			}
		}
		stress_impact = {
			arrogant = medium_stress_impact_gain
			shy = medium_stress_impact_gain
			callous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 40
				OR = {
					has_trait = gregarious
					has_trait = compassionate
				}
			}
		}
	}

	option = { #Humor them
		name = feast_default.2006.b
		trigger = {
			scope:befriending_guest = {
				has_activity_intent = woo_attendee_intent
				intent_target ?= root
			}
		}
		scope:befriending_guest = {
			progress_towards_lover_effect = {
				CHARACTER = root
				REASON = seduced_at_feast
				OPINION = default_lover_opinion
			}
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 40
				OR = {
					has_trait = gregarious
					has_trait = compassionate
					has_trait = lustful
				}
			}
		}
	}

	option = { #Discourage them
		name = feast_default.2006.c
		trigger = {
			OR = {
				diplomacy >= high_skill_rating
			}
		}
		skill = diplomacy

		add_prestige = medium_prestige_gain
		scope:befriending_guest = {
			add_opinion = {
				modifier = humiliated_opinion
				target = root
				opinion = -10
			}
		}
		stress_impact = {
			reclusive = medium_stress_impact_loss
			craven = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 40
				has_trait = arrogant
			}
		}
	}

	option = { #Discourage them
		name = feast_default.2006.d
		add_prestige = minor_prestige_gain
		scope:befriending_guest = {
			add_opinion = {
				modifier = rude_opinion
				target = root
			}
		}
		stress_impact = {
			reclusive = medium_stress_impact_loss
			craven = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 40
				OR = {
					has_trait = shy
					has_trait = humble
					has_trait = reclusive
				}
			}
			modifier = {
				add = 75
				has_trait = celibate
			}
		}
	}
}


#####################
# Two ai lovers are exposed
# by Linnéa Thimrén
#####################

scripted_trigger feast_default_2007_lover_basic_trigger = {
	feast_default_participant_trigger = yes
	NOT = { is_spouse_of = root	}
	NOR = {
		has_trait = celibate
		has_trait = chaste
	}
	basic_is_available_ai = yes
	might_cheat_on_every_partner_trigger = yes
}


feast_default.2007 = {
	type = activity_event
	title = feast_default.2007.t
	desc = feast_default.2007.desc
	theme = feast_activity
	center_portrait = {
		character = scope:lover_guest_1
		animation = fear
		camera = camera_event_very_right
	}
	right_portrait = {
		character = scope:lover_guest_2
		animation = shock
		camera = camera_event_center
	}
	theme = seduction
	override_background = {
		reference = bedchamber
	}
	cooldown = { years = 2 }

	trigger = {
		is_ai = no # Player only, otherwise they'll just be sending secret discovery notifications out of nowhere
		NOT = { exists = scope:activity.var:had_2007 }
		scope:activity = {
			any_attending_character = {
				feast_default_2007_lover_basic_trigger = yes
				save_temporary_scope_as = lover_check
				scope:activity = {
					any_attending_character = {
						NOR = {
							this = scope:lover_check
							is_consort_of = scope:lover_check
						}
						feast_default_2007_lover_basic_trigger = yes
						OR = { #Can they become lovers, or are they lovers already?
							AND = {
								can_set_relation_lover_trigger = { CHARACTER = scope:lover_check }
								NOT = { any_close_family_member = { this = scope:lover_check } } #No incest if it's not already set as a secret!
							}
							any_secret = {
								secret_type = secret_lover
								secret_target = scope:lover_check
							}
						}
					}
				}
			}
		}
	}

	weight_multiplier = {
		base = 0.5
		modifier = {
			add = 0.75
			scope:activity = {
				any_attending_character = {
					feast_default_2007_lover_basic_trigger = yes
					any_secret = {
						secret_type = secret_lover
						secret_target = {
							feast_default_2007_lover_basic_trigger = yes
							save_temporary_scope_as = lover_check
							scope:activity = { any_attending_character = { this = scope:lover_check } }
						}
					}
				}
			}
		}
	}

	immediate = {
		scope:activity = {
			set_variable = {
				name = had_2007
				value = yes
			}
			random_attending_character = {
				limit = {
					feast_default_2007_lover_basic_trigger = yes
					save_temporary_scope_as = lover_check
					scope:activity = {
						any_attending_character = {
							NOR = {
								this = scope:lover_check
								is_consort_of = scope:lover_check
							}
							feast_default_2007_lover_basic_trigger = yes
							OR = { #Can they become lovers, or are they lovers already?
								AND = {
									can_set_relation_lover_trigger = { CHARACTER = scope:lover_check }
									NOT = { any_close_family_member = { this = scope:lover_check } } #No incest if it's not already set as a secret!
								}
								any_secret = {
									secret_type = secret_lover
									secret_target = scope:lover_check
								}
							}
						}
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						has_trait = lustful
					}
					modifier = {
						add = 10
						any_secret = {
							secret_type = secret_lover
							secret_target = {
								feast_default_2007_lover_basic_trigger = yes
								save_temporary_scope_as = lover_check
								scope:activity = { any_attending_character = { this = scope:lover_check } }
							}
						}
					}
				}
				save_scope_as = lover_guest_1
			}
			random_attending_character = {
				limit = {
					NOR = {
						this = scope:lover_guest_1
						is_consort_of = scope:lover_guest_1
					}
					feast_default_2007_lover_basic_trigger = yes
					any_secret = {
						secret_type = secret_lover
						secret_target = scope:lover_guest_1
					}
				}
				alternative_limit = {
					NOR = {
						this = scope:lover_guest_1
						is_consort_of = scope:lover_guest_1
					}
					feast_default_2007_lover_basic_trigger = yes
					can_set_relation_lover_trigger = { CHARACTER = scope:lover_guest_1 }
					NOT = { any_close_family_member = { this = scope:lover_check } } #No incest if it's not already set as a secret!
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						has_trait = lustful
					}
				}
				save_scope_as = lover_guest_2

				#Set their secret and expose it
				hidden_effect = {
					if = {
						limit = {
							can_set_relation_lover_trigger = { CHARACTER = scope:lover_guest_1 }
						}
						set_relation_lover = { reason = lover_feast_tumble target = scope:lover_guest_1 involved_character = root province = scope:activity.activity_location }
					}
				}
				random_secret = {
					limit = {
						secret_type = secret_lover
						secret_target = scope:lover_guest_1
					}
					save_scope_as = lover_secret

					expose_secret = root
				}
			}
		}
		scope:lover_guest_1 = {
			add_character_flag = {
				flag = is_naked
				days = 30
			}
		}
		scope:lover_guest_2 = {
			add_character_flag = {
				flag = is_naked
				days = 30
			}
		}
	}

	option = {
		name = feast_default.2007.a_chaste
		trigger = {
			has_trait = chaste
		}
		trait = chaste
		stress_impact = {
			chaste = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = feast_default.2007.a_lustful
		trigger = {
			has_trait = lustful
		}
		trait = lustful
		stress_impact = {
			lustful = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = feast_default.2007.a_sadistic
		trigger = {
			has_trait = sadistic
		}
		trait = sadistic
		stress_impact = {
			sadistic = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = feast_default.2007.a_compassionate
		trigger = {
			has_trait = compassionate
		}
		trait = compassionate
		stress_impact = {
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = feast_default.2007.b
		trigger = { always = no }
		fallback = yes
	}
	after = {
		scope:lover_guest_1 = {
			remove_character_flag = is_naked
		}
		scope:lover_guest_2 = {
			remove_character_flag = is_naked
		}
	}
}


#####################
# Lustful Homosexual character gets inappropriate with a servant
# by Petter Vilberg
#####################
scripted_trigger feast_default_2008_homosexual_trigger = {
	feast_default_participant_trigger = yes
	has_trait = lustful
	is_adult = yes
	any_secret = {
		secret_type = secret_homosexual
		NOT = { is_known_by = root }
		is_blackmailable_secret_trigger = {
			PARTICIPANT = prev
			BLACKMAILER = root
		}
	}
	root = {
		can_add_hook = {
			type = favor_hook
			target = prev
		}
	}
	might_cheat_on_every_partner_trigger = yes
}


feast_default.2008 = {
	type = activity_event
	title = feast_default.2008.t
	desc = feast_default.2008.desc
	theme = feast_activity
	left_portrait = {
		character = scope:homosexual_character
		animation = shame
	}
	cooldown = { years = 2 }
	
	trigger = {
		NOT = { exists = local_var:had_2008 }
		scope:activity = {
			any_attending_character = {
				feast_default_2008_homosexual_trigger = yes
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_2008
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_2008_homosexual_trigger = yes
				}
				save_scope_as = homosexual_character
				romance_target_gender_effect = { SCOPE_NAME = romance_target }
				random_secret = {
					limit = {
						secret_type = secret_homosexual
						NOT = { is_known_by = root }
					}
					save_scope_as = secret
					reveal_to_without_events_effect = {
						CHARACTER = root
					}
				}
			}
		}
	}

	option = { #What a shameful display!
		name = feast_default.2008.a
		scope:secret = {
			expose_secret = root
		}
		stress_impact = {
			forgiving = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
				ai_boldness = 1
			}
		}
	}

	option = { #Your secret is safe with me
		name = feast_default.2008.b
		blackmail_target_with_secret_effect = {
			SECRET = scope:secret
			TARGET = scope:homosexual_character
		}
		stress_impact = {
			honest = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
				ai_rationality = 1
			}
		}
	}
	
	option = { #You're doing WHAT without my approval???
		name = feast_default.2008.c
		trigger = {
			has_trait = vengeful
			this = root
		}
		trait = vengeful
		add_dread = medium_dread_gain
		add_character_modifier = {
			modifier = feast_loyal_servantry_modifier
			years = 5
		}
		scope:secret = {
			expose_secret = root	
		}
		hidden_effect = {
			add_opinion = {
				target = scope:homosexual_character
				modifier = respect_opinion
				opinion = -20
			}
		}
		ai_chance = {
			base = 500
			ai_value_modifier = {
				ai_boldness = 1
			}
		}
	}

	option = { #You too?
		name = feast_default.2008.d
		trigger = {
			OR = {
				any_secret = { secret_type = secret_homosexual }
				has_sexuality = homosexual
			}
		}
		add_internal_flag = special
		custom_tooltip = feast_default.2008.d.unlock_text
		if = {
			limit = {
				any_secret = {
					secret_type = secret_homosexual
					NOT = { is_known_by = scope:homosexual_character }
				}
			}
			random_secret = {
				limit = { secret_type = secret_homosexual }
				reveal_to = scope:homosexual_character
			}
		}
		reverse_add_opinion = {
			target = scope:homosexual_character
			modifier = feast_common_burden_opinion
		}
		hidden_effect = {
			add_opinion = {
				target = scope:homosexual_character
				modifier = feast_common_burden_opinion
			}
		}
		if = {
			limit = {
				can_set_relation_friend_trigger = { CHARACTER = scope:homosexual_character }
			}
			if = {
				limit = {
					has_relation_potential_friend = scope:homosexual_character
					can_set_relation_friend_trigger = { CHARACTER = scope:homosexual_character }
				}
				set_relation_friend = { reason = friend_feast_bonding target = scope:homosexual_character }
			}
			else_if = {
				limit = {
					has_relation_potential_lover = scope:homosexual_character
					can_set_relation_lover_trigger = { CHARACTER = scope:homosexual_character }
				}
				set_relation_lover = { reason = lover_feast_homosexual target = scope:homosexual_character province = scope:activity.activity_location }
			}
			else = {
				progress_towards_friend_effect = {
					REASON = friend_also_homosexual
					CHARACTER = scope:homosexual_character
					OPINION = 0
				}
			}
		}
		stress_impact = {
			base = medium_stress_loss
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 1
				ai_compassion = 0.5
			}
		}
	}
}



#####################
# Learn someone's secret
# by Petter Vilberg
#####################
scripted_trigger feast_default_2009_secret_holder_trigger = {
	feast_default_participant_trigger = yes
	is_adult = yes
	any_secret = {
		NOT = { is_known_by = root }
	}
	NOT = { has_trait = temperate }
	drinks_alcohol_trigger = yes
}

feast_default.2009 = {
	type = activity_event
	title = feast_default.2009.t
	desc = feast_default.2009.desc
	theme = feast_activity
	right_portrait = {
		character = root
		animation = eavesdrop
	}
	left_portrait = {
		character = scope:secret_holder
		animation = worry
	}
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { exists = local_var:had_2009 }
		scope:activity = {
			any_attending_character = {
				feast_default_2009_secret_holder_trigger = yes
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_2009
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = { feast_default_2009_secret_holder_trigger = yes }
				save_scope_as = secret_holder
				random_secret = {
					limit = { NOT = { is_known_by = root } }
					save_scope_as = secret_to_reveal
				}
			}
		}
	}

	option = {
		name = feast_default.2009.a
		scope:secret_to_reveal = {
			reveal_to = root
		}
	}
}


#####################
# Learn someone else's secret
# by Petter Vilberg
#####################
scripted_trigger feast_default_2010_secret_knower_trigger = {
	feast_default_participant_trigger = yes
	is_adult = yes
	any_known_secret = {
		NOT = { secret_owner = prev }
		NOT = { is_known_by = root }
	}
	drinks_alcohol_trigger = yes
}

feast_default.2010 = {
	type = activity_event
	title = feast_default.2009.t
	desc = feast_default.2009.desc
	theme = feast_activity
	left_portrait = {
		character = scope:secret_holder
		animation = worry
	}
	right_portrait = {
		character = scope:secret_knower
		animation = scheme
	}
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { exists = local_var:had_2010 }
		scope:activity = {
			any_attending_character = {
				feast_default_2010_secret_knower_trigger = yes
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_2010
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = { feast_default_2010_secret_knower_trigger = yes }
				save_scope_as = secret_knower
				random_known_secret = {
					limit = {
						NOT = { is_known_by = root }
						NOT = { secret_owner = scope:secret_knower }
					}
					secret_owner = {
						save_scope_as = secret_holder
					}
					save_scope_as = secret_to_reveal
				}
			}
		}
	}

	option = {
		name = feast_default.2009.a
		scope:secret_to_reveal = {
			reveal_to = root
		}
	}
}


#####################
# Someone makes grand promises to you
# by Petter Vilberg
#####################
scripted_trigger feast_default_2011_favor_character_trigger = {
	feast_default_participant_trigger = yes
	is_adult = yes
	NOT = { has_trait = temperate }
	NOT = { has_trait = shy }
	NOT = { has_trait = deceitful }
	root = {
		can_add_hook = {
			target = prev
			type = favor_hook
		}
	}
	opinion = {
		target = root
		value > 15
	}
	drinks_alcohol_trigger = yes
}

feast_default.2011 = {
	type = activity_event
	title = feast_default.2011.t
	desc = feast_default.2011.desc
	theme = feast_activity
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:favor_character
		animation = personality_bold
	}
	cooldown = { years = 2 }
	
	trigger = {
		NOT = { exists = local_var:had_2011 }
		scope:activity = {
			any_attending_character = {
				feast_default_2011_favor_character_trigger = yes
			}
		}
	}

	weight_multiplier = {
		base = 0.5
		modifier = {
			add = 0.5
			scope:activity = {
				any_attending_character = {
					feast_default_2011_favor_character_trigger = yes
					has_trait = gregarious
				}
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_2011
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_2011_favor_character_trigger = yes
				}
				weight = {
					base = 1
					interesting_feast_participant_modifier = yes
					modifier = {
						add = 3
						has_trait = gregarious
					}
				}
				save_scope_as = favor_character
			}
		}
	}

	option = { #That's a generous promise
		name = feast_default.2011.a
		add_hook = {
			type = favor_hook
			target = scope:favor_character
		}
		ai_chance = {
			base = 75
			ai_value_modifier = {
				ai_greed = 2
			}
		}
	}

	option = { # Let's ignore it
		name = feast_default.2011.b
		scope:favor_character = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 30
			}
		}
		stress_impact = {
			greedy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 25
		}
	}
}


#####################
# Someone is murdered, you're a witness!
# by Linnéa Thimrén
#####################

scripted_trigger feast_default_2012_victim_trigger = {
	feast_default_participant_trigger = yes
	save_temporary_scope_as = murdered_guest
	scope:activity = {
		any_attending_character = {
			feast_default_2012_murderer_trigger = yes
		}
	}
}

scripted_trigger feast_default_2012_murderer_trigger = {
	feast_default_participant_trigger = yes
	is_ai = yes
	NOT = { this = scope:murdered_guest }
	opinion = {
		target = scope:murdered_guest
		value <= -30
	}
	OR = {
		ai_vengefulness >= high_positive_ai_value
		has_trait = wrathful
	}
}

feast_default.2012 = {
	type = activity_event
	title = feast_default.2012.t
	desc = feast_default.2012.desc
	center_portrait = {
		camera = camera_event_very_left
		character = scope:murderer
		animation = assassin
	}
	right_portrait = {
		character = scope:murdered_guest
		animation = pain
	}
	theme = feast_activity
	cooldown = { years = 2 }
	
	trigger = {
		NOT = { exists = local_var:had_2012 }
		is_ai = no
		scope:activity = {
			any_attending_character = {
				feast_default_2012_victim_trigger = yes
				save_temporary_scope_as = murdered_guest
			}
			any_attending_character = {
				feast_default_2012_murderer_trigger = yes
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_2012
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_2012_victim_trigger = yes
				}
				save_scope_as = murdered_guest
			}
			random_attending_character = {
				limit = {
					feast_default_2012_murderer_trigger = yes
				}
				weight = {
					base = 1
					modifier = {
						add = 5
						any_scheme = {
							scheme_type = murder
							scheme_target_character = scope:murdered_guest
						}
					}
					modifier = {
						add = 5
						has_relation_rival = scope:murdered_guest
					}
				}
				save_scope_as = murderer
			}
		}

		unknown_murder_effect = {
			VICTIM = scope:murdered_guest
			MURDERER = scope:murderer
			REASON = death_mysterious
		}
		scope:murderer = {
			random_secret = {
				limit = {
					secret_type = secret_murder
					secret_target = scope:murdered_guest
				}
				reveal_to = root
				save_scope_as = secret
			}
			hidden_effect = { #To make suer you can extort them
				if = {
					limit = {
						short_term_gold < root.minor_gold_value
					}
					add_gold = root.minor_gold_value
				}
			}
		}
	}

	option = {
		name = feast_default.2012.a
	}

	option = { #I will tell everyone!
		name = feast_default.2012.b
		scope:secret = {
			expose_secret = root	
		}
		stress_impact = {
			greedy = medium_stress_impact_gain
			contrite = medium_stress_impact_loss
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				OR = {
					has_trait = honest
					has_trait = just
				}
			}
			ai_value_modifier = {
				ai_compassion = 0.5
			}
		}
	}

	option = {
		name = feast_default.2012.c
		trigger = {
			scope:murderer = { short_term_gold >= root.minor_gold_value }
		}
		scope:murderer = {
			pay_short_term_gold = {
				target = root
				gold = root.minor_gold_value
			}
		}
		scope:secret = {
			set_variable = {
				name = promised_not_to_reveal
				value = root
			}
		}
		stress_impact = {
			honest = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_greed = 0.75
			}
		}
	}
}


#####################
# Guest tries to steal your thunder by kissing ass to shared liege
# by Bianca Savazzi
#####################
scripted_trigger feast_default_2013_annoying_bootlicker_trigger = {
	feast_default_participant_trigger = yes
	exists = root.liege
	is_vassal_of = root.liege #This liege is also my liege
	NOT = { has_trait = content }
}

scripted_effect feast_default_2013_pelt_creation_effect = {
	if = {
		limit = {
			scope:shared_liege = { has_royal_court = yes }
		}
		scope:bootlicker = {
			create_artifact_animal_hide_effect = {
				OWNER = scope:shared_liege
				HUNTER = scope:bootlicker
				LEGENDARY = no
				ANIMAL = flag:none
			}
		}
		scope:shared_liege = {
			add_opinion = {
				target = scope:bootlicker
				modifier = kindness_opinion
				opinion = 20
			}
		}
		if = {
			limit = {
				root = { has_variable = feast_default_2013_opt_c_var }
			}
			#drink stain reduces artifact durability
			scope:bootlicker = { 
				scope:newly_created_artifact = {
					# Remove 50% of remaining durability
					add_durability = {
						value = artifact_durability
						multiply = 0.50
						multiply = -1
					}
				}
			}
		}
	}
	else = {
		if = {
			limit = { 
				NOT = { root = { has_variable = feast_default_2013_opt_c_var } }
			}
			scope:shared_liege = {
				add_character_modifier = {
					modifier = wolf_pelt_modifier
					years = 20
				}
			}
		}
		else = {
			scope:shared_liege = {
				add_character_modifier = {
					modifier = wolf_pelt_modifier
					years = 10 #spillage decreases the time to sorta mimic the durability
				}
			}
		}
	}
} 

feast_default.2013 = {
	type = activity_event
	title = feast_default.2013.t
	desc = feast_default.2013.desc
	theme = feast_activity
	left_portrait = {
		character = scope:bootlicker
		animation = ecstasy
	}
	right_portrait = {
		character = scope:shared_liege
		animation = personality_rational
	}
	cooldown = { years = 1 }
	
	trigger = {
		exists = liege
		liege = {
			is_ai = yes
		}
		NOR = { 
			exists = local_var:had_2013 
			has_trait = content 
		}
		scope:activity = {
			any_attending_character = {
				feast_default_2013_annoying_bootlicker_trigger = yes
			}
		}
		scope:activity = {
			any_attending_character = {
				feast_default_participant_trigger = yes
				this = root.liege
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			scope:activity = {
				any_attending_character = {
					feast_default_2013_annoying_bootlicker_trigger = yes
					has_trait = ambitious
				}
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_2013
			value = yes
		}
		liege = {
			save_scope_as = shared_liege
		}
		scope:activity = {
			random_attending_character = {
				limit = { #If they have the befriend intent towards the liege we prever this
					feast_default_2013_annoying_bootlicker_trigger = yes 
					has_activity_intent = befriend_attendee_intent
					intent_target ?= {
						is_alive = yes
						this = scope:shared_liege
					}
				}
				alternative_limit = {
					feast_default_2013_annoying_bootlicker_trigger = yes 
					has_trait = ambitious
				}
				alternative_limit = {
					feast_default_2013_annoying_bootlicker_trigger = yes
				}
				save_scope_as = bootlicker
			}
		}

		if = {
			limit = {
				any_character_artifact = {
					is_equipped = no
					artifact_durability < 50
				}
			}
			random_character_artifact = {
				limit = {
					is_equipped = no
					artifact_durability < 50
				}
				save_scope_as = potential_artifact_gift
			}
		}
	}

	option = { #Uuuh, here! Take this too!
		name = feast_default.2013.a
		duel = {
			skill = stewardship
			target = scope:bootlicker
			12 = {
				desc = feast_default.2013.a.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				scope:shared_liege = {
					add_opinion = {
						target = root
						modifier = feast_recieved_amazing_gift
					}
				}
			}
			8 = {
				desc = feast_default.2013.a.failure
				scope:shared_liege = {
					add_opinion = {
						target = root
						modifier = feast_recieved_underwhelming_gift
					}
				}
				progress_towards_rival_effect = {
					CHARACTER = scope:bootlicker
					REASON = rival_bootlicker_antagonised
					OPINION = 0
				}
			}
		}
		if = {
			limit = {
				exists = scope:potential_artifact_gift
			}
			scope:potential_artifact_gift = {
				set_owner = {
					target = scope:shared_liege 
					history = {
						type = given
						actor = scope:shared_liege #reciever
						recipient = root #giver
						location = scope:shared_liege.location
					}
				}
			}
		}
		else = {
			pay_short_term_gold = {
				target = scope:shared_liege
				gold = medium_gold_value
			}
		}

		stress_impact = {
			greedy = medium_stress_impact_gain
			patient = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_greed = -0.5
				ai_rationality = 0.5
				ai_compassion = 0.5
			}
			modifier = {
				add = 50
				has_trait = fickle 
			}
			modifier = {
				factor = 0
				short_term_gold < minor_gold_value 
			}
		}
	}

	option = { # Toast to your liege!
		name = feast_default.2013.b
		duel = {
			skill = diplomacy
			target = scope:bootlicker
			10 = {
				desc = feast_default.2013.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				scope:shared_liege = {
					add_opinion = {
						target = root
						modifier = feast_recieved_amazing_toast
					}
				}
			}
			10 = {
				desc = feast_default.2013.b.failure
				scope:shared_liege = {
					add_opinion = {
						target = root
						modifier = feast_recieved_underwhelming_toast
					}
				}
				progress_towards_rival_effect = {
					CHARACTER = scope:bootlicker
					REASON = rival_bootlicker_antagonised
					OPINION = 0
				}
			}
		}
		stress_impact = {
			shy = medium_stress_impact_gain
			patient = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_honor = 0.5
			}
			modifier = {
				add = 20
				has_trait = gregarious
			}
			modifier = {
				add = -100
				has_trait = shy
			}
		}
	}

	option = { # Spill your drink on the gift
		name = feast_default.2013.c
		duel = {
			skill = intrigue
			target = scope:bootlicker
			10 = {
				desc = feast_default.2013.c.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
			}
			10 = {
				desc = feast_default.2013.c.failure
				scope:shared_liege = {
					add_opinion = {
						target = root
						modifier = feast_purposefully_ruined_gift
					}
				}
				progress_towards_rival_effect = {
					CHARACTER = scope:bootlicker
					REASON = rival_bootlicker_foiled
					OPINION = default_rival_opinion
				}
			}
		}
		set_variable = {
			name = feast_default_2013_opt_c_var 
			value = yes	
		}
		stress_impact = {
			vengeful = medium_stress_impact_loss
			sadistic = medium_stress_impact_loss
			compassionate = medium_stress_impact_gain
			honest = medium_stress_impact_gain
			just = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_vengefulness = 0.5
				ai_honor = -0.5
			}
			modifier = {
				add = 20
				has_trait = vengeful
			}
			modifier = {
				add = -100
				has_trait = honest
			}
		}
	}

	option = { # Do nothing
		name = feast_default.2013.d

		stress_impact = {
			ambitious = medium_stress_impact_gain
			impatient = medium_stress_impact_gain
		}
		ai_chance = {
			base = 10
		}
	}

	after = {
		hidden_effect = {
			feast_default_2013_pelt_creation_effect = yes
		}
	}
}



#################################
# RELATION EVENTS
# 3000-3999
#################################

#####################
# A good time with a Friend
# by Petter Vilberg
#####################
feast_default.3001 = {
	type = activity_event
	title = feast_default.3001.t
	desc = feast_default.3001.desc
	theme = feast_activity
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:friend
		animation = throne_room_conversation_2
	}
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { has_character_flag = had_feast_default_3001 }
		scope:activity = {
			any_attending_character = {
				feast_default_participant_trigger = yes
				has_relation_friend = root
			}
		}	
	}

	immediate = {
		add_character_flag = {
			flag = had_feast_default_3001
			years = 7
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_participant_trigger = yes
					has_relation_friend = root
				}
				save_scope_as = friend
			}
		}
	}

	option = {
		name = feast_default.3001.a
		add_stress = major_stress_loss
		add_character_modifier = {
			modifier = feast_reinvigorated_by_friend_modifier
			years = 5
		}
		reverse_add_opinion = {
			target = scope:friend
			modifier = friend_had_good_time_at_feast_opinion	
		}
		hidden_effect = {
			add_opinion = {
				target = scope:friend
				modifier = friend_had_good_time_at_feast_opinion
			}
		}
	}
}


#####################
# A chance to exchange secret kisses with a Lover
# by Petter Vilberg
#####################
scripted_trigger feast_default_3002_lover_trigger = {
	feast_default_participant_trigger = yes
	lover_is_secret_trigger = {
		CHARACTER = root
	}
}

feast_default.3002 = {
	type = activity_event
	title = feast_default.3002.t
	desc = feast_default.3002.desc
	theme = feast_activity
	left_portrait = {
		character = scope:lover
		animation = flirtation
	}
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { has_character_flag = had_feast_default.3002_event }
		scope:activity = {
			any_attending_character = {
				feast_default_3002_lover_trigger = yes
			}
		}	
	}

	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_3002_lover_trigger = yes
				}
				save_scope_as = lover
			}
		}
		add_character_flag = {
			flag = had_feast_default.3002_event
			years = 10
		}
	}

	option = { #This is our chance!
		name = feast_default.3002.a
		hidden_effect = {
			add_opinion = {
				target = scope:lover
				modifier = lover_feast_secret_dalliance_opinion
			}
		}
		add_stress = major_stress_loss
		add_character_modifier = {
			modifier = feast_practiced_secrecy_modifier
			years = 10
		}
		reverse_add_opinion = {
			target = scope:lover
			modifier = lover_feast_secret_dalliance_opinion	
		}
		if = { #There is a chance of the activity owner discovering the secret
			limit = {
				scope:activity.activity_host = {
					is_ai = yes
					NOT = { this = root }
					NOT = { this = scope:lover }
				}
			}
			custom_tooltip = feast_default.3002.discovery_tt
			random = {
				chance = 5
				random_secret = {
					limit = {
						secret_type = secret_lover
						secret_target = scope:lover
					}
					reveal_to = scope:activity.activity_host
				}
			}
		}
		stress_impact = {
			chaste = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #No, we might be discovered!
		name = feast_default.3002.b
		add_character_modifier = {
			modifier = feast_showed_great_restraint_modifier
			years = 10
		}
		reverse_add_opinion = {
			target = scope:lover
			modifier = feast_rejected_dalliance_opinion
		}
		stress_impact = {
			lustful = major_stress_impact_gain
		}
		ai_chance = {
			base = 20
			modifier = {
				add = 100
				has_trait = temperate
			}
			modifier = {
				factor = 0
				has_trait = lustful
			}
		}
	}
}


#####################
# An altercation with a Rival
# by Petter Vilberg
#####################
scripted_trigger feast_default_3003_rival_trigger = {	
	feast_default_participant_trigger = yes
	has_relation_rival = root
}

feast_default.3003 = {
	type = activity_event
	title = feast_default.3003.t
	desc = feast_default.3003.desc
	theme = feast_activity
	left_portrait = {
		character = root
		animation = dismissal
	}
	right_portrait = {
		character = scope:rival
		animation = anger
	}
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { has_character_flag = had_feast_default.3003_event }
		scope:activity = {
			any_attending_character = {
				feast_default_3003_rival_trigger = yes
			}
		}	
	}

	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_3003_rival_trigger = yes
				}
				save_scope_as = rival
			}
		}
		add_character_flag = {
			flag = had_feast_default.3003_event
			years = 10
		}
	}

	option = {
		name = feast_default.3003.a
		add_character_modifier = {
			modifier = feast_bad_form_with_rival_modifier
			years = 5
		}
		reverse_add_opinion = {
			target = scope:rival
			modifier = rival_feast_altercation_opinion	
		}
		hidden_effect = {
			add_opinion = {
				target = scope:rival
				modifier = rival_feast_altercation_opinion
			}
		}
	}
}


#####################
# Insult your rival
# by Linnéa Thimrén
#####################
feast_default.3004 = {
	type = activity_event
	title = feast_default.3004.t
	desc = feast_default.3004.desc
	theme = feast_activity
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:rival_guest
		animation = anger
	}
	cooldown = { years = 1 }

	trigger = {
		NOT = { exists = local_var:had_3004 }
		scope:activity = {
			any_attending_character = {
				feast_default_participant_trigger = yes
				has_relation_rival = root
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_3004
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_participant_trigger = yes
					has_relation_rival = root
				}
				save_scope_as = rival_guest
			}
		}
	}

	option = { #Be reasonable and tell them to calm down
		name = feast_default.3004.a
		add_prestige = minor_prestige_gain
		scope:rival_guest = {
			add_prestige = medium_prestige_loss
		}
		stress_impact = {
			wrathful = medium_stress_impact_gain
			vengeful = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = -0.5
				ai_honor = 0.5
				ai_compassion = 0.5
				ai_rationality = 0.25
			}
		}
	}

	option = { #Let's get this insult-battle going!
		name = feast_default.3004.b
		trait = wrathful
		duel = {
			skill = prowess
			target = scope:rival_guest
			12 = {
				desc = feast_default.3004.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				scope:rival_guest = { increase_wounds_effect = { REASON = fight } }
			}
			8 = {
				desc = feast_default.3004.b.failure
				increase_wounds_effect = { REASON = fight }
			}
		}
		add_character_modifier = {
			modifier = feast_had_good_fight_modifier
			years = 5
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
			calm = medium_stress_impact_gain
			content = medium_stress_impact_gain
			shy = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_vengefulness = 0.75
				ai_energy = 0.75
				ai_boldness = 0.5
				ai_compassion = -0.25
			}
		}
	}

	option = { #Please leave my party
		name = feast_default.3004.c
		flavor = feast_default.3004.c.tt
		trigger = {
			OR = {
				has_trait = gregarious
				probably_intelligent_trigger = yes
			}
		}
		trait = gregarious
		add_prestige = medium_prestige_gain
		scope:rival_guest = {
			add_prestige = medium_prestige_loss
			add_opinion = {
				modifier = feast_threw_me_out_opinion
				target = root
			}
		}
		stress_impact = {
			wrathful = medium_stress_impact_gain
			shy = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.75
				ai_honor = 0.25
				ai_rationality = 0.25
				ai_energy = 0.25
			}
		}
	}
}


#####################
# Rival duel!
# by Linnéa Thimrén
#####################
feast_default.3005 = {
	type = activity_event
	title = feast_default.3005.t
	desc = {
		desc = feast_default.3005.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = won_fight
				}
				desc = feast_default.3005.desc_won
			}
			desc = feast_default.3005.desc_lost
		}
	}
	theme = feast_activity
	left_portrait = {
		character = root
		animation = anger
	}
	right_portrait = {
		character = scope:rival_to_duel
		animation = dismissal
	}
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { exists = local_var:had_3005 }
		scope:activity = {
			any_attending_character = {
				feast_default_participant_trigger = yes
				has_relation_rival = root
			}
		}
	}

	weight_multiplier = {
		base = 0.5
		modifier = { #Less likely if they are wounded
			add = 0.5
			scope:activity = {
				any_attending_character = {
					feast_default_participant_trigger = yes
					has_relation_rival = root
					has_trait_rank = {
						trait = wounded
						rank <= 2
					}
				}
			}
		}
		modifier = {#More likely if they are wrathful
			add = 0.3
			scope:activity = {
				any_attending_character = {
					feast_default_participant_trigger = yes
					has_relation_rival = root
					has_trait = wrathful
				}
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_3005
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_participant_trigger = yes
					has_relation_rival = root
				}
				save_scope_as = rival_to_duel
			}
		}
		hidden_effect = {
			random_list = {
				60 = {
					modifier = {
						add = 20
						martial > scope:rival_to_duel.martial
					}
					modifier = {
						add = 5
						scope:rival_to_duel = {
							has_trait = drunkard
						}
					}
					modifier = {
						add = -5
						has_trait = drunkard
					}
					modifier = {
						add = 10
						scope:rival_to_duel = {
							has_trait_rank = {
								trait = wounded
								rank >= 2
							}
						}
					}
					modifier = {
						add = -10
						has_trait_rank = {
							trait = wounded
							rank >= 2
						}
					}
					add_character_flag = {
						flag = won_fight
						days = 50
					}
				}
				40 = {	}
			}
		}
		if = {
			limit = {
				has_character_flag = won_fight
			}
			add_prestige = medium_prestige_gain
		}
		if = {
			limit = {
				NOT = { has_character_flag = won_fight }
			}
			scope:rival_to_duel = {
				add_prestige = medium_prestige_gain
			}
		}
	}

	option = { #You won - injure them
		name = feast_default.3005.a
		trigger = {
			has_character_flag = won_fight
		}
		scope:rival_to_duel = {
			increase_wounds_effect = { REASON = fight }
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
			sadistic = medium_stress_impact_loss
			vengeful = medium_stress_impact_loss
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 20
				has_trait = sadistic
			}
			ai_value_modifier = {
				ai_vengefulness = 1
			}
		}
	}

	option = { #You lost - they injure you
		name = feast_default.3005.b
		trigger = {
			NOT = { has_character_flag = won_fight }
		}
		increase_wounds_effect = { REASON = fight }
		random = {
			chance = 50
			scope:rival_to_duel = {
				increase_wounds_effect = { REASON = fight }
			}
		}
		stress_impact = {
			craven = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 20
				has_trait = stubborn
			}
			ai_value_modifier = {
				ai_boldness = 1
			}
		}
	}

	option = { #You lost - give up
		name = feast_default.3005.c
		trigger = {
			NOT = { has_character_flag = won_fight }
		}
		add_prestige = minor_prestige_loss
		stress_impact = {
			arrogant = medium_stress_impact_gain
			brave = medium_stress_impact_gain
			wrathful = medium_stress_impact_gain
			craven = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #You won - be an ass about it
		name = feast_default.3005.d
		trigger = {
			has_character_flag = won_fight
		}
		scope:rival_to_duel = {
			add_prestige = medium_prestige_loss
		}
		stress_impact = {
			forgiving = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #You lost - slit their Achilles tendon
		name = feast_default.3005.e
		trigger = {
			NOT = { has_character_flag = won_fight }
			intrigue >= high_skill_rating
		}
		skill = intrigue
		scope:rival_to_duel = {
			increase_wounds_effect = { REASON = fight }
		}

		stress_impact = {
			forgiving = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 500
		}
	}

	after = { remove_character_flag = won_fight  }
}



#####################
# Soiree with another attendee
# by Petter Vilberg and Linnéa Thimrén
#####################
scripted_trigger feast_default_3006_adultery_target_trigger = {
	feast_default_participant_trigger = yes
	is_adult = yes
	is_ai = no
	NOT = { this = root }
	NOT = {
		any_consort = {
			this = root
		}
	}
	NOR = {
		has_trait = chaste
		has_trait = celibate
		has_relation_lover = root
	}
	num_of_relation_lover < 2
	save_temporary_scope_as = adultery_target_check
	root = {
		trait_compatibility = {
			target = scope:adultery_target_check
			value >= low_positive_trait_compatibility
		}
		age <= scope:adultery_target_check.age_plus_5
		trigger_if = {
			limit = {
				scope:adultery_target_check = { is_female = yes }
			}
			age >= scope:adultery_target_check.age_minus_10
		}
	}
	possible_mutual_interest_trigger = {
		CHARACTER_1 = scope:adultery_target_check
		CHARACTER_2 = root
	}
	opinion = {
		target = root
		value > 20
	}
	might_cheat_on_every_partner_trigger = yes
}

feast_default.3096 = {
	type = activity_event
	title = feast_default.3096.t
	desc = feast_default.3096.desc
	theme = feast_activity
	left_portrait = {
		character = scope:partner
		animation = flirtation
	}
	right_portrait = {
		character = root
		animation = admiration
	}
	lower_left_portrait = scope:spouse
	lower_center_portrait = scope:partner_spouse
	
	trigger = {
		NOT = { exists = local_var:had_3006 }
		NOT = { has_trait = chaste }
		might_cheat_on_every_partner_trigger = yes
		scope:activity = {
			any_attending_character = {
				feast_default_3006_adultery_target_trigger = yes
			}
		}
	}

	weight_multiplier = {
		base = 0.75
		modifier = {
			add = -0.5
			num_of_relation_lover > 0
		}
		modifier = {
			add = -0.3
			num_of_relation_lover > 1
		}
		modifier = {
			add = 0.5
			has_trait = rakish
		}
		modifier = {
			add = 1
			has_trait = lustful
		}
		modifier = {
			add = -0.5
			any_spouse = {
				reverse_opinion = {
					target = root
					value >= 60
				}
			}
		}
		modifier = {
			add = -0.4
			any_spouse = {
				reverse_opinion = {
					target = root
					value >= 90
				}
			}
		}
		modifier = {
			add = -0.4
			any_spouse = {
				reverse_has_opinion_modifier = {
					target = root
					modifier = love_opinion
				}
			}
		}
	}

	immediate = {
		scope:activity = {
			every_attending_character = { #Build a list of potential targets
				if = {
					limit = { feast_default_3006_adultery_target_trigger = yes }
					add_to_list = potential_adulterer
				}
			}
		}
		random_in_list = {
			list = potential_adulterer
			weight = {
				base = 5
				interesting_feast_participant_modifier = yes
				modifier = {
					add = 20
					any_consort = {
						is_of_major_interest_to_root_trigger = yes
					}
				}
				modifier = {
					add = 10
					any_consort = {
						is_of_minor_interest_to_root_trigger = yes
					}
				}
				modifier = {
					add = 50
					has_relation_potential_lover = root
				}
			}
			save_scope_as = partner
		}
		scope:partner = {
			add_opinion = {
				modifier = love_opinion
				target = root
				opinion = 15
			}
			hidden_effect = {
				if = { #Character becomes root's potential lover for future reference
					limit = {
						can_set_relation_potential_lover_trigger = { CHARACTER = root }
						opinion = {
							target = root
							value > 10
						}
					}
					set_relation_potential_lover = root
				}
			}
			if = {
				limit ={
					OR = {
						is_married = yes
						is_concubine = yes
					}
				}
				primary_partner = {
					save_scope_as = partner_spouse
				}
			}
		}
	}

	option = { #Go ahead
		name = feast_default.3096.a
		custom_tooltip = fest_default.3906.a.tt
		trigger_event = feast_default.3006
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -0.25
				ai_boldness = 0.5
			}
		}
	}

	option = { #I am better than this
		name = feast_default.3096.b
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_rationality = 0.5
			}
			opinion_modifier = {
				trigger = { exists = scope:spouse }
				opinion_target = scope:spouse
			}
		}
	}
}

feast_default.3006 = {
	type = activity_event
	title = feast_default.3006.t
	desc = {
		random_valid = {
			desc = feast_default.3006.opening_1
			desc = feast_default.3006.opening_2
			desc = feast_default.3006.opening_3
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					has_opinion_modifier = {
						target = scope:partner
						modifier = love_opinion
					}
				}
				desc = {
					first_valid = {
						triggered_desc = {
							trigger = {
								is_married = yes
								scope:partner = {
									OR = {
										is_married = yes
										is_concubine = yes
									}
								}
							}
							desc = feast_default.3006.both_married_love
						}
						triggered_desc = {
							trigger = {
								is_married = yes
								scope:partner = {
									is_married = no
									is_concubine = no
								}
							}
							desc = feast_default.3006.married_love
						}
						triggered_desc = {
							trigger = {
								is_married = no
								scope:partner = {
									OR = {
										is_married = yes
										is_concubine = yes
									}
								}
							}
							desc = feast_default.3006.partner_married_love
						}
						triggered_desc = {
							trigger = {
								is_married = no
								scope:partner = {
									is_married = no
									is_concubine = no
								}
							}
							desc = feast_default.3006.unmarried_love
						}
					}
				}
			}
			triggered_desc = {
				trigger = {
					is_married = yes
					scope:partner = {
						OR = {
							is_married = yes
							is_concubine = yes
						}
					}
				}
				desc = feast_default.3006.both_married
			}
			triggered_desc = {
				trigger = {
					is_married = yes
					scope:partner = {
						is_married = no
						is_concubine = no
					}
				}
				desc = feast_default.3006.married
			}
			triggered_desc = {
				trigger = {
					is_married = no
					scope:partner = {
						OR = {
							is_married = yes
							is_concubine = yes
						}
					}
				}
				desc = feast_default.3006.partner_married
			}
			triggered_desc = {
				trigger = {
					is_married = no
					scope:partner = {
						is_married = no
						is_concubine = no
					}
				}
				desc = feast_default.3006.unmarried
			}
		}
	}
	theme = feast_activity
	override_background = {
		reference = bedchamber
	}
	left_portrait = {
		character = scope:partner
		animation = flirtation
	}
	right_portrait = {
		character = root
		animation = admiration
	}
	lower_left_portrait = scope:spouse
	lower_center_portrait = scope:partner_spouse

	immediate = {
		set_local_variable = {
			name = had_3006
			value = yes
		}
		had_sex_with_effect = {
			CHARACTER = scope:partner
			PREGNANCY_CHANCE = pregnancy_chance
		}
	}

	option = { #I must see you again!
		name = feast_default.3006.a
		progress_towards_lover_effect = {
			CHARACTER = scope:partner
			REASON = lover_feast_boink
			OPINION = 0
		}
		if = {
			limit = {
				OR = {
					trait_is_shunned_in_faith_trigger = {
						TRAIT = adulterer
						GENDER_CHARACTER = root
						FAITH = root.faith
					}
					trait_is_criminal_in_faith_trigger = {
						TRAIT = adulterer
						GENDER_CHARACTER = root
						FAITH = root.faith
					}
				}
			}
			stress_impact = {
				zealous = major_stress_impact_gain
				chaste = major_stress_impact_gain
				callous = minor_stress_impact_gain
				cynical = minor_stress_impact_gain
				craven = minor_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				chaste = major_stress_impact_gain
				callous = minor_stress_impact_gain
				cynical = minor_stress_impact_gain
				craven = minor_stress_impact_gain
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 0.5
				ai_honor = -0.25
				ai_boldness = 0.5
			}
		}
	}

	option = { #Let's go for another round
		name = feast_default.3006.b
		add_character_modifier = {
			modifier = feast_blew_off_steam_modifier
			years = 5
		}
		had_sex_with_effect = {
			CHARACTER = scope:partner
			PREGNANCY_CHANCE = pregnancy_chance
		}
		stress_impact = {
			rakish = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -0.25
				ai_boldness = 0.5
			}
		}
	}


	option = { #Let us not speak of this again
		name = feast_default.3006.c
		custom_tooltip = feast_default.3006.c.tt
		stress_impact = {
			lustful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_rationality = 0.5
			}
			opinion_modifier = {
				trigger = { exists = scope:spouse }
				opinion_target = scope:spouse
			}
		}
	}
}


#####################
# Caught committing adultery with a Lover
# by Petter Vilberg
#####################
###Your spouse discovers your adultery during the feast
#
#Trigger for making sure a suitable secret lover is present
scripted_trigger feast_default_3007_lover_trigger = {
	feast_default_participant_trigger = yes
	is_adult = yes
	has_relation_lover = root
	NOT = {
		any_consort = {
			this = root
		}
	}
	save_temporary_scope_as = lover_check
	root = {
		exists = primary_partner
		primary_partner = {
			save_temporary_scope_as = spouse_check
		}
		any_secret = {
			secret_type = secret_lover
			secret_target = scope:lover_check
			NOT = { is_known_by = scope:spouse_check }
		}
	}
}

feast_default.3007 = {
	type = activity_event
	title = feast_default.3007.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_opinion_modifier = {
							target = scope:lover
							modifier = love_opinion
						}
						opinion = {
							target = scope:lover
							value > 75
						}
					}
				}
				desc = feast_default.3007.love
			}
			triggered_desc = {
				trigger = {
					opinion = {
						target = scope:lover
						value < 20
					}
				}
				desc = feast_default.3007.not_love
			}
			desc = feast_default.3007.ambiguous
		}
		desc = feast_default.3007.end
	}
	theme = feast_activity
	left_portrait = {
		character = scope:lover
		animation = shock
	}
	right_portrait = {
		character = scope:spouse
		animation = anger
	}
	
	trigger = {
		is_ai = no
		NOT = { exists = local_var:had_3007 }
		is_married = yes
		scope:activity = {
			any_attending_character = {
				OR = {
					feast_default_3007_lover_trigger = yes
					any_consort = {
						is_landed = no
						feast_default_3007_lover_trigger = yes
					}
					any_parent = {
						is_landed = no
						feast_default_3007_lover_trigger = yes
					}
					any_sibling = {
						is_landed = no
						feast_default_3007_lover_trigger = yes
					}
					any_child = {
						is_landed = no
						feast_default_3007_lover_trigger = yes
					}
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 1
			has_trait = lustful
		}
		modifier = {
			add = 0.5
			num_of_relation_lover > 1
		}
	}

	immediate = {
		set_local_variable = {
			name = had_3007
			value = yes
		}
		scope:activity = {
			every_attending_character = {
				if = {
					limit = { feast_default_3007_lover_trigger = yes }
					add_to_list = lover_potential
				}
				random_consort = {
					limit = {
						is_landed = no
						feast_default_3007_lover_trigger = yes
					}
					add_to_list = lover_potential
				}
				random_parent = {
					limit = {
						is_landed = no
						feast_default_3007_lover_trigger = yes
					}
					add_to_list = lover_potential
				}
				random_sibling = {
					limit = {
						is_landed = no
						feast_default_3007_lover_trigger = yes
					}
					add_to_list = lover_potential
				}
				random_child = {
					limit = {
						is_landed = no
						feast_default_3007_lover_trigger = yes
					}
					add_to_list = lover_potential
				}
			}
		}
		random_in_list = {
			list = lover_potential
			save_scope_as = lover
		}
		primary_partner = {
			save_scope_as = spouse
		}
		random_secret = {
			limit = {
				secret_type = secret_lover
				secret_target = scope:lover
				NOT = { is_known_by = scope:spouse }
			}
			save_scope_as = secret
		}
		had_sex_with_effect = {
			CHARACTER = scope:lover
			PREGNANCY_CHANCE = pregnancy_chance
		}
	}

	option = { #No, it means nothing!
		name = feast_default.3007.a
		remove_relation_lover = scope:lover
		scope:lover = {
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = -40
			}
		}
		scope:spouse = {
			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -20
			}
		}
		if = {
			limit = {
				opinion = {
					target = scope:lover
					value >= 75
				}
			}
			stress_impact = {
				compassionate = minor_stress_impact_gain
				stubborn = minor_stress_impact_gain
				honest = medium_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				compassionate = minor_stress_impact_gain
				stubborn = minor_stress_impact_gain
			}
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:spouse
			}
			opinion_modifier = {
				opinion_target = scope:lover
				multiplier = -1
			}
			ai_value_modifier = {
				ai_honor = 0.5
			}
		}
	}

	option = { #I love them!
		name = feast_default.3007.b
		scope:lover = {
			add_opinion = {
				target = root
				modifier = love_opinion
				opinion = 20
			}
		}
		scope:secret = {
			expose_secret = scope:spouse
		}
		if = {
			limit = {
				opinion = {
					target = scope:lover
					value >= 75
				}
			}
			stress_impact = {
				callous = medium_stress_impact_gain
				sadistic = medium_stress_impact_gain
				cynical = minor_stress_impact_gain
				craven = minor_stress_impact_gain
				content = medium_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				callous = medium_stress_impact_gain
				sadistic = medium_stress_impact_gain
				cynical = minor_stress_impact_gain
				craven = minor_stress_impact_gain
				content = medium_stress_impact_gain
				deceitful = medium_stress_impact_gain
			}
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:lover
			}
			opinion_modifier = {
				opinion_target = scope:spouse
				multiplier = -1
			}
			ai_value_modifier = {
				ai_greed = 0.25
				ai_boldness = 0.25
			}
		}
	}

	option = { #Be quiet, I do as I please
		name = feast_default.3007.c
		trigger = {
			OR = {
				has_trait = arrogant
				has_trait = sadistic
				has_trait = arbitrary
			}
		}
		trait = arrogant
		trait = sadistic
		trait = arbitrary
		scope:secret = {
			expose_secret = scope:spouse
		}
		scope:lover = {
			if = {
				limit = {
					scope:lover = {
						OR = {
							has_trait = arrogant
							has_trait = sadistic
							has_trait = arbitrary
						}
					}
				}
				scope:lover = {
					add_opinion = {
						target = root
						modifier = respect_opinion
						opinion = 15
					}
				}
			}
			else = {
				scope:lover = {
					add_opinion = {
						target = root
						modifier = kindness_opinion
						opinion = 15
					}
				}
			}
		}
		scope:spouse = {
			add_opinion = {
				target = root
				modifier = love_opinion
				opinion = -20
			}
		}
		ai_chance = {
			base = 500
			ai_value_modifier = {
				ai_compassion = -1
			}
		}
	}
}


#################################
# HOST-TRIGGERED EVENTS
# 5000-5999
#################################

#####################
# The Host's high Dread freaks you out
# by Petter Vilberg
#####################
feast_default.5001 = {
	type = activity_event
	title = feast_default.5001.t
	desc = {
		first_valid = {
			random_valid = {
				triggered_desc = {
					trigger = { exists = scope:friend }
					desc = feast_default.5001.friend_reminder
				}
				triggered_desc = {
					trigger = { exists = scope:rival }
					desc = feast_default.5001.rival_reminder
				}
				triggered_desc = {
					trigger = { exists = scope:spouse }
					desc = feast_default.5001.spouse_reminder
				}
				triggered_desc = {
					trigger = { exists = scope:sadist }
					desc = feast_default.5001.sadist_reminder
				}
			}
			desc = feast_default.5001.reminder
		}
		desc = feast_default.5001.worry
	}
	left_portrait = {
		character = scope:host
		animation = personality_callous
	}
	right_portrait = {
		character = root
		animation = paranoia
	}
	theme = feast_activity
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { exists = local_var:had_5001 }
		scope:activity.activity_host = {
			is_alive = yes
			NOT = { this = root }
			is_imprisoned = no
			dread >= medium_dread
		}
	}

	weight_multiplier = {
		base = 1
		modifier = { #You're less likely to be intimidated if you're brave
			factor = 0.3
			has_trait = brave
		}
		compare_modifier = {
			value = root.dread
			multiplier = 0.02
		}
	}

	immediate = {
		set_local_variable = {
			name = had_5001
			value = yes
		}
		scope:activity = {
			activity_host = {
				save_scope_as = host
			}
			random_attending_character = {
				limit = {
					has_relation_friend = root
				}
				save_scope_as = friend
			}
			random_attending_character = {
				limit = {
					has_relation_rival = root
				}
				save_scope_as = rival
			}
			random_attending_character = {
				limit = {
					has_trait = sadistic
				}
				save_scope_as = sadist
			}
		}
		random_spouse = { #root character's spouse, not necessarily a part of the activity
			save_scope_as = spouse
		}
	}

	option = { #This is too much
		name = feast_default.5001.a
		stress_impact = {
			base = medium_stress_gain
		}
	}	
}


#####################
# Host is a lunatic
# by Linnéa Thimrén
#####################
feast_default.5002 = {
	type = activity_event
	title = feast_default.5002.t
	desc = {
		random_valid = {
			desc = feast_default.5002.desc_chair
			desc = feast_default.5002.desc_chicken
			desc = feast_default.5002.desc_drapes
		}
	}
	theme = feast_activity
	left_portrait = {
		character = scope:lunatic_host
		animation = personality_irrational
	}
	right_portrait = {
		character = root
		animation = shock
	}
	cooldown = { years = 1 }

	trigger = {
		NOT = { exists = local_var:had_5002 }
		scope:activity.activity_host = {
			NOT = { this = root }
			is_alive = yes
			is_imprisoned = no
			has_trait = lunatic
		}
	}

	immediate = {
		set_local_variable = {
			name = had_5002
			value = yes
		}
		scope:activity = {
			activity_host = {
				save_scope_as = lunatic_host
			}
		}
	}

	option = { #Come now, let's go outside
		name = feast_default.5002.a
		scope:lunatic_host = {
			add_opinion = {
				modifier = kindness_opinion
				target = root
				opinion = 20
			}
		}
		stress_impact = {
			sadistic = medium_stress_impact_gain
			callous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.75
			}
		}
	}

	option = { #I will stop them!
		name = feast_default.5002.b
		scope:activity = {
			every_attending_character = {
				custom = every_guest_scope_tt
				limit = {
					NOT = { this = root }
				}
				add_opinion = {
					target = root
					modifier = respect_opinion
					opinion = 10
				}
			}
		}
		scope:lunatic_host = {
			add_opinion = {
				modifier = rude_opinion
				target = root
			}
		}
		stress_impact = {
			compassionate = minor_stress_impact_gain
		}
		add_prestige = medium_prestige_gain
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_rationality = 0.5
			}
		}
	}

	option = { #Also lunatic, join in on the fun
		name = feast_default.5002.c
		trigger = {
			has_trait = lunatic
		}
		trait = lunatic_1
		trait = lunatic_genetic
		exclusive = yes
		scope:lunatic_host = {
			add_opinion = {
				modifier = friendliness_opinion
				target = root
				opinion = 20
			}
		}
		stress_impact = {
			base = medium_stress_impact_loss
		}
	}
}


#####################
# Host is sadistic
# by Linnéa Thimrén
#####################
scripted_trigger feast_default_5003_guest_trigger = {
	feast_default_participant_trigger = yes
	NOT = { this = root }
	NOT = {	this = scope:activity.activity_host }
	is_ai = yes
	root = {
		can_add_hook = {
			target = prev
			type = favor_hook
		}
	}
}


feast_default.5003 = {
	type = activity_event
	title = feast_default.5003.t
	desc = feast_default.5003.desc
	theme = feast_activity
	left_portrait = {
		character = scope:guest
		animation = fear
	}
	right_portrait = {
		character = scope:sadistic_host
		animation = schadenfreude
	}
	cooldown = { years = 1 }

	trigger = {
		NOT = { exists = local_var:had_5003 }
		scope:activity = {
			activity_host = {
				NOT = { this = root }
				is_alive = yes
				is_imprisoned = no
				has_trait = sadistic
			}
			any_attending_character = {
				feast_default_5003_guest_trigger = yes
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_5003
			value = yes
		}
		scope:activity = {
			activity_host = {
				save_scope_as = sadistic_host
			}
			random_attending_character = {
				limit = {
					feast_default_5003_guest_trigger = yes
				}
				weight = {
					base = 1
					modifier = { #Less likely to pick someone you actively dislike
						add = -0.75
						OR = {
							has_relation_rival = root
							has_relation_potential_rival = root
							reverse_opinion = {
								target = root
								value <= -10
							}
						}
					}
					modifier = { #More likely to pick someone that matters
						add = 0.75
						is_powerful_vassal = yes
					}
					modifier = { #More likely to pick someone that matters
						add = 0.75
						save_temporary_scope_as = guest_check
						scope:sadistic_host = {
							any_councillor = {
								this = scope:guest_check
							}
						}
					}
					modifier = { #More likely to pick someone that matters
						add = 0.75
						is_of_major_interest_to_root_trigger = yes
					}
				}
				save_scope_as = guest
			}
		}
	}

	option = { #This has to stop!
		name = feast_default.5003.a
		scope:activity = {
			every_attending_character = {
				limit = {
					NOT = { this = root }
				}
				custom = every_guest_scope_tt
				add_opinion = {
					target = root
					modifier = respect_opinion
					opinion = 10
				}
			}
		}
		scope:sadistic_host = {
			add_opinion = {
				modifier = rude_opinion
				target = root
			}
		}
		add_prestige = medium_prestige_gain
		stress_impact = {
			craven = major_stress_impact_gain
			shy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				OR = {
					has_trait = brave
					has_trait = vengeful
					has_trait = wrathful
					has_trait = just
				}
			}
			modifier = {
				add = 20
				OR = {
					has_trait = arrogant
					has_trait = zealous
				}
			}
		}
	}

	option = { #I'm too scared to intervene
		name = feast_default.5003.b
		add_hook = {
			target = scope:guest
			type = favor_hook
		}
		stress_impact = {
			wrathful = medium_stress_impact_gain
			callous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.75
			}
		}
	}

	option = { #Also sadistic, what a party!
		name = feast_default.5003.c
		trigger = {
			has_trait = sadistic
		}
		trait = sadistic
		exclusive = yes

		scope:sadistic_host = {
			add_opinion = {
				modifier = friendliness_opinion
				target = root
				opinion = 20
			}
		}
		stress_impact = {
			base = minor_stress_loss
		}
		ai_chance = {
			base = 100
		}
	}
}


#####################
# Host is a reveler, offers you more! More!
# by Petter Vilberg
#####################
feast_default.5004 = {
	type = activity_event
	title = feast_default.5004.t
	desc = feast_default.5004.desc
	theme = feast_activity
	left_portrait = {
		character = scope:host
		animation = wedding_drunk
	}
	right_portrait = {	
		character = root
		animation = toast_goblet
	}
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { exists = local_var:had_5004 }
		scope:activity.activity_host = {
			NOT = { this = root }
			is_alive = yes
			is_imprisoned = no
			has_trait = lifestyle_reveler
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 0.5
			has_trait = lifestyle_reveler
		}
		modifier = {
			add = 0.5
			has_trait = lifestyle_reveler
			has_trait_xp = {
				trait = lifestyle_reveler
				value >= 50
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_5004
			value = yes
		}
	}

	option = { #This is great!
		name = feast_default.5004.a
		random = {
			chance = 10
			add_trait = drunkard
		}
		scope:host = {
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = 15
			}
		}
		hidden_effect = { #Progress in the reveler lifestyle
			if = {
				limit = { NOT = { has_variable = reveler_lifestyle_progress } }
				set_variable = {
					name = reveler_lifestyle_progress
					value = 1
				}
			}
			else = {
				change_variable = {
					name = reveler_lifestyle_progress
					add = 1
				}
			}
		}
		stress_impact = {
			lifestyle_reveler = minor_stress_impact_loss
			comfort_eater = minor_stress_impact_loss
			drunkard = minor_stress_impact_loss
			shy = minor_stress_impact_gain
			temperate = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 1
			}
			modifier = {
				add = 100
				has_trait = lifestyle_reveler
			}
		}
	}

	option = { #No, I cannot take anymore
		name = feast_default.5004.b
		scope:host = {
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = -10
			}
		}
		stress_impact = {
			gregarious = minor_stress_impact_gain
			gluttonous = minor_stress_impact_gain
			inappetetic = minor_stress_impact_loss
		}
	}

	option = { #Make yourself disappear
		name = feast_default.5004.c
		trigger = {
			OR = {
				has_trait = shy
				has_trait = reclusive
			}
		}
		trait = shy
		trait = reclusive
		reverse_add_opinion = {
			target = scope:host
			modifier = respect_opinion
			opinion = -10
		}
		stress_impact = {
			shy = medium_stress_loss
			reclusive = medium_stress_impact_loss
		}
		ai_chance = {
			base = 1000
		}
	}
}


################################
# You just love garum
# by Petter Vilberg
################################
feast_default.5005 = {
	type = activity_event
	title = feast_default.5005.t
	desc = feast_default.5005.desc
	theme = feast_activity
	left_portrait = {
		character = scope:host
		animation = happiness
	}
	right_portrait = {
		character = root
		animation = dancing
	}
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { exists = local_var:had_5005 }
		NOT = { scope:activity.activity_host = root }
		NOR = {
			has_character_modifier = feast_hearty_diet_modifier
			has_character_modifier = feast_obsessed_with_garum_modifier
		}
		scope:activity.activity_host = {
			is_alive = yes
			is_imprisoned = no
			culture = {		
				OR = {
					has_cultural_pillar = heritage_byzantine
					has_cultural_pillar = heritage_arabic
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		set_local_variable = {
			name = had_5005
			value = yes
		}
		scope:activity.activity_host = {
			save_scope_as = host
		}
	}

	option = { # I need to eat this regularly!
		name = feast_default.5005.a
		add_character_modifier = {
			modifier = feast_hearty_diet_modifier
			years = 10
		}
	}

	option = { # Wow, this is incredible, host!
		name = feast_default.5005.b
		add_opinion = {
			target = scope:host
			modifier = compliment_opinion
			opinion = 20
		}
	}

	option = { # I know a fun fact!
		name = feast_default.5005.c
		flavor = feast_default.5005.c.flavor
		trigger = {
			OR = {
				has_trait = scholar
				has_trait = education_learning_4
				has_trait = education_learning_5
				has_trait = intellect_good_2
				has_trait = intellect_good_3
			}
		}
		trait = scholar
		trait = education_learning_4
		trait = intellect_good_2
		trait = intellect_good_3

		add_prestige = medium_prestige_gain
	}

	option = { # Yes, more garum!
		name = feast_default.5005.d
		trigger = { has_trait = gluttonous }
		trait = gluttonous
		add_character_modifier = {
			modifier = feast_obsessed_with_garum_modifier
			years = 10
		}
	}
}


################################
# Time to spread a legend!
# by James Beaumont
################################
feast_default.5010 = {
	type = activity_event
	title = feast_default.5010.t
	desc = feast_default.5010.desc
	theme = feast_activity
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:rando_guest
		animation = admiration
	}
	cooldown = { years = 3 }
	
	trigger = {
		has_activity_intent = spread_legend_intent
		scope:activity = {
			any_attending_character = {
				is_adult = yes
				is_ai = yes
				is_landed = yes
			}
		}
	}

	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					is_adult = yes
					is_ai = yes
					is_landed = yes
				}
				save_scope_as = rando_guest
			}
		}
	}

	option = { # Did you ever hear the tale of Solomon the Wise? I thought not...
		name = feast_default.5010.a
		duel = {
			skill = diplomacy
			target = scope:rando_guest
			50 = {
				desc = feast_default.5010.a.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				send_interface_toast = {
					title = feast_default.5010.a.success
					left_icon = root
					right_icon = scope:rando_guest
					add_prestige = medium_prestige_gain
					scope:rando_guest = {
						set_promoted_legend = root.promoted_legend
					}
				}
			}
			50 = {
				desc = feast_default.5010.a.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				send_interface_toast = {
					title = feast_default.5010.a.failure
					left_icon = root
					right_icon = scope:rando_guest
					add_prestige = minor_prestige_loss
				}
			}
		}
	}

	option = { # Everyone must hear the legend!
		name = feast_default.5010.b
		add_character_modifier = {
			modifier = ce1_legendary_feaster
			years = 15
		}
	}

	option = { # I'll just enjoy the quiet for a moment
		name = feast_default.5010.c
		add_stress = medium_stress_loss
	}
}

################################
# Let's talk about how great of a king I am!
# by James Beaumont
################################
feast_default.5020 = {
	type = activity_event
	title = feast_default.5020.t
	desc = feast_default.5020.desc
	theme = feast_activity
	left_portrait = {
		character = root
		animation = happiness
	}
	cooldown = { years = 3 }
	
	trigger = {
		has_activity_intent = legitimacy_intent
	}

	option = { # I have the wit of TricksterGodName!
		name = feast_default.5020.a
		duel = {
			skills = { diplomacy intrigue }
			value = decent_skill_rating
			50 = {
				desc = feast_default.5020.a.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				send_interface_toast = {
					title = feast_default.5020.a.success
					left_icon = root
					add_legitimacy = medium_legitimacy_gain
				}
			}
			50 = {
				desc = feast_default.5020.a.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				send_interface_toast = {
					title = feast_default.5020.a.failure
					left_icon = root
					add_legitimacy = minor_legitimacy_gain
				}
			}
		}
	}

	option = { # I have the wisdom of KnowledgeGodName!
		name = feast_default.5020.b
		duel = {
			skills = { learning stewardship }
			value = decent_skill_rating
			50 = {
				desc = feast_default.5020.a.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				send_interface_toast = {
					title = feast_default.5020.a.success
					left_icon = root
					add_legitimacy = medium_legitimacy_gain
				}
			}
			50 = {
				desc = feast_default.5020.a.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				send_interface_toast = {
					title = feast_default.5020.a.failure
					left_icon = root
					add_legitimacy = minor_legitimacy_gain
				}
			}
		}
	}

	option = { # I have the heart and stomach of WarGodName!
		name = feast_default.5020.c
		duel = {
			skills = { martial prowess }
			value = decent_skill_rating
			50 = {
				desc = feast_default.5020.a.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				send_interface_toast = {
					title = feast_default.5020.a.success
					left_icon = root
					add_legitimacy = medium_legitimacy_gain
				}
			}
			50 = {
				desc = feast_default.5020.a.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				send_interface_toast = {
					title = feast_default.5020.a.failure
					left_icon = root
					add_legitimacy = minor_legitimacy_gain
				}
			}
		}
	}

	option = { # I'll just enjoy the quiet for a moment
		name = feast_default.5020.d
		add_stress = medium_stress_loss
	}
}

#################################
# HOST EVENTS
# 6000-6999
#################################

#####################
# Your spouse is doing an incredible job
# by Petter Vilberg
#####################
feast_default.6001 = {
	type = activity_event
	title = feast_default.6001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					reverse_opinion = {
						target = scope:spouse
						value < 0
					}
				}
				desc = feast_default.6001.dislike_spouse
			}
			desc = feast_default.6001.like_spouse
		}
	}
	theme = feast_activity
	left_portrait = {
		character = scope:spouse
		animation = personality_bold
	}
	right_portrait = {
		character = root
		animation = admiration
	}
	cooldown = { years = 1 }
	
	trigger = {
		NOR = {
			exists = local_var:had_6001
			exists = local_var:had_6002
		}
		any_spouse = {
			is_available = yes
			NOT = { has_trait = lazy }
		}
	}

	immediate = {
		set_local_variable = {
			name = had_6001
			value = yes
		}
		random_spouse = {
			limit = {
				has_trait = diligent
			}
			alternative_limit = {
				NOT = { has_trait = lazy }
			}
			save_scope_as = spouse
		}
	}

	option = {
		name = feast_default.6001.a
		add_character_modifier = {
			modifier = feast_household_efforts_modifier
			years = 5
		}
		hidden_effect = {
			add_opinion = {
				target = scope:spouse
				modifier = feast_spouse_doing_impressive_job_opinion
			}
		}
		stress_impact = {
			base = minor_stress_loss
		}
	}
}


#####################
# Guest compliments you on your feast
# by Petter Vilberg
#####################
feast_default.6002 = {
	type = activity_event
	title = feast_default.6002.t
	desc = feast_default.6002.desc
	left_portrait = {
		character = scope:guest
		animation = happiness
	}
	center_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = shy
					has_trait = reclusive
					has_trait = humble
					has_trait = content
				}
			}
			animation = personality_content
		}
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:spouse
		animation = dancing
	}
	theme = feast_activity
	cooldown = { years = 1 }
	
	trigger = {
		scope:activity = {
			OR = {
				AND = {
					has_activity_type = activity_wedding
					has_activity_option = {
						category = wedding_option_food
						option = wedding_food_good
					}
				}
				AND = {
					has_activity_type = activity_feast
					has_activity_option = {
						category = feast_option_food
						option = feast_food_good
					}
				}
			}
		}
		NOR = {
			exists = local_var:had_6002
			exists = local_var:had_6001
		}
		scope:activity = {
			activity_host = {
				is_married = yes
				primary_partner = { 
					feast_default_participant_trigger = yes
				}
			}
			any_attending_character = {
				feast_default_participant_trigger = yes
				NOT = { this = root }
				NOT = { this = scope:activity.activity_host.primary_partner }
				opinion = {
					target = scope:activity.activity_host
					value >= 20
				}
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_6002
			value = yes
		}
		primary_partner = {
			save_scope_as = spouse
		}

		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_participant_trigger = yes
					NOT = { this = scope:spouse } # Spouse should not compliment themselves
					opinion = {
						target = scope:activity.activity_host
						value >= 20
					}
				}
				save_scope_as = guest
			}
		}
	}

	option = { # Yes, I've really done something here
		name = feast_default.6002.a
		ai_chance = {
			base = 100
			modifier = {
				add = 100
				has_trait = arrogant
			}
		}
		stress_impact = {
			humble = medium_stress_impact_gain
			family_first = minor_stress_impact_gain
		}
		add_prestige = medium_prestige_gain
		reverse_add_opinion = {
			target = scope:spouse
			modifier = feast_spouse_did_not_credit_me_opinion
		}
	}	

	option = { #It is all thanks to my spouse
		name = feast_default.6002.b
		trigger = {
			exists = scope:spouse
		}
		add_character_modifier = {
			modifier = feast_household_efforts_modifier
			years = 5
		}
		reverse_add_opinion = {
			target = scope:spouse
			modifier = feast_spouse_gave_me_credit_opinion
		}
		stress_impact = {
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			compare_modifier = {
				target = scope:activity.activity_host
				value = ai_honor
			}
			opinion_modifier = {
				opinion_target = scope:spouse
				min = -99
			}
		}
	}
}

#####################
# Two guests get into a fight
# by Petter Vilberg
#####################

scripted_trigger feast_default_6003_fighter_2_temp_trigger = {
	feast_default_participant_trigger = yes
	NOT = { this = scope:fighter_1_temp }
	OR = {
		has_relation_rival = scope:fighter_1_temp
		AND = {
			opinion = {
				target = scope:fighter_1_temp
				value <= -20
			}
			reverse_opinion = {
				target = scope:fighter_1_temp
				value <= -20	
			}
			OR = {
				AND = {
					is_female = yes
					scope:fighter_1_temp = { is_female = yes }
				}
				AND = {
					is_male = yes
					scope:fighter_1_temp = { is_male = yes }
				}
			}
		}
	}
}

scripted_trigger feast_default_6003_fighter_2_trigger = {
	feast_default_participant_trigger = yes
	NOT = { this = root }
	NOT = { this = scope:fighter_1 }
	OR = {
		has_relation_rival = scope:fighter_1
		AND = {
			opinion = {
				target = scope:fighter_1
				value <= -20
			}
			reverse_opinion = {
				target = scope:fighter_1
				value <= -20	
			}
			OR = {
				AND = {
					is_female = yes
					scope:fighter_1 = { is_female = yes }
				}
				AND = {
					is_male = yes
					scope:fighter_1 = { is_male = yes }
				}
			}
		}
	}
}

scripted_trigger feast_default_6003_fighter_1_trigger = {
	feast_default_participant_trigger = yes
	save_temporary_scope_as = fighter_1_temp
	NOT = { this = root }
	scope:activity = {
		any_attending_character = {
			feast_default_6003_fighter_2_temp_trigger = yes
		}
	}
}

feast_default.6003 = {
	type = activity_event
	title = feast_default.6003.t
	desc = {
		desc = feast_default.6003.opening
		desc = feast_default.6003.guard
	}
	theme = feast_activity
	center_portrait = {
		character = scope:fighter_1
		animation = wrestling_victory
	}
	right_portrait = {
		character = scope:fighter_2
		animation = aggressive_unarmed
	}
	cooldown = { years = 1 }
	
	trigger = {
		NOT = { exists = local_var:had_6003 }
		NOT = { exists = local_var:had_6351 }
		scope:activity = {
			any_attending_character = {
				feast_default_6003_fighter_1_trigger = yes
				save_temporary_scope_as = fighter_1_temp
			}
			any_attending_character = {
				feast_default_6003_fighter_2_temp_trigger = yes
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_6003
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_6003_fighter_1_trigger = yes
				}
				save_scope_as = fighter_1
			}
			random_attending_character = {
				limit = {
					feast_default_6003_fighter_2_trigger = yes
				}
				save_scope_as = fighter_2
			}
		}
	}

	option = { #Side with fighter_1
		name = feast_default.6003.a
		reverse_add_opinion = {
			target = scope:fighter_1
			modifier = feast_sided_with_me_in_my_fight_opinion
		}
		progress_towards_friend_effect = {
			REASON = friend_took_side_in_fight
			CHARACTER = scope:fighter_1
			OPINION = 0
		}
		reverse_add_opinion = {
			target = scope:fighter_2
			modifier = feast_sided_against_me_in_my_fight_opinion
		}
		progress_towards_rival_effect = {
			CHARACTER = scope:fighter_2
			REASON = rival_other_fighter_side
			OPINION = 0
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:fighter_1
				min = -99
			}
			modifier = {
				add = 500
				has_relation_friend = scope:fighter_1
			}
		}
	}

	option = { #Side with fighter_2
		name = feast_default.6003.b
		reverse_add_opinion = {
			target = scope:fighter_2
			modifier = feast_sided_with_me_in_my_fight_opinion
		}
		progress_towards_friend_effect = {
			REASON = friend_took_side_in_fight
			CHARACTER = scope:fighter_2
			OPINION = 0
		}
		reverse_add_opinion = {
			target = scope:fighter_1
			modifier = feast_sided_against_me_in_my_fight_opinion
		}
		progress_towards_rival_effect = {
			CHARACTER = scope:fighter_1
			REASON = rival_other_fighter_side
			OPINION = 0
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:fighter_1
				min = -99
			}
			modifier = {
				add = 500
				has_relation_friend = scope:fighter_1
			}
		}
	}	

	option = { #Resolve fight amicably
		name = feast_default.6003.c
		trigger = {
			diplomacy >= 15
		}
		skill = diplomacy
		add_prestige = medium_prestige_gain
	}
}


#####################
# Guest is having a hard time socializing - help or laugh at them!
# by Linnéa Thimrén
#####################
feast_default.6101 = {
	type = activity_event
	title = feast_default.6101.t
	desc = {
		desc = feast_default.6101.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = liked_by_host
				}
				desc = feast_default.6101.desc_liked
			}
			triggered_desc = {
				trigger = {
					has_character_flag = disliked_by_host
					scope:troubled_guest = { is_landed = no }
				}
				desc = feast_default.6101.desc_disliked_unlanded
			}
			triggered_desc = {
				trigger = {
					has_character_flag = disliked_by_host
					scope:troubled_guest = { is_landed = yes }
				}
				desc = feast_default.6101.desc_disliked
			}
		}
	}
	theme = feast_activity
	left_portrait = {
		character = scope:troubled_guest
		animation = paranoia
	}
	right_portrait = {
		character = root
		animation = personality_compassionate
	}
	cooldown = { years = 1 }

	trigger = {
		NOT = { exists = local_var:had_6101 }
		scope:activity = {
			any_attending_character = {
				feast_default_participant_trigger = yes
				NOT = { this = root }
				has_trait = shy
				save_temporary_scope_as = guest_check
			}
		}
		can_add_hook = {
			target = scope:guest_check
			type = favor_hook
		}
	}

	immediate = {
		set_local_variable = {
			name = had_6101
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_participant_trigger = yes
					NOT = { this = root }
					has_trait = shy
				}
				weight = {
					base = 1
					modifier = { #More likely to pick someone that matters
						add = 0.75
						is_powerful_vassal = yes
					}
					modifier = { #More likely to pick someone that matters
						add = 0.75
						save_temporary_scope_as = guest_check
						root = {
							any_councillor = {
								this = scope:guest_check
							}
						}
					}
					modifier = { #More likely to pick someone that matters
						add = 0.75
						is_of_major_interest_to_root_trigger = yes
					}
				}
				save_scope_as = troubled_guest
			}
		}
		if = {
			limit = {
				OR = {
					has_relation_friend = scope:troubled_guest
					has_relation_potential_friend = scope:troubled_guest
					has_relation_lover = scope:troubled_guest
					has_relation_potential_lover = scope:troubled_guest
					opinion = {
						target = scope:troubled_guest
						value >= 10
					}
				}
			}
			add_character_flag = {
				flag = liked_by_host
				days = 10
			}
		}
		else = {
			add_character_flag = {
				flag = disliked_by_host
				days = 10
			}
		}
	}

	option = { #you save them from having to be social
		name = feast_default.6101.a
		if = {
			limit = {
				can_add_hook = {
					target = scope:troubled_guest
					type = favor_hook
				}
			}
			reverse_add_opinion = {
				modifier = kindness_opinion
				target = scope:troubled_guest
				opinion = 15
			}
			add_hook = {
				target = scope:troubled_guest
				type = favor_hook
			}
		}
		else = {
			reverse_add_opinion = {
				modifier = kindness_opinion
				target = scope:troubled_guest
				opinion = 30
			}
		}
		stress_impact = {
			shy = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.7
				ai_honor = 0.25
				ai_boldness = 0.25
			}
		}
	}

	option = { #Mercilessly push them
		name = feast_default.6101.b
		reverse_add_opinion = {
			modifier = cruelty_opinion
			target = scope:troubled_guest
			opinion = -20
		}
		progress_towards_rival_effect = {
			CHARACTER = scope:troubled_guest
			REASON = rival_mercilessly_pushed
			OPINION = 0
		}
		scope:activity = {
			every_attending_character = {
				limit = {
					feast_default_participant_trigger = yes
					NOT = {	this = scope:troubled_guest	}
				}
				custom = every_guest_scope_tt
				add_opinion = {
					target = root
					modifier = friendliness_opinion
					opinion = 10
				}
			}
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
			shy = medium_stress_impact_gain
			sadistic = medium_stress_impact_loss
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = 0.5
				ai_energy = 0.25
				ai_boldness = 0.25
			}
		}
	}

	option = { #You save him
		name = feast_default.6101.c
		flavor = feast_default.6101.c.tt
		trigger = {
			OR = {
				has_trait = shy
				has_trait = reclusive
			}
		}
		trait = shy
		trait = reclusive
		add_prestige = medium_prestige_loss
		reverse_add_opinion = {
			modifier = friendliness_opinion
			target = scope:troubled_guest
			opinion = 20
		}
		progress_towards_friend_effect = {
			REASON = friend_saved_troubled_guest
			CHARACTER = scope:troubled_guest
			OPINION = 0
		}
		add_hook = {
			target = scope:troubled_guest
			type = favor_hook
		}
		stress_impact = {
			shy = minor_stress_impact_loss
			reclusive = medium_stress_impact_loss
			sadistic = medium_stress_impact_gain
			callous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				has_trait = shy
			}
			ai_value_modifier = {
				ai_compassion = 0.7
				ai_honor = 0.25
			}
		}
	}
}


#####################
# A guest rambles on and on
# by Linnéa Thimrén
#####################
scripted_trigger feast_default_6111_character_trigger = {
	feast_default_participant_trigger = yes
	NOT = { this = root }
}

feast_default.6111 = {
	type = activity_event
	title = feast_default.6111.t
	desc = feast_default.6111.desc
	theme = feast_activity
	left_portrait = {
		character = scope:guest_to_talk_to
		animation = thinking
	}
	right_portrait = {
		character = root
		animation = boredom
	}
	cooldown = { years = 1 }

	trigger = {
		NOT = { exists = local_var:had_6111 }
		scope:activity = {
			any_attending_character = {
				feast_default_6111_character_trigger = yes
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_6111
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_6111_character_trigger = yes
					#to prioritize characters that you want to get to know
					OR = { #Either I am trying to befriend them, or them me, or I just wanna promote my legend to anyone who will listen
						AND = {
							has_activity_intent = befriend_attendee_intent
							intent_target ?= {
								is_alive = yes
								this = root
							}
						}
						root = {
							has_activity_intent = befriend_attendee_intent
							intent_target ?= prev
						}
						root = {
							has_activity_intent = spread_legend_intent
						}
					}
				}
				alternative_limit = {
					feast_default_6111_character_trigger = yes
					has_same_education_trait_as_character_trigger = {
						CHARACTER = root
					}
				}
				alternative_limit = {
					feast_default_6111_character_trigger = yes
				}
				weight = {
					base = 1
					modifier = { #More likely to pick someone that matters
						add = 0.75
						is_of_major_interest_to_root_trigger = yes
					}
					modifier = { #More likely to pick someone that matters
						add = 0.75
						is_powerful_vassal = yes
					}
					modifier = { #More likely to pick someone that matters
						add = 0.5
						save_temporary_scope_as = guest_check
						root = {
							any_councillor = {
								this = scope:guest_check
							}
						}
					}
				}
				save_scope_as = guest_to_talk_to
			}
		}
	}

	option = { #you're actually interested
		name = feast_default.6111.a
		
		add_character_modifier = {
			modifier = feast_had_interesting_conversation_modifier
			years = 10
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_honor = 0.25
				ai_rationality = 0.25
			}
		}
	}

	option = { #Let's talk about you instead
		name = feast_default.6111.b
		progress_towards_friend_effect = {
			REASON = friend_showed_personal_interest
			CHARACTER = scope:guest_to_talk_to
			OPINION = 20
		}
		stress_impact = {
			compassionate = medium_stress_impact_loss
			gregarious = medium_stress_impact_loss
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				OR = {
					scope:guest_to_talk_to = {
						any_targeting_scheme = {
							scheme_owner = root
							scheme_type = befriend
						}
					}
					number_of_personality_traits_in_common = {
						target = scope:guest_to_talk_to
						value >= 2
					}
					scope:guest_to_talk_to = {
						has_same_education_trait_as_character_trigger = {
							CHARACTER = root
						}
					}
				}
			}
		}
	}

	option = { #they just won't shut up!
		name = feast_default.6111.c
		trigger = {
			OR = {
				has_trait = sadistic
				has_trait = callous
				has_trait = irritable
			}
		}
		trait = sadistic
		trait = callous
		trait = irritable
		scope:activity = {
			every_attending_character = {
				limit = {
					feast_default_participant_trigger = yes
					NOT = { this = scope:guest_to_talk_to }
					ai_compassion <= medium_negative_compassion
				}
				custom = every_evil_guest_scope_tt
				add_opinion = {
					target = root
					modifier = amused_opinion
					opinion = 10
				}
			}
		}
		reverse_add_opinion = {
			modifier = publicly_ridiculed
			target = scope:guest_to_talk_to
		}
		if = {
			limit = {
				can_set_relation_potential_rival_trigger = { CHARACTER = scope:guest_to_talk_to }
			}
			set_relation_potential_rival = scope:guest_to_talk_to
		}
		add_prestige = minor_prestige_gain
		stress_impact = {
			sadistic = medium_stress_impact_loss
			callous = minor_stress_impact_loss
			irritable = medium_stress_impact_loss
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 50
				opinion = {
					target = scope:guest_to_talk_to
					value <= 0
				}
			}
			ai_value_modifier = {
				ai_vengefulness = 0.75
				ai_compassion = -0.5
			}
		}
	}

	option = { #Let's change subjects to my legend!
		name = feast_default.6111.d
		trigger = {
			has_activity_intent = spread_legend_intent
		}
		if = { # If they're a nobody I don't care about, give me a neat modifier
			limit = {
				scope:guest_to_talk_to = {
					OR = {
						highest_held_title_tier <= tier_county
						exists = promoted_legend
					}
				}
			}
			add_character_modifier = {
				modifier = ce1_legendary_feaster
				years = 15
			}
		}
		else = {
			duel = {
				skill = diplomacy
				target = scope:guest_to_talk_to
				50 = {
					desc = feast_default.6111.d.success
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
					}
					send_interface_toast = {
						title = feast_default.6111.d.success
						left_icon = root
						right_icon = scope:guest_to_talk_to
						add_prestige = medium_prestige_gain
						scope:guest_to_talk_to = {
							set_promoted_legend = root.promoted_legend
						}
					}
				}
				50 = {
					desc = feast_default.6111.d.failure
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
					}
					send_interface_toast = {
						title = feast_default.6111.d.failure
						left_icon = root
						right_icon = scope:guest_to_talk_to
						add_prestige = minor_prestige_loss
					}
				}
			}
		}
		ai_chance = {
			base = 500
		}
	}

	option = { #Let's talk about how great of a king I am!
		name = feast_default.6111.e
		trigger = {
			has_activity_intent = legitimacy_intent
		}
		add_legitimacy = minor_legitimacy_gain
		ai_chance = {
			base = 500
		}
	}
}

#####################
# Serve a guest food you know they hate
# by Linnéa Thimrén
#####################
feast_default.6121 = {
	type = activity_event
	title = feast_default.6121.t
	desc = feast_default.6121.desc
	theme = feast_activity
	right_portrait = {
		character = scope:hated_guest
		animation = poison
	}
	left_portrait = {
		character = root
		animation = schadenfreude
	}
	cooldown = { years = 1 }

	trigger = {
		NOT = { exists = local_var:had_6121 }
		scope:activity = {
			activity_host = root
			any_attending_character = {
				NOT = { this = root }
				feast_default_participant_trigger = yes
				opinion = {
					target = scope:activity.activity_host
					value <= -10
				}
				save_temporary_scope_as = guest_check
				root = {
					can_add_hook = {
						target = scope:guest_check
						type = favor_hook
					}
				}
			}
		}
	}

	weight_multiplier = {
		base = 0.5
		modifier = { #More likely if there's someone you actually dislike
			scope:activity = {
				any_attending_character = {
					NOT = { this = root }
					feast_default_participant_trigger = yes
					OR = {
						opinion = {
							target = scope:activity.activity_host
							value <= -40
						}
						has_relation_rival = scope:activity.activity_host
						has_relation_potential_rival = scope:activity.activity_host
					}
					save_temporary_scope_as = guest_check
					root = {
						can_add_hook = {
							target = scope:guest_check
							type = favor_hook
						}
					}
				}
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_6121
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					NOT = { this = root }
					feast_default_participant_trigger = yes
					has_relation_rival = scope:activity.activity_host
					save_temporary_scope_as = guest_check
					root = {
						can_add_hook = {
							target = scope:guest_check
							type = favor_hook
						}
					}

				}
				alternative_limit = {
					NOT = { this = root }
					feast_default_participant_trigger = yes
					has_relation_potential_rival = scope:activity.activity_host
					save_temporary_scope_as = guest_check
					root = {
						can_add_hook = {
							target = scope:guest_check
							type = favor_hook
						}
					}
				}
				alternative_limit = {
					feast_default_participant_trigger = yes
					opinion = {
						target = scope:activity.activity_host
						value <= -20
					}
					save_temporary_scope_as = guest_check
					root = {
						can_add_hook = {
							target = scope:guest_check
							type = favor_hook
						}
					}
				}
				alternative_limit = {
					NOT = { this = root }
					feast_default_participant_trigger = yes
					opinion = {
						target = scope:activity.activity_host
						value <= -10
					}
					save_temporary_scope_as = guest_check
					root = {
						can_add_hook = {
							target = scope:guest_check
							type = favor_hook
						}
					}
				}
				weight = {
					base = 1
					modifier = { #Less likely to choose someone you probably like
						add = -1
						OR = {
							has_relation_friend = root
							has_relation_potential_friend = root
							has_relation_lover = root
							has_relation_potential_lover = root
						}
					}
					modifier = { #More likely to choose someone you want dead
						add = 1
						any_targeting_scheme = {
							scheme_owner = root
							scheme_type = murder
						}
					}
				}
				save_scope_as = hated_guest
			}
		}
	}

	option = { #Laugh as they suffer
		name = feast_default.6121.a
		scope:hated_guest = {
			add_character_modifier = {
				modifier = feast_bad_reaction_to_food
				years = 7
			}
		}
		if = {
			limit = {
				OR = {
					can_set_relation_potential_rival_trigger = { CHARACTER = scope:hated_guest }
					can_set_relation_rival_trigger = { CHARACTER = scope:hated_guest }
				}
			}
			progress_towards_rival_effect = {
				CHARACTER = scope:hated_guest
				REASON = rival_served_food
				OPINION = 0
			}
		}
		else = {
			scope:hated_guest = {
				add_opinion = {
					target = root
					modifier = cruelty_opinion
					opinion = -20
				}
			}
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 0.5
				ai_boldness = 0.25
				ai_compassion = -0.25
			}
		}
	}

	option = { #"Save" them
		name = feast_default.6121.b
		add_prestige = minor_prestige_gain
		add_hook = {
			type = favor_hook
			target = scope:hated_guest
		}
		stress_impact = {
			sadistic = medium_stress_impact_gain
			vengeful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_compassion = 0.75
				ai_honor = 0.25
			}
		}
	}
}


#####################
# There's no more wine!
# by Linnéa Thimrén
#####################
feast_default.6231 = {
	type = activity_event
	title = feast_default.6231.t
	desc = feast_default.6231.desc
	theme = feast_activity
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:drunk_guest
		animation = wedding_drunk
	}
	override_background = { reference = bp1_wine_cellar }
	cooldown = { months = 6 } 
	trigger = {
		drinks_alcohol_trigger = yes
		scope:activity = {
			any_attending_character = {
				count > 2
				NOT = { this = root }
				drinks_alcohol_trigger = yes
			}
		}
	}

	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					NOT = { this = root }
					exists = scope:activity.special_guest:honorary_guest_regular
					this = scope:activity.special_guest:honorary_guest_regular
					drinks_alcohol_trigger = yes
				}
				alternative_limit = {
					NOT = { this = root }
					drinks_alcohol_trigger = yes
				}
				save_scope_as = drunk_guest
			}
		}
	}

	option = { #We must buy more!
		name = feast_default.6231.a
		trigger = {
			short_term_gold >= activity_medium_gold_value
		}
		show_as_unavailable = {
			short_term_gold < activity_medium_gold_value
		}
		scope:activity = {
			every_attending_character = {
				limit = {
					NOT = { this = root }
					feast_default_participant_trigger = yes
				}
				custom = every_guest_scope_tt
				add_opinion = {
					target = root
					modifier = pleased_opinion
					opinion = 10
				}
			}
			if = {
				limit = {
					any_attending_character = {
						NOT = { this = root }
						has_trait = drunkard
					}
				}
				every_attending_character = {
					limit = {
						NOT = { this = root }
						feast_default_participant_trigger = yes
						has_trait = drunkard
					}
					custom = every_drunkard_guest_scope_tt
					add_opinion = {
						target = root
						modifier = grateful_opinion
						opinion = 20
					}
				}
			}
		}
		add_character_modifier = {
			modifier = feast_bought_more_drink_modifier
			years = 10
		}
		remove_short_term_gold = activity_medium_gold_value
		stress_impact = {
			greedy = medium_stress_impact_gain
			drunkard = medium_stress_impact_loss
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_energy = 0.5
				ai_honor = 0.25
				ai_compassion = 0.25
			}
		}
	}

	option = { #We all have to pitch in!
		name = feast_default.6231.b
		add_prestige = minor_prestige_loss
		add_gold = minor_gold_value
		stress_impact = {
			just = medium_stress_impact_gain
			generous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_greed = 0.5
			}
		}
	}

	option = { #I have a private stash!
		name = feast_default.6231.c
		trigger = {
			has_trait = lifestyle_reveler
		}
		trait = lifestyle_reveler
		add_prestige = medium_prestige_gain
		add_character_modifier = {
			modifier = feast_bought_more_drink_modifier
			years = 10
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 500
		}
	}

	option = { #Let's bring out my finer wines.
		name = feast_default.6231.d
		trigger = {
			domicile ?= { has_domicile_building_or_higher = wine_cellar_01 }
		}
		reason = estate_building_wine_cellar
		
		change_influence = minor_influence_gain
		
		stress_impact = {
			generous = minor_stress_impact_loss
			gluttonous = minor_stress_impact_loss
		}
		ai_chance = {
			base = 50
			
			modifier = {
				add = 50
				has_trait = ambitious
			}
		}
	}
}


#####################
# Chance to become friend or rival
# by Linnéa Thimrén
#####################
scripted_trigger feast_default_participant_requirements_trigger = {
	feast_default_participant_trigger = yes
	NOR = {
		has_relation_friend = root
		has_relation_rival = root
		has_relation_lover = root
	}
}

feast_default.6251 = {
	type = activity_event
	title = feast_default.6251.t
	desc = feast_default.6251.desc
	theme = feast_activity
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:guest
		animation = happiness
	}
	cooldown = { years = 1 }

	trigger = {
		NOT = { exists = local_var:had_6251 }
		scope:activity = {
			any_attending_character = {
				NOT = { this = root }
				feast_default_participant_requirements_trigger = yes
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_6251
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					NOT = { this = root }
					feast_default_participant_requirements_trigger = yes
				}
				weight = {
					base = 1
					modifier = { #More likely to pick someone that matters
						add = 2
						is_of_major_interest_to_root_trigger = yes
					}
					modifier = { #More likely to pick someone that matters
						add = 1
						is_of_minor_interest_to_root_trigger = yes
					}
				}
				save_scope_as = guest
			}
		}
	}

	option = { #friendly
		name = feast_default.6251.a
		reverse_add_opinion = {
			modifier = friendliness_opinion
			target = scope:guest
			opinion = 20
		}
		if = {
			limit = {
				NOR = {
					has_relation_friend = scope:guest
					has_relation_potential_friend = scope:guest
				}
			}
			set_relation_potential_friend = scope:guest
		}
		if = {
			limit = {
				has_relation_potential_friend = scope:guest
			}
			set_relation_friend = { reason = friend_feast_subject_of_interest target = scope:guest involved_character = scope:activity.activity_host province = scope:activity.activity_location }
		}
		stress_impact = {
			gregarious = minor_stress_impact_loss
			compassionate = minor_stress_impact_loss
			vengeful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 40
			modifier = {
				add = 60
				opinion = {
					target = scope:guest
					value >= 40
				}
			}
			ai_value_modifier = {
				ai_compassion = 0.75
			}
		}
	}

	option = { #Rival
		name = feast_default.6251.b
		add_prestige = minor_prestige_gain
		reverse_add_opinion = {
			modifier = cruelty_opinion
			target = scope:guest
			opinion = -20
		}
		if = {
			limit = {
				OR = {
					can_set_relation_potential_rival_trigger = { CHARACTER = scope:guest }
					can_set_relation_rival_trigger = { CHARACTER = scope:guest }
				}
			}
			progress_towards_rival_effect = {
				CHARACTER = scope:guest
				REASON = rival_rude_response
				OPINION = 0
			}
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 40
			modifier = {
				add = 20
				opinion = {
					target = scope:guest
					value <= 0
				}
			}
			modifier = {
				add = 20
				OR = {
					has_trait = sadistic
					has_trait = vengeful
					has_trait = wrathful
				}
			}
			ai_value_modifier = {
				ai_vengefulness = 0.5
			}
		}
	}

	option = { #Lustful
		name = feast_default.6251.c
		trigger = {
			OR = {
				matching_gender_and_sexuality_trigger = { CHARACTER_1 = root CHARACTER_2 = scope:guest }
				AND = {
					scope:guest = {	is_attracted_to_gender_of = root }
					root = { has_perk = unshackled_lust_perk }
				}
			}
			scope:guest = {
				might_cheat_on_every_partner_trigger = yes
				NOT = { is_close_or_extended_family_of = root }
			}
			root = {
				might_cheat_on_every_partner_trigger = yes
			}
		}
		reverse_add_opinion = {
			modifier = friendliness_opinion
			target = scope:guest
			opinion = 20
		}
		progress_towards_lover_effect = {
			CHARACTER = scope:guest
			REASON = lover_feast_conversation
			OPINION = 0
		}
		stress_impact = {
			celibate = major_stress_impact_gain
			lustful = medium_stress_impact_loss
		}
		ai_chance = {
			base = 20
			modifier = {
				add = 100
				has_trait = lustful
			}
		}
	}
}


#####################
# Serve the guests something new (cannibal)
# by Linnéa Thimrén
#####################
feast_default.6261 = {
	type = activity_event
	title = feast_default.6261.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_trait = lunatic
						has_trait = possessed
					}
				}
				desc = feast_default.6261.desc_lunatic
			}
			triggered_desc = {
				trigger = {
					NOR = {
						has_trait = lunatic
						has_trait = possessed
					}
				}
				desc = feast_default.6261.desc_not_lunatic
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:cannibal_guest
				}
				desc = feast_default.6261.desc_cannibal_guest
			}
			triggered_desc = {
				trigger = {
					exists = scope:concerned_guest
				}
				desc = feast_default.6261.desc_concerned_guest
			}
		}
	}
	theme = feast_activity
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:guest_to_display
		#Cannibals would chow down
		triggered_animation = {
			trigger = { exists = scope:cannibal_guest }
			animation = ecstasy
		}
		#Not cannibals... not so much
		animation = worry
	}
	cooldown = { years = 1 }

	trigger = {
		NOT = { exists = local_var:had_6261 }
		is_cannibal_trigger = yes
		scope:activity = {
			any_attending_character = {
				NOT = { this = root }
				feast_default_participant_trigger = yes
				is_cannibal_trigger = no
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = { #More likely to fire if a guest is cannibal!
			add = 0.5
			scope:activity = {
				any_attending_character = {
					NOT = { this = root }
					feast_default_participant_trigger = yes
					is_cannibal_trigger = yes
				}
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_6261
			value = yes
		}
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_participant_trigger = yes
					is_cannibal_trigger = yes
					NOT = { this = root }
				}
				save_scope_as = cannibal_guest
				save_scope_as = guest_to_display
			}
			if = {
				limit = {
					NOT = { exists = scope:cannibal_guest }
				}
				random_attending_character = {
					limit = {
						NOT = { this = root }
						feast_default_participant_trigger = yes
						is_cannibal_trigger = no
						probably_intelligent_trigger = yes
					}
					alternative_limit = {
						NOT = { this = root }
						feast_default_participant_trigger = yes
						is_cannibal_trigger = no
					}
					weight = {
						base = 1
						modifier = {
							add = 2
							is_of_major_interest_to_root_trigger = yes
						}
						modifier = {
							add = 1
							is_of_minor_interest_to_root_trigger = yes
						}
					}
					save_scope_as = concerned_guest
					save_scope_as = guest_to_display
				}
			}
		}
		if = {
			limit = {
				OR = {
					has_trait = lunatic
					has_trait = possessed
				}
			}
			apply_maimed_trait_and_modifier_effect = yes
		}
	}

	option = { #Exposed cannibal - don't care about the guest
		name = feast_default.6261.a_exposed
		trigger = {
			has_trait = cannibal
		}
		scope:concerned_guest = {
			add_character_modifier = {
				modifier = stress_starvation
				days = 1825
			}
		}
		add_character_modifier = {
			modifier = feast_good_food_modifier
			years = 10
		}
		stress_impact = {
			paranoid = medium_stress_impact_gain
			wrathful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = 0.5
			}
		}
	}

	option = { #Not exposed as cannibal - don't care about the guest
		name = feast_default.6261.a
		trigger = {
			NOT = { has_trait = cannibal }
		}
		random = {
			chance = 25
			if = {
				limit = {
					any_secret = {
						secret_type = secret_cannibal
						NOT = { is_known_by = scope:concerned_guest }
					}
				}
				random_secret = {
					limit = {
						secret_type = secret_cannibal
						NOT = { is_known_by = scope:concerned_guest }
					}
					reveal_to = scope:concerned_guest
				}
			}
		}
		add_character_modifier = {
			modifier = feast_good_food_modifier
			years = 10
		}
		stress_impact = {
			paranoid = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = 0.5
			}
		}
	}

	option = { #Bring them something else to eat
		name = feast_default.6261.b
		add_prestige = medium_prestige_gain
		reverse_add_opinion = {
			modifier = grateful_opinion
			target = scope:concerned_guest
			opinion = 15
		}
		stress_impact = {
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.75
				ai_honor = 0.25
			}
		}
	}

	option = { #Flesh-friend! Bond over shared dietary tips and trix
		name = feast_default.6261.c
		trigger = {
			exists = scope:cannibal_guest
		}
		exclusive = yes
		scope:cannibal_guest = {
			if = {
				limit = {
					any_secret = {
						secret_type = secret_cannibal
						NOT = { is_known_by = scope:activity.activity_host }
					}
				}
				random_secret = {
					limit = {
						secret_owner = {
							scope:cannibal_guest = this
						}
						secret_type = secret_cannibal
						NOT = { is_known_by = scope:activity.activity_host }
					}
					reveal_to = scope:activity.activity_host
				}
			}
		}
		if = {
			limit = {
				any_secret = {
					secret_type = secret_cannibal
					NOT = { is_known_by = scope:cannibal_guest }
				}
			}
			random_secret = {
				limit = {
					secret_type = secret_cannibal
					NOT = { is_known_by = scope:cannibal_guest }
				}
				reveal_to = scope:cannibal_guest
			}
		}
		progress_towards_friend_effect = {
			REASON = friend_fellow_cannibal
			CHARACTER = scope:cannibal_guest
			OPINION = 20
		}
		reverse_add_opinion = {
			modifier = friendly_interaction
			target = scope:cannibal_guest
		}
		ai_chance = {
			base = 100
		}
	}
}

#####################
# A guest has damaged one of your Court Artifacts on display
# by Filippa Gannholm Kirsten
#####################

scripted_effect set_worsened_relation_feast_default_6301_effect = {
	if = {
		limit = {
			can_set_relation_potential_rival_trigger = { CHARACTER = scope:feast_artifact_culprit }
		}
		set_relation_potential_rival = scope:feast_artifact_culprit
	}
	else_if = {
		limit = {
			can_set_relation_rival_trigger = { CHARACTER = scope:feast_artifact_culprit }
		}
		set_relation_rival = {
			target = scope:feast_artifact_culprit
			reason = rival_artifact_destroyer
		}
	}
	else_if = {
		limit = {
			has_relation_rival = scope:feast_artifact_culprit
			can_set_relation_nemesis_trigger = { CHARACTER = scope:feast_artifact_culprit }
		}
		set_relation_nemesis = {
			reason = nemesis_artifact_destroyer
			copy_reason = rival
			target = scope:feast_artifact_culprit
		}
	}
}

scripted_effect feast_default_6301_gold_amount_based_on_rarity_effect = {
	#Illustrious court artifact
	if = {
		limit = { 
			scope:feast_target_artifact = { rarity = illustrious } 
		}
		add_gold = { 
			value = major_gold_value
			multiply = 0.25
		}
	}
	#Famed court artifact
	else_if = {
		limit = { 
			scope:feast_target_artifact = { rarity = famed } 
		}
		add_gold = { 
			value = medium_gold_value
			multiply = 0.25
		}
	}
	#Masterwork court artifact
	else_if = {
		limit = { 
			scope:feast_target_artifact = { rarity = masterwork } 
		}
		add_gold = { 
			value = minor_gold_value
			multiply = 0.25
		}
	}
	#Common and worse
	else = {
		add_gold = { 
			value = tiny_gold_value
			multiply = 0.25
		}
	}
}

feast_default.6301 = {
	type = activity_event
	title = feast_default.6301.t
	desc = {
		desc = feast_default.6301.desc
		#If we have decent learning we can find more evidence
		first_valid = {
			triggered_desc = {
				#If the suspect is innocent
				trigger = { 
					learning > 10 
					NOT = { 
						scope:feast_artifact_culprit = { has_character_flag = damaged_artifact_during_feast_default.6301 }
					}
				}
				desc = feast_default.6301.desc_learning_guard
			}
			triggered_desc = {
				#If the suspect is guilty
				trigger = { 
					learning > 10 
					scope:feast_artifact_culprit = { has_character_flag = damaged_artifact_during_feast_default.6301 }
				}
				desc = feast_default.6301.desc_learning
			}
		}
	}
	#Display the suspect
	left_portrait = {
		character = scope:feast_artifact_culprit
		triggered_animation = {
			trigger = {
				OR = {
					#If we have high learning and the suspect is guilty 
					AND = {
						root.learning > 10 
						has_character_flag = damaged_artifact_during_feast_default.6301
					}
					#If the suspect has low intrigue and is guilty
					AND = {
						intrigue < 6
						has_character_flag = damaged_artifact_during_feast_default.6301
					}
					#If the suspect is innocent but paranoid they may be acting strange
					has_trait = paranoid
				}
			}
  			animation = paranoia
  		}
		animation = disapproval
	}
	right_portrait = {
		character = root
		animation = shock
	}
	#Show the court artifact
	artifact = {
		target = scope:feast_target_artifact
		position = lower_center_portrait
		trigger = { exists = scope:feast_target_artifact }
	}
	theme = feast_activity
	cooldown = { years = 1 }
	
	trigger = {
		has_dlc_feature = royal_court #Court Artifacts
		NOT = { exists = local_var:had_6301 }
		NOT = { exists = local_var:had_6351 }
		#Do we have a court artifact on display?
		scope:activity.activity_host = {
			is_ai = no
			any_character_artifact = {
				ep1_artifact_is_court_artifact_trigger = yes
				is_equipped = yes
			}
		}
		#Do we have a suitable culprit?
		scope:activity = {
			any_attending_character = {
				is_ai = yes
				OR = {
					#A rival?
					has_relation_nemesis = scope:activity.activity_host
					has_relation_rival = scope:activity.activity_host
					has_relation_potential_rival = scope:activity.activity_host
					opinion = {
						target = root
						value <= -30
					}
					#Or just a random eligible guest
					feast_default_participant_trigger = yes
				}
				save_temporary_scope_as = feast_6301_suspect_check
			}
			#Do we have a trusted friend, in case we were wrong?
			any_attending_character = {
				is_ai = yes
				OR = {
					has_relation_lover = scope:activity.activity_host
					has_relation_best_friend = scope:activity.activity_host
					has_relation_friend = scope:activity.activity_host
				}
				NOT = { this = scope:feast_6301_suspect_check }
				save_temporary_scope_as = feast_6301_trusted_friend_check
			}
			#And a potential debatee if we were wrong
			any_attending_character = {
				feast_default_participant_trigger = yes
				NOR = { 
					this = scope:feast_6301_suspect_check
					this = scope:feast_6301_trusted_friend_check
				}
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_6301
			value = yes
		}
		#Save a dummy char for captain gender in loc for artifact
		random = {
			chance = root_soldier_female_chance
			dummy_female = {
				save_scope_as = captain_of_the_guard_dummy
			}
		}
		if = {
			limit = {
				NOT = { exists = scope:captain_of_the_guard_dummy }
			}
			dummy_male = {
				save_scope_as = captain_of_the_guard_dummy
			}
		}
		#Let's set our court artifact to-be defaced
		scope:activity.activity_host = {
			random_character_artifact = {
				limit = {
					ep1_artifact_is_court_artifact_trigger = yes
					is_equipped = yes
				}
				save_scope_as = feast_target_artifact
			}
		}
		#...and damage it a bit
		scope:feast_target_artifact = {
			add_durability = {
				value = artifact_max_durability
				multiply = {
					value = {
						integer_range = {
							min = 5
							max = 25
						} 
					}
					multiply = -0.01
				}
			}
			#Save the scope in a var so we can use it in the custom_loc
			set_variable = {
				name = captain_gender
				value = scope:captain_of_the_guard_dummy
			}	
		}
		#How was it damaged?
		determine_artifact_damage_type_effect = { ARTIFACT = scope:feast_target_artifact }
		#And who supposedly did it?
		scope:activity = {
			random_attending_character = {
				limit = {
					is_ai = yes
					has_relation_nemesis = scope:activity.activity_host
				}
				alternative_limit = {
					is_ai = yes
					has_relation_rival = scope:activity.activity_host
				}
				alternative_limit = {
					is_ai = yes
					has_relation_potential_rival = scope:activity.activity_host
				}
				alternative_limit = {
					is_ai = yes
					opinion = {
						target = root
						value <= -10
					}
				}
				alternative_limit = { feast_default_participant_trigger = yes }
				save_scope_as = feast_artifact_culprit
			}
		}
		#Is the suspect guilty or innocent?
		random_list = {
			50 = {
				#Guilty
				modifier = {
					#If they're out-acting there's probably a higher chance they damaged something
					scope:feast_artifact_culprit = {
						OR = {
							has_trait = drunkard
							has_trait = vengeful
							has_trait = wrathful
							has_trait = reckless
						}
					}
					add = 25
				}
				scope:feast_artifact_culprit = { add_character_flag = damaged_artifact_during_feast_default.6301 }
			}
			50 = {
				#The suspect was innocent, let's save our trusted friend for the follow-up
				scope:activity = {
					random_attending_character = {
						limit = {
							is_ai = yes
							OR = {
								has_relation_lover = scope:activity.activity_host
								has_relation_best_friend = scope:activity.activity_host
								has_relation_friend = scope:activity.activity_host
							}
						}
						save_scope_as = feast_trusted_friend
					}
					#...and let's save a potential debatee character in case the trusted friend can't be the culprit's lover
					random_attending_character = {
						limit = { 
							feast_default_participant_trigger = yes 
							NOR = { 
								this = scope:feast_artifact_culprit
								this = scope:feast_trusted_friend 
							}
						}
						save_scope_as = feast_debatee_character
					}
				}
			}
		}	
	}

	#Send them to the dungeon!	
	option = {
		name = feast_default.6301.a
		rightfully_imprison_character_effect = {
			TARGET = scope:feast_artifact_culprit
			IMPRISONER = root
		}
		add_dread = medium_dread_gain
		stress_impact = {
			forgiving = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		#Closer to forming rivalry/nemesis
		set_worsened_relation_feast_default_6301_effect = yes
		#If innocent, trigger follow-up event
		if = {
			limit = { exists = scope:feast_trusted_friend }
			trigger_event = {
				id = feast_default.6302
				days = 50
			}
		}
	}

	#Give them a stern lecture & have them pay for their damages
	option = {
		name = feast_default.6301.b
		flavor = feast_default.6301.b.tt
		random_list = {
			#If they're innocent
			50 = {
				desc = feast_default.6301.b.tt_innocent
				show_chance = no
				#If they're guilty, the innocent outcome will be unavailable
				modifier = {
					scope:feast_artifact_culprit = { has_character_flag = damaged_artifact_during_feast_default.6301 }
					factor = 0
				}
				send_interface_toast = {
					title = feast_default.6301.b.tt_innocent
					right_icon = scope:feast_artifact_culprit
					#Opinion loss
					reverse_add_opinion = { 
						target = scope:feast_artifact_culprit
						modifier = falsely_accused
						opinion = -30
					}
					#Closer to forming rivalry/nemesis
					set_worsened_relation_feast_default_6301_effect = yes
				}
			}
			#If they're guilty
			50 = {
				desc = feast_default.6301.b.tt_guilty
				show_chance = no
				send_interface_toast = {
					title = feast_default.6301.b.tt_guilty
					right_icon = scope:feast_artifact_culprit
					#Opinion loss
					reverse_add_opinion = { 
						target = scope:feast_artifact_culprit
						modifier = shamed_me_opinion
						opinion = -20
					}
				}
			}	
		}
		stress_impact = {
			forgiving = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}
		#Figure out how much gold based on artifact rarity
		feast_default_6301_gold_amount_based_on_rarity_effect = yes
	}

	#The captain did it!
	option = {
		name = feast_default.6301.c_learning
		flavor = feast_default.6301.c.tt
		trigger = {
			AND = {
				learning > 10 
				NOT = { 
					scope:feast_artifact_culprit = { has_character_flag = damaged_artifact_during_feast_default.6301 }
				}
			}
		}
		#Gain relation with the culprit
		reverse_add_opinion = { 
			target = scope:feast_artifact_culprit
			modifier = relieved_opinion
			opinion = 20
		}
		#You did the right thing
		add_character_modifier = { 
			modifier = feast_dutiful_ruler_modifier
			years = 5
		}
		add_prestige = medium_prestige_gain
		#Justice has prevailed!
		stress_impact = {
			just = minor_stress_impact_loss
		}
	}

	#Let them go - Good riddance; I didn't like that piece anyway...
	option = {
		name = feast_default.6301.d
		#Gain relation with the culprit
		reverse_add_opinion = { 
			target = scope:feast_artifact_culprit
			modifier = relieved_opinion
			opinion = 10
		}
		#Makes your vassals feel less threatened by you
		add_character_modifier = { 
			modifier = feast_benevolent_ruler_modifier
			years = 5
		}
		add_dread = minor_dread_loss
		add_prestige = minor_prestige_loss
		stress_impact = {
			vengeful = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			irritable = minor_stress_impact_gain
		}
	}

	after = {
		scope:feast_target_artifact = {
			if = {
				limit = { exists = var:captain_gender }
				remove_variable = captain_gender
			}
			if = {
				limit = { exists = var:artifact_burned }
				remove_variable = artifact_burned
			}
			if = {
				limit = { exists = var:artifact_knocked_over }
				remove_variable = artifact_knocked_over
			}
			if = {
				limit = { exists = var:artifact_smeared_food }
				remove_variable = artifact_smeared_food
			}
			if = {
				limit = { exists = var:artifact_spilled_drink }
				remove_variable = artifact_spilled_drink
			}
			if = {
				limit = { exists = var:artifact_tear }
				remove_variable = artifact_tear
			}
			if = {
				limit = { exists = var:artifact_tear_down }
				remove_variable = artifact_tear_down 
			}
			if = {
				limit = { exists = var:artifact_threw_up }
				remove_variable = artifact_threw_up
			}
			if = {
				limit = { exists = var:artifact_damage_fallback }
				remove_variable = artifact_damage_fallback
			}
		}
		scope:feast_artifact_culprit = {
			if = {
				limit = { has_character_flag = damaged_artifact_during_feast_default.6301 }
				remove_character_flag = damaged_artifact_during_feast_default.6301
			}
		}
	}
}

scripted_effect learn_secret_lover_feast_default_6301_effect = {
	if = {
		limit = { 
			scope:feast_trusted_friend = { has_character_flag = is_secret_lover_feast_default.6302 }
		}
		scope:feast_trusted_friend = {
			random_secret = {
				limit = {
					secret_type = secret_lover
					secret_target = scope:feast_artifact_culprit
				}
				reveal_to = root
			}
		}
	}
}

#Follow-up in case the suspect was innocent and you sent them to the dungeon
feast_default.6302 = {
	type = activity_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { 
					scope:feast_trusted_friend = { has_character_flag = is_secret_lover_feast_default.6302 }
				}
				desc =  feast_default.6302.t_lover
			}
			triggered_desc = {
				desc = feast_default.6302.t
			}
		}
	}	
	desc = {
		desc = feast_default.6302.desc_intro
		first_valid = {
			triggered_desc = {
				trigger = { 
					scope:feast_trusted_friend = { has_character_flag = is_secret_lover_feast_default.6302 }
				}
				desc = feast_default.6302.desc_secret_lover
			}
			desc = feast_default.6302.desc_spirited_debate
		}
	}
	#Display the suspect
	left_portrait = {
		character = scope:feast_trusted_friend
		animation = worry
	}
	lower_left_portrait = {
		character = scope:feast_artifact_culprit
	}
	#Show the court artifact
	artifact = {
		target = scope:feast_target_artifact
		position = lower_center_portrait
		trigger = { exists = scope:feast_target_artifact }
	}
	theme = diplomacy 
	override_background = { reference = study }

	immediate = {
		hidden_effect = {
			scope:feast_trusted_friend = {
				if = {
					limit = { 
						can_set_relation_lover_trigger = { CHARACTER = scope:feast_artifact_culprit }
					}
					set_random_lover_reason = { TARGET = scope:feast_artifact_culprit }
					add_secret = { 
						target = scope:feast_artifact_culprit
						type = secret_lover 
					}
					add_character_flag = is_secret_lover_feast_default.6302
				}
			}
		}
	}

	#Turns out the culprit was busy with something else at the time of the incident
	option = {
		name = {
			text = {
				first_valid = {
					#Turns out our friend is the culprit's secret lover!
					triggered_desc = {
						trigger = {
							scope:feast_trusted_friend = { has_character_flag = is_secret_lover_feast_default.6302 }
						}
						desc = feast_default.6302.a_lover
					}
					#Turns out the culprit was busy with something else at the time of the incident
					desc = feast_default.6302.a
				}
			}
		}
		#Learn the smut secret (if it exists)
		learn_secret_lover_feast_default_6301_effect = yes
		#Opinion loss
		reverse_add_opinion = { 
			target = scope:feast_artifact_culprit
			modifier = falsely_accused
			opinion = -20
		}
		reverse_add_opinion = { 
			target = scope:feast_trusted_friend
			modifier = grateful_opinion
			opinion = 10
		}
		#Closer to forming rivalry/nemesis
		set_worsened_relation_feast_default_6301_effect = yes
		scope:feast_artifact_culprit = { release_from_prison = yes }
	}

	#Let's keep them in prison
	option = {
		name = feast_default.6302.b
		flavor = {
			first_valid = {
				#They make a fine addition to my prisoners
				triggered_desc = {
					trigger = {
						OR = {
							has_trait = callous
							has_trait = sadistic
						}
					}
					desc = feast_default.6302.b.tt_callous
				}
				#I'm sure they're guilty of _something_
				desc = feast_default.6302.b.tt
			}
		}
		#Learn the smut secret (if it exists)
		learn_secret_lover_feast_default_6301_effect = yes
		#Opinion loss
		reverse_add_opinion = { 
			target = scope:feast_artifact_culprit
			modifier = falsely_accused
			opinion = -40
		}
		reverse_add_opinion = { 
			target = scope:feast_trusted_friend
			modifier = scared_opinion
			opinion = -10
		}
		#Closer to forming rivalry/nemesis
		set_worsened_relation_feast_default_6301_effect = yes
		stress_impact = {
			just = minor_stress_impact_gain
			sadistic = minor_stress_impact_loss
		}
	}

	after = {
		scope:feast_trusted_friend = {
			if = {
				limit = { has_character_flag = is_secret_lover_feast_default.6302 }
				remove_character_flag = is_secret_lover_feast_default.6302
			}
		}
	}
}
#####################
# Two guests get into a fight, causing damage to one of your displayed Court Artifacts!
# by Filippa Gannholm Kirsten
#####################

#Shamelessly borrowing from feast_default.6003 - thanks Petter!
scripted_trigger feast_default_6351_fighter_2_trigger = {
	feast_default_participant_trigger = yes
	NOT = { this = scope:feast_default_6351_fighter_1 }
	OR = {
		has_relation_rival = scope:feast_default_6351_fighter_1
		AND = {
			opinion = {
				target = scope:feast_default_6351_fighter_1
				value <= -20
			}
			reverse_opinion = {
				target = scope:feast_default_6351_fighter_1
				value <= -20	
			}
			OR = {
				AND = {
					is_female = yes
					scope:feast_default_6351_fighter_1 = { is_female = yes }
				}
				AND = {
					is_male = yes
					scope:feast_default_6351_fighter_1 = { is_male = yes }
				}
			}
		}
	}
}

scripted_trigger feast_default_6351_fighter_1_trigger = {
	feast_default_participant_trigger = yes
	save_temporary_scope_as = feast_default_6351_fighter_1
	scope:activity = {
		any_attending_character = {
			feast_default_6351_fighter_2_trigger = yes
		}
	}
}

scripted_effect feast_default_6351_gold_amount_based_on_rarity_effect = {
	#Illustrious court artifact
	if = {
		limit = { 
			scope:feast_target_artifact = { rarity = illustrious } 
		}
		pay_short_term_gold = {
			target = root
			gold = {
				value = root.major_gold_value
				multiply = 0.25
			}
		}
	}
	#Famed court artifact
	else_if = {
		limit = { 
			scope:feast_target_artifact = { rarity = famed } 
		}
		pay_short_term_gold = {
			target = root
			gold = {
				value = root.medium_gold_value
				multiply = 0.5
			}
		}
	}
	#Masterwork court artifact
	else_if = {
		limit = { 
			scope:feast_target_artifact = { rarity = masterwork } 
		}
		pay_short_term_gold = {
			target = root
			gold = {
				value = root.minor_gold_value
			}
		}
	}
	#Common and worse
	else = {
		pay_short_term_gold = {
			target = root
			gold = {
				value = root.tiny_gold_value
			}
		}
	}
}

feast_default.6351 = {
	type = activity_event
	title = feast_default.6351.t
	desc = {
		desc = feast_default.6351.desc_intro
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_trait = wrathful
						has_trait = irritable
						has_trait = vengeful
					}
				}
				desc = feast_default.6351.desc_wrathful
			}
			triggered_desc = {
				desc = feast_default.6351.desc_calm
			}
		}
		desc = feast_default.6351.desc_outro
	}
	theme = feast_activity
	left_portrait = {
		character = scope:feast_default_6351_fighter_1
		animation = war_defender
	}
	right_portrait = {
		character = scope:feast_default_6351_fighter_2
		animation = severelywounded
	}
	#Show the court artifact
	artifact = {
		target = scope:feast_target_artifact
		position = lower_center_portrait
		trigger = { exists = scope:feast_target_artifact }
	}
	cooldown = { years = 2 }
	
	trigger = {
		NOR = { 
			#Don't need two fights in one party
			exists = local_var:had_6003
			#or damage two Court Artifacts
			exists = local_var:had_6301
			exists = local_var:had_6351
		}
		has_dlc_feature = royal_court #Court Artifacts
		#Do we have a court artifact on display?
		scope:activity.activity_host = {
			any_character_artifact = {
				ep1_artifact_is_court_artifact_trigger = yes
				is_equipped = yes
			}
		}
		scope:activity = {
			any_attending_character = {
				feast_default_6351_fighter_1_trigger = yes
				save_temporary_scope_as = feast_default_6351_fighter_1
			}
			any_attending_character = {
				feast_default_6351_fighter_2_trigger = yes
			}
		}
	}

	immediate = {
		set_local_variable = {
			name = had_6351
			value = yes
		}
		#Set up gold check
		save_scope_value_as = {
			name = gold_check_6351
			value = { 
				value = root.major_gold_value
				multiply = 0.25
			}
		}
		#Find our fighters
		scope:activity = {
			random_attending_character = {
				#Prefer fighters who don't go into the red if they have to pay up
				limit = {
					feast_default_6351_fighter_1_trigger = yes
					short_term_gold >= scope:gold_check_6351
				}
				alternative_limit = {
					feast_default_6351_fighter_1_trigger = yes
				}
				save_scope_as = feast_default_6351_fighter_1
			}
			random_attending_character = {
				limit = {
					feast_default_6351_fighter_2_trigger = yes
					short_term_gold >= scope:gold_check_6351
				}
				alternative_limit = {
					feast_default_6351_fighter_2_trigger = yes
				}
				save_scope_as = feast_default_6351_fighter_2
			}
		}
		#Let's set our court artifact to-be defaced
		scope:activity.activity_host = {
			random_character_artifact = {
				limit = {
					ep1_artifact_is_court_artifact_trigger = yes
					is_equipped = yes
				}
				save_scope_as = feast_target_artifact
			}
		}
		#...and damage it a bit
		scope:feast_target_artifact = {
			add_durability = {
				value = artifact_max_durability
				multiply = {
					value = {
						integer_range = {
							min = 5
							max = 25
						} 
					}
					multiply = -0.01
				}
			}	
		}
	}

	#Make fighter_1 pay up
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							OR = {
								has_trait = wrathful
								has_trait = irritable
								has_trait = vengeful
							}
						}
						desc = feast_default.6351.a_wrathful
					}
					triggered_desc = {
						desc = feast_default.6351.a
					}
				}
			}
		}
		flavor = feast_default.6351.a.tt
		scope:feast_default_6351_fighter_1 = {
			#Pay up
			feast_default_6351_gold_amount_based_on_rarity_effect = yes
			add_opinion = {
				target = root
				modifier = feast_sided_against_me_in_my_fight_opinion
			}
			progress_towards_rival_effect = {
				CHARACTER = root
				REASON = rival_fighter_pay_up
				OPINION = 0
			}
		}
		scope:feast_default_6351_fighter_2 = {
			add_opinion = {
				target = root
				modifier = feast_sided_with_me_in_my_fight_opinion
			}
			progress_towards_friend_effect = {
				REASON = friend_took_side_in_fight
				CHARACTER = root
				OPINION = 0
			}
		}
		stress_impact = {
			zealous = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:feast_default_6351_fighter_1
				min = -99
			}
			modifier = {
				add = 500
				has_relation_friend = scope:feast_default_6351_fighter_1
			}
		}
	}

	#Make fighter_2 pay up
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							OR = {
								has_trait = wrathful
								has_trait = irritable
								has_trait = vengeful
							}
						}
						desc = feast_default.6351.b_wrathful
					}
					triggered_desc = {
						desc = feast_default.6351.b
					}
				}
			}
		}
		flavor = feast_default.6351.b.tt
		scope:feast_default_6351_fighter_1 = {
			add_opinion = {
				target = root
				modifier = feast_sided_with_me_in_my_fight_opinion
			}
			progress_towards_friend_effect = {
				REASON = friend_took_side_in_fight
				CHARACTER = root
				OPINION = 0
			}
		}
		scope:feast_default_6351_fighter_2 = {
			#Pay up
			feast_default_6351_gold_amount_based_on_rarity_effect = yes
			add_opinion = {
				target = root
				modifier = feast_sided_against_me_in_my_fight_opinion
			}
			progress_towards_rival_effect = {
				CHARACTER = root
				REASON = rival_fighter_pay_up
				OPINION = 0
			}
		}
		#Zealous no like
		stress_impact = {
			zealous = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:feast_default_6351_fighter_1
				min = -99
			}
			modifier = {
				add = 500
				has_relation_friend = scope:feast_default_6351_fighter_1
			}
		}
	}	

	#Make them both pay up
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							OR = {
								has_trait = wrathful
								has_trait = irritable
								has_trait = vengeful
							}
						}
						desc = feast_default.6351.c_wrathful
					}
					triggered_desc = {
						desc = feast_default.6351.c
					}
				}
			}
		}
		trigger = {
			has_trait = greedy
		}
		flavor = feast_default.6351.c.tt
		#Double hate
		scope:feast_default_6351_fighter_1 = {
			#Pay up
			feast_default_6351_gold_amount_based_on_rarity_effect = yes
			add_opinion = {
				target = root
				modifier = feast_sided_against_me_in_my_fight_opinion
				opinion = -20
			}
			progress_towards_rival_effect = {
				CHARACTER = root
				REASON = rival_fighter_pay_up
				OPINION = 0
			}
		}
		scope:feast_default_6351_fighter_2 = {
			#Pay up
			feast_default_6351_gold_amount_based_on_rarity_effect = yes
			add_opinion = {
				target = root
				modifier = feast_sided_against_me_in_my_fight_opinion
				opinion = -20
			}
			progress_towards_rival_effect = {
				CHARACTER = root
				REASON = rival_fighter_pay_up
				OPINION = 0
			}
		}
		#Zealous no like
		stress_impact = {
			zealous = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = greedy
				add = 500
			}
			ai_value_modifier = {
				ai_greed = 1
				ai_compassion = 0.1
			}
		}
	}

	#Turn the other cheek
	option = {
		name = feast_default.6351.d
		trigger = {
			has_trait = zealous
		}
		flavor = feast_default.6351.d.tt
		#Double love
		scope:feast_default_6351_fighter_1 = {
			add_opinion = {
				target = root
				modifier = feast_compassionate_opinion
				opinion = 20
			}
			progress_towards_friend_effect = {
				REASON = friend_ignored_feast_fight
				CHARACTER = root
				OPINION = 0
			}
		}
		scope:feast_default_6351_fighter_2 = {
			add_opinion = {
				target = root
				modifier = feast_compassionate_opinion
				opinion = 20
			}
			progress_towards_friend_effect = {
				REASON = friend_ignored_feast_fight
				CHARACTER = root
				OPINION = 0
			}
		}
		#Some piety
		add_piety = medium_piety_gain
		#Vengeful/angry no like
		stress_impact = {
			vengeful = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			irritable = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
			forgiving = minor_stress_impact_loss
			zealous = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = zealous
				add = 500
			}
			ai_value_modifier = {
				ai_zeal = 1
				ai_compassion = 1
				ai_vengefulness = 0.25
			}
		}
	}

	#I didn't like that piece anyway
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							OR = {
								has_trait = wrathful
								has_trait = irritable
								has_trait = vengeful
							}
						}
						desc = feast_default.6351.e_wrathful
					}
					triggered_desc = {
						desc = feast_default.6351.e
					}
				}
			}
		}
		trigger = {
			NOT = { has_trait = zealous }
		}
		flavor = feast_default.6351.e.tt
		scope:feast_default_6351_fighter_1 = {
			add_opinion = {
				target = root
				modifier = feast_compassionate_opinion
				opinion = 20
			}
			progress_towards_rival_effect = {
				CHARACTER = scope:feast_default_6351_fighter_2
				REASON = rival_fighter_rivalry
				OPINION = 0
			}
		}
		scope:feast_default_6351_fighter_2 = {
			add_opinion = {
				target = root
				modifier = feast_compassionate_opinion
				opinion = 20
			}
			progress_towards_rival_effect = {
				CHARACTER = scope:feast_default_6351_fighter_1
				REASON = rival_fighter_rivalry
				OPINION = 0
			}
		}
		#Subjects are less afraid of us
		add_dread = minor_dread_loss
		add_prestige = medium_prestige_loss
		add_character_modifier = { 
			modifier = feast_benevolent_ruler_modifier
			years = 5
		}
		#Vengeful/angry no like
		stress_impact = {
			vengeful = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			irritable = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
			compassionate = minor_stress_impact_loss
			forgiving = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:feast_default_6351_fighter_1
			}
			opinion_modifier = {
				opinion_target = scope:feast_default_6351_fighter_2
			}
			modifier = {
				has_trait = forgiving
				add = 100
			}
			modifier = {
				AND = {
					has_relation_friend = scope:feast_default_6351_fighter_1
					has_relation_friend = scope:feast_default_6351_fighter_2
				}
				add = 500
			}
			ai_value_modifier = {
				ai_compassion = 1
				ai_vengefulness = 0.25
			}
		}
	}
}

#####################
# Pervert laughs at lewd double-meaning
# by Bianca Savazzi
#####################

scripted_effect feast_default_6501_additional_person_opinion_effect = {
	if = {
		limit = { exists = scope:fellow_pervert }
		random_list = {
			40 = {
				show_chance = no
				progress_towards_friend_effect = {
					REASON = friend_shared_lewd_humor
					CHARACTER = scope:fellow_pervert
					OPINION = 0
				}
			}
			60 = {
				show_chance = no
				modifier = {
					add = -20
					has_trait_extroverted_trigger = yes
				}
				modifier = {
					add = 20
					has_trait_levelheaded_trigger = yes
				}
				progress_towards_rival_effect = {
					CHARACTER = scope:fellow_pervert
					REASON = rival_misunderstood_lewd_humor
					OPINION = 0
				}
			}
		}
	}
}

feast_default.6501 = {
	type = activity_event
	title = feast_default.6501.t
	desc = {
		desc = feast_default.6501.desc.opening
		random_valid = {
			desc = feast_default.6501.joke_a
			desc = feast_default.6501.joke_b
			desc = feast_default.6501.joke_c
		}
		first_valid = {
			triggered_desc = {
				trigger = { NOT = { exists = scope:fellow_pervert } }
				desc = feast_default.6501.desc.ending_solo
			}
			desc = feast_default.6501.desc.ending_duo
		}

	}
	theme = feast_activity
	cooldown = { years = 2 }
	left_portrait = {
		character = scope:innocent_guest
		animation = personality_cynical
	}
	right_portrait = {
		character = scope:fellow_pervert
		animation = disbelief
	}

	trigger = {
		OR = {
			has_trait = rakish 
			has_trait = deviant
			has_trait_extroverted_trigger = yes
		}
		scope:activity = {
			any_attending_character = {
				count > 0
				feast_default_participant_trigger = yes
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = { #More likely to fire if it can be the duo version
			add = 0.5
			scope:activity = {
				any_attending_character = {
					count > 2
					is_ai = yes
				}
			}
		}
	}

	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					feast_default_participant_trigger = yes
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						is_of_major_interest_to_root_trigger = yes
					}
					modifier = {
						add = 1
						is_of_minor_interest_to_root_trigger = yes
					}
				}
				save_scope_as = innocent_guest
			}
			random_attending_character = {
				limit = {
					feast_default_participant_trigger = yes
					is_ai = yes
					NOT = { this = scope:innocent_guest}
				}
				weight = {
					base = 1
					modifier = {
						add = 1
						is_of_minor_interest_to_root_trigger = yes
					}
				}
				save_scope_as = fellow_pervert
			}
		}
	}

	option = { # Hold back
		name = feast_default.6501.a
		stress_impact = {
			lifestyle_reveler = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = -0.5
				ai_energy = -0.5
			}
		}
	}

	option = { # Laugh 
		name = feast_default.6501.b

		custom_tooltip = feast_default.6501.b.tt
		hidden_effect = {
			random_list = {
				40 = {
					show_chance = no
					send_interface_toast = {	
						title = feast_default.6501.b.success
						left_icon = scope:innocent_guest

						progress_towards_friend_effect = {
							REASON = friend_shared_lewd_humor
							CHARACTER = scope:innocent_guest
							OPINION = 0
						}
						feast_default_6501_additional_person_opinion_effect = yes
					}
				}
				60 = {
					show_chance = no
					modifier = {
						add = -20
						has_trait_extroverted_trigger = yes
					}
					modifier = {
						add = 20
						has_trait_levelheaded_trigger = yes
					}
					send_interface_toast = {	
						title = feast_default.6501.b.failure
						left_icon = scope:innocent_guest

						progress_towards_rival_effect = {
							CHARACTER = scope:innocent_guest
							REASON = rival_didnt_get_lewd_humor
							OPINION = 0
						}
						feast_default_6501_additional_person_opinion_effect = yes
					}
				}
			}
		}
		
		stress_impact = {
			shy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_energy = 0.5
			}
		}
	}
}

#################################
# END EVENTS
# by Petter Vilberg
# 9000-9999
#################################

scripted_trigger feast_end_events_participant_trigger = {
	NOT = { this = scope:host }
	is_alive = yes
	is_imprisoned = no
}
