﻿@army_commander_vulnerable_to_health_problems_value = good_health
@court_medic_able_to_help_value = very_high_skill_rating
@random_harm_standard_skill_check_value = very_high_skill_rating
@random_harm_easy_skill_check_value = mediocre_skill_rating

namespace = harm

##################################################
# #Responsive Incapability Events
# 0001 - 0010	Ailing with Age - You're growing old and your health is ailing.
# 0011 - 0020	Broken by Battle - You take brain damage during a battle.
#
# #Random Incapability Events
# 0501 - 0510	Best in Breed - Inbreeding has left you increasingly vapid and feeble-minded.
# 0511 - 0520	A Little Tumble - You fall from your horse/camel/elephant/donkey.
# 0521 - 0530	Gurgling & Grasping - Whilst at sea, you fall overboard and drown long enough to endanger your brain.
# 0531 - 0540	The World Slipping - Struck down by a stroke.
# 0541 - 0550	Chilled to the Bones - Crippling arthritis, chiefly in colder regions, can hurt the elderly.
# 0551 - 0560	A Thud & A Snap - A child falls from a tree.
# 0561 - 0570	The Descent - An old person falls down some stairs.
# 0571 - 0580	A Trip During Training - A fighting ruler is whacked on the bonce whilst training.
# 0581 - 0590	Slippery when Wet - Slipping getting out of the tub.
# 0591 - 0600	Death from Above - A peasant's falling pot leaves you incapable.
# 0601 - 0610	What's the Harm? - Children playing goes horribly wrong.
# 0611 - 0620	Dizzying Heights - As a cripplingly feeble character, stand up way, way too fast.
# 0621 - 0630	A Jolly Good Time - Drunken shenanigans.
# 0631 - 0640	A Rollicking Good Time - Heart attack whilst vigorously bonking.
# 0641 - 0650	Some Slight Swelling - Dropsy renders you bed-ridden.
#
# #Random Death Events
# 1001 - 1010	Choke On It - Choking at a feast.
# 1011 - 1020	Ride or Die - Something spooks your horse and it goes flying out of control.
# 1021 - 1030	Finger-Licking Good - Eating too much exotic food.
# 1031 - 1040	A Clogged Throat - Quinsy-induced choking.
# 1041 - 1050	Probably Safe - Fall into a body of water.
# 1051 - 1060	Flickering Flames - A small fire gets out of hand.
# 1061 - 1070	A Moderate Tumble - Falling out of a window whilst admiring the view.
# 1071 - 1080	Crimes of Passion - A scuffle between two rivals sees you accidentally stabbed.
# 1081 - 1090	Storm's Wrath - Death in a storm, due to a lightning hit/being crushed by a falling tree/twatted by a falling rock/catching a terminal chill.
# 1091 - 1100	Aching Minds - Struck down by an aneurysm.
# 1101 - 1110	Street Safety - Run over by a rider/run-away cart.
# 1111 - 1120	People's Justice - Stabbed by a servant in your capital that hates you.
#
# #Random Death Battle Events
# 2001 - 2010	Camp Fever - Terrible siege conditions cause you strife.
# 2011 - 2020	Marching Malaise - Terrible marching conditions are problematic.
# 2021 - 2030	So... Cold... - Frostbite claims you.
# 2031 - 2040	So... Hot... - Heat-stroke claims you.
# 2041 - 2050	For the Realm - Aggrieved soldiers at war too long assassinate you.
# 2051 - 2060	Starvation - Complications due to starvation from lack of supply.
# 2061 - 2070	Harried Each Step - Retreating from battle and caught by enemy soldiers.
# 2071 - 2080	A Disastrous Victory - Pursuing too far ahead in battle and caught by enemy soldiers.
##################################################










##################################################
# MISC SCRIPTED TRIGGERS & EFFECTS

# Can this dynasty/house get another random horrific accident?
## Note: this only applies to the foreboding events. If a family is unlucky enough to roll two foreboding events in a row before the next one hits, well, that's only gonna reset their cooldown.
scripted_trigger harm_0000_not_on_dynastic_cooldown_trigger = {
	# Are we a player?
	trigger_if = {
		limit = { is_ai = no }
		NOT = {
			# We structure it like this so that the variable registers as used by the game, avoiding the need for an error suppression event.
			dynasty ?= { has_variable = player_random_harm_cooldown }
		}
	}
	# No? Ok, then try our house.
	trigger_if = {
		limit = {
			is_ai = yes
			exists = house
		}
		NOT = {
			# We structure it like this so that the variable registers as used by the game, avoiding the need for an error suppression event.
			house ?= { has_variable = ai_random_harm_cooldown}
		}
	}
}

# Apply appropriate cooldowns so that we don't repeatedly kill/incapacitate the same people.
scripted_effect harm_0000_apply_dynastic_cooldowns_effect = {
	# Are we a player?
	if = {
		limit = { is_ai = no }
		# Right, then we want to set a cooldown on our dynasty.
		dynasty = {
			set_variable = {
				name = player_random_harm_cooldown
				value = yes
				years = 50
			}
		}
	}
	else_if = {
		limit = { exists = house }
		house = {
			set_variable = {
				name = ai_random_harm_cooldown
				value = yes
				years = 30
			}
		}
	}
}

# Grab our court physician and apply the correct scope _if_ we wouldn't be better off treating ourselves.
scripted_effect harm_0000_grab_available_court_physician_effect = {
	if = {
		limit = {
			# Check to see if we'd be better of treating ourselves.
			$PERSONAL_SKILL$ < @random_harm_standard_skill_check_value
			# Else, try to grab the physician.
			any_court_position_holder = {
				type = court_physician_court_position
				is_available_adult = yes
				location = root.location
			}
		}
		random_court_position_holder = {
			type = court_physician_court_position
			limit = {
				is_available_adult = yes
				location = root.location
			}
			save_scope_as = medic
		}
	}
}

# Run the chance of a court physician saving us if we're at risk of becoming incapable.
scripted_effect harm_0000_physic_rescue_chance_incapable_effect = {
	random_list = {
		# You aren't permanently hurt.
		0 = {
			modifier = { add = harm_event_random_list_medium_odd_success_value }
			desc = harm.0000.tt.incapable.success
			send_interface_toast = {
				type = event_toast_effect_good
				title = harm.0000.tt.incapable.success
				left_icon = root
				custom_tooltip = harm.0000.tt.no_permanent_damage
			}
		}
		# The experience leaves you feeble.
		0 = {
			modifier = { add = harm_event_random_list_medium_odd_failure_value }
			desc = harm.0000.tt.incapable.failure
			send_interface_toast = {
				type = event_toast_effect_bad
				title = harm.0000.tt.incapable.failure
				left_icon = root
				upgrade_infirm_to_incapable_effect = yes
				create_character_memory = { type = became_incapable_generic }
			}
		}
	}

	# Having someone to call on for this type of thing offloads the "what do I do?!" panic.
	stress_impact = {
		base = minor_stress_impact_gain
		calm = minor_stress_impact_loss
	}
}

# Run the chance of a court physician saving us if we're at risk of death.
scripted_effect harm_0000_physic_rescue_chance_death_effect = {
	random_list = {
		# You live.
		0 = {
			modifier = { add = harm_event_random_list_medium_odd_success_value }
			desc = harm.0000.tt.death.success
			send_interface_toast = {
				type = event_toast_effect_good
				title = harm.0000.tt.death.success
				left_icon = root
				custom_tooltip = harm.0000.tt.spared_for_now
				log_harm_event_spared_as_variable_effect = yes
			}
		}
		# You die.
		0 = {
			modifier = { add = harm_event_random_list_medium_odd_failure_value }
			desc = harm.0000.tt.death.failure
			send_interface_toast = {
				type = event_toast_effect_bad
				title = harm.0000.tt.death.failure
				left_icon = root
				death = { death_reason = $DEATH_REASON$ }
				log_harm_event_death_as_variable_effect = yes
			}
		}
	}

	# Having someone to call on for this type of thing offloads the "what do I do?!" panic.
	stress_impact = {
		base = minor_stress_impact_gain
		calm = minor_stress_impact_loss
	}
}











##################################################
# RESPONSIVE INCAPABILITY EVENTS

##################################################
# Ailing with Age
# by Ewan Cowhig Croft
# 0001 - 0010
##################################################

scripted_trigger harm_0001_general_requirements_trigger = {
	# Standard checks.
	harm_game_rule_enablement_trigger = yes
	# Mustn't _already_ have a trait granting you this.
	is_incapable = no
	# Health checks.
	age_ranked_health_vulnerability_threshold_trigger = yes
}

scripted_effect harm_0001_age_gracefully_or_stress_loss_effect = {
	if = {
		limit = {
			NOT = { has_character_modifier = aging_gracefully_modifier }
		}
		add_character_modifier = aging_gracefully_modifier
	}
	else = { add_stress = medium_stress_loss }
}

#	You're growing old and your health is ailing.
harm.0001 = {
	type = character_event
	title = harm.0001.t
	desc = harm.0001.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = sick
		outfit_tags = { nightgown }
	}
	override_background = { reference = bedchamber }

	# See you next time...
	cooldown = { years = 10 }

	trigger = {
		# Must've had the foreshadowing events.
		has_character_flag = had_event_harm_0002
		has_character_flag = had_event_harm_0003
		# Then our general reqs.
		harm_0001_general_requirements_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Weight up a bit for infirm characters.
		modifier = {
			add = 0.25
			has_trait = infirm
		}
	}

	immediate = { play_music_cue = "mx_cue_stress" }

	# I'll be around for donkey's years yet, I'm sure.
	option = {
		name = harm.0001.a

		duel = {
			skill = prowess
			value = very_high_skill_rating
			# Your body is healthy, your mind is clear.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					# Always give _some_ chance.
					min = -39
				}
				desc = harm.0001.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0001.a.tt.success
					left_icon = root
					harm_0001_age_gracefully_or_stress_loss_effect = yes
				}
			}
			# You're not as fit as you thought you were.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					# Limit how low the off-chance can go.
					min = -19
				}
				desc = harm.0001.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0001.a.tt.failure
					left_icon = root
					# Upgrade our incapability.
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_due_to_age }
				}
			}
		}

		stress_impact = {
			brave = miniscule_stress_impact_loss
			craven = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_boldness = 1
				ai_energy = 1
			}
		}
	}

	# Perhaps I could live a little cleaner...
	option = {
		name = harm.0001.b

		duel = {
			skill = learning
			value = very_high_skill_rating
			# You make a few necessary changes.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					# Always give _some_ chance.
					min = -39
				}
				desc = harm.0001.b.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0001.b.tt.success
					left_icon = root
					harm_0001_age_gracefully_or_stress_loss_effect = yes
				}
			}
			# Nothing stops the march of time.
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					# Limit how low the off-chance can go.
					min = -19
				}
				desc = harm.0001.b.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0001.b.tt.failure
					left_icon = root
					# Upgrade our incapability.
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_due_to_age }
				}
			}
		}

		stress_impact = {
			patient = miniscule_stress_impact_loss
			impatient = minor_stress_impact_gain
			eccentric = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_rationality = 1
				ai_zeal = 0.5
			}
		}
	}

	# Stubborn: I'll go when I'm good and ready, DeathDeityName, not before.
	option = {
		name = harm.0001.c
		trigger = { has_trait = stubborn }
		trait = stubborn

		# Stubborness & will alone keep you going.
		add_stress = major_stress_gain

		# We're just awarding stress directly here, so no stress impact.
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# I'm not the youth I once was.
	option = {
		name = harm.0001.d

		# Welp, you've got some kinda chance.
		random_list = {
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0001.d.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0001.d.tt.success
					left_icon = root
					harm_0001_age_gracefully_or_stress_loss_effect = yes
				}
			}
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0001.d.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0001.d.tt.failure
					left_icon = root
					# Upgrade our incapability.
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_due_to_age }
				}
			}
		}

		stress_impact = {
			lazy = miniscule_stress_impact_loss
			humble = miniscule_stress_impact_loss
			diligent = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 1
			ai_value_modifier = {
				ai_rationality = 0.25
				ai_energy = -0.5
				ai_boldness = -0.5
			}
		}
	}
}

#	Your mind fogs.
harm.0002 = {
	type = character_event
	title = harm.0002.t
	desc = harm.0002.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = paranoia
	}
	override_background = { reference = bedchamber }

	trigger = {
		NOT = { has_character_flag = had_event_harm_0002 }
		harm_0001_general_requirements_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Weight up a bit for infirm characters.
		modifier = {
			add = 0.25
			has_trait = infirm
		}
	}

	immediate = {
		# Flag this event as taken for .0001.
		add_character_flag = had_event_harm_0002
	}

	# What was I thinking about?
	option = {
		name = harm.0002.a
		flavor = harm.0002.a.tt

		# No effects, this event is just foreshadowing.

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}
}

#	Your bones creak.
harm.0003 = {
	type = character_event
	title = harm.0003.t
	desc = {
		desc = harm.0003.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { has_trait = blind }
				desc = harm.0003.desc.blind
			}
			desc = harm.0003.desc.sighted
		}
		desc = harm.0003.desc.outro
	}
	theme = physical_health
	left_portrait = {
		character = root
		animation = worry
	}
	override_background = { reference = bedchamber }

	trigger = {
		NOT = { has_character_flag = had_event_harm_0003 }
		harm_0001_general_requirements_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Weight up a bit for infirm characters.
		modifier = {
			add = 0.25
			has_trait = infirm
		}
	}

	immediate = {
		# Flag this event as taken for .0001.
		add_character_flag = had_event_harm_0003
	}

	# Gah, do everyone's joints #EMP creak#! like this?
	option = {
		name = harm.0003.a
		flavor = harm.0003.a.tt

		# No effects, this is just foreshadowing.

		stress_impact = {
			base = medium_stress_impact_gain
			stubborn = minor_stress_impact_loss
		}
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}
}

##################################################
# Broken by Battle
# by Ewan Cowhig Croft
# 0011 - 0020
##################################################

scripted_trigger harm_0011_valid_emergency_medic_trigger = {
	OR = {
		# Court physician is with the army.
		has_court_position = court_physician_court_position
		# Any knight with the physician trait is with the army.
		has_trait = lifestyle_physician
		# Any character with obscenely high learning will also do.
		learning >= 26
	}
	NOT = {
		has_any_bad_relationship_with_character_trigger = { CHARACTER = root.side_commander }
	}
}

