﻿namespace = ep2_tournament_events

##################################################
# DUEL
# 0001 - 0999
#
# MELEE
# 1000 - 1499
#
# ARCHERY
# 1500 - 1999
#
# WRESTLING/FISTFIGHTING
# 2000 - 2999
#
# QUINTAIN (Locale)
# 3500 - 3999
#
# JOUST
# 4000 - 4499
#
# RACE
# 4500 - 4999
#
# RECITAL
# 5500 - 5999
#
##################################################

#########################
###   SHARED EVENTS   ###
#########################

##############
###  DUEL  ###
##############

# Opponent is limping... you think
ep2_tournament_events.0001 = {
	type = activity_event
	title = ep2_tournament_events.0001.t
	desc = ep2_tournament_events.0001.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = personality_cynical
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = pain
	}
	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_male_grunts"
		contest_versus_player_vs_ai_scope_effect = yes
		if = {
			limit = {
				scope:activity = { has_current_phase = tournament_phase_wrestling }
			}
			tournament_pivotal_flavor_variable_effect = { CONTEST = wrestling ID = 0001 }
		}
		else_if = {
			limit = {
				scope:activity = { has_current_phase = tournament_phase_duel }
			}
			tournament_pivotal_flavor_variable_effect = { CONTEST = duel ID = 0001 }
		}
	}

	# Work it out via smarts
	option = {
		name = ep2_tournament_events.0001.a
		trigger = {
			OR = {
				has_trait = intellect_good
				has_trait = shrewd
			}
		}
		activity_tournament_change_contestant_score_effect = { SCORE = increase_major }
		custom_tooltip = ep2_tournament_events.0001.a.tt

		stress_impact = {
			base = miniscule_stress_impact_loss
			paranoid = minor_stress_impact_loss
			trusting = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}

	# Go for their leg
	option = {
		name = ep2_tournament_events.0001.b
		
		duel = {
			skills = { intrigue prowess }
			target = scope:versus_contestant
			#Your intuition was correct
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.0001.b.tt.win
					left_icon = root
					right_icon = scope:versus_contestant
					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
				}

				desc = ep2_tournament_events.0001.b.tt.win

				if = {
					limit = {
						has_trait = tourney_participant
					}
					add_trait_xp = {
						trait = tourney_participant
						track = foot
						value = tournament_hastiludes_xp_gain_medium_value
					}
				}

				stress_impact = {
					paranoid = minor_stress_impact_loss
					trusting = minor_stress_impact_gain
				}
			}
			#Your opponent was bluffing
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.0001.b.tt.lose
					left_icon = root
					right_icon = scope:versus_contestant
					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
				}

				desc = ep2_tournament_events.0001.b.tt.lose

				stress_impact = {
					paranoid = minor_stress_impact_gain
					trusting = minor_stress_impact_loss
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}

	# Ignore it
	option = {
		name = ep2_tournament_events.0001.c

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

		stress_impact = {
			paranoid = minor_stress_impact_gain
			trusting = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}
}

# Opponent plays to the crowd
ep2_tournament_events.0002 = {
	type = activity_event
	title = ep2_tournament_events.0002.t
	desc = ep2_tournament_events.0002.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = personality_cynical
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = throne_room_cheer_1
	}
	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_positive_reaction"
		contest_versus_player_vs_ai_scope_effect = yes
		if = {
			limit = {
				scope:activity = { has_current_phase = tournament_phase_wrestling }
			}
			tournament_pivotal_flavor_variable_effect = { CONTEST = wrestling ID = 0002 }
		}
		else_if = {
			limit = {
				scope:activity = { has_current_phase = tournament_phase_duel }
			}
			tournament_pivotal_flavor_variable_effect = { CONTEST = duel ID = 0002 }
		}
	}

	# I'll show you!
	option = {
		name = ep2_tournament_events.0002.a
		trigger = {
			OR = {
				has_trait = physique_good
				has_trait = strong
			}
		}
		custom_tooltip = ep2_tournament_events.0002.a.tt
		
		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

		add_prestige = minor_prestige_gain

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_pose_off_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

		stress_impact = {
			base = minor_stress_impact_loss
			arrogant = medium_stress_impact_loss
			humble = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}

	# Demand they face you
	option = {
		name = ep2_tournament_events.0002.b

		stress_impact = {
			arrogant = minor_stress_impact_loss
			humble = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}

	# Attack them from behind
	option = {
		name = ep2_tournament_events.0002.c
		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
		accolade_minimal_glory_loss_with_checks_effect = yes

	 	reverse_add_opinion = {
	 		target = scope:versus_contestant
	 		modifier = angry_opinion
	 		opinion = -30
	 	}

		stress_impact = {
			craven = medium_stress_impact_loss
			brave = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}
}

scripted_trigger contest_versus_wants_to_resign_trigger = {
	OR = {
		dread_modified_ai_boldness = {
			dreaded_character = root
			value <= medium_negative_ai_value
		}
		AND = {
			has_trait = wounded
			has_trait = craven
		}
		AND = {
			NOT = { has_trait = brave }
			has_trait_rank = {
				trait = wounded
				rank >= 2
			}
		}
	}
}

# Opponent wants to quit
ep2_tournament_events.0003 = {
	type = activity_event
	title = ep2_tournament_events.0003.t
	desc = {
		desc = ep2_tournament_events.0003.desc
		first_valid = {
			triggered_desc = { # Dread
				trigger = {
					scope:versus_contestant = {
						has_dread_level_towards = {
							target = root
							level > 0
						}
					}
				}
				desc = ep2_tournament_events.0003.desc.dread
			}
			triggered_desc = { #Wounded and Craven
				trigger = {
					scope:versus_contestant = {
						has_trait = wounded
						has_trait = craven
					}
				}
				desc = ep2_tournament_events.0003.desc.craven
			}
			triggered_desc = { # Badly wounded, not brave
				trigger = {
					scope:versus_contestant = {
						NOT = { has_trait = brave }
						has_trait_rank = {
							trait = wounded
							rank >= 2
						}
					}
				}
				desc = ep2_tournament_events.0003.desc.wounded
			}
		}
	}
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	cooldown = { years = 1 }

	left_portrait = {
		character = root
		animation = personality_honorable
	}

	right_portrait = {
		character = scope:versus_contestant
		animation = pain
	}

	# Reasons for the opposition to quit:
	# They dread you
	# They have medium or high wounds and aren't brave
	# They have any level of wounds and are craven
	trigger = {
		contest_versus_player_vs_ai_trigger = yes
		trigger_if = {
			limit = { this = scope:versus_matchee }
			scope:versus_matcher = { contest_versus_wants_to_resign_trigger = yes }		
		}
		trigger_else = {
			scope:versus_matchee = { contest_versus_wants_to_resign_trigger = yes }
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_negative_reaction"
		contest_versus_player_vs_ai_scope_effect = yes
		if = {
			limit = {
				scope:activity = { has_current_phase = tournament_phase_wrestling }
			}
			tournament_pivotal_flavor_variable_effect = { CONTEST = wrestling ID = 0003 }
		}
		else_if = {
			limit = {
				scope:activity = { has_current_phase = tournament_phase_duel }
			}
			tournament_pivotal_flavor_variable_effect = { CONTEST = duel ID = 0003 }
		}
	}

	# Mock their cowardice
	option = {
		name = ep2_tournament_events.0003.a
		trigger = {
			NOT = { has_trait = craven }
			scope:versus_contestant = { has_trait = craven }
		}
		accolade_minimal_glory_loss_with_checks_effect = yes

		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = tournament_mocked_opinion
			opinion = -30
		}

		add_prestige = minor_prestige_gain

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_mocked_cowardice_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

		stress_impact = {
			compassionate = minor_stress_impact_gain
			sadistic = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}

	# Understand their cowardice
	option = {
		name = ep2_tournament_events.0003.b
		trigger = {
			has_trait = craven
			scope:versus_contestant = { has_trait = craven }
		}

		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = grateful_opinion
			opinion = 20
		}

		stress_impact = {
			craven = medium_stress_impact_loss
			arrogant = minor_stress_impact_gain
			compassionate = minor_stress_impact_loss
			humble = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}

	# Acknowledge their wounds
	option = {
		name = ep2_tournament_events.0003.c
		trigger = {
			scope:versus_contestant = {
				NOT = { has_trait = brave }
				OR = {
					has_trait = wounded_2
					has_trait = wounded_3
				}
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_wounded_quit_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = respect_opinion
			opinion = 20
		}

		stress_impact = {
			compassionate = minor_stress_impact_loss
			sadistic = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}

	# Tell them never to challenge you again
	option = {
		name = ep2_tournament_events.0003.d
		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = angry_opinion
			opinion = -30
		}

		stress_impact = {
			arrogant = minor_stress_impact_loss
			compassionate = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_mocked_cowardice_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = compassionate
					has_trait = humble
				}
			}
		}
	}

	# Tell them they fought well
	option = {
		name = ep2_tournament_events.0003.e
		accolade_minimal_glory_gain_with_checks_effect = yes
		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = compliment_opinion
			opinion = 20
		}

		stress_impact = {
			arrogant = minor_stress_impact_gain
			compassionate = minor_stress_impact_loss
			humble = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				has_trait = arrogant
			}
		}
	}

	after = {
		tournament_contest_versus_resignation_effect = { RESIGNER = scope:versus_contestant CONTEST = wrestling SKILL = pugilism }
	}
}

# Sword flies into the crowd
ep2_tournament_events.0004 = {
	type = activity_event
	title = ep2_tournament_events.0004.t
	desc = ep2_tournament_events.0004.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	cooldown = { years = 1 }

	left_portrait = {
		character = root
		animation = worry
	}

	right_portrait = {
		character = scope:versus_contestant
		animation = shock
	}

	lower_center_portrait = {
		character = scope:watching_crowd
	}

	trigger = {
		contest_versus_player_vs_ai_trigger = yes

		scope:activity = {
			any_guest_subset_current_phase = {
				name = spectator
				is_alive = yes
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_surprise_reaction"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = duel ID = 0004 }

		scope:activity = {
			random_guest_subset_current_phase = {
				name = spectator
				limit = { is_alive = yes }
				save_scope_as = watching_crowd
			}
		}

		scope:watching_crowd = {
			increase_wounds_no_death_effect = { REASON = death_spectator_injured }

			if = {
				limit = {
					NOT = {
						has_trait = scarred
					}
				}
				add_trait = scarred
			}
			add_trait_xp = {
				trait = scarred
				value = {
					integer_range = {
						min = 5
						max = 25
					}
				}
			}
		}
	}

	# Blame your opponent
	option = {
		name = ep2_tournament_events.0004.a
	
		trigger = {
			has_trait = deceitful
		}

		scope:watching_crowd = {
			add_opinion = {
				target = scope:versus_contestant
				modifier = hurt_opinion
				opinion = -50
			}
		}

		scope:versus_contestant = {
			add_prestige = minor_prestige_loss

			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -30
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_failed_defuse_duel_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

		stress_impact = {
			compassionate = medium_stress_impact_gain
			just = medium_stress_impact_gain
			sadistic = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = compassionate
					has_trait = just
				}
			}
		}
	}

	# Apologise
	option = {
		name = ep2_tournament_events.0004.b

		duel = {
			skill = diplomacy
			value = high_skill_rating
			50 = { #They accept your apology
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				desc = ep2_tournament_events.0004.b.success

				send_interface_toast = {
					title = ep2_tournament_events.0004.b.success
					left_icon = root
					right_icon = scope:watching_crowd

					scope:watching_crowd = {
						add_opinion = {
							target = root
							modifier = forgiven_opinion
							opinion = 15
						}
					}
				}

				desc = ep2_tournament_events.1001.c.success
			}
			50 = { #They don't accept the apology
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				desc = ep2_tournament_events.0004.b.failure

				send_interface_toast = {
					title = ep2_tournament_events.0004.b.failure
					left_icon = root
					right_icon = scope:watching_crowd

					scope:watching_crowd = {
						add_opinion = {
							target = root
							modifier = angry_opinion
							opinion = -35
						}
					}
				}
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_duel_apology_log
				tags = { bad }
				score = 5
				character = root
				target = scope:watching_crowd
			}
		}

		stress_impact = {
			compassionate = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
			honest = minor_stress_impact_loss
			sadistic = medium_stress_impact_gain
			arbitrary = medium_stress_impact_gain
			deceitful = major_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = sadistic
					has_trait = arbitrary
					has_trait = deceitful
				}
			}
		}
	}

	# Take a swing at opponent whilst they're distracted
	option = {
		name = ep2_tournament_events.0004.c

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
		accolade_minimal_glory_loss_with_checks_effect = yes
		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = angry_opinion
			opinion = -40
		}

		stress_impact = {
			ambitious = miniscule_stress_impact_loss
			craven = miniscule_stress_impact_loss
			impatient = minor_stress_impact_loss
			brave = medium_stress_impact_gain
			patient = medium_stress_impact_gain
			content = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = content
					has_trait = patient
					has_trait = brave
				}
			}
		}
	}
}

# Kick opponent in the groin
ep2_tournament_events.0005 = {
	type = activity_event
	title = ep2_tournament_events.0005.t
	desc = {
		desc = ep2_tournament_events.0005.start
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:versus_contestant = { is_eunuch_trigger = yes }
				}
				desc = ep2_tournament_events.0005.eunuch
			}
			triggered_desc = {
				trigger = {
					scope:versus_contestant = { is_eunuch_trigger = no }
				}
				desc = ep2_tournament_events.0005.pain
			}
		}
	}
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	cooldown = { years = 1 }

	left_portrait = {
		character = root
		animation = worry
	}

	right_portrait = {
		character = scope:versus_contestant
		triggered_animation = { # Normal
			trigger = {
				scope:versus_contestant = { is_eunuch_trigger = no }
			}
  			animation = pain
  		}
		triggered_animation = { # Unfettered by any weak spots. BUILT DIFFERENT.
			trigger = {
				scope:versus_contestant = { is_eunuch_trigger = yes }
			}
  			animation = anger
  		}
	}

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	weight_multiplier = {
		base = 1
		modifier = {
			OR = {
				has_trait = just
				has_trait = compassionate
				has_trait = gallant
			}
			add = -0.5
		}
		modifier = {
			OR = {
				has_trait = arbitrary
				has_trait = sadistic
				has_trait = ambitious
			}
			add = 0.5
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_negative_reaction"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = duel ID = 0005 }
	}

	# Follow up
	option = {
		name = ep2_tournament_events.0005.a

		trigger = {
			scope:versus_contestant = { is_eunuch_trigger = no }
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
		
		accolade_minimal_glory_loss_with_checks_effect = yes
		
		add_prestige = minor_prestige_loss

		add_character_modifier = {
			modifier = tournament_low_blower_modifier
			years = 10
		}

		scope:versus_contestant = {
			add_prestige = minor_prestige_loss

			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -50
			}
		}

		stress_impact = {
			compassionate = medium_stress_impact_gain
			just = medium_stress_impact_gain
			honest = medium_stress_impact_gain
			sadistic = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
			deceitful = miniscule_stress_impact_loss
			gallant = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = -1
				ai_vengefulness = 1
			}
		}
	}

	# Apologise
	option = {
		name = ep2_tournament_events.0005.b

		trigger = {
			scope:versus_contestant = { is_eunuch_trigger = no }
		}
		
		accolade_minimal_glory_gain_with_checks_effect = yes

		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = angry_opinion
			opinion = -20
		}

		stress_impact = {
			compassionate = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
			honest = minor_stress_impact_loss
			sadistic = medium_stress_impact_gain
			arbitrary = medium_stress_impact_gain
			deceitful = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
				ai_vengefulness = -1
			}
		}
	}

	# Oh no, they're not susceptible to my secret technique!
	option = {
		name = ep2_tournament_events.0005.c

		trigger = {
			scope:versus_contestant = { is_eunuch_trigger = yes }
		}

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_miniscule }

		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = dismissive_opinion
			opinion = -25
		}

		stress_impact = {
			ambitious = miniscule_stress_impact_loss
			craven = miniscule_stress_impact_loss
			impatient = minor_stress_impact_loss
			brave = medium_stress_impact_gain
			patient = medium_stress_impact_gain
			content = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_vengefulness = -0.5
			}
		}
	}
}

# You have a chance to end them rightly
ep2_tournament_events.0006 = {
	type = activity_event
	title = ep2_tournament_events.0006.t
	desc = ep2_tournament_events.0006.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	cooldown = { years = 1 }

	left_portrait = {
		character = root
		animation = scheme
	}

	right_portrait = {
		character = scope:versus_contestant
		animation = worry
	}

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_positive_reaction"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = duel ID = 0006 }
	}

	# End them rightly!
	option = {
		name = ep2_tournament_events.0006.a

		flavor = ep2_tournament_events.0006.a.tt

		activity_tournament_change_contestant_score_effect = { SCORE = increase_miniscule }
		
		accolade_minimal_glory_gain_with_checks_effect = yes

		add_character_modifier = {
			modifier = tournament_roguish_duelist_modifier
			years = 25
		}

		scope:versus_contestant = {
			send_interface_toast = { #Send an interface toast so it's not just completely random if it's not an AI
				title = ep2_tournament_events.0006.a.toast
				left_icon = scope:versus_contestant
				right_icon = root

				add_prestige = medium_prestige_loss

				add_character_modifier = {
					modifier = tournament_ended_rightly_modifier
					years = 15
				}
			}		

			add_opinion = {
				target = root
				modifier = tournament_ended_rightly_opinion
				opinion = -60
			}
		}

		scope:activity = {		
			add_activity_log_entry = {
				key = tournament_ended_rightly_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

		stress_impact = {
			compassionate = medium_stress_impact_gain
			just = medium_stress_impact_gain
			honest = medium_stress_impact_gain
			sadistic = minor_stress_impact_loss
			arbitrary = minor_stress_impact_loss
			deceitful = minor_stress_impact_loss
		}

		ai_chance = {
			base = 30 #Deliberately lowered to ensure we don't see too much of this
			ai_value_modifier = {
				ai_compassion = -1
				ai_vengefulness = 1
			}
		}
	}

	# Just follow up normally
	option = {
		name = ep2_tournament_events.0006.b

		flavor = ep2_tournament_events.0006.b.tt

		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		stress_impact = {
			just = miniscule_stress_impact_loss
			arbitrary = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
				ai_vengefulness = -1
			}
		}
	}

	# Let them recover
	option = {
		name = ep2_tournament_events.0006.c

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_miniscule }
		
		accolade_minor_glory_gain_with_checks_effect = yes

		progress_towards_friend_effect = {
			REASON = friend_duel_recovered
			CHARACTER = scope:versus_contestant
			OPINION = default_friend_opinion
		}

		stress_impact = {
			ambitious = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			impatient = medium_stress_impact_gain
			vengeful = minor_stress_impact_gain
			brave = miniscule_stress_impact_loss
			patient = miniscule_stress_impact_loss
			content = miniscule_stress_impact_loss
			forgiving = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_vengefulness = -0.5
			}
		}
	}
}

# Your opponent offers you money to take a dive
ep2_tournament_events.0007 = {
	type = activity_event
	title = ep2_tournament_events.0007.t
	desc = ep2_tournament_events.0007.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	cooldown = { years = 1 }

	left_portrait = {
		character = root
		animation = worry
	}

	right_portrait = {
		character = scope:versus_contestant
		animation = beg
	}

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
		trigger_if = {
			limit = { this = scope:versus_matcher }
			scope:versus_matchee.gold > 100
		}
		trigger_else = { scope:versus_matcher.gold > 100 }
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_surprise_reaction"
		contest_versus_player_vs_ai_scope_effect = yes

		activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

		tournament_pivotal_flavor_variable_effect = { CONTEST = duel ID = 0007 }
	}

	# Accept
	option = {
		name = ep2_tournament_events.0007.a

		scope:versus_contestant = {
			pay_short_term_gold = {
				target = root
				gold = {
					value = scope:versus_contestant.major_gold_value
					max = 100
				}
			}

			add_opinion = {
				target = root
				modifier = relieved_opinion
				opinion = 30
			}
		}

		save_scope_as = resigner
		tournament_contest_versus_resignation_effect = { RESIGNER = root CONTEST = duel SKILL = foot }

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_suspicious_loss_log
				tags = { bad }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

		stress_impact = {
			honest = medium_stress_impact_gain
			just = medium_stress_impact_gain
			ambitious = medium_stress_impact_gain
			greedy = minor_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
			content = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -1
				ai_greed = 1
			}
		}
	}

	# Accept, but for a hook and half the gold
	option = {
		name = ep2_tournament_events.0007.b

		trigger = {
			can_add_hook = { #Ensure they can be indebted to you
				type = loyalty_hook
				target = scope:versus_contestant
			}
		}

		add_hook = {
			type = loyalty_hook
			target = scope:versus_contestant
		}

		save_scope_as = resigner
		tournament_contest_versus_resignation_effect = { RESIGNER = root CONTEST = duel SKILL = foot }

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_suspicious_loss_log
				tags = { bad }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

		stress_impact = {
			honest = medium_stress_impact_gain
			greedy = minor_stress_impact_gain
			deceitful = miniscule_stress_impact_loss
			ambitious = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -1
				ai_energy = 1
			}
		}
	}

	# Refuse
	option = {
		name = ep2_tournament_events.0007.c
		
		scope:versus_contestant = {
			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -30
			}
		}

		stress_impact = {
			arbitrary = medium_stress_impact_gain
			just = miniscule_stress_impact_loss
			greedy = medium_stress_impact_gain
			ambitious = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
				ai_vengefulness = -1
			}
		}
	}
}

# You try to read your opponent's move
ep2_tournament_events.0010 = {
	type = activity_event
	title = ep2_tournament_events.0010.t
	desc = ep2_tournament_events.0010.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	cooldown = { years = 1 }

	left_portrait = {
		character = root
		animation = marshal
	}

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

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_metal_clash"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = duel ID = 0010 }
	}

	# Attempt a risky counter
	option = {
		name = ep2_tournament_events.0010.a
	
		duel = {
			skills = { prowess intrigue }
			target = scope:versus_contestant
			50 = { #You guess right
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				desc = ep2_tournament_events.0010.a.success

				modifier = {
					has_trait = lifestyle_blademaster
					add = 10
				}

				modifier = {
					AND = {
						has_trait = tourney_participant
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 50
						}
					}
					add = 10
				}

				modifier = {
					has_trait = shrewd
					add = 2
				}

				send_interface_toast = {
					title = ep2_tournament_events.0010.a.success
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

					reverse_add_opinion = {
						target = scope:versus_contestant
						modifier = respect_opinion
						opinion = 10
					}
				}
				min = 10
			}
			50 = { #You guess wrong
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				desc = ep2_tournament_events.0010.a.failure

				modifier = {
					scope:versus_contestant = {
						has_trait = lifestyle_blademaster
					}
					add = 5
				}

				modifier = {
					scope:versus_contestant = {
						AND = {
							has_trait = tourney_participant
							has_trait_xp = {
								trait = tourney_participant
								track = foot
								value >= 50
							}
						}
					}
					add = 5
				}

				send_interface_toast = {
					title = ep2_tournament_events.0010.a.failure
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

					increase_wounds_no_death_effect = { REASON = duel }

					if = {
						limit = {
							NOT = {
								has_trait = scarred
							}
						}
						add_trait = scarred
					}
					add_trait_xp = {
						trait = scarred
						value = {
							integer_range = {
								min = 5
								max = 25
							}
						}
					}
				}
				min = 10
			}
		}

		stress_impact = {
			brave = miniscule_stress_impact_loss
			ambitious = miniscule_stress_impact_loss
			impatient = miniscule_stress_impact_loss
			patient = minor_stress_impact_gain
			content = minor_stress_impact_gain
			craven = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = 1
			}
		}
	}

	# Block it
	option = {
		name = ep2_tournament_events.0010.b

		duel = {
			skills = { prowess martial }
			target = scope:versus_contestant
			75 = { #It succeeds
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				desc = ep2_tournament_events.0010.b.success

				modifier = {
					has_trait = lifestyle_blademaster
					add = 10
				}

				modifier = {
					AND = {
						has_trait = tourney_participant
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 50
						}
					}
					add = 10
				}

				send_interface_toast = {
					title = ep2_tournament_events.0010.b.success
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

					reverse_add_opinion = {
						target = scope:versus_contestant
						modifier = respect_opinion
						opinion = 10
					}
				}
				min = 10
			}
			25 = { #It fails
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				desc = ep2_tournament_events.0010.a.failure

				modifier = {
					scope:versus_contestant = {
						has_trait = lifestyle_blademaster
					}
					add = 7
				}

				modifier = {
					scope:versus_contestant = {
						AND = {
							has_trait = tourney_participant
							has_trait_xp = {
								trait = tourney_participant
								track = foot
								value >= 50
							}
						}
					}
					add = 7
				}

				send_interface_toast = {
					title = ep2_tournament_events.0010.a.failure
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

					increase_wounds_no_death_effect = { REASON = duel }
				}
				min = 10
			}
		}

		stress_impact = {
			fickle = miniscule_stress_impact_loss
			patient = miniscule_stress_impact_loss
			humble = miniscule_stress_impact_loss
			stubborn = minor_stress_impact_gain
			impatient = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_honor = 0.5
			}
		}
	}

	# Sidestep the blow entirely
	option = {
		name = ep2_tournament_events.0010.c

		flavor = ep2_tournament_events.0010.c.tt
		
		accolade_minimal_glory_gain_with_checks_effect = yes

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_miniscule }

		stress_impact = {
			brave = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
			impatient = minor_stress_impact_gain
			patient = miniscule_stress_impact_loss
			content = miniscule_stress_impact_loss
			craven = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = -1
				ai_honor = -1
			}
		}
	}
}

# You attempt to fight with your other hand to surprise your opponent
ep2_tournament_events.0011 = {
	type = activity_event
	title = ep2_tournament_events.0011.t
	desc = ep2_tournament_events.0011.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	cooldown = { years = 1 }

	left_portrait = {
		character = root
		animation = aggressive_sword
	}

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

	trigger = {
		contest_versus_player_vs_ai_trigger = yes

		NOT = { #For obvious reasons
			has_trait = maimed
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_metal_woosh"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = duel ID = 0011 }
		save_scope_value_as = {
			name = weapon_range
			value = {
				integer_range = {
					min = 1
					max = 15
				}
			}
		}
	}

	# Pop it to your hand with the greatest of ease
	option = {
		name = ep2_tournament_events.0011.a
	
		trigger = {
			OR = {
				AND = {
					has_trait = tourney_participant
					has_trait_xp = {
						trait = tourney_participant
						track = foot
						value >= 50
					}
				}
				has_trait = lifestyle_blademaster
				has_trait = education_martial_prowess
			}
		}

		flavor = ep2_tournament_events.0011.a.tt

		add_character_modifier = tournament_ambidextrous_modifier
		
		accolade_minor_glory_gain_with_checks_effect = yes

		activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_ambidextrous_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

		stress_impact = {
			base = minor_stress_impact_loss
			deceitful = miniscule_stress_impact_loss
			arrogant = miniscule_stress_impact_loss
			honest = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 1
			}
		}
	}

	# Attempt to throw your weapon to your other hand
	option = {
		name = ep2_tournament_events.0011.b

		trigger = {
			NOR = {
				AND = {
					has_trait = tourney_participant
					has_trait_xp = {
						trait = tourney_participant
						track = foot
						value >= 50
					}
				}
				has_trait = lifestyle_blademaster
				has_trait = education_martial_prowess
			}
		}

		flavor = ep2_tournament_events.0011.b.tt

		duel = {
			skills = { prowess intrigue }
			target = scope:versus_contestant
			
			50 = { #It succeeds
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				desc = ep2_tournament_events.0011.b.success

				modifier = {
					has_trait = athletic
					add = 5
				}

				modifier = {
					AND = {
						has_trait = tourney_participant
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 15
						}
					}
					add = 5
				}
				min = 5

				modifier = {
					has_trait = education_martial_prowess
					add = 15
				}

				scope:activity = {
					add_activity_log_entry = {
						key = tournament_ambidextrous_log
						tags = { good }
						score = 5
						character = root
						target = scope:versus_contestant
					}
				}

				send_interface_toast = {
					title = ep2_tournament_events.0011.b.success
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

					add_character_modifier = {
						modifier = tournament_ambidextrous_modifier
						years = 25
					}
				}
			}
			40 = { #It fails
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				desc = ep2_tournament_events.0011.b.failure

				modifier = {
					scope:versus_contestant = {
						has_trait = lifestyle_blademaster
					}
					add = 7
				}

				modifier = {
					scope:versus_contestant = {
						AND = {
							has_trait = tourney_participant
							has_trait_xp = {
								trait = tourney_participant
								track = foot
								value >= 50
							}
						}
					}
					add = 7
				}
				min = 4

				send_interface_toast = {
					title = ep2_tournament_events.0011.b.failure
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
				}
			}

			10 = { #It fails horrendously
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 1

				desc = ep2_tournament_events.0011.b.criticalfailure

				scope:activity = {
					add_activity_log_entry = {
						key = tournament_ambisinister_log
						tags = { bad }
						score = 5
						character = root
						target = scope:versus_contestant
					}
				}

				send_interface_toast = {
					title = ep2_tournament_events.0011.b.criticalfailure
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_major }

					add_character_modifier = {
						modifier = tournament_ambisinister_modifier
						years = 25
					}

					increase_wounds_no_death_effect = { REASON = duel }

					if = {
						limit = {
							NOT = {
								has_trait = scarred
							}
						}
						add_trait = scarred
					}
					add_trait_xp = {
						trait = scarred
						value = {
							integer_range = {
								min = 5
								max = 25
							}
						}
					}
				}
			}
		}

		stress_impact = {
			deceitful = miniscule_stress_impact_loss
			arrogant = miniscule_stress_impact_loss
			honest = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 1
			}
		}
	}

	# Attempt to fight on, using your sword with two hands
	option = {
		name = ep2_tournament_events.0011.c

		flavor = ep2_tournament_events.0011.c.tt

		random_list = {
			50 = {
				modifier = { #This is for fuzzying up the random list so it randomises it a bit
					add = scope:weapon_range
				}

				send_interface_toast = {
					title = ep2_tournament_events.0011.c.success
					left_icon = root
					right_icon = scope:versus_contestant

					custom_tooltip = ep2_tournament_events.0011.c.opinion

					scope:activity = {
						random_guest_subset_current_phase = {
							name = spectator
							limit = { is_alive = yes }

							hidden_effect = {
								add_opinion = {
									target = root
									opinion = 5
									modifier = impressed_opinion								
								}
							}
						}
					}
				}
			}
			50 = {
				send_interface_toast = {
					title = ep2_tournament_events.0011.c.failure
					left_icon = root
					right_icon = scope:versus_contestant

					increase_wounds_no_death_effect = { REASON = duel }
					activity_tournament_change_contestant_score_effect = { SCORE = decrease_miniscule }
				}
			}
		}

		stress_impact = {
			brave = miniscule_stress_impact_loss
			ambitious = miniscule_stress_impact_loss
			wrathful = miniscule_stress_impact_loss
			calm = minor_stress_impact_gain
			content = minor_stress_impact_gain
			craven = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = -1
			}
		}
	}
}

