﻿# Events for the cultural festival portion of the Tour grand activity

namespace = cultural_festival

############################
## Tour Mini-Activity: Cultural Festival
############################
## Vassal Events
## 1000-1999
## by Veronica Pazos
############################
#
############################
## Liege Events
## 2000-2999
## by Veronica Pazos
############################
# cultural_festival.2000 - Cultural Festival Arrival Event (big variation)
# cultural_festival.2001-2002 - Performer messes up in front of you
# cultural_festival.2010 - King/Queen of Love and Beauty / Grim and Grievance
# cultural_festival.2020 - You enjoy a cultural demonstration based on the time of the year/culture
# cultural_festival.2030 - You tax people that go into the cultural festival
# cultural_festival.2040 - You are horrified by the culture in the cultural festival
# cultural_festival.2050 - Local dance is too scandalous - or not
# cultural_festival.2060 - You bring sophisticated entertainments from the capital to a low-dev county
# cultural_festival.2070 - You encounter a band of mercenaries enjoying the festivities, recruit?
# cultural_festival.2080 - Weird guy offers you a mysterious bag of liquids
# cultural_festival.2090 - Imprison performers on made up accussations
# cultural_festival.2100 - A guild is contributing to the festival
# cultural_festival.2110 - A dog breaks into a performance - Adopt?
#
#
############################
## Bilateral Events
## 3000-3999
## by Veronica Pazos
############################
# cultural_festival.3000-3002 - Big play based on liege
# cultural_festival.3010-3011 - Alcohol/Juice fountain
# cultural_festival.3020-3022 - Host a lavish ceremony to make your vassal formally repledge homage to you
# cultural_festival.3030-3031 - Crown the best pig/cow/local_farm_animal
# cultural_festival.3040-3042 - Sword in the stone
# cultural_festival.3050-3051 - You struggle to stay awake during a boring performance
# cultural_festival.3060-3061 - Take your spouse/vassal's spouse for a dance
# cultural_festival.3070-3071 - Hold a feast of fools-esque ceremony
#
#
############################
## 4000-4999
## by Arkadiusz Majewski
############################
# cultural_festival.4000 - As Liege you end up in a conversation in a language you don't know
# cultural_festival.4100 - Your courtier makes a cultural faux pas
# cultural_festival.4200-4203 - Vassal does a parade, liege attends
# cultural_festival.4300-4312 - Vassal initiates gift exchange custom, both can follow up on the gifts years later

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

######################
## Liege Events
## 2000-2999
## by Veronica Pazos
######################

######################
## Liege: Arrival event
## 2000
## by Veronica Pazos
######################

cultural_festival.2000 = {
	type = activity_event
	title = cultural_festival.2000.t
	desc = { 
		desc = cultural_festival.2000.desc.intro
		random_valid = {
			triggered_desc = {
				trigger = {
					NOT = {
						is_target_in_variable_list = {
							name = visited_cultural_festival_province_var
							target = scope:cultural_festival_scope
						}
					}
					has_relation_lover = scope:stop_host_scope
				}
				desc = cultural_festival.2000.desc.first_time_lovers
			}
			triggered_desc = {
				trigger = {
					NOT = {
						is_target_in_variable_list = {
							name = visited_cultural_festival_province_var
							target = scope:cultural_festival_scope
						}
					}
					has_relation_rival = scope:stop_host_scope
				}
				desc = cultural_festival.2000.desc.first_time_rivals
			}
			triggered_desc = {
				trigger = {
					NOT = { 
						is_target_in_variable_list = {
							name = visited_cultural_festival_province_var
							target = scope:cultural_festival_scope
						}
					}
					opinion = {
						target = scope:stop_host_scope
						value >= -10
					}
					opinion = {
						target = scope:stop_host_scope
						value <= 15
					}
				}
				desc = cultural_festival.2000.desc.first_time_neutral
			}
			triggered_desc = {
				trigger = {
					NOT = {
						is_target_in_variable_list = {
							name = visited_cultural_festival_province_var
							target = scope:cultural_festival_scope
						}
					}
					OR = {
						opinion = {
							target = scope:stop_host_scope
							value > 15
						}
						has_any_good_relationship_with_character_trigger = { CHARACTER = scope:stop_host_scope }
					}
				}
				desc = cultural_festival.2000.desc.first_time_good
			}
			triggered_desc = {
				trigger = {
					NOT = {
						is_target_in_variable_list = {
							name = visited_cultural_festival_province_var
							target = scope:cultural_festival_scope
						}
					}
					opinion = {
						target = scope:stop_host_scope
						value < -10
					}
				}
				desc = cultural_festival.2000.desc.first_time_bad
			}
			triggered_desc = {
				trigger = {
					is_target_in_variable_list = {
						name = visited_cultural_festival_province_var
						target = scope:cultural_festival_scope
					}
					has_relation_lover = scope:stop_host_scope
				}
				desc = cultural_festival.2000.desc.again_lovers
			}
			triggered_desc = {
				trigger = {
					is_target_in_variable_list = {
						name = visited_cultural_festival_province_var
						target = scope:cultural_festival_scope
					}
					has_relation_rival = scope:stop_host_scope
				}
				desc = cultural_festival.2000.desc.again_rivals
			}
			triggered_desc = {
				trigger = {
					is_target_in_variable_list = {
						name = visited_cultural_festival_province_var
						target = scope:cultural_festival_scope
					}
					OR = {
						opinion = {
							target = scope:stop_host_scope
							value > 15
						}
						has_any_good_relationship_with_character_trigger = { CHARACTER = scope:stop_host_scope }
					}
				}
				desc = cultural_festival.2000.desc.again_good
			}
			triggered_desc = {
				trigger = {
					is_target_in_variable_list = {
						name = visited_cultural_festival_province_var
						target = scope:cultural_festival_scope
					}
					opinion = {
						target = scope:stop_host_scope
						value >= -10
					}
					opinion = {
						target = scope:stop_host_scope
						value <= 15
					}
				}
				desc = cultural_festival.2000.desc.again_neutral
			}
			triggered_desc = {
				trigger = {
					is_target_in_variable_list = {
						name = visited_cultural_festival_province_var
						target = scope:cultural_festival_scope
					}
					opinion = {
						target = scope:stop_host_scope
						value < -10
					}
				}
				desc = cultural_festival.2000.desc.again_bad
			}
		}
		random_valid = {
			triggered_desc = {
				trigger = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = tour_type_majesty
						}
					}
				}
				desc = cultural_festival.2000.desc.majesty
			}
			triggered_desc = {
				trigger = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = tour_type_intimidation
						}
					}
				}
				desc = cultural_festival.2000.desc.intimidation
			}
			triggered_desc = {
				trigger = {
					is_target_in_variable_list = {
						name = visited_cultural_festival_province_var
						target = scope:cultural_festival_scope
					}
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = tour_type_intimidation
						}
					}
				}
				desc = cultural_festival.2000.desc.again_intimidation
			}
			triggered_desc = {
				trigger = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = tour_type_taxation
						}
					}
				}
				desc = cultural_festival.2000.desc.taxation
			}
		}
	}
	
	theme = tour_arrival
	window = tour_arrival_event
	
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				has_relation_lover = scope:stop_host_scope
			}
			animation = flirtation_left
		}
		triggered_animation = {
			trigger = {
				OR = {
					opinion = {
						target = scope:stop_host_scope
						value > 15
					}
					has_any_good_relationship_with_character_trigger = { CHARACTER = scope:stop_host_scope }
				}
			}
			animation = ecstasy
		}
		triggered_animation = {
			trigger = {
				OR = {
					opinion = {
						target = scope:stop_host_scope
						value < -10
					}
					has_relation_rival = scope:stop_host_scope
				}
			}
			animation = dismissal
		}
		triggered_animation = {
			trigger = {
				OR = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = tour_type_taxation
						}
					}
					has_trait = ambitious
					has_trait = greedy
					has_trait = avaricious
				}
			}
			animation = dismissal
		}
		triggered_animation = {
			trigger = {
				OR = {
					scope:activity = {
						has_activity_option = {
							category = special_type
							option = tour_type_intimidation
						}
					}
					has_trait = callous
					has_trait = sadistic
					dread >= high_dread
				}
			}
			animation = personality_vengeful
		}
		animation = personality_rational
	}
	right_portrait = {
		character = scope:stop_host_scope
		triggered_animation = {
			trigger = {
				has_relation_lover = scope:stop_host_scope
			}
			animation = flirtation
		}
		triggered_animation = {
			trigger = {
				scope:stop_host_scope = {
					opinion = {
						target = scope:stop_host_scope
						value > 15
					}
					has_any_good_relationship_with_character_trigger = { CHARACTER = root }
				}
			}
			animation = happiness
		}
		triggered_animation = {
			trigger = {
				scope:stop_host_scope = {
					OR = {
						opinion = {
							target = scope:stop_host_scope
							value < -10
						}
						has_relation_rival = root
					}
				}
			}
			animation = boredom
		}
		animation = personality_honorable
	}

	immediate = {
		if = {
			limit = {
				root.location.county.holder = {
					OR = {
						has_relation_friend = root
						opinion = {
							target = root
							value >= low_positive_opinion
						}
					}
				}
			}
			play_arrival_music_effect = {
				WELCOME_LEVEL = welcome
			}
		}
		else = {
			play_arrival_music_effect = {
				WELCOME_LEVEL = neutral
			}
		}
	}
	
	option = {
		name = cultural_festival.2000.a 
		custom_tooltip = cultural_festival_begins_tt
		if = {
			limit = {
				root.culture != root.location.culture
			}
			culture = {
				change_cultural_acceptance = {
					target = root.location.culture
					value = minor_cultural_acceptance_gain
					desc = cultural_acceptance_embraced_festival
				}
			}
		}
		else = {
			root.location.county = {
				add_county_modifier = {
					modifier = recent_cultural_festival
					years = 20
				}
			}
		}
		tour_generic_arrival_effect = yes
	}
	
	after = {
		add_to_variable_list = {
			name = visited_cultural_festival_province_var
			target = scope:cultural_festival_scope
		}
	}
}

######################
## Liege: Performer messes up in front of you, gets injured
## 2001
## by Veronica Pazos
######################

scripted_trigger cultural_festival_2001_has_wrathful_trait = {
	OR = {
		has_trait = callous
		has_trait = sadistic
		has_trait = wrathful
	}
}

cultural_festival.2001 = {
	type = activity_event
	title = cultural_festival.2001.t
	desc = {
		desc = cultural_festival.2001.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					has_variable = child_in_disguise_var
				}
				desc = cultural_festival.2001.desc.child
			}
			triggered_desc = {
				trigger = {
					NOT = { has_variable = child_in_disguise_var }
				}
				desc = cultural_festival.2001.desc.normal
			}
		}
	}

	theme = cultural_festival
	cooldown = { years = 2 }
	
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				cultural_festival_2001_has_wrathful_trait = yes
			}
			animation = schadenfreude
		}
		animation = shock
	}
	right_portrait = {
		character = scope:injured_artist
		animation = pain
	}
	
	trigger = {
		#triggered in the on_action 
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		location = { save_scope_as = injured_artist_location }
		random_list = {
			35 = {
				trigger = { # if host has a child there's a tiny chance they'll be the artist
					scope:stop_host_scope = {
						any_child = { is_available_ai_adult = yes }
					}
				}
				set_variable = child_in_disguise_var
				scope:stop_host_scope = {
					random_child = {
						limit = { is_available_ai_adult = yes }
						increase_wounds_effect = { REASON = fall }
						save_scope_as = injured_artist
					}
				}
			}
			65 = {
				create_character = {
					gender_female_chance = 50
					culture = location.culture
					faith = location.faith
					random_traits = yes
					dynasty = none
					age = { 18 50 }
					employer = scope:stop_host_scope
					save_scope_as = injured_artist
					after_creation = {
						increase_wounds_effect = { REASON = fall }
					}
				}
			}
		}
	}

	option = { # So unfortunate
		name = cultural_festival.2001.a
		stress_impact = {
			compassionate = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = forgiving
				}
			}
		}
	}

	option = { # Help them!
		name = cultural_festival.2001.b
		remove_short_term_gold = tiny_gold_value
		scope:cultural_festival_scope = {
			add_county_modifier = {
				modifier = festival_helped_injured_artist_modifier
				years = 5
			}
		}
		if = {
			limit = { has_variable = child_in_disguise_var }
			scope:stop_host_scope = {
				add_opinion = {
					target = root
					modifier = grateful_opinion
					opinion = 20
				}
			}
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_majesty
					}
				}
			}
			increase_tour_success_effect = { POINTS = 1 }
		}
		hidden_effect = {
			trigger_event = {
				id = cultural_festival.2002
				days = { 10 15 }
			}
		}
		stress_impact = {
			arrogant = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			sadistic = medium_stress_impact_gain
			callous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				OR = {
					has_trait = arrogant
					has_trait = sadistic
					has_trait = callous
					has_trait = wrathful
				}
			}
		}
	}
	
	option = { # Have them whipped
		name = cultural_festival.2001.c
		trigger = {
			cultural_festival_2001_has_wrathful_trait = yes
		}
		add_dread = medium_dread_gain
		scope:injured_artist = {
			increase_wounds_effect = { REASON = whipping }
		}
		scope:cultural_festival_scope = {
			add_county_modifier = {
				modifier = festival_whipped_injured_artist_modifier
				years = 5
			}
		}
		if = {
			limit = { has_variable = child_in_disguise_var }
			scope:stop_host_scope = {
				progress_towards_rival_effect = {
					CHARACTER = root
					REASON = rival_whipped_my_kid
					OPINION = -30
				}
			}
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_intimidation
					}
				}
			}
			increase_tour_success_effect = { POINTS = 1 }
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_majesty
					}
				}
			}
			decrease_tour_success_effect = { POINTS = 1 }
		}
		stress_impact = {
			gregarious = minor_stress_impact_gain
			compassionate = medium_stress_impact_gain
			just = medium_stress_impact_gain
			calm = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				OR = {
					has_trait = arrogant
					has_trait = sadistic
					has_trait = callous
					has_trait = wrathful
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = just
					has_trait = calm
					has_trait = forgiving
				}
			}
		}
	}
}

# Follow up: The person gives you a reward for your kindness

scripted_trigger cultural_festival_2002_valid_secret_owner = {
	is_adult = yes
	is_ai = yes
	this != ROOT
	any_secret = {
		exists = this
		NOT = { is_known_by = root }
	}
}

cultural_festival.2002 = {
	type = activity_event
	title = cultural_festival.2002.t
	desc = {
		desc = cultural_festival.2002.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = var:secret_var
				}
				desc = cultural_festival.2002.desc.secret
			}
			triggered_desc = {
				trigger = {
					exists = var:hunting_var
				}
				desc = cultural_festival.2002.desc.hunting
			}
			triggered_desc = {
				trigger = {
					exists = var:savings_var
				}
				desc = cultural_festival.2002.desc.savings
			}
		}
	}

	theme = cultural_festival
	
	override_background = { reference = market }
	
	left_portrait = {
		character = root
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:injured_artist
		animation = beg
	}
	lower_center_portrait = {
		trigger = { has_variable = secret_var }
		character = scope:secret_target
	}
	
	trigger = {
		location = scope:injured_artist_location #you haven't left for the next stop
	}

	weight_multiplier = {
		base = 1
	}
	
	immediate = {
		random_list = { #we select your reward
			1 = {
				trigger = {	
					scope:activity = {
						any_attending_character = {
							cultural_festival_2002_valid_secret_owner = yes
						}
					}
				}
				set_variable = secret_var
			}
			1 = { set_variable = hunting_var }
			1 = { set_variable = savings_var }
		}
		
		if = { #we get the secret scopes
			limit = { has_variable = secret_var }
			scope:activity = {
				random_attending_character = {
					limit = { cultural_festival_2002_valid_secret_owner = yes }
					save_scope_as = secret_target
					random_secret = {
						limit = { NOT = { is_known_by = root } }
						save_scope_as = secret_secret
					}
				}
			}
		}
	}

	option = { # Thanks!
		name = cultural_festival.2002.a
		if = {
			limit = { has_variable = secret_var }
			scope:secret_secret = { reveal_to = root }
		}
		else_if = {
			limit = { has_variable = hunting_var }
			add_character_modifier = { #skirmishers_damage_mult
				modifier = terrain_knowledge_modifier
				years = 10
			}
		}
		else = {
			add_treasury_or_gold = {
				value = minor_treasury_or_gold_value
				max = 10
			}
		}
		stress_impact = {
			compassionate = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = forgiving
				}
			}
		}
	}

	option = { # I can't accept this
		name = cultural_festival.2002.b
		add_piety = medium_piety_gain
		stress_impact = {
			arrogant = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			sadistic = medium_stress_impact_gain
			callous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				OR = {
					has_trait = arrogant
					has_trait = sadistic
					has_trait = callous
					has_trait = wrathful
				}
			}
		}
	}
	
	after = {
		remove_variable = secret_var
		remove_variable = hunting_var
		remove_variable = savings_var
	}
}

######################
## Liege: You're being crowned the Ugliest/Prettiest person
## 2010
## by Veronica Pazos
######################

cultural_festival.2010 = {
	type = activity_event
	title = cultural_festival.2010.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_conventionally_ugly_trigger = yes
				}
				desc = cultural_festival.2010.desc_bad
			}
			triggered_desc = {
				trigger = {
					has_conventionally_attractive_trigger = yes
				}
				desc = cultural_festival.2010.desc_good
			}
		}
	}

	theme = cultural_festival
	cooldown = { years = 2 }
	
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				has_conventionally_ugly_trigger = yes
				OR = {
					has_trait = arrogant
					has_trait = wrathful
					has_trait = vengeful
					has_trait = callous
					has_trait = sadistic
				}
			}
			animation = rage
		}
		triggered_animation = {
			trigger = {
				has_conventionally_ugly_trigger = yes
				NOR = {
					has_trait = arrogant
					has_trait = wrathful
					has_trait = vengeful
					has_trait = callous
					has_trait = sadistic
				}
			}
			animation = grief
		}
		animation = ecstasy
	}
	right_portrait = {
		character = scope:stop_host_scope
		triggered_animation = {
			trigger = {
				has_conventionally_ugly_trigger = yes
			}
			animation = schadenfreude
		}
		animation = happiness
	}

	trigger = {
		is_landed_or_landless_administrative = yes
		NOT = { has_variable = was_monarch_good_bad_var }
		OR = {
			AND = {
				has_conventionally_attractive_trigger = yes #you're pretty
				scope:stop_host_scope = { #and the host doesn't hate you
					NOT = { has_relation_rival = root }
				}
			}
			AND = {
				has_conventionally_ugly_trigger = yes #or not pretty
				scope:stop_host_scope = { #and the host has something against you
					OR = {
						has_relation_rival = root
						has_relation_potential_rival = root
						AND = {
							has_hook_of_type = {
								target = root
								type = weak_blackmail_hook
							}
							opinion = {
								target = root
								value >= medium_negative_opinion
							}
						}
						has_hook_of_type = {
							target = root
							type = strong_blackmail_hook
						}
					}
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			scope:stop_host_scope = {
				has_relation_soulmate = root
			}
		}
		modifier = {
			factor = 2
			scope:stop_host_scope = {
				has_relation_nemesis = root
			}
		}
		modifier = {
			factor = 1.5
			scope:stop_host_scope = {
				has_relation_lover = root
			}
		}
		modifier = {
			factor = 1.5
			OR = {
				has_trait = arrogant #more likely to happen if you care about this stuff
				has_trait = gregarious
			}
		}
		modifier = {
			factor = 0.5
			OR = {
				has_trait = humble #less likely to happen if you don't like this
				has_trait = shy
			}
		}
	}

	immediate = {
		set_variable = was_monarch_good_bad_var #so you don't get the same event again
	}

	option = { # you're the king/queen of beauty - yass king/queen
		name = cultural_festival.2010.a
		trigger = {
			has_conventionally_attractive_trigger = yes
		}
		scope:activity = {
			add_activity_log_entry = {
				key = crowned_monarch_of_beauty_log
				tags = { good }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				root = {
					if = {
						limit = { is_male = yes }
						give_nickname = nick_monarch_of_beauty_and_noblesse_masc
					}
					else = {
						give_nickname = nick_monarch_of_beauty_and_noblesse
					}
					scope:cultural_festival_scope = {
						add_county_modifier = {
							modifier = king_of_beauty_modifier
							years = 5
						}
					}
					if = {
						limit = {
							scope:activity = {
								has_activity_option = {
									category = special_type
									option = tour_type_majesty
								}
							}
						}
						increase_tour_success_effect = { POINTS = 1 }
					}
				}
			}
		}
		stress_impact = {
			base = minor_stress_impact_loss
			arrogant = minor_stress_impact_loss #you like this even more!
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
			}
		}
	}

	option = { # you're king/queen of the homely - sigh
		name = cultural_festival.2010.b
		trigger = {
			has_conventionally_ugly_trigger = yes
		}
		scope:activity = {
			add_activity_log_entry = {
				key = crowned_monarch_of_ugly_log
				tags = { bad }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				root = {
					if = {
						limit = { is_male = yes }
						give_nickname = nick_monarch_of_grim_and_grievance_masc
					}
					else = {
						give_nickname = nick_monarch_of_grim_and_grievance
					}
					add_opinion = {
						target = scope:stop_host_scope
						modifier = insult_opinion
						opinion = -50
					}
				}
			}
		}
		stress_impact = {
			base = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			vengeful = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				
			}
		}
	}
	
	option = { #you're the king/queen of the homely - rage
		name = cultural_festival.2010.c
		trigger = {
			has_conventionally_ugly_trigger = yes
		}
		scope:activity = {
			add_activity_log_entry = {
				key = crowned_monarch_of_ugly_log
				tags = { bad }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				root = {
					if = {
						limit = { has_relation_nemesis = scope:stop_host_scope }
						add_opinion = {
							target = scope:stop_host_scope
							modifier = insult_opinion
							opinion = -50
						}
					}
					else_if = {
						limit = { has_relation_rival = scope:stop_host_scope }
						set_relation_nemesis = { #this is bad enough to make you nemesis
							target = scope:stop_host_scope
							copy_reason = rival
							reason = nemesis_monarch_of_grim_and_grievance
						}
					}
					else = {
						progress_towards_rival_effect = {
							CHARACTER = scope:stop_host_scope
							REASON = rival_king_of_ugly
							OPINION = -10
						}
					}
					scope:cultural_festival_scope = {
						add_county_modifier = {
							modifier = king_of_ugly_modifier
							years = 5
						}
					}
				}
			}
		}
		duel = {
			skill = prowess
			target = scope:stop_host_scope
			50 = { #you win
				desc = cultural_festival.2010.c.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				send_interface_toast = {
					title = cultural_festival.2010.c.success
					left_icon = root
					right_icon = scope:stop_host_scope
					scope:stop_host_scope = {
						increase_wounds_effect = {
							REASON = fight
						}
					}
					if = {
						limit = {
							scope:activity = {
								has_activity_option = {
									category = special_type
									option = tour_type_intimidation
								}
							}
						}
						increase_tour_success_effect = { POINTS = 1 }
					}
				}
			}
			50 = {
				desc = cultural_festival.2010.c.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				send_interface_toast = {
					title = cultural_festival.2010.c.failure
					left_icon = root
					increase_wounds_effect = {
						REASON = fight
					}
				}
			}
		}
		stress_impact = {
			content = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
			calm = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = content
					has_trait = forgiving
					has_trait = calm
				}
			}
		}
	}
}

######################
## Liege: You enjoy a cultural demonstration
## 2020
## by Veronica Pazos
######################

cultural_festival.2020 = {
	type = activity_event
	title = cultural_festival.2020.t
	desc = {
		desc = cultural_festival.2020.desc.intro
		first_valid = {
			triggered_desc = { #Christmas
				trigger = {
					OR = {
						location.faith.religion = religion:eastern_orthodox_religion 
						location.faith.religion = religion:catholic_religion 
						location.faith.religion = religion:protestant_religion 
					}
					OR = { #we take the broader Christmaside season
						current_month = 11
						current_month = 12
						current_month = 1
					}						
				}
				desc = cultural_festival.2020.desc.christmas
			}
			triggered_desc = { #Eid al-Fitr
				trigger = {
					location.faith.religion = religion:islam_religion
					OR = {
						current_month = 3
						current_month = 4
						current_month = 5
					}
				}
				desc = cultural_festival.2020.desc.eid
			}
			triggered_desc = { #Midsommar
				trigger = {
					root.culture = { NOT = { has_cultural_pillar = heritage_north_germanic } }
					location.culture = { has_cultural_pillar = heritage_north_germanic }
					OR = {
						current_month = 5
						current_month = 6
						current_month = 7
						current_month = 8
					}
				}
				desc = cultural_festival.2020.desc.midsommar
			}
			triggered_desc = { #Regular Summer Solstice
				trigger = {
					NOT = {
						location.culture = { has_cultural_pillar = heritage_north_germanic }
					}
					OR = {
						current_month = 5
						current_month = 6
						current_month = 7
						current_month = 8
					}
				}
				desc = cultural_festival.2020.desc.summer_solstice
			}
			triggered_desc = { #Harvest Festival
				trigger = {
					OR = {
						current_month = 9
						current_month = 10
						current_month = 11
					}
				}
				desc = cultural_festival.2020.desc.harvest
			}
			desc = cultural_festival.2020.desc.generic
		}
	}

	theme = cultural_festival
	
	left_portrait = {
		character = root
		animation = ecstasy
	}
	right_portrait = {
		character = scope:stop_host_scope
		animation = personality_forgiving
	}
	
	cooldown = { years = 2 }

	trigger = {
		is_landed_or_landless_administrative = yes
		location.culture = { NOT = { has_variable = cultural_festival_culture_var } } #you haven't seen this festival in a while
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			involved_activity = {
				has_activity_option = {
					category = special_type
					option = tour_type_majesty
				}
			}
		}
	}

	immediate = {
		location.culture = {
			set_variable = {
				name = cultural_festival_culture_var
				days = 1825 # 5 years
			}
			save_scope_as = festival_culture_scope
		}
	}

	option = { # I love this culture!
		name = cultural_festival.2020.a
		if = {
			limit = {
				location.culture != root.culture #they're not of your same culture
			}
			culture = {
				change_cultural_acceptance = {
					target = scope:festival_culture_scope
					value = major_cultural_acceptance_gain
					desc = cultural_acceptance_embraced_festival
				}
			}
		}
		else = {
			scope:cultural_festival_scope = {
				add_county_modifier = {
					modifier = enjoyed_culture_modifier
					years = 10
				}
			}
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_majesty
					}
				}
			}
			increase_tour_success_effect = { POINTS = 1 }
		}
		stress_impact = {
			lifestyle_reveler = minor_stress_impact_gain
			drunkard = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = lifestyle_reveler
					has_trait = drunkard
					has_trait = stubborn
				}
			}
		}
	}

	option = { # I like the festival itself
		name = {
			trigger = {
				drinks_alcohol_trigger = yes
				is_adult = yes
				scope:stop_host_scope = {
					drinks_alcohol_trigger = yes
				}
			}
			text = cultural_festival.2020.b.drink
		}
		name = {
			trigger = {
				OR = {
					drinks_alcohol_trigger = no
					AND = {
						drinks_alcohol_trigger = yes
						scope:stop_host_scope = {
							drinks_alcohol_trigger = no
						}
					}
				}
			}
			text = cultural_festival.2020.b.no_drink
		}
		add_character_modifier = { #stress gain -
			modifier = festival_tis_the_season
			years = 10
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_majesty
					}
				}
			}
			increase_tour_success_effect = { POINTS = 1 }
		}
		stress_impact = {
			base = major_stress_impact_loss
			lifestyle_reveler = minor_stress_impact_loss
			drunkard = minor_stress_impact_loss
			callous = minor_stress_impact_gain
			temperate = minor_stress_impact_gain
			content = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				OR = {
					has_trait = callous
					has_trait = temperate
					has_trait = content
				}
			}
		}
	}
}

