﻿namespace = lmf_feast

########################
# FAMILY DINNER EVENTS #
########################

scripted_trigger available_for_family_dinner = {
	is_available_ai = yes
	has_recoverable_disease_trigger = no
	NOT = { is_in_list = potential_family_dinner_guests }
	age >= 3
	trigger_if = {
		limit = { is_courtier_of = root }
		OR = {
			# courtiers must be at least kinsmen
			dynasty = root.dynasty
			# or be close/extended family
			is_close_or_extended_family_of = root
			# or my consort
			is_consort_of = root
			# but also includes my wards
			has_relation_guardian = root
			# and hostages
			is_hostage_of = root
			# spouses of extended family can also come
			any_spouse = { is_close_or_extended_family_of = root }
			# same with their children
			any_parent = { is_close_or_extended_family_of = root }
			# or one of your friends
			has_relation_friend = root
			# or a sociable non-secret lover
			AND = {
				has_relation_lover = root
				NOT = { lover_is_secret_trigger = { CHARACTER = root } }
				ai_sociability > 0
			}
		}
	}
	trigger_else_if = {
		limit = { is_vassal_of = root }
		OR = {
			# vassals must be close or extended family
			AND = {
				is_close_or_extended_family_of = root
				OR = {
					# and must be councillors or have a court position (they're often at court)
					is_councillor_of = root
					has_any_court_position = yes
					# or is a vassal ward
					has_relation_guardian = root
				}
			}
			AND = {
				# social family members can also come
				OR = {
					AND = {
						is_close_or_extended_family_of = root
						ai_sociability >= low_positive_ai_value
					}
					# or kinsman friends
					AND = {
						has_relation_friend = root
						dynasty = root.dynasty
					}
					# or a sociable non-secret lover
					AND = {
						has_relation_lover = root
						NOT = { lover_is_secret_trigger = { CHARACTER = root } }
						ai_sociability > 0
					}
				}
				# so long as they're nearby
				location ?= {
					squared_distance = { target = root.capital_province value <= 200000 }
				}
			}
		}
	}
	# or they're nearby rulers who are close family
	trigger_else_if = {
		limit = { is_ruler = yes }
		is_close_family_of = root
		location ?= {
			squared_distance = { target = root.capital_province value <= 200000 }
		}
	}
	# the remainder are either courtiers of existing guests or present in the capital province
	trigger_else = {
		OR = {
			is_close_or_extended_family_of = root
			any_spouse = { is_close_or_extended_family_of = root }
			any_parent = { is_close_or_extended_family_of = root }
			has_relation_friend = root
			AND = {
				has_relation_lover = root
				NOT = { lover_is_secret_trigger = { CHARACTER = root } }
				ai_sociability > 0
			}
		}
	}
}

scripted_trigger has_marital_trait_or_secret_objectionable_to = {
	save_temporary_scope_as = objection_check
	OR = {
		AND = {
			OR = {
				has_trait = sodomite
				any_secret = {
					type = secret_homosexual
					is_known_by = $OBJECTOR$
				}
			}
			$OBJECTOR$ = { has_negative_attitude_towards_trait_trigger = { TRAIT = trait:sodomite GENDER_CHARACTER = scope:objection_check } }
		}
		AND = {
			OR = {
				has_trait = incestuous
				any_secret = {
					type = secret_incest
					is_known_by = $OBJECTOR$
				}
			}
			$OBJECTOR$ = { has_negative_attitude_towards_trait_trigger = { TRAIT = trait:incestuous GENDER_CHARACTER = scope:objection_check } }
		}
		AND = {
			OR = {
				has_trait = deviant
				any_secret = {
					type = secret_deviant
					is_known_by = $OBJECTOR$
				}
			}
			$OBJECTOR$ = { has_negative_attitude_towards_trait_trigger = { TRAIT = trait:deviant GENDER_CHARACTER = scope:objection_check } }
		}
	}
}

scripted_trigger betrayed_our_marriage_trigger = {
	OR = {
		reverse_has_opinion_modifier = { target = $CHARACTER$ modifier = betrayed_our_promise }
		reverse_has_opinion_modifier = { target = $CHARACTER$ modifier = unfaithful_spouse_exposed_opinion }
		reverse_has_opinion_modifier = { target = $CHARACTER$ modifier = unfaithful_spouse_discovered_opinion }
	}
}

scripted_trigger knows_of_my_secret_lover = {
	$CHARACTER$ = {
		any_secret = {
			type = secret_lover
			NOT = { secret_target = $CHARACTER$.primary_spouse }
			is_known_by = $CHARACTER$.primary_spouse
		}
	}
	has_negative_attitude_towards_trait_trigger = { TRAIT = trait:adulterer GENDER_CHARACTER = $CHARACTER$ }
	NOT = {
		hurt_by_marriage_betrayal_trigger = { CHARACTER = $CHARACTER$ }
	}
}

scripted_trigger has_known_secret_lover = {
	any_secret = {
		type = secret_lover
		NOT = { secret_target = $CHARACTER$ }
		is_known_by = $CHARACTER$
	}
	$CHARACTER$ = {
		has_negative_attitude_towards_trait_trigger = { TRAIT = trait:adulterer GENDER_CHARACTER = $CHARACTER$.primary_spouse }
	}
	NOT = {
		betrayed_our_marriage_trigger = { CHARACTER = $CHARACTER$ }
	}
}

scripted_trigger has_marital_grievance = {
	OR = {
		has_relation_rival = $CHARACTER$
		AND = {
			has_relation_potential_rival = $CHARACTER$
			opinion = { target = $CHARACTER$ value < 0 }
		}
		knows_of_my_secret_lover = { CHARACTER = $CHARACTER$ }
		has_known_secret_lover = { CHARACTER = $CHARACTER$ }
		betrayed_our_marriage_trigger = { CHARACTER = $CHARACTER$ }
		hurt_by_marriage_betrayal_trigger = { CHARACTER = $CHARACTER$ }
		has_marital_trait_or_secret_objectionable_to = { OBJECTOR = $CHARACTER$ }
		$CHARACTER$ = { has_marital_trait_or_secret_objectionable_to = { OBJECTOR = $CHARACTER$.primary_spouse } }
	}
}

scripted_trigger still_got_it_trigger = {
	is_healthy = yes
	is_attracted_to_gender_of = root
	root = {
		is_attracted_to_gender_of = root.primary_spouse
		is_healthy = yes
		NOT = {
			any_relation = {
				type = lover
				NOT = { is_consort_of = root }
			}
		}
	}
	NOR = {
		has_trait = chaste
		root = { has_trait = chaste }
		has_trait = celibate
		root = { has_trait = celibate }
		any_relation = {
			type = lover
			NOT = { is_consort_of = root.primary_spouse }
		}
	}
	OR = {
		has_relation_lover = root
		AND = {
			reverse_opinion = { target = root value >= 20 }
			opinion = { target = root value >= 20 }
		}
	}
}

scripted_trigger chaste_marriage_trigger = {
	OR = {
		has_trait = infirm
		root = { has_trait = infirm }
		has_trait = chaste
		root = { has_trait = chaste }
		has_trait = celibate
		root = { has_trait = celibate }
		NOT = { is_attracted_to_gender_of = root }
		root = { NOT = { is_attracted_to_gender_of = root.primary_spouse } }
	}
	reverse_opinion = { target = root value >= 50 }
	opinion = { target = root value >= 50 }
}

scripted_trigger can_be_family_rival_with = {
	trigger_if = {
		limit = { $CHARACTER$ = { is_adult = no } }
		is_adult = no
		age <= $CHARACTER$.age_plus_3
		age >= $CHARACTER$.age_minus_3
	}
	trigger_else = {
		is_adult = yes
	}
	NOR = {
		has_relation_rival = $CHARACTER$
		has_relation_lover = $CHARACTER$
		primary_spouse ?= $CHARACTER$
		has_personality_levelheaded_trigger = yes
	}
	OR = {
		has_relation_potential_rival = $CHARACTER$
		has_relation_bully = $CHARACTER$
		has_relation_grudge = $CHARACTER$
		is_at_war_with = $CHARACTER$
		# they're disinherited and it's a close family member who isn't and also an heir
		AND = {
			OR = {
				ai_greed >= 20
				ai_vengefulness >= 20
			}
			NOR = {
				ai_greed < -20
				ai_vengefulness < -20
			}
			has_trait = disinherited
			is_close_family_of = $CHARACTER$
			is_landed = no
			$CHARACTER$ = {
				NOT = { has_trait = disinherited }
				any_heir_title = {}
			}
		}
		# they're ambitious/greedy and unlanded and have a claim on a family member's title
		AND = {
			fp3_proper_gender_for_dynastic_ambition_trigger = yes
			OR = {
				has_personality_dominant_trigger = yes
				ai_greed > 20
			}
			is_landed = no
			any_claim = { holder = $CHARACTER$ }
		}
		# they have an issue with your disputed heritage
		has_issue_with_disputed_heritage_of = { CHARACTER = $CHARACTER$ }
		# they have a serious cause for vengeance
		has_revenge_motivation_against = { CHARACTER = $CHARACTER$ }
		# one of us is zealous and the other cynical
		is_resentful_of_impious_character = { CHARACTER = $CHARACTER$ }
		is_resentful_of_pious_character = { CHARACTER = $CHARACTER$ }
		# they're pious and the other is a hostile religion
		is_resentful_of_hostile_faith_character = { CHARACTER = $CHARACTER$ }
		# they're pious and the other is pious and of an astray religion
		is_resentful_of_pious_astray_faith_character = { CHARACTER = $CHARACTER$ }
		# they simply hate the character are are malicious or emotional
		has_hatred_towards = { CHARACTER = $CHARACTER$ }
		# they're just very incompatible
		has_major_incompatibility_with = { CHARACTER = $CHARACTER$ }
		# is jealous over a lover
		is_jealous_of_their_lover = { CHARACTER = $CHARACTER$ }
		# is jealous of their position
		is_jealous_of_their_court_position = { CHARACTER = $CHARACTER$ }
		is_jealous_of_their_council_position = { CHARACTER = $CHARACTER$ }
		is_jealous_of_their_heir_position = { CHARACTER = $CHARACTER$ }
	}
}

scripted_trigger can_be_family_rival_with_root = {
	is_adult = yes
	NOR = {
		has_personality_levelheaded_trigger = yes
		has_relation_lover = root
		has_relation_friend = root
		has_relation_rival = root
		primary_spouse ?= root
	}
	OR = {
		# they're already a potential rival
		has_relation_potential_rival = root
		# I disinherited them
		AND = {
			has_trait = disinherited
			has_opinion_modifier = { modifier = disinherited_opinion target = root }
		}
		# they have a serious cause for vengeance
		AND = {
			ai_vengefulness >= 0
			has_any_major_revenge_opinion_against_character_trigger = { CHARACTER = root }
		}
		# they really don't like me (relevant family only)
		AND = {
			is_relevant_family_member = { CHARACTER = root }
			opinion = { target = root value < 0 }
			NOR = {
				has_personality_benevolent_trigger = yes
				has_personality_submissive_trigger = yes
			}
			OR = {
				trait_compatibility = { target = root value <= medium_negative_trait_compatibility }
				has_moderate_bad_opinion_of_character_trigger = { CHARACTER = root }
			}
		}
	}
}

scripted_effect create_family_dinner_pool = {
	remove_character_flag ?= had_family_dinner_event
	remove_character_flag ?= had_recent_family_dinner_event
	add_character_flag = { flag = had_family_dinner_event months = 24 }
	add_character_flag = { flag = had_recent_family_dinner_event months = 6 }
	
	every_in_list = {
		list = potential_family_dinner_guests
		add_to_list = family_dinner_guests
		remove_from_list = potential_family_dinner_guests
	}
}