# GO GO GADGET DUELING CLOAK
# No but for real, it's taken from Di Grassi's manuals (yes, I know, slightly out of period, shhhh, rule of cool):
# "The cloak may be flung or thrown with the edge of the sword, when one standeth at the low ward, 
# with the point of the sword turned backwards, on the left side and the left side with the cloak upon it, 
# followed at large upon the arm up to the elbow: but not wrapped about it, and whilest he falseth a reverse, 
# he may take the cloak on the edge of the sword and fling it towards his enemy, 
# and then strike him with such a blow as shall be then most for his advantage deliver."
ep2_tournament_events.0012 = {
	type = activity_event
	title = ep2_tournament_events.0012.t
	desc = ep2_tournament_events.0012.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest

	left_portrait = {
		character = root
		animation = marshal
	}

	right_portrait = {
		character = scope:versus_contestant
		animation = laugh
	}

	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes

		has_character_flag = cloak_duelist_flag #Ensure you are wearing your DUELING CLOAK 
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_surprise_reaction"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = duel ID = 0012 }
	}

	# Proudly fight in the cloak
	option = {
		name = ep2_tournament_events.0012.a
	
		trigger = {
			has_trait = arrogant
		}

		if = {
			limit = {
				NOT = {
					has_character_modifier = tournament_fashionable_duelist_modifier
				}
			}
			add_character_modifier = {
				modifier = tournament_fashionable_duelist_modifier
				years = 20
			}
		}
		else = {
			add_prestige = medium_prestige_gain
		}
		
		accolade_medium_glory_gain_with_checks_effect = yes
		
		activity_tournament_change_contestant_score_effect = { SCORE = decrease_miniscule }

		stress_impact = {
			base = medium_stress_impact_loss
			stubborn = miniscule_stress_impact_loss
			fickle = minor_stress_impact_gain
		}

		ai_chance = {
			base = 75
			ai_value_modifier = {
				ai_boldness = 1
				ai_vengefulness = 0.5
			}
		}
	}

	# Throw the cloak at your enemy
	option = {
		name = ep2_tournament_events.0012.b

		trigger = {
			intrigue > 8
		}
		show_as_unavailable = {
			always = yes
		}

		flavor = ep2_tournament_events.0012.b.tt

		activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_dueling_cloak_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

		stress_impact = {
			deceitful = minor_stress_impact_loss
			arbitrary = minor_stress_impact_loss
			just = medium_stress_impact_gain
			honest = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_vengefulness = 1
			}
		}
	}

	# Dis-cloak thyself
	option = {
		name = ep2_tournament_events.0012.c

		flavor = ep2_tournament_events.0012.c.tt

		stress_impact = {
			ambitious = miniscule_stress_impact_loss
			fickle = miniscule_stress_impact_loss
			humble = miniscule_stress_impact_loss
			content = medium_stress_impact_gain
			stubborn = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = -1
				ai_honor = 0.5
			}
		}
	}

	# Insist on wearing it
	option = {
		name = ep2_tournament_events.0012.d

		trigger = {
			NOT = {
				has_trait = arrogant
			}
		}

		if = {
			limit = {
				NOT = {
					has_character_modifier = tournament_fashionable_duelist_modifier
				}
			}
			add_character_modifier = {
				modifier = tournament_fashionable_duelist_modifier
				years = 10
			}
		}
		else = {
			add_prestige = medium_prestige_gain
		}

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

		stress_impact = {
			stubborn = miniscule_stress_impact_loss
			fickle = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = 1
			}
		}
	}

	after = {
		remove_character_flag = cloak_duelist_flag
	}
}

# Try to distract your opponent with words
ep2_tournament_events.0020 = {
	type = activity_event
	title = ep2_tournament_events.0020.t
	desc = {
		desc = ep2_tournament_events.0020.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:secret = {
						exists = this
					}
				}
				desc = ep2_tournament_events.0020.secret
			}
		}
	}
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = scheme
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = aggressive_sword
	}
	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = duel ID = 0020 }

		scope:versus_contestant = {
			random_secret = {
				limit = {
					is_known_by = root
				}
				save_scope_as = secret
			}
		}
	}

	# Loudly reveal their secret
	option = {
		name = ep2_tournament_events.0020.a
	
		trigger = {
			scope:secret = {
				exists = this
			}
			OR = {
				has_trait = sadistic
				has_trait = callous
				has_trait = arbitrary
			}
		}

		scope:secret = {
			expose_secret = root
		}

		scope:versus_contestant = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_major }
		}
		
		accolade_minor_glory_loss_with_checks_effect = yes

		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = angry_opinion
			opinion = -50
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_secret_exposed_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

		stress_impact = {
			compassionate = medium_stress_impact_gain
			just = medium_stress_impact_gain
			sadistic = miniscule_stress_impact_loss
			callous = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 50

			modifier = {
				factor = 0
				NOR = {
					has_trait = compassionate
					has_trait = just
				}
			}
		}
	}

	# I know your seeeecreeeet!
	option = {
		name = ep2_tournament_events.0020.b
	
		trigger = {
			scope:secret = {
				exists = this
			}
		}

		add_internal_flag = special

		scope:versus_contestant = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
		}
		
		accolade_minimal_glory_loss_with_checks_effect = yes

		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = angry_opinion
			opinion = -30
		}

		stress_impact = {
			compassionate = minor_stress_impact_gain
			just = minor_stress_impact_gain
			sadistic = miniscule_stress_impact_loss
			callous = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = 2
				ai_boldness = 2
				ai_honor = -2
				ai_compassion = -2
			}
		}
	}

	# Try to distract them
	option = {
		name = ep2_tournament_events.0020.c

		duel = {
			skill = diplomacy
			value = high_skill_rating
			50 = { #They accept your apology
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				desc = ep2_tournament_events.0020.c.success

				send_interface_toast = {
					title = ep2_tournament_events.0020.c.success
					left_icon = root
					right_icon = scope:versus_contestant

					scope:versus_contestant = {
						activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }
					}
				}
			}
			50 = { #They don't accept the apology
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				desc = ep2_tournament_events.0020.c.failure

				send_interface_toast = {
					title = ep2_tournament_events.0020.c.failure
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }
				}
			}
		}

		stress_impact = {
			just = medium_stress_impact_gain
			honest = minor_stress_impact_gain
			arbitrary = miniscule_stress_impact_gain
			deceitful = miniscule_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = -1
			}
		}
	}

	# Decide against such underhanded tactics
	option = {
		name = ep2_tournament_events.0020.d
		
		accolade_minimal_glory_gain_with_checks_effect = yes

		stress_impact = {
			just = miniscule_stress_impact_loss
			honest = miniscule_stress_impact_loss
			arbitrary = minor_stress_impact_gain
			deceitful = minor_stress_impact_gain
		}

		ai_chance = {
			base = 75
			ai_value_modifier = {
				ai_boldness = -0.5
				ai_honor = 1
			}
		}
	}
}

# Remind your opponent you slept with their family member
ep2_tournament_events.0021 = {
	type = activity_event
	title = ep2_tournament_events.0021.t
	desc = ep2_tournament_events.0021.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = scheme
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = dismissal
	}
	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
		trigger_if = {
			limit = { this = scope:versus_matcher }
			scope:versus_matchee = {
				any_close_family_member = {
					OR = {
						has_relation_lover = root
						has_relation_soulmate = root
						is_spouse_of = root
					}
				}
			}
		}
		trigger_else = {
			scope:versus_matcher = {
				any_close_family_member = {
					OR = {
						has_relation_lover = root
						has_relation_soulmate = root
						is_spouse_of = root
					}
				}
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_surprise_reaction"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = duel ID = 0021 }

		scope:versus_contestant = {
			random_close_family_member = {
				limit = {
					OR = {
						has_relation_lover = root
						has_relation_soulmate = root
						is_spouse_of = root
					}
				}
				save_scope_as = family
			}
		}
	}

	# CoD lobby trash talk, 2009
	option = {
		name = ep2_tournament_events.0021.a
	
		trigger = {
			OR = {
				has_trait = sadistic
				has_trait = arrogant
			}

			NOR = {
				has_trait = chaste
				has_trait = celibate
			}
		}

		scope:versus_contestant = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_major }
		}

		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = absolutely_horrified_opinion
			opinion = -60
		}

		reverse_add_opinion = {
			target = scope:family
			modifier = insulted_opinion
			opinion = -20
		}

		stress_impact = {
			base = minor_stress_impact_loss
			compassionate = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = 2
				ai_boldness = 2
				ai_honor = -2
				ai_compassion = -2
			}
		}
	}

	# Thou hast undone our mother!
	option = {
		name = ep2_tournament_events.0021.b

		scope:versus_contestant = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
		}
		
		accolade_minimal_glory_gain_with_checks_effect = yes

		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = angry_opinion
			opinion = -40
		}

		stress_impact = {
			compassionate = minor_stress_impact_gain
			just = minor_stress_impact_gain
			sadistic = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = 2
				ai_boldness = 2
				ai_honor = -2
				ai_compassion = -2
			}
		}
	}

	# Stay out of it
	option = {
		name = ep2_tournament_events.0021.c

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

		stress_impact = {
			compassionate = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
			content = miniscule_stress_impact_loss
			ambitious = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
			arbitrary = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = -2
				ai_boldness = -2
				ai_honor = 2
				ai_compassion = 2
			}
		}
	}
}

###############
###  MELEE  ###
###############

# Melee spills over into nearby town
ep2_tournament_events.1001 = {
	type = activity_event
	title = ep2_tournament_events.1001.t
	desc = ep2_tournament_events.1001.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = worry
	}
	cooldown = { years = 1 }

	trigger = {
		NOT = {
			has_variable = tournament_village_destroyed
		}
		OR = {
			involved_activity.activity_location = {
				has_holding_type = church_holding
				barony = {
					lessee = {
						this != root #it's not you
						is_ai = yes
						is_adult = yes
					}
				}
			}
			scope:activity.activity_location.province_owner != root
		}
	}

	immediate = {
		play_sound_effect = "event:/SFX/Ambience/3DMapEmitters/Nature/sfx_amb_3d_fire"
		scope:activity.activity_location.province_owner = { save_scope_as = mayor }
		tournament_pivotal_flavor_variable_effect = { CONTEST = melee ID = 1001 }
	}

	# Make everyone stop
	option = {
		name = ep2_tournament_events.1001.a

		trigger = {
			has_trait = august
		}

		add_prestige = medium_prestige_value

		stress_impact = {
			craven = medium_stress_impact_gain
			content = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = craven
					has_trait = content
					has_trait = humble
				}
			}
		}
	}

	# Stubbornly refuse to leave
	option = {
		name = ep2_tournament_events.1001.b

		trigger = {
			has_trait = stubborn
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

		scope:activity.activity_location = {
			add_province_modifier = {
				modifier = village_destroyed_modifier
				years = 10
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_village_burned_log
				tags = { bad }
				score = 5
				character = root
			}
		}

		stress_impact = {
			craven = medium_stress_impact_gain
			content = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = craven
					has_trait = content
					has_trait = humble
				}
			}
		}
	}

	# Attempt to call a truce
	option = {
		name = ep2_tournament_events.1001.c

		duel = {
			skill = diplomacy
			value = high_skill_rating

			50 = { #The contestants acquiesce
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.1001.c.success
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

					add_prestige = minor_prestige_gain
				}

				desc = ep2_tournament_events.1001.c.success
			}
			50 = { #Nobody listens
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.1001.c.success
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

					add_prestige = minor_prestige_loss
				}

				desc = ep2_tournament_events.1001.c.failure

				scope:activity = {
					add_activity_log_entry = {
						key = tournament_village_burned_log
						tags = { bad }
						score = 5
						character = root
					}
				}

				scope:activity.activity_location = {
					add_province_modifier = {
						modifier = village_destroyed_modifier
						years = 10
					}
				}

				set_variable = {
					days = 150 #Want it to last the entire duration of a tournament
					name = tournament_village_destroyed
				}
			}
		}

		stress_impact = {
			brave = medium_stress_impact_gain
			ambitious = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}

	# Leave
	option = {
		name = ep2_tournament_events.1001.d

		set_variable = {
			days = 150 #Want it to last the entire duration of a tournament
			name = tournament_village_destroyed
		}

		scope:activity.activity_location = {
			add_province_modifier = {
				modifier = village_destroyed_modifier
				years = 10
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_village_burned_log
				tags = { bad }
				score = 5
				character = root
			}
		}

		stress_impact = {
			craven = minor_stress_impact_loss
			content = miniscule_stress_impact_loss
			brave = medium_stress_impact_gain
			ambitious = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100


			modifier = {
				factor = 0
				NOR = {
					has_trait = brave
					has_trait = ambitious
					has_trait = arrogant
				}
			}
		}	
	}
}

# Village mayor approaches you furiously
ep2_tournament_events.1002 = {
	type = activity_event
	title = ep2_tournament_events.1002.t
	desc = ep2_tournament_events.1002.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = {
		character = scope:mayor
		animation = anger
	}
	cooldown = { years = 1 }

	trigger = {
		has_variable = tournament_village_destroyed # ensure village actually got ruined
		scope:activity.activity_location.province_owner != root
	}

	immediate = {
		scope:activity.activity_location.province_owner = { save_scope_as = mayor }
		scope:activity.activity_location = { save_scope_as = holding }
	}

	# Offer to rebuild using your expertise
	option = {
		name = ep2_tournament_events.1002.a

		trigger = {
			has_trait = architect
		}

		reverse_add_opinion = {
			target = scope:mayor
			opinion = 20
			modifier = pleased_opinion
		}

		if = {
			limit = {
				this != scope:host
			}
			reverse_add_opinion = {
				target = scope:host
				opinion = 20
				modifier = pleased_opinion
			}
		}

		scope:holding = {
			remove_province_modifier = village_destroyed_modifier
			add_province_modifier = {
				modifier = village_rebuilt_modifier
				years = 10
			}
		}

		stress_impact = {
			content = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = content
					has_trait = humble
				}
			}
		}
	}

	# Intimidate the mayor
	option = {
		name = ep2_tournament_events.1002.b

		trigger = {
			dread >= high_dread
		}

		add_internal_flag = special

		reverse_add_opinion = {
			target = scope:mayor
			opinion = -30
			modifier = scared_opinion
		}

		stress_impact = {
			sadistic = minor_stress_impact_loss
			content = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = content
					has_trait = humble
					has_trait = compassionate
				}
			}
		}
	}

	# Offer to pay for the damage
	option = {
		name = ep2_tournament_events.1002.c

		remove_short_term_gold = medium_gold_value

		scope:holding = {
			remove_province_modifier = village_destroyed_modifier
		}

		reverse_add_opinion = {
			target = scope:mayor
			opinion = 10
			modifier = kindness_opinion
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_village_paid_log
				tags = { good }
				score = 5
				character = root
				target = scope:mayor
			}
		}

		stress_impact = {
			greedy = major_stress_impact_gain
			generous = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				has_trait = greedy
			}
		}
	}

	# Send the mayor away
	option = {
		name = ep2_tournament_events.1002.d

		progress_towards_rival_effect = {
			REASON = rival_melee_dismissed_mayor
			CHARACTER = scope:mayor
			OPINION = default_rival_opinion
		}

		stress_impact = {
			arrogant = miniscule_stress_impact_loss
			compassionate = minor_stress_impact_gain
			just = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}	
	}
}

# Your weapon is knocked from your grasp; retrieve it or switch to a reserve?
ep2_tournament_events.1003 = {
	type = activity_event
	title = ep2_tournament_events.1003.t
	desc = ep2_tournament_events.1003.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = shock
	}
	artifact = {
		target = scope:tournament_weapon
		position = lower_center_portrait
	}
	cooldown = { years = 1 }

	trigger = {
		exists = var:contest_aptitude
		scope:activity = {
			any_guest_subset_current_phase = {
				name = qualified
				this = root
			}
			any_guest_subset_current_phase = { # Just to make sure there's still some alive people
				name = qualified
				contest_event_general_contestant_valid_trigger = yes
			}
		}
		any_character_artifact = {
			is_equipped = yes
			artifact_slot_type = primary_armament
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_surprise_reaction"
		tournament_pivotal_flavor_variable_effect = { CONTEST = melee ID = 1003 }
		random_character_artifact = {
			limit = {
				is_equipped = yes
				artifact_slot_type = primary_armament
			}
			unequip_artifact_from_owner = yes
			save_scope_as = tournament_weapon
		}

		save_scope_value_as = {
			name = weapon_range
			value = {
				integer_range = {
					min = 0
					max = 5
				}
			}
		}

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }
	}

	# Dive for it
	option = {
		name = ep2_tournament_events.1003.a

		random_list = {
			10 = { #You successfully retrieve it
				custom_tooltip = ep2_tournament_events.1003.a.tt.success

				modifier = { #Strong and Athletic are nice catch-all traits for having quick reflexes
					add = 5

					OR = {
						has_trait = strong
						has_trait = athletic
					}
				}
				modifier = { #add a good physique too, for the same reasons
					add = 2
					
					has_trait = physique_good
				}

				modifier = { #This is for fuzzying up the random list so it randomises it a bit
					add = scope:weapon_range
				}

				send_interface_toast = {
					title = ep2_tournament_events.1003.a.tt.success
					left_icon = root

					scope:tournament_weapon = {
						equip_artifact_to_owner = yes
					}

					activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

					if = {
						limit = { has_trait = tourney_participant }
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_minor_value
						}
					}
				}

				stress_impact = {
					base = miniscule_stress_impact_loss

					arrogant = miniscule_stress_impact_loss
					content = minor_stress_impact_gain
					lazy = minor_stress_impact_gain
				}
			}

			10 = { #You have to go back later and find it
				custom_tooltip = ep2_tournament_events.1003.a.tt.failure

				send_interface_toast = {
					title = ep2_tournament_events.1003.a.tt.failure
					left_icon = root
				}

				stress_impact = {
					base = miniscule_stress_impact_gain

					arrogant = minor_stress_impact_gain
					content = miniscule_stress_impact_loss
					lazy = miniscule_stress_impact_loss
				}
			}
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOT = {
					has_trait = arrogant
				}
			}
		}
	}

	# Switch to a different weapon
	option = {
		name = ep2_tournament_events.1003.b

		flavor = ep2_tournament_events.1003.b.tt

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_medium_value
			}
		}

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

		stress_impact = {
			arrogant = medium_stress_impact_gain
			content = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}

		ai_chance = { #Get out option
			base = 100
		}
	}
}

# A comely [non-martial gender] has taken a wrong turn and ended up in the melee!
ep2_tournament_events.1004 = {
	type = activity_event
	title = ep2_tournament_events.1004.t
	desc = ep2_tournament_events.1004.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:comely_stray
		animation = worry
	}
	lower_center_portrait = {
		character = scope:rescuer_knight
	}
	cooldown = { years = 1 }

	trigger = {
		exists = var:contest_aptitude
		scope:activity = {
			any_attending_character = {
				count < 240 #Max is 250 but attendance is open so leaving some space
			}
			any_guest_subset_current_phase = {
				name = qualified
				this = root
			}
			any_guest_subset_current_phase = {
				name = qualified
				contest_event_general_contestant_valid_trigger = yes
				is_knight_of = root
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_metal_clash"
		tournament_pivotal_flavor_variable_effect = { CONTEST = melee ID = 1004 }
		create_character = {
			template = beautiful_peasant_character
			age = { age_compared_to_root_minus_ten_always_adult age_compared_to_root_plus_ten_always_adult }
			gender_female_chance = root_attraction_based_female_chance
			location = scope:activity.activity_location
			faith = root.location.faith
			culture = root.location.culture
			save_scope_as = comely_stray
			
		}
		scope:comely_stray = {
			hidden_effect = {
				add_to_activity = scope:activity
			}
		}
		scope:activity = {
			random_guest_subset_current_phase = {
				name = qualified
				limit = {
					contest_event_general_contestant_valid_trigger = yes
					is_knight_of = root
				}
				save_scope_as = rescuer_knight
			}
		}
	}

	# Lustful/Seducer option that has you escort them completely off the field of battle
	option = {
		name = ep2_tournament_events.1004.a

		trigger = {
			OR = {
				has_trait = lustful
				has_trait = seducer
			}
			might_cheat_on_every_partner_trigger = yes
		}

		flavor = ep2_tournament_events.1004.a.tt
		
		accolade_minor_glory_gain_with_checks_effect = yes

		had_sex_with_effect = {
			CHARACTER = scope:comely_stray
			PREGNANCY_CHANCE = 50
		}

		if = {
			limit = {
				can_set_relation_lover_trigger = { CHARACTER = scope:comely_stray }
			}
			set_relation_lover = {
				TARGET = scope:comely_stray
				REASON = lover_saved_melee
			}
		}

		remove_variable = contest_aptitude

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_seducer_log
				tags = { good }
				score = 5
				character = root
				target = scope:comely_stray

				# Effect
				custom_description = {
					text = tournament_contest_withdraw_tt
					subject = root
				}
			}
		}

		stress_impact = {
			base = minor_stress_impact_loss
			chaste = massive_stress_impact_gain #technically possible if you're a Seducer
			content = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
			compassionate = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = chaste
					has_trait = brave
				}
			}
		}
	}

	# Well well, how would you like a dashing ladylord to sweep you off your feet?
	option = {
		name = ep2_tournament_events.1004.a # Same name as above to re-use loc

		trigger = {
			NOR = {
				has_trait = lustful
				has_trait = seducer
			}
		}
		
		accolade_minimal_glory_gain_with_checks_effect = yes

		scope:comely_stray = { #Goodness, so dashing!
			add_opinion = {
				modifier = grateful_opinion
				target = root
				opinion = 40
			}
		}

		add_courtier = scope:comely_stray

		if = {
			limit = {
				can_start_scheme = {
					type = seduce
					target_character = scope:comely_stray
				}
			}
			start_scheme = {
				type = seduce
				target_character = scope:comely_stray
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_swept_off_feet_log
				tags = { good }
				score = 5
				character = root
				target = scope:comely_stray
			}
		}

		stress_impact = {
			chaste = major_stress_impact_gain
			content = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
			compassionate = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = chaste
					has_trait = brave
				}
			}
		}
	}

	# Send a knight to rescue them
	option = {
		name = ep2_tournament_events.1004.c

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }
		
		scope:rescuer_knight = {
			accolade_minor_glory_gain_with_checks_effect = yes
		}

		scope:comely_stray = {
			add_opinion = {
				modifier = grateful_opinion
				target = scope:rescuer_knight
				opinion = 40
			}
		}

		stress_impact = {
			lustful = major_stress_impact_gain
			arrogant = medium_stress_impact_gain
			brave = medium_stress_impact_gain
			humble = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = arrogant
					has_trait = lustful
				}
			}
		}
	}

	# They can fend for themselves
	option = {
		name = ep2_tournament_events.1004.d

		scope:comely_stray = {
			add_opinion = {
				modifier = cruelty_opinion
				target = root
				opinion = -30
			}
		}

		random_list = {
			7 = { #They escape unharmed
				desc = ep2_tournament_events.1004.d.escape.tt

				show_chance = no #Make it uncertain for all three

				send_interface_toast = {
					title = ep2_tournament_events.1004.d.escape.tt
					left_icon = root
					right_icon = scope:comely_stray
				}
			}

			5 = { #They get injured
				desc = ep2_tournament_events.1004.d.injured.tt

				show_chance = no

				send_interface_toast = {
					title = ep2_tournament_events.1004.d.injured.tt
					left_icon = root
					right_icon = scope:comely_stray

					scope:comely_stray = {
						increase_wounds_effect = { REASON = battle }

						if = {
							limit = {
								NOT = {
									has_trait = scarred
								}
							}
							add_trait = scarred
						}
						add_trait_xp = {
							trait = scarred
							value = {
								integer_range = {
									min = 35
									max = 100
								}
							}
						}
					}
				}
			}

			3 = { #They die
				desc = ep2_tournament_events.1004.d.dead.tt

				show_chance = no

				scope:activity = {
					add_activity_log_entry = {
						key = tournament_melee_death_log
						tags = { bad }
						score = 5
						character = root
						target = scope:comely_stray
					}
				}

				send_interface_toast = {
					title = ep2_tournament_events.1004.d.dead.tt
					left_icon = root
					right_icon = scope:comely_stray
					scope:comely_stray = {
						death = { death_reason = death_wounds }
					}
				}
			}
		}

		stress_impact = {
			lustful = major_stress_impact_gain
			brave = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			lazy = minor_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = lustful
					has_trait = brave
					has_trait = compassionate
				}
			}
		}
	}
}

# Death Event: You step into a throat strike
ep2_tournament_events.1005 = {
	type = activity_event
	title = ep2_tournament_events.1005.t
	desc = ep2_tournament_events.1005.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = poison
	}
	cooldown = { years = 5 }

	trigger = {
		scope:activity = {
			any_guest_subset_current_phase = {
				name = qualified
				this = root
			}
		}
	}

	# Die
	option = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_metal_clash"	
		name = ep2_tournament_events.1005.a

		remove_variable = contest_aptitude
		scope:activity = {
			add_activity_log_entry = {
				key = tournament_melee_death_log
				tags = { bad }
				score = 10
				character = root
			}
		}

		death = {
			death_reason = death_tournament_melee_throat
		}

		ai_chance = {
			base = 100
		}
	}
}