######################
## Liege: Taxes?
## 2030
## by Veronica Pazos
######################

cultural_festival.2030 = {
	type = activity_event
	title = cultural_festival.2030.t
	desc = cultural_festival.2030.desc

	theme = cultural_festival
	cooldown = { years = 2 }
	
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = greedy
					has_trait = avaricious
				}
			}
			animation = personality_greedy
		}
		animation = personality_rational
	}
	right_portrait = {
		character = scope:stop_host_scope
		animation = worry
	}

	trigger = {
		is_landed_or_landless_administrative = yes
		location.county ?= {
			development_level >= bad_development_level
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			location.county = { development_level >= medium_development_level }
		}
	}

	option = { # Tax the people
		name = cultural_festival.2030.a
		add_treasury_or_gold = medium_treasury_or_gold_value
		scope:cultural_festival_scope = {
			add_county_modifier = {
				modifier = festival_taxation_modifier
				years = 5
			}
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_taxation
					}
				}
			}
			increase_tour_success_effect = { POINTS = 2 }
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_majesty
					}
				}
			}
			decrease_tour_success_effect = { POINTS = 1 }
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
			generous = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = forgiving
					has_trait = generous
				}
			}
		}
	}

	option = { # Let them go
		name = cultural_festival.2030.b
		scope:cultural_festival_scope = {
			add_county_modifier = {
				modifier = no_taxation_modifier
				years = 5
			}
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_majesty
					}
				}
			}
			increase_tour_success_effect = { POINTS = 1 }
		}
		stress_impact = {
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
			greedy = medium_stress_impact_gain
			avaricious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = callous
					has_trait = sadistic
					has_trait = greedy
					has_trait = avaricious
				}
			}
		}
	}
	
	option = { # Tax them MORE
		name = cultural_festival.2030.c
		trigger = {
			OR = {
				has_trait = greedy
				has_trait = avaricious
			}
		}
		add_treasury_or_gold = major_treasury_or_gold_value
		location.county = {
			change_development_level = -1
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_taxation
					}
				}
			}
			increase_tour_success_effect = { POINTS = 2 }
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
			generous = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				OR = {
					has_trait = greedy
					has_trait = avaricious
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = forgiving
					has_trait = just
					has_trait = generous
				}
			}
		}
	}
}

######################
## Liege: You're horrified by this (lack of) culture
## 2040
## by Veronica Pazos
######################

cultural_festival.2040 = {
	type = activity_event
	title = cultural_festival.2040.t
	desc = cultural_festival.2040.desc

	theme = cultural_festival
	cooldown = { years = 2 }
	
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:stop_host_scope
		animation = worry
	}

	trigger = {
		is_landed_or_landless_administrative = yes
		is_available_in_activity_trigger = yes
		location.county.culture != root.culture #this is not your culture
		exists = root.capital_county
		location = {
			county = {
				culture != root.capital_county.culture #this is not the capital's culture
			}
		}
	}
	
	immediate = {
		location.county.culture = { save_scope_as = festival_culture_scope }
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			root.culture = {
				cultural_acceptance = {
					target = scope:stop_host_scope.culture
					value < hybridization_threshold_value
				}
			}
		}
	}

	option = { # This is AWFUL
		name = cultural_festival.2040.a
		if = {
			limit = {
				location.culture != root.culture
			}
			culture = {
				change_cultural_acceptance = {
					target = scope:festival_culture_scope
					value = minor_cultural_acceptance_loss
					desc = cultural_acceptance_insulted_festival
				}
			}
		}
		else = {
			scope:cultural_festival_scope = {
				add_county_modifier = {
					modifier = no_culture_modifier
					years = 10
				}
			}
		}
		scope:cultural_festival_scope = {
			add_county_modifier = {
				modifier = helped_culture_modifier
				years = 5
			}
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_intimidation
					}
				}
			}
			increase_tour_success_effect = { POINTS = 1 }
		}
		stress_impact = {
			compassionate = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = gregarious
					has_trait = humble
				}
			}
		}
	}

	option = { # It's not that bad
		name = cultural_festival.2040.b
		if = {
			limit = {
				location.culture != root.culture
			}
			culture = {
				change_cultural_acceptance = {
					target = scope:festival_culture_scope
					value = minor_cultural_acceptance_gain
					desc = cultural_acceptance_embraced_festival
				}
			}
		}
		else = {
			scope:cultural_festival_scope = {
				add_county_modifier = {
					modifier = appreciated_culture_modifier
					years = 5
				}
			}
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_majesty
					}
				}
			}
			increase_tour_success_effect = { POINTS = 1 }
		}
		stress_impact = {
			zealous = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = zealous
					has_trait = callous
					has_trait = arrogant
				}
			}
		}
	}
	
	option = { # I'll show them what a good culture actually looks like
		name = cultural_festival.2040.c 
		trigger = {
			has_trait = arrogant
		}
		duel = {
			skill = diplomacy
			value = average_skill_level
			50 = {
				desc = cultural_festival.2040.c.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				send_interface_toast = {
					title = cultural_festival.2040.c.success
					left_icon = root
					if = {
						limit = {
							location.culture != root.culture
						}
						culture = {
							change_cultural_acceptance = {
								target = scope:festival_culture_scope
								value = minor_cultural_acceptance_gain
								desc = cultural_acceptance_insulted_festival
							}
						}
					}
					add_prestige = minor_prestige_gain
					if = {
						limit = {
							scope:activity = {
								has_activity_option = {
									category = special_type
									option = tour_type_majesty
								}
							}
						}
						increase_tour_success_effect = { POINTS = 1 }
					}
					if = {
						limit = {
							scope:activity = {
								has_activity_option = {
									category = special_type
									option = tour_type_intimidation
								}
							}
						}
						increase_tour_success_effect = { POINTS = 1 }
					}
				}
			}
			50 = {
				desc = cultural_festival.2040.c.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				send_interface_toast = {
					title = cultural_festival.2040.c.failure
					left_icon = root
					add_prestige = medium_prestige_loss
				}
			}
		}
		stress_impact = {
			gregarious = minor_stress_impact_gain
			temperate = minor_stress_impact_gain
			shy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				has_trait = arrogant
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = gregarious
					has_trait = temperate
					has_trait = shy
				}
			}
		}
	}
}

######################
## Liege: Local dance is too scandalous for you
## 2050
## by Veronica Pazos
######################

scripted_trigger cultural_festival_2050_scandalous_trigger = {
	culture = { NOT = { has_cultural_tradition = tradition_modest } } #they need to not be modest AND
	NOR = { #their liege is into this
		has_trait = chaste
		has_trait = celibate
	}
	OR = {
		faith = { #there are many ways you can be scandalous
			OR = {
				has_doctrine_parameter = naked_adherents_active
				has_doctrine_parameter = deviancy_accepted
				NOT = { trait_is_sin = lustful }
				trait_is_sin = chaste
				trait_is_sin = celibate
			}
		}
	}
}

scripted_trigger cultural_festival_2050_modest_trigger = {
	faith = { trait_is_sin = lustful } #this is a sin
	OR = {
		culture = { has_cultural_tradition = tradition_modest } #you can just be modest
		faith = { #or you don't have these tenets
			NOR = {
				has_doctrine_parameter = naked_adherents_active
				has_doctrine_parameter = deviancy_accepted
			}
		}
	}
}

cultural_festival.2050 = {
	type = activity_event
	title = cultural_festival.2050.t
	desc = {
		desc = cultural_festival.2050.desc_intro
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_trait = lustful
						has_trait = deviant
					}
				}
				desc = cultural_festival.2050.desc_lustful
			}
			triggered_desc = {
				trigger = {
					NOR = {
						has_trait = lustful
						has_trait = deviant
					}
				}
				desc = cultural_festival.2050.desc_fallback
			}
		}
		desc = cultural_festival.2050.desc_outro
	}

	theme = cultural_festival
	cooldown = { years = 2 }
	
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:stop_host_scope
		animation = ecstasy
	}

	trigger = {
		is_landed_or_landless_administrative = yes
		is_available_in_activity_trigger = yes
		location != root.capital_county.title_province #this is not happening in your capital
		scope:stop_host_scope = {
			cultural_festival_2050_scandalous_trigger = yes #they're scandalous
		}
		cultural_festival_2050_modest_trigger = yes #you're not
		# Probably best not for kids to be involved in this event at all
		scope:stop_host_scope = { is_adult = yes }
		scope:visiting_liege = { is_adult = yes }
	}
	
	immediate = {
		location.culture ?= { save_scope_as = festival_culture_scope }
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			OR = {
				has_trait = lustful
				scope:stop_host_scope = {
					OR = {
						has_trait = lustful
						has_trait = deviant
					}
				}
			}
		}
	}

	option = { # OH MY GOD
		name = cultural_festival.2050.a
		scope:activity = {
			add_activity_log_entry = {
				key = culture_shock_log
				tags = { bad }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				root = {
					culture = { #Decrease
						change_cultural_acceptance = {
							target = scope:festival_culture_scope
							value = minor_cultural_acceptance_loss
							desc = cultural_acceptance_insulted_festival
						}
					}
				}
			}
		}
		stress_impact = {
			lustful = minor_stress_impact_gain
			deviant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				OR = {
					has_trait = chaste
					has_trait = celibate
					has_trait = zealous
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = lustful 
					has_trait = deviant 
				}
			}
		}
	}

	option = { # I shall defend their culture
		name = cultural_festival.2050.b
		scope:activity = {
			add_activity_log_entry = {
				key = culture_exchange_log
				tags = { good }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				root = {
					culture = {
						change_cultural_acceptance = {
							target = scope:festival_culture_scope
							value = medium_cultural_acceptance_gain
							desc = cultural_acceptance_embraced_festival
						}
					}
					add_piety = minor_piety_loss
					if = {
						limit = {
							scope:activity = {
								has_activity_option = {
									category = special_type
									option = tour_type_majesty
								}
							}
						}
						increase_tour_success_effect = { POINTS = 1 }
					}
				}
			}
		}
		stress_impact = {
			shy = minor_stress_impact_gain
			chaste = medium_stress_impact_gain
			celibate = medium_stress_impact_gain
			zealous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = shy
					has_trait = chaste
					has_trait = celibate
					has_trait = zealous
				}
			}
		}
	}
	
	option = { # This is amazing!
		name = cultural_festival.2050.c 
		trigger = {
			has_trait = lustful
			has_trait = deviant
		}
		scope:activity = {
			add_activity_log_entry = {
				key = culture_exchange_log
				tags = { good }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				root = {
					culture = {
						change_cultural_acceptance = {
							target = scope:festival_culture_scope
							value = medium_cultural_acceptance_gain
							desc = cultural_acceptance_embraced_festival
						}
					}
					scope:stop_host_scope = {
						add_opinion = {
							target = root
							modifier = grateful_opinion
							opinion = 35
						}
					}
					add_piety = medium_piety_loss
					if = {
						limit = {
							scope:activity = {
								has_activity_option = {
									category = special_type
									option = tour_type_majesty
								}
							}
						}
						increase_tour_success_effect = { POINTS = 1 }
					}
				}
			}
		}
		stress_impact = {
			shy = medium_stress_impact_gain
			zealous = medium_stress_impact_gain
			chaste = major_stress_impact_gain
			celibate = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				OR = {
					has_trait = lustful
					has_trait = deviant
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = shy
					has_trait = chaste
					has_trait = celibate
					has_trait = zealous
				}
			}
		}
	}
}

######################
## Liege: You bring sophisticated entertainments from the capital
## 2060
## by Veronica Pazos
######################

scripted_trigger cultural_festival_2060_arrogant_trigger = {
	OR = {
		has_trait = arrogant
		has_trait = wrathful
		has_trait = vengeful
		has_trait = sadistic
		has_trait = callous
		has_trait = stubborn
	}
}

cultural_festival.2060 = {
	type = activity_event
	title = cultural_festival.2060.t
	desc = cultural_festival.2060.desc

	theme = cultural_festival
	cooldown = { years = 2 }
	
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:stop_host_scope
		triggered_animation = {
			trigger = {
				scope:stop_host_scope = { cultural_festival_2060_arrogant_trigger = yes }
			}
			animation = dismissal
		}
		animation = ecstasy
	}
	artifact = {
		target = scope:sophisticated_artifact
		position = lower_center_portrait
	}

	trigger = {
		is_landed_or_landless_administrative = yes
		location.county ?= {
			development_level <= bad_development_level
		}
		any_character_artifact = { #you bring something with you
			is_equipped = no
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			location.county = {
				development_level <= terrible_development_level
			}
		}
		modifier = {
			factor = 1.5
			involved_activity = {
				has_activity_option = {
					category = special_type
					option = tour_type_majesty
				}
			}
		}
	}
	
	immediate = {
		random_character_artifact = {
			limit = {
				is_equipped = no
				trigger_if = {
					limit = {
						scope:stop_host_scope = {
							highest_held_title_tier > tier_kingdom #No point in giving a court artifact if this is a character without a court.
						}
					}
					ep1_artifact_is_court_artifact_trigger = no
				}
				rarity = common
			}
			alternative_limit = {
				is_equipped = no
				trigger_if = {
					limit = {
						scope:stop_host_scope = {
							highest_held_title_tier > tier_kingdom #No point in giving a court artifact if this is a character without a court.
						}
					}
					ep1_artifact_is_court_artifact_trigger = no
				}
				rarity = masterwork
			}
			alternative_limit = {
				is_equipped = no
				trigger_if = {
					limit = {
						scope:stop_host_scope = {
							highest_held_title_tier > tier_kingdom #No point in giving a court artifact if this is a character without a court.
						}
					}
					ep1_artifact_is_court_artifact_trigger = no
				}
				rarity = famed
			}
			alternative_limit = {
				is_equipped = no
				trigger_if = {
					limit = {
						scope:stop_host_scope = {
							highest_held_title_tier > tier_kingdom #No point in giving a court artifact if this is a character without a court.
						}
					}
					ep1_artifact_is_court_artifact_trigger = no
				}
			}
			save_scope_as = sophisticated_artifact
		}
		if = {
			limit = {
				scope:stop_host_scope = {
					any_sponsored_inspiration = {
						count > 0
						inspiration_owner.location = root.location
					}
				}
			}
			scope:stop_host_scope = {
				random_sponsored_inspiration = {
					limit = {
						inspiration_owner.location = root.location
					}
					inspiration_owner = {
						save_scope_as = inspired_character
					}
				}
			}
		}
	}

	option = { # Give it to them
		name = cultural_festival.2060.a
		scope:activity = {
			add_activity_log_entry = {
				key = gave_away_artifact_log
				tags = { good }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				artifact = scope:sophisticated_artifact
				root.location.county = {
					change_development_progress = 2
				}
				scope:sophisticated_artifact = {
					set_owner = scope:stop_host_scope
				}
				scope:stop_host_scope = {
					add_opinion = {
						target = root
						modifier = grateful_opinion
						opinion = 15
					}
				}
				if = {
					limit = {
						scope:activity = {
							has_activity_option = {
								category = special_type
								option = tour_type_majesty
							}
						}
					}
					increase_tour_success_effect = { POINTS = 2 }
				}
			}
		}
		stress_impact = {
			callous = minor_stress_impact_gain
			greedy = medium_stress_impact_gain
			avaricious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = callous
				}
			}
		}
	}

	option = { # Ask to have it back
		name = cultural_festival.2060.b
		scope:stop_host_scope = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -15
			}
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_intimidation
					}
				}
			}
			increase_tour_success_effect = { POINTS = 1 }
		}
		stress_impact = {
			compassionate = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
			generous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = gregarious
					has_trait = generous
				}
			}
		}
	}
	
	option = { # Find a local to craft a similar artifact
		name = cultural_festival.2060.c
		trigger = {
			exists = scope:inspired_character
			exists = scope:inspired_character.inspiration
		}
		pay_short_term_gold = {
			target = scope:inspired_character
			gold = minor_gold_value
		}
		location.county = {
			change_development_progress = 2
		}
		scope:inspired_character = {
			inspiration = {
				change_inspiration_progress = 20
			}
		}
		stress_impact = {
			callous = minor_stress_impact_gain
			greedy = medium_stress_impact_gain
			avaricious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = callous
				}
			}
		}
	}
}

######################
## Liege: You encounter a band of mercenaries enjoying the festivities, recruit?
## 2070
## by Veronica Pazos
######################

scripted_trigger cultural_festival_2070_valid_mercenary = {
	is_available_healthy_ai_adult = yes
	prowess >= high_skill_rating
	trigger_if = {
		limit = { #your vassal and you can use these mercenaries
			can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:stop_host_scope }
			can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
		}
		is_female = yes 
	}
	trigger_else = {
		is_female = no
	}
}

cultural_festival.2070 = {
	type = activity_event
	title = cultural_festival.2070.t
	desc = cultural_festival.2070.desc

	theme = cultural_festival
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = deceitful 
					has_trait = disloyal
					has_trait = schemer
				}
			}
			animation = scheme
		}
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = gregarious 
					has_trait = lifestyle_reveler
					has_trait = drunkard
				}
			}
			animation = toast_goblet
		}
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:retired_mercenary
		animation = drink_goblet
	}
	lower_center_portrait = scope:stop_host_scope
	cooldown = { years = 2 }
	
	trigger = {
		location.county ?= { county_control <= medium_county_control }
	}
	
	immediate = {
		#if there's an appropiate pool character pick them
		if = {
			limit = {
				any_pool_character = {
					province = root.location
					cultural_festival_2070_valid_mercenary = yes
				}
			}
			random_pool_character = {
				province = root.location 
				limit = { cultural_festival_2070_valid_mercenary = yes }
				save_scope_as = retired_mercenary
			}
		}
		#otherwise create new character
		else = {
			create_character = {
				template = retired_mercenary
				location = root.location
				culture = root.location.culture
				faith = root.location.faith
				gender_female_chance = root_soldier_female_chance
				dynasty = none 
				save_scope_as = retired_mercenary	
			}
		}
	}
	
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			location.county = { county_control < low_county_control }
		}
	}

	option = { # hire them to keep the area controlled
		name = cultural_festival.2070.a
		pay_short_term_gold = {
			target = scope:retired_mercenary
			gold = minor_gold_value
		}
		add_character_modifier = {
			modifier = festival_hired_mercenaries #county_control
			years = 10
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_intimidation
					}
				}
			}
			increase_tour_success_effect = { POINTS = 1 }
		}
		stress_impact = {
			drunkard = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = drunkard
					has_trait = gregarious
				}
			}
		}
	}
	
	option = { # challenge them to a game, if you win they must serve you for free, if they win you pay them double
		name = cultural_festival.2070.b
		random_list = {
			50 = {
				send_interface_toast = {
					title = cultural_festival.2070.b.success
					left_icon = scope:retired_mercenary
					add_character_modifier = {
						modifier = festival_luck_mercenaries
						years = 10
					}
					if = {
						limit = {
							scope:activity = {
								OR = {
									has_activity_option = {
										category = special_type
										option = tour_type_taxation
									}
									has_activity_option = {
										category = special_type
										option = tour_type_intimidation
									}
								}
							}
						}
						increase_tour_success_effect = { POINTS = 1 }
					}
				}
			}
			50 = {
				send_interface_toast = {
					title = cultural_festival.2070.b.failure
					left_icon = scope:retired_mercenary
					pay_short_term_gold = {
						target = scope:retired_mercenary
						gold = minor_gold_value
					}
				}
			}
		}
		stress_impact = {
			drunkard = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = drunkard
					has_trait = gregarious
				}
			}
		}
	}
	
	option = { # challenge them to a game, if you win they must serve you for free, if they win you pay them double - but you cheat
		name = cultural_festival.2070.c
		trigger = {
			OR = {
				has_trait = deceitful
				has_trait = schemer
			}
		}
		duel = {
			skill = intrigue
			target = scope:retired_mercenary
			70 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 5
				} 
				send_interface_toast = {
					title = cultural_festival.2070.b.success
					left_icon = scope:retired_mercenary
					add_character_modifier = {
						modifier = festival_luck_mercenaries
						years = 10
					}
					if = {
						limit = {
							scope:activity = {
								OR = {
									has_activity_option = {
										category = special_type
										option = tour_type_taxation
									}
									has_activity_option = {
										category = special_type
										option = tour_type_intimidation
									}
								}
							}
						}
						increase_tour_success_effect = { POINTS = 1 }
					}
				}
			}
			30 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -5
				} 
				send_interface_toast = {
					title = cultural_festival.2070.c.failure
					left_icon = scope:retired_mercenary
					pay_short_term_gold = {
						target = scope:retired_mercenary
						gold = minor_gold_value
					}
					#they also beat you up
					increase_wounds_no_death_effect = { REASON = fight }
				}
			}
		}
		stress_impact = {
			drunkard = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
			honest = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = drunkard
					has_trait = gregarious
					has_trait = honest
				}
			}
		}
	}
	
	option = { # have a nice one, gents
		name = cultural_festival.2070.d
		add_character_modifier = {
			modifier = festival_drank_with_mercenaries
			years = 10
		}
		stress_impact = {
			temperate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = temperate
			}
		}
	}
}

######################
## Liege: You encounter a mysterious merchant
## 2080
## by Veronica Pazos
######################

scripted_trigger cultural_festival_2080_merchant = {
	is_ai = yes
	is_adult = yes
	is_landed_or_landless_administrative = no
	is_lowborn = yes
	is_councillor = no
	NOT = { is_courtier_of = root }
	NOR = {
		has_trait = zealous
		has_trait = cynical
	}
}

cultural_festival.2080 = {
	type = activity_event
	title = cultural_festival.2080.t
	desc = cultural_festival.2080.desc

	theme = cultural_festival
	cooldown = { years = 5 }
	
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:mysterious_merchant
		animation = ecstasy
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			has_trait = arbitrary
		}
	}
	
	immediate = {
		if = {
			limit = { 
				any_pool_character = {
					province = root.location
					cultural_festival_2080_merchant = yes
				}
			}
			random_pool_character = {
				province = root.location 
				limit = { cultural_festival_2080_merchant = yes }
				save_scope_as = mysterious_merchant
			}
		}
		else = {
			create_character = {
				template = merchant_template
				location = root.location
				dynasty = none
				faith = root.location.faith
				culture = root.location.culture
				save_scope_as = mysterious_merchant
			}
		}
	}

	option = { # Buy the red liquid
		name = cultural_festival.2080.a
		remove_short_term_gold = 1 #symbolic prize, you're buying one bottle
		custom_tooltip = {
			text = cultural_festival.2080.tt
			random_list = {
				1 = {
					send_interface_toast = {
						left_icon = root
						title = cultural_festival_2080.a.health
						add_character_modifier = festival_2080_red_health
					}
				}
				1 = {
					send_interface_toast = {
						left_icon = root
						title = cultural_festival_2080.a.prowess
						add_character_modifier = festival_2080_red_prowess
					}
				}
				1 = {
					send_interface_toast = {
						left_icon = root
						title = cultural_festival_2080.a.fertility
						add_character_modifier = festival_2080_red_fertility
					}
				}
				1 = {
					send_interface_toast = {
						left_icon = root
						title = cultural_festival_2080.a.prowess_bad
						add_character_modifier = festival_2080_red_prowess_bad
					}
				}
				1 = {
					send_interface_toast = {
						left_icon = root
						title = cultural_festival_2080.a.fertility_bad
						add_character_modifier = festival_2080_red_fertility_bad
					}
				}
			}
		}
		stress_impact = {
			greedy = miniscule_stress_impact_gain
			avaricious = miniscule_stress_impact_gain
			cynical = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
			craven = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 1.25
				has_trait = arbitrary
			}
			modifier = {
				factor = 0.5
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = cynical
				}
			}
			modifier = {
				factor = 0
				OR = {
					gold <= tiny_gold_value
					has_trait = craven
					has_trait = paranoid
				}
			}
		}
	}

	option = { # Buy the green liquid
		name = cultural_festival.2080.b
		remove_short_term_gold = 1
		custom_tooltip = {
			text = cultural_festival.2080.tt
			random_list = {
				1 = {
					send_interface_toast = {
						left_icon = root
						title = cultural_festival_2080.b.health_bad
						add_character_modifier = festival_2080_blue_health_bad
					}
				}
				1 = {
					send_interface_toast = {
						left_icon = root
						title = cultural_festival_2080.b.stress
						add_character_modifier = festival_2080_blue_stress
					}
				}
				1 = {
					send_interface_toast = {
						left_icon = root
						title = cultural_festival_2080.b.stress_bad
						add_character_modifier = festival_2080_blue_stress_bad
					}
				}
				1 = {
					send_interface_toast = {
						left_icon = root
						title = cultural_festival_2080.b.attraction
						add_character_modifier = festival_2080_blue_attraction
					}
				}
				1 = {
					send_interface_toast = {
						left_icon = root
						title = cultural_festival_2080.b.stress_loss
						add_character_modifier = festival_2080_blue_stress_loss
					}
				}
			}
		}
		stress_impact = {
			greedy = miniscule_stress_impact_gain
			avaricious = miniscule_stress_impact_gain
			cynical = minor_stress_impact_gain
			craven = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 1.25
				has_trait = arbitrary
			}
			modifier = {
				factor = 0.5
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = cynical
				}
			}
			modifier = {
				factor = 0
				OR = {
					gold <= tiny_gold_value
					has_trait = craven
					has_trait = paranoid
				}
			}
		}
	}
	
	option = { # Leave
		name = cultural_festival.2080.c
		stress_impact = {
			brave = minor_stress_impact_gain
			trusting = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = brave
					has_trait = trusting
				}
			}
		}
	}
}

