﻿namespace = tournament_events

scripted_trigger is_valid_for_ai_to_use = {
	OR = {
		root = {
			is_ai = no
		}
		num_of_relation_activity_recurrer <= 0
	}
}

# Take in the sights of the Tournament Province, lose stress
tournament_events.9000 = {
	type = activity_event
	title = tournament_events.9000.t
	desc = {
		desc = tournament_events.9000.desc
		first_valid = {
			triggered_desc = {
				trigger = { 
					scope:activity.activity_location.county.holder = {
						OR = {
							this = root
							is_vassal_or_below_of = root
						}
					}
				}
				desc = tournament_events.9000.desc_home
			}
			desc = tournament_events.9000.desc_not_home
		}
	}
	theme = tournament_outskirts
	
	left_portrait = {
		character = root
		animation = wedding_happy_cry
	}
	
	cooldown = { years = 1 }

	trigger = {
		#DLC check.
		#has_ep2_dlc_trigger = yes
		stress > 0
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 3
			has_activity_intent = reduce_stress_intent
		}
		modifier = {
			factor = 2
			has_activity_intent = win_contest_intent
		}
	}

	immediate = {
		scope:activity.activity_location = {
			save_scope_as = tournament_province
		}
	}

	option = {
		name = tournament_events.9000.impatient
		trait = impatient
		trigger = {
			has_trait = impatient
			NOT = { has_trait = athletic }
			activity_tournament_prowess_contest_trigger = yes
		}
		if = {
			limit = { activity_is_competing_trigger = yes }
			activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
		}
		random = {
			chance = 20
			add_trait = athletic
		}
		stress_impact = {
			lazy = major_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = tournament_events.9000.a
		stress_impact = {
			base = medium_stress_impact_loss
			shy = minor_stress_impact_loss
			reclusive = minor_stress_impact_loss
			calm = minor_stress_impact_loss
			humble = minor_stress_impact_loss
			content = minor_stress_impact_loss
			patient = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				has_trait = impatient
			}
		}
	}

	option = {
		name = tournament_events.9000.b
		trigger = {
			activity_tournament_prowess_contest_trigger = yes
			activity_is_competing_trigger = yes
		}
		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
		stress_impact = {
			diligent = minor_stress_impact_loss
			stubborn = minor_stress_impact_loss
			ambitious = minor_stress_impact_loss
			lazy = major_stress_impact_gain
		}
		
		ai_chance = {
			base = 25 # The AI is here to relax, primarily
			
			modifier = {
				factor = 0
				OR = {
					has_trait = shy
					has_trait = reclusive
					has_trait = calm
					has_trait = humble
					has_trait = content
					has_trait = patient
				}
			}
		}
	}
}

# Come across a liegeless knight who joins you
tournament_events.9001 = {
	type = activity_event
	title = tournament_events.9001.t
	desc = tournament_events.9001.desc
	theme = tournament_grounds
	
	left_portrait = {
		character = root
		animation = war_defender
	}
	
	right_portrait = {
		character = scope:liegeless_knight
		animation = marshal
	}
	
	cooldown = { years = 1 }

	trigger = {
		scope:activity = {
			any_attending_character = {
				is_physically_able_ai_adult = yes
				is_ruler = no
				can_be_knight_trigger = { ARMY_OWNER = root }
				NOT = { exists = liege }
				NOT = { exists = host }
				exists = dynasty
				is_valid_for_ai_to_use = yes
			}
			any_attending_character = {
				count < 240 #Max is 250, leaving some space for stragglers
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 0.1
			number_of_knights >= max_number_of_knights
		}
		modifier = {
			factor = 3
			has_activity_intent = recruit_knights_intent
		}
	}

	immediate = {
		scope:activity.activity_location = {
			save_scope_as = tournament_province
		}
		scope:activity = {
			if = {
				limit = {
					any_attending_character = {
						is_physically_able_ai_adult = yes
						is_ruler = no
						can_be_knight_trigger = { ARMY_OWNER = root }
						NOT = { exists = liege }
						NOT = { exists = host }
						exists = dynasty
						is_valid_for_ai_to_use = yes
					}
				}
				random_attending_character = {
					limit = {
						is_physically_able_ai_adult = yes
						is_ruler = no
						can_be_knight_trigger = { ARMY_OWNER = root }
						NOT = { exists = liege }
						NOT = { exists = host }
						exists = dynasty
						is_valid_for_ai_to_use = yes
					}
					weight = {
						base = 1
						activity_recurring_character_weight_modifier = { VALUE = 100 }
					}
					save_scope_as = liegeless_knight
				}
			}
			else = {
				hidden_effect = {
					create_character = {
						template = tournament_foot_character
						gender_female_chance = root_soldier_female_chance
						location = scope:activity.activity_location
						culture = scope:activity.activity_location.culture
						faith = scope:activity.activity_location.faith
						dynasty = generate
						save_scope_as = liegeless_knight
					}
					scope:liegeless_knight = {
						add_to_activity = scope:activity
					}
					add_to_guest_subset = {
						name = contestant
						target = scope:liegeless_knight						
					}
				}
			}
		}
		try_to_create_recurring_character_effect = { CHARACTER = scope:liegeless_knight	 }
		scope:liegeless_knight = {
			add_character_flag = wear_armor
			assign_quirk_effect = yes
		}
	}

	option = {
		name = tournament_events.9001.a
		
		reverse_add_opinion = {
			target = scope:liegeless_knight
			modifier = grateful_opinion
			opinion = 10
		}
		
		add_courtier = scope:liegeless_knight
		scope:liegeless_knight = {
			hidden_effect = {
				if = {
					limit = {
						NOT = { is_participant_in_activity = scope:activity }
					}
					add_to_activity = scope:activity
				}
				if = {
					limit = {
						NOT = {
							is_in_guest_subset = { name = contestant }
						}
					}
					scope:activity = {
						add_to_guest_subset = {
							name = contestant
							target = scope:liegeless_knight						
						}
					}
				}
			}
		}
		
		stress_impact = {
			paranoid = medium_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				has_trait = paranoid
			}
		}
	}

	option = {
		name = tournament_events.9001.b
		
		add_courtier = scope:liegeless_knight
		scope:liegeless_knight = {
			hidden_effect = {
				if = {
					limit = {
						NOT = { is_participant_in_activity = scope:activity }
					}
					add_to_activity = scope:activity
				}
				if = {
					limit = {
						NOT = {
							is_in_guest_subset = { name = contestant }
						}
					}
					scope:activity = {
						add_to_guest_subset = {
							name = contestant
							target = scope:liegeless_knight						
						}
					}
				}
			}
		}
		
		reverse_add_opinion = {
			target = scope:liegeless_knight
			modifier = grateful_opinion
			opinion = 30
		}
		
		pay_short_term_gold = {
			target = scope:liegeless_knight
			gold = tiny_gold_value
		}
		
		add_hook = {
			target = scope:liegeless_knight
			type = loyalty_hook
		}
		
		stress_impact = {
			greedy = major_stress_impact_gain
			paranoid = medium_stress_impact_gain
			arrogant = minor_stress_impact_gain
			generous = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 25
			
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = paranoid
				}
			}
		}
	}

	option = {
		name = tournament_events.9001.c
		
		add_prestige = minor_prestige_gain
		
		reverse_add_opinion = {
			target = scope:liegeless_knight
			modifier = disappointed_opinion
			opinion = -10
		}
		
		stress_impact = {
			generous = major_stress_impact_gain
			trusting = medium_stress_impact_gain
			ambitious = minor_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = generous
					has_trait = trusting
				}
			}
		}
	}
	
	option = { #teach me senpai
		name = tournament_events.9001.d
		trigger = { activity_is_competing_trigger = yes }

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
		
		stress_impact = {
			humble = medium_stress_impact_gain
			lazy = medium_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = humble
					has_trait = lazy
				}
			}
		}
	}
}