#	You take brain damage during a battle.
harm.0011 = {
	type = character_event
	title = harm.0011.t
	desc = {
		desc = harm.0011.desc.default_body
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:medic }
				desc = harm.0011.desc.medic_present
			}
			desc = harm.0011.desc.no_medic
		}
	}
	theme = physical_health
	left_portrait = {
		character = root
		animation = stress
	}
	right_portrait = {
		character = scope:medic
		animation = shock
	}
	override_background = { reference = battlefield }

	# Trigger taken care of in harm.0012.

	# Weight_multiplier taken care of in harm.0012, too.

	# Harm.0012 is where it's all happening, basically.

	immediate = { play_music_cue = "mx_cue_stress" }

	# I'm fine! I-I'm fine...
	option = {
		name = harm.0011.a

		random_list = {
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0011.a.tt.success
				# You recover, given time.
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0011.a.tt.success
					left_icon = root
					# Natural proclivity saves you.
					random_list = {
						50 = {
							desc = harm.0011.a.tt.success.bone
							add_character_modifier = {
								modifier = thick_skulled_modifier
								years = 20
							}
						}
						50 = {
							desc = harm.0011.a.tt.success.brain
							add_character_modifier = {
								modifier = strong_willed_modifier
								years = 20
							}
						}
					}
				}
			}
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0011.a.tt.failure
				# But you were not fine.
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0011.a.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_due_to_battle_concussion }
					# We have to do this weird double-scoping due to some kind of dark pact with Code, else things won't work.
					scope:new_memory = { save_scope_as = battle_memory }
					scope:battle_memory = {
						set_variable = {
							name = battle_location
							value = scope:battle_location
						}
					}
				}
			}
		}

		stress_impact = { base = major_stress_impact_gain }
		ai_chance = {
			# AI should only pick this option if there's not a chance to call for a medic.
			base = 1
		}
	}

	# Scope:medic. Please. My #EMP head.#!
	option = {
		name = harm.0011.b
		trigger = { exists = scope:medic }

		# Scope:medic battles to save your thinker.
		scope:medic = {
			duel = {
				skill = learning
				value = very_high_skill_rating
				# With HerHis aid, you pull through.
				0 = {
					modifier = { add = harm_event_random_list_medium_odd_success_value }
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -49
					}
					desc = harm.0011.b.tt.success
					root = {
						send_interface_toast = {
							type = event_toast_effect_good
							title = harm.0011.b.tt.success
							left_icon = root
							right_icon = scope:medic
							# Clearly you were well-fortified.
							random_list = {
								0 = {
									modifier = { add = harm_event_random_list_medium_odd_success_value }
									desc = harm.0011.a.tt.success.bone
									add_character_modifier = {
										modifier = thick_skulled_modifier
										years = 20
									}
								}
								0 = {
									modifier = { add = harm_event_random_list_medium_odd_failure_value }
									desc = harm.0011.a.tt.success.brain
									add_character_modifier = {
										modifier = strong_willed_modifier
										years = 20
									}
								}
							}
							# Good start to a friendship.
							progress_towards_friend_effect = {
								REASON = friend_emergency_surgery
								CHARACTER = scope:medic
								OPINION = 0
							}
						}
					}
				}
				# HerHis best just wasn't good enough.
				0 = {
					modifier = { add = harm_event_random_list_medium_odd_failure_value }
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
						min = -49
					}
					# Without recent or prolonged experience on behalf of your physic, your odds are much worse.
					modifier = {
						add = 25
						NOR = {
							has_trait = lifestyle_physician
							has_court_position = court_physician_court_position
						}
					}
					desc = harm.0011.b.tt.failure
					root = {
						send_interface_toast = {
							type = event_toast_effect_bad
							title = harm.0011.b.tt.failure
							left_icon = root
							right_icon = scope:medic
							upgrade_infirm_to_incapable_effect = yes
							create_character_memory = { type = became_incapable_due_to_battle_concussion }
							# We have to do this weird double-scoping due to some kind of dark pact with Code, else things won't work.
							scope:new_memory = { save_scope_as = battle_memory }
							scope:battle_memory = {
								set_variable = {
									name = battle_location
									value = scope:battle_location
								}
							}
							# And uhhh, you're not happy.
							add_opinion = {
								target = scope:medic
								modifier = botched_my_treatment_crime_opinion
							}
						}
					}
				}
			}
		}

		stress_impact = {
			base = major_stress_impact_gain
			trusting = minor_stress_impact_loss
			stubborn = minor_stress_impact_gain
			paranoid = medium_stress_impact_gain
		}
		ai_chance = {
			# AI should be picking this if it's available.
			base = 1000
		}
	}
}

scripted_trigger harm_0012_valid_commander_trigger = {
	# Standard checks.
	harm_game_rule_enablement_trigger = yes
	# Mustn't _already_ have a trait granting you this.
	is_incapable = no
}

#	Setup event for harm.0011.
#		Due to mechanical constraints, currently only fires for the leaders on either side.
harm.0012 = {
	hidden = yes
	scope = combat_side

	trigger = {
		side_commander ?= { harm_0012_valid_commander_trigger = yes }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		## We have to be a bit weird checking this one: there's not an easy way to weight the chance of the event by any commander potentially fulfilling the event, so we weight by a random valid one.
		modifier = {
			add = side_commander.harm_game_rule_likelihood_value
			exists = side_commander
		}
		# We deliberately weight only a _little_ bit for prowess - you've got a retinue and we still want bad luck to strike, so a mild rebate is all you get.
		modifier = {
			add = -0.25
			side_commander ?= {
				OR = {
					prowess >= extremely_high_skill_rating
					has_trait = lifestyle_blademaster
				}
			}
		}
	}

	immediate = {
		# Grab our location.
		combat.location = { save_scope_as = battle_location }
		# Try to grab a physician, if there's one available.
		if = {
			limit = {
				any_side_knight = { harm_0011_valid_emergency_medic_trigger = yes }
			}
			# Pick out the appropriate knights.
			every_side_knight = {
				limit = { harm_0011_valid_emergency_medic_trigger = yes }
				add_to_list = potential_medics_list
			}
			# Then grab someone at random - medics are likely to be busy, so we don't just grab the best one.
			random_in_list = {
				list = potential_medics_list
				weight = {
					base = 0
					# You're important, so there's more likelihood of better medics being rushed to you.
					modifier = { add = learning }
					# But we weight down if they're not part of your army.
					modifier = {
						factor = 0.5
						NOT = { knight_army = root.side_commander.commanding_army }
					}
				}
				save_scope_as = medic
			}
		}
		# Then we fire the next event.
		side_commander = { trigger_event = harm.0011 }
	}
}











##################################################
# RANDOM INCAPABILITY EVENTS

##################################################
# Best in Breed
# by Ewan Cowhig Croft
# 0501 - 0510
##################################################

#	Inbreeding has left you increasingly vapid and feeble-minded.
harm.0501 = {
	type = character_event
	title = harm.0501.t
	desc = harm.0501.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = pain
	}
	override_background = { reference = courtyard }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0501 }
		has_character_flag = had_event_harm_0502
		# We don't recheck your inbreeding situation because your genetic heritage can't have changed and you already have a character flag indicating you went through this once, so there's no need.
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Weight up if you're _already_ inbred.
		modifier = {
			add = 0.5
			has_trait = inbred
		}
	}

	immediate = {
		# We don't want to see this event twice.
		add_character_flag = had_event_harm_0501
		# Give a little protection against spam.
 		harm_0000_apply_dynastic_cooldowns_effect = yes
 		# If you weren't obviously inbred before, you are now.
 		if = {
 			limit = {
 				NOT = { has_trait = inbred }
 			}
 			add_trait = inbred
 		}
	}

	# Where... where am I?
	option = {
		name = harm.0501.a

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0501.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0501.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0501.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0501.a.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# I can #EMP control myself#!.
	option = {
		name = harm.0501.b
		trigger = { has_trait = whole_of_body }
		trait = whole_of_body

		custom_tooltip = harm.0000.tt.no_permanent_damage

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# My mind is sharper than this.
	option = {
		name = harm.0501.c
		trigger = { learning >= @random_harm_standard_skill_check_value }
		skill = learning

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.0501.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0501.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.0501.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0501.c.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		# Always gain stress from skill tests.
		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.0502 = {
	type = character_event
	title = harm.0502.t
	desc = harm.0502.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = pain
	}
	override_background = { reference = courtyard }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0502 }
		# Right, let's check your inbreeding situation.
		## First, we filter out creepy pure-blooded types, because they're homozygous and thus aren't affected by these things.
		NOT = { has_trait = pure_blooded }
		## Now, let's check what the immediate inbreeding situation is like and grab some scopes.
		### First, you need both parents or we'll get errors.
		any_parent = { count >= 2 }
		### Right, now let's check for recent inbreeding and get those parents saved up.
		any_parent = { save_temporary_scope_as = char_temp_1 }
		any_parent = {
			this != scope:char_temp_1
			is_close_or_extended_family_of = scope:char_temp_1
			save_temporary_scope_as = char_temp_2
		}
		## Then we want to make sure you've got all six parents'n'grandparents available so we can iterate through them.
		### Check they're there.
		scope:char_temp_1 = {
			any_parent = { count >= 2 }
		}
		scope:char_temp_2 = {
			any_parent = { count >= 2 }
		}
		### Then grab the scopes so we don't constantly reiterate for them.
		scope:char_temp_1 = {
			any_parent = { save_temporary_scope_as = char_temp_3 }
			any_parent = {
				this != scope:char_temp_3
				save_temporary_scope_as = char_temp_4
			}
		}
		scope:char_temp_2 = {
			any_parent = { save_temporary_scope_as = char_temp_5 }
			any_parent = {
				this != scope:char_temp_5
				save_temporary_scope_as = char_temp_6
			}
		}
		## Sweet, we've got this far, so check what our degrees of incest are.
		OR = {
			# We'll take an extra generation of close kin on either grandparental side.
			scope:char_temp_3 = { is_close_family_of = scope:char_temp_4 }
			scope:char_temp_5 = { is_close_family_of = scope:char_temp_6 }
			# Alternatively, if all of your grandparents were vaguely related to their partner, that works too.
			AND = {
				scope:char_temp_3 = { is_close_or_extended_family_of = scope:char_temp_4 }
				scope:char_temp_5 = { is_close_or_extended_family_of = scope:char_temp_5 }
			}
		}
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Weight up if you're _already_ inbred.
		modifier = {
			add = 0.5
			has_trait = inbred
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_0502
	}

	# What strange malady is this?
	option = {
		name = harm.0502.a

		# Foreshadow.
		custom_tooltip = harm.0502.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.0501
					years = { 2 4 }
				}
			}
		}
	}
}

##################################################
# A Little Tumble
# by Ewan Cowhig Croft
# 0511 - 0520
##################################################

scripted_trigger harm_0511_rides_horses_trigger = {
	OR = {
		# Either you're not a tribe.
		NOT = { government_has_flag = government_is_tribal }
		# Or you have Horse Lords.
		mpo_can_recruit_nomad_maa_trigger = yes
		culture = { culture_has_archer_cavalry_maa = yes }
		has_trait = nomadic_philosophy
	}
}

#	You fall from your horse/camel/elephant/donkey.
harm.0511 = {
	type = character_event
	title = harm.0511.t
	desc = harm.0511.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = loss_1
	}
	override_background = { reference = wilderness }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0511 }
		has_character_flag = had_event_harm_0512
		# Are we expected to ride a horse regularly?
		harm_0511_rides_horses_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
	}

	immediate = {
		# We don't want to see this event twice.
		add_character_flag = had_event_harm_0511
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
	}

	# Wait, n-!
	option = {
		name = harm.0511.a

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0511.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0511.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0511.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0511.a.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# Duck and roll.
	option = {
		name = harm.0511.b
		trigger = {
			OR = {
				has_trait = brave
				has_trait_xp = {
					trait = tourney_participant
					track = horse
					value >= 75
				}
				has_trait_xp = {
					trait = lifestyle_hunter
					track = hunter
					value >= 75
				}
			}
		}
		trait = brave
		trait = tourney_participant
		trait = lifestyle_hunter

		custom_tooltip = harm.0000.tt.no_permanent_damage

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Take it on the shoulder.
	option = {
		name = harm.0511.c
		trigger = { martial >= @random_harm_standard_skill_check_value }
		skill = martial

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.0511.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0511.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.0511.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0511.c.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		# Always gain stress from skill tests.
		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.0512 = {
	type = character_event
	title = harm.0512.t
	desc = harm.0512.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = jockey_walk
		camera = camera_event_horse_left
	}
	override_background = { reference = wilderness }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0512 }
		# Are we expected to ride a horse regularly?
		harm_0511_rides_horses_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_0512
	}

	# Heh, not letting #EMP that#! happen again.
	option = {
		name = harm.0512.a

		# Foreshadow.
		custom_tooltip = harm.0512.a.tt

		stress_impact = { base = medium_stress_impact_loss }
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.0511
					years = { 2 4 }
				}
			}
		}
	}
}

##################################################
# Gurgling & Grasping
# by Ewan Cowhig Croft
# 0521 - 0530
##################################################

scripted_trigger harm_0521_has_waterside_capital_trigger = {
	location = {
		OR = {
			is_sea_province = yes
			# Now we check for county so that your capital barony doesn't have to be literally _on_ the sea.
			county ?= {
				OR = {
					is_coastal_county = yes
					is_riverside_county = yes
				}
			}
		}
	}
}

scripted_trigger harm_0521_cultural_tradition_encourages_swimming_trigger = {
	culture = {
		OR = {
			has_cultural_parameter = next_level_trade_ports
			has_cultural_parameter = maritime_mercantilism_coastal_holdings
			has_cultural_parameter = trade_ports_stationed_maa_bonus
			has_cultural_parameter = trade_ports_enabled_for_tribals
			has_cultural_parameter = coastal_holdings_give_defensive_bonus
			has_cultural_parameter = trade_ports_give_control_growth
			has_cultural_parameter = trade_ports_give_levies
		}
	}
}

#	Whilst at sea, you fall overboard and drown long enough to endanger your brain.
harm.0521 = {
	type = character_event
	title = harm.0521.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					location = { is_sea_province = yes }
				}
				desc = harm.0521.desc.sea
			}
			triggered_desc = {
				trigger = {
					location.county = { is_riverside_county = yes }
				}
				desc = harm.0521.desc.river
			}
			desc = harm.0521.desc.coastal
		}
		desc = harm.0521.desc.outro
	}
	theme = physical_health
	left_portrait = {
		character = root
		animation = fear
	}
	override_background = { reference = fp1_ocean }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0521 }
		has_character_flag = had_event_harm_0522
		# Do we have an opportunity to drown?
		harm_0521_has_waterside_capital_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
	}

	immediate = {
		# We don't want to see this event twice.
		add_character_flag = had_event_harm_0521
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
	}

	# A rope, a net, a plank, something!
	option = {
		name = harm.0521.a

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0521.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0521.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0521.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0521.a.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# Break for the surface!
	option = {
		name = harm.0521.b
		trigger = {
			OR = {
				# Strong swimmers.
				has_trait = athletic
				# Not their first time falling overboard.
				AND = {
					has_trait = viking
					can_raid_across_water_trigger = yes
				}
				# Has some cultural affinity for the water.
				harm_0521_cultural_tradition_encourages_swimming_trigger = yes
			}
		}
		trait = athletic
		trait = viking
		if = {
			limit = { harm_0521_cultural_tradition_encourages_swimming_trigger = yes }
			custom_tooltip = harm.0521.b.tt.unlocked_by_cultrad
		}

		custom_tooltip = harm.0000.tt.no_permanent_damage

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Swim, #EMP swim#!!
	option = {
		name = harm.0521.c
		trigger = { prowess >= @random_harm_standard_skill_check_value }
		skill = prowess

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.0521.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0521.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.0521.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0521.c.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		# Always gain stress from skill tests.
		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.0522 = {
	type = character_event
	title = harm.0522.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					location = { is_sea_province = yes }
				}
				desc = harm.0522.desc.sea
			}
			triggered_desc = {
				trigger = {
					location.county = { is_riverside_county = yes }
				}
				desc = harm.0522.desc.river
			}
			desc = harm.0522.desc.coastal
		}
		desc = harm.0522.desc.outro
	}
	theme = physical_health
	left_portrait = {
		character = root
		animation = admiration
	}
	override_background = { reference = fp1_ocean }

	trigger = {
		# Standard checks.
		is_available_adult_or_is_commanding = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0522 }
		# Do we have an opportunity to drown?
		harm_0521_has_waterside_capital_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_0522
	}

	# The water is almost hypnotic...
	option = {
		name = harm.0522.a

		# Foreshadow.
		custom_tooltip = harm.0522.a.tt

		stress_impact = { base = medium_stress_impact_loss }
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.0521
					years = { 2 4 }
				}
			}
		}
	}
}

##################################################
# The World Slipping
# by Ewan Cowhig Croft
# 0531 - 0540
##################################################