######################
## Liege: Make a point of arresting performers on made-up allegations
## 2090
## by Veronica Pazos
######################

scripted_trigger cultural_festival_2090_peasant = {
	is_ai = yes
	is_adult = yes
	is_landed_or_landless_administrative = no
	is_lowborn = yes
	is_councillor = no
	NOT = { is_courtier_of = root }
}

scripted_trigger cultural_festival_2090_faction = {
	exists = yes
	NOT = { exists = faction_war }
	faction_is_type = peasant_faction
	faction_leader ?= {
		location = root.location
	}
}

cultural_festival.2090 = {
	type = activity_event
	title = cultural_festival.2090.t
	desc = cultural_festival.2090.desc

	theme = cultural_festival
	cooldown = { years = 2 }
	
	left_portrait = {
		character = root
		animation = personality_vengeful
	}
	right_portrait = {
		character = scope:arrested_performer
		animation = fear
	}
	lower_right_portrait = {
		trigger = { exists = scope:faction_leader_scope }
		character = scope:faction_leader_scope
	}

	trigger = {
		OR = {
			involved_activity = {
				has_activity_option = {
					category = special_type
					option = tour_type_intimidation
				}
			}
			has_trait = callous
			has_trait = sadistic
			dread >= high_dread
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			involved_activity = {
				has_activity_option = {
					category = special_type
					option = tour_type_intimidation
				}
			}
		}
		modifier = {
			factor = 2
			any_targeting_faction = {
				faction_type = peasant_faction
				exists = yes
				NOT = { exists = faction_war }
			}
		}
	}
	
	immediate = {
		if = {
			limit = {
				any_pool_character = {
					province = root.location
					cultural_festival_2090_peasant = yes
				}
			}
			random_pool_character = {
				province = root.location
				limit = { cultural_festival_2090_peasant = yes }
				save_scope_as = arrested_performer
			}
		}
		else = {
			create_character = {
				template = generic_peasant_character
				location = root.location
				dynasty = none
				culture = root.location.culture
				faith = root.location.faith
				save_scope_as = arrested_performer
			}
		}
		if = {
			limit = {
				any_targeting_faction = {
					cultural_festival_2090_faction = yes
				}
			}
			random_targeting_faction = {
				limit = { cultural_festival_2090_faction = yes }
				save_scope_as = faction_scope
				faction_leader = { save_scope_as = faction_leader_scope }
			}
		}
	}

	option = { # Arrest them
		name = cultural_festival.2090.a
		scope:activity = {
			add_activity_log_entry = {
				key = arrested_performers_log
				tags = { good }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				root = {
					add_dread = medium_dread_gain
					scope:cultural_festival_scope = { #lose popular opinion
						add_county_modifier = {
							modifier = festival_arrested_artists
							years = 5
						}
					}
					if = {
						limit = {
							involved_activity = {
								has_activity_option = {
									category = special_type
									option = tour_type_intimidation
								}
							}
						}
						increase_tour_success_effect = { POINTS = 2 }
					}
					else = {
						increase_tour_success_effect = { POINTS = 1 }
					}
				}
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			avaricious = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = cynical
				}
			}
		}
	}

	option = { # They're actually factioning against you
		name = cultural_festival.2090.b
		trigger = {
			any_targeting_faction = {
				cultural_festival_2090_faction = yes
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = arrested_faction_leader_log
				tags = { good }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				root = {
					rightfully_imprison_character_effect = {
						TARGET = scope:faction_leader_scope
						IMPRISONER = root
					}
					scope:faction_leader_scope = {
						leave_faction_with_cooldown_effect = {
							FACTION = scope:faction_scope
							YEARS = 10
						}
					}
					scope:cultural_festival_scope = { #lose popular opinion
						add_county_modifier = {
							modifier = festival_arrested_artists
							years = 5
						}
					}
					if = {
						limit = {
							involved_activity = {
								has_activity_option = {
									category = special_type
									option = tour_type_intimidation
								}
							}
						}
						increase_tour_success_effect = { POINTS = 2 }
					}
					else = {
						increase_tour_success_effect = { POINTS = 1 }
					}
				}
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			avaricious = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = cynical
				}
			}
		}
	}
	
	option = { # Nahh
		name = cultural_festival.2090.c
		add_dread = minor_dread_loss
		scope:cultural_festival_scope = { #get popular opinion
			add_county_modifier = {
				modifier = festival_no_prisoners
				years = 5
			}
		}
		stress_impact = {
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0.5
				OR = {
					has_trait = callous
					has_trait = sadistic
				}
			}
			modifier = {
				factor = 0
				involved_activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_intimidation
					}
				}
			}
		}
	}
}

######################
## Liege: You see a guild contributing to the festival
## 2100
## by Veronica Pazos
######################

scripted_trigger cultural_festival_2100_courtier = {
	is_ai = yes
	is_adult = yes
	is_courtier_of = root
}

cultural_festival.2100 = {
	type = activity_event
	title = cultural_festival.2100.t
	desc = cultural_festival.2100.desc

	theme = cultural_festival
	cooldown = { years = 2 }
	
	override_background = { reference = market }
	
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:inspired_courtier
		animation = admiration
	}

	trigger = {
		scope:activity = {
			any_attending_character = {
				cultural_festival_2100_courtier = yes 
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			involved_activity = {
				has_activity_option = {
					category = special_type
					option = tour_type_majesty
				}
			}
		}
	}
	
	immediate = {
		location = { save_scope_as = guild_location }
		scope:activity = {
			random_attending_character = {
				limit = { cultural_festival_2100_courtier = yes }
				weight = {
					base = 1
					modifier = {
						add = 5
						has_any_good_relationship_with_root_trigger = yes #someone you potentially care about
					}
					modifier = {
						add = 2
						has_any_high_skill_rating = no #someone we can make useful
					}
					modifier = {
						add = -2
						is_councillor = yes
					}
				}
				save_scope_as = inspired_courtier
			}
		}
	}

	option = { # Support them
		name = cultural_festival.2100.a
		remove_short_term_gold = {
			value = medium_gold_value
			max = 100
		}
		location.county = {
			change_development_progress = medium_development_progress_gain
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			avaricious = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = ambitious
				}
				NOT = { can_make_expensive_purchase_trigger = { PRICE = medium_gold_value } }
			}
		}
	}

	option = { # You get inspired
		name = cultural_festival.2100.b
		add_character_modifier = {
			modifier = discounted_guild_holding_build_cost_modifier
			years = 10
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			avaricious = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = cynical
				}
			}
		}
	}
	
	option = { # Courtier gets inspired
		name = cultural_festival.2100.c
		scope:inspired_courtier = {
			duel = {
				skill = stewardship
				value = high_skill_rating
				50 = { #they get the trait
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
					}
					desc = cultural_festival.2100.c.success
					root = {
						send_interface_toast = {
							title = cultural_festival.2100.c.success
							left_icon = scope:inspired_courtier
							scope:inspired_courtier = { add_trait = architect }
						}
					}
				}
				50 = { #they improve their skills
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
					}
					desc = cultural_festival.2100.c.failure
					root = {
						send_interface_toast = {
							title = cultural_festival.2100.c.failure
							left_icon = scope:inspired_courtier
							scope:inspired_courtier = { add_stewardship_skill = 2 }
						}
					}
				}
			}
		}				
		stress_impact = {
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0.5
				OR = {
					has_trait = callous
					has_trait = sadistic
				}
			}
			modifier = {
				factor = 0
				involved_activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_intimidation
					}
				}
			}
		}
	}
}

######################
## Liege: A puppy disrupts the performance
## 2110
## by Veronica Pazos
######################

cultural_festival.2110 = {
	type = activity_event
	title = cultural_festival.2110.t
	desc = {
		desc = cultural_festival.2110.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_trait = callous
						has_trait = sadistic
					}
				}
				desc = cultural_festival.2110.desc.callous
			}
		}
		desc = cultural_festival.2110.desc.outro
	}

	theme = cultural_festival
	cooldown = { years = 2 }
	
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = callous
					has_trait = sadistic
				}
			}
			animation = dismissal
		}
		animation = personality_compassionate
	}
	lower_right_portrait = {
		trigger = { exists = scope:my_heir }
		character = scope:my_heir
	}

	trigger = {
		NOT = { any_owned_story = { type = story_cycle_pet_dog } }
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			has_trait = compassionate
		}
	}
	
	immediate = {
		if = {
			limit = {
				any_child = {
					is_adult = no
					is_ai = yes
				}
			}
			random_child = {
				limit = {
					is_adult = no
					is_ai = yes
				}
				save_scope_as = my_heir
			}
		}
	}

	option = { # Adopt!!!
		name = cultural_festival.2110.a
		scope:activity = {
			add_activity_log_entry = {
				key = adopted_a_puppy_log
				tags = { good }
				character = scope:visiting_liege
				root = {
					start_dog_story_cycle_effect = yes
				}
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			avaricious = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = ambitious
				}
				NOT = { can_make_expensive_purchase_trigger = { PRICE = medium_gold_value } }
			}
		}
	}

	option = { # Get it for your heir
		name = cultural_festival.2110.b
		trigger = {
			exists = scope:my_heir
		}
		if = {
			limit = {
				NOT = { has_relation_friend = scope:my_heir }
			}
			set_relation_friend = {
				target = scope:my_heir
				reason = friend_festival_puppy
			}
		}
		else = {
			add_opinion = {
				target = scope:my_heir
				modifier = grateful_opinion
				opinion = 20
			}
		}
		scope:my_heir = {
			start_dog_story_cycle_effect = yes
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			avaricious = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = cynical
				}
			}
		}
	}
	
	option = { # Pet the dog! Pet the dog!
		name = cultural_festival.2110.c
		trigger = {
			has_activity_intent = reduce_stress_intent
		}
		custom_tooltip = available_because_intent_tt
		stress_impact = {
			base = major_stress_impact_loss #your reward
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = cynical
				}
			}
		}
	}
	
	option = { # Kick the dog
		name = cultural_festival.2110.d
		custom_tooltip = cultural_festival_2110_d_tt
		trigger = {
			OR = {
				has_trait = callous
				has_trait = sadistic
			}
		}
		scope:activity = {
			every_attending_character = {
				custom = cultural_festival_2110_d_opinion_tt
				limit = {
					NOR = {
						has_trait = callous
						has_trait = sadistic
					}
				}
				add_opinion = {
					target = root
					modifier = cruelty_opinion
					opinion = -5
				}
			}
		}
		random = {
			chance = 10
			increase_wounds_effect = { REASON = wild_animal }
		}
		stress_impact = {
			base = major_stress_impact_loss #your reward
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				OR = {
					has_trait = callous
					has_trait = sadistic
				}
			}
		}
	}
	
	option = { # Ignore
		name = cultural_festival.2110.e
		add_prestige = miniscule_prestige_gain #you maintain your composure
		stress_impact = {
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = avaricious
					has_trait = cynical
				}
			}
		}
	}
}

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

######################
## Bilateral Events
## 3000-3999
## by Veronica Pazos
######################

######################
## Bilateral: Big play based on liege
## 3000-3002
## by Veronica Pazos
######################

# Vassal: Do you want to make a big play based on your visiting liege?
cultural_festival.3000 = {
	type = activity_event
	title = cultural_festival.3000.t
	desc = cultural_festival.3000.desc

	theme = cultural_festival
	left_portrait = {
		character = root
		animation = admiration
	}
	cooldown = { years = 2 }
	
	trigger = {
		is_landed_or_landless_administrative = yes
		is_available_in_activity_trigger = yes
		scope:visiting_liege = {
			can_receieve_good_available_compliment_trigger = yes
		}
	}
	
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			has_trait = lifestyle_poet #you're interested in theatre kinda
		}
	}

	option = { # I sure do!
		name = cultural_festival.3000.a
		custom_tooltip = cultural_festival.3000.a.tt
		remove_treasury_or_gold = medium_treasury_or_gold_value
		trigger_event = { id = cultural_festival.3001 days = 3 } 
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 200
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					short_term_treasury_or_gold < medium_treasury_or_gold_value
				}
			}
		}
	}
	
	option = { # Not really
		name = cultural_festival.3000.b
		stress_impact = {
			generous = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 200
			modifier = {
				factor = 0
				OR = {
					has_trait = generous
					has_trait = gregarious
				}
			}
		}
	}
}

# Vassal: Choose how to depict the liege
cultural_festival.3001 = {
	type = activity_event
	title = cultural_festival.3001.t
	desc = cultural_festival.3001.desc

	theme = cultural_festival
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:liege_actor
		animation = beg
	}
	
	immediate = {
		randomize_available_compliment_effect = { COMPLIMENT_RECEIVER = scope:visiting_liege }
		randomize_available_compliment_effect = { COMPLIMENT_RECEIVER = scope:visiting_liege }
		randomize_good_available_compliment_effect = { COMPLIMENT_RECEIVER = scope:visiting_liege }
		create_character = {
			age = { 20 50 }
			location = root.location
			random_traits = yes
			faith = location.faith
			culture = location.culture
			dynasty = none
			gender_female_chance = {
				if = {
					limit = { scope:visiting_liege = { is_female = yes } }
					add = 100
				}
				else = {
					add = 0
				}
			}
			save_scope_as = liege_actor
		}
	}
	
	#Compassionate
	option = {
		trigger = { has_character_flag = available_compliment_compassionate }
		name = cultural_festival.3001.compassionate
		custom_tooltip = cultural_festival.3001.tt
		hidden_effect = {
			scope:visiting_liege = { evaluate_compliment_effect = { COMPLIMENT_TYPE = compassionate COMPLIMENT_GIVER = root } }
		}
		ai_chance = {
			base = 100
		}
	}

	#bold
	option = {
		trigger = { has_character_flag = available_compliment_bold }
		name = cultural_festival.3001.bold
		custom_tooltip = cultural_festival.3001.tt
		hidden_effect = {
			scope:visiting_liege = { evaluate_compliment_effect = { COMPLIMENT_TYPE = bold COMPLIMENT_GIVER = root } }
		}
		ai_chance = {
			base = 100
		}
	}

	#honorable
	option = {
		trigger = { has_character_flag = available_compliment_honorable }
		name = cultural_festival.3001.honorable
		custom_tooltip = cultural_festival.3001.tt
		hidden_effect = {
			scope:visiting_liege = { evaluate_compliment_effect = { COMPLIMENT_TYPE = honorable COMPLIMENT_GIVER = root } }
		}
		ai_chance = {
			base = 100
		}
	}

	#greed
	option = {
		trigger = { has_character_flag = available_compliment_greedy }
		name = cultural_festival.3001.greed
		custom_tooltip = cultural_festival.3001.tt
		hidden_effect = {
			scope:visiting_liege = { evaluate_compliment_effect = { COMPLIMENT_TYPE = greed COMPLIMENT_GIVER = root } }
		}
		ai_chance = {
			base = 100
		}
	}

	#rational
	option = {
		trigger = { has_character_flag = available_compliment_rational }
		name = cultural_festival.3001.rational
		custom_tooltip = cultural_festival.3001.tt
		hidden_effect = {
			scope:visiting_liege = { evaluate_compliment_effect = { COMPLIMENT_TYPE = rational COMPLIMENT_GIVER = root } }
		}
		ai_chance = {
			base = 100
		}
	}

	#zealous
	option = {
		trigger = { has_character_flag = available_compliment_zealous }
		name = cultural_festival.3001.zealous
		custom_tooltip = cultural_festival.3001.tt
		hidden_effect = {
			scope:visiting_liege = { evaluate_compliment_effect = { COMPLIMENT_TYPE = zealous COMPLIMENT_GIVER = root } }
		}
		ai_chance = {
			base = 100
		}
	}

	#energetic
	option = {
		trigger = { has_character_flag = available_compliment_energetic }
		name = cultural_festival.3001.energetic
		custom_tooltip = cultural_festival.3001.tt
		hidden_effect = {
			scope:visiting_liege = { evaluate_compliment_effect = { COMPLIMENT_TYPE = energetic COMPLIMENT_GIVER = root } }
		}
		ai_chance = {
			base = 100
		}
	}

	#forgiving
	option = {
		trigger = { has_character_flag = available_compliment_forgiving }
		name = cultural_festival.3001.forgiving
		custom_tooltip = cultural_festival.3001.tt
		hidden_effect = {
			scope:visiting_liege = { evaluate_compliment_effect = { COMPLIMENT_TYPE = forgiving COMPLIMENT_GIVER = root } }
		}
		ai_chance = {
			base = 100
		}
	}

	#beautiful
	option = {
		trigger = { has_character_flag = available_compliment_beautiful }
		name = cultural_festival.3001.beautiful
		custom_tooltip = cultural_festival.3001.tt
		hidden_effect = {
			scope:visiting_liege = { evaluate_compliment_effect = { COMPLIMENT_TYPE = beautiful COMPLIMENT_GIVER = root } }
		}
		ai_chance = {
			base = 100
		}
	}

	#strong
	option = {
		trigger = { has_character_flag = available_compliment_strong }
		name = cultural_festival.3001.strong
		custom_tooltip = cultural_festival.3001.tt
		hidden_effect = {
			scope:visiting_liege = { evaluate_compliment_effect = { COMPLIMENT_TYPE = strong COMPLIMENT_GIVER = root } }
		}
		ai_chance = {
			base = 100
		}
	}

	#extroverted
	option = {
		trigger = { has_character_flag = available_compliment_extroverted }
		name = cultural_festival.3001.extroverted
		custom_tooltip = cultural_festival.3001.tt
		hidden_effect = {
			scope:visiting_liege = { evaluate_compliment_effect = { COMPLIMENT_TYPE = extroverted COMPLIMENT_GIVER = root } }
		}
		ai_chance = {
			base = 100
		}
	}

	#dominant
	option = {
		trigger = { has_character_flag = available_compliment_dominant }
		name = cultural_festival.3001.dominant
		custom_tooltip = cultural_festival.3001.tt
		hidden_effect = {
			scope:visiting_liege = { evaluate_compliment_effect = { COMPLIMENT_TYPE = dominant COMPLIMENT_GIVER = root } }
		}
		ai_chance = {
			base = 100
		}
	}

	option = { # Represent them like a buffoon
		name = cultural_festival.3001.negative
		flavor = cultural_festival.3001.negative.flavor
		add_character_modifier = {
			modifier = dressed_liege_like_buffon_modifier
			years = 5
		}
		scope:visiting_liege = { set_variable = buffoon_costume_var }
		stress_impact = {
			craven = minor_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = craven
					has_trait = compassionate
				}
			}
			modifier = {
				factor = 2
				OR = {
					has_trait = sadistic
					has_trait = callous
				}
			}
		}
	}
	
	after = {
		clear_available_compliments_effect = yes
		scope:visiting_liege = { trigger_event = { id = cultural_festival.3002 days = 3 } }
	}
}

scripted_effect cultural_festival.3002.add_hook = {
	scope:stop_host_scope = {
		send_interface_toast = {
			title = cultural_festival.3002.a.toast
			left_icon = scope:visiting_liege
			add_hook = {
				target = root
				type = favor_hook
			}
		}
	}
}

# Liege: You see the play
cultural_festival.3002 = {
	type = activity_event
	title = cultural_festival.3002.t
	desc = {
		desc = cultural_festival.3002.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:compliment_outcome
					scope:compliment_outcome = flag:good
				}
				desc = cultural_festival.3002.desc.good
			}
			triggered_desc = {
				trigger = {
					exists = scope:compliment_outcome
					scope:compliment_outcome = flag:neutral
				}
				desc = cultural_festival.3002.desc.neutral
			}
			triggered_desc = {
				trigger = {
					exists = scope:compliment_outcome
					scope:compliment_outcome = flag:bad
				}
				desc = cultural_festival.3002.desc.bad
			}
			triggered_desc = {
				trigger = {
					has_variable = buffoon_costume_var
				}
				desc = cultural_festival.3002.desc.buffoon
			}
		}
	}

	theme = cultural_festival
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				exists = scope:compliment_outcome
				scope:compliment_outcome = flag:good
			}
			animation = admiration
		}
		triggered_animation = {
			trigger = {
				exists = scope:compliment_outcome
				scope:compliment_outcome = flag:neutral
			}
			animation = personality_rational
		}
		triggered_animation = {
			trigger = {
				exists = scope:compliment_outcome
				scope:compliment_outcome = flag:bad
			}
			animation = disgust
		}
		triggered_animation = {
			trigger = {
				has_variable = buffoon_costume_var
			}
			animation = anger
		}
	}
	right_portrait = {
		character = scope:liege_actor
		animation = personality_honorable
		triggered_outfit = {
			trigger = {
				root = { has_variable = buffoon_costume_var }
			}
			remove_default_outfit = yes
			outfit_tags = { jester_outfit }
		}
	}
	lower_center_portrait = scope:stop_host_scope
	immediate = {
		scope:liege_actor = {
			add_character_flag = wear_armor
		}
	}

	option = { # Compliment is good, pay 
		name = cultural_festival.3002.a
		trigger = {
			exists = scope:compliment_outcome
			scope:compliment_outcome = flag:good
		}
		scope:activity = {
			add_activity_log_entry = {
				key = enjoyed_good_play_log
				tags = { good }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				root = {
					scope:stop_host_scope = {
						send_interface_toast = {
							title = cultural_festival.3002.a.toast
							left_icon = scope:visiting_liege
							root = {
								add_opinion = {
									modifier = grateful_opinion
									target = scope:stop_host_scope
									opinion = 50
								}
							}
						}
					}
					add_prestige = minor_prestige_gain
					scope:stop_host_scope = {
						every_held_county = {
							add_county_modifier = { #everyone loves you
								modifier = festival_good_play
								years = 5
							}
						}
					}
				}
			}
		}
		stress_impact = {
			humble = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = humble
					has_trait = paranoid
				}
				add = -50
			}
		}
	}
	
	option = { # Meh
		name = cultural_festival.3002.b
		trigger = {
			exists = scope:compliment_outcome
			scope:compliment_outcome = flag:neutral
		}
		scope:stop_host_scope = {
			send_interface_toast = {
				title = cultural_festival.3002.b.toast
				left_icon = scope:visiting_liege
				root = {
					add_opinion = {
						modifier = grateful_opinion
						target = scope:stop_host_scope
						opinion = 10
					}
				}
			}
		}
		stress_impact = {
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0.25
				has_trait = arrogant
			}
		}
	}
	
	option = { # This is awful
		name = cultural_festival.3002.c
		trigger = {
			exists = scope:compliment_outcome
			scope:compliment_outcome = flag:bad
		}
		scope:stop_host_scope = {
			send_interface_toast = {
				title = cultural_festival.3002.c.toast
				left_icon = scope:visiting_liege
				root = {
					add_opinion = {
						modifier = insulted_opinion
						target = scope:stop_host_scope
						opinion = -15
					}
				}
			}
		}
		scope:cultural_festival_scope = {
			add_county_modifier = { #everyone thinks you're kinda lame
				modifier = festival_bad_play
				years = 5
			}
		}
		stress_impact = {
			base = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = arrogant
			}
		}
	}
	
	option = { # You're a buffoon
		name = cultural_festival.3002.d 
		trigger = {
			has_variable = buffoon_costume_var
		}
		scope:stop_host_scope = {
			send_interface_toast = {
				title = cultural_festival.3002.d.toast
				left_icon = scope:visiting_liege
				root = {
					progress_towards_rival_effect = {
						CHARACTER = scope:stop_host_scope
						REASON = rival_buffoon_play
						OPINION = -30
					}
				}
			}
		}
		stress_impact = {
			forgiving = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = forgiving
					has_trait = humble
				}
			}
		}
	}
	
	option = { # I don't really care about this, but Im gonna pretend I do
		name = cultural_festival.3002.e
		trigger = {
			exists = scope:compliment_outcome
			NOT = { scope:compliment_outcome = flag:good }
			scope:stop_host_scope = {
				can_add_hook = {
					target = root
					type = favor_hook
				}
			}
		}
		scope:cultural_festival_scope = {
			add_county_modifier = { #everyone loves you, kinda
				modifier = festival_neutral_play
				years = 5
			}
		}
		scope:stop_host_scope = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 20
			}
		}
		cultural_festival.3002.add_hook = yes
		if = {
			limit = { has_variable = buffoon_costume_var }
			stress_impact = {
				vengeful = minor_stress_impact_gain
				wrathful = minor_stress_impact_gain
				callous = minor_stress_impact_gain
				arrogant = medium_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				base = minor_stress_impact_loss
				arrogant = minor_stress_impact_gain #you actually care about this stuff
				gregarious = minor_stress_impact_gain #you also care
			}
		}
		ai_chance = {
			base = 50
			modifier = {
				factor = 0.25
				OR = {
					has_trait = arrogant
					has_trait = gregarious
				}
			}
		}
	}
	after = {
		scope:liege_actor = {
			remove_character_flag = wear_armor
		}
	}
}

