﻿namespace = legend_spread_events

############################
## Legend Spread Events
## 8000-8999
## by James Beaumont
############################

# legend_spread_events.8000 - I am descended from an ancient people, I must travel to their homelands to find evidence

############################
## Ancient people ancestry tome
## 8000-8009
## by James Beaumont
############################

# I am descended from an ancient people, I must travel to their homelands to find evidence
legend_spread_events.8000 = {
	type = character_event
	title = legend_spread_events.8000.t
	desc = legend_spread_events.8000.desc
	theme = legend
	left_portrait = {
		character = root
		animation = personality_honorable
	}
	
	trigger = {
		is_available_adult = yes
		promoted_legend ?= {
			has_legend_chronicle = ancient_people
			NOT = {
				exists = var:had_lspe_8000
			}
		}
		any_county_in_region = {
			region = promoted_legend.legend_property:original_region
			this.holder.top_liege != root.top_liege
		}
	}

	cooldown = { years = 25 }

	immediate = {
		grab_appropriate_chronicler_effect = yes
		promoted_legend = { save_scope_as = promoted_legend }
		random_county_in_region = {
			region = promoted_legend.legend_property:original_region
			limit = {
				this.holder.top_liege != root.top_liege
			}
			random_county_province = { save_scope_as = province_to_visit }
		}
	}

	option = { #A worthwhile expedition!
		name = legend_spread_events.8000.a
		custom_tooltip = {
			text = travel_to_tome_tt
			start_travel_plan = { 
				destination = scope:province_to_visit
				return_trip = yes
				on_arrival_event = legend_spread_events.8002
				on_travel_planner_cancel_event = legend_spread_events.8001
			}
			promoted_legend = {
				set_variable = {
					name = had_lspe_8000
					value = yes
				}
			}
		}
		stress_impact = {
			lazy = medium_stress_impact_gain # You want me to go all the way to X place? I'm staying here.
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -1
				ai_honor = 1
			}
		}
	}
	
	option = { # Sod that
		name = legend_spread_events.8000.b
		stress_impact = {
			content = medium_stress_impact_loss
			ambitious = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_honor = -1
			}
		}
	}
}

# I foolishly cancelled my travel plan, the information is lost forever
legend_spread_events.8001 = {
	type = character_event
	title = legend_spread_events.8001.t
	desc = legend_spread_events.8001.desc
	theme = legend
	override_background = { reference = wilderness }
	left_portrait = {
		character = root
		animation = admiration
	}

	option = { # Dangit
		name = legend_spread_events.8001.a
		ai_chance = {
			base = 100
		}
	}
}

# I have arrived, let's look for that tome!
legend_spread_events.8002 = {
	type = character_event
	title = legend_spread_events.8002.t
	desc = legend_spread_events.8002.desc
	theme = legend
	override_background = { reference = wilderness }
	left_portrait = {
		character = root
		animation = admiration
	}

	immediate = {
		current_travel_plan = { delay_travel_plan = { months = 1 } }
	}

	option = { # Let's seek it out
		name = legend_spread_events.8002.a
		show_as_unavailable = { always = yes } # Make scholars feel cool
		trigger = {
			NOT = { has_trait = scholar }
		}
		duel = {
			skills = { stewardship learning }
			value = decent_skill_rating
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				custom_tooltip = {
					text = you_find_the_tome_tt
					trigger_event = {
						id = legend_spread_events.8003
						days = { 2 14 }
					}
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				custom_tooltip = {
					text = you_fail_to_find_the_tome_tt
					trigger_event = {
						id = legend_spread_events.8004
						days = { 2 14 }
					}
				}
			}
		}
		stress_impact = {
			patient = minor_stress_impact_loss
			impatient = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_boldness = -0.5 # I'd rather smash
			}
		}
	}

	option = { # Smash my way through until I find what I'm looking for
		name = legend_spread_events.8002.b
		show_as_unavailable = { always = yes } # Make scholars feel cool
		trigger = {
			NOT = { has_trait = scholar }
		}
		duel = {
			skill = prowess
			value = high_skill_rating
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				custom_tooltip = {
					text = you_destroy_the_tome_tt
					send_interface_toast = {
						title = you_destroy_the_tome_tt
						left_icon = root
						add_stress = minor_stress_gain
						promoted_legend = {
							change_legend_quality_effect = { VALUE = minor_legend_quality_decrease }
						}
						current_travel_plan = { resume_travel_plan = yes }
					}
				}
			}
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
					min = -49
				}
				custom_tooltip = {
					text = you_find_the_tome_tt
					trigger_event = {
						id = legend_spread_events.8003
						days = { 2 14 }
					}
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				custom_tooltip = {
					text = you_fail_to_find_the_tome_tt
					trigger_event = {
						id = legend_spread_events.8004
						days = { 2 14 }
					}
				}
			}
		}
		stress_impact = {
			impatient = minor_stress_impact_loss
			patient = minor_stress_impact_gain
			diligent = minor_stress_impact_gain
			calm = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -1
				ai_boldness = 1 # SMASH!
			}
		}
	}

	option = { # There's so much else to see here!
		name = legend_spread_events.8002.c
		add_learning_lifestyle_xp = medium_lifestyle_xp
		add_character_modifier = {
			modifier = studying_ancient_cultures
			years = 10
		}
		current_travel_plan = { resume_travel_plan = yes }
		stress_impact = {
			content = medium_stress_impact_loss
			patient = minor_stress_impact_loss
			impatient = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
			ambitious = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 0.5
				ai_boldness = -0.5
			}
		}
	}

	option = { # I'm a scholar so I'm able to just find it instantly
		name = legend_spread_events.8002.d
		trigger = { has_trait = scholar }
		custom_tooltip = {
			text = you_find_the_tome_tt
			trigger_event = { 
				id = legend_spread_events.8003
				days = { 2 14 }
			}
		}
		stress_impact = {
			scholar = medium_stress_impact_loss
			patient = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_boldness = 1
				ai_honor = 1
			}
		}
	}
}

# I found the tome! :wahoohellyeah:
legend_spread_events.8003 = {
	type = character_event
	title = legend_spread_events.8003.t
	desc = legend_spread_events.8003.desc
	theme = legend
	override_background = { reference = ce1_catacombs }
	left_portrait = {
		character = root
		animation = ecstasy
	}
	artifact = {
		target = scope:ancient_artifact
		position = lower_right_portrait
	}

	immediate = {
		add_prestige = major_prestige_gain
		promoted_legend = {
			change_legend_quality_effect = { VALUE = major_legend_quality_increase }
		}
		if = {
			limit = { artifacts_use_indian_books_trigger = no }
			if = {
				limit = {
					has_royal_court = yes
				}
				create_artifact = {
					name = ancient_culture_tome
					description = ancient_culture_tome_desc
					type = pedestal
					modifier = artifact_court_grandeur_baseline_add_4_modifier
					modifier = artifact_monthly_dynasty_prestige_1_modifier
					modifier = artifact_legend_spread_mult_5_modifier
					durability = 25
					max_durability = 50
					decaying = yes
					visuals = book
					generate_history = no
					quality = 100
					wealth = 100
					save_scope_as = ancient_artifact
				}
			}
			else = {
				create_artifact = {
					name = ancient_culture_tome
					description = ancient_culture_tome_desc
					type = journal
					modifier = artifact_court_grandeur_baseline_add_4_modifier
					modifier = artifact_monthly_dynasty_prestige_1_modifier
					modifier = artifact_legend_spread_mult_5_modifier
					durability = 25
					max_durability = 50
					decaying = yes
					visuals = book
					generate_history = no
					quality = 100
					wealth = 100
					save_scope_as = ancient_artifact
				}
			}
		}
		else = {
			if = {
				limit = {
					has_royal_court = yes
				}
				create_artifact = {
					name = ancient_culture_tome
					description = ancient_culture_tome_desc
					type = pedestal
					modifier = artifact_court_grandeur_baseline_add_4_modifier
					modifier = artifact_monthly_dynasty_prestige_1_modifier
					modifier = artifact_legend_spread_mult_5_modifier
					durability = 25
					max_durability = 50
					decaying = yes
					visuals = indian_book
					generate_history = no
					quality = 100
					wealth = 100
					save_scope_as = ancient_artifact
				}
			}
			else = {
				create_artifact = {
					name = ancient_culture_tome
					description = ancient_culture_tome_desc
					type = journal
					modifier = artifact_court_grandeur_baseline_add_4_modifier
					modifier = artifact_monthly_dynasty_prestige_1_modifier
					modifier = artifact_legend_spread_mult_5_modifier
					durability = 25
					max_durability = 50
					decaying = yes
					visuals = indian_book
					generate_history = no
					quality = 100
					wealth = 100
					save_scope_as = ancient_artifact
				}
			}
		}
	}

	option = { # Love that for me, time to go home tho
		name = legend_spread_events.8003.a
		current_travel_plan = { resume_travel_plan = yes }
		ai_chance = {
			base = 100
		}
	}
}

# I didn't find the tome, but I did find this cool artifact
legend_spread_events.8004 = {
	type = character_event
	title = legend_spread_events.8004.t
	desc = legend_spread_events.8004.desc
	theme = legend
	override_background = { reference = ce1_catacombs }
	left_portrait = {
		character = root
		animation = ecstasy
	}
	artifact = {
		target = scope:ancient_artifact
		position = lower_right_portrait
	}

	immediate = {
		add_prestige = major_prestige_gain
		promoted_legend = {
			change_legend_quality_effect = { VALUE = minor_legend_quality_increase }
		}
		create_artifact = {
			name = ancient_culture_artifact
			description = ancient_culture_artifact_desc
			type = miscellaneous
			modifier = artifact_legend_spread_mult_1_modifier
			modifier = artifact_monthly_dynasty_prestige_1_modifier
			durability = 25
			max_durability = 50
			decaying = yes
			visuals = animal_figurine
			generate_history = no
			quality = 50
			wealth = 50
			save_scope_as = ancient_artifact
		}
	}

	option = { # Love that for me, time to go home tho
		name = legend_spread_events.8004.a
		current_travel_plan = { resume_travel_plan = yes }
		ai_chance = {
			base = 100
		}
	}
}