# Bounce event
lmf_feast.1000 = {
	hidden = yes
	
	trigger = {
		NOR = {
			has_character_flag = had_recent_family_dinner_event
			has_game_rule = lmf_no_family_feasts
			has_character_modifier = isolating_modifier
		}
	}
	
	immediate = {
		# check if the player isn't busy
		if = {
			limit = {
				is_available = yes
				has_recoverable_disease_trigger = no
				capital_province_being_besieged = no
			}
			# first create the guest list
			every_courtier_or_guest = {
				limit = { available_for_family_dinner = yes }
				add_to_list = potential_family_dinner_guests
			}
			# then add more guests until we're at capacity
			if = {
				limit = {
					list_size:potential_family_dinner_guests < expected_feast_size
					exists = capital_county
					NOT = {
						capital_county = { has_county_modifier = isolate_capital_decision_modifier }
					}
				}
				# first add pool characters at the capital
				every_pool_character = {
					province = root.capital_province
					limit = { available_for_family_dinner = yes }
					add_to_list = potential_family_dinner_guests
				}
				# then continue to vassals and family members within a short distance
				if = {
					limit = { list_size:potential_family_dinner_guests < expected_feast_size }
					every_vassal = {
						limit = {
							available_for_family_dinner = yes
							capital_province ?= {
								squared_distance = { target = root.capital_province value <= 50000 }
							}
						}
						add_to_list = potential_family_dinner_guests
						every_courtier_or_guest = {
							limit = { available_for_family_dinner = yes }
							add_to_list = potential_family_dinner_guests
						}
					}
					every_close_family_member = {
						limit = {
							is_ruler = yes
							is_close_family_of = root
							NOT = { is_vassal_of = root }
							available_for_family_dinner = yes
							capital_province ?= {
								squared_distance = { target = root.capital_province value <= 50000 }
							}
						}
						add_to_list = potential_family_dinner_guests
						every_courtier_or_guest = {
							limit = { available_for_family_dinner = yes }
							add_to_list = potential_family_dinner_guests
						}
					}
				}
				# then continue to vassals and family members within a medium distance
				if = {
					limit = { list_size:potential_family_dinner_guests < expected_feast_size }
					every_vassal = {
						limit = {
							available_for_family_dinner = yes
							capital_province ?= {
								squared_distance = { target = root.capital_province value <= 100000 }
							}
						}
						add_to_list = potential_family_dinner_guests
						every_courtier_or_guest = {
							limit = { available_for_family_dinner = yes }
							add_to_list = potential_family_dinner_guests
						}
					}
					every_close_family_member = {
						limit = {
							is_ruler = yes
							is_close_family_of = root
							NOT = { is_vassal_of = root }
							available_for_family_dinner = yes
							capital_province ?= {
								squared_distance = { target = root.capital_province value <= 100000 }
							}
						}
						add_to_list = potential_family_dinner_guests
						every_courtier_or_guest = {
							limit = { available_for_family_dinner = yes }
							add_to_list = potential_family_dinner_guests
						}
					}
				}
				# then continue to vassals and family members within a longer distance
				if = {
					limit = { list_size:potential_family_dinner_guests < expected_feast_size }
					every_vassal = {
						limit = {
							available_for_family_dinner = yes
							capital_province ?= {
								squared_distance = { target = root.capital_province value <= 200000 }
							}
						}
						add_to_list = potential_family_dinner_guests
						every_courtier_or_guest = {
							limit = { available_for_family_dinner = yes }
							add_to_list = potential_family_dinner_guests
						}
					}
					every_close_family_member = {
						limit = {
							is_close_family_of = root
							is_ruler = yes
							NOT = { is_vassal_of = root }
							available_for_family_dinner = yes
							capital_province ?= {
								squared_distance = { target = root.capital_province value <= 200000 }
							}
						}
						add_to_list = potential_family_dinner_guests
						every_courtier_or_guest = {
							limit = { available_for_family_dinner = yes }
							add_to_list = potential_family_dinner_guests
						}
					}
				}
			}
			
			# then select the outcome event
			random_list = {
				5 = {
					modifier = {
						add = 50
						has_character_flag = had_family_dinner_event
					}
				}
				50 = {
					modifier = {
						add = 25
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 12
						}
					}
					modifier = {
						add = 25
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 16
						}
					}
					trigger = {
						NOT = { has_character_flag = lmfmod_4001_flag }
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 8
						}
						
						# then see if there are two attending members who can become rivals
						any_in_list = {
							list = potential_family_dinner_guests
							age >= 12
							num_of_relation_rival <= 2
							is_relevant_family_member = { CHARACTER = root }
							NOT = { has_character_flag = featured_family_dinner_event }
							save_temporary_scope_as = potential_rival
							any_in_list = {
								list = potential_family_dinner_guests
								NOT = { this = scope:potential_rival }
								num_of_relation_rival <= 2
								can_be_family_rival_with = { CHARACTER = scope:potential_rival }
							}
						}
					}
					trigger_event = lmf_feast.1001 # Two family members become rivals
				}
				50 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4002_flag }
						is_adult = yes
						num_of_relation_rival <= 4
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 8
						}
						
						# then see if there's someone who can be your rival
						any_in_list = {
							list = potential_family_dinner_guests
							num_of_relation_rival <= 2
							NOT = { has_character_flag = featured_family_dinner_event }
							can_be_family_rival_with_root = yes
						}
					}
					trigger_event = lmf_feast.1002 # Family member becomes player's rival
				}
				50 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4003_flag }
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 5
						}
						
						# then see if there are two attending rivals who can make up
						any_in_list = {
							list = potential_family_dinner_guests
							is_adult = yes
							num_of_relation_rival >= 1
							NOT = { has_character_flag = featured_family_dinner_event }
							save_temporary_scope_as = current_rival
							any_relation = {
								type = rival
								is_in_list = potential_family_dinner_guests
								is_adult = yes
								NOR = {
									has_relation_nemesis = scope:current_rival
									any_targeting_scheme = { scheme_owner = scope:current_rival }
									any_scheme = { scheme_target_character = scope:current_rival }
								}
							}
						}
					}
					trigger_event = lmf_feast.1003 # Rival family members resolve differences
				}
				50 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4004_flag }
						is_adult = yes
						num_of_relation_rival >= 1
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 5
						}
						
						# then see if there is an attending rival who can make up with the player
						any_relation = {
							type = rival
							is_in_list = potential_family_dinner_guests
							is_adult = yes
							NOR = {
								has_character_flag = featured_family_dinner_event
								has_relation_nemesis = root
								any_targeting_scheme = { scheme_owner = root }
								any_scheme = { scheme_target_character = root }
							}
						}
					}
					trigger_event = lmf_feast.1004 # Player might make up with family rival
				}
				500 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4005_flag }
						age >= 8
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 5
						}
						
						OR = {
							# a close family member of the player dead in last three months
							any_close_family_member = {
								even_if_dead = yes
								is_close_family_of = root
								is_alive = no
								days_since_death <= 90
								# who has at least three other close family member at the dinner old enough to grieve
								any_close_family_member = {
									is_in_list = potential_family_dinner_guests
									is_close_family_of = prev
									count > 2
									age >= 8
								}
							}
							# a consort of the player dead in the last three months
							any_consort = {
								even_if_dead = yes
								is_alive = no
								days_since_death <= 90
								# who has at least one other close family member at the dinner old enough to grieve
								any_close_family_member = {
									is_in_list = potential_family_dinner_guests
									is_close_family_of = prev
									age >= 8
								}
							}
							# primary spouse miscarried in the last three months
							AND = {
								exists = primary_spouse
								primary_spouse = {
									has_variable = had_miscarriage
									has_trait = depressed_1
								}
								ai_compassion > high_negative_compassion
							}
						}
					}
					trigger_event = lmf_feast.1005 # Family dinner quiet due to recent death (higher due to small window)
				}
				50 = {
					modifier = {
						add = -25
						has_character_flag = lmfmod_4006_flag
					}
					trigger = {
						is_adult = yes
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 8
						}
						# just to make sure we have at least three guests we likely haven't seen in an event recently
						any_in_list = {
							list = potential_family_dinner_guests
							NOT = { has_character_flag = featured_family_dinner_event }
							count >= 3
						}
					}
					trigger_event = lmf_feast.1006 # Stressful family dinner
				}
				50 = {
					modifier = {
						add = -25
						has_character_flag = lmfmod_4007_flag
					}
					trigger = {
						is_adult = yes
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 8
						}
						# just to make sure we have at least three guests we likely haven't seen in an event recently
						any_in_list = {
							list = potential_family_dinner_guests
							NOT = { has_character_flag = featured_family_dinner_event }
							count >= 3
						}
					}
					trigger_event = lmf_feast.1007 # Serene family dinner
				}
				50 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4008_flag }
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 8
						}
						
						# then see if there are two attending members who can become rivals
						any_in_list = {
							list = potential_family_dinner_guests
							age >= 12
							num_of_relation_friend <= 3
							is_relevant_family_member = { CHARACTER = root }
							NOT = { has_character_flag = featured_family_dinner_event }
							save_temporary_scope_as = potential_friend
							any_in_list = {
								list = potential_family_dinner_guests
								NOT = { this = scope:potential_friend }
								num_of_relation_friend <= 3
								can_set_relation_friend_trigger = { CHARACTER = scope:potential_friend }
								trait_compatibility = { target = scope:potential_friend value >= 5 }
								trigger_if = {
									limit = { scope:potential_friend = { is_adult = no } }
									is_adult = no
									age <= scope:potential_friend.age_plus_3
									age >= scope:potential_friend.age_minus_3
								}
								trigger_else = {
									is_adult = yes
								}
								OR = {
									has_relation_potential_friend = scope:potential_friend
									AND = {
										age <= scope:potential_friend.age_plus_10
										age >= scope:potential_friend.age_minus_10
										opinion = { target = scope:potential_friend value >= 20 }
									}
								}
							}
						}
					}
					trigger_event = lmf_feast.1008 # Two family members become friends
				}
				50 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4009_flag }
						trigger_if = {
							limit = { is_adult = no }
							num_of_relation_friend <= 3
						}
						trigger_else = {
							num_of_relation_friend <= 5
						}
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 8
						}

						# then see if there's someone who can be your friend
						any_in_list = {
							list = potential_family_dinner_guests
							num_of_relation_friend <= 3
							is_relevant_family_member = { CHARACTER = root }
							NOT = { has_character_flag = featured_family_dinner_event }
							can_set_relation_friend_trigger = { CHARACTER = root }
							trigger_if = {
								limit = { root = { is_adult = no } }
								is_adult = no
								age <= root.age_plus_3
								age >= root.age_minus_3
							}
							trigger_else = {
								is_adult = yes
							}
							OR = {
								has_relation_potential_friend = root
								AND = {
									trait_compatibility = { target = root value >= 5 }
									opinion = { target = root value >= 20 }
								}
							}
						}
					}
					trigger_event = lmf_feast.1009 # Family member might become player's friend
				}
				50 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4010_flag }
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 8
						}
						
						# then see if there are two attending friends who can break up
						any_in_list = {
							list = potential_family_dinner_guests
							is_adult = yes
							num_of_relation_friend > 0
							NOT = { has_character_flag = featured_family_dinner_event }
							save_temporary_scope_as = potential_current_friend
							any_relation = {
								type = friend
								is_in_list = potential_family_dinner_guests
								is_adult = yes
								NOR = {
									has_relation_best_friend = scope:potential_current_friend
									any_targeting_scheme = { scheme_owner = scope:potential_current_friend }
									any_scheme = { scheme_target_character = scope:potential_current_friend }
								}
								OR = {
									scope:potential_current_friend = { num_of_relation_friend > 2 }
									num_of_relation_friend > 2
									opinion = { value < 0 target = scope:potential_current_friend }
								}
							}
						}
					}
					trigger_event = lmf_feast.1010 # Two family members end their friendship
				}
				50 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4011_flag }
						is_adult = yes
						num_of_relation_friend > 3
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 8
						}
					
						# then see if there is an attending friend who can break up with the player
						any_relation = {
							type = friend
							is_in_list = potential_family_dinner_guests
							is_adult = yes
							num_of_relation_friend > 2
							NOR = {
								has_character_flag = featured_family_dinner_event
								has_relation_best_friend = root
								any_targeting_scheme = { scheme_owner = root }
								any_scheme = { scheme_target_character = root }
							}
						}
					}
					trigger_event = lmf_feast.1011 # Family member ends friendship with player
				}
				50 = {
					modifier = {
						add = 25
						intrigue >= 8
					}
					modifier = {
						add = 25
						intrigue >= 15
					}
					trigger = {
						NOT = { has_character_flag = lmfmod_4012_flag }
						is_adult = yes
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 8
						}

						# then see if anyone attending has a secret to reveal
						any_in_list = {
							list = potential_family_dinner_guests
							is_adult = yes
							save_temporary_scope_as = family_secret
							any_secret = {
								NOR = {
									is_known_by = root
									secret_is_incriminating_trigger = { TARGET = root }
								}
								OR = {
									is_blackmailable_secret_trigger = { BLACKMAILER = root PARTICIPANT = scope:family_secret }
									secret_is_always_interesting_trigger = yes
								}
							}
						}
					}
					trigger_event = lmf_feast.1012 # Secret gets revealed at the dinner
				}
				100 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4013_flag }
						is_adult = yes
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 12
						}
					
						# then see if there are two attending guests who might become lovers
						any_in_list = {
							list = potential_family_dinner_guests
							is_adult = yes
							is_below_ai_lover_soft_cap_trigger = yes
							ai_boldness >= medium_negative_ai_value
							might_cheat_on_every_partner_trigger = yes
							likely_to_take_lover_trigger = yes
							NOR = {
								has_sexuality = asexual
								has_trait = infirm
								has_trait = pregnant
								is_malformed_trigger = yes
								has_any_illness = yes
								has_relation_lover = root
							}
							OR = {
								is_old_age_or_not_have_children = no
								is_deviant_trigger = yes
								has_focus = intrigue_temptation_focus
								faith = { has_doctrine = tenet_carnal_exaltation }
							}
							save_temporary_scope_as = potential_lover
							any_in_list = {
								list = potential_family_dinner_guests
								NOT = { this = scope:potential_lover }
								is_adult = yes
								is_below_ai_lover_soft_cap_trigger = yes
								NOR = {
									has_trait = infirm
									has_trait = pregnant
									is_malformed_trigger = yes
									is_unattractive_trigger = yes
									num_of_relation_soulmate > 0
									any_targeting_scheme = {}
									is_consort_of = scope:potential_lover
									has_relation_lover = root
								}
								trigger_if = {
									limit = {
										scope:potential_lover = { is_female = yes }
									}
									age <= scope:potential_lover.age_plus_10
									age >= scope:potential_lover.age_minus_10
								}
								trigger_if = {
									limit = {
										scope:potential_lover = { is_male = yes }
									}
									age <= scope:potential_lover.age
									age >= scope:potential_lover.age_minus_25
								}
								can_set_relation_lover_trigger = { CHARACTER = scope:potential_lover }
								might_cheat_on_every_partner_trigger = yes
								willing_to_take_character_as_lover = { LOVER = scope:potential_lover }
								trigger_if = {
									limit = { scope:potential_lover = { ai_boldness < 20 } }
									NOR = {
										primary_spouse ?= { is_liege_or_above_of = scope:potential_lover }
										any_parent = { is_liege_or_above_of = scope:potential_lover }
									}
								}
								trigger_if = {
									limit = { scope:potential_lover = { ai_honor > 0 } }
									is_married = no
								}
								trigger_if = {
									limit = {
										scope:potential_lover = {
											NOR = {
												is_deviant_trigger = yes
												ai_zeal <= low_negative_ai_value
												faith = { has_doctrine = tenet_carnal_exaltation }
												faith = { has_doctrine = doctrine_clerical_marriage_allowed }
											}
										}
									}
									NOR = {
										is_clergy = yes
										has_trait = devoted
										has_council_position = councillor_court_chaplain
										has_trait = septon
										has_trait = silent_sister
									}
								}
								save_temporary_scope_as = incest_check
								scope:potential_lover = { is_attracted_to_gender_of = scope:incest_check }
								is_attracted_to_gender_of = scope:potential_lover
								accepts_incest_with_each_other_trigger = {
									CHARACTER_1 = scope:incest_check
									CHARACTER_2 = scope:potential_lover
								}
							}
						}
					}
					trigger_event = lmf_feast.1013 # Two attendees at the dinner become lovers
				}
				100 = {
					modifier = {
						add = 100
						any_in_list = {
							list = potential_family_dinner_guests
							num_of_relation_nemesis > 0
							NOR = {
								has_character_flag = featured_family_dinner_event
								has_trait = wounded
								has_trait = infirm
								has_trait = maimed
								has_trait = blind
							}
							save_temporary_scope_as = current_rival
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:current_rival }
							any_relation = {
								type = nemesis
								is_in_list = potential_family_dinner_guests
								prowess <= scope:current_rival.prowess
								NOR = {
									has_trait = wounded
									has_trait = infirm
									has_trait = maimed
									has_trait = blind
								}
								save_temporary_scope_as = target_rival
								can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:target_rival }
							}
						}
					}
					trigger = {
						NOT = { has_character_flag = lmfmod_4014_flag }
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 10
						}
						
						# then see if there are two attending rivals who can fight
						any_in_list = {
							list = potential_family_dinner_guests
							is_adult = yes
							num_of_relation_rival >= 1
							NOR = {
								has_character_flag = featured_family_dinner_event
								has_personality_levelheaded_trigger = yes
								has_personality_submissive_trigger = yes
								has_trait = wounded
								has_trait = infirm
								has_trait = maimed
								has_trait = blind
								has_trait = craven
							}
							save_temporary_scope_as = current_rival
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:current_rival }
							any_relation = {
								type = rival
								is_in_list = potential_family_dinner_guests
								is_adult = yes
								OR = {
									prowess <= scope:current_rival.prowess
									prowess < 10
								}
								NOR = {
									has_trait = wounded
									has_trait = infirm
									has_trait = maimed
									has_trait = blind
								}
								save_temporary_scope_as = target_rival
								can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:target_rival }
							}
						}
					}
					trigger_event = lmf_feast.1014 # Duel between two rivals at the dinner
				}
				50 = {
					modifier = {
						add = 20
						exists = primary_spouse
						primary_spouse = { has_relation_soulmate = root }
					}
					trigger = {
						NOT = { has_character_flag = lmfmod_4015_flag }
						exists = primary_spouse
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 5
						}
						
						# has a spouse attending who is happy
						primary_spouse = {
							is_in_list = potential_family_dinner_guests
							NOR = {
								has_trait = pregnant
								has_character_flag = featured_family_dinner_event
								has_marital_grievance = { CHARACTER = root }
							}
							OR = {
								still_got_it_trigger = yes
								chaste_marriage_trigger = yes
								any_child = {
									is_in_list = potential_family_dinner_guests
									is_child_of = root
									NOR = {
										has_trait = bastard
										has_trait = legitimized_bastard
										has_trait = wild_oat
										has_trait = disputed_heritage
									}
									age <= 8
								}
								any_child = {
									is_available = yes
									has_recoverable_disease_trigger = no
									is_child_of = root
									NOR = {
										has_trait = bastard
										has_trait = legitimized_bastard
										has_trait = wild_oat
										has_trait = disputed_heritage
									}
									age < 3
								}
							}
						}
					}
					trigger_event = lmf_feast.1015 # Good dinner with the player's spouse
				}
				50 = {
					modifier = {
						add = 20
						exists = primary_spouse
						primary_spouse = {
							OR = {
								hurt_by_marriage_betrayal_trigger = { CHARACTER = root }
								has_relation_nemesis = root
							}
						}
					}
					trigger = {
						NOT = { has_character_flag = lmfmod_4016_flag }
						exists = primary_spouse
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 5
						}
						
						# has a spouse who is unhappy
						primary_spouse = {
							is_in_list = potential_family_dinner_guests
							has_marital_grievance = { CHARACTER = root }
							NOR = {
								has_trait = pregnant
								has_character_flag = featured_family_dinner_event
							}
						}
					}
					trigger_event = lmf_feast.1016 # Marital spat between player and spouse
				}
				25 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4017_flag }
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 10
						}
					}
					trigger_event = lmf_feast.1017 # Terrible accident at the feast
				}
				25 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4018_flag }
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 10
						}
						
						# and that someone can get sick
						any_in_list = {
							list = potential_family_dinner_guests
							is_relevant_family_member = { CHARACTER = root }
							NOT = { has_character_flag = featured_family_dinner_event }
							can_contract_disease_trigger = { DISEASE = ill }
						}
					}
					trigger_event = lmf_feast.1018 # Someone grows ill at the feast
				}
				50 = {
					modifier = {
						add = -25
						has_character_flag = lmfmod_4019_flag
					}
					trigger = {
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 5
						}
					}
					trigger_event = lmf_feast.1019 # Normal family dinner
				}
				200 = {
					modifier = {
						add = 150
						NOT = {
							any_child = { is_alive = yes }
						}
					}
					trigger = {
						NOT = { has_character_flag = lmfmod_4020_flag }
						exists = primary_spouse
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 5
						}
						# has a pregnant spouse attending who isn't unhappy but might be rival
						primary_spouse = {
							is_in_list = potential_family_dinner_guests
							has_trait = pregnant
							NOR = {
								has_character_flag = featured_family_dinner_event
								knows_of_my_secret_lover = { CHARACTER = root }
								has_known_secret_lover = { CHARACTER = root }
								betrayed_our_marriage_trigger = { CHARACTER = root }
								hurt_by_marriage_betrayal_trigger = { CHARACTER = root }
								has_marital_trait_or_secret_objectionable_to = { OBJECTOR = root }
								root = { has_marital_trait_or_secret_objectionable_to = { OBJECTOR = root.primary_spouse } }
							}
						}
					}
					trigger_event = lmf_feast.1020 # Player's spouse is pregnant
				}
				50 = {
					modifier = {
						add = 20
						stress > higher_than_baseline_stress
					}
					trigger = {
						NOT = { has_character_flag = lmfmod_4021_flag }
						is_adult = yes
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 8
						}

						# then see if there's a friend to spend time with
						any_in_list = {
							list = potential_family_dinner_guests
							has_relation_friend = root
							is_adult = yes
							opinion = { target = root value >= 20 }
							NOR = {
								has_character_flag = featured_family_dinner_event
								is_consort_of = root
								has_relation_lover = root
								is_hostage_of = root
							}
						}
					}
					trigger_event = lmf_feast.1021 # Player at ease with a family friend
				}
				50 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4022_flag }
						is_adult = yes
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 8
						}

						# then see if there's a rival
						any_in_list = {
							list = potential_family_dinner_guests
							has_relation_rival = root
							is_adult = yes
							NOR = {
								has_character_flag = featured_family_dinner_event
								is_consort_of = root
								has_relation_lover = root
								is_hostage_of = root
							}
						}
					}
					trigger_event = lmf_feast.1022 # Player angered by family rival
				}
				50 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4023_flag }
						is_adult = yes
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 8
						}
						
						# the previous holder was a close relative who's been dead a few years
						exists = root.primary_title.previous_holder
						any_close_family_member = {
							even_if_dead = yes
							is_alive = no
							is_close_family_of = root
							faith = root.faith
							this = root.primary_title.previous_holder
							days_since_death >= 1095
						}

						# then see if there's a relative to kick off the toast
						any_in_list = {
							list = potential_family_dinner_guests
							is_adult = yes
							has_dynasty = yes
							faith = root.primary_title.previous_holder.faith
							dynasty = root.primary_title.previous_holder.dynasty
							is_close_or_extended_family_of = root.primary_title.previous_holder
							save_temporary_scope_as = potential_toaster
							NOR = {
								is_consort_of = root
								has_relation_rival = root
							}
						}
					}
					trigger_event = lmf_feast.1023 # Remembering the previous holder of the player's primary title
				}
				50 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4024_flag }
						is_adult = yes
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 8
						}

						# then see if there's a suitable hostage
						any_in_list = {
							list = potential_family_dinner_guests
							is_hostage_of = root
							save_temporary_scope_as = potential_family_hostage
							OR = {
								NOR = {
									knows_language_of_culture = root.culture
									root = { knows_language_of_culture = scope:potential_family_hostage.culture }
									any_in_list = {
										list = potential_family_dinner_guests
										NOT = { this = scope:potential_family_hostage }
										knows_language_of_culture = scope:potential_family_hostage.culture
										count > 1
									}
								}
								NOR = {
									culture = root.culture
									any_in_list = {
										list = potential_family_dinner_guests
										NOT = { this = scope:potential_family_hostage }
										culture = scope:potential_family_hostage.culture
										count > 1
									}
								}
								NOR = {
									religion = root.religion
									any_in_list = {
										list = potential_family_dinner_guests
										NOT = { this = scope:potential_family_hostage }
										religion = scope:potential_family_hostage.religion
										count > 1
									}
								}
							}
							NOR = {
								has_relation_rival = root
								has_relation_friend = root
								is_close_or_extended_family_of = root
								has_character_flag = featured_family_dinner_event
							}
						}
					}
					trigger_event = lmf_feast.1024 # Hostage feels out of place among family
				}
				50 = {
					modifier = {
						add = 50
						any_in_list = {
							list = potential_family_dinner_guests
							has_relation_guardian = root
							age >= 10
							any_heir_title = { holder = root }
						}
					}
					trigger = {
						NOT = { has_character_flag = lmfmod_4025_flag }
						is_adult = yes
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 5
						}

						# then see if there's a suitable ward
						any_in_list = {
							list = potential_family_dinner_guests
							has_relation_guardian = root
							age >= 10
							OR = {
								has_focus = education_martial
								has_focus = education_intrigue
								has_focus = education_learning
								has_focus = education_diplomacy
								has_focus = education_stewardship
							}
							save_temporary_scope_as = potential_ward
							any_in_list = {
								list = potential_family_dinner_guests
								NOT = { this = root }
								OR = {
									AND = {
										scope:potential_ward = { has_focus = education_martial }
										OR = {
											has_trait = education_martial_3
											has_trait = education_martial_4
											has_trait = education_martial_5
										}
									}
									AND = {
										scope:potential_ward = { has_focus = education_intrigue }
										OR = {
											has_trait = education_intrigue_3
											has_trait = education_intrigue_4
											has_trait = education_intrigue_5
										}
									}
									AND = {
										scope:potential_ward = { has_focus = education_learning }
										OR = {
											has_trait = education_learning_3
											has_trait = education_learning_4
											has_trait = education_learning_5
										}
									}
									AND = {
										scope:potential_ward = { has_focus = education_diplomacy }
										OR = {
											has_trait = education_diplomacy_3
											has_trait = education_diplomacy_4
											has_trait = education_diplomacy_5
										}
									}
									AND = {
										scope:potential_ward = { has_focus = education_stewardship }
										OR = {
											has_trait = education_stewardship_3
											has_trait = education_stewardship_4
											has_trait = education_stewardship_5
										}
									}
								}
							}
						}
					}
					trigger_event = lmf_feast.1025 # Ward can be taught a lesson
				}
				50 = {
					modifier = {
						add = 50
						OR = {
							has_trait = zealous
							has_trait = cynical
						}
					}
					modifier = {
						add = 50
						any_in_list = {
							list = potential_family_dinner_guests
							is_adult = yes
							faith = root.faith
							OR = {
								is_clergy = yes
								has_council_position = councillor_court_chaplain
							}
							ai_zeal >= 50
							NOR = {
								has_character_flag = featured_family_dinner_event
								has_relation_rival = root
							}
						}
					}
					trigger = {
						NOT = { has_character_flag = lmfmod_4026_flag }
						is_adult = yes
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 8
						}

						# then see if there's a suitable religious family member
						any_in_list = {
							list = potential_family_dinner_guests
							is_adult = yes
							faith = root.faith
							is_pious_or_clergy = yes
							NOR = {
								has_character_flag = featured_family_dinner_event
								has_relation_rival = root
							}
						}
					}
					trigger_event = lmf_feast.1026 # Pious family member gives a prayer
				}
				50 = {
					modifier = {
						add = 50
						any_in_list = {
							list = potential_family_dinner_guests
							is_adult = yes
							OR = {
								AND = {
									has_court_position = court_musician_court_position
									aptitude = {
										court_position = court_musician_court_position
										value >= 4
									}
								}
								AND = {
									has_court_position = master_bard_camp_officer
									aptitude = {
										court_position = master_bard_camp_officer
										value >= 4
									}
								}
							}
							NOR = {
								has_character_flag = featured_family_dinner_event
								has_relation_rival = root
							}
						}
					}
					trigger = {
						NOT = { has_character_flag = lmfmod_4027_flag }
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 12
						}

						# then see if there's a suitable religious family member
						any_in_list = {
							list = potential_family_dinner_guests
							is_adult = yes
							OR = {
								AND = {
									has_trait = lifestyle_poet
									diplomacy >= 12
								}
								AND = {
									has_court_position = court_musician_court_position
									aptitude = {
										court_position = court_musician_court_position
										value >= 3
									}
								}
								AND = {
									has_court_position = master_bard_camp_officer
									aptitude = {
										court_position = master_bard_camp_officer
										value >= 3
									}
								}
							}
							NOR = {
								has_character_flag = featured_family_dinner_event
								has_relation_rival = root
							}
						}
					}
					trigger_event = lmf_feast.1027 # Entertainment at the family feast
				}
				50 = {
					modifier = {
						add = 50
						age <= 30
					}
					modifier = {
						add = -25
						age >= 50
					}
					trigger = {
						NOT = { has_character_flag = lmfmod_4028_flag }
						is_adult = yes
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 10
						}

						# then see if there's a suitable religious family member
						any_in_list = {
							list = potential_family_dinner_guests
							is_adult = yes
							any_character_trait = {
								has_trait_category = lifestyle
								OR = {
									this = trait:diplomat
									this = trait:family_first
									this = trait:august
									this = trait:strategist
									this = trait:overseer
									this = trait:gallant
									this = trait:architect
									this = trait:administrator
									this = trait:avaricious
									this = trait:schemer
									this = trait:seducer
									this = trait:torturer
									this = trait:whole_of_body
									this = trait:scholar
									this = trait:theologian
								}
								NOT = {
									ROOT = { has_trait = prev }
								}
							}
							NOR = {
								has_character_flag = featured_family_dinner_event
								has_relation_rival = root
							}
						}
					}
					trigger_event = lmf_feast.1028 # Excellent conversation at the family feast
				}
				100 = {
					modifier = {
						add = 50
						is_married = yes
					}
					modifier = {
						factor = 0.5
						intrigue >= 12
					}
					trigger = {
						NOT = { has_character_flag = lmfmod_4029_flag }
						is_adult = yes
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 12
						}
						
						# is the player's public lover attending?
						any_in_list = {
							list = potential_family_dinner_guests
							has_relation_lover = root
							NOR = {
								is_consort_of = root
								has_character_flag = featured_family_dinner_event
								lover_is_secret_trigger = { CHARACTER = root }
							}
							save_temporary_scope_as = potential_public_lover
							# then pick out a family member to hate htem
							any_in_list = {
								list = potential_family_dinner_guests
								is_adult = yes
								OR = {
									ai_boldness >= 0
									ai_vengefulness >= 0
								}
								OR = {
									has_personality_malicious_trigger = yes
									is_hot_headed_trigger = yes
									is_consort_of = root
									has_relation_lover = root
								}
								OR = {
									AND = {
										scope:potential_public_lover = { relation_with_character_is_sodomy_in_my_or_lieges_faith_trigger = { CHARACTER = root } }
										has_negative_attitude_towards_trait_trigger = { TRAIT = trait:sodomite GENDER_CHARACTER = scope:potential_public_lover }
									}
									AND = {
										scope:potential_public_lover = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = root } }
										has_negative_attitude_towards_trait_trigger = { TRAIT = trait:incestuous GENDER_CHARACTER = scope:potential_public_lover }
									}
									AND = {
										trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = trait:adulterer GENDER_CHARACTER = scope:potential_public_lover }
										has_negative_attitude_towards_trait_trigger = { TRAIT = trait:adulterer GENDER_CHARACTER = scope:potential_public_lover }
									}
									is_consort_of = root
									has_relation_lover = root
								}
								NOR = {
									this = scope:potential_public_lover
									has_character_flag = featured_family_dinner_event
									likes_character_trigger = { CHARACTER = scope:potential_public_lover }
								}
							}
						}
					}
					trigger_event = lmf_feast.1029 # Public lover is the subject of family gossip
				}
				100 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4030_flag }
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 8
						}
						
						# first see if there's an instigator
						any_in_list = {
							list = potential_family_dinner_guests
							is_adult = yes
							num_of_relation_rival <= 2
							OR = {
								has_personality_malicious_trigger = yes
								is_hot_headed_trigger = yes
							}
							NOT = { has_character_flag = featured_family_dinner_event }
							save_temporary_scope_as = potential_culture_rival
							# then see if there's someone of a different culture to argue with
							any_in_list = {
								list = family_dinner_guests
								is_adult = yes
								num_of_relation_rival <= 2
								save_temporary_scope_as = potential_rival_check
								NOR = {
									this = scope:potential_culture_rival
									scope:potential_culture_rival = { likes_character_trigger = { CHARACTER = scope:potential_rival_check } }
									culture = scope:potential_culture_rival.culture
									has_character_flag = featured_family_dinner_event
								}
								scope:potential_culture_rival.culture = {
									cultural_acceptance = {
										target = scope:potential_rival_check.culture
										value < 5
									}
								}
							}
						}
					}
					trigger_event = lmf_feast.1030 # Two attendees of different cultures argue
				}
				50 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4031_flag }
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 10
						}
						
						# see if there's a stressed family member who can make a fool of themselves
						any_in_list = {
							list = potential_family_dinner_guests
							is_adult = yes
							is_relevant_family_member = { CHARACTER = root }
							stress > normal_baseline_stress
							save_temporary_scope_as = potential_stress_fool
							OR = {
								has_trait = lunatic
								has_trait = hashishiyah
								has_trait = irritable
								has_trait = depressed
								has_trait = drunkard
								has_trait = rakish
								has_trait = reclusive
								AND = {
									is_deviant_trigger = yes
									has_personality_levelheaded_trigger = no
								}
								AND = {
									has_trait = contrite
									any_secret = {
										exists = this
										can_be_exposed_by = scope:potential_stress_fool
									}
								}
								AND = {
									has_a_bad_stress_coping_trait_trigger = no
									OR = {
										can_be_drunkard = yes
										can_be_hashishiyah = yes
										can_be_rakish = yes
										can_be_irritable = yes
										can_be_reclusive = yes
										AND = {
											can_be_contrite = yes
											any_secret = {
												exists = this
												can_be_exposed_by = scope:potential_stress_fool
											}
										}
									}
								}
							}
						}
					}
					trigger_event = lmf_feast.1031 # Stressed family member makes a fool of themselves
				}
				50 = {
					trigger = {
						is_adult = yes
						NOT = { has_character_flag = lmfmod_4032_flag }
						is_at_war = no
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 15
						}
						
						# see if there are three family celebrators
						any_in_list = {
							list = potential_family_dinner_guests
							is_adult = yes
							ai_sociability >= 50
							ai_boldness >= 0
							NOR = {
								has_character_flag = featured_family_dinner_event
								has_trait = temperate
								has_trait = depressed
								has_trait = reclusive
								has_trait = infirm
								has_trait = wounded
								has_relation_rival = root
							}
							count > 2
						}
					}
					trigger_event = lmf_feast.1032 # A spontaneous celebration breaks out
				}
				100 = {
					trigger = {
						NOT = { has_character_flag = lmfmod_4033_flag }
						
						# first make sure we've got a large enough pool to work with
						any_in_list = {
							list = potential_family_dinner_guests
							count >= 12
						}
						
						# see if there is a family member with an angry spouse
						any_in_list = {
							list = potential_family_dinner_guests
							is_adult = yes
							is_married = yes
							is_relevant_family_member = { CHARACTER = root }
							primary_spouse = {
								is_in_list = potential_family_dinner_guests
								NOT = { has_character_flag = featured_family_dinner_event }
							}
							NOR = {
								has_character_flag = featured_family_dinner_event
								is_spouse_of = root
							}
							save_temporary_scope_as = potential_rival
							primary_spouse = { save_temporary_scope_as = potential_rival_spouse }
							OR = {
								AND = {
									has_trait_submissive_trigger = no
									has_personality_levelheaded_trigger = no
									OR = {
										scope:potential_rival_spouse = { has_marital_trait_or_secret_objectionable_to = { OBJECTOR = scope:potential_rival } }
										hurt_by_marriage_betrayal_trigger = { CHARACTER = scope:potential_rival_spouse }
										knows_of_my_secret_lover = { CHARACTER = scope:potential_rival_spouse }
										has_relation_rival = scope:potential_rival_spouse
										AND = {
											has_relation_potential_rival = scope:potential_rival_spouse
											opinion = { target = scope:potential_rival_spouse value < 0 }
										}
									}
								}
								primary_spouse = {
									has_trait_submissive_trigger = no
									has_personality_levelheaded_trigger = no
									OR = {
										scope:potential_rival = { has_marital_trait_or_secret_objectionable_to = { OBJECTOR = scope:potential_rival_spouse } }
										hurt_by_marriage_betrayal_trigger = { CHARACTER = scope:potential_rival }
										knows_of_my_secret_lover = { CHARACTER = scope:potential_rival }
										has_relation_rival = scope:potential_rival
										AND = {
											has_relation_potential_rival = scope:potential_rival
											opinion = { target = scope:potential_rival value < 0 }
										}
									}
								}
							}
						}
					}
					trigger_event = lmf_feast.1033 # Family members have marriage spat
				}
			}
		}
		# when the player is busy, re-check in 30 days if the event falls earlier in the year
		# (we skip January because that might be a holdover from the previous year)
		else_if = {
			limit = {
				current_month > 1
				current_month < 9
			}
			trigger_event = {
				id = lmf_feast.1000
				days = 30
			}
		}
	}
}

# Two family members become rivals
lmf_feast.1001 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1001.t
	desc = {
		desc = lmf_feast.1001.desc.opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:family_rival_2 = {
						has_closer_or_equal_relation_than = { CHARACTER = root TARGET = scope:family_rival_1 }
					}
				}
				desc = lmf_feast.1001.desc.relation
			}
			desc = lmf_feast.1001.desc.norelation
		}
		desc = lmf_feast.1001.desc.mid
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:family_rival_2 = {
						is_adult = no
						is_male = yes
					}
				}
				desc = lmf_feast.1001.desc.child.male
			}
			triggered_desc = {
				trigger = {
					scope:family_rival_2 = {
						is_adult = no
						is_female = yes
					}
				}
				desc = lmf_feast.1001.desc.child.female
			}
			triggered_desc = {
				trigger = {
					scope:family_rival_2 = {
						can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:family_rival_2 }
					}
				}
				desc = lmf_feast.1001.desc.combatant
			}
			desc = lmf_feast.1001.desc.noncombatant
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						is_adult = no
						has_trait = infirm
						has_trait = lazy
						has_trait = intellect_bad
					}
				}
				desc = lmf_feast.1001.desc.bystander
			}
			desc = lmf_feast.1001.desc.intervene
		}
		desc = lmf_feast.1001.desc.end
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:family_rival_1 = {
						OR = {
							has_relation_best_friend = scope:family_rival_2
							has_relation_friend = scope:family_rival_2
						}
					}
				}
				desc = lmf_feast.1001.desc.friends
			}
			desc = lmf_feast.1001.desc.notfriends
		}
	}
	theme = family
	
	left_portrait = {
		character = scope:family_rival_1
		triggered_animation = {
			trigger = {
				scope:family_rival_2 = {
					is_adult = yes
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:family_rival_2 }
				}
			}
			animation = shock
		}
		animation = dismissal
	}
	right_portrait = {
		character = scope:family_rival_2
		triggered_animation = {
			trigger = {
				scope:family_rival_2 = {
					is_adult = yes
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:family_rival_2 }
				}
			}
			animation = aggressive_dagger
		}
		animation = rage
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_unfriendly" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4001_flag years = 10 }
			create_family_dinner_pool = yes
			
			# pick out the two who will become rivals
			random_in_list = {
				list = family_dinner_guests
				limit = {
					age >= 12
					num_of_relation_rival <= 2
					is_relevant_family_member = { CHARACTER = root }
					NOT = { has_character_flag = featured_family_dinner_event }
					save_temporary_scope_as = potential_rival
					any_in_list = {
						list = family_dinner_guests
						NOT = { this = scope:potential_rival }
						num_of_relation_rival <= 2
						can_be_family_rival_with = { CHARACTER = scope:potential_rival }
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 3
						any_in_list = {
							list = family_dinner_guests
							NOT = { this = scope:potential_rival }
							num_of_relation_rival <= 2
							has_relation_potential_rival = scope:potential_rival
						}
					}
					modifier = {
						add = 10
						any_in_list = {
							list = family_dinner_guests
							NOT = { this = scope:potential_rival }
							num_of_relation_rival <= 2
							is_at_war_with = scope:potential_rival
						}
					}
					modifier = {
						add = 10
						any_in_list = {
							list = family_dinner_guests
							NOT = { this = scope:potential_rival }
							num_of_relation_rival <= 2
							ai_vengefulness >= 0
							has_simplified_revenge_opinion_against_character_trigger = { CHARACTER = scope:potential_rival }
						}
					}
					modifier = {
						add = 5
						any_in_list = {
							list = family_dinner_guests
							NOT = { this = scope:potential_rival }
							num_of_relation_rival <= 2
							faith = {
								faith_hostility_level = {
									target = scope:potential_rival.faith
									value >= faith_hostile_level
								}
							}
						}
					}
					modifier = {
						add = 5
						has_personality_malicious_trigger = yes
					}
					modifier = {
						add = -5
						has_personality_benevolent_trigger = yes
					}
					modifier = {
						add = 3
						has_personality_annoying_trigger = yes
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
				}
				save_scope_as = family_rival_1
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOT = { this = scope:family_rival_1 }
					num_of_relation_rival <= 2
					can_be_family_rival_with = { CHARACTER = scope:family_rival_1 }
				}
				weight = {
					base = 1
					ai_value_modifier = {
						ai_compassion = -1
						ai_vengefulness = 2
					}
					opinion_modifier = {
						who = this
						opinion_target = scope:family_rival_1
						multiplier = -5
					}
					compatibility_modifier = {
						who = this
						compatibility_target = scope:family_rival_1
						multiplier = -2
					}
					modifier = {
						add = 50
						has_relation_potential_rival = scope:family_rival_1
					}
					modifier = {
						add = 25
						is_knight = yes
						scope:family_rival_1 = { is_knight = yes }
					}
					modifier = {
						factor = 0.5
						sex_opposite_of = scope:family_rival_1
					}
					modifier = {
						factor = 0.5
						OR = {
							age > scope:family_rival_1.age_plus_3
							age < scope:family_rival_1.age_minus_3
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							age > scope:family_rival_1.age_plus_5
							age < scope:family_rival_1.age_minus_5
						}
					}
					modifier = {
						add = 50
						NOT = { faith = scope:family_rival_1.faith }
					}
					modifier = {
						add = 100
						is_at_war_with = scope:family_rival_1
					}
					modifier = {
						add = 200
						has_simplified_revenge_opinion_against_character_trigger = { CHARACTER = scope:family_rival_1 }
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = family_rival_2
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
			
			# see if it might involve a claim (for loc)
			if = {
				limit = {
					scope:family_rival_2 = {
						any_claim = { holder = scope:family_rival_1 }
					}
				}
				scope:family_rival_2 = {
					every_claim = {
						limit = { holder = scope:family_rival_1 }
						add_to_list = fr1_claimed_titles
					}
				}
				ordered_in_list = {
					list = fr1_claimed_titles
					order_by = {
						value = tier
						if = {
							limit = { scope:family_rival_2 = { has_strong_claim_on = prev } }
							add = 2
						}
					}
					save_scope_as = rival_claim_title
				}
			}
		}
	}

	option = {
		name = lmf_feast.1001.a
		scope:family_rival_2 = {
			if = {
				limit = { has_relation_best_friend = scope:family_rival_1 }
				remove_relation_best_friend = scope:family_rival_1
			}
			else_if = {
				limit = { has_relation_friend = scope:family_rival_1 }
				remove_relation_friend = scope:family_rival_1
			}
			else = {
				set_relation_rival = {
					target = scope:family_rival_1
					reason = rival_family_dinner
				}
			}
			add_opinion = {
				target = scope:family_rival_1
				modifier = hate_opinion
				opinion = -40
			}
			reverse_add_opinion = {
				target = scope:family_rival_1
				modifier = angry_opinion
				opinion = -20
			}
		}
	}
}