#	Struck down by a stroke.
harm.0531 = {
	type = character_event
	title = harm.0531.t
	desc = harm.0531.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = pain
	}
	lower_right_portrait = scope:medic
	override_background = { reference = sitting_room }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Medicine checks.
		character_can_easily_self_treat_trigger = no
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0531 }
		has_character_flag = had_event_harm_0532
		# Are you at a health risk?
		OR = {
			# Due to blood pressure...
			potential_victim_of_apoplexy_trigger = yes
			# ... or just age.
			age_ranked_health_vulnerability_threshold_trigger = yes
		}
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			potential_victim_of_apoplexy_trigger = yes
		}
	}

	immediate = {
		# We don't want to see this event twice.
		add_character_flag = had_event_harm_0531
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
		# Try to grab our court physician.
		harm_0000_grab_available_court_physician_effect = { PERSONAL_SKILL = learning }
	}

	# My mind is... on #EMP fire#!...
	option = {
		name = harm.0531.a

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0531.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0531.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0531.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0531.a.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# I know myself, and this will pass.
	option = {
		name = harm.0531.b
		trigger = { has_trait = whole_of_body }
		trait = whole_of_body

		custom_tooltip = harm.0000.tt.no_permanent_damage

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Call for your physic.
	option = {
		name = harm.0000.tt.physician
		trigger = {
			exists = scope:medic
			scope:medic.learning >= @court_medic_able_to_help_value
		}
		show_as_unavailable = { scope:medic.learning < @court_medic_able_to_help_value }

		# Random roll & stress handled in this effect.
		harm_0000_physic_rescue_chance_incapable_effect = yes

		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 10
		}
	}

	# HealthGodName, give me strength.
	option = {
		name = harm.0531.c
		trigger = { learning >= @random_harm_standard_skill_check_value }
		skill = learning

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.0531.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0531.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.0531.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0531.c.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		# Always gain stress from skill tests.
		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.0532 = {
	type = character_event
	title = harm.0532.t
	desc = harm.0532.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = stress
	}
	override_background = { reference = sitting_room }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0532 }
		# Are you at a health risk?
		OR = {
			# Due to blood pressure...
			potential_victim_of_apoplexy_trigger = yes
			# ... or just age.
			age_ranked_health_vulnerability_threshold_trigger = yes
		}
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			potential_victim_of_apoplexy_trigger = yes
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_0532
	}

	# These infernal headaches, will they never cease?
	option = {
		name = harm.0532.a

		# Foreshadow.
		custom_tooltip = harm.0532.a.tt

		stress_impact = { base = medium_stress_impact_gain }
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.0531
					years = { 2 4 }
				}
			}
		}
	}
}

##################################################
# Chilled to the Bones
# by Ewan Cowhig Croft
# 0541 - 0550
##################################################

# Is the winter here bad enough to hurt someone of your age?
scripted_trigger harm_0541_bad_winter_trigger = {
	OR = {
		AND = {
			OR = {
				# Adults.
				age >= 55
				# Young children.
				child_not_teen_trigger = yes
			}
			location = { has_province_modifier = winter_harsh_modifier }
		}
		AND = {
			OR = {
				# Adults.
				age >= 65
				# Very young children.
				child_is_infant_trigger = yes
			}
			location = { has_province_modifier = winter_normal_modifier }
		}
	}
	# Now check our health.
	trigger_if = {
		limit = { is_adult = yes }
		age_ranked_health_vulnerability_threshold_trigger = yes
	}
	trigger_else = { health <= medium_health }
}

# Are you paying enough in court amenity costs to have people who'd notice and help whilst there's still time?
scripted_trigger harm_0541_saved_by_court_amenities_trigger = {
	has_royal_court = yes
	# We'll take either lodgings or servants.
	OR = {
		amenity_level = {
			target = court_lodging_standards
			value >= 3
		}
		amenity_level = {
			target = court_servants
			value >= 3
		}
	}
}

#	Crippling arthritis, chiefly in colder regions, can hurt the elderly whilst the young freeze to death.
harm.0541 = {
	type = character_event
	title = harm.0541.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { child_is_infant_trigger = yes }
				desc = harm.0541.desc.baby
			}
			desc = harm.0541.desc.fallback
		}
	}
	theme = physical_health
	left_portrait = {
		character = root
		animation = pain
		outfit_tags = { nightgown }
	}
	override_background = { reference = bedchamber }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0541 }
		## Exemption here so that babies can still freeze to death every now and then.
		OR = {
			has_character_flag = had_event_harm_0542
			child_is_infant_trigger = yes
		}
		# Check winter + age stuff.
		harm_0541_bad_winter_trigger = yes
		# Lastly, are you paying other people to deal with this who should notice?
		harm_0541_saved_by_court_amenities_trigger = no
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# If your body is poorly set up, then you're more accutely vulnerable.
		modifier = {
			add = 0.25
			has_weak_physical_health_traits_trigger = yes
		}
	}

	immediate = {
		# We don't want to see this event twice.
		add_character_flag = had_event_harm_0541
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
	}

	# ...
	option = {
		name = harm.0541.a

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0541.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0541.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0541.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0541.a.tt.failure
					left_icon = root
					# Infants are at extra risk.
					if = {
						limit = { child_is_infant_trigger = yes }
						death = { death_reason = death_froze }
						log_harm_event_death_as_variable_effect = yes
					}
					# Though everyone else isn't having a _great_ time.
					else = {
						upgrade_infirm_to_incapable_effect = yes
						create_character_memory = { type = became_incapable_generic }
					}
				}
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# I've faced worse than this.
	option = {
		name = harm.0541.b
		trigger = {
			OR = {
				has_trait = winter_soldier
				has_trait = stubborn
			}
		}
		trait = winter_soldier
		trait = stubborn

		custom_tooltip = harm.0000.tt.no_permanent_damage

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# I will not be laid low by #EMP frost#!!
	option = {
		name = harm.0541.c
		trigger = { prowess >= @random_harm_standard_skill_check_value }
		skill = prowess

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.0541.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0541.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.0541.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0541.c.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		# Always gain stress from skill tests.
		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.0542 = {
	type = character_event
	title = harm.0542.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { child_is_infant_trigger = yes }
				desc = harm.0542.desc.baby
			}
			desc = harm.0542.desc.fallback
		}
	}
	theme = physical_health
	left_portrait = {
		character = root
		animation = stress
		outfit_tags = { nightgown }
	}
	override_background = { reference = bedchamber }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0542 }
		# Check winter + age stuff.
		harm_0541_bad_winter_trigger = yes
		# Lastly, are you paying other people to deal with this who should notice?
		harm_0541_saved_by_court_amenities_trigger = no
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# If your body is poorly set up, then you're more accutely vulnerable.
		modifier = {
			add = 0.25
			has_weak_physical_health_traits_trigger = yes
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_0542
	}

	# I so wish it were warmer...
	option = {
		name = harm.0542.a

		# Foreshadow.
		custom_tooltip = harm.0542.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.0541
					years = { 2 4 }
				}
			}
		}
	}
}

##################################################
# A Thud & A Snap
# by Ewan Cowhig Croft
# 0551 - 0560
##################################################

scripted_trigger harm_0551_child_might_be_outside_trigger = {
	# Must have sufficient health that they're outside.
	health >= medium_health
	has_short_disease_trigger = no
	NOT = { has_trait_with_flag = debilitating_illness }
}

scripted_trigger harm_0551_child_location_has_trees_trigger = {
	location = {
		OR = {
			terrain = drylands
			terrain = farmlands
			terrain = floodplains
			terrain = forest
			terrain = hills
			terrain = jungle
			terrain = mountains
			terrain = oasis
			terrain = plains
			terrain = taiga
			terrain = wetlands
		}
	}
}

#	A child falls from a tree.
harm.0551 = {
	type = character_event
	title = harm.0551.t
	desc = harm.0551.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = fear
	}
	override_background = { reference = wilderness }

	trigger = {
		# Standard checks.
		is_available = yes
		child_not_infant_trigger = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0551 }
		has_character_flag = had_event_harm_0552
		# Do we have trees to climb?
		harm_0551_child_location_has_trees_trigger = yes
		# Would this child actually attempt this?
		harm_0551_child_might_be_outside_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			OR = {
				has_trait = rowdy
				has_trait = brave
			}
		}
	}

	immediate = {
		# We don't want to see this event twice.
		add_character_flag = had_event_harm_0551
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
	}

	# Just... gotta be careful...
	option = {
		name = harm.0551.a

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0551.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0551.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0551.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0551.a.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# Help. Help! HELP!
	option = {
		name = harm.0551.b
		trigger = {
			OR = {
				has_trait = craven
				has_trait = pensive
			}
		}
		trait = craven
		trait = pensive

		custom_tooltip = harm.0000.tt.no_permanent_damage

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# How hard can it be?
	option = {
		name = harm.0551.c
		trigger = { prowess >= @random_harm_easy_skill_check_value }
		skill = prowess

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.0551.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0551.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.0551.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0551.c.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		# Always gain stress from skill tests.
		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.0552 = {
	type = character_event
	title = harm.0552.t
	desc = harm.0552.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = happiness
	}
	override_background = { reference = wilderness }

	trigger = {
		# Standard checks.
		is_available = yes
		child_not_infant_trigger = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0552 }
		# Do we have trees to climb?
		harm_0551_child_location_has_trees_trigger = yes
		# Would this child actually attempt this?
		harm_0551_child_might_be_outside_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			OR = {
				has_trait = rowdy
				has_trait = brave
			}
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_0552
	}

	# What fun!
	option = {
		name = harm.0552.a

		# Foreshadow.
		custom_tooltip = harm.0552.a.tt

		stress_impact = { base = medium_stress_impact_loss }
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.0551
					years = { 2 4 }
				}
			}
		}
	}
}

##################################################
# The Descent
# by Ewan Cowhig Croft
# 0561 - 0570
##################################################

#	An old person falls down some stairs.
harm.0561 = {
	type = character_event
	title = harm.0561.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { has_government = landless_adventurer_government }
				desc = harm.0561.desc_adventurer
			}
			desc = harm.0561.desc
		}
	}
	theme = physical_health
	left_portrait = {
		character = root
		animation = fear
	}
	override_background = { reference = corridor_day }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0561 }
		has_character_flag = had_event_harm_0562
		# Health checks.
		age_ranked_health_vulnerability_threshold_trigger = yes
		# Do you have lots of stairs to walk down?
		location_has_multi_story_buildings_trigger = { LOCATION = root.location }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
	}

	immediate = {
		# We don't want to see this event twice.
		add_character_flag = had_event_harm_0561
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
	}

	# Oh — wait — NOO-
	option = {
		name = harm.0561.a

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0561.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0561.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0561.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0561.a.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# One foot in front of the other, stay calm.
	option = {
		name = harm.0561.b
		trigger = {
			OR = {
				has_trait = diligent
				has_trait = patient
			}
		}
		trait = diligent
		trait = patient

		custom_tooltip = harm.0000.tt.no_permanent_damage

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# They're just #EMP stairs#!.
	option = {
		name = {
			trigger = { is_landless_adventurer = no }
			text = harm.0561.c
		}
		name = {
			trigger = { has_government = landless_adventurer_government }
			text = harm.0561.c.adventurer
		}
		trigger = { prowess >= @random_harm_standard_skill_check_value }
		skill = prowess

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.0561.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0561.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.0561.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0561.c.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		# Always gain stress from skill tests.
		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.0562 = {
	type = character_event
	title = harm.0562.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { has_government = landless_adventurer_government }
				desc = harm.0562.desc_adventurer
			}
			desc = harm.0562.desc
		}
	}
	theme = physical_health
	left_portrait = {
		character = root
		animation = worry
	}
	override_background = { reference = corridor_day }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0562 }
		# Health checks.
		age_ranked_health_vulnerability_threshold_trigger = yes
		# Do you have lots of stairs to walk down?
		location_has_multi_story_buildings_trigger = { LOCATION = root.location }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_0562
	}

	# Troubling.
	option = {
		name = harm.0562.a

		# Foreshadow.
		custom_tooltip = harm.0562.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.0561
					years = { 2 4 }
				}
			}
		}
	}
}

##################################################
# A Trip During Training
# by Ewan Cowhig Croft
# 0571 - 0580
##################################################

scripted_trigger harm_0571_suitable_sparring_partner_trigger = {
	prowess <= root.prowess
	calc_true_if = {
		amount >= 3
		# People who suck as knights are dangerous to fight with.
		prowess <= low_skill_rating
		# If you're quite skilled and they're quite bad, then their thinking is lateral enough to pose a bit of a risk.
		AND = {
			root.prowess >= very_high_skill_rating
			prowess <= mediocre_skill_rating
		}
		# Various traits make you less predictable or more furiously uncontrolled.
		has_trait = wrathful
		has_trait = deceitful
		has_trait = ambitious
		has_trait = arbitrary
		has_trait = cynical
		has_trait = callous
		has_trait = sadistic
		has_trait = stubborn
		has_trait = vengeful
		# Plus never rule out malice.
		opinion = {
			target = root
			value <= high_negative_opinion
		}
	}
}

#	A fighting ruler is whacked on the bonce whilst training.
harm.0571 = {
	type = character_event
	title = harm.0571.t
	desc = harm.0571.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		character = scope:sparring_partner
		animation = aggressive_sword
	}
	override_background = { reference = courtyard }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0571 }
		has_character_flag = had_event_harm_0572
		# Craven and lazy characters generally won't be in this situation.
		NOR = {
			has_trait = craven
			has_trait = lazy
		}
		# Must be expected to train.
		NOT = { has_trait = blind }
		can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
		# And you need someone who's over-eager.
		any_knight = { harm_0571_suitable_sparring_partner_trigger = yes }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = brave
		}
	}

	immediate = {
		# We don't want to see this event twice.
		add_character_flag = had_event_harm_0571
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
		# Is our last guy still valid?
		if = {
			limit = {
				OR = {
					NOT = { exists = scope:sparring_partner }
					scope:sparring_partner ?= { harm_0571_suitable_sparring_partner_trigger = no }
				}
			}
			# Ok, if they're not, grab a new one.
			ordered_knight = {
				limit = { harm_0571_suitable_sparring_partner_trigger = yes }
				# Get our worst knight.
				order_by = {
					value = prowess
					multiply = -1
				}
				save_scope_as = sparring_partner
			}
		}
	}

	# By TricksterGodName, you fool, that was my head!
	option = {
		name = harm.0571.a

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0571.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0571.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0571.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0571.a.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# Barely a scratch.
	option = {
		name = harm.0571.b
		trigger = { has_trait = stubborn }
		trait = stubborn

		custom_tooltip = harm.0000.tt.no_permanent_damage

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Breath — it could be worse.
	option = {
		name = harm.0571.c
		trigger = { prowess >= @random_harm_standard_skill_check_value }
		skill = prowess

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.0571.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0571.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.0571.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0571.c.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		# Always gain stress from skill tests.
		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.0572 = {
	type = character_event
	title = harm.0572.t
	desc = harm.0572.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = sword_yield_start
	}
	right_portrait = {
		character = scope:sparring_partner
		animation = aggressive_sword
	}
	override_background = { reference = courtyard }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0572 }
		# Craven and lazy characters generally won't be in this situation.
		NOR = {
			has_trait = craven
			has_trait = lazy
		}
		# Must be expected to train.
		NOT = { has_trait = blind }
		can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
		# And you need someone who's over-eager.
		any_knight = { harm_0571_suitable_sparring_partner_trigger = yes }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = brave
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_0572
		# Save a sparring partner.
		ordered_knight = {
			limit = { harm_0571_suitable_sparring_partner_trigger = yes }
			# Get our worst knight.
			order_by = {
				value = prowess
				multiply = -1
			}
			save_scope_as = sparring_partner
		}
	}

	# Be careful, you lout!
	option = {
		name = harm.0572.a

		# Foreshadow.
		custom_tooltip = harm.0572.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.0571
					years = { 2 4 }
				}
			}
		}
	}
}

##################################################
# Slippery when Wet
# by Ewan Cowhig Croft
# 0581 - 0590
##################################################

#	Slipping getting out of the tub.
harm.0581 = {
	type = character_event
	title = harm.0581.t
	desc = harm.0581.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = shock
	}
	override_background = { reference = relaxing_room }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0581 }
		has_character_flag = had_event_harm_0582
		# Medieval mores being what they were, some characters are just never going to have a private bath.
		NOT = { has_trait = gregarious }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Some characters are more likely to take baths.
		modifier = {
			add = 0.25
			OR = {
				has_trait = lazy
				has_perk = wash_your_hands_perk
				has_character_modifier = fp1_bathing_health_modifier
				has_character_modifier = fp1_bathing_attraction_modifier
			}
		}
	}

	immediate = {
		# We don't want to see this event twice.
		add_character_flag = had_event_harm_0581
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
		add_character_flag = {
			flag = is_naked
			days = 30
		}
	}

	# Wait, FateGodName, n—
	option = {
		name = harm.0581.a

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0581.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0581.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0581.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0581.a.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# Take it slow, take it safe.
	option = {
		name = harm.0581.b
		trigger = {
			OR = {
				has_trait = diligent
				has_trait = craven
				has_trait = patient
			}
		}
		trait = diligent
		trait = craven
		trait = patient

		custom_tooltip = harm.0000.tt.no_permanent_damage

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}
	after = {
		remove_character_flag = is_naked
	}
}

