﻿namespace = yearly

####
# 7001 - marshal suspecting factions are going to target you by Isabella welch
# 7002 - your marshal tells you about their suspicions
# 7003 - knights attempt to kidnap you
# 7004 - attempted coup by a faction
###
scripted_trigger can_detect_coup_trigger = { #will you unlock the option to ask your marshal why they are afraid
	OR = {
		scope:marshal = {
			opinion = {
				target = root
				value >= medium_positive_opinion
			}
		}
		has_relation_friend = scope:marshal
		has_trait = schemer
		has_lifestyle = intrigue_lifestyle
	}
}

scripted_trigger valid_coup_leader_trigger = {
	OR = {
		is_leading_faction_type = independence_faction
		is_leading_faction_type = liberty_faction
		is_leading_faction_type = claimant_faction
		is_leading_faction_type = populist_faction
	}
	NOT = { has_council_position = councillor_marshal }
	is_ai = yes
}

### A faction tries to stage a coup during court being held by Isabella Welch

yearly.7001 = {
	type = character_event
	title = yearly.7001.t
	desc = yearly.7001.desc
	theme = martial

	override_background = {
		event_background = bedchamber
	}
	left_portrait = {
		character = root
		animation = personality_bold
	}
	right_portrait = {
		character = scope:marshal
		animation = worry
	}
	
	trigger = {
		NOT = { has_character_flag = had_first_coup_event }
		any_vassal = {
			valid_coup_leader_trigger = yes
		}
		exists = cp:councillor_marshal
		cp:councillor_marshal = {
			is_ai = yes
		}
		any_knight = { count >= 2 }
		any_vassal = {
			count >=3
			# [LTAF]
			OR = {
				is_a_faction_member = no
				LTAF_is_loyalist = yes
			}
			# [/LTAF]
		}
		has_ep1_dlc_trigger = yes
		has_royal_court = yes
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		add_character_flag = had_first_coup_event
		cp:councillor_marshal = { save_scope_as = marshal }
		set_signature_weapon_effect = yes
		random_vassal = {
			limit = { valid_coup_leader_trigger = yes }
			save_scope_as = coup_leader
			joined_faction = {
				save_scope_as = coup_faction 
			}	
		}
		random_knight = { #knight loyalty is going to matter, if they are both disloyal you are likelier to get the knights kidnapping you event
			weight = {
				base = 1
				compare_modifier = {
					value = prowess
					multiplier = 0.5
				}
				modifier = {
					trigger = {
						AND = {
							opinion = {
								target = root
								value < medium_positive_opinion
							}
							is_a_faction_member = yes
							# [LTAF]
							LTAF_is_loyalist = no
							# [/LTAF]
						}
						NOT = {
							root = { can_detect_coup_trigger = yes }
						}
					}
					factor = 10
				}
			}
			save_scope_as = knight_1
		}
		random_knight = {
			limit = { NOT = { scope:knight_1 = this } }
			weight = {
				base = 1
				compare_modifier = {
					value = prowess
					multiplier = 0.5
				}
				modifier = {
					trigger = {
						AND = {
							opinion = {
								target = root
								value < medium_positive_opinion
							}
							is_a_faction_member = yes
							# [LTAF]
							LTAF_is_loyalist = no
							# [/LTAF]
						}
						NOT = {
							root = {  can_detect_coup_trigger = yes}
						}
					}
					factor = 2
				}
			}
			save_scope_as = knight_2
		}
	}

	option = { #likelier someone will die if you don't get the knights kidnapping event
		name = yearly.7001.a
		add_character_flag = ignored_guard_patrols
		change_current_court_grandeur = medium_court_grandeur_gain
		stress_impact = {
			brave = medium_stress_loss
			arbitrary = medium_stress_loss
			craven = massive_stress_gain
			paranoid = major_stress_gain
		}
	}

	option = { #likelier you will defend your court well in 7005
		name = yearly.7001.b
		change_current_court_grandeur = medium_court_grandeur_loss
	}
	
	option = { #marshal will run away and send you a letter warning you if you win the toast
		name = yearly.7001.c
		trigger = {
			can_detect_coup_trigger = yes
		}
		duel = {
			skill = intrigue
			target = scope:marshal
			20 = {
				custom_tooltip = yearly.7001.c.tt
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				trigger_event = {
					id = yearly.7002
					days = { 10 20 }
				}
				add_character_flag = marshal_letter_event
			}
			5 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				scope:marshal = {
					add_opinion = {
						target = root
						modifier = falsely_accused
					}
				}
				hidden_effect = {
					send_interface_toast = {
						left_icon = scope:marshal
						title = yearly.7001.tt
						show_as_tooltip = { 
							scope:marshal = {
								add_opinion = {
									target = root
									modifier = falsely_accused
								}
							}
						}
					}
				}
			}
		}
	}

	option = { #critically likely to help, might disband the faction
		name = yearly.7001.d
		add_character_flag = increased_guard_patrols
		duel = {
			skill = martial
			value = 14
			30 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				add_dread = medium_dread_gain
				send_interface_toast = {
					left_icon = scope:marshal
					title = yearly.7001.d.win.tt
					show_as_tooltip = { 
						scope:coup_faction = { #I am not 100% sure if this effect actually works
							every_faction_member = {
								custom = custom.all_faction_members
								leave_faction_with_cooldown_effect = {
									FACTION = scope:coup_faction
									YEARS = 20
								}
							}
						}
					}
				}
				scope:coup_faction = {
					every_faction_member = {
						custom = custom.all_faction_members
						leave_faction_with_cooldown_effect = {
							FACTION = scope:coup_faction
							YEARS = 20
						}
					}
				}
			}
			60 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
					min = -49
				}
				send_interface_toast = {
					left_icon = scope:marshal
					title = yearly.7001.d.tt
					show_as_tooltip = {
						every_courtier_or_guest = {
							custom = all_courtiers_and_guests
							add_opinion = {
								target = root
								modifier = frightened_in_court_opinion
								opinion = -5
							}
						}	
					}
				}
				change_current_court_grandeur = medium_court_grandeur_loss
				every_courtier_or_guest = {
					limit = {
						NOR = { 
							has_trait = brave
							has_trait = craven
						}
					}
					custom = all_courtiers_and_guests
					add_opinion = {
						target = root
						modifier = frightened_in_court_opinion
						opinion = -5
					}
				}
				every_courtier_or_guest = {
					limit = { has_trait = craven }
					custom = all_craven_in_the_court
					add_opinion = {
						target = root
						modifier = frightened_in_court_opinion
						opinion = -15
					}
				}
			}
		}
	}

	after = {
		hidden_effect = {
			random_list = {
				10 = {
					trigger = {
						NOT = { has_character_flag = marshal_letter_event }
						scope:knight_1 = {
							opinion = {
								target = root
								value < medium_positive_opinion
							}
						}
						scope:knight_2 = {
							opinion = {
								target = root
								value < medium_positive_opinion
							}
						}
						NOR = {
							scope:marshal = {
								opinion = {
									target = root
									value >= medium_positive_opinion
								}
							}
							has_relation_friend = scope:marshal
							has_trait = schemer
							has_lifestyle = intrigue_lifestyle
						}
					}
					trigger_event = {
						id = yearly.7004
						days = 30
					}
				}
				10 = {
					trigger = { NOT = { has_character_flag = marshal_letter_event } }
					duel = {
						skill = martial
						target = scope:coup_leader
						50 = {		
							compare_modifier = {
								value = scope:duel_value
								multiplier = 3.5
								min = -49
							}
							add_character_flag = ruler_won_duel
							set_variable = {
								name = coup_success
								value = -1
							}
						}
						50 = {		
							compare_modifier = {
								value = scope:duel_value
								multiplier = -3.5
								min = -49
							}
							add_character_flag = ruler_lost_duel
							set_variable = {
								name = coup_success
								value = 1
							}
						}
					}
					trigger_event = {
						id = yearly.7003
						days = { 30 40 }
					}
				}
			}
		}
	}
}