############################
## Travel event, someone hears of your heroic legend and wants to duel you, travel event
## 8010
## by James Beaumont
############################
legend_spread_events.8010 = {
	type = character_event
	title = legend_spread_events.8010.t
	desc = legend_spread_events.8010.desc
	theme = travel
	override_background = { reference = wilderness }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				ai_boldness >= medium_positive_boldness
			}
			animation = anger
		}
		triggered_animation = {
			trigger = {
				always = yes
			}
			animation = fear
		}
	}
	right_portrait = {
		character = scope:challenger
		animation = eccentric
		hide_info = yes # It's cooler this way
	}

	trigger = {
		exists = promoted_legend
		is_adult = yes
		promoted_legend = {
			legend_owner = root
			legend_type = legend_type:heroic
		}
		is_location_valid_for_travel_event_on_land = yes
	}

	cooldown = { years = 100 }

	immediate = {
		if = {
			limit = {
				any_pool_character = {
					province = root.location
					ai_boldness >= medium_positive_boldness
					ai_vengefulness >= medium_positive_vengefulness
					prowess >= high_skill_rating
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				}
			}
			random_pool_character = {
				province = root.location
				limit = {
					ai_boldness >= medium_positive_boldness
					ai_vengefulness >= medium_positive_vengefulness
					prowess >= high_skill_rating
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				}
				save_scope_as = challenger
			}
		}
		else = {
			create_character = {
				location = this.location
				template = ce1_hooded_figure_template
				save_scope_as = challenger
			}
		}
		current_travel_plan = { delay_travel_plan = { months = 1 } }
	}

	option = { # Pick it up.
		name = legend_spread_events.8010.a
		custom_tooltip = legend_quality_if_wins_tt
		configure_start_single_combat_effect = {
			SC_INITIATOR = root
			SC_ATTACKER = scope:challenger
			SC_DEFENDER = root
			FATALITY = no
			FIXED = no
			LOCALE = tavern
			OUTPUT_EVENT = legend_spread_events.8011
			INVALIDATION_EVENT = fp1_tbc.0021
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = 1
				ai_energy = 0.1
			}
		}
	}

	option = { # Run.
		name = legend_spread_events.8010.b
		add_prestige = medium_prestige_loss
		current_travel_plan = { resume_travel_plan = yes }
		stress_impact = {
			brave = medium_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = -1
				ai_honor = -1
				ai_energy = -0.1
			}
		}
	}
}
#SCE output events
legend_spread_events.8011 = {
	hidden = yes
	type = character_event
	immediate = {
		if = { # Defeat
			limit = {
				scope:sc_victor = scope:challenger
			}
			trigger_event = legend_spread_events.8012
		}
		else = {
			trigger_event = legend_spread_events.8013
		}
	}
}
#Defeat
legend_spread_events.8012 = {
	type = character_event
	title = legend_spread_events.8012.t
	desc = legend_spread_events.8012.desc
	theme = legend
	override_background = { reference = wilderness }
	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		character = scope:challenger
		animation = schadenfreude
		hide_info = yes
	}

	immediate = {
		current_travel_plan = { resume_travel_plan = yes }
	}

	option = { # Damn
		name = legend_spread_events.8012.a
		trigger = {
			NOT = { has_trait = schemer }
		}
		show_as_unavailable = { always = yes }
		promoted_legend = {
			change_legend_quality_effect = { VALUE = medium_legend_quality_decrease }
		}
		stress_impact = {
			ambitious = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			vengeful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = { # Damn, but also I'm sneaky
		name = legend_spread_events.8012.b
		trigger = {
			has_trait = schemer
		}
		stress_impact = {
			ambitious = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			vengeful = minor_stress_impact_gain
			deceitful = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}
}
#Victory
legend_spread_events.8013 = {
	type = character_event
	title = legend_spread_events.8013.t
	desc = legend_spread_events.8013.desc
	theme = legend
	override_background = { reference = wilderness }
	left_portrait = {
		character = root
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:challenger
		animation = fear
		hide_info = yes
	}

	immediate = {
		current_travel_plan = { resume_travel_plan = yes }
		promoted_legend = {
			change_legend_quality_effect = { VALUE = medium_legend_quality_increase }
		}
	}

	option = { # Wahoo
		name = legend_spread_events.8013.a
		ai_chance = {
			base = 100
		}
	}
}

############################
## Holy legend, accused of heresy
## 8020
## by James Beaumont
############################
scripted_trigger valid_zealous_guy_trigger = {
	ai_boldness >= medium_positive_boldness
	ai_zeal >= low_positive_boldness
	learning >= medium_skill_rating
}
legend_spread_events.8020 = {
	type = character_event
	title = legend_spread_events.8020.t
	desc = legend_spread_events.8020.desc
	theme = legend
	override_background = { reference = throne_room }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				ai_boldness >= medium_positive_boldness
			}
			animation = anger
		}
		animation = fear
	}
	right_portrait = {
		character = scope:challenger
		animation = rage
	}

	cooldown = { years = 15 }

	trigger = {
		promoted_legend ?= {
			legend_type = legend_type:holy
		}
		is_available_adult = yes
		OR = {
			any_courtier_or_guest = { valid_zealous_guy_trigger = yes }
			any_pool_character = {
				province = root.location
				valid_zealous_guy_trigger = yes
			}
		}
	}

	immediate = {
		if = {
			limit = {
				any_courtier_or_guest = { valid_zealous_guy_trigger = yes }
			}
			random_courtier_or_guest = {
				limit = {
					valid_zealous_guy_trigger = yes
				}
				save_scope_as = challenger
			}
		}
		else = {
			random_pool_character = {
				province = root.location
				limit = { valid_zealous_guy_trigger = yes }
				save_scope_as = challenger
			}
		}
		promoted_legend = { save_scope_as = legend }
	}

	option = { # Ah, you see, if you read this verse, clearly it's not heresy
		name = legend_spread_events.8020.c
		trigger = {
			has_trait = theologian
		}
		add_piety = medium_piety_gain
		promoted_legend = {
			change_legend_quality_effect = { VALUE = medium_legend_quality_increase }
		}
		ai_chance = {
			base = 1000
		}
	}

	option = { # Nonsense!
		name = legend_spread_events.8020.a
		duel = {
			skill = learning
			target = scope:challenger
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8020.a.win
					left_icon = root
					right_icon = scope:challenger
					add_piety = medium_piety_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_increase
						}
					}
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8020.a.lose
					left_icon = root
					right_icon = scope:challenger
					add_stress = minor_stress_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_decrease
						}
					}
				}
			}
		}
		stress_impact = {
			humble = medium_stress_impact_gain
			honest = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1 # I cannot be a heretic
				ai_honor = 1
				ai_energy = 1
			}
		}
	}

	option = { # Get out.
		name = legend_spread_events.8020.b
		add_piety = minor_piety_loss
		add_prestige = minor_prestige_gain
		scope:challenger = { select_and_move_to_pool_effect = yes }
		stress_impact = {
			base = minor_stress_impact_loss
			zealous = medium_stress_impact_gain
			diligent = minor_stress_impact_gain
			just = medium_stress_impact_gain
			arbitrary = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = -1
				ai_boldness = -1
				ai_energy = -1
			}
		}
	}
}

############################
## Your kid wants to emulate your legend
## 8030
## by James Beaumont
############################
scripted_trigger valid_for_legend_8030 = {
	child_not_infant_trigger = yes
	child_not_teen_trigger = yes
	location = root.location
	OR = {
		opinion = {
			target = root
			value >= high_positive_opinion
		}
		has_relation_friend = root
	}
}

legend_spread_events.8030 = {
	type = character_event
	title = legend_spread_events.8030.t
	desc = legend_spread_events.8030.desc
	theme = legend
	override_background = { reference = bp2_courtyard }
	left_portrait = {
		character = root
		animation = personality_bold
	}
	right_portrait = {
		character = scope:child
		animation = aggressive_wooden_sword
	}

	trigger = {
		promoted_legend ?= {
			legend_owner = root
		}
		is_available_adult = yes
		OR = {
			any_warden_hostage = { valid_for_legend_8030 = yes }
			any_child = { valid_for_legend_8030 = yes }
			any_relation = {
				type = ward
				valid_for_legend_8030 = yes
			}
		}
	}

	cooldown = { years = 15 }

	immediate = {
		random_list = {
			10 = {
				trigger = {
					any_warden_hostage = { valid_for_legend_8030 = yes }
				}
				random_warden_hostage = {
					limit = { valid_for_legend_8030 = yes }
					save_scope_as = child
				}
			}
			15 = {
				trigger = {
					any_child = { valid_for_legend_8030 = yes }
				}
				random_child = {
					limit = { valid_for_legend_8030 = yes }
					save_scope_as = child
				}
			}
			10 = {
				trigger = {
					any_relation = {
						type = ward
						valid_for_legend_8030 = yes
					}
				}
				random_relation = {
					type = ward
					limit = { valid_for_legend_8030 = yes }
					save_scope_as = child
				}
			}
		}
		promoted_legend = { save_scope_as = legend }
	}

	option = { # Go sing my praises to the other kids!
		name = legend_spread_events.8030.a
		add_character_modifier = {
			modifier = kids_legend_modifier
			years = 10
		}
		stress_impact = {
			humble = minor_stress_impact_gain
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
				ai_energy = 1
			}
		}
	}

	option = { # Use this as a bonding opportunity
		name = legend_spread_events.8030.b
		progress_towards_friend_effect = {
			CHARACTER = scope:child
			REASON = friend_legendary_tale
			OPINION = default_friend_opinion
		}
		if = {
			limit = {
				promoted_legend = { legend_type = legend_type:heroic }
			}
			scope:child = {
				add_martial_skill = 1
			}
		}
		else_if = {
			limit = {
				promoted_legend = { legend_type = legend_type:holy }
			}
			scope:child = {
				add_learning_skill = 1
			}
		}
		else_if = {
			limit = {
				promoted_legend = { legend_type = legend_type:legitimizing }
			}
			scope:child = {
				add_stewardship_skill = 1
			}
		}
		stress_impact = {
			shy = minor_stress_impact_gain
			arrogant = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = 1
			}
		}
	}
}