# Attached foreboding event.
harm.0582 = {
	type = character_event
	title = harm.0582.t
	desc = harm.0582.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = personality_bold
	}
	override_background = { reference = relaxing_room }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0582 }
		# Medieval mores being what they were, some characters are just never going to have a private bath.
		NOT = { has_trait = gregarious }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Some characters are more likely to take baths.
		modifier = {
			add = 0.25
			OR = {
				has_trait = lazy
				has_perk = wash_your_hands_perk
				has_character_modifier = fp1_bathing_health_modifier
				has_character_modifier = fp1_bathing_attraction_modifier
			}
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_0582
		add_character_flag = {
			flag = is_naked
			days = 30
		}
	}

	# I should be more careful, I suppose.
	option = {
		name = harm.0582.a

		# Foreshadow.
		custom_tooltip = harm.0582.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.0581
					years = { 2 4 }
				}
			}
		}
		remove_character_flag = is_naked
	}
}

##################################################
# Death from Above
# by Ewan Cowhig Croft
# 0591 - 0600
##################################################

scripted_trigger harm_0591_likely_to_go_to_town_trigger = {
	# Shy'n'lazy characters don't bother going out.
	NOR = {
		has_trait = shy
		has_trait = lazy
		# Humble characters _do_ go out, but the tone is narratively inconsistent for them, so we avoid it.
		has_trait = humble
	}
}

#	A peasant's falling pot leaves you incapable.
harm.0591 = {
	type = character_event
	title = harm.0591.t
	desc = harm.0591.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = jockey_walk
		camera = camera_event_horse_left
	}
	override_background = { reference = alley_day }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0591 }
		has_character_flag = had_event_harm_0592
		# Would they be out for this?
		harm_0591_likely_to_go_to_town_trigger = yes
		# Town
		location = {
			OR = {
				has_holding_type = city_holding
				has_holding_type = castle_holding
				has_holding_type = church_holding
			}
		}
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = gregarious
		}
	}

	immediate = {
		# We don't want to see this event twice.
		add_character_flag = had_event_harm_0591
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
	}

	# Throw yourself to the side.
	option = {
		name = harm.0591.a

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0591.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0591.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0591.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0591.a.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# #EMP Am I never safe?!!#!
	option = {
		name = harm.0591.b
		flavor = harm.0591.b.tt
		trigger = {
			OR = {
				has_trait = craven
				has_trait = paranoid
			}
		}
		trait = craven
		trait = paranoid

		custom_tooltip = harm.0000.tt.no_permanent_damage

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
			# Paranoid characters get reduced stress loss so that they don't get nuts just for taking their opt-out.
			paranoid = major_stress_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# I'm already moving.
	option = {
		name = harm.0591.c
		trigger = { intrigue >= @random_harm_standard_skill_check_value }
		skill = intrigue

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.0591.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0591.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.0591.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0591.c.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		# Always gain stress from skill tests.
		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.0592 = {
	type = character_event
	title = harm.0592.t
	desc = harm.0592.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = jockey_idle
		camera = camera_event_horse_left
	}
	override_background = { reference = alley_day }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0592 }
		# Would they be out for this?
		harm_0591_likely_to_go_to_town_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = gregarious
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_0592
	}

	# These #EMP peasants#!.
	option = {
		name = harm.0592.a

		# Foreshadow.
		custom_tooltip = harm.0592.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.0591
					years = { 2 4 }
				}
			}
		}
	}
}

##################################################
# What's the Harm?
# by Ewan Cowhig Croft
# 0601 - 0610
##################################################

scripted_trigger harm_0601_valid_playmate_trigger = {
	is_available = yes
	child_not_infant_trigger = yes
	# Must be within certain bounds.
	## Not too young.
	age >= {
		value = root.age
		add = -5
	}
	## Not too old.
	age <= {
		value = root.age
		add = 5
	}
	NOR = {
		has_trait = pensive
		has_trait = craven
		has_trait = compassionate
	}
	opinion = {
		target = root
		value >= 1
	}
}

scripted_effect harm_0601_grab_valid_playmate_effect = {
	random_courtier = {
		limit = {
			harm_0601_valid_playmate_trigger = yes
			OR = {
				has_trait = callous
				has_trait = sadistic
				has_trait = wrathful
			}
		}
		alternative_limit = {
			harm_0601_valid_playmate_trigger = yes
			has_trait = rowdy
		}
		alternative_limit = { harm_0601_valid_playmate_trigger = yes }
		save_scope_as = playmate
	}
}

#	Children playing goes horribly wrong.
harm.0601 = {
	type = character_event
	title = harm.0601.t
	desc = harm.0601.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = pain
	}
	right_portrait = {
		character = scope:playmate
		animation = fear
	}
	override_background = { reference = corridor_day }

	trigger = {
		# Standard checks.
		is_available = yes
		child_not_infant_trigger = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0601 }
		has_character_flag = had_event_harm_0602
		# Some traits stop this happening.
		NOR = {
			# Craven children give up earlier and are thus safe.
			has_trait = craven
			# Paranoid children fear some trick earlier, and are thus also safe.
			has_trait = paranoid
		}
		# And someone to play rough with.
		any_courtier = { harm_0601_valid_playmate_trigger = yes }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			OR = {
				has_trait = rowdy
				has_trait = brave
			}
		}
	}

	immediate = {
		# We don't want to see this event twice.
		add_character_flag = had_event_harm_0601
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
		# Pick a new playmate if our old one isn't valid.
		if = {
			limit = {
				OR = {
					NOT = { exists = scope:playmate }
					scope:playmate ?= { harm_0601_valid_playmate_trigger = no }
				}
			}
			harm_0601_grab_valid_playmate_effect = yes
		}
	}

	# I... don't feel so good...
	option = {
		name = harm.0601.a

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0601.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0601.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0601.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0601.a.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}
}

# Attached foreboding event.
harm.0602 = {
	type = character_event
	title = harm.0602.t
	desc = harm.0602.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = admiration
	}
	right_portrait = {
		character = scope:playmate
		animation = happiness
	}
	override_background = { reference = corridor_day }

	trigger = {
		# Standard checks.
		is_available = yes
		child_not_infant_trigger = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0602 }
		# Some traits stop this happening.
		NOR = {
			# Craven children give up earlier and are thus safe.
			has_trait = craven
			# Paranoid children fear some trick earlier, and are thus also safe.
			has_trait = paranoid
		}
		# And someone to play rough with.
		any_courtier = { harm_0601_valid_playmate_trigger = yes }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			OR = {
				has_trait = rowdy
				has_trait = brave
			}
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_0602
		# Grab a playmate.
		harm_0601_grab_valid_playmate_effect = yes
	}

	# This is a great idea!
	option = {
		name = harm.0602.a

		# Foreshadow.
		custom_tooltip = harm.0602.a.tt
		# If relevant, let's set up a potential friendship.
		if = {
			limit = {
				can_set_relation_potential_friend_trigger = { CHARACTER = scope:playmate }
			}
			set_relation_potential_friend = scope:playmate
		}

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.0601
					years = { 2 4 }
				}
			}
		}
	}
}

##################################################
# Dizzying Heights
# by Ewan Cowhig Croft
# 0611 - 0620
##################################################

#	As a cripplingly feeble character, stand up way, way too fast.
##	The term is orthostatic hypotension, and yes, if you're in poor health, it can and will absolutely killed you.
harm.0611 = {
	type = character_event
	title = harm.0611.t
	desc = {
		desc = harm.0611.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { has_trait = blind }
				desc = harm.0611.desc.blind
			}
			desc = harm.0611.desc.fallback
		}
	}
	theme = physical_health
	left_portrait = {
		character = root
		animation = fear
	}
	lower_right_portrait = scope:medic
	override_background = { reference = sitting_room }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0611 }
		has_character_flag = had_event_harm_0612
		# Does this type of thing pose a danger to you?
		OR = {
			has_weak_physical_health_traits_trigger = yes
			age_ranked_health_vulnerability_threshold_trigger = yes
		}
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
	}

	immediate = {
		# We don't want to see this event twice.
		add_character_flag = had_event_harm_0611
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
		# Try to grab our court physician.
		harm_0000_grab_available_court_physician_effect = { PERSONAL_SKILL = learning }
	}

	# Wait.. wha... my...
	option = {
		name = harm.0611.a

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0611.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0611.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0611.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0611.a.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# Grit your teeth against the rush.
	option = {
		name = harm.0611.b
		trigger = { has_trait = whole_of_body }
		trait = whole_of_body

		custom_tooltip = harm.0000.tt.no_permanent_damage

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Call for your physic.
	option = {
		name = harm.0000.tt.physician
		trigger = {
			exists = scope:medic
			scope:medic.learning >= @court_medic_able_to_help_value
		}
		show_as_unavailable = { scope:medic.learning < @court_medic_able_to_help_value }

		# Random roll & stress handled in this effect.
		harm_0000_physic_rescue_chance_incapable_effect = yes

		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 10
		}
	}

	# Focus. Clarity. #EMP Focus#!.
	option = {
		name = harm.0611.c
		trigger = { learning >= @random_harm_standard_skill_check_value }
		skill = learning

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.0611.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0611.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.0611.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0611.c.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		# Always gain stress from skill tests.
		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.0612 = {
	type = character_event
	title = harm.0612.t
	desc = harm.0612.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = worry
	}
	override_background = { reference = sitting_room }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Medicine checks.
		character_can_easily_self_treat_trigger = no
		NOT = { has_character_flag = had_event_harm_0612 }
		# Does this type of thing pose a danger to you?
		OR = {
			has_weak_physical_health_traits_trigger = yes
			age_ranked_health_vulnerability_threshold_trigger = yes
		}
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_0612
	}

	# I'm still dizzy.
	option = {
		name = harm.0612.a

		# Foreshadow.
		custom_tooltip = harm.0612.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.0611
					years = { 2 4 }
				}
			}
		}
	}
}

##################################################
# A Jolly Good Time
# by Ewan Cowhig Croft
# 0621 - 0630
##################################################

scripted_trigger harm_0621_alcohol_problem_trigger = {
	OR = {
		has_trait = drunkard
		AND = {
			has_trait_xp = {
				trait = lifestyle_reveler
				value >= 50
			}
			drinks_alcohol_trigger = yes
		}
	}
}

scripted_trigger harm_0621_social_drinker_trigger = {
	NOR = {
		has_trait = shy
		has_trait = reclusive
	}
}

#	Drunken shenanigans.
harm.0621 = {
	type = character_event
	title = harm.0621.t
	desc = harm.0621.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = fear
	}
	override_background = {
		trigger = { harm_0621_social_drinker_trigger = yes }
		reference = tavern
	}
	override_background = {
		trigger = { harm_0621_social_drinker_trigger = no }
		reference = bedchamber
	}

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0621 }
		has_character_flag = had_event_harm_0622
		# Must have something of an alcohol problem.
		harm_0621_alcohol_problem_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
	}

	immediate = {
		# We don't want to see this event twice.
		add_character_flag = had_event_harm_0621
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
	}

	# *HIC*... *hic*... ...
	option = {
		name = harm.0621.a

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0621.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0621.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0621.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0621.a.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# Hehe, guess I'm gonna feel that in the morning.
	option = {
		name = harm.0621.b
		trigger = {
			OR = {
				has_trait = stubborn
				has_trait = gregarious
			}
		}
		trait = stubborn
		trait = gregarious

		custom_tooltip = harm.0000.tt.no_permanent_damage

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Ooph, my head. That was a bad one, eh?
	option = {
		name = harm.0621.c
		trigger = { diplomacy >= @random_harm_standard_skill_check_value }
		skill = diplomacy

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.0621.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0621.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.0621.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0621.c.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		# Always gain stress from skill tests.
		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.0622 = {
	type = character_event
	title = harm.0622.t
	desc = harm.0622.desc
	theme = physical_health
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				NOR = {
					location.culture ?= { has_graphical_india_culture_group_trigger = yes }
					location.culture ?= { has_graphical_mena_culture_group_trigger = yes }
					location.culture ?= { has_building_gfx = iranian_building_gfx }
					location.culture ?= { has_graphical_african_culture_group_trigger = yes }
					location.culture ?= { has_graphical_steppe_culture_group_trigger = yes }
				}
				harm_0621_social_drinker_trigger = yes
			}
			animation = drink
		}
		animation = drink_goblet
	}
	override_background = {
		trigger = { harm_0621_social_drinker_trigger = yes }
		reference = tavern
	}
	override_background = {
		trigger = { harm_0621_social_drinker_trigger = no }
		reference = bedchamber
	}

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0622 }
		# Must have some an alcohol problem.
		harm_0621_alcohol_problem_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_0622
	}

	# Life is good.
	option = {
		name = harm.0622.a

		# Foreshadow.
		custom_tooltip = harm.0622.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.0621
					years = { 2 4 }
				}
			}
		}
	}
}

##################################################
# A Rollicking Good Time
# by Ewan Cowhig Croft
# 0631 - 0640
##################################################

# A few people get auto-filtered immediately.
scripted_trigger harm_0631_bonk_pre_filter_enthusiasm_trigger = {
	NOR = {
		# Asexual characters can still enjoy sex but are less likely to be doing it enough to be in this situation.
		has_sexuality = asexual
		# Likewise for chaste characters.
		has_trait = chaste
		# Celibate characters aren't having sex _at all_.
		has_trait = celibate
		# Some characters are too obsessed with work.
		AND = {
			has_trait = ambitious
			has_trait = diligent
			OR = {
				AND = {
					is_ruler = yes
					stress_level >= 1
				}
				is_councillor = yes
				has_any_court_position = yes
			}
		}
		# Zealous characters might be religious compelled not to engage in sex for pleasure.
		AND = {
			has_trait = zealous
			faith = {
				OR = {
					trait_is_virtue = chaste
					trait_is_sin = lustful
					trait_is_sin = deviant
				}
			}
		}
		# Eunuchs omitted - they absolutely can still have sex.
		## Quite a lot of it, according to various sources, and depending on the method of castration, it could even still be penetrative.
	}
}

# Do you have a partner who might be able to ride you into the proverbial ground?
scripted_trigger harm_0631_bonk_partner_trigger = {
	location = root.location
	is_ai = yes
	# Filter out a few folks before we start.
	harm_0631_bonk_pre_filter_enthusiasm_trigger = yes
	# The sex has to be really rather vigorous to induce this in you.
	OR = {
		# Always give their all.
		has_trait = deviant
		has_trait = lustful
		has_relation_soulmate = root
		# Selfless lovers.
		AND = {
			has_trait = compassionate
			ai_energy >= very_high_positive_ai_value
		}
		# Selfish lovers but you're into it.
		AND = {
			OR = {
				has_trait = sadistic
				has_trait = callous
			}
			root = { has_trait = flagellant }
		}
		# Religious compulsion.
		AND = {
			faith = {
				OR = {
					trait_is_virtue = lustful
					trait_is_virtue = deviant
					trait_is_sin = chaste
				}
			}
			has_trait = zealous
		}
		# Last but by no means least, dramatically different relative ages!
		age <= root.vigorous_sex_age_difference_value
	}
	# Either you've got a fantastic connection or you've got an. Ahem. Positively-manifesting negative feedback loop.
	OR = {
		# Loves you.
		opinion = {
			target = root
			value >= very_high_positive_opinion
		}
		# Hates you.
		opinion = {
			target = root
			value <= very_high_negative_opinion
		}
	}
}