######################
## Bilateral: Make a fountain run with wine
## 3010-3011
## by Veronica Pazos
######################

# Vassal: Do you want to make your fountain run with wine?
cultural_festival.3010 = {
	type = activity_event
	title = cultural_festival.3010.t
	desc = cultural_festival.3010.desc

	theme = cultural_festival
	left_portrait = {
		character = root
		animation = personality_rational
	}
	override_background = { reference = garden }
	cooldown = { years = 2 }
	
	trigger = {
		is_landed_or_landless_administrative = yes
		is_available_in_activity_trigger = yes
		scope:visiting_liege = {
			drinks_alcohol_trigger = yes #you heard that they like this
			NOT = { has_variable = fountain_event_var } #we set a 5 year cooldown for the liege too
		} 
	}
	
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 1.5
			any_child = { }
		}
		modifier = {
			factor = 1.25
			OR = {
				has_trait = gregarious
				has_trait = drunkard
			}
		}
	}

	option = { # I sure do!
		name = cultural_festival.3010.a
		scope:activity = {
			add_activity_log_entry = {
				key = wine_fountain_log
				tags = { good }
				character = scope:visiting_liege
				target = scope:stop_host_scope
			}
		}
		remove_short_term_gold = minor_gold_value
		add_prestige = minor_prestige_gain
		if = {
			limit = { faith_forbids_alcohol_trigger = no }
			hidden_effect = {
				every_pool_character = {
					province = root.location
					limit = { drinks_alcohol_trigger = yes }
					add_opinion = {
						modifier = impressed_opinion
						target = root
						opinion = 5
					}
				}
				location = {
					every_character_in_location = { #people love this
						limit = {
							drinks_alcohol_trigger = yes
							this != root
						}
						add_opinion = {
							modifier = impressed_opinion
							target = root
							opinion = 5
						}
					}
				}
			}
			location.county = {
				holder = {
					every_courtier = {
						custom = custom.every_courtier
						limit = {
							location = root.location
							faith_forbids_alcohol_trigger = no
						}
						add_opinion = {
							modifier = impressed_opinion
							target = root
							opinion = 5
						}
					}
				}
				add_county_modifier = {
					modifier = alcohol_fountain_modifier
					years = 5
				}
			}
		}
		scope:visiting_liege = {
			add_opinion = {
				modifier = impressed_opinion
				target = root
				opinion = 20
			}
			set_variable = {
				name = fountain_event_var
				years = 5
			}
			set_variable = alcohol_fountain_var
			trigger_event = { id = cultural_festival.3011 days = 3 }
		}
		if = {
			limit = {
				has_trait = zealous
				faith_forbids_alcohol_trigger = yes
			}
			add_stress = medium_stress_gain
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			temperate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = temperate
					short_term_gold < medium_gold_value
					AND = {
						has_trait = zealous
						faith_forbids_alcohol_trigger = yes
					}
				}
			}
		}
	}
	
	option = { # Maybe just juice?
		name = cultural_festival.3010.b
		scope:activity = {
			add_activity_log_entry = {
				key = juice_fountain_log
				tags = { good }
				character = scope:visiting_liege
				target = scope:stop_host_scope
			}
		}
		remove_short_term_gold = tiny_gold_value
		if = { #if you have children they love this
			limit = {
				any_child = {
					is_adult = no
					count > 0
				}
			}
			every_child = {
				limit = { is_adult = no }
				add_opinion = {
					modifier = impressed_opinion
					target = root
					opinion = 15
				}
			}
		}
		location.county = {
			add_county_modifier = {
				modifier = juice_fountain_modifier
				years = 5
			}
		}
		scope:visiting_liege = {
			add_opinion = {
				modifier = impressed_opinion
				target = root
				opinion = 10
			}
			set_variable = {
				name = fountain_event_var
				years = 5
			}
			set_variable = juice_fountain_var
			trigger_event = { id = cultural_festival.3011 days = 3 }
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			drunkard = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0.5
				has_trait = greedy
			}
			modifier = {
				factor = 0
				has_trait = drunkard
			}
		}
	}
	
	option = { # Not really
		name = cultural_festival.3010.c
		stress_impact = {
			avaricious = minor_stress_impact_gain #you want to climb the ladder
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = avaricious
					has_trait = gregarious
				}
			}
		}
	}
}

# Liege: You encounter this cool alcohol/juice fountain
cultural_festival.3011 = {
	type = activity_event
	title = cultural_festival.3011.t
	desc = {
		desc = cultural_festival.3011.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					has_variable = alcohol_fountain_var
				}
				desc = cultural_festival.3011.desc.alcohol
			}
			triggered_desc = {
				trigger = {
					has_variable = juice_fountain_var
				}
				desc = cultural_festival.3011.desc.juice
			}
		}
		desc = cultural_festival.3011.desc.outro
	}

	theme = cultural_festival
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = paranoid
					has_trait = callous
				}
			}
			animation = disbelief
		}
		animation = admiration
	}
	right_portrait = {
		character = scope:stop_host_scope
		animation = happiness
	}
	override_background = { reference = garden }

	option = { # drink together
		name = cultural_festival.3011.a
		scope:cultural_festival_scope = {
			add_county_modifier = {
				modifier = drank_together_modifier
				years = 5
			}
		}
		if = {
			limit = { has_variable = alcohol_fountain_var }
			stress_impact = {
				base = minor_stress_impact_loss
				paranoid = minor_stress_impact_gain
				temperate = minor_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				base = minor_stress_impact_loss
				paranoid = minor_stress_impact_gain
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = paranoid
					has_trait = temperate
				}
			}
		}
	}
	
	option = { # make a wish
		name = cultural_festival.3011.b
		add_character_modifier = {
			modifier = festival_wishing_well_modifier
			years = 5
		}
		if = {
			limit = { has_variable = alcohol_fountain_var }
			stress_impact = {
				cynical = minor_stress_impact_gain
				drunkard = minor_stress_impact_gain
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = drunkard
					has_trait = cynical
				}
			}
		}
	}
	
	after = {
		remove_variable = alcohol_fountain_var
		remove_variable = juice_fountain_var
	}
}

######################
## Bilateral: Host a lavish ceremony to make your vassal formally repledge homage to you
## 3020-3022
## by Veronica Pazos
######################

# Liege: Do you want to host this ceremony?
cultural_festival.3020 = {
	type = activity_event
	title = cultural_festival.3020.t
	desc = cultural_festival.3020.desc

	theme = cultural_festival
	left_portrait = {
		character = root
		animation = personality_rational
	}
	cooldown = { years = 2 }
	
	trigger = {
		is_landed_or_landless_administrative = yes
		government_has_flag = government_is_feudal
		is_available_in_activity_trigger = yes
		scope:stop_host_scope = { is_ai = yes }
		OR = {
			can_add_hook = {
				target = scope:stop_host_scope
				type = loyalty_hook
			}
			scope:stop_host_scope = { vassal_contract_obligation_level_can_be_increased = feudal_government_taxes }
			scope:stop_host_scope = { vassal_contract_obligation_level_can_be_increased = feudal_government_levies }
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			scope:stop_host_scope = {
				subject_contract_is_blocked_from_modification = yes
			}
		}
		modifier = {
			factor = 2
			involved_activity = {
				has_activity_option = {
					category = special_type
					option = tour_type_majesty
				}
			}
		}
	}
	
	option = { # I sure do!
		name = cultural_festival.3020.a
		custom_tooltip = cultural_festival.3020.a.tt
		trigger_event = { id = cultural_festival.3021 days = 3 }
		stress_impact = {
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = humble
			}
		}
	}
	
	option = { # Let's just relax instead
		name = cultural_festival.3020.b
		scope:stop_host_scope = {
			every_held_county = {
				add_county_modifier = {
					modifier = festival_no_homage_modifier
					years = 5
				}
			}
		}
		stress_impact = {
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0.5
				has_trait = arrogant
			}
		}
	}
}

# Liege: What do you ask for?
cultural_festival.3021 = {
	type = activity_event
	title = cultural_festival.3021.t
	desc = cultural_festival.3021.desc

	theme = cultural_festival
	left_portrait = {
		character = root
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:stop_host_scope
		animation = personality_honorable
	}
	override_background = { reference = throne_room }
	
	option = { # Give me money
		name = cultural_festival.3021.a
		custom_tooltip = cultural_festival.3021.a.tt
		trigger = { scope:stop_host_scope = { vassal_contract_obligation_level_can_be_increased = feudal_government_taxes } }
		scope:activity = {
			add_activity_log_entry = {
				key = vassal_homage_log
				tags = { good }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				scope:stop_host_scope = {
					vassal_contract_increase_obligation_level = feudal_government_taxes
					set_variable = homage_money_var
				}
			}
		}
		stress_impact = {
			brave = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				has_trait = greedy
			}
		}
	}
	
	option = { # Give me levies
		name = cultural_festival.3021.b
		custom_tooltip = cultural_festival.3021.a.tt
		trigger = { scope:stop_host_scope = { vassal_contract_obligation_level_can_be_increased = feudal_government_levies } }
		scope:activity = {
			add_activity_log_entry = {
				key = vassal_homage_log
				tags = { good }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				scope:stop_host_scope = {
					vassal_contract_increase_obligation_level = feudal_government_levies
					set_variable = homage_levies_var
				}
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				OR = {
					has_lifestyle = martial_lifestyle
					martial >= high_skill_rating
					has_trait = brave
				}
			}
		}
	}
	
	option = { # Give me hook
		name = cultural_festival.3021.c
		flavor = cultural_festival.3021.c.flavor
		trigger = {
			can_add_hook = {
				target = scope:stop_host_scope
				type = loyalty_hook
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = vassal_homage_log
				tags = { good }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				root = {
					add_hook = {
						target = scope:stop_host_scope
						type = loyalty_hook
					}
					scope:stop_host_scope = {
						set_subject_contract_modification_blocked = yes
						set_variable = homage_hook_var
					}
				}
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
			brave = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 1.25
				OR = {
					has_lifestyle = intrigue_lifestyle
					intrigue >= high_skill_rating
					has_trait = deceitful
				}
			}
		}
	}
	
	option = { # Let's be friends
		name = cultural_festival.3021.d
		scope:activity = {
			add_activity_log_entry = {
				key = vassal_homage_log
				tags = { good }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				root = {
					progress_towards_friend_effect = {
						REASON = friend_homage_ceremony
						CHARACTER = scope:stop_host_scope
						OPINION = 50
					}
				}
			}
		}
		scope:stop_host_scope = {
			set_variable = homage_friends_var
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			deceitful = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				OR = {
					has_trait = compassionate
					has_trait = generous
					has_trait = forgiving
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = deceitful
					has_trait = greedy
					has_trait = callous
					has_trait = sadistic
				}
			}
		}
	}
	
	after = {
		scope:stop_host_scope = {
			trigger_event = { id = cultural_festival.3022 days = 3 }
		}
	}
}

# Vassal: What do you think of this?

scripted_effect cultural_festival.3022.vassal_contract_modified_effect = {
	scope:visiting_liege = {
		send_interface_toast = {
			title = cultural_festival.3022.annoyed
			left_icon = root
			scope:stop_host_scope = {
				add_opinion = {
					target = scope:visiting_liege
					modifier = annoyed_opinion
					opinion = -10
				}
			}
		}
	}
}

cultural_festival.3022 = {
	type = activity_event
	title = cultural_festival.3022.t
	desc = {
		desc = cultural_festival.3022.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					has_variable = homage_friends_var
				}
				desc = cultural_festival.3022.desc.friends
			}
			triggered_desc = {
				trigger = {
					has_variable = homage_hook_var
				}
				desc = cultural_festival.3022.desc.hook
			}
			triggered_desc = {
				trigger = {
					has_variable = homage_levies_var
				}
				desc = cultural_festival.3022.desc.levies
			}
			triggered_desc = {
				trigger = {
					has_variable = homage_money_var
				}
				desc = cultural_festival.3022.desc.money
			}
		}
	}

	theme = cultural_festival
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {	
					has_variable = homage_money_var
					has_variable = homage_levies_var
					has_variable = homage_hook_var
				}
				OR = {
					has_trait = vengeful
					has_trait = wrathful
					has_trait = arrogant
				}
			}
			animation = anger
		}
		triggered_animation = {
			trigger = {
				OR = {	
					has_variable = homage_money_var
					has_variable = homage_levies_var
					has_variable = homage_hook_var
				}
			}
			animation = stress
		}
		animation = happiness
	}
	right_portrait = {
		character = scope:visiting_liege
		animation = personality_honorable
	}
	override_background = { reference = throne_room }
	
	option = { # You had to give money
		name = cultural_festival.3022.a
		custom_tooltip = cultural_festival.3022.money
		trigger = { has_variable = homage_money_var }
		cultural_festival.3022.vassal_contract_modified_effect = yes
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}
	
	option = { # You had to give levies
		name = cultural_festival.3022.b
		custom_tooltip = cultural_festival.3022.levies
		trigger = { has_variable = homage_levies_var }
		cultural_festival.3022.vassal_contract_modified_effect = yes
		ai_chance = {
			base = 100
		}
	}
	
	option = { # You had to give a strong hook
		name = cultural_festival.3022.a
		custom_tooltip = cultural_festival.3022.hook
		trigger = { has_variable = homage_hook_var }
		cultural_festival.3022.vassal_contract_modified_effect = yes
		stress_impact = {
			deceitful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}
	
	option = { # Friendship
		name = cultural_festival.3022.d
		trigger = { has_variable = homage_friends_var }
		scope:visiting_liege = {
			send_interface_toast = {
				title = cultural_festival.3022.d.friends
				left_icon = root
				scope:stop_host_scope = {
					progress_towards_friend_effect = {
						REASON = friend_homage_ceremony
						CHARACTER = scope:visiting_liege
						OPINION = 50
					}
				}
			}
		}
		stress_impact = {
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}
	
	after = {
		remove_variable = homage_money_var
		remove_variable = homage_levies_var
		remove_variable = homage_hook_var
		remove_variable = homage_friends_var
	}
}

######################
## Bilateral: Crown the best pig/cow/local_farm_animal
## 3030-3031
## by Veronica Pazos
######################

# Vassal: Do you want to set up a local_farm_animal contest?
cultural_festival.3030 = {
	type = activity_event
	title = cultural_festival.3030.t
	desc = cultural_festival.3030.desc

	theme = cultural_festival
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:local_farmer
		animation = happiness
	}
	cooldown = { years = 2 }
	
	trigger = {
		is_landed_or_landless_administrative = yes
		is_available_in_activity_trigger = yes
	}
	
	immediate = {
		scope:stop_host_scope = { select_local_farm_animal_effect = yes } #let's find the animal to judge
		create_character = {
			template = generic_peasant_character
			location = root.location
			dynasty = none
			faith = root.faith
			culture = root.culture
			save_scope_as = local_farmer
		}
	}
	
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			location.county = {
				development_level <= bad_development_level
			}
		}
		modifier = {
			factor = 2
			location = { terrain = farmlands }
		}
	}

	option = { # I sure do!
		name = cultural_festival.3030.a
		remove_treasury_or_gold = minor_treasury_or_gold_value
		scope:cultural_festival_scope = {
			add_county_modifier = {
				modifier = farm_contest_modifier
				years = 5
			}
		}
		scope:visiting_liege = { trigger_event = { id = cultural_festival.3031 days = 3 } }
		stress_impact = {
			greedy = minor_stress_impact_gain
			callous = minor_stress_impact_gain #you think this is stupid
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					short_term_treasury_or_gold < medium_treasury_or_gold_value
				}
			}
		}
	}
	
	option = { # Nahhhh
		name = cultural_festival.3030.b
		remove_variable = local_farm_animal
		stress_impact = {
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0.5
				has_trait = gregarious
			}
		}
	}
	after = {
		scope:local_farmer = {
			silent_disappearance_ai_effect = yes
		}
	}
}

# Liege: Crown the best local_farm_animal
cultural_festival.3031 = {
	type = activity_event
	title = cultural_festival.3031.t
	desc = cultural_festival.3031.desc

	theme = cultural_festival
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = callous
					has_trait = sadistic
					has_trait = cynical
				}
			}
			animation = disbelief
		}
		animation = personality_rational
	}
	right_portrait = {
		character = scope:stop_host_scope
		animation = happiness
	}
	
	immediate = {
		location.culture = { save_scope_as = festival_culture_scope }
		if = {
			limit = {
				scope:activity = {
					any_attending_character = {
						has_relation_rival = root
						can_set_relation_nemesis_trigger = { CHARACTER = root }
					}
				}
			}
			scope:activity = {
				random_attending_character = {
					limit = {
						has_relation_rival = root
						can_set_relation_nemesis_trigger = { CHARACTER = root }
					}
					save_scope_as = farm_animal_rival
				}
			}
		}
	}

	option = { # This one - the liege's, but it's ugly
		name = cultural_festival.3031.a
		scope:stop_host_scope = {
			add_opinion = {
				target = root
				modifier = flattered_opinion
				opinion = 20
			}
		}
		add_character_modifier = {
			modifier = underdog_animal_contest_modifier
			years = 5
		}
		stress_impact = {
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}
	
	option = { # This one - the favourite, but not the liege's
		name = cultural_festival.3031.b
		scope:cultural_festival_scope = {
			add_county_modifier = {
				modifier = favourite_animal_contest_modifier
				years = 10
			}
		}
		scope:stop_host_scope = {
			add_opinion = {
				target = root
				modifier = insulted_opinion
				opinion = -10
			}
		}
		stress_impact = {
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}
	
	option = { # This one - the diff culture one
		name = cultural_festival.3031.c
		trigger = {
			location.culture != root.culture #if the county culture is not your culture
		}
		culture = {
			change_cultural_acceptance = {
				target = scope:festival_culture_scope
				value = minor_cultural_acceptance_gain
				desc = cultural_acceptance_farm_contest
			}
		}
		scope:stop_host_scope = { #it's still not their animal
			add_opinion = {
				target = root
				modifier = insulted_opinion
				opinion = -10
			}
		}
		stress_impact = {
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}
	
	option = { # This is ridiculous
		name = cultural_festival.3031.d
		trigger = {
			OR = {
				has_trait = callous
				has_trait = sadistic
			}
		}
		scope:cultural_festival_scope = {
			add_county_modifier = {
				modifier = mocked_animal_fair_modifier
				years = 10
			}
		}
		stress_impact = {
			callous = medium_stress_impact_loss
			sadistic = major_stress_impact_loss
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				OR = {
					has_trait = callous
					has_trait = sadistic
				}
			}
		}
	}
	
	option = { # If your rival is around, pick them as the best farm_animal
		name = cultural_festival.3031.e
		custom_tooltip = cultural_festival.3031.e.tt
		trigger = {
			scope:activity = {
				any_attending_character = {
					has_relation_rival = root
					can_set_relation_nemesis_trigger = { CHARACTER = root }
				}
			}
		}
		#you become nemesis, this is highly humiliating
		set_relation_nemesis = {
			reason = nemesis_animal_contest
			target = scope:farm_animal_rival 
		}
		stress_impact = {
			base = minor_stress_impact_loss
			vengeful = minor_stress_impact_loss
			callous = medium_stress_impact_loss
			sadistic = major_stress_impact_loss
			forgiving = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				OR = {
					has_trait = arrogant
					has_trait = callous
					has_trait = vengeful
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = forgiving
					has_trait = compassionate
				}
			}
		}
	}
	
	after = {
		remove_variable = local_farm_animal
		if = {
			limit = {
				scope:stop_host_scope = { has_variable = local_farm_animal }
			}
			remove_variable = local_farm_animal
		}
	}
}

######################
## Bilateral: Sword in the stone
## 3040-3042
## by Veronica Pazos
######################

# Vassal: Do you want to set up a sword in a stone
cultural_festival.3040 = {
	type = activity_event
	title = cultural_festival.3040.t
	desc = cultural_festival.3040.desc

	theme = cultural_festival
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = cp:councillor_marshal
		animation = disapproval
	}
	artifact = {
		target = scope:sword_in_the_stone_scope
		position = lower_center_portrait
	}
	override_background = { reference = courtyard }
	cooldown = { years = 2 }
	
	trigger = {
		is_landed_or_landless_administrative = yes
		exists = cp:councillor_marshal
		any_character_artifact = { #do you have an artifact that could be buried in a stone?
			OR = {
				artifact_type = axe
				artifact_type = spear
				artifact_type = dagger
				artifact_type = sword
			}
		}
	}
	
	immediate = {
		cp:councillor_marshal = { save_scope_as = marshal }
		random_character_artifact = {
			limit = {
				OR = {
					artifact_type = axe
					artifact_type = spear
					artifact_type = dagger
					artifact_type = sword
				}
			}
			save_scope_as = sword_in_the_stone_scope
		}
	}
	
	weight_multiplier = {
		base = 1
		modifier = { #more likely to happen if you actually have a sword
			factor = 2
			any_character_artifact = { artifact_type = sword }
		}
	}

	option = { # I sure do!
		name = cultural_festival.3040.a
		flavor = cultural_festival.3040.flavor
		custom_tooltip = cultural_festival.3040.a.tt
		add_prestige = medium_prestige_gain #this is a really cool activity
		scope:visiting_liege = {
			trigger_event = {
				id = cultural_festival.3041
				days = 3
			}
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = arrogant
				}
			}
		}
	}
	
	option = { # Nahhhh
		name = cultural_festival.3040.b
		stress_impact = {
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = gregarious
			}
		}
	}
}

# Liege: Do you want to take this sword out of the stone?
cultural_festival.3041 = {
	type = activity_event
	title = cultural_festival.3041.t
	desc = cultural_festival.3041.desc

	theme = cultural_festival
	left_portrait = {
		character = root
		animation = marshal
	}
	right_portrait = {
		character = scope:stop_host_scope
		animation = personality_bold
	}
	artifact = {
		target = scope:sword_in_the_stone_scope
		position = lower_center_portrait
	}

	option = { # Try to get it out
		name = cultural_festival.3041.a
		trigger = { NOT = { has_trait = giant } } 
		duel = {
			skill = prowess
			value = high_skill_rating
			50 = { #you get the sword
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				desc = cultural_festival.3041.a.success
				send_interface_toast = {
					title = cultural_festival.3041.a.success
					left_icon = root
					right_icon = scope:sword_in_the_stone_scope
					scope:activity = {
						add_activity_log_entry = {
							key = got_sword_in_stone_log
							tags = { good }
							character = scope:visiting_liege
							artifact = scope:sword_in_the_stone_scope
							scope:sword_in_the_stone_scope = {
								set_owner = root 
								if = {
									limit = {
										root = {
											can_equip_artifact = scope:sword_in_the_stone_scope
										}
									}
									equip_artifact_to_owner_replace = yes
								}
							}
							root = { add_prestige = medium_prestige_gain }
							if = {
								limit = {
									scope:activity = {
										OR = {
											has_activity_option = {
												category = special_type
												option = tour_type_majesty
											}
											has_activity_option = {
												category = special_type
												option = tour_type_intimidation
											}
										}
									}
								}
								increase_tour_success_effect = { POINTS = 1 }
							}
						}
					}
				}
				scope:stop_host_scope = { #we also send them a toast if you got the artifact
					send_interface_toast = {
						title = cultural_festival.3041.a.success.vassal
						left_icon = scope:visiting_liege
						right_icon = scope:sword_in_the_stone_scope
						scope:visiting_liege = { #but they like you
							add_opinion = {
								target = scope:stop_host_scope
								modifier = grateful_opinion
								opinion = 20
							}
						}
					}
				}
			}
			50 = { #you can't make it
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				desc = cultural_festival.3041.a.failure
				send_interface_toast = {
					title = cultural_festival.3041.a.failure
					left_icon = root
					right_icon = scope:sword_in_the_stone_scope
					add_prestige = minor_prestige_loss
				}
				set_variable = couldnt_get_sword_var
				scope:stop_host_scope = {
					trigger_event = {
						id = cultural_festival.3042
						days = 3
					}
				}
			}
		}
		stress_impact = {
			weak = minor_stress_impact_gain
			content = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = weak
					has_trait = content
					has_trait = humble
				}
			}
		}
	}
	
	option = { # Let the host win
		name = cultural_festival.3041.b
		progress_towards_friend_effect = {
			REASON = friend_sword_in_stone
			CHARACTER = scope:stop_host_scope
			OPINION = 15
		}
		scope:stop_host_scope = { #now they get a chance to take it out
			trigger_event = {
				id = cultural_festival.3042
				days = 3
			} 
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_majesty
					}
				}
			}
			increase_tour_success_effect = { POINTS = 1 }
		}
		stress_impact = {
			callous = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = arrogant
					has_trait = callous
				}
			}
		}
	}
	
	option = { #You're a giant, you get this immediately
		name = cultural_festival.3041.c
		trigger = { has_trait = giant }
		scope:sword_in_the_stone_scope = {
			set_owner = root 
			if = {
				limit = {
					root = {
						can_equip_artifact = scope:sword_in_the_stone_scope
					}
				}
				equip_artifact_to_owner_replace = yes
			}
		}
		add_prestige = minor_prestige_gain
		if = {
			limit = {
				scope:activity = {
					OR = {
						has_activity_option = {
							category = special_type
							option = tour_type_majesty
						}
						has_activity_option = {
							category = special_type
							option = tour_type_intimidation
						}
					}
				}
			}
			increase_tour_success_effect = { POINTS = 1 }
		}
		scope:stop_host_scope = { #we also send them a toast if you got the artifact
			send_interface_toast = {
				title = cultural_festival.3041.a.success.vassal
				left_icon = scope:visiting_liege
				right_icon = scope:sword_in_the_stone_scope
				scope:visiting_liege = { #but they like you
					add_opinion = {
						target = scope:stop_host_scope
						modifier = grateful_opinion
						opinion = 20
					}
				}
			}
		}
	}
}