############################
## Someone argues your ancestor was actually a bad dude
## 8040
## by James Beaumont
############################
legend_spread_events.8040 = {
	type = character_event
	title = legend_spread_events.8040.t
	desc = legend_spread_events.8040.desc
	theme = legend
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				ai_boldness >= medium_positive_boldness
			}
			animation = anger
		}
		animation = fear
	}
	right_portrait = {
		character = scope:challenger
		animation = rage
	}
	lower_right_portrait = {
		character = scope:ancestor
	}

	trigger = {
		promoted_legend ?= {
			legend_owner = root
			exists = legend_property:ancestor
			exists = legend_property:ancestor.culture # Make sure the ancestor is a character, not a flag
			legend_property:ancestor = { # There is a sinful trait your ancestor *doesn't* have
				this != root
				any_trait_in_category = {
					category = personality
					NOT = { prev = { has_trait = prev } }
					root.faith = { trait_is_sin = prev }
				}
			}
		}
		is_available_adult = yes
		OR = {
			any_courtier_or_guest = { valid_zealous_guy_trigger = yes }
			any_pool_character = {
				province = root.location
				valid_zealous_guy_trigger = yes
			}
		}
	}

	cooldown = { years = 15 }

	immediate = {
		if = {
			limit = {
				any_courtier_or_guest = { valid_zealous_guy_trigger = yes }
			}
			random_courtier_or_guest = {
				limit = {
					valid_zealous_guy_trigger = yes
				}
				save_scope_as = challenger
			}
		}
		else = {
			random_pool_character = {
				province = root.location
				limit = { valid_zealous_guy_trigger = yes }
				save_scope_as = challenger
			}
		}
		promoted_legend = {
			save_scope_as = legend
			legend_property:ancestor = { save_scope_as = ancestor }
		}
		if = {
			limit = {
				scope:ancestor = {
					any_trait_in_category = { # Using trait in category so it doesn't like make them Pregnant or something, as hilarious as that would be
						category = personality
						prev = { has_trait = prev }
						root.faith = { trait_is_virtue = prev }
					}
				}
			}
			scope:ancestor = {
				random_trait_in_category = {
					category = personality
					limit = {
						prev = { has_trait = prev }
						root.faith = { trait_is_virtue = prev }
					}
					save_scope_as = virtue_trait
				}
			}
		}
		else = {
			scope:ancestor = {
				random_trait_in_category = {
					category = personality
					limit = {
						prev = { has_trait = prev }
						NOT = { root.faith = { trait_is_sin = prev } }
					}
					save_scope_as = virtue_trait
				}
			}
		}
		scope:ancestor = {
			random_trait_in_category = {
				category = personality
				limit = {
					NOT = { prev = { has_trait = prev } }
					root.faith = { trait_is_sin = prev }
				}
				save_scope_as = sin_trait
			}
		}
	}

	option = { # Nonsense!
		name = legend_spread_events.8040.a
		duel = {
			skill = learning
			target = scope:challenger
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8040.a.win
					left_icon = root
					right_icon = scope:challenger
					add_piety = medium_piety_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_increase
						}
					}
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8040.a.lose
					left_icon = root
					right_icon = scope:challenger
					add_stress = minor_stress_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_decrease
						}
						legend_property:ancestor = {
							remove_trait = scope:virtue_trait
							add_trait = scope:sin_trait
						}
					}
				}
			}
		}
		stress_impact = {
			humble = medium_stress_impact_gain
			honest = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
				ai_honor = 1
				ai_energy = 1
			}
		}
	}

	option = { # Get out.
		name = legend_spread_events.8040.b
		add_prestige = minor_prestige_gain
		add_piety = medium_piety_loss
		scope:challenger = { select_and_move_to_pool_effect = yes }
		stress_impact = {
			base = miniscule_stress_impact_loss
			wrathful = medium_stress_impact_loss
			calm = minor_stress_impact_gain
			zealous = medium_stress_impact_gain
			diligent = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = -1
				ai_boldness = -1
				ai_energy = -1
			}
		}
	}
}

############################
## Someone argues your ancestor was actually cooler than we thought
## 8050
## by James Beaumont
############################
legend_spread_events.8050 = {
	type = character_event
	title = legend_spread_events.8050.t
	desc = legend_spread_events.8050.desc
	theme = legend
	left_portrait = {
		character = root
		animation = ecstasy
	}
	right_portrait = {
		character = scope:chronicler
		animation = personality_zealous
	}
	lower_right_portrait = {
		character = scope:ancestor
	}

	trigger = {
		promoted_legend ?= {
			legend_owner = root
			exists = legend_property:ancestor.culture # Make sure the ancestor is a character, not a flag
			legend_property:ancestor = { is_alive = no }
			legend_property:ancestor = { # There is a virtuous trait your ancestor *doesn't* have
				any_trait_in_category = {
					category = personality
					NOT = { prev = { has_trait = prev } }
					root.faith = { trait_is_virtue = prev }
				}
				# There is a trait they have which is not virtuous
				any_trait_in_category = {
					category = personality
					prev = { has_trait = prev }
					NOT = { root.faith = { trait_is_virtue = prev } }
				}
			}
		}
		is_available_adult = yes
	}

	cooldown = { years = 15 }

	immediate = {
		grab_appropriate_chronicler_effect = yes
		promoted_legend = {
			save_scope_as = legend
			legend_property:ancestor = {
				save_scope_as = ancestor
				random_trait_in_category = {
					category = personality
					limit = {
						NOT = { prev = { has_trait = prev } }
						root.faith = { trait_is_virtue = prev }
					}
					save_scope_as = virtue_trait
				}
				random_trait_in_category = {
					category = personality
					limit = {
						prev = { has_trait = prev }
						NOT = { root.faith = { trait_is_virtue = prev } }
					}
					save_scope_as = sin_trait
				}
			}
		}
		save_scope_as = root_scope
	}

	option = { # Cool, love that for us
		name = legend_spread_events.8050.a
		duel = {
			skill = learning
			value = very_high_skill_rating
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8050.a.win
					left_icon = root
					right_icon = scope:chronicler
					add_piety = medium_piety_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_increase
						}
						legend_property:ancestor = {
							remove_trait = scope:sin_trait
							add_trait_force_tooltip = scope:virtue_trait
						}
					}
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8050.a.lose
					left_icon = root
					right_icon = scope:chronicler
					add_stress = minor_stress_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_decrease
						}
					}
				}
			}
		}
		stress_impact = {
			humble = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_honor = -1
			}
		}
	}

	option = { # Hmm, maybe we can just talk about his virtuous actions instead?
		name = legend_spread_events.8050.b
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = minor_legend_quality_increase
			}
		}
		stress_impact = {
			humble = minor_stress_impact_loss
			arrogant = medium_stress_impact_gain
			deceitful = medium_stress_impact_gain
			diligent = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = -1
				ai_honor = 1
			}
		}
	}

	option = { # But what about me?
		name = legend_spread_events.8050.c

		add_prestige = medium_prestige_gain

		every_vassal = {
			vassal_stance = courtly
			custom = every_courtly_vassal
			add_opinion = {
				modifier = disrespect_opinion
				opinion = -15
				target = root
			}
		}

		every_vassal = {
			vassal_stance = glory_hound
			custom = every_glory_hound_vassal
			add_opinion = {
				modifier = respect_opinion
				opinion = 15
				target = root
			}
		}

		stress_impact = {
			humble = medium_stress_impact_gain
			arrogant = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = -0.5
			}
		}
	}
}

############################
## Yazgirid III was actually a Catholic, many people are saying this
## 8060
## by James Beaumont
############################
legend_spread_events.8060 = {
	type = character_event
	title = legend_spread_events.8060.t
	desc = legend_spread_events.8060.desc
	theme = legend
	left_portrait = {
		character = root
		animation = ecstasy
	}
	right_portrait = {
		character = scope:chronicler
		animation = personality_zealous
	}
	lower_right_portrait = {
		character = scope:ancestor
	}

	trigger = {
		promoted_legend ?= {
			legend_owner = root
			exists = legend_property:ancestor.religion # Make sure the ancestor is a character, not a flag
			legend_property:ancestor = {
				religion != root.religion
			}
		}
		is_available_adult = yes
	}

	cooldown = { years = 15 }

	immediate = {
		grab_appropriate_chronicler_effect = yes
		promoted_legend = {
			save_scope_as = legend
			legend_property:ancestor = {
				save_scope_as = ancestor
			}
		}
	}

	option = { # It *must* be true!
		name = legend_spread_events.8060.a
		duel = {
			skill = learning
			value = high_skill_rating
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8060.a.win
					left_icon = root
					right_icon = scope:chronicler
					add_piety = medium_piety_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_increase
						}
						legend_property:ancestor = {
							set_character_faith = root.faith
						}
					}
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8060.a.lose
					left_icon = root
					right_icon = scope:chronicler
					add_stress = minor_stress_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_decrease
						}
					}
				}
			}
		}
		stress_impact = {
			humble = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_honor = -1
			}
		}
	}

	option = { # Hmm, maybe we can just talk about his virtuous actions instead?
		name = legend_spread_events.8060.b
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = minor_legend_quality_increase
			}
		}
		stress_impact = {
			deceitful = medium_stress_impact_gain
			diligent = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = -1
				ai_honor = 1
			}
		}
	}
}

############################
## Actually my legend happened in a holy site
## 8070
## by James Beaumont
############################
legend_spread_events.8070 = {
	type = character_event
	title = legend_spread_events.8070.t
	desc = legend_spread_events.8070.desc
	theme = legend
	left_portrait = {
		character = root
		animation = admiration
	}
	right_portrait = {
		character = scope:chronicler
		animation = chancellor
	}

	trigger = {
		promoted_legend ?= {
			legend_owner = root
			exists = legend_property:location.county # Make sure the location is a province
			legend_property:location.county = {
				any_county_province = {
					barony = { NOT = { is_holy_site_of = root.faith } }
				}
			}
		}
		is_available_adult = yes
	}

	cooldown = { years = 15 }

	immediate = {
		grab_appropriate_chronicler_effect = yes
		promoted_legend = {
			save_scope_as = legend
			legend_property:location = {
				save_scope_as = location
			}
		}
		faith = {
			random_holy_site = {
				title_province = { save_scope_as = holy_site }
			}
		}
	}

	option = { # It *must* be true!
		name = legend_spread_events.8070.a
		duel = {
			skill = learning
			value = high_skill_rating
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8070.a.win
					left_icon = root
					right_icon = scope:chronicler
					add_piety = medium_piety_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_increase
						}
						set_legend_property = {
							name = location
							target = scope:holy_site
						}
					}
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8070.a.lose
					left_icon = root
					right_icon = scope:chronicler
					add_stress = minor_stress_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = minor_legend_quality_decrease
						}
					}
				}
			}
		}
		stress_impact = {
			humble = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
				ai_energy = 1
				ai_honor = -1
			}
		}
	}

	option = { # No, the existing location is just *like* a holy place
		name = legend_spread_events.8070.b
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = minor_legend_quality_increase
			}
		}
		scope:location.county = {
			add_county_modifier = {
				modifier = legendary_holy_site
				years = 15
			}
		}
		if = {
			limit = {
				scope:location.county.holder = {
					NOR = {
						this = root
						any_liege_or_above = {
							this = root
						}
					}
				}
			}
			root.capital_county = {
				add_county_modifier = {
					modifier = legendary_holy_site
					years = 15
				}			
			}
		}

		stress_impact = {
			deceitful = medium_stress_impact_gain
			diligent = minor_stress_impact_gain
			zealous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = -1
				ai_honor = 1
			}
		}
	}
}