yearly.7002 = {
	type = letter_event
	opening = { desc = yearly.7002 }
	desc = yearly.7002.d
	sender = scope:marshal
	
	immediate = {
		hidden_effect = { fire_councillor = cp:councillor_marshal }
		add_character_flag = knew_about_coup
	}

	option = {
		name = yearly.7002.a
		trigger = {
			NOR = {
				has_lifestyle = martial_lifestyle
				has_trait = strategist
				has_trait = overseer
				has_trait = gallant
				prowess > high_skill_rating
				has_trait = lifestyle_blademaster
			}
		}
		add_character_flag = no_one_guarding
		add_character_flag = self_defense_prepared_poor
		add_stress = medium_stress_gain
	}
	option = {
		name = yearly.7002.b
		flavor = yearly.7002.b.tt
		custom_tooltip = yearly.7002.b.tt.2
		if = {
			limit = {
				scope:knight_1 = {
					opinion = {
						target = root
						value >= medium_positive_opinion
					}
				}
			}
			add_character_flag = knight_1_support
		}
		else = {
			add_character_flag = knight_1_defection
		}
		if = {
			limit = {
				scope:knight_2 = {
					opinion = {
						target = root
						value >= medium_positive_opinion
					}
				}
			}
			add_character_flag = knight_2_support
		}
		else = {
			add_character_flag = knight_2_defection
		}
		stress_impact = {
			trusting = minor_stress_loss
			paranoid = major_stress_gain
			craven = major_stress_gain

		}
	}
	option = {
		name = yearly.7002.c
		custom_tooltip = yearly.7002.c.tt
		trigger = {
			OR = {
				has_lifestyle = martial_lifestyle
				has_trait = strategist
				has_trait = overseer
				has_trait = gallant
				prowess > high_skill_rating
				has_trait = lifestyle_blademaster
			}
		}
		add_character_flag = self_defense_prepared_good
		add_character_flag = no_one_guarding
		stress_impact = {
			brave = minor_stress_loss
			craven = minor_stress_gain
		}
	}
	after = {
		trigger_event = {
			id = yearly.7003
			days = { 30 40 }
		}
	}
}

yearly.7003 = {
	hidden = yes
	immediate = {
		if = {
			limit = {
				has_character_flag = knight_1_defection
				has_character_flag = knight_2_defection 
			}
			trigger_event = {
				id = yearly.7004
				days = 30
			}
		}
		else = {
			trigger_event = {
				id = yearly.7005
				days = 30
			}
		}
	}
}

##### Knights dragging you off in a bag comedy hour

yearly.7004 = { #big power move with the sleepy ruler
	type = character_event
	title = yearly.7001.t
	desc = yearly.7004.desc
	theme = intrigue
	override_background = {
		event_background = alley_night
	}
	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		character = scope:knight_1
		animation = rage
	}
	lower_right_portrait = {
		character = scope:knight_2
	}
	trigger = {
		scope:knight_1 = {
			is_available_ai_adult = yes
		}
		scope:knight_2 = {
			is_available_ai_adult = yes
		}
		is_available = yes
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		root.capital_province.county = {
			random_neighboring_county = {
				save_scope_as = neighbor_county
			}
		}
		scope:coup_faction = {
			every_faction_member = {
				custom = custom.all_faction_members
				leave_faction_with_cooldown_effect = {
					FACTION = scope:coup_faction
					YEARS = 20
				}
			}
		}
		add_character_modifier = {
			modifier = sleep_deprived_modifier
			days = 3
		}
		add_opinion = {
			target = scope:knight_1
			modifier = abductor_opinion
		}
		add_opinion = {
			target = scope:knight_2
			modifier = abductor_opinion
		}
		add_opinion = {
			target = scope:coup_leader
			modifier = attempted_abduction_opinion
		}
	}

	option = {
		name = yearly.7004.a
		flavor = yearly.7004.tt
		add_character_modifier = {
			modifier = watchful_modifier
			days = watchful_modifier_duration
		}
	}

	option = {
		name = yearly.7004.b
		flavor = yearly.7004.tt
		imprison_character_effect = {
			TARGET = scope:knight_1
			IMPRISONER = root
		}
		imprison_character_effect = {
			TARGET = scope:knight_2
			IMPRISONER = root
		}
		scope:knight_1 = {
			change_prison_type = dungeon
		}
		scope:knight_2 = {
			change_prison_type = dungeon
		}
	}
	option = {
		name = yearly.7004.c
		flavor = yearly.7004.tt
		custom_tooltip = yearly.7004.c.tt
		give_nickname = nick_the_sleeper
	}
}


scripted_effect attack_random_outcome_effect = { #figuring out who is going to get targeted by the attack
	random_list = {
		20 = {
			death = {
				death_reason = death_assassination
				killer = scope:coup_leader
			}
			compare_modifier = {
				value = scope:coup_leader.prowess
				multiplier = 0.5
			}
			if = {
				limit = { is_close_family_of = root }
				root = {
					add_opinion = {
						target = scope:coup_leader
						modifier = murdered_close_family_crime
					}
				}
			}
			else_if = {
				limit = { 
					OR = { 
						any_relation = {
							type = friend
							this = root
						}
						any_relation = {
							type = lover
							this = root
						}
						any_relation = {
							type = soulmate
							this = root
						}
					}
				}
				root = {
					add_opinion = {
						target = scope:coup_leader
						modifier = murdered_someone_close_to_me_crime
					}
				}
			}
			else = {
				root = {
					add_opinion = {
						target = scope:coup_leader
						modifier = plotting_against_liege_opinion
					}
				}
			}
		}
		40 = {
			increase_wounds_effect = { REASON = assassination }
			if = {
				limit = { is_close_family_of = root }
				root = {
					add_opinion = {
						target = scope:coup_leader
						modifier = attempted_murder_close_family_crime
					}
				}
			}
			else_if = {
				limit = { 
					OR = { 
						any_relation = {
							type = friend
							this = root
						}
						any_relation = {
							type = lover
							this = root
						}
						any_relation = {
							type = soulmate
							this = root
						}
					}
				}
				root = {
					add_opinion = {
						target = scope:coup_leader
						modifier = hurt_someone_close_to_me_crime
					}
				}
			}
			else = {
				root = {
					add_opinion = {
						target = scope:coup_leader
						modifier = plotting_against_liege_opinion
					}
				}
			}
		}
		20 = {
			add_trait = disfigured
			if = {
				limit = { is_close_family_of = root }
				root = {
					add_opinion = {
						target = scope:coup_leader
						modifier = attempted_murder_close_family_crime
					}
				}
			}
			else_if = {
				limit = { 
					OR = { 
						any_relation = {
							type = friend
							this = root
						}
						any_relation = {
							type = lover
							this = root
						}
						any_relation = {
							type = soulmate
							this = root
						}
					}
				}
				root = {
					add_opinion = {
						target = scope:coup_leader
						modifier = hurt_someone_close_to_me_crime
					}
				}
			}
			else = {
				root = {
					add_opinion = {
						target = scope:coup_leader
						modifier = plotting_against_liege_opinion
					}
				}
			}
		}
	}
}