# Would we be engaging in enthusiastic sex on the regular?
scripted_trigger harm_0631_bonk_enthusiast_trigger = {
	# Knock out some folks.
	harm_0631_bonk_pre_filter_enthusiasm_trigger = yes
	# And you've got to enjoy/prioritise a healthy sex life.
	OR = {
		# If your health is low enough, this can happen at any time.
		AND = {
			age <= 49
			health <= medium_health
			OR = {
				# Naturally.
				has_trait = deviant
				has_trait = lustful
				# When you've got plenty of time on your hands...
				has_trait = lazy
				has_trait = content
				# Hormones ablaze.
				AND = {
					is_adult = yes
					age <= 30
				}
				# Might suffer from heart conditions.
				potential_victim_of_apoplexy_trigger = yes
			}
		}
		# Otherwise, it's more of an age concern.
		age_ranked_health_vulnerability_threshold_trigger = yes
	}
	# Must have a sufficiently vigorous lover available.
	OR = {
		any_consort = { harm_0631_bonk_partner_trigger = yes }
		any_relation = {
			type = lover
			harm_0631_bonk_partner_trigger = yes
		}
	}
}

scripted_effect harm_grab_suitable_partner_effect = {
	every_consort = {
		limit = { harm_0631_bonk_partner_trigger = yes }
		add_to_list = bonkable_bartners
	}
	every_relation = {
		type = lover
		limit = { harm_0631_bonk_partner_trigger = yes }
		add_to_list = bonkable_bartners
	}
	random_in_list = {
		list = bonkable_bartners
		save_scope_as = bonker
	}
}

scripted_effect harm_0631_process_partner_stress_effect = {
	# Do they have any affection for you?
	if = {
		limit = {
			opinion = {
				target = root
				value >= 1
			}
		}
		# Cool, are they your soulmate?
		if = {
			limit = { has_relation_soulmate = root }
			# Yes we put in a manual number to make it larger than monumental.
			## This would probably destroy you as a person.
			add_stress = 250
		}
		# If not, apply some stress without going overboard.
		else = { add_stress = major_stress_gain }
	}
}

#	Heart attack whilst vigorously bonking.
harm.0631 = {
	type = character_event
	title = harm.0631.t
	desc = harm.0631.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		character = scope:bonker
		animation = shock
	}
	override_background = { reference = bedchamber }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0631 }
		has_character_flag = had_event_harm_0632
		# Check that we've got a partner who might cause us some strife.
		harm_0631_bonk_enthusiast_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = lustful
		}
	}

	immediate = {
		# We don't want to see this event twice.
		add_character_flag = had_event_harm_0631
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
		# Do we need a fresh bonk buddy or is the old one still good?
		if = {
			limit = {
				OR = {
					NOT = { exists = scope:bonker }
					scope:bonker ?= { harm_0631_bonk_enthusiast_trigger = no }
				}
			}
			harm_grab_suitable_partner_effect = yes
		}
		# And bonk away.
		had_sex_with_effect = {
			CHARACTER = scope:bonker
			PREGNANCY_CHANCE = pregnancy_chance
		}
		add_character_flag = {
			flag = is_naked
			days = 30
		}
		scope:bonker = {
			add_character_flag = {
				flag = is_naked
				days = 30
			}
		}
	}

	# Wait — I can't — my chest!
	option = {
		name = harm.0631.a

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0631.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0631.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0631.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0631.a.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
				# Plus your partner probably isn't happy.
				scope:bonker = { harm_0631_process_partner_stress_effect = yes }
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# N-no you don't, heart, not #EMP now#!...
	option = {
		name = harm.0631.b
		trigger = { has_trait = stubborn }
		trait = stubborn

		custom_tooltip = harm.0000.tt.no_permanent_damage

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# I just need to ride this out.
	## Ahem.
	option = {
		name = harm.0631.c
		trigger = { intrigue >= @random_harm_standard_skill_check_value }
		skill = intrigue

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.0631.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0631.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.0631.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0631.c.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
				# Plus your partner probably isn't happy.
				scope:bonker = { harm_0631_process_partner_stress_effect = yes }
			}
		}

		# Always gain stress from skill tests.
		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
	after = {
		remove_character_flag = is_naked
		scope:bonker = {
			remove_character_flag = is_naked
		}
	}
}

# Attached foreboding event.
harm.0632 = {
	type = character_event
	title = harm.0632.t
	desc = harm.0632.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = personality_bold
	}
	right_portrait = {
		character = scope:bonker
		animation = admiration
	}
	override_background = { reference = bedchamber }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0632 }
		# Check that we've got a partner who might cause us some strife.
		harm_0631_bonk_enthusiast_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = lustful
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_0632
		# Grab us a bonk-buddy.
		harm_grab_suitable_partner_effect = yes
		# And bonk away.
		had_sex_with_effect = {
			CHARACTER = scope:bonker
			PREGNANCY_CHANCE = pregnancy_chance
		}
		add_character_flag = is_naked
		scope:bonker = {
			add_character_flag = is_naked
		}
	}

	# Scope:lover makes me feel so #EMP alive#!.
	option = {
		name = harm.0632.a

		# Foreshadow.
		custom_tooltip = harm.0632.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.0631
					years = { 2 4 }
				}
			}
		}
		remove_character_flag = is_naked
		scope:bonker = {
			remove_character_flag = is_naked
		}
	}
}

##################################################
# Some Slight Swelling
# by Ewan Cowhig Croft
# 0641 - 0650
##################################################

scripted_trigger harm_0641_saved_by_court_amenities_trigger = {
	has_royal_court = yes
	# Good food'll keep you out of this.
	amenity_level = {
		target = court_food_quality
		value >= 3
	}
}

#	Dropsy renders you bed-ridden.
harm.0641 = {
	type = character_event
	title = harm.0641.t
	desc = harm.0641.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = pain
	}
	lower_right_portrait = scope:medic
	override_background = { reference = bedchamber }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Medicine checks.
		character_can_easily_self_treat_trigger = no
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0641 }
		has_character_flag = had_event_harm_0642
		# Some characters just won't have this problem.
		NOR = {
			has_trait = gluttonous
			has_trait = comfort_eater
		}
		# Make sure we wouldn't be saved by our court amenities.
		harm_0641_saved_by_court_amenities_trigger = no
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			OR = {
				has_trait = temperate
				has_trait = inappetetic
			}
		}
	}

	immediate = {
		# We don't want to see this event twice.
		add_character_flag = had_event_harm_0641
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
		# Try to grab our court physician.
		harm_0000_grab_available_court_physician_effect = { PERSONAL_SKILL = learning }
	}

	# What is... wrong with me...
	option = {
		name = harm.0641.a

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.0641.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0641.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.0641.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0641.a.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# This will pass.
	option = {
		name = harm.0641.b
		trigger = { has_trait = whole_of_body }
		trait = whole_of_body

		custom_tooltip = harm.0000.tt.no_permanent_damage

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Call for your physic.
	option = {
		name = harm.0000.tt.physician
		trigger = {
			exists = scope:medic
			scope:medic.learning >= @court_medic_able_to_help_value
		}
		show_as_unavailable = { scope:medic.learning < @court_medic_able_to_help_value }

		# Random roll & stress handled in this effect.
		harm_0000_physic_rescue_chance_incapable_effect = yes

		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 10
		}
	}

	# Surely this must be treatable?
	option = {
		name = harm.0641.c
		trigger = { learning >= @random_harm_standard_skill_check_value }
		skill = learning

		random_list = {
			# You aren't permanently hurt.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.0641.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.0641.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.no_permanent_damage
				}
			}
			# The experience leaves you feeble.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.0641.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.0641.c.tt.failure
					left_icon = root
					upgrade_infirm_to_incapable_effect = yes
					create_character_memory = { type = became_incapable_generic }
				}
			}
		}

		# Always gain stress from skill tests.
		stress_impact = {
			base = medium_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.0642 = {
	type = character_event
	title = harm.0642.t
	desc = harm.0642.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = worry
	}
	override_background = { reference = bedchamber }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_0642 }
		# Some characters just won't have this problem.
		NOR = {
			has_trait = gluttonous
			has_trait = comfort_eater
		}
		# Make sure we wouldn't be saved by our court amenities.
		harm_0641_saved_by_court_amenities_trigger = no
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			OR = {
				has_trait = temperate
				has_trait = inappetetic
			}
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_0642
	}

	# Aggh, that's a little tender.
	option = {
		name = harm.0642.a

		# Foreshadow.
		custom_tooltip = harm.0642.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.0641
					years = { 2 4 }
				}
			}
		}
	}
}











##################################################
# RANDOM DEATH EVENTS

##################################################
# Choke On It
# by Ewan Cowhig Croft
# 1001 - 1010
##################################################

#	Choking at a feast.
harm.1001 = {
	type = character_event
	title = harm.1001.t
	desc = harm.1001.desc
	theme = skull
	left_portrait = {
		character = root
		animation = poison
	}
	override_background = { reference = feast }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1001 }
		has_character_flag = had_event_harm_1002
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = gluttonous
		}
	}

	immediate = {
		# Flag this event so the same character can't get it again.
		add_character_flag = had_event_harm_1001
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
	}

	# Try to cough it out.
	option = {
		name = harm.1001.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.1001.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1001.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.1001.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1001.a.tt.failure
					left_icon = root
					death = { death_reason = death_choked }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# Calm, breath.
	option = {
		name = harm.1001.b
		trigger = { has_trait = temperate }
		trait = temperate

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Thump at your chest and lungs.
	option = {
		name = harm.1001.c
		trigger = { prowess >= @random_harm_standard_skill_check_value }
		skill = prowess

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.1001.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1001.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.1001.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1001.c.tt.failure
					left_icon = root
					death = { death_reason = death_choked }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.1002 = {
	type = character_event
	title = harm.1002.t
	desc = harm.1002.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = personality_greedy
	}
	override_background = { reference = feast }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1002 }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = gluttonous
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_1002
	}

	# I'm really enjoying food lately.
	option = {
		name = harm.1002.a

		# Foreshadow.
		custom_tooltip = harm.1002.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.1001
					years = { 3 8 }
				}
			}
		}
	}
}

##################################################
# Ride or Die
# by Ewan Cowhig Croft
# 1011 - 1020
##################################################

#	Something spooks your horse and it goes flying out of control.
harm.1011 = {
	type = character_event
	title = harm.1011.t
	desc = harm.1011.desc
	theme = skull
	left_portrait = {
		character = root
		animation = jockey_gallop
		camera = camera_event_horse_left
	}
	override_background = { reference = wilderness }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1011 }
		has_character_flag = had_event_harm_1012
		harm_0511_rides_horses_trigger = yes
		# Some characters will never go riding for pleasure.
		NOT = { has_trait = lazy }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = diligent
		}
	}

	immediate = {
		# Flag this event so the same character can't get it again.
		add_character_flag = had_event_harm_1011
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
	}

	# Hang on for dear life.
	option = {
		name = harm.1011.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.1011.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1011.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.1011.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1011.a.tt.failure
					left_icon = root
					death = { death_reason = death_horse_riding_accident }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# Head down, cling hard.
	option = {
		name = harm.1011.b
		trigger = {
			OR = {
				has_trait = craven
				has_trait_xp = {
					trait = tourney_participant
					track = horse
					value >= 75
				}
				has_trait_xp = {
					trait = lifestyle_hunter
					track = hunter
					value >= 75
				}
			}
		}
		trait = craven
		trait = tourney_participant
		trait = lifestyle_hunter

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# This isn't your first spooked horse.
	option = {
		name = harm.1011.c
		trigger = { martial >= @random_harm_standard_skill_check_value }
		skill = martial

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.1011.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1011.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.1011.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1011.c.tt.failure
					left_icon = root
					death = { death_reason = death_horse_riding_accident }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.1012 = {
	type = character_event
	title = harm.1012.t
	desc = harm.1012.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = jockey_idle
		camera = camera_event_horse_left
	}
	override_background = { reference = wilderness }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1012 }
		harm_0511_rides_horses_trigger = yes
		# Some characters will never go riding for pleasure.
		NOT = { has_trait = lazy }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = diligent
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_1012
	}

	# Whoah there, girl, calm down...
	option = {
		name = harm.1012.a

		# Foreshadow.
		custom_tooltip = harm.1012.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.1011
					years = { 3 8 }
				}
			}
		}
	}
}

##################################################
# Finger-Licking Good
# by Ewan Cowhig Croft
# 1021 - 1030
##################################################

scripted_trigger harm_1021_saved_by_court_amenities_trigger = {
	trigger_if = {
		limit = { has_royal_court = yes }
		# Bad food'll keep you out of this.
		amenity_level = {
			target = court_food_quality
			# So if you _aren't_ paying for decent food, you have no worries of sudden stomach upsets because you're enjoying it so much.
			## Just a drab, dreary existence.
			value >= 3
		}
	}
}

#	Eating too much exotic food.
harm.1021 = {
	type = character_event
	title = harm.1021.t
	desc = harm.1021.desc
	theme = skull
	left_portrait = {
		character = root
		animation = poison
	}
	lower_right_portrait = scope:medic
	override_background = { reference = feast }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1021 }
		has_character_flag = had_event_harm_1022
		# Some characters can avoid this entirely.
		harm_1021_saved_by_court_amenities_trigger = yes
		NOT = { has_trait = inappetetic }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			OR = {
				has_trait = gluttonous
				has_trait = gout_ridden
			}
		}
	}

	immediate = {
		# Flag this event so the same character can't get it again.
		add_character_flag = had_event_harm_1021
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
		# Try to grab our court physician.
		harm_0000_grab_available_court_physician_effect = { PERSONAL_SKILL = stewardship }
	}

	# I... don't feel so good...
	option = {
		name = harm.1021.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.1021.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1021.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.1021.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1021.a.tt.failure
					left_icon = root
					death = { death_reason = death_tumultuous_guts }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# Bring me cool water — I need to lie down. Now.
	option = {
		name = harm.1021.b
		trigger = { has_trait = temperate }
		trait = temperate

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Call for your physic.
	option = {
		name = harm.0000.tt.physician
		trigger = {
			exists = scope:medic
			scope:medic.learning >= @court_medic_able_to_help_value
		}
		show_as_unavailable = { scope:medic.learning < @court_medic_able_to_help_value }

		# Random roll & stress handled in this effect.
		harm_0000_physic_rescue_chance_death_effect = { DEATH_REASON = death_tumultuous_guts }

		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 10
		}
	}

	# We must have some kind of medicine in stock for this!
	option = {
		name = harm.1021.c
		trigger = { stewardship >= @random_harm_standard_skill_check_value }
		skill = stewardship

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.1021.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1021.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.1021.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1021.c.tt.failure
					left_icon = root
					death = { death_reason = death_tumultuous_guts }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.1022 = {
	type = character_event
	title = harm.1022.t
	desc = harm.1022.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = worry
	}
	override_background = { reference = feast }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Medicine checks.
		character_can_easily_self_treat_trigger = no
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1022 }
		# Some characters can avoid this entirely.
		harm_1021_saved_by_court_amenities_trigger = yes
		NOT = { has_trait = inappetetic }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			OR = {
				has_trait = gluttonous
				has_trait = gout_ridden
			}
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_1022
	}

	# I'm glad that passed quickly.
	option = {
		name = harm.1022.a

		# Foreshadow.
		custom_tooltip = harm.1022.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.1021
					years = { 3 8 }
				}
			}
		}
	}
}

##################################################
# A Clogged Throat
# by Ewan Cowhig Croft
# 1031 - 1040
##################################################