############################
## I punched a bear
## 8080
## by James Beaumont
############################
legend_spread_events.8080 = {
	type = character_event
	title = legend_spread_events.8080.t
	desc = legend_spread_events.8080.desc
	theme = legend_terrain
	left_portrait = {
		character = root
		animation = personality_bold
	}
	right_portrait = {
		character = scope:chronicler
		animation = marshal
	}

	trigger = {
		promoted_legend ?= {
			legend_owner = root
			has_legend_chapter = hunt
		}
		is_available_adult = yes
	}

	cooldown = { years = 15 }

	immediate = {
		grab_appropriate_chronicler_effect = yes
		promoted_legend = {
			save_scope_as = legend
		}
	}

	option = { # Yes, it's true, I punched a bear.
		name = legend_spread_events.8080.a
		duel = {
			skills = { prowess intrigue }
			value = high_skill_rating
			# Crit success.
			10 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8080.a.crit_win
					left_icon = root
					right_icon = scope:chronicler
					add_prestige = medium_prestige_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = major_legend_quality_increase
						}
						set_legend_chapter = {
							name = hunt
							localization_key = legend_chapter_punched_animal_great
						}
					}
				}
			}
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8080.a.win
					left_icon = root
					right_icon = scope:chronicler
					add_prestige = minor_prestige_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_increase
						}
						set_legend_chapter = {
							name = hunt
							localization_key = legend_chapter_punched_animal_good
						}
					}
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8080.a.lose
					left_icon = root
					right_icon = scope:chronicler
					add_prestige = minor_prestige_loss
					add_stress = minor_stress_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_decrease
						}
						set_legend_chapter = {
							name = hunt
							localization_key = legend_chapter_punched_animal_bad
						}
					}
				}
			}
			# Crit failure.
			10 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8080.a.crit_lose
					left_icon = root
					right_icon = scope:chronicler
					add_stress = minor_stress_gain
					add_prestige = medium_prestige_loss
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = major_legend_quality_decrease
						}
						set_legend_chapter = {
							name = hunt
							localization_key = legend_chapter_punched_animal_very_bad
						}
					}
				}
			}
		}
		stress_impact = {
			humble = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
				ai_energy = 1
				ai_honor = -1
			}
		}
	}

	option = { # No, this is silly
		name = legend_spread_events.8080.b

		add_prestige = minor_prestige_gain

		if = {
			limit = { has_trait = lifestyle_hunter }
			add_trait_xp = {
				trait = lifestyle_hunter
				track = hunter
				value = minor_trait_xp
			}
		}
		else = {
			add_trait = lifestyle_hunter
			add_trait_xp = {
				trait = lifestyle_hunter
				track = hunter
				value = minor_trait_xp
			}
		}

		stress_impact = {
			deceitful = medium_stress_impact_gain
			diligent = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = -1
				ai_honor = 1
			}
		}
	}
}

############################
## I was called to adventure by a magical spring
## 8090
## by James Beaumont
############################
legend_spread_events.8090 = {
	type = character_event
	title = legend_spread_events.8090.t
	desc = legend_spread_events.8090.desc
	theme = legend
	left_portrait = {
		character = root
		animation = personality_bold
	}
	right_portrait = {
		character = scope:chronicler
		animation = personality_zealous
	}
	trigger = {
		promoted_legend ?= {
			legend_owner = root
			OR = {
				legend_quality = illustrious
				legend_quality = mythical
			}
			has_legend_chapter = opening
		}
		is_available_adult = yes
		any_sub_realm_barony = {
			title_province = {
				NOR = {
					terrain = desert
					terrain = desert_mountains
				}
			}
		}
	}

	cooldown = { years = 15 }

	immediate = {
		grab_appropriate_chronicler_effect = yes
		promoted_legend = {
			save_scope_as = legend
		}
		romance_target_gender_effect = { SCOPE_NAME = person_of_the_lake }
		random_sub_realm_barony = {
			limit = {
				title_province = {
					NOR = {
						terrain = desert
						terrain = desert_mountains
					}
				}
			}
			save_scope_as = watery_place
		}
	}
	option = { # Yes, it's true, I was given my mission by the wet woman
		name = legend_spread_events.8090.a
		duel = {
			skill = learning
			value = high_skill_rating
			# Crit success.
			10 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8080.a.crit_win
					left_icon = root
					right_icon = scope:chronicler
					scope:watery_place.county = {
						add_county_modifier = {
							modifier = mysterious_sword_giver_great
							years = 15
						}
					}
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = major_legend_quality_increase
						}
						set_legend_chapter = {
							name = opening
							localization_key = legend_chapter_person_of_lake_great
						}
					}
				}
			}
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8080.a.win
					left_icon = root
					right_icon = scope:chronicler
					scope:watery_place.county = {
						add_county_modifier = {
							modifier = mysterious_sword_giver
							years = 15
						}
					}
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_increase
						}
						set_legend_chapter = {
							name = opening
							localization_key = legend_chapter_person_of_lake_good
						}
					}
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8080.a.lose
					left_icon = root
					right_icon = scope:chronicler
					add_stress = minor_stress_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_decrease
						}
						set_legend_chapter = {
							name = opening
							localization_key = legend_chapter_person_of_lake_bad
						}
					}
				}
			}
			# Crit failure.
			10 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8080.a.crit_lose
					left_icon = root
					right_icon = scope:chronicler
					add_stress = minor_stress_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = major_legend_quality_decrease
						}
						set_legend_chapter = {
							name = opening
							localization_key = legend_chapter_person_of_lake_very_bad
						}
					}
				}
			}
		}
		stress_impact = {
			humble = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
				ai_energy = 1
				ai_honor = -1
			}
		}
	}

	option = { # No, this is silly
		name = legend_spread_events.8090.b
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = minor_legend_quality_increase
			}
			set_legend_chapter = {
				name = opening
				localization_key = legend_chapter_forged_own_path
			}
		}
		stress_impact = {
			deceitful = medium_stress_impact_gain
			diligent = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = -1
				ai_honor = 1
			}
		}
	}
}

############################
## Your courtiers sense an evil presence
## 8100
## by James Beaumont
############################
legend_spread_events.8100 = {
	type = character_event
	title = legend_spread_events.8100.t
	desc = legend_spread_events.8100.desc
	theme = legend
	override_background = { reference = corridor_night }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				ai_boldness > medium_positive_ai_value
			}
			animation = personality_bold
		}
		animation = shock
	}
	right_portrait = {
		character = scope:superstitious_courtier
		animation = fear
	}
	artifact = {
		target = scope:witchy_artifact
		position = lower_center_portrait
	}
	trigger = {
		promoted_legend ?= {
			legend_owner = root
			legend_type = legend_type:holy
		}
		is_available_adult = yes
		faith = {
			has_doctrine_parameter = witchcraft_accepted # Covers both accepted and virtuous
		}
		# You have an artifact that is not already home to an evil spirit
		any_character_artifact = {
			NOT = { has_variable = imbued_with_evil_spirit }
		}
	}

	cooldown = { years = 15 }

	immediate = {
		get_superstitious_courtier_effect = yes
		promoted_legend = {
			save_scope_as = legend
		}
		# Get an artifact to imbue with the spirit
		random_character_artifact = {
			limit = {
				NOT = { has_variable = imbued_with_evil_spirit }
			}
			weight = { # Try to make it an artifact they care about
				base = 1
				modifier = {
					add = 10
					rarity = illustrious
				}
				modifier = {
					add = 5
					rarity = famed
				}
				modifier = {
					add = 1
					rarity = masterwork
				}
				modifier = {
					factor = 2
					is_equipped = yes
				}
			}
			save_scope_as = witchy_artifact
		}
	}

	option = { # I know exactly what to do
		name = legend_spread_events.8100.c
		trigger = {
			has_trait = theologian
		}
		add_piety = minor_piety_gain
		scope:witchy_artifact = {
			add_artifact_modifier = artifact_dread_gain_mult_3_modifier
			set_artifact_description = possessed_artifact_desc
			set_variable = {
				name = imbued_with_evil_spirit
				value = yes
			}
		}
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = minor_legend_quality_increase
			}
		}
		ai_chance = {
			base = 200
			ai_value_modifier = {
				ai_zeal = 2
				ai_rationality = 1
			}
		}
	}

	option = { # I'm already full of demons, let's just add some more
		name = legend_spread_events.8100.d
		trigger = {
			OR = {
				has_trait = possessed_1
				has_trait = possessed_genetic
			}
		}
		add_piety = major_piety_gain
		add_character_modifier = {
			modifier = ce1_evil_spirit
			years = 15
		}
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = minor_legend_quality_increase
			}
		}
		ai_chance = {
			base = 200
			ai_value_modifier = {
				ai_zeal = 2
				ai_rationality = -1
			}
		}
	}

	option = { # Stay back everyone, I will capture the spirit in my artifact
		name = legend_spread_events.8100.a
		duel = {
			skill = learning
			value = high_skill_rating
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				modifier = {
					factor = 0.75
					is_witch_trigger = no
				}
				send_interface_toast = {
					title = legend_spread_events.8100.a.win
					left_icon = root
					scope:witchy_artifact = {
						add_artifact_modifier = artifact_dread_gain_mult_3_modifier
						set_artifact_description = possessed_artifact_desc
						set_variable = {
							name = imbued_with_evil_spirit
							value = yes
						}
					}
					if = {
						limit = {
							is_witch_trigger = no
						}
						add_trait = witch
					}
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = minor_legend_quality_increase
						}
					}
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8100.a.lose
					left_icon = root
					add_stress = minor_stress_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_decrease
						}
					}
				}
			}
			# Crit failure.
			10 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8100.a.crit_lose
					left_icon = root
					if = {
						limit = { NOT = { has_trait = possessed } }
						add_trait = possessed_1
					}
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_decrease
						}
					}
				}
			}
		}
		stress_impact = {
			craven = medium_stress_impact_gain
			callous = minor_stress_impact_gain
			witch = minor_stress_impact_loss # I live for this shit
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
				ai_boldness = 1
			}
		}
	}

	option = { # Zoinks! I'm outta here scoob
		name = legend_spread_events.8100.b
		stress_impact = {
			arrogant = medium_stress_impact_gain
			witch = medium_stress_impact_gain
			brave = medium_stress_impact_gain
			zealous = minor_stress_impact_gain
			craven = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = -1
			}
		}
	}
}