# Vassal: Do /you/ want to take the sword out?
cultural_festival.3042 = {
	type = activity_event
	title = cultural_festival.3042.t
	desc = {
		desc = cultural_festival.3042.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:visiting_liege = { has_variable = couldnt_get_sword_var }
				}
				desc = cultural_festival.3042.desc.failed
			}
			desc = cultural_festival.3042.desc.pretended
		}
	}

	theme = cultural_festival
	left_portrait = {
		character = root
		animation = marshal
	}
	right_portrait = {
		character = scope:visiting_liege
		animation = admiration
	}
	artifact = {
		target = scope:sword_in_the_stone_scope
		position = lower_center_portrait
	}

	option = { # Try to get it out
		name = cultural_festival.3042.a
		duel = {
			skill = prowess
			value = high_skill_rating
			50 = { #you get the sword
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				desc = cultural_festival.3041.a.success #we can reuse the loc for this
				send_interface_toast = {
					title = cultural_festival.3041.a.success
					left_icon = root
					right_icon = scope:sword_in_the_stone_scope
					add_prestige = medium_prestige_gain
				}
			}
			50 = { #you can't make it
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				desc = cultural_festival.3041.a.failure
				send_interface_toast = {
					title = cultural_festival.3041.a.failure
					left_icon = root
					right_icon = scope:sword_in_the_stone_scope
					add_prestige = minor_prestige_loss
				}	
			}
		}
		stress_impact = {
			weak = minor_stress_impact_gain
			content = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = weak
					has_trait = content
					has_trait = humble
				}
			}
		}
	}
	
	option = { # Ignore it
		name = cultural_festival.3042.b
		stress_impact = {
			brave = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = arrogant
					has_trait = brave
				}
			}
		}
	}
}

######################
## Bilateral: Struggle to stay awake during a boring performance
## 3050-3051
## by Veronica Pazos
######################

# Liege: Do you try to stay awake to not insult your host?
cultural_festival.3050 = {
	type = activity_event
	title = cultural_festival.3050.t
	desc = cultural_festival.3050.desc

	theme = cultural_festival
	left_portrait = {
		character = root
		animation = boredom
	}
	right_portrait = {
		character = scope:stop_host_scope
		animation = happiness
	}
	cooldown = { years = 2 }
	
	trigger = {
		#triggered by the monthly_pulse
	}
	
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			has_trait = impatient
		}
	}

	option = { # try
		name = cultural_festival.3050.a
		scope:stop_host_scope = {
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 10
			}
		}
		scope:cultural_festival_scope = { #people also like this
			add_county_modifier = {
				modifier = festival_enjoyed_local_performance
				years = 5
			}
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_majesty
					}
				}
			}
			increase_tour_success_effect = { POINTS = 1 }
		}
		stress_impact = {
			base = minor_stress_impact_gain #this is kinda stressful to you
			impatient = minor_stress_impact_gain #to make it major
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = impatient
			}
		}
	}
	
	option = { # you don't even care
		name = cultural_festival.3050.b
		custom_tooltip = cultural_festival.3050.b.tt
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_intimidation
					}
				}
			}
			increase_tour_success_effect = { POINTS = 1 }
		}
		hidden_effect = {
			random_list = {
				60 = { #the host notices
					modifier = {
						add = 10
						scope:stop_host_scope = {
							has_trait = deceitful #they know you're lying
						}
					}
					scope:stop_host_scope = { trigger_event = { id = cultural_festival.3051 days = 3 } }
				}
				40 = { #they don't notice
					modifier = {
						add = 15
						has_trait = deceitful
					}
					modifier = {
						add = -10
						has_trait = honest
					}
				}
			}
		}
		stress_impact = {
			base = medium_stress_impact_loss
			shy = minor_stress_impact_gain
			honest = minor_stress_impact_gain
			patient = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = shy
					has_trait = honest
					has_trait = patient
				}
			}
		}
	}
}

# Vassal: You notice liege falling asleep
cultural_festival.3051 = {
	type = activity_event
	title = cultural_festival.3051.t
	desc = cultural_festival.3051.desc

	theme = cultural_festival
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = wrathful
					has_trait = callous
					has_trait = vengeful
				}
			}
			animation = rage
		}
		animation = disbelief
	}
	right_portrait = {
		character = scope:visiting_liege
		animation = boredom
	}

	option = { # b r u h
		name = cultural_festival.3051.a
		scope:visiting_liege = {
			send_interface_toast = {
				title = cultural_festival.3051.a.toast
				left_icon = scope:stop_host_scope
				scope:stop_host_scope = {
					add_opinion = {
						target = scope:visiting_liege
						modifier = insult_opinion
						opinion = -15
					}
				}
			}
		}
		stress_impact = {
			forgiving = minor_stress_impact_gain
			impatient = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = forgiving
					has_trait = impatient
				}
			}
		}
	}
	
	option = { # I kinda get it
		name = cultural_festival.3051.b
		stress_impact = { #you get stressed
			base = minor_stress_impact_gain
			humble = medium_stress_impact_loss
			arrogant = minor_stress_impact_gain
			patient = minor_stress_impact_gain
		}
		ai_chance = {
			base = 75
			modifier = {
				factor = 0
				OR = {
					has_trait = arrogant
					has_trait = patient
				}
			}
		}
	}
}

######################
## Bilateral: Take someone to dance
## 3060-3061
## by Veronica Pazos
######################

scripted_trigger cultural_festival_3060_valid_pool_character = {
	is_available_ai_adult = yes
	is_attracted_to_gender_of = root
	root = { is_attracted_to_gender_of = prev }
}

# Liege: Do you wanna dance with your spouse or with the vassal's?
cultural_festival.3060 = {
	type = activity_event
	title = cultural_festival.3060.t
	desc = {
		desc = cultural_festival.3060.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:my_spouse
				}
				desc = cultural_festival.3060.desc.spouse
			}
			triggered_desc = {
				trigger = {
					exists = scope:vassal_spouse
				}
				desc = cultural_festival.3060.desc.vassal
			}
		}
	}

	theme = cultural_festival
	left_portrait = {
		character = root
		animation = flirtation_left
	}
	right_portrait = {
		character = scope:my_spouse
		animation = happiness
		trigger = { exists = scope:my_spouse }
	}
	lower_center_portrait = {
		character = scope:stop_host_scope
		trigger = { #they'll only be there if you're trying to dance with their spouse
			exists = scope:vassal_spouse
			scope:stop_host_scope != scope:my_spouse
		}
	}
	lower_right_portrait = {
		character = scope:vassal_spouse
		trigger = {
			exists = scope:vassal_spouse
			scope:vassal_spouse != root
		}
	}
	
	cooldown = { years = 2 }
	
	trigger = {
		OR = { # Only for adults and teenagers
			is_adult = yes
			# Pre-pubescent children are considered asexual, but adult asexuals should be allowed to get this event
			NOT = { has_sexuality = asexual }
		}
		OR = {
			scope:stop_host_scope = { #Host has a spouse in our location
				any_spouse = {
					location = root.location
				}
			}
			any_spouse = { #Our own spouse is in this location
				location = root.location
			}
		}
	}
	
	immediate = {
		random_spouse = { #if your spouse is here we grab them
			limit = { location = root.location }
			save_scope_as = my_spouse
		}
		scope:stop_host_scope = { #Host has a spouse in our location
			random_spouse = {
				limit = {
					location = root.location
				}
				save_scope_as = vassal_spouse
			}
		}
	}
	
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2
			any_spouse = { #Our own spouse is in this location
				location = root.location
			}
		}
		modifier = {
			factor = 2
			scope:stop_host_scope = {
				any_spouse = {
					location = root.location
				}
			}
		}
	}

	option = { # I wanna dance with my spouse, obviously
		name = cultural_festival.3060.a
		trigger = {
			exists = scope:my_spouse
		}
		scope:my_spouse = {
			add_opinion = {
				target = root
				modifier = flattered_opinion
				opinion = 20
			}
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_majesty
					}
				}
			}
			increase_tour_success_effect = { POINTS = 1 }
		}
		stress_impact = {
			base = minor_stress_impact_loss
			gregarious = minor_stress_impact_loss
			loyal = medium_stress_impact_loss
			lazy = minor_stress_impact_gain
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = lazy
					has_trait = callous
				}
			}
		}
	}
	
	option = { # I wanna dance with YOUR spouse, obviously
		name = cultural_festival.3060.b
		trigger = {
			exists = scope:vassal_spouse
			scope:vassal_spouse != root
		}
		custom_tooltip = cultural_festival.3060.b.tt
		if = {
			limit = {
				NOR = {
					has_trait = celibate
					has_trait = chaste
				}
			}
			duel = {
				target = scope:vassal_spouse
				skill = diplomacy
				50 = {
					desc = cultural_festival.3060.b.success
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -49
					}
					modifier = {
						scope:vassal_spouse = {
							OR = {
								has_trait = lustful
								has_trait = seducer
							}
						}
						factor = 2
					}
					modifier = {
						OR = {
							has_trait = lustful
							has_trait = seducer
						}
						factor = 2
					}
					send_interface_toast = {
						title = cultural_festival.3060.b.success
						left_icon = scope:vassal_spouse
						progress_towards_lover_effect = {
							CHARACTER = scope:vassal_spouse
							REASON = lover_festival_dancing
							OPINION = 5
						}
					}
				}
				50 = {
					desc = cultural_festival.3060.b.failure
					#nothing happens
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
						min = -49
					}
					modifier = {
						scope:vassal_spouse = {
							OR = {
								has_trait = celibate
								has_trait = chaste
							}
						}
						factor = 3
					}
					send_interface_toast = {
						title = cultural_festival.3060.b.failure
						left_icon = scope:vassal_spouse
					}
				}
			}
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_intimidation
					}
				}
			}
			increase_tour_success_effect = { POINTS = 1 }
		}
		hidden_effect = {
			scope:stop_host_scope = { trigger_event = { id = cultural_festival.3061 days = 3 } }
		}
		stress_impact = {
			lustful = minor_stress_impact_loss
			seducer = minor_stress_impact_loss
			gregarious = minor_stress_impact_loss
			loyal = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = loyal
			}
		}
	}
	
	option = { # I wanna dance with all the locals
		name = cultural_festival.3060.c
		trigger = { #if one of the spouses doesn't exist, we open this option
			OR = {
				NOT = { exists = scope:my_spouse }
				NOT = { exists = scope:vassal_spouse }
			}
		}
		if = {
			limit = { exists = scope:my_spouse }
			scope:my_spouse = {
				add_opinion = {
					target = root
					modifier = insult_opinion
					opinion = -20
				}
			}
		}
		scope:cultural_festival_scope = {
			add_county_modifier = {
				modifier = festival_danced_with_local_modifier
				years = 5
			}
		}
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_majesty
					}
				}
			}
			increase_tour_success_effect = { POINTS = 2 }
		}
		stress_impact = {
			base = minor_stress_impact_loss
			lazy = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			loyal = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = loyal
					has_trait = lazy
					has_trait = callous
				}
			}
		}
	}
	
	option = { # I hate dancing
		name = cultural_festival.3060.d
		add_dread = minor_dread_gain
		if = {
			limit = {
				scope:activity = {
					has_activity_option = {
						category = special_type
						option = tour_type_intimidation
					}
				}
			}
			increase_tour_success_effect = { POINTS = 2 }
		}
		stress_impact = {
			lazy = minor_stress_impact_loss
			callous = minor_stress_impact_loss
			gregarious = minor_stress_impact_gain
			seducer = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 2
				OR = {
					has_trait = lazy
					has_trait = callous
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_trait = gregarious
					has_trait = seducer
				}
			}
		}
	}
}

# Vassal: Your liege has chosen your spouse for a dance
cultural_festival.3061 = {
	type = activity_event
	title = cultural_festival.3061.t
	desc = {
		desc = cultural_festival.3060.desc.intro #we reuse the intro
		desc = cultural_festival.3061.desc
	}

	theme = cultural_festival
	left_portrait = {
		character = root
		animation = disbelief
	}
	right_portrait = {
		character = scope:visiting_liege
		animation = flirtation
	}
	lower_center_portrait = scope:vassal_spouse

	option = { # How dare they????
		name = cultural_festival.3061.a
		scope:visiting_liege = {
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -10
			}
			send_interface_toast = {
				title = cultural_festival.3061.a.toast
				left_icon = scope:stop_host_scope
				scope:stop_host_scope = {
					progress_towards_rival_effect = {
						CHARACTER = scope:visiting_liege
						REASON = rival_danced_with_spouse
						OPINION = 0
					}
				}
			}
		}
		stress_impact = {
			forgiving = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = forgiving
			}
		}
	}
	
	option = { # Who wouldn't!
		name = cultural_festival.3061.b
		add_character_modifier = {
			modifier = festival_flattered_spouse_modifier
			years = 5
		}
		scope:vassal_spouse = {
			add_opinion = {
				target = root
				modifier = flattered_opinion
				opinion = 15
			}
		}
		stress_impact = {
			arrogant = minor_stress_impact_gain
			vengeful = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = arrogant
					has_trait = vengeful
					has_trait = wrathful
					has_trait = callous
				}
			}
		}
	}
}

######################
## Bilateral: Hold a Feast of Fools-esque ceremony
## 3070-3071
## by Veronica Pazos
######################

scripted_effect cultural_festival.3070.bishop_angry_effect = {
	if = {
		limit = {
			scope:bishop = {
				NOR = {
					has_trait = cynical
					has_trait = gregarious
				}
			}
		}
		scope:bishop = {
			add_opinion = {
				target = root
				modifier = impious_opinion
				opinion = -10
			}
		}
	}
}

# Vassal: Do you want to hold a Feast of Fools?
cultural_festival.3070 = {
	type = activity_event
	title = cultural_festival.3070.t
	desc = cultural_festival.3070.desc

	theme = cultural_festival
	override_background = { reference = courtyard }
	left_portrait = {
		character = root
		animation = personality_rational
	}
	lower_right_portrait = scope:rival_jester
	lower_center_portrait = scope:sinful_jester
	lower_left_portrait = {
		trigger = {
			exists = scope:bishop
			scope:bishop = {
				NOR = {
					has_trait = cynical
					has_trait = gregarious
				}
			}
		}
		character = scope:bishop
	}
	cooldown = { years = 2 }
	
	trigger = {
		OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion } #this is a deeply Christian thing
		location = {
			any_character_in_location = {
				this != scope:visiting_liege
				num_sinful_traits >= 1
				is_adult = yes
				save_temporary_scope_as = jester_1
			}
			any_character_in_location = {
				this != scope:jester_1
				this != scope:visiting_liege
				OR = {
					has_relation_potential_rival = root
					has_relation_rival = root
					has_relation_nemesis = root 
					root = {
						opinion = {
							target = prev #the character
							value < 0
						}
					}
				}
			}
		}
	}
	
	weight_multiplier = {
		base = 1
		modifier = {
			factor = 1.5
			location = {
				any_character_in_location = {
					OR = {
						has_relation_rival = root
						has_relation_potential_rival = root 
					}
				}
			}
		}
		modifier = {
			factor = 2
			location = {
				any_character_in_location = {
					has_relation_nemesis = root
				}
			}
		}
		modifier = {
			government_has_flag = government_is_theocracy
			NOR = {
				has_trait = cynical
				any_secret = { type = secret_non_believer }
			}
			factor = 0.1
		}
	}
	
	immediate = {
		if = { #if you have a nemesis here, we pick them
			limit = {
				location = {
					any_character_in_location = {
						this != scope:visiting_liege
						has_relation_nemesis = root
					}
				}
			}
			location = {
				random_character_in_location = {
					limit = {
						this != scope:visiting_liege
						has_relation_nemesis = root
					}
					save_scope_as = rival_jester
				}
			}
		}
		else_if = { #if you have a rival here, we pick them
			limit = {
				location = {
					any_character_in_location = {
						this != scope:visiting_liege
						has_relation_rival = root
					}
				}
			}
			location = {
				random_character_in_location = {
					limit = {
						this != scope:visiting_liege
						has_relation_rival = root
					}
					save_scope_as = rival_jester
				}
			}
		}
		else_if = { #if you have a potential rival here, we pick them
			limit = {
				location = {
					any_character_in_location = {
						this != scope:visiting_liege
						has_relation_potential_rival = root
					}
				}
			}
			location = {
				random_character_in_location = {
					limit = {
						this != scope:visiting_liege
						has_relation_potential_rival = root
					}
					save_scope_as = rival_jester
				}
			}
		}
		else = { #we grab someone that you dislike
			location = {
				random_character_in_location = {
					limit = {
						this != scope:visiting_liege
						root = {
							opinion = {
								target = prev #the character
								value < 0
							}
						}
					}
					weight = {
						base = 100
						modifier = {
							add = 100
							is_powerful_vassal = yes
						}
					}
					save_scope_as = rival_jester
				}
			}
		}
		location = {
			random_character_in_location = {
				limit = {
					num_sinful_traits >= 1
					is_adult = yes
					this != scope:rival_jester 
					this != scope:visiting_liege
				}
				save_scope_as = sinful_jester
			}
		}
		if = {
			limit = {
				exists = cp:councillor_court_chaplain
			}
			cp:councillor_court_chaplain = {
				save_scope_as = bishop
			}
		}
	}

	option = { # pick someone you dislike
		name = cultural_festival.3070.a
		if = { #become potential rivals
			limit = {
				scope:rival_jester = {
					NOR = {
						has_relation_potential_rival = root
						has_relation_rival = root
						has_relation_nemesis = root
					}
				}
			}
			scope:rival_jester = {
				set_relation_potential_rival = {
					target = root
					reason = rival_feast_of_fools
				}
			}
		}
		else_if = { #become rivals if potential rivals
			limit = {
				scope:rival_jester = {
					has_relation_potential_rival = root
				}
			}
			scope:rival_jester = {
				set_relation_rival = {
					target = root
					reason = rival_feast_of_fools
				}
			}
		}
		else_if = { #become nemesis if rivals
			limit = {
				scope:rival_jester = {
					has_relation_rival = root
				}
			}
			scope:rival_jester = {
				set_relation_nemesis = {
					target = root
					reason = rival_feast_of_fools
				}
			}
		}
		else = { #they get hostile scheme power against you if nemesis
			scope:rival_jester = {
				set_variable = {
					name = festival_nemesis_fool_var
					value = scope:stop_host_scope
				}
			}
		}
		scope:rival_jester = {
			if = {
				limit = { is_male = no }
				give_nickname = nick_monarch_of_fools
			}
			else = {
				give_nickname = nick_monarch_of_fools_masc
			}
			add_character_modifier = { #attraction malus
				modifier = festival_king_of_fools_modifier
				years = 10
			}
			save_scope_as = final_jester
		}
		every_held_county = {
			add_county_modifier = {
				modifier = festival_feast_of_fools_county_modifier
				years = 5
			}
		}
		add_piety = minor_piety_loss
		cultural_festival.3070.bishop_angry_effect = yes
		scope:visiting_liege = { trigger_event = { id = cultural_festival.3071 days = 3 } }
		stress_impact = {
			forgiving = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
			zealous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = zealous
					has_trait = forgiving
					has_trait = compassionate
				}
			}
		}
	}
	
	option = { # pick someone with a sinful trait
		name = cultural_festival.3070.b
		if = { # become potential rivals
			limit = {
				scope:sinful_jester = {
					NOR = {
						has_relation_potential_rival = root
						has_relation_rival = root
						has_relation_nemesis = root
					}
				}
			}
			scope:sinful_jester = {
				set_relation_potential_rival = {
					target = root
					reason = rival_feast_of_fools
				}
			}
		}
		else = {
			scope:sinful_jester = {
				add_opinion = {
					target = root
					modifier = humiliated_opinion
					opinion = -20
				}
			}
		}
		scope:sinful_jester = {
			if = {
				limit = { is_male = no }
				give_nickname = nick_monarch_of_fools
			}
			else = {
				give_nickname = nick_monarch_of_fools_masc
			}
			add_character_modifier = { #attraction malus
				modifier = festival_king_of_fools_modifier
				years = 10
			}
			save_scope_as = final_jester
		}
		every_held_county = {
			add_county_modifier = {
				modifier = festival_feast_of_fools_county_modifier
				years = 5
			}
		}
		add_piety = minor_piety_loss
		#bishop doesn't really care that much since they're sinful
		scope:visiting_liege = { trigger_event = { id = cultural_festival.3071 days = 3 } }
		stress_impact = {
			compassionate = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = forgiving
					has_trait = compassionate
				}
			}
		}
	}
	
	option = { # pick the liege
		name = cultural_festival.3070.c
		trigger = {
			OR = {
				has_trait = callous
				has_trait = sadistic
				dread >= high_dread
			}
			opinion = { # you don't super like this person
				target = liege
				value <= 10
			}
			can_set_relation_rival_trigger = { CHARACTER = scope:visiting_liege }
		}
		if = {
			limit = {
				scope:visiting_liege = { is_ai = yes }
			}
			set_relation_rival = {
				target = scope:visiting_liege
				reason = rival_feast_of_fools
			}
		}
		every_held_county = {
			add_county_modifier = {
				modifier = festival_feast_of_fools_county_modifier
				years = 5
			}
		}
		add_piety = minor_piety_loss
		cultural_festival.3070.bishop_angry_effect = yes
		scope:visiting_liege = {
			save_scope_as = final_jester
			set_variable = im_the_jester_var
			trigger_event = { id = cultural_festival.3071 days = 3 }
		}
		stress_impact = {
			compassionate = minor_stress_impact_gain
			just = medium_stress_impact_gain
			loyal = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = just
					has_trait = loyal
				}
			}
			modifier = {
				factor = 2
				has_trait = callous
				opinion = {
					target = liege
					value <= 0
				}
			}
		}
	}
	
	option = { # absolutely not
		name = cultural_festival.3070.d
		add_piety = minor_piety_gain
		if = {
			limit = {
				scope:bishop = {
					NOR = {
						has_trait = cynical
						has_trait = gregarious
					}
				}
			}
			scope:bishop = {
				add_opinion = {
					target = root
					modifier = pious_opinion
					opinion = 10
				}
			}
		}
		stress_impact = {
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
			vengeful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = callous
					has_trait = sadistic
					has_trait = vengeful
				}
			}
		}
	}
}

# Liege: You observe a Feast of Fools
cultural_festival.3071 = {
	type = activity_event
	title = cultural_festival.3071.t
	desc = {
		desc = cultural_festival.3071.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					has_variable = im_the_jester_var
				}
				desc = cultural_festival.3071.desc_jester
			}
			desc = cultural_festival.3071.desc_fallback
		}
	}	

	theme = cultural_festival
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				has_variable = im_the_jester_var
				NOR = {
					has_trait = compassionate
					has_trait = forgiving
					has_trait = gregarious
					has_trait = lifestyle_reveler
				}
			}
			animation = anger
		}
		animation = happiness
	}
	right_portrait = {
		trigger = {
			root != scope:final_jester
		}
		character = scope:final_jester
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = vengeful
					has_trait = wrathful
					has_trait = callous
					has_trait = sadistic
				}
			}
			animation = anger
		}
		animation = boredom
		outfit_tags = { jester_outfit }
	}
	lower_center_portrait = scope:stop_host_scope

	option = { # great stuff
		name = cultural_festival.3071.a
		scope:activity = {
			add_activity_log_entry = {
				key = festival_of_fools_log
				tags = { good }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				root = {
					if = { #cultural acceptance if you're not the same culture
						limit = {
							scope:stop_host_scope.culture != root.culture
						}
						root.culture = {
							change_cultural_acceptance = {
								target = scope:stop_host_scope.culture
								value = major_cultural_acceptance_gain
								desc = cultural_acceptance_feast_of_fools
							}
						}
					}
					else = { #popular opinion
						scope:stop_host_scope = {
							every_held_county = {
								add_county_modifier = {
									modifier = festival_feast_of_fools_county_modifier
									years = 10
								}
							}
						}
					}
					add_piety = medium_piety_loss
				}
			}
		}
		stress_impact = {
			base = minor_stress_impact_loss
			callous = medium_stress_impact_loss
			sadistic = medium_stress_impact_loss
			diligent = minor_stress_impact_gain
			zealous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = zealous
					has_trait = diligent
				}
			}
			modifier = {
				factor = 2
				OR = {
					has_trait = callous
					has_trait = sadistic
				}
			}
		}
	}
	
	option = { # blasphemous
		name = cultural_festival.3071.b
		add_piety = medium_piety_gain
		if = { #if your priest is with you they like this
			limit = {
				current_travel_plan = {
					any_entourage_character = {
						has_council_position = councillor_court_chaplain
					}
				}
			}
			current_travel_plan = {
				random_entourage_character = {
					limit = {
						has_council_position = councillor_court_chaplain
					}
					add_opinion = {
						target = root
						modifier = pious_opinion
						opinion = 10
					}
				}
			}
		}
		stress_impact = {
			cynical = minor_stress_impact_gain
			lifestyle_reveler = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = cynical
					has_trait = lifestyle_reveler
					has_trait = gregarious
				}
			}
		}
	}
	
	option = { # hire the guy
		name = cultural_festival.3071.c
		trigger = {
			root != scope:final_jester
			can_appoint_char_to_court_position = {
				CHAR = scope:final_jester
				COURT_POS = court_jester_court_position
			}
		}
		scope:final_jester = { set_variable = king_of_fools_var } #75% discount forever
		recruit_to_entourage_court_and_activity_effect = { 
			CHAR_TO_ADD = scope:final_jester 
			NEW_COURT_OWNER = root
		}
		court_position_grant_effect = {
			POS = court_jester
			CANDIDATE = scope:final_jester
			EMPLOYER = root
		}
		stress_impact = {
			avaricious = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
			zealous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = avaricious
					has_trait = greedy
					has_trait = zealous
				}
			}
		}
	}
	
	option = { # how dare you???
		name = cultural_festival.3071.d
		trigger = {
			root = scope:final_jester
		}
		scope:activity = {
			add_activity_log_entry = {
				key = festival_of_fools_bad_log
				tags = { bad }
				character = scope:visiting_liege
				target = scope:stop_host_scope
				root = {
					if = {
						limit = { #if you're rivals but not nemesis become nemesis
							has_relation_rival = scope:stop_host_scope
							NOT = { has_relation_nemesis = scope:stop_host_scope}
						}
						set_relation_nemesis = {
							target = scope:stop_host_scope
							reason = rival_feast_of_fools
						}
					}
					else = {
						set_relation_rival = {
							target = scope:stop_host_scope
							reason = rival_feast_of_fools
						}
					}
				}
			}
		}
		stress_impact = {
			base = medium_stress_impact_loss
			compassionate = minor_stress_impact_gain
			calm = minor_stress_impact_gain
			forgiving = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = calm
					has_trait = forgiving
				}
			}
		}
	}
}