# Observe two local strongmen wrestling for a show
tournament_events.9002 = {
	type = activity_event
	title = tournament_events.9002.t
	desc = tournament_events.9002.desc
	theme = tournament_grounds
	
	left_portrait = {
		character = scope:strongman_1
		animation = wrestling_victory
	}
	
	right_portrait = {
		character = scope:strongman_2
		animation = wrestling_yield_start
	}
	
	cooldown = { years = 1 }

	trigger = {
		activity_tournament_prowess_contest_trigger = yes
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 3
			has_activity_intent = reduce_stress_intent
		}
		modifier = {
			factor = 3
			has_activity_intent = win_contest_intent
		}
	}

	immediate = {
		scope:activity.activity_location = {
			save_scope_as = tournament_province
		}
		scope:activity = {
			if = {
				limit = {
					any_pool_character = {
						province = scope:activity.activity_location
						count >= 2
						is_physically_able_ai_adult = yes
						has_no_particular_noble_roots_trigger = yes
						can_be_knight_trigger = { ARMY_OWNER = scope:host }
						is_valid_for_ai_to_use = yes
					}
				}
				random_pool_character = {
					province = scope:activity.activity_location
					limit = {
						is_physically_able_ai_adult = yes
						has_no_particular_noble_roots_trigger = yes
						can_be_knight_trigger = { ARMY_OWNER = scope:host }
						is_valid_for_ai_to_use = yes
					}
					weight = {
						base = 1
						activity_recurring_character_weight_modifier = { VALUE = 100 }
					}
					save_scope_as = strongman_1
				}
				random_pool_character = {
					province = scope:activity.activity_location
					limit = {
						is_physically_able_ai_adult = yes
						has_no_particular_noble_roots_trigger = yes
						can_be_knight_trigger = { ARMY_OWNER = scope:host }
						is_valid_for_ai_to_use = yes
						this != scope:strongman_1
					}
					weight = {
						base = 1
						activity_recurring_character_weight_modifier = { VALUE = 100 }
					}
					save_scope_as = strongman_2
				}
			}
			else = {
				hidden_effect = {
					create_character = {
						template = generic_peasant_character
						gender_female_chance = root_soldier_female_chance
						location = scope:activity.activity_location
						culture = scope:activity.activity_location.culture
						faith = scope:activity.activity_location.faith
						dynasty = none
						save_scope_as = strongman_1
						after_creation = {
							add_character_flag = created
						}
					}
					create_character = {
						template = generic_peasant_character
						gender_female_chance = root_soldier_female_chance
						location = scope:activity.activity_location
						culture = scope:activity.activity_location.culture
						faith = scope:activity.activity_location.faith
						dynasty = none
						save_scope_as = strongman_2
						after_creation = {
							add_character_flag = created
						}
					}
				}
			}
		}
		try_to_create_recurring_character_effect = { CHARACTER = scope:strongman_1 }
		hidden_effect = {
			scope:strongman_1 = {
				add_character_flag = single_combat_stripped_to_waist
				add_character_flag = no_hat
				if = {
					limit = {
						prowess <= 10
					}
					add_prowess_skill = 5
				}
			}
			scope:strongman_2 = {
				add_character_flag = single_combat_stripped_to_waist
				add_character_flag = no_hat
				if = {
					limit = {
						prowess <= 10
					}
					add_prowess_skill = 5
				}
			}
		}
	}

	option = {
		name = tournament_events.9002.whole_of_body
		trait = whole_of_body
		trigger = {
			has_trait = whole_of_body
			activity_tournament_prowess_contest_trigger = yes
			activity_is_competing_trigger = yes
		}
		
		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
		
		stress_impact = {
			base = medium_stress_impact_loss
			gregarious = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
			wrathful = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = tournament_events.9002.a
		
		stress_impact = {
			base = medium_stress_impact_loss
			gregarious = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
			wrathful = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = tournament_events.9002.b
		trigger = {
			activity_tournament_prowess_contest_trigger = yes
			activity_is_competing_trigger = yes 
		}
		
		duel = {
			skill = martial
			value = average_skill_rating
			50 = {
				desc = tournament_events.9002.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				send_interface_toast = {
					title = tournament_events.9002.b.success
					left_icon = root
					right_icon = scope:versus_contestant
					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
				}
			}
			50 = {
				desc = tournament_events.9002.b.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2
				}
				send_interface_toast = {
					title = tournament_events.9002.b.failure
					left_icon = root
				}
			}
		}
		
		stress_impact = {
			lazy = major_stress_impact_gain
			craven = minor_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = lazy
					has_trait = craven
					stress >= 25
				}
			}
		}
	}

	option = {
		name = tournament_events.9002.c
		
		trigger = {
			gold >= tiny_gold_value
		}
		
		add_prestige = minor_prestige_gain
		scope:strongman_1 = {
			accolade_minimal_glory_gain_with_checks_effect = yes
		}
		
		pay_short_term_gold = {
			target = scope:strongman_1
			gold = tiny_gold_value
		}
		
		reverse_add_opinion = {
			target = scope:strongman_1
			modifier = grateful_opinion
			opinion = 20
		}
		
		stress_impact = {
			base = minor_stress_impact_loss
			generous = medium_stress_impact_loss
			greedy = major_stress_impact_gain
		}
		
		ai_chance = {
			base = 20
			
			modifier = {
				factor = 0
				has_trait = greedy
			}
		}
	}
	
	after = {
		scope:strongman_1 = {
			remove_character_flag = single_combat_stripped_to_waist
			remove_character_flag = no_hat
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:strongman_2 = {
			remove_character_flag = single_combat_stripped_to_waist
			remove_character_flag = no_hat
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Come across your befriend/seduce target while wandering, talk to them
tournament_events.9003 = {
	type = activity_event
	title = tournament_events.9003.t
	desc = {
		desc = tournament_events.9003.desc
		first_valid = {
			triggered_desc = {
				trigger = { 
					has_activity_intent = befriend_attendee_intent
				}
				desc = tournament_events.9003.friend
			}
			desc = tournament_events.9003.lover
		}
	}
	theme = tournament_outskirts
	
	left_portrait = {
		character = root
		animation = flirtation
	}
	
	right_portrait = {
		character = scope:intent_target_character
		animation = personality_forgiving
	}
	
	cooldown = { years = 1 }

	trigger = {
		#DLC check.
		#has_ep2_dlc_trigger = yes
		OR = {
			has_activity_intent = woo_attendee_intent
			has_activity_intent = befriend_attendee_intent
		}
		intent_target = { is_physically_able_ai_adult = yes }
		intent_target.location = root.location
	}

	immediate = {
		scope:activity.activity_location = {
			save_scope_as = tournament_province
		}
		intent_target = { save_scope_as = intent_target_character }
	}

	option = {
		name = tournament_events.9003.friend_attempt
		
		trigger = {
			has_activity_intent = befriend_attendee_intent
		}
		custom_tooltip = available_because_intent_tt
		duel = {
			skills = { diplomacy intrigue }
			value = average_skill_rating
			15 = {
				desc = tournament_events.9003.friend_attempt.critical_success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				send_interface_toast = {
					title = tournament_events.9003.friend_attempt.critical_success
					left_icon = root
					right_icon = scope:intent_target_character
					complete_activity_intent = yes
					set_relation_friend = { reason = friend_tournament_discussion target = scope:intent_target_character }
				}
			}
			35 = {
				desc = tournament_events.9003.friend_attempt.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				send_interface_toast = {
					title = tournament_events.9003.friend_attempt.success
					left_icon = root
					right_icon = scope:intent_target_character
					reverse_add_opinion = {
						target = scope:intent_target_character
						modifier = friendliness_opinion
						opinion = 20
					}
				}
			}
			50 = {
				desc = tournament_events.9003.friend_attempt.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				send_interface_toast = {
					title = tournament_events.9003.friend_attempt.failure
					left_icon = root
					right_icon = scope:intent_target_character
					reverse_add_opinion = {
						target = scope:intent_target_character
						modifier = annoyed_opinion
						opinion = -10
					}
				}
			}
		}
		
		stress_impact = {
			shy = medium_stress_impact_gain
			reclusive = medium_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = shy
					has_trait = reclusive
				}
			}
		}
	}

	option = {
		name = tournament_events.9003.lover_attempt
		
		trigger = {
			has_activity_intent = woo_attendee_intent
		}
		custom_tooltip = available_because_intent_tt
		random_list = {
			2 = {
				desc = tournament_events.9003.lover_attempt.critical_success
				send_interface_toast = {
					title = tournament_events.9003.lover_attempt.critical_success
					left_icon = root
					right_icon = scope:intent_target_character
					complete_activity_intent = yes
					set_relation_lover = { reason = lover_given_flower target = scope:intent_target_character }
				}
				
				compatibility_modifier = {
					who = scope:intent_target_character
					compatibility_target = root
				}
				
				opinion_modifier = {
					who = scope:intent_target_character
					opinion_target = root
					multiplier = 0.1
				}
				min = 2
			}
			4 = {
				desc = tournament_events.9003.lover_attempt.success
				send_interface_toast = {
					title = tournament_events.9003.lover_attempt.success
					left_icon = root
					right_icon = scope:intent_target_character
					progress_towards_lover_effect = {
						REASON = lover_given_flower
						CHARACTER = scope:intent_target_character
						OPINION = 30
					}
				}
				
				compatibility_modifier = {
					who = scope:intent_target_character
					compatibility_target = root
				}
				
				opinion_modifier = {
					who = scope:intent_target_character
					opinion_target = root
					multiplier = 0.1
				}
				min = 2
			}
			30 = {
				desc = tournament_events.9003.lover_attempt.minor_success
				send_interface_toast = {
					title = tournament_events.9003.lover_attempt.minor_success
					left_icon = root
					right_icon = scope:intent_target_character
					reverse_add_opinion = {
						target = scope:intent_target_character
						modifier = romantic_gesture_opinion
						opinion = 20
						years = 10
					}
				}
				
				opinion_modifier = {
					who = scope:intent_target_character
					opinion_target = root
					multiplier = 0.1
				}
				min = 2
			}
			64 = {
				desc = tournament_events.9003.lover_attempt.fail
				send_interface_toast = {
					title = tournament_events.9003.lover_attempt.fail
					left_icon = root
					right_icon = scope:intent_target_character
					reverse_add_opinion = {
						target = scope:intent_target_character
						modifier = confused_opinion
						opinion = -20
					}
				}
				modifier = {
					factor = 2
					scope:intent_target_character = {
						might_cheat_on_every_partner_trigger = no
					}
				}
				modifier = {
					factor = 2
					scope:intent_target_character = {
						relation_with_character_is_incestuous_in_faith_trigger = { CHARACTER = root FAITH = scope:intent_target_character.faith }
					}
				}
				modifier = {
					factor = 0.25
					scope:intent_target_character = {
						is_consort_of = root
					}
				}
				
				opinion_modifier = {
					who = scope:intent_target_character
					opinion_target = root
					multiplier = -0.1
				}
				min = 2
			}
		}
		
		stress_impact = {
			chaste = major_stress_impact_gain
			shy = medium_stress_impact_gain
			reclusive = minor_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = shy
					has_trait = reclusive
					has_trait = chaste
				}
			}
		}
	}

	option = {
		name = tournament_events.9003.a
		
		stress_impact = {
			base = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 25
		}
	}
}