############################
## Your artifact is drenched in the blood of infidels
## 8110
## by James Beaumont
############################
legend_spread_events.8110 = {
	type = character_event
	title = legend_spread_events.8110.t
	desc = legend_spread_events.8110.desc
	theme = legend
	left_portrait = {
		character = root
		animation = personality_bold
	}
	right_portrait = {
		character = scope:courtier_1
		animation = personality_rational
	}
	lower_right_portrait = {
		character = scope:courtier_2
	}

	cooldown = { years = 15 }

	trigger = {
		is_available_adult = yes
		faith = {
			has_doctrine_parameter = great_holy_wars_active
		}
		promoted_legend ?= {
			legend_owner = root
			legend_type = legend_type:holy
		}
		# You have an artifact that does not already have this modifier
		any_character_artifact = {
			artifact_slot_type = primary_armament
			NOT = { has_variable = blood_of_infidels }
		}
		any_courtier_or_guest = {
			count >= 2
			is_adult = yes
		}
		# You have a memory where you beat up an infidel
		any_memory = {
			memory_type = battle_won_memory
			exists = memory_participant:loser
			save_temporary_scope_as = temp_memory
			root.faith = {
				faith_hostility_level = {
					target = scope:temp_memory.memory_participant:loser.faith
					value >= faith_hostile_level
				}
			}
		}
	}
	immediate = {
		promoted_legend = {
			save_scope_as = legend
		}
		# Get an artifact to attach the memory to
		random_character_artifact = {
			limit = {
				artifact_slot_type = primary_armament
				NOT = { has_variable = blood_of_infidels }
			}
			weight = { # Try to make it an artifact they care about
				base = 1
				modifier = {
					add = 10
					rarity = illustrious
				}
				modifier = {
					add = 5
					rarity = famed
				}
				modifier = {
					add = 1
					rarity = masterwork
				}
				modifier = {
					factor = 2
					is_equipped = yes
				}
			}
			save_scope_as = infidel_weapon
		}
		# Get the memory
		random_memory = {
			memory_type = battle_won_memory
			limit = {
				exists = memory_participant:loser
				save_temporary_scope_as = temp_memory
				root.faith = {
					faith_hostility_level = {
						target = scope:temp_memory.memory_participant:loser.faith
						value >= faith_hostile_level
					}
				}
			}
			memory_participant:loser = { save_scope_as = loser }
			save_scope_as = memory
		}
		random_courtier_or_guest = {
			limit = {
				is_adult = yes
			}
			weight = {
				base = 1
				modifier = {
					add = {
						subtract = ai_zeal
					}
				}
			}
			save_scope_as = courtier_1
		}
		random_courtier_or_guest = {
			limit = {
				is_adult = yes
				this != scope:courtier_1
			}
			weight = {
				base = 1
				modifier = {
					add = ai_zeal
				}
			}
			save_scope_as = courtier_2
		}
	}
	option = { # Yeah, that totally happened! Fr fr no cap
		name = legend_spread_events.8110.a
		duel = {
			skills = { learning martial }
			value = high_skill_rating
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8110.a.win
					left_icon = root
					scope:infidel_weapon = {
						add_artifact_modifier = artifact_legend_spread_mult_2_modifier
						add_artifact_modifier = artifact_monthly_piety_gain_mult_2_modifier
						set_artifact_description = infidel_artifact_desc
						set_variable = {
							name = blood_of_infidels
							value = yes
						}
					}
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = minor_legend_quality_increase
						}
					}
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8110.a.lose
					left_icon = root
					add_stress = minor_stress_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_decrease
						}
					}
				}
			}
		}
		stress_impact = {
			honest = medium_stress_impact_gain
			callous = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
			zealous = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
				ai_boldness = 1
				ai_honor = -1
				ai_compassion = -1
			}
		}
	}

	option = { # Nah, this did not happen
		name = legend_spread_events.8110.b
		stress_impact = {
			arrogant = medium_stress_impact_gain
			deceitful = medium_stress_impact_gain
			zealous = minor_stress_impact_gain
			honest = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = -1
			}
		}
	}

	option = { # How about I have it engraved with the real story of the battle?
		name = legend_spread_events.8110.c
		reason = prestige_level
		trigger = {
			prestige_level >= very_high_prestige_level
		}
		scope:infidel_weapon = {
			add_artifact_modifier = artifact_legend_spread_mult_1_modifier
			set_artifact_description = ce1_battle_artifact_desc
			set_variable = {
				name = blood_of_infidels
				value = yes
			}
		}
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = minor_legend_quality_increase
			}
		}
		ai_chance = {
			base = 200
			ai_value_modifier = {
				ai_zeal = 1
				ai_boldness = 1
				ai_honor = 1
				ai_rationality = 1
				ai_compassion = -1
			}
		}
	}
}

############################
## Go visit someone outside of your diplo range
## 8120-8129
## by James Beaumont
############################

# Call to adventure
legend_spread_events.8120 = {
	type = character_event
	title = legend_spread_events.8120.t
	desc = legend_spread_events.8120.desc
	theme = legend
	left_portrait = {
		character = root
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:chronicler
		animation = chancellor
	}
	lower_right_portrait = {
		character = scope:distant_liege
	}

	cooldown = { years = 50 }
	
	trigger = {
		is_available_adult = yes
		promoted_legend = {
			legend_owner = root
			legend_type = legend_type:heroic
		}
		# There must be a ruler outside of diplo range
		any_ruler = {
			top_liege = {
				is_ai = yes
				NOT = { in_diplomatic_range = root }
				primary_title = { is_mercenary_company = no }
				capital_province = {
					squared_distance = {
						target = root.capital_province
						value <= squared_distance_massive # Don't walk from Iceland to Burma
					}
				}
				any_courtier_or_guest = {
					is_adult = yes
				}
			}
		}
	}

	immediate = {
		promoted_legend = { save_scope_as = legend }
		random_ruler = {
			limit = {
				top_liege = {
					is_ai = yes
					NOT = { in_diplomatic_range = root }
					primary_title = { is_mercenary_company = no }
					capital_province = {
						squared_distance = {
							target = root.capital_province
							value <= squared_distance_massive
						}
					}
					any_courtier_or_guest = {
						is_adult = yes
					}
				}
			}
			top_liege = {
				capital_province = { save_scope_as = distant_location }
				primary_title = { save_scope_as = distant_title }
				save_scope_as = distant_liege
			}
		}
		grab_appropriate_chronicler_effect = yes
	}

	option = { #A worthwhile expedition!
		name = legend_spread_events.8120.a
		custom_tooltip = {
			text = travel_to_distant_land_tt
			start_travel_plan = { 
				destination = scope:distant_location
				return_trip = yes
				on_arrival_event = legend_spread_events.8122
				on_travel_planner_cancel_event = legend_spread_events.8121
			}
		}
		stress_impact = {
			lazy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -1
				ai_honor = 1
			}
		}
	}
	
	option = { # Sod that
		name = legend_spread_events.8120.b
		stress_impact = {
			content = medium_stress_impact_loss
			ambitious = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_honor = -1
			}
		}
	}
}

# I foolishly cancelled my travel plan
legend_spread_events.8121 = {
	type = character_event
	title = legend_spread_events.8121.t
	desc = legend_spread_events.8121.desc
	theme = legend
	override_background = { reference = wilderness }
	left_portrait = {
		character = root
		animation = stress
	}

	option = { # Dangit
		name = legend_spread_events.8121.a
		ai_chance = {
			base = 100
		}
	}
}