# Family member becomes player's rival
lmf_feast.1002 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1001.t
	desc = lmf_feast.1002.desc
	theme = family
	
	left_portrait = {
		character = root
		animation = dismissal
	}
	right_portrait = {
		character = scope:family_rival
		animation = rage
	}
	lower_right_portrait = scope:dinner_pos_family
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_unfriendly" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4002_flag years = 10 }
			create_family_dinner_pool = yes
			
			# pick out who will become the rival
			random_in_list = {
				list = family_dinner_guests
				limit = {
					num_of_relation_rival <= 2
					NOT = { has_character_flag = featured_family_dinner_event }
					can_be_family_rival_with_root = yes
				}
				weight = {
					base = 1
					ai_value_modifier = {
						ai_compassion = -1
						ai_vengefulness = 2
					}
					opinion_modifier = {
						who = this
						opinion_target = root
						multiplier = -5
					}
					compatibility_modifier = {
						who = this
						compatibility_target = root
						multiplier = -10
					}
					modifier = {
						add = 500
						has_relation_potential_rival = root
					}
					modifier = {
						factor = 0.5
						sex_opposite_of = root
					}
					modifier = {
						factor = 0.75
						OR = {
							age > root.age_plus_3
							age < root.age_minus_3
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							age > root.age_plus_5
							age < root.age_minus_5
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							age > root.age_plus_10
							age < root.age_minus_10
						}
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = family_rival
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
			
			# pick out a family member to exhibit good behavior, to kick things off
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOT = { this = scope:family_rival }
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						has_relation_friend = root
					}
					modifier = {
						add = 1
						OR = {
							has_trait = pregnant
							has_trait = gregarious
							has_trait = lifestyle_reveler
						}
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					min = 1
				}
				save_scope_as = dinner_pos_family
				assign_pos_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
		}
	}
	
	option = {
		name = lmf_feast.1002.a
		scope:family_rival = {
			set_relation_rival = {
				target = root
				reason = self_rival_family_dinner
			}
		}
	}
	
	after = {
		scope:dinner_pos_family = { remove_variable = pos_dinner }
	}
}

# Rival family members resolve differences
lmf_feast.1003 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1003.t
	desc = {
		desc = lmf_feast.1003.desc.opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:family_rival_1 = {
						has_closer_or_equal_relation_than = { CHARACTER = root TARGET = scope:family_rival_2 }
					}
				}
				desc = lmf_feast.1003.desc.relation
			}
			desc = lmf_feast.1003.desc.norelation
		}
		first_valid = {
			triggered_desc = {
				trigger = { is_adult = no }
				desc = lmf_feast.1003.desc.child
			}
			desc = lmf_feast.1003.desc.end
		}
	}
	theme = family
	
	left_portrait = {
		character = scope:family_rival_1
		animation = toast_goblet
	}
	right_portrait = {
		character = scope:family_rival_2
		animation = laugh
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_friendly" }

	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4003_flag years = 10 }
			create_family_dinner_pool = yes
			
			# pick out the two rivals who might make up
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					num_of_relation_rival >=1
					NOT = { has_character_flag = featured_family_dinner_event }
					save_temporary_scope_as = current_rival
					any_relation = {
						type = rival
						is_in_list = family_dinner_guests
						is_adult = yes
						NOR = {
							has_relation_nemesis = scope:current_rival
							any_targeting_scheme = { scheme_owner = scope:current_rival }
							any_scheme = { scheme_target_character = scope:current_rival }
						}
					}
				}
				save_scope_as = family_rival_1
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
				random_relation = {
					type = rival
					limit = {
						is_in_list = family_dinner_guests
						is_adult = yes
						NOR = {
							has_relation_nemesis = scope:family_rival_1
							any_targeting_scheme = { scheme_owner = scope:family_rival_1 }
							any_scheme = { scheme_target_character = scope:family_rival_1 }
						}
					}
					save_scope_as = family_rival_2
					remove_character_flag ?= featured_family_dinner_event
					add_character_flag = { flag = featured_family_dinner_event years = 5 }
				}
			}
		}
	}

	option = {
		trigger = { is_adult = yes }
		name = lmf_feast.1003.a # Try to convince them to make up
		show_as_unavailable = { is_adult = no }
		random_list = {
			30 = {
				ai_value_modifier = {
					who = scope:family_rival_1
					ai_vengefulness = -0.25
				}
				ai_value_modifier = {
					who = scope:family_rival_2
					ai_vengefulness = -0.25
				}
				modifier = {
					add = {
						value = diplomacy
						multiply = 5
					}
				}
				desc = lmf_feast.1003.a.convince.tt
				show_as_tooltip = {
					scope:family_rival_1 = { remove_relation_rival = scope:family_rival_2 }
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = lmf_feast.1003.a.convince.tt
					left_icon = scope:family_rival_1
					right_icon = scope:family_rival_2
					scope:family_rival_1 = { remove_relation_rival = scope:family_rival_2 }
				}
			}
			70 = {
				desc = lmf_feast.1003.a.fail.tt
				show_as_tooltip = {
					scope:family_rival_1 = {
						add_opinion = {
							target = root
							modifier = annoyed_opinion
							opinion = -10
						}
					}
					scope:family_rival_2 = {
						add_opinion = {
							target = root
							modifier = annoyed_opinion
							opinion = -10
						}
					}
				}
				send_interface_toast = {
					type = event_toast_effect_bad
					title = lmf_feast.1003.a.fail.tt
					left_icon = scope:family_rival_1
					right_icon = scope:family_rival_2
					scope:family_rival_1 = {
						add_opinion = {
							target = root
							modifier = annoyed_opinion
							opinion = -10
						}
					}
					scope:family_rival_2 = {
						add_opinion = {
							target = root
							modifier = annoyed_opinion
							opinion = -10
						}
					}
				}
			}
		}
	}
	option = {
		name = {
			trigger = { is_adult = yes }
			text = lmf_feast.1003.b # They can work it out on their own
		}
		name = {
			trigger = { is_adult = no }
			text = lmf_feast.1003.c # I hope they work it out
		}
		random_list = {
			50 = {
				ai_value_modifier = {
					who = scope:family_rival_1
					ai_vengefulness = -0.25
				}
				ai_value_modifier = {
					who = scope:family_rival_2
					ai_vengefulness = -0.25
				}
				desc = lmf_feast.1003.b.makeup.tt
				show_chance = no
				show_as_tooltip = {
					scope:family_rival_1 = { remove_relation_rival = scope:family_rival_2 }
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = lmf_feast.1003.b.makeup.tt
					left_icon = scope:family_rival_1
					right_icon = scope:family_rival_2
					scope:family_rival_1 = { remove_relation_rival = scope:family_rival_2 }
				}
			}
			50 = {
				desc = lmf_feast.1003.b.nomakeup.tt
				show_chance = no
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = lmf_feast.1003.b.nomakeup.tt
					left_icon = scope:family_rival_1
					right_icon = scope:family_rival_2
				}
			}
		}
	}
}

# Player might make up with family rival
lmf_feast.1004 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1003.t
	desc = lmf_feast.1004.desc
	theme = family
	
	left_portrait = {
		character = root
		animation = toast_goblet
	}
	right_portrait = {
		character = scope:family_rival
		animation = laugh
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_friendly" }

	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4004_flag years = 10 }
			create_family_dinner_pool = yes
			
			random_relation = {
				type = rival
				limit = {
					is_in_list = family_dinner_guests
					is_adult = yes
					NOR = {
						has_character_flag = featured_family_dinner_event
						has_relation_nemesis = root
						any_targeting_scheme = { scheme_owner = root }
						any_scheme = { scheme_target_character = root }
					}
				}
				save_scope_as = family_rival
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
		}
	}

	option = {
		name = lmf_feast.1004.a # Try to make amends
		duel = {
			skill = diplomacy
			target = scope:family_rival
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = lmf_feast.1004.a.success.tt
				send_interface_toast = {
					type = event_toast_effect_good
					title = lmf_feast.1004.a.success.tt
					left_icon = scope:family_rival
					remove_relation_rival = scope:family_rival
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 10
				desc = lmf_feast.1004.a.failure.tt
				send_interface_toast = {
					type = event_toast_effect_bad
					title = lmf_feast.1004.a.failure.tt
					left_icon = scope:family_rival
					stress_impact = { base = minor_stress_impact_gain }
					reverse_add_opinion = {
						target = scope:family_rival
						modifier = annoyed_opinion
						opinion = -10
					}
				}
			}
		}
	}
	option = {
		name = lmf_feast.1004.b # It was enough that we had a good night
		stress_impact = { base = minor_stress_impact_loss }
		reverse_add_opinion = {
			target = scope:family_rival
			modifier = amused_opinion
			opinion = 10
		}
	}
}

# Family dinner quiet due to recent death
lmf_feast.1005 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1005.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:was_miscarriage }
				desc = lmf_feast.1005.desc.miscarriage.start
			}
			desc = lmf_feast.1005.desc.start
		}
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:was_miscarriage }
				desc = lmf_feast.1005.desc.miscarriage
			}
			triggered_desc = {
				trigger = { scope:dead_relative = { age > 50 } }
				desc = lmf_feast.1005.desc.old
			}
			triggered_desc = {
				trigger = { scope:dead_relative = { age > 12 } }
				desc = lmf_feast.1005.desc.adult
			}
			triggered_desc = {
				trigger = { scope:dead_relative = { age > 2 } }
				desc = lmf_feast.1005.desc.child
			}
			desc = lmf_feast.1005.desc.baby
		}
	}
	theme = family
	
	right_portrait = {
		trigger = { exists = scope:was_miscarriage }
		character = scope:dead_relative
		animation = grief
	}
	left_portrait = {
		character = root
		animation = sadness
	}
	lower_right_portrait = {
		trigger = { NOT = { exists = scope:was_miscarriage } }
		character = scope:dead_relative
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_health_bad" }

	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4005_flag years = 5 }
			create_family_dinner_pool = yes
			
			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						has_variable = had_miscarriage
						has_trait = depressed_1
					}
					ai_compassion > high_negative_compassion
				}
				save_scope_value_as = {
					name = was_miscarriage
					value = flag:yes
				}
				primary_spouse = {
					save_scope_as = dead_relative
					var:had_miscarriage = { save_scope_as = dead_child }
				}
			}
			else = {
				every_close_family_member = {
					even_if_dead = yes
					limit = {
						is_alive = no
						is_close_family_of = root
						days_since_death <= 90
						any_close_family_member = {
							is_in_list = family_dinner_guests
							is_close_family_of = prev
							count > 2
							age >= 8
						}
					}
					add_to_list = recently_dead_relatives
				}
				every_consort = {
					even_if_dead = yes
					limit = {
						is_alive = no
						days_since_death <= 90
						any_close_family_member = {
							is_close_family_of = prev
							is_in_list = family_dinner_guests
							age >= 8
						}
					}
					add_to_list = recently_dead_relatives
				}
				
				random_in_list = {
					list = recently_dead_relatives
					save_scope_as = dead_relative
				}
			}
		}
	}

	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { exists = scope:was_miscarriage }
						desc = lmf_feast.1005.c
					}
					triggered_desc = {
						trigger = { has_trait = cynical }
						desc = lmf_feast.1005.b
					}
					desc = lmf_feast.1005.a
				}
			}
		}
		stress_impact = { base = minor_stress_impact_loss }
		every_in_list = {
			list = family_dinner_guests
			limit = {
				is_close_or_extended_family_of = scope:dead_relative
				age >= 8
			}
			add_opinion = {
				target = root
				modifier = grieved_together_opinion
			}
		}
	}
}

# Stressful family dinner
lmf_feast.1006 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1006.t
	desc = lmf_feast.1006.desc
	theme = family
	
	left_portrait = {
		character = scope:dinner_neg_family_1
		triggered_animation = {
			trigger = { scope:dinner_neg_family_1 = { var:neg_dinner = flag:reclusive } }
			animation = throne_room_conversation_3
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_1 = { var:neg_dinner = flag:lustful } }
			animation = admiration
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_1 = { var:neg_dinner = flag:cynical } }
			animation = eyeroll
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_1 = { var:neg_dinner = flag:craven } }
			animation = personality_coward
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_1 = { var:neg_dinner = flag:ambitious } }
			animation = laugh
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_1 = { var:neg_dinner = flag:rowdy } }
			animation = celebrate_wooden_sword
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_1 = { var:neg_dinner = flag:depressed } }
			animation = sadness
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_1 = { var:neg_dinner = flag:drunkard } }
			animation = drink_goblet
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family_1 = {
					var:neg_dinner = flag:fallback_3
					is_adult = yes
				}
			}
			animation = wedding_drunk
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_1 = { var:neg_dinner = flag:eccentric } }
			animation = eccentric
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_1 = { var:neg_dinner = flag:gluttonous } }
			animation = happiness
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family_1 = {
					OR = {
						var:neg_dinner = flag:lunatic
						var:neg_dinner = flag:possessed
					}
				}
			}
			animation = paranoia
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family_1 = {
					OR = {
						var:neg_dinner = flag:greedy
						var:neg_dinner = flag:wrathful
						var:neg_dinner = flag:impatient
						var:neg_dinner = flag:irritable
						var:neg_dinner = flag:bossy
					}
				}
			}
			animation = anger
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family_1 = {
					OR = {
						var:neg_dinner = flag:arrogant
						var:neg_dinner = flag:callous
						var:neg_dinner = flag:sadistic
					}
				}
			}
			animation = disgust
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family_1 = {
					OR = {
						var:neg_dinner = flag:shy
						var:neg_dinner = flag:paranoid
						var:neg_dinner = flag:pensive
						var:neg_dinner = flag:comfort_eater
					}
				}
			}
			animation = stress
		}
		animation = boredom
	}
	center_portrait = {
		character = scope:dinner_neg_family_2
		triggered_animation = {
			trigger = { scope:dinner_neg_family_2 = { var:neg_dinner = flag:reclusive } }
			animation = throne_room_conversation_3
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_2 = { var:neg_dinner = flag:lustful } }
			animation = admiration
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_2 = { var:neg_dinner = flag:cynical } }
			animation = eyeroll
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_2 = { var:neg_dinner = flag:craven } }
			animation = personality_coward
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_2 = { var:neg_dinner = flag:ambitious } }
			animation = laugh
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_2 = { var:neg_dinner = flag:rowdy } }
			animation = celebrate_wooden_sword
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_2 = { var:neg_dinner = flag:depressed } }
			animation = sadness
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_2 = { var:neg_dinner = flag:drunkard } }
			animation = drink_goblet
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family_2 = {
					var:neg_dinner = flag:fallback_3
					is_adult = yes
				}
			}
			animation = wedding_drunk
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_2 = { var:neg_dinner = flag:eccentric } }
			animation = eccentric
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_2 = { var:neg_dinner = flag:gluttonous } }
			animation = happiness
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family_2 = {
					OR = {
						var:neg_dinner = flag:lunatic
						var:neg_dinner = flag:possessed
					}
				}
			}
			animation = paranoia
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family_2 = {
					OR = {
						var:neg_dinner = flag:greedy
						var:neg_dinner = flag:wrathful
						var:neg_dinner = flag:impatient
						var:neg_dinner = flag:irritable
					}
				}
			}
			animation = anger
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family_2 = {
					OR = {
						var:neg_dinner = flag:arrogant
						var:neg_dinner = flag:callous
						var:neg_dinner = flag:sadistic
					}
				}
			}
			animation = disgust
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family_2 = {
					OR = {
						var:neg_dinner = flag:shy
						var:neg_dinner = flag:paranoid
						var:neg_dinner = flag:pensive
						var:neg_dinner = flag:comfort_eater
					}
				}
			}
			animation = stress
		}
		animation = boredom
	}
	right_portrait = {
		character = scope:dinner_neg_family_3
		triggered_animation = {
			trigger = { scope:dinner_neg_family_3 = { var:neg_dinner = flag:reclusive } }
			animation = throne_room_conversation_3
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_3 = { var:neg_dinner = flag:lustful } }
			animation = admiration
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_3 = { var:neg_dinner = flag:cynical } }
			animation = eyeroll
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_3 = { var:neg_dinner = flag:craven } }
			animation = personality_coward
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_3 = { var:neg_dinner = flag:ambitious } }
			animation = laugh
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_3 = { var:neg_dinner = flag:rowdy } }
			animation = celebrate_wooden_sword
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_3 = { var:neg_dinner = flag:depressed } }
			animation = sadness
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_3 = { var:neg_dinner = flag:drunkard } }
			animation = drink_goblet
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family_3 = {
					var:neg_dinner = flag:fallback_3
					is_adult = yes
				}
			}
			animation = wedding_drunk
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_3 = { var:neg_dinner = flag:eccentric } }
			animation = eccentric
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family_3 = { var:neg_dinner = flag:gluttonous } }
			animation = happiness
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family_3 = {
					OR = {
						var:neg_dinner = flag:lunatic
						var:neg_dinner = flag:possessed
					}
				}
			}
			animation = paranoia
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family_3 = {
					OR = {
						var:neg_dinner = flag:greedy
						var:neg_dinner = flag:wrathful
						var:neg_dinner = flag:impatient
						var:neg_dinner = flag:irritable
					}
				}
			}
			animation = anger
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family_3 = {
					OR = {
						var:neg_dinner = flag:arrogant
						var:neg_dinner = flag:callous
						var:neg_dinner = flag:sadistic
					}
				}
			}
			animation = disgust
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family_3 = {
					OR = {
						var:neg_dinner = flag:shy
						var:neg_dinner = flag:paranoid
						var:neg_dinner = flag:pensive
						var:neg_dinner = flag:comfort_eater
					}
				}
			}
			animation = stress
		}
		animation = boredom
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_unfriendly" }
	
	immediate = {
		hidden_effect = {
			remove_character_flag ?= lmfmod_4006_flag
			add_character_flag = { flag = lmfmod_4006_flag years = 5 }
			create_family_dinner_pool = yes
			
			# pick three family members for bad behavior
			random_in_list = {
				list = family_dinner_guests
				weight = {
					base = 1
					modifier = {
						add = 1
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						OR = {
							has_relation_rival = root
							reverse_opinion = { target = root value <= -20 }
						}
					}
					modifier = {
						add = 1
						OR = {
							has_trait = drunkard
							has_trait = reclusive
							has_trait = irritable
							has_trait = comfort_eater
							has_trait = inappetetic
							has_trait = depressed
							has_trait = lunatic
							has_trait = possessed
						}
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = dinner_neg_family_1
				assign_neg_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOT = { this = scope:dinner_neg_family_1 }
				}
				weight = {
					base = 1
					modifier = {
						add = 1
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						OR = {
							has_relation_rival = root
							reverse_opinion = { target = root value <= -20 }
						}
					}
					modifier = {
						add = 1
						OR = {
							has_trait = drunkard
							has_trait = reclusive
							has_trait = irritable
							has_trait = comfort_eater
							has_trait = inappetetic
							has_trait = depressed
							has_trait = lunatic
							has_trait = possessed
						}
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = dinner_neg_family_2
				assign_neg_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOR = {
						this = scope:dinner_neg_family_1
						this = scope:dinner_neg_family_2
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 1
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						OR = {
							has_relation_rival = root
							reverse_opinion = { target = root value <= -20 }
						}
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = dinner_neg_family_3
				assign_neg_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
		}
	}
	
	option = {
		name = lmf_feast.1006.a
		stress_impact = {
			base = medium_stress_gain
			paranoid = minor_stress_impact_gain
			reclusive = minor_stress_impact_gain
			irritable = minor_stress_impact_gain
		}
		scope:dinner_neg_family_1 = {
			add_opinion = {
				target = root
				modifier = insult_opinion
				opinion = -10
			}
		}
		scope:dinner_neg_family_2 = {
			add_opinion = {
				target = root
				modifier = insult_opinion
				opinion = -10
			}
		}
		scope:dinner_neg_family_3 = {
			add_opinion = {
				target = root
				modifier = insult_opinion
				opinion = -10
			}
		}
	}
	
	after = {
		scope:dinner_neg_family_1 = { remove_variable = neg_dinner }
		scope:dinner_neg_family_2 = { remove_variable = neg_dinner }
		scope:dinner_neg_family_3 = { remove_variable = neg_dinner }
	}
}

# Serene family dinner
lmf_feast.1007 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1007.t
	desc = lmf_feast.1007.desc
	theme = family

	left_portrait = {
		character = scope:dinner_pos_family_1
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family_1 = {
					OR = {
						var:pos_dinner = flag:brave
						var:pos_dinner = flag:lifestyle_blademaster
						var:pos_dinner = flag:lifestyle_hunter
					}
				}
			}
			animation = storyteller
		}
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family_1 = {
					OR = {
						var:pos_dinner = flag:gregarious
						var:pos_dinner = flag:fallback_3
					}
				}
			}
			animation = laugh
		}
		triggered_animation = {
			trigger = { scope:dinner_pos_family_1 = { var:pos_dinner = flag:lifestyle_reveler } }
			animation = toast_goblet
		}
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family_1 = {
					OR = {
						var:pos_dinner = flag:intellect_good
						var:pos_dinner = flag:honest
					}
				}
			}
			animation = debating
		}
		triggered_animation = {
			trigger = { scope:dinner_pos_family_1 = { var:pos_dinner = flag:zealous } }
			animation = prayer
		}
		triggered_animation = {
			trigger = { scope:dinner_pos_family_1 = { var:pos_dinner = flag:diligent } }
			animation = throne_room_conversation_1
		}
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family_1 = {
					OR = {
						var:pos_dinner = flag:forgiving
						var:pos_dinner = flag:compassionate
						var:pos_dinner = flag:trusting
						var:pos_dinner = flag:charming
					}
				}
			}
			animation = happiness
		}
		animation = personality_content
	}
	center_portrait = {
		character = scope:dinner_pos_family_2
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family_2 = {
					OR = {
						var:pos_dinner = flag:brave
						var:pos_dinner = flag:lifestyle_blademaster
						var:pos_dinner = flag:lifestyle_hunter
					}
				}
			}
			animation = storyteller
		}
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family_2 = {
					OR = {
						var:pos_dinner = flag:gregarious
						var:pos_dinner = flag:fallback_3
					}
				}
			}
			animation = laugh
		}
		triggered_animation = {
			trigger = { scope:dinner_pos_family_2 = { var:pos_dinner = flag:lifestyle_reveler } }
			animation = toast_goblet
		}
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family_2 = {
					OR = {
						var:pos_dinner = flag:intellect_good
						var:pos_dinner = flag:honest
					}
				}
			}
			animation = debating
		}
		triggered_animation = {
			trigger = { scope:dinner_pos_family_2 = { var:pos_dinner = flag:zealous } }
			animation = prayer
		}
		triggered_animation = {
			trigger = { scope:dinner_pos_family_2 = { var:pos_dinner = flag:diligent } }
			animation = throne_room_conversation_1
		}
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family_2 = {
					OR = {
						var:pos_dinner = flag:forgiving
						var:pos_dinner = flag:compassionate
						var:pos_dinner = flag:trusting
						var:pos_dinner = flag:charming
					}
				}
			}
			animation = happiness
		}
		animation = personality_content
	}
	right_portrait = {
		character = scope:dinner_pos_family_3
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family_3 = {
					OR = {
						var:pos_dinner = flag:brave
						var:pos_dinner = flag:lifestyle_blademaster
						var:pos_dinner = flag:lifestyle_hunter
					}
				}
			}
			animation = storyteller
		}
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family_3 = {
					OR = {
						var:pos_dinner = flag:gregarious
						var:pos_dinner = flag:fallback_3
					}
				}
			}
			animation = laugh
		}
		triggered_animation = {
			trigger = { scope:dinner_pos_family_3 = { var:pos_dinner = flag:lifestyle_reveler } }
			animation = toast_goblet
		}
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family_3 = {
					OR = {
						var:pos_dinner = flag:intellect_good
						var:pos_dinner = flag:honest
					}
				}
			}
			animation = debating
		}
		triggered_animation = {
			trigger = { scope:dinner_pos_family_3 = { var:pos_dinner = flag:zealous } }
			animation = personality_zealous
		}
		triggered_animation = {
			trigger = { scope:dinner_pos_family_3 = { var:pos_dinner = flag:diligent } }
			animation = throne_room_conversation_1
		}
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family_3 = {
					OR = {
						var:pos_dinner = flag:forgiving
						var:pos_dinner = flag:compassionate
						var:pos_dinner = flag:trusting
						var:pos_dinner = flag:charming
					}
				}
			}
			animation = happiness
		}
		animation = personality_content
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_social" }

	immediate = {
		hidden_effect = {
			remove_character_flag ?= lmfmod_4007_flag
			add_character_flag = { flag = lmfmod_4007_flag years = 5 }
			create_family_dinner_pool = yes
			
			# pick three family members for good behavior
			random_in_list = {
				list = family_dinner_guests
				weight = {
					base = 1
					modifier = {
						add = 1
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						has_relation_friend = root
					}
					modifier = {
						add = 1
						OR = {
							has_trait = pregnant
							has_trait = gregarious
							has_trait = lifestyle_reveler
						}
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = dinner_pos_family_1
				assign_pos_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOT = { this = scope:dinner_pos_family_1 }
				}
				weight = {
					base = 1
					modifier = {
						add = 1
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						has_relation_friend = root
					}
					modifier = {
						add = 1
						OR = {
							has_trait = pregnant
							has_trait = gregarious
							has_trait = lifestyle_reveler
						}
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = dinner_pos_family_2
				assign_pos_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOR = {
						this = scope:dinner_pos_family_1
						this = scope:dinner_pos_family_2
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 1
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						has_relation_friend = root
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = dinner_pos_family_3
				assign_pos_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
		}
	}

	option = {
		name = lmf_feast.1007.a
		stress_impact = {
			base = medium_stress_loss
			drunkard = minor_stress_impact_loss
			gregarious = minor_stress_impact_loss
			humble = minor_stress_impact_loss
		}
		scope:dinner_pos_family_1 = {
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 10
			}
		}
		scope:dinner_pos_family_2 = {
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 10
			}
		}
		scope:dinner_pos_family_3 = {
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 10
			}
		}
	}
	
	after = {
		scope:dinner_pos_family_1 = { remove_variable = pos_dinner }
		scope:dinner_pos_family_2 = { remove_variable = pos_dinner }
		scope:dinner_pos_family_3 = { remove_variable = pos_dinner }
	}
}

# Two family members become friends
lmf_feast.1008 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1008.t
	desc = {
		desc = lmf_feast.1008.desc.start
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:family_friend_1 = {
						has_closer_or_equal_relation_than = { CHARACTER = root TARGET = scope:family_friend_2 }
					}
				}
				desc = lmf_feast.1008.desc.relation
			}
			desc = lmf_feast.1008.desc.norelation
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:family_friend_1 = { is_adult = no }
				}
				desc = lmf_feast.1008.desc.child
			}
			triggered_desc = {
				trigger = {
					scope:family_friend_1 = { is_male = yes }
					scope:family_friend_2 = { is_male = yes }
				}
				desc = lmf_feast.1008.desc.twomen
			}
			triggered_desc = {
				trigger = {
					scope:family_friend_1 = { is_female = yes }
					scope:family_friend_2 = { is_female = yes }
				}
				desc = lmf_feast.1008.desc.twowomen
			}
			desc = lmf_feast.1008.desc.mixed
		}
		desc = lmf_feast.1008.desc.end
	}
	theme = family
	
	left_portrait = {
		character = scope:family_friend_1
		triggered_animation = {
			trigger = { scope:family_friend_1 = { is_male = yes } }
			animation = debating
		}
		animation = admiration
	}
	right_portrait = {
		character = scope:family_friend_2
		animation = laugh
	}
	lower_right_portrait = scope:dinner_pos_family
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_friendly" }

	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4008_flag years = 10 }
			create_family_dinner_pool = yes
			
			# pick out the two who will become friends
			random_in_list = {
				list = family_dinner_guests
				limit = {
					age >= 12
					num_of_relation_friend <= 3
					is_relevant_family_member = { CHARACTER = root }
					NOT = { has_character_flag = featured_family_dinner_event }
					save_temporary_scope_as = potential_friend
					any_in_list = {
						list = family_dinner_guests
						NOT = { this = scope:potential_friend }
						num_of_relation_friend <= 3
						can_set_relation_friend_trigger = { CHARACTER = scope:potential_friend }
						trait_compatibility = { target = scope:potential_friend value >= 5 }
						trigger_if = {
							limit = { scope:potential_friend = { is_adult = no } }
							is_adult = no
							age <= scope:potential_friend.age_plus_3
							age >= scope:potential_friend.age_minus_3
						}
						trigger_else = {
							is_adult = yes
						}
						OR = {
							has_relation_potential_friend = scope:potential_friend
							AND = {
								age <= scope:potential_friend.age_plus_10
								age >= scope:potential_friend.age_minus_10
								opinion = { target = scope:potential_friend value >= 20 }
							}
						}
					}
				}
				weight = {
					base = 1
					ai_value_modifier = {
						ai_compassion = 0.8
						ai_sociability = 2
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
				}
				save_scope_as = family_friend_1
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOT = { this = scope:family_friend_1 }
					num_of_relation_friend <= 3
					can_set_relation_friend_trigger = { CHARACTER = scope:family_friend_1 }
					trait_compatibility = { target = scope:family_friend_1 value >= 5 }
					trigger_if = {
						limit = { scope:family_friend_1 = { is_adult = no } }
						is_adult = no
						age <= scope:family_friend_1.age_plus_3
						age >= scope:family_friend_1.age_minus_3
					}
					trigger_else = {
						is_adult = yes
					}
					OR = {
						has_relation_potential_friend = scope:family_friend_1
						AND = {
							age <= scope:family_friend_1.age_plus_10
							age >= scope:family_friend_1.age_minus_10
							opinion = { target = scope:family_friend_1 value >= 20 }
						}
					}
				}
				weight = {
					base = 1
					ai_value_modifier = {
						ai_compassion = 0.8
						ai_sociability = 2
					}
					opinion_modifier = {
						who = this
						opinion_target = scope:family_friend_1
						multiplier = 5
					}
					compatibility_modifier = {
						who = this
						compatibility_target = scope:family_friend_1
						multiplier = 10
					}
					modifier = {
						add = 500
						has_relation_potential_friend = scope:family_friend_1
					}
					modifier = {
						add = 50
						is_knight = yes
						scope:family_friend_1 = { is_knight = yes }
					}
					modifier = {
						factor = 0.5
						sex_opposite_of = scope:family_friend_1
					}
					modifier = {
						factor = 0.5
						OR = {
							age > scope:family_friend_1.age_plus_3
							age < scope:family_friend_1.age_minus_3
						}
					}
					modifier = {
						factor = 0.5
						OR = {
							age > scope:family_friend_1.age_plus_5
							age < scope:family_friend_1.age_minus_5
						}
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = family_friend_2
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
		
			# pick out a third family member to exhibit good behavior, to kick things off
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOR = {
						this = scope:family_friend_1
						this = scope:family_friend_2
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						has_relation_friend = root
					}
					modifier = {
						add = 1
						OR = {
							has_trait = pregnant
							has_trait = gregarious
							has_trait = lifestyle_reveler
						}
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					min = 1
				}
				save_scope_as = dinner_pos_family
				assign_pos_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
		}
	}
	
	option = {
		name = lmf_feast.1008.a
		scope:family_friend_1 = {
			set_relation_friend = {
				target = scope:family_friend_2
				reason = befriended_at_feast
				province = root.capital_province
			}
		}
	}
	
	after = {
		scope:dinner_pos_family = { remove_variable = pos_dinner }
	}
}