#	Quinsy-induced choking.
harm.1031 = {
	type = character_event
	title = harm.1031.t
	desc = harm.1031.desc
	theme = skull
	left_portrait = {
		character = root
		animation = poison
	}
	lower_right_portrait = scope:medic
	override_background = { reference = bedchamber }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Medicine checks.
		character_can_easily_self_treat_trigger = no
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1031 }
		has_character_flag = had_event_harm_1032
		# Must be below a certain level of health to suffer from this.
		health <= medium_health
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = -0.75
			has_perk = wash_your_hands_perk
		}
	}

	immediate = {
		# Flag this event so the same character can't get it again.
		add_character_flag = had_event_harm_1031
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
		# Try to grab our court physician.
		harm_0000_grab_available_court_physician_effect = { PERSONAL_SKILL = learning }
	}

	# Can't... breath...
	option = {
		name = harm.1031.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.1031.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1031.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.1031.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1031.a.tt.failure
					left_icon = root
					death = { death_reason = death_choked_pus }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# I just need to control my breathing till I can find a physic.
	option = {
		name = harm.1031.b
		trigger = { has_trait = whole_of_body }
		trait = whole_of_body

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Call for your physic.
	option = {
		name = harm.0000.tt.physician
		trigger = {
			exists = scope:medic
			scope:medic.learning >= @court_medic_able_to_help_value
		}
		show_as_unavailable = { scope:medic.learning < @court_medic_able_to_help_value }

		# Random roll & stress handled in this effect.
		harm_0000_physic_rescue_chance_death_effect = { DEATH_REASON = death_choked_pus }

		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 10
		}
	}

	# Calm. Small breaths. To the physician.
	option = {
		name = harm.1031.c
		trigger = { learning >= @random_harm_standard_skill_check_value }
		skill = learning

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.1031.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1031.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.1031.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1031.c.tt.failure
					left_icon = root
					death = { death_reason = death_choked_pus }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.1032 = {
	type = character_event
	title = harm.1032.t
	desc = harm.1032.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = worry
	}
	override_background = { reference = bedchamber }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1032 }
		# Must be below a certain level of health to suffer from this.
		health <= medium_health
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = -0.75
			has_perk = wash_your_hands_perk
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_1032
	}

	# These things usually pass.
	option = {
		name = harm.1032.a

		# Foreshadow.
		custom_tooltip = harm.1032.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.1031
					years = { 3 8 }
				}
			}
		}
	}
}

##################################################
# Probably Safe
# by Ewan Cowhig Croft
# 1041 - 1050
##################################################

# Which characters wouldn't find themselves in this situation?
scripted_trigger harm_1041_characters_to_exclude_trigger = {
	NOR = {
		# Paranoid characters wouldn't be caught in this situation
		has_trait = paranoid
		# Whilst gregarious characters wouldn't be caught _alone_.
		has_trait = gregarious
		# Lazy characters don't like rides.
		has_trait = lazy
		# And blind characters, though capable of great independence, probably aren't going to dismiss their guards like this.
		has_trait = blind
	}
}

#	Fall into a body of water.
harm.1041 = {
	type = character_event
	title = harm.1041.t
	desc = harm.1041.desc
	theme = skull
	left_portrait = {
		character = root
		animation = fear
	}
	override_background = { reference = wilderness }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1041 }
		has_character_flag = had_event_harm_1042
		# Some characters wouldn't have this happen.
		harm_1041_characters_to_exclude_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			OR = {
				has_trait = brave
				has_trait = athletic
			}
		}
	}

	immediate = {
		# Flag this event so the same character can't get it again.
		add_character_flag = had_event_harm_1041
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
		add_character_flag = is_naked
	}

	# Try to come to your senses.
	option = {
		name = harm.1041.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.1041.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1041.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.1041.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1041.a.tt.failure
					left_icon = root
					death = { death_reason = death_drowned }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# Fight-or-flight selects _flight_.
	option = {
		name = harm.1041.b
		trigger = { has_trait = craven }
		trait = craven

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}
	after = {
		if = {
			limit = {
				is_alive = yes
			}
			remove_character_flag = is_naked
		}
	}
}

# Attached foreboding event.
harm.1042 = {
	type = character_event
	title = harm.1042.t
	desc = harm.1042.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = personality_bold
	}
	override_background = { reference = wilderness }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1042 }
		# Some characters wouldn't have this happen.
		harm_1041_characters_to_exclude_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			OR = {
				has_trait = brave
				has_trait = athletic
			}
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_1042
	}

	# A nice spot, this.
	option = {
		name = harm.1042.a

		# Foreshadow.
		custom_tooltip = harm.1042.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.1041
					years = { 3 8 }
				}
			}
		}
	}
}

##################################################
# Flickering Flames
# by Ewan Cowhig Croft
# 1051 - 1060
##################################################

#	A small fire gets out of hand.
harm.1051 = {
	type = character_event
	title = harm.1051.t
	desc = harm.1051.desc
	theme = skull
	left_portrait = {
		character = root
		animation = fear
		outfit_tags = { nightgown }
	}
	override_background = { reference = sitting_room }
	widget = {
		gui = "event_window_widget_vfx_conclusion_smoke"
		container = "background_shader_vfx_container"
	}

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1051 }
		has_character_flag = had_event_harm_1052
		# Paranoid & diligent characters wouldn't be caught in this situation.
		NOR = {
			has_trait = paranoid
			has_trait = diligent
		}
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = brave
		}
	}

	immediate = {
		# Flag this event so the same character can't get it again.
		add_character_flag = had_event_harm_1051
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
	}

	# The only way out is through!
	option = {
		name = harm.1051.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.1051.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1051.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.1051.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1051.a.tt.failure
					left_icon = root
					death = { death_reason = death_burned }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# That way, that's the fastest route out!
	option = {
		name = harm.1051.b
		trigger = { has_trait = craven }
		trait = craven

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}
}

# Attached foreboding event.
harm.1052 = {
	type = character_event
	title = harm.1052.t
	desc = harm.1052.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = worry
		outfit_tags = { nightgown }
	}
	override_background = { reference = sitting_room }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1052 }
		# Paranoid & diligent characters wouldn't be caught in this situation.
		NOR = {
			has_trait = paranoid
			has_trait = diligent
		}
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = brave
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_1052
	}

	# I must be more careful about these candles...
	option = {
		name = harm.1052.a

		# Foreshadow.
		custom_tooltip = harm.1052.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.1051
					years = { 3 8 }
				}
			}
		}
	}
}

##################################################
# A Moderate Tumble
# by Ewan Cowhig Croft
# 1061 - 1070
##################################################

# Some characters would never take this risk or else have no reason to.
scripted_trigger harm_1061_admires_window_view_trigger = {
	NOR = {
		has_trait = paranoid
		has_trait = blind
		# Doesn't appreciate beauty.
		has_trait = callous
	}
}

#	Falling out of a window whilst admiring the view.
harm.1061 = {
	type = character_event
	title = harm.1061.t
	desc = harm.1061.desc
	theme = skull
	left_portrait = {
		character = root
		animation = fear
	}
	override_background = { reference = bedchamber }

	trigger = {
		# No multi-story tents
		is_landless_adventurer = no
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1061 }
		has_character_flag = had_event_harm_1062
		# Can't be tribal, must have enough development that you've got a tall building.
		location_has_multi_story_buildings_trigger = { LOCATION = location }
		# Some characters would never take this risk or else have no reason to.
		harm_1061_admires_window_view_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = brave
		}
	}

	immediate = {
		# Flag this event so the same character can't get it again.
		add_character_flag = had_event_harm_1061
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
	}

	# Grab for the window frame.
	option = {
		name = harm.1061.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.1061.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1061.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.1061.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1061.a.tt.failure
					left_icon = root
					death = { death_reason = death_fell_bedchamber }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# grab-grab-grab-GRAB!
	option = {
		name = harm.1061.b
		trigger = { has_trait = craven }
		trait = craven

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Rely on your quick reflexes.
	option = {
		name = harm.1061.c
		trigger = { prowess >= @random_harm_standard_skill_check_value }
		skill = prowess

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.1061.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1061.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.1061.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1061.c.tt.failure
					left_icon = root
					death = { death_reason = death_fell_bedchamber }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.1062 = {
	type = character_event
	title = harm.1062.t
	desc = harm.1062.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = happiness
	}
	override_background = { reference = bedchamber }

	trigger = {
		# No multi-story tents
		is_landless_adventurer = no
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1062 }
		# Can't be tribal, must have enough development that you've got a tall building.
		location_has_multi_story_buildings_trigger = { LOCATION = location }
		# Some characters would never take this risk or else have no reason to.
		harm_1061_admires_window_view_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = lazy
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_1062
	}

	# What a lovely view!
	option = {
		name = harm.1062.a

		# Foreshadow.
		custom_tooltip = harm.1062.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.1061
					years = { 3 8 }
				}
			}
		}
	}
}

##################################################
# Crimes of Passion
# by Ewan Cowhig Croft
# 1071 - 1080
##################################################

# Do we have two courtiers who might stab each other?
scripted_trigger harm_1071_rival_courtiers_trigger = {
	NOT = { has_trait = forgiving }
	any_relation = {
		type = rival
		NOT = { has_trait = forgiving }
		is_courtier_of = root
	}
}

# Grab two appropriate courtiers.
scripted_effect harm_1071_grab_rival_courtiers_effect = {
	# Grab our courtiers.
	random_courtier = {
		limit = {
			has_trait = vengeful
			harm_1071_rival_courtiers_trigger = yes
		}
		alternative_limit = { harm_1071_rival_courtiers_trigger = yes }
		save_scope_as = killer
		random_relation = {
			type = rival
			limit = {
				has_trait = vengeful
				harm_1071_rival_courtiers_trigger = yes
			}
			alternative_limit = { harm_1071_rival_courtiers_trigger = yes }
			save_scope_as = other
		}
	}
}

#	A scuffle between two rivals sees you accidentally stabbed.
harm.1071 = {
	type = character_event
	title = harm.1071.t
	desc = harm.1071.desc
	theme = skull
	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		character = scope:killer
		animation = assassin
	}
	lower_right_portrait = scope:other
	override_background = { reference = corridor_day }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1071 }
		has_character_flag = had_event_harm_1072
		# Must have suitable courtiers.
		any_courtier = {
			harm_1071_rival_courtiers_trigger = yes
		}
		# Paranoid characters wouldn't be caught in this situation.
		NOT = { has_trait = paranoid }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_royal_court = yes
			OR = {
				has_court_type = court_warlike
				has_court_type = court_intrigue
				has_court_type = court_tribal
				has_court_type = court_nomadic
			}
		}
		modifier = {
			add = -0.75
			has_royal_court = yes
			OR = {
				has_court_type = court_diplomatic
				has_court_type = court_scholarly
			}
		}
	}

	immediate = {
		# Flag this event so the same character can't get it again.
		add_character_flag = had_event_harm_1071
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
		# Process stabby courtiers.
		## If our old ones aren't still good, then we need to set up new ones.
		if = {
			limit = {
				OR = {
					NOR = {
						exists = scope:killer
						exists = scope:other
					}
					NOT = {
						scope:killer ?= {
							is_alive = yes
							is_imprisoned = no
							is_courtier_of = root
							harm_1071_rival_courtiers_trigger = yes
						}
						scope:other ?= {
							is_alive = yes
							is_imprisoned = no
							is_courtier_of = root
							harm_1071_rival_courtiers_trigger = yes
						}
					}
				}
			}
			harm_1071_grab_rival_courtiers_effect = yes
		}
	}

	# Dodge the knife.
	option = {
		name = harm.1071.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.1071.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1071.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.1071.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1071.a.tt.failure
					left_icon = root
					death = {
						death_reason = death_courtier_mistakenly_stabbed
						killer = scope:killer
					}
					log_harm_event_death_as_variable_effect = yes
					# Do some stealthy stuff to keep the toast neat whilst propagating out consequences.
					hidden_effect = {
						scope:killer = {
							add_trait = murderer
							add_kinslayer_trait_or_nothing_effect = { VICTIM = root }
						}
					}
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# Easily duck aside from the blade.
	option = {
		name = harm.1071.b
		trigger = {
			OR = {
				has_trait = brave
				has_trait = lifestyle_blademaster
			}
		}
		trait = brave
		trait = lifestyle_blademaster

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Rely on your reflexes.
	option = {
		name = harm.1071.c
		trigger = { prowess >= @random_harm_standard_skill_check_value }
		skill = prowess

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.1071.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1071.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.1071.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1071.c.tt.failure
					left_icon = root
					death = {
						death_reason = death_courtier_mistakenly_stabbed
						killer = scope:killer
					}
					log_harm_event_death_as_variable_effect = yes
					# Do some stealthy stuff to keep the toast neat whilst propagating out consequences.
					hidden_effect = {
						scope:killer = {
							add_trait = murderer
							add_kinslayer_trait_or_nothing_effect = { VICTIM = root }
						}
					}
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}

	after = {
		if = {
			limit = {
				scope:killer = {
					is_alive = yes
					liege ?= { is_alive = yes }
				}
			}
			# Yeahhhh. Yeah you're goin' down for this'un.
			rightfully_imprison_character_effect = {
				TARGET = scope:killer
				IMPRISONER = scope:killer.liege
			}
		}
	}
}

# Attached foreboding event.
harm.1072 = {
	type = character_event
	title = harm.1072.t
	desc = harm.1072.desc
	theme = physical_health
	left_portrait = {
		character = scope:killer
		animation = rage
	}
	right_portrait = {
		character = scope:other
		animation = dismissal
	}
	override_background = { reference = corridor_day }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1072 }
		# Must have suitable courtiers.
		any_courtier = {
			harm_1071_rival_courtiers_trigger = yes
		}
		# Paranoid characters wouldn't be caught in this situation.
		NOT = { has_trait = paranoid }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_royal_court = yes
			OR = {
				has_court_type = court_warlike
				has_court_type = court_intrigue
				has_court_type = court_tribal
				has_court_type = court_nomadic
			}
		}
		modifier = {
			add = -0.75
			has_royal_court = yes
			OR = {
				has_court_type = court_diplomatic
				has_court_type = court_scholarly
			}
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_1072
		# Set up our courtiers.
		harm_1071_grab_rival_courtiers_effect = yes
	}

	# Just another exciting day at court, eh?
	option = {
		name = harm.1072.a

		# Foreshadow.
		custom_tooltip = harm.1072.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.1071
					years = { 3 8 }
				}
			}
		}
	}
}

##################################################
# Storm's Wrath
# by Ewan Cowhig Croft
# 1081 - 1090
##################################################

scripted_trigger harm_1081_normal_storms_trigger = {
	location = {
		OR = {
			terrain = drylands
			terrain = farmlands
			terrain = floodplains
			terrain = forest
			terrain = hills
			terrain = jungle
			terrain = mountains
			terrain = plains
			terrain = taiga
			terrain = wetlands
			terrain = steppe
		}
	}
}

#	Death in a storm, due to a lightning hit/being crushed by a falling tree/twatted by a falling rock/catching a terminal chill.
harm.1081 = {
	type = character_event
	title = harm.1081.t
	desc = harm.1081.desc
	theme = skull
	left_portrait = {
		character = root
		animation = jockey_gallop
		camera = camera_event_horse_left
	}
	override_background = { reference = wilderness }
	widget = {
		gui = "event_window_widget_vfx_lightning_storm"
		container = "foreground_shader_vfx_container"
	}

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1081 }
		has_character_flag = had_event_harm_1082
		# Paranoid characters wouldn't be caught in this situation.
		NOT = { has_trait = paranoid }
		# Check to see if we're likely to have to deal with such storms.
		## Not that you _don't_ get storms in the desert, but it's more difficult to frame.
		harm_1081_normal_storms_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = brave
		}
	}

	immediate = {
		# Flag this event so the same character can't get it again.
		add_character_flag = had_event_harm_1081
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
	}

	# If we ride hard enough, we can reach home.
	option = {
		name = harm.1081.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.1081.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1081.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.1081.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1081.a.tt.failure
					left_icon = root
					death = { death_reason = death_violent_storm }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# There, that hollow, we can shelter there!
	option = {
		name = harm.1081.b
		trigger = { has_trait = craven }
		trait = craven

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# I — I think I might have a hide-away near hear?
	option = {
		name = harm.1081.c
		trigger = { intrigue >= @random_harm_standard_skill_check_value }
		skill = intrigue

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.1081.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1081.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.1081.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1081.c.tt.failure
					left_icon = root
					death = { death_reason = death_violent_storm }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.1082 = {
	type = character_event
	title = harm.1082.t
	desc = harm.1082.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = survey
	}
	override_background = { reference = wilderness }
	widget = {
		gui = "event_window_widget_vfx_rainy_fog"
		container = "foreground_shader_vfx_container"
	}

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1082 }
		# Paranoid characters wouldn't be caught in this situation.
		NOT = { has_trait = paranoid }
		# Check to see if we're likely to have to deal with such storms.
		## Not that you _don't_ get storms in the desert, but it's more difficult to frame.
		harm_1081_normal_storms_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = brave
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_1082
	}

	# I hope FateGodName isn't signalling something...
	option = {
		name = harm.1082.a

		# Foreshadow.
		custom_tooltip = harm.1082.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.1082
					years = { 2 8 }
				}
			}
		}
	}
}