######################
## Liege: You end up in a conversation in a language you don't know
## 4000
## by Arkadiusz Majewski
######################

scripted_trigger unknown_language_character_trigger = { #pick someone you don't understand
	is_physically_able_ai_adult = yes
	culture = location.county.culture
	NOT = { knows_language_of_culture = scope:visiting_liege.culture }
}

scripted_trigger bilingual_character_trigger = { #pick someone that can understand both of you
	is_physically_able_ai_adult = yes
	knows_language_of_culture = scope:visiting_liege.culture 
	knows_language_of_culture = scope:local_character_scope.culture
	NOT = { has_any_relation_trigger = { CHARACTER = scope:stop_host_scope } }
}

cultural_festival.4000 = { #Liege: You end up in a conversation in a language you don't know
	type = activity_event
	title = cultural_festival.4000.t
	desc = cultural_festival.4000.desc	

	theme = cultural_festival

	left_portrait = {
		character = root
		animation = paranoia
	}
	right_portrait = {
		character = scope:local_translator_scope
		animation = worry
	}
	center_portrait = {
		character = scope:local_character_scope
		animation = disbelief
	}

	cooldown = { years = 5 }

	trigger = { #look for a character that you don't understand
		scope:stop_host_scope = { 
			any_courtier_or_guest = {
				unknown_language_character_trigger = yes
				save_temporary_scope_as = unknown_language_character_scope
			}
		}
		NOT = { knows_language_of_culture = scope:unknown_language_character_scope.culture }
	}

	immediate = {
		scope:stop_host_scope = {
			random_courtier_or_guest = { #pick someone you don't understand
				limit = {
					unknown_language_character_trigger = yes
				}
				save_scope_as = local_character_scope
			}
		}
		if = {
			limit = {
				scope:stop_host_scope = {
					any_courtier_or_guest = {
						bilingual_character_trigger = yes
					}
				 }
			}
			scope:stop_host_scope = {
				random_courtier_or_guest = { #pick someone that can understand both of you in vassals court
					limit = { 
						bilingual_character_trigger = yes
					 }
					save_scope_as = local_translator_scope
				}
			}
		}
		else_if = { #if above fails, pick someone that can understand both of you in your entourage
			limit = { 
				current_travel_plan = {
					any_entourage_character = {
						bilingual_character_trigger = yes
					}
				}
			}
			current_travel_plan = {
				random_entourage_character = {
					limit = {
						bilingual_character_trigger = yes
					}
					save_scope_as = local_translator_scope
				}
			}
		}
		else = { #if above still fails, just create them
			create_character = {
				template = scholar_character
				location = scope:stop_host_scope.location
				faith = location.county.faith
				culture = location.county.culture
				dynasty = none
				save_scope_as = local_translator_scope
			}
			hidden_effect = {
				scope:local_translator_scope = {
					learn_language_of_culture = root.culture
				}
			}
		}
	}

	option = { #hire one of them as a translator
		name = cultural_festival.4000.a
		add_character_modifier = { #gain bonus to learning languages
			modifier = interpreter_option_modifier
			years = 5
		}
		pay_short_term_gold = { #pay them to join
			target = scope:local_translator_scope
			gold = minor_gold_value
		}
		if = { #recruit them to court if you can
			limit = { 
				scope:local_translator_scope = {
					NOT = {
						is_courtier_of = scope:visiting_liege
					}
				}
			}
			scope:local_translator_scope = {
				add_to_court_and_entourage_effect = yes
			}
		}
		scope:cultural_festival_scope = { #gain popular opinion
			add_county_modifier = {
				modifier = appreciated_culture_modifier
				years = 5
			}
		}
		stress_impact = {
			ambitious = minor_stress_impact_loss
			greedy = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = lazy
					short_term_gold < minor_gold_value
				}
			}
		}
	}
	option = { #pretend to understand the convesation
		name = cultural_festival.4000.b
		duel = {
			skill = intrigue
			target = scope:local_translator_scope
			50 = {
				desc = cultural_festival.4000.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				} 
				send_interface_toast = {
					title = cultural_festival.4000.b.success
					left_icon = scope:local_translator_scope
					scope:cultural_festival_scope = { #gain popular opinion
						add_county_modifier = {
							modifier = appreciated_culture_modifier
							years = 5
						}
					}
					increase_tour_success_effect = { POINTS = 1 }
				}
			}
			50 = {
				desc = cultural_festival.4000.b.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				} 
				send_interface_toast = {
					title = cultural_festival.4000.b.failure
					left_icon = scope:local_translator_scope
					scope:cultural_festival_scope = { #lose popular opinion
						add_county_modifier = {
							modifier = no_culture_modifier
							years = 5
						}
					}
				}
			}
		}
		stress_impact = {
			deceitful = medium_stress_impact_loss
			shy = minor_stress_impact_gain
			craven = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				OR = {
					has_trait = shy
					has_trait = craven
				}
			}
		}
	}
	option = { #go away
		name = cultural_festival.4000.c
		stress_impact = {
			base = minor_stress_impact_loss
			shy = minor_stress_impact_loss
			craven = minor_stress_impact_loss
			brave = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				OR = {
					has_trait = gregarious
					has_trait = brave
				}
			}
		}
	}
}

######################
## Bilateral: Your courtier made a cultural faux pas
## 4100
## by Arkadiusz Majewski
######################

cultural_festival.4100 = { #Your courtier made a cultural faux pas
	type = activity_event
	title = cultural_festival.4100.t
	desc = cultural_festival.4100.desc	

	theme = cultural_festival

	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = {
		character = scope:offended_character_scope
		animation = shock
	}
	center_portrait = {
		character = scope:inconsiderate_character_scope
		animation = fear
	}

	cooldown = { years = 5 }

	trigger = {
		OR = {
			AND = {
				root = scope:visiting_liege
				any_courtier_or_guest = { #find someone in your court that could commit a faux pas
					age > 5
					culture != scope:stop_host_scope.culture
				}
			}
			AND = {
				root = scope:stop_host_scope
				any_courtier_or_guest = { #find someone in your court that could commit a faux pas
					age > 5
					culture != scope:visiting_liege.culture
				}
			}
		}
	}

	immediate = {
		if = { #set who is offended by the faux pas, either liege or vassal
			limit = {
				root = scope:visiting_liege
			}
			scope:stop_host_scope = {
				save_scope_as = offended_character_scope
			}
		}
		else = {
			scope:visiting_liege = {
				save_scope_as = offended_character_scope
			}
		}
		random_courtier_or_guest = { #find someone in your court that could commit a faux pas
			limit = {
				age > 5
				culture != scope:offended_character_scope.culture
			}
			save_scope_as = inconsiderate_character_scope
		}
		scope:offended_character_scope = {
			add_opinion = {
				target = scope:inconsiderate_character_scope
				modifier = insult_opinion
				opinion = -20
			}
		}
	}

	option = { #try to convince everyone it's just a misunderstanding using diplomacy skill
		name = cultural_festival.4100.a
		duel = {
			skill = diplomacy
			target = scope:offended_character_scope
			50 = { #on success gain opinion with both characters; gain cultural acceptance and increase tour success
				desc = cultural_festival.4100.a.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				modifier = {
					factor = 2
					has_activity_intent = altruism_intent
				}
				send_interface_toast = {
					title = cultural_festival.4100.a.success
					left_icon = scope:offended_character_scope
					scope:inconsiderate_character_scope = {
						add_opinion = {
							target = root
							modifier = grateful_opinion
							opinion = 20
						}
					}
					scope:offended_character_scope = {
						add_opinion = {
							target = root
							modifier = respect_opinion
							opinion = 10
						}
					}
					if = {
						limit = { root.culture != scope:offended_character_scope.culture }
						root.culture = {
							change_cultural_acceptance = {
								target = scope:offended_character_scope.culture
								value = miniscule_positive_culture_acceptance
								desc = cultural_acceptance_gain_hold_court_event_outcome
							}
						}
					}
					if = {
						limit = { root = scope:visiting_liege }
						increase_tour_success_effect = { POINTS = 1 }
					}
				}
			}
			50 = { #on fail gain opinion with offender, but lose with offended; lose cultural acceptance and decrease tour success
				desc = cultural_festival.4100.a.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = cultural_festival.4100.a.failure
					left_icon = scope:offended_character_scope
					scope:inconsiderate_character_scope = {
						add_opinion = {
							target = root
							modifier = respect_opinion
							opinion = 10
						}
					}
					scope:offended_character_scope = {
						add_opinion = {
							target = root
							modifier = insult_opinion
							opinion = -10
						}
					}
					if = {
						limit = { root.culture != scope:offended_character_scope.culture }
						root.culture = {
							change_cultural_acceptance = {
								target = scope:offended_character_scope.culture
								value = miniscule_negative_culture_acceptance
								desc = cultural_acceptance_gain_hold_court_event_outcome
							}
						}
					}
				}
			}
		}
		stress_impact = {
			compassionate = minor_stress_impact_loss
			honest = minor_stress_impact_loss
			callous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 10
				has_trait = compassionate
				has_trait = honest
			}
			modifier = {
				add = -20
				has_trait = callous
			}
		}
	}

	option = { #make the offender pay for their mistakes, gain opinion with offended
		name = cultural_festival.4100.b
		scope:inconsiderate_character_scope = {
			add_opinion = {
				target = root
				modifier = shamed_me_opinion
				opinion = -20
			}
			pay_short_term_gold = {
				target = scope:offended_character_scope
				gold = minor_gold_value
			}
		}
		scope:offended_character_scope = {
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = 20
			}
		}
		stress_impact = {
			vengeful = minor_stress_impact_loss
			wrathful = minor_stress_impact_loss
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				factor = 10
				has_relation_rival = scope:inconsiderate_character_scope
				has_relation_nemesis = scope:inconsiderate_character_scope
			}
			modifier = {
				add = 10
				OR = {
					has_trait = vengeful
					has_trait = wrathful
				}
			}
			modifier = {
				add = -20
				has_trait = compassionate
			}
		}
	}

	option = { #compensate in offenders name with gold; gain opinion with both
		name = cultural_festival.4100.c
		scope:inconsiderate_character_scope = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 20
			}
		}
		pay_short_term_gold = {
			target = scope:offended_character_scope
			gold = minor_gold_value
		}
		scope:offended_character_scope = {
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = 10
			}
		}
		stress_impact = {
			compassionate = minor_stress_impact_loss
			generous = minor_stress_impact_loss
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				factor = 0
				OR = {
					has_relation_rival = scope:inconsiderate_character_scope
					has_relation_nemesis = scope:inconsiderate_character_scope
					short_term_gold < minor_gold_value
				}
			}
			modifier = {
				add = 10
				OR = {
					has_trait = generous
					has_trait = compassionate
				}
			}
			modifier = {
				add = -20
				has_trait = greedy
			}
		}
	}
}

######################
## Bilateral: Vassal prepares a parade, Liege participates in the parade
## 4200-4203
## by Arkadiusz Majewski
######################

scripted_effect parade_liege_enjoyment_effect = { #rewards for liege if liege likes the parade
	if = {
		limit = {
			scope:stop_host_scope.var:parade_type = flag:military_parade
		}
		scope:visiting_liege = {
			add_character_modifier = {
				modifier = festival_military_parade_best_modifier
				years = 5
			}
		}
	}
	else_if = {
		limit = {
			scope:stop_host_scope.var:parade_type = flag:civil_parade
		}
		scope:visiting_liege = {
			add_character_modifier = {
				modifier = festival_civil_parade_best_modifier
				years = 5
			}
		}
	}
	else = {
		scope:visiting_liege = {
			add_character_modifier = {
				modifier = festival_religious_parade_best_modifier
				years = 5
			}
		}
	}
	if = {
		limit = { scope:visiting_liege.culture != location.county.culture }
		scope:visiting_liege.culture = {
			change_cultural_acceptance = {
				target = scope:stop_host_scope.location.county.culture
				value = major_cultural_acceptance_gain
				desc = cultural_acceptance_embraced_festival
			}
		}
	}
	scope:visiting_liege = {
		add_opinion = {
			target = scope:stop_host_scope
			modifier = impressed_opinion
			opinion = 10
		}
	}
}

scripted_effect parade_liege_dissatisfaction_effect = { #rewards for liege if liege dislikes the parade
	if = {
		limit = {
			scope:stop_host_scope.var:parade_type = flag:religious_parade
		}
		add_piety = minor_piety_gain
	}
	else = {
		add_prestige = minor_prestige_gain
	}
	scope:visiting_liege = {
		add_opinion = {
			target = scope:stop_host_scope
			modifier = bored_opinion
			opinion = -10
		}
		add_character_flag = parade_liege_dissatisfaction_flag
	}
}

scripted_effect liege_parade_enjoyment_custom_tt_effect = { #custom tooltip hint for player how likely the liege is to like the parade
	if = {
		limit = { scope:liege_parade_enjoyment_value > 2 }
		custom_tooltip = cultural_festival.4200.tt.liege_likes
	}
	else_if = {
		limit = { scope:liege_parade_enjoyment_value >= 0 }
		custom_tooltip = cultural_festival.4200.tt.liege_indifferent
	}
	else = {
		custom_tooltip = cultural_festival.4200.tt.liege_dislikes
	}
}

scripted_effect positive_opinion_after_parade_effect = {
	scope:stop_host_scope = {
		add_opinion = {
			target = scope:visiting_liege
			modifier = flattered_opinion
			opinion = 10
		}
	}
}

scripted_effect negative_opinion_after_parade_effect = {
	scope:stop_host_scope = {
		add_opinion = {
			target = scope:visiting_liege
			modifier = frustrated_opinion
			opinion = -10
		}
	}
}

scripted_effect parade_end_effect = { #rewards for vassal dependent on parade type and if liege liked the parade
	if = {
		limit = {
			var:parade_type = flag:military_parade
		}
		if = {
			limit = {
				var:liege_parade_enjoyment >= 3
			}
			scope:cultural_festival_scope = {
				add_county_modifier = {
					modifier = festival_military_parade_best_modifier
					years = 5
				}
			}
			dynasty = { add_dynasty_prestige = minor_dynasty_prestige_gain }
			if = {
				limit = { scope:visiting_liege = { has_character_flag = parade_liege_dissatisfaction_flag } }
				negative_opinion_after_parade_effect = yes
			}
			else = {
				positive_opinion_after_parade_effect = yes
			}
		}
		else_if = {
			limit = {
				OR = {
					var:liege_parade_enjoyment >= 0
					scope:visiting_liege = { NOT = { has_character_flag = parade_liege_dissatisfaction_flag } }
				}
			}
			scope:cultural_festival_scope = {
				add_county_modifier = {
					modifier = festival_military_parade_best_modifier
					years = 5
				}
			}
			dynasty = { add_dynasty_prestige = minor_dynasty_prestige_gain }
		}
		else = {
			scope:cultural_festival_scope = {
				add_county_modifier = {
					modifier = festival_military_parade_modifier
					years = 5
				}
			}
			dynasty ?= { add_dynasty_prestige = miniscule_dynasty_prestige_gain }
			negative_opinion_after_parade_effect = yes
		}
	}
	else_if = {
		limit = {
			var:parade_type = flag:civil_parade
		}
		if = {
			limit = {
				var:liege_parade_enjoyment >= 3
			}
			scope:cultural_festival_scope = {
				add_county_modifier = {
					modifier = festival_civil_parade_best_modifier
					years = 5
				}
			}
			add_prestige = minor_prestige_gain
			if = {
				limit = { scope:visiting_liege = { has_character_flag = parade_liege_dissatisfaction_flag } }
				negative_opinion_after_parade_effect = yes
			}
			else = {
				positive_opinion_after_parade_effect = yes
			}
		}
		else_if = {
			limit = {
				OR = {
					var:liege_parade_enjoyment >= 0
					scope:visiting_liege = { NOT = { has_character_flag = parade_liege_dissatisfaction_flag } }
				}
			}
			scope:cultural_festival_scope = {
				add_county_modifier = {
					modifier = festival_civil_parade_best_modifier
					years = 5
				}
			}
			add_prestige = minor_prestige_gain
		}
		else = {
			scope:cultural_festival_scope = {
				add_county_modifier = {
					modifier = festival_civil_parade_modifier
					years = 5
				}
			}
			add_prestige = miniscule_prestige_gain
			negative_opinion_after_parade_effect = yes
		}
	}
	else_if = {
		limit = {
			var:parade_type = flag:religious_parade
		}
		if = {
			limit = {
				var:liege_parade_enjoyment >= 3
			}
			scope:cultural_festival_scope = {
				add_county_modifier = {
					modifier = festival_religious_parade_best_modifier
					years = 5
				}
			}
			add_piety = minor_piety_gain
			if = {
				limit = { scope:visiting_liege = { has_character_flag = parade_liege_dissatisfaction_flag } }
				negative_opinion_after_parade_effect = yes
			}
			else = {
				positive_opinion_after_parade_effect = yes
			}
		}
		else_if = {
			limit = {
				OR = {
					var:liege_parade_enjoyment >= 0
					scope:visiting_liege = { NOT = { has_character_flag = parade_liege_dissatisfaction_flag } }
				}
			}
			scope:cultural_festival_scope = {
				add_county_modifier = {
					modifier = festival_religious_parade_best_modifier
					years = 5
				}
			}
			add_piety = minor_piety_gain
		}
		else = {
			scope:cultural_festival_scope = {
				add_county_modifier = {
					modifier = festival_religious_parade_modifier
					years = 5
				}
			}
			add_piety = miniscule_piety_gain
			negative_opinion_after_parade_effect = yes
		}
	}
}

scripted_effect clear_parade_variables_effect = { #clear all variables and flags
	remove_variable = parade_type
	remove_variable = parade_quality
	remove_variable = liege_parade_type
	remove_variable = liege_parade_enjoyment
	if = {
		limit = {
			scope:visiting_liege = {
				has_character_flag = parade_liege_dissatisfaction_flag
			}
		}
		scope:visiting_liege = {
			remove_character_flag = parade_liege_dissatisfaction_flag
		}
	}
}

cultural_festival.4200 = { #Vassal: Do a parade, pick a type
	type = activity_event
	title = cultural_festival.4200.t
	desc = cultural_festival.4200.desc	

	theme = cultural_festival

	left_portrait = {
		character = root
		animation = thinking
	}

	cooldown = { years = 5 }

	trigger = {
		scope:visiting_liege = {
			NOT = { has_character_flag = had_cultural_parade }
		}
		any_courtier = {
			is_available_ai_adult = yes
		}
	}

	immediate = {
		set_variable = { #used later to determine outcomes, descriptions and ai chance
			name = liege_parade_enjoyment
			value = 0
		}
		random_list = { #decide which parade the liege likes by setting a var, used later to determine outcomes, descriptions and ai chance
			1 = {
				modifier = {
					add = 10
					scope:visiting_liege = { OR = { highest_skill = martial highest_skill = intrigue } }
				}
				modifier = {
					add = 10
					scope:visiting_liege = { OR = { has_lifestyle = martial_lifestyle has_lifestyle = intrigue_lifestyle } }
				}
				set_variable = {
					name = liege_parade_type
					value = flag:military_parade
				}
			}
			1 = {
				modifier = {
					add = 10
					scope:visiting_liege = { OR = { highest_skill = diplomacy highest_skill = stewardship } }
				}
				modifier = {
					add = 10
					scope:visiting_liege = { OR = { has_lifestyle = diplomacy_lifestyle has_lifestyle = stewardship_lifestyle } }
				}
				modifier = {
					add = 10
					scope:visiting_liege.culture != location.county.culture
				}
				set_variable = {
					name = liege_parade_type
					value = flag:civil_parade
				}
			}
			1 = {
				modifier = {
					add = 10
						scope:visiting_liege = { highest_skill = learning }
				}
				modifier = {
					add = 10
					scope:visiting_liege = { has_lifestyle = learning_lifestyle }
				}				
				modifier = {
					add = 10
					scope:visiting_liege.faith != location.county.faith
				}
				modifier = {
					add = 10
					scope:visiting_liege = { has_trait = zealous }
				}
				set_variable = {
					name = liege_parade_type
					value = flag:religious_parade
				}
			}
		}
		scope:visiting_liege = { #makes sure that event does not trigger for liege with multiple vassals during the same tour
			add_character_flag = {
				flag = had_cultural_parade
				days = 3650
			}
		}
	}

	option = { #pick military parade, set liege enjoyment according to parade type they like
		name = cultural_festival.4200.a
		if = {
			limit = { var:liege_parade_type = flag:military_parade }
			custom_tooltip = cultural_festival.4200.tt.liege_likes
			change_variable = {
				name = liege_parade_enjoyment
				add = 2
			}
		}
		else_if = {
			limit = { var:liege_parade_type = flag:religious_parade }
			custom_tooltip = cultural_festival.4200.tt.liege_indifferent
		}
		else_if = {
			limit = { var:liege_parade_type = flag:civil_parade }
			custom_tooltip = cultural_festival.4200.tt.liege_dislikes
			change_variable = {
				name = liege_parade_enjoyment
				add = -2
			}
		}
		set_variable = {
			name = parade_type
			value = flag:military_parade
		}
		stress_impact = {
			base = minor_stress_impact_loss
			brave = minor_stress_impact_loss
			craven = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 10
				var:liege_parade_type = flag:military_parade
			}
		}
	}

	option = { #pick civil parade, set liege enjoyment according to parade type they like
		name = cultural_festival.4200.b
		if = {
			limit = { var:liege_parade_type = flag:civil_parade }
			custom_tooltip = cultural_festival.4200.tt.liege_likes
			change_variable = {
				name = liege_parade_enjoyment
				add = 2
			}
		}
		else_if = {
			limit = { var:liege_parade_type = flag:military_parade }
			custom_tooltip = cultural_festival.4200.tt.liege_indifferent
		}
		else_if = {
			limit = { var:liege_parade_type = flag:religious_parade }
			custom_tooltip = cultural_festival.4200.tt.liege_dislikes
			change_variable = {
				name = liege_parade_enjoyment
				add = -2
			}
		}
		set_variable = {
			name = parade_type
			value = flag:civil_parade
		}
		stress_impact = {
			base = minor_stress_impact_loss
			just = minor_stress_impact_loss
			arbitrary = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 10
				var:liege_parade_type = flag:civil_parade
			}
		}
	}

	option = { #pick religious parade, set liege enjoyment according to parade type they like
		name = cultural_festival.4200.c
		if = {
			limit = { var:liege_parade_type = flag:religious_parade }
			custom_tooltip = cultural_festival.4200.tt.liege_likes
			change_variable = {
				name = liege_parade_enjoyment
				add = 2
			}
		}
		else_if = {
			limit = { var:liege_parade_type = flag:civil_parade }
			custom_tooltip = cultural_festival.4200.tt.liege_indifferent
		}
		else_if = {
			limit = { var:liege_parade_type = flag:military_parade }
			custom_tooltip = cultural_festival.4200.tt.liege_dislikes
			change_variable = {
				name = liege_parade_enjoyment
				add = -2
			}
		}
		set_variable = {
			name = parade_type
			value = flag:religious_parade
		}
		stress_impact = {
			base = minor_stress_impact_loss
			zealous = minor_stress_impact_loss
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 10
				var:liege_parade_type = flag:religious_parade
			}
		}
	}
	after = {
		trigger_event = cultural_festival.4201
	}
}