# Ransom an opponent
ep2_tournament_events.1006 = {
	type = activity_event
	title = ep2_tournament_events.1006.t
	desc = {
		desc = ep2_tournament_events.1006.start
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_relation_rival = scope:surrendering_knight
						has_relation_nemesis = scope:surrendering_knight
					}
				}
				desc = ep2_tournament_events.1006.rival
			}
			triggered_desc = {
				trigger = {
					AND = {
						NOR = {
							has_relation_rival = scope:surrendering_knight
							has_relation_nemesis = scope:surrendering_knight
						}
						scope:surrendering_knight.gold < 5
					}
				}
				desc = {
					desc = ep2_tournament_events.1006.normal
					desc = ep2_tournament_events.1006.broke
				}
			}
			triggered_desc = {
				trigger = {
					NOR = {
						has_relation_rival = scope:surrendering_knight
						has_relation_nemesis = scope:surrendering_knight
					}
				}
				desc = ep2_tournament_events.1006.normal
			}
		}
	}
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = sword_coup_degrace
	}
	right_portrait = {
		character = scope:surrendering_knight
		animation = sword_yield_start
	}
	cooldown = { years = 5 }

	trigger = {
		scope:activity = {
			any_guest_subset_current_phase = {
				name = qualified
				contest_event_general_contestant_valid_trigger = yes
				root = this
			}
			any_guest_subset_current_phase = {
				name = qualified
				contest_event_general_contestant_valid_trigger = yes
				is_ai = yes
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_positive_reaction"
		tournament_pivotal_flavor_variable_effect = { CONTEST = melee ID = 1006 }
		scope:activity = {
			random_guest_subset_current_phase = {
				name = qualified
				limit = {
					contest_event_general_contestant_valid_trigger = yes
					is_ai = yes
				}
				save_scope_as = surrendering_knight
			}
		}

		save_scope_value_as = { #Save their gold
			name = surrendering_knight_gold
			value = scope:surrendering_knight.gold
		}

		save_scope_value_as = { #Save a fifth of their gold as a ransom
			name = gold_percentage
			value = {
				value = scope:surrendering_knight.gold
				multiply = 0.2
			}
		}

		if = {
			limit = {
				scope:surrendering_knight ?= {
					any_equipped_character_artifact = {
						OR = {
							artifact_slot_type = primary_armament
							artifact_slot_type = armor
							artifact_slot_type = helmet
						}
					}
				}
			}
			scope:surrendering_knight = {
				random_equipped_character_artifact = {
					limit = {
						OR = {
							artifact_slot_type = primary_armament
							artifact_slot_type = armor
							artifact_slot_type = helmet
						}
					}
					save_scope_as = artifact
				}
			}
		}
		else = {
			create_artifact_brooch_effect = {
				OWNER = scope:surrendering_knight
				SMITH = scope:surrendering_knight
			}
		}

		if = {
			limit = { has_trait = tourney_participant }
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_minor_value
			}
			add_trait_xp = {
				trait = tourney_participant
				track = horse
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}
		
		scope:surrendering_knight = {
			accolade_medium_glory_loss_with_checks_effect = yes
		}
	}

	# Take their eye
	option = {
		name = ep2_tournament_events.1006.a

		trigger = {
			OR = {
				has_relation_rival = scope:surrendering_knight
				has_relation_nemesis = scope:surrendering_knight
			}
		}

		add_internal_flag = special

		if = {
			limit = {
				scope:surrendering_knight = {
					has_relation_nemesis = root
				}
			}
			scope:surrendering_knight = {
				add_trait = disfigured
			}
		}
		else_if = {
			limit = {
				scope:surrendering_knight = {
					has_relation_rival = root
				}
			}
			scope:surrendering_knight = {
				add_trait = one_eyed
			}
		}

		stress_impact = {
			base = miniscule_stress_impact_loss
			compassionate = massive_stress_impact_gain
			forgiving = massive_stress_impact_gain
			vengeful = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
		}

		ai_chance = {
			base = 25

			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = forgiving
				}
			}
		}
	}

	# Take the ransom
	option = {
		name = ep2_tournament_events.1006.b

		trigger = {
			scope:surrendering_knight.gold > 4
		}

		scope:surrendering_knight = {
			pay_short_term_gold = {
				target = root
				gold = scope:gold_percentage
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_ransom_log
				tags = { good }
				score = 5
				character = root
				target = scope:surrendering_knight
			}
		}

		stress_impact = { # Deliberately low; we want the player to pick this option the most
			greedy = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
			generous = miniscule_stress_impact_gain
			arbitrary = miniscule_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_vengefulness = -0.5
			}
		}
	}

	# Take a piece of their armour/weaponry
	option = {
		name = ep2_tournament_events.1006.c

		trigger = {
			scope:surrendering_knight = {
				any_equipped_character_artifact = {
					count >= 1
					OR = {
						artifact_slot_type = primary_armament
						artifact_slot_type = armor
						artifact_slot_type = helmet
					}
				}
			}			
		}

		if = {
			limit = {
				scope:surrendering_knight = {
					any_equipped_character_artifact = {
						count >= 1
						OR = {
							artifact_slot_type = primary_armament
							artifact_slot_type = armor
							artifact_slot_type = helmet
						}
						save_temporary_scope_as = artifact
					}
				}
			}
			scope:artifact = {
				set_owner = root
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_ransom_log
				tags = { good }
				score = 5
				character = root
				target = scope:surrendering_knight
			}
		}

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

	# Take a tiny amount of gold
	option = {
		name = ep2_tournament_events.1006.d

		trigger = {
			scope:surrendering_knight = {
				any_equipped_character_artifact = {
					count = 0
				}
				gold < 4
			}			
		}

		scope:surrendering_knight = {
			pay_short_term_gold = {
				target = root
				gold = 5
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_ransom_log
				tags = { good }
				score = 5
				character = root
				target = scope:surrendering_knight
			}
		}

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

	# Let them go free
	option = {
		name = ep2_tournament_events.1006.e

		add_prestige = 50 #Small bit of prestige for being gracious

		reverse_add_opinion = {
			modifier = grateful_opinion
			target = scope:surrendering_knight
			opinion = 25
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = -1
				ai_vengefulness = -1
			}
		}
	}
}

# You take a minute at a refuge
ep2_tournament_events.1007 = {
	type = activity_event
	title = ep2_tournament_events.1007.t
	desc = ep2_tournament_events.1007.desc
	theme = tournament_contest
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:teammate_1
	}
	lower_right_portrait = {
		character = scope:teammate_2
	}
	lower_left_portrait = {
		character = scope:teammate_3
	}
	cooldown = { years = 5 }

	trigger = {
		scope:activity = {
			any_guest_subset_current_phase = {
				name = qualified
				root = this
				exists = var:progress_to_victory
			}
			#Ensure there are two teams with at least 3 people each
			any_guest_subset_current_phase = {
				name = team_alpha
				contest_event_general_contestant_valid_trigger = yes
				count >= 3
			}
			any_guest_subset_current_phase = {
				name = team_beta
				contest_event_general_contestant_valid_trigger = yes
				count >= 3
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_horse_trotting"
		tournament_pivotal_flavor_variable_effect = { CONTEST = melee ID = 1007 }
		scope:activity = {
			if = { # If you're in Team A, grab teammates
				limit = {
					any_guest_subset_current_phase = {
						name = team_alpha
						this = root
					}
				}
				random_guest_subset_current_phase = {
					name = team_alpha
					limit = { contest_event_general_contestant_valid_trigger = yes }
					save_scope_as = teammate_1
				}
				random_guest_subset_current_phase = {
					name = team_alpha
					limit = { 
						contest_event_general_contestant_valid_trigger = yes 
						this != scope:teammate_1
					}
					save_scope_as = teammate_2
				}
				random_guest_subset_current_phase = {
					name = team_alpha
					limit = { 
						contest_event_general_contestant_valid_trigger = yes 
						NOR = {
							this = scope:teammate_1
							this = scope:teammate_2
						}
					}
					save_scope_as = teammate_3
				}
			}
			else = { # If you're in team B, grab those teammates
				random_guest_subset_current_phase = {
					name = team_beta
					limit = {
						contest_event_general_contestant_valid_trigger = yes
					}
					save_scope_as = teammate_1
				}
				random_guest_subset_current_phase = {
					name = team_beta
					limit = {
						contest_event_general_contestant_valid_trigger = yes
						this != scope:teammate_1
					}
					save_scope_as = teammate_2
				}
				random_guest_subset_current_phase = {
					name = team_beta
					limit = {
						contest_event_general_contestant_valid_trigger = yes
						NOR = {
							this = scope:teammate_1
							this = scope:teammate_2
						}
					}
					save_scope_as = teammate_3
				}
			}
		}
	}

	# Pay for some food and drink
	option = {
		name = ep2_tournament_events.1007.a

		remove_short_term_gold = medium_gold_value

		random_list = {
			10 = { #You are all somewhat refreshed
				desc = ep2_tournament_events.1007.a.tt.success
				show_chance = no

				hidden_effect = {
					activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

					scope:teammate_1 = {
						activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
					}
					scope:teammate_2 = {
						activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
					}
					scope:teammate_3 = {
						activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
					}
				}

				send_interface_toast = {
					title = ep2_tournament_events.1007.a.tt.success
					left_icon = root

					custom_tooltip = ep2_tournament_events.1007.a.result
				}
			}
			2 = { #It refreshes all of you a lot
				desc = ep2_tournament_events.1007.a.tt.bigsuccess
				show_chance = no

				hidden_effect = {
					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

					scope:teammate_1 = {
						activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
					}
					scope:teammate_2 = {
						activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
					}
					scope:teammate_3 = {
						activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
					}
				}

				send_interface_toast = {
					title = ep2_tournament_events.1007.a.tt.bigsuccess
					left_icon = root

					custom_tooltip = ep2_tournament_events.1007.a.bigresult
				}
			}
		}

		stress_impact = {
			base = miniscule_stress_impact_loss
			diligent = miniscule_stress_impact_gain
			gluttonous = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = greedy
					has_trait = avaricious
				}
			}
		}
	}

	# Share some inspiring words
	option = {
		name = ep2_tournament_events.1007.b

		flavor = ep2_tournament_events.1007.b.tt

		duel = {
			skill = diplomacy
			value = decent_skill_rating

			50 = { #You inspire your troops
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				desc = ep2_tournament_events.1007.b.tt.success

				hidden_effect = {
					scope:teammate_1 = {
						activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
					}
					scope:teammate_2 = {
						activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
					}
					scope:teammate_3 = {
						activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
					}
				}

				send_interface_toast = {
					title = ep2_tournament_events.1007.b.tt.success
					left_icon = root

					custom_tooltip = ep2_tournament_events.1007.b.result

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = wit
							value = tournament_hastiludes_xp_gain_minor_value
						}
					}
				}
			}
			50 = { #You fail to make an impact
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				desc = ep2_tournament_events.1007.b.tt.failure

				send_interface_toast = {
					title = ep2_tournament_events.1007.b.tt.failure
					left_icon = root

					add_stress = minor_stress_gain
				}
			}
		}

		stress_impact = {
			shy = medium_stress_impact_gain
			lazy = minor_stress_impact_gain
			greedy = miniscule_stress_impact_loss
			gregarious = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				has_trait = shy
			}
		}
	}

	# Rest alone
	option = {
		name = ep2_tournament_events.1007.c

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

		stress_impact = {
			shy = minor_stress_impact_loss
			lazy = miniscule_stress_impact_loss
			greedy = miniscule_stress_impact_loss
			gregarious = medium_stress_impact_gain
			diligent = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				has_trait = gregarious
			}
		}
	}
}

# You encounter a famous knight in the melee
ep2_tournament_events.1011 = {
	type = activity_event
	title = ep2_tournament_events.1011.t
	desc = {
		desc = ep2_tournament_events.1011.start
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 50
						}
						has_trait_xp = {
							trait = tourney_participant
							track = horse
							value >= 50
						}
					}
				}
				desc = ep2_tournament_events.1011.equal
			}
			triggered_desc = {
				trigger = {
					NOR = {
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 50
						}
						has_trait_xp = {
							trait = tourney_participant
							track = horse
							value >= 50
						}
					}
				}
				desc = ep2_tournament_events.1011.unequal
			}
		}
	}
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:famous_knight
		animation = sword_coup_degrace
	}
	cooldown = { years = 1 }

	trigger = {
		exists = var:progress_to_victory_score
		scope:activity = {
			has_current_phase = tournament_phase_melee
			OR = {
				AND = { # If you're in Team A, they need to be in Team B
					any_guest_subset_current_phase = {
						name = team_alpha
						this = root
					}
					any_guest_subset_current_phase = {
						name = team_beta
						contest_event_general_contestant_valid_trigger = yes
						has_trait = tourney_participant
						is_healthy = yes
						OR = {
							has_trait_xp = {
								trait = tourney_participant
								track = foot
								value >= 50
							}
							has_trait_xp = {
								trait = tourney_participant
								track = horse
								value >= 50
							}
						}
					}
				}
				AND = { # If you're in Team B, they need to be in Team A
					any_guest_subset_current_phase = {
						name = team_beta
						this = root
					}
					any_guest_subset_current_phase = {
						name = team_alpha
						contest_event_general_contestant_valid_trigger = yes
						has_trait = tourney_participant
						is_healthy = yes
						OR = {
							has_trait_xp = {
								trait = tourney_participant
								track = foot
								value >= 50
							}
							has_trait_xp = {
								trait = tourney_participant
								track = horse
								value >= 50
							}
						}
					}
				}
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_horse_neigh"
		tournament_pivotal_flavor_variable_effect = { CONTEST = melee ID = 1011 }
		scope:activity = {
			if = {
				limit = {
					any_guest_subset_current_phase = {
						name = team_alpha
						this = root
					}					
				}
				random_guest_subset_current_phase = {
					name = team_beta
					limit = {
						contest_event_general_contestant_valid_trigger = yes
						has_trait = tourney_participant
						is_healthy = yes
						OR = {
							has_trait_xp = {
								trait = tourney_participant
								track = foot
								value >= 50
							}
							has_trait_xp = {
								trait = tourney_participant
								track = horse
								value >= 50
							}
						}
					}
					save_scope_as = famous_knight
				}
			}
			else = {
				random_guest_subset_current_phase = {
					name = team_alpha
					limit = {
						contest_event_general_contestant_valid_trigger = yes
						has_trait = tourney_participant
						is_healthy = yes
						OR = {
							has_trait_xp = {
								trait = tourney_participant
								track = foot
								value >= 50
							}
							has_trait_xp = {
								trait = tourney_participant
								track = horse
								value >= 50
							}
						}
					}
					save_scope_as = famous_knight
				}
			}
		}
		save_scope_value_as = {
			name = fight_range
			value = {
				integer_range = {
					min = 1
					max = 9
				}
			}
		}
	}

	# Throw dirt to give you an advantage before your duel
	option = {
		name = ep2_tournament_events.1011.a

		flavor = ep2_tournament_events.1011.a.tt

		trigger = {
			OR = {
				intrigue > 20
				has_trait = deceitful
				has_trait = arbitrary
			}
		}

		random_list = {
			75 = { #You win
				modifier = { #This is for fuzzying up the random list so it randomises it a bit
					add = scope:fight_range
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = foot
						value >= 60
					}
					add = 5
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = foot
						value >= 75
					}
					add = 10
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = foot
						value >= 90
					}
					add = 15
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = horse
						value >= 60
					}
					add = 5
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = horse
						value >= 75
					}
					add = 10
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = horse
						value >= 90
					}
					add = 15
				}
				desc = ep2_tournament_events.1011.a.success
				send_interface_toast = {
					title = ep2_tournament_events.1011.a.success
					left_icon = root
					right_icon = scope:famous_knight

					activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

					if = {
						limit = { has_trait = tourney_participant }
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_minor_value
						}
					}
				}
			}
			25 = { #You lose
				modifier = { #This is for fuzzying up the random list so it randomises it a bit
					add = scope:fight_range
				}
				modifier = {
					scope:famous_knight = {
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 60
						}
					}
					add = 5
				}
				modifier = {
					scope:famous_knight = {
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 75
						}
					}
					add = 10
				}
				modifier = {
					scope:famous_knight = {
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 90
						}
					}
					add = 15
				}
				modifier = {
					scope:famous_knight = {
						has_trait_xp = {
							trait = tourney_participant
							track = horse
							value >= 60
						}
					}
					add = 5
				}
				modifier = {
					scope:famous_knight = {
						has_trait_xp = {
							trait = tourney_participant
							track = horse
							value >= 75
						}
					}
					add = 10
				}
				modifier = {
					scope:famous_knight = {
						has_trait_xp = {
							trait = tourney_participant
							track = horse
							value >= 90
						}
					}
					add = 15
				}
				desc = ep2_tournament_events.1011.a.failure
				send_interface_toast = {
					title = ep2_tournament_events.1011.a.failure
					left_icon = root
					right_icon = scope:famous_knight

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_major }
				}
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_dirt_thrown_log
				tags = { good }
				score = 5
				character = root
				target = scope:famous_knight
			}
		}

		stress_impact = {
			craven = minor_stress_impact_loss
			deceitful = minor_stress_impact_loss
			wrathful = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
			brave = minor_stress_impact_gain
			just = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = brave
					has_trait = just
				}
			}
		}
	}

	# Engage them head on
	option = {
		name = ep2_tournament_events.1011.b

		trigger = {
			OR = { #You are skilful in your own right
				has_trait_xp = {
					trait = tourney_participant
					track = foot
					value >= 50
				}
				has_trait_xp = {
					trait = tourney_participant
					track = horse
					value >= 50
				}
			}
		}

		random_list = {
			50 = { #You win
				modifier = { #This is for fuzzying up the random list so it randomises it a bit
					add = scope:fight_range
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = foot
						value >= 60
					}
					add = 5
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = foot
						value >= 75
					}
					add = 10
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = foot
						value >= 90
					}
					add = 15
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = horse
						value >= 60
					}
					add = 5
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = horse
						value >= 75
					}
					add = 10
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = horse
						value >= 90
					}
					add = 15
				}
				desc = ep2_tournament_events.1011.a.success
				send_interface_toast = {
					title = ep2_tournament_events.1011.a.success
					left_icon = root
					right_icon = scope:famous_knight

					if = {
						limit = { has_trait = tourney_participant }
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_medium_value
						}
						add_trait_xp = {
							trait = tourney_participant
							track = horse
							value = tournament_hastiludes_xp_gain_medium_value
						}
					}

					activity_tournament_change_contestant_score_effect = { SCORE = increase_major }
				}
			}
			50 = { #You lose
				modifier = {
					scope:famous_knight = {
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 60
						}
					}
					add = 5
				}
				modifier = {
					scope:famous_knight = {
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 75
						}
					}
					add = 10
				}
				modifier = {
					scope:famous_knight = {
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 90
						}
					}
					add = 15
				}
				modifier = {
					scope:famous_knight = {
						has_trait_xp = {
							trait = tourney_participant
							track = horse
							value >= 60
						}
					}
					add = 5
				}
				modifier = {
					scope:famous_knight = {
						has_trait_xp = {
							trait = tourney_participant
							track = horse
							value >= 75
						}
					}
					add = 10
				}
				modifier = {
					scope:famous_knight = {
						has_trait_xp = {
							trait = tourney_participant
							track = horse
							value >= 90
						}
					}
					add = 15
				}
				desc = ep2_tournament_events.1011.a.failure
				send_interface_toast = {
					title = ep2_tournament_events.1011.a.failure
					left_icon = root
					right_icon = scope:famous_knight

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_major }

					if = {
						limit = { has_trait = tourney_participant }
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_minor_value
						}
						add_trait_xp = {
							trait = tourney_participant
							track = horse
							value = tournament_hastiludes_xp_gain_minor_value
						}
					}
				}
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_dirt_thrown_log
				tags = { good }
				score = 5
				character = root
				target = scope:famous_knight
			}
		}

		stress_impact = {
			craven = medium_stress_impact_gain
			wrathful = miniscule_stress_impact_loss
			brave = minor_stress_impact_loss
			just = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_energy = 0.5
				ai_vengefulness = 0.5
			}
		}
	}

	# Ignore their challenge and slip away
	option = {
		name = ep2_tournament_events.1011.c

		trigger = {
			OR = { #You are skilful in your own right
				has_trait_xp = {
					trait = tourney_participant
					track = foot
					value >= 50
				}
				has_trait_xp = {
					trait = tourney_participant
					track = horse
					value >= 50
				}
			}
		}

		reverse_add_opinion = {
			modifier = disappointed_opinion
			target = scope:famous_knight
			opinion = -30
		}

		stress_impact = {
			brave = major_stress_impact_gain
			ambitious = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain			
			craven = medium_stress_impact_loss
			content = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = ambitious
					has_trait = brave
					has_trait = arrogant
				}
			}
		}
	}

	# Try to fight them
	option = {
		name = ep2_tournament_events.1011.b #Re-use loc from above

		trigger = {
			NOR = {
				has_trait_xp = {
					trait = tourney_participant
					track = foot
					value >= 50
				}
				has_trait_xp = {
					trait = tourney_participant
					track = horse
					value >= 50
				}
			}
		}

		random_list = {
			20 = { #You win
				modifier = { #This is for fuzzying up the random list so it randomises it a bit
					add = scope:fight_range
				}
				modifier = {
					has_trait = physique_good
					add = 5
				}
				modifier = {
					has_trait = strong
					add = 5
				}
				modifier = {
					has_trait = gallant
					add = 5
				}
				modifier = {
					has_trait = lifestyle_blademaster
					add = 10
				}
				custom_tooltip = ep2_tournament_events.1011.a.success
				send_interface_toast = {
					title = ep2_tournament_events.1011.a.success
					left_icon = root
					right_icon = scope:famous_knight

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_medium_value
						}
						add_trait_xp = {
							trait = tourney_participant
							track = horse
							value = tournament_hastiludes_xp_gain_medium_value
						}
					}

					activity_tournament_change_contestant_score_effect = { SCORE = increase_major }
					
					accolade_medium_glory_gain_with_checks_effect = yes
				}
			}
			80 = { #You lose
				modifier = { #This is for fuzzying up the random list so it randomises it a bit
					add = scope:fight_range
				}
				custom_tooltip = ep2_tournament_events.1011.a.failure
				send_interface_toast = {
					title = ep2_tournament_events.1011.a.failure
					left_icon = root
					right_icon = scope:famous_knight

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_major }
					
					scope:famous_knight = {
						accolade_minor_glory_gain_with_checks_effect = yes
					}

					if = {
						limit = { has_trait = tourney_participant }
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_minor_value
						}
						add_trait_xp = {
							trait = tourney_participant
							track = horse
							value = tournament_hastiludes_xp_gain_minor_value
						}
					}
				}
			}
		}

		stress_impact = {
			brave = medium_stress_impact_loss #In face of very unlikely odds!
			ambitious = miniscule_stress_impact_loss
			arrogant = miniscule_stress_impact_loss
			craven = major_stress_impact_gain
			humble = medium_stress_impact_gain
			content = minor_stress_impact_gain
		}

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

	# Try to escape
	option = {
		name = ep2_tournament_events.1011.c #Also re-using this

		trigger = {
			NOR = { #You are skilful in your own right
				has_trait_xp = {
					trait = tourney_participant
					track = foot
					value >= 50
				}
				has_trait_xp = {
					trait = tourney_participant
					track = horse
					value >= 50
				}
			}
		}

		reverse_add_opinion = {
			modifier = disappointed_opinion
			target = scope:famous_knight
			opinion = -30
		}

		duel = {
			skill = intrigue
			target = scope:famous_knight

			50 = { #You escape
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				desc = ep2_tournament_events.1011.d.success

				send_interface_toast = {
					title = ep2_tournament_events.1011.d.success
					left_icon = root
					right_icon = scope:famous_knight

					add_stress = medium_stress_loss
				}
			}
			50 = { #They catch you and smack you about
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				desc = ep2_tournament_events.1011.d.failure

				send_interface_toast = {
					title = ep2_tournament_events.1011.d.failure
					left_icon = root
					right_icon = scope:famous_knight

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_major }
				}
			}
		}

		stress_impact = {
			brave = major_stress_impact_gain
			ambitious = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain			
			craven = medium_stress_impact_loss
			content = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = brave
					has_trait = ambitious
					has_trait = arrogant
				}
			}
		}
	}
}

# You attempt to ambush an opponent in the trees
ep2_tournament_events.1012 = {
	type = activity_event
	title = ep2_tournament_events.1012.t
	desc = ep2_tournament_events.1012.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = scheme
	}
	right_portrait = {
		character = scope:caught_opponent
		animation = shock
	}
	cooldown = { years = 5 }

	trigger = {
		scope:activity = {
			any_guest_subset_current_phase = {
				name = qualified
				this = root
			}
			any_guest_subset_current_phase = {
				name = qualified
				contest_event_general_contestant_valid_trigger = yes
			}
		}
		scope:activity.activity_location = { #Ensure it's in a place where there could feasibly be some trees
			NOR = {
				terrain = desert
				terrain = desert_mountains
				terrain = drylands
				terrain = floodplains
				terrain = mountains
				terrain = oasis
				terrain = steppe
				terrain = wetlands
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_wood_woosh"
		tournament_pivotal_flavor_variable_effect = { CONTEST = melee ID = 1012 }
		scope:activity = {
			if = { # If you're in Team A, grab opponent
				limit = {
					any_guest_subset_current_phase = {
						name = team_alpha
						this = root
					}
				}
				random_guest_subset_current_phase = {
					name = team_beta
					limit = { contest_event_general_contestant_valid_trigger = yes }
					save_scope_as = caught_opponent
				}
			}
			else = { # If you're in team B, grab that opponent
				random_guest_subset_current_phase = {
					name = team_alpha
					limit = {
						contest_event_general_contestant_valid_trigger = yes
					}
					save_scope_as = caught_opponent
				}
			}
		}
	}

	# You, a forest fighter, take huge advantage
	option = {
		name = ep2_tournament_events.1012.a

		trigger = {
			OR = {
				has_trait = forest_fighter
				has_trait = jungle_stalker
			}
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

		scope:caught_opponent = {
			pay_short_term_gold = {
				target = root
				gold = {
					value = root.medium_gold_value
					max = scope:caught_opponent.gold
				}
			}
		}

		if = {
			limit = { has_trait = tourney_participant }
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_minor_value
			}
			add_trait_xp = {
				trait = tourney_participant
				track = horse
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_ambush_sprung_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

		stress_impact = {
			brave = miniscule_stress_impact_loss
			ambitious = miniscule_stress_impact_loss
			deceitful = miniscule_stress_impact_loss
			craven = medium_stress_impact_gain
			content = minor_stress_impact_gain
			honest = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = -1
				ai_vengefulness = 1
			}
		}
	}

	# You are an honorable knight, and offer them fair duel
	option = {
		name = ep2_tournament_events.1012.b

		trigger = {
			OR = {
				has_trait = gallant
				has_trait = just
			}
		}

		duel = {
			skill = prowess
			target = scope:caught_opponent

			50 = { #You win
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = foot
						value >= 20
					}
					add = 5
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = foot
						value >= 40
					}
					add = 10
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = foot
						value >= 60
					}
					add = 15
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = foot
						value >= 80
					}
					add = 20
				}
				desc = ep2_tournament_events.1012.b.success
				send_interface_toast = {
					title = ep2_tournament_events.1012.b.success
					left_icon = root
					right_icon = scope:caught_opponent

					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
					
					accolade_minor_glory_gain_with_checks_effect = yes

					if = {
						limit = { has_trait = tourney_participant }
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_medium_value
						}
						add_trait_xp = {
							trait = tourney_participant
							track = horse
							value = tournament_hastiludes_xp_gain_medium_value
						}
					}
				}
			}
			50 = { #You lose
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				modifier = {
					scope:caught_opponent = {
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 20
						}
					}
					add = 5
				}
				modifier = {
					scope:caught_opponent = {
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 40
						}
					}
					add = 10
				}
				modifier = {
					scope:caught_opponent = {
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 60
						}
					}
					add = 15
				}
				modifier = {
					scope:caught_opponent = {
						has_trait_xp = {
							trait = tourney_participant
							track = horse
							value >= 80
						}
					}
					add = 20
				}
				desc = ep2_tournament_events.1012.b.failure
				send_interface_toast = {
					title = ep2_tournament_events.1012.b.failure
					left_icon = root
					right_icon = scope:caught_opponent

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
					
					scope:caught_opponent = {
						accolade_minor_glory_gain_with_checks_effect = yes
					}
				}
			}
		}

		reverse_add_opinion = {
			modifier = respect_opinion
			target = scope:caught_opponent
			opinion = 25
		}

		stress_impact = {
			brave = miniscule_stress_impact_loss
			ambitious = miniscule_stress_impact_loss
			deceitful = miniscule_stress_impact_loss
			craven = medium_stress_impact_gain
			content = minor_stress_impact_gain
			honest = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 1
				ai_honor = 1
				ai_boldness = 1
			}
		}
	}

	# You attempt an ambush
	option = {
		name = ep2_tournament_events.1012.c

		trigger = {
			NOR = {
				has_trait = forest_fighter
				has_trait = jungle_stalker
			}
		}

		duel = {
			skills = { martial intrigue }
			target = scope:caught_opponent

			60 = { #It works
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				modifier = {
					has_trait = deceitful #Happy to do it!
					add = 5
				}
				modifier = {
					has_trait = patient #Wait for the right time to strike
					add = 5
				}
				modifier = {
					has_trait = lifestyle_hunter
					add = 5
				}
				modifier = {
					has_trait = lifestyle_blademaster
					add = 5
				}
				modifier = {
					has_trait = strategist
					add = 5
				}
				custom_tooltip = ep2_tournament_events.1012.c.success
				scope:activity = {
					add_activity_log_entry = {
						key = tournament_ambush_sprung_log
						tags = { good }
						score = 5
						character = root
						target = scope:caught_opponent
					}
				}
				send_interface_toast = {
					title = ep2_tournament_events.1012.c.success
					left_icon = root
					right_icon = scope:caught_opponent

					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

					scope:caught_opponent = {
						pay_short_term_gold = {
							target = root
							gold = {
								value = root.minor_gold_value
								max = scope:caught_opponent.gold
							}
						}
					}

					if = {
						limit = { has_trait = tourney_participant }
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_minor_value
						}
						add_trait_xp = {
							trait = tourney_participant
							track = horse
							value = tournament_hastiludes_xp_gain_minor_value
						}
					}
				}
			}
			40 = { #It doesn't work
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				modifier = {
					has_trait = impatient
					add = 5
				}
				modifier = {
					scope:caught_opponent = {
						has_trait = strategist
					}
					add = 5
				}
				modifier = {
					scope:caught_opponent = {
						has_trait = paranoid #Always watching out of the corner of their eye
					}
					add = 5
				}
				custom_tooltip = ep2_tournament_events.1012.c.failure
				send_interface_toast = {
					title = ep2_tournament_events.1012.c.failure
					left_icon = root
					right_icon = scope:caught_opponent

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

					pay_short_term_gold = {
						target = scope:caught_opponent
						gold = {
							value = root.minor_gold_value
							max = root.gold
						}
					}
				}
			}
		}

		stress_impact = {
			brave = miniscule_stress_impact_loss
			ambitious = miniscule_stress_impact_loss
			deceitful = miniscule_stress_impact_loss
			craven = medium_stress_impact_gain
			content = minor_stress_impact_gain
			honest = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = -1
				ai_vengefulness = 1
			}
		}
	}

	# You let them go
	option = {
		name = ep2_tournament_events.1012.d

		stress_impact = {
			brave = medium_stress_impact_gain
			ambitious = medium_stress_impact_gain
			deceitful = medium_stress_impact_gain
			craven = miniscule_stress_impact_loss
			content = miniscule_stress_impact_loss
			honest = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = -1
			}
		}
	}
}