# Family member might become player's friend
lmf_feast.1009 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1008.t
	desc = {
		desc = lmf_feast.1009.desc.start
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:family_friend = { is_adult = no }
				}
				desc = lmf_feast.1009.desc.child
			}
			desc = lmf_feast.1009.desc.adult
		}
		desc = lmf_feast.1009.desc.end
	}
	theme = family

	left_portrait = {
		character = scope:family_friend
		animation = admiration
	}
	right_portrait = {
		character = root
		animation = laugh
	}
	lower_right_portrait = scope:dinner_pos_family
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_friendly" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4009_flag years = 10 }
			create_family_dinner_pool = yes
			
			# pick out who will become the friend
			random_in_list = {
				list = family_dinner_guests
				limit = {
					num_of_relation_friend <= 3
					NOT = { has_character_flag = featured_family_dinner_event }
					is_relevant_family_member = { CHARACTER = root }
					can_set_relation_friend_trigger = { CHARACTER = root }
					trigger_if = {
						limit = { root = { is_adult = no } }
						is_adult = no
						age <= root.age_plus_3
						age >= root.age_minus_3
					}
					trigger_else = {
						is_adult = yes
					}
					OR = {
						has_relation_potential_friend = root
						AND = {
							trait_compatibility = { target = root value >= 5 }
							opinion = { target = root value >= 20 }
						}
					}
				}
				weight = {
					base = 1
					ai_value_modifier = {
						ai_compassion = 0.8
						ai_sociability = 2
					}
					opinion_modifier = {
						who = this
						opinion_target = root
						multiplier = 5
					}
					compatibility_modifier = {
						who = this
						compatibility_target = root
						multiplier = 10
					}
					modifier = {
						add = 500
						has_relation_potential_friend = root
					}
					modifier = {
						factor = 0.5
						sex_opposite_of = root
					}
					modifier = {
						factor = 0.75
						OR = {
							age > root.age_plus_3
							age < root.age_minus_3
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							age > root.age_plus_5
							age < root.age_minus_5
						}
					}
					modifier = {
						factor = 0.75
						OR = {
							age > root.age_plus_10
							age < root.age_minus_10
						}
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = family_friend
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
			
			# pick out a family member to exhibit good behavior, to kick things off
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOT = { this = scope:family_friend }
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						has_relation_friend = root
					}
					modifier = {
						add = 1
						OR = {
							has_trait = pregnant
							has_trait = gregarious
							has_trait = lifestyle_reveler
						}
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					min = 1
				}
				save_scope_as = dinner_pos_family
				assign_pos_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
		}
	}

	option = {
		name = lmf_feast.1009.a # A new friend!
		set_relation_friend = {
			target = scope:family_friend
			reason = befriended_at_feast
			province = root.capital_province
		}
	}
	option = {
		name = lmf_feast.1009.b # That's as close as they get
		scope:family_friend = {
			add_opinion = {
				target = root
				modifier = friendliness_opinion
				opinion = 20
			}
		}
	}
	
	after = {
		scope:dinner_pos_family = { remove_variable = pos_dinner }
	}
}

# Two family members end their friendship
lmf_feast.1010 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1010.t
	desc = {
		desc = lmf_feast.1010.desc.start
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:family_friend_1 = {
						has_closer_or_equal_relation_than = { CHARACTER = root TARGET = scope:family_friend_2 }
					}
				}
				desc = lmf_feast.1010.desc.relation
			}
			desc = lmf_feast.1010.desc.norelation
		}
		desc = lmf_feast.1010.desc.end
	}
	theme = family
	
	left_portrait = {
		character = scope:family_friend_1
		animation = throne_room_conversation_3
		camera = camera_body_left_slight
	}
	right_portrait = {
		character = scope:family_friend_2
		animation = disapproval
		camera = camera_body_right
	}
	lower_right_portrait = scope:dinner_neg_family
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_unfriendly" }

	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4010_flag years = 10 }
			create_family_dinner_pool = yes
			
			# pick out the two friends who will break up
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					num_of_relation_friend > 0
					NOT = { has_character_flag = featured_family_dinner_event }
					save_temporary_scope_as = current_friend
					any_relation = {
						type = friend
						is_in_list = family_dinner_guests
						is_adult = yes
						NOR = {
							has_relation_best_friend = scope:current_friend
							any_targeting_scheme = { scheme_owner = scope:current_friend }
							any_scheme = { scheme_target_character = scope:current_friend }
						}
						OR = {
							scope:current_friend = { num_of_relation_friend > 2 }
							num_of_relation_friend > 2
							opinion = { value < 0 target = scope:current_friend }
						}
					}
				}
				save_scope_as = family_friend_1
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
				random_relation = {
					type = friend
					limit = {
						is_in_list = family_dinner_guests
						is_adult = yes
						NOR = {
							has_relation_best_friend = scope:family_friend_1
							any_targeting_scheme = { scheme_owner = scope:family_friend_1 }
							any_scheme = { scheme_target_character = scope:family_friend_1 }
						}
						OR = {
							scope:family_friend_1 = { num_of_relation_friend > 2 }
							num_of_relation_friend > 2
							opinion = { value < 0 target = scope:family_friend_1 }
						}
					}
					save_scope_as = family_friend_2
					remove_character_flag ?= featured_family_dinner_event
					add_character_flag = { flag = featured_family_dinner_event years = 5 }
				}
			}
			
			# pick out a third family member to exhibit poor behavior, to kick things off
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOR = {
						this = scope:family_friend_1
						this = scope:family_friend_2
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						OR = {
							has_relation_rival = root
							reverse_opinion = { target = root value <= -20 }
						}
					}
					modifier = {
						add = 1
						OR = {
							has_trait = drunkard
							has_trait = reclusive
							has_trait = irritable
							has_trait = comfort_eater
							has_trait = inappetetic
							has_trait = depressed
							has_trait = lunatic
							has_trait = possessed
						}
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					min = 1
				}
				save_scope_as = dinner_neg_family
				assign_neg_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
		}
	}
	
	option = {
		name = lmf_feast.1010.a
		scope:family_friend_1 = { remove_relation_friend = scope:family_friend_2 }
	}
	
	after = {
		scope:dinner_neg_family = { remove_variable = neg_dinner }
	}
}

# Family member ends friendship with player
lmf_feast.1011 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1010.t
	desc = lmf_feast.1011.desc
	theme = family
	
	center_portrait = {
		character = scope:family_friend
		animation = eyeroll
	}
	left_portrait = {
		character = root
		animation = stress
	}
	lower_right_portrait = scope:dinner_neg_family
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_unfriendly" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4011_flag years = 10 }
			create_family_dinner_pool = yes
			
			random_relation = {
				type = friend
				limit = {
					is_in_list = family_dinner_guests
					is_adult = yes
					num_of_relation_friend > 2
					NOR = {
						has_character_flag = featured_family_dinner_event
						has_relation_best_friend = root
						any_targeting_scheme = { scheme_owner = root }
						any_scheme = { scheme_target_character = root }
					}
				}
				save_scope_as = family_friend
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
			
			# pick out a third family member to exhibit poor behavior, to kick things off
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOT = { this = scope:family_friend }
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						OR = {
							has_relation_rival = root
							reverse_opinion = { target = root value <= -20 }
						}
					}
					modifier = {
						add = 1
						OR = {
							has_trait = drunkard
							has_trait = reclusive
							has_trait = irritable
							has_trait = comfort_eater
							has_trait = inappetetic
							has_trait = depressed
							has_trait = lunatic
							has_trait = possessed
						}
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					min = 1
				}
				save_scope_as = dinner_neg_family
				assign_neg_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
		}
	}
	
	option = {
		name = lmf_feast.1011.a
		scope:family_friend = { remove_relation_friend = root }
	}
	
	after = {
		scope:dinner_neg_family = { remove_variable = neg_dinner }
	}
}

# Secret gets revealed at the dinner
lmf_feast.1012 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1012.t
	desc = {
		desc = lmf_feast.1012.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { scope:tattler = { is_adult = no } }
				desc = lmf_feast.1012.desc.child
			}
			desc = lmf_feast.1012.desc.adult
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:tattler = {
						has_closer_or_equal_relation_than = { CHARACTER = root TARGET = scope:family_secret }
					}
				}
				desc = lmf_feast.1012.desc.relation
			}
			desc = lmf_feast.1012.desc.norelation
		}
		first_valid = {
			triggered_desc = {
				trigger = { scope:tattler = { is_adult = no } }
				desc = lmf_feast.1012.desc.child2
			}
			triggered_desc = {
				trigger = { scope:tattler = { has_trait = temperate } }
				desc = lmf_feast.1012.desc.temperate
			}
			desc = lmf_feast.1012.desc.drunk
		}
		desc = lmf_feast.1012.desc.end
	}
	theme = family

	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:tattler
		triggered_animation = {
			trigger = { scope:tattler = { is_adult = no } }
			animation = laugh
		}
		triggered_animation = {
			trigger = { scope:tattler = { has_trait = temperate } }
			animation = disgust
		}
		animation = drink_goblet
	}
	lower_right_portrait = scope:family_secret
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_intrigue" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4012_flag years = 10 }
			create_family_dinner_pool = yes
			
			# find secret to reveal
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					save_temporary_scope_as = potential_family_secret
					any_secret = {
						NOR = {
							is_known_by = root
							secret_is_incriminating_trigger = { TARGET = root }
						}
						OR = {
							is_blackmailable_secret_trigger = { BLACKMAILER = root PARTICIPANT = scope:potential_family_secret }
							secret_is_always_interesting_trigger = yes
						}
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 100
						has_relation_rival = root
					}
					opinion_modifier = {
						who = root
						opinion_target = this
						multiplier = -1
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = family_secret
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
				random_secret = {
					limit = {
						NOR = {
							is_known_by = root
							secret_is_incriminating_trigger = { TARGET = root }
						}
						OR = {
							is_blackmailable_secret_trigger = { BLACKMAILER = root PARTICIPANT = scope:family_secret }
							secret_is_always_interesting_trigger = yes
						}
					}
					save_scope_as = revealed_secret
				}
			}
			
			# find family member who can tattle
			random_in_list = {
				list = family_dinner_guests
				limit = {
					save_temporary_scope_as = potential_tattler
					NOR = {
						this = scope:family_secret
						scope:revealed_secret = { is_known_by = scope:potential_tattler }
						scope:revealed_secret = { secret_is_incriminating_trigger = { TARGET = scope:potential_tattler } }
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 25
						is_adult = no
					}
					modifier = {
						add = 25
						has_trait = trusting
					}
					modifier = {
						add = 25
						has_trait = intellect_bad
					}
					ai_value_modifier = {
						ai_vengefulness = -0.5
					}
					opinion_modifier = {
						who = this
						opinion_target = root
						multiplier = 0.5
					}
					min = 1
				}
				save_scope_as = tattler
			}
		}
	}

	option = {
		name = lmf_feast.1012.a
		scope:revealed_secret = {
			reveal_to = root
		}
	}
}

# Two attendees at the dinner become lovers
lmf_feast.1013 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1013.t
	desc = {
		desc = lmf_feast.1013.start
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:family_lover_1 = {
						has_closer_or_equal_relation_than = { CHARACTER = root TARGET = scope:family_lover_2 }
					}
				}
				desc = lmf_feast.1013.desc.relation
			}
			desc = lmf_feast.1013.desc.norelation
		}
		desc = lmf_feast.1013.end
	}
	theme = family
	
	left_portrait = {
		character = scope:family_lover_1
		animation = flirtation
	}
	right_portrait = {
		character = scope:family_lover_2
		animation = flirtation_left
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_love" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4013_flag years = 10 }
			create_family_dinner_pool = yes
			
			# find the two lovers
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					is_below_ai_lover_soft_cap_trigger = yes
					ai_boldness >= medium_negative_ai_value
					might_cheat_on_every_partner_trigger = yes
					likely_to_take_lover_trigger = yes
					NOR = {
						has_sexuality = asexual
						has_trait = infirm
						has_trait = pregnant
						is_malformed_trigger = yes
						has_any_illness = yes
						has_relation_lover = root
					}
					OR = {
						is_old_age_or_not_have_children = no
						is_deviant_trigger = yes
						has_focus = intrigue_temptation_focus
						faith = { has_doctrine = tenet_carnal_exaltation }
					}
					save_temporary_scope_as = potential_lover
					any_in_list = {
						list = family_dinner_guests
						NOT = { this = scope:potential_lover }
						is_adult = yes
						is_below_ai_lover_soft_cap_trigger = yes
						NOR = {
							has_trait = infirm
							is_malformed_trigger = yes
							is_unattractive_trigger = yes
							num_of_relation_soulmate > 0
							any_targeting_scheme = {}
							is_consort_of = scope:potential_lover
							has_relation_lover = root
						}
						trigger_if = {
							limit = {
								scope:potential_lover = { is_female = yes }
							}
							age <= scope:potential_lover.age_plus_10
							age >= scope:potential_lover.age_minus_10
						}
						trigger_if = {
							limit = {
								scope:potential_lover = { is_male = yes }
							}
							age <= scope:potential_lover.age
							age >= scope:potential_lover.age_minus_25
						}
						can_set_relation_lover_trigger = { CHARACTER = scope:potential_lover }
						might_cheat_on_every_partner_trigger = yes
						willing_to_take_character_as_lover = { LOVER = scope:potential_lover }
						trigger_if = {
							limit = { scope:potential_lover = { ai_boldness < 20 } }
							NOR = {
								primary_spouse ?= { is_liege_or_above_of = scope:potential_lover }
								any_parent = { is_liege_or_above_of = scope:potential_lover }
							}
						}
						trigger_if = {
							limit = { scope:potential_lover = { ai_honor > 0 } }
							is_married = no
						}
						save_temporary_scope_as = incest_check
						scope:potential_lover = { is_attracted_to_gender_of = scope:incest_check }
						is_attracted_to_gender_of = scope:potential_lover
						accepts_incest_with_each_other_trigger = {
							CHARACTER_1 = scope:incest_check
							CHARACTER_2 = scope:potential_lover
						}
					}
				}
				save_scope_as = family_lover_1
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOT = { this = scope:family_lover_1 }
					is_adult = yes
					is_below_ai_lover_soft_cap_trigger = yes
					NOR = {
						has_trait = infirm
						has_trait = pregnant
						is_malformed_trigger = yes
						is_unattractive_trigger = yes
						num_of_relation_soulmate > 0
						any_targeting_scheme = {}
						is_consort_of = scope:family_lover_1
						has_relation_lover = root
					}
					trigger_if = {
						limit = {
							scope:family_lover_1 = { is_female = yes }
						}
						age <= scope:family_lover_1.age_plus_10
						age >= scope:family_lover_1.age_minus_10
					}
					trigger_if = {
						limit = {
							scope:family_lover_1 = { is_male = yes }
						}
						age <= scope:family_lover_1.age
						age >= scope:family_lover_1.age_minus_25
					}
					can_set_relation_lover_trigger = { CHARACTER = scope:family_lover_1 }
					might_cheat_on_every_partner_trigger = yes
					willing_to_take_character_as_lover = { LOVER = scope:family_lover_1 }
					trigger_if = {
						limit = { scope:family_lover_1 = { ai_boldness < 20 } }
						NOR = {
							primary_spouse ?= { is_liege_or_above_of = scope:family_lover_1 }
							any_parent = { is_liege_or_above_of = scope:family_lover_1 }
						}
					}
					trigger_if = {
						limit = { scope:family_lover_1 = { ai_honor > 0 } }
						is_married = no
					}
					trigger_if = {
						limit = {
							scope:family_lover_1 = {
								NOR = {
									is_deviant_trigger = yes
									ai_zeal <= low_negative_ai_value
									faith = { has_doctrine = tenet_carnal_exaltation }
									faith = { has_doctrine = doctrine_clerical_marriage_allowed }
								}
							}
						}
						NOR = {
							is_clergy = yes
							has_trait = devoted
							has_council_position = councillor_court_chaplain
							has_trait = septon
							has_trait = silent_sister
						}
					}
					save_temporary_scope_as = incest_check
					scope:family_lover_1 = { is_attracted_to_gender_of = scope:incest_check }
					is_attracted_to_gender_of = scope:family_lover_1
					accepts_incest_with_each_other_trigger = {
						CHARACTER_1 = scope:incest_check
						CHARACTER_2 = scope:family_lover_1
					}
				}
				weight = {
					base = 1
					opinion_modifier = {
						who = this
						opinion_target = scope:family_lover_1
						multiplier = 5
					}
					opinion_modifier = {
						who = scope:family_lover_1
						opinion_target = this
						multiplier = 5
					}
					compatibility_modifier = {
						who = this
						compatibility_target = scope:family_lover_1
						multiplier = 10
					}
					modifier = {
						is_married = yes
						primary_spouse = { has_relation_rival = scope:family_lover_1 }
						add = 100
					}
					modifier = {
						has_relation_crush = scope:family_lover_1
						add = 250
					}
					modifier = {
						has_relation_potential_lover = scope:family_lover_1
						add = 500
					}
					modifier = {
						add = {
							value = attraction
							divide = high_positive_attraction
							multiply = 50
						}
					}
					modifier = {
						likely_to_take_lover_trigger = yes
						factor = 2
					}
					modifier = {
						factor = 0.5
						is_female = yes
						NOT = { has_trait = beauty_good }
						age >= 25
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
				}
				save_scope_as = family_lover_2
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
			
			# actually hook them up
			scope:family_lover_1 = {
				set_random_lover_reason = { TARGET = scope:family_lover_2 }
				had_sex_with_effect = {
					CHARACTER = scope:family_lover_2
					PREGNANCY_CHANCE = pregnancy_chance
				}
			}
		}
	}

	option = {
		name = lmf_feast.1013.a
		scope:family_lover_1 = {
			random_secret = {
				type = secret_lover
				limit = { secret_target = scope:family_lover_2 }
				reveal_to = root
			}
			if = {
				limit = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = scope:family_lover_2 } }
				random_secret = {
					type = secret_incest
					limit = { NOT = { is_known_by = root } }
					reveal_to = root
				}
			}
			if = {
				limit = {
					is_male = yes
					scope:family_lover_2 = { is_male = yes }
				}
				random_secret = {
					type = secret_homosexual
					limit = { NOT = { is_known_by = root } }
					reveal_to = root
				}
			}
		}
	}
}