# Observe local falconers having a race
tournament_events.9004 = {
	type = activity_event
	title = tournament_events.9004.t
	desc = tournament_events.9004.desc
	theme = tournament_grounds
	left_portrait = {
		character = scope:falconer_2
		animation = anger
	}
	
	right_portrait = {
		character = scope:falconer_1
		animation = hunting_falcon
	}
	
	cooldown = { years = 1 }

	trigger = {
		#DLC check.
		#has_ep2_dlc_trigger = yes
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 3
			has_activity_intent = reduce_stress_intent
		}
		modifier = {
			factor = 3
			has_activity_intent = win_contest_intent
		}
		modifier = {
			factor = 3
			activity_tournament_prowess_contest_trigger = no
		}
	}

	immediate = {
		scope:activity.activity_location = {
			save_scope_as = tournament_province
		}
		scope:activity = {
			if = {
				limit = {
					any_pool_character = {
						province = scope:activity.activity_location
						count >= 2
						is_physically_able_ai_adult = yes
						is_valid_for_ai_to_use = yes
						exists = dynasty
					}
				}
				random_pool_character = {
					province = scope:activity.activity_location
					limit = {
						is_physically_able_ai_adult = yes
						is_valid_for_ai_to_use = yes
						exists = dynasty
					}
					weight = {
						base = 1
						activity_recurring_character_weight_modifier = { VALUE = 100 }
					}
					save_scope_as = falconer_1
				}
				random_pool_character = {
					province = scope:activity.activity_location
					limit = {
						is_physically_able_ai_adult = yes
						is_valid_for_ai_to_use = yes
						this != scope:falconer_1
						exists = dynasty
					}
					weight = {
						base = 1
						activity_recurring_character_weight_modifier = { VALUE = 100 }
					}
					save_scope_as = falconer_2
				}
			}
			else = {
				hidden_effect = {
					create_character = {
						template = pool_repopulate_martial
						gender_female_chance = root_soldier_female_chance
						location = scope:activity.activity_location
						culture = scope:activity.activity_location.culture
						faith = scope:activity.activity_location.faith
						dynasty = generate
						save_scope_as = falconer_1
						after_creation = {
							add_character_flag = created
						}
					}
					create_character = {
						template = pool_repopulate_stewardship
						gender_female_chance = root_soldier_female_chance
						location = scope:activity.activity_location
						culture = scope:activity.activity_location.culture
						faith = scope:activity.activity_location.faith
						dynasty = generate
						save_scope_as = falconer_2
						after_creation = {
							add_character_flag = created
						}
					}
				}
			}
		}
		try_to_create_recurring_character_effect = { CHARACTER = scope:falconer_1 }
		hidden_effect = {
			scope:falconer_1 = {
				add_gold = minor_gold_value
				if = {
					limit = {
						NOT = { has_trait = lifestyle_hunter }
					}
					add_trait = lifestyle_hunter
					add_trait_xp = {
						trait = lifestyle_hunter
						track = falconer
						value = 50
					}
				}
				if = {
					limit = {
						martial < 12
					}
					add_martial_skill = 5
				}
				if = {
					limit = {
						has_character_flag = peasant_outfit
					}
					remove_character_flag = peasant_outfit
				}
			}
			scope:falconer_2 = {
				add_gold = minor_gold_value
				if = {
					limit = {
						NOT = { has_trait = lifestyle_hunter }
					}
					add_trait = lifestyle_hunter
					add_trait_xp = {
						trait = lifestyle_hunter
						track = falconer
						value = 25
					}
				}
				if = {
					limit = {
						has_character_flag = peasant_outfit
					}
					remove_character_flag = peasant_outfit
				}
			}
		}
	}

	option = {
		name = tournament_events.9004.hunter
		trait = lifestyle_hunter
		trigger = {
			has_trait = lifestyle_hunter
		}
		
		add_trait_xp = {
			trait = lifestyle_hunter
			track = falconer
			value = medium_trait_xp
		}
		
		stress_impact = {
			lazy = medium_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				has_trait = lazy
			}
		}
	}

	option = {
		name = tournament_events.9004.a
		
		stress_impact = {
			base = minor_stress_impact_loss
			patient = minor_stress_impact_loss
			calm = minor_stress_impact_loss
			content = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = tournament_events.9004.b
		trigger = {
			activity_tournament_prowess_contest_trigger = no
			activity_is_competing_trigger = yes
		}
		
		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
		stress_impact = {
			diligent = minor_stress_impact_loss
			stubborn = minor_stress_impact_loss
			ambitious = minor_stress_impact_loss
			lazy = major_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				NOR = {
					has_trait = diligent
					has_trait = stubborn
					has_trait = ambitious
				}
			}
			
			modifier = {
				factor = 0
				has_trait = lazy
			}
		}
	}

	option = {
		name = tournament_events.9004.c
		
		trigger = {
			gold >= tiny_gold_value
		}
		
		scope:falconer_1 = {
			duel = {
				skill = martial
				value = scope:falconer_2.martial
				50 = {
					desc = tournament_events.9004.c.success
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
					}
					root = {
						send_interface_toast = {
							title = tournament_events.9004.c.success
							left_icon = root
							right_icon = scope:falconer_1
							add_gold = minor_gold_value
							add_prestige = minor_prestige_gain
						}
					}
				}
				50 = {
					desc = tournament_events.9004.c.failure
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
					}
					root = {
						send_interface_toast = {
							title = tournament_events.9004.c.failure
							left_icon = root
							right_icon = scope:falconer_2
							pay_short_term_gold = {
								target = scope:falconer_2
								gold = tiny_gold_value
							}
						}
					}
				}
			}
		}
		stress_impact = {
			generous = minor_stress_impact_gain
			calm = minor_stress_impact_gain
			lazy = major_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = generous
					has_trait = calm
					has_trait = lazy
				}
			}
		}
	}
	
	option = {
		name = tournament_events.9004.d
		trigger = { activity_is_competing_trigger = yes }
		
		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
		
		stress_impact = {
			patient = minor_stress_impact_gain
			calm = minor_stress_impact_gain
			content = minor_stress_impact_gain
			gregarious = medium_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
		}
	}
	
	after = {
		scope:falconer_1 = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:falconer_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

# Come across some decently strong drunken peasants, recruit them or join them for a drink
tournament_events.9005 = {
	type = activity_event
	title = tournament_events.9005.t
	desc = tournament_events.9005.desc
	theme = tournament_locale_tavern
	
	left_portrait = {
		character = scope:peasant_1
		animation = wedding_drunk
	}
	
	right_portrait = {
		character = scope:peasant_2
		animation = toast
	}
	
	lower_center_portrait = {
		character = scope:peasant_3
		animation = drink
	}
	
	cooldown = { years = 1 }

	trigger = {
		#DLC check.
		#has_ep2_dlc_trigger = yes
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 1.2
			has_activity_intent = reduce_stress_intent
		}
		modifier = {
			factor = 3
			has_activity_intent = recruit_knights_intent
		}
	}

	immediate = {
		scope:activity.activity_location = {
			save_scope_as = tournament_province
		}
		scope:activity.activity_host = {
			save_scope_as = tournament_host
		}
		scope:activity = {
			if = {
				limit = {
					any_pool_character = {
						province = scope:activity.activity_location
						count >= 3
						is_physically_able_ai_adult = yes
						has_no_particular_noble_roots_trigger = yes
						can_be_knight_trigger = { ARMY_OWNER = root }
						is_valid_for_ai_to_use = yes
					}
				}
				random_pool_character = {
					province = scope:activity.activity_location
					limit = {
						is_physically_able_ai_adult = yes
						has_no_particular_noble_roots_trigger = yes
						can_be_knight_trigger = { ARMY_OWNER = root }
						is_valid_for_ai_to_use = yes
					}
					weight = {
						base = 1
						activity_recurring_character_weight_modifier = { VALUE = 100 }
					}
					save_scope_as = peasant_1
				}
				random_pool_character = {
					province = scope:activity.activity_location
					limit = {
						is_physically_able_ai_adult = yes
						has_no_particular_noble_roots_trigger = yes
						can_be_knight_trigger = { ARMY_OWNER = root }
						is_valid_for_ai_to_use = yes
						this != scope:peasant_1
					}
					weight = {
						base = 1
						activity_recurring_character_weight_modifier = { VALUE = 100 }
					}
					save_scope_as = peasant_2
				}
				random_pool_character = {
					province = scope:activity.activity_location
					limit = {
						is_physically_able_ai_adult = yes
						has_no_particular_noble_roots_trigger = yes
						can_be_knight_trigger = { ARMY_OWNER = root }
						is_valid_for_ai_to_use = yes
						NOR = {
							this = scope:peasant_1
							this = scope:peasant_2
						}
					}
					weight = {
						base = 1
						activity_recurring_character_weight_modifier = { VALUE = 100 }
					}
					save_scope_as = peasant_3
				}
			}
			else = {
				hidden_effect = {
					create_character = {
						template = generic_peasant_character
						gender_female_chance = root_soldier_female_chance
						location = scope:activity.activity_location
						culture = scope:activity.activity_location.culture
						faith = scope:activity.activity_location.faith
						dynasty = none
						save_scope_as = peasant_1
						after_creation = {
							add_character_flag = created
						}
					}
					create_character = {
						template = generic_peasant_character
						gender_female_chance = root_soldier_female_chance
						location = scope:activity.activity_location
						culture = scope:activity.activity_location.culture
						faith = scope:activity.activity_location.faith
						dynasty = none
						save_scope_as = peasant_2
						after_creation = {
							add_character_flag = created
						}
					}
					create_character = {
						template = generic_peasant_character
						gender_female_chance = root_soldier_female_chance
						location = scope:activity.activity_location
						culture = scope:activity.activity_location.culture
						faith = scope:activity.activity_location.faith
						dynasty = none
						save_scope_as = peasant_3
						after_creation = {
							add_character_flag = created
						}
					}
				}
			}
		}
		try_to_create_recurring_character_effect = { CHARACTER = scope:peasant_1 }
		hidden_effect = {
			scope:peasant_1 = {
				add_character_flag = peasant_outfit
				if = {
					limit = {
						prowess <= 4
					}
					add_prowess_skill = 3
				}
				else_if = {
					limit = {
						prowess <= 8
					}
					add_prowess_skill = 1
				}
			}
			scope:peasant_1 = {
				add_character_flag = peasant_outfit
				if = {
					limit = {
						prowess <= 4
					}
					add_prowess_skill = 3
				}
				else_if = {
					limit = {
						prowess <= 8
					}
					add_prowess_skill = 1
				}
			}
			scope:peasant_1 = {
				add_character_flag = peasant_outfit
				if = {
					limit = {
						prowess <= 4
					}
					add_prowess_skill = 3
				}
				else_if = {
					limit = {
						prowess <= 8
					}
					add_prowess_skill = 1
				}
			}
		}
	}

	option = {
		name = tournament_events.9005.a
		flavor = available_because_of_intent
		
		trigger = {
			is_ai = no
			has_activity_intent = recruit_knights_intent
			scope:activity = {
				any_attending_character = {
					count < 240 #Max is 250, leaving some space for stragglers
				}
			}
		}
		custom_tooltip = available_because_intent_tt
		add_prestige = minor_prestige_loss
		remove_short_term_gold = tiny_gold_value
		
		add_courtier = scope:peasant_1
		add_courtier = scope:peasant_2
		add_courtier = scope:peasant_3
		
		scope:peasant_1 = {
			remove_character_flag = peasant_outfit
			hidden_effect = {
				add_to_activity = scope:activity
				scope:activity = {
					add_to_guest_subset = {
						name = contestant
						target = scope:battle_peasant						
					}
				}
			}
		}
		
		scope:peasant_2 = {
			remove_character_flag = peasant_outfit
			hidden_effect = {
				add_to_activity = scope:activity
				scope:activity = {
					add_to_guest_subset = {
						name = contestant
						target = scope:battle_peasant						
					}
				}
			}
		}
		
		scope:peasant_3 = {
			remove_character_flag = peasant_outfit
			hidden_effect = {
				add_to_activity = scope:activity
				scope:activity = {
					add_to_guest_subset = {
						name = contestant
						target = scope:battle_peasant						
					}
				}
			}
		}
		
		stress_impact = {
			paranoid = minor_stress_impact_gain
			patient = minor_stress_impact_gain
			calm = minor_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = paranoid
					has_trait = patient
					has_trait = calm
				}
			}
		}
	}

	option = {
		name = tournament_events.9005.b
		trigger = { activity_is_competing_trigger = yes }
		
		random_list = {
			10 = {
				desc = you_get_drunk
				send_interface_toast = {
					title = you_get_drunk
					left_icon = root
					activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

					add_character_modifier = {
						modifier = tournament_wicked_hangover_modifier
						months = 3
					}
				}
			}
			20 = {
				desc = they_share_some_tricks
				send_interface_toast = {
					title = they_share_some_tricks
					left_icon = root
					activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
				}
			}
			70 = {
				desc = you_have_a_good_time
			}
		}
		
		stress_impact = {
			base = medium_stress_impact_loss
			temperate = medium_stress_impact_gain
			shy = minor_stress_impact_gain
			gregarious = minor_stress_impact_loss
			drunkard = minor_stress_impact_loss
			gluttonous = minor_stress_impact_loss
			comfort_eater = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = temperate
					has_trait = shy
				}
			}
		}
	}

	option = {
		name = tournament_events.9005.c
		
		random = {
			chance = {
				value = scope:peasant_1.prowess
				multiply = 5
			}
			scope:peasant_2 = {
				increase_wounds_effect = { REASON = fight }
			}
		}
		
		random = {
			chance = {
				value = scope:peasant_2.prowess
				multiply = 5
			}
			scope:peasant_1 = {
				increase_wounds_effect = { REASON = fight }
			}
		}
		
		random = {
			chance = 10
			send_interface_toast = {
				title = skill_increased
				left_icon = root
				add_intrigue_skill = 1
			}
		}
		
		stress_impact = {
			sadistic = major_stress_impact_loss
			deceitful = medium_stress_impact_loss
			arbitrary = medium_stress_impact_loss
			compassionate = major_stress_impact_gain
			just = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = just
					has_trait = forgiving
				}
			}
		}
	}

	option = {
		name = tournament_events.9005.d
		
		add_prestige = minor_prestige_gain
		
		stress_impact = {
			sadistic = minor_prestige_gain
			drunkard = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = sadistic
					has_trait = drunkard
				}
			}
		}
	}
	
	after = {
		scope:peasant_1 = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:peasant_2 = {
			silent_disappearance_ai_if_created_effect = yes
		}
		scope:peasant_3 = {
			silent_disappearance_ai_if_created_effect = yes
		}
	}
}