# An opponent has fallen from their horse
ep2_tournament_events.1013 = {
	type = activity_event
	title = ep2_tournament_events.1013.t
	desc = ep2_tournament_events.1013.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = jockey_lance_couched_gallop
	}
	right_portrait = {
		character = scope:felled_participant
		animation = pain
	}
	cooldown = { years = 1 }

	trigger = {
		scope:activity = { #Ensure each team has at least one participant
			any_guest_subset_current_phase = {
				name = qualified
				this = root
			}
			any_guest_subset_current_phase = {
				name = team_alpha
				contest_event_general_contestant_valid_trigger = yes
				is_healthy = yes
			}
			any_guest_subset_current_phase = {
				name = team_beta
				contest_event_general_contestant_valid_trigger = yes
				is_healthy = yes
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_horse_neigh"
		tournament_pivotal_flavor_variable_effect = { CONTEST = melee ID = 1013 }
		scope:activity = {
			if = { #Ensure it picks an opponent
				limit = {
					any_guest_subset_current_phase = {
						name = team_alpha
						this = root
					}					
				}
				random_guest_subset_current_phase = {
					name = team_beta
					limit = {
						contest_event_general_contestant_valid_trigger = yes
						is_healthy = yes
					}
					save_scope_as = felled_participant
				}
			}
			else = {
				random_guest_subset_current_phase = {
					name = team_alpha
					limit = {
						contest_event_general_contestant_valid_trigger = yes
						is_healthy = yes
					}
					save_scope_as = felled_participant
				}
			}
		}

		scope:felled_participant = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }
		}
	}

	# You escort them out of the fray
	option = {
		name = ep2_tournament_events.1013.a

		trigger = {
			OR = {
				has_trait = gallant
				has_trait = just
			}
		}

		scope:felled_participant = {
			activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

			add_opinion = {
				modifier = grateful_opinion
				target = root
				opinion = 25
			}
		}

		set_nickname_effect = { #To give you something roleplay-ish
			NICKNAME = nick_the_honorable
		}

		stress_impact = {
			base = minor_stress_impact_loss
			compassionate = miniscule_stress_impact_loss
			arbitrary = minor_stress_impact_gain
			callous = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 1
				ai_honor = 1
			}
		}
	}

	# You run them over
	option = {
		name = ep2_tournament_events.1013.b

		activity_tournament_change_contestant_score_effect = { SCORE = increase_miniscule }

		scope:felled_participant = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

			increase_wounds_no_death_effect = { REASON = battle }

			random = {
				chance = 33
				if = {
					limit = {
						NOT = {
							has_trait = scarred
						}
					}
					add_trait = scarred
				}
				add_trait_xp = {
					trait = scarred
					value = {
						integer_range = {
							min = 5
							max = 25
						}
					}
				}
			}

			add_opinion = {
				modifier = angry_opinion
				target = root
				opinion = -25
			}
		}

		stress_impact = {
			brave = minor_stress_impact_gain
			just = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			sadistic = miniscule_stress_impact_loss
			craven = miniscule_stress_impact_loss
			arbitrary = minor_stress_impact_loss
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_honor = -1
				ai_compassion = -1
			}
		}
	}

	# You dismount to offer them fair duel
	option = {
		name = ep2_tournament_events.1013.c

		duel = {
			skills = { prowess martial }
			target = scope:felled_participant

			50 = { #You win
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = foot
						value >= 25
					}
					add = 10
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = foot
						value >= 50
					}
					add = 20
				}
				modifier = {
					has_trait_xp = {
						trait = tourney_participant
						track = foot
						value >= 75
					}
					add = 30
				}
				desc = ep2_tournament_events.1013.c.success
				send_interface_toast = {
					title = ep2_tournament_events.1013.c.success
					left_icon = root
					right_icon = scope:felled_participant

					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

					scope:felled_participant = {
						activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
					}

					if = {
						limit = { has_trait = tourney_participant }
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_minor_value
						}
						add_trait_xp = {
							trait = tourney_participant
							track = horse
							value = tournament_hastiludes_xp_gain_minor_value
						}
					}
				}
			}
			50 = { #You lose
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				modifier = {
					scope:felled_participant = {
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 25
						}
					}
					add = 10
				}
				modifier = {
					scope:felled_participant = {
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 50
						}
					}
					add = 20
				}
				modifier = {
					scope:felled_participant = {
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value >= 75
						}
					}
					add = 30
				}
				desc = ep2_tournament_events.1013.c.failure
				send_interface_toast = {
					title = ep2_tournament_events.1013.c.failure
					left_icon = root
					right_icon = scope:felled_participant

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

					scope:felled_participant = {
						activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
					}
				}
			}
		}

		stress_impact = {
			brave = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
			craven = minor_stress_impact_gain
			arbitrary = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_honor = 1
				ai_boldness = 1
			}
		}
	}

	# You let them go
	option = {
		name = ep2_tournament_events.1013.d

		stress_impact = {
			brave = miniscule_stress_impact_gain
			sadistic = minor_stress_impact_gain
			craven = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_honor = 0.5
				ai_boldness = -0.5
			}
		}
	}
}

# A mysterious knight is doing incredibly well
ep2_tournament_events.1015 = {
	type = activity_event
	title = ep2_tournament_events.1015.t
	desc = ep2_tournament_events.1015.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = shock
	}
	cooldown = { years = 5 }

	trigger = {
		scope:activity = {
			OR = {
				AND = {
					any_guest_subset_current_phase = {
						name = team_alpha
						this = root
					}
					any_guest_subset_current_phase = {
						name = team_alpha
						contest_event_general_contestant_valid_trigger = yes		
						OR = { #Ensure it's someone meaningful to you
							is_close_family_or_spouse_of_root_trigger = yes
							has_relation_lover = root
							has_relation_soulmate = root
							has_character_modifier = ignores_gender_army_rules #In case Mulan ends up really good!
						}
					}
				}
				AND = {
					any_guest_subset_current_phase = {
						name = team_beta
						this = root
					}
					any_guest_subset_current_phase = {
						name = team_beta
						contest_event_general_contestant_valid_trigger = yes		
						OR = { #Ensure it's someone meaningful to you
							is_close_family_or_spouse_of_root_trigger = yes
							has_relation_lover = root
							has_relation_soulmate = root
							has_character_modifier = ignores_gender_army_rules #In case Mulan ends up really good!
						}
					}
				}
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_metal_clash"
		tournament_pivotal_flavor_variable_effect = { CONTEST = melee ID = 1015 }
		scope:activity = {
			if = { #Ensure it picks a member of your team
				limit = {
					any_guest_subset_current_phase = {
						name = team_alpha
						this = root
					}					
				}
				random_guest_subset_current_phase = {
					name = team_alpha
					limit = {
						contest_event_general_contestant_valid_trigger = yes
						OR = {
							is_close_family_or_spouse_of_root_trigger = yes
							has_relation_soulmate = root
							has_relation_lover = root
							has_character_modifier = ignores_gender_army_rules
						}
					}
					save_scope_as = mysterious_knight
				}
			}
			else = {
				random_guest_subset_current_phase = {
					name = team_beta
					limit = {
						contest_event_general_contestant_valid_trigger = yes
						OR = {
							is_close_family_or_spouse_of_root_trigger = yes
							has_relation_soulmate = root
							has_relation_lover = root
							has_character_modifier = ignores_gender_army_rules
						}
					}
					save_scope_as = mysterious_knight
				}
			}
		}

		hidden_effect = {
			scope:mysterious_knight = {
				activity_tournament_change_contestant_score_effect = { SCORE = increase_major }
			}
		}

		save_scope_value_as = { #For the chase scene number fuzzying
			name = chase_range
			value = {
				integer_range = {
					min = 1
					max = 9
				}
			}
		}
	}

	# Follow along behind them to clean up in their wake
	option = {
		name = ep2_tournament_events.1015.a

		trigger = {
			intrigue >= 15
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

		add_gold = { minor_gold_value medium_gold_value }

		if = {
			limit = { has_trait = tourney_participant }
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_minor_value
			}
			add_trait_xp = {
				trait = tourney_participant
				track = horse
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}

		stress_impact = {
			ambitious = miniscule_stress_impact_loss
			deceitful = miniscule_stress_impact_loss
			craven = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
			brave = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = -1
				ai_honor = -1
				ai_compassion = -1
			}
		}
	}

	# You must know who it is! Chase after them!
	option = {
		name = ep2_tournament_events.1015.b

		random_list = {
			50 = { #You catch them
				modifier = { #This is for fuzzying up the random list so it randomises it a bit
					add = scope:chase_range
				}
				modifier = {
					has_trait = athletic
					add = 10
				}
				modifier = {
					has_trait = stubborn
					add = 5
				}
				desc = ep2_tournament_events.1015.b.success
				custom_tooltip = ep2_tournament_events.1015.b.success.tt

				trigger_event = ep2_tournament_events.1016
			}
			50 = { #They get away
				modifier = { #This is for fuzzying up the random list so it randomises it a bit
					add = scope:chase_range
				}
				modifier = {
					OR = {
						has_trait = wheezing
						has_trait = spindly
					}
					add = 10
				}
				modifier = {
					OR = {
						has_trait = clubfooted
						has_trait = dwarf
					}
					add = 10
				}
				modifier = {
					current_weight > 80
					add = 5
				}
				modifier = {
					scope:mysterious_knight = {
						has_trait = athletic
					}
					add = 10
				}
				desc = ep2_tournament_events.1015.b.failure
				send_interface_toast = {
					title = ep2_tournament_events.1015.b.failure
					left_icon = root
					right_icon = scope:caught_opponent

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_miniscule }
				}
			}
		}

		stress_impact = {
			diligent = miniscule_stress_impact_loss
			stubborn = miniscule_stress_impact_loss
			lazy = medium_stress_impact_gain
			fickle = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 1
			}
		}
	}

	# You let them go
	option = {
		name = ep2_tournament_events.1015.c

		stress_impact = {
			diligent = minor_stress_impact_gain
			stubborn = medium_stress_impact_gain
			lazy = miniscule_stress_impact_loss
			fickle = miniscule_stress_impact_loss
		}

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

# Followup to 1015: it's your (notable person!)
ep2_tournament_events.1016 = {
	type = activity_event
	title = ep2_tournament_events.1016.t
	desc = {
		desc = ep2_tournament_events.1016.start
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = knows_mulan_flag
					scope:mysterious_knight = {
						has_character_modifier = ignores_gender_army_rules
					}
				}
				desc = ep2_tournament_events.1016.mulan
			}
			triggered_desc = {
				trigger = {
					NOT = {
						has_character_flag = knows_mulan_flag
					}
					scope:mysterious_knight = {
						has_character_modifier = ignores_gender_army_rules
					}
				}
				desc = ep2_tournament_events.1016.mulanunknown
			}
			triggered_desc = {
				trigger = {
					scope:mysterious_knight = {
						OR = { #Catchall for relations
							is_close_family_or_spouse_of_root_trigger = yes
							has_relation_lover = root
							has_relation_soulmate = root
						}
					}
				}
				desc = ep2_tournament_events.1016.relation
			}
		}
	}
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:mysterious_knight
		animation = marshal
	}
	cooldown = { years = 5 }

	immediate = {
		hidden_effect = {
			if = {
				limit = {
					scope:mysterious_knight = {
						NOT = {
							has_trait = tourney_participant
						}
					}
				}
				add_trait = tourney_participant
			}

			if = { #Give them a stealthy big boost, so in-universe they don't look weird
				limit = {
					scope:mysterious_knight = {
						has_trait = tourney_participant
					}
				}
				scope:mysterious_knight = {
					add_trait_xp = {
						trait = tourney_participant
						track = foot
						value = tournament_hastiludes_xp_gain_major_value
					}
					add_trait_xp = {
						trait = tourney_participant
						track = horse
						value = tournament_hastiludes_xp_gain_major_value
					}
				}
			}
			else = {
				scope:mysterious_knight = {
					add_trait = tourney_participant

					add_trait_xp = {
						trait = tourney_participant
						track = foot
						value = tournament_hastiludes_xp_gain_major_value
					}
					add_trait_xp = {
						trait = tourney_participant
						track = horse
						value = tournament_hastiludes_xp_gain_major_value
					}
				}
			}
		}
		save_scope_value_as = { #For the chase scene number fuzzying
			name = ability_range
			value = {
				integer_range = {
					min = 1
					max = 9
				}
			}
		}
	}

	# Protect me!
	option = {
		name = ep2_tournament_events.1016.a

		add_character_modifier = { #Add a powerful but temporary modifier
			modifier = tournament_melee_protector_modifier
			years = 1
		}

		stress_impact = {
			ambitious = miniscule_stress_impact_loss
			paranoid = miniscule_stress_impact_loss
			craven = miniscule_stress_impact_loss
			humble = miniscule_stress_impact_loss
			brave = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = -0.5
				ai_rationality = 1
			}
		}
	}

	# You must teach me!
	option = {
		name = ep2_tournament_events.1016.b

		flavor = ep2_tournament_events.1016.b.tt

		random_list = {
			20 = { #You learn a lot
				modifier = { #This is for fuzzying up the random list so it randomises it a bit
					add = scope:ability_range
				}
				modifier = {
					learning > 10
					add = 10
				}
				modifier = {
					has_trait = shrewd
					add = 5
				}
				modifier = {
					has_trait = lifestyle_blademaster
					add = 5
				}
				desc = ep2_tournament_events.1016.b.success

				send_interface_toast = {
					title = ep2_tournament_events.1016.b.success
					left_icon = root
					right_icon = scope:mysterious_knight

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_major_value
						}
						add_trait_xp = {
							trait = tourney_participant
							track = horse
							value = tournament_hastiludes_xp_gain_major_value
						}
					}
					else = {
						add_trait = tourney_participant

						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_major_value
						}
						add_trait_xp = {
							trait = tourney_participant
							track = horse
							value = tournament_hastiludes_xp_gain_major_value
						}
					}
				}
			}
			80 = { #You learn a little
				modifier = { #This is for fuzzying up the random list so it randomises it a bit
					add = scope:ability_range
				}
				desc = ep2_tournament_events.1016.b.failure

				send_interface_toast = {
					title = ep2_tournament_events.1016.b.failure
					left_icon = root
					right_icon = scope:mysterious_knight

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_minor_value
						}
						add_trait_xp = {
							trait = tourney_participant
							track = horse
							value = tournament_hastiludes_xp_gain_minor_value
						}
					}
					else = {
						add_trait = tourney_participant

						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_minor_value
						}
						add_trait_xp = {
							trait = tourney_participant
							track = horse
							value = tournament_hastiludes_xp_gain_minor_value
						}
					}
				}
			}
		}

		stress_impact = {
			humble = miniscule_stress_impact_loss
			diligent = miniscule_stress_impact_loss
			arrogant = medium_stress_impact_gain
			lazy = minor_stress_impact_gain
		}

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

	# I forbid this!
	option = {
		name = ep2_tournament_events.1016.c

		if = { #If you are their liege, demand they resign
			limit = {
				scope:mysterious_knight.liege = root
			}
			scope:mysterious_knight = {	
				if = {
					limit = { exists = var:progress_to_victory }
					remove_variable = progress_to_victory
				}
				if = {
					limit = { exists = var:progress_to_victory_score }
					remove_variable = progress_to_victory_score
				}
				if = {
					limit = { exists = var:contest_aptitude }
					remove_variable = contest_aptitude
				}
			}
		}

		reverse_add_opinion = {
			modifier = disappointed_opinion
			target = scope:mysterious_knight
			opinion = -25
		}

		stress_impact = {
			humble = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
			fickle = medium_stress_impact_gain
			callous = miniscule_stress_impact_loss
			stubborn = miniscule_stress_impact_loss
			arrogant = miniscule_stress_impact_loss
		}

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

# Cornered by three opposing knights
ep2_tournament_events.1017 = {
	type = activity_event
	title = ep2_tournament_events.1017.t
	desc = ep2_tournament_events.1017.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = pain
	}
	right_portrait = {
		character = scope:knight_1
		animation = sword_coup_degrace
	}
	lower_right_portrait = {
		character = scope:knight_2
	}
	lower_left_portrait = {
		character = scope:knight_3
	}
	cooldown = { years = 5 }

	trigger = {
		scope:activity = {
			OR = {
				AND = {
					any_guest_subset_current_phase = {
						name = team_alpha
						this = root
					}
					any_guest_subset_current_phase = {
						name = team_alpha
						contest_event_general_contestant_valid_trigger = yes
						this != root
					}
				}
				AND = {
					any_guest_subset_current_phase = {
						name = team_beta
						this = root
					}
					any_guest_subset_current_phase = {
						name = team_beta
						contest_event_general_contestant_valid_trigger = yes
						this != root	
					}
				}
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_metal_woosh"
		tournament_pivotal_flavor_variable_effect = { CONTEST = melee ID = 1017 }
		scope:activity = {
			if = { # If you're in Team A, grab opponents in B
				limit = {
					any_guest_subset_current_phase = {
						name = team_alpha
						this = root
					}
				}
				random_guest_subset_current_phase = {
					name = team_beta
					limit = { contest_event_general_contestant_valid_trigger = yes }
					save_scope_as = knight_1
				}
				random_guest_subset_current_phase = {
					name = team_beta
					limit = { 
						contest_event_general_contestant_valid_trigger = yes 
						this != scope:knight_1
					}
					save_scope_as = knight_2
				}
				random_guest_subset_current_phase = {
					name = team_beta
					limit = { 
						contest_event_general_contestant_valid_trigger = yes 
						NOR = {
							this = scope:knight_1
							this = scope:knight_2
						}
					}
					save_scope_as = knight_3
				}
			}
			else = { # If you're in team B, grab opponents in A
				random_guest_subset_current_phase = {
					name = team_alpha
					limit = {
						contest_event_general_contestant_valid_trigger = yes
					}
					save_scope_as = knight_1
				}
				random_guest_subset_current_phase = {
					name = team_alpha
					limit = {
						contest_event_general_contestant_valid_trigger = yes
						this != scope:knight_1
					}
					save_scope_as = knight_2
				}
				random_guest_subset_current_phase = {
					name = team_alpha
					limit = {
						contest_event_general_contestant_valid_trigger = yes
						NOR = {
							this = scope:knight_1
							this = scope:knight_2
						}
					}
					save_scope_as = knight_3
				}
			}
		}

		save_scope_value_as = { #Combine the knights' prowess
			name = knight_prowess
			value = {
				add = scope:knight_1.prowess
				add = scope:knight_3.prowess
				add = scope:knight_3.prowess
			}
		}

		save_scope_value_as = { #Simulate your backups' combined prowess
			name = prowess_range
			value = {
				integer_range = {
					min = 10
					max = 35
				}
			}
		}
	}

	# Take them all on!
	option = {
		name = ep2_tournament_events.1017.a

		duel = {
			skill = prowess
			value = scope:knight_prowess

			# Success
			50 = {
				desc = ep2_tournament_events.1017.a.success
				show_chance = yes

				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}

				send_interface_toast = {
					title = ep2_tournament_events.1017.a.success
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = increase_massive }

					add_prestige = 250

					if = {
						limit = { has_trait = tourney_participant }
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_medium_value
						}
						add_trait_xp = {
							trait = tourney_participant
							track = horse
							value = tournament_hastiludes_xp_gain_medium_value
						}
					}
				}
			}
			# Failure
			50 = {
				desc = ep2_tournament_events.1017.a.failure
				show_chance = yes

				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}

				send_interface_toast = {
					title = ep2_tournament_events.1017.a.failure
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

					increase_wounds_effect = { REASON = battle }
				}
			}
		}

		stress_impact = {
			ambitious = minor_stress_impact_loss
			brave = minor_stress_impact_loss
			stubborn = miniscule_stress_impact_loss
			content = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			fickle = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = 0.5
			}
		}
	}

	# Call for backup
	option = {
		name = ep2_tournament_events.1017.b

		duel = {
			skills = { prowess martial }
			value = decent_skill_rating

			# Success
			50 = {
				desc = ep2_tournament_events.1017.b.success
				show_chance = yes

				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.1017.b.success
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

					if = {
						limit = { has_trait = tourney_participant }
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_minor_value
						}
						add_trait_xp = {
							trait = tourney_participant
							track = horse
							value = tournament_hastiludes_xp_gain_minor_value
						}
					}
				}
			}
			# Failure
			50 = {
				desc = ep2_tournament_events.1017.b.failure
				show_chance = yes

				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.1017.b.failure
					left_icon = root
					
					add_stress = minor_stress_gain
				}
			}
		}

		stress_impact = {
			ambitious = minor_stress_impact_gain
			brave = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
			content = miniscule_stress_impact_loss
			craven = miniscule_stress_impact_loss
			fickle = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = -1
				ai_honor = -0.5
			}
		}
	}
}

scripted_trigger contest_house_united_trigger = {
	contest_event_general_contestant_valid_trigger = yes
	this != root
	exists = house
	house ?= {
		this = root.house
		any_house_member = { is_alive = yes }
	}
}

# You save a house member
ep2_tournament_events.1018 = {
	type = activity_event
	title = ep2_tournament_events.1018.t
	desc = ep2_tournament_events.1018.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = jockey_gallop
	}
	right_portrait = {
		character = scope:family
		animation = admiration
	}
	cooldown = { years = 5 }

	trigger = {
		exists = house
		scope:activity = {
			OR = {
				AND = {
					any_guest_subset_current_phase = {
						name = team_alpha
						this = root
					}
					any_guest_subset_current_phase = {
						name = team_alpha
						contest_house_united_trigger = yes
					}
				}
				AND = {
					any_guest_subset_current_phase = {
						name = team_beta
						this = root
					}
					any_guest_subset_current_phase = {
						name = team_beta
						contest_house_united_trigger = yes
					}
				}
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_horse_flyby"
		scope:activity = {
			if = { # If you're in Team A, grab teammate
				limit = {
					any_guest_subset_current_phase = {
						name = team_alpha
						this = root
					}
				}
				random_guest_subset_current_phase = {
					name = team_alpha
					limit = { contest_house_united_trigger = yes }
					save_scope_as = family
				}
			}
			else = { # If you're in Team B, grab teammate
				random_guest_subset_current_phase = {
					name = team_beta
					limit = { contest_house_united_trigger = yes }
					save_scope_as = family
				}
			}
		}

		if = {
			limit = { has_trait = tourney_participant }
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_minor_value
			}
			add_trait_xp = {
				trait = tourney_participant
				track = horse
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_ambush_sprung_log
				tags = { good }
				score = 5
				character = root
				target = scope:family
			}
		}
	}

	# House unity!
	option = {
		name = ep2_tournament_events.1018.a

		if = {
			limit = {
				house = {
					NOT = { 
						has_house_modifier = tournament_house_unity_modifier
					}
				}
			}
			house = {
				add_house_modifier = {
					modifier = tournament_house_unity_modifier
					years = 15
					desc = tournament_house_unity_modifier_desc
				}			
			}
		}
		else = {
			add_prestige = medium_prestige_value
		}

		reverse_add_opinion = {
			target = scope:family
			opinion = 15
			modifier = respect_opinion
		}

		stress_impact = {
			ambitious = miniscule_stress_impact_loss
			shy = miniscule_stress_impact_loss
			content = minor_stress_impact_gain
			callous = minor_stress_impact_gain
		}

		ai_chance = {
			base = 25 #Deliberately low to keep the else from occurring too much for AI
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_honor = 0.5
			}
		}
	}

	# Love u fam
	option = {
		name = ep2_tournament_events.1018.b

		if = {
			limit = {
				NOT = { #Ensure that you're not AI, to avoid massive proliferation of the Loyal trait
					is_ai = yes
				}
				scope:family = {
					is_ai = yes
					NOR = {
						has_trait = disloyal
						has_trait = loyal
					}
				}
			}
			scope:family = {
				add_trait = loyal
			}
		}		

		if = {
			limit = {
				can_add_hook = {
					type = loyalty_hook
					target = scope:family
				}
			}
			add_hook = {
				type = loyalty_hook
				target = scope:family
			}
		}

		reverse_add_opinion = {
			target = scope:family
			opinion = 15
			modifier = loyalty_opinion
		}

		stress_impact = {
			gregarious = miniscule_stress_impact_loss
			compassionate = miniscule_stress_impact_loss
			callous = miniscule_stress_impact_loss
			sadistic = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = 1
			}
		}
	}
}

###################
###   ARCHERY   ###
###################

# Attempt to put off an opponent by coughing
ep2_tournament_events.1501 = {
	type = activity_event
	title = ep2_tournament_events.1501.t
	desc = {
		desc = ep2_tournament_events.1501.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:competitor = {
						has_any_secrets = yes
					}
					intrigue > 10
				}
				desc = ep2_tournament_events.1501.secret
			}
		}
	}
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		scripted_animation = bow_closed
	}
	right_portrait = {
		character = scope:competitor
		scripted_animation = bow_drawn
	}
	cooldown = { years = 1 }

	trigger = {
		scope:activity = {
			any_guest_subset_current_phase = {
				name = qualified
				is_alive = yes
				is_ai = yes # To ensure we don't reveal player secrets
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_arrow_flyby"
		tournament_pivotal_flavor_variable_effect = { CONTEST = archery ID = 1501 }
		scope:activity = {
			random_guest_subset_current_phase = {
				name = qualified
				limit = { 
					is_alive = yes 
					is_ai = yes # To ensure we don't reveal player secrets
				}
				save_scope_as = competitor
			}
		}

		if = {
			limit = {
				scope:competitor = {
					any_secret = {
						OR = {
							secret_type = secret_deviant
							secret_type = secret_witch
							secret_type = secret_murder
							secret_type = secret_disputed_heritage
							secret_type = secret_non_believer
							secret_type = secret_cannibal
						}
					}
				}
			}
			scope:competitor = {
				random_secret = {
					limit = {
						OR = {
							secret_type = secret_deviant
							secret_type = secret_witch
							secret_type = secret_murder
							secret_type = secret_disputed_heritage
							secret_type = secret_non_believer
							secret_type = secret_cannibal
						}
					}
					save_scope_as = competitor_secret
				}
			}
		}
	}

	# Spread a rumour amongst the crowd
	option = {
		name = ep2_tournament_events.1501.a

		trigger = {
			exists = scope:competitor_secret

			intrigue > 10 # Ensure you have decent enough intrigue to do this
		}

		flavor = ep2_tournament_events.1501.a.tt

		scope:competitor_secret = {
			expose_secret = root
		}

		scope:competitor = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_archery_rumour_log
				tags = { good }
				score = 5
				character = root
				target = scope:competitor
			}
		}

		stress_impact = {
			deceitful = minor_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
			vengeful = miniscule_stress_impact_loss
			just = medium_stress_impact_gain
			honest = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = just
					has_trait = honest
					has_trait = forgiving
				}
			}
		}
	}

	# Cough loudly
	option = {
		name = ep2_tournament_events.1501.b

		flavor = ep2_tournament_events.1501.b.tt

		add_prestige = -25

		scope:competitor = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_archery_cough_log
				tags = { good }
				score = 5
				character = root
				target = scope:competitor
			}
		}

		stress_impact = {
			arbitrary = miniscule_stress_impact_loss
			deceitful = miniscule_stress_impact_loss
			just = medium_stress_impact_gain
			honest = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_boldness = 1
				ai_vengefulness = 1
			}
		}
	}

	# Stay silent
	option = {
		name = ep2_tournament_events.1501.c

		scope:competitor = {
			activity_tournament_change_contestant_score_effect = { SCORE = increase_miniscule }
		}

		stress_impact = {
			deceitful = medium_stress_impact_gain
			arbitrary = medium_stress_impact_gain
			vengeful = medium_stress_impact_gain
			just = miniscule_stress_impact_loss
			honest = miniscule_stress_impact_loss
			forgiving = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_boldness = -1
				ai_vengefulness = -1
			}
		}
	}
}