##################################################
# Aching Minds
# by Ewan Cowhig Croft
# 1091 - 1100
##################################################

#	Struck down by an aneurysm.
harm.1091 = {
	type = character_event
	title = harm.1091.t
	desc = harm.1091.desc
	theme = skull
	left_portrait = {
		character = root
		animation = pain
	}
	lower_right_portrait = scope:medic
	override_background = { reference = study }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Medicine checks.
		character_can_easily_self_treat_trigger = no
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1091 }
		has_character_flag = had_event_harm_1092
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			potential_victim_of_apoplexy_trigger = yes
		}
	}

	immediate = {
		# Flag this event so the same character can't get it again.
		add_character_flag = had_event_harm_1091
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
		# Try to grab our court physician.
		harm_0000_grab_available_court_physician_effect = { PERSONAL_SKILL = diplomacy }
	}

	# #EMP My mind?!#!.
	## Obligatory "There's no one else here".
	### 2015/08/30.
	option = {
		name = harm.1091.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.1091.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1091.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.1091.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1091.a.tt.failure
					left_icon = root
					death = { death_reason = death_apoplexy }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# I. Will. Endure.
	option = {
		name = harm.1091.b
		trigger = {
			OR = {
				has_trait = calm
				has_trait = stubborn
			}
		}
		trait = calm
		trait = stubborn

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Call for your physic.
	option = {
		name = harm.0000.tt.physician
		trigger = {
			exists = scope:medic
			scope:medic.learning >= @court_medic_able_to_help_value
		}
		show_as_unavailable = { scope:medic.learning < @court_medic_able_to_help_value }

		# Random roll & stress handled in this effect.
		harm_0000_physic_rescue_chance_death_effect = { DEATH_REASON = death_apoplexy }

		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 10
		}
	}

	# Clarity, clarity, I need #EMP clarity#!.
	option = {
		name = harm.1091.c
		trigger = { diplomacy >= @random_harm_standard_skill_check_value }
		skill = diplomacy

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.1091.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1091.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.1091.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1091.c.tt.failure
					left_icon = root
					death = { death_reason = death_apoplexy }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.1092 = {
	type = character_event
	title = harm.1092.t
	desc = {
		desc = harm.1092.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { has_trait = blind }
				desc = harm.1092.desc.blind
			}
			desc = harm.1092.desc.fallback
		}
	}
	theme = physical_health
	left_portrait = {
		character = root
		animation = worry
	}
	override_background = { reference = study }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1092 }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			potential_victim_of_apoplexy_trigger = yes
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_1092
	}

	# Uggh, my head...
	option = {
		name = harm.1092.a

		# Foreshadow.
		custom_tooltip = harm.1092.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.1091
					years = { 3 8 }
				}
			}
		}
	}
}

##################################################
# Street Safety
# by Ewan Cowhig Croft
# 1101 - 1110
##################################################

#	Run over by a rider/run-away cart.
harm.1101 = {
	type = character_event
	title = harm.1101.t
	desc = harm.1101.desc
	theme = skull
	left_portrait = {
		character = root
		animation = fear
	}
	override_background = { reference = alley_day }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1101 }
		has_character_flag = had_event_harm_1102
		# Neither Paranoid characters nor Reclusive ones would be caught in this situation.
		NOR = {
			has_trait = paranoid
			has_trait = reclusive
		}
		# And some danger of fast-moving carts.
		location_has_fast_traffic_trigger = { LOCATION = root.location }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = gregarious
		}
	}

	immediate = {
		# Flag this event so the same character can't get it again.
		add_character_flag = had_event_harm_1101
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
	}

	# Jump backwards.
	option = {
		name = harm.1101.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.1101.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1101.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.1101.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1101.a.tt.failure
					left_icon = root
					death = { death_reason = death_run_over_cart }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# Leap backwards with all your might.
	option = {
		name = harm.1101.b
		trigger = {
			OR = {
				has_trait = shy
				has_trait = craven
			}
		}
		trait = shy
		trait = craven

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Throw yourself forwards.
	option = {
		name = harm.1101.c
		trigger = { prowess >= @random_harm_standard_skill_check_value }
		skill = prowess

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.1101.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1101.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.1101.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1101.c.tt.failure
					left_icon = root
					death = { death_reason = death_run_over_cart }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.1102 = {
	type = character_event
	title = harm.1102.t
	desc = harm.1102.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = personality_bold
	}
	override_background = { reference = alley_day }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1102 }
		# Neither Paranoid characters nor Reclusive ones would be caught in this situation.
		NOR = {
			has_trait = paranoid
			has_trait = reclusive
		}
		# And some danger of fast-moving carts.
		location_has_fast_traffic_trigger = { LOCATION = root.location }
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			has_trait = gregarious
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_1102
	}

	# The commoners do need to see their GetTitleAsName.
	option = {
		name = harm.1102.a

		# Foreshadow.
		custom_tooltip = harm.1102.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.1101
					years = { 3 8 }
				}
			}
		}
	}
}

##################################################
# People's Justice
# by Ewan Cowhig Croft
# 1111 - 1120
##################################################

scripted_trigger harm_1111_capital_hates_you_trigger = { capital_county.county_opinion <= -80 }

scripted_trigger harm_1111_saved_by_court_amenities_trigger = {
	trigger_if = {
		limit = { has_royal_court = yes }
		# Must have enough servants for one to slip through unnoticed.
		amenity_level = {
			target = court_servants
			value >= 3
		}
	}
}

# Some characters wouldn't be caught near people like this.
scripted_trigger harm_1111_traits_filter_trigger = {
	NOR = {
		# Doesn't take risks.
		has_trait = paranoid
		# Is never near people.
		has_trait = reclusive
		has_trait = shy
		# Narrative taste.
		has_trait = pregnant
	}
}