# Duel between two rivals at the dinner
lmf_feast.1014 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1014.t
	desc = {
		desc = lmf_feast.1014.start
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:family_duel_starter = {
						has_closer_or_equal_relation_than = { CHARACTER = root TARGET = scope:family_duel_target }
					}
				}
				desc = lmf_feast.1014.desc.relation
			}
			desc = lmf_feast.1014.desc.norelation
		}
		desc = lmf_feast.1014.end
	}
	theme = family
	
	right_portrait = {
		character = scope:family_duel_starter
		animation = aggressive_dagger
	}
	left_portrait = {
		character = scope:family_duel_target
		animation = fear
	}
	lower_right_portrait = scope:dinner_neg_family
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_unfriendly" }

	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4014_flag years = 10 }
			create_family_dinner_pool = yes
			
			# find the guest who starts the duel
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					num_of_relation_rival >= 1
					NOR = {
						has_character_flag = featured_family_dinner_event
						has_personality_levelheaded_trigger = yes
						has_personality_submissive_trigger = yes
						has_trait = wounded
						has_trait = infirm
						has_trait = maimed
						has_trait = blind
						has_trait = craven
					}
					save_temporary_scope_as = current_rival
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:current_rival }
					any_relation = {
						type = rival
						is_in_list = family_dinner_guests
						is_adult = yes
						OR = {
							prowess <= scope:current_rival.prowess
							prowess < 10
						}
						NOR = {
							has_trait = wounded
							has_trait = infirm
							has_trait = maimed
							has_trait = blind
						}
						save_temporary_scope_as = target_rival
						can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:target_rival }
					}
				}
				weight = {
					base = 1
					ai_value_modifier = {
						ai_boldness = 0.5
						ai_rationality = -1
					}
					modifier = {
						add = 500
						any_relation = {
							type = nemesis
							is_in_list = family_dinner_guests
							is_adult = yes
							prowess <= scope:current_rival.prowess
							NOR = {
								has_trait = wounded
								has_trait = infirm
								has_trait = maimed
								has_trait = blind
							}
							save_temporary_scope_as = target_nemesis
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:target_nemesis }
						}
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
				}
				save_scope_as = family_duel_starter
				set_signature_weapon_effect = yes
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
				# find the guest they attack
				random_relation = {
					type = rival
					limit = {
						is_in_list = family_dinner_guests
						is_adult = yes
						OR = {
							prowess <= scope:family_duel_starter.prowess
							prowess < 10
						}
						NOR = {
							has_trait = wounded
							has_trait = infirm
							has_trait = maimed
							has_trait = blind
						}
						save_temporary_scope_as = target_rival
						can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:target_rival }
					}
					weight = {
						base = 1
						modifier = {
							add = 500
							has_relation_nemesis = scope:family_duel_starter
						}
						modifier = {
							add = 100
							has_personality_annoying_trigger = yes
						}
						modifier = {
							add = 50
							has_personality_malicious_trigger = yes
						}
						opinion_modifier = {
							who = scope:family_duel_starter
							opinion_target = this
							multiplier = -5
						}
						modifier = {
							factor = 0.5
							NOR = {
								is_close_or_extended_family_of = root
								is_vassal_of = root
								is_consort_of = root
								has_important_relationship_with_character_trigger = { CHARACTER = root }
							}
						}
					}
					save_scope_as = family_duel_target
					set_signature_weapon_effect = yes
					add_character_flag = { flag = featured_family_dinner_event years = 5 }
					
					# and wound them
					add_trait = wounded_1
					add_opinion = {
						target = scope:family_duel_starter
						modifier = angry_opinion
						opinion = -20
					}
				}
			}
		
			# pick out a third family member to exhibit poor behavior, to kick things off
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOR = {
						this = scope:family_duel_starter
						this = scope:family_duel_target
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						OR = {
							has_relation_rival = root
							reverse_opinion = { target = root value <= -20 }
						}
					}
					modifier = {
						add = 1
						OR = {
							has_trait = drunkard
							has_trait = reclusive
							has_trait = irritable
							has_trait = comfort_eater
							has_trait = inappetetic
							has_trait = depressed
							has_trait = lunatic
							has_trait = possessed
						}
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					min = 1
				}
				save_scope_as = dinner_neg_family
				assign_neg_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
		
			# will they progress to nemesis?
			if = {
				limit = {
					scope:family_duel_starter = {
						can_set_relation_nemesis_trigger = { CHARACTER = scope:family_duel_target }
					}
				}
				random = {
					chance = 20
					modifier = {
						add = 20
						scope:family_duel_starter = {
							OR = {
								has_personality_malicious_trigger = yes
								is_hot_headed_trigger = yes
							}
						}
					}
					modifier = {
						add = 20
						scope:family_duel_target = {
							OR = {
								has_personality_malicious_trigger = yes
								is_hot_headed_trigger = yes
							}
						}
					}
					modifier = {
						factor = 0.5
						scope:family_duel_starter = {
							OR = {
								has_personality_benevolent_trigger = yes
								has_personality_levelheaded_trigger = yes
							}
						}
					}
					modifier = {
						factor = 0.5
						scope:family_duel_target = {
							OR = {
								has_personality_benevolent_trigger = yes
								has_personality_levelheaded_trigger = yes
							}
						}
					}
					save_scope_value_as = {
						name = nemesis_check
						value = flag:yes
					}
				}
			}
		}
	}

	option = {
		name = {
			text = lmf_feast.1014.a #Let them duel
			trigger = { is_adult = yes }
		}
		name = {
			text = lmf_feast.1014.b #I guess this is when they fight?
			trigger = { is_adult = no }
		}
		if = {
			limit = { is_adult = yes }
			add_character_modifier = {
				modifier = feast_had_good_fight_modifier
				years = 5
			}
		}
		scope:family_duel_starter = {
			duel = {
				skill = prowess
				target = scope:family_duel_target
				5 = {
					trigger = {
						scope:family_duel_starter = {
							NOR = {
								has_trait = compassionate
								has_trait = forgiving
								has_trait = gallant #you don't kill people in duels!
								AND = {
									NOT = { has_relation_nemesis = scope:family_duel_target }
									has_trait = lifestyle_blademaster #I am too careful with blades... unless I WANT to kill them
								}
							}
						}
					}
					desc = lmf_feast.1014.a.start.kill.tt
					compare_modifier = {
						value = scope:duel_value
						multiplier = 2.5
					}
					modifier = {
						factor = 2
						scope:family_duel_starter = { has_relation_nemesis = scope:family_duel_target }
					}
					modifier = {
						factor = 2
						scope:family_duel_starter = {
							has_personality_malicious_trigger = yes
						}
					}
					modifier = {
						factor = 0.5
						scope:family_duel_starter = {
							OR = {
								has_personality_benevolent_trigger = yes
								has_personality_levelheaded_trigger = yes
							}
						}
					}
					scope:family_duel_starter = {
						show_as_tooltip = {
							add_kinslayer_trait_or_nothing_effect = { VICTIM = scope:family_duel_target }
						}
					}
					root = {
						send_interface_toast = {
							title = lmf_feast.1014.a.start.kill.tt
							left_icon = scope:family_duel_starter
							right_icon = scope:family_duel_target
							scope:family_duel_target = {
								death = {
									death_reason = death_duel
									killer = scope:family_duel_starter
								}
							}
							scope:family_duel_starter = {
								add_kinslayer_trait_or_nothing_effect = { VICTIM = scope:family_duel_target }
							}
						}
					}
				}
				55 = {
					desc = lmf_feast.1014.a.start.win.tt
					compare_modifier = {
						value = scope:duel_value
						multiplier = 2.5
					}
					root = {
						send_interface_toast = {
							title = lmf_feast.1014.a.start.win.tt
							left_icon = scope:family_duel_starter
							right_icon = scope:family_duel_target
							scope:family_duel_target = {
								increase_wounds_effect = { REASON = duel }
								if = {
									limit = { exists = scope:nemesis_check }
									set_relation_nemesis = {
										target = scope:family_duel_starter
										reason = family_feast_duel
									}
								}
							}
						}
					}
				}
				35 = {
					desc = lmf_feast.1014.a.target.win.tt
					compare_modifier = {
						value = scope:duel_value
						multiplier = -2.5
					}
					root = {
						send_interface_toast = {
							title = lmf_feast.1014.a.target.win.tt
							left_icon = scope:family_duel_starter
							right_icon = scope:family_duel_target
							scope:family_duel_starter = {
								increase_wounds_effect = { REASON = duel }
								if = {
									limit = { exists = scope:nemesis_check }
									set_relation_nemesis = {
										target = scope:family_duel_target
										reason = family_feast_duel
									}
								}
							}
						}
					}
				}
				5 = {
					trigger = {
						scope:family_duel_target = {
							NOR = {
								has_trait = compassionate
								has_trait = forgiving
								has_trait = gallant #you don't kill people in duels!
								AND = {
									NOT = { has_relation_nemesis = scope:family_duel_target }
									has_trait = lifestyle_blademaster #I am too careful with blades... unless I WANT to kill them
								}
							}
						}
					}
					desc = lmf_feast.1014.a.target.kill.tt
					compare_modifier = {
						value = scope:duel_value
						multiplier = -2.5
					}
					modifier = {
						factor = 2
						scope:family_duel_target = { has_relation_nemesis = scope:family_duel_starter }
					}
					modifier = {
						factor = 2
						scope:family_duel_target = {
							has_personality_malicious_trigger = yes
						}
					}
					modifier = {
						factor = 0.5
						scope:family_duel_target = {
							OR = {
								has_personality_benevolent_trigger = yes
								has_personality_levelheaded_trigger = yes
							}
						}
					}
					scope:family_duel_target = {
						show_as_tooltip = {
							add_kinslayer_trait_or_nothing_effect = { VICTIM = scope:family_duel_starter }
						}
					}
					root = {
						send_interface_toast = {
							title = lmf_feast.1014.a.target.kill.tt
							left_icon = scope:family_duel_starter
							right_icon = scope:family_duel_target
							scope:family_duel_starter = {
								death = {
									death_reason = death_duel
									killer = scope:family_duel_target
								}
							}
							scope:family_duel_target = {
								add_kinslayer_trait_or_nothing_effect = { VICTIM = scope:family_duel_starter }
							}
						}
					}
				}
			}
		}
	}
	option = {
		trigger = { is_adult = yes }
		name = lmf_feast.1014.c #Throw him in prison to cool off
		scope:family_duel_target = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 10
			}
		}
		rightfully_imprison_character_effect = { TARGET = scope:family_duel_starter IMPRISONER = root }
	}
	
	after = {
		scope:dinner_neg_family = { remove_variable = neg_dinner }
	}
}

# Good dinner with the player's spouse
lmf_feast.1015 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1015.t
	desc = {
		desc = lmf_feast.1015.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { scope:marital_bliss = flag:still_got_it }
				desc = lmf_feast.1015.desc.stillgotit
			}
			triggered_desc = {
				trigger = { scope:marital_bliss = flag:newborn }
				desc = lmf_feast.1015.desc.newborn
			}
			triggered_desc = {
				trigger = { scope:marital_bliss = flag:small_child }
				desc = lmf_feast.1015.desc.smallchild
			}
			triggered_desc = {
				trigger = { scope:marital_bliss = flag:young_child }
				desc = lmf_feast.1015.desc.youngchild
			}
			desc = lmf_feast.1015.desc.chaste
		}
	}
	theme = family
	
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					scope:marital_bliss = flag:small_child
					scope:marital_bliss = flag:young_child
				}
			}
			animation = laugh
		}
		animation = happiness
	}
	right_portrait = {
		character = scope:family_spouse
		animation = love
	}
	center_portrait = {
		trigger = { exists = scope:show_child }
		character = scope:show_child
		triggered_animation = {
			trigger = { scope:marital_bliss = flag:newborn }
			animation = happiness
		}
		animation = dancing
	}
	override_background = { reference = feast }

	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4015_flag years = 10 }
			create_family_dinner_pool = yes
			
			# find the appropriate spouse
			primary_spouse = {
				save_scope_as = family_spouse
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
				random_list = {
					10 = {
						trigger = {
							still_got_it_trigger = yes
						}
						save_scope_value_as = {
							name = marital_bliss
							value = flag:still_got_it
						}
					}
					10 = {
						trigger = {
							chaste_marriage_trigger = yes
						}
						save_scope_value_as = {
							name = marital_bliss
							value = flag:chaste_marriage
						}
					}
					300 = {
						trigger = {
							any_child = {
								is_available = yes
								has_recoverable_disease_trigger = no
								is_child_of = root
								NOR = {
									has_trait = bastard
									has_trait = legitimized_bastard
									has_trait = wild_oat
									has_trait = disputed_heritage
								}
								age < 1
							}
						}
						save_scope_value_as = {
							name = marital_bliss
							value = flag:newborn
						}
						random_child = {
							limit = {
								is_available = yes
								has_recoverable_disease_trigger = no
								is_child_of = root
								NOR = {
									has_trait = bastard
									has_trait = legitimized_bastard
									has_trait = wild_oat
									has_trait = disputed_heritage
								}
								age < 1
							}
							save_scope_as = show_child
						}
					}
					30 = {
						trigger = {
							any_child = {
								is_available = yes
								has_recoverable_disease_trigger = no
								is_child_of = root
								NOR = {
									has_trait = bastard
									has_trait = legitimized_bastard
									has_trait = wild_oat
									has_trait = disputed_heritage
								}
								age > 0
								age < 3
							}
						}
						save_scope_value_as = {
							name = marital_bliss
							value = flag:small_child
						}
						random_child = {
							limit = {
								is_available = yes
								has_recoverable_disease_trigger = no
								is_child_of = root
								NOR = {
									has_trait = bastard
									has_trait = legitimized_bastard
									has_trait = wild_oat
									has_trait = disputed_heritage
								}
								age > 0
								age < 3
							}
							save_scope_as = show_child
						}
					}
					10 = {
						trigger = {
							any_child = {
								is_in_list = family_dinner_guests
								is_child_of = root
								NOR = {
									has_trait = bastard
									has_trait = legitimized_bastard
									has_trait = wild_oat
									has_trait = disputed_heritage
								}
								age <= 8
							}
						}
						save_scope_value_as = {
							name = marital_bliss
							value = flag:young_child
						}
						random_child = {
							limit = {
								is_in_list = family_dinner_guests
								is_child_of = root
								NOR = {
									has_trait = bastard
									has_trait = legitimized_bastard
									has_trait = wild_oat
									has_trait = disputed_heritage
								}
								age <= 8
							}
							weight = {
								base = 1
								modifier = {
									add = 5
									is_player_heir_of = root
								}
								modifier = {
									add = 1
									age <= 6
								}
								modifier = {
									add = 1
									age <= 4
								}
								modifier = {
									add = 2
									has_trait = charming
								}
								modifier = {
									add = -2
									has_trait = pensive
								}
								modifier = {
									add = 2
									has_trait = gregarious
								}
								min = 1
							}
							save_scope_as = show_child
							remove_character_flag ?= featured_family_dinner_event
							add_character_flag = { flag = featured_family_dinner_event years = 5 }
						}
					}
				}
			}
		}
	}

	option = {
		name = lmf_feast.1015.a
		stress_impact = {
			base = medium_stress_loss
		}
		if = {
			limit = { scope:marital_bliss = flag:still_got_it }
			had_sex_with_effect = {
				CHARACTER = scope:family_spouse
				PREGNANCY_CHANCE = pregnancy_chance
			}
			if = {
				limit = {
					NOT = { has_relation_lover = root.primary_spouse }
				}
				progress_towards_lover_effect = {
					CHARACTER = scope:family_spouse
					REASON = seduced_at_feast
					OPINION = 20
				}
			}
			else = {
				reverse_add_opinion = {
					target = scope:family_spouse
					modifier = love_opinion
					opinion = 20
				}
			}
		}
		else_if = {
			limit = { scope:marital_bliss = flag:chaste_marriage }
			if = {
				limit = {
					NOT = { has_relation_friend = root.primary_spouse }
				}
				progress_towards_friend_effect = {
					REASON = friend_family_feast
					CHARACTER = scope:family_spouse
					OPINION = 20
				}
			}
			else = {
				reverse_add_opinion = {
					target = scope:family_spouse
					modifier = respect_opinion
					opinion = 20
				}
			}
		}
		else = {
			reverse_add_opinion = {
				target = scope:family_spouse
				modifier = love_opinion
				opinion = 20
			}
			reverse_add_opinion = {
				target = scope:show_child
				modifier = love_opinion
				opinion = 20
			}
		}
	}
}

# Marital spat between player and spouse
lmf_feast.1016 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1016.t
	desc = {
		desc = lmf_feast.1016.desc.start
		triggered_desc = {
			trigger = { scope:marital_chill = flag:object_to_me }
			desc = lmf_feast.1016.desc.object.to.me
		}
		triggered_desc = {
			trigger = {
				scope:marital_chill = flag:object_to_me
				scope:marital_problem = flag:my_sodomy
			}
			desc = lmf_feast.1016.desc.object.to.me.sodomy
		}
		triggered_desc = {
			trigger = {
				scope:marital_chill = flag:object_to_me
				scope:marital_problem = flag:my_incest
			}
			desc = lmf_feast.1016.desc.object.to.me.incest
		}
		triggered_desc = {
			trigger = {
				scope:marital_chill = flag:object_to_me
				scope:marital_problem = flag:my_secret_sodomy
			}
			desc = lmf_feast.1016.desc.object.to.me.secret.sodomy
		}
		triggered_desc = {
			trigger = {
				scope:marital_chill = flag:object_to_me
				scope:marital_problem = flag:my_secret_incest
			}
			desc = lmf_feast.1016.desc.object.to.me.secret.incest
		}
		triggered_desc = {
			trigger = {
				scope:marital_chill = flag:object_to_me
				scope:marital_problem = flag:my_deviant
			}
			desc = lmf_feast.1016.desc.object.to.me.deviant
		}
		triggered_desc = {
			trigger = {
				scope:marital_chill = flag:object_to_me
				scope:marital_problem = flag:my_secret_deviant
			}
			desc = lmf_feast.1016.desc.object.to.me.secret.deviant
		}
		triggered_desc = {
			trigger = { scope:marital_chill = flag:i_object_to_them }
			desc = lmf_feast.1016.desc.object.to.them
		}
		triggered_desc = {
			trigger = {
				scope:marital_chill = flag:i_object_to_them
				scope:marital_problem = flag:their_sodomy
			}
			desc = lmf_feast.1016.desc.object.to.them.sodomy
		}
		triggered_desc = {
			trigger = {
				scope:marital_chill = flag:i_object_to_them
				scope:marital_problem = flag:their_incest
			}
			desc = lmf_feast.1016.desc.object.to.them.incest
		}
		triggered_desc = {
			trigger = {
				scope:marital_chill = flag:i_object_to_them
				scope:marital_problem = flag:their_secret_sodomy
			}
			desc = lmf_feast.1016.desc.object.to.them.secret.sodomy
		}
		triggered_desc = {
			trigger = {
				scope:marital_chill = flag:i_object_to_them
				scope:marital_problem = flag:their_secret_incest
			}
			desc = lmf_feast.1016.desc.object.to.them.secret.incest
		}
		triggered_desc = {
			trigger = {
				scope:marital_chill = flag:i_object_to_them
				scope:marital_problem = flag:their_deviant
			}
			desc = lmf_feast.1016.desc.object.to.them.deviant
		}
		triggered_desc = {
			trigger = {
				scope:marital_chill = flag:i_object_to_them
				scope:marital_problem = flag:their_secret_deviant
			}
			desc = lmf_feast.1016.desc.object.to.them.secret.deviant
		}
		triggered_desc = {
			trigger = { scope:marital_chill = flag:i_betrayed_marriage }
			desc = lmf_feast.1016.desc.betrayed
		}
		triggered_desc = {
			trigger = { scope:marital_chill = flag:betrayed_marriage }
			desc = lmf_feast.1016.desc.they.betrayed
		}
		triggered_desc = {
			trigger = { scope:marital_chill = flag:i_know_secret_lover }
			desc = lmf_feast.1016.desc.they.secret.lover
		}
		triggered_desc = {
			trigger = { scope:marital_chill = flag:knows_secret_lover }
			desc = lmf_feast.1016.desc.secret.lover
		}
		triggered_desc = {
			trigger = { scope:marital_chill = flag:rivalry }
			desc = lmf_feast.1016.desc.rivalry
		}
		desc = lmf_feast.1016.desc.end
	}
	theme = family
	
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { scope:marital_chill = flag:i_object_to_them }
			animation = disgust
		}
		triggered_animation = {
			trigger = { scope:marital_chill = flag:betrayed_marriage }
			animation = rage
		}
		triggered_animation = {
			trigger = { scope:marital_chill = flag:i_know_secret_lover }
			animation = disbelief
		}
		animation = eyeroll
	}
	right_portrait = {
		character = scope:family_spouse
		triggered_animation = {
			trigger = { scope:marital_chill = flag:object_to_me }
			animation = disgust
		}
		triggered_animation = {
			trigger = { scope:marital_chill = flag:i_object_to_them }
			animation = eyeroll
		}
		triggered_animation = {
			trigger = { scope:marital_chill = flag:betrayed_marriage }
			animation = shame
		}
		triggered_animation = {
			trigger = { scope:marital_chill = flag:i_know_secret_lover }
			animation = shock
		}
		animation = rage
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_unfriendly" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4016_flag years = 10 }
			create_family_dinner_pool = yes
			
			primary_spouse = {
				save_scope_as = family_spouse
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
				random_list = {
					100 = {
						trigger = {
							root = { has_marital_trait_or_secret_objectionable_to = { OBJECTOR = root.primary_spouse } }
						}
						save_scope_value_as = {
							name = marital_chill
							value = flag:object_to_me
						}
						if = {
							limit = {
								root = { has_trait = sodomite }
								has_negative_attitude_towards_trait_trigger = { TRAIT = trait:sodomite GENDER_CHARACTER = root }
							}
							save_scope_value_as = {
								name = marital_problem
								value = flag:my_sodomy
							}
						}
						else_if = {
							limit = {
								root = { has_trait = incestuous }
								has_negative_attitude_towards_trait_trigger = { TRAIT = trait:incestuous GENDER_CHARACTER = root }
							}
							save_scope_value_as = {
								name = marital_problem
								value = flag:my_incest
							}
						}
						else_if = {
							limit = {
								root = {
									any_secret = {
										type = secret_homosexual
										is_known_by = root.primary_spouse
									}
								}
								has_negative_attitude_towards_trait_trigger = { TRAIT = trait:sodomite GENDER_CHARACTER = root }
							}
							save_scope_value_as = {
								name = marital_problem
								value = flag:my_secret_sodomy
							}
						}
						else_if = {
							limit = {
								root = {
									any_secret = {
										type = secret_incest
										is_known_by = root.primary_spouse
									}
								}
								has_negative_attitude_towards_trait_trigger = { TRAIT = trait:incestuous GENDER_CHARACTER = root }
							}
							save_scope_value_as = {
								name = marital_problem
								value = flag:my_secret_incest
							}
						}
						else_if = {
							limit = {
								root = { has_trait = deviant }
								has_negative_attitude_towards_trait_trigger = { TRAIT = trait:deviant GENDER_CHARACTER = root }
							}
							save_scope_value_as = {
								name = marital_problem
								value = flag:my_deviant
							}
						}
						else = {
							save_scope_value_as = {
								name = marital_problem
								value = flag:my_secret_deviant
							}
						}
					}
					100 = {
						trigger = {
							has_marital_trait_or_secret_objectionable_to = { OBJECTOR = root }
						}
						save_scope_value_as = {
							name = marital_chill
							value = flag:i_object_to_them
						}
						if = {
							limit = {
								has_trait = sodomite
								root = { has_negative_attitude_towards_trait_trigger = { TRAIT = trait:sodomite GENDER_CHARACTER = root.primary_spouse } }
							}
							save_scope_value_as = {
								name = marital_problem
								value = flag:their_sodomy
							}
						}
						else_if = {
							limit = {
								has_trait = incestuous
								root = { has_negative_attitude_towards_trait_trigger = { TRAIT = trait:incestuous GENDER_CHARACTER = root.primary_spouse } }
							}
							save_scope_value_as = {
								name = marital_problem
								value = flag:their_incest
							}
						}
						else_if = {
							limit = {
								any_secret = {
									type = secret_homosexual
									is_known_by = root
								}
								root = { has_negative_attitude_towards_trait_trigger = { TRAIT = trait:sodomite GENDER_CHARACTER = root.primary_spouse } }
							}
							save_scope_value_as = {
								name = marital_problem
								value = flag:their_secret_sodomy
							}
						}
						else_if = {
							limit = {
								any_secret = {
									type = secret_incest
									is_known_by = root
								}
								root = { has_negative_attitude_towards_trait_trigger = { TRAIT = trait:incestuous GENDER_CHARACTER = root.primary_spouse } }
							}
							save_scope_value_as = {
								name = marital_problem
								value = flag:their_secret_incest
							}
						}
						else_if = {
							limit = {
								has_trait = deviant
								root = { has_negative_attitude_towards_trait_trigger = { TRAIT = trait:deviant GENDER_CHARACTER = root.primary_spouse } }
							}
							save_scope_value_as = {
								name = marital_problem
								value = flag:their_deviant
							}
						}
						else = {
							save_scope_value_as = {
								name = marital_problem
								value = flag:their_secret_deviant
							}
						}
					}
					300 = {
						trigger = {
							hurt_by_marriage_betrayal_trigger = { CHARACTER = root }
						}
						save_scope_value_as = {
							name = marital_chill
							value = flag:i_betrayed_marriage
						}
					}
					300 = {
						trigger = {
							betrayed_our_marriage_trigger = { CHARACTER = root }
						}
						save_scope_value_as = {
							name = marital_chill
							value = flag:betrayed_marriage
						}
					}
					200 = {
						trigger = {
							has_known_secret_lover = { CHARACTER = root }
						}
						save_scope_value_as = {
							name = marital_chill
							value = flag:i_know_secret_lover
						}
						random_secret = {
							type = secret_lover
							limit = {
								NOT = { secret_target = root }
								is_known_by = root
							}
							secret_target = { save_scope_as = suspected_lover }
						}
					}
					200 = {
						trigger = {
							knows_of_my_secret_lover = { CHARACTER = root }
						}
						save_scope_value_as = {
							name = marital_chill
							value = flag:knows_secret_lover
						}
						root = {
							random_secret = {
								type = secret_lover
								limit = {
									NOT = { secret_target = root.primary_spouse }
									is_known_by = root.primary_spouse
								}
								secret_target = { save_scope_as = suspected_lover }
							}
						}
					}
					50 = {
						trigger = {
							has_relation_rival = root
						}
						save_scope_value_as = {
							name = marital_chill
							value = flag:rivalry
						}
					}
					10 = {
						trigger = {
							has_relation_potential_rival = root
							opinion = { target = root value < 0 }
						}
						save_scope_value_as = {
							name = marital_chill
							value = flag:rivalry
						}
					}
				}
			}
		}
	}
	
	option = {
		name = lmf_feast.1016.a
		stress_impact = {
			base = medium_stress_gain
		}
		if = {
			limit = { has_relation_soulmate = scope:family_spouse }
			remove_relation_soulmate = scope:family_spouse
		}
		else_if = {
			limit = { has_relation_lover = scope:family_spouse }
			remove_relation_lover = scope:family_spouse
		}
		else_if = {
			limit = { has_relation_best_friend = scope:family_spouse }
			remove_relation_best_friend = scope:family_spouse
		}
		else_if = {
			limit = { has_relation_friend = scope:family_spouse }
			remove_relation_friend = scope:family_spouse
		}
		else_if = {
			limit = {
				has_relation_rival = scope:family_spouse
				can_set_relation_nemesis_trigger = { CHARACTER = scope:family_spouse }
			}
			set_relation_nemesis = {
				reason = nemesis_family_feast
				target = scope:family_spouse
			}
		}
		else_if = {
			limit = {
				OR = {
					can_set_relation_rival_trigger = { CHARACTER = scope:family_spouse }
					can_set_relation_potential_rival_trigger = { CHARACTER = scope:family_spouse }
				}
			}
			progress_towards_rival_effect = {
				CHARACTER = scope:family_spouse
				REASON = rival_family_feast
				OPINION = -40
			}
		}
		else = {
			reverse_add_opinion = {
				target = scope:family_spouse
				modifier = angry_opinion
				opinion = -40
			}
		}
	}
}

# Terrible accident at the feast
lmf_feast.1017 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1017.t
	desc = {
		desc = lmf_feast.1017.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { scope:feast_accident = flag:fire }
				desc = lmf_feast.1017.desc.fire
			}
			triggered_desc = {
				trigger = { scope:feast_accident = flag:stairs }
				desc = lmf_feast.1017.desc.stairs
			}
			triggered_desc = {
				trigger = { scope:feast_accident = flag:window }
				desc = lmf_feast.1017.desc.window
			}
			triggered_desc = {
				trigger = { scope:feast_accident = flag:fall }
				desc = lmf_feast.1017.desc.fall
			}
			triggered_desc = {
				trigger = { scope:feast_accident = flag:trample }
				desc = lmf_feast.1017.desc.trample
			}
			desc = lmf_feast.1017.desc.accident
		}
		desc = lmf_feast.1017.desc.end
	}
	theme = family
	
	center_portrait = {
		character = scope:family_accident
		animation = shock
	}
	lower_right_portrait = scope:dinner_pos_family
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_health_bad" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4017_flag years = 5 }
			create_family_dinner_pool = yes
			
			# now pick the unlucky soul
			random_in_list = {
				list = family_dinner_guests
				weight = {
					base = 1
					modifier = {
						add = 1
						is_close_or_extended_family_of = root
					}
					modifier = {
						add = 1
						is_adult = yes
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = family_accident
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }

				# and the severity of the injury
				hunt_wound_select_effect = yes
				random_list = {
					8 = {
						hunt_wound_apply_effect = { SEVERE = no }
					}
					3 = {
						hunt_wound_apply_effect = { SEVERE = yes }
					}
				}
			}
			
			# and a random way to have the accident
			random_list = {
				1 = {
					save_scope_value_as = {
						name = feast_accident
						value = flag:fire
					}
				}
				1 = {
					save_scope_value_as = {
						name = feast_accident
						value = flag:stairs
					}
				}
				1 = {
					save_scope_value_as = {
						name = feast_accident
						value = flag:window
					}
				}
				1 = {
					save_scope_value_as = {
						name = feast_accident
						value = flag:fall
					}
				}
				1 = {
					save_scope_value_as = {
						name = feast_accident
						value = flag:trample
					}
				}
				1 = {
					save_scope_value_as = {
						name = feast_accident
						value = flag:accident
					}
				}
			}
			
			# pick out a family member to exhibit good behavior, to kick things off
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOT = { this = scope:family_accident }
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						has_relation_friend = root
					}
					modifier = {
						add = 1
						OR = {
							has_trait = pregnant
							has_trait = gregarious
							has_trait = lifestyle_reveler
						}
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					min = 1
				}
				save_scope_as = dinner_pos_family
				assign_pos_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
		}
	}

	option = {
		name = lmf_feast.1017.a
		custom_tooltip = lmf_feast.1017.injured.tt
		scope:family_accident = {
			show_as_tooltip = {
				if = {
					limit = { has_trait = wounded_1 }
					add_trait_force_tooltip = wounded_1
				}
				else_if = {
					limit = { has_trait = wounded_2 }
					add_trait_force_tooltip = wounded_2
				}
				else_if = {
					limit = { has_trait = wounded_3 }
					add_trait_force_tooltip = wounded_3
				}
				if = {
					limit = { scope:severe = yes }
					switch = {
						trigger = scope:wound
						flag:wound = {}
						flag:incapable = { add_trait_force_tooltip = incapable }
						flag:maimed = { add_trait_force_tooltip = maimed }
						flag:one_eyed = { add_trait_force_tooltip = one_eyed }
						flag:one_legged = { add_trait_force_tooltip = one_legged }
						flag:disfigured = { add_trait_force_tooltip = disfigured }
						flag:none = {}
					}
				}
			}
		}
	}
	
	after = {
		scope:dinner_pos_family = { remove_variable = pos_dinner }
	}
}