# It's a bit windy as you step up to shoot!
ep2_tournament_events.1502 = {
	type = activity_event
	title = ep2_tournament_events.1502.t
	desc = ep2_tournament_events.1502.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		scripted_animation = bow_closed
	}
	cooldown = { years = 1 }

	trigger = {
		is_in_guest_subset = { name = qualified }
		scope:activity = {
			any_guest_subset_current_phase = { #random qualified participant
				name = qualified
				contest_event_general_contestant_valid_trigger = yes
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_arrow_flyby"
		tournament_pivotal_flavor_variable_effect = { CONTEST = archery ID = 1502 }
		scope:activity = {
			random_guest_subset_current_phase = {
				name = qualified
				limit = { contest_event_general_contestant_valid_trigger = yes }
				save_scope_as = contestant
			}
		}
	}

	# Take the shot anyway, because you're an experienced marksman
	option = {
		name = ep2_tournament_events.1502.a

		trigger = {
			OR = { #Make sure you're good at shooting a bow!
				AND = {
					has_trait = lifestyle_hunter
					has_trait_xp = {
						trait = lifestyle_hunter
						track = hunter
						value >= 50
					}
				}
				AND = {
					has_trait = tourney_participant
					has_trait_xp = {
						trait = tourney_participant
						track = bow
						value >= 50
					}
				}
			}
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

		add_prestige = medium_prestige_gain

		if = {
			limit = { has_trait = tourney_participant }
			add_trait_xp = {
				trait = tourney_participant
				track = bow
				value = tournament_hastiludes_xp_gain_major_value
			}
		}

		stress_impact = {
			base = miniscule_stress_impact_loss
			ambitious = miniscule_stress_impact_loss
			diligent = miniscule_stress_impact_loss
			arrogant = miniscule_stress_impact_loss
			content = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_honor = 1
			}
		}
	}

	# Try and pin it on someone else
	option = {
		name = ep2_tournament_events.1502.b

		flavor = ep2_tournament_events.1502.b.tt

		duel = {
			skill = diplomacy
			value = medium_skill_rating
			# Success
			1 = {
				desc = ep2_tournament_events.1502.b.success
				show_chance = yes

				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.1502.b.success
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

					scope:contestant = {
						activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
					}
				}
			}
			# Failure
			1 = {
				desc = ep2_tournament_events.1502.b.failure
				show_chance = yes

				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.1502.b.failure
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
				}
			}
		}

		stress_impact = {
			ambitious = miniscule_stress_impact_loss
			deceitful = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
			content = minor_stress_impact_gain
			honest = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = -1
				ai_honor = -1
			}
		}
	}

	# Have a go despite the wind
	option = {
		name = ep2_tournament_events.1502.c

		duel = {
			skill = prowess
			value = high_skill_rating
			# Success
			1 = {
				desc = ep2_tournament_events.1502.c.success
				show_chance = yes

				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.1502.c.success
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

					if = {
						limit = { has_trait = tourney_participant }
						add_trait_xp = {
							trait = tourney_participant
							track = bow
							value = tournament_hastiludes_xp_gain_major_value
						}
					}
				}
			}
			# Failure
			1 = {
				desc = ep2_tournament_events.1502.c.failure
				show_chance = yes

				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.1502.c.success
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
				}
			}
		}

		stress_impact = {
			ambitious = minor_stress_impact_gain
			deceitful = minor_stress_impact_gain
			arbitrary = minor_stress_impact_gain
			content = miniscule_stress_impact_loss
			honest = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = 1
			}
		}
	}
}

# Bored waiting for your turn, try some mischief?
ep2_tournament_events.1503 = {
	type = activity_event
	title = ep2_tournament_events.1503.t
	desc = ep2_tournament_events.1503.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = boredom
	}
	right_portrait = {
		character = scope:contestant
		scripted_animation = bow_closed
	}
	cooldown = { years = 1 }

	trigger = {
		is_in_guest_subset = { name = qualified }
		scope:activity = {
			any_guest_subset_current_phase = { #random qualified participant
				name = qualified
				contest_event_general_contestant_valid_trigger = yes
				NOT = {
					any_secret = {
						NOT = { is_known_by = root }
					}
				}
				save_temporary_scope_as = participant_1
			}
			any_guest_subset_current_phase = { #random qualified participant with a secret
				name = qualified
				this != scope:participant_1
				contest_event_general_contestant_valid_trigger = yes
				# Won't reveal a secret to you which you already know.
				any_secret = {
					NOT = { is_known_by = root }
				}
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_wood_woosh"
		tournament_pivotal_flavor_variable_effect = { CONTEST = archery ID = 1503 }
		scope:activity = {
			random_guest_subset_current_phase = { #random qualified participant
				name = qualified
				limit = {
					contest_event_general_contestant_valid_trigger = yes
					NOT = {
						any_secret = {
							NOT = { is_known_by = root }
						}
					}
				}
				save_scope_as = contestant
			}
			random_guest_subset_current_phase = { #random qualified participant with a secret
				name = qualified
				limit = {
					contest_event_general_contestant_valid_trigger = yes
					this != scope:contestant
					# Won't reveal a secret to you which you already know.
					any_secret = {
						NOT = { is_known_by = root }
					}
				}
				save_scope_as = secret_haver
				random_secret = {
					limit = {
						NOT = { is_known_by = root }
					}
					save_scope_as = secret
				}
			}
		}
	}

	# Move the line back a few feet
	option = {
		name = ep2_tournament_events.1503.a

		flavor = ep2_tournament_events.1503.a.tt

		duel = {
			skill = intrigue
			target = scope:contestant
			# Success
			1 = {
				desc = ep2_tournament_events.1503.a.success
				show_chance = yes

				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.1503.a.success
					left_icon = root
					right_icon = scope:contestant

					scope:contestant = {
						activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
					}
				}
			}
			# Failure
			1 = {
				desc = ep2_tournament_events.1503.a.failure
				show_chance = yes

				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				scope:activity = {
					add_activity_log_entry = {
						key = tournament_cheating_caught_log
						tags = { good }
						score = 5
						character = root
						target = scope:contestant
					}
				}

				send_interface_toast = {
					title = ep2_tournament_events.1503.a.failure
					left_icon = root
					right_icon = scope:contestant

					add_prestige = medium_prestige_loss
				}
			}
		}

		stress_impact = {
			ambitious = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
			content = minor_stress_impact_gain
			just = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_energy = 0.5
				ai_honor = -1
			}
		}
	}

	# Go and talk to the crowd
	option = {
		name = ep2_tournament_events.1503.b

		flavor = ep2_tournament_events.1503.b.flavor

		# Success, find a secret
		duel = {
			skills = { diplomacy intrigue }
			value = medium_skill_rating
			# Find a 
			1 = {
				desc = ep2_tournament_events.1503.b.success
				show_chance = yes

				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				custom_tooltip = ep2_tournament_events.1503.b.tt

				hidden_effect = { #So at to hide the secret until toast pops
					send_interface_toast = {
						title = ep2_tournament_events.1503.b.success
						left_icon = root

						scope:secret = {
							reveal_to_without_events_effect = {
								CHARACTER = root
							}
						}
					}
				}
			}
			# Failure, find nothing
			1 = {
				desc = ep2_tournament_events.1503.b.failure
				show_chance = yes

				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.1503.b.failure
					left_icon = root

					add_stress = minor_stress_loss
				}
			}
		}

		stress_impact = {
			lazy = miniscule_stress_impact_loss
			gregarious = miniscule_stress_impact_loss
			shy = minor_stress_impact_gain
			diligent = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 1
				ai_honor = 1
			}
		}
	}

	# Bah, just wait it out
	option = {
		name = ep2_tournament_events.1503.c

		stress_impact = {
			gregarious = miniscule_stress_impact_gain
			deceitful = miniscule_stress_impact_gain
			impatient = miniscule_stress_impact_gain
			shy = miniscule_stress_impact_loss
			honest = miniscule_stress_impact_loss
			patient = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = -1
				ai_honor = 1
			}
		}
	}
}

###################
###  WRESTLING  ###
###################

# You can use dirt to blind your opponent
ep2_tournament_events.2001 = {
	type = activity_event
	title = ep2_tournament_events.2001.t
	desc = ep2_tournament_events.2001.desc
	theme = tournament_contest
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = aggressive_unarmed
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = rage
	}
	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_male_grunts"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = wrestling ID = 2001 }
	}

	# Throw dirt at them
	option = {
		name = ep2_tournament_events.2001.a

		custom_tooltip = ep2_tournament_events.2001.a.tt

		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		stress_impact = {
			craven = medium_stress_impact_gain
			brave = medium_stress_impact_loss
			content = minor_stress_impact_gain
			ambitious = minor_stress_impact_loss
			arrogant = minor_stress_impact_loss
			humble = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = craven
					has_trait = content
					has_trait = humble
				}
			}
		}
	}

	# Don't throw the dirt
	option = {
		name = ep2_tournament_events.2001.b

		duel = {
			skill = prowess
			target = scope:versus_contestant

			40 = { #You fight your way out
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				desc = ep2_tournament_events.2004.d.tt.success

				send_interface_toast = {
					title = ep2_tournament_events.2004.d.tt.success
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_medium_value
						}
					}
				}
			}
			60 = { #You struggle fruitlessly
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				desc = ep2_tournament_events.2004.d.tt.failure

				send_interface_toast = {
					title = ep2_tournament_events.2004.d.tt.failure
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
				}
			}
		}

		stress_impact = {
			craven = medium_stress_impact_loss
			brave = medium_stress_impact_gain
			content = minor_stress_impact_loss
			ambitious = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			humble = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = brave
					has_trait = ambitious
					has_trait = arrogant
				}
			}
		}	
	}
}

# You go for the ol' oil check
ep2_tournament_events.2002 = {
	type = activity_event
	title = ep2_tournament_events.2002.t
	desc = ep2_tournament_events.2002.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = personality_dishonorable
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = shock
	}
	cooldown = { years = 1 }

	trigger = {
		NOT = { #Make sure player has two hands with which to fight
			has_trait = maimed
		}
		contest_versus_player_vs_ai_trigger = yes	
	}

	immediate = {
	play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_surprise_reaction"
		contest_versus_player_vs_ai_scope_effect = yes

		save_scope_value_as = {
			name = xp_range
			value = {
				integer_range = {
					min = 1
					max = 5
				}
			}
		}
		tournament_pivotal_flavor_variable_effect = { CONTEST = wrestling ID = 2002 }
	}

	# Pokey poke
	option = {
		name = ep2_tournament_events.2002.a

		give_nickname = nick_the_dirty

		scope:versus_contestant = {
			add_character_modifier = {
				modifier = tournament_walking_funny_modifier
				years = 3
			}
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

		every_close_family_member = {
			custom = ep2_tournament_events.2002.a.tt
			add_opinion = {
				target = root
				opinion = -10
				modifier = disgusted_opinion
			}
		}

		stress_impact = {
			honest = major_stress_impact_gain
			just = major_stress_impact_gain
			arbitrary = minor_stress_impact_loss
			deceitful = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = honest
					has_trait = just
				}
			}
		}
	}

	# I'd rather not
	option = {
		name = ep2_tournament_events.2002.b

		flavor = ep2_tournament_events.2002.b.tt

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

		if = {
			limit = { has_trait = tourney_participant }
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}
		else = {
			add_trait = tourney_participant
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}

		stress_impact = {
			honest = minor_stress_impact_loss
			just = minor_stress_impact_loss
			arbitrary = major_stress_impact_gain
			deceitful = major_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = arbitrary
					has_trait = deceitful
				}
			}
		}
	}
}

# Your friend distracts the ref; use the chair?
ep2_tournament_events.2003 = {
	type = activity_event
	title = ep2_tournament_events.2003.t
	desc = ep2_tournament_events.2003.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = scheme
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = worry
	}
	lower_left_portrait = {
		character = scope:friend
	}
	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
		scope:activity = {
			any_attending_character = {
				is_alive = yes
				NOR = {
					this = scope:versus_matchee
					this = scope:versus_matcher
				}
				OR = {
					has_relation_friend = root
					has_relation_best_friend = root
				}
			}
		}
	}

	immediate = {
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = wrestling ID = 2003 }
		involved_activity = {
			random_attending_character = {
				limit = {
					is_alive = yes
					NOR = {
						this = scope:versus_matchee
						this = scope:versus_matcher
					}
					OR = {
						has_relation_friend = root
						has_relation_best_friend = root
					}
				}
				save_scope_as = friend
			}
		}
		save_scope_value_as = {
			name = xp_range
			value = {
				integer_range = {
					min = 1
					max = 5
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = tournament_ref_distracted_log
				tags = { good }
				score = 5
				character = root
				target = scope:friend
			}
		}
	}

	# Viva la raza!
	option = {
		name = ep2_tournament_events.2003.a

		trigger = {
			OR = {
				has_trait = deceitful
				has_trait = arbitrary
			}
		}

		custom_tooltip = ep2_tournament_events.2003.a.tt

		give_nickname = nick_the_cheater

		reverse_add_opinion = {
			modifier = cheater_opinion
			target = scope:versus_contestant
			opinion = -40
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

		stress_impact = {
			base = minor_stress_impact_loss
			brave = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
			just = major_stress_impact_gain
			honest = major_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = just
					has_trait = brave
					has_trait = honest
				}
			}
		}
	}

	# Hit them with the chair
	option = {
		name = ep2_tournament_events.2003.b

		flavor = ep2_tournament_events.2003.b.tt

		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}

		stress_impact = {
			craven = medium_stress_impact_loss
			brave = medium_stress_impact_gain
			content = minor_stress_impact_gain
			ambitious = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = brave
					has_trait = content
				}
			}
		}
	}

	# Choose the honourable route
	option = {
		name = ep2_tournament_events.2003.c

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

		if = {
			limit = { has_trait = tourney_participant }
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}
		else = {
			add_trait = tourney_participant
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}

		stress_impact = {
			base = miniscule_stress_impact_loss
			compassionate = medium_stress_impact_loss
			craven = medium_stress_impact_gain
			brave = medium_stress_impact_loss
			just = medium_stress_impact_loss
			sadistic = medium_stress_impact_gain
			callous = minor_stress_impact_gain
			content = minor_stress_impact_loss
			ambitious = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = craven
					has_trait = ambitious
				}
			}
		}
	}
}

# Opponent has a high weight
ep2_tournament_events.2004 = {
	type = activity_event
	title = ep2_tournament_events.2004.t
	desc = ep2_tournament_events.2004.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = personality_bold
	}
	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
		trigger_if = {
			limit = { this = scope:versus_matchee }
			scope:versus_matcher = { current_weight >= 70 }
		}
		trigger_else = {
			scope:versus_matchee = { current_weight >= 70 }
		}
	}

	immediate = {
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = wrestling ID = 2004 }
	}

	# Tire them out by moving them around
	option = {
		name = ep2_tournament_events.2004.a

		trigger = {
			OR = {
				has_trait = shrewd
				has_trait = intellect_good
				scope:versus_contestant = {
					has_trait = wheezing
				}
			}
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_medium_value
			}
		}

		ai_chance = {
			base = 100
		}
	}

	# Just pick them up lol
	option = {
		name = ep2_tournament_events.2004.b

		trigger = {
			OR = {
				has_trait = strong
				has_trait = physique_good_1
				has_trait = physique_good_2
				has_trait = physique_good_3
			}
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_medium_value
			}
		}

		stress_impact = {
			base = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}

	# Medieval sumo
	option = {
		name = ep2_tournament_events.2004.c

		trigger = {
			current_weight > 50
			NOT = {
				has_trait = strong
				has_trait = physique_good
			}
		}

		add_internal_flag = special

		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_medium_value
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_sumo_wrestling_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

		stress_impact = {
			base = miniscule_stress_impact_loss
			craven = minor_stress_impact_gain
			brave = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}

	# Attempt to target their legs
	option = {
		name = ep2_tournament_events.2004.d

		duel = {
			skill = prowess
			target = scope:versus_contestant

			50 = { #You wear them down
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				desc = ep2_tournament_events.2004.d.tt.success

				activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

				if = {
					limit = {
						has_trait = tourney_participant
					}
					add_trait_xp = {
						trait = tourney_participant
						track = foot
						value = tournament_hastiludes_xp_gain_medium_value
					}
				}
			}
			50 = { #You fail to make an impact
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				desc = ep2_tournament_events.2004.d.tt.failure

				activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
			}
		}

		ai_chance = {
			base = 100
		}
	}

	# Take them head-on
	option = {
		name = ep2_tournament_events.2004.e

		add_prestige = minor_prestige_gain

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

		stress_impact = {
			craven = minor_stress_impact_gain
			brave = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				has_trait = craven
			}
		}
	}
}

scripted_trigger suitably_amorous_opponent = {
	is_physically_able_adult = yes
	can_marry_trigger = yes
	is_concubine = no
	is_attracted_to_gender_of = root
	NOT = {
		has_trait = chaste
		has_trait = celibate
	}
}

# You and your opponent end up in a rather amorous position
ep2_tournament_events.2005 = {
	type = activity_event
	title = ep2_tournament_events.2005.t
	desc = ep2_tournament_events.2005.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = flirtation_left
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = flirtation
	}
	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
		scope:versus_matcher = {
			is_attracted_to_gender_of = scope:versus_matchee
			might_cheat_on_every_partner_trigger = yes
		}
		scope:versus_matchee = {
			is_attracted_to_gender_of = scope:versus_matcher
			might_cheat_on_every_partner_trigger = yes
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_male_grunts"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = wrestling ID = 2005 }
	}

	# Give 'em a good tumble
	option = {
		name = ep2_tournament_events.2005.a
		trigger = {
			OR = {
				has_trait = rakish
				has_trait = seducer
				has_trait = lustful
			}
			NOT = {
				has_trait = chaste
			}
		}
		
		had_sex_with_effect = {
			CHARACTER = scope:versus_contestant
			PREGNANCY_CHANCE = 50
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

		stress_impact = {
			base = minor_stress_impact_loss
		}

		tournament_contest_versus_resignation_effect = { RESIGNER = scope:versus_contestant CONTEST = wrestling SKILL = pugilism }

		ai_chance = {
			base = 100
		}
	}

	# See if they're interested
	option = {
		name = ep2_tournament_events.2005.b

		trigger = {
			NOR = {
				has_trait = rakish
				has_trait = seducer
				has_trait = lustful
			}
		}

		random_list = {
			5 = { #They are amenable to your advances
				custom_tooltip = ep2_tournament_events.2005.b.tt.success

				had_sex_with_effect = {
					CHARACTER = scope:versus_contestant
					PREGNANCY_CHANCE = 50
				}

				modifier = {
					add = 5
					scope:versus_contestant = {
						has_trait = lustful
					}
				}
				modifier = {
					add = 5
					scope:versus_contestant = {
						has_trait = seducer
					}
				}
				modifier = {
					add = 5
					scope:versus_contestant = {
						has_trait = rakish
					}
				}
				modifier = {
					add = 1
					scope:versus_contestant = {
						trait_compatibility = {
							target = root
							value >= medium_positive_trait_compatibility
						}
					}
				}
				modifier = {
					add = -100
					scope:versus_contestant = {
						has_trait = celibate
					}
				}

				send_interface_toast = {
					title = ep2_tournament_events.2005.b.tt.success
					left_icon = root
					right_icon = scope:versus_contestant
				}

				stress_impact = {
					base = minor_stress_impact_loss
					lustful = minor_stress_impact_loss
					arrogant = minor_stress_impact_loss
					rakish = minor_stress_impact_loss
					seducer = minor_stress_impact_loss
				}

				tournament_contest_versus_resignation_effect = { RESIGNER = scope:versus_contestant CONTEST = wrestling SKILL = pugilism }
			}

			6 = { #They are flattered but decline
				custom_tooltip = ep2_tournament_events.2005.b.tt.failure
				modifier = {
					add = 5
					scope:versus_contestant = {
						trait_compatibility = {
							target = root
							value >= medium_positive_trait_compatibility
						}
					}
				}
				modifier = {
					add = 5
					scope:versus_contestant = {
						has_trait = celibate
					}
				}

				send_interface_toast = {
					title = ep2_tournament_events.2005.b.tt.failure
					left_icon = root
					right_icon = scope:versus_contestant
				}

				stress_impact = {
					lustful = minor_stress_impact_gain
					stubborn = minor_stress_impact_gain
					arrogant = minor_stress_impact_gain
				}
			}

			4 = { #They are horrified and angry
				custom_tooltip = ep2_tournament_events.2005.b.tt.criticalfailure
				modifier = {
					add = 5
					scope:versus_contestant = {
						has_trait = chaste
					}
				}
				modifier = {
					add = 5
					scope:versus_contestant = {
						has_trait = celibate
					}
				}

				send_interface_toast = {
					title = ep2_tournament_events.2005.b.tt.criticalfailure
					left_icon = root
					right_icon = scope:versus_contestant
				}

				stress_impact = {
					base = minor_stress_impact_gain
					lustful = medium_stress_impact_gain
					arrogant = medium_stress_impact_gain
				}
			}
		}

		stress_impact = {
			chaste = major_stress_impact_gain
			celibate = massive_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = celibate
					has_trait = chaste
				}
			}
		}
	}

	# Take advantage to win the contest
	option = {
		name = ep2_tournament_events.2005.c

		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		stress_impact = {
			just = medium_stress_impact_gain
			deceitful = minor_stress_impact_loss
			arbitrary = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				has_trait = just
			}
		}
	}
}

# Death Event: Your opponent piledrivers you on to your head
ep2_tournament_events.2006 = {
	type = activity_event
	title = ep2_tournament_events.2006.t
	desc = ep2_tournament_events.2006.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = rage
	}

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_negative_reaction"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = wrestling ID = 2006 }
	}

	# Die
	option = {
		name = ep2_tournament_events.2006.a

		hidden_effect = {
			tournament_contest_versus_resignation_effect = { RESIGNER = root CONTEST = wrestling SKILL = pugilism }
		}
		death = {
			death_reason = death_tournament_piledriver
		}
		scope:activity = {
			add_activity_log_entry = {
				key = tournament_wrestling_death_log
				tags = { bad }
				score = 10
				character = root
			}
		}
		ai_chance = {
			base = 100
		}
	}
}

# A person storms the ring to protest a decision in your favour
ep2_tournament_events.2007 = {
	type = activity_event
	title = ep2_tournament_events.2007.t
	desc = ep2_tournament_events.2007.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = worry
	}
	lower_right_portrait = {
		character = scope:opponent_friend
	}
	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
		scope:activity = {
			any_attending_character = {
				is_alive = yes
				is_adult = yes
				NOR = {
					this = scope:versus_matchee
					this = scope:versus_matcher
				}
				trigger_if = {
					limit = { root = scope:versus_matchee }
					has_relation_friend = scope:versus_matcher
				}
				trigger_else = { has_relation_friend = scope:versus_matchee }
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_negative_reaction"
		contest_versus_player_vs_ai_scope_effect = yes

		scope:activity = {
			random_guest_subset_current_phase = {
				name = spectator
				limit = { 
					is_alive = yes 
					is_adult = yes
					NOR = {
						this = scope:versus_matchee
						this = scope:versus_matcher
					}
					trigger_if = {
						limit = { root = scope:versus_matchee }
						has_relation_friend = scope:versus_matcher
					}
					trigger_else = { has_relation_friend = scope:versus_matchee }
				}
				save_scope_as = opponent_friend
			}
		}
		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_ring_stormed_log
				tags = { good }
				score = 5
				character = root
				target = scope:opponent_friend
			}
		}
	}

	# Guards! Have this miscreant removed!
	option = {
		name = ep2_tournament_events.2007.a

		add_prestige = -50

		progress_towards_rival_effect = {
			REASON = rival_wrestling_liar
			CHARACTER = scope:opponent_friend
			OPINION = 0
		}

		stress_impact = {
			wrathful = miniscule_stress_impact_loss
			ambitious = miniscule_stress_impact_loss
			deceitful = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
			calm = medium_stress_impact_gain
			content = medium_stress_impact_gain
			honest = major_stress_impact_gain
			just = major_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = just
					has_trait = honest
				}
			}
		}
	}

	# Argue with them
	option = {
		name = ep2_tournament_events.2007.b

		duel = {
			skill = diplomacy
			target = scope:opponent_friend
			#You win the debate
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = ep2_tournament_events.2007.b.tt.success

				send_interface_toast = {
					title = ep2_tournament_events.2007.b.tt.success
					left_icon = root
					right_icon = scope:opponent_friend

					activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = wit
							value = tournament_hastiludes_xp_gain_medium_value
						}
					}
				}
			}
			#They win the debate
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = ep2_tournament_events.2007.b.tt.failure

				send_interface_toast = {
					title = ep2_tournament_events.2007.b.tt.failure
					left_icon = root
					right_icon = scope:opponent_friend

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
				}
			}
		}

		stress_impact = {
			stubborn = miniscule_stress_impact_loss
			diligent = miniscule_stress_impact_loss
			fickle = medium_stress_impact_gain
			lazy = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				NOR = {
					has_trait = fickle
					has_trait = lazy
				}
			}
		}
	}

	# Admit it, gain nickname
	option = {
		name = ep2_tournament_events.2007.c

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

		give_nickname = nick_the_honest

		add_prestige = medium_prestige_value

		reverse_add_opinion = {
			modifier = impressed_opinion
			target = scope:opponent_friend
			opinion = 20
		}

		reverse_add_opinion = {
			modifier = grateful_opinion
			target = scope:versus_contestant
			opinion = 20
		}

		stress_impact = {
			honest = minor_stress_impact_loss
			just = minor_stress_impact_loss
			arbitrary = medium_stress_impact_gain
			deceitful = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_honor = 1
				ai_vengefulness = -0.5
			}
		}
	}
}

# What part of your opponent's body do you focus on?
ep2_tournament_events.2501 = {
	type = activity_event
	title = ep2_tournament_events.2501.t
	desc = ep2_tournament_events.2501.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = throne_room_cheer_1
	}
	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_male_grunts"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = wrestling ID = 2501 }
	}

	# Aim for the head
	option = {
		name = ep2_tournament_events.2501.a
		random_list = {
			5 = { #You knock them out!
				custom_tooltip = ep2_tournament_events.2501.a.tt.criticalsuccess
				modifier = {
					add = 5
					prowess > high_skill_rating
				}
				modifier = {
					add = -5
					prowess < low_skill_rating
				}

				send_interface_toast = {
					title = ep2_tournament_events.2501.a.tt.criticalsuccess
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

					add_prestige = minor_prestige_gain

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_medium_value
						}
					}
				}
			}
			20 = { #It works reasonably well
				custom_tooltip = ep2_tournament_events.2501.a.tt.success
				modifier = {
					add = 10
					prowess > high_skill_rating
				}

				send_interface_toast = {
					title = ep2_tournament_events.2501.a.tt.success
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_minor_value
						}
					}
				}
			}
			20 = { #Your opponent sees it coming
				custom_tooltip = ep2_tournament_events.2501.a.tt.failure

				send_interface_toast = {
					title = ep2_tournament_events.2501.a.tt.failure
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
				}
			}
		}
		ai_chance = {
			base = 100
		}
	}

	# Aim for the body
	option = {
		name = ep2_tournament_events.2501.b
		random_list = {
			10 = { #It works well
				custom_tooltip = ep2_tournament_events.2501.a.tt.criticalsuccess
				modifier = {
					add = 5
					prowess > high_skill_rating
				}
				add_prestige = minor_prestige_gain

				send_interface_toast = {
					title = ep2_tournament_events.2501.a.tt.criticalsuccess
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_minor_value
						}
					}
				}
			}
			10 = { #It works reasonably well
				custom_tooltip = ep2_tournament_events.2501.a.tt.success
				modifier = {
					add = 10
					prowess > high_skill_rating
				}

				send_interface_toast = {
					title = ep2_tournament_events.2501.a.tt.success
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
				}
			}
			10 = { #Your opponent sees it coming
				custom_tooltip = ep2_tournament_events.2501.a.tt.failure
				modifier = {
					add = 10
					prowess < low_skill_rating
				}

				send_interface_toast = {
					title = ep2_tournament_events.2501.a.tt.failure
					left_icon = root
					right_icon = scope:versus_contestant

					add_prestige = minor_prestige_loss

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }
				}
			}
		}
		ai_chance = {
			base = 100
		}
	}

	# Attack their legs
	option = {
		name = ep2_tournament_events.2501.c
		random_list = {
			1 = { #It works well
				custom_tooltip = ep2_tournament_events.2501.a.tt.criticalsuccess
				modifier = {
					add = -5
					prowess < low_skill_rating
				}
				add_prestige = minor_prestige_gain

				send_interface_toast = {
					title = ep2_tournament_events.2501.a.tt.criticalsuccess
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_minor_value
						}
					}
				}
			}
			30 = { #It works reasonably well
				custom_tooltip = ep2_tournament_events.2501.a.tt.success
				
				modifier = {
					add = 10
					prowess > high_skill_rating
				}

				send_interface_toast = {
					title = ep2_tournament_events.2501.a.tt.success
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
				}
			}
			5 = { #Your opponent sees it coming
				
				custom_tooltip = ep2_tournament_events.2501.a.tt.failure
				modifier = {
					add = 10
					prowess < low_skill_rating
				}
				

				send_interface_toast = {
					title = ep2_tournament_events.2501.a.tt.failure
					left_icon = root
					right_icon = scope:versus_contestant

					add_prestige = minor_prestige_loss

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
}

# Your finger pops out of its socket!
ep2_tournament_events.2502 = {
	type = activity_event
	title = ep2_tournament_events.2502.t
	desc = ep2_tournament_events.2502.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = pain
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = personality_dishonorable
	}
	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_male_grunts"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = wrestling ID = 2502 }
	}

	# Try and pop it back in
	option = {
		name = ep2_tournament_events.2502.a
		custom_tooltip = ep2_tournament_events.2502.a.tt
		random_list = {
			5 = { #It works
				desc = ep2_tournament_events.2502.a.tt.success
				modifier = {
					add = 30
					has_trait = lifestyle_physician
				}
				modifier = {
					add = 10
					has_trait = lifestyle_herbalist
				}
				
				send_interface_toast = {
					title = ep2_tournament_events.2502.a.tt.success
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

					add_prestige = minor_prestige_gain
				}
			}
			20 = { #It doesn't work
				desc = ep2_tournament_events.2502.a.tt.failure
				modifier = {
					add = 10
					has_trait = physique_bad
				}

				send_interface_toast = {
					title = ep2_tournament_events.2502.a.tt.failure
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

					add_character_modifier = {
						modifier = tournament_dislocated_finger_modifier
						years = 1
					}
				}
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_finger_popped_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

		stress_impact = {
			craven = medium_stress_impact_gain
			impatient = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				has_trait = craven
			}
		}
	}

	# Work around it
	option = {
		name = ep2_tournament_events.2502.b
		activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

		add_character_modifier = {
			modifier = tournament_dislocated_finger_modifier
			years = 1
		}

		ai_chance = {
			base = 100
		}
	}

	# Concede
	option = {
		name = ep2_tournament_events.2502.c
		tournament_contest_versus_resignation_effect = { RESIGNER = root CONTEST = wrestling SKILL = pugilism }

		stress_impact = {
			craven = medium_stress_impact_loss
			brave = medium_stress_impact_gain
			content = minor_stress_impact_loss
			ambitious = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			humble = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = brave
					has_trait = ambitious
				}
			}
		}	
	}
}