scripted_trigger appropriate_memory_holder = {
	location = root.location
	this != root
	is_physically_able_ai_adult = yes
	NOR = {
		has_trait = shy
		has_trait = reclusive
	}
	any_memory = {
		OR = {
			has_memory_category = family
			has_memory_category = martial
			has_memory_category = death
			has_memory_category = war
			has_memory_category = relationships
			has_memory_category = travel
		}
		NOR = {
			has_memory_category = private
			any_memory_participant = {
				this = root
			}
			any_memory_participant = {
				is_close_family_of = root
			}
		}
	}
}

# Meet a tournamentgoer who tells a story about a memory
tournament_events.9006 = {
	type = activity_event
	title = tournament_events.9006.t
	desc = {
		desc = tournament_events.9006.desc
		random_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:family
				}
				desc = tournament_events.9006.family
			}
			triggered_desc = {
				trigger = {
					exists = scope:martial
				}
				desc = tournament_events.9006.martial
			}
			triggered_desc = {
				trigger = {
					exists = scope:death
				}
				desc = tournament_events.9006.death
			}
			triggered_desc = {
				trigger = {
					exists = scope:war
				}
				desc = tournament_events.9006.war
			}
			triggered_desc = {
				trigger = {
					exists = scope:relationships
				}
				desc = tournament_events.9006.relationships
			}
			triggered_desc = {
				trigger = {
					exists = scope:travel
				}
				desc = tournament_events.9006.travel
			}
		}
		desc = tournament_events.9006.desc_end
	}
	theme = tournament_grounds
	
	left_portrait = {
		character = root
		animation = happiness
	}
	
	right_portrait = {
		character = scope:memory_holder
		animation = throne_room_conversation_1
	}
	
	cooldown = { years = 1 }

	trigger = {
		#DLC check.
		#has_ep2_dlc_trigger = yes
		OR = {
			scope:activity = {
				any_attending_character = {
					appropriate_memory_holder = yes
				}
			}
			any_pool_character = {
				province = scope:activity.activity_location
				appropriate_memory_holder = yes
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 3
			has_activity_intent = win_contest_intent
		}
	}

	immediate = {
		scope:activity.activity_location = {
			save_scope_as = tournament_province
		}
		scope:activity.activity_host = {
			save_scope_as = tournament_host
		}
		scope:activity = {
			every_attending_character = {
				limit = {
					appropriate_memory_holder = yes
				}
				add_to_list = potential_memory_holders
			}
		}
		every_pool_character = {
			province = scope:activity.activity_location
			limit = {
				appropriate_memory_holder = yes
			}
			add_to_list = potential_memory_holders
		}
		random_in_list = {
			list = potential_memory_holders
			weight = {
				base = 1
				activity_recurring_character_weight_modifier = { VALUE = 100 }
			}
			save_scope_as = memory_holder
			assign_quirk_effect = yes
			random_memory = {
				limit = {
					OR = {
						has_memory_category = family
						has_memory_category = martial
						has_memory_category = death
						has_memory_category = war
						has_memory_category = relationships
						has_memory_category = travel
					}
					NOR = {
						has_memory_category = private
						any_memory_participant = {
							this = ROOT
						}
						any_memory_participant = {
							is_close_family_of = root
						}
					}
				}
				weight = {
					base = 1
					modifier = {
						add = 4
						has_memory_category = travel
					}
					modifier = {
						add = 2
						has_memory_category = war
					}
				}
				save_scope_as = story_memory
				if = {
					limit = {
						has_memory_category = family
					}
					save_scope_as = family
				}
				if = {
					limit = {
						has_memory_category = martial
					}
					save_scope_as = martial
				}
				if = {
					limit = {
						has_memory_category = death
					}
					save_scope_as = death
				}
				if = {
					limit = {
						has_memory_category = war
					}
					save_scope_as = war
				}
				if = {
					limit = {
						has_memory_category = relationships
					}
					save_scope_as = relationships
				}
				if = {
					limit = {
						has_memory_category = travel
					}
					save_scope_as = travel
				}
			}
		}
		try_to_create_recurring_character_effect = { CHARACTER = scope:memory_holder }
		scope:memory_holder = {
			accolade_minimal_glory_gain_with_checks_effect = yes
		}
	}

	option = {
		name = tournament_events.9006.a
		flavor = available_because_of_intent
		
		trigger = {
			has_activity_intent = win_contest_intent
			activity_is_competing_trigger = yes
		}
		custom_tooltip = available_because_intent_tt
		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = tournament_events.9006.impatient
		trait = impatient
		trigger = {
			has_trait = impatient
		}
		
		add_prestige = major_prestige_gain
		
		reverse_add_opinion = {
			target = scope:memory_holder
			modifier = insult_opinion
			opinion = -40
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = tournament_events.9006.shy
		trait = shy
		trigger = {
			has_trait = shy
			diplomacy <= 12
		}
		
		add_diplomacy_skill = 2
		
		add_stress = minor_stress_impact_gain
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = tournament_events.9006.b
		
		duel = {
			skill = learning
			value = high_skill_rating
			90 = {
				desc = you_learn_a_little
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				if = {
					limit = {
						OR = {
							exists = scope:relationships
							exists = scope:family
						}
					}
					send_interface_toast = {
						title = lifestyle_experience_increased
						left_icon = root
						right_icon = scope:memory_holder
						add_diplomacy_lifestyle_xp = medium_lifestyle_experience
					}
				}
				else_if = {
					limit = {
						OR = {
							exists = scope:martial
							exists = scope:war
						}
					}
					send_interface_toast = {
						title = lifestyle_experience_increased
						left_icon = root
						right_icon = scope:memory_holder
						add_martial_lifestyle_xp = medium_lifestyle_experience
					}
				}
				else_if = {
					limit = {
						exists = scope:death
					}
					send_interface_toast = {
						title = lifestyle_experience_increased
						left_icon = root
						right_icon = scope:memory_holder
						add_intrigue_lifestyle_xp = medium_lifestyle_experience
					}
				}
				else_if = {
					limit = {
						exists = scope:travel
					}
					send_interface_toast = {
						title = lifestyle_experience_increased
						left_icon = root
						right_icon = scope:memory_holder
						add_stewardship_lifestyle_xp = medium_lifestyle_experience
					}
				}
			}
			10 = {
				desc = you_learn_a_lot
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				min = 5
				if = {
					limit = {
						OR = {
							exists = scope:family
							exists = scope:relationships
						}
					}
					send_interface_toast = {
						title = skill_increased
						left_icon = root
						right_icon = scope:memory_holder
						add_diplomacy_skill = 1
					}
				}
				else_if = {
					limit = {
						exists = scope:martial
					}
					send_interface_toast = {
						title = skill_increased
						left_icon = root
						right_icon = scope:memory_holder
						add_martial_skill = 1
					}
				}
				else_if = {
					limit = {
						exists = scope:death
					}
					send_interface_toast = {
						title = skill_increased
						left_icon = root
						right_icon = scope:memory_holder
						add_intrigue_skill = 1
					}
				}
				else_if = {
					limit = {
						exists = scope:war
					}
					send_interface_toast = {
						title = skill_increased
						left_icon = root
						right_icon = scope:memory_holder
						add_prowess_skill = 1
					}
				}
				else_if = {
					limit = {
						exists = scope:relationships
					}
					send_interface_toast = {
						title = skill_increased
						left_icon = root
						right_icon = scope:memory_holder
						add_diplomacy_skill = 1
					}
				}
				else_if = {
					limit = {
						exists = scope:travel
					}
					send_interface_toast = {
						title = skill_increased
						left_icon = root
						right_icon = scope:memory_holder
						add_stewardship_skill = 1
					}
				}
			}
		}
		
		ai_chance = {
			base = 100
		}
	}
}

# One of your knights hype you up over a memory you have
tournament_events.9007 = {
	type = activity_event
	title = tournament_events.9007.t
	desc = tournament_events.9007.desc
	theme = tournament_grounds
	
	left_portrait = {
		character = root
		animation = sword_coup_degrace
	}
	
	right_portrait = {
		character = scope:hype_knight
		animation = throne_room_applaud_1
	}
	
	cooldown = { years = 1 }

	trigger = {
		#DLC check.
		has_ep2_dlc_trigger = yes
		activity_is_competing_trigger = yes
		scope:activity = {
			any_attending_character = {
				is_physically_able_ai_adult = yes
				is_knight_of = root
				NOT = { has_any_bad_relationship_with_root_trigger = yes }
				opinion = {
					target = root
					value >= 0
				}
			}
		}
		any_memory = {
			has_memory_category = positive
			OR = {
				has_memory_category = martial
				has_memory_category = war
			}
			NOT = {
				has_memory_category = private
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 3
			has_activity_intent = win_contest_intent
		}
	}

	immediate = {
		scope:activity.activity_location = {
			save_scope_as = tournament_province
		}
		scope:activity.activity_host = {
			save_scope_as = tournament_host
		}
		save_scope_as = root_scope
		scope:activity = {
			random_attending_character = {
				limit = {
					is_physically_able_ai_adult = yes
					is_knight_of = root
					NOT = { has_any_bad_relationship_with_root_trigger = yes }
					opinion = {
						target = root
						value >= 0
					}
				}
				save_scope_as = hype_knight
			}
		}
		random_memory = {
			limit = {
				has_memory_category = positive
				OR = {
					has_memory_category = martial
					has_memory_category = death
					has_memory_category = war
				}
				NOT = {
					has_memory_category = private
				}
			}
			save_scope_as = hype_memory
		}
		try_to_create_recurring_character_effect = { CHARACTER = scope:hype_knight }
	}

	option = {
		name = tournament_events.9007.ambitious
		trait = ambitious
		trigger = {
			has_trait = ambitious
		}
		
		activity_tournament_change_contestant_score_effect = { SCORE = increase_major }
		
		reverse_add_opinion = {
			modifier = insulted_opinion
			target = scope:hype_knight
			opinion = -20
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = tournament_events.9007.a
		
		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = tournament_events.9007.b
		
		add_prestige = minor_prestige_gain
		
		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
		
		every_vassal = {
			vassal_stance = glory_hound
			custom = every_glory_hound_vassal
			add_opinion = {
				modifier = impressed_opinion
				target = root
				opinion = 20
			}
		}
		every_active_accolade = {
			custom = custom.every_acclaimed_knight
			add_glory = minor_glory_gain
		}
		
		stress_impact = {
			humble = medium_stress_impact_gain
			calm = medium_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = humble
					has_trait = calm
				}
			}
		}
	}

	option = {
		name = tournament_events.9007.c
		
		add_piety = minor_piety_gain
		
		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
		
		every_vassal = {
			vassal_stance = zealot
			custom = every_zealot_vassal
			add_opinion = {
				modifier = impressed_with_humility_opinion
				target = root
				opinion = 20
			}
		}
		
		stress_impact = {
			cynical = medium_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				has_trait = cynical
			}
		}
	}
}