# I have arrived, what do I want?
legend_spread_events.8122 = {
	type = character_event
	title = legend_spread_events.8122.t
	desc = {
		desc = legend_spread_events.8122.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:distant_location.county = {
						any_this_title_or_de_jure_above = { this = title:k_sweden }
					}
				}
				desc = legend_spread_events.8122.desc.disappointing.sweden
			}
			triggered_desc = {
				trigger = {
					scope:distant_location = {
						has_holding_type = tribal_holding
					}
				}
				desc = legend_spread_events.8122.desc.disappointing.tribal
			}
			triggered_desc = {
				trigger = {
					scope:distant_location.county = {
						development_level <= bad_development_level
						title_province = { is_wetland_trigger = yes }
					}
				}
				desc = legend_spread_events.8122.desc.disappointing.wet
			}
			triggered_desc = {
				trigger = {
					scope:distant_location.county = {
						development_level <= bad_development_level
						title_province = { is_drylands_or_desert_trigger = yes }
					}
				}
				desc = legend_spread_events.8122.desc.disappointing.dry
			}
			triggered_desc = {
				trigger = {
					scope:distant_location.county = {
						development_level <= bad_development_level
					}
				}
				desc = legend_spread_events.8122.desc.disappointing.fallback
			}
			triggered_desc = {
				trigger = {
					scope:distant_location.county = {
						development_level > great_development_level
					}
				}
				desc = legend_spread_events.8122.desc.not_disappointing
			}
			triggered_desc = {
				trigger = {
					scope:distant_location.county = {
						development_level > good_development_level
					}
				}
				desc = legend_spread_events.8122.desc.slightly_disappointing
			}
			triggered_desc = {
				trigger = {
					scope:distant_location.county = {
						development_level > bad_development_level
					}
				}
				desc = legend_spread_events.8122.desc.somewhat_disappointing
			}
		}
		desc = legend_spread_events.8122.desc.bridge
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:distant_courtier = { # Viking adventurers and such
						culture = root.culture
					}
				}
				desc = legend_spread_events.8122.desc.outro.same_culture
			}
			triggered_desc = {
				trigger = {
					scope:distant_courtier = {
						religion = root.religion
					}
				}
				desc = legend_spread_events.8122.desc.outro.same_religion
			}
			desc = legend_spread_events.8122.desc.outro.fallback
		}
	}
	theme = legend
	left_portrait = {
		character = root
		animation = admiration
	}
	right_portrait = {
		character = scope:distant_courtier
		animation = thinking
	}
	lower_right_portrait = {
		character = scope:distant_knight
	}
	lower_center_portrait = {
		character = scope:distant_liege
	}

	immediate = {
		scope:distant_liege = {
			random_courtier_or_guest = {
				limit = {
					is_adult = yes
				}
				save_scope_as = distant_courtier
			}
			random_knight ?= {
				save_scope_as = distant_knight
			}
		}
		current_travel_plan = {
			delay_travel_plan = { months = 2 }
		}
		create_character_memory = {
			type = ce1_travelled_far_away
			participants = {
				distant_realm = scope:distant_liege
			}
		}
	}

	option = { # I want to see how people fight here
		name = legend_spread_events.8122.a
		trigger = {
			exists = scope:distant_liege
		}
		custom_tooltip = legend_quality_if_wins_tt
		configure_start_single_combat_effect = {
			SC_INITIATOR = root
			SC_ATTACKER = root
			SC_DEFENDER = scope:distant_knight
			FATALITY = no
			FIXED = no
			LOCALE = tavern
			OUTPUT_EVENT = legend_spread_events.8123
			INVALIDATION_EVENT = fp1_tbc.0021
		}
		stress_impact = {
			craven = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = 1
			}
		}
	}

	option = { # I want to talk about my cool legend with your liege
		name = legend_spread_events.8122.b
		duel = {
			skill = diplomacy
			target = scope:distant_liege
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8122.b.success
					left_icon = root
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = major_legend_quality_increase
						}
					}
					current_travel_plan = { resume_travel_plan = yes }
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8122.b.failure
					left_icon = root
					add_stress = minor_stress_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = minor_legend_quality_increase
						}
					}
					current_travel_plan = { resume_travel_plan = yes }
				}
			}
		}
		stress_impact = {
			shy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = 1
				ai_honor = 1
			}
		}
	}

	option = { # I want to bring something cool back home
		name = legend_spread_events.8122.c
		if = {
			limit = {
				capital_county.holder = root
			}
			capital_county = {
				add_county_modifier = {
					modifier = legendary_item
					years = 15
				}
			}
		}
		add_character_modifier = {
			modifier = legendary_item_personal
			years = 10
		}
		current_travel_plan = { resume_travel_plan = yes }
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = -1
				ai_boldness = -1
			}
		}
	}
}
#SCE output events
legend_spread_events.8123 = {
	hidden = yes
	type = character_event
	immediate = {
		if = { # Defeat
			limit = {
				scope:sc_victor = scope:distant_knight
			}
			trigger_event = legend_spread_events.8124
		}
		else = {
			trigger_event = legend_spread_events.8125
		}
	}
}

# I lost :(
legend_spread_events.8124 = {
	type = character_event
	title = legend_spread_events.8124.t
	desc = legend_spread_events.8124.desc
	theme = legend
	override_background = { reference = wilderness }
	left_portrait = {
		character = root
		animation = stress
	}
	right_portrait = {
		character = scope:distant_knight
		triggered_animation = {
			trigger = { var:signature_weapon = flag:axe }
			animation = celebrate_axe
		}
		triggered_animation = {
			trigger = { var:signature_weapon = flag:mace }
			animation = celebrate_mace
		}
		triggered_animation = {
			trigger = { var:signature_weapon = flag:sword }
			animation = celebrate_sword
		}
		triggered_animation = {
			trigger = { var:signature_weapon = flag:dagger }
			animation = celebrate_dagger
		}
		triggered_animation = {
			trigger = { var:signature_weapon = flag:spear }
			animation = celebrate_spear
		}
		triggered_animation = {
			trigger = {	var:signature_weapon = flag:hammer }
			animation = celebrate_hammer
		}
		animation = marshal
	}

	option = { # Dangit
		name = legend_spread_events.8124.a
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = minor_legend_quality_increase
			}
		}
		current_travel_plan = { resume_travel_plan = yes }
		ai_chance = {
			base = 100
		}
	}
}

# I won :D
legend_spread_events.8125 = {
	type = character_event
	title = legend_spread_events.8125.t
	desc = legend_spread_events.8125.desc
	theme = legend
	override_background = { reference = wilderness }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { var:signature_weapon = flag:axe }
			animation = celebrate_axe
		}
		triggered_animation = {
			trigger = { var:signature_weapon = flag:mace }
			animation = celebrate_mace
		}
		triggered_animation = {
			trigger = { var:signature_weapon = flag:sword }
			animation = celebrate_sword
		}
		triggered_animation = {
			trigger = { var:signature_weapon = flag:dagger }
			animation = celebrate_dagger
		}
		triggered_animation = {
			trigger = { var:signature_weapon = flag:spear }
			animation = celebrate_spear
		}
		triggered_animation = {
			trigger = {	var:signature_weapon = flag:hammer }
			animation = celebrate_hammer
		}
		animation = marshal
	}
	right_portrait = {
		character = scope:distant_knight
		animation = stress
	}

	immediate = {
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = major_legend_quality_increase
			}
		}
	}

	option = { # Neato!
		name = legend_spread_events.8125.a
		current_travel_plan = { resume_travel_plan = yes }
		ai_chance = {
			base = 100
		}
	}

	option = { # Come back with me!
		name = legend_spread_events.8125.b
		current_travel_plan = { resume_travel_plan = yes }
		add_courtier = scope:distant_knight
		root.current_travel_plan = {
			add_companion = scope:distant_knight
		}
		scope:distant_knight = {
			add_character_flag = {
				flag = blocked_from_leaving
				years = 10
			}
			if = {
				limit = {
					NOT = {
						can_be_combatant_based_on_gender_trigger = {
							ARMY_OWNER = root
						}
					}
				}
				custom_tooltip = ignores_gender_army_rules_tt
				add_character_modifier = ignores_gender_army_rules
			}
		}
		if = {
			limit = {
				can_employ_court_position_type = champion_court_position
			}
			court_position_grant_effect = {
				EMPLOYER = root
				CANDIDATE = scope:distant_knight
				POS = champion
			}
		}
		else_if = {
			limit = {
				can_employ_court_position_type = bodyguard_court_position
			}
			court_position_grant_effect = {
				EMPLOYER = root
				CANDIDATE = scope:distant_knight
				POS = bodyguard
			}
		}
		ai_chance = {
			base = 0
		}
	}
}

############################
## My ancestor was visited by angels
## 8130
## by James Beaumont
############################
legend_spread_events.8130 = {
	type = character_event
	title = legend_spread_events.8130.t
	desc = legend_spread_events.8130.desc
	theme = legend
	left_portrait = {
		character = root
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:chronicler
		animation = chancellor
	}
	
	trigger = {
		is_available_adult = yes
		promoted_legend = {
			legend_type = legend_type:legitimizing
			exists = legend_property:title
		}
		root != house.house_founder
		house.house_founder = { is_alive = no }
		religion_has_angels_trigger = yes
	}

	cooldown = { years = 15 }


	immediate = {
		promoted_legend = {
			save_scope_as = legend
			legend_property:title = { save_scope_as = legend_title }
		}
		house.house_founder = { save_scope_as = founder }
		grab_appropriate_chronicler_effect = yes
	}

	option = { # Yes, this definitely happened
		name = legend_spread_events.8130.a
		duel = {
			skill = learning
			value = high_skill_rating
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8130.a.win
					left_icon = root
					right_icon = scope:chronicler
					add_piety = medium_piety_gain
					house = {
						add_house_modifier = {
							modifier = angelic_founder
							years = 15
						}
					}
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_increase
						}
					}
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8130.a.lose
					left_icon = root
					right_icon = scope:chronicler
					add_stress = minor_stress_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = minor_legend_quality_decrease
						}
					}
				}
			}
		}
		stress_impact = {
			humble = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
				ai_energy = 1
				ai_honor = -1
			}
		}
	}
	
	option = { # Sod that
		name = legend_spread_events.8130.b
		
		add_piety = minor_piety_gain

		stress_impact = {
			base = miniscule_stress_impact_loss
			content = medium_stress_impact_loss
			ambitious = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = 1
				ai_honor = -1
			}
		}
	}
}

############################
## What a cool battle, time to add it to my legend
## 8140
## by James Beaumont
############################
# Hidden setup event
legend_spread_events.8140 = {
	scope = combat_side
	hidden = yes

	trigger = {
		# Only for promoted legend owners who are their own protagonists
		side_primary_participant.promoted_legend.legend_protagonist ?= side_primary_participant
		# Only if you commanded the army yourself
		side_commander = side_primary_participant
		enemy_side.side_primary_participant = {
			is_landed = yes # Killing peasants is not very legendary
		}
	}

	cooldown = { years = 15 }


	weight_multiplier = {
		base = 1
		modifier = {
			side_primary_participant = {
				has_royal_court = yes
				has_court_type = court_warlike
			}
			add = 1
		}
		modifier = { # More likely for crusades and such
			side_primary_participant = {
				is_in_ongoing_great_holy_war = yes
			}
			add = 1
		}
	}

	immediate = {
		if = {
			limit = {
				exists = enemy_side.side_commander
			}
			enemy_side.side_commander = {
				save_scope_as = enemy_commander
			}
		}
		if = {
			limit = {
				exists = side_commander
			}
			side_commander = {
				save_scope_as = friendly_commander
			}
		}
		enemy_side.side_primary_participant = {
			save_scope_as = enemy_battle_owner
		}
		combat.location = {
			save_scope_as = combat_location
		}

		side_primary_participant = {
			trigger_event = { id = legend_spread_events.8141 }
		}
	}
}