scripted_trigger contest_wrestling_eye_poke_trigger = {
	OR = {
		has_trait = sadistic
		has_trait = deceitful
		ai_compassion <= low_positive_ai_value
	}
}

# Your opponent tries eye-poking you
ep2_tournament_events.2503 = {
	type = activity_event
	title = ep2_tournament_events.2503.t
	desc = ep2_tournament_events.2503.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = grief
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = personality_cynical
	}
	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
		trigger_if = {
			limit = { this = scope:versus_matchee }
			scope:versus_matcher = { contest_wrestling_eye_poke_trigger = yes }
		}
		trigger_else = {
			scope:versus_matchee = { contest_wrestling_eye_poke_trigger = yes }
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_male_grunts"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = wrestling ID = 2503 }
	}

	# Poke them back
	option = {
		name = ep2_tournament_events.2503.a

		trigger = {
			OR = {
				has_trait = wrathful
				has_trait = vengeful
				has_trait = deceitful
				has_trait = arbitrary
				has_trait = callous
				has_trait = sadistic
			}
			NOT = {
				has_trait = one_eyed
			}
		}

		custom_tooltip = ep2_tournament_events.2503.a.tt

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}

		add_prestige = minor_prestige_loss

		add_character_modifier = {
			modifier = tournament_blurry_vision_modifier
			years = 3
		}

		scope:versus_contestant = {
			add_character_modifier = {
				modifier = tournament_blurry_vision_modifier
				years = 3
			}
		}

		stress_impact = {
			base = miniscule_stress_impact_loss
			vengeful = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			craven = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = vengeful
					has_trait = wrathful
				}
			}
		}
	}

	# Complain to get them disqualified, and take some time to recover
	option = {
		name = ep2_tournament_events.2503.b

		trigger = {
			NOT = {
				has_trait = one_eyed
			}
		}

		duel = {
			skill = diplomacy
			target = scope:versus_contestant
			#You get them disqualified
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = ep2_tournament_events.2503.b.tt.success

				activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
			}
			#You fail to get them disqualified
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = ep2_tournament_events.2503.b.tt.failure

				activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
			}
		}


	}

	# Continue the fight
	option = {
		name = ep2_tournament_events.2503.c

		trigger = {
			NOT = {
				has_trait = one_eyed
			}
		}

		custom_tooltip = ep2_tournament_events.2503.c.tt

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

		add_character_modifier = {
			modifier = tournament_blurry_vision_modifier
			years = 3
		}
	}

	# Continue the fight but with no working eyes
	option = {
		name = ep2_tournament_events.2503.d

		trigger = {
			has_trait = one_eyed
		}

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

		add_character_modifier = {
			modifier = tournament_really_blurry_vision_modifier
			years = 5
		}
	}
}

# Your berserker opponent bites your nose off
ep2_tournament_events.2504 = {
	type = activity_event
	title = ep2_tournament_events.2504.t
	desc = ep2_tournament_events.2504.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = grief
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = rage
	}
	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
		trigger_if = {
			limit = { this = scope:versus_matchee }
			scope:versus_matcher = { has_trait = berserker }
		}
		trigger_else = {
			scope:versus_matchee = { has_trait = berserker }
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_negative_reaction"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = wrestling ID = 2504 }
		random_court_position_holder = {
			type = court_physician_court_position
			save_scope_as = physician
		}

		add_stress = major_stress_gain
	}

	# Aaaaaaaaagggghhhh! Disqualify them!
	option = {
		name = ep2_tournament_events.2504.a

		custom_tooltip = ep2_tournament_events.2504.a.tt

		activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

		add_trait = disfigured

		tournament_contest_versus_disqualification_effect = { DISQUALIFIED = scope:versus_contestant MATCH = root CONTEST = wrestling SKILL = pugilism }

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_berserker_log
				tags = { bad }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

		ai_chance = {
			base = 100

		}
	}

	# Get me my physician! I don't need to participate any further!
	option = {
		name = ep2_tournament_events.2504.b

		trigger = {
			court_physician_available_trigger = yes
		}

		custom_tooltip = ep2_tournament_events.2504.b.tt

		random_list = {
			#Your physician works miracles
			2 = {
				modifier = {
					add = 5
					scope:physician = {
						learning > average_skill_rating
					}
				}
				modifier = {
					add = 10
					scope:physician = {
						learning > high_skill_rating
					}
				}
				modifier = {
					add = 10
					scope:physician = {
						has_trait = lifestyle_herbalist
					}
				}
				modifier = {
					add = 20
					scope:physician = {
						has_trait = lifestyle_physician
					}
				}
				custom_tooltip = ep2_tournament_events.2504.b.tt.criticalsuccess
				increase_wounds_effect = { REASON = fight }
			}
			#Your physician saves your nose
			10 = {
				modifier = {
					add = 5
					scope:physician = {
						learning > average_skill_rating
					}
				}
				modifier = {
					add = 10
					scope:physician = {
						learning > high_skill_rating
					}
				}
				modifier = {
					add = 10
					scope:physician = {
						has_trait = lifestyle_herbalist
					}
				}
				modifier = {
					add = 20
					scope:physician = {
						has_trait = lifestyle_physician
					}
				}
				custom_tooltip = ep2_tournament_events.2504.b.tt.success
				increase_wounds_effect = { REASON = fight }
				add_trait = scarred
				add_trait_xp = {
	                trait = scarred
	                value = {
	                    integer_range = {
	                        min = 25
	                        max = 60
	                    }
	                }
	            }
			}
			#Your physician is unable to save your nose
			10 = {
				modifier = {
					add = 5
					scope:physician = {
						learning < average_skill_rating
					}
				}
				modifier = {
					add = 10
					scope:physician = {
						learning < low_skill_rating
					}
				}
				custom_tooltip = ep2_tournament_events.2504.b.tt.failure
				increase_wounds_effect = { REASON = fight }
				add_trait = disfigured
			}
		}

		stress_impact = {
			base = miniscule_stress_impact_loss
			vengeful = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			craven = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = vengeful
					has_trait = wrathful
				}
			}
		}
	}

	# Find me a physician! I don't need to participate any further!
	option = {
		name = ep2_tournament_events.2504.c

		trigger = {
			court_physician_available_trigger = no
		}

		custom_tooltip = ep2_tournament_events.2504.c.tt

		increase_wounds_effect = { REASON = fight }
		add_trait = disfigured

		tournament_contest_versus_resignation_effect = { RESIGNER = root CONTEST = wrestling SKILL = pugilism }

		stress_impact = {
			base = miniscule_stress_impact_loss
			vengeful = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			craven = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = vengeful
					has_trait = wrathful
				}
			}
		}
	}
}

# Death event: opponent kicks your head through 180 degrees
ep2_tournament_events.2506 = {
	type = activity_event
	title = ep2_tournament_events.2506.t
	desc = ep2_tournament_events.2506.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = pain
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = shock
	}

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_surprise_reaction"
		contest_versus_player_vs_ai_scope_effect = yes
	}

	# Urk!
	option = {
		name = ep2_tournament_events.2506.a

		hidden_effect = {
			tournament_contest_versus_resignation_effect = { RESIGNER = root CONTEST = wrestling SKILL = pugilism }
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_wrestling_death_log
				tags = { bad }
				score = 10
				character = root
			}
		}

		death = {
			death_reason = death_tournament_roundhouse
		}

		ai_chance = {
			base = 100
		}
	}
}

# Discombobulate
ep2_tournament_events.2507 = {
	type = activity_event
	title = ep2_tournament_events.2507.t
	desc = ep2_tournament_events.2507.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = personality_callous
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = rage
	}
	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_surprise_reaction"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = wrestling ID = 2507 }
	}

	# ...do it again
	option = {
		name = ep2_tournament_events.2507.a

		trigger = {
			OR = {
				has_trait = callous
				has_trait = sadistic
				has_trait = wrathful
			}
		}

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_medium_value
			}
		}

		scope:versus_contestant = {
			add_character_modifier = {
				modifier = tournament_discombobulated_modifier
				years = 10
			}

			add_opinion = {
				modifier = hate_opinion
				target = root
				opinion = -60
			}
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

		stress_impact = {
			base = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}

	# Finish the fight quickly
	option = {
		name = ep2_tournament_events.2507.b

		flavor = ep2_tournament_events.2507.b.tt

		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}

		add_prestige = minor_prestige_gain

		reverse_add_opinion = {
			modifier = grateful_opinion
			target = scope:versus_contestant
			opinion = 10
		}

		stress_impact = {
			compassionate = minor_stress_impact_loss
			sadistic = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}

	# Persuade them to give up
	option = {
		name = ep2_tournament_events.2507.c

		duel = {
			skill = diplomacy
			value = medium_skill_rating
			# Success
			1 = {
				desc = ep2_tournament_events.2507.c.success
				modifier = {
					add = 10
					has_trait = compassionate
				}
				modifier = {
					add = 2
					has_trait = humble
				}
				modifier = {
					add = 5
					has_trait = patient
				}
				modifier = {
					add = 5
					has_trait = education_diplomacy
				}
				modifier = {
					add = 10
					has_trait = intellect_good
				}
				modifier = {
					add = 15
					has_trait = shrewd
				}
				modifier = {
					add = 20
					has_trait = diplomat
				}
				compare_modifier = {
					value = scope:duel_value
					multiplier = 5
				}
				send_interface_toast = {
					title = ep2_tournament_events.2507.c.success
					left_icon = root
					right_icon = scope:versus_contestant
					add_prestige = minor_prestige_gain
					reverse_add_opinion = {
						modifier = kindness_opinion
						target = scope:versus_contestant
						opinion = 20
					}
					tournament_contest_versus_resignation_effect = { RESIGNER = scope:versus_contestant CONTEST = wrestling SKILL = pugilism }
				}
				min = 5
			}
			# Failure
			1 = {
				desc = ep2_tournament_events.2507.c.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -5
				}
				modifier = {
					add = 10
					has_trait = callous
				}
				modifier = {
					add = 5
					has_trait = arrogant
				}
				modifier = {
					add = 2
					has_trait = impatient
				}
				modifier = {
					add = 5
					has_trait = intellect_bad
				}
				modifier = {
					add = 10
					has_trait = lisping
				}
				send_interface_toast = {
					title = ep2_tournament_events.2507.c.failure
					left_icon = root
					right_icon = scope:versus_contestant
					add_prestige = minor_prestige_loss
					reverse_add_opinion = {
						modifier = insult_opinion
						target = scope:versus_contestant
						opinion = -30
					}
					activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
				}
				min = 5
			}
		}

		ai_chance = {
			base = 100
		}	
	}
}

##################
###  QUINTAIN  ###
##################

scripted_trigger tournament_events_3501_knight_trigger = {
	age < 25 #Need to be young to prove themselves!
	is_ai = yes #No players!
	can_be_knight_trigger = { ARMY_OWNER = root } # CAN be a knight...
	is_knight = no #...but isn't currently
	is_landed = no #is not landed, to avoid taking anyone good
	NOR = { #is not employed, to avoid taking anyone useful
		has_council_position = councillor_spouse
		has_council_position = councillor_marshal
		has_council_position = councillor_court_chaplain
		has_council_position = councillor_steward
		has_council_position = councillor_spymaster
	}
	this != root #isn't you, or the either knight
}

# Two young knights vie for your attention
ep2_tournament_events.3501 = {
	type = activity_event
	title = ep2_tournament_events.3501.t
	desc = ep2_tournament_events.3501.desc
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = personality_callous
	}
	lower_right_portrait = {
		character = scope:knight1
	}
	lower_left_portrait = {
		character = scope:knight2
	}
	cooldown = { years = 1 }

	trigger = {
		this = scope:host
		scope:activity = {
			any_guest_subset_current_phase = {
				name = contestant
				count >= 2
				tournament_events_3501_knight_trigger = yes
				is_alive = yes
			}
			has_current_phase = tournament_phase_joust
		}
	}

	immediate = {
		scope:activity = {
			random_guest_subset_current_phase = {
				name = contestant
				limit = { 
					tournament_events_3501_knight_trigger = yes 
					is_alive = yes
				}
				save_scope_as = knight1
			}
			random_guest_subset_current_phase = {
				name = contestant
				limit = {
					tournament_events_3501_knight_trigger = yes
					is_alive = yes
					this != scope:knight1
				}
				save_scope_as = knight2
			}
		}
	}

	# Pick Knight 1
	option = {
		name = ep2_tournament_events.3501.a

		add_courtier = scope:knight1

		scope:knight1 = {

			add_opinion = {
				target = root
				modifier = flattered_opinion
				opinion = 50
			}
			
			accolade_medium_glory_gain_with_checks_effect = yes

			scope:knight2 = {
				add_opinion = {
					modifier = hate_opinion
					target = scope:knight1
					opinion = -60
				}
				add_opinion = {
					modifier = disappointed_opinion
					target = root
					opinion = -10
				}
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_quintain_choice_log_1
				tags = { good }
				score = 5
				character = root
				target = scope:knight1
			}
		}

		ai_chance = {
			base = 100
		}
	}

	# Pick Knight 2
	option = {
		name = ep2_tournament_events.3501.b

		add_courtier = scope:knight2

		scope:knight2 = {

			add_opinion = {
				target = root
				modifier = flattered_opinion
				opinion = 50
			}
			
			accolade_medium_glory_gain_with_checks_effect = yes

			scope:knight1 = {
				add_opinion = {
					modifier = hate_opinion
					target = scope:knight2
					opinion = -60
				}
				add_opinion = {
					modifier = disappointed_opinion
					target = root
					opinion = -10
				}
			}
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_quintain_choice_log_2
				tags = { good }
				score = 5
				character = root
				target = scope:knight2
			}
		}

		ai_chance = {
			base = 100
		}
	}

	# Pick whoever wins the next match!
	option = {
		name = ep2_tournament_events.3501.c
		scope:knight1 = {
			duel = {
				skill = prowess
				target = scope:knight2
				50 = {
					show_chance = no
					compare_modifier = {
						value = scope:duel_value
						multiplier = 1.5
					}
					desc = ep2_tournament_events.knight_1_wins
					scope:activity = {
						add_activity_log_entry = {
							key = tournament_quintain_choice_log_1
							tags = { good }
							score = 5
							character = root
							target = scope:knight1
						}
					}
					send_interface_toast = {
						title = ep2_tournament_events.knight_1_wins
						left_icon = root
						right_icon = scope:knight1
						add_courtier = scope:knight1
						scope:knight1 = {
							accolade_minor_glory_gain_with_checks_effect = yes
						}
					}
				}
				50 = {
					show_chance = no
					compare_modifier = {
						value = scope:duel_value
						multiplier = -1.5
					}
					desc = ep2_tournament_events.knight_2_wins
					scope:activity = {
						add_activity_log_entry = {
							key = tournament_quintain_choice_log_2
							tags = { good }
							score = 5
							character = root
							target = scope:knight2
						}
					}
					send_interface_toast = {
						title = ep2_tournament_events.knight_2_wins
						left_icon = root
						right_icon = scope:knight2
						add_courtier = scope:knight2
						scope:knight2 = {
							accolade_minor_glory_gain_with_checks_effect = yes
						}
					}
				}
			}
		}
		ai_chance = {
			base = 100
		}
	}

	# Pick neither
	option = {
		name = ep2_tournament_events.3501.d
		
		if = {
			limit = { activity_is_competing_trigger = yes }
			activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
		}
		
		scope:knight1 = {

			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -20
			}

			progress_towards_rival_effect = {
				REASON = rival_quintain_knight_anger
				CHARACTER = scope:knight2
				OPINION = 0
			}
		}

		scope:knight2 = {

			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -20
			}

			progress_towards_rival_effect = {
				REASON = rival_quintain_knight_anger
				CHARACTER = scope:knight1
				OPINION = 0
			}
		}

		ai_chance = {
			base = 100
		}
	}
}

# Quintain breaks
ep2_tournament_events.3502 = {
	type = activity_event
	title = ep2_tournament_events.3502.t
	desc = ep2_tournament_events.3502.desc
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:competitor
		animation = personality_honorable
	}
	cooldown = { years = 1 }

	trigger = {
		this = scope:host
		scope:activity = {
			any_guest_subset_current_phase = {
				name = contestant
				contest_event_general_contestant_valid_trigger = yes
			}
			has_current_phase = tournament_phase_joust
		}
	}

	immediate = {
		scope:activity = {
			random_guest_subset_current_phase = {
				name = contestant
				limit = { contest_event_general_contestant_valid_trigger = yes }
				save_scope_as = competitor
			}
			activity_location.province_owner = { save_scope_as = mayor }
		}
		scope:activity = {
			add_activity_log_entry = {
				key = tournament_broken_quintain_log
				tags = { bad }
				score = 5
				character = scope:mayor
			}
		}
	}

	option = { # Punish the builder
		name = ep2_tournament_events.3502.a

		trigger = {
			this = scope:host
		}
		
		if = {
			limit = { activity_is_competing_trigger = yes} 
			activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
		}
		
		add_prestige = medium_prestige_loss

		progress_towards_rival_effect = {
			REASON = rival_quintain_collapse_blame
			CHARACTER = scope:mayor
			OPINION = default_rival_opinion
		}

		stress_impact = {
			base = miniscule_stress_impact_gain
			calm = minor_stress_impact_gain
			wrathful = miniscule_stress_impact_loss
			vengeful = miniscule_stress_impact_loss
			forgiving = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				has_trait = forgiving
			}
		}
	}

	option = { # Criticise the host
		name = ep2_tournament_events.3502.b

		trigger = {
			this != scope:host
		}

		progress_towards_rival_effect = {
			REASON = rival_quintain_collapse_blame
			CHARACTER = scope:mayor
			OPINION = default_rival_opinion
		}

	 	reverse_add_opinion = {
	 		target = scope:host
	 		modifier = angry_opinion
	 		opinion = -30
	 	}

		stress_impact = {
			forgiving = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				has_trait = forgiving
			}
		}
	}

	option = { # Pay for its repair
		name = ep2_tournament_events.3502.c

		remove_short_term_gold = medium_gold_value

		add_prestige = minor_prestige_gain

		if = {
			limit = {
				this != scope:host
			}
		 	reverse_add_opinion = {
		 		target = scope:host
		 		modifier = grateful_opinion
		 		opinion = 30
		 	}
		 }

		stress_impact = {
			greedy = medium_stress_impact_gain
			generous = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				has_trait = greedy
			}
		}
	}

	option = { # Pull out
		name = ep2_tournament_events.3502.d

	 	reverse_add_opinion = {
	 		target = scope:competitor
	 		modifier = compliment_opinion
	 		opinion = 20
	 	}

		stress_impact = {
			arrogant = minor_stress_impact_gain
			humble = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = ambitious
					has_trait = stubborn
					has_trait = arrogant
					has_trait = brave
				}
			}
		}
	}
}

# Hapless knight ends up on the quintain
ep2_tournament_events.3503 = {
	type = activity_event
	title = ep2_tournament_events.3503.t
	desc = ep2_tournament_events.3503.desc
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = laugh
	}
	right_portrait = {
		character = scope:hapless_knight
		animation = pain
	}
	cooldown = { years = 1 }

	trigger = {
		this = scope:host
		scope:activity = {
			any_guest_subset_current_phase = {
				name = contestant
				contest_event_general_contestant_valid_trigger = yes
				is_landed = no #Make sure they're not a noble
				is_lowborn = yes #...and again
				prowess < medium_skill_rating #Make sure they're likely to actually be bad
				is_alive = yes #duh
			}
			has_current_phase = tournament_phase_joust
		}
	}

	immediate = {
		scope:activity = {
			random_guest_subset_current_phase = {
				name = contestant
				limit = {					
					contest_event_general_contestant_valid_trigger = yes
					is_landed = no #Make sure they're not a noble
					is_lowborn = yes #...and again
					prowess < medium_skill_rating #Make sure they're likely to actually be bad
					is_alive = yes #duh
				}
				save_scope_as = hapless_knight

				activity_tournament_change_contestant_score_effect = { SCORE = decrease_major }
			}
			add_activity_log_entry = {
				key = tournament_hapless_knight_log
				tags = { good }
				score = 5
				character = root
				target = scope:hapless_knight
			}
		}
		scope:hapless_knight = { accolade_minor_glory_loss_with_checks_effect = yes }
	}

	option = { # Offer them a place as a jester
		name = ep2_tournament_events.3503.a

		trigger = {
			#Make sure you can actually offer them a jester position
			can_appoint_char_to_court_position = {
				CHAR = scope:hapless_knight
				COURT_POS = court_jester_court_position
			}
		}

		random_list = {
			24 = { #They accept

				modifier = { #A humble person might be more likely to accept
					add = 40
					scope:hapless_knight = {
						has_trait = humble
					}
				}


				modifier = { #A fickle person is less likely to adhere to their profession
					add = 20
					scope:hapless_knight = {
						has_trait = fickle
					}
				}

				modifier = { #A lazy person sees the opportunity for a comfortable life with minimal effort
					add = 20
					scope:hapless_knight = {
						has_trait = lazy
					}
				}

				modifier = { #Perhaps more likely if they're good at it
					add = 10
					scope:hapless_knight = {
						aptitude:court_jester_court_position >= 2
					}
				}

				modifier = { #A gregarious person loves interacting with people
					add = 5
					scope:hapless_knight = {
						has_trait = gregarious
					}
				}

				desc = ep2_tournament_events.3503.a.tt.success

				send_interface_toast = {
					title = ep2_tournament_events.3503.a.tt.success
					left_icon = root
					right_icon = scope:hapless_knight
					hidden_effect = {
						scope:hapless_knight = { set_employer = root }
					}
					court_position_grant_effect = {
						EMPLOYER = root
						POS = court_jester
						CANDIDATE = scope:hapless_knight
					}

					scope:hapless_knight = {
						save_scope_as = resigner
						tournament_contest_versus_resignation_effect = { RESIGNER = scope:hapless_knight CONTEST = joust SKILL = horse }
					}
				}
			}
			76 = { #They refuse
				modifier = { #An arrogant person would almost never accept
					add = 200
					scope:hapless_knight = {
						has_trait = arrogant
					}
				}

				modifier = { #A stubborn person doesn't want a career change
					add = 50
					scope:hapless_knight = {
						has_trait = stubborn
					}
				}

				desc = ep2_tournament_events.3503.a.tt.failure

				send_interface_toast = {
					title = ep2_tournament_events.3503.a.tt.failure
					left_icon = root
					right_icon = scope:hapless_knight

					progress_towards_rival_effect = {
						REASON = rival_quintain_collapse_blame
						CHARACTER = scope:hapless_knight
						OPINION = default_rival_opinion
					}
				}
			}
		}		

		ai_chance = {
			base = 100
		}
	}

	option = { # Try to get them banned
		name = ep2_tournament_events.3503.b

		progress_towards_rival_effect = {
			REASON = rival_tournament_attempted_banning
			CHARACTER = scope:hapless_knight
			OPINION = default_rival_opinion
		}

		duel = {
			skill = diplomacy
			target = scope:hapless_knight
			# Success
			50 = {
				show_chance = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				desc = ep2_tournament_events.3503.b.tt.success

				send_interface_toast = {
					title = ep2_tournament_events.3503.b.tt.success
					left_icon = root
					right_icon = scope:enemy

					if = {
						limit = { activity_is_competing_trigger = yes }
						activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
					}

					scope:hapless_knight = {
						add_prestige = minor_prestige_loss
						add_character_flag = tournament_not_competing
						custom_tooltip = tournament_not_competing_tt
					}
					scope:activity = {
						remove_from_guest_subset = {
							name = contestant
							target = scope:hapless_knight
						}
						add_to_guest_subset = {
							name = spectator
							target = scope:hapless_knight
						}
					}
				}
			}
			# Failure
			50 = {
				show_chance = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				desc = ep2_tournament_events.3503.b.tt.failure

				send_interface_toast = {
					title = ep2_tournament_events.3503.b.tt.failure
					left_icon = root
					right_icon = scope:enemy

					add_prestige = minor_prestige_loss
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}

	option = { # You decide you quite like them
		name = ep2_tournament_events.3503.c
		
		if = {
			limit = { activity_is_competing_trigger = yes }
			activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
		}

		progress_towards_friend_effect = {
			REASON = friend_joust_endearment
			CHARACTER = scope:hapless_knight
			OPINION = default_friend_opinion
		}

		stress_impact = {
			sadistic = medium_stress_impact_gain
			callous = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = callous
					has_trait = sadistic
				}
			}
		}
	}
	option = { # Laugh at them
		name = ep2_tournament_events.3503.d
		custom_tooltip = available_because_intent_tt
		trigger = { has_activity_intent = reduce_stress_intent }

		progress_towards_rival_effect = {
			REASON = rival_contest_mockery
			CHARACTER = scope:hapless_knight
			OPINION = default_rival_opinion
		}

		scope:hapless_knight = {
			add_prestige = medium_prestige_loss
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_major }
		}

		stress_impact = {
			base = major_stress_impact_loss
			compassionate = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}
}

#Death event: Quintain hits you
ep2_tournament_events.3504 = {
	type = activity_event
	title = ep2_tournament_events.3504.t
	desc = ep2_tournament_events.3504.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = pain
	}

	trigger = {
		is_participant_in_activity = scope:activity
		scope:activity = {
			has_current_phase = tournament_phase_joust
		}
	}

	option = { # Ouch!
		name = ep2_tournament_events.3504.a

		random_list = {
			1 = {
				show_chance = no
				increase_wounds_effect = { REASON = accident }
			}
			1 = {
				show_chance = no
				add_trait = incapable
			}
			1 = {
				show_chance = no
				death = {
					death_reason = death_tournament_quintain_hit
				}

				scope:activity = {
					add_activity_log_entry = {
						key = tournament_quintain_death_log
						tags = { bad }
						score = 10
						character = root
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
}

#################
###   JOUST   ###
#################

# You get injured
ep2_tournament_events.4001 = {
	type = activity_event
	title = ep2_tournament_events.4001.t
	desc = ep2_tournament_events.4001.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = jockey_loss
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = jockey_lance_couched_gallop
	}
	cooldown = { months = 2 }

	trigger = {
		#DLC check.
		#has_ep2_dlc_trigger = yes
		
		#Standard checks.
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_surprise_reaction"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = joust ID = 4001 }
		scope:activity = {
			add_activity_log_entry = {
				key = tournament_joust_injury_log
				tags = { bad }
				score = 5
				character = root
			}
		}
	}

	option = { # Pull through
		name = ep2_tournament_events.4001.a

		trigger = {
			OR = {
				has_trait = physique_good
				has_trait = strong		
			}
		}

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = horse
				value = tournament_hastiludes_xp_gain_medium_value
			}
		}

		increase_wounds_no_death_effect = { REASON = battle }

		add_prestige = medium_prestige_gain

		stress_impact = {
			base = miniscule_stress_impact_gain
			fickle = minor_stress_impact_gain
			stubborn = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}

	option = { # Stay in, get wounded
		name = ep2_tournament_events.4001.b

		increase_wounds_no_death_effect = { REASON = battle }

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = horse
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}

		add_prestige = medium_prestige_gain

		stress_impact = {
			base = minor_stress_impact_gain
			fickle = minor_stress_impact_gain
			stubborn = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}
	option = { # Pull out
		name = ep2_tournament_events.4001.c

		tournament_contest_versus_resignation_effect = { RESIGNER = root CONTEST = joust SKILL = horse }

		stress_impact = {
			base = miniscule_stress_impact_loss
			brave = minor_stress_impact_gain
			craven = minor_stress_impact_loss
			ambitious = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			humble = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = ambitious
					has_trait = stubborn
					has_trait = arrogant
					has_trait = brave
				}
			}
		}
	}
}