# Someone grows ill at the feast
lmf_feast.1018 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1018.t
	desc = {
		desc = lmf_feast.1018.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { scope:family_sick.age < 13 }
				desc = lmf_feast.1018.desc.child
			}
			desc = lmf_feast.1018.desc.adult
		}
		desc = lmf_feast.1018.desc.end
	}
	theme = family
	
	center_portrait = {
		character = scope:family_sick
		animation = sick
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_health_bad" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4018_flag years = 5 }
			create_family_dinner_pool = yes
			
			# now pick the unlucky soul
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_relevant_family_member = { CHARACTER = root }
					NOT = { has_character_flag = featured_family_dinner_event }
					can_contract_disease_trigger = { DISEASE = ill }
				}
				weight = {
					base = 1
					modifier = {
						add = 1
						is_close_or_extended_family_of = root
					}
					modifier = {
						add = 1
						is_adult = no
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = family_sick
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }

				# and make them sick
				random_list = {
					76 = {
						contract_disease_effect = {
							DISEASE = ill
							TREATMENT_EVENT = no
						}
					}
					20 = {
						trigger = {
							can_contract_disease_trigger = { DISEASE  = pneumonic }
						}
						contract_disease_effect = {
							DISEASE = pneumonic
							TREATMENT_EVENT = no
						}
						save_scope_value_as = {
							name = illness_gained
							value = flag:pneumonic
						}
					}
					4 = {
						trigger = {
							can_contract_disease_trigger = { DISEASE  = consumption }
						}
						contract_disease_effect = {
							DISEASE = consumption
							TREATMENT_EVENT = no
						}
						save_scope_value_as = {
							name = illness_gained
							value = flag:consumption
						}
					}
				}
			}
		}
	}
	
	option = {
		name = lmf_feast.1018.a
		scope:family_sick = {
			if = {
				limit = { scope:illness_gained ?= flag:consumption }
				show_as_tooltip = { add_trait_force_tooltip = consumption }
			}
			else_if = {
				limit = { scope:illness_gained ?= flag:pneumonic }
				show_as_tooltip = { add_trait_force_tooltip = pneumonic }
			}
			else = {
				show_as_tooltip = { add_trait_force_tooltip = ill }
			}
		}
	}
}

# Normal family dinner
lmf_feast.1019 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1019.t
	desc = {
		desc = lmf_feast.1019.desc.opening
		first_valid = {
			triggered_desc = {
				trigger = { is_at_war = yes }
				desc = lmf_feast.1019.desc.atwar
			}
			desc = lmf_feast.1019.desc.nowar
		}
		desc = lmf_feast.1019.desc.end
	}
	theme = family

	left_portrait = {
		character = scope:dinner_pos_family
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family = {
					OR = {
						var:pos_dinner = flag:brave
						var:pos_dinner = flag:lifestyle_blademaster
						var:pos_dinner = flag:lifestyle_hunter
					}
				}
			}
			animation = storyteller
		}
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family = {
					OR = {
						var:pos_dinner = flag:gregarious
						var:pos_dinner = flag:fallback_3
					}
				}
			}
			animation = laugh
		}
		triggered_animation = {
			trigger = { scope:dinner_pos_family = { var:pos_dinner = flag:lifestyle_reveler } }
			animation = toast_goblet
		}
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family = {
					OR = {
						var:pos_dinner = flag:intellect_good
						var:pos_dinner = flag:honest
					}
				}
			}
			animation = debating
		}
		triggered_animation = {
			trigger = { scope:dinner_pos_family = { var:pos_dinner = flag:zealous } }
			animation = prayer
		}
		triggered_animation = {
			trigger = { scope:dinner_pos_family = { var:pos_dinner = flag:diligent } }
			animation = throne_room_conversation_1
		}
		triggered_animation = {
			trigger = {
				scope:dinner_pos_family = {
					OR = {
						var:pos_dinner = flag:forgiving
						var:pos_dinner = flag:compassionate
						var:pos_dinner = flag:trusting
						var:pos_dinner = flag:charming
					}
				}
			}
			animation = happiness
		}
		animation = personality_content
	}
	right_portrait = {
		character = scope:dinner_neg_family
		triggered_animation = {
			trigger = { scope:dinner_neg_family = { var:neg_dinner = flag:reclusive } }
			animation = throne_room_conversation_3
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family = { var:neg_dinner = flag:lustful } }
			animation = admiration
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family = { var:neg_dinner = flag:cynical } }
			animation = eyeroll
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family = { var:neg_dinner = flag:craven } }
			animation = personality_coward
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family = { var:neg_dinner = flag:ambitious } }
			animation = laugh
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family = { var:neg_dinner = flag:rowdy } }
			animation = celebrate_wooden_sword
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family = { var:neg_dinner = flag:depressed } }
			animation = sadness
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family = { var:neg_dinner = flag:drunkard } }
			animation = drink_goblet
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family = {
					var:neg_dinner = flag:fallback_3
					is_adult = yes
				}
			}
			animation = wedding_drunk
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family = { var:neg_dinner = flag:eccentric } }
			animation = eccentric
		}
		triggered_animation = {
			trigger = { scope:dinner_neg_family = { var:neg_dinner = flag:gluttonous } }
			animation = happiness
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family = {
					OR = {
						var:neg_dinner = flag:lunatic
						var:neg_dinner = flag:possessed
					}
				}
			}
			animation = paranoia
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family = {
					OR = {
						var:neg_dinner = flag:greedy
						var:neg_dinner = flag:wrathful
						var:neg_dinner = flag:impatient
						var:neg_dinner = flag:irritable
						var:neg_dinner = flag:bossy
					}
				}
			}
			animation = anger
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family = {
					OR = {
						var:neg_dinner = flag:arrogant
						var:neg_dinner = flag:callous
						var:neg_dinner = flag:sadistic
					}
				}
			}
			animation = disgust
		}
		triggered_animation = {
			trigger = {
				scope:dinner_neg_family = {
					OR = {
						var:neg_dinner = flag:shy
						var:neg_dinner = flag:paranoid
						var:neg_dinner = flag:pensive
						var:neg_dinner = flag:comfort_eater
					}
				}
			}
			animation = stress
		}
		animation = boredom
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_social" }

	immediate = {
		hidden_effect = {
			remove_character_flag ?= lmfmod_4019_flag
			add_character_flag = { flag = lmfmod_4019_flag years = 5 }
			create_family_dinner_pool = yes
			
			# first pick one for the positive
			random_in_list = {
				list = family_dinner_guests
				weight = {
					base = 1
					modifier = {
						add = 2
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						has_relation_friend = root
					}
					modifier = {
						add = 1
						OR = {
							has_trait = pregnant
							has_trait = gregarious
							has_trait = lifestyle_reveler
						}
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					min = 1
				}
				save_scope_as = dinner_pos_family
				assign_pos_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
			# then pick one for the negative
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOT = { this = scope:dinner_pos_family }
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						OR = {
							has_relation_rival = root
							reverse_opinion = { target = root value <= -20 }
						}
					}
					modifier = {
						add = 1
						OR = {
							has_trait = drunkard
							has_trait = reclusive
							has_trait = irritable
							has_trait = comfort_eater
							has_trait = inappetetic
							has_trait = depressed
							has_trait = lunatic
							has_trait = possessed
						}
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					min = 1
				}
				save_scope_as = dinner_neg_family
				assign_neg_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
		}
	}

	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { has_trait = zealous }
						desc = lmf_feast.1019.a
					}
					triggered_desc = {
						trigger = { has_trait = drunkard }
						desc = lmf_feast.1019.i
					}
					triggered_desc = {
						trigger = { has_trait = paranoid }
						desc = lmf_feast.1019.b
					}
					triggered_desc = {
						trigger = {
							OR = {
								has_trait = compassionate
								has_trait = diligent
								has_trait = humble
								has_trait = forgiving
							}
						}
						desc = lmf_feast.1019.c
					}
					triggered_desc = {
						trigger = { has_trait = irritable }
						desc = lmf_feast.1019.f
					}
					triggered_desc = {
						trigger = {
							OR = {
								has_trait = reclusive
								has_trait = shy
							}
						}
						desc = lmf_feast.1019.g
					}
					triggered_desc = {
						trigger = {
							OR = {
								has_trait = lazy
								has_trait = infirm
							}
						}
						desc = lmf_feast.1019.d
					}
					triggered_desc = {
						trigger = {
							OR = {
								has_trait = gluttonous
								has_trait = comfort_eater
							}
						}
						desc = lmf_feast.1019.h
					}
					triggered_desc = {
						trigger = {
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
							has_education_martial_trigger = yes
						}
						desc = lmf_feast.1019.e
					}
					desc = lmf_feast.1019.j
				}
			}
		}
		stress_impact = {
			base = minor_stress_loss
			drunkard = minor_stress_impact_loss
			gregarious = minor_stress_impact_loss
			humble = minor_stress_impact_loss
			paranoid = minor_stress_impact_gain
			reclusive = minor_stress_impact_gain
			irritable = minor_stress_impact_gain
		}
	}

	after = {
		scope:dinner_pos_family = { remove_variable = pos_dinner }
		scope:dinner_neg_family = { remove_variable = neg_dinner }
	}
}

# Player's spouse is pregnant
lmf_feast.1020 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1020.t
	desc = {
		desc = lmf_feast.1020.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { scope:marital_pregnancy = flag:resolution }
				desc = lmf_feast.1020.desc.resolution
			}
			triggered_desc = {
				trigger = { scope:marital_pregnancy = flag:love }
				desc = lmf_feast.1020.desc.love
			}
			triggered_desc = {
				trigger = { scope:marital_pregnancy = flag:possibility }
				desc = lmf_feast.1020.desc.possibility
			}
			desc = lmf_feast.1020.desc.fallback
		}
	}
	theme = family
	
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:family_spouse
		animation = personality_content
	}
	override_background = { reference = feast }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4020_flag years = 10 }
			create_family_dinner_pool = yes
			
			primary_spouse = {
				save_scope_as = family_spouse
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
				if = {
					limit = { has_relation_rival = root }
					save_scope_value_as = {
						name = marital_pregnancy
						value = flag:resolution
					}
				}
				else_if = {
					limit = { has_relation_lover = root }
					save_scope_value_as = {
						name = marital_pregnancy
						value = flag:love
					}
				}
				else_if = {
					limit = {
						still_got_it_trigger = yes
						OR = {
							can_set_relation_lover_trigger = { CHARACTER = scope:family_spouse }
							can_set_relation_potential_lover_trigger = { CHARACTER = scope:family_spouse }
						}
					}
					save_scope_value_as = {
						name = marital_pregnancy
						value = flag:possibility
					}
				}
				else = {
					save_scope_value_as = {
						name = marital_pregnancy
						value = flag:fallback
					}
				}
			}
		}
	}
	
	option = {
		trigger = { scope:marital_pregnancy = flag:resolution }
		name = lmf_feast.1020.a #let it go
		if = {
			limit = { has_relation_nemesis = scope:family_spouse }
			remove_relation_nemesis = scope:family_spouse
			set_relation_rival = {
				target = scope:family_spouse
				reason = rival_no_longer_nemesis
			}
		}
		else = {
			remove_relation_rival = scope:family_spouse
		}
	}
	option = {
		trigger = { scope:marital_pregnancy = flag:love }
		name = lmf_feast.1020.b
		stress_impact = {
			base = medium_stress_loss
		}
		reverse_add_opinion = {
			target = scope:family_spouse
			modifier = love_opinion
			opinion = 20
		}
	}
	option = {
		trigger = { scope:marital_pregnancy = flag:possibility }
		name = lmf_feast.1020.c #this is love
		stress_impact = {
			base = medium_stress_loss
		}
		progress_towards_lover_effect = {
			CHARACTER = scope:family_spouse
			REASON = seduced_at_feast
			OPINION = 20
		}
	}
	option = {
		trigger = { scope:marital_pregnancy = flag:fallback }
		name = lmf_feast.1020.d
		stress_impact = {
			base = minor_stress_loss
		}
		reverse_add_opinion = {
			target = scope:family_spouse
			modifier = pleased_opinion
			opinion = 20
		}
	}
	option = {
		trigger = {
			OR = {
				scope:marital_pregnancy = flag:resolution
				scope:marital_pregnancy = flag:possibility
			}
		}
		name = {
			text = lmf_feast.1020.e #no, not just yet
			trigger = { scope:marital_pregnancy = flag:resolution }
		}
		name = {
			text = lmf_feast.1020.f #this isn't love
			trigger = { scope:marital_pregnancy = flag:possibility }
		}
		reverse_add_opinion = {
			target = scope:family_spouse
			modifier = pleased_opinion
			opinion = 10
		}
	}
}

# Player at ease with a family friend
lmf_feast.1021 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1021.t
	desc = {
		desc = lmf_feast.1021.desc.start
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:family_friend = { is_playable_character = yes }
				}
				desc = lmf_feast.1021.desc.ruler
			}
			triggered_desc = {
				trigger = {
					scope:family_friend = { is_married = yes }
				}
				desc = lmf_feast.1021.desc.spouse
			}
			triggered_desc = {
				trigger = {
					scope:family_friend = {
						OR = {
							is_councillor_of = root
							AND = {
								has_any_court_position = yes
								is_courtier_of = root
							}
						}
					}
				}
				desc = lmf_feast.1021.desc.court
			}
			desc = lmf_feast.1021.desc.courtier
		}
		desc = lmf_feast.1021.desc.end
	}
	theme = family

	left_portrait = {
		character = scope:family_friend
		triggered_animation = {
			trigger = {
				scope:family_friend = { has_trait = temperate }
			}
			animation = toast
		}
		animation = toast_goblet
	}
	right_portrait = {
		character = root
		animation = laugh
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_friendly" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4021_flag years = 10 }
			create_family_dinner_pool = yes
			
			# pick out who will become the friend
			random_in_list = {
				list = family_dinner_guests
				limit = {
					has_relation_friend = root
					is_adult = yes
					opinion = { target = root value >= 20 }
					NOR = {
						has_character_flag = featured_family_dinner_event
						is_consort_of = root
						has_relation_lover = root
						is_hostage_of = root
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 1
						opinion = { target = root value >= 50 }
					}
					modifier = {
						add = -1
						sex_opposite_of = root
					}
					modifier = {
						add = -1
						OR = {
							is_child_of = root
							is_grandchild_of = root
						}
					}
					modifier = {
						add = 10
						has_relation_best_friend = root
					}
					min = 1
				}
				save_scope_as = family_friend
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
		}
	}
	
	option = {
		name = lmf_feast.1021.a
		stress_impact = {
			base = medium_stress_loss
		}
		if = {
			limit = {
				num_of_relation_best_friend < 1
				can_set_relation_best_friend_trigger = { CHARACTER = scope:family_friend }
			}
			random = {
				chance = 25
				ai_value_modifier = {
					ai_sociability = 0.5
					min = -15
				}
				show_as_tooltip = {
					set_relation_best_friend = scope:family_friend
				}
				hidden_effect = {
					send_interface_toast = {
						type = event_toast_effect_good
						title = diplomacy_family.2201.a.tt
						left_icon = root
						right_icon = scope:family_friend
						root = {
							improve_relationship_effect = {
								TARGET = scope:family_friend
								REASON = best_friend_socializing
							}
						}
					}
				}
			}
		}
	}
}

# Player angered by family rival
lmf_feast.1022 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1022.t
	desc = lmf_feast.1022.desc
	theme = family

	left_portrait = {
		character = scope:family_rival
		animation = rage
	}
	right_portrait = {
		character = root
		animation = eyeroll
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_unfriendly" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4022_flag years = 10 }
			create_family_dinner_pool = yes
			
			# pick out who will become the friend
			random_in_list = {
				list = family_dinner_guests
				limit = {
					has_relation_rival = root
					is_adult = yes
					NOR = {
						has_character_flag = featured_family_dinner_event
						is_consort_of = root
						has_relation_lover = root
						is_hostage_of = root
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 1
						opinion = { target = root value <= 0 }
					}
					modifier = {
						add = 1
						opinion = { target = root value < -20 }
					}
					modifier = {
						add = 1
						opinion = { target = root value < -50 }
					}
					modifier = {
						add = 10
						has_relation_nemesis = root
					}
					min = 1
				}
				save_scope_as = family_rival
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
		}
	}
	
	option = {
		name = lmf_feast.1022.a
		stress_impact = {
			base = medium_stress_gain
		}
		if = {
			limit = {
				num_of_relation_nemesis < 1
				can_set_relation_nemesis_trigger = { CHARACTER = scope:family_rival }
			}
			random = {
				chance = 25
				show_as_tooltip = {
					set_relation_nemesis = scope:family_friend
				}
				hidden_effect = {
					send_interface_toast = {
						type = event_toast_effect_bad
						title = diplomacy_family.2201.a.tt
						left_icon = root
						right_icon = scope:family_friend
						root = {
							worsen_relationship_effect = {
								TARGET = scope:family_rival
								REASON = rival_forced_to_socialize
							}
						}
					}
				}
			}
		}
	}
}

# Remembering the previous holder of the player's primary title
lmf_feast.1023 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1023.t
	desc = lmf_feast.1023.desc
	theme = family

	left_portrait = {
		character = scope:family_toaster
		animation = toast
	}
	right_portrait = {
		character = root
		animation = toast_goblet
	}
	lower_right_portrait = {
		character = scope:dead_relative
		animation = dead
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_friendly" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = lmfmod_4023_flag
			create_family_dinner_pool = yes
			
			# mark the previous holder
			random_close_family_member = {
				even_if_dead = yes
				limit = {
					is_alive = no
					faith = root.faith
					this = root.primary_title.previous_holder
					days_since_death >= 1095
				}
				save_scope_as = dead_relative
			}
			
			# pick out the one who initiates the toast
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					has_dynasty = yes
					faith = scope:dead_relative.faith
					dynasty = scope:dead_relative.dynasty
					is_close_or_extended_family_of = scope:dead_relative
					save_temporary_scope_as = potential_toaster
					NOR = {
						is_consort_of = root
						has_relation_rival = root
					}
				}
				weight = {
					base = 1
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					modifier = {
						add = -1
						age < root.age
					}
					modifier = {
						add = 1
						age > root.age
					}
					modifier = {
						add = 1
						age > root.age_plus_10
					}
					modifier = {
						add = 2
						is_close_family_of = scope:dead_relative
					}
					modifier = {
						add = 3
						is_spouse_of = scope:dead_relative
					}
				}
				save_scope_as = family_toaster
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
		}
	}
	
	option = {
		name = lmf_feast.1023.a
		dynasty = { add_dynasty_prestige = minor_dynasty_prestige_gain }
	}
}

# Hostage feels out of place among family
lmf_feast.1024 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1024.t
	desc = {
		desc = lmf_feast.1024.desc.start
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:hostage_problem = flag:language
					exists = scope:family_hostage_common
				}
				desc = lmf_feast.1024.desc.language.one
			}
			triggered_desc = {
				trigger = {
					scope:hostage_problem = flag:language
				}
				desc = lmf_feast.1024.desc.language.none
			}
			triggered_desc = {
				trigger = {
					scope:hostage_problem = flag:religion
					exists = scope:family_hostage_common
				}
				desc = lmf_feast.1024.desc.religion.one
			}
			triggered_desc = {
				trigger = {
					scope:hostage_problem = flag:religion
				}
				desc = lmf_feast.1024.desc.religion.none
			}
			triggered_desc = {
				trigger = {
					scope:hostage_problem = flag:culture
					exists = scope:family_hostage_common
				}
				desc = lmf_feast.1024.desc.culture.one
			}
			desc = lmf_feast.1024.desc.culture.none
		}
		desc = lmf_feast.1024.desc.end
	}
	theme = family

	center_portrait = {
		character = scope:family_hostage
		animation = shame
	}
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_unfriendly" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4024_flag years = 10 }
			create_family_dinner_pool = yes
			
			# pick out the hostage
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_hostage_of = root
					save_temporary_scope_as = potential_family_hostage
					OR = {
						NOR = {
							knows_language_of_culture = root.culture
							root = { knows_language_of_culture = scope:potential_family_hostage.culture }
							any_in_list = {
								list = family_dinner_guests
								NOT = { this = scope:potential_family_hostage }
								knows_language_of_culture = scope:potential_family_hostage.culture
								count > 1
							}
						}
						NOR = {
							culture = root.culture
							any_in_list = {
								list = family_dinner_guests
								NOT = { this = scope:potential_family_hostage }
								culture = scope:potential_family_hostage.culture
								count > 1
							}
						}
						NOR = {
							religion = root.religion
							any_in_list = {
								list = family_dinner_guests
								NOT = { this = scope:potential_family_hostage }
								religion = scope:potential_family_hostage.religion
								count > 1
							}
						}
					}
					NOR = {
						has_relation_rival = root
						has_relation_friend = root
						is_close_or_extended_family_of = root
						has_character_flag = featured_family_dinner_event
					}
				}
				save_scope_as = family_hostage
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
			
			# check if there's anyone the hostage can relate to
			if = {
				limit = {
					scope:family_hostage = {
						NOR = {
							knows_language_of_culture = root.culture
							root = { knows_language_of_culture = scope:family_hostage.culture }
							any_in_list = {
								list = family_dinner_guests
								NOT = { this = scope:family_hostage }
								knows_language_of_culture = scope:family_hostage.culture
								count > 1
							}
						}
					}
				}
				save_scope_value_as = {
					name = hostage_problem
					value = flag:language
				}
				if = {
					limit = {
						any_in_list = {
							list = family_dinner_guests
							NOT = { this = scope:family_hostage }
							knows_language_of_culture = scope:family_hostage.culture
							count > 0
						}
					}
				}
				random_in_list = {
					list = family_dinner_guests
					limit = {
						NOT = { this = scope:family_hostage }
						knows_language_of_culture = scope:family_hostage.culture
					}
					save_scope_as = family_hostage_common
				}
			}
			else_if = {
				limit = {
					scope:family_hostage = {
						NOR = {
							religion = root.religion
							any_in_list = {
								list = family_dinner_guests
								NOT = { this = scope:family_hostage }
								religion = scope:family_hostage.religion
								count > 1
							}
						}
					}
				}
				save_scope_value_as = {
					name = hostage_problem
					value = flag:religion
				}
				if = {
					limit = {
						any_in_list = {
							list = family_dinner_guests
							NOT = { this = scope:family_hostage }
							religion = scope:family_hostage.religion
							count > 0
						}
					}
				}
				random_in_list = {
					list = family_dinner_guests
					limit = {
						NOT = { this = scope:family_hostage }
						religion = scope:family_hostage.religion
					}
					save_scope_as = family_hostage_common
				}
			}
			else = {
				save_scope_value_as = {
					name = hostage_problem
					value = flag:culture
				}
				if = {
					limit = {
						any_in_list = {
							list = family_dinner_guests
							NOT = { this = scope:family_hostage }
							culture = scope:family_hostage.culture
							count > 0
						}
					}
				}
				random_in_list = {
					list = family_dinner_guests
					limit = {
						NOT = { this = scope:family_hostage }
						culture = scope:family_hostage.culture
					}
					save_scope_as = family_hostage_common
				}
			}
		}
	}
	
	option = {
		name = lmf_feast.1024.a #Try to make him feel more at home
		stress_impact = {
			patient = minor_stress_impact_loss
			compassionate = minor_stress_impact_loss
			impatient = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		reverse_add_opinion = {
			target = scope:family_hostage
			modifier = kindness_opinion
			opinion = 20
		}
	}
	option = {
		name = lmf_feast.1024.b #I'm not his father
		stress_impact = {
			patient = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
			impatient = minor_stress_impact_loss
			callous = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
		}
		reverse_add_opinion = {
			target = scope:family_hostage
			modifier = disappointed_opinion
			opinion = -20
		}
	}
}