yearly.7005 = {
	type = character_event
	title = yearly.7001.t
	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		character = scope:coup_leader
		animation = severelywounded
	}
	lower_left_portrait = {
		character = scope:first_character_kill
	}
	lower_right_portrait = {
		trigger = {
			OR = {
				has_character_flag = kills_two_people
				has_character_flag = kills_three_people
			}
		}
		character = scope:second_character_kill
	}
	lower_center_portrait = {
		trigger = {
			has_character_flag = kills_three_people
		}
		character = scope:third_character_kill
	}
	theme = martial
	override_background = {
		event_background = throne_room
	}
	desc = {
		first_valid = {
			triggered_desc = { #if your marshal warned you with the letter
				trigger = { has_character_flag = knew_about_coup }
				desc = yearly.7005.preparation	
			}
			triggered_desc = { #if your marshal didn't tell you
				trigger = { has_character_flag = ignored_guard_patrols }
				desc = yearly.7005.decreased_security
			}
			triggered_desc = {  #if your marshal didn't tell you
				trigger = { has_character_flag = increased_guard_patrols }
				desc = yearly.7005.increased_security
			}
		}
		first_valid = {
			triggered_desc = { #if your marshal wrote the letter and you don't have very good prowess and chose to defend yourself
				trigger = { has_character_flag = self_defense_prepared_poor }
				desc = yearly.7005.preparation_poor
			}
			triggered_desc = { #if your marshal wrote the letter and you have very good prowess and chose to defend yourself
				trigger = { has_character_flag = self_defense_prepared_good }
				desc = yearly.7005.preparation_good
			}
			triggered_desc = { #if your knights following the letter event proved loyal
				trigger = { has_character_flag = full_knight_support }
				desc = yearly.7005.knight_support
			}
			triggered_desc = {  #if one of your knights following the letter event proved loyal
				trigger = { has_character_flag = single_knight_defection }
				desc = yearly.7005.single_knight_support
			}
		}
		desc = yearly.7005.throne_approach
		first_valid = {
			triggered_desc = { #custom reasons for each faction to attack
				trigger = { has_character_flag = liberty_faction }
				desc = yearly.7005.liberty_faction
			}
			triggered_desc = {
				trigger = { has_character_flag = independence_faction }
				desc = yearly.7005.independence_faction
			}
			triggered_desc = {
				trigger = { has_character_flag = claimant_faction }
				desc = yearly.7005.claimant_faction
			}
			triggered_desc = {
				trigger = { has_character_flag = populist_faction }
				desc = yearly.7005.populist_faction
			}
		}
		desc = yearly.7005.weapon
		first_valid = {
			triggered_desc = {
				trigger = { has_character_flag = kills_one_person }
				desc = yearly.7005.single_death
			}
			triggered_desc = {
				trigger = { has_character_flag = kills_two_people }
				desc = yearly.7005.double_death
			}
			triggered_desc = {
				trigger = { has_character_flag = kills_three_people }
				desc = yearly.7005.triple_death
			}
			triggered_desc = {
				trigger = { has_character_flag = kills_no_people }
				desc = yearly.7005.no_death
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = { has_character_flag = coup_ruler_strike }
				desc = yearly.7005.coup_ruler_strike
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = { has_character_flag = kills_no_people }
				desc = yearly.7005.failure
			}
			triggered_desc = {
				trigger = { has_character_flag = coup_ruler_death }
				desc = yearly.7005.ruler_death
			}
			desc = yearly.7005.success
		}
	}	
	trigger = {
		scope:coup_leader = {
			is_available_ai_adult = yes
		}
		has_character_flag = had_first_coup_event
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		scope:coup_leader = {
			set_signature_weapon_effect = yes
		}
		if = {
			limit = {
				exists = scope:coup_faction
			}
			scope:coup_faction = { #to disband them later if needed
				every_faction_member = {
					add_to_list = coup_faction_list
				}
			}
		}
		set_variable = { #to calculate how many people are going to die
			name = coup_success
			value = 0
		}
		## Determine how guarded or warned the ruler is
		if = {
			limit = {
				has_character_flag = knight_1_support
				has_character_flag = knight_2_support
			}
			change_variable = {
				name = coup_success
				add = -1
			}
			add_character_flag = full_knight_support
		}
		if = {
			limit = {
				OR = {
					has_character_flag = knight_1_defection
					has_character_flag = knight_2_defection
				}
			}
			change_variable = {
				name = coup_success
				add = 1
			}
			add_character_flag = single_knight_defection
		}
		if = {
			limit = {
				has_character_flag = self_defense_prepared_poor
			}
			change_variable = {
				name = coup_success
				add = 1
			}
		}
		if = {
			limit = {
				has_character_flag = self_defense_prepared_good
			}
			change_variable = {
				name = coup_success
				add = -1
			}
		}
		if = {
			limit = {
				has_character_flag = ruler_lost_duel
			}
			change_variable = {
				name = coup_success
				add = 2
			}
		}
		if = {
			limit = {
				has_character_flag = ruler_won_duel
			}
			change_variable = {
				name = coup_success
				add = -1
			}
		}
		if = {
			limit = {
				has_character_flag = knew_about_coup
			}
			change_variable = {
				name = coup_success
				add = -1
			}
		}
		if = {
			limit = {
				has_character_flag = ignored_guard_patrols
			}
			change_variable = {
				name = coup_success
				add = 1
			}
		}
		#to have custom loc for the attack reasons for different faction types
		if = {
			limit = {
				scope:coup_leader = {
					is_leading_faction_type = liberty_faction
				}
			}
			add_character_flag = liberty_faction
		}
		else_if = {
			limit = {
				scope:coup_leader = {
					is_leading_faction_type = independence_faction
				}
			}
			add_character_flag = independence_faction
		}
		if = {
			limit = {
				scope:coup_leader = {
					is_leading_faction_type = claimant_faction
				}
			}
			add_character_flag = claimant_faction
		}
		if = {
			limit = {
				scope:coup_leader = {
					is_leading_faction_type = populist_faction
				}
			}
			add_character_flag = populist_faction
		}
		### Find some characters who might get attacked
		if = {
			limit = {
				exists = root.primary_spouse
				root.primary_spouse = {
					NOT = {
						is_in_list = coup_faction_list
					}
				}
			}
			root.primary_spouse = { add_to_list = character_kill_list }
		}
		if = {
			limit = {
				any_councillor = {
					exists = yes
					NOR = {
						has_council_position = councillor_marshal
						primary_spouse = this
						is_in_list = coup_faction_list
					}
				}
			}
			random_councillor = {
				limit = {
					NOR = { 
						has_council_position = councillor_marshal
						primary_spouse = this
						is_in_list = coup_faction_list
					}
				}
				add_to_list = character_kill_list
			}
		}
		if = {
			limit = {
				exists = root.primary_heir
				root.primary_heir = {
					NOT = {
						is_in_list = coup_faction_list
					}
				}
			}
			root.primary_heir = { add_to_list = character_kill_list }
		}

		if = {
			limit = {
				exists = root.father
				root.father = { 
					is_courtier_of = root 
					NOT = { is_in_list = coup_faction_list }
				}
			}
			root.father = { add_to_list = character_kill_list }
		}
		if = {
			limit = {
				exists = root.mother
				root.mother = { 
					is_courtier_of = root 
					NOT = { is_in_list = coup_faction_list } 
				}
			}
			root.mother = { add_to_list = character_kill_list }	
		}
		if = {
			limit = {
				any_powerful_vassal = {
					is_councillor = no
					exists = yes
					NOT = { is_in_list = coup_faction_list }
				}
			}
			random_vassal = {
				limit = {
					is_councillor = no
					NOT = { is_in_list = coup_faction_list }
					is_powerful_vassal = yes
				}
				add_to_list = character_kill_list
			}
		}
		random_vassal = {
			limit = { NOT = { is_in_list = coup_faction_list } }
			add_to_list = character_kill_list
		}
		random_vassal = {
			limit = {
				NOR = {
					is_in_list = coup_faction_list
					is_in_list = character_kill_list
				}
			}
			add_to_list = character_kill_list
		}
		random_vassal = {
			limit = { 
				NOR = {
					is_in_list = coup_faction_list
					is_in_list = character_kill_list
				}
			}
			add_to_list = character_kill_list
		}
		#attacking more important characters first
		random_in_list = {
			list = character_kill_list
			weight = {
				base = 1
				modifier  = {
					factor = 20
					exists = root.primary_spouse
					any_relation = {
						type = lover
						this = root.primary_spouse
					}
				}
				modifier  = {
					factor = 20
					exists = root.primary_spouse
					any_relation = {
						type = soulmate
						this = root.primary_spouse
					}
				}
				modifier = {
					factor = 20
					is_powerful_vassal = yes
				}
				modifier = {
					factor = 10
					is_close_family_of = root
				}
				modifier = {
					opinion = {
						target = root
						value > medium_positive_opinion
					}
					factor = 5
				}
			}
			save_scope_as = first_character_kill
		}
		random_in_list = {
			limit = {
				NOT = {
					scope:first_character_kill = this
				}
			}
			weight = {
				base = 1
				modifier  = {
					factor = 20
					exists = root.primary_spouse
					has_relation_lover = root.primary_spouse
				}
				modifier  = {
					factor = 20
					exists = root.primary_spouse
					has_relation_soulmate = root.primary_spouse
				}
				modifier = {
					factor = 20
					is_powerful_vassal = yes
				}
				modifier = {
					factor = 10
					is_close_family_of = root
				}
				modifier = {
					opinion = {
						target = root
						value > medium_positive_opinion
					}
					factor = 5
				}
			}			
			list = character_kill_list
			save_scope_as = second_character_kill
		}
		random_in_list = {
			limit = {
				NOR = {
					scope:first_character_kill = this
					scope:second_character_kill = this
				}
			}
			weight = {
				base = 1
				modifier  = {
					factor = 20
					exists = root.primary_spouse
					has_relation_lover = root.primary_spouse
				}
				modifier  = {
					factor = 20
					exists = root.primary_spouse
					has_relation_soulmate = root.primary_spouse
				}
				modifier = {
					factor = 20
					is_powerful_vassal = yes
				}
				modifier = {
					factor = 10
					is_close_family_of = root
				}
				modifier = {
					opinion = {
						target = root
						value > medium_positive_opinion
					}
					factor = 5
				}
			}			
			list = character_kill_list
			save_scope_as = third_character_kill
		}
		## Determine how wounded the characters become
		if = {
			limit = { var:coup_success = 0 }
			add_character_flag = kills_one_person
			scope:first_character_kill = {
				attack_random_outcome_effect = yes
			}
		}
		else_if = {
			limit = {
				var:coup_success = 1
			}
			add_character_flag = kills_two_people
			scope:first_character_kill = {
				attack_random_outcome_effect = yes
			}
			scope:second_character_kill = {
				attack_random_outcome_effect = yes
			}
		}
		else_if = {
			limit = {
				var:coup_success > 1
			}
			add_character_flag = kills_three_people
			scope:first_character_kill = {
				attack_random_outcome_effect = yes
			}
			scope:second_character_kill = {
				attack_random_outcome_effect = yes
			}
			scope:third_character_kill = {
				attack_random_outcome_effect = yes
			}
		}
		else = {
			add_character_flag = kills_no_people
		}
		if = {
			limit = { NOT = { has_character_flag = kills_no_people } }
			random_list = {
				5 = {
					compare_modifier = {
						value = var:coup_success
						multiplier = 0.5
					}
					modifier = {
						has_character_flag = no_one_guarding
						factor = 2
					}
					add_character_flag = coup_ruler_death
				}
				40 = {
					increase_wounds_effect = { REASON = assassination }
					add_character_flag = coup_ruler_strike
					add_opinion = {
						target = scope:coup_leader
						modifier = attempted_murder_me_crime
					}
				}
				20 = {
					add_trait = disfigured
					add_character_flag = coup_ruler_strike
					add_opinion = {
						target = scope:coup_leader
						modifier = attempted_murder_me_crime
					}
				}
			}
		}
	}

	option = { #imprison them
		name = yearly.7005.a
		trigger = {
			has_character_flag = kills_no_people
			NOT = { has_character_flag = coup_ruler_death }
		}
		rightfully_imprison_character_effect = {
			TARGET = scope:coup_leader
			IMPRISONER = root
		}
	}

	option = { #let them slit their own throat
		name = yearly.7005.b
		trigger = {
			NOT = { has_character_flag = coup_ruler_death }
		}
		scope:coup_leader = {
			death = {
				death_reason = death_refused_to_be_imprisoned
			}
		}
	}
	
	option = { #torture and imprison them
		name = yearly.7005.c
		custom_tooltip = yearly.7005.c.tt
		trigger = {
			NOT = { has_character_flag = coup_ruler_death }
		}
		rightfully_imprison_character_effect = {
			TARGET = scope:coup_leader
			IMPRISONER = root
		}
		scope:coup_leader = {
			add_trait = blind
		}
	}
	option = { #if this wasn't accompanied with bloodshed, just loot their titles
		name = yearly.7005.d
		trigger = {
			has_character_flag = kills_no_people
			NOT = { has_character_flag = coup_ruler_death }
		}
		custom_tooltip = yearly.7005.d.tt
		hidden_effect = {
			scope:coup_leader = {
				every_held_title = {
					limit = {
						tier >= tier_county
					}
					add_to_list = revoked_coup_leader_titles
				}
				every_vassal = {
					add_to_list = vassals_for_you
				}
				add_opinion = {
					target = root
					modifier = revoked_title
				}
			}
			create_title_and_vassal_change = {
				type = granted
				save_scope_as = title_change_coup
				add_claim_on_loss = yes
			}
			every_in_list = {
				list = revoked_coup_leader_titles
				change_title_holder = {
					holder = root
					change = scope:title_change_coup
					take_baronies = no
				}
			}
			every_in_list = {
				list = vassals_for_you
				change_liege = {
					liege = root
					change = scope:title_change_coup
				}
			}
			resolve_title_and_vassal_change = scope:title_change_coup
		}
	}
	option = { #guess I'll die
		name = {
			trigger = {
				OR = {
					has_trait = theologian
					has_trait = zealous
				}
			}
			text = yearly.7005.devout.e
		}
		name = yearly.7005.e
		trigger = {
			has_character_flag = coup_ruler_death
		}
	}
	after = {
		if = {
			limit = {
				has_character_flag = coup_ruler_death
			}
			death = {
				death_reason = death_assassination
				killer = scope:coup_leader
			}
		}
		else = {
			remove_character_flag = knight_1_support
			remove_character_flag = knight_2_support
			remove_character_flag = full_knight_support
			remove_character_flag = knight_1_defection
			remove_character_flag = knight_2_defection
			remove_character_flag = single_knight_defection
			remove_character_flag = self_defense_prepared_poor
			remove_character_flag = self_defense_prepared_good
			remove_character_flag = ruler_lost_duel
			remove_character_flag = ruler_won_duel
			remove_character_flag = knew_about_coup
			remove_character_flag = ignored_guard_patrols
			remove_character_flag = increased_guard_patrols
			remove_character_flag = liberty_faction
			remove_character_flag = independence_faction
			remove_character_flag = claimant_faction
			remove_character_flag = populist_faction
			remove_character_flag = kills_one_person
			remove_character_flag = kills_two_people
			remove_character_flag = kills_three_people
			remove_character_flag = kills_no_people
			remove_character_flag = coup_ruler_death
		}
	}
}