# Your opponent is knocked off their horse
ep2_tournament_events.4002 = {
	type = activity_event
	title = ep2_tournament_events.4002.t
	desc = ep2_tournament_events.4002.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = jockey_lance_tilted
	}
	right_portrait = {
		trigger = {
			this != involved_activity.activity_host
		}
		character = scope:versus_contestant
		animation = pain
	}
	cooldown = { months = 2 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_horse_neigh"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = joust ID = 4002 }
		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = horse
				value = tournament_hastiludes_xp_gain_medium_value
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = tournament_knocked_off_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}
	}

	option = { # Help them up and give them a shield
		name = ep2_tournament_events.4002.a

		trigger = {
			OR = {
				has_trait = just
				has_trait = gregarious
				has_trait = compassionate
			}
		}

	 	reverse_add_opinion = {
	 		target = scope:versus_contestant
	 		modifier = grateful_opinion
	 		opinion = 40
	 	}

		add_prestige = medium_prestige_gain

		custom_tooltip = ep2_tournament_events.4001.a.tt

		hidden_effect = {
			every_courtier_or_guest = {
				add_opinion = {
					target = root
					opinion = 10
					modifier = reputation_opinion
				}
			}
		}

		stress_impact = {
			base = miniscule_stress_impact_loss
			ambitious = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}

	option = { # Help them up
		name = ep2_tournament_events.4002.b

	 	reverse_add_opinion = {
	 		target = scope:versus_contestant
	 		modifier = grateful_opinion
	 		opinion = 15
	 	}

		add_prestige = minor_prestige_gain

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

		stress_impact = {
			just = miniscule_stress_impact_loss
			compassionate = miniscule_stress_impact_loss
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = callous
					has_trait = sadistic
				}
			}
		}
	}
	option = { # Ah well
		name = ep2_tournament_events.4002.c

		activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

		stress_impact = {
			just = minor_stress_impact_gain
			brave = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}
}

# Your opponent is using a massive lance
ep2_tournament_events.4003 = {
	type = activity_event
	title = ep2_tournament_events.4003.t
	desc = ep2_tournament_events.4003.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = jockey_loss
	}
	right_portrait = {
		trigger = {
			this != involved_activity.activity_host
		}
		character = scope:versus_contestant
		animation = jockey_lance_couched_gallop
	}
	cooldown = { months = 2 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_horse_trotting"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = joust ID = 4003 }
	}

	option = { # Protest to the authorities
		name = ep2_tournament_events.4003.a

		trigger = {
			OR = {
				has_trait = just
				has_trait = honest
				has_trait = irritable
			}
		}

		flavor = ep2_tournament_events.4003.a.tt

	 	reverse_add_opinion = {
	 		target = scope:versus_contestant
	 		modifier = annoyed_opinion
	 		opinion = -40
	 	}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

		add_prestige = minor_prestige_loss

		stress_impact = {
			base = miniscule_stress_impact_loss
			ambitious = minor_stress_impact_gain
			just = minor_stress_impact_loss
			craven = minor_stress_impact_loss
			brave = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = brave
					has_trait = ambitious
				}
			}
		}
	}

	option = { # Ask them not to use it
		name = ep2_tournament_events.4003.b

		duel = {
			skill = diplomacy
			target = scope:versus_contestant
			# Success
			50 = {
				show_chance = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.4003.b.tt.win
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }
				}
			}
			# Failure
			50 = {
				show_chance = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = ep2_tournament_events.4003.b.tt.lose
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
				}
			}
		}

		stress_impact = {
			ambitious = minor_stress_impact_gain
			just = minor_stress_impact_loss
			craven = minor_stress_impact_loss
			brave = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = brave
					has_trait = ambitious
				}
			}
		}
	}
	option = { # Joust them anyway
		name = ep2_tournament_events.4003.c

		add_prestige = medium_prestige_gain

		duel = {
			skills = { prowess martial }
			value = decent_skill_rating
			# Success
			50 = {
				show_chance = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				
				send_interface_toast = {
					title = ep2_tournament_events.4003.c.tt.win
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = horse
							value = tournament_hastiludes_xp_gain_medium_value
						}
					}
				}
			}
			# Failure
			50 = {
				show_chance = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.4003.c.tt.lose
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
				}
			}
		}

		stress_impact = {
			ambitious = minor_stress_impact_loss
			just = minor_stress_impact_gain
			craven = minor_stress_impact_gain
			brave = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = just
					has_trait = craven
				}
			}
		}
	}
}

# Your opponent challenges you to a duel on foot
ep2_tournament_events.4004 = {
	type = activity_event
	title = ep2_tournament_events.4004.t
	desc = ep2_tournament_events.4004.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = jockey_lance_tilted
	}
	right_portrait = {
		trigger = {
			this != involved_activity.activity_host
		}
		character = scope:versus_contestant
		animation = marshal
	}
	cooldown = { months = 2 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_horse_neigh"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = joust ID = 4004 }
	}

	option = { # Accept
		name = ep2_tournament_events.4004.a

	 	reverse_add_opinion = {
	 		target = scope:versus_contestant
	 		modifier = respect_opinion
	 		opinion = 30
	 	}

		duel = {
			skill = prowess
			target = scope:versus_contestant
			# Success
			50 = {
				show_chance = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.4004.a.success
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = foot
							value = tournament_hastiludes_xp_gain_medium_value
						}
					}
				}
			}
			# Failure
			50 = {
				show_chance = yes
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = ep2_tournament_events.4004.a.failure
					left_icon = root
					right_icon = scope:versus_contestant

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
				}
			}
		}

		add_prestige = minor_prestige_loss

		stress_impact = {
			ambitious = medium_stress_impact_loss
			paranoid = medium_stress_impact_gain
			craven = minor_stress_impact_gain
			brave = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = paranoid
					has_trait = craven
				}
			}
		}
	}

	option = { # Refuse
		name = ep2_tournament_events.4004.b

		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = disappointed_opinion
			opinion = -30
		}

		ai_chance = {
			base = 100
		}
	}

	option = { # Accept, but insist upon fighting WITH LANCES
		name = ep2_tournament_events.4004.c

		trigger = {
			OR = {
				has_trait = dull
				has_trait = intellect_bad
			}
		}

		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = tournament_confused_opinion
			opinion = -40
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

		add_prestige = minor_prestige_loss

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = foot
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}

		stress_impact = {
			base = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}
}

# Your opponent is injured but tilts anyway
ep2_tournament_events.4005 = {
	type = activity_event
	title = ep2_tournament_events.4005.t
	desc = ep2_tournament_events.4005.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = jockey_lance_tilted
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = jockey_loss
	}
	cooldown = { months = 2 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_wood_clash"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = joust ID = 4005 }
		scope:activity = {
			add_activity_log_entry = {
				key = tournament_joust_injury_log
				tags = { bad }
				score = 5
				character = scope:versus_contestant
			}
		}
	}

	option = { # Tilt against them
		name = ep2_tournament_events.4005.a

		flavor = ep2_tournament_events.4005.a.tt

		if = {	# If they're a coward they'll like you less
			limit = {
				scope:versus_contestant = {
					has_trait = craven
				}
			}
			reverse_add_opinion = {
				target = scope:versus_contestant
				modifier = cruelty_opinion
				opinion = -10
			}
		}	
		else_if = { # If they're brave, stubborn or chivalric they'll respect you for respecting their wishes
			limit = {
				scope:versus_contestant = {
					OR = {
						has_trait = brave
						has_trait = stubborn
						has_trait = gallant
					}
				}
			}
			reverse_add_opinion = {
				target = scope:versus_contestant
				modifier = tournament_respected_wishes_opinion
				opinion = 30
			}
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		add_prestige = miniscule_prestige_loss

		ai_chance = {
			base = 100
		}
	}

	option = { # Refuse to tilt against them
		name = ep2_tournament_events.4005.b

		flavor = ep2_tournament_events.4005.b.tt

		if = { # If they're chivalric they'll respect you even more for being knightly
			limit = {
				scope:versus_contestant = {
					has_trait = gallant
				}
			}
			reverse_add_opinion = {
				target = scope:versus_contestant
				modifier = respect_opinion
				opinion = 50
			}
		}

		else_if = { # If they're not chivalric they'll still respect you
			limit = {
				scope:versus_contestant = {
					NOT = {
						has_trait = gallant
					}
				}
			}
			reverse_add_opinion = {
				target = scope:versus_contestant
				modifier = respect_opinion
				opinion = 20
			}
		}

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

		add_prestige = medium_prestige_gain

		stress_impact = {
			compassionate = medium_stress_impact_loss
			sadistic = medium_stress_impact_gain
			callous = medium_stress_impact_gain
			just = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = sadistic
					has_trait = callous
				}
			}
		}
	}

	option = { # Tilt against them in an underhanded way that guarantees victory
		name = ep2_tournament_events.4005.c

		flavor = ep2_tournament_events.4005.c.tt

		activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

		add_prestige = medium_prestige_loss

		if = { # If they're chivalric they'll hate you you even more for being knightly
			limit = {
				scope:versus_contestant = {
					has_trait = gallant
				}
			}
			reverse_add_opinion = {
				target = scope:versus_contestant
				modifier = angry_opinion
				opinion = -60
			}
		}

		else_if = { # If they're not chivalric they'll still hate you, just less so
			limit = {
				scope:versus_contestant = {
					NOT = {
						has_trait = gallant
					}
				}
			}
			reverse_add_opinion = {
				target = scope:versus_contestant
				modifier = angry_opinion
				opinion = -40
			}
		}

		stress_impact = {
			compassionate = medium_stress_impact_gain
			sadistic = medium_stress_impact_loss
			callous = medium_stress_impact_loss
			just = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = just
				}
			}
		}
	}
}

# Your opponent asks for a mercy pass
ep2_tournament_events.4006 = {
	type = activity_event
	title = ep2_tournament_events.4006.t
	desc = ep2_tournament_events.4006.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = jockey_lance_tilted
	}
	right_portrait = {
		trigger = {
			this != involved_activity.activity_host
		}
		character = scope:versus_contestant
		animation = jockey_idle
	}
	cooldown = { months = 2 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_horse_flyby"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = joust ID = 4006 }
		scope:activity = {
			add_activity_log_entry = {
				key = tournament_mercy_pass_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}
	}

	option = { # Show mercy
		name = ep2_tournament_events.4006.a

		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = tournament_mercy_opinion
			opinion = 30
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

		add_prestige = minor_prestige_gain

		stress_impact = {
			compassionate = medium_stress_impact_loss
			sadistic = medium_stress_impact_gain
			callous = medium_stress_impact_gain
			just = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = callous
					has_trait = sadistic
				}
			}
		}
	}

	option = { # No mercy
		name = ep2_tournament_events.4006.b

		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = cruelty_opinion
			opinion = -30
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		stress_impact = {
			compassionate = medium_stress_impact_gain
			sadistic = medium_stress_impact_loss
			callous = minor_stress_impact_loss
			just = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = just
					has_trait = compassionate
				}
			}
		}
	}
}

# Your opponent is mistreating their groom
ep2_tournament_events.4007 = {
	type = activity_event
	title = ep2_tournament_events.4007.t
	desc = ep2_tournament_events.4007.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = jockey_idle
	}
	right_portrait = {
		character = scope:groom
		outfit_tags = { beggar_rags }
		animation = admiration
	}
	lower_right_portrait = {
		character = scope:versus_contestant
	}
	cooldown = { months = 2 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_negative_reaction"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = joust ID = 4007 }
		create_character = {
			location = root.location
			faith = scope:versus_contestant.faith
			culture = scope:versus_contestant.culture
			random_traits_list = {
				count = 1
				education_martial_1 = {}
				education_martial_2 = {}
			}
			dynasty = none
			age = { 18 22 }
			random_traits = yes
			gender_female_chance = {
				if = {
					limit = { scope:versus_contestant.faith = { has_doctrine = doctrine_gender_male_dominated } }
					add = 0
				}
				else_if = {
					limit = { scope:versus_contestant.faith = { has_doctrine = doctrine_gender_female_dominated } }
					add = 100
				}
				else = {
					add = 50
				}
			}
			save_scope_as = groom
		}
	}


	option = { # Laugh at the groom
		name = ep2_tournament_events.4007.a

		trigger = {
			has_trait = callous
		}

	 	reverse_add_opinion = {
	 		target = scope:versus_contestant
	 		modifier = tournament_agreed_opinion
	 		opinion = 30
	 	}

		reverse_add_opinion = {
			target = root
			modifier = tournament_mocked_opinion
			opinion = -30
		}

		stress_impact = {
			base = minor_stress_impact_loss
			gregarious = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				has_trait = gregarious
			}
		}
	}

	option = { # Offer the groom a job
		name = ep2_tournament_events.4007.b

		flavor = ep2_tournament_events.4007.b.tt

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

	 	reverse_add_opinion = {
	 		target = scope:versus_contestant
	 		modifier = angry_opinion
	 		opinion = -30
	 	}

		scope:groom = {
			reverse_add_opinion = {
				target = scope:versus_contestant
				modifier = angry_opinion
				opinion = -30
			}
		}

		add_courtier = scope:groom

		ai_chance = {
			base = 100
		}
	}

	option = { # Pay groom to unsettle opponent's horse
		name = ep2_tournament_events.4007.c

		flavor = ep2_tournament_events.4007.c.tt

		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		scope:groom = {
			reverse_add_opinion = {
				target = scope:versus_contestant
				modifier = angry_opinion
				opinion = -50
			}
		}

		pay_short_term_gold = {
			target = scope:groom
			gold = minor_gold_value
		}

		stress_impact = {
			just = medium_stress_impact_gain
			ambitious = minor_stress_impact_loss
			greedy = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = just
					has_trait = greedy
				}
			}
		}
	}

	option = { # Let it go
		name = ep2_tournament_events.4007.d

		ai_chance = {
			base = 100
		}
	}
}

# Crowd heckles you
ep2_tournament_events.4008 = {
	type = activity_event
	title = ep2_tournament_events.4008.t
	desc = ep2_tournament_events.4008.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	cooldown = { months = 2 }

	left_portrait = {
		character = root
		animation = jockey_loss
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = jockey_lance_tilted
	}

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_amb_2d_crowd_negative_reaction"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = joust ID = 4008 }
		scope:activity = {
			add_activity_log_entry = {
				key = tournament_crowd_heckled_log
				tags = { bad }
				score = 5
				character = root
			}
		}
	}

	# Continue with the contest
	option = {
		name = ep2_tournament_events.4008.a
		random_list = {
			45 = { #You win
				
				modifier = { #Skill buff
					add = 15
					prowess > high_skill_rating
				}

				modifier = {
					add = 10
					has_trait = brave #Brave enough to ignore it
				}

				modifier = {
					add = 10
					has_trait = calm #Calm enough to ignore the abuse
				}

				modifier = {
					add = -10
					OR = {
						has_trait = wrathful #Too angry to not care
						has_trait = arrogant #How dare they!
						has_trait = craven #Aaahhh, scary!
					}
				}

				desc = ep2_tournament_events.4008.a.success

				send_interface_toast = {
					title = ep2_tournament_events.4008.a.success
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = horse
							value = tournament_hastiludes_xp_gain_medium_value
						}
					}

					stress_impact = {
						base = miniscule_stress_impact_loss
					}
				}
			}
			25 = { #You lose

				desc = ep2_tournament_events.4008.a.failure

				send_interface_toast = {
					title = ep2_tournament_events.4008.a.failure
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

					stress_impact = {
						base = miniscule_stress_impact_gain
					}
				}
			}
			15 = { #You get injured by the crowd throwing stuff at you		
				modifier = {
					add = 10
					has_trait = sadistic
				}
				modifier = {
					add = 10
					has_trait = callous
				}
				modifier = {
					add = 15
					OR = {
						has_trait = murderer
						has_trait = incestuous
						has_trait = sodomite
						has_trait = cannibal
						has_trait = deviant
						has_trait = kinslayer
						has_trait = adulterer
						has_trait = fornicator
						has_trait = excommunicated
					}
				}

				desc = ep2_tournament_events.4008.a.criticalfailure

				send_interface_toast = {
					title = ep2_tournament_events.4008.a.criticalfailure
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

					add_prestige = minor_prestige_loss

					increase_wounds_effect = { REASON = fight }

					random = {
						chance = 25
						if = {
							limit = {
								NOT = {
									has_trait = scarred
								}
							}
							add_trait = scarred
						}
						add_trait_xp = {
							trait = scarred
							value = {
								integer_range = {
									min = 5
									max = 25
								}
							}
						}
					}

					stress_impact = {
						base = minor_stress_impact_gain
					}
				}
			}
		}
		ai_chance = {
			base = 100
	
		}
	}

	# Throw the contest
	option = {
		name = ep2_tournament_events.4008.b
		
		add_prestige = minor_prestige_loss

		tournament_contest_versus_resignation_effect = { RESIGNER = root CONTEST = joust SKILL = horse }

		stress_impact = {
			brave = medium_stress_impact_gain
			craven = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				has_trait = brave
			}
		}
	}
}

# Lend opponent a lance
ep2_tournament_events.4009 = {
	type = activity_event
	title = ep2_tournament_events.4009.t
	desc = ep2_tournament_events.4009.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	cooldown = { months = 2 }

	left_portrait = {
		character = root
		animation = jockey_lance_tilted
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = jockey_idle
	}

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_horse_neigh"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = joust ID = 4009 }
	}

	# Mock them
	option = {
		name = ep2_tournament_events.4009.a
		trigger = {
			OR = {
				has_trait = sadistic
				has_trait = arrogant
			}
		}
		
		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		progress_towards_rival_effect = {
			REASON = rival_contest_mockery
			CHARACTER = scope:hapless_knight
			OPINION = default_rival_opinion
		}

		stress_impact = {
			sadistic = minor_stress_impact_loss
			arrogant = minor_stress_impact_loss
			just = medium_stress_impact_loss
			gregarious = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = just
					has_trait = gregarious
				}
			}		
		}
	}
	# Lend them a lance
	option = {
		name = ep2_tournament_events.4009.b

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

		add_prestige = medium_prestige_gain

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_lent_lance_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}

	 	reverse_add_opinion = {
	 		target = scope:versus_contestant
	 		modifier = grateful_opinion
	 		opinion = 30
	 	}

		stress_impact = {
			compassionate = minor_stress_impact_loss
			generous = minor_stress_impact_loss
			just = minor_stress_impact_loss
			arbitrary = minor_stress_impact_gain
			callous = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {				
					has_trait = callous
					has_trait = arbitrary
				}
			}
		}
	}
	# Continue
	option = {
		name = ep2_tournament_events.4009.c

		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		add_prestige = minor_prestige_loss

		stress_impact = {
			compassionate = minor_stress_impact_gain
			generous = minor_stress_impact_gain
			just = minor_stress_impact_gain
			arbitrary = minor_stress_impact_loss
			callous = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = generous
					has_trait = just
				}
			}
		}
	}
}

#################
###  RECITAL  ###
##################

# Previous entrant's verse is similar to yours
ep2_tournament_events.5501 = {
	type = activity_event
	title = ep2_tournament_events.5501.t
	desc = ep2_tournament_events.5501.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = {
		character = scope:enemy
		animation = scheme
	}
	cooldown = { years = 1 }

	trigger = {
		exists = var:contest_aptitude
		scope:activity = {
			any_guest_subset_current_phase = {
				name = qualified
				this = root
			}
			any_guest_subset_current_phase = {
				name = qualified
				contest_event_general_contestant_valid_trigger = yes
				this != root
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_positive_reaction"
		scope:activity = {
			random_guest_subset_current_phase = {
				name = qualified
				limit = { contest_event_general_contestant_valid_trigger = yes }
				save_scope_as = enemy
			}
		}
		tournament_pivotal_flavor_variable_effect = { CONTEST = recital ID = 5501 }
	}

	# Show them it's all about the delivery
	option = {
		name = ep2_tournament_events.5501.a
		trigger = {
			OR = {
				has_trait = lifestyle_poet
				has_trait = education_learning_3
				has_trait = education_learning_4
				has_trait = education_learning_5
				has_trait = shrewd
			}
		}
		
		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = wit
				value = tournament_hastiludes_xp_gain_medium_value
			}
		}

		stress_impact = {
			base = miniscule_stress_impact_loss
			arrogant = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
			}		
		}
	}

	# Improvise
	option = {
		name = ep2_tournament_events.5501.b

		random_list = {
			9 = { #It goes well
				
				modifier = { #Skill buff
					add = 15
					diplomacy > high_skill_rating
				}

				modifier = { #Big buff if you're a poet
					add = 15
					has_trait = lifestyle_poet
				}

				modifier = { #More diplo!
					add = 10
					OR = {
						has_trait = education_learning_3
						has_trait = education_learning_4
						has_trait = education_learning_5
					}
				}

				modifier = { #Being learned helps
					add = 5
					learning > high_skill_rating
				}

				modifier = { #Always good to be an extrovert in these situations
					add = 5
					has_trait = gregarious
				}

				modifier = { #Blanket coverage for smarts
					add = 5
					OR = {
						has_trait = shrewd
						has_trait = intellect_good
					}
				}

				desc = ep2_tournament_events.5501.b.success

				send_interface_toast = {
					title = ep2_tournament_events.5501.b.success
					left_icon = root
					right_icon = scope:enemy

					activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = wit
							value = tournament_hastiludes_xp_gain_minor_value
						}
					}

					stress_impact = {
						base = miniscule_stress_impact_loss
					}
				}
			}
			10 = { #It doesn't go well

				desc = ep2_tournament_events.5501.b.failure

				send_interface_toast = {
					title = ep2_tournament_events.5501.b.failure
					left_icon = root
					right_icon = scope:enemy

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

					stress_impact = {
						base = miniscule_stress_impact_gain
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
	# Protest
	option = {
		name = ep2_tournament_events.5501.c

		add_prestige = minor_prestige_loss

		duel = {
			skills = { diplomacy intrigue }
			target = scope:enemy
			#They DID plan it!
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.5501.c.success
					left_icon = root
					right_icon = scope:enemy
					activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
					add_prestige = minor_prestige_gain
				}

				desc = ep2_tournament_events.5501.c.success

				stress_impact = {
					base = miniscule_stress_impact_loss
					paranoid = major_stress_impact_loss #I KNEW IT!
					just = minor_stress_impact_loss
				}
			}
			#You look like a fool
			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.5501.c.failure
					left_icon = root
					right_icon = scope:enemy
					activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }
					add_prestige = minor_prestige_loss
				}

				desc = ep2_tournament_events.5501.c.failure

				stress_impact = {
					base = miniscule_stress_impact_gain
					paranoid = medium_stress_impact_gain
					just = medium_stress_impact_gain
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}
}

# Contestant plagiarises verse
ep2_tournament_events.5502 = {
	type = activity_event
	title = ep2_tournament_events.5502.t
	desc = {
		desc = ep2_tournament_events.5502.start
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:contestant = {
						has_friendly_relationship_trigger = {
							CHARACTER = root
						}
						culture != scope:activity.activity_location.culture
					}
				}
				desc = ep2_tournament_events.5502.friend
			}
			triggered_desc = {
				trigger = {
					scope:contestant = {
						culture != scope:activity.activity_location.culture
					}
				}
				desc = ep2_tournament_events.5502.culture
			}
		}
		desc = ep2_tournament_events.5502.end
	}
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = {
		character = scope:contestant
		animation = shock
	}
	cooldown = { years = 1 }

	trigger = {
		scope:activity = {
			any_guest_subset_current_phase = {
				name = qualified
				contest_event_general_contestant_valid_trigger = yes
				culture != scope:activity.activity_location.culture
				this != root
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_negative_reaction"
		scope:activity = {
			random_guest_subset_current_phase = {
				name = qualified
				limit = {
					contest_event_general_contestant_valid_trigger = yes
					culture != scope:activity.activity_location.culture
				}
				save_scope_as = contestant
			}
		}
		tournament_pivotal_flavor_variable_effect = { CONTEST = recital ID = 5502 }
		scope:activity = {
			add_activity_log_entry = {
				key = tournament_plagiarism_log
				tags = { good }
				score = 5
				character = root
				target = scope:versus_contestant
			}
		}
	}

	# This isn't their fault!
	option = {
		name = ep2_tournament_events.5502.a

		duel = {
			skills = { diplomacy }
			value = decent_skill_rating

			#You convince the crowd
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.5502.c.success
					left_icon = root
					right_icon = scope:contestant

					scope:contestant = {
						activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

						add_opinion = {
							target = root
							modifier = grateful_opinion
							opinion = 35
						}
					}
				}

				desc = ep2_tournament_events.5502.c.success

				stress_impact = {
					base = miniscule_stress_impact_loss
					gregarious = miniscule_stress_impact_loss
					just = minor_stress_impact_loss
					lazy = minor_stress_impact_gain
					callous = medium_stress_impact_gain
				}
			}

			#The crowd turn against them
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.5502.c.failure
					left_icon = root
					right_icon = scope:contestant

					scope:contestant = {
						activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }
					}
				}

				desc = ep2_tournament_events.5502.c.failure

				stress_impact = {
					base = miniscule_stress_impact_gain
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}

	# Join in with the booing
	option = {
		name = ep2_tournament_events.5502.b

		scope:contestant = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
			add_prestige = minor_prestige_loss
		}

		progress_towards_rival_effect = {
			REASON = rival_recital_booing
			CHARACTER = scope:contestant
			OPINION = default_rival_opinion
		}

		stress_impact = {
			gregarious = minor_stress_impact_gain
			just = medium_stress_impact_gain
			lazy = miniscule_stress_impact_loss
			callous = miniscule_stress_impact_loss
			ambitious = miniscule_stress_impact_loss
			honest = major_stress_impact_gain
			deceitful = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {
					has_trait = just
					has_trait = honest
				}
			}
		}
	}

	# Leave the contestant to suffer
	option = {
		name = ep2_tournament_events.5502.c

		scope:contestant = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }
		}

		stress_impact = {
			gregarious = miniscule_stress_impact_gain
			just = miniscule_stress_impact_gain
			honest = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				has_trait = honest

			}
		}
	}
}

# Stage fright
ep2_tournament_events.5503 = {
	type = activity_event
	title = ep2_tournament_events.5503.t
	desc = {
		desc = ep2_tournament_events.5503.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						has_trait = avaricious
						has_trait = education_stewardship_3
						has_trait = education_stewardship_4
						has_trait = education_stewardship_5
					}
				}
				desc = ep2_tournament_events.5503.rich
			}
			triggered_desc = {
				trigger = {
					OR = {
						has_trait = seducer
						AND = {
							has_trait = deviant
							has_trait = lustful
						}
					}
				}
				desc = ep2_tournament_events.5503.seducer
			}
			triggered_desc = {
				desc = ep2_tournament_events.5503.fallback
			}
		}
	}
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = shock
	}
	cooldown = { years = 1 }

	trigger = {
		exists = var:contest_aptitude
		scope:activity = {
			any_guest_subset_current_phase = {
				name = qualified
				this = root
			}
			any_guest_subset_current_phase = {
				name = qualified
				contest_event_general_contestant_valid_trigger = yes
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_surprise_reaction"
		scope:activity = {
			random_guest_subset_current_phase = {
				name = qualified
				limit = { contest_event_general_contestant_valid_trigger = yes }
				save_scope_as = contestant
			}
		}
		tournament_pivotal_flavor_variable_effect = { CONTEST = recital ID = 5503 }
	}

	# Fall back on a stock poem
	option = {
		name = ep2_tournament_events.5503.a
		trigger = {
			has_trait = lifestyle_poet
		}

		flavor = ep2_tournament_events.5503.a.tt

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = wit
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}

		stress_impact = {
			base = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 200
		}
	}

	# Behold! Free coin!
	option = {
		name = ep2_tournament_events.5503.b

		trigger = {
			OR = {
				has_trait = avaricious
				has_trait = education_stewardship_3
				has_trait = education_stewardship_4
				has_trait = education_stewardship_5
			}
		}

		flavor = ep2_tournament_events.5503.b.tt

		remove_short_term_gold = tiny_gold_value

		stress_impact = {
			base = miniscule_stress_impact_loss
			greedy = major_stress_impact_gain
			generous = minor_stress_impact_loss
			just = minor_stress_impact_gain
		}

		ai_chance = {
			base = 200
		}
	}

	# Give the crowd what they want
	option = {
		name = ep2_tournament_events.5503.c

		trigger = {
			OR = {
				has_trait = seducer
				AND = {
					has_trait = deviant
					has_trait = lustful
				}
			}
		}

		flavor = ep2_tournament_events.5503.c.tt

		if = {
			limit = {
				faith = {
					NOR = {
						trait_is_virtue = lustful
						trait_is_sin = lustful
					}
				}
			}
			add_prestige = minor_prestige_loss
			add_character_modifier = {
				modifier = tournament_performative_sensuousness_modifier
				years = 5
			}
		}
		else_if = {
			limit = {
				faith = {
					trait_is_sin = lustful
				}
			}
			add_piety = medium_piety_loss
			add_character_modifier = {
				modifier = tournament_performative_sensuousness_modifier
				years = 10
			}
		}

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

		ai_chance = {
			base = 200
		}
	}

	# Distract the crowd
	option = {
		name = ep2_tournament_events.5503.d

		duel = {
			skills = { intrigue diplomacy }
			value = decent_skill_rating
			#You successfully distract the crowd
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.5503.d.win
					left_icon = root
					activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }
				}

				desc = ep2_tournament_events.5503.d.win

				stress_impact = {
					base = miniscule_stress_impact_loss
					deceitful = minor_stress_impact_loss
				}
			}
			#The crowd aren't fooled
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.5503.d.lose
					left_icon = root
					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
				}

				desc = ep2_tournament_events.5503.d.lose

				stress_impact = {
					base = minor_stress_impact_gain
					arrogant = minor_stress_impact_gain
					shy = minor_stress_impact_gain
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}

	# Try and fail
	option = {
		name = ep2_tournament_events.5503.e

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

		stress_impact = {
			base = miniscule_stress_impact_gain
			arrogant = minor_stress_impact_gain
			shy = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}
}