# Ward can be taught a lesson
lmf_feast.1025 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1025.t
	desc = {
		desc = lmf_feast.1025.desc.start
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:family_ward = {
						has_closer_or_equal_relation_than = { CHARACTER = root TARGET = scope:family_example }
					}
				}
				desc = lmf_feast.1025.desc.relation
			}
			desc = lmf_feast.1025.desc.norelation
		}
		desc = lmf_feast.1025.desc.mid
		first_valid = {
			triggered_desc = {
				trigger = { scope:ward_education = flag:martial }
				desc = lmf_feast.1025.desc.martial
			}
			triggered_desc = {
				trigger = { scope:ward_education = flag:intrigue }
				desc = lmf_feast.1025.desc.intrigue
			}
			triggered_desc = {
				trigger = { scope:ward_education = flag:learning }
				desc = lmf_feast.1025.desc.learning
			}
			triggered_desc = {
				trigger = { scope:ward_education = flag:diplomacy }
				desc = lmf_feast.1025.desc.diplomacy
			}
			desc = lmf_feast.1025.desc.stewardship
		}
		desc = lmf_feast.1025.desc.end
	}
	theme = family

	left_portrait = {
		character = scope:family_ward
		animation = thinking
	}
	right_portrait = {
		character = scope:family_example
		animation = debating
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_friendly" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4025_flag years = 6 }
			create_family_dinner_pool = yes
			
			# first select the ward
			random_in_list = {
				list = family_dinner_guests
				limit = {
					has_relation_guardian = root
					age >= 10
					save_temporary_scope_as = potential_ward
					any_in_list = {
						list = family_dinner_guests
						NOT = { this = root }
						OR = {
							AND = {
								scope:potential_ward = { has_focus = education_martial }
								OR = {
									has_trait = education_martial_3
									has_trait = education_martial_4
									has_trait = education_martial_5
								}
							}
							AND = {
								scope:potential_ward = { has_focus = education_intrigue }
								OR = {
									has_trait = education_intrigue_3
									has_trait = education_intrigue_4
									has_trait = education_intrigue_5
								}
							}
							AND = {
								scope:potential_ward = { has_focus = education_learning }
								OR = {
									has_trait = education_learning_3
									has_trait = education_learning_4
									has_trait = education_learning_5
								}
							}
							AND = {
								scope:potential_ward = { has_focus = education_diplomacy }
								OR = {
									has_trait = education_diplomacy_3
									has_trait = education_diplomacy_4
									has_trait = education_diplomacy_5
								}
							}
							AND = {
								scope:potential_ward = { has_focus = education_stewardship }
								OR = {
									has_trait = education_stewardship_3
									has_trait = education_stewardship_4
									has_trait = education_stewardship_5
								}
							}
						}
					}
				}
				save_scope_as = family_ward
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 6 }
			}
			
			if = {
				limit = {
					scope:family_ward = { has_focus = education_martial }
				}
				save_scope_value_as = {
					name = ward_education
					value = flag:martial
				}
			}
			else_if = {
				limit = {
					scope:family_ward = { has_focus = education_intrigue }
				}
				save_scope_value_as = {
					name = ward_education
					value = flag:intrigue
				}
			}
			else_if = {
				limit = {
					scope:family_ward = { has_focus = education_learning }
				}
				save_scope_value_as = {
					name = ward_education
					value = flag:learning
				}
			}
			else_if = {
				limit = {
					scope:family_ward = { has_focus = education_diplomacy }
				}
				save_scope_value_as = {
					name = ward_education
					value = flag:diplomacy
				}
			}
			else = {
				save_scope_value_as = {
					name = ward_education
					value = flag:stewardship
				}
			}
			
			# now pick out the ward's target
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOT = { this = root }
					OR = {
						AND = {
							scope:ward_education = flag:martial
							OR = {
								has_trait = education_martial_3
								has_trait = education_martial_4
								has_trait = education_martial_5
							}
						}
						AND = {
							scope:ward_education = flag:intrigue
							OR = {
								has_trait = education_intrigue_3
								has_trait = education_intrigue_4
								has_trait = education_intrigue_5
							}
						}
						AND = {
							scope:ward_education = flag:learning
							OR = {
								has_trait = education_learning_3
								has_trait = education_learning_4
								has_trait = education_learning_5
							}
						}
						AND = {
							scope:ward_education = flag:diplomacy
							OR = {
								has_trait = education_diplomacy_3
								has_trait = education_diplomacy_4
								has_trait = education_diplomacy_5
							}
						}
						AND = {
							scope:ward_education = flag:stewardship
							OR = {
								has_trait = education_stewardship_3
								has_trait = education_stewardship_4
								has_trait = education_stewardship_5
							}
						}
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 5
						has_education_martial_trigger = yes
						martial >= high_skill_rating
					}
					modifier = {
						add = 5
						has_education_intrigue_trigger = yes
						intrigue >= high_skill_rating
					}
					modifier = {
						add = 5
						has_education_learning_trigger = yes
						learning >= high_skill_rating
					}
					modifier = {
						add = 5
						has_education_diplomacy_trigger = yes
						diplomacy >= high_skill_rating
					}
					modifier = {
						add = 5
						has_education_stewardship_trigger = yes
						stewardship >= high_skill_rating
					}
					modifier = {
						add = -4
						has_character_flag = featured_family_dinner_event
					}
					modifier = {
						add = 10
						OR = {
							has_trait = education_intrigue_5
							has_trait = education_diplomacy_5
							has_trait = education_stewardship_5
							has_trait = education_martial_5
							has_trait = education_learning_5
						}
					}
					modifier = {
						add = 5
						OR = {
							has_trait = education_intrigue_4
							has_trait = education_diplomacy_4
							has_trait = education_stewardship_4
							has_trait = education_martial_4
							has_trait = education_learning_4
						}
					}
					modifier = {
						add = 10
						is_councillor = yes
					}
					min = 1
				}
				save_scope_as = family_example
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 5 }
			}
		}
	}
	
	option = {
		name = lmf_feast.1025.a
		stress_impact = {
			base = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
			impatient = minor_stress_impact_gain
			diligent = minor_stress_impact_loss
			patient = minor_stress_impact_loss
		}
		random_list = {
			20 = {
				modifier = {
					add = {
						value = learning
						multiply = 3
					}
				}
				modifier = {
					add = {
						value = diplomacy
						multiply = 0.5
					}
				}
				modifier = {
					add = {
						value = scope:family_ward.learning
						multiply = 2
					}
				}
				modifier = {
					add = 10
					has_trait = patient
				}
				modifier = {
					add = -10
					has_trait = impatient
				}
				modifier = {
					add = 5
					scope:family_ward = { has_trait = diligent }
				}
				modifier = {
					add = -5
					scope:family_ward = { has_trait = lazy }
				}
				custom_tooltip = lmf_feast.1025.a.success
				hidden_effect = {
					scope:family_ward = {
						if = {
							limit = { has_focus = education_martial }
							change_variable = {
								name = education_martial_variable
								add = 2
							}
						}
						else_if = {
							limit = { has_focus = education_intrigue }
							change_variable = {
								name = education_intrigue_variable
								add = 2
							}
						}
						else_if = {
							limit = { has_focus = education_learning }
							change_variable = {
								name = education_learning_variable
								add = 2
							}
						}
						else_if = {
							limit = { has_focus = education_diplomacy }
							change_variable = {
								name = education_diplomacy_variable
								add = 2
							}
						}
						else = {
							change_variable = {
								name = education_stewardship_variable
								add = 2
							}
						}
					}
					send_interface_message = {
						type = event_generic_good
						title = lmf_feast.1025.a.success.tt
						right_icon = scope:family_ward
						custom_tooltip = lmf_feast.1025.a.success2.tt
					}
				}
			}
			50 = {
				custom_tooltip = lmf_feast.1025.a.fail
				hidden_effect = {
					send_interface_message = {
						type = event_generic_bad
						title = lmf_feast.1025.a.fail.tt
						right_icon = scope:family_ward
						scope:family_ward = { add_stress = minor_stress_gain }
					}
				}
			}
			5 = {
				modifier = {
					add = 5
					scope:family_ward = { has_trait = intellect_bad_1 }
				}
				modifier = {
					add = 10
					scope:family_ward = { has_trait = intellect_bad_2 }
				}
				modifier = {
					add = 20
					scope:family_ward = { has_trait = intellect_bad_3 }
				}
				custom_tooltip = lmf_feast.1025.a.botch
				hidden_effect = {
					scope:family_ward = {
						if = {
							limit = { has_focus = education_martial }
							change_variable = {
								name = education_martial_variable
								add = -1
							}
						}
						else_if = {
							limit = { has_focus = education_intrigue }
							change_variable = {
								name = education_intrigue_variable
								add = -1
							}
						}
						else_if = {
							limit = { has_focus = education_learning }
							change_variable = {
								name = education_learning_variable
								add = -1
							}
						}
						else_if = {
							limit = { has_focus = education_diplomacy }
							change_variable = {
								name = education_diplomacy_variable
								add = -1
							}
						}
						else = {
							change_variable = {
								name = education_stewardship_variable
								add = -1
							}
						}
					}
					send_interface_message = {
						type = event_generic_bad
						title = lmf_feast.1025.a.botch.tt
						right_icon = scope:family_ward
						custom_tooltip = lmf_feast.1025.a.botch2.tt
						scope:family_ward = { add_stress = medium_stress_gain }
					}
				}
			}
		}
	}
	option = {
		name = lmf_feast.1025.b
		stress_impact = {
			base = minor_stress_impact_loss
			lazy = minor_stress_impact_loss
			impatient = minor_stress_impact_loss
			diligent = minor_stress_impact_gain
			patient = minor_stress_impact_gain
		}
		reverse_add_opinion = {
			target = scope:family_ward
			modifier = disappointed_opinion
			opinion = -10
		}
	}
}

# Pious family member gives a prayer
lmf_feast.1026 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1026.t
	desc = {
		desc = lmf_feast.1026.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { has_trait = zealous }
				desc = lmf_feast.1026.desc.zealous
			}
			triggered_desc = {
				trigger = { has_trait = cynical }
				desc = lmf_feast.1026.desc.cynical
			}
			desc = lmf_feast.1026.desc.nozeal
		}
		first_valid = {
			triggered_desc = {
				trigger = { has_trait = impatient }
				desc = lmf_feast.1026.desc.impatient
			}
			triggered_desc = {
				trigger = { has_trait = patient }
				desc = lmf_feast.1026.desc.patient
			}
			desc = lmf_feast.1026.desc.family
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:family_react
					scope:family_react = {
						faith = scope:family_religious.faith
						is_pious_or_clergy = yes
					}
				}
				desc = {
					desc = lmf_feast.1026.desc.loved
					first_valid = {
						triggered_desc = {
							trigger = {
								scope:family_religious = {
									has_closer_or_equal_relation_than = { CHARACTER = root TARGET = scope:family_react }
								}
							}
							desc = lmf_feast.1026.desc.relation
						}
						desc = lmf_feast.1026.desc.norelation
					}
					desc = lmf_feast.1026.desc.loved2
				}
			}
			triggered_desc = {
				trigger = { exists = scope:family_react }
				desc = {
					desc = lmf_feast.1026.desc.hated
					first_valid = {
						triggered_desc = {
							trigger = {
								scope:family_religious = {
									has_closer_or_equal_relation_than = { CHARACTER = root TARGET = scope:family_react }
								}
							}
							desc = lmf_feast.1026.desc.relation
						}
						desc = lmf_feast.1026.desc.norelation
					}
					desc = lmf_feast.1026.desc.hated2
				}
			}
			desc = lmf_feast.1026.desc.default
		}
	}
	theme = family
	
	right_portrait = {
		trigger = { exists = scope:family_react }
		character = scope:family_react
		triggered_animation = {
			trigger = {
				scope:family_react = {
					faith = scope:family_religious.faith
					is_pious_or_clergy = yes
				}
			}
			animation = ecstasy
		}
		animation = rage
	}
	left_portrait = {
		character = scope:family_religious
		animation = prayer
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_faith" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4026_flag years = 10 }
			create_family_dinner_pool = yes
			
			#first select the religious family member
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					faith = root.faith
					is_pious_or_clergy = yes
					NOR = {
						has_character_flag = featured_family_dinner_event
						has_relation_rival = root
					}
				}
				weight = {
					base = 1
					modifier = {
						add = {
							value = ai_zeal
							multiply = 0.10
						}
					}
					modifier = {
						factor = 2
						OR = {
							is_clergy = yes
							has_council_position = councillor_court_chaplain
						}
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
				}
				save_scope_as = family_religious
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
		
			#then see if there's a family member to react
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					OR = {
						AND = {
							faith = scope:family_religious.faith
							is_pious_or_clergy = yes
						}
						AND = {
							OR = {
								has_personality_malicious_trigger = yes
								is_hot_headed_trigger = yes
							}
							is_pious_or_clergy = yes
							faith = {
								faith_hostility_level = {
									target = scope:family_religious.faith
									value = faith_astray_level
								}
							}
						}
						AND = {
							OR = {
								has_personality_malicious_trigger = yes
								is_hot_headed_trigger = yes
							}
							ai_zeal > 0
							faith = {
								faith_hostility_level = {
									target = scope:family_religious.faith
									value >= faith_hostile_level
								}
							}
						}
					}
					NOR = {
						this = root
						this = scope:family_religious
						has_relation_lover = scope:family_religious
						has_relation_best_friend = scope:family_religious
						has_relation_nemesis = scope:family_religious
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 10
						OR = {
							is_clergy = yes
							has_council_position = councillor_court_chaplain
						}
					}
					modifier = {
						add = 5
						NOT = { faith = scope:family_religious.faith }
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
				}
				save_scope_as = family_react
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
		}
	}
	
	option = {
		name = lmf_feast.1026.a
		stress_impact = {
			base = minor_stress_gain
			zealous = medium_stress_impact_loss
			patient = minor_stress_impact_loss
			cynical = minor_stress_impact_gain
			impatient = minor_stress_impact_gain
		}
		if = {
			limit = { exists = scope:family_react }
			scope:family_react = {
				if = {
					limit = {
						faith = scope:family_religious.faith
						is_pious_or_clergy = yes
					}
					improve_relationship_effect = {
						TARGET = scope:family_religious
						REASON = loved_family_feast_sermon
					}
				}
				else = {
					worsen_relationship_effect = {
						TARGET = scope:family_religious
						REASON = hated_family_feast_sermon
					}
				}
			}
		}
	}
}

# Entertainment at the family feast
lmf_feast.1027 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1027.t
	desc = {
		desc = lmf_feast.1027.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:poet }
				desc = lmf_feast.1027.desc.poet
			}
			desc = lmf_feast.1027.desc.bard
		}
		desc = lmf_feast.1027.desc.end
	}
	theme = family
	
	center_portrait = {
		character = scope:family_entertainer
		triggered_animation = {
			trigger = { exists = scope:poet }
			animation = storyteller
		}
		animation = instrument_active
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_social" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4027_flag years = 10 }
			create_family_dinner_pool = yes
			
			#first select the entertainer
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					OR = {
						AND = {
							has_trait = lifestyle_poet
							diplomacy >= 12
						}
						AND = {
							has_court_position = court_musician_court_position
							aptitude = {
								court_position = court_musician_court_position
								value >= 3
							}
						}
						AND = {
							has_court_position = master_bard_camp_officer
							aptitude = {
								court_position = master_bard_camp_officer
								value >= 3
							}
						}
					}
					NOR = {
						has_character_flag = featured_family_dinner_event
						has_relation_rival = root
					}
				}
				weight = {
					base = 1
					modifier = {
						add = diplomacy
					}
					modifier = {
						add = 10
						OR = {
							has_court_position = court_musician_court_position
							has_court_position = master_bard_camp_officer
						}
					}
					modifier = {
						add = 50
						OR = {
							AND = {
								has_court_position = court_musician_court_position
								aptitude = {
									court_position = court_musician_court_position
									value >= 4
								}
							}
							AND = {
								has_court_position = master_bard_camp_officer
								aptitude = {
									court_position = master_bard_camp_officer
									value >= 4
								}
							}
						}
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
				}
				save_scope_as = family_entertainer
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
				if = {
					limit = { has_trait = lifestyle_poet }
					save_scope_value_as = {
						name = poet
						value = yes
					}
				}
			}
		}
	}
	
	option = {
		name = lmf_feast.1027.a
		stress_impact = {
			base = minor_stress_loss
		}
		every_in_list = {
			list = family_dinner_guests
			custom = all_stressed_family_dinner_guests
			limit = {
				stress > 0
				is_adult = yes
				NOR = {
					this = root
					this = scope:family_entertainer
					has_relation_rival = scope:family_entertainer
				}
			}
			stress_impact = {
				base = minor_stress_loss
			}
		}
	}
}

# Excellent conversation at the family feast
lmf_feast.1028 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1028.t
	desc = {
		desc = lmf_feast.1028.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { scope:conversation = flag:diplomat }
				desc = lmf_feast.1028.desc.diplomat
			}
			triggered_desc = {
				trigger = { scope:conversation = flag:family_first }
				desc = lmf_feast.1028.desc.family_first
			}
			triggered_desc = {
				trigger = { scope:conversation = flag:august }
				desc = lmf_feast.1028.desc.august
			}
			triggered_desc = {
				trigger = { scope:conversation = flag:strategist }
				desc = lmf_feast.1028.desc.strategist
			}
			triggered_desc = {
				trigger = { scope:conversation = flag:overseer }
				desc = lmf_feast.1028.desc.overseer
			}
			triggered_desc = {
				trigger = { scope:conversation = flag:gallant }
				desc = lmf_feast.1028.desc.gallant
			}
			triggered_desc = {
				trigger = { scope:conversation = flag:architect }
				desc = lmf_feast.1028.desc.architect
			}
			triggered_desc = {
				trigger = { scope:conversation = flag:administrator }
				desc = lmf_feast.1028.desc.administrator
			}
			triggered_desc = {
				trigger = { scope:conversation = flag:avaricious }
				desc = lmf_feast.1028.desc.avaricious
			}
			triggered_desc = {
				trigger = { scope:conversation = flag:schemer }
				desc = lmf_feast.1028.desc.schemer
			}
			triggered_desc = {
				trigger = { scope:conversation = flag:seducer }
				desc = lmf_feast.1028.desc.seducer
			}
			triggered_desc = {
				trigger = { scope:conversation = flag:torturer }
				desc = lmf_feast.1028.desc.torturer
			}
			triggered_desc = {
				trigger = { scope:conversation = flag:whole_of_body }
				desc = lmf_feast.1028.desc.whole_of_body
			}
			triggered_desc = {
				trigger = { scope:conversation = flag:scholar }
				desc = lmf_feast.1028.desc.scholar
			}
			desc = lmf_feast.1028.desc.theologian
		}
		desc = lmf_feast.1028.desc.end
	}
	theme = family
	
	right_portrait = {
		character = root
		animation = interested_left
	}
	left_portrait = {
		character = scope:family_expert
		animation = storyteller
	}
	lower_right_portrait = scope:dinner_pos_family
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_friendly" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4028_flag years = 10 }
			create_family_dinner_pool = yes
			
			#first select the expert family member
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					any_character_trait = {
						has_trait_category = lifestyle
						OR = {
							this = trait:diplomat
							this = trait:family_first
							this = trait:august
							this = trait:strategist
							this = trait:overseer
							this = trait:gallant
							this = trait:architect
							this = trait:administrator
							this = trait:avaricious
							this = trait:schemer
							this = trait:seducer
							this = trait:torturer
							this = trait:whole_of_body
							this = trait:scholar
							this = trait:theologian
						}
						NOT = {
							ROOT = { has_trait = prev }
						}
					}
					NOR = {
						has_character_flag = featured_family_dinner_event
						has_relation_rival = root
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						OR = {
							diplomacy > root.diplomacy
							martial > root.martial
							stewardship > root.stewardship
							intrigue > root.intrigue
							learning > root.learning
						}
					}
					modifier = {
						add = 2
						OR = {
							diplomacy > root.diplomacy_plus_5
							martial > root.martial_plus_5
							stewardship > root.stewardship_plus_5
							intrigue > root.intrigue_plus_5
							learning > root.learning_plus_5
						}
					}
					modifier = {
						add = 2
						OR = {
							has_relation_potential_friend = root
							has_relation_friend = root
						}
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
				}
				save_scope_as = family_expert
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
				random_list = {
					1 = {
						trigger = {
							has_trait = diplomat
							ROOT = { NOT = { has_trait = diplomat } }
						}
						modifier = {
							add = 2
							diplomacy >= root.diplomacy
						}
						modifier = {
							add = 2
							diplomacy >= root.diplomacy_plus_5
						}
						save_scope_value_as = { name = conversation value = flag:diplomat }
					}
					1 = {
						trigger = {
							has_trait = family_first
							ROOT = { NOT = { has_trait = family_first } }
						}
						modifier = {
							add = 2
							diplomacy >= root.diplomacy
						}
						modifier = {
							add = 2
							diplomacy >= root.diplomacy_plus_5
						}
						save_scope_value_as = { name = conversation value = flag:family_first }
					}
					1 = {
						trigger = {
							has_trait = august
							ROOT = { NOT = { has_trait = august } }
						}
						modifier = {
							add = 2
							diplomacy >= root.diplomacy
						}
						modifier = {
							add = 2
							diplomacy >= root.diplomacy_plus_5
						}
						save_scope_value_as = { name = conversation value = flag:august }
					}
					1 = {
						trigger = {
							has_trait = strategist
							ROOT = { NOT = { has_trait = strategist } }
						}
						modifier = {
							add = 2
							martial >= root.martial
						}
						modifier = {
							add = 2
							martial >= root.martial_plus_5
						}
						save_scope_value_as = { name = conversation value = flag:strategist }
					}
					1 = {
						trigger = {
							has_trait = overseer
							ROOT = { NOT = { has_trait = overseer } }
						}
						modifier = {
							add = 2
							martial >= root.martial
						}
						modifier = {
							add = 2
							martial >= root.martial_plus_5
						}
						save_scope_value_as = { name = conversation value = flag:overseer }
					}
					1 = {
						trigger = {
							has_trait = gallant
							ROOT = { NOT = { has_trait = gallant } }
						}
						modifier = {
							add = 2
							martial >= root.martial
						}
						modifier = {
							add = 2
							martial >= root.martial_plus_5
						}
						save_scope_value_as = { name = conversation value = flag:gallant }
					}
					1 = {
						trigger = {
							has_trait = architect
							ROOT = { NOT = { has_trait = architect } }
						}
						modifier = {
							add = 2
							stewardship >= root.stewardship
						}
						modifier = {
							add = 2
							stewardship >= root.stewardship_plus_5
						}
						save_scope_value_as = { name = conversation value = flag:architect }
					}
					1 = {
						trigger = {
							has_trait = administrator
							ROOT = { NOT = { has_trait = administrator } }
						}
						modifier = {
							add = 2
							stewardship >= root.stewardship
						}
						modifier = {
							add = 2
							stewardship >= root.stewardship_plus_5
						}
						save_scope_value_as = { name = conversation value = flag:administrator }
					}
					1 = {
						trigger = {
							has_trait = avaricious
							ROOT = { NOT = { has_trait = avaricious } }
						}
						modifier = {
							add = 2
							stewardship >= root.stewardship
						}
						modifier = {
							add = 2
							stewardship >= root.stewardship_plus_5
						}
						save_scope_value_as = { name = conversation value = flag:avaricious }
					}
					1 = {
						trigger = {
							has_trait = schemer
							ROOT = { NOT = { has_trait = schemer } }
						}
						modifier = {
							add = 2
							intrigue >= root.intrigue
						}
						modifier = {
							add = 2
							intrigue >= root.intrigue_plus_5
						}
						save_scope_value_as = { name = conversation value = flag:schemer }
					}
					1 = {
						trigger = {
							has_trait = seducer
							ROOT = { NOT = { has_trait = seducer } }
						}
						modifier = {
							add = 2
							intrigue >= root.intrigue
						}
						modifier = {
							add = 2
							intrigue >= root.intrigue_plus_5
						}
						save_scope_value_as = { name = conversation value = flag:seducer }
					}
					1 = {
						trigger = {
							has_trait = torturer
							ROOT = { NOT = { has_trait = torturer } }
						}
						modifier = {
							add = 2
							intrigue >= root.intrigue
						}
						modifier = {
							add = 2
							intrigue >= root.intrigue_plus_5
						}
						save_scope_value_as = { name = conversation value = flag:torturer }
					}
					1 = {
						trigger = {
							has_trait = whole_of_body
							ROOT = { NOT = { has_trait = whole_of_body } }
						}
						modifier = {
							add = 2
							learning >= root.learning
						}
						modifier = {
							add = 2
							learning >= root.learning_plus_5
						}
						save_scope_value_as = { name = conversation value = flag:whole_of_body }
					}
					1 = {
						trigger = {
							has_trait = scholar
							ROOT = { NOT = { has_trait = scholar } }
						}
						modifier = {
							add = 2
							learning >= root.learning
						}
						modifier = {
							add = 2
							learning >= root.learning_plus_5
						}
						save_scope_value_as = { name = conversation value = flag:scholar }
					}
					1 = {
						trigger = {
							has_trait = theologian
							ROOT = { NOT = { has_trait = theologian } }
						}
						modifier = {
							add = 2
							learning >= root.learning
						}
						modifier = {
							add = 2
							learning >= root.learning_plus_5
						}
						save_scope_value_as = { name = conversation value = flag:theologian }
					}
				}
			}
		
			#then pick one for the positive
			random_in_list = {
				list = family_dinner_guests
				limit = {
					NOT = { has_character_flag = featured_family_dinner_event }
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						is_adult = yes
					}
					modifier = {
						add = 1
						is_close_family_of = root
					}
					modifier = {
						add = -1
						NOT = { is_close_or_extended_family_of = root }
					}
					modifier = {
						add = 1
						has_relation_friend = root
					}
					modifier = {
						add = 1
						OR = {
							has_trait = pregnant
							has_trait = gregarious
							has_trait = lifestyle_reveler
						}
					}
					modifier = {
						add = -3
						has_character_flag = featured_family_dinner_event
					}
					min = 1
				}
				save_scope_as = dinner_pos_family
				assign_pos_dinner_activity = yes
				remove_character_flag ?= featured_family_dinner_event
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
		}
	}
	
	option = {
		name = lmf_feast.1028.a
		if = {
			limit = {
				OR = {
					scope:conversation = flag:diplomat
					scope:conversation = flag:family_first
					scope:conversation = flag:august
				}
			}
			if = {
				limit = {
					scope:family_expert.diplomacy >= 12
					diplomacy_plus_5 <= scope:family_expert.diplomacy
				}
				add_diplomacy_lifestyle_xp = major_lifestyle_xp
			}
			else = {
				add_diplomacy_lifestyle_xp = medium_lifestyle_xp
			}
		}
		else_if = {
			limit = {
				OR = {
					scope:conversation = flag:strategist
					scope:conversation = flag:overseer
					scope:conversation = flag:gallant
				}
			}
			if = {
				limit = {
					scope:family_expert.martial >= 12
					martial_plus_5 <= scope:family_expert.martial
				}
				add_martial_lifestyle_xp = major_lifestyle_xp
			}
			else = {
				add_martial_lifestyle_xp = medium_lifestyle_xp
			}
		}
		else_if = {
			limit = {
				OR = {
					scope:conversation = flag:architect
					scope:conversation = flag:administrator
					scope:conversation = flag:avaricious
				}
			}
			if = {
				limit = {
					scope:family_expert.stewardship >= 12
					stewardship_plus_5 <= scope:family_expert.stewardship
				}
				add_stewardship_lifestyle_xp = major_lifestyle_xp
			}
			else = {
				add_stewardship_lifestyle_xp = medium_lifestyle_xp
			}
		}
		else_if = {
			limit = {
				OR = {
					scope:conversation = flag:schemer
					scope:conversation = flag:seducer
					scope:conversation = flag:torturer
				}
			}
			if = {
				limit = {
					scope:family_expert.intrigue >= 12
					intrigue_plus_5 <= scope:family_expert.intrigue
				}
				add_intrigue_lifestyle_xp = major_lifestyle_xp
			}
			else = {
				add_intrigue_lifestyle_xp = medium_lifestyle_xp
			}
		}
		else = {
			if = {
				limit = {
					scope:family_expert.learning >= 12
					learning_plus_5 <= scope:family_expert.learning
				}
				add_learning_lifestyle_xp = major_lifestyle_xp
			}
			else = {
				add_learning_lifestyle_xp = medium_lifestyle_xp
			}
		}
		if = {
			limit = {
				NOR = {
					has_relation_lover = scope:family_expert
					has_relation_best_friend = scope:family_expert
				}
			}
			improve_relationship_effect = {
				TARGET = scope:family_expert
				REASON = good_family_feast_conversation
			}
		}
	}
}

# Public lover is the subject of family gossip
lmf_feast.1029 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1029.t
	desc = {
		desc = lmf_feast.1029.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = scope:public_lover } }
				desc = lmf_feast.1029.desc.family
			}
			desc = lmf_feast.1029.desc.notfamily
		}
		desc = lmf_feast.1029.desc.end
	}
	theme = family
	
	right_portrait = {
		character = scope:public_lover
		animation = shame
	}
	left_portrait = {
		character = scope:family_hater
		animation = disgust
	}
	
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_unfriendly" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4029_flag years = 10 }
			create_family_dinner_pool = yes
			
			#first grab the lover
			random_in_list = {
				list = family_dinner_guests
				limit = {
					has_relation_lover = root
					NOR = {
						is_consort_of = root
						has_character_flag = featured_family_dinner_event
						lover_is_secret_trigger = { CHARACTER = root }
					}
					save_temporary_scope_as = potential_public_lover
					any_in_list = {
						list = family_dinner_guests
						is_adult = yes
						OR = {
							ai_boldness >= 0
							ai_vengefulness >= 0
						}
						OR = {
							has_personality_malicious_trigger = yes
							is_hot_headed_trigger = yes
							is_consort_of = root
							has_relation_lover = root
						}
						OR = {
							AND = {
								scope:potential_public_lover = { relation_with_character_is_sodomy_in_my_or_lieges_faith_trigger = { CHARACTER = root } }
								has_negative_attitude_towards_trait_trigger = { TRAIT = trait:sodomite GENDER_CHARACTER = scope:potential_public_lover }
							}
							AND = {
								scope:potential_public_lover = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = root } }
								has_negative_attitude_towards_trait_trigger = { TRAIT = trait:incestuous GENDER_CHARACTER = scope:potential_public_lover }
							}
							AND = {
								trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = trait:adulterer GENDER_CHARACTER = scope:potential_public_lover }
								has_negative_attitude_towards_trait_trigger = { TRAIT = trait:adulterer GENDER_CHARACTER = scope:potential_public_lover }
							}
							is_consort_of = root
							has_relation_lover = root
						}
						NOR = {
							this = scope:potential_public_lover
							has_character_flag = featured_family_dinner_event
							likes_character_trigger = { CHARACTER = scope:potential_public_lover }
						}
					}
				}
				save_scope_as = public_lover
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
			
			#then find a family member to hate them
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					OR = {
						ai_boldness >= 0
						ai_vengefulness >= 0
					}
					OR = {
						has_personality_malicious_trigger = yes
						is_hot_headed_trigger = yes
						is_consort_of = root
						has_relation_lover = root
					}
					OR = {
						AND = {
							scope:public_lover = { relation_with_character_is_sodomy_in_my_or_lieges_faith_trigger = { CHARACTER = root } }
							has_negative_attitude_towards_trait_trigger = { TRAIT = trait:sodomite GENDER_CHARACTER = scope:public_lover }
						}
						AND = {
							scope:public_lover = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = root } }
							has_negative_attitude_towards_trait_trigger = { TRAIT = trait:incestuous GENDER_CHARACTER = scope:public_lover }
						}
						AND = {
							trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = trait:adulterer GENDER_CHARACTER = scope:public_lover }
							has_negative_attitude_towards_trait_trigger = { TRAIT = trait:adulterer GENDER_CHARACTER = scope:public_lover }
						}
						is_consort_of = root
						has_relation_lover = root
					}
					NOR = {
						this = scope:public_lover
						has_character_flag = featured_family_dinner_event
						likes_character_trigger = { CHARACTER = scope:public_lover }
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 50
						is_consort_of = root
					}
					modifier = {
						add = 50
						has_relation_lover = root
					}
					modifier = {
						add = 100
						OR = {
							has_relation_rival = root
							has_relation_rival = scope:public_lover
						}
					}
					ai_value_modifier = {
						ai_zeal = 0.5
						ai_vengefulness = 0.5
						min = 0
						max = 50
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_relation_lover = root
						}
					}
					min = 1
				}
				save_scope_as = family_hater
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
		}
	}
	
	option = {
		name = lmf_feast.1029.a
		stress_impact = {
			base = minor_stress_gain
			just = minor_stress_impact_gain
			shy = minor_stress_impact_gain
			reclusive = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			arbitrary = minor_stress_impact_loss
			gregarious = minor_stress_impact_loss
			arrogant = minor_stress_impact_loss
		}
		scope:public_lover = {
			stress_impact = {
				base = medium_stress_gain
				just = minor_stress_impact_gain
				shy = minor_stress_impact_gain
				reclusive = minor_stress_impact_gain
				humble = minor_stress_impact_gain
				arbitrary = minor_stress_impact_loss
				gregarious = minor_stress_impact_loss
				arrogant = minor_stress_impact_loss
			}
		}
		scope:family_hater = {
			worsen_relationship_effect = {
				TARGET = scope:public_lover
				REASON = lover_showed_at_family_feast
			}
		}
	}
}