cultural_festival.4201 = { #Vassal: Choose the quality of the parade
	type = activity_event
	title = cultural_festival.4201.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { var:parade_type = flag:military_parade }
				desc = cultural_festival.4201.desc_military
			}
			triggered_desc = {
				trigger = { var:parade_type = flag:civil_parade }
				desc = cultural_festival.4201.desc_civil
			}
			triggered_desc = {
				trigger = { var:parade_type = flag:religious_parade }
				desc = cultural_festival.4201.desc_religious
			}
		}
		desc = cultural_festival.4201.desc_end
	}

	theme = cultural_festival

	left_portrait = {
		character = root
		animation = worry
	}

	right_portrait = {
		character = scope:coordinator_scope
		animation = thinking
	}

	immediate = {
		if = { #set proper councillor as the parade coordinator
			limit = { 
				var:parade_type = flag:military_parade 
				exists = cp:councillor_marshal
			}
			cp:councillor_marshal = {
				save_scope_as = coordinator_scope
			}
		}
		else_if = {
			limit = { 
				var:parade_type = flag:civil_parade 
				exists = cp:councillor_steward
			}
			cp:councillor_steward = {
				save_scope_as = coordinator_scope
			}
		}
		else_if = {
			limit = { 
				var:parade_type = flag:religious_parade 
				exists = cp:councillor_court_chaplain
			}
			cp:councillor_court_chaplain = {
				save_scope_as = coordinator_scope
			}
		}
		else = {
			random_courtier = {
				limit = {
					is_available_ai_adult = yes
				}
				save_scope_as = coordinator_scope
			}
		}
		set_variable = { #used later to determine outcomes and descriptions
			name = parade_quality
			value = 0
		}
	}

	option = { #make the best parade possible
		name = {
			trigger = { var:parade_type = flag:military_parade }
			text = cultural_festival.4201.a.military
		}
		name = {
			trigger = { var:parade_type = flag:civil_parade }
			text = cultural_festival.4201.a.civil
		}
		name = {
			trigger = { var:parade_type = flag:religious_parade }
			text = cultural_festival.4201.a.religious
		}
		save_temporary_scope_value_as = { #value needed to set proper custom tooltip hinting how it will affect your liege
			name = liege_parade_enjoyment_value
			value = { value = var:liege_parade_enjoyment add = 3 }
		}
		liege_parade_enjoyment_custom_tt_effect = yes
		remove_treasury_or_gold = major_treasury_or_gold_value
		change_variable = {
			name = parade_quality
			add = 3
		}
		change_variable = {
			name = liege_parade_enjoyment
			add = var:parade_quality
		}
		stress_impact = {
			arrogant = minor_stress_impact_loss
			ambitious = minor_stress_impact_loss
			gluttonous = minor_stress_impact_loss
			humble = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 10
				OR = {
					has_trait = arrogant
					has_trait = ambitious
					has_trait = gluttonous
				}
			}
			modifier = {
				add = 10
				AND = {
					has_trait = zealous
					var:parade_type = flag:religious_parade
				}
			}
			modifier = {
				factor = 0
				short_term_treasury_or_gold < major_treasury_or_gold_value
			}
		}
	}

	option = { #make an ok parade
		name = cultural_festival.4201.b
		save_temporary_scope_value_as = { #value needed to set proper custom tooltip hinting how it will affect your liege
			name = liege_parade_enjoyment_value
			value = { value = var:liege_parade_enjoyment add = 2 }
		}
		liege_parade_enjoyment_custom_tt_effect = yes
		remove_treasury_or_gold = minor_treasury_or_gold_value
		change_variable = {
			name = parade_quality
			add = 2
		}
		change_variable = {
			name = liege_parade_enjoyment
			add = var:parade_quality
		}
		stress_impact = {
			temperate = minor_stress_impact_loss
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 10
				has_trait = temperate
			}
			modifier = {
				factor = 0
				short_term_treasury_or_gold < minor_treasury_or_gold_value
			}
		}
	}

	option = {  #make a poor parade
		name = cultural_festival.4201.c
		save_temporary_scope_value_as = { #value needed to set proper custom tooltip hinting how it will affect your liege
			name = liege_parade_enjoyment_value
			value = { value = var:liege_parade_enjoyment add = -1 }
		}
		liege_parade_enjoyment_custom_tt_effect = yes
		add_prestige = miniscule_prestige_loss
		change_variable = {
			name = parade_quality
			add = -1
		}
		change_variable = {
			name = liege_parade_enjoyment
			add = var:parade_quality
		}
		stress_impact = {
			base = minor_stress_impact_loss
			greedy = minor_stress_impact_loss
			cynical = minor_stress_impact_loss
			humble = minor_stress_impact_loss
			ambitious = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 10
				OR = {
					has_trait = greedy
					has_trait = cynical
					has_trait = humble
				}
			}
			modifier = {
				add = 10
				AND = {
					has_trait = cynical
					var:parade_type = flag:religious_parade
				}
			}
		}
	}

	after = {
		scope:visiting_liege = {
			trigger_event = {
				id = cultural_festival.4202
				days = 1
			}
		}
	}
}

cultural_festival.4202 = { #Liege: Attend the parade and like it or not
	type = activity_event
	title = cultural_festival.4202.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:stop_host_scope.var:parade_type = flag:military_parade 
					scope:stop_host_scope.var:parade_quality > 2 
				}
				desc = cultural_festival.4202.desc_military_best
			}
			triggered_desc = {
				trigger = {
					scope:stop_host_scope.var:parade_type = flag:military_parade
					scope:stop_host_scope.var:parade_quality >= 0
				}
				desc = cultural_festival.4202.desc_military_good
			}
			triggered_desc = {
				trigger = {
					scope:stop_host_scope.var:parade_type = flag:military_parade
					scope:stop_host_scope.var:parade_quality < 0
				}
				desc = cultural_festival.4202.desc_military_worst
			}
			triggered_desc = {
				trigger = {
					scope:stop_host_scope.var:parade_type = flag:civil_parade
					scope:stop_host_scope.var:parade_quality > 2
				}
				desc = cultural_festival.4202.desc_civil_best
			}
			triggered_desc = {
				trigger = {
					scope:stop_host_scope.var:parade_type = flag:civil_parade
					scope:stop_host_scope.var:parade_quality >= 0
				}
				desc = cultural_festival.4202.desc_civil_good
			}
			triggered_desc = {
				trigger = {
					scope:stop_host_scope.var:parade_type = flag:civil_parade
					scope:stop_host_scope.var:parade_quality < 0
				}
				desc = cultural_festival.4202.desc_civil_worst
			}
			triggered_desc = {
				trigger = {
					scope:stop_host_scope.var:parade_type = flag:religious_parade
					scope:stop_host_scope.var:parade_quality > 2
				}
				desc = cultural_festival.4202.desc_religious_best
			}
			triggered_desc = {
				trigger = {
					scope:stop_host_scope.var:parade_type = flag:religious_parade
					scope:stop_host_scope.var:parade_quality >= 0
				}
				desc = cultural_festival.4202.desc_religious_good
			}
			triggered_desc = {
				trigger = {
					scope:stop_host_scope.var:parade_type = flag:religious_parade
					scope:stop_host_scope.var:parade_quality < 0
				}
				desc = cultural_festival.4202.desc_religious_worst
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:stop_host_scope.var:parade_type = flag:religious_parade
					scope:stop_host_scope.faith != scope:visiting_liege.faith
					scope:stop_host_scope.var:parade_quality >= 0
				}
				desc = cultural_festival.4202.desc_religious_different_faith_good
			}
			triggered_desc = {
				trigger = {
					scope:stop_host_scope.var:parade_type = flag:religious_parade
					scope:stop_host_scope.faith = scope:visiting_liege.faith
					scope:stop_host_scope.var:parade_quality >= 0
				}
				desc = cultural_festival.4202.desc_religious_same_faith_good
			}
			triggered_desc = {
				trigger = {
					scope:stop_host_scope.var:parade_type = flag:religious_parade
					scope:stop_host_scope.faith != scope:visiting_liege.faith
					scope:stop_host_scope.var:parade_quality < 0
				}
				desc = cultural_festival.4202.desc_religious_different_faith_bad
			}
			triggered_desc = {
				trigger = {
					scope:stop_host_scope.var:parade_type = flag:religious_parade
					scope:stop_host_scope.faith = scope:visiting_liege.faith
					scope:stop_host_scope.var:parade_quality < 0
				}
				desc = cultural_festival.4202.desc_religious_same_faith_bad
			}
		}
	}

	theme = cultural_festival

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:coordinator_scope
		animation = happiness
	}

	option = { #you enjoy the parade, for ai liege_parade_enjoyment var decides
		name = {
			trigger = { has_activity_intent = reduce_stress_intent }
		 	text = cultural_festival.4202.a.revelry
		}
		name = cultural_festival.4202.a
		parade_liege_enjoyment_effect = yes
		if = {
			limit = { has_activity_intent = reduce_stress_intent }
			increase_tour_success_effect = { POINTS = 1 }
		}
		stress_impact = {
			base = minor_stress_impact_loss
			gregarious = minor_stress_impact_loss
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 100
				scope:stop_host_scope.var:liege_parade_enjoyment >= 0
			}
		}
	}

	option = { #you don't enjoy the parade, for ai liege_parade_enjoyment var decides
		name = cultural_festival.4202.b
		parade_liege_dissatisfaction_effect = yes
		stress_impact = {
			base = minor_stress_impact_loss
			callous = minor_stress_impact_loss
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 100
				scope:stop_host_scope.var:liege_parade_enjoyment < 0
			}
			modifier = {
				factor = 0
				has_activity_intent = reduce_stress_intent
			}
		}
	}

	after = {
		scope:stop_host_scope = {
			trigger_event = { id = cultural_festival.4203 days = 1 }
		}
	}
}

cultural_festival.4203 = { #Vassal: Summary of the parade
	type = activity_event
	title = cultural_festival.4203.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:visiting_liege = { has_character_flag = parade_liege_dissatisfaction_flag } }
				desc = cultural_festival.4203.desc_failure
			}
			desc = cultural_festival.4203.desc_success
		}
	}

	theme = cultural_festival

	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { scope:visiting_liege = { has_character_flag = parade_liege_dissatisfaction_flag } }
			animation = anger
		}
		animation = happiness
	}

	right_portrait = {
		character = scope:visiting_liege
		triggered_animation = {
			trigger = { scope:visiting_liege = { has_character_flag = parade_liege_dissatisfaction_flag } }
			animation = disapproval
		}
		animation = admiration
	}

	immediate = { #display what was the liege reaction to the parade, based on option chosen in previous event
		if = {
			limit = {
				scope:visiting_liege = {
					has_character_flag = parade_liege_dissatisfaction_flag
				}
			}
			show_as_tooltip = {
				parade_liege_dissatisfaction_effect = yes
			}
		}
		else = {
			show_as_tooltip = {
				parade_liege_enjoyment_effect = yes
			}
		}
	}

	option = { #effect is determined by previous actions, mainly liege_parade_enjoyment or overide by player
		name = {
			trigger = { scope:visiting_liege = { NOT = { has_character_flag = parade_liege_dissatisfaction_flag } } }
			text = cultural_festival.4203.a.success		
		}
		name = {
			trigger = { scope:visiting_liege = { has_character_flag = parade_liege_dissatisfaction_flag } }
			text = cultural_festival.4203.a.failure
		}
		parade_end_effect = yes
		if = {
			limit  = { scope:visiting_liege = { NOT = { has_character_flag = parade_liege_dissatisfaction_flag } } }
			stress_impact = {
				base = major_stress_impact_loss
			}
		}
		else = {
			stress_impact = {
				base = minor_stress_impact_loss
			}
		}
	}

	after = {
		clear_parade_variables_effect = yes
	}
}

######################
## Bilateral: Vassal and Liege exchange gifts; later they can decide to check up on them
## 4300-4312
## by Arkadiusz Majewski
######################

scripted_effect create_cultural_artifact_effect = { #create a random artifact to possibly give as a gift
	random_list = {
		10 = {
			create_artifact_weapon_effect = {
				OWNER = root
				CREATOR = root
				SET_WEAPON_TYPE = flag:no
			}
		}
		10 = {
			create_artifact_armor_effect = {
				OWNER = root
				CREATOR = root
				SET_ARMOR_TYPE = flag:no
			}
		}
		10 = {
			create_artifact_regalia_effect = {
				OWNER = root
				SMITH = root
			}
		}
		10 = {
			create_artifact_crown_effect = {
				OWNER = root
				SMITH = root
			}
		}
		10 = {
			create_artifact_brooch_effect = {
				OWNER = root
				SMITH = root
			}
		}
		10 = {
			create_artifact_book_effect = {
				OWNER = root 
				CREATOR = root
				SET_SUBJECT = flag:no
				SET_TOPIC = flag:no
			}
		}
	}
	scope:newly_created_artifact = {
		set_artifact_description = artifact_cultural_gift_desc
	}
}

scripted_effect choose_gift_effect = { #used only in tooltip to show the gift receiver what happened
	if = {
		limit = { exists = $CHOSEN_GIFT$ }
		if = {
			limit = { $CHOSEN_GIFT$ = flag:gift_existing_artifact }
			scope:existing_artifact = {
				set_owner = root
			}
		}
		else_if = {
			limit = { $CHOSEN_GIFT$ = flag:gift_newly_created_artifact }
			scope:newly_created_artifact = {
				set_owner = root
			}
		}
		else_if = {
			limit = { $CHOSEN_GIFT$ = flag:gift_gold }
			$GIFT_GIVER$ = {
				pay_short_term_gold = { 
					target = root
					gold = minor_gold_value
				}
			}
		}
	}
}

scripted_effect create_giving_gift_memory_effect = { #create a memory of giving a gift
	create_character_memory = {
		type = gave_cultural_gift_memory
		participants = {
			gift_receiver = $GIFT_RECEIVER$
		}
	}
	if = {
		limit = { exists = scope:new_memory }
		scope:new_memory = {
			set_variable = {
				name = gift_type
				value = scope:gifted_artifact
			}
			if = {
				limit = { exists = var:gift_type }
				#To prevent 'unused except in loc' errors
			}
		}
	}
}

scripted_effect give_artifact_gift_opinion_effect = {
	if = {
		limit = { root = scope:visiting_liege }
		scope:visiting_liege = {
			add_opinion = {
				target = scope:stop_host_scope
				modifier = gift_artifact_opinion 
				opinion = 30
			}
		}
	}
	else = {
		scope:stop_host_scope = {
			add_opinion = {
				target = scope:visiting_liege
				modifier = gift_artifact_opinion 
				opinion = 30
			}
		}
	}
}

scripted_effect give_gold_gift_opinion_effect = {
	if = {
		limit = { root = scope:visiting_liege }
		scope:visiting_liege = {
			add_opinion = {
				target = scope:stop_host_scope
				modifier = gift_opinion 
				opinion = 15
			}
		}
	}
	else = {
		scope:stop_host_scope = {
			add_opinion = {
				target = scope:visiting_liege
				modifier = gift_opinion 
				opinion = 15
			}
		}
	}
}

scripted_trigger vassal_gift_giving_memory_trigger = { #check if vassal remembers giving liege a gift
	has_memory_type = gave_cultural_gift_memory
	any_memory_participant = {
		this = scope:visiting_liege
	}
}

scripted_effect equip_gifted_artifact_effect = { #equip the gift if possible
	if = {
		limit = { can_equip_artifact = scope:gifted_artifact }
		custom_tooltip = cultural_festival.4301.a.tt
		scope:gifted_artifact = {
			equip_artifact_to_owner_replace = yes
		}
	}
}

scripted_effect delete_new_artifact_effect = { #destroy newly created artifact if it wasn't picked as a gift
	destroy_artifact = scope:newly_created_artifact
}

cultural_festival.4300 = { #Vassal: Decide which gift to give
	type = activity_event
	title = cultural_festival.4300.t
	desc = {
		desc = cultural_festival.4300.desc
		triggered_desc = {
			trigger = { exists = scope:existing_artifact }
			desc = cultural_festival.4300.desc_existing_artifact
		}
	}

	theme = cultural_festival

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:visiting_liege
		animation = boredom
	}

	artifact = {
		trigger = { exists = scope:existing_artifact }
		target = scope:existing_artifact
		position = lower_left_portrait
	}

	artifact = {
		trigger = { exists = scope:newly_created_artifact }
		target = scope:newly_created_artifact
		position = lower_center_portrait
	}

	cooldown = { years = 5 }

	trigger = { #check if you have a memory of giving your liege a gift
		root = {
			NOT = { 
				any_memory = {
					vassal_gift_giving_memory_trigger = yes
				}
			}
		}
	}

	immediate = {
		if = { #look for any insignificant artifact you have and save it as something to gift
			limit = {
				has_any_artifact = yes
				any_character_artifact = {
					category = inventory
				}
			}
			random_character_artifact = {
				limit = {
					category = inventory
					NOT = { has_variable = historical_unique_artifact }
				}
				save_scope_as = existing_artifact
			}
		}
		hidden_effect = { #create new artifact and save it as something to gift
			create_cultural_artifact_effect = yes
		}
		add_character_flag = {  #to make sure to not trigger 4310 in the same tour you gave the gift
			flag = gave_gift_recently_flag
			days = 1825
		}
	}

	option = { #gift an already nonsignificant existing artifact from root inventory
		trigger = {
			exists = scope:existing_artifact
		}
		name = cultural_festival.4300.a
		scope:existing_artifact = {
			set_variable = {
				name = suppress_artifact_notifications
				value = yes
				days = 1
			}
			set_variable = { 
				name = gifted_artifact 
				value = yes
				days = 1825
			}
			set_owner = {
				target = scope:visiting_liege
				history = {
					location = scope:stop_host_scope.location
					actor = scope:stop_host_scope
					recipient = scope:visiting_liege
					type = given
				}
			}
			save_scope_as = gifted_artifact
		}
		save_scope_value_as = { #used later to determine outcomes and description
			name = vassal_chosen_gift
			value = flag:gift_existing_artifact
		}
		create_giving_gift_memory_effect = { GIFT_RECEIVER = scope:visiting_liege } #remember that you gave a gift to liege, used later to trigger a follow up event
		show_as_tooltip = {
			give_artifact_gift_opinion_effect = yes
		}
		hidden_effect = { #delete the newly created artifact, because it wasn't gifted away
			delete_new_artifact_effect = yes
		}
		scope:visiting_liege = {
			trigger_event = cultural_festival.4301
		}
		custom_tooltip = cultural_festival.4300.tt
		stress_impact = {
			compassionate = minor_stress_impact_loss
			greedy = minor_stress_impact_loss
		}
		ai_chance = {
			base = 10
		}
	}

	option = { #gift the newly created artifact
		name = cultural_festival.4300.b
		remove_short_term_gold = minor_gold_value
		scope:newly_created_artifact = {
			set_variable = {
				name = suppress_artifact_notifications
				value = yes
				days = 1
			}
			set_variable = { 
				name = gifted_artifact 
				value = yes
				days = 1825
			}
			set_owner = {
				target = scope:visiting_liege
				history = {
					location = scope:visiting_liege.location
					actor = scope:stop_host_scope
					recipient = scope:visiting_liege
					type = given
				}
			}
			save_scope_as = gifted_artifact
		}
		save_scope_value_as = { #used later to determine outcomes and description
			name = vassal_chosen_gift
			value = flag:gift_newly_created_artifact
		}
		create_giving_gift_memory_effect = { GIFT_RECEIVER = scope:visiting_liege } #remember that you gave a gift to liege, used later to trigger a follow up event
		show_as_tooltip = {
			give_artifact_gift_opinion_effect = yes
		}
		scope:visiting_liege = {
			trigger_event = cultural_festival.4301
		}
		custom_tooltip = cultural_festival.4300.tt
		stress_impact = {
			generous = minor_stress_impact_loss
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 5
			modifier = {
				factor = 0
				has_trait = greedy
				short_term_gold < minor_gold_value
			}
		}
	}

	option = { #gift just gold
		name = cultural_festival.4300.c
		pay_short_term_gold = { 
			target = scope:visiting_liege
			gold = minor_gold_value
		}
		save_scope_value_as = { #used later to determine outcomes and description
			name = vassal_chosen_gift
			value = flag:gift_gold
		}
		show_as_tooltip = {
			give_gold_gift_opinion_effect = yes
		}
		hidden_effect = { #delete the newly created artifact, because it wasn't gifted away
			delete_new_artifact_effect = yes
		}
		scope:visiting_liege = {
			trigger_event = cultural_festival.4301
		}
		custom_tooltip = cultural_festival.4300.tt
		stress_impact = {
			cynical = minor_stress_impact_loss
			generous = major_stress_impact_loss
			greedy = major_stress_impact_gain
		}
		ai_chance = { #this should be the least likely option when player is the gift receiver to ensure the follow up event triggering for them
			base = 1
			modifier = {
				factor = 0
				has_trait = greedy
				short_term_gold < minor_gold_value
			}
		}
	}
	
	option = { #no, i don't think I will
		name = cultural_festival.4300.d
		hidden_effect = {
			delete_new_artifact_effect = yes
		}
		stress_impact = {
			cynical = major_stress_impact_loss
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 10
				has_trait = cynical
			}
		}
	}
}

cultural_festival.4301 = { #Liege: Get the gift from vassal and decide to keep it or destroy it
	type = activity_event
	title = cultural_festival.4301.t
	desc = {
		desc = cultural_festival.4301.desc	
		first_valid = {
			triggered_desc = {
				trigger = { scope:vassal_chosen_gift = flag:gift_gold }
				desc = cultural_festival.4301.desc_gold
			}
			desc = cultural_festival.4301.desc_artifact
		}
	}

	theme = cultural_festival

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:stop_host_scope
		animation = happiness
	}
	
	artifact = {
		trigger = { exists = scope:gifted_artifact }
		target = scope:gifted_artifact
		position = lower_center_portrait
	}

	immediate = { #display root what was the gift
		show_as_tooltip = {
			choose_gift_effect = { 
				CHOSEN_GIFT = scope:vassal_chosen_gift 	
				GIFT_GIVER = scope:stop_host_scope 
			}
		}
		give_artifact_gift_opinion_effect = yes
	}

	option = { #keep it, equip it if possible
		name = cultural_festival.4301.a
		trigger = { NOT = { scope:vassal_chosen_gift = flag:gift_gold } }
		equip_gifted_artifact_effect = yes
		scope:gifted_artifact = {
			set_variable = {
				name = received_as_cultural_gift
				value = scope:vassal_chosen_gift
			}
		}
		stress_impact = {
			trusting = minor_stress_impact_loss
			humble = minor_stress_impact_loss
			paranoid = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 10
				OR = {
					has_trait = honest
					has_trait = just
				}
			}
			modifier = {
				add = 100
				OR = {
					has_relation_friend = scope:stop_host_scope
					has_relation_best_friend = scope:stop_host_scope
					has_relation_lover = scope:stop_host_scope
					has_relation_soulmate = scope:stop_host_scope
				}
			}
		}
	}

	option = { #get rid of the gift, quietly
		name = cultural_festival.4301.b
		trigger = { NOT = { scope:vassal_chosen_gift = flag:gift_gold } }
		destroy_artifact = scope:gifted_artifact
		add_gold = minor_gold_value
		stress_impact = {
			trusting = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			paranoid = major_stress_impact_loss
			arrogant = minor_stress_impact_loss
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 50
				has_trait = paranoid
			}
			modifier = {
				add = 10
				OR = {
					has_trait = deceitful
					has_trait = cynical
				}
			}
			modifier = {
				add = 100
				OR = {
					has_relation_rival = scope:stop_host_scope
					has_relation_nemesis = scope:stop_host_scope
				}
			}
		}
	}

	option = { #yay, you got gold!
		name = cultural_festival.4301.c
		trigger = { scope:vassal_chosen_gift = flag:gift_gold }	
		give_gold_gift_opinion_effect = yes
		stress_impact = {
			greedy = major_stress_impact_loss
			paranoid = minor_stress_impact_loss
		}
		ai_chance = { #actually, doesn't matter as it is the only option if you got gifted gold
			base = 1
		}
	}

	after = {
		trigger_event = cultural_festival.4302
		custom_tooltip = cultural_festival.4301.tt
	}
}