#Participate in a football game
#by Nick Meredith

# Set up event
yearly.7010 = {
	type = character_event
	title = yearly.7010.t
	desc = yearly.7010.desc
	theme = recovery
	override_background = { event_background = farmland }
	left_portrait = {
		character = root
		animation = idle
	}

	trigger = {
		is_landed = yes
		is_available_at_peace_adult = yes
		capital_province = {
			geographical_region = world_europe
		}
	}

	# Display interest
	option = {
		name = yearly.7010.a

		custom_tooltip = yearly.7010.tt.yes

		trigger_event = {
			id = yearly.7011
			days = { 1 3 }
		}
	}

	# Stay out of it
	option = {
		name = yearly.7010.b
	}
}


# Valet explains game
yearly.7011 = {
	type = character_event
	title = yearly.7011.t
	desc = yearly.7011.desc
	theme = battle
	override_background = { event_background = farmland }
	left_portrait = {
		character = root
		animation = personality_bold
	}

	immediate = {
		random_dummy_gender_soldier_effect = { 
			SCOPE_NAME = dummy_gender
			}
		}

	# I'm in!
	option = {
		name = yearly.7011.a

		add_internal_flag = dangerous

		custom_tooltip = yearly.7011.tt

		stress_impact = {
			athletic = minor_stress_impact_loss
			lazy = miniscule_stress_impact_gain
		}

		hidden_effect = {
			random_list = {
				1 = {
					trigger_event = {
						id = yearly.7012
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7013
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7014
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7015
						days = { 1 3 }
					}
				}
			}
		}
	}


	# Typical commoner pastime, leave them to it
	option = {
		name = yearly.7011.b

		stress_impact = {
			athletic = minor_stress_impact_gain
			lazy = miniscule_stress_impact_loss
			craven = miniscule_stress_impact_loss
		}
	}
}