#	Stabbed by a servant in your capital that hates you.
harm.1111 = {
	type = character_event
	title = harm.1111.t
	desc = harm.1111.desc
	theme = skull
	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		character = scope:killer
		animation = assassin
		outfit_tags = { beggar_rags }
	}
	override_background = { reference = corridor_day }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1111 }
		has_character_flag = had_event_harm_1112
		# Must be landed for this'un...
		is_landed_or_landless_administrative = yes
		# ... because your capital _really_ does not like you.
		harm_1111_capital_hates_you_trigger = yes
		# Must have enough servants for this to be a potential problem.
		harm_1111_saved_by_court_amenities_trigger = yes
		# Some characters wouldn't be caught near people like this.
		harm_1111_traits_filter_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			OR = {
				has_trait = arbitrary
				has_trait = trusting
			}
		}
	}

	immediate = {
		# Flag this event so the same character can't get it again.
		add_character_flag = had_event_harm_1111
		# Give a little protection against spam.
		harm_0000_apply_dynastic_cooldowns_effect = yes
		# Stab root.
		increase_wounds_no_death_effect = { REASON = fight }
		# Create our killer.
		create_character = {
			age = { 25 45 }
			culture = root.capital_county.culture
			faith = root.capital_county.faith
			dynasty = none
			gender_female_chance = 50
			# Traits.
			## Education.
			random_traits_list = {
				count = 1
				education_diplomacy_1 = {}
				education_martial_1 = {}
				education_stewardship_1 = {}
				education_intrigue_1 = {}
				education_learning_1 = {}
			}
			## Personality.
			trait = vengeful
			trait = brave
			## Plus a little bit of variety is nice.
			random_traits_list = {
				count = 1
				stubborn = {}
				impatient = {}
				humble = {}
				wrathful = {}
			}
			# Skills.
			intrigue = {
				min_template_decent_skill
				max_template_decent_skill
			}
			prowess = {
				min_template_decent_skill
				max_template_decent_skill
			}
			employer = root
			save_scope_as = killer
		}
		# Alright, welcome to the world, scope:killer!
		## Now you die.
		scope:killer = {
			death = { death_reason = death_slaughtered_by_guards }
			log_harm_event_death_as_variable_effect = yes
		}
	}

	# Gah, I am undone!
	option = {
		name = harm.1111.a
		trigger = {
			NOR = {
				has_trait = stubborn
				dread >= 50
			}
		}

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.1111.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1111.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.1111.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1111.a.tt.failure
					left_icon = root
					death = {
						death_reason = death_murder
						killer = scope:killer
					}
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# It'll take more than that to kill #EMP me#!.
	option = {
		name = harm.1111.b
		trigger = { has_trait = stubborn }
		trait = stubborn

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# #EMP Another#! assassin? Pathetic!
	option = {
		name = harm.1111.c
		trigger = { dread >= 50 }
		custom_tooltip = harm.1111.c.tt.dread

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.1111.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.1111.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.1111.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.1111.c.tt.failure
					left_icon = root
					death = { death_reason = death_choked }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

# Attached foreboding event.
harm.1112 = {
	type = character_event
	title = harm.1112.t
	desc = harm.1112.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = dismissal
	}
	override_background = { reference = corridor_day }

	trigger = {
		# Standard checks.
		is_available_adult = yes
		# Harm filter checks.
		NOT = { has_character_flag = had_event_harm_1112 }
		# Must be landed for this'un...
		is_landed_or_landless_administrative = yes
		# ... because your capital _really_ does not like you.
		harm_1111_capital_hates_you_trigger = yes
		# Must have enough servants for this to be a potential problem.
		harm_1111_saved_by_court_amenities_trigger = yes
		# Some characters wouldn't be caught near people like this.
		harm_1111_traits_filter_trigger = yes
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Plus some other factors apply.
		modifier = {
			add = 0.25
			OR = {
				has_trait = arbitrary
				has_trait = trusting
			}
		}
	}

	immediate = {
		# Flag this event as taken for the follow-up.
		add_character_flag = had_event_harm_1112
	}

	# As long as they know their place.
	option = {
		name = harm.1112.a

		# Foreshadow.
		custom_tooltip = harm.1112.a.tt

		# No stress. Yet.
		ai_chance = {
			# Only one option, so what we do is unimportant.
			base = 1
		}
	}

	after = {
		# Random chance of immediately skipping on to the following event in a few years.
		hidden_effect = {
			random = {
				chance = 50
				trigger_event = {
					id = harm.1111
					years = { 3 8 }
				}
			}
		}
	}
}











##################################################
# RANDOM DEATH BATTLE EVENTS

##################################################
# Camp Fever
# by Ewan Cowhig Croft
# 2001 - 2010
##################################################

#	Terrible siege conditions cause you strife.
harm.2001 = {
	type = character_event
	title = harm.2001.t
	desc = harm.2001.desc
	theme = skull
	left_portrait = {
		character = root
		animation = sick
	}
	override_background = { reference = battlefield }

	cooldown = { years = 30 }

	trigger = {
		# Standard checks.
		harm_game_rule_enablement_trigger = yes
		# Medicine checks.
		character_can_easily_self_treat_trigger = no
		# Army checks.
		commanding_army = {
			# Gotta be at a siege.
			is_army_in_siege = yes
			# But _not_ currently fighting, as that'll mess the narrative up.
			is_army_in_combat = no
		}
		NOR = {
			health >= @army_commander_vulnerable_to_health_problems_value
			has_trait = logistician
			has_trait = military_engineer
		}
		commander_in_terrain_specialisation = no
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Characters in poor health shouldn't campaign.
		## Medium health
		modifier = {
			add = 0.25
			health <= medium_health
		}
		## Fine health (which is somehow lower than medium)
		modifier = {
			add = 0.25
			health <= fine_health
		}
		## Poor health
		modifier = {
			add = 0.25
			health <= poor_health
		}
		# Some characters do better on campaign.
		## Martially educated characters are better able to cope with these harsh realities.
		modifier = {
			add = -0.45
			has_trait = education_martial
		}
		## Stubborn characters will stomach all manner of pains.
		modifier = {
			add = -0.5
			has_trait = stubborn
		}
	}

	# My — my guts... eurgh...
	option = {
		name = harm.2001.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.2001.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2001.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.2001.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2001.a.tt.failure
					left_icon = root
					death = { death_reason = death_camp_fever }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# I will not end here.
	option = {
		name = harm.2001.b
		trigger = { has_trait = whole_of_body }
		trait = whole_of_body

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# I know what I need. Get me... get me...
	option = {
		name = harm.2001.c
		trigger = { learning >= @random_harm_standard_skill_check_value }
		skill = learning

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.2001.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2001.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.2001.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2001.c.tt.failure
					left_icon = root
					death = { death_reason = death_camp_fever }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

##################################################
# Marching Malaise
# by Ewan Cowhig Croft
# 2011 - 2020
##################################################

#	Terrible marching conditions are problematic.
harm.2011 = {
	type = character_event
	title = harm.2011.t
	desc = harm.2011.desc
	theme = skull
	left_portrait = {
		character = root
		animation = sick
	}
	override_background = { reference = wilderness }

	cooldown = { years = 30 }

	trigger = {
		# Standard checks.
		harm_game_rule_enablement_trigger = yes
		# Medicine checks.
		character_can_easily_self_treat_trigger = no
		# Army checks.
		commanding_army = {
			# Army must be mobile.
			army_is_moving = yes
			is_army_in_combat = no
		}
		NOR = {
			health >= @army_commander_vulnerable_to_health_problems_value
			has_trait = logistician
			has_trait = organizer
		}
		commander_in_terrain_specialisation = no
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Characters in poor health shouldn't campaign.
		## Medium health
		modifier = {
			add = 0.25
			health <= medium_health
		}
		## Fine health (which is somehow lower than medium)
		modifier = {
			add = 0.25
			health <= fine_health
		}
		## Poor health
		modifier = {
			add = 0.25
			health <= poor_health
		}
		# Some characters do better on campaign.
		## Martially educated characters are better able to cope with these harsh realities.
		modifier = {
			add = -0.45
			has_trait = education_martial
		}
		## Stubborn characters will stomach all manner of pains.
		modifier = {
			add = -0.5
			has_trait = stubborn
		}
	}

	# Why is... what is...
	option = {
		name = harm.2011.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.2011.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2011.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.2011.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2011.a.tt.failure
					left_icon = root
					death = { death_reason = death_march_malaise }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# My soldiers suffer only what I can suffer.
	option = {
		name = harm.2011.b
		trigger = {
			OR = {
				has_trait = diligent
				has_trait = athletic
				has_trait = stubborn
			}
			# Some characters can't motivate themselves in this fashion.
			NOR = {
				has_trait = callous
				has_trait = sadistic
			}
		}
		trait = diligent
		trait = athletic
		trait = stubborn

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# I've endured worse, surely?
	option = {
		name = harm.2011.c
		trigger = {
			OR = {
				martial >= very_high_skill_rating
				prowess >= extremely_high_skill_rating
			}
		}
		skill = martial
		skill = prowess

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.2011.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2011.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.2011.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2011.c.tt.failure
					left_icon = root
					death = { death_reason = death_march_malaise }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

##################################################
# So... Cold...
# by Ewan Cowhig Croft
# 2021 - 2030
##################################################

#	Frostbite claims you.
harm.2021 = {
	type = character_event
	title = harm.2021.t
	desc = harm.2021.desc
	theme = skull
	left_portrait = {
		character = root
		animation = sick
	}
	override_background = { reference = ep2_hunt_snowy_forest }
	widget = {
		gui = "event_window_widget_vfx_snow"
		container = "foreground_shader_vfx_container"
	}

	cooldown = { years = 30 }

	trigger = {
		# Standard checks.
		harm_game_rule_enablement_trigger = yes
		# Medicine checks.
		character_can_easily_self_treat_trigger = no
		# Winter checks.
		location_has_harsh_winter_trigger = yes
		# Exempt some peoples.
		NOR = {
			health >= @army_commander_vulnerable_to_health_problems_value
			has_trait = winter_soldier
			# Winter soldier bonuses.
			culture = { has_cultural_parameter = winter_trait_bonuses }
		}
		commander_in_terrain_specialisation = no
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Characters in poor health shouldn't campaign.
		## Medium health or harsh winter
		modifier = {
			add = 0.25
			health <= medium_health
			location = { has_province_modifier = winter_harsh_modifier }
		}
		## Fine health (which is somehow lower than medium) or normal winter
		modifier = {
			add = 0.25
			health <= fine_health
			location = {
				OR = {
					has_province_modifier = winter_harsh_modifier
					has_province_modifier = winter_normal_modifier
				}
			}
		}
		## Poor health or mild winter
		modifier = {
			add = 0.25
			health <= poor_health
			location = {
				OR = {
					has_province_modifier = winter_harsh_modifier
					has_province_modifier = winter_normal_modifier
					has_province_modifier = winter_mild_modifier
				}
			}
		}
		# Some characters do better on campaign.
		## Martially educated characters are better able to cope with these harsh realities.
		modifier = {
			add = -0.45
			has_trait = education_martial
		}
		## Stubborn characters will stomach all manner of pains.
		modifier = {
			add = -0.5
			has_trait = stubborn
		}
	}

	# ...
	option = {
		name = harm.2021.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.2021.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2021.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.2021.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2021.a.tt.failure
					left_icon = root
					death = { death_reason = death_froze }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# I. Have. A higher. Destiny.
	option = {
		name = harm.2021.b
		trigger = { has_trait = ambitious }
		trait = ambitious

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# I. Will not. End.
	option = {
		name = harm.2021.c
		trigger = { prowess >= @random_harm_standard_skill_check_value }
		skill = prowess

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.2021.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2021.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.2021.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2021.c.tt.failure
					left_icon = root
					death = { death_reason = death_froze }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

##################################################
# So... Hot...
# by Ewan Cowhig Croft
# 2031 - 2040
##################################################

#	Heat-stroke claims you.
harm.2031 = {
	type = character_event
	title = harm.2031.t
	desc = harm.2031.desc
	theme = skull
	left_portrait = {
		character = root
		animation = stress
	}
	override_background = { reference = wilderness }

	cooldown = { years = 30 }

	trigger = {
		# Standard checks.
		harm_game_rule_enablement_trigger = yes
		# Medicine checks.
		character_can_easily_self_treat_trigger = no
		# Terrain checks.
		tropical_seasons_trigger = { LOCATION = root.location }
		NOT = {
			is_nice_season_to_be_outside_trigger = { LOCATION = root.location }
		}
		# Exempt some peoples.
		NOR = {
			health >= @army_commander_vulnerable_to_health_problems_value
			# Desert cultural bonuses.
			culture = { has_cultural_parameter = desert_warrior_trait_is_better }
			# *sigh* And SOME people are just too into the sun.
			faith = { has_doctrine_parameter = trial_by_sun_active }
		}
		commander_in_terrain_specialisation = no
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Characters in poor health shouldn't campaign.
		## Medium health
		modifier = {
			add = 0.25
			health <= medium_health
		}
		## Fine health (which is somehow lower than medium)
		modifier = {
			add = 0.25
			health <= fine_health
		}
		## Poor health
		modifier = {
			add = 0.25
			health <= poor_health
		}
		# Some characters do better on campaign.
		## Martially educated characters are better able to cope with these harsh realities.
		modifier = {
			add = -0.45
			has_trait = education_martial
		}
		## Stubborn characters will stomach all manner of pains.
		modifier = {
			add = -0.5
			has_trait = stubborn
		}
		# Are we not in the desert? If not, reduce _markedly.
		modifier = {
			factor = 0.25
			location = {
				NOR = {
					terrain = desert
					terrain = desert_mountains
				}
			}
		}
	}

	# Is DeathGodName calling for me?
	option = {
		name = harm.2031.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.2031.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2031.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.2031.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2031.a.tt.failure
					left_icon = root
					death = { death_reason = death_heatstroke }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# I. Have. A higher. Destiny.
	option = {
		name = harm.2031.b
		trigger = { has_trait = ambitious }
		trait = ambitious

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# I am not DeathGodNamePossessive's fool.
	option = {
		name = harm.2031.c
		trigger = { prowess >= @random_harm_standard_skill_check_value }
		skill = prowess

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.2031.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2031.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.2031.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2031.c.tt.failure
					left_icon = root
					death = { death_reason = death_heatstroke }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

##################################################
# For the Realm
# by Ewan Cowhig Croft
# 2041 - 2050
##################################################

#	Aggrieved soldiers at war too long assassinate you.
harm.2041 = {
	type = character_event
	title = harm.2041.t
	desc = harm.2041.desc
	theme = skull
	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		character = scope:killer
		animation = aggressive_sword
	}
	override_background = { reference = bp1_bonfire }

	cooldown = { years = 30 }

	trigger = {
		# Standard checks.
		harm_game_rule_enablement_trigger = yes
		# Requires you to be landed so we know where to pull the soldier from.
		is_landed_or_landless_administrative = yes
		# Army checks.
		NOT = {
			faith = { has_doctrine_parameter = warmonger }
		}
		days_of_continuous_war >= 9125
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Some characters aren't popular with soldiers.
		modifier = {
			add = 0.5
			OR = {
				has_trait = shy
				has_trait = wrathful
				has_trait = impatient
				has_trait = callous
				has_trait = sadistic
				has_trait = irritable
			}
		}
		# And some characters can persuade their soldiers through thick'n'thin.
		modifier = {
			add = -0.75
			OR = {
				has_trait = gregarious
				has_trait = calm
				has_trait = patient
				has_trait = compassionate
			}
		}
	}

	immediate = {
		# Generate a suitable soldier to use.
		create_character = {
			template = retired_mercenary
			location = root.location
			culture = root.capital_county.culture
			faith = root.capital_county.faith
			gender_female_chance = root_soldier_female_chance
			dynasty = none
			save_scope_as = killer
		}
	}

	# Traitors! TRAITORS!
	option = {
		name = harm.2041.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.2041.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2041.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.2041.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2041.a.tt.failure
					left_icon = root
					death = { death_reason = death_assassinated_by_soldiers }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# Only five? Have at thee, milksops!
	option = {
		name = harm.2041.b
		trigger = { has_trait = lifestyle_blademaster }
		trait = lifestyle_blademaster

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# I'll make you bleed!
	option = {
		name = harm.2041.c
		trigger = {
			OR = {
				prowess >= very_high_skill_rating
				has_trait = berserker
				has_trait = shieldmaiden
			}
		}
		skill = prowess
		trait = berserker
		trait = shieldmaiden

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.2041.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2041.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.2041.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2041.c.tt.failure
					left_icon = root
					death = { death_reason = death_assassinated_by_soldiers }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

##################################################
# Starvation
# by Ewan Cowhig Croft
# 2051 - 2060
##################################################

#	Complications due to starvation from lack of supply.
harm.2051 = {
	type = character_event
	title = harm.2051.t
	desc = harm.2051.desc
	theme = skull
	left_portrait = {
		character = root
		animation = sick
	}
	override_background = { reference = wilderness }

	cooldown = { years = 30 }

	trigger = {
		# Standard checks.
		harm_game_rule_enablement_trigger = yes
		# Army checks.
		# TIT-44620
		always = no
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Characters in poor health shouldn't campaign.
		## Medium health
		modifier = {
			add = 0.25
			health <= medium_health
		}
		## Fine health (which is somehow lower than medium)
		modifier = {
			add = 0.25
			health <= fine_health
		}
		## Poor health
		modifier = {
			add = 0.25
			health <= poor_health
		}
		# Some characters do better on campaign.
		## Martially educated characters are better able to cope with these harsh realities.
		modifier = {
			add = -0.45
			has_trait = education_martial
		}
		## Stubborn characters will stomach all manner of pains.
		modifier = {
			add = -0.5
			has_trait = stubborn
		}
	}

	# My skin... like paper...
	option = {
		name = harm.2051.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.2051.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2051.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.2051.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2051.a.tt.failure
					left_icon = root
					death = { death_reason = death_starved }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# The situation is still salvageable.
	option = {
		name = harm.2051.b
		trigger = {
			OR = {
				has_trait = logistician
				AND = {
					has_trait = desert_warrior
					location = {
						OR = {
							terrain = desert
							terrain = desert_mountains
						}
					}
				}
				AND = {
					has_trait = jungle_stalker
					location = { terrain = jungle }
				}
				AND = {
					has_trait = open_terrain_expert
					location = {
						OR = {
							terrain = drylands
							terrain = farmlands
							terrain = plains
							terrain = steppe
						}
					}
				}
				AND = {
					has_trait = rough_terrain_expert
					location = {
						OR = {
							terrain = hills
							terrain = mountains
							terrain = wetlands
							terrain = desert_mountains
						}
					}
				}
				AND = {
					has_trait = forest_fighter
					location = {
						OR = {
							terrain = forest
							terrain = taiga
						}
					}
				}
				AND = {
					has_trait = winter_soldier
					location_has_winter_trigger = yes
				}
			}
		}
		trait = logistician
		trait = desert_warrior
		trait = jungle_stalker
		trait = open_terrain_expert
		trait = rough_terrain_expert
		trait = forest_fighter
		trait = winter_soldier

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# We have reserves, we _must_ have reserves!
	option = {
		name = harm.2051.c
		trigger = { stewardship >= @random_harm_standard_skill_check_value }
		skill = stewardship

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.2051.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2051.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.2051.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2051.c.tt.failure
					left_icon = root
					death = { death_reason = death_starved }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

##################################################
# Harried Each Step
# by Ewan Cowhig Croft
# 2061 - 2070
##################################################

#	Retreating from battle and caught by enemy soldiers.
harm.2061 = {
	type = character_event
	title = harm.2061.t
	desc = harm.2061.desc
	theme = skull
	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		character = scope:killer
		animation = aggressive_spear
		hide_info = yes
	}
	override_background = { reference = battlefield }

	cooldown = { years = 30 }

	trigger = {
		# Standard checks.
		harm_game_rule_enablement_trigger = yes
		# Army checks.
		commanding_army = { is_army_in_combat = yes }
		# TIT-44621
		always = no
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Maybe you like forward charges.
		modifier = {
			add = 0.25
			OR = {
				has_trait = brave
				has_trait = reckless
				has_trait = unyielding_defender
			}
		}
		# Maybe you don't.
		modifier = {
			add = -0.75
			OR = {
				has_trait = craven
				# Focused on coordination.
				has_trait = logistician
			}
		}
	}

	immediate = {
		# Generate a suitable soldier to use.
		# TIT-44621
	}

	# Get away from me, you bastards!
	option = {
		name = harm.2061.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.2061.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2061.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.2061.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2061.a.tt.failure
					left_icon = root
					death = { death_reason = death_cut_off_by_enemy_troops_defensive }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# FLEE!
	option = {
		name = harm.2061.b
		trigger = { has_trait = craven }
		trait = craven

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Blast the horn, the TitleAsName requires aid!
	option = {
		name = harm.2061.c
		trigger = { martial >= @random_harm_standard_skill_check_value }
		skill = martial

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.2061.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2061.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.2061.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2061.c.tt.failure
					left_icon = root
					death = { death_reason = death_cut_off_by_enemy_troops_defensive }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}
}

##################################################
# A Disastrous Victory
# by Ewan Cowhig Croft
# 2071 - 2080
##################################################

#	Pursuing too far ahead in battle and caught by enemy soldiers.
harm.2071 = {
	type = character_event
	title = harm.2071.t
	desc = harm.2071.desc
	theme = skull
	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		character = scope:killer
		animation = aggressive_spear
		hide_info = yes
	}
	override_background = { reference = battlefield }

	cooldown = { years = 30 }

	trigger = {
		# Standard checks.
		harm_game_rule_enablement_trigger = yes
		# Army checks.
		commanding_army = {
			is_army_in_combat = yes
			involved_combat_side = {
				OR = {
					is_combat_side_pursuing = yes
					enemy_side = { is_combat_side_retreating = yes }
				}
			}
			exists = enemy_side.side_primary_participant
		}
	}

	weight_multiplier = {
		base = 0

		# Add the weightings.
		modifier = { add = harm_game_rule_likelihood_value }
		# Maybe you like forward charges.
		modifier = {
			add = 0.25
			OR = {
				has_trait = brave
				has_trait = reckless
				has_trait = aggressive_attacker
			}
		}
		# Maybe you don't.
		modifier = {
			add = -0.75
			OR = {
				has_trait = craven
				# Focused on coordination.
				has_trait = logistician
			}
		}
	}

	immediate = {
		# Generate a suitable soldier to use.
		commanding_army.involved_combat_side.enemy_side.side_primary_participant = { save_scope_as = actor }
		create_character = {
			gender_female_chance = actor_soldier_female_chance
			location = root.location
			template = new_warrior_character
			faith = scope:actor.faith
			culture = scope:actor.culture
			save_scope_as = killer
		}
		scope:killer = { add_character_flag = wear_armor }
	}

	# You'll not claim me, DeathGodName!
	option = {
		name = harm.2071.a

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_success_value }
				desc = harm.2071.a.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2071.a.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_low_odd_failure_value }
				desc = harm.2071.a.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2071.a.tt.failure
					left_icon = root
					death = { death_reason = death_cut_off_by_enemy_troops_offensive }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = medium_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# Unless they've got a special option, the AI should always choose this.
			base = 1
		}
	}

	# FLEE!
	option = {
		name = harm.2071.b
		trigger = { has_trait = craven }
		trait = craven

		custom_tooltip = harm.0000.tt.spared_for_now
		log_harm_event_spared_as_variable_effect = yes

		# Always gain stress from trait opt-outs.
		stress_impact = {
			base = massive_stress_impact_gain
			calm = minor_stress_impact_loss
		}
		ai_chance = {
			# The AI should essentially always take this option.
			base = 1000
		}
	}

	# Rally! Rally to the TitleAsName!
	option = {
		name = harm.2071.c
		trigger = { martial >= @random_harm_standard_skill_check_value }
		skill = martial

		random_list = {
			# You survive.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_success_value }
				desc = harm.2071.c.tt.success
				send_interface_toast = {
					type = event_toast_effect_good
					title = harm.2071.c.tt.success
					left_icon = root
					custom_tooltip = harm.0000.tt.spared_for_now
					log_harm_event_spared_as_variable_effect = yes
				}
			}
			# You perish.
			0 = {
				modifier = { add = harm_event_random_list_high_odd_failure_value }
				desc = harm.2071.c.tt.failure
				send_interface_toast = {
					type = event_toast_effect_bad
					title = harm.2071.c.tt.failure
					left_icon = root
					death = { death_reason = death_cut_off_by_enemy_troops_offensive }
					log_harm_event_death_as_variable_effect = yes
				}
			}
		}

		# Always gain stress from skill tests.
		if = {
			limit = { is_alive = yes }
			stress_impact = {
				base = major_stress_impact_gain
				calm = minor_stress_impact_loss
			}
		}
		ai_chance = {
			# The AI should take this option if a better one isn't available.
			base = 100
		}
	}

	after = {
		hidden_effect = {
			scope:killer = {
				death = { death_reason = death_vanished }
			}
		}
	}
}











##################################################
# RESPONSIVE INCAPABILITY EVENTS

##################################################
# Various Maintenance Events
# by Ewan Cowhig Croft
# 9501 - 9550
##################################################

#	Maintenance event fire the on_action containing the randoms..
harm.9501 = {
	hidden = yes
	trigger = {
		# Standard checks.
		is_ruler = yes
		harm_0000_not_on_dynastic_cooldown_trigger = yes
		harm_game_rule_enablement_trigger = yes
		# Mustn't _already_ have a trait rendering you senseless.
		is_incapable = no
	}

	immediate = {
		trigger_event = { on_action = harm_events_pulse }
	}
}