# A downpour begins
ep2_tournament_events.5504 = {
	type = activity_event
	title = ep2_tournament_events.5504.t
	desc = ep2_tournament_events.5504.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = worry
	}
	cooldown = { years = 1 }

	trigger = {
		exists = var:contest_aptitude
		scope:activity = {
			any_guest_subset_current_phase = {
				name = qualified
				this = root
			}
			activity_location = { is_drylands_or_desert_trigger = no }
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_negative_reaction"
		tournament_pivotal_flavor_variable_effect = { CONTEST = recital ID = 5504 }
		scope:activity = {
			add_activity_log_entry = {
				key = tournament_downpour_begins_log
				tags = { good }
				score = 5
				character = root
			}
		}
	}

	# Continue
	option = {
		name = ep2_tournament_events.5504.a

		duel = {
			skills = { diplomacy }
			value = decent_skill_rating

			50 = { #You utilise the rain successfully
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				modifier = { #Skill buff
					add = 15
					diplomacy > high_skill_rating
				}

				modifier = { #Big buff if you're a poet
					add = 15
					has_trait = lifestyle_poet
				}

				modifier = { #More diplo!
					add = 10
					OR = {
						has_trait = education_learning_3
						has_trait = education_learning_4
						has_trait = education_learning_5
					}
				}

				modifier = { #Being learned helps
					add = 5
					learning > high_skill_rating
				}

				modifier = { #Not scared of a bit of thunder
					add = 5
					has_trait = brave
				}

				modifier = { #Blanket coverage for smarts
					add = 5
					OR = {
						has_trait = shrewd
						has_trait = intellect_good
					}
				}

				send_interface_toast = {
					title = ep2_tournament_events.5504.a.success
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = wit
							value = tournament_hastiludes_xp_gain_medium_value
						}
					}
				}

				desc = ep2_tournament_events.5504.a.success

				stress_impact = {
					base = miniscule_stress_impact_loss
					brave = miniscule_stress_impact_loss
				}
			}

			50 = { #You are drowned out by the downpour
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				modifier = { #Skill debuff
					add = -10
					diplomacy < high_skill_rating
				}

				modifier = { #Aaahhhh, loud noises!
					add = -5
					has_trait = craven
				}

				send_interface_toast = {
					title = ep2_tournament_events.5504.a.failure
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }
				}


				desc = ep2_tournament_events.5504.a.failure

				stress_impact = {
					base = miniscule_stress_impact_gain
					craven = medium_stress_impact_gain
				}
			}
		}


		ai_chance = {
			base = 100
		}
	}

	# Run away scared
	option = {
		name = ep2_tournament_events.5504.b

		activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

		stress_impact = {
			brave = medium_stress_impact_gain
			shy = miniscule_stress_impact_loss
			craven = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				has_trait = brave
			}	
		}
	}
}

# You see a chance to insult an opponent
ep2_tournament_events.5505 = {
	type = activity_event
	title = ep2_tournament_events.5505.t
	desc = {
		desc = ep2_tournament_events.5505.desc
		first_valid = {
			triggered_desc = {
				trigger = { 
					scope:enemy = {
						AND = {
							is_female = no
							OR = {
								has_trait = chaste
								has_trait = celibate
							}
						}
					}
				}
				desc = ep2_tournament_events.5505.start.malevirgin
			}
			triggered_desc = {
				trigger = { 
					scope:enemy = {
						AND = {
							is_female = yes
							OR = {
								has_trait = chaste
								has_trait = celibate
							}
						}
					}
				}
				desc = ep2_tournament_events.5505.start.femalevirgin
			}
			triggered_desc = {
				trigger = { 
					scope:enemy = {
						age > 60
					}
				}
				desc = ep2_tournament_events.5505.start.old
			}
			triggered_desc = {
				trigger = { 
					scope:enemy = {
						current_weight > 50
					}
				}
				desc = ep2_tournament_events.5505.start.fat
			}
			triggered_desc = {
				trigger = { 
					scope:enemy = {
						has_trait = compassionate
					}
					NOT = {
						has_trait = compassionate
					}
				}
				desc = ep2_tournament_events.5505.start.soft
			}
			triggered_desc = {
				trigger = { 
					has_trait = compassionate
				}
				desc = ep2_tournament_events.5505.start.compassionate
			}
			triggered_desc = {
				desc = ep2_tournament_events.5505.start.fallback
			}
		}
		desc = ep2_tournament_events.5505.end
	}
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:enemy
		animation = anger
	}
	cooldown = { years = 1 }

	trigger = {
		exists = var:contest_aptitude
		scope:activity = {
			any_guest_subset_current_phase = {
				name = qualified
				this = root
			}
			any_guest_subset_current_phase = {
				name = qualified
				contest_event_general_contestant_valid_trigger = yes
				this != root
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Ambience/2D/ep2_amb_2d_crowd_surprise_reaction"
		scope:activity = {
			random_guest_subset_current_phase = {
				name = qualified
				limit = { contest_event_general_contestant_valid_trigger = yes }
				save_scope_as = enemy
			}
		}
		tournament_pivotal_flavor_variable_effect = { CONTEST = recital ID = 5505 }
	}

	# Call them a virgin
	option = {
		name = ep2_tournament_events.5505.maidenless
		trigger = {
			scope:enemy = {
				OR = {
					has_trait = chaste
					has_trait = celibate
				}
			}
		}
		
		add_internal_flag = special

		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = wit
				value = tournament_hastiludes_xp_gain_medium_value
			}
		}

		progress_towards_rival_effect = {
			REASON = rival_recital_insult
			CHARACTER = scope:enemy
			OPINION = default_rival_opinion
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_insulted_opponent_log
				tags = { good }
				score = 5
				character = root
				target = scope:enemy
			}
		}

		stress_impact = {
			chaste = medium_stress_impact_gain
			celibate = medium_stress_impact_gain
			sadistic = minor_stress_impact_loss
			arrogant = minor_stress_impact_loss
			gregarious = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = gregarious
					has_trait = chaste
					has_trait = celibate
				}
			}		
		}
	}

	# Call them old
	option = {
		name = ep2_tournament_events.5505.old
		trigger = {
			scope:enemy = {
				age > 60
			}
		}

		add_internal_flag = special
		
		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = wit
				value = tournament_hastiludes_xp_gain_medium_value
			}
		}

		progress_towards_rival_effect = {
			REASON = rival_recital_insult
			CHARACTER = scope:enemy
			OPINION = default_rival_opinion
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_insulted_opponent_log
				tags = { good }
				score = 5
				character = root
				target = scope:enemy
			}
		}

		stress_impact = {
			sadistic = minor_stress_impact_loss
			arrogant = minor_stress_impact_loss
			gregarious = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = gregarious
				}
			}		
		}
	}

	# Call them fat
	option = {
		name = ep2_tournament_events.5505.fat
		trigger = {
			scope:enemy = {
				current_weight > 50
			}
			NOT = {
				current_weight > 50
			}
		}

		add_internal_flag = special
		
		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = wit
				value = tournament_hastiludes_xp_gain_medium_value
			}
		}

		progress_towards_rival_effect = {
			REASON = rival_recital_insult
			CHARACTER = scope:enemy
			OPINION = default_rival_opinion
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_insulted_opponent_log
				tags = { good }
				score = 5
				character = root
				target = scope:enemy
			}
		}

		stress_impact = {
			sadistic = minor_stress_impact_loss
			arrogant = minor_stress_impact_loss
			gregarious = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = gregarious
				}
			}		
		}
	}

	# Try, and fail, to insult them
	option = {
		name = ep2_tournament_events.5505.idiot
		trigger = {
			OR = {
				has_trait = dull
				has_trait = intellect_bad
			}
		}

		add_internal_flag = special
		
		activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }

		reverse_add_opinion = {
			target = scope:enemy
			modifier = tournament_confused_opinion
			opinion = -5
		}

		stress_impact = {
			base = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}

	# Imply you'll flay them
	option = {
		name = ep2_tournament_events.5505.torturer
		trigger = {
			has_trait = torturer
		}

		add_internal_flag = special
		
		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		progress_towards_rival_effect = {
			REASON = rival_recital_insult
			CHARACTER = scope:enemy
			OPINION = default_rival_opinion
		}

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = wit
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}

		reverse_add_opinion = {
			target = scope:enemy
			modifier = disgusted_opinion
			opinion = -40
		}

		every_close_family_member = {
			custom = ep2_tournament_events.5505.opinion.tt
			limit = {
				NOT = {
					has_trait = sadistic
				}
				location = root.location
			}
			add_opinion = {
				target = root
				opinion = -20
				modifier = disgusted_opinion
			}
		}

		stress_impact = {
			base = minor_stress_impact_loss
			sadistic = medium_stress_impact_loss
			gregarious = major_stress_impact_gain
			compassionate = major_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = gregarious
				}
			}		
		}
	}

	# Be nice
	option = {
		name = ep2_tournament_events.5505.compassionate

		trigger = {
			has_trait = compassionate
		}
		
		add_internal_flag = special

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

		progress_towards_friend_effect = {
			REASON = friend_recital_compliment
			CHARACTER = scope:enemy
			OPINION = default_friend_opinion
		}

		if = {
			limit = {
				has_trait = tourney_participant
			}
			add_trait_xp = {
				trait = tourney_participant
				track = wit
				value = tournament_hastiludes_xp_gain_minor_value
			}
		}

		stress_impact = {
			sadistic = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
			compassionate = minor_stress_impact_loss
			gregarious = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = sadistic
					has_trait = arrogant
				}
			}		
		}
	}

	# Insult them
	option = {
		name = ep2_tournament_events.5505.fallback

		activity_tournament_change_contestant_score_effect = { SCORE = increase_minor }

		progress_towards_rival_effect = {
			REASON = rival_recital_insult
			CHARACTER = scope:enemy
			OPINION = default_rival_opinion
		}

		stress_impact = {
			compassionate = medium_stress_impact_gain
			humble = medium_stress_impact_gain
			gregarious = minor_stress_impact_gain
		}

		scope:activity = {
			add_activity_log_entry = {
				key = tournament_insulted_opponent_log
				tags = { good }
				score = 5
				character = root
				target = scope:enemy
			}
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = gregarious
				}
			}		
		}
	}

	# ...never mind
	option = {
		name = ep2_tournament_events.5505.getout
		
		activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

		stress_impact = {
			sadistic = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
			compassionate = minor_stress_impact_loss
			gregarious = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = sadistic
					has_trait = arrogant
				}
			}		
		}
	}
}

#########################
###   HONSE RANCING   ###
#########################

# Choose your ~~fighter~~ jockey
ep2_tournament_events.4500 = {
	type = activity_event
	title = ep2_tournament_events.4500.t
	desc = {
		desc = ep2_tournament_events.4500.desc
		triggered_desc = { # Knight
			trigger = {
				scope:jockey1 = {
					is_knight_of = root
				}
			}
			desc = ep2_tournament_events.4500.knight
		}
		triggered_desc = { # Guest
			trigger = {
				scope:jockey1 = {
					is_knight_of = root
				}
				scope:jockey2 = { is_in_the_same_court_as_or_guest = root }
			}
			desc = ep2_tournament_events.4500.guest
		}
		triggered_desc = {
			trigger = {
				scope:jockey1 = {
					is_knight_of = root
				}
				scope:jockey2 = {
					is_in_the_same_court_as_or_guest = root
				}
			}
			desc = ep2_tournament_events.4500.nobody
		}
		triggered_desc = { # Nobody
			trigger = {
				NOR = {
					scope:jockey1 = {
						is_knight_of = root
					}
					scope:jockey2 = {
						is_in_the_same_court_as_or_guest = root
					}
				}
			}
			desc = ep2_tournament_events.4500.fallback
		}
	}
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = scope:jockey1
	lower_right_portrait = scope:jockey2
	lower_left_portrait = scope:jockey3

	trigger = {
		is_ai = no
	}

	immediate = {
		#Knight
		if = {
			limit = {
				any_knight = {
					location = root.location
					is_participant_in_activity = scope:activity
					is_adult = yes
					is_landed = no
					is_healthy = yes
					NOT = {
						is_in_guest_subset = { name = qualified }
					}
				}
			}
			random_knight = {
				limit = {
					location = root.location
					is_participant_in_activity = scope:activity
					is_adult = yes
					is_landed = no
					is_healthy = yes
					NOT = {
						is_in_guest_subset = { name = qualified }
					}
				}
				weight = {
					base = 1
					modifier = { add = prowess }
				}
				save_scope_as = jockey1
			}
		}
		else = {
			create_character = {
				template = tournament_locale_character
				culture = root.location.culture
				faith = root.location.faith
				location = root.location
				gender_female_chance = root_soldier_female_chance
				save_scope_as = jockey1
			}
			scope:jockey1 = {
				add_character_flag = generated_jockey
				add_to_list = potential_jockeys
			}
		}
		# Courtiers/Guests
		if = {
			limit = {
				any_courtier_or_guest = {
					location = root.location
					is_participant_in_activity = scope:activity
					is_adult = yes
					is_healthy = yes
					NOR = {
						is_in_guest_subset = { name = qualified }
						this = scope:jockey1
						is_spouse_of = root
						is_concubine = yes
					}
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:host }
				}
			}
			random_courtier_or_guest = {
				limit = {
					location = root.location
					is_participant_in_activity = scope:activity
					is_adult = yes
					is_healthy = yes
					NOR = {
						is_in_guest_subset = { name = qualified }
						this = scope:jockey1
						is_spouse_of = root
						is_concubine = yes
					}
				}
				weight = {
					base = 1
					modifier = { add = prowess }
				}
				save_scope_as = jockey2
			}
		}
		else = {
			create_character = {
				template = tournament_locale_character
				culture = root.location.culture
				faith = root.location.faith
				location = root.location
				gender_female_chance = root_soldier_female_chance
				save_scope_as = jockey2
			}
			scope:jockey2 = {
				add_character_flag = generated_jockey
				add_to_list = potential_jockeys
			}
		}
		#Randos
		create_character = {
			template = tournament_locale_character
			culture = root.location.culture
			faith = root.location.faith
			location = root.location
			gender_female_chance = root_soldier_female_chance
			save_scope_as = jockey3
		}
		scope:jockey3 = {
			add_character_flag = generated_jockey
			add_to_list = potential_jockeys
		}
	}

	# Choose Jockey 1
	option = {
		name = ep2_tournament_events.4500.a
		flavor = ep2_tournament_events.4500.knight.tt
		scope:jockey1 = {
			tournament_choose_jockey_effect = yes
			accolade_medium_glory_gain_with_checks_effect = yes
		}
		ai_chance = {
			base = 1
			modifier = { add = scope:jockey1.contest_horse_aptitude_value }
		}
	}
	# Choose Jockey 2
	option = {
		name = ep2_tournament_events.4500.b
		flavor = ep2_tournament_events.4500.guest.tt
		scope:jockey2 = {
			tournament_choose_jockey_effect = yes
			accolade_medium_glory_gain_with_checks_effect = yes
		}
		ai_chance = {
			base = 1
			modifier = { add = scope:jockey2.contest_horse_aptitude_value }
		}
	}
	# Choose Jockey 3
	option = {
		name = ep2_tournament_events.4500.c
		flavor = ep2_tournament_events.4500.nobody.tt
		scope:jockey3 = {
			tournament_choose_jockey_effect = yes
			accolade_medium_glory_gain_with_checks_effect = yes
		}
		ai_chance = {
			base = 1
			modifier = { add = scope:jockey3.contest_horse_aptitude_value }
		}
	}

	after = {
		# Cull spare jockeys
		every_in_list = {
			list = potential_jockeys
			limit = {
				has_character_flag = generated_jockey
				NOT = { root.var:horse_race_jockey ?= this }
			}
			silent_disappearance_effect = yes
		}
	}
}

#########################
###   EXTRA ARCHERY   ###
#########################

# You try to liven up the Contest
# Archery
ep2_tournament_events.6501 = {
	type = activity_event
	title = ep2_tournament_events.6501.t
	desc = ep2_tournament_events.6501.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = bow_closed
	}
	cooldown = { years = 1 }

	trigger = {
		exists = var:contest_aptitude
		scope:activity = {
			any_guest_subset_current_phase = {
				name = qualified
				this = root
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_arrow_flyby"
		tournament_pivotal_flavor_variable_effect = { CONTEST = archery ID = 6501 }
	}

	# Stand on one leg a fencepost
	option = {
		name = ep2_tournament_events.6501.a
		trigger = {
			has_trait = arrogant
		}

		duel = {
			skill = prowess
			value = high_skill_rating
			#You succeed!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				modifier = { # I'm used to this :sunglasses:
					factor = 2
					has_trait = one_legged
				}

				send_interface_toast = {
					title = ep2_tournament_events.6501.a.tt.win
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = increase_major }

					add_prestige = major_prestige_value

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = bow
							value = tournament_hastiludes_xp_gain_major_value
						}
					}
				}
				if = {
					limit = {
						OR = {
							location = {
								OR = {
									geographical_region = world_europe
									geographical_region = world_asia_minor
								}
							}
							OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
						}
					}
					give_nickname = nick_monopod
				}
				else = {
					give_nickname = nick_sure_footed
				}

				desc = ep2_tournament_events.6501.a.tt.win

				stress_impact = {
					arrogant = medium_stress_impact_loss
					shy = medium_stress_impact_gain
					brave = minor_stress_impact_loss
					stubborn = minor_stress_impact_loss
				}
			}
			#You slip and fall
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.6501.a.tt.lose
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

					increase_wounds_effect = { REASON = wounds }
				}

				desc = ep2_tournament_events.6501.a.tt.lose

				stress_impact = {
					base = minor_stress_impact_gain
					arrogant = major_stress_impact_gain
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = tournament_archery_livened_log
				tags = { good }
				score = 5
				character = root
			}
		}
		stress_impact = {
			craven = minor_stress_impact_gain
			shy = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 30
		}
	}

	# Try to fire an arrow blindfolded
	option = {
		name = ep2_tournament_events.6501.b
		duel = {
			skill = prowess 
			value = high_skill_rating
			#You succeed!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.6501.b.tt.win
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

					add_prestige = medium_prestige_value

					if = {
						limit = {
							has_trait = tourney_participant
						}
						add_trait_xp = {
							trait = tourney_participant
							track = bow
							value = tournament_hastiludes_xp_gain_medium_value
						}
					}
				}

				desc = ep2_tournament_events.6501.b.tt.win

				stress_impact = {
					arrogant = minor_stress_impact_loss
					shy = minor_stress_impact_gain
					brave = miniscule_stress_impact_loss
					stubborn = miniscule_stress_impact_loss
				}
			}
			#You slip and fall
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}

				send_interface_toast = {
					title = ep2_tournament_events.6501.a.tt.lose
					left_icon = root

					activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

					add_prestige = minor_prestige_loss
				}

				desc = ep2_tournament_events.6501.b.tt.lose

				stress_impact = {
					arrogant = medium_stress_impact_gain
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = tournament_archery_livened_log
				tags = { good }
				score = 5
				character = root
			}
		}
		ai_chance = {
			base = 100
		}
	}

	# Leave it
	option = {
		name = ep2_tournament_events.6501.c
		stress_impact = {
			stubborn = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}
}

# A competitor injures themself
# Joust
ep2_tournament_events.6502 = {
	type = activity_event
	title = ep2_tournament_events.6502.t
	desc = ep2_tournament_events.6502.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:versus_contestant
		animation = loss_1
	}
	cooldown = { years = 1 }

	trigger = {
		contest_versus_player_vs_ai_trigger = yes
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_male_grunts"
		contest_versus_player_vs_ai_scope_effect = yes
		tournament_pivotal_flavor_variable_effect = { CONTEST = joust ID = 6502 }
		random_court_position_holder = {
			type = court_physician_court_position
			save_scope_as = physician
		}
		scope:activity = {
			add_activity_log_entry = {
				key = tournament_joust_injury_log
				tags = { bad }
				score = 5
				character = scope:versus_contestant
			}
		}
	}

	# Slyly delight in their fall and injure them further
	option = {
		name = ep2_tournament_events.6502.a
		trigger = {
			OR = {
				has_trait = sadistic
				has_trait = callous
			}
		}

		flavor = ep2_tournament_events.6502.a.tt

		activity_tournament_change_contestant_score_effect = { SCORE = increase_medium }

		scope:versus_contestant = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
			increase_wounds_no_death_effect = { REASON = wounds }
			if = {
				limit = {
					NOT = {
						has_trait = scarred
					}
				}
				add_trait = scarred
			}
			add_trait_xp = {
				trait = scarred
				value = {
					integer_range = {
						min = 5
						max = 65
					}
				}
			}
		}

		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = hurt_opinion
			opinion = -40
		}

		stress_impact = {
			sadistic = miniscule_stress_impact_loss
			callous = miniscule_stress_impact_loss
			just = medium_stress_impact_gain
			gregarious = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				factor = 0
				OR = {
					has_trait = just
					has_trait = gregarious
				}
			}		
		}
	}

	# Fetch your doctor
	option = {
		name = ep2_tournament_events.6502.b

		trigger = {	
			court_physician_available_trigger = yes
		}

		add_prestige = minor_prestige_gain

		random_list = {
			#Your physician does well
			2 = {
				modifier = {
					add = 5
					scope:physician = {
						learning > average_skill_rating
					}
				}
				modifier = {
					add = 10
					scope:physician = {
						learning > high_skill_rating
					}
				}
				modifier = {
					add = 10
					scope:physician = {
						has_trait = lifestyle_herbalist
					}
				}
				modifier = {
					add = 20
					scope:physician = {
						has_trait = lifestyle_physician
					}
				}
				desc = ep2_tournament_events.6502.b.tt.success

				send_interface_toast = {
					title = ep2_tournament_events.6502.b.tt.success
					left_icon = root
					right_icon = scope:versus_contestant

					reverse_add_opinion = {
						target = scope:versus_contestant
						modifier = grateful_opinion
						opinion = 30
					}
				}
			}
			#Your physician doesn't do so hot
			10 = {
				modifier = {
					add = 5
					scope:physician = {
						learning < average_skill_rating
					}
				}
				modifier = {
					add = 10
					scope:physician = {
						learning < high_skill_rating
					}
				}
				desc = ep2_tournament_events.6502.b.tt.failure
				send_interface_toast = {
					title = ep2_tournament_events.6502.b.tt.failure
					left_icon = root
					right_icon = scope:versus_contestant

					scope:competitor = {
						if = {
							limit = {
								NOT = {
									scope:versus_contestant = {
										has_trait = scarred
									}
								}
							}
							add_trait = scarred
						}
						add_trait_xp = {
			                trait = scarred
			                value = {
			                    integer_range = {
			                        min = 5
			                        max = 25
			                    }
			                }
			            }
					}
				}
			}
		}

		scope:versus_contestant = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }
		}

		reverse_add_opinion = {
			target = scope:versus_contestant
			modifier = grateful_opinion
			opinion = 20
		}

		stress_impact = {
			compassionate = miniscule_stress_impact_loss
			generous = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
			callous = minor_stress_impact_gain
			arbitrary = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			
			modifier = {
				factor = 0
				OR = {				
					has_trait = callous
					has_trait = arbitrary
				}
			}
		}
	}

	# Help them up
	option = {
		name = ep2_tournament_events.6502.c

		trigger = {
			NOT = {
				has_trait = callous
				has_trait = sadistic
			}
		}

		scope:versus_contestant = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

			increase_wounds_no_death_effect = { REASON = wounds }
		}

		add_prestige = minor_prestige_gain

		stress_impact = {
			compassionate = miniscule_stress_impact_loss
			generous = miniscule_stress_impact_loss
			just = miniscule_stress_impact_loss
			arbitrary = minor_stress_impact_gain
			callous = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}

	# Shake your head and move on
	option = {
		name = ep2_tournament_events.6502.d

		scope:versus_contestant = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

			increase_wounds_no_death_effect = { REASON = wounds }

			if = {
				limit = {
					NOT = {
						has_trait = scarred
					}
				}
				add_trait = scarred
			}
			add_trait_xp = {
				trait = scarred
				value = {
					integer_range = {
						min = 5
						max = 25
					}
				}
			}
		}

		stress_impact = {
			compassionate = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}
}

# A wayward arrow hits a bystander
# Archery
ep2_tournament_events.6503 = {
	type = activity_event
	title = ep2_tournament_events.6503.t
	desc = ep2_tournament_events.6503.desc
	window = widget_activity_locale_fullscreen_event
	theme = tournament_contest
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:competitor1
		animation = shame
	}
	lower_right_portrait = {
		character = scope:competitor2
	}
	cooldown = { years = 1 }

	trigger = {
		scope:activity = {
			any_guest_subset_current_phase = {
				count >= 2
				name = qualified			
				contest_event_general_contestant_valid_trigger = yes
			}
		}
	}

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Tournaments/ConstructionKits/ep2_event_grand_tournament_ck_arrow_impact"
		tournament_pivotal_flavor_variable_effect = { CONTEST = archery ID = 6503 }
		scope:activity = {
			random_guest_subset_current_phase = {
				name = qualified
				limit = { contest_event_general_contestant_valid_trigger = yes }
				save_scope_as = competitor1
				tournament_pivotal_flavor_variable_effect = { CONTEST = archery ID = 6503 }
			}
			random_guest_subset_current_phase = {
				name = qualified
				limit = {
					contest_event_general_contestant_valid_trigger = yes
					this != scope:competitor1
				}
				save_scope_as = competitor2
				tournament_pivotal_flavor_variable_effect = { CONTEST = archery ID = 6503 }
			}
		}
		scope:competitor2 = {
			increase_wounds_no_death_effect = {
				REASON = spectator_injured
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = tournament_wayward_arrow_log
				tags = { bad }
				score = 5
				character = scope:competitor2
			}
		}
	}

	# Heal the person
	option = {
		name = ep2_tournament_events.6503.a
		trigger = {
			has_trait = lifestyle_herbalist
		}
		reverse_add_opinion = {
			target = scope:competitor2
			modifier = grateful_opinion
			opinion = 40
		}
		reverse_add_opinion = {
			target = scope:competitor1
			modifier = relieved_opinion
			opinion = 10
		}
		scope:competitor2 = {
			add_character_modifier = {
				modifier = safe_wound_treatment_success_low_modifier
				years = 2
			}
		}
		progress_towards_friend_effect = {
			REASON = friend_treated_wounds
			CHARACTER = scope:competitor2
			OPINION = 0
		}
		stress_impact = {
			base = miniscule_stress_impact_loss
			arbitrary = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	# Call for a medic
	option = {
		name = ep2_tournament_events.6503.b
		remove_short_term_gold = minor_gold_value
		reverse_add_opinion = {
			target = scope:competitor2
			modifier = grateful_opinion
			opinion = 40
		}
		reverse_add_opinion = {
			target = scope:competitor1
			modifier = relieved_opinion
			opinion = 10
		}
		scope:competitor2 = {
			add_character_modifier = {
				modifier = safe_wound_treatment_success_low_modifier
				years = 2
			}
		}
		progress_towards_friend_effect = {
			REASON = friend_treated_wounds
			CHARACTER = scope:competitor2
			OPINION = 0
		}
		stress_impact = {
			base = miniscule_stress_impact_gain
			greedy = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = { #More likely if you don't have a lot of gold
				factor = 0
				gold < root.minor_gold_value
			}
		}
	}

	# This isn't my concern
	option = {
		name = ep2_tournament_events.6503.c
		scope:competitor1 = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_minor }
		}
		scope:competitor2 = {
			activity_tournament_change_contestant_score_effect = { SCORE = decrease_medium }

			add_stress = minor_stress_gain

			progress_towards_rival_effect = {
				REASON = rival_refused_to_help_wound
				CHARACTER = scope:competitor1
				OPINION = default_rival_opinion
			}
		}
		ai_chance = {
			base = 100
		}
	}
}