# Pre-game: Literal Under Armour
yearly.7012 = {
	type = character_event
	title = yearly.7012.t
	desc = yearly.7012.desc
	theme = recovery
	override_background = { event_background = market }
	left_portrait = {
		character = root
		animation = personality_cynical
	}

	# I'll buy it off you!
	option = {
		name = yearly.7012.a

		remove_short_term_gold = minor_gold_value

		stress_impact = {
			craven = miniscule_stress_impact_loss
			brave = minor_stress_impact_gain
		}

		trigger_event = {
			id = yearly.7020
			days = { 1 3 }
		}
	}

	# Give it up, old man
	option = {
		name = yearly.7012.b

		stress_impact = {
			ambitious = miniscule_stress_impact_gain
			craven = minor_stress_impact_gain
			deceitful = minor_stress_impact_gain
		}

		trigger_event = {
			id = yearly.7020
			days = { 1 3 }
		}
	}
}


# Pre-game: Wealthy merchant buys your best player
yearly.7013 = {
	type = character_event
	title = yearly.7013.t
	desc = yearly.7013.desc
	theme = battle
	override_background = { event_background = market }
	left_portrait = {
		character = root
		animation = disapproval
	}

	# Whatever he's paid you, I'll double it!
	option = {
		name = yearly.7013.a

		remove_short_term_gold = minor_gold_value
		custom_tooltip = yearly.7010.tt.win

		add_character_flag = retained_star

		stress_impact = {
			greedy = major_stress_impact_gain
		}

		trigger_event = {
			id = yearly.7020
			days = { 1 3 }
		}
	}

	# How dare he!
	option = {
		name = yearly.7013.b

		custom_tooltip = yearly.7010.tt.lose

		add_character_flag = lost_star

		trigger_event = {
			id = yearly.7020
			days = { 1 3 }
		}
	}

	# I reckon I can compensate...
	option = {
		name = yearly.7013.c

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

		add_prestige = minor_prestige_value

		add_character_flag = became_star

		stress_impact = {
			craven = minor_stress_impact_gain
			shy = minor_stress_impact_gain
		}

		trigger_event = {
			id = yearly.7020
			days = { 1 3 }
		}
	}
}

# Pre-game: Messing with pies
yearly.7014 = {
	type = character_event
	title = yearly.7014.t

	desc = {
		# kick over cart vs poison pies

		first_valid = {

			triggered_desc = { # poison the pies
				trigger = {
					has_trait = lifestyle_herbalist
				}
				desc = yearly.7014.desc.1
			}
			desc = yearly.7014.desc # kick over the cart
		}
	}

	theme = battle
	override_background = { event_background = market }
	left_portrait = {
		character = root
		animation = scheme
	}

	# Herbalist option - poison the pies
	option = {
		name = yearly.7014.a

		trigger = {
			has_trait = lifestyle_herbalist
		}

		stress_impact = {
			deceitful = miniscule_stress_impact_loss
		}

		add_character_flag = poisoned_pies

		custom_tooltip = yearly.7014.hemlock
		custom_tooltip = yearly.7010.tt.win

		trigger_event = {
			id = yearly.7020
			days = { 1 3 }
		}
	}

	# Overturn the cart
	option = {
		name = yearly.7014.b

		trigger = {
			NOT = {
				has_trait = lifestyle_herbalist
			}
		}

		custom_tooltip = yearly.7010.tt.win

		add_character_flag = yeeted_cart

		stress_impact = {
			gluttonous = minor_stress_impact_gain
		}

		trigger_event = {
			id = yearly.7020
			days = { 1 3 }
		}
	}

	# Even I'm not that evil
	option = {
		name = yearly.7014.c

		add_character_flag = left_cart

		trigger_event = {
			id = yearly.7020
			days = { 1 3 }
		}
	}
}

# Pre-game: Performance-Enhancing Draughts
yearly.7015 = {
	type = character_event
	title = yearly.7015.t
	desc = yearly.7015.desc
	theme = battle
	override_background = { event_background = market }
	left_portrait = {
		character = root
		animation = shock
	}

	immediate = {
		random_dummy_gender_effect = yes
	}

	# How much do you want for the drugs?
	option = {
		name = yearly.7015.a

		remove_short_term_gold = minor_gold_value

		add_character_modifier = {
			modifier = performance_enhancers_modifier
			months = 1
		}

		stress_impact = {
			greedy = minor_stress_impact_gain
			honest = major_stress_impact_gain
			just = minor_stress_impact_gain
		}

		add_character_flag = took_peds
	}

	# You should be ashamed!
	option = {
		name = yearly.7015.b

		add_character_flag = left_peds
	}

	after = {
		trigger_event = {
			id = yearly.7020
			days = { 1 3 }
		}
	}
}

# Game starts!
yearly.7020 = {
	type = character_event
	title = yearly.7020.t
	desc = yearly.7020.desc
	theme = battle
	override_background = { event_background = market }
	left_portrait = {
		character = root
		animation = personality_bold
	}

	option = {
		name = yearly.7020.a

		stress_impact = {
			craven = minor_stress_impact_gain
		}

		hidden_effect = {
			random_list = {
				1 = {
					trigger_event = {
						id = yearly.7021
						days = { 1 3 }
						}
					}
				1 = {
					trigger_event = {
						id = yearly.7022
						days = { 1 3 }
						}
					}
				1 = {
					trigger_event = {
						id = yearly.7023
						days = { 1 3 }
						}
					}
				1 = {
					trigger_event = {
						id = yearly.7024
						days = { 1 3 }
					}
				}
			}
		}
	}

	# BERSERKER SMASH
	option = {
		name = yearly.7020.b

		trigger = {
			has_trait = berserker
		}

		stress_impact = {
			base = miniscule_stress_impact_loss
		}

		add_character_flag = berserker_start

		hidden_effect = {
			random_list = {
				1 = {
					trigger_event = {
						id = yearly.7021
						days = { 1 3 }
						}
					}
				1 = {
					trigger_event = {
						id = yearly.7022
						days = { 1 3 }
						}
					}
				1 = {
					trigger_event = {
						id = yearly.7023
						days = { 1 3 }
						}
					}
				1 = {
					trigger_event = {
						id = yearly.7024
						days = { 1 3 }
					}
				}
			}
		}
	}
}