# Two attendees of different cultures argue
lmf_feast.1030 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1030.t
	desc = lmf_feast.1030.desc
	theme = family
	
	right_portrait = {
		character = scope:family_hater
		animation = anger
	}
	left_portrait = {
		character = scope:family_react
		animation = dismissal
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_unfriendly" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4030_flag years = 10 }
			create_family_dinner_pool = yes
			
			# first grab the instigator
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					num_of_relation_rival <= 2
					OR = {
						has_personality_malicious_trigger = yes
						is_hot_headed_trigger = yes
					}
					NOT = { has_character_flag = featured_family_dinner_event }
					save_temporary_scope_as = potential_rival
					any_in_list = {
						list = family_dinner_guests
						is_adult = yes
						num_of_relation_rival <= 2
						save_temporary_scope_as = rival_check
						NOR = {
							this = scope:potential_rival
							scope:potential_rival = { likes_character_trigger = { CHARACTER = scope:rival_check } }
							culture = scope:potential_rival.culture
							has_character_flag = featured_family_dinner_event
						}
						scope:potential_rival.culture = {
							cultural_acceptance = {
								target = scope:rival_check.culture
								value < 5
							}
						}
					}
				}
				weight = {
					base = 1
					ai_value_modifier = {
						ai_rationality = -0.5
						ai_vengefulness = 0.5
						min = 0
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = family_hater
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
			
			# then grab the target
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					num_of_relation_rival <= 2
					save_temporary_scope_as = rival_check
					NOR = {
						this = scope:family_hater
						scope:family_hater = { likes_character_trigger = { CHARACTER = scope:rival_check } }
						culture = scope:family_hater.culture
						has_character_flag = featured_family_dinner_event
					}
					scope:family_hater.culture = {
						cultural_acceptance = {
							target = scope:rival_check.culture
							value < 5
						}
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 25
						NOT = { faith = scope:family_hater.faith }
					}
					modifier = {
						add = 25
						scope:family_hater.culture = {
							cultural_acceptance = {
								target = scope:rival_check.culture
								value < 2
							}
						}
					}
					opinion_modifier = {
						who = scope:family_hater
						opinion_target = scope:rival_check
						multiplier = -1
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = family_react
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
		}
	}
	
	option = {
		name = lmf_feast.1030.a
		stress_impact = {
			base = minor_stress_gain
		}
		scope:family_hater = {
			worsen_relationship_effect = {
				TARGET = scope:family_react
				REASON = argued_over_different_culture
			}
		}
	}
}

# Stressed family member makes a fool of themselves
lmf_feast.1031 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1031.t
	desc = {
		desc = lmf_feast.1031.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { scope:family_stress = flag:lunatic }
				desc = lmf_feast.1031.desc.lunatic
			}
			triggered_desc = {
				trigger = { scope:family_stress = flag:hashishiyah }
				desc = lmf_feast.1031.desc.hashishiyah
			}
			triggered_desc = {
				trigger = { scope:family_stress = flag:deviant }
				desc = lmf_feast.1031.desc.deviant
			}
			triggered_desc = {
				trigger = { scope:family_stress = flag:rakish }
				desc = lmf_feast.1031.desc.rakish
			}
			triggered_desc = {
				trigger = { scope:family_stress = flag:reclusive }
				desc = lmf_feast.1031.desc.reclusive
			}
			triggered_desc = {
				trigger = { scope:family_stress = flag:irritable }
				desc = lmf_feast.1031.desc.irritable
			}
			triggered_desc = {
				trigger = { scope:family_stress = flag:contrite }
				desc = lmf_feast.1031.desc.contrite
			}
			triggered_desc = {
				trigger = { scope:family_stress = flag:depressed }
				desc = lmf_feast.1031.desc.depressed
			}
			desc = lmf_feast.1031.desc.drunkard
		}
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:new_stress_trait }
				desc = lmf_feast.1031.desc.newtrait
			}
			desc = lmf_feast.1031.desc.trait
		}
		desc = lmf_feast.1031.desc.end
	}
	theme = family
	
	center_portrait = {
		character = scope:family_fool
		triggered_animation = {
			trigger = { scope:family_stress = flag:lunatic }
			animation = eccentric
		}
		triggered_animation = {
			trigger = { scope:family_stress = flag:hashishiyah }
			animation = delirium
		}
		triggered_animation = {
			trigger = { scope:family_stress = flag:deviant }
			animation = disapproval
		}
		triggered_animation = {
			trigger = { scope:family_stress = flag:rakish }
			animation = flirtation
		}
		triggered_animation = {
			trigger = { scope:family_stress = flag:reclusive }
			animation = dismissal
		}
		triggered_animation = {
			trigger = { scope:family_stress = flag:irritable }
			animation = rage
		}
		triggered_animation = {
			trigger = { scope:family_stress = flag:contrite }
			animation = shame
		}
		triggered_animation = {
			trigger = { scope:family_stress = flag:depressed }
			animation = wailing
		}
		animation = wedding_drunk
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_unfriendly" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4031_flag years = 10 }
			create_family_dinner_pool = yes
			
			#select the stressed family member
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					is_relevant_family_member = { CHARACTER = root }
					stress > normal_baseline_stress
					save_temporary_scope_as = potential_fool
					OR = {
						has_trait = lunatic
						has_trait = hashishiyah
						has_trait = irritable
						has_trait = depressed
						has_trait = drunkard
						has_trait = rakish
						has_trait = reclusive
						AND = {
							is_deviant_trigger = yes
							has_personality_levelheaded_trigger = no
						}
						AND = {
							has_trait = contrite
							any_secret = {
								exists = this
								can_be_exposed_by = scope:potential_fool
							}
						}
						AND = {
							has_a_bad_stress_coping_trait_trigger = no
							OR = {
								can_be_drunkard = yes
								can_be_hashishiyah = yes
								can_be_rakish = yes
								can_be_irritable = yes
								can_be_reclusive = yes
								AND = {
									can_be_contrite = yes
									any_secret = {
										exists = this
										can_be_exposed_by = scope:potential_fool
									}
								}
							}
						}
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						has_trait = lunatic
					}
					modifier = {
						add = 1
						has_trait = depressed
					}
					modifier = {
						add = 2
						stress > higher_than_baseline_stress
					}
					modifier = {
						add = 2
						stress > medium_stress
					}
					modifier = {
						add = 5
						stress > high_stress
					}
					modifier = {
						add = -1
						ai_rationality > 0
					}
					modifier = {
						add = -1
						ai_rationality >= 50
					}
					modifier = {
						add = 1
						ai_rationality < 0
					}
					modifier = {
						add = 1
						ai_rationality <= -50
					}
					modifier = {
						factor = 0.75
						has_trait = drunkard #because it's so common
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
					min = 1
				}
				save_scope_as = family_fool
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
				random_list = {
					2 = {
						trigger = { has_trait = lunatic }
						save_scope_value_as = { name = family_stress value = flag:lunatic }
					}
					1 = {
						trigger = {
							OR = {
								has_trait = hashishiyah
								AND = {
									has_a_bad_stress_coping_trait_trigger = no
									can_be_hashishiyah = yes
								}
							}
						}
						save_scope_value_as = { name = family_stress value = flag:hashishiyah }
						if = {
							limit = {
								NOT = { has_trait = hashishiyah }
							}
							save_scope_value_as = { name = new_stress_trait value = flag:yes }
						}
					}
					1 = {
						trigger = {
							OR = {
								has_trait = irritable
								AND = {
									has_a_bad_stress_coping_trait_trigger = no
									can_be_irritable = yes
								}
							}
						}
						save_scope_value_as = { name = family_stress value = flag:irritable }
						if = {
							limit = {
								NOT = { has_trait = irritable }
							}
							save_scope_value_as = { name = new_stress_trait value = flag:yes }
						}
					}
					1 = {
						trigger = { has_trait = depressed }
						save_scope_value_as = { name = family_stress value = flag:depressed }
					}
					1 = {
						trigger = {
							OR = {
								has_trait = drunkard
								AND = {
									has_a_bad_stress_coping_trait_trigger = no
									can_be_drunkard = yes
								}
							}
						}
						save_scope_value_as = { name = family_stress value = flag:drunkard }
						if = {
							limit = {
								NOT = { has_trait = drunkard }
							}
							save_scope_value_as = { name = new_stress_trait value = flag:yes }
						}
					}
					1 = {
						trigger = {
							OR = {
								has_trait = rakish
								AND = {
									has_a_bad_stress_coping_trait_trigger = no
									can_be_rakish = yes
								}
							}
						}
						save_scope_value_as = { name = family_stress value = flag:rakish }
						if = {
							limit = {
								NOT = { has_trait = rakish }
							}
							save_scope_value_as = { name = new_stress_trait value = flag:yes }
						}
						dummy_attracted_gender_effect = { TARGET = scope:family_fool }
					}
					1 = {
						trigger = {
							OR = {
								has_trait = reclusive
								AND = {
									has_a_bad_stress_coping_trait_trigger = no
									can_be_reclusive = yes
								}
							}
						}
						save_scope_value_as = { name = family_stress value = flag:reclusive }
						if = {
							limit = {
								NOT = { has_trait = reclusive }
							}
							save_scope_value_as = { name = new_stress_trait value = flag:yes }
						}
					}
					1 = {
						trigger = {
							is_deviant_trigger = yes
							has_personality_levelheaded_trigger = no
						}
						save_scope_value_as = { name = family_stress value = flag:deviant }
						if = {
							limit = {
								any_secret = { type = secret_deviant }
							}
							save_scope_value_as = { name = new_stress_trait value = flag:yes }
							random_secret = {
								type = secret_deviant
								save_scope_as = secret_to_expose
							}
						}
						scope:family_fool = { make_naked_effect = yes }
					}
					1 = {
						trigger = {
							OR = {
								has_trait = contrite
								AND = {
									has_a_bad_stress_coping_trait_trigger = no
									can_be_contrite = yes
								}
							}
							any_secret = {
								exists = this
								can_be_exposed_by = scope:family_fool
							}
						}
						save_scope_value_as = { name = family_stress value = flag:contrite }
						if = {
							limit = {
								NOT = { has_trait = contrite }
							}
							save_scope_value_as = { name = new_stress_trait value = flag:yes }
						}
						random_secret = {
							limit = {
								exists = this
								can_be_exposed_by = scope:family_fool
							}
							save_scope_as = secret_to_expose
						}
					}
				}
			}
		}
	}
	
	option = {
		name = lmf_feast.1031.a
		stress_impact = {
			base = minor_stress_gain
		}
		scope:family_fool = {
			add_prestige = medium_prestige_loss
			stress_impact = {
				base = massive_stress_loss
			}
			if = {
				limit = {
					scope:family_stress = flag:hashishiyah
					exists = scope:new_stress_trait
				}
				add_trait = hashishiyah
			}
			else_if = {
				limit = {
					scope:family_stress = flag:irritable
					exists = scope:new_stress_trait
				}
				add_trait = irritable
			}
			else_if = {
				limit = {
					scope:family_stress = flag:drunkard
					exists = scope:new_stress_trait
				}
				add_trait = drunkard
			}
			else_if = {
				limit = {
					scope:family_stress = flag:rakish
					exists = scope:new_stress_trait
				}
				add_trait = rakish
			}
			else_if = {
				limit = {
					scope:family_stress = flag:reclusive
					exists = scope:new_stress_trait
				}
				add_trait = reclusive
			}
			else_if = {
				limit = {
					scope:family_stress = flag:contrite
					exists = scope:new_stress_trait
				}
				add_trait = contrite
			}
		}
		if = {
			limit = { exists = scope:secret_to_expose }
			scope:secret_to_expose = {
				expose_secret = scope:family_fool
			}
		}
	}

	after = {
		if = {
			limit = { scope:family_stress = flag:deviant }
			remove_naked_effect = yes
		}
	}
}

# A spontaneous celebration breaks out
lmf_feast.1032 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1032.t
	desc = lmf_feast.1032.desc
	theme = family
	
	left_portrait = {
		character = scope:family_celebrate_1
		animation = laugh
	}
	center_portrait = {
		character = scope:family_celebrate_2
		animation = dancing
	}
	right_portrait = {
		character = scope:family_celebrate_3
		animation = throne_room_cheer_2
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_social" }
	
	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4032_flag years = 10 }
			create_family_dinner_pool = yes
			
			# pick three family members to celebrate
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					ai_boldness >= 0
					ai_sociability >= 50
					NOR = {
						has_character_flag = featured_family_dinner_event
						has_trait = temperate
						has_trait = depressed
						has_trait = reclusive
						has_trait = infirm
						has_trait = wounded
						has_relation_rival = root
					}
				}
				weight = {
					base = 1
					ai_value_modifier = {
						ai_sociability = 1
						ai_boldness = 0.5
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
				}
				save_scope_as = family_celebrate_1
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					ai_boldness >= 0
					ai_sociability >= 50
					NOR = {
						this = scope:family_celebrate_1
						has_character_flag = featured_family_dinner_event
						has_trait = temperate
						has_trait = depressed
						has_trait = reclusive
						has_trait = infirm
						has_trait = wounded
						has_relation_rival = root
					}
				}
				weight = {
					base = 1
					ai_value_modifier = {
						ai_sociability = 1
						ai_boldness = 0.5
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
				}
				save_scope_as = family_celebrate_2
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					ai_boldness >= 0
					ai_sociability >= 50
					NOR = {
						this = scope:family_celebrate_1
						this = scope:family_celebrate_2
						has_character_flag = featured_family_dinner_event
						has_trait = temperate
						has_trait = depressed
						has_trait = reclusive
						has_trait = infirm
						has_trait = wounded
						has_relation_rival = root
					}
				}
				weight = {
					base = 1
					ai_value_modifier = {
						ai_sociability = 1
						ai_boldness = 0.5
					}
					modifier = {
						factor = 0.5
						NOR = {
							is_close_or_extended_family_of = root
							is_vassal_of = root
							is_consort_of = root
							has_important_relationship_with_character_trigger = { CHARACTER = root }
						}
					}
				}
				save_scope_as = family_celebrate_3
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
			}
		}
	}
	
	option = {
		name = lmf_feast.1032.a
		stress_impact = {
			base = minor_stress_loss
		}
		every_in_list = {
			list = family_dinner_guests
			custom = all_stressed_family_dinner_guests
			limit = { stress > 0 }
			stress_impact = {
				base = minor_stress_loss
			}
		}
	}
}

# Family members have marriage spat
lmf_feast.1033 = {
	type = character_event
	window = lmf_feast_event_window
	title = lmf_feast.1033.t
	desc = {
		desc = lmf_feast.1033.desc.start
		first_valid = {
			triggered_desc = {
				trigger = { scope:marital_chill = flag:public_sodomite }
				desc = lmf_feast.1033.desc.sodomy
			}
			triggered_desc = {
				trigger = { scope:marital_chill = flag:public_incestuous }
				desc = lmf_feast.1033.desc.incest
			}
			triggered_desc = {
				trigger = { scope:marital_chill = flag:public_deviant }
				desc = lmf_feast.1033.desc.deviant
			}
			triggered_desc = {
				trigger = { scope:marital_chill = flag:secret_sodomite }
				desc = lmf_feast.1033.desc.secretsodomy
			}
			triggered_desc = {
				trigger = { scope:marital_chill = flag:secret_incest }
				desc = lmf_feast.1033.desc.secretincest
			}
			triggered_desc = {
				trigger = { scope:marital_chill = flag:secret_deviant }
				desc = lmf_feast.1033.desc.secretdeviant
			}
			triggered_desc = {
				trigger = { scope:marital_chill = flag:secret_infidelity }
				desc = lmf_feast.1033.desc.secretinfidelity
			}
			triggered_desc = {
				trigger = { scope:marital_chill = flag:public_infidelity }
				desc = lmf_feast.1033.desc.infidelity
			}
			triggered_desc = {
				trigger = { scope:marital_chill = flag:public_infidelity }
				desc = lmf_feast.1033.desc.infidelity
			}
			triggered_desc = {
				trigger = { scope:marital_chill = flag:rival }
				desc = lmf_feast.1033.desc.rival
			}
			triggered_desc = {
				trigger = { scope:marital_chill = flag:potrival }
				desc = lmf_feast.1033.desc.potrival
			}
			desc = lmf_feast.1033.desc.potrival
		}
		desc = lmf_feast.1033.desc.end
	}
	theme = family
	
	left_portrait = {
		character = scope:target_spouse
		triggered_animation = {
			trigger = {
				scope:target_spouse = {
					OR = {
						has_trait = depressed
						has_trait = lunatic
						has_trait = pregnant
					}
				}
			}
			animation = crying
		}
		triggered_animation = {
			trigger = { scope:target_spouse = { has_personality_submissive_trigger = yes } }
			animation = beg
		}
		triggered_animation = {
			trigger = { scope:target_spouse = { has_personality_malicious_trigger = yes } }
			animation = dismissal
		}
		triggered_animation = {
			trigger = { scope:target_spouse = { has_personality_benevolent_trigger = yes } }
			animation = shame
		}
		animation = stress
	}
	right_portrait = {
		character = scope:angry_spouse
		animation = rage
	}
	override_background = { reference = feast }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_relation_unfriendly" }

	immediate = {
		hidden_effect = {
			add_character_flag = { flag = lmfmod_4033_flag years = 10 }
			create_family_dinner_pool = yes
			
			# pick out relevant married family member with an angry spouse
			random_in_list = {
				list = family_dinner_guests
				limit = {
					is_adult = yes
					is_married = yes
					is_relevant_family_member = { CHARACTER = root }
					primary_spouse = {
						is_in_list = family_dinner_guests
						NOT = { has_character_flag = featured_family_dinner_event }
					}
					NOR = {
						has_character_flag = featured_family_dinner_event
						is_spouse_of = root
					}
					save_temporary_scope_as = potential_rival
					primary_spouse = { save_temporary_scope_as = potential_rival_spouse }
					OR = {
						AND = {
							has_trait_submissive_trigger = no
							has_personality_levelheaded_trigger = no
							OR = {
								scope:potential_rival_spouse = { has_marital_trait_or_secret_objectionable_to = { OBJECTOR = scope:potential_rival } }
								hurt_by_marriage_betrayal_trigger = { CHARACTER = scope:potential_rival_spouse }
								knows_of_my_secret_lover = { CHARACTER = scope:potential_rival_spouse }
								has_relation_rival = scope:potential_rival_spouse
								AND = {
									has_relation_potential_rival = scope:potential_rival_spouse
									opinion = { target = scope:potential_rival_spouse value < 0 }
								}
							}
						}
						primary_spouse = {
							has_trait_submissive_trigger = no
							has_personality_levelheaded_trigger = no
							OR = {
								scope:potential_rival = { has_marital_trait_or_secret_objectionable_to = { OBJECTOR = scope:potential_rival_spouse } }
								hurt_by_marriage_betrayal_trigger = { CHARACTER = scope:potential_rival }
								knows_of_my_secret_lover = { CHARACTER = scope:potential_rival }
								has_relation_rival = scope:potential_rival
								AND = {
									has_relation_potential_rival = scope:potential_rival
									opinion = { target = scope:potential_rival value < 0 }
								}
							}
						}
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 10
						is_close_family_of = root
					}
					modifier = {
						add = 5
						is_extended_family_of = root
					}
					modifier = {
						add = 3
						is_vassal_of = root
					}
					modifier = {
						add = 2
						is_councillor_of = root
					}
					modifier = {
						factor = 2
						OR = {
							has_personality_emotional_trigger = yes
							primary_spouse = { has_personality_emotional_trigger = yes }
						}
					}
					modifier = {
						factor = 2
						OR = {
							has_personality_malicious_trigger = yes
							primary_spouse = { has_personality_malicious_trigger = yes }
						}
					}
				}
				save_scope_as = family_rival_1
				add_character_flag = { flag = featured_family_dinner_event years = 10 }
				primary_spouse = {
					save_scope_as = family_rival_2
					add_character_flag = { flag = featured_family_dinner_event years = 10 }
				}
				
				# now figure out which one has the issue with the other
				if = {
					limit = {
						scope:family_rival_1 = {
							has_trait_submissive_trigger = no
							has_personality_levelheaded_trigger = no
							OR = {
								scope:family_rival_2 = { has_marital_trait_or_secret_objectionable_to = { OBJECTOR = scope:family_rival_1 } }
								hurt_by_marriage_betrayal_trigger = { CHARACTER = scope:family_rival_2 }
								knows_of_my_secret_lover = { CHARACTER = scope:family_rival_2 }
								has_relation_rival = scope:family_rival_2
								AND = {
									has_relation_potential_rival = scope:family_rival_2
									opinion = { target = scope:family_rival_2 value < 0 }
								}
							}
						}
					}
					scope:family_rival_1 = { save_scope_as = angry_spouse }
					scope:family_rival_2 = { save_scope_as = target_spouse }
				}
				else = {
					scope:family_rival_2 = { save_scope_as = angry_spouse }
					scope:family_rival_1 = { save_scope_as = target_spouse }
				}
				
				# then figure out the main cause, for the loc
				scope:target_spouse = {
					random_list = {
						100 = {
							trigger = {
								has_trait = sodomite
								scope:angry_spouse = { has_negative_attitude_towards_trait_trigger = { TRAIT = trait:sodomite GENDER_CHARACTER = scope:target_spouse } }
							}
							save_scope_value_as = {
								name = marital_chill
								value = flag:public_sodomite
							}
						}
						100 = {
							trigger = {
								has_trait = incestuous
								scope:angry_spouse = { has_negative_attitude_towards_trait_trigger = { TRAIT = trait:incestuous GENDER_CHARACTER = scope:target_spouse } }
							}
							save_scope_value_as = {
								name = marital_chill
								value = flag:public_incestuous
							}
						}
						100 = {
							trigger = {
								has_trait = deviant
								scope:angry_spouse = { has_negative_attitude_towards_trait_trigger = { TRAIT = trait:deviant GENDER_CHARACTER = scope:target_spouse } }
							}
							save_scope_value_as = {
								name = marital_chill
								value = flag:public_deviant
							}
						}
						300 = {
							trigger = {
								NOT = { has_trait = sodomite }
								any_secret = {
									type = secret_homosexual
									is_known_by = scope:angry_spouse
								}
								scope:angry_spouse = { has_negative_attitude_towards_trait_trigger = { TRAIT = trait:sodomite GENDER_CHARACTER = scope:target_spouse } }
							}
							save_scope_value_as = {
								name = marital_chill
								value = flag:secret_sodomite
							}
							random_secret = {
								type = secret_homosexual
								limit = { is_known_by = scope:angry_spouse }
								save_scope_as = reveal_secret
							}
						}
						300 = {
							trigger = {
								NOT = { has_trait = incestuous }
								any_secret = {
									type = secret_incest
									is_known_by = scope:angry_spouse
								}
								scope:angry_spouse = { has_negative_attitude_towards_trait_trigger = { TRAIT = trait:incestuous GENDER_CHARACTER = scope:target_spouse } }
							}
							save_scope_value_as = {
								name = marital_chill
								value = flag:secret_incest
							}
							random_secret = {
								type = secret_incest
								limit = { is_known_by = scope:angry_spouse }
								save_scope_as = reveal_secret
							}
						}
						300 = {
							trigger = {
								NOT = { has_trait = deviant }
								any_secret = {
									type = secret_deviant
									is_known_by = scope:angry_spouse
								}
								scope:angry_spouse = { has_negative_attitude_towards_trait_trigger = { TRAIT = trait:deviant GENDER_CHARACTER = scope:target_spouse } }
							}
							save_scope_value_as = {
								name = marital_chill
								value = flag:secret_deviant
							}
							random_secret = {
								type = secret_deviant
								limit = { is_known_by = scope:angry_spouse }
								save_scope_as = reveal_secret
							}
						}
						200 = {
							trigger = {
								has_known_secret_lover = { CHARACTER = scope:angry_spouse }
							}
							save_scope_value_as = {
								name = marital_chill
								value = flag:secret_infidelity
							}
							random_secret = {
								type = secret_lover
								limit = {
									NOT = { secret_target = scope:angry_spouse }
									is_known_by = scope:angry_spouse
								}
								save_scope_as = reveal_secret
							}
						}
						200 = {
							trigger = {
								betrayed_our_marriage_trigger = { CHARACTER = scope:angry_spouse }
							}
							save_scope_value_as = {
								name = marital_chill
								value = flag:public_infidelity
							}
						}
						50 = {
							trigger = {
								has_relation_rival = scope:angry_spouse
							}
							save_scope_value_as = {
								name = marital_chill
								value = flag:rival
							}
						}
						10 = {
							save_scope_value_as = {
								name = marital_chill
								value = flag:potrival
							}
						}
					}
				}
			}
		}
	}
	
	option = {
		name = lmf_feast.1033.a
		stress_impact = {
			base = minor_stress_gain
			sadistic = minor_stress_impact_loss
			compassionate = medium_stress_impact_gain
			family_first = minor_stress_impact_gain
		}
		scope:target_spouse = {
			stress_impact = {
				base = medium_stress_gain
				family_first = medium_stress_impact_gain
				arrogant = minor_stress_impact_loss
				callous = medium_stress_impact_loss
				humble = minor_stress_impact_gain
				craven = minor_stress_impact_gain
				shy = minor_stress_impact_gain
			}
		}
		if = {
			limit = { exists = scope:reveal_secret }
			scope:reveal_secret = {
				expose_secret = scope:angry_spouse
			}
		}
		scope:angry_spouse = {
			if = {
				limit = { has_relation_soulmate = scope:target_spouse }
				remove_relation_soulmate = scope:target_spouse
			}
			else_if = {
				limit = { has_relation_lover = scope:target_spouse }
				remove_relation_lover = scope:target_spouse
			}
			else_if = {
				limit = { has_relation_best_friend = scope:target_spouse }
				remove_relation_best_friend = scope:target_spouse
			}
			else_if = {
				limit = { has_relation_friend = scope:target_spouse }
				remove_relation_friend = scope:target_spouse
			}
			else_if = {
				limit = {
					has_relation_rival = scope:target_spouse
					can_set_relation_nemesis_trigger = { CHARACTER = scope:target_spouse }
				}
				set_relation_nemesis = {
					reason = nemesis_family_feast
					target = scope:target_spouse
				}
			}
			else_if = {
				limit = {
					OR = {
						can_set_relation_rival_trigger = { CHARACTER = scope:target_spouse }
						can_set_relation_potential_rival_trigger = { CHARACTER = scope:target_spouse }
					}
				}
				progress_towards_rival_effect = {
					CHARACTER = scope:target_spouse
					REASON = rival_family_feast
					OPINION = -40
				}
			}
			else = {
				add_opinion = {
					target = scope:target_spouse
					modifier = angry_opinion
					opinion = -40
				}
			}
		}
	}
}