cultural_festival.4302 = { #Liege: Pick the gift for Vassal, mirror of cultural_festival.4300
	type = activity_event
	title = cultural_festival.4302.t
	desc = {
		desc = cultural_festival.4302.desc
		triggered_desc = {
			trigger = { exists = scope:existing_artifact }
			desc = cultural_festival.4302.desc_existing_artifact
		}
		first_valid = {
			triggered_desc = {
				trigger = { scope:vassal_chosen_gift = flag:gift_gold }
				desc = cultural_festival.4302.desc_gifted_gold
			}
			desc = cultural_festival.4302.desc_gold
		}
	}

	theme = cultural_festival

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:stop_host_scope
		animation = happiness
	}

	artifact = {
		trigger = { exists = scope:existing_artifact }
		target = scope:existing_artifact
		position = lower_left_portrait
	}

	artifact = {
		trigger = { exists = scope:newly_created_artifact }
		target = scope:newly_created_artifact
		position = lower_center_portrait
	}
	
	immediate = {
		if = {
			limit = {
				root = {
					has_any_artifact = yes
					any_character_artifact = {
						category = inventory
						NOT = { has_variable = historical_unique_artifact }
						NOT = { has_variable = received_as_cultural_gift } #make sure you don't give back the thing you just got
					}
				}
			}
			random_character_artifact = {
				limit = {
					category = inventory
					artifact_owner = root
					NOT = { has_variable = historical_unique_artifact }
					NOT = { has_variable = received_as_cultural_gift }
				}
				save_scope_as = existing_artifact
			}
		}
		hidden_effect = {
			create_cultural_artifact_effect = yes
		}
		add_character_flag = {  #to make sure to not trigger 4310 in the same tour you gave the gift
			flag = gave_gift_recently_flag
			days = 720
		}
	}

	option = { #gift an already existing nonsignificant artifact from root inventory
		trigger = {
			exists = scope:existing_artifact
		}
		name = cultural_festival.4302.a
		scope:existing_artifact = {
			set_variable = {
				name = suppress_artifact_notifications
				value = yes
				days = 1
			}
			set_variable = { 
				name = gifted_artifact 
				value = yes
				days = 1825
			}
			set_owner = {
				target = scope:stop_host_scope
				history = {
					location = scope:stop_host_scope.location
					actor = scope:visiting_liege
					recipient = scope:stop_host_scope
					type = given
				}
			}
			save_scope_as = gifted_artifact
		}
		save_scope_value_as = {
			name = liege_chosen_gift
			value = flag:gift_existing_artifact
		}
		create_giving_gift_memory_effect = { GIFT_RECEIVER = scope:stop_host_scope }
		show_as_tooltip = {
			give_artifact_gift_opinion_effect = yes
		}
		hidden_effect = {
			delete_new_artifact_effect = yes
		}
		scope:stop_host_scope = {
			trigger_event = cultural_festival.4303
		}
		stress_impact = {
			compassionate = minor_stress_impact_loss
			greedy = minor_stress_impact_loss
		}
		ai_chance = {
			base = 10
		}
	}

	option = { #gift the newly created artifact
		name = cultural_festival.4302.b
		remove_short_term_gold = minor_gold_value
		scope:newly_created_artifact = {
			set_variable = {
				name = suppress_artifact_notifications
				value = yes
				days = 1
			}
			set_variable = { 
				name = gifted_artifact 
				value = yes
				days = 1825
			}
			set_owner = {
				target = scope:stop_host_scope
				history = {
					location = scope:stop_host_scope.location
					actor = scope:visiting_liege
					recipient = scope:stop_host_scope
					type = given
				}
			}
			save_scope_as = gifted_artifact
		}
		save_scope_value_as = {
			name = liege_chosen_gift
			value = flag:gift_newly_created_artifact
		}
		create_giving_gift_memory_effect = { GIFT_RECEIVER = scope:stop_host_scope }
		show_as_tooltip = {
			give_artifact_gift_opinion_effect = yes
		}
		scope:stop_host_scope = {
			trigger_event = cultural_festival.4303
		}
		stress_impact = {
			generous = minor_stress_impact_loss
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 5
			modifier = {
				factor = 0
				has_trait = greedy
				short_term_gold < minor_gold_value
			}
		}
	}

	option = { #gift just gold
		name = cultural_festival.4302.c
		pay_short_term_gold = { 
			target = scope:stop_host_scope
			gold = minor_gold_value
		}
		save_scope_value_as = {
			name = liege_chosen_gift
			value = flag:gift_gold
		}
		show_as_tooltip = {
			give_gold_gift_opinion_effect = yes
		}
		hidden_effect = {
			delete_new_artifact_effect = yes
		}
		scope:stop_host_scope = {
			trigger_event = cultural_festival.4303
		}
		stress_impact = {
			cynical = minor_stress_impact_loss
			generous = major_stress_impact_loss
			greedy = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				factor = 0
				has_trait = greedy
				short_term_gold < minor_gold_value
			}
		}
	}

	option = { #no, I don't think I will
		name = cultural_festival.4302.d
		scope:stop_host_scope = {
			send_interface_toast = {
				title = cultural_festival.4302.d
				left_icon = scope:visiting_liege
				add_opinion = {
					target = scope:visiting_liege
					modifier = rude_opinion
				}
			}
		}
		hidden_effect = {
			delete_new_artifact_effect = yes
		}
		stress_impact = {
			cynical = major_stress_impact_loss
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 10
				has_trait = cynical
			}
		}
	}
}

cultural_festival.4303 = { #Vassal: Get the gift from liege, mirror of cultural_festival.4301
	type = activity_event
	title = cultural_festival.4303.t
	desc = {
		desc = cultural_festival.4303.desc	
		first_valid = {
			triggered_desc = {
				trigger = { scope:liege_chosen_gift = flag:gift_gold }
				desc = cultural_festival.4303.desc_gold
			}
			desc = cultural_festival.4303.desc_artifact
		}
	}

	theme = cultural_festival

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:visiting_liege
		animation = happiness
	}

	artifact = {
		trigger = { exists = scope:gifted_artifact }
		target = scope:gifted_artifact
		position = lower_center_portrait
	}

	immediate = {
		show_as_tooltip = {
			choose_gift_effect = { 
				CHOSEN_GIFT = scope:liege_chosen_gift 
				GIFT_GIVER = scope:visiting_liege 
			}
		}
		give_artifact_gift_opinion_effect = yes
	}

	option = { 
		name = cultural_festival.4303.a
		trigger = { NOT = { scope:liege_chosen_gift = flag:gift_gold } }
		equip_gifted_artifact_effect = yes
		set_variable = {
			name = received_as_cultural_gift
			value = scope:liege_chosen_gift
		}
		stress_impact = {
			trusting = minor_stress_impact_loss
			humble = minor_stress_impact_loss
			paranoid = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 10
				OR = {
					has_trait = honest
					has_trait = just
				}
			}
			modifier = {
				add = 100
				OR = {
					has_relation_friend = scope:stop_host_scope
					has_relation_best_friend = scope:stop_host_scope
					has_relation_lover = scope:stop_host_scope
					has_relation_soulmate = scope:stop_host_scope
				}
			}
		}
	}

	option = {
		name = cultural_festival.4303.b
		trigger = { NOT = { scope:liege_chosen_gift = flag:gift_gold } }
		destroy_artifact = scope:gifted_artifact
		add_gold = minor_gold_value
		stress_impact = {
			trusting = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			paranoid = major_stress_impact_loss
			arrogant = minor_stress_impact_loss
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 50
				has_trait = paranoid
			}
			modifier = {
				add = 10
				OR = {
					has_trait = deceitful
					has_trait = cynical
				}
			}
			modifier = {
				add = 100
				OR = {
					has_relation_rival = scope:stop_host_scope
					has_relation_nemesis = scope:stop_host_scope
				}
			}
		}
	}

	option = {
		name = cultural_festival.4303.c
		trigger = { scope:liege_chosen_gift = flag:gift_gold }
		give_gold_gift_opinion_effect = yes
		stress_impact = {
			greedy = major_stress_impact_loss
			paranoid = minor_stress_impact_loss
		}
		ai_chance = {
			base = 1
		}
	}
}

scripted_trigger liege_gift_giving_memory_trigger = { #check if liege remembers giving vassal a gift
	has_memory_type = gave_cultural_gift_memory
	any_memory_participant = {
		this = scope:stop_host_scope
	}
}

scripted_effect displayed_proper_gift_effect = { #progress towards friend and gain of cultural acceptance if possible
	scope:gift_receiver = {
		send_interface_toast = {
			title = cultural_festival.4311.proper_gift_taost
			left_icon = scope:gift_receiver
			right_icon = scope:giving_gift_memory_owner
			scope:giving_gift_memory_owner = {
				progress_towards_friend_effect = {
					CHARACTER = scope:gift_receiver
					OPINION = 30
					REASON = friend_respected_foreign_culture
				}
			}
			scope:visiting_liege = {
				increase_tour_success_effect = { POINTS = 1 }
			}
			if = {
				limit = { scope:gift_receiver.culture != scope:giving_gift_memory_owner.culture }
				scope:gift_receiver.culture = {
					change_cultural_acceptance = {
						target = scope:giving_gift_memory_owner.culture
						value = major_cultural_acceptance_gain
						desc = cultural_acceptance_embraced_festival
					}
				}
			}
		}
	}
}

scripted_effect displayed_no_gift_effect = { #progress towards rivalry and loss of cultural acceptance if possible
	scope:gift_receiver = {
		send_interface_toast = {
			title = cultural_festival.4311.no_gift_toast
			left_icon = scope:gift_receiver
			right_icon = scope:giving_gift_memory_owner
			scope:giving_gift_memory_owner = {
				progress_towards_rival_effect = {
					CHARACTER = scope:gift_receiver
					OPINION = -30
					REASON = rival_abused_subjects_hospitality
				}
			}
			if = {
				limit = { scope:gift_receiver.culture != scope:giving_gift_memory_owner.culture }
				scope:gift_receiver.culture = {
					change_cultural_acceptance = {
						target = scope:giving_gift_memory_owner.culture
						value = major_cultural_acceptance_loss
						desc = cultural_acceptance_embraced_festival
					}
				}
			}
		}
	}
}

scripted_effect set_var_gift_liege_response_effect = { #sets proper flag for var:gift_liege_response
	set_variable = {
		name = gift_liege_response
		value = $FLAG$
	}
}

scripted_effect liege_failed_hook_effect = { #add hook, loyalty trait or prestige if possible
	scope:gift_receiver = {
		send_interface_toast = {
			title = cultural_festival.4311.liege_failed_toast
			left_icon = scope:gift_receiver
			right_icon = scope:giving_gift_memory_owner
			if = {
				limit = {
					scope:giving_gift_memory_owner = {
						can_add_hook = {
							target = scope:gift_receiver
							type = loyalty_hook
						}
					}
				}
				scope:giving_gift_memory_owner = {
					add_hook = {
						target = scope:gift_receiver
						type = loyalty_hook
					}
					add_prestige = miniscule_prestige_gain
				}
			}
			else = {
				if = {
					limit = { scope:stop_host_scope = { NOT = { has_trait = loyal } } }
					scope:stop_host_scope = {
						add_trait = loyal
					}
				}
				add_prestige = medium_prestige_gain
			}
			scope:visiting_liege = {
				if = {
					limit = {
						involved_activity ?= {
							has_activity_option = {
								category = special_type
								option = tour_type_intimidation
							}
						}
					}
					increase_tour_success_effect = { POINTS = 1 }
				}
			}
		}
	}
}

cultural_festival.4310 = { #Decide if you want to ask to see the gifts
	type = activity_event
	title = cultural_festival.4310.t
	desc = cultural_festival.4310.desc	

	theme = cultural_festival

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:gift_receiver
		animation = boredom
	}

	cooldown = { years = 5 }

	trigger = {
		OR = {
			AND = {
				root = scope:visiting_liege
				any_memory = {
					liege_gift_giving_memory_trigger = yes
				}
				NOT = { has_character_flag = gave_gift_recently_flag } #to make sure to not trigger in the same tour you gave the gift
			}
			AND = {
				root = scope:stop_host_scope
				any_memory = {
					vassal_gift_giving_memory_trigger = yes
				}
				NOT = { has_character_flag = gave_gift_recently_flag } #to make sure to not trigger in the same tour you gave the gift
			}
		}
	}

	immediate = {
		random_memory = {
			limit = {
				OR = {
					AND = {
						root = scope:visiting_liege
						liege_gift_giving_memory_trigger = yes
					}
					AND = {
						root = scope:stop_host_scope
						vassal_gift_giving_memory_trigger = yes
					}
				}
			}
			save_scope_as = giving_gift_memory
		}
		scope:giving_gift_memory.memory_participant:gift_receiver = { save_scope_as = gift_receiver }
		if = {
			limit = { exists = scope:giving_gift_memory.var:gift_type }
			scope:giving_gift_memory.var:gift_type = { save_scope_as = gifted_artifact }
		}
		save_scope_as = giving_gift_memory_owner
	}

	option = { #Where is my gift? Is it safe, is it all right?
		name = cultural_festival.4310.a
		custom_tooltip = cultural_festival.4310.a.tt
		scope:gift_receiver = {
			trigger_event = {
				id = cultural_festival.4311
				days = 1
			}
		}
		stress_impact = {
			arrogant = major_stress_impact_loss
			paranoid = minor_stress_impact_loss
			content = minor_stress_impact_gain
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
		}
	}

	option = { #Don't ask about it
		name = cultural_festival.4310.b
		add_piety = miniscule_piety_gain
		stress_impact = {
			arrogant = major_stress_impact_gain
			paranoid = minor_stress_impact_gain
			content = minor_stress_impact_loss
			shy = minor_stress_impact_loss
		}
		ai_chance = { #set to 0, because it guarantees trigger of the next event for player
			base = 0
		}
	}
}

cultural_festival.4311 = { #Respond to gift accordingly, if you still have the gifts or not
	type = activity_event
	title = cultural_festival.4311.t
	desc = {
		desc = cultural_festival.4311.desc
		triggered_desc = {
			trigger = { NOT = { exists = scope:old_gift } }
			desc = cultural_festival.4311.desc.lost_gift
		}
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:old_gift }
			 	desc = cultural_festival.4311.desc.old_gift
			}
			triggered_desc = {
				trigger = { exists = scope:decoy_gift }
			 	desc = cultural_festival.4311.desc.decoy_gift
			}
		}
		triggered_desc = {
			trigger = { OR = { NOT = { exists = scope:decoy_gift } NOT = { exists = scope:old_gift } } }
			desc = cultural_festival.4311.desc.no_gift
		}
	}

	theme = cultural_festival

	left_portrait = {
		character = root
		animation = worry
	}

	right_portrait = {
		character = scope:giving_gift_memory_owner
		animation = happiness
	}

	artifact = {
		trigger = { exists = scope:old_gift }
		target = scope:old_gift
		position = lower_center_portrait
	}

	artifact = {
		trigger = { exists = scope:decoy_gift }
		target = scope:decoy_gift
		position = lower_right_portrait
	}

	immediate = {
		if = {
			limit = {
				has_any_artifact = yes
				any_character_artifact = { has_variable = received_as_cultural_gift }
			}
			random_character_artifact = {
				limit = {
					has_variable = received_as_cultural_gift 
				}
				save_scope_as = old_gift
			}
		}
		else_if = {
			limit = {
				has_any_artifact = yes
			}
			random_character_artifact = {
				save_scope_as = decoy_gift
			}
		}
	}

	option = { #show the gift you got, if you still have it around
		name = cultural_festival.4311.a
		trigger = { exists = scope:old_gift }
		show_as_tooltip = {
			random_list = {
				50 = {
					show_chance = no
					desc = cultural_festival.4311.a.success
					displayed_proper_gift_effect = yes 
				}
				50 = { 
					show_chance = no
					desc = cultural_festival.4311.a.failure
					liege_failed_hook_effect = yes
				}
			}
		}
		set_var_gift_liege_response_effect = { FLAG = flag:show_real_gift_flag }
		stress_impact = {
			deceitful = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
			honest = minor_stress_impact_loss
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 10
				has_trait = honest
			}
			modifier = {
				add = -10
				OR = {
					has_trait = deceitful
					has_trait = paranoid
				}
			}
		}
	}

	option = { #show a decoy gift, if you have any other artifact
		name = cultural_festival.4311.b
		trigger = { exists = scope:decoy_gift }
		duel = {
			skill = intrigue
			target = scope:giving_gift_memory_owner
			50 = { #you win
				desc = cultural_festival.4311.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 2
				}
				set_var_gift_liege_response_effect = { FLAG = flag:decoy_gift_succeeded_flag }
				show_as_tooltip = {
					displayed_proper_gift_effect = yes
				}
			}
			50 = {
				desc = cultural_festival.4311.b.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2
				}
				set_var_gift_liege_response_effect = { FLAG = flag:decoy_gift_failed_flag }
				show_as_tooltip = {
					displayed_no_gift_effect = yes
				}
			}
		}
		stress_impact = {
			deceitful = major_stress_impact_loss
			cynical = minor_stress_impact_loss
			honest = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 10
				OR = {
					has_trait = deceitful
					has_trait = cynical
				}
			}
			modifier = {
				add = -10
				has_trait = honest
			}
		}
	}

	option = { #try to convince that they never gave you anything
		name = cultural_festival.4311.c
		trigger = { OR = { NOT = { exists = scope:decoy_gift } NOT = { exists = scope:old_gift } } }
		duel = {
			skill = diplomacy
			target = scope:giving_gift_memory_owner
			50 = { #you win
				desc = cultural_festival.4311.c.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 2
				}
				show_as_tooltip = { 
					displayed_proper_gift_effect = yes
				} 
				set_var_gift_liege_response_effect = { FLAG = flag:no_gift_succeeded_flag }
			}
			50 = {
				desc = cultural_festival.4311.c.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2
				}
				set_var_gift_liege_response_effect = { FLAG = flag:no_gift_failed_flag }
				show_as_tooltip = {
					displayed_no_gift_effect = yes
				}
			}
		}
		stress_impact = {
			stubborn = minor_stress_impact_loss
			deceitful = major_stress_impact_loss
			cynical = minor_stress_impact_loss
			honest = major_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 10
				OR = {
					has_trait = deceitful
					has_trait = cynical
					has_trait = stubborn
				}
			}
			modifier = {
				add = -10
				has_trait = honest
			}
		}
	}

	option = { #tell them you no longer have it
		name = cultural_festival.4311.d
		trigger = { NOT = { exists = scope:old_gift } }
		set_var_gift_liege_response_effect = { FLAG = flag:liege_lost_gift_flag }
		show_as_tooltip = {
			add_prestige = minor_prestige_loss
		}
		stress_impact = {
			deceitful = minor_stress_impact_gain
			honest = major_stress_impact_loss
		}
		ai_chance = {
			base = 1
			modifier = {
				add = 10
				has_trait = honest
			}
			modifier = {
				add = -10
				has_trait = deceitful
			}
		}
	}

	after = {
		scope:giving_gift_memory_owner = {
			trigger_event = cultural_festival.4312
		}
	}
}

cultural_festival.4312 = { #Vassal: Liege shows you a gift, or not
	type = activity_event
	title = cultural_festival.4312.t
	desc = {
		desc = cultural_festival.4312.desc
		first_valid = {
			triggered_desc = {
				trigger = { scope:gift_receiver.var:gift_liege_response = flag:decoy_gift_succeeded_flag }
				desc = cultural_festival.4312.desc.decoy_gift_succeeded
			}
			triggered_desc = {
				trigger = { scope:gift_receiver.var:gift_liege_response = flag:decoy_gift_failed_flag }
				desc = cultural_festival.4312.desc.decoy_gift_failed
			}
			triggered_desc = {
				trigger = { scope:gift_receiver.var:gift_liege_response = flag:no_gift_succeeded_flag }
				desc = cultural_festival.4312.desc.no_gift_succeeded
			}
			triggered_desc = {
				trigger = { scope:gift_receiver.var:gift_liege_response = flag:no_gift_failed_flag }
				desc = cultural_festival.4312.desc.no_gift_failed
			}
			triggered_desc = {
				trigger = { scope:gift_receiver.var:gift_liege_response = flag:liege_lost_gift_flag }
				desc = cultural_festival.4312.desc.liege_lost_gift
			}
			desc = cultural_festival.4312.desc.show_real_gift_flag
		}
	}

	theme = cultural_festival

	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { 
				OR = {
					scope:gift_receiver.var:gift_liege_response = flag:decoy_gift_succeeded_flag
					scope:gift_receiver.var:gift_liege_response = flag:no_gift_succeeded_flag
				}
			}
			animation = disbelief
		}
		triggered_animation = {
			trigger = { 
				OR = {
					scope:gift_receiver.var:gift_liege_response = flag:decoy_gift_failed_flag
					scope:gift_receiver.var:gift_liege_response = flag:no_gift_failed_flag
				}
			}
			animation = anger
		}
		triggered_animation = {
			trigger = { scope:gift_receiver.var:gift_liege_response = flag:liege_lost_gift_flag	}
			animation = sadness
		}
		animation = happiness
	}

	right_portrait = {
		character = scope:gift_receiver
		triggered_animation = {
			trigger = { 
				OR = {
					scope:gift_receiver.var:gift_liege_response = flag:decoy_gift_succeeded_flag
					scope:gift_receiver.var:gift_liege_response = flag:no_gift_succeeded_flag
				}
			}
			animation = schadenfreude
		}
		triggered_animation = {
			trigger = { 
				OR = {
					scope:gift_receiver.var:gift_liege_response = flag:decoy_gift_failed_flag
					scope:gift_receiver.var:gift_liege_response = flag:no_gift_failed_flag
				}
			}
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:gift_receiver.var:gift_liege_response = flag:liege_lost_gift_flag	}
			animation = sadness
		}
		animation = happiness
	}

	artifact = {
		trigger = { exists = scope:old_gift }
		target = scope:old_gift
		position = lower_center_portrait
	}

	artifact = {
		trigger = { exists = scope:decoy_gift }
		target = scope:decoy_gift
		position = lower_right_portrait
	}

	option = {
		trigger = {
			OR = {
				scope:gift_receiver.var:gift_liege_response = flag:show_real_gift_flag
				scope:gift_receiver.var:gift_liege_response = flag:decoy_gift_succeeded_flag
			}
		}
		name = { #you appreciate them holding on to your gift, display only if gift receiver shown you the real gift
			trigger = {
				exists = scope:old_gift 
				scope:gift_receiver.var:gift_liege_response = flag:show_real_gift_flag
			}
			text = cultural_festival.4312.a		
		}
		name = { #you appreciate them holding on to your gift, display only if gift receiver succeed in showing you a decoy
			trigger = { scope:gift_receiver.var:gift_liege_response = flag:decoy_gift_succeeded_flag }
			text = cultural_festival.4312.a.decoy_success
		}
		displayed_proper_gift_effect = yes
		stress_impact = {
			base = minor_stress_impact_loss
			compassionate = minor_stress_impact_loss
		}
		ai_chance = {
			base = 10
		}
	}

	option = {
		trigger = {
			OR = {
				scope:gift_receiver.var:gift_liege_response = flag:decoy_gift_succeeded_flag 
				scope:gift_receiver.var:gift_liege_response = flag:decoy_gift_failed_flag 
				scope:gift_receiver.var:gift_liege_response = flag:no_gift_succeeded_flag 
				scope:gift_receiver.var:gift_liege_response = flag:no_gift_failed_flag 
				scope:gift_receiver.var:gift_liege_response = flag:liege_lost_gift_flag 
			} 
		}
		name = { #you call their bluff, player only, display only if gift receiver succeed in showing you a decoy
			trigger = { scope:gift_receiver.var:gift_liege_response = flag:decoy_gift_succeeded_flag }
			text = cultural_festival.4312.b.decoy_success_holup
		}
		name = { #you're mad that they tried to trick you, display only if gift receiver failed in showing you a decoy
			trigger = { scope:gift_receiver.var:gift_liege_response = flag:decoy_gift_failed_flag }
			text = cultural_festival.4312.b.decoy_fail
		}
		name = { #you call their bluff, player only, display only if gift receiver succeed in convincing you about not giving a gift at all
			trigger = { scope:gift_receiver.var:gift_liege_response = flag:no_gift_succeeded_flag }
			text = cultural_festival.4312.b.nogift_success_holup
		}
		name = { #you're mad that they tried to trick you, display only if gift receiver failed in convincing you about not giving a gift at all
			trigger = { scope:gift_receiver.var:gift_liege_response = flag:no_gift_failed_flag }
			text = cultural_festival.4312.b.nogift_fail
		}
		name = { #you call their bluff, player only, display only if gift receiver said they lost it
			trigger = { scope:gift_receiver.var:gift_liege_response = flag:liege_lost_gift_flag }
			text = cultural_festival.4312.b.holup
		}
		displayed_no_gift_effect = yes
		stress_impact = {
			wrathful = minor_stress_impact_loss
			vengeful = minor_stress_impact_loss
			just = minor_stress_impact_loss
			forgiving = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = { #has to be 0 in those cases, so that the tooltips and duel checks for the Player in previous event were telling the truth 
				factor = 0
				OR = {
					scope:gift_receiver.var:gift_liege_response = flag:decoy_gift_succeeded_flag 
					scope:gift_receiver.var:gift_liege_response = flag:no_gift_succeeded_flag 
					scope:gift_receiver.var:gift_liege_response = flag:liege_lost_gift_flag 
				}
			}
		}
	}
	
	option = {
		trigger = {
			OR = {
				scope:gift_receiver.var:gift_liege_response = flag:show_real_gift_flag #you want something in return, display only if gift receiver shown you the real gift
				scope:gift_receiver.var:gift_liege_response = flag:decoy_gift_failed_flag #you play along, display only if gift receiver failed in showing you a decoy
				scope:gift_receiver.var:gift_liege_response = flag:no_gift_failed_flag #you play along, display only if gift receiver failed in convincing you about not giving a gift at all
			}
		}
		name = cultural_festival.4312.c
		liege_failed_hook_effect = yes
		stress_impact = {
			callous = minor_stress_impact_loss
			vengeful = minor_stress_impact_loss
			content = minor_stress_impact_gain
			just = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			modifier = { #has to be 0 in those cases, so that the tooltips and duel checks for the Player in previous event were telling the truth 
				factor = 0
				OR = {
					scope:gift_receiver.var:gift_liege_response = flag:decoy_gift_failed_flag
					scope:gift_receiver.var:gift_liege_response = flag:no_gift_failed_flag
				}
			}
		}
	}

	option = {
		trigger = {
			OR = {
				scope:gift_receiver.var:gift_liege_response = flag:no_gift_succeeded_flag
				scope:gift_receiver.var:gift_liege_response = flag:liege_lost_gift_flag
			}
		}
		name = { #you are told you never gave them anything, display only if gift receiver succeed in convincing you about not giving a gift at all
			trigger = { scope:gift_receiver.var:gift_liege_response = flag:no_gift_succeeded_flag }
			text = cultural_festival.4312.d.nogift_success
		}
		name = { #it's a pity, but it happens, display only if gift receiver said they lost it
			trigger = { scope:gift_receiver.var:gift_liege_response = flag:liege_lost_gift_flag }
			text = cultural_festival.4312.d
		}
		scope:gift_receiver = {
			send_interface_toast = {
				title = cultural_festival.4312.d
				left_icon = scope:gift_receiver
				right_icon = scope:giving_gift_memory_owner
			}
			add_prestige = minor_prestige_loss
		}
		stress_impact = {
			wrathful = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			vengeful = minor_stress_impact_gain
			content = minor_stress_impact_loss
			just = minor_stress_impact_loss
			forgiving = minor_stress_impact_loss
		}
		ai_chance = {
			base = 1
		}
	}

	after = {
		if = {
			limit = {
				exists = scope:gift_receiver.var:gift_liege_response
			}
			scope:gift_receiver = {
				remove_variable = gift_liege_response
			}
		}
	}
}