# First half: A villager comes at you with a rock!
yearly.7021 = {
	type = character_event
	title = yearly.7021.t
	desc = yearly.7021.desc
	theme = battle
	left_portrait = {
		character = root
		animation = anger
	}

	# Hey, that's illegal!
	option = {
		name = yearly.7021.a

		add_internal_flag = dangerous

		random_list = {
			80 = {

			send_interface_toast = {
				title = yearly.7021.a.tt.lose
				left_icon = root
				add_prestige = minor_prestige_loss
				increase_wounds_effect = { REASON = fight }
				}

			add_character_flag = hit_with_rock

			}
			
			20 = {

			modifier = {
				add = 20
				prowess > 5
			}

			modifier = {
				add = 30
				prowess > 10
			}

			modifier = {
				add = 40
				prowess > 15
			}

			modifier = {
				add = 50
				prowess > 20
			}

			add_character_flag = stole_rock

			send_interface_toast = {
				title = yearly.7021.a.tt.win
				left_icon = root
				add_prestige = minor_prestige_gain
				}
			}
		}

		hidden_effect = {
			random_list = {
				1 = {
					trigger_event = {
						id = yearly.7030
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7031
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7032
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7033
						days = { 1 3 }
					}
				}
			}
		}
	}

	# BERSERKER SMASH
	option = {
		name = yearly.7021.b

		trigger = {
			has_trait = berserker
		}

		trait = berserker

		add_character_flag = stole_rock

		send_interface_toast = {
			title = yearly.7021.a.tt.win
			left_icon = root
			add_prestige = minor_prestige_gain
			}

		hidden_effect = {
			random_list = {
				1 = {
					trigger_event = {
						id = yearly.7030
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7031
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7032
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7033
						days = { 1 3 }
					}
				}
			}
		}
	}

	# Run away!
	option = {
		name = yearly.7021.c

		stress_impact = {
			craven = miniscule_stress_impact_loss
			brave = minor_stress_impact_gain
		}

		add_character_flag = hit_with_rock

		hidden_effect = {
			random_list = {
				1 = {
					trigger_event = {
						id = yearly.7030
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7031
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7032
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7033
						days = { 1 3 }
					}
				}
			}
		}
	}
}

# First half: Player is getting seduced by a winsome lad/lass
yearly.7022 = {
	type = character_event
	title = yearly.7022.t
	desc = yearly.7022.desc
	theme = battle
	left_portrait = {
		character = root
		animation = flirtation
	}

	immediate = {
		romance_target_gender_effect = { 
			SCOPE_NAME = dummy_gender }
		save_scope_as = same_gender
		}

	# Yoink!
	option = {
		name = yearly.7022.a

		stress_impact = {
			honest = minor_stress_impact_gain
			compassionate = medium_stress_impact_gain
			chaste = minor_stress_impact_gain
		}

		add_character_flag = stole_ball

		hidden_effect = {
			random_list = {
				1 = {
					trigger_event = {
						id = yearly.7030
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7031
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7032
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7033
						days = { 1 3 }
					}
				}
			}
		}
	}

	# Ah, young love!
	option = {
		name = yearly.7022.b

		custom_tooltip = yearly.7010.tt.lose

		add_prestige = minor_prestige_value

		stress_impact = {
			chaste = miniscule_stress_impact_gain
			deceitful = miniscule_stress_impact_gain
		}

		add_character_flag = winsome_stranger

		hidden_effect = {
			random_list = {
				1 = {
					trigger_event = {
						id = yearly.7030
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7031
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7032
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7033
						days = { 1 3 }
					}
				}
			}
		}
	}

	# Seduce them yourself
	option = {
		name = yearly.7022.c

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

		trait = lustful
		trait = seducer

		add_character_flag = winsome_stranger

		stress_impact = {
			base = minor_stress_impact_loss
			rakish = miniscule_stress_impact_loss
		}

		hidden_effect = {
			random_list = {
				1 = {
					trigger_event = {
						id = yearly.7030
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7031
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7032
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7033
						days = { 1 3 }
					}
				}
			}
		}
	}
}

# First half: Punching a priest
yearly.7023 = {
	type = character_event
	title = yearly.7023.t
	desc = yearly.7023.desc
	theme = battle
	left_portrait = {
		character = root
		animation = stress
	}

	immediate = {
		random_dummy_gender_clergy_effect = yes
	}

	# Punch the priest in the face
	option = {
		name = yearly.7023.a

		add_piety = minor_piety_loss

		stress_impact = {
			base = miniscule_stress_impact_gain
			zealous = major_stress_impact_gain
			cynical = miniscule_stress_impact_loss
		}

		add_character_flag = punched_priest

		hidden_effect = {
			random_list = {
				1 = {
					trigger_event = {
						id = yearly.7030
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7031
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7032
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7033
						days = { 1 3 }
					}
				}
			}
		}
	}

	# leave him be
	option = {
		name = yearly.7023.b

		stress_impact = {
			cynical = minor_stress_impact_gain
			callous = minor_stress_impact_gain
		}

		add_piety = miniscule_piety_gain

		add_character_flag = let_priest_go

		hidden_effect = {
				random_list = {
				1 = {
					trigger_event = {
						id = yearly.7030
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7031
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7032
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7033
						days = { 1 3 }
					}
				}
			}
		}
	}
}

# First half: Damaging a local building
yearly.7024 = {
	type = character_event
	title = yearly.7024.t
	desc = yearly.7024.desc
	theme = battle
	left_portrait = {
		character = root
		animation = shock
	}

	immediate = {
		random_held_title = {
			limit = {
				tier = tier_county
			}
		save_scope_as = damaged_building
		}
	}

	# I'll pay for the refurbishments
	option = {
		name = yearly.7024.a

		remove_short_term_gold = medium_gold_value

		stress_impact = {
			greedy = miniscule_stress_impact_gain
		}

		hidden_effect = {
			random_list = {
				1 = {
					trigger_event = {
						id = yearly.7030
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7031
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7032
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7033
						days = { 1 3 }
					}
				}
			}
		}
	}

	# I won't pay for the refurbishments!
	option = {
		name = yearly.7024.b

		scope:damaged_building = {
			change_county_control = minor_county_control_loss
		}

		stress_impact = {
			generous = miniscule_stress_impact_gain
		}

		hidden_effect = {
			random_list = {
				1 = {
					trigger_event = {
						id = yearly.7030
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7031
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7032
						days = { 1 3 }
					}
				}
				1 = {
					trigger_event = {
						id = yearly.7033
						days = { 1 3 }
					}
				}
			}
		}
	}
}

# Second half: Diving scum
yearly.7030 = {
	type = character_event
	title = yearly.7030.t
	desc = yearly.7030.desc
	theme = battle
	left_portrait = {
		character = root
		animation = disbelief
	}

	# wtf ref!
	option = {
		name = yearly.7030.a

		stress_impact = {
			trusting = massive_stress_impact_gain
		}

		add_character_flag = let_cheater_go

		trigger_event = {
			id = yearly.7040
			days = { 1 3 }
		}
	}

	# Get him!
	option = {
		name = yearly.7030.b

		stress_impact = {
			paranoid = miniscule_stress_impact_gain
			vengeful = miniscule_stress_impact_gain
			trusting = massive_stress_impact_gain
		}

		random_list = {
			60 = {

				custom_tooltip = yearly.7030.b.win

				add_character_flag = caught_cheater

				send_interface_toast = {
					title = yearly.7030.b.win
					left_icon = root
					add_prestige = miniscule_prestige_gain
					}

				modifier = {
					add = 20
					prowess > 5
				}

				modifier = {
					add = 30
					prowess > 10
				}

				modifier = {
					add = 40
					prowess > 15
				}

				modifier = {
					add = 50
					prowess > 20
				}

				trigger_event = {
					id = yearly.7040
					days = { 1 3 }
				}
			}
			
		
			40 = {

				add_character_flag = let_cheater_go

				custom_tooltip = yearly.7030.b.lose

				send_interface_toast = {
					title = yearly.7030.b.lose
					left_icon = root
					add_prestige = miniscule_prestige_loss
				}

				trigger_event = {
					id = yearly.7040
					days = { 1 3 }
				}
			}
		}
	}


	# Damn you're gullible
	option = {
		name = yearly.7030.c

		trigger = {
			has_trait = trusting
			}

		trait = trusting

		add_character_flag = let_cheater_go

		stress_impact = {
			trusting = minor_stress_impact_loss
		}

		trigger_event = {
			id = yearly.7040
			days = { 1 3 }
		}
	}
}