# Observe a local street performer performing
tournament_events.9008 = {
	type = activity_event
	title = tournament_events.9008.t
	desc = tournament_events.9008.desc
	theme = tournament_locale_village
	
	left_portrait = {
		character = root
		animation = laugh
	}
	
	right_portrait = {
		character = scope:tournament_fool
		outfit_tags = { jester_outfit }
		animation = ecstasy
	}
	
	cooldown = { years = 1 }

	trigger = {
		#DLC check.
		#has_ep2_dlc_trigger = yes
		scope:activity = {
			any_attending_character = {
				this != root
				any_memory = {
					has_memory_category = positive
					NOR = {
						has_memory_category = private
						has_memory_category = birth
						has_memory_category = death
					}
				}
			}
			any_attending_character = {
				this != root
				any_memory = {
					has_memory_category = negative
					NOR = {
						has_memory_category = private
						has_memory_category = birth
					}
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 3
			has_activity_intent = win_contest_intent
		}
	}

	immediate = {
		scope:activity.activity_location = {
			save_scope_as = tournament_province
		}
		scope:activity.activity_host = {
			save_scope_as = tournament_host
		}
		save_scope_as = root_scope
		scope:activity = {
			if = {
				limit = {
					any_pool_character = {
						province = scope:activity.activity_location
						is_physically_able_ai_adult = yes
						has_no_particular_noble_roots_trigger = yes
						is_valid_for_ai_to_use = yes
					}
				}
				random_pool_character = {
					province = scope:activity.activity_location
					limit = {
						is_physically_able_ai_adult = yes
						has_no_particular_noble_roots_trigger = yes
						is_valid_for_ai_to_use = yes
					}
					weight = {
						base = 1
						activity_recurring_character_weight_modifier = { VALUE = 100 }
					}
					save_scope_as = tournament_fool
				}
			}
			else = {
				hidden_effect = {
					create_character = {
						template = generic_peasant_character
						gender_female_chance = root_soldier_female_chance
						location = scope:activity.activity_location
						culture = scope:activity.activity_location.culture
						faith = scope:activity.activity_location.faith
						dynasty = none
						save_scope_as = tournament_fool
					}
				}
			}
			random_attending_character = {
				limit = {
					this != root
					any_memory = {
						has_memory_category = positive
						NOR = {
							has_memory_category = private
							has_memory_category = birth
							has_memory_category = death
						}
					}
				}
				random_memory = {
					limit = {
						has_memory_category = positive
						NOR = {
							has_memory_category = private
							has_memory_category = birth
							has_memory_category = death
						}
					}
					save_scope_as = memory_story
				}
			}
			random_attending_character = {
				limit = {
					this != root
					any_memory = {
						has_memory_category = negative
						NOR = {
							has_memory_category = private
							has_memory_category = birth
						}
					}
				}
				random_memory = {
					limit = {
						has_memory_category = negative
						NOR = {
							has_memory_category = private
							has_memory_category = birth
						}
					}
					save_scope_as = memory_story_negative
				}
			}
			if = {
				limit = {
					any_attending_character = {
						any_secret = {
							NOT = { any_secret_knower = { this = root } }
						}
					}
				}
				random_attending_character = {
					limit = {
						any_secret = {
							NOT = { any_secret_knower = { this = root } }
						}
					}
					save_scope_as = secret_holder
					random_secret = {
						limit = {
							NOT = { any_secret_knower = { this = root } }
						}
						save_scope_as = secret
					}
				}
			}
		}
		try_to_create_recurring_character_effect = { CHARACTER = scope:tournament_fool }
	}

	option = {
		name = tournament_events.9008.schemer
		trait = schemer
		trigger = {
			has_trait = schemer
			exists = scope:secret
		}
		scope:secret = { reveal_to = root }
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = tournament_events.9008.a
		
		stress_impact = {
			base = minor_stress_impact_loss
			impatient = medium_stress_impact_loss
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = tournament_events.9008.b
		trigger = {
			NOT = {
				has_character_modifier = cheery_disposition_modifier
			}
		}
		
		add_character_modifier = { modifier = cheery_disposition_modifier years = 5 }
		
		stress_impact = {
			cynical = medium_stress_impact_gain
			vengeful = medium_stress_impact_gain
			callous = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
			patient = minor_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = cynical
					has_trait = vengeful
					has_trait = patient
					has_trait = callous
					has_trait = sadistic
				}
			}
		}
	}

	option = {
		name = tournament_events.9008.c
		trigger = {
			NOT = {
				has_character_modifier = grim_disposition_modifier
			}
		}
		
		add_character_modifier = { modifier = grim_disposition_modifier years = 5 }
		
		stress_impact = {
			compassionate = medium_stress_impact_gain
			gregarious = 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 = gregarious
					has_trait = generous
					has_trait = forgiving
				}
			}
		}
	}
}