legend_spread_events.8141 = {
	type = character_event
	title = legend_spread_events.8141.t
	desc = legend_spread_events.8141.desc
	theme = battle
	left_portrait = {
		character = root
		animation = celebrate_sword
	}

	trigger = {
		# based on where the scope is set, they might not exist when the event is fired
		exists = scope:enemy_commander
		exists = scope:friendly_commander
		NOT = {
			exists = promoted_legend.var:8141_commander
		}
		promoted_legend = {
			has_legend_chapter = famous_deed
		}
	}

	immediate = {
		promoted_legend = {
			save_scope_as = legend
		}
	}

	option = { # A nice addition to my legend
		name = legend_spread_events.8141.a
		promoted_legend = {
			change_legend_quality_effect = { VALUE = medium_legend_quality_increase }
			set_variable = { # For loc
				name = 8141_commander
				value = scope:enemy_commander
			}
			set_legend_chapter = {
				name = famous_deed
				localization_key = legend_chapter_great_battle
			}
		}
	}

	option = { # No, there are far greater things for my legend to be about
		name = legend_spread_events.8141.b
		add_character_modifier = {
			modifier = ce1_legendary_battle
			years = 15
		}
	}
}

############################
## Wanna know how I got these scars? Activity event
## 8150
## by James Beaumont
############################
legend_spread_events.8150 = {
	type = activity_event
	title = legend_spread_events.8150.t
	desc = legend_spread_events.8150.desc
	theme = legend
	left_portrait = {
		character = root
		animation = sadness
	}
	right_portrait = {
		character = scope:intrigued_guest
		animation = thinking
	}

	trigger = {
		exists = promoted_legend
		promoted_legend.legend_protagonist = root
		has_permanent_physical_injury = yes
		promoted_legend = {
			has_legend_chapter = famous_deed
		}
	}

	cooldown = { years = 15 }


	weight_multiplier = {
		base = 1
		modifier = {
			add = 1
			has_activity_intent = spread_legend_intent
		}
	}

	immediate = {
		root = {
			save_scope_as = root_scope
		}
		if = { # Prioritise the stop host for tours
			limit = {
				exists = scope:stop_host_scope
			}
			scope:stop_host_scope = { save_scope_as = intrigued_guest }
		}
		else = {
			scope:activity = {
				random_attending_character = {
					limit = {
						is_ai = yes
						is_adult = yes
					}
					weight = {
						base = 1
						modifier = { # Curious about you
							add = 10
							has_trait = gregarious
						}
						modifier = { # Not big on the whole "This could be offensive" thing
							add = 2
							NOT = { has_trait = compassionate }
						}
					}
					save_scope_as = intrigued_guest
				}
			}
		}
	}

	option = { # A story I will take to my grave
		name = legend_spread_events.8150.c
		trigger = {
			has_trait = gallant
		}
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = medium_legend_quality_increase
			}
			set_legend_chapter = {
				name = famous_deed
				localization_key = legend_chapter_mysterious_injury
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
			}
		}
	}

	option = { # I got this injury fighting a mighty beast!
		name = legend_spread_events.8150.a
		duel = {
			skills = { martial learning }
			target = scope:intrigued_guest
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8080.a.win
					left_icon = root
					right_icon = scope:intrigued_guest
					add_piety = medium_prestige_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_increase
						}
						set_legend_chapter = {
							name = famous_deed
							localization_key = legend_chapter_battled_mighty_beast_good
						}
					}
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8080.a.lose
					left_icon = root
					right_icon = scope:intrigued_guest
					add_stress = minor_stress_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_decrease
						}
						set_legend_chapter = {
							name = famous_deed
							localization_key = legend_chapter_battled_mighty_beast_bad
						}
					}
				}
			}
		}
		stress_impact = {
			humble = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = -1
				ai_energy = 1
				ai_honor = -0.5
			}
		}
	}

	option = { # I was attacked when evangelising the faith
		name = legend_spread_events.8150.b
		trigger = { # Must believe in evangelism to an extent
			faith = { NOT = { has_doctrine = doctrine_pluralism_pluralistic } }
		}
		duel = {
			skill = learning
			target = scope:intrigued_guest
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8080.a.win
					left_icon = root
					right_icon = scope:intrigued_guest
					add_piety = medium_prestige_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_increase
						}
						set_legend_chapter = {
							name = famous_deed
							localization_key = legend_chapter_injured_evangelising_good
						}
					}
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8080.a.lose
					left_icon = root
					right_icon = scope:intrigued_guest
					add_stress = minor_stress_gain
					promoted_legend = {
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_decrease
						}
						set_legend_chapter = {
							name = famous_deed
							localization_key = legend_chapter_injured_evangelising_bad
						}
					}
				}
			}
		}
		stress_impact = {
			humble = minor_stress_impact_gain
			honest = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
				ai_energy = 1
				ai_honor = -0.5
			}
		}
	}

	option = { # No, the memories are too painful
		name = legend_spread_events.8150.d

		every_vassal = {
			vassal_stance = glory_hound
			custom = every_glory_hound_vassal
			add_opinion = {
				modifier = respect_opinion
				target = root
				opinion = 15
			}
		}

		stress_impact = {
			base = minor_stress_impact_loss
			shy = minor_stress_impact_loss
			reclusive = minor_stress_impact_loss
			paranoid = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = -1
				ai_energy = -1
				ai_honor = 1
			}
		}
	}

	after = {
		add_character_flag = legend_spread_events_8160
	}
}

############################
## I woo'd the love of my life
## 8160
## by James Beaumont
############################
legend_spread_events.8160 = {
	type = character_event
	title = legend_spread_events.8160.t
	desc = legend_spread_events.8160.desc
	theme = legend
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = flirtation
	}
	right_portrait = {
		character = scope:soulmate
		animation = flirtation
	}

	trigger = {
		exists = promoted_legend
		promoted_legend.legend_protagonist = root
		NOR = {
			exists = promoted_legend.var:8160_soulmate
			has_character_flag = legend_spread_events_8160
		}
		promoted_legend = {
			has_legend_chapter = additional_deed
		}
	}

	cooldown = { years = 15 }


	immediate = {
		promoted_legend = { save_scope_as = legend }
	}

	option = { # Yes, our love will be legendary
		name = legend_spread_events.8160.a
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = medium_legend_quality_increase
			}
			set_variable = {
				name = 8160_soulmate
				value = scope:soulmate
			}
			set_legend_chapter = {
				name = additional_deed
				localization_key = legend_chapter_love
			}
		}
		reverse_add_opinion = {
			modifier = flattered_opinion
			target = scope:soulmate
			opinion = 15
		}
		stress_impact = {
			# My legend is about meeeee
			arrogant = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
			honest = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
			}
		}
	}

	option = { # No, this is about me :)
		name = legend_spread_events.8160.b
		reverse_add_opinion = {
			modifier = insult_opinion
			target = scope:soulmate
			opinion = -15
		}
		add_character_modifier = {
			modifier = ce1_heartthrob
			years = 15
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -1
			}
		}
	}
}

############################
## W-wait, I'm gonna die one day??
## 8170
## by James Beaumont
############################
legend_spread_events.8170 = {
	type = character_event
	title = legend_spread_events.8170.t
	desc = {
		desc = legend_spread_events.8170.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					religion = religion:taoism_religion
				}
				desc = legend_spread_events.8170.desc.mid.taoist
			}
			triggered_desc = {
				trigger = {
					faith = { has_doctrine_parameter = reincarnation_events_active }
				}
				desc = legend_spread_events.8170.desc.mid.reincarnation
			}
			desc = legend_spread_events.8170.desc.mid.fallback
		}
		desc = legend_spread_events.8170.desc.outro
	}
	theme = legend
	override_background = { reference = corridor_night }
	left_portrait = {
		character = root
		animation = fear
	}
	cooldown = { years = 100 }

	trigger = {
		exists = promoted_legend
		promoted_legend.legend_protagonist = root
		is_immortal = no # We don't use immortality in the base game, this is here to make life easier for modders
		age >= 30
		promoted_legend = {
			has_legend_chapter = motivation
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 2
			religion = religion:taoism_religion
		}
		modifier = {
			add = 2
			health <= poor_health
		}
		modifier = { # Contemplate mortality more as you get older
			add = {
				value = age
				divide = 50
			}
		}
		modifier = { # Comfortable with dying
			factor = 0.5
			OR = {
				has_trait = content
				has_trait = humble
				has_trait = brave
				has_trait = zealous
			}
		}
		modifier = { # Terrified of dying
			factor = 1.5
			OR = {
				has_trait = ambitious
				has_trait = arrogant
				has_trait = craven
				has_trait = cynical
			}
		}
		modifier = { # Faith believes dying is good actually
			factor = 0.1
			faith = { has_doctrine_parameter = consolamentum_active }
		}
	}

	immediate = {
		promoted_legend = { save_scope_as = legend }
	}

	option = { # Y-yes, I must become immortal!
		name = legend_spread_events.8170.a
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = minor_legend_quality_increase
			}
			set_legend_chapter = {
				name = motivation
				localization_key = legend_chapter_immortal
			}
		}
		add_character_modifier = {
			modifier = ce1_immortal
			years = 15
		}
		hidden_effect = {
			add_character_flag = quest_for_immortality
		}
		stress_impact = {
			content = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			brave = minor_stress_impact_gain
			zealous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -1
				ai_boldness = 1
			}
		}
	}

	option = { # Pfshhhhh, legends never die
		name = {
			trigger = { has_trait = eccentric }
			text = legend_spread_events.8170.b.chess
		}
		name = {
			trigger = { NOT = { has_trait = eccentric } }
			text = legend_spread_events.8170.b.fallback
		}
		add_character_modifier = {
			modifier = ce1_level_headed
			years = 5
		}
		stress_impact = {
			ambitious = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			craven = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
			}
		}
	}
	
	after = {
		trigger_event = {
			id = legend_spread_events.8172
			months = { 1 3 }
		}
	}
}
#Follow-up, my little kid looks just like ME!
legend_spread_events.8171 = {
	type = character_event
	title = legend_spread_events.8171.t
	desc = legend_spread_events.8171.desc
	theme = legend
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:child
		animation = happiness
	}
	cooldown = { years = 5 }

	trigger = {
		exists = promoted_legend
		promoted_legend.legend_protagonist = root
		is_immortal = no
		has_character_flag = quest_for_immortality
		NOT = { exists = promoted_legend.var:8171_child }
		promoted_legend = {
			has_legend_chapter = conclusion
		}
	}

	immediate = {
		promoted_legend = { save_scope_as = legend }
	}

	option = { # My song is ending, but the story never ends.
		name = legend_spread_events.8171.a
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = major_legend_quality_increase
			}
			set_variable = {
				name = 8171_child
				value = scope:child
			}
			set_legend_chapter = {
				name = conclusion
				localization_key = legend_chapter_immortal_child_conclusion
			}
		}
		stress_impact = {
			ambitious = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			craven = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -1
				ai_boldness = 1
			}
		}
	}
}
#Follow-up, meet your maker
legend_spread_events.8172 = {
	type = character_event
	title = legend_spread_events.8172.t
	desc = legend_spread_events.8172.desc
	theme = legend
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:old_you
		animation = personality_zealous
		outfit_tags = { nightgown }
		hide_info = yes
	}
	override_effect_2d = fog
	cooldown = { years = 5 }

	trigger = {
		exists = promoted_legend
		promoted_legend.legend_protagonist = root
		has_character_flag = quest_for_immortality
		NOT = { religion = religion:taoism_religion }
		is_immortal = no
		promoted_legend = {
			has_legend_chapter = conclusion
		}
	}

	immediate = {
		promoted_legend = { save_scope_as = legend }
		create_character = {
			template = bp1_doppelganger_template
			dynasty = none
			location = root.capital_province
			save_scope_as = old_you
		}
		scope:old_you = {
			set_age = 100
		}
	}

	option = { # Go be human
		name = legend_spread_events.8172.a
		flavor = legend_spread_events.8172.a.flavor
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = medium_legend_quality_increase
			}
			set_legend_chapter = {
				name = conclusion
				localization_key = legend_chapter_accept_mortality_conclusion
			}
		}
		add_character_modifier = {
			modifier = ce1_accepted_mortality
			years = 25
		}
		stress_impact = {
			base = major_stress_impact_loss
			ambitious = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			craven = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -1
				ai_boldness = 1
			}
		}
	}

	option = { # Not today matey
		name = legend_spread_events.8172.b
		flavor = legend_spread_events.8172.b.flavor
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = minor_legend_quality_increase
			}
			set_legend_chapter = {
				name = conclusion
				localization_key = legend_chapter_confronted_creator_conclusion
			}
		}
		add_character_modifier = {
			modifier = ce1_will_to_live
			years = 15
		}
		stress_impact = {
			ambitious = minor_stress_impact_loss
			arrogant = minor_stress_impact_loss
			craven = minor_stress_impact_loss
			cynical = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
				ai_boldness = -1
			}
		}
	}

	option = { # I'm ready
		name = legend_spread_events.8172.c
		flavor = legend_spread_events.8172.c.flavor
		trigger = {
			has_trait = content
			OR = {
				health <= poor_health
				age >= 65
			}
		}
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = major_legend_quality_increase
			}
			set_legend_chapter = {
				name = conclusion
				localization_key = legend_chapter_accept_mortality_conclusion
			}
		}
		death = {
			death_reason = death_peaceful
		}

		stress_impact = {
			base = massive_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = -1
				ai_boldness = 1
			}
		}
	}
	after = {
		scope:old_you = {
			silent_disappearance_effect = yes
		}
	}
}