# Second half: Bladed boots
yearly.7031 = {
	type = character_event
	title = yearly.7031.t
	desc = yearly.7031.desc
	theme = battle
	left_portrait = {
		character = root
		animation = shock
	}

	# Get the shoes off him!
	option = {
		name = yearly.7031.a

		add_internal_flag = dangerous

		random_list = {
			50 = {

			add_character_flag = stole_shoes

			send_interface_toast = {
				title = yearly.7031.a.win
				left_icon = root
				}

			custom_tooltip = yearly.7031.a.win

			modifier = {
				add = 20
				prowess > 5
			}

			modifier = {
				add = 30
				prowess > 10
			}

			modifier = {
				add = 40
				prowess > 15
			}

			modifier = {
				add = 50
				prowess > 20
			}
		}
			
			50 = {

			add_character_flag = kicked_by_blades

			send_interface_toast = {
				title = yearly.7031.a.lose
				left_icon = root
				add_prestige = minor_prestige_loss
				increase_wounds_effect = { REASON = fight }
				}
			}
		}

		trigger_event = {
			id = yearly.7040
			days = { 1 3 }
		}
	}

	# Stay away from him
	option = {
		name = yearly.7031.b

		add_character_flag = kicked_by_blades

		trigger_event = {
			id = yearly.7040
			days = { 1 3 }
		}
	}

	# What a great idea...
	option = {
		name = yearly.7031.c

		trigger = {
			has_trait = sadistic
		}

		trait = sadistic

		add_dread = minor_dread_gain

		add_character_flag = kicked_by_blades

		stress_impact = {
			sadistic = miniscule_stress_impact_loss
		}

		trigger_event = {
			id = yearly.7040
			days = { 1 3 }
		}
	}
}

# Second half: Drinks break
yearly.7032 = {
	type = character_event
	title = yearly.7032.t
	desc = yearly.7032.desc
	theme = battle
	left_portrait = {
		character = root
		animation = happiness
	}

	# Water please
	option = {
		name = yearly.7032.a

		add_character_flag = water_refreshments

		remove_short_term_gold = minor_gold_value

		trigger_event = {
			id = yearly.7040
			days = { 1 3 }
		}
	}

	# Beer please
	option = {
		name = yearly.7032.b

		trigger = {
			root = {
				drinks_alcohol_trigger = yes
			}
		}

		remove_short_term_gold = minor_gold_value

		add_character_flag = alcoholic_refreshments

		stress_impact = {
			gluttonous = miniscule_stress_impact_loss
			temperate = major_stress_impact_gain
		}

		trigger_event = {
			id = yearly.7040
			days = { 1 3 }
		}
	}

	# Bring me wine!
	option = {
		name = yearly.7032.c

		trigger = {
			root = {
				drinks_alcohol_trigger = yes
			}
			OR = {
				has_trait = reveler_1
				has_trait = reveler_2
				has_trait = reveler_3
			}
		}

		add_character_flag = alcoholic_refreshments

		remove_short_term_gold = medium_gold_value

		trait = reveler_1
		trait = reveler_2
		trait = reveler_3

		stress_impact = {
			reveler_1 = minor_stress_impact_loss
			reveler_2 = minor_stress_impact_loss
			reveler_3 = minor_stress_impact_loss
		}

		trigger_event = {
			id = yearly.7040
			days = { 1 3 }
		}
	}

	# I'd love a hashish cake...
	option = {
		name = yearly.7032.d

		trigger = {
			root = {
				drinks_alcohol_trigger = no
				OR = {
					has_trait = hashishiyah
					can_be_hashishiyah = yes
				}
			}
		}

		add_character_flag = alcoholic_refreshments

		remove_short_term_gold = medium_gold_value

		add_stress = minor_stress_loss

		trigger_event = {
			id = yearly.7040
			days = { 1 3 }
		}
	}
}

# Second half: Bowyer and dyer fight
yearly.7033 = {
	type = character_event
	title = yearly.7033.t
	desc = yearly.7033.desc
	theme = battle
	left_portrait = {
		character = root
		animation = rage
	}

	# Break it up!
	option = {
		name = yearly.7033.a

		add_internal_flag = dangerous

		random_list = {
			50 = {

				add_character_flag = broke_up_fight

				custom_tooltip = yearly.7021.c.tt.escape

				send_interface_toast = {
					title = yearly.7033.a.win
					left_icon = root
				}

				modifier = {
					add = 20
					prowess > 5
				}

				modifier = {
					add = 30
					prowess > 10
				}

				modifier = {
					add = 40
					prowess > 15
				}

				modifier = {
					add = 50
					prowess > 20
				}
			}

			50 = {

				add_character_flag = escalated_fight

				send_interface_toast = {
					title = yearly.7033.a.lose
					left_icon = root
					add_prestige = minor_prestige_loss
					increase_wounds_effect = { REASON = fight }
				}
			}
		}

		trigger_event = {
			id = yearly.7040
			days = { 1 3 }
		}
	}

	# Leave them to it
	option = {
		name = yearly.7033.b

		custom_tooltip = yearly.7010.tt.lose

		add_character_flag = escalated_fight

		trigger_event = {
			id = yearly.7040
			days = { 1 3 }
		}
	}
}

# Match resolution holding event
yearly.7040 = {
	type = character_event
	title = yearly.7040.t
	desc = yearly.7040.desc
	theme = battle
	left_portrait = {
		character = root
		animation = pain
	}

	# Victory decider
	option = {
		name = yearly.7040.a

	hidden_effect = {
		change_current_weight = -2
		random_list = {	# Big Victory - has more than 3 positive flags
			10 = {
				trigger_event = {
					id = yearly.7041
					days = { 1 3 }
				}
				modifier = {
					add = 100
					calc_true_if = {
						amount = 3
						has_character_flag = retained_star
						has_character_flag = became_star
						has_character_flag = poisoned_pies
						has_character_flag = yeeted_cart
						has_character_flag = took_peds
						has_character_flag = berserker_start
						has_character_flag = stole_rock
						has_character_flag = stole_ball
						has_character_flag = punched_priest
						has_character_flag = caught_cheater
						has_character_flag = stole_shoes
						has_character_flag = water_refreshments
						has_character_flag = broke_up_fight
					}
				}
			}
			10 = { 	# Victory - has between 1 and 3 positive flags
				trigger_event = {
					id = yearly.7042
					days = { 1 3 }
				}
				modifier = {
					add = 100
					calc_true_if = {
						amount = 2
						has_character_flag = retained_star
						has_character_flag = became_star
						has_character_flag = poisoned_pies
						has_character_flag = yeeted_cart
						has_character_flag = took_peds
						has_character_flag = berserker_start
						has_character_flag = stole_rock
						has_character_flag = stole_ball
						has_character_flag = punched_priest
						has_character_flag = caught_cheater
						has_character_flag = stole_shoes
						has_character_flag = water_refreshments
						has_character_flag = broke_up_fight
					}
				}
			}
			10 = {	# Draw - has 1 at most positive or negative flag
				trigger_event = {
					id = yearly.7043
					days = { 1 3 }
				}
				modifier = {
					add = 100
					calc_true_if = {
						amount = 1
						has_character_flag = retained_star
						has_character_flag = became_star
						has_character_flag = poisoned_pies
						has_character_flag = yeeted_cart
						has_character_flag = took_peds
						has_character_flag = berserker_start
						has_character_flag = stole_rock
						has_character_flag = stole_ball
						has_character_flag = punched_priest
						has_character_flag = caught_cheater
						has_character_flag = stole_shoes
						has_character_flag = water_refreshments
						has_character_flag = broke_up_fight
						has_character_flag = lost_star
						has_character_flag = left_cart
						has_character_flag = left_peds
						has_character_flag = hit_with_rock
						has_character_flag = winsome_stranger
						has_character_flag = let_priest_go
						has_character_flag = let_cheater_go
						has_character_flag = kicked_by_blades
						has_character_flag = alcoholic_refreshments
						has_character_flag = escalated_fight
					}
				}
			}
			10 = {	# Defeat - has between 1 and 3 negative flags
				trigger_event = {
					id = yearly.7044
					days = { 1 3 }
				}
					modifier = {
						add = 100
						calc_true_if = {
							amount = 2
							has_character_flag = lost_star
							has_character_flag = left_cart
							has_character_flag = left_peds
							has_character_flag = hit_with_rock
							has_character_flag = winsome_stranger
							has_character_flag = let_priest_go
							has_character_flag = let_cheater_go
							has_character_flag = kicked_by_blades
							has_character_flag = alcoholic_refreshments
							has_character_flag = escalated_fight
						}
					}
				}
			10 = {	# Big Defeat - has more than 3 negative flags
				trigger_event = {
					id = yearly.7045
					days = { 1 3 }
				}
					modifier = {
						add = 100
						calc_true_if = {
							amount = 3
							has_character_flag = lost_star
							has_character_flag = left_cart
							has_character_flag = left_peds
							has_character_flag = hit_with_rock
							has_character_flag = winsome_stranger
							has_character_flag = let_priest_go
							has_character_flag = let_cheater_go
							has_character_flag = kicked_by_blades
							has_character_flag = alcoholic_refreshments
							has_character_flag = escalated_fight
						}
					}
				}
			}
		}
	}

	after = {
		remove_character_flag = retained_star
		remove_character_flag = became_star
		remove_character_flag = poisoned_pies
		remove_character_flag = yeeted_cart
		remove_character_flag = took_peds
		remove_character_flag = berserker_start
		remove_character_flag = stole_rock
		remove_character_flag = stole_ball
		remove_character_flag = punched_priest
		remove_character_flag = caught_cheater
		remove_character_flag = stole_shoes
		remove_character_flag = water_refreshments
		remove_character_flag = broke_up_fight
		remove_character_flag = lost_star
		remove_character_flag = left_cart
		remove_character_flag = left_peds
		remove_character_flag = hit_with_rock
		remove_character_flag = winsome_stranger
		remove_character_flag = let_priest_go
		remove_character_flag = let_cheater_go
		remove_character_flag = kicked_by_blades
		remove_character_flag = alcoholic_refreshments
		remove_character_flag = escalated_fight
	}
}