############################
## You killed my father, prepare to die
## 8180
## by James Beaumont
############################
legend_spread_events.8180 = {
	type = character_event
	title = legend_spread_events.8180.t
	desc = legend_spread_events.8180.desc
	theme = legend
	left_portrait = {
		character = root
		animation = anger
	}
	lower_left_portrait = {
		character = scope:dead_parent
	}
	lower_right_portrait = {
		character = scope:killer
	}

	trigger = {
		exists = promoted_legend
		promoted_legend.legend_protagonist = root
		NOT = {
			exists = var:8180_revenge_quest
		}
		any_parent = {
			even_if_dead = yes
			killer ?= { is_alive = yes }
			NOT = { # I killed my father. Prepare to- wait...
				killer = root
			}
		}
		promoted_legend = {
			has_legend_chapter = motivation
		}
	}

	cooldown = { years = 25 }

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 10
			has_trait = vengeful
		}
		modifier = {
			factor = 0.1
			has_trait = forgiving
		}
	}

	immediate = {
		random_parent = {
			even_if_dead = yes
			limit = {
				killer ?= { is_alive = yes }
				killer != root
			}
			save_scope_as = dead_parent
			killer = { save_scope_as = killer }
		}
		promoted_legend = { save_scope_as = legend }
	}

	option = { # My revenge quest begins
		name = legend_spread_events.8180.a
		promoted_legend = {
			change_legend_quality_effect = {
				VALUE = minor_legend_quality_increase
			}
			set_legend_chapter = {
				name = motivation
				localization_key = legend_chapter_revenge_quest
			}
		}
		if = {
			limit = {
				NOT = {
					has_relation_rival = scope:killer
				}
			}
			set_relation_rival = {
				target = scope:killer
				reason = rival_murdered_parent
			}
		}
		custom_tooltip = {
			text = 8180_bonus_if_you_kill_tt
			set_variable = {
				name = 8180_revenge_quest
				value = scope:killer
			}
			scope:killer = {
				set_variable = { # To trigger the event
					name = 8180_marked_for_death
					value = root
				}
			}
		}
		stress_impact = {
			forgiving = minor_stress_impact_gain
			craven = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_boldness = 1
			}
		}
	}

	option = { # This does not define me
		name = legend_spread_events.8180.b
		add_character_modifier = {
			modifier = ce1_forgiveness
			years = 15
		}
		stress_impact = {
			base = major_stress_impact_gain
			forgiving = major_stress_impact_loss
			compassionate = major_stress_impact_loss
			just = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = -1
				ai_boldness = -1
				ai_honor = 1
			}
		}
	}
}
# Revenge complete!
legend_spread_events.8181 = {
	type = character_event
	title = legend_spread_events.8181.t
	desc = {
		desc = legend_spread_events.8181.desc.intro
		first_valid = {
			triggered_desc = { # Did I kill them, or did they just die?
				trigger = {
					scope:killer.killer = root
				}
				desc = legend_spread_events.8181.desc.mid.murder
			}
			desc = legend_spread_events.8181.desc.mid.fallback
		}
		desc = legend_spread_events.8181.desc.outro
	}
	theme = legend
	left_portrait = {
		character = root
		animation = anger
	}
	right_portrait = {
		character = scope:killer
	}

	trigger = {
		exists = promoted_legend
		promoted_legend.legend_protagonist = root
		exists = var:8180_revenge_quest
		promoted_legend = {
			has_legend_chapter = conclusion
		}
	}

	immediate = {
		var:8180_revenge_quest = { save_scope_as = killer }
		promoted_legend = { save_scope_as = legend }
		random_parent = {
			even_if_dead = yes
			limit = {
				killer ?= scope:killer
			}
			save_scope_as = dead_parent
		}
	}

	option = { # My revenge quest begins
		name = legend_spread_events.8181.a
		promoted_legend = {
			if = {
				limit = {
					scope:killer.killer = root
				}
				change_legend_quality_effect = {
					VALUE = major_legend_quality_increase
				}
				set_legend_chapter = {
					name = conclusion
					localization_key = legend_chapter_revenge_quest_complete
				}
			}
			else = {
				set_legend_chapter = {
					name = conclusion
					localization_key = legend_chapter_revenge_quest_divine_justice
				}
			}
		}
		remove_variable = 8180_revenge_quest
		stress_impact = {
			base = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_boldness = 1
			}
		}
	}
}

############################
## I was raised by LocalAnimal
## 8190
## by James Beaumont
############################
legend_spread_events.8190 = {
	type = character_event
	title = legend_spread_events.8190.t
	desc = legend_spread_events.8190.desc
	theme = legend
	left_portrait = {
		character = root
		animation = personality_bold
	}
	right_portrait = {
		character = scope:chronicler
		animation = marshal
	}

	trigger = {
		promoted_legend ?= {
			legend_owner = root
			has_legend_chapter = opening
		}
		is_available_adult = yes
		has_trait = eccentric
		NOT = { exists = promoted_legend.var:animal_parent }
		any_parent = { is_alive = yes }
	}

	cooldown = { years = 15 }

	immediate = {
		grab_appropriate_chronicler_effect = yes
		promoted_legend = {
			save_scope_as = legend
		}
		select_local_animal_effect = { TYPE = dangerous }
		random_parent = {
			limit = { is_alive = yes }
			save_scope_as = parent
		}
	}

	option = { # Yes, it's true, I was raised by wolves
		name = legend_spread_events.8190.a
		duel = {
			skills = { prowess learning }
			value = high_skill_rating
			# Success.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8190.a.win
					left_icon = root
					right_icon = scope:chronicler
					add_piety = medium_prestige_gain
					promoted_legend = {
						set_variable = {
							name = animal_parent
							value = root.var:animal_type
						}
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_increase
						}
						set_legend_chapter = {
							name = opening
							localization_key = legend_chapter_raised_by_animal
						}
					}
				}
			}
			# Failure.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8190.a.lose
					left_icon = root
					right_icon = scope:chronicler
					add_stress = minor_stress_gain
					promoted_legend = {
						root = { select_local_animal_effect = { TYPE = small } }
						set_variable = {
							name = animal_parent
							value = root.var:animal_type
						}
						change_legend_quality_effect = {
							VALUE = medium_legend_quality_decrease
						}
						set_legend_chapter = {
							name = opening
							localization_key = legend_chapter_raised_by_animal
						}
					}
				}
			}
			# Crit failure.
			10 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = legend_spread_events.8190.a.crit_lose
					left_icon = root
					right_icon = scope:chronicler
					add_stress = minor_stress_gain
					promoted_legend = {
						root = { select_local_animal_effect = { TYPE = harmless } }
						set_variable = {
							name = animal_parent
							value = root.var:animal_type
						}
						change_legend_quality_effect = {
							VALUE = major_legend_quality_decrease
						}
						set_legend_chapter = {
							name = opening
							localization_key = legend_chapter_raised_by_animal
						}
					}
				}
			}
		}
		stress_impact = {
			humble = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_zeal = 1
				ai_energy = 1
				ai_honor = -1
			}
		}
	}

	option = { # No, this is silly
		name = legend_spread_events.8190.b

		if = {
			limit = {
				exists = scope:parent
			}
			reverse_add_opinion = {
				modifier = angry_opinion
				target = scope:parent
				opinion = -20
			}
		}

		stress_impact = {
			base = minor_stress_impact_loss
			deceitful = medium_stress_impact_gain
			diligent = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = -1
				ai_honor = 1
			}
		}
	}
}