yearly.7041 = {
	type = character_event
	title = yearly.7041.t
	desc = {
		desc = yearly.7041.desc
		desc = yearly.7041.desc.ending
	}
	theme = recovery
	override_background = { event_background = market }
	left_portrait = {
		character = root
		animation = throne_room_cheer_2
	}

	# Have a celebratory drink
	option = {
		name = yearly.7041.a

		add_prestige = major_prestige_value
		add_character_modifier = {
			modifier = footballer_modifier
			years = 5
		}
	}

	# Commission a cup
	option = {
		name = yearly.7041.b
		trigger = { has_dlc_feature = royal_court }

		add_character_modifier = {
			modifier = footballer_modifier
			years = 5
		}

		save_scope_value_as = {
			name = quality
			value = 40
		}
		save_scope_value_as = {
			name = wealth
			value = 40
		}

		create_artifact = {
			name = football_cup
			description = football_cup_desc
			type = goblet
			visuals = goblet
			wealth = 40
			quality = 40
			modifier = artifact_monthly_prestige_1_modifier
			modifier = artifact_negate_prowess_penalty_add_1_modifier
		}
	}
}

yearly.7042 = {
	type = character_event
	title = yearly.7042.t
	desc = {
		desc = yearly.7042.desc
		desc = yearly.7041.desc.ending
	}
	theme = recovery
	override_background = { event_background = market }
	left_portrait = {
		character = root
		animation = throne_room_cheer_2
	}

	# Have a celebratory drink
	option = {
		name = yearly.7042.a

		add_prestige = medium_prestige_value
		add_character_modifier = {
			modifier = footballer_modifier
			years = 2
		}
	}

	# Commission a cup
	option = {
		name = yearly.7042.b
		trigger = { has_dlc_feature = royal_court }

		add_character_modifier = {
			modifier = footballer_modifier
			years = 2
		}

		save_scope_value_as = {
			name = quality
			value = 40
		}
		save_scope_value_as = {
			name = wealth
			value = 40
		}

		create_artifact = {
			name = football_cup
			description = football_cup_desc
			type = goblet
			visuals = goblet
			wealth = 40
			quality = 40
			modifier = artifact_monthly_prestige_2_modifier
			modifier = artifact_negate_prowess_penalty_add_2_modifier
		}
	}
}


yearly.7043 = {
	type = character_event
	title = yearly.7043.t
	desc = {
		desc = yearly.7043.desc
		desc = yearly.7041.desc.ending
	}
	theme = recovery
	override_background = { event_background = market }
	left_portrait = {
		character = root
		animation = war_over_tie
	}

	# Wander away listlessly
	option = {
		name = yearly.7043.a

		add_character_modifier = {
			modifier = footballer_health_modifier
			years = 1
		}
	}
}

yearly.7044 = {
	type = character_event
	title = yearly.7044.t
	desc = {
		desc = yearly.7044.desc
		desc = yearly.7041.desc.ending
	}
	theme = recovery
	override_background = { event_background = market }
	left_portrait = {
		character = root
		animation = throne_room_applaud_1
	}

	# Be a gracious loser
	option = {
		name = yearly.7044.a

		stress_impact = {
			arrogant = major_stress_gain
			ambitious = minor_stress_gain
			gregarious = miniscule_stress_impact_loss
			humble = miniscule_stress_impact_loss
		}

		add_prestige = miniscule_prestige_value

		add_character_modifier = {
			modifier = footballer_health_modifier
			years = 1
		}
	}

	# Be a bad loser
	option = {
		name = yearly.7044.b

		stress_impact = {
			arrogant = minor_stress_loss
			ambitious = miniscule_stress_impact_loss
			gregarious = minor_stress_gain
			humble = minor_stress_gain
		}

		add_character_modifier = {
			modifier = footballer_health_modifier
			years = 2
		}
	}

	# Commission a participation trophy
	option = {
		name = yearly.7044.c

		trigger = {
			has_trait = arrogant
			has_dlc_feature = royal_court
		}

		trait = arrogant

		stress_impact = {
			arrogant = minor_stress_loss
		}

		save_scope_value_as = {
			name = quality
			value = 20
		}
		save_scope_value_as = {
			name = wealth
			value = 20
		}

		create_artifact = {
			name = participation_trophy
			description = participation_trophy_desc
			type = goblet
			visuals = goblet
			wealth = 20
			quality = 20
			modifier = artifact_stress_gain_1_modifier
			modifier = artifact_vassal_opinion_penalty_1_modifier
		}
	}
}

yearly.7045 = {
	type = character_event
	title = yearly.7045.t
	desc = {
		desc = yearly.7045.desc
		desc = yearly.7041.desc.ending
	}
	theme = recovery
	override_background = { event_background = market }
	left_portrait = {
		character = root
		animation = loss_1
	}



	# Be a gracious loser
	option = {
		name = yearly.7045.a

		stress_impact = {
			arrogant = major_stress_gain
			ambitious = minor_stress_gain
			gregarious = miniscule_stress_impact_loss
			humble = miniscule_stress_impact_loss
		}

		add_prestige = miniscule_prestige_value

		add_character_modifier = {
			modifier = footballer_health_modifier
			years = 1
		}
	}

	# Be a bad loser
	option = {
		name = yearly.7045.b

		stress_impact = {
			arrogant = minor_stress_loss
			ambitious = miniscule_stress_impact_loss
			gregarious = minor_stress_gain
			humble = minor_stress_gain
		}

		add_character_modifier = {
			modifier = footballer_health_modifier
			years = 2
		}
	}

	# Commission a participation trophy
	option = {
		name = yearly.7045.c

		trigger = {
			has_trait = arrogant
			has_dlc_feature = royal_court
		}

		trait = arrogant

		stress_impact = {
			arrogant = minor_stress_loss
		}

		save_scope_value_as = {
			name = quality
			value = 20
		}
		save_scope_value_as = {
			name = wealth
			value = 20
		}

		create_artifact = {
			name = participation_trophy
			description = participation_trophy_desc
			type = goblet
			visuals = goblet
			wealth = 20
			quality = 20
			modifier = artifact_stress_gain_2_modifier
			modifier = artifact_vassal_opinion_penalty_1_modifier
		}
	}
}

