﻿#Events managing health concerns

namespace = health

#WOUNDED EVENTS: by Linnéa Thimrén and Petter Vilberg
#	0001-0099: Recovery events
#	0101-0199: Becoming wounded
#	0201-0299: Infection/gangrene

#DISEASE EVENTS: by Mathilda Bjarnehed
#	1001-1099: Contract disease
#	1101-1199: Recover from diseases
#	1201-1299: Contagion handling events
# 	2001-2099: STD events
#	2101-2199: Contagious disease at court
#	2201-2299: Important character has dangerous disease events

#COURT PHYSICIAN RECRUITMENT by Mathilda Bjarnehed
#	3001-3009: Recruit physician event
#	3010	 : Invalidate physician

#COURT PHYSICIAN DISEASE EVENTS: by Mathilda Bjarnehed, Milla Isaksson, and Linnéa Thimrén
#	3100-3199: Disease treatment
#	3201-3299: Punishment for mistreating important people

#COURT PHYSICIAN WOUND EVENTS: by Linnéa Thimrén
#	4000		Wound treatment

#COMMIT SUICIDE EVENTS: by Linnéa Thimrén
#	6000		How will you do it?

#INFIRM EVENTS: by Bianca Savazzi
#	7000		You've become infirm
#	7100		You become depressed while infirm

#PULSE MANAGEMENT:
#	9998-9999: Pulse management



##################
##################
# WOUNDED EVENTS #
##################
##################

##################
# RECOVERY EVENTS
##################

#Recover from being Wounded
health.0001 = {
	hidden = yes

	trigger = {
		has_trait = wounded_1
	}

	weight_multiplier = {
		base = 1
		compare_modifier = {
			value = age
			multiplier = -0.01
			min = -0.9
		}
		compare_modifier = {
			value = stress
			offset = -25
			multiplier = -0.005
		}
		modifier = {
			add = -0.3
			has_character_modifier = infected_wound_modifier
		}
		modifier = {
			add = 1
			court_physician_available_trigger = yes
		}
	}

	immediate = {
		if = {
			limit = { has_character_modifier = infected_wound_modifier }
			remove_character_modifier = infected_wound_modifier

			if = {
				limit = { NOT = { has_trait = scarred } }
				add_character_flag = will_get_scar
			}
		}
		else_if = {
			limit = { NOT = { has_trait = scarred } }
			random = {
				chance = 40
				add_character_flag = will_get_scar
			}
		}
		send_interface_toast = {
			type = event_court_physician_good
			title = health.0001.desc

			remove_trait = wounded_1

			if = {
				limit = { has_character_flag = will_get_scar }
				add_trait = scarred
				add_trait_xp = {
	                trait = scarred
	                value = {
	                    integer_range = {
	                        min = 5
	                        max = 25
	                    }
	                }
	            }
				remove_character_flag = will_get_scar
			}
		}
	}
}


#Recover from being severely injured
health.0002 = {
	type = character_event
	title = health.0002.t
	desc = health.0002.desc
	theme = recovery
	left_portrait = {
		character = root
		animation = sick
	}

	trigger = {
		has_trait = wounded_2
	}

	weight_multiplier = {
		base = 1
		compare_modifier = {
			value = age
			multiplier = -0.01
			min = -0.9
		}
		compare_modifier = {
			value = stress
			offset = -25
			multiplier = -0.005
		}
		modifier = {
			add = -0.2
			has_character_modifier = infected_wound_modifier
		}
	}

	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		hidden_effect = {
			random = {
				chance = 20
				add_character_flag = will_get_scar #This flag is checked when wounded_1 heals
			}
		}
		if = {
			limit = { has_character_modifier = infected_wound_modifier }
			random = {
				chance = 50
				remove_character_modifier = infected_wound_modifier
			}
		}
		show_as_tooltip = { remove_trait_force_tooltip = wounded_2 }
		change_trait_rank = {
			trait = wounded
			rank = -1
			max = 1
		}
	}

	option = {
		name = health.0002.a
	}
}


#Recover from being near death
health.0003 = {
	type = character_event
	title = health.0003.t
	desc = health.0003.desc
	theme = recovery
	left_portrait = {
		character = root
		animation = severelywounded
	}

	trigger = {
		has_trait_rank = {
			trait = wounded
			rank > 2
		}
	}

	weight_multiplier = {
		base = 1
		compare_modifier = {
			value = age
			multiplier = -0.01
			min = -0.9
		}
		compare_modifier = {
			value = stress
			offset = -25
			multiplier = -0.005
		}
		modifier = {
			add = -0.2
			has_character_modifier = infected_wound_modifier
		}
	}

	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		hidden_effect = {
			random = {
				chance = 20
				add_character_flag = will_get_scar #This flag is checked when wounded_1 heals
			}
		}
		if = {
			limit = { has_character_modifier = infected_wound_modifier }
			random = {
				chance = 50
				remove_character_modifier = infected_wound_modifier
			}
		}
		show_as_tooltip = { remove_trait_force_tooltip = wounded_3 }
		change_trait_rank = {
			trait = wounded
			rank = -1
		}
	}

	option = {
		name = health.0003.a
	}
}


#Recover from your wound being infected
health.0004 = {
	type = character_event
	title = health.0004.t
	desc = health.0004.desc
	theme = recovery
	left_portrait = {
		character = root
		animation = sick
	}

	trigger = {
		has_character_modifier = infected_wound_modifier
		NOT = { is_in_prison_type = dungeon } #Special dungeon event for this.
	}

	weight_multiplier = {
		base = 1
		compare_modifier = {
			value = age
			multiplier = -0.01
			min = -0.9
		}
		compare_modifier = {
			value = stress
			offset = -25
			multiplier = -0.005
		}
	}

	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		remove_character_modifier = infected_wound_modifier
		add_character_flag = {
			flag = recently_recovered_from_infection
			days = 730
		}
	}

	option = {
		name = health.0004.a
	}
}


##################
# BECOME WOUNDED
##################

#Wounded 1 - Successful treatment
health.0100 = {
	hidden = yes

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = court_physician }

		if = {
			limit = { exists = scope:court_physician }
			send_interface_toast = {
				type = event_court_physician_good
				left_icon = scope:court_physician
				title = health.wounded_1_success

				wound_treatment_results_effect = { TREATMENT = safe OUTCOME = success }
			}
		}
	}
}

#Wounded 1 - Failed treatment
health.0101 = {
	hidden = yes

	immediate = {
		save_court_physician_as_effect = { SCOPE_NAME = court_physician }

		if = {
			limit = { exists = scope:court_physician }

			send_interface_message = {
				type = event_court_physician_bad
				left_icon = scope:court_physician
				title = health.wounded_1_failure

				wound_treatment_results_effect = { TREATMENT = safe OUTCOME = failure }
			}
		}
	}
}

#Wounded 2
scripted_trigger health_event_is_worried_trigger = {
	OR = {
		ai_compassion >= medium_positive_ai_value
		dread_modified_ai_boldness = {
			dreaded_character = $CHARACTER$
			value <= medium_negative_ai_value
		}
		has_relation_friend = $CHARACTER$
		has_relation_lover = $CHARACTER$
		opinion = {
			target = $CHARACTER$
			value >= high_positive_opinion
		}
	}
	$CHARACTER$.health < fine_health
}

health.0102 = {
	type = character_event
	title = health.0102.t
	desc = {
		desc = health.0102.desc
		triggered_desc = {
			trigger = {
				court_physician_available_trigger = yes
				liege_picks_treatment_trigger = no
			}
			desc = health.0102.court_physician.desc
		}
	}
	theme = healthcare

	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = severelywounded
	}
	right_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = root } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_scope_as = sick_character
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		show_as_tooltip = {
			add_trait_force_tooltip = wounded_2
		}
	}

	#Find physician
	option = {
		trigger = {
			NOT = { exists = scope:physician }
			is_playable_character = yes
			is_travelling = no
		}
		name = health.3101.e
		find_court_physician_effect = yes
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
		}
		name = health.0102.a
		if = {
			limit = {
				exists = liege
				liege != root
			}
			liege = { trigger_event = health.4000 }
		}
		ai_chance = { base = 1 }
	}

	###PHYSICAIN OPTIONS###
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
		}
		name = health.3101.a
		safe_wound_treatment_effect = yes
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
		}
		name = health.3101.b
		risky_wound_treatment_effect = yes
		ai_chance = { base = 1 }
	}

	#No treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
		}
		name = health.3101.d
		no_disease_treatment_effect = yes
		ai_chance = { base = 0 }
	}
}

#Wounded 3
health.0104 = {
	type = character_event
	title = health.0104.t
	desc = {
		desc = health.0104.desc
		triggered_desc = {
			trigger = {
				court_physician_available_trigger = yes
				liege_picks_treatment_trigger = no
			}
			desc = health.0104.court_physician.desc
		}
	}
	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = severelywounded
	}
	right_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = root } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_scope_as = sick_character
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		show_as_tooltip = {
			add_trait_force_tooltip = wounded_3
		}
	}

	###NON-PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			NOT = { exists = scope:physician }
			is_playable_character = yes
		}
		name = health.3101.e
		find_court_physician_effect = yes
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
		}
		name = health.0104.a
		if = {
			limit = {
				exists = liege
				liege != root
			}
			liege = { trigger_event = health.4000 }
		}
		ai_chance = { base = 1 }
	}

	###PHYSICIAN OPTIONS###

	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
		}
		name = health.3101.a
		safe_wound_treatment_effect = yes
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
		}
		name = health.3101.b
		risky_wound_treatment_effect = yes
		ai_chance = { base = 1 }
	}

	#No treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
		}
		name = health.3101.d
		no_disease_treatment_effect = yes
		ai_chance = { base = 0 }
	}
}



#######################
# INFECTION/GANGERENE
#######################

#Your wound becomes infected, notification or event?
health.0201 = {
	hidden = yes

	trigger = {
		has_trait_rank = {
			trait = wounded
			rank >= 1
		}
	}

	immediate = {
		save_scope_as = sick_character
		if = {
			limit = {
				has_recent_wound_treatment_trigger = yes
			}
			#Notification message if you're already being treated for wounds
			send_interface_toast = {
				type = event_court_physician_bad
				title = health.0201.desc
				left_icon = scope:physician

				add_character_modifier = {
					modifier = infected_wound_modifier
				}
			}
		}
		else = {
			#A "real" event if you're not receiving treatment
			trigger_event = health.0202
		}

		#Extra fun: gangrene!
		random = {
			chance = 10
			trigger_event = {
				id = health.0203
				days = { 60 90 }
			}
		}
	}
}

#Your wounds have become infected!
health.0202 = {
	type = character_event
	title = health.0202.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { probably_unintelligent_trigger = yes }
				desc = health.0202.unintelligent
			}
			desc = health.0202.desc
		}
		triggered_desc = {
			trigger = {
				court_physician_available_trigger = yes
				liege_picks_treatment_trigger = no
			}
			desc = health.0202.court_physician.desc
		}
	}
	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_trait = wounded_3 }
			animation = severelywounded
		}
		animation = sick
	}
	right_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = root } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	trigger = {
		has_trait_rank = {
			trait = wounded
			rank > 0
		}
		NOT = { has_character_modifier = infected_wound_modifier }
		NOT = { has_character_flag = recently_recovered_from_infection }
		NOT = { is_in_prison_type = dungeon } #Special dungeon event for this.
	}

	weight_multiplier = {
		base = 1
		compare_modifier = {
			value = stress
			offset = -25
			multiplier = -0.005
		}
		modifier = {
			add = 0.5
			has_trait_rank = {
				trait = wounded
				rank > 1
			}
		}
		modifier = {
			add = 0.5
			has_trait_rank = {
				trait = wounded
				rank > 2
			}
		}
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		add_character_modifier = {
			modifier = infected_wound_modifier
		}
	}

	###NO PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			NOT = { exists = scope:physician }
			is_playable_character = yes
		}
		name = health.3101.e
		find_court_physician_effect = yes
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
		}
		name = health.0202.a
		if = {
			limit = {
				exists = liege
				liege != root
			}
			liege = { trigger_event = health.4000 }
		}
		ai_chance = { base = 1 }
	}

	#PHYSICIAN OPTIONS
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
		}
		name = health.3101.a
		safe_wound_treatment_effect = yes
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
		}
		name = health.3101.b
		risky_wound_treatment_effect = yes
		ai_chance = { base = 1 }
	}

	#No treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
		}
		name = health.3101.d
		no_disease_treatment_effect = yes
		ai_chance = { base = 0 }
	}


}

#Gangrene! Event or notification?
health.0203 = {
	hidden = yes

	trigger = {
		has_character_modifier = infected_wound_modifier
	}

	immediate = {
		save_scope_as = sick_character
		if = {
			limit = {
				has_recent_wound_treatment_trigger = yes
			}
			#Notification message if you're already being treated for wounds
			send_interface_toast = {
				type = event_court_physician_bad
				title = health.0203.desc
				left_icon = scope:physician
				remove_character_modifier = infected_wound_modifier
				add_character_modifier = gangrene_modifier
			}
		}
		else = {
			#A "real" event if you're not receiving treatment
			trigger_event = health.0204
		}
	}
}

#You've contracted gangrene!
health.0204 = {
	type = character_event
	title = health.0204.t
	desc = {
		desc = health.0204.desc
		triggered_desc = {
			trigger = {
				court_physician_available_trigger = yes
				liege_picks_treatment_trigger = no
			}
			desc = health.0204.court_physician.desc
		}
	}

	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = root } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	trigger = {
		has_trait_rank = {
			trait = wounded
			rank > 0
		}
		NOT = { has_character_modifier = gangrene_modifier }
	}

	weight_multiplier = {
		base = 0.5
		compare_modifier = {
			value = stress
			offset = -25
			multiplier = -0.005
		}
		modifier = {
			add = 0.5
			has_trait_rank = {
				trait = wounded
				rank > 1
			}
		}
		modifier = {
			add = 0.5
			has_trait_rank = {
				trait = wounded
				rank > 2
			}
		}
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		add_character_modifier = {
			modifier = gangrene_modifier
		}
		remove_character_modifier = infected_wound_modifier
	}

	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			NOT = { exists = scope:physician }
			is_playable_character = yes
		}
		name = health.3101.e
		find_court_physician_effect = yes
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
		}
		name = health.0202.a
		if = {
			limit = {
				exists = liege
				liege != root
			}
			liege = { trigger_event = health.4000 }
		}
		ai_chance = { base = 1 }
	}

	###COURT PHYSICIAN OPTIONS###
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
		}
		name = health.3101.a
		safe_wound_treatment_effect = yes
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
		}
		name = health.3101.b
		risky_wound_treatment_effect = yes
		ai_chance = { base = 1 }
	}

	#No treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
		}
		name = health.3101.d
		no_disease_treatment_effect = yes
		ai_chance = { base = 0 }
	}


}


##################
##################
# DISEASE EVENTS #
##################
##################

##############################
# CONTRACTING DISEASE EVENTS # Mathilda Bjarnehed & Veronica Pazos
##############################
#For outbreaks, contagion and scripted effects

#You become ill
health.1001 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					involved_activity ?= { has_activity_type = activity_pilgrimage }
				}
				desc = pilgrimage.0041.t
			}
			triggered_desc = {
				trigger = { is_travelling = yes }
				desc = health.travel.t
			}
			desc = health.1001.t
		}
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					involved_activity ?= { has_activity_type = activity_pilgrimage }
				}
				desc = pilgrimage.0041.desc
			}
			triggered_desc = {
				trigger = {
					trigger_if = {
						limit = { exists = involved_activity }
						NOT = {
							involved_activity = { has_activity_type = activity_pilgrimage }
						}
					}
					trigger_else = { always = yes }
				}
				desc = health.1001.desc
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					court_physician_available_trigger = no
				}
				desc = health.1001.nophysician.desc
			}
			triggered_desc = {
				trigger = {
					court_physician_available_trigger = yes
				}
				desc = health.1001.court_physician.desc
			}
		}
	}
	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}
	override_background = {
		trigger = { is_travelling = no }
		reference = bedchamber
	}
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		trigger = {
			trigger_if = {
				limit = { is_travelling = yes }
				current_travel_plan = {
					any_entourage_character = {
						has_court_position = court_physician_court_position
					}
				}
			}
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = root } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	trigger = {
		can_contract_disease_trigger = { DISEASE = ill }
	}

	weight_multiplier = {
		base = 1

		modifier = {
			is_adult = no
			factor = 1.5
		}
		modifier = {
			health <= fine_health
			factor = 1.1
		}
		modifier = {
			health <= poor_health
			factor = 1.1
		}
		# Difficulty and Game Rules make the generic 'Ill' slightly more common
		modifier = { # Difficulty
			is_ai = no
			has_game_rule = easy_difficulty
			factor = 1.1
		}
		modifier = {
			is_ai = no
			has_game_rule = very_easy_difficulty
			factor = 1.5
		}
		modifier = {
			is_ai = yes
			has_game_rule = easy_difficulty
			any_parent = {
				is_ai = no
			}
			factor = 1.1
		}
		modifier = {
			is_ai = no
			has_game_rule = very_easy_difficulty
			any_parent = {
				is_ai = no
			}
			factor = 1.5
		}
		modifier = { # Game Rule
			has_game_rule = fewer_minor_disease_frequency
			factor = 1.2
		}
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = no } #Adds the trait, sends event "health.2201" to those who care if health is brought too low
	}
	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			# can't hire a court physician while you're traveling
			is_travelling = no
			NOT = { exists = scope:physician }
			is_playable_character = yes
		}
		name = health.3101.e
		find_court_physician_effect = yes
		ai_chance = { base = 5 }
	}
	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
		}
		name = health.1001.a
		ai_chance = { base = 1 }
	}
	### TRAVEL- GO HOME
	option = {
		name = health.travel.option.home
		name = {
			trigger = {
				involved_activity ?= { has_activity_type = activity_pilgrimage }
			}
			text = pilgrimage.0041.b
		}
		flavor = health.travel.option.home.flavor
		trigger = {
			is_travelling = yes
			current_travel_plan = {
				travel_plan_owner = root
			}
			involved_activity ?= {
				NOR = {
					has_activity_type = activity_tour
					is_required_special_guest = root
				}
			}
		}
		#Go back home, damnit
		if = {
			limit = {
				involved_activity ?= { has_activity_type = activity_pilgrimage }
			}
			#Removed in the on_travel_plan_complete on_action
			set_variable = {
				name = pilgrimage_invalidated_illness
				value = involved_activity.activity_location
			}
		}
		#current_travel_plan = { cancel_travel_plan = yes }
		ai_chance = { # Adventurers never cancel
			base = 1
			modifier = {
				has_government = landless_adventurer_government
				factor = 0
			}
		}
	}
	###COURT PHYSICIAN OPTIONS###
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.a
		safe_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}
	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.b
		risky_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}
	#Mystic treatment
	option = {
		trigger = {
			court_physician_available_trigger = yes
			liege_picks_treatment_trigger = no
			scope:physician = { has_trait = lifestyle_mystic }
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.c
		mystic_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}
	#No treatment
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							involved_activity ?= { has_activity_type = activity_pilgrimage }
						}
						desc = pilgrimage.0041.a
					}
					triggered_desc = {
						trigger = { is_travelling = yes }
						desc = health.travel.option.continue
					}
					desc = health.3101.d
				}
			}
		}
		if = {
			limit = {
				involved_activity ?= { has_activity_type = activity_pilgrimage }
			}
			custom_tooltip = pilgrimage.0041.a.tt
		}
		if = {
			limit = {
				exists = scope:physician
				liege_picks_treatment_trigger = no
				court_physician_available_when_traveling_trigger = yes
			}
			no_disease_treatment_effect = yes
		}
		if = {
			limit = {
				has_global_variable = tutorial_completed
			}
			hidden_effect = {
				if = {
					limit = {
						has_global_variable = tutorial_completed
					}
					add_character_flag = force_court_positions_tutorial
				}
			}
		}
		ai_chance = { base = 0 }
	}

}


#You become pneumonic
health.1002 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { is_travelling = yes }
				desc = health.travel.t
			}
			desc = health.1002.t
		}
	}
	desc = {
		desc = health.1002.desc
		triggered_desc = {
			trigger = {
				court_physician_available_trigger = yes
				liege_picks_treatment_trigger = no
			}
			desc = health.1002.court_physician.desc
		}
	}

	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		character = scope:physician
		trigger = {
			trigger_if = {
				limit = { is_travelling = yes }
				current_travel_plan = {
					any_entourage_character = {
						has_court_position = court_physician_court_position
					}
				}
			}
		}
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = root } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}

	trigger = {
		can_contract_disease_trigger = { DISEASE = pneumonic }
	}

	weight_multiplier = {
		base = 1

		modifier = {
			has_trait = ill
			factor = 35
		}
		modifier = {
			is_adult = no
			factor = 2
		}
		modifier = {
			health <= fine_health
			factor = 1.1
		}
		modifier = {
			health <= poor_health
			factor = 1.1
		}
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		contract_disease_effect = { DISEASE = pneumonic TREATMENT_EVENT = no } #Adds the trait (and removes ill if present), sends event "health.2201" to those who care
	}

	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			NOT = { exists = scope:physician }
			is_playable_character = yes
			is_travelling = no
		}
		name = health.3101.e
		find_court_physician_effect = yes
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
		}
		name = health.1002.a
		ai_chance = { base = 1 }
	}
	### TRAVEL- GO HOME
	option = {
		name = health.travel.option.home
		flavor = health.travel.option.home.flavor
		trigger = {
			is_travelling = yes
			current_travel_plan ={
				travel_plan_owner = root
				can_cancel = yes
			}
			involved_activity ?= {
				NOR = {
					has_activity_type = activity_tour
					is_required_special_guest = root
				}
			}
		}
		current_travel_plan = {
			if = {
				limit = { can_cancel = yes }
				cancel_travel_plan = yes
			}
		}
		ai_chance = { base = 1 }
	}
	###COURT PHYSICIAN OPTIONS###
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.a
		safe_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.b
		risky_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic treatment
	option = {
		trigger = {
			court_physician_available_trigger = yes
			liege_picks_treatment_trigger = no
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = health.3101.c
		mystic_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { is_travelling = yes }
						desc = health.travel.option.continue
					}
					desc = health.3101.d
				}
			}
		}
		if = {
			limit = {
				exists = scope:physician
				liege_picks_treatment_trigger = no
				court_physician_available_when_traveling_trigger = yes
			}
			no_disease_treatment_effect = yes
		}
		ai_chance = { base = 0 }
	}
}


#You become gout-ridden
health.1003 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { is_travelling = yes }
				desc = health.travel.t
			}
			desc = health.1003.t
		}
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					court_owner = { exists = yes }
					root.court_owner = root
					court_owner = {
						has_royal_court = yes
						amenity_level = { target = court_food_quality value >= 3 }
					}
					is_travelling = no
				}
				desc = health.1003.court_amenities_gout.desc
			}
			desc = health.1003.desc
		}

		triggered_desc = {
			trigger = {
				court_physician_available_trigger = yes
				liege_picks_treatment_trigger = no
			}
			desc = health.1003.court_physician.desc
		}
	}
	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		trigger = {
			trigger_if = {
				limit = { is_travelling = yes }
				current_travel_plan = {
					any_entourage_character = {
						has_court_position = court_physician_court_position
					}
				}
			}
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = root } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}

	trigger = {
		can_contract_disease_trigger = { DISEASE = gout_ridden }
	}

	weight_multiplier = {
		base = 1

		modifier = {
			age < 60
			factor = 0.5
		}
		modifier = {
			age < 50
			factor = 0.5
		}
		modifier = {
			age < 40
			factor = 0.5
		}
		modifier = {
			health >= good_health
			factor = 0.5
		}
		modifier = {
			has_trait = temperate
			factor = 0.8
		}
		modifier = {
			has_character_modifier = obese_modifier
			factor = 1.5
		}
		modifier = {
			any_parent = {
				has_trait = gout_ridden
			}
			factor = 1.5
		}
		modifier = {
			current_weight > 50
			factor = 1.1
		}
		modifier = {
			current_weight > 80
			factor = 1.1
		}
		modifier = {
			court_owner ?= {
				has_royal_court = yes
				amenity_level = { target = court_food_quality value = 3 }
			}
			factor = 1.1
		}
		modifier = {
			court_owner ?= {
				has_royal_court = yes
				amenity_level = { target = court_food_quality value = 4 }
			}
			factor = 1.3
		}
		modifier = {
			court_owner ?= {
				has_royal_court = yes
				amenity_level = { target = court_food_quality value = 5 }
			}
			factor = 1.5
		}
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		contract_disease_effect = { DISEASE = gout_ridden TREATMENT_EVENT = no } #Adds the trait, sends event "health.2201" to those who care if health is brought too low
	}

	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			NOT = { exists = scope:physician }
			is_playable_character = yes
		}
		name = health.3101.e
		find_court_physician_effect = yes
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
		}
		name = health.1003.a
		ai_chance = { base = 1 }
	}
	### TRAVEL- GO HOME
	option = {
		name = health.travel.option.home
		flavor = health.travel.option.home.flavor
		trigger = {
			is_travelling = yes
			current_travel_plan ={
				travel_plan_owner = root
				can_cancel = yes
			}
			involved_activity ?= {
				NOR = {
					has_activity_type = activity_tour
					is_required_special_guest = root
				}
			}
		}
		current_travel_plan = { 
			if = {
				limit = { can_cancel = yes }
				cancel_travel_plan = yes
			}
		}
		ai_chance = { base = 1 }
	}
	###COURT PHYSICIAN OPTIONS###
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.a
		safe_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.b
		risky_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic treatment
	option = {
		trigger = {
			court_physician_available_trigger = yes
			liege_picks_treatment_trigger = no
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = health.3101.c
		mystic_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { is_travelling = yes }
						desc = health.travel.option.continue
					}
					desc = health.3101.d
				}
			}
		}
		if = {
			limit = {
				exists = scope:physician
				liege_picks_treatment_trigger = no
				court_physician_available_when_traveling_trigger = yes
			}
			no_disease_treatment_effect = yes
		}
		ai_chance = { base = 0 }
	}
}


#You become leper
health.1004 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { is_travelling = yes }
				desc = health.travel.t
			}
			desc = health.1004.t
		}
	}
	desc = {
		desc = health.1004.desc
		triggered_desc = {
			trigger = {
				court_physician_available_trigger = yes
				liege_picks_treatment_trigger = no
			}
			desc = health.1004.court_physician.desc
		}
	}
	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = shame
	}
	right_portrait = {
		trigger = {
			trigger_if = {
				limit = { is_travelling = yes }
				current_travel_plan = {
					any_entourage_character = {
						has_court_position = court_physician_court_position
					}
				}
			}
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = root } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}

	trigger = {
		can_contract_disease_trigger = { DISEASE = leper }
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		contract_disease_effect = { DISEASE = leper TREATMENT_EVENT = no } #Adds the trait, sends event "health.2201" to those who care
	}

	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			NOT = { exists = scope:physician }
			is_playable_character = yes
			is_travelling = no
		}
		name = health.3101.e
		find_court_physician_effect = yes
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
		}
		name = health.1004.a
		ai_chance = { base = 1 }
	}
	### TRAVEL- GO HOME
	option = {
		name = health.travel.option.home
		flavor = health.travel.option.home.flavor
		trigger = {
			is_travelling = yes
			current_travel_plan ={
				travel_plan_owner = root
				can_cancel = yes
			}
			involved_activity ?= {
				NOR = {
					has_activity_type = activity_tour
					is_required_special_guest = root
				}
			}
		}
		current_travel_plan = { 
			if = {
				limit = { can_cancel = yes }
				cancel_travel_plan = yes
			}
		}
		ai_chance = { base = 1 }
	}
	###COURT PHYSICIAN OPTIONS###
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.a
		safe_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.b
		risky_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic treatment
	option = {
		trigger = {
			court_physician_available_trigger = yes
			liege_picks_treatment_trigger = no
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = health.3101.c
		mystic_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { is_travelling = yes }
						desc = health.travel.option.continue
					}
					desc = health.3101.d
				}
			}
		}
		if = {
			limit = {
				exists = scope:physician
				liege_picks_treatment_trigger = no
				court_physician_available_when_traveling_trigger = yes
			}
			no_disease_treatment_effect = yes
		}
		ai_chance = { base = 0 }
	}
}


#You contract typhus
health.1005 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { is_travelling = yes }
				desc = health.travel.t
			}
			desc = health.1005.t
		}
	}
	desc = {
		desc = health.1005.desc
		triggered_desc = {
			trigger = {
				court_physician_available_trigger = yes
				liege_picks_treatment_trigger = no
			}
			desc = health.1005.court_physician.desc
		}
	}

	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		trigger = {
			trigger_if = {
				limit = { is_travelling = yes }
				current_travel_plan = {
					any_entourage_character = {
						has_court_position = court_physician_court_position
					}
				}
			}
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = root } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}

	trigger = {
		can_contract_disease_trigger = { DISEASE = typhus }
	}

	weight_multiplier = {
		base = 1

		modifier = {
			is_commanding_army = yes
			is_knight = yes
			factor = 7
		}
		modifier = {
			health <= fine_health
			factor = 1.1
		}
		modifier = {
			health <= poor_health
			factor = 1.1
		}
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		contract_disease_effect = { DISEASE = typhus TREATMENT_EVENT = no } #Adds the trait, sends event "health.2201" to those who care
	}

	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			NOT = { exists = scope:physician }
			is_playable_character = yes
			is_travelling = no
		}
		name = health.3101.e
		find_court_physician_effect = yes
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
		}
		name = health.1005.a
		ai_chance = { base = 1 }
	}
	### TRAVEL- GO HOME
	option = {
		name = health.travel.option.home
		flavor = health.travel.option.home.flavor
		trigger = {
			is_travelling = yes
			current_travel_plan ={
				travel_plan_owner = root
				can_cancel = yes
			}
			involved_activity ?= {
				NOR = {
					has_activity_type = activity_tour
					is_required_special_guest = root
				}
			}
		}
		current_travel_plan = { 
			if = {
				limit = { can_cancel = yes }
				cancel_travel_plan = yes
			}
		}
		ai_chance = { base = 1 }
	}
	###COURT PHYSICIAN OPTIONS###
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.a
		safe_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.b
		risky_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic treatment
	option = {
		trigger = {
			court_physician_available_trigger = yes
			liege_picks_treatment_trigger = no
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = health.3101.c
		mystic_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { is_travelling = yes }
						desc = health.travel.option.continue
					}
					desc = health.3101.d
				}
			}
		}
		if = {
			limit = {
				exists = scope:physician
				liege_picks_treatment_trigger = no
				court_physician_available_when_traveling_trigger = yes
			}
			no_disease_treatment_effect = yes
		}
		ai_chance = { base = 0 }
	}
}


#You contract consumption
health.1006 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { is_travelling = yes }
				desc = health.travel.t
			}
			desc = health.1006.t
		}
	}
	desc = {
		desc = health.1006.desc
		triggered_desc = {
			trigger = {
				court_physician_available_trigger = yes
				liege_picks_treatment_trigger = no
			}
			desc = health.1006.court_physician.desc
		}
	}

	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		trigger = {
			trigger_if = {
				limit = { is_travelling = yes }
				current_travel_plan = {
					any_entourage_character = {
						has_court_position = court_physician_court_position
					}
				}
			}
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = root } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}

	trigger = {
		can_contract_disease_trigger = { DISEASE = consumption }
	}

	weight_multiplier = {
		base = 1

		modifier = {
			health <= fine_health
			factor = 1.1
		}
		modifier = {
			health <= poor_health
			factor = 1.1
		}
		modifier = {
			is_adult = no
			factor = 1.3
		}
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		contract_disease_effect = { DISEASE = consumption TREATMENT_EVENT = no } #Adds the trait, sends event "health.2201" to those who care
	}

	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			NOT = { exists = scope:physician }
			is_playable_character = yes
			is_travelling = no
		}
		name = health.3101.e
		find_court_physician_effect = yes
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
		}
		name = health.1006.a
		ai_chance = { base = 1 }
	}
	### TRAVEL- GO HOME
	option = {
		name = health.travel.option.home
		flavor = health.travel.option.home.flavor
		trigger = {
			is_travelling = yes
			current_travel_plan ={
				travel_plan_owner = root
				can_cancel = yes
			}
			involved_activity ?= {
				NOR = {
					has_activity_type = activity_tour
					is_required_special_guest = root
				}
			}
		}
		current_travel_plan = { 
			if = {
				limit = { can_cancel = yes }
				cancel_travel_plan = yes
			}
		}
		ai_chance = { base = 1 }
	}
	###COURT PHYSICIAN OPTIONS###
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.a
		safe_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.b
		risky_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic treatment
	option = {
		trigger = {
			court_physician_available_trigger = yes
			liege_picks_treatment_trigger = no
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = health.3101.c
		mystic_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { is_travelling = yes }
						desc = health.travel.option.continue
					}
					desc = health.3101.d
				}
			}
		}
		if = {
			limit = {
				exists = scope:physician
				liege_picks_treatment_trigger = no
				court_physician_available_when_traveling_trigger = yes
			}
			no_disease_treatment_effect = yes
		}
		ai_chance = { base = 0 }
	}
}


#You develop cancer
health.1007 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { is_travelling = yes }
				desc = health.travel.t
			}
			desc = health.1007.t
		}
	}
	desc = {
		desc = health.1007.desc
		triggered_desc = {
			trigger = {
				court_physician_available_trigger = yes
				liege_picks_treatment_trigger = no
			}
			desc = health.1007.court_physician.desc
		}
	}
	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		trigger = {
			trigger_if = {
				limit = { is_travelling = yes }
				current_travel_plan = {
					any_entourage_character = {
						has_court_position = court_physician_court_position
					}
				}
			}
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = root } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}

	trigger = {
		can_contract_disease_trigger = { DISEASE = cancer }
	}

	weight_multiplier = {
		base = 1

		modifier = { #Children almost never have it
			age < 25
			factor = 0.1
		}
		modifier = { #Very uncommon before 30
			age >= 25
			age < 35
			factor = 0.3
		}
		modifier = { #Increasingly common after 55
			is_male = yes
			age > 55 #Males have a higher risk later in life
			factor = 3
		}
		modifier = { #Increasingly common after 55
			age >= 55
			is_female = yes
			factor = 2
		}
		modifier = { #Increasingly common after 65
			age >= 60
			factor = 2
		}
		modifier = { #Increasingly common after 70
			age >= 70
			factor = 2
		}
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		contract_disease_effect = { DISEASE = cancer TREATMENT_EVENT = no } #Adds the trait, sends event "health.2201" to those who care
	}

	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			NOT = { exists = scope:physician }
			is_playable_character = yes
			is_travelling = no
		}
		name = health.3101.e
		find_court_physician_effect = yes
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
		}
		name = health.1007.a
		ai_chance = { base = 1 }
	}
	### TRAVEL- GO HOME
	option = {
		name = health.travel.option.home
		flavor = health.travel.option.home.flavor
		trigger = {
			is_travelling = yes
			current_travel_plan ={
				travel_plan_owner = root
				can_cancel = yes
			}
			involved_activity ?= {
				NOR = {
					has_activity_type = activity_tour
					is_required_special_guest = root
				}
			}
		}
		current_travel_plan = { 
			if = {
				limit = { can_cancel = yes }
				cancel_travel_plan = yes
			}
		}
		ai_chance = { base = 1 }
	}
	###COURT PHYSICIAN OPTIONS###
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.a
		safe_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.b
		risky_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic treatment
	option = {
		trigger = {
			court_physician_available_trigger = yes
			liege_picks_treatment_trigger = no
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = health.3101.c
		mystic_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { is_travelling = yes }
						desc = health.travel.option.continue
					}
					desc = health.3101.d
				}
			}
		}
		if = {
			limit = {
				exists = scope:physician
				liege_picks_treatment_trigger = no
				court_physician_available_when_traveling_trigger = yes
			}
			no_disease_treatment_effect = yes
		}
		ai_chance = { base = 0 }
	}
}


#You contract lover's pox
health.1008 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { is_travelling = yes }
				desc = health.travel.t
			}
			desc = health.1008.t
		}
	}
	desc = health.1008.desc
	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}

	left_portrait = {
		character = root
		animation = anger
	}
	right_portrait = scope:infecting_partner

	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}

	trigger = {
		can_contract_disease_trigger = { DISEASE = lovers_pox }
	}

	weight_multiplier = {
		base = 1

		modifier = { #Shouldn't appear randomly for player characters, children, celibate characters etc.
			OR = {
				is_ai = no
				any_spouse = {
					is_ai = no
				}
				any_relation = {
					type = lover
					is_ai = no
				}
				is_adult = no
				has_trait = celibate
				has_sexuality = asexual
			}
			factor = 0
		}
		modifier = {
			has_trait = lustful
			factor = 3
		}
		modifier = {
			has_trait = chaste
			factor = 0.2
		}
		modifier = {
			has_trait = seducer
			factor = 2
		}
		modifier = {
			has_trait = lifestyle_reveler
			factor = 1.5
		}
	}

	immediate = {
		contract_disease_effect = { DISEASE = lovers_pox TREATMENT_EVENT = no } #Adds the trait, sends event "health.2001" to sexual partners, sends event "health.2201" to those who care if health is brought too low
	}

	#Note: no treatment for lover's pox

	option = {
		name = {
			trigger = { exists = scope:infecting_partner }
			text = health.1008.partner.a
		}
		name = {
			trigger = { NOT = { exists = scope:infecting_partner } }
			text = health.1008.no_partner.a
		}
	}
	### TRAVEL- GO HOME
	option = {
		name = health.travel.option.home
		flavor = health.travel.option.home.flavor
		trigger = {
			is_travelling = yes
			current_travel_plan ={
				travel_plan_owner = root
				can_cancel = yes
			}
			involved_activity ?= {
				NOR = {
					has_activity_type = activity_tour
					is_required_special_guest = root
				}
			}
		}
		current_travel_plan = { 
			if = {
				limit = { can_cancel = yes }
				cancel_travel_plan = yes
			}
		}
		ai_chance = { base = 1 }
	}
	### TRAVEL - TRUDGE ON
	option = {
		name = health.travel.option.continue
		trigger = {
			is_travelling = yes
		}
		ai_chance = { base = 1 }
	}
}

#Infection with Great Pox. Will give early great pox hidden as lover's pox, unless you already have lover's pox
health.1009 = {
	hidden = yes

	trigger = {
		can_contract_disease_trigger = { DISEASE = great_pox }
		NOR = {
			has_trait = early_great_pox
			has_trait = great_pox
		}
	}

	weight_multiplier = {
		base = 1

		modifier = { #Shouldn't appear randomly for player characters, children, celibate characters etc.
			OR = {
				is_ai = no
				any_spouse = {
					is_ai = no
				}
				any_relation = {
					type = lover
					is_ai = no
				}
				is_adult = no
				has_trait = celibate
				has_sexuality = asexual
			}
			factor = 0
		}
		modifier = {
			has_trait = lustful
			factor = 3
		}
		modifier = {
			has_trait = chaste
			factor = 0.2
		}
		modifier = {
			has_trait = seducer
			factor = 2
		}
		modifier = {
			has_trait = lifestyle_reveler
			factor = 1.5
		}
	}

	immediate = {
		if = {
			limit = { NOT = { has_trait = lovers_pox } }
			trigger_event = health.1012 #early_great_pox
		}
		else = {
			add_trait = early_great_pox #so it will be upgraded
			trigger_event = health.1013 #great_pox
		}
	}
}


#You contract great pox (hidden as lover's pox)
health.1012 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { is_travelling = yes }
				desc = health.travel.t
			}
			desc = health.1008.t
		}
	}
	desc = health.1008.desc
	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = anger
	}
	right_portrait = scope:infecting_partner

	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}

	trigger = {
		can_contract_disease_trigger = { DISEASE = great_pox }
		NOR = {
			has_trait = early_great_pox
			has_trait = great_pox
			has_trait = lovers_pox
		}
	}

	immediate = {
		contract_disease_effect = { DISEASE = great_pox TREATMENT_EVENT = no } #Adds the trait early_great_pox, great pox reveal event "health.1013" will be sent in 60-150 days, sends event "health.2001" to sexual partners, sends event "health.2201" to those who care if health is brought too low
	}

	#Note: no treatment yet, because it appears to be lover's pox

	option = {
		name = {
			trigger = { exists = scope:infecting_partner }
			text = health.1008.partner.a
		}
		name = {
			trigger = { NOT = { exists = scope:infecting_partner } }
			text = health.1008.no_partner.a
		}

		hidden_effect = {
			trigger_event = {
				id = health.1013 #Reveals the true disease
				days = { 60 150 }
			}
		}
	}
	### TRAVEL- GO HOME
	option = {
		name = health.travel.option.home
		flavor = health.travel.option.home.flavor
		trigger = {
			is_travelling = yes
			current_travel_plan ={
				travel_plan_owner = root
				can_cancel = yes
			}
			involved_activity ?= {
				NOR = {
					has_activity_type = activity_tour
					is_required_special_guest = root
				}
			}
		}
		current_travel_plan = { 
			if = {
				limit = { can_cancel = yes }
				cancel_travel_plan = yes
			}
		}
		ai_chance = { base = 1 }
	}
	### TRAVEL - TRUDGE ON
	option = {
		name = health.travel.option.continue
		trigger = {
			is_travelling = yes
		}
		ai_chance = { base = 1 }
	}
}

#"Lover's pox" progresses to Great Pox
health.1013 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { is_travelling = yes }
				desc = health.travel.t
			}
			desc = health.1013.t
		}
	}
	desc = {
		desc = health.1013.desc
		triggered_desc = {
			trigger = {
				court_physician_available_trigger = yes
				liege_picks_treatment_trigger = no
			}
			desc = health.1013.court_physician.desc
		}
	}

	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		trigger = {
			trigger_if = {
				limit = { is_travelling = yes }
				current_travel_plan = {
					any_entourage_character = {
						has_court_position = court_physician_court_position
					}
				}
			}
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = root } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}

	trigger = {
		can_contract_disease_trigger = { DISEASE = great_pox }
		has_trait = early_great_pox
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		contract_disease_effect = { DISEASE = great_pox TREATMENT_EVENT = no } #Adds the trait and removes early_great_pox/lovers_pox, sends event "health.2002" to sexual partners, sends event "health.2201" to those who care

		hidden_effect = {
			trigger_event = {
				id = health.1014
				days = { 1825 5475 }
			}
		}
	}

	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			NOT = { exists = scope:physician }
			is_playable_character = yes
			is_travelling = no
		}
		name = health.3101.e
		find_court_physician_effect = yes
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
		}
		name = {
			trigger = { exists = scope:infecting_partner }
			text = health.1013.partner.a
		}
		name = {
			trigger = { NOT = { exists = scope:infecting_partner } }
			text = health.1013.no_partner.a
		}
		ai_chance = { base = 1 }
	}
	### TRAVEL- GO HOME
	option = {
		name = health.travel.option.home
		flavor = health.travel.option.home.flavor
		trigger = {
			is_travelling = yes
			current_travel_plan ={
				travel_plan_owner = root
				can_cancel = yes
			}
			involved_activity ?= {
				NOR = {
					has_activity_type = activity_tour
					is_required_special_guest = root
				}
			}
		}
		current_travel_plan = { 
			if = {
				limit = { can_cancel = yes }
				cancel_travel_plan = yes
			}
		}
		ai_chance = { base = 1 }
	}
	###COURT PHYSICIAN OPTIONS###
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.a
		safe_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.b
		risky_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic treatment
	option = {
		trigger = {
			court_physician_available_trigger = yes
			liege_picks_treatment_trigger = no
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = health.3101.c
		mystic_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { is_travelling = yes }
						desc = health.travel.option.continue
					}
					desc = health.3101.d
				}
			}
		}
		if = {
			limit = {
				exists = scope:physician
				liege_picks_treatment_trigger = no
				court_physician_available_when_traveling_trigger = yes
			}
			no_disease_treatment_effect = yes
		}
		ai_chance = { base = 0 }
	}
}


#Great pox leads to lunacy
health.1014 = {
	type = character_event
	title = health.1014.t
	desc = health.1014.desc
	theme = mental_health
	left_portrait = {
		character = root
		animation = paranoia
	}

	trigger = {
		has_trait = great_pox
		NOT = { has_trait = lunatic }
	}

	immediate = {
		add_trait = lunatic_1
	}

	option = {
		name = health.1014.a
	}
}

#You contract smallpox
health.1010 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { is_travelling = yes }
				desc = health.travel.t
			}
			desc = health.1010.t
		}
	}
	desc = {
		desc = health.1010.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					court_physician_available_trigger = yes
					liege_picks_treatment_trigger = no
				}
				desc = health.1010.court_physician.desc
			}
			desc = health.1010.end.desc
		}
	}

	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		trigger = {
			trigger_if = {
				limit = { is_travelling = yes }
				current_travel_plan = {
					any_entourage_character = {
						has_court_position = court_physician_court_position
					}
				}
			}
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = root } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}

	trigger = {
		can_contract_disease_trigger = { DISEASE = smallpox }
	}

	weight_multiplier = {
		base = 1

		modifier = {
			health <= fine_health
			factor = 1.1
		}
		modifier = {
			health <= poor_health
			factor = 1.1
		}
		modifier = {
			is_adult = no
			factor = 1.5
		}
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		contract_disease_effect = { DISEASE = smallpox TREATMENT_EVENT = no } #Adds the trait, sends event "health.2101" about contagious disease to liege/host/imprisoner, sends event "health.2201" to those who care
	}

	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			court_physician_available_trigger = no
			is_ruler = yes
			is_travelling = no
		}
		name = health.3101.e
		find_court_physician_effect = yes
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
		}
		name = health.1010.a
		ai_chance = { base = 1 }
	}
	### TRAVEL- GO HOME
	option = {
		name = health.travel.option.home
		flavor = health.travel.option.home.flavor
		trigger = {
			is_travelling = yes
			current_travel_plan ={
				travel_plan_owner = root
				can_cancel = yes
			}
			involved_activity ?= {
				NOR = {
					has_activity_type = activity_tour
					is_required_special_guest = root
				}
			}
		}
		current_travel_plan = { 
			if = {
				limit = { can_cancel = yes }
				cancel_travel_plan = yes
			}
		}
		ai_chance = { base = 1 }
	}
	###COURT PHYSICIAN OPTIONS###
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.a
		safe_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.b
		risky_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic treatment
	option = {
		trigger = {
			court_physician_available_trigger = yes
			liege_picks_treatment_trigger = no
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = health.3101.c
		mystic_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { is_travelling = yes }
						desc = health.travel.option.continue
					}
					desc = health.3101.d
				}
			}
		}
		if = {
			limit = {
				exists = scope:physician
				liege_picks_treatment_trigger = no
				court_physician_available_when_traveling_trigger = yes
			}
			no_disease_treatment_effect = yes
		}
		ai_chance = { base = 0 }
	}
}

#You contract bubonic plague
health.1011 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { is_travelling = yes }
				desc = health.travel.t
			}
			desc = health.1011.t
		}
	}
	desc = {
		desc = health.1011.desc
		triggered_desc = {
			trigger = {
				court_physician_available_trigger = yes
				liege_picks_treatment_trigger = no
			}
			desc = health.1011.court_physician.desc
		}
	}
	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		trigger = {
			root != scope:physician
			trigger_if = {
				limit = { is_travelling = yes }
				current_travel_plan = {
					any_entourage_character = {
						has_court_position = court_physician_court_position
					}
				}
			}
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = scope:sick_character } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}

	trigger = {
		can_contract_disease_trigger = { DISEASE = bubonic_plague }
	}

	weight_multiplier = {
		base = 1

		modifier = {
			health <= fine_health
			factor = 1.1
		}
		modifier = {
			health <= poor_health
			factor = 1.1
		}
		modifier = {
			is_adult = no
			factor = 1.5
		}
		modifier = {
			current_date < 1346.1.1
			factor = 0
		}
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		contract_disease_effect = { DISEASE = bubonic_plague TREATMENT_EVENT = no } #Adds the trait, sends event "health.2101" about contagious disease to liege/host/imprisoner, sends event "health.2201" to those who care
	}

	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			NOT = { exists = scope:physician }
			is_playable_character = yes
			is_imprisoned = no
			is_travelling = no
		}
		name = health.3101.e
		find_court_physician_effect = yes
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
		}
		name = health.1011.a
		ai_chance = { base = 1 }
	}
	### TRAVEL- GO HOME
	option = {
		name = health.travel.option.home
		flavor = health.travel.option.home.flavor
		trigger = {
			is_travelling = yes
			current_travel_plan ={
				travel_plan_owner = root
				can_cancel = yes
			}
			involved_activity ?= {
				NOR = {
					has_activity_type = activity_tour
					is_required_special_guest = root
				}
			}
		}
		current_travel_plan = { 
			if = {
				limit = { can_cancel = yes }
				cancel_travel_plan = yes
			}
		}
		ai_chance = { base = 1 }
	}
	###COURT PHYSICIAN OPTIONS###
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.a
		safe_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.b
		risky_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic treatment
	option = {
		trigger = {
			court_physician_available_trigger = yes
			liege_picks_treatment_trigger = no
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = health.3101.c
		mystic_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { is_travelling = yes }
						desc = health.travel.option.continue
					}
					desc = health.3101.d
				}
			}
		}
		if = {
			limit = {
				exists = scope:physician
				liege_picks_treatment_trigger = no
				court_physician_available_when_traveling_trigger = yes
			}
			no_disease_treatment_effect = yes
		}
		ai_chance = { base = 0 }
	}

	#You're going to rot away in prison most likely
	option = {
		trigger = {
			is_imprisoned = yes
		}
		name = health.3101.f
	}
}

#You contract measles
health.1015 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { is_travelling = yes }
				desc = health.travel.t
			}
			desc = health.1015.t
		}
	}
	desc = {
		desc = health.1015.desc
		triggered_desc = {
			trigger = {
				court_physician_available_trigger = yes
				liege_picks_treatment_trigger = no
			}
			desc = health.1015.court_physician.desc
		}
	}
	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		trigger = {
			root != scope:physician
			trigger_if = {
				limit = { is_travelling = yes }
				current_travel_plan = {
					any_entourage_character = {
						has_court_position = court_physician_court_position
					}
				}
			}
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = scope:sick_character } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}

	trigger = {
		can_contract_disease_trigger = { DISEASE = measles }
	}

	weight_multiplier = {
		base = 1

		modifier = {
			health <= fine_health
			factor = 1.1
		}
		modifier = {
			health <= poor_health
			factor = 1.1
		}
		modifier = {
			is_adult = no
			factor = 1.5
		}
		modifier = {
			current_date < 1346.1.1
			factor = 0
		}
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		contract_disease_effect = { DISEASE = measles TREATMENT_EVENT = no } #Adds the trait, sends event "health.2101" about contagious disease to liege/host/imprisoner, sends event "health.2201" to those who care
	}

	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			NOT = { exists = scope:physician }
			is_playable_character = yes
			is_imprisoned = no
			is_travelling = no
		}
		name = {
			trigger = {
				NOR = {
					has_character_flag = seeking_epidemic_treatment
					has_character_flag = searching_for_physician
				}
			}
			text = health.3101.e
		}
		name = {
			trigger = {
				OR = {
					has_character_flag = seeking_epidemic_treatment
					has_character_flag = searching_for_physician
				}
			}
			text = health.3101.e.already_looking
		}
		if = {
			limit = {
				NOR = {
					has_character_flag = seeking_epidemic_treatment
					has_character_flag = searching_for_physician
				}
			}
			find_court_physician_effect = yes
		}
		else = {
			custom_tooltip = health_3101_already_looking_tt
		}
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
			NOR = {
				has_character_flag = seeking_epidemic_treatment
				has_character_flag = searching_for_physician
			}
		}
		name = health.1015.a
		ai_chance = { base = 1 }
	}
	### TRAVEL- GO HOME
	option = {
		name = health.travel.option.home
		flavor = health.travel.option.home.flavor
		trigger = {
			is_travelling = yes
			current_travel_plan ={
				travel_plan_owner = root
				can_cancel = yes
			}
			involved_activity ?= {
				NOR = {
					has_activity_type = activity_tour
					is_required_special_guest = root
				}
			}
		}
		current_travel_plan = { 
			if = {
				limit = { can_cancel = yes }
				cancel_travel_plan = yes
			}
		}
		ai_chance = { base = 1 }
	}
	###COURT PHYSICIAN OPTIONS###
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.a
		safe_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.b
		risky_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic treatment
	option = {
		trigger = {
			court_physician_available_trigger = yes
			liege_picks_treatment_trigger = no
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = health.3101.c
		mystic_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { is_travelling = yes }
						desc = health.travel.option.continue
					}
					desc = health.3101.d
				}
			}
		}
		if = {
			limit = {
				exists = scope:physician
				liege_picks_treatment_trigger = no
				court_physician_available_when_traveling_trigger = yes
			}
			no_disease_treatment_effect = yes
		}
		ai_chance = { base = 0 }
	}

	#You're going to rot away in prison most likely
	option = {
		trigger = {
			is_imprisoned = yes
		}
		name = health.3101.f
	}
}

#You contract dysentery
health.1016 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { is_travelling = yes }
				desc = health.travel.t
			}
			desc = health.1016.t
		}
	}
	desc = {
		desc = health.1016.desc
		triggered_desc = {
			trigger = {
				court_physician_available_trigger = yes
				liege_picks_treatment_trigger = no
			}
			desc = health.1016.court_physician.desc
		}
	}
	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		trigger = {
			root != scope:physician
			trigger_if = {
				limit = { is_travelling = yes }
				current_travel_plan = {
					any_entourage_character = {
						has_court_position = court_physician_court_position
					}
				}
			}
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = scope:sick_character } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = idle
	}

	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}

	trigger = {
		can_contract_disease_trigger = { DISEASE = dysentery }
	}

	weight_multiplier = {
		base = 1

		modifier = {
			health <= fine_health
			factor = 1.1
		}
		modifier = {
			health <= poor_health
			factor = 1.1
		}
		modifier = {
			is_adult = no
			factor = 1.5
		}
		modifier = {
			current_date < 1346.1.1
			factor = 0
		}
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		contract_disease_effect = { DISEASE = dysentery TREATMENT_EVENT = no } #Adds the trait, sends event "health.2101" about contagious disease to liege/host/imprisoner, sends event "health.2201" to those who care
	}

	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			NOT = { exists = scope:physician }
			is_playable_character = yes
			is_imprisoned = no
			is_travelling = no
		}
		name = {
			trigger = {
				NOR = {
					has_character_flag = seeking_epidemic_treatment
					has_character_flag = searching_for_physician
				}
			}
			text = health.3101.e
		}
		name = {
			trigger = {
				OR = {
					has_character_flag = seeking_epidemic_treatment
					has_character_flag = searching_for_physician
				}
			}
			text = health.3101.e.already_looking
		}
		if = {
			limit = {
				NOR = {
					has_character_flag = seeking_epidemic_treatment
					has_character_flag = searching_for_physician
				}
			}
			find_court_physician_effect = yes
		}
		else = {
			custom_tooltip = health_3101_already_looking_tt
		}
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
			NOR = {
				has_character_flag = seeking_epidemic_treatment
				has_character_flag = searching_for_physician
			}
		}
		name = health.1016.a
		ai_chance = { base = 1 }
	}
	### TRAVEL- GO HOME
	option = {
		name = health.travel.option.home
		flavor = health.travel.option.home.flavor
		trigger = {
			is_travelling = yes
			current_travel_plan ={
				travel_plan_owner = root
				can_cancel = yes
			}
			involved_activity ?= {
				NOR = {
					has_activity_type = activity_tour
					is_required_special_guest = root
				}
			}
		}
		current_travel_plan = { 
			if = {
				limit = { can_cancel = yes }
				cancel_travel_plan = yes
			}
		}
		ai_chance = { base = 1 }
	}
	###COURT PHYSICIAN OPTIONS###
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.a
		safe_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.b
		risky_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic treatment
	option = {
		trigger = {
			court_physician_available_trigger = yes
			liege_picks_treatment_trigger = no
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = health.3101.c
		mystic_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { is_travelling = yes }
						desc = health.travel.option.continue
					}
					desc = health.3101.d
				}
			}
		}
		if = {
			limit = {
				exists = scope:physician
				liege_picks_treatment_trigger = no
				court_physician_available_when_traveling_trigger = yes
			}
			no_disease_treatment_effect = yes
		}
		ai_chance = { base = 0 }
	}

	#You're going to rot away in prison most likely
	option = {
		trigger = {
			is_imprisoned = yes
		}
		name = health.3101.f
	}
}

#You contract ergotism
health.1017 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { is_travelling = yes }
				desc = health.travel.t
			}
			desc = health.1017.t
		}
	}
	desc = {
		desc = health.1017.desc
		triggered_desc = {
			trigger = {
				court_physician_available_trigger = yes
				liege_picks_treatment_trigger = no
			}
			desc = health.1017.court_physician.desc
		}
	}
	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		trigger = {
			root != scope:physician
			trigger_if = {
				limit = { is_travelling = yes }
				current_travel_plan = {
					any_entourage_character = {
						has_court_position = court_physician_court_position
					}
				}
			}
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = scope:sick_character } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = worry
	}

	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}

	trigger = {
		can_contract_disease_trigger = { DISEASE = ergotism }
	}

	weight_multiplier = {
		base = 1

		modifier = {
			health <= fine_health
			factor = 1.1
		}
		modifier = {
			health <= poor_health
			factor = 1.1
		}
		modifier = {
			is_adult = no
			factor = 1.5
		}
		modifier = {
			current_date < 1346.1.1
			factor = 0
		}
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		save_court_physician_as_effect = { SCOPE_NAME = physician }
		contract_disease_effect = { DISEASE = ergotism TREATMENT_EVENT = no } #Adds the trait, sends event "health.2101" about contagious disease to liege/host/imprisoner, sends event "health.2201" to those who care
	}

	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			NOT = { exists = scope:physician }
			is_playable_character = yes
			is_imprisoned = no
			is_travelling = no
		}
		name = {
			trigger = {
				NOR = {
					has_character_flag = seeking_epidemic_treatment
					has_character_flag = searching_for_physician
				}
			}
			text = health.3101.e
		}
		name = {
			trigger = {
				OR = {
					has_character_flag = seeking_epidemic_treatment
					has_character_flag = searching_for_physician
				}
			}
			text = health.3101.e.already_looking
		}
		if = {
			limit = {
				NOR = {
					has_character_flag = seeking_epidemic_treatment
					has_character_flag = searching_for_physician
				}
			}
			find_court_physician_effect = yes
		}
		else = {
			custom_tooltip = health_3101_already_looking_tt
		}
		ai_chance = { base = 5 }
	}

	#OK
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = yes
			NOR = {
				has_character_flag = seeking_epidemic_treatment
				has_character_flag = searching_for_physician
			}
		}
		name = health.1017.a
		ai_chance = { base = 1 }
	}
	### TRAVEL- GO HOME
	option = {
		name = health.travel.option.home
		flavor = health.travel.option.home.flavor
		trigger = {
			is_travelling = yes
			current_travel_plan ={
				travel_plan_owner = root
				can_cancel = yes
			}
			involved_activity ?= {
				NOR = {
					has_activity_type = activity_tour
					is_required_special_guest = root
				}
			}
		}
		current_travel_plan = { 
			if = {
				limit = { can_cancel = yes }
				cancel_travel_plan = yes
			}
		}
		ai_chance = { base = 1 }
	}
	###COURT PHYSICIAN OPTIONS###
	#Safe treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.a
		safe_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky treatment
	option = {
		trigger = {
			exists = scope:physician
			liege_picks_treatment_trigger = no
			court_physician_available_when_traveling_trigger = yes
		}
		name = health.3101.b
		risky_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic treatment
	option = {
		trigger = {
			court_physician_available_trigger = yes
			liege_picks_treatment_trigger = no
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = health.3101.c
		mystic_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { is_travelling = yes }
						desc = health.travel.option.continue
					}
					desc = health.3101.d
				}
			}
		}
		if = {
			limit = {
				exists = scope:physician
				liege_picks_treatment_trigger = no
				court_physician_available_when_traveling_trigger = yes
			}
			no_disease_treatment_effect = yes
		}
		ai_chance = { base = 0 }
	}

	#You're going to rot away in prison most likely
	option = {
		trigger = {
			is_imprisoned = yes
		}
		name = health.3101.f
	}
}

###########################
# DISEASE RECOVERY EVENTS # Mathilda Bjarnehed & Veronica Pazos
###########################
#For recovery pulses and scripted effects

#Recover from ill
health.1101 = {
	type = character_event
	title = health.1101.t
	desc = health.1101.desc
	theme = recovery
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	override_background = { reference = bedchamber }
	left_portrait = {
		character = root
		animation = personality_content
	}

	trigger = {
		has_trait = ill
	}

	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		hidden_effect = {
			recover_from_disease_effect = { DISEASE = ill } #Removes the trait, sends event "health.2202" to those who care
			remove_disease_treatment_effect = yes
		}
	}

	option = {
		name = health.1101.a
		show_as_tooltip = { #show the trait actually shows up in the tooltip
			remove_trait_force_tooltip = ill
		}
	}
}

#Recover from pneumonic
health.1102 = {
	type = character_event
	title = health.1102.t
	desc = health.1102.desc
	theme = recovery
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = personality_content
	}

	trigger = {
		has_trait = pneumonic
	}

	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		hidden_effect = {
			recover_from_disease_effect = { DISEASE = pneumonic } #Removes the trait, sends event "health.2202" to those who care
			remove_disease_treatment_effect = yes
		}
	}

	option = {
		name = health.1102.a
		show_as_tooltip = { #show the trait actually shows up in the tooltip
			remove_trait_force_tooltip = pneumonic
		}
	}
}

#Recover from gout_ridden
health.1103 = {
	type = character_event
	title = health.1103.t
	desc = health.1103.desc
	theme = recovery
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = personality_content
	}

	trigger = {
		has_trait = gout_ridden
	}


	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		hidden_effect = {
			recover_from_disease_effect = { DISEASE = gout_ridden } #Removes the trait, sends event "health.2202" to those who care
			remove_disease_treatment_effect = yes
		}
	}

	option = {
		name = health.1103.a
		show_as_tooltip = { #show the trait actually shows up in the tooltip
			remove_trait_force_tooltip = gout_ridden
		}
	}
}

#Recover from leper (currently not possible)

#Recover from typhus
health.1105 = {
	type = character_event
	title = health.1105.t
	desc = health.1105.desc
	theme = recovery
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = personality_content
	}

	trigger = {
		has_trait = typhus
	}


	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		hidden_effect = {
			recover_from_disease_effect = { DISEASE = typhus } #Removes the trait, sends event "health.2202" to those who care
			remove_disease_treatment_effect = yes
		}
	}

	option = {
		name = health.1105.a
		show_as_tooltip = { #show the trait actually shows up in the tooltip
			remove_trait_force_tooltip = typhus
		}
	}
}

#Recover from consumption
health.1106 = {
	type = character_event
	title = health.1106.t
	desc = health.1106.desc
	theme = recovery
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = personality_content
	}

	trigger = {
		has_trait = consumption
	}


	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		hidden_effect = {
			recover_from_disease_effect = { DISEASE = consumption } #Removes the trait, sends event "health.2202" to those who care
			remove_disease_treatment_effect = yes
		}
	}

	option = {
		name = health.1106.a
		show_as_tooltip = { #show the trait actually shows up in the tooltip
			remove_trait_force_tooltip = consumption
		}
	}
}

#Recover from cancer
health.1107 = {
	type = character_event
	title = health.1107.t
	desc = health.1107.desc
	theme = recovery
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = personality_content
	}

	trigger = {
		has_trait = cancer
	}


	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		hidden_effect = {
			recover_from_disease_effect = { DISEASE = cancer } #Removes the trait, sends event "health.2202" to those who care
			remove_disease_treatment_effect = yes
		}
	}

	option = {
		name = health.1107.a
		show_as_tooltip = { #show the trait actually shows up in the tooltip
			remove_trait_force_tooltip = cancer
		}
	}
}

#Recover from lovers_pox (currently not possible)

#Recover from great_pox
health.1109 = {
	type = character_event
	title = health.1109.t
	desc = health.1109.desc
	theme = recovery
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = personality_content
	}

	trigger = {
		has_trait = great_pox
	}

	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		hidden_effect = {
			recover_from_disease_effect = { DISEASE = great_pox } #Removes the trait, sends event "health.2202" to those who care & sexual partners
			remove_disease_treatment_effect = yes
		}
	}

	option = {
		name = health.1109.a
		show_as_tooltip = { #show the trait actually shows up in the tooltip
			remove_trait_force_tooltip = great_pox
		}
	}
}

#Recover from smallpox
health.1110 = {
	type = character_event
	title = health.1110.t
	desc = health.1110.desc
	theme = recovery
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = personality_content
	}

	trigger = {
		has_trait = smallpox
	}

	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		hidden_effect = {
			recover_from_disease_effect = { DISEASE = smallpox } #Removes the trait, sends event "health.2202" to those who care & liege/host/imprisoner, adds immunity flag
			remove_disease_treatment_effect = yes
		}
	}

	option = {
		name = health.1110.a
		custom_tooltip = health.1110.a.tt
		show_as_tooltip = { #show the trait actually shows up in the tooltip
			remove_trait_force_tooltip = smallpox
		}
	}

	after = {
		random = {
			chance = 10
			add_trait = scarred
			add_trait_xp = {
                trait = scarred
                value = {
                    integer_range = {
                        min = 5
                        max = 15
                    }
                }
            }
		}
	}
}

#Recover from bubonic_plague
health.1111 = {
	type = character_event
	title = health.1111.t
	desc = health.1111.desc
	theme = recovery
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = personality_content
	}

	trigger = {
		has_trait = bubonic_plague
	}


	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		hidden_effect = {
			recover_from_disease_effect = { DISEASE = bubonic_plague } #Removes the trait, sends event "health.2202" to those who care & liege/host/imprisoner, adds immunity flag
			remove_disease_treatment_effect = yes
			if = {
				limit = { is_ai = no }
				add_achievement_global_variable_effect = {
					VARIABLE = ce1_not_today_achievement_unlocked
					VALUE = yes
				}
			}
		}
	}

	option = {
		name = health.1111.a
		custom_tooltip = health.1111.a.tt
		show_as_tooltip = { #show the trait actually shows up in the tooltip
			remove_trait_force_tooltip = bubonic_plague
		}
	}
}

#Recover from measles
health.1112 = {
	type = character_event
	title = health.1112.t
	desc = health.1112.desc
	theme = recovery
	left_portrait = {
		character = root
		animation = personality_content
	}

	trigger = {
		has_trait = measles
	}

	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		hidden_effect = {
			recover_from_disease_effect = { DISEASE = measles } #Removes the trait, sends event "health.2202" to those who care & liege/host/imprisoner, adds immunity flag
			remove_disease_treatment_effect = yes
		}
	}

	option = {
		name = health.1112.a
		custom_tooltip = health.1112.a.tt
		show_as_tooltip = { #show the trait actually shows up in the tooltip
			remove_trait_force_tooltip = measles
		}
	}

	after = {
		random = {
			chance = 5
			add_trait = blind
		}
	}
}

#Recover from dysentery
health.1113 = {
	type = character_event
	title = health.1113.t
	desc = health.1113.desc
	theme = recovery
	left_portrait = {
		character = root
		animation = personality_content
	}

	trigger = {
		has_trait = dysentery
	}

	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		hidden_effect = {
			recover_from_disease_effect = { DISEASE = dysentery } #Removes the trait, sends event "health.2202" to those who care & liege/host/imprisoner, adds immunity flag
			remove_disease_treatment_effect = yes
		}
	}

	option = {
		name = health.1113.a
		show_as_tooltip = { #show the trait actually shows up in the tooltip
			remove_trait_force_tooltip = dysentery
		}
	}
}

#Recover from ergotism/holy fire
health.1114 = {
	type = character_event
	title = health.1114.t
	desc = health.1114.desc
	theme = recovery
	left_portrait = {
		character = root
		animation = happiness
	}

	trigger = {
		has_trait = ergotism
	}

	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		hidden_effect = {
			recover_from_disease_effect = { DISEASE = ergotism } #Removes the trait, sends event "health.2202" to those who care & liege/host/imprisoner, adds immunity flag
			remove_disease_treatment_effect = yes
		}
	}

	option = {
		name = health.1114.a
		show_as_tooltip = { #show the trait actually shows up in the tooltip
			remove_trait_force_tooltip = ergotism
		}
	}
}


####################
# STDs CONTAGION EVENTS # Mathilda Bjarnehed
####################

#Lover's pox contagion
health.1200 = {
	hidden = yes

	trigger = {
		has_trait = lovers_pox
	}

	immediate = {

		if = {
			limit = { #Children, celibate characters, rejected_from_marriage_bed_modifier characters and characters without partners (or with sick partners) won't spread the disease
				OR = {
					is_adult = no
					has_trait = celibate
					has_character_modifier = rejected_from_marriage_bed_modifier
					NOR = {
						is_married = yes
						any_consort = { NOT = { has_trait = lovers_pox } }
						any_relation = { type = lover NOT = { has_trait = lovers_pox } }
					}
				}
			}
			#Let's just check back with them in ~5 years
			trigger_event = {
				id = health.1200
				days = { 1800 2200 }
			}
		}
		else = { #But everyone else infects a partner
			save_scope_as = infecting_partner

			every_relation = {
				type = lover
				limit = {
					NOT = { has_trait = lovers_pox }
				}
				add_to_temporary_list = potential_contagion_victims
			}
			every_consort = {
				limit = {
					NOT = { has_trait = lovers_pox }
				}
				add_to_temporary_list = potential_contagion_victims
			}
			random_in_list = {
				list = potential_contagion_victims
				weight = {
					base = 100
					modifier = {
						add = -50
						has_perk = wash_your_hands_perk
					}
				}
				contract_lovers_pox_from = { PARTNER = root }
			}

			#New chance of contagion in a while (time frame depends on traits)
			if = {
				limit = { #Quick
					OR = {
						has_trait = lustful
						has_trait = seducer
						has_trait = lifestyle_reveler
					}
				}
				trigger_event = {
					id = health.1200
					days = { 250 700 }
				}
			}
			else_if = { #Slow
				limit = { has_trait = chaste }
				trigger_event = {
					id = health.1200
					days = { 3000 10000 }
				}
			}
			else = { #Regular
				trigger_event = {
					id = health.1200
					days = { 700 2500 }
				}
			}
		}
	}
}

#Great Pox contagion
health.1201 = {
	hidden = yes

	trigger = {
		OR = {
			has_trait = early_great_pox
			has_trait = great_pox
		}
	}

	immediate = {
		if = {
			limit = { #Children, celibate characters, rejected_from_marriage_bed_modifier characters and characters without partners (or with sick partners) won't spread the disease
				OR = {
					is_adult = no
					has_trait = celibate
					has_character_modifier = rejected_from_marriage_bed_modifier
					NOR = {
						is_married = yes
						any_consort = { can_contract_disease_trigger = { DISEASE = great_pox } }
						any_relation = { type = lover can_contract_disease_trigger = { DISEASE = great_pox } }
					}
				}
			}
			#Let's just check back with them in ~3 years
			trigger_event = {
				id = health.1201
				days = { 1000 1200 }
			}
		}
		else = { #But everyone else infects a partner
			save_scope_as = infecting_partner

			every_relation = {
				type = lover
				limit = {
					can_contract_disease_trigger = { DISEASE = great_pox }
				}
				add_to_temporary_list = potential_contagion_victims
			}
			every_consort = {
				limit = {
					can_contract_disease_trigger = { DISEASE = great_pox }
				}
				add_to_temporary_list = potential_contagion_victims
			}
			random_in_list = {
				list = potential_contagion_victims
				weight = {
					base = 100
					modifier = {
						add = -50
						has_perk = wash_your_hands_perk
					}
				}
				contract_great_pox_from = { PARTNER = root }
			}

			#New chance of contagion in a while (time frame depends on traits)
			if = {
				limit = { #Quick
					OR = {
						has_trait = lustful
						has_trait = seducer
						has_trait = lifestyle_reveler
					}
				}
				trigger_event = {
					id = health.1201
					days = { 350 1000 }
				}
			}
			else_if = { #Slow
				limit = { has_trait = chaste }
				trigger_event = {
					id = health.1201
					days = { 3000 10000 }
				}
			}
			else = { #Regular
				trigger_event = {
					id = health.1201
					days = { 1000 3000 }
				}
			}
		}
	}
}

#Smallpox contagion
health.1202 = {
	hidden = yes

	trigger = {
		has_trait = smallpox
	}

	immediate = {
		save_scope_as = disease_spreader

		save_health_court_owner_effect = { SCOPE_NAME = contagion_court_owner }

		if = {
			limit = { exists = scope:contagion_court_owner }

			scope:contagion_court_owner = {
				save_court_physician_as_effect = { SCOPE_NAME = physician }
			}

			#Add everyone in the same court (ruler, prisoners, guests) and friendly scheme targets/owners to list
			create_contagion_list_effect = { SICK_CHARACTER = root CONTAGION_COURT_OWNER = scope:contagion_court_owner }

			random_list = {
				20 = { #Contagion successful
					random_in_list = {
						list = contagion_list
						weight = {
							base = 75
							modifier = { #Proximity increases likelihood of contagion
								is_imprisoned = yes
								root = { is_imprisoned = yes }
								add = 125
							}
							modifier = { #Proximity increases likelihood of contagion
								is_imprisoned = no
								root = { is_imprisoned = no }
								add = 125
							}
							modifier = {
								add = -50
								has_perk = wash_your_hands_perk
							}
							modifier = {
								add = -50
								AND = {
									OR = {
										liege ?= {
											any_court_position_holder ?= {
												type = wet_nurse_court_position
												NOT = { has_trait = smallpox }
												has_relation_nursed_child = root
											}
										}
										root = {
											any_court_position_holder ?= {
												type = wet_nurse_court_position
												NOT = { has_trait = smallpox }
												has_relation_nursed_child = root
											}
										}
									}
									root = { is_adult = no }
								}
							}
						}
						contract_disease_notify_effect = { DISEASE = smallpox }
					}
				}
				0 = { #Contagion prevented by physician
					modifier = {
						has_good_disease_treatment_trigger = yes
						add = 80
					}
					#No contagion this time!
				}
			}
		}

		#Next contagion
		trigger_event = {
			id = health.1202
			days = { smallpox_contagion_min smallpox_contagion_max }
		}
	}
}

#Bubonic plague contagion
health.1203 = {
	hidden = yes

	trigger = {
		has_trait = bubonic_plague
	}

	immediate = {
		save_scope_as = disease_spreader

		save_health_court_owner_effect = { SCOPE_NAME = contagion_court_owner }

		if = {
			limit = { exists = scope:contagion_court_owner }

			scope:contagion_court_owner = {
				save_court_physician_as_effect = { SCOPE_NAME = physician }
			}

			#Add everyone in the same court (ruler, prisoners, guests) and friendly scheme targets/owners to list
			create_contagion_list_effect = { SICK_CHARACTER = root CONTAGION_COURT_OWNER = scope:contagion_court_owner }


			random_list = {
				20 = { #Contagion successful
					random_in_list = {
						list = contagion_list
						weight = {
							base = 100
							modifier = { #Proximity increases likelihood of contagion
								is_imprisoned = yes
								root = { is_imprisoned = yes }
								add = 100
							}
							modifier = { #Proximity increases likelihood of contagion
								is_imprisoned = no
								root = { is_imprisoned = no }
								add = 100
							}
							modifier = {
								add = -50
								has_perk = wash_your_hands_perk
							}
							modifier = {
								add = -50
								AND = {
									OR = {
										liege ?= {
											any_court_position_holder ?= {
												type = wet_nurse_court_position
												NOT = { has_trait = bubonic_plague }
												has_relation_nursed_child = root
											}
										}
										root = {
											any_court_position_holder ?= {
												type = wet_nurse_court_position
												NOT = { has_trait = bubonic_plague }
												has_relation_nursed_child = root
											}
										}
									}
									root = { is_adult = no }
								}
							}
						}
						contract_disease_notify_effect = { DISEASE = bubonic_plague }
					}
				}
				0 = { #Contagion prevented by physician
					modifier = {
						has_good_disease_treatment_trigger = yes
						add = 80
					}
					#No contagion this time!
				}
			}
		}

		#Next contagion
		trigger_event = {
			id = health.1203
			days = { bubonic_plague_contagion_min bubonic_plague_contagion_max }
		}
	}
}



#######################################
# SEXUAL PARTNER CONTRACTS STD EVENTS # Mathilda Bjarnehed
#######################################


#Sexual partner has lover's pox / early great pox
scripted_trigger health_2001_std_from_you_trigger = {
	OR = {
		has_std_trigger = yes
		#Has recently had the disease
		has_character_flag = contraction_cooldown_great_pox
	}
}

health.2001 = {
	type = character_event
	title = health.2001.t
	desc = {
		desc = health.2001.start.desc
		first_valid = {
			triggered_desc = {
				trigger = { has_std_trigger = no }
				desc = health.2001.not_sick.desc
			}
			triggered_desc = {
				trigger = {
					health_2001_std_from_you_trigger = yes
				}
				desc = health.2001.sick.desc
			}
		}
	}
	theme = seduction
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}
	override_icon = {
		trigger = { has_relation_soulmate = scope:std_partner }
		reference = "gfx/interface/icons/event_types/type_love.dds"
	}
	override_icon = {
		trigger = { is_spouse_of = scope:std_partner }
		reference = "gfx/interface/icons/event_types/type_marriage.dds"
	}
	override_background = {
		reference = bedchamber
	}
	left_portrait = {
		character = scope:std_partner
		animation = shame
	}

	trigger = {
		is_playable_character = yes
	}

	immediate = {
		save_scope_as = other_partner
		scope:std_partner = {
			show_as_tooltip = { add_trait_force_tooltip = lovers_pox }
		}
		if = {
			limit = {
				is_spouse_of = scope:std_partner
				has_std_trigger = no
			}
			scope:std_partner = {
				set_variable = {
					name = std_from_unfaithfulness_against
					value = root
					years = 15
				}
			}
		}
	}

	#Force celibacy
	option = {
		trigger = {
			any_consort = { this = scope:std_partner }
		}
		name = {
			trigger = { has_std_trigger = no }
			text = health.2001.a.not_sick
		}
		name = {
			trigger = { health_2001_std_from_you_trigger = yes }
			text = health.2001.a.sick
		}

		show_as_tooltip = { #Actually happens in 2003
			if = {
				limit = { has_relation_lover = scope:std_partner }
				remove_relation_lover = scope:std_partner
			}
			scope:std_partner = {
				add_character_modifier = {
					modifier = rejected_from_marriage_bed_modifier
				}
			}
			reverse_add_opinion = {
				target = scope:std_partner
				modifier = refusal_opinion
				opinion = -20
			}
		}

		hidden_effect = {
			scope:std_partner = {
				trigger_event = health.2003
			}
		}

		stress_impact = {
			compassionate = medium_stress_gain
			lustful = minor_stress_gain
			forgiving = minor_stress_gain
		}

		ai_chance = {
			base = 300

			ai_value_modifier = {
				ai_vengefulness = medium_chance_impact_positive_ai_value #200 if positive vengefulness is "high"
				ai_compassion = high_chance_impact_negative_ai_value #400 if negative compassion is "high"
			}
			opinion_modifier = {
				opinion_target = scope:std_partner
				multiplier = -5
			}
			modifier = {
				has_trait = paranoid
				add = 100
			}
		}
	}

	#Break up
	option = {
		trigger = {
			NOT = { any_consort = { this = scope:std_partner } }
			has_relation_lover = scope:std_partner
		}
		name = {
			trigger = { has_std_trigger = no }
			text = health.2001.c.not_sick
		}
		name = {
			trigger = { health_2001_std_from_you_trigger = yes }
			text = health.2001.c.sick
		}

		show_as_tooltip = { #Really happens in 2003
			remove_relation_lover = scope:std_partner
			reverse_add_opinion = {
				target = scope:std_partner
				modifier = refusal_opinion
				opinion = -20
			}
		}

		hidden_effect = {
			scope:std_partner = {
				trigger_event = health.2003
			}
		}

		stress_impact = {
			compassionate = medium_stress_gain
			lustful = minor_stress_gain
			forgiving = minor_stress_gain
		}

		ai_chance = {
			base = 400

			ai_value_modifier = {
				ai_vengefulness = medium_chance_impact_positive_ai_value #200 if positive vengefulness is "high"
				ai_compassion = high_chance_impact_negative_ai_value #400 if negative compassion is "high"
			}
				opinion_modifier = {
					opinion_target = scope:std_partner
					multiplier = -5
				}
			modifier = {
				has_trait = paranoid
				add = 100
			}
		}
	}

	#Forgive
	option = {
		name = {
			trigger = { has_std_trigger = no }
			text = health.2001.d.not_sick
		}
		name = {
			trigger = { health_2001_std_from_you_trigger = yes }
			text = health.2001.d.sick
		}
		if = {
			limit = {
				health_2001_std_from_you_trigger = yes
			}
			custom_tooltip = health.2001.c.tt_sick
		}
		else = {
			custom_tooltip = health.2001.c.tt
		}

		stress_impact = {
			paranoid = major_stress_gain
			vengeful = medium_stress_gain
		}

		ai_chance = {
			base = 150
		}
	}
}

#It turns out the blisters were actually Great Pox!
health.2002 = {
	type = character_event
	title = health.2002.t
	desc = {
		desc = health.2002.start.desc
		triggered_desc = {
			trigger = { has_trait = early_great_pox }
			desc = health.2002.early_great_pox.desc
		}
	}
	theme = seduction
	override_icon = {
		trigger = { has_relation_soulmate = scope:std_partner }
		reference = "gfx/interface/icons/event_types/type_love.dds"
	}
	override_icon = {
		trigger = { is_spouse_of = scope:std_partner }
		reference = "gfx/interface/icons/event_types/type_marriage.dds"
	}
	left_portrait = {
		character = scope:std_partner
		animation = shame
	}

	trigger = {
		is_playable_character = yes
	}

	immediate = {
		play_music_cue = "mx_cue_stress"
		save_scope_as = other_partner
		scope:std_partner = {
			show_as_tooltip = { add_trait_force_tooltip = great_pox }
		}
	}

	#Force celibacy
	option = {
		trigger = { #Non-rejected consort
			any_consort = { this = scope:std_partner }
			NOT = { scope:std_partner = { has_character_modifier = rejected_from_marriage_bed_modifier } }
		}
		name = {
			trigger = { has_std_trigger = no }
			text = health.2002.a.not_sick
		}
		name = {
			trigger = { has_std_trigger = yes }
			text = health.2002.a.sick
		}


		show_as_tooltip = { #Actually happens in 2003
			if = {
				limit = { has_relation_lover = scope:std_partner }
				remove_relation_lover = scope:std_partner
			}
			scope:std_partner = {
				add_character_modifier = {
					modifier = rejected_from_marriage_bed_modifier
				}
			}
			reverse_add_opinion = {
				target = scope:std_partner
				modifier = refusal_opinion
				opinion = -20
			}
		}

		hidden_effect = {
			scope:std_partner = {
				trigger_event = health.2003
			}
		}

		stress_impact = {
			compassionate = minor_stress_gain
			lustful = minor_stress_gain
			forgiving = minor_stress_gain
		}

		ai_chance = {
			base = 300

			ai_value_modifier = {
				ai_vengefulness = medium_chance_impact_positive_ai_value #200 if positive vengefulness is "high"
				ai_compassion = high_chance_impact_negative_ai_value #400 if negative compassion is "high"
			}
				opinion_modifier = {
					opinion_target = scope:std_partner
					multiplier = -5
				}
			modifier = {
				has_trait = paranoid
				add = 100
			}
		}
	}

	#Break up
	option = {
		trigger = { #Lover
			NOT = { any_consort = { this = scope:std_partner } }
			has_relation_lover = scope:std_partner
		}
		name = {
			trigger = { has_std_trigger = no }
			text = health.2002.b.not_sick
		}
		name = {
			trigger = { health_2001_std_from_you_trigger = yes }
			text = health.2002.b.sick
		}

		show_as_tooltip = { #Really happens in 2003
			remove_relation_lover = scope:std_partner
			reverse_add_opinion = {
				target = scope:std_partner
				modifier = refusal_opinion
				opinion = -20
			}
		}

		hidden_effect = {
			scope:std_partner = {
				trigger_event = health.2003
			}
		}

		stress_impact = {
			compassionate = minor_stress_gain
			lustful = minor_stress_gain
			forgiving = minor_stress_gain
		}

		ai_chance = {
			base = 400

			ai_value_modifier = {
				ai_vengefulness = medium_chance_impact_positive_ai_value #200 if positive vengefulness is "high"
				ai_compassion = high_chance_impact_negative_ai_value #400 if negative compassion is "high"
			}
				opinion_modifier = {
					opinion_target = scope:std_partner
					multiplier = -5
				}
			modifier = {
				has_trait = paranoid
				add = 100
			}
		}
	}

	#Still forgive
	option = {
		trigger = {
			OR = {
				AND = { # Lover
					NOT = { any_consort = { this = scope:std_partner } }
					has_relation_lover = scope:std_partner
				}
				AND = { # Non-rejected consort
					any_consort = { this = scope:std_partner }
					NOT = { scope:std_partner = { has_character_modifier = rejected_from_marriage_bed_modifier } }
				}
			}
		}
		name = health.2002.c
		custom_tooltip = health.2001.c.tt

		stress_impact = {
			paranoid = major_stress_gain
			vengeful = major_stress_gain
		}

		ai_chance = {
			base = 50
		}
	}

	#Already rejected, phew
	option = {
		trigger = { #Rejected consort
			any_consort = { this = scope:std_partner }
			scope:std_partner = { has_character_modifier = rejected_from_marriage_bed_modifier }
		}
		name = {
			trigger = { has_std_trigger = no }
			text = health.2002.d.not_sick
		}
		name = {
			trigger = { health_2001_std_from_you_trigger = yes }
			text = health.2002.d.sick
		}
	}

	after = {
		hidden_effect = { #Treatments handled separatley
			if = {
				limit = { root_picks_treatment_for_sick_character_trigger = yes }
				trigger_event = {
					id = health.3102 #I decide
					days = { 5 10 }
				}
			}
		}
	}
}

#Dumped/rejected from marriage bed because of STD
health.2003 = {
	type = character_event
	title = health.2003.t
	desc = {
		desc = health.2003.start.desc
		first_valid = {
			triggered_desc = {
				trigger = { any_consort = { this = scope:other_partner } }
				desc = health.2003.consort.desc
			}
			triggered_desc = {
				trigger = { NOT = { any_consort = { this = scope:other_partner } } }
				desc = health.2003.lover.desc
			}
		}
	}
	theme = seduction
	override_icon = {
		trigger = { has_relation_soulmate = scope:std_partner }
		reference = "gfx/interface/icons/event_types/type_love.dds"
	}
	override_icon = {
		trigger = { is_spouse_of = scope:std_partner }
		reference = "gfx/interface/icons/event_types/type_marriage.dds"
	}
	left_portrait = {
		character = scope:other_partner
		animation = disgust
	}

	immediate = {
		play_music_cue = "mx_cue_prison"
	}

	option = {
		name = health.2003.a

		if = {
			limit = {
				has_relation_lover = scope:other_partner
			}
			remove_relation_lover = scope:other_partner
		}
		if = {
			limit = {
				any_consort = { this = scope:other_partner }
			}
			add_character_modifier = {
				modifier = rejected_from_marriage_bed_modifier
			}
		}
		reverse_add_opinion = {
			target = scope:other_partner
			modifier = refusal_opinion
			opinion = -20
		}
	}
}

###############################
# CONTAGIOUS DISEASE AT COURT # Mathilda Bjarnehed
###############################

#Courtier/guest/prisoner has contagious disease
health.2101 = {
	type = character_event
	title = health.2101.t
	orphan = yes
	desc = {
		first_valid = {
			triggered_desc = { #Smallpox outbreak!
				trigger = {
					scope:disease_type = flag:smallpox
				}
				desc = health.2101.smallpox_outbreak.desc
			}
			triggered_desc = { #Smallpox spreads
				trigger = {
					scope:disease_type = flag:smallpox
				}
				desc = health.2101.smallpox_spreads.desc
			}
			triggered_desc = { #Bubonic plague outbreak!
				trigger = {
					scope:disease_type = flag:bubonic_plague
				}
				desc = health.2101.bubonic_plague_outbreak.desc
			}
			triggered_desc = { #Bubonic plague spreads
				trigger = {
					scope:disease_type = flag:bubonic_plague
				}
				desc = health.2101.bubonic_plague_spreads.desc
			}
			triggered_desc = { #Typhus outbreak!
				trigger = {
					scope:disease_type = flag:typhus
				}
				desc = health.2101.typhus_outbreak.desc
			}
			triggered_desc = { #Typhus spreads
				trigger = {
					scope:disease_type = flag:typhus
				}
				desc = health.2101.typhus_spreads.desc
			}
			triggered_desc = { #Consumption outbreak!
				trigger = {
					scope:disease_type = flag:consumption
				}
				desc = health.2101.consumption_outbreak.desc
			}
			triggered_desc = { #Consumption spreads
				trigger = {
					scope:disease_type = flag:consumption
				}
				desc = health.2101.consumption_spreads.desc
			}
			triggered_desc = { #Measles outbreak!
				trigger = {
					scope:disease_type = flag:measles
				}
				desc = health.2101.measles_outbreak.desc
			}
			triggered_desc = { #Measles spreads
				trigger = {
					scope:disease_type = flag:measles
				}
				desc = health.2101.measles_spreads.desc
			}
			triggered_desc = { #Dysentery outbreak!
				trigger = {
					scope:disease_type = flag:dysentery
				}
				desc = health.2101.dysentery_outbreak.desc
			}
			triggered_desc = { #Dysentery spreads
				trigger = {
					scope:disease_type = flag:dysentery
				}
				desc = health.2101.dysentery_spreads.desc
			}
			triggered_desc = { #Ergotism outbreak!
				trigger = {
					scope:disease_type = flag:ergotism
				}
				desc = health.2101.ergotism_outbreak.desc
			}
			triggered_desc = { #Ergotism spreads
				trigger = {
					scope:disease_type = flag:ergotism
				}
				desc = health.2101.ergotism_spreads.desc
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						is_spouse_of = scope:sick_character
						is_child_of = scope:sick_character
						is_parent_of = scope:sick_character
						AND = {
							exists = scope:sick_character
							player_heir = scope:sick_character
						}
					}
				}
				desc = health.2101.imporant.desc #It's someone important
			}
			triggered_desc = {
				trigger = { scope:sick_character = { is_imprisoned = yes } }
				desc = health.2101.prisoner.desc #It's a prisoner
			}
			desc = health.2101.courtier_or_guest.desc #It's a courtier/guest
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						AND = {
							scope:disease_type = flag:smallpox
							has_character_flag = disease_immunity_smallpox
						}
						AND = {
							scope:disease_type = flag:bubonic_plague
							has_character_flag = disease_immunity_bubonic_plague
						}
					}
				}
				desc = health.2101.immune.desc #I'm immune
			}
			desc = health.2101.not_immune.desc #I'm not immune
		}
		triggered_desc = {
			trigger = {
				root_picks_treatment_for_sick_character_trigger = yes
				court_physician_available_trigger = yes
			}
			desc = {
				first_valid = {
					triggered_desc = {
					    trigger = {
							scope:sick_character = scope:physician
					    }
					    desc = health.2201.court_physician.desc_sick_physician
					}
					desc = health.2201.court_physician.desc
				}
			}
		}
	}
	theme = healthcare
	override_background = {
		trigger = { scope:sick_character ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:sick_character
		animation = sick
	}
	right_portrait = {
		trigger = { scope:sick_character != scope:physician }
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = scope:sick_character } } }
			animation = worry
		}
		animation = personality_rational
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		#Show physician portrait if you're picking the sick character's treatment
		hidden_effect = {
			if = {
				limit = {
					root_picks_treatment_for_sick_character_trigger = yes
				}
				save_court_physician_as_effect = { SCOPE_NAME = physician }
			}
		}
		scope:sick_character.location ?= { save_scope_as = background_terrain_scope }
	}

	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			court_physician_available_trigger = no
		}
		name = health.3101.e

		name = {
			trigger = { scope:sick_character = scope:physician }
			text = health.3101.e_sick_physician
		}
		find_court_physician_effect = yes
		ai_chance = { base = 100 }
	}

	#Isolate them and hope for the best (generic option)
	option = {
		trigger = {
			NAND = {
				root_picks_treatment_for_sick_character_trigger = yes
				court_physician_available_trigger = yes
			}
		}
		name = health.2101.a
		if = {
			limit = { court_physician_available_trigger = no }
			custom_tooltip = health.2101.a.tt
		}
		ai_chance = { base = 10 }
	}

	###COURT PHYSICIAN OPTIONS###
	#Safe
	option = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			court_physician_available_trigger = yes
		}
		name = health.3102.a
		safe_disease_treatment_effect = { PATIENT = scope:sick_character TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky
	option = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			court_physician_available_trigger = yes
		}
		name = health.3102.b
		risky_disease_treatment_effect = { PATIENT = scope:sick_character TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic
	option = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			court_physician_available_trigger = yes
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = {
			trigger = { scope:sick_character = scope:physician }
			text = health.3102.c_sick_physician
		}
		name = health.3102.c
		mystic_disease_treatment_effect = { PATIENT = scope:sick_character TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			court_physician_available_trigger = yes
		}
		name = health.3102.d
		deny_treatment_effect = { PATIENT = scope:sick_character TREATMENT_PICKER = root }
		ai_chance = { base = 0 }
	}

	#Let them pick
	option = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			court_physician_available_trigger = yes
		}
		name = {
			trigger = {
				OR = {
					scope:sick_character = { is_adult = yes }
					scope:sick_character != scope:physician
				}
			}
			text = health.3102.e_adult
		}
		name = {
			trigger = {
				OR = {
					scope:sick_character = { is_adult = no }
					scope:sick_character = scope:physician
				}
			}
			text = health.3102.e_child
		}
		scope:sick_character = { pick_own_disease_treatment_effect = yes }
		ai_chance = { base = 0 }
	}

	#Release them
	option = {
		trigger = {
			scope:sick_character = {
				is_imprisoned = yes
				NOT = { is_courtier_of = root }
			}
			root_picks_treatment_for_sick_character_trigger = no
		}
		name = health.2101.c
		scope:sick_character = { release_from_prison = yes }
	}
}

#There is no longer an outbreak! (send by story)
health.2102 = { #by Mathilda Bjarnehed
	type = character_event
	title = health.2102.t
	orphan = yes
	desc = {
		desc = health.2102.start1.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:disease_type
					scope:disease_type = flag:smallpox
				}
				desc = health.2102.smallpox.desc
			}
			triggered_desc = {
				trigger = {
					exists = scope:disease_type
					scope:disease_type = flag:bubonic_plague
				}
				desc = health.2102.bubonic_plague.desc
			}
		}
		desc = health.2102.start2.desc
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:physician }
				desc = health.2102.physician.desc
			}
			desc = health.2102.no_physician.desc
		}
		#Extra bits about specific people dying
		first_valid = {
			triggered_desc = {
				desc = health.2102.2_victims.desc
			}
			triggered_desc = {
				desc = health.2102.1_victim.desc
			}
			triggered_desc = {
				desc = health.2102.root_victim.desc
			}
		}
	}
	theme = recovery
	left_portrait = scope:left_portrait
	right_portrait = scope:right_portrait

	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
	}

	option = {
	}
}

####################################
# SOMEONE IMPORTANT TO YOU IS SICK # Mathilda Bjarnehed
####################################

#Someone important to you is sick. If you're their liege and you have a court physician, you may chose their treatment.
#Triggered by the contract_disease_effect
health.2201 = {
	type = character_event
	title = health.2201.t
	desc = {
		desc = health.2201.start.desc
		triggered_desc = {
			trigger = { scope:disease_type = flag:ill }
			desc = disease_ill_article
		}
		first_valid = { #Disease type
			triggered_desc = {
				trigger = { scope:disease_type = flag:ill }
				desc = disease_ill
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:pneumonic }
				desc = disease_pneumonic
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:gout_ridden }
				desc = disease_gout_ridden
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:leper }
				desc = disease_leper
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:typhus }
				desc = disease_typhus
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:consumption }
				desc = disease_consumption
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:cancer }
				desc = disease_cancer
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:lovers_pox }
				desc = disease_lovers_pox
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:great_pox }
				desc = disease_great_pox
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:smallpox }
				desc = disease_smallpox
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:bubonic_plague }
				desc = disease_bubonic_plague
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:measles }
				desc = disease_measles
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:dysentery }
				desc = disease_dysentery
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:ergotism }
				desc = disease_ergotism
			}
			desc = missing_illness
		}
		first_valid = {
			triggered_desc = { #Normally not bad, now worried
				trigger = {
					OR = {
						scope:disease_type = flag:ill
						scope:disease_type = flag:gout_ridden
						scope:disease_type = flag:lovers_pox
						scope:disease_type = flag:early_great_pox
					}
				}
				desc = health.2201.minor_disease.desc
			}
			triggered_desc = { #Leprosy
				trigger = { scope:disease_type = flag:leper }
				desc = health.2201.leprosy.desc
			}
			triggered_desc = { #Lethal
				trigger = {
					OR = {
						scope:disease_type = flag:cancer
						scope:disease_type = flag:bubonic_plague
					}
				}
				desc = health.2201.lethal_disease.desc
			}
			desc = health.2201.major_disease.desc #Ther rest, dangerous stuff but with a ~50%+ chance of survival
		}
		triggered_desc = {
			trigger = {
				root_picks_treatment_for_sick_character_trigger = yes
				court_physician_available_trigger = yes
			}
			desc = {
				first_valid = {
					triggered_desc = {
					    trigger = {
							scope:sick_character = scope:physician
					    }
					    desc = health.2201.court_physician.desc_sick_physician
					}
					desc = health.2201.court_physician.desc
				}
			}
		}
	}
	theme = healthcare
	override_background = {
		trigger = { scope:sick_character ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	override_background = {
		trigger = { scope:sick_character ?= { is_travelling = no } }
		reference = bedchamber
	}
	left_portrait = {
		character = scope:sick_character
		animation = sick
	}
	#Show physician portrait if you're picking the sick character's treatment
	right_portrait = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			scope:sick_character != scope:physician
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = scope:sick_character } } }
			animation = worry
		}
		animation = personality_rational
	}

	trigger = {
		scope:sick_character = {
			is_alive = yes
			trigger_if = {
				limit = { is_imprisoned = yes }
				is_imprisoned_by = root
			}
		}
	}

	immediate = {
		show_as_tooltip = {
			if = {
				limit = { scope:disease_type = flag:ill }
				scope:sick_character = { add_trait_force_tooltip = ill }
			}
			else_if = {
				limit = { scope:disease_type = flag:pneumonic }
				scope:sick_character = { add_trait_force_tooltip = pneumonic }
			}
			if = {
				limit = { scope:disease_type = flag:leper }
				scope:sick_character = { add_trait_force_tooltip = leper }
			}
			else_if = {
				limit = { scope:disease_type = flag:typhus }
				scope:sick_character = { add_trait_force_tooltip = typhus }
			}
			if = {
				limit = { scope:disease_type = flag:consumption }
				scope:sick_character = { add_trait_force_tooltip = consumption }
			}
			else_if = {
				limit = { scope:disease_type = flag:cancer }
				scope:sick_character = { add_trait_force_tooltip = cancer }
			}
			if = {
				limit = { scope:disease_type = flag:lovers_pox }
				scope:sick_character = { add_trait_force_tooltip = lovers_pox }
			}
			else_if = {
				limit = { scope:disease_type = flag:early_great_pox }
				scope:sick_character = { add_trait_force_tooltip = early_great_pox }
			}
			if = {
				limit = { scope:disease_type = flag:great_pox }
				scope:sick_character = { add_trait_force_tooltip = great_pox }
			}
			else_if = {
				limit = { scope:disease_type = flag:smallpox }
				scope:sick_character = { add_trait_force_tooltip = smallpox }
			}
			if = {
				limit = { scope:disease_type = flag:bubonic_plague }
				scope:sick_character = { add_trait_force_tooltip = bubonic_plague }
			}
			else_if = {
				limit = { scope:disease_type = flag:measles }
				scope:sick_character = { add_trait_force_tooltip = measles }
			}
			else_if = {
				limit = { scope:disease_type = flag:dysentery }
				scope:sick_character = { add_trait_force_tooltip = dysentery }
			}
			else_if = {
				limit = { scope:disease_type = flag:ergotism }
				scope:sick_character = { add_trait_force_tooltip = ergotism }
			}
		}

		save_court_physician_as_effect = { SCOPE_NAME = physician }
		scope:sick_character.location ?= { save_scope_as = background_terrain_scope }
	}

	###COURT PHYSICIAN OPTIONS###
	#Safe
	option = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			court_physician_available_trigger = yes
		}
		name = health.3102.a
		safe_disease_treatment_effect = { PATIENT = scope:sick_character TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky
	option = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			court_physician_available_trigger = yes
		}
		name = health.3102.b
		risky_disease_treatment_effect = { PATIENT = scope:sick_character TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic
	option = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			court_physician_available_trigger = yes
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = {
			trigger = { scope:sick_character = scope:physician }
			text = health.3102.c_sick_physician
		}
		name = health.3102.c
		mystic_disease_treatment_effect = { PATIENT = scope:sick_character TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			court_physician_available_trigger = yes
		}
		name = health.3102.d
		deny_treatment_effect = { PATIENT = scope:sick_character TREATMENT_PICKER = root }
		ai_chance = { base = 0 }
	}

	#Let them pick
	option = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			court_physician_available_trigger = yes
		}
		name = {
			trigger = {
				OR = {
					scope:sick_character = { is_adult = yes }
					scope:sick_character != scope:physician
				}
			}
			text = health.3102.e_adult
		}
		name = {
			trigger = {
				OR = {
					scope:sick_character = { is_adult = no }
					scope:sick_character = scope:physician
				}
			}
			text = health.3102.e_child
		}
		scope:sick_character = { pick_own_disease_treatment_effect = yes }
		ai_chance = { base = 0 }
	}

	###NO COURT PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			court_physician_available_trigger = no
			root_picks_treatment_for_sick_character_trigger = yes
		}
		name = {
			trigger = {
				NOR = {
					has_character_flag = seeking_epidemic_treatment
					has_character_flag = searching_for_physician
				}
			}
			text = health.3101.e
		}
		name = {
			trigger = {
				OR = {
					has_character_flag = seeking_epidemic_treatment
					has_character_flag = searching_for_physician
				}
			}
			text = health.3101.e.already_looking
		}
		if = {
			limit = {
				NOR = {
					has_character_flag = seeking_epidemic_treatment
					has_character_flag = searching_for_physician
				}
			}
			find_court_physician_effect = yes
		}
		else = {
			custom_tooltip = health_3101_already_looking_tt
		}
		ai_chance = { base = 1 }
	}

	#Nothing to do
	option = {
		trigger = {
			NAND = {
				root_picks_treatment_for_sick_character_trigger = yes
				court_physician_available_trigger = yes
			}
			NOR = {
				has_character_flag = seeking_epidemic_treatment
				has_character_flag = searching_for_physician
			}
		}
		name = health.2201.a
		ai_chance = { base = 10 }
	}
}

scripted_trigger health_2202_happy_recovery_trigger = {
	OR = {
		has_relation_lover = scope:sick_character
		has_relation_friend = scope:sick_character
		has_relation_best_friend = scope:sick_character
		has_relation_soulmate = scope:sick_character
		AND = {
			scope:sick_character = {
				opinion = {
					target = root
					value > 0
				}
				is_of_major_interest_to_root_trigger = yes
			}
		}
	}
}

scripted_trigger health_2202_angry_recovery_trigger = {
	OR = {
		has_relation_rival = scope:sick_character
		has_relation_nemesis = scope:sick_character
		scope:sick_character = {
			opinion = {
				target = root
				value < -35
			}
		}
	}
}

scripted_trigger health_2202_contagious_recovery_trigger = {
	OR = {
		any_courtier_or_guest = { this = scope:sick_character }
		any_prisoner = { this = scope:sick_character }
	}
	OR = {
		scope:disease_type = flag:smallpox
		scope:disease_type = flag:bubonic_plague
	}
}


##########################################################
# SOMEONE IMPORTANT/CONTAGIOUS/STD PARTNER HAS RECOVERED # By Mathilda Bjarnehed & Veronica Pazos
##########################################################

health.2202 = {
	type = character_event
	title = health.2202.t
	desc = {
		desc = health.2202.desc
		triggered_desc = {
			trigger = { scope:disease_type = flag:ill }
			desc = disease_ill_article
		}
		first_valid = { #Disease type
			triggered_desc = {
				trigger = { scope:disease_type = flag:ill }
				desc = disease_ill
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:pneumonic }
				desc = disease_pneumonic
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:gout_ridden }
				desc = disease_gout_ridden
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:leper }
				desc = disease_leper
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:typhus }
				desc = disease_typhus
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:consumption }
				desc = disease_consumption
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:cancer }
				desc = disease_cancer
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:lovers_pox }
				desc = disease_lovers_pox
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:great_pox }
				desc = disease_great_pox
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:smallpox }
				desc = disease_smallpox
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:bubonic_plague }
				desc = disease_bubonic_plague
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:measles }
				desc = disease_measles
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:ergotism }
				desc = disease_ergotism
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:dysentery }
				desc = disease_dysentery
			}
			desc = missing_illness
		}
		first_valid = { #Are you happy about this?
			triggered_desc = {
				trigger = {
					health_2202_happy_recovery_trigger = yes
				}
				desc = health.2202.desc.happy
			}
			triggered_desc = {
				trigger = {
					health_2202_happy_recovery_trigger = no
					health_2202_angry_recovery_trigger = yes
				}
				desc = health.2202.desc.angry
			}
			triggered_desc = {
				trigger = {
					health_2202_happy_recovery_trigger = no
					health_2202_angry_recovery_trigger = no
					health_2202_contagious_recovery_trigger = yes
				}
				desc = health.2202.desc.relieved
			}
			triggered_desc = {
				trigger = {
					health_2202_happy_recovery_trigger = no
					health_2202_angry_recovery_trigger = no
					health_2202_contagious_recovery_trigger = no
				}
				desc = health.2202.desc.neutral
			}
		}
	}
	theme = recovery
	override_background = { reference = relaxing_room }
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				health_2202_happy_recovery_trigger = no
				health_2202_angry_recovery_trigger = yes
			}
			animation = rage
		}
		animation = personality_compassionate
	}
	right_portrait = {
		character = scope:sick_character
		animation = happiness
	}

	trigger = {
		scope:sick_character = { is_alive = yes }
	}

	immediate = {
		show_as_tooltip = {
			if = {
				limit = { scope:disease_type = flag:ill }
				scope:sick_character = { remove_trait_force_tooltip = ill }
			}
			else_if = {
				limit = { scope:disease_type = flag:pneumonic }
				scope:sick_character = { remove_trait_force_tooltip = pneumonic }
			}
			if = {
				limit = { scope:disease_type = flag:leper }
				scope:sick_character = { remove_trait_force_tooltip = leper }
			}
			else_if = {
				limit = { scope:disease_type = flag:typhus }
				scope:sick_character = { remove_trait_force_tooltip = typhus }
			}
			if = {
				limit = { scope:disease_type = flag:consumption }
				scope:sick_character = { remove_trait_force_tooltip = consumption }
			}
			else_if = {
				limit = { scope:disease_type = flag:cancer }
				scope:sick_character = { remove_trait_force_tooltip = cancer }
			}
			if = {
				limit = { scope:disease_type = flag:lovers_pox }
				scope:sick_character = { remove_trait_force_tooltip = lovers_pox }
			}
			else_if = {
				limit = { scope:disease_type = flag:early_great_pox }
				scope:sick_character = { remove_trait_force_tooltip = early_great_pox }
			}
			if = {
				limit = { scope:disease_type = flag:great_pox }
				scope:sick_character = { remove_trait_force_tooltip = great_pox }
			}
			else_if = {
				limit = { scope:disease_type = flag:smallpox }
				scope:sick_character = { remove_trait_force_tooltip = smallpox }
			}
			if = {
				limit = { scope:disease_type = flag:bubonic_plague }
				scope:sick_character = { remove_trait_force_tooltip = bubonic_plague }
			}
			else_if = {
				limit = { scope:disease_type = flag:measles }
				scope:sick_character = { remove_trait_force_tooltip = measles }
			}
			else_if = {
				limit = { scope:disease_type = flag:dysentery }
				scope:sick_character = { remove_trait_force_tooltip = dysentery }
			}
			else_if = {
				limit = { scope:disease_type = flag:ergotism }
				scope:sick_character = { remove_trait_force_tooltip = ergotism }
			}
		}
	}

	option = {
		name = { #So happy!
			trigger = { health_2202_happy_recovery_trigger = yes }
			text = health.2202.a.happy
		}

		name = { #So angry!
			trigger = {
				health_2202_happy_recovery_trigger = no
				health_2202_angry_recovery_trigger = yes
			}
			text = health.2202.a.angry
		}

		name = { #So relieved!
			trigger = {
				health_2202_happy_recovery_trigger = no
				health_2202_angry_recovery_trigger = no
				health_2202_contagious_recovery_trigger = yes
			}
			text = health.2202.a.relieved
		}

		name = { #So neutral...
			trigger = {
				health_2202_happy_recovery_trigger = no
				health_2202_angry_recovery_trigger = no
				health_2202_contagious_recovery_trigger = no
			}
			text = health.2202.a.neutral
		}

		if = {
			limit = {
				OR = {
					scope:disease_type = flag:lovers_pox
					scope:disease_type = flag:early_great_pox
					scope:disease_type = flag:great_pox
				}
				scope:sick_character = {
					has_std_trigger = no
					has_character_modifier = rejected_from_marriage_bed_modifier
				}
			}
			scope:sick_character = {
				remove_character_modifier = rejected_from_marriage_bed_modifier
			}
		}
	}
}

##########################
##########################
# COURT PHYSICIAN EVENTS #
##########################
##########################


########################
# PICK COURT PHYSICIAN #
########################

scripted_trigger health_3001_physician_basic_requirements_trigger = {
	is_adult = yes
	is_imprisoned = no
	is_alive = yes # Because apparently there can be dead characters in the pool (remove when fixed)
	is_claimant = no # We don't want recruiting physicians to be a cheap way of getting claimants
	learning >= low_skill_rating
}

scripted_trigger health_3001_excellent_skill_physician_trigger = {
	health_3001_physician_basic_requirements_trigger = yes
	learning >= high_skill_rating # 15
}

scripted_trigger health_3001_high_skill_physician_trigger = {
	health_3001_physician_basic_requirements_trigger = yes
	#Empire/kingdom
	trigger_if = {
		limit = {
			root = { highest_held_title_tier >= tier_kingdom }
		}
		learning <= very_high_skill_rating # 18
		learning >= decent_skill_rating # 12
	}
	#Duchy/county
	trigger_else = {
		learning <= high_skill_rating  # 15
		learning >= medium_skill_rating  # 10
	}
}

scripted_trigger health_3001_low_skill_physician_trigger = {
	health_3001_physician_basic_requirements_trigger = yes
	# Save mystics for mystic option
	NOT = { has_trait = lifestyle_mystic }
	#Empire/kingdom
	trigger_if = {
		limit = {
			root = { highest_held_title_tier >= tier_kingdom }
		}
		learning <= decent_skill_rating # 12
		learning >= mediocre_skill_rating # 8
	}
	#Duchy/county
	trigger_else = {
		learning <= medium_skill_rating # 10
		learning >= low_skill_rating # 5
	}
}

scripted_trigger health_3001_low_skill_physician_light_trigger = {
	health_3001_physician_basic_requirements_trigger = yes
	learning >= medium_skill_rating # 10
}

scripted_trigger health_3001_mystic_physician_trigger = {
	health_3001_physician_basic_requirements_trigger = yes

	#For this one, we add mystic trait if they don't have it if their learning isn't awesome
	#Must be suitable mystic
	has_trait = lifestyle_mystic
	#Empire/kingdom
	trigger_if = {
		limit = {
			root = { highest_held_title_tier >= tier_kingdom }
		}
		learning >= decent_skill_rating # 12
		NAND = {
			has_trait = lifestyle_physician
			NOT = { has_trait = lifestyle_mystic }
		}
	}
	#Duchy/county
	trigger_else = {
		NOR = {
			learning > high_skill_rating # 15
			AND = {
				has_trait = lifestyle_mystic
				has_trait_xp = {
					trait = lifestyle_mystic
					value >= 100
				}
			}
			has_trait = lifestyle_physician
		}
		learning >= mediocre_skill_rating # 8
	}
}

#Ruler picking court physician
health.3001 = {
	type = character_event
	title = {
		triggered_desc = {
			trigger = { exists = scope:disease_type }
			desc = health.3001.disease.t
		}
		desc = health.3001.t
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { has_character_flag = already_sick }
				desc = health.3001.already_sick.desc
			}
			triggered_desc = {
				trigger = { has_character_flag = health_3001_hire_physician_decision_text }
				desc = health.3001.decision.desc
			}
			desc = health.3001.fallback_reason.desc
		}
	}
	theme = healthcare
	left_portrait = {
		character = scope:high_skill_option
		animation = physician
	}
	lower_left_portrait = scope:mystic_option
	right_portrait = {
		character = scope:low_skill_option
		animation = personality_rational
	}
	lower_right_portrait = scope:excellent_skill_option

	trigger = { #If I lost it before I got this event, I shouldn't get a physician
		exists = capital_province
	}

	immediate = {
		hidden_effect = {
			#Find some appropriate options

			if = { #Performance heavy option finding is only for players
				limit = { is_ai = no }

				#EXCELLENT SKILL CHARACTER (for learned rulers)
				if = {
					limit = {
						OR = {
							has_learning_lifestyle_trait_trigger = yes
							learning >= high_skill_rating
						}
					}
					random_pool_character = {
						province = capital_province
						limit = {
							health_3001_excellent_skill_physician_trigger = yes
							has_trait = lifestyle_physician
							has_trait = lifestyle_herbalist
						}
						alternative_limit = {
							health_3001_excellent_skill_physician_trigger = yes
							has_trait = lifestyle_physician
						}
						alternative_limit = { health_3001_excellent_skill_physician_trigger = yes }
						weight = {
							base = 1
							modifier = {
								faith = root.faith
								factor = 10
							}
							modifier = {
								has_trait = lifestyle_mystic
								factor = 10
							}
							modifier = {
								has_trait = lifestyle_herbalist
								factor = 10
							}
						}
						save_scope_as = excellent_skill_option
						# Good doctor trait
						if = {
							limit = {
								NOT = { has_trait = lifestyle_physician }
							}
							add_trait = lifestyle_physician
						}
						if = {
							limit = {
								NOT = {
									has_trait_xp = {
										trait = lifestyle_physician
										value >= 10
									}
								}
							}
							add_trait_xp = {
				                trait = lifestyle_physician
				                value = {
				                    integer_range = {
				                        min = medium_lifestyle_random_xp_low
				                        max = medium_lifestyle_random_xp_high
				                    }
				                }
				            }
						}
					}
					#Backup excellent generation
					if = {
						limit = { NOT = { exists = scope:excellent_skill_option } }
						create_character = {
							location = root.capital_province
							template = physician_excellent_character_template
							save_scope_as = excellent_skill_option
						}
					}

					# Ensure some medical knowledge
					scope:excellent_skill_option ?= {
						if = {
							limit = {
								NOT = { has_trait = lifestyle_physician }
							}
							add_trait = lifestyle_physician
							add_trait_xp = {
								trait = lifestyle_physician
								value = {
									medium_lifestyle_random_xp_high
									100
								}
							}
						}
						else_if = {
							limit = {
								has_trait_xp = {
									trait = lifestyle_physician
									value <= 55
								}
							}
							add_trait_xp = {
								trait = lifestyle_physician
								value = {
									medium_lifestyle_random_xp_low
									45
								}
							}
						}
						# Bonus herbalist trait chance
						random = {
							chance = 66
							modifier = {
								culture = { has_cultural_parameter = herbalist_traits_more_common }
								factor = 2
							}
							if = {
								limit = {
									NOT = { has_trait = lifestyle_herbalist }
								}
								add_trait = lifestyle_herbalist
							}
						}
			}
				}

				#HIGH-SKILL CHARACTER
				random_pool_character = {
					province = capital_province
					limit = {
						health_3001_high_skill_physician_trigger = yes
						has_trait = lifestyle_physician
						NOT = { scope:excellent_skill_option ?= this }
					}
					alternative_limit = {
						health_3001_high_skill_physician_trigger = yes
						NOT = { scope:excellent_skill_option ?= this }
					}
					weight = {
						base = 1
						modifier = {
							faith = root.faith
							factor = 10
						}
						modifier = {
							has_trait = lifestyle_mystic
							factor = 10
						}
						modifier = {
							has_trait = lifestyle_herbalist
							factor = 10
						}
					}
					save_scope_as = high_skill_option
				}

				#Backup high generation
				if = {
					limit = { NOT = { exists = scope:high_skill_option } }
					create_character = {
						location = root.capital_province
						template = physician_high_character_template
						save_scope_as = high_skill_option
					}
				}

				# Ensure some medical knowledge
				scope:high_skill_option ?= {
					if = {
						limit = {
							NOT = { has_trait = lifestyle_physician }
						}
						add_trait = lifestyle_physician
						add_trait_xp = {
							trait = lifestyle_physician
							value = {
								medium_lifestyle_random_xp_low
								medium_lifestyle_random_xp_high
							}
						}
					}
					else_if = {
						limit = {
							has_trait_xp = {
								trait = lifestyle_physician
								value <= 30
							}
						}
						add_trait_xp = {
							trait = lifestyle_physician
							value = {
								small_lifestyle_random_xp_low
								small_lifestyle_random_xp_high
							}
						}
					}
					# Bonus herbalist trait chance
					random = {
						chance = 33
						modifier = {
							culture = { has_cultural_parameter = herbalist_traits_more_common }
							factor = 2
						}
						if = {
							limit = {
								NOT = { has_trait = lifestyle_herbalist }
							}
							add_trait = lifestyle_herbalist
						}
					}
				}

				#LOW-MEDIUM-SKILL CHARACTER
				random_pool_character = {
					province = root.capital_province
					limit = {
						health_3001_low_skill_physician_trigger = yes
						has_trait = lifestyle_physician
						NOT = { scope:excellent_skill_option ?= this }
						NOT = { scope:high_skill_option ?= this }
					}
					alternative_limit = {
						health_3001_low_skill_physician_trigger = yes
						NOT = { scope:excellent_skill_option ?= this }
						NOT = { scope:high_skill_option ?= this }
					}
					weight = {
						base = 1
						modifier = {
							faith = root.faith
							factor = 10
						}
					}
					save_scope_as = low_skill_option
				}

				#MYSTIC CHARACTER (optional, only if available in pool)
				random_pool_character = {
					province = root.capital_province
					limit = {
						health_3001_mystic_physician_trigger = yes
						has_trait = lifestyle_physician
						NOT = { scope:excellent_skill_option ?= this }
						NOT = { scope:high_skill_option ?= this }
						NOT = { scope:low_skill_option ?= this }
					}
					alternative_limit = {
						health_3001_mystic_physician_trigger = yes
						NOT = { scope:excellent_skill_option ?= this }
						NOT = { scope:high_skill_option ?= this }
						NOT = { scope:low_skill_option ?= this }
					}
					weight = {
						base = 1
						modifier = {
							has_trait = lifestyle_mystic
							factor = 100
						}
						modifier = {
							faith = root.faith
							factor = 10
						}
						modifier = {
							culture = { has_cultural_parameter = mystic_trait_gives_bonuses }
							factor = 10
						}
					}
					save_scope_as = mystic_option
					#Set mystic trait if skill is too low
					while = {
						limit = {
							#Empire/kingdom
							trigger_if = {
								limit = {
									root = { highest_held_title_tier >= tier_kingdom }
								}
								has_trait = lifestyle_mystic
								has_trait_xp = {
									trait = lifestyle_mystic
									value <= 60
								}
							}
							#Duchy/county
							trigger_else = {
								has_trait = lifestyle_mystic
								has_trait_xp = {
									trait = lifestyle_mystic
									value <= 30
								}
							}
						}
						ai_mystic_lifestyle_rank_up_effect = yes
					}
				}
			}
			else = { #Ai get someone simple
				random_pool_character = {
					province = root.capital_province
					limit = { health_3001_low_skill_physician_light_trigger = yes }
					weight = {
						base = 1
						modifier = {
							faith = root.faith
							factor = 10
						}
					}
					save_scope_as = low_skill_option
				}
			}

			#Backup low generation
			if = {
				limit = { NOT = { exists = scope:low_skill_option } }
				create_character = {
					location = root.capital_province
					template = physician_low_character_template
					save_scope_as = low_skill_option
				}
			}

			# Ensure some medical knowledge
			scope:low_skill_option ?= {
				if = {
					limit = {
						NOT = { has_trait = lifestyle_physician }
					}
					random = {
						chance = 50
						add_trait = lifestyle_physician
						add_trait_xp = {
							trait = lifestyle_physician
							value = {
								small_lifestyle_random_xp_low
								small_lifestyle_random_xp_high
							}
						}
					}
				}
				else_if = {
					limit = {
						has_trait_xp = {
							trait = lifestyle_physician
							value <= 5
						}
					}
					add_trait_xp = {
						trait = lifestyle_physician
						value = {
							small_lifestyle_random_xp_low
							small_lifestyle_random_xp_high
						}
					}
				}
				# Bonus herbalist trait chance
				random = {
					chance = 10
					modifier = {
						culture = { has_cultural_parameter = herbalist_traits_more_common }
						factor = 2
					}
					if = {
						limit = {
							NOT = { has_trait = lifestyle_herbalist }
						}
						add_trait = lifestyle_herbalist
					}
				}
			}
		}
	}

	#Amazing skill
	option = {
		trigger = {
			exists = scope:excellent_skill_option
			is_playable_character = yes #extra check to make sure they haven't lost their status
		}
		name = health.3001.e
		trait = scholar
		skill = learning

		custom_tooltip = health.3001.e.aptitude
		pay_treasury_or_gold = {
			target = scope:excellent_skill_option
			value = high_skill_court_physician_cost
		}
		custom_tooltip = health.3001.a.tt

		set_court_physician_effect = {
			EMPLOYER = root
			PHYSICIAN = scope:excellent_skill_option
		}

		ai_chance = {
			factor = 500
			modifier = {
				short_term_gold < medium_gold_value
				factor = 0
			}
		}
	}

	#High skill
	option = {
		trigger = {
			is_playable_character = yes #extra check to make sure they haven't lost their status
			exists = scope:high_skill_option #Doesn't exists for AI
		}
		name = health.3001.a

		custom_tooltip = health.3001.a.aptitude
		pay_treasury_or_gold = {
			target = scope:high_skill_option
			value = high_skill_court_physician_cost
		}
		custom_tooltip = health.3001.a.tt

		set_court_physician_effect = {
			EMPLOYER = root
			PHYSICIAN = scope:high_skill_option
		}

		ai_chance = {
			factor = 100
			modifier = {
				short_term_gold < medium_gold_value
				factor = 0
			}
		}
	}

	#Low
	option = {
		trigger = {
			is_playable_character = yes #extra check to make sure they haven't lost their status
		}
		name = health.3001.b

		custom_tooltip = health.3001.b.aptitude
		if = {
			limit = {
				OR = {
					is_ai = no
					short_term_gold >= low_skill_court_physician_cost #Because AI would never have enough money and everyone would die
				}
			}
			pay_treasury_or_gold = {
				target = scope:low_skill_option
				value = low_skill_court_physician_cost
			}
		}
		custom_tooltip = health.3001.a.tt

		set_court_physician_effect = {
			EMPLOYER = root
			PHYSICIAN = scope:low_skill_option
		}

		ai_chance = {
			factor = 100
		}
	}

	#Mystic
	option = {
		trigger = {
			exists = scope:mystic_option
			is_playable_character = yes #extra check to make sure they haven't lost their status
		}
		name = health.3001.c

		custom_tooltip = health.3001.c.aptitude
		pay_treasury_or_gold = {
			target = scope:mystic_option
			value = low_skill_court_physician_cost
		}
		custom_tooltip = health.3001.a.tt
		add_piety = medium_piety_loss

		set_court_physician_effect = {
			EMPLOYER = root
			PHYSICIAN = scope:mystic_option
		}

		stress_impact = {
			zealous = minor_stress_impact_gain
		}

		hidden_effect = {
			scope:mystic_option = {
				if = {
					limit = {
						NOR = {
							any_secret = { type = secret_witch }
							has_trait = witch
						}
					}
					random = {
						chance = 5
						modifier = {
							factor = 0
							ai_zeal >= medium_positive_ai_value
						}
						modifier = {
							factor = 2
							ai_zeal <= high_negative_ai_value #high and not medium because mystic traits already remove some ai_zeal
						}
						give_witch_secret_or_trait_effect = yes
					}
				}
			}
		}

		ai_chance = {
			factor = 30
			modifier = {
				short_term_gold < minor_gold_value
				factor = 0
			}
			ai_value_modifier = {
				ai_zeal = tiny_chance_impact_negative_ai_value
				max = 20
			}
		}
	}

	#None...
	option = {
		name = {
			trigger = {
				NOR = {
					exists = scope:mystic_option
					exists = scope:excellent_skill_option
				}
			}
			text = health.3001.d.two
		}
		name = {
			trigger = {
				OR = {
					exists = scope:mystic_option
					exists = scope:excellent_skill_option
				}
			}
			text = health.3001.d.more
		}
		custom_tooltip = health.3001.d.tt

		ai_chance = {
			factor = 1
		}
	}

	after = {
		hidden_effect = {
			if = {
				limit = {
					has_character_flag = seeking_epidemic_treatment
					exists = court_position:court_physician_court_position
				}
				court_position:court_physician_court_position = { save_scope_as = physician }
				trigger_event = {
					id = physician_epidemic_events.1020
					days = 3
				}
			}
		}

		remove_character_flag = health_3001_hire_physician_decision_text
	}
}


#####################
# DISEASE TREATMENT # by Mathilda Bjarnehed & additional texts by Milla Isaksson
#####################

#Who should decide about my treatment?
health.3100 = {
	hidden = yes

	trigger = {
		has_treatable_disease_trigger = yes
		has_recent_treatment_trigger = no
		court_physician_available_trigger = yes
	}

	immediate = {
		set_worst_disease_effect = yes
		save_scope_as = sick_character
		decide_who_picks_disease_treatment_effect = yes #Sends health.3101 to me or 3102 to liege
	}

	on_trigger_fail = {
		#No disease/no physician: do nothing (if we hire a new physician, they will treat everyone upon being hired)
		#Has a disease but treatment is still active? Try again
		if = {
			limit = {
				has_treatable_disease_trigger = yes
				has_recent_treatment_trigger = yes #Only difference
				court_physician_available_trigger = yes
			}
			trigger_event = { id = health.3100 years = 1 }
		}
	}
}

#I pick my treatment (court physician was recently hired OR treating after last treatment ran out OR liege let me pick for myself)
health.3101 = {
	type = character_event
	title = health.3101.t
	desc = {
		desc = health.3101.start.desc
		first_valid = { #Disease type
			triggered_desc = {
				trigger = { scope:disease_type = flag:ill }
				desc = disease_ill
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:pneumonic }
				desc = disease_pneumonic
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:gout_ridden }
				desc = disease_gout_ridden
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:leper }
				desc = disease_leper
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:typhus }
				desc = disease_typhus
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:consumption }
				desc = disease_consumption
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:cancer }
				desc = disease_cancer
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:lovers_pox }
				desc = disease_lovers_pox
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:great_pox }
				desc = disease_great_pox
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:smallpox }
				desc = disease_smallpox
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:bubonic_plague }
				desc = disease_bubonic_plague
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:measles }
				desc = disease_measles
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:ergotism }
				desc = disease_ergotism
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:dysentery }
				desc = disease_dysentery
			}
			desc = missing_illness
		}
		random_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						OR = {
							scope:disease_type = flag:ill
							health >= death_chance_starts_health
						}
						scope:physician = {
							NOR = {
								has_trait = lifestyle_physician
								has_trait = lifestyle_mystic
							}
						}
					}
				}
				desc = health.3101.safe_recommendation.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						health < death_chance_starts_health
						scope:physician = {
							NOR = {
								has_trait = lifestyle_physician
								has_trait = lifestyle_mystic
							}
						}
					}
					NOT = { has_trait = lifestyle_mystic }
				}
				desc = health.3101.risky_recommendation.desc
			}
			triggered_desc = {
				trigger = {
					scope:physician = { has_trait = lifestyle_mystic }
				}
				desc = health.3101.mystic_recommendation.desc
			}
		}
		desc = health.3101.end.desc
	}
	theme = healthcare
	override_background = {
		trigger = { scope:physician ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = bubonic_plague
					has_trait = dysentery
				}
			}
			animation = sick_stomach
		}
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = typhus
					has_trait = measles
				}
			}
			animation = shiver
		}
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = smallpox
					has_trait = ill
					has_trait = consumption
				}
			}
			animation = cough
		}
		animation = worry
	}

	right_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = root } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = physician
	}

	trigger = {
		has_treatable_disease_trigger = yes
		court_physician_available_trigger = yes
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		hidden_effect = {
			save_court_physician_as_effect = { SCOPE_NAME = physician }
			set_worst_disease_effect = yes
		}
		scope:physician.location ?= { save_scope_as = background_terrain_scope }
	}

	#Safe
	option = {
		name = health.3101.a
		safe_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky
	option = {
		name = health.3101.b
		risky_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic
	option = {
		trigger = {
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = health.3101.c
		mystic_disease_treatment_effect = { PATIENT = root TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		name = health.3101.d
		no_disease_treatment_effect = yes
		ai_chance = { base = 0 }
	}
}

#Important courtier sick: I pick treatment for them (court physician was recently hired OR treating after last treatment ran out)
health.3102 = {
	type = character_event
	title = health.3102.t
	desc = {
		desc = health.3102.preamble
		first_valid = {
			triggered_desc = {
			    trigger = {
					scope:sick_character = scope:physician
			    }
			    desc = health.3102.start.desc_sick_physician
			}
			desc = health.3102.start.desc
		}
		first_valid = { #Disease type
			triggered_desc = {
				trigger = { scope:disease_type = flag:ill }
				desc = disease_ill
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:pneumonic }
				desc = disease_pneumonic
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:gout_ridden }
				desc = disease_gout_ridden
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:leper }
				desc = disease_leper
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:typhus }
				desc = disease_typhus
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:consumption }
				desc = disease_consumption
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:cancer }
				desc = disease_cancer
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:lovers_pox }
				desc = disease_lovers_pox
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:great_pox }
				desc = disease_great_pox
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:smallpox }
				desc = disease_smallpox
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:bubonic_plague }
				desc = disease_bubonic_plague
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:measles }
				desc = disease_measles
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:ergotism }
				desc = disease_ergotism
			}
			triggered_desc = {
				trigger = { scope:disease_type = flag:dysentery }
				desc = disease_dysentery
			}
			desc = missing_illness
		}
		desc = health.3102.treatment
	}
	theme = healthcare
	override_background = {
		trigger = { scope:sick_character ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:sick_character
		animation = sick
	}
	right_portrait = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			scope:sick_character != scope:physician
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = scope:sick_character } } }
			animation = worry
		}
		animation = physician
	}

	trigger = {
		scope:sick_character = {
			has_treatable_disease_trigger = yes
			is_alive = yes
		}
		court_physician_available_trigger = yes
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		hidden_effect = {
			save_court_physician_as_effect = { SCOPE_NAME = physician }
			scope:sick_character = { set_worst_disease_effect = yes }
		}
		scope:sick_character.location ?= { save_scope_as = background_terrain_scope }
	}

	#Safe
	option = {
		name = health.3102.a
		safe_disease_treatment_effect = { PATIENT = scope:sick_character TREATMENT_PICKER = root }
		ai_chance = { base = 10 }
	}

	#Risky
	option = {
		name = health.3102.b
		risky_disease_treatment_effect = { PATIENT = scope:sick_character TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Mystic
	option = {
		trigger = {
			scope:physician = { has_trait = lifestyle_mystic }
		}
		name = {
			trigger = { scope:sick_character = scope:physician }
			text = health.3102.c_sick_physician
		}
		name = health.3102.c
		mystic_disease_treatment_effect = { PATIENT = scope:sick_character TREATMENT_PICKER = root }
		ai_chance = {
			base = 0.5
			modifier = {
				add = -0.5
				ai_zeal >= 0
			}
		}
	}

	#No treatment
	option = {
		name = health.3102.d
		deny_treatment_effect = { PATIENT = scope:sick_character TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Let them pick
	option = {
		name = {
			trigger = {
				OR = {
					scope:sick_character = { is_adult = yes }
					scope:sick_character != scope:physician
				}
			}
			text = health.3102.e_adult
		}
		name = {
			trigger = {
				OR = {
					scope:sick_character = { is_adult = no }
					scope:sick_character = scope:physician
				}
			}
			text = health.3102.e_child
		}
		scope:sick_character = { pick_own_disease_treatment_effect = yes }
		ai_chance = { base = 0 }
	}
}


#SAFE TREATMENT: SUCCESS
health.3103 = {
	type = character_event
	title = health.3103.t
	desc = {
		#Treatment type
		random_valid = {
			desc = health.safe_treatment.1.desc
			triggered_desc = {
				trigger = { NOT = { has_trait = temperate } }
				desc = health.safe_treatment.2.desc
			}
			desc = health.safe_treatment.3.desc
			desc = health.safe_treatment.4.desc
			desc = health.safe_treatment.5.desc
			triggered_desc = {
				trigger = { ai_zeal > 0 }
				desc = health.safe_treatment.6.desc
			}
			triggered_desc = {
				trigger = { ai_zeal > 0 }
				desc = health.safe_treatment.7.desc
			}
			desc = health.safe_treatment.8.desc
			desc = health.safe_treatment.9.desc
			desc = health.safe_treatment.10.desc
			desc = health.safe_treatment.11.desc
			desc = health.safe_treatment.12.desc
			desc = health.safe_treatment.13.desc
			desc = health.safe_treatment.14.desc
			desc = health.safe_treatment.15.desc
			desc = health.safe_treatment.16.desc
			desc = health.safe_treatment.17.desc
			desc = health.safe_treatment.18.desc
		}
		desc = health.3103.end.desc
	}
	theme = healthcare
	override_background = {
		trigger = { scope:physician ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = {
				OR = {
					opinion = {
						target = root
						value >= high_positive_opinion
					}
					ai_compassion >= medium_positive_compassion
				}
			}
			animation = happiness
		}
		animation = physician
	}

	immediate = {
		#Adds modifiers, sends return visit event in 1-5 years, shows a tooltip if physician ranked up
		disease_treatment_results_effect = { TREATMENT = safe OUTCOME = success }

		#Message for close relatives
		inform_liege_about_disease_treatment_effect = { TREATMENT = safe OUTCOME = success }
		scope:physician.location ?= { save_scope_as = background_terrain_scope }
	}

	option = {
		name = health.3103.a
	}

	after = {
		hidden_effect = {
			if = {
				limit = {
					has_global_variable = tutorial_completed
				}
				add_character_flag = force_court_positions_tutorial
			}
		}
	}
}

#SAFE TREATMENT: FAILURE
scripted_trigger health_failed_physician_fears_trigger = {
	scope:physician = {
		dread_modified_ai_boldness = {
			dreaded_character = root
			value <= medium_negative_ai_value
		}
	}
}

health.3104 = {
	type = character_event
	title = health.3104.t
	desc = {
		#Treatment type
		random_valid = {
			desc = health.safe_treatment.1.desc
			triggered_desc = {
				trigger = { NOT = { has_trait = temperate } }
				desc = health.safe_treatment.2.desc
			}
			desc = health.safe_treatment.3.desc
			desc = health.safe_treatment.4.desc
			desc = health.safe_treatment.5.desc
			triggered_desc = {
				trigger = { ai_zeal > 0 }
				desc = health.safe_treatment.6.desc
			}
			triggered_desc = {
				trigger = { ai_zeal > 0 }
				desc = health.safe_treatment.7.desc
			}
			desc = health.safe_treatment.8.desc
			desc = health.safe_treatment.9.desc
			desc = health.safe_treatment.10.desc
			desc = health.safe_treatment.11.desc
			desc = health.safe_treatment.12.desc
			desc = health.safe_treatment.13.desc
			desc = health.safe_treatment.14.desc
			desc = health.safe_treatment.15.desc
			desc = health.safe_treatment.16.desc
			desc = health.safe_treatment.17.desc
			desc = health.safe_treatment.18.desc
		}
		desc = health.3104.end.desc
	}
	theme = healthcare
	override_background = {
		trigger = { scope:physician ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = {
				health_failed_physician_fears_trigger = yes
			}
			animation = fear
		}
		animation = shame
	}

	immediate = {
		#Adds modifiers, sends return visit event in 1-5 years, shows a tooltip if physician ranked up
		disease_treatment_results_effect = { TREATMENT = safe OUTCOME = failure }

		#Message for close relatives
		inform_liege_about_disease_treatment_effect = { TREATMENT = safe OUTCOME = failure }
		scope:physician.location ?= { save_scope_as = background_terrain_scope }
	}

	#Ok...
	option = {
		name = health.3104.a
		ai_chance = {
			factor = 40
		}
	}

	#Imprison!
	option = {
		trigger = {
			can_punish_court_physician = { PHYSICIAN = scope:physician }
			scope:physician = { is_imprisoned = no }
			OR = {
				has_trait = wrathful
				has_trait = vengeful
				has_trait = arbitrary
				has_trait = paranoid
				has_trait = sadistic
				has_trait = callous
			}
		}
		trait = wrathful
		trait = vengeful
		trait = arbitrary
		trait = paranoid
		trait = sadistic
		trait = callous

		name = health.3107.d

		imprison_physician_effect = yes

		ai_chance = {
			factor = 30 #Can go up to ~80 for lowest compassion characters and becomes 0 for characters with medium positive compassion
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_negative_ai_value
			}
		}
	}

	#Execute!
	option = {
		trigger = {
			can_punish_court_physician = { PHYSICIAN = scope:physician }
			OR = {
				has_trait = wrathful
				has_trait = vengeful
				has_trait = arbitrary
				has_trait = paranoid
				has_trait = sadistic
				has_trait = callous
			}
		}
		trait = wrathful
		trait = vengeful
		trait = arbitrary
		trait = paranoid
		trait = sadistic
		trait = callous

		name = health.3107.e

		execute_physician_effect = yes

		ai_chance = {
			factor = 15 #Can go up to ~65 for lowest compassion characters and becomes 0 for characters with low positive compassion
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_negative_ai_value
			}
		}
	}
	after = {
		hidden_effect = {
			if = {
				limit = {
					has_global_variable = tutorial_completed
				}
				add_character_flag = force_court_positions_tutorial
			}
		}
	}
}

#RISKY TREATMENT: CRITICAL SUCCESS
scripted_trigger health_successful_physician_happy_for_trigger = {
	scope:physician = {
		OR = {
			opinion = {
				target = $CHARACTER$
				value >= high_positive_opinion
			}
			ai_compassion >= medium_positive_compassion
		}

	}
}

health.3105 = {
	type = character_event
	title = health.3105.t
	desc = {
		#Treatment type
		random_valid = {
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.1.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.2.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.3.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.4.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.5.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.6.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.7.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.8.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.9.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						var:treatment_strategy = flag:amputation
						var:treatment_strategy = flag:disfigurement
						var:treatment_strategy = flag:castration
					}
				}
				desc = health.risky_treatment_surgery.1.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						var:treatment_strategy = flag:amputation
						var:treatment_strategy = flag:disfigurement
						var:treatment_strategy = flag:eye
						var:treatment_strategy = flag:castration
					}
				}
				desc = health.risky_treatment_surgery.2.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:amputation }
				desc = health.risky_treatment_amputation.1.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:disfigurement }
				desc = health.risky_treatment_disfigurement.1.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:eye }
				desc = health.risky_treatment_eye.1.desc
			}
		}
		desc = health.3105.end.desc
	}

	theme = healthcare
	override_background = {
		trigger = { scope:physician ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = {
				health_successful_physician_happy_for_trigger = { CHARACTER = root }
			}
			animation = happiness
		}
		animation = physician
	}

	trigger = {
		NOT = { scope:disease_type = flag:leper } #blocked in risky_disease_treatment_effect too
	}

	immediate = {
		play_music_cue = "mx_cue_positive_effect"

		#Removes traits, removes body part if the treatment strategy demands it, shows a tooltip if physician ranked up
		disease_treatment_results_effect = { TREATMENT = risky OUTCOME = critical_success }

		#Message for close relatives
		inform_liege_about_disease_treatment_effect = { TREATMENT = risky OUTCOME = critical_success }
		scope:physician.location ?= { save_scope_as = background_terrain_scope }
		if = {
			limit = {
				is_ai = no
				scope:disease_type = flag:bubonic_plague
			}
			add_achievement_global_variable_effect = {
				VARIABLE = ce1_not_today_achievement_unlocked
				VALUE = yes
			}
		}
	}

	#I am healed!
	option = {
		name = health.3105.a
	}

	after = {
		hidden_effect = {
			if = {
				limit = {
					has_global_variable = tutorial_completed
				}
				add_character_flag = force_court_positions_tutorial
			}
		}
	}
}

#RISKY TREATMENT: REGULAR SUCCESS
health.3106 = {
	type = character_event
	title = health.3106.t
	desc = {
		#Treatment type
		random_valid = {
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.1.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.2.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.3.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.4.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.5.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.6.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.7.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.8.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.9.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						var:treatment_strategy = flag:amputation
						var:treatment_strategy = flag:disfigurement
						var:treatment_strategy = flag:castration
					}
				}
				desc = health.risky_treatment_surgery.1.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						var:treatment_strategy = flag:amputation
						var:treatment_strategy = flag:disfigurement
						var:treatment_strategy = flag:eye
						var:treatment_strategy = flag:castration
					}
				}
				desc = health.risky_treatment_surgery.2.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:amputation }
				desc = health.risky_treatment_amputation.1.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:disfigurement }
				desc = health.risky_treatment_disfigurement.1.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:eye }
				desc = health.risky_treatment_eye.1.desc
			}
		}
		desc = health.3106.end.desc
	}

	theme = healthcare
	override_background = {
		trigger = { scope:physician ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = {
				health_successful_physician_happy_for_trigger = { CHARACTER = root }
			}
			animation = personality_content
		}
		animation = physician
	}

	immediate = {
		#Adds modifiers, removes body part if the treatment strategy demands it, sends return visit event in 1-5 years, shows a tooltip if physician ranked up
		disease_treatment_results_effect = { TREATMENT = risky OUTCOME = success }

		#Message for close relatives
		inform_liege_about_disease_treatment_effect = { TREATMENT = risky OUTCOME = success }
		scope:physician.location ?= { save_scope_as = background_terrain_scope }
		if = {
			limit = {
				is_ai = no
				scope:disease_type = flag:bubonic_plague
			}
			add_achievement_global_variable_effect = {
				VARIABLE = ce1_not_today_achievement_unlocked
				VALUE = yes
			}
		}
	}

	#I feel better!
	option = {
		name = health.3106.a
	}

	after = {
		hidden_effect = {
			if = {
				limit = {
					has_global_variable = tutorial_completed
				}
				add_character_flag = force_court_positions_tutorial
			}
		}
	}
}

#RISKY TREATMENT: FAILURE
health.3107 = {
	type = character_event
	title = health.3107.t
	desc = {
		#Treatment type
		random_valid = {
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.1.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.2.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.3.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.4.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.5.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.6.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.7.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.8.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.risky_treatment_medicine.9.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						var:treatment_strategy = flag:amputation
						var:treatment_strategy = flag:disfigurement
						var:treatment_strategy = flag:castration
					}
				}
				desc = health.risky_treatment_surgery.1.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						var:treatment_strategy = flag:amputation
						var:treatment_strategy = flag:disfigurement
						var:treatment_strategy = flag:eye
						var:treatment_strategy = flag:castration
					}
				}
				desc = health.risky_treatment_surgery.2.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:amputation }
				desc = health.risky_treatment_amputation.1.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:disfigurement }
				desc = health.risky_treatment_disfigurement.1.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:eye }
				desc = health.risky_treatment_eye.1.desc
			}
		}
		first_valid = {
			triggered_desc = { #Will die right now
				trigger = { has_character_flag = die_risky_treatment }
				desc = health.3107.death.desc
			}
			desc = health.3107.end.desc
		}
	}
	theme = healthcare
	override_background = {
		trigger = { scope:physician ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	override_icon = {
		trigger = { has_character_flag = die_risky_treatment }
		reference = "gfx/interface/icons/event_types/type_illness.dds"
	}
	left_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = {
				health_failed_physician_fears_trigger = yes
			}
			animation = fear
		}
		animation = shame
	}

	trigger = { #They might have died before this is triggered
		is_alive = yes
	}

	immediate = {
		if = {
			limit = { has_character_flag = die_risky_treatment }
			play_music_cue = "mx_cue_death"
		}
		else = {
			play_music_cue = "mx_cue_illness"
		}
		#Adds modifiers, removes body part if the treatment strategy demands it, sends return visit event in 1-5 years (unless died), shows a tooltip if physician ranked up
		disease_treatment_results_effect = { TREATMENT = risky OUTCOME = failure }

		#Set my opinion here (if forgive/chastise, it is later downgraded to non-crime opinion)
		hidden_effect = { add_failed_treatment_of_me_opinions_effect = yes }
		scope:physician.location ?= { save_scope_as = background_terrain_scope }
	}

	#I'm dying
	option = {
		trigger = { has_character_flag = die_risky_treatment }
		name = health.3107.a

		#Message for close relatives, or punishment event if relative is your liege
		inform_liege_about_disease_treatment_effect = { TREATMENT = risky OUTCOME = death }

		death = {
			death_reason = death_treatment
			killer = scope:physician
		}
	}

	#Chastise
	option = {
		trigger = {
			NOT = { has_character_flag = die_risky_treatment }
			can_punish_court_physician = { PHYSICIAN = scope:physician }
		}
		name = health.3107.b

		chastise_physician_effect = yes
		inform_liege_about_disease_treatment_effect = { TREATMENT = risky OUTCOME = failure } #Messages my relatives

		ai_chance = {
			factor = 30
			modifier = {
				scope:physician = { has_character_modifier = chastised_physician_modifier }
				add = -20
			}
		}
	}

	#Forgive
	option = {
		trigger = {
			NOT = { has_character_flag = die_risky_treatment }
			can_punish_court_physician = { PHYSICIAN = scope:physician }
		}
		name = health.3107.c

		forgive_physician_effect = yes
		inform_liege_about_disease_treatment_effect = { TREATMENT = risky OUTCOME = failure } #Messages my relatives

		ai_chance = {
			factor = 20
			ai_value_modifier = {
				max = 80
				ai_compassion = tiny_chance_impact_positive_ai_value #+50 for max compassionate, -50 for max uncompassionate
				ai_vengefulness = low_chance_impact_negative_ai_value #-100 for max vengeful, +100 for max forgiving
			}
		}
	}

	#Imprison!
	option = {
		trigger = {
			NOT = { has_character_flag = die_risky_treatment }
			can_punish_court_physician = { PHYSICIAN = scope:physician }
			scope:physician = { is_imprisoned = no }
		}
		name = health.3107.d

		imprison_physician_effect = yes
		inform_liege_about_disease_treatment_effect = { TREATMENT = risky OUTCOME = failure } #Messages my relatives

		ai_chance = {
			factor = 30 #Can go up to ~80 for lowest compassion characters and becomes 0 for characters with medium positive compassion
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_negative_ai_value
			}
		}
	}

	#Execute!
	option = {
		trigger = {
			NOT = { has_character_flag = die_risky_treatment }
			can_punish_court_physician = { PHYSICIAN = scope:physician }
		}
		name = health.3107.e

		execute_physician_effect = yes
		inform_liege_about_disease_treatment_effect = { TREATMENT = risky OUTCOME = failure } #Messages my relatives

		ai_chance = {
			factor = 15 #Can go up to ~65 for lowest compassion characters and becomes 0 for characters with low positive compassion
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_negative_ai_value
			}
		}
	}

	#OK (I am not liege and can't punish)
	option = {
		trigger = {
			NOR = {
				has_character_flag = die_risky_treatment
				can_punish_court_physician = { PHYSICIAN = scope:physician }
			}
		}

		#Message for close relatives, or punishment event if relative is your liege
		inform_liege_about_disease_treatment_effect = { TREATMENT = risky OUTCOME = failure }
	}

	after = {
		hidden_effect = {
			if = {
				limit = {
					has_global_variable = tutorial_completed
				}
				add_character_flag = force_court_positions_tutorial
			}
		}
	}
}


#MYSTIC TREATMENT: CRITICAL SUCCESS
health.3108 = {
	type = character_event
	title = health.3108.t
	desc = {
		first_valid = {
			#First, the special outcomes that need their own text
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:occult_cannibal }
				desc = health.mystic_treatment_occult.cannibal.desc
			}
			triggered_desc = {
				trigger = { 
					var:treatment_strategy = flag:occult_deviant
				}
				desc = health.mystic_treatment_occult.deviant.desc
			}
			#If not, take anything
			random_valid = {
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:occult }
					desc = health.mystic_treatment_occult.1.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:occult }
					desc = health.mystic_treatment_occult.2.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:occult }
					desc = health.mystic_treatment_occult.3.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:occult }
					desc = health.mystic_treatment_occult.4.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:occult }
					desc = health.mystic_treatment_occult.5.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.1.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.2.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.3.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.4.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.5.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.6.desc
				}
			}
		}
		desc = health.3108.end.desc
	}

	theme = healthcare
	override_background = {
		trigger = { scope:physician ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = { health_successful_physician_happy_for_trigger = { CHARACTER = root } }
			animation = happiness
		}
		animation = physician
	}

	trigger = {
		NOT = { scope:disease_type = flag:leper } #blocked in mystic_disease_treatment_effect too
	}

	immediate = {
		play_music_cue = "mx_cue_positive_effect"

		#Removes traits, removes body part if the treatment strategy demands it, shows a tooltip if physician ranked up
		disease_treatment_results_effect = { TREATMENT = mystic OUTCOME = critical_success }

		#Message for close relatives
		inform_liege_about_disease_treatment_effect = { TREATMENT = mystic OUTCOME = critical_success }
		scope:physician.location ?= { save_scope_as = background_terrain_scope }
	}

	#I am healed!
	option = {
		name = health.3108.a

	}

	after = {
		hidden_effect = {
			if = {
				limit = {
					has_global_variable = tutorial_completed
				}
				add_character_flag = force_court_positions_tutorial
			}
		}
	}
}

#MYSTIC TREATMENT: SUCCESS
health.3109 = {
	type = character_event
	title = health.3109.t
	desc = {
		first_valid = {
			#First, the special outcomes that need their own text
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:occult_cannibal }
				desc = health.mystic_treatment_occult.cannibal.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:occult_deviant }
				desc = health.mystic_treatment_occult.deviant.desc
			}
			#If not, take anything
			random_valid = {
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:occult }
					desc = health.mystic_treatment_occult.1.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:occult }
					desc = health.mystic_treatment_occult.2.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:occult }
					desc = health.mystic_treatment_occult.3.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:occult }
					desc = health.mystic_treatment_occult.4.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:occult }
					desc = health.mystic_treatment_occult.5.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.1.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.2.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.3.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.4.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.5.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.6.desc
				}
			}
		}
		desc = health.3109.end.desc
	}

	theme = healthcare
	override_background = {
		trigger = { scope:physician ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = { health_successful_physician_happy_for_trigger = { CHARACTER = root } }
			animation = happiness
		}
		animation = physician
	}

	immediate = {
		#Removes traits, removes body part if the treatment strategy demands it, shows a tooltip if physician ranked up
		disease_treatment_results_effect = { TREATMENT = mystic OUTCOME = success }

		#Message for close relatives
		inform_liege_about_disease_treatment_effect = { TREATMENT = mystic OUTCOME = success }
		scope:physician.location ?= { save_scope_as = background_terrain_scope }
	}

	#I am healed!
	option = {
		name = health.3109.a

	}

	after = {
		hidden_effect = {
			if = {
				limit = {
					has_global_variable = tutorial_completed
				}
				add_character_flag = force_court_positions_tutorial
			}
		}
	}
}


#MYSTIC TREATMENT: FAILURE
health.3110 = {
	type = character_event
	title = health.3110.t
	desc = {
		first_valid = {
			#First, the special outcomes that need their own text
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:occult_cannibal }
				desc = health.mystic_treatment_occult.cannibal.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:occult_deviant }
				desc = health.mystic_treatment_occult.deviant.desc
			}
			#If not, take anything
			random_valid = {
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:occult }
					desc = health.mystic_treatment_occult.1.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:occult }
					desc = health.mystic_treatment_occult.2.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:occult }
					desc = health.mystic_treatment_occult.3.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:occult }
					desc = health.mystic_treatment_occult.4.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:occult }
					desc = health.mystic_treatment_occult.5.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.1.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.2.desc
				}
#				triggered_desc = {
#					trigger = { var:treatment_strategy = flag:questionable }
#					desc = health.mystic_treatment_questionable.3.desc
#				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.4.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.5.desc
				}
				triggered_desc = {
					trigger = { var:treatment_strategy = flag:questionable }
					desc = health.mystic_treatment_questionable.6.desc
				}
			}
		}
		desc = health.3110.end.desc
	}
	theme = healthcare
	override_background = {
		trigger = { scope:physician ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = {
				health_failed_physician_fears_trigger = yes
			}
			animation = fear
		}
		animation = shame
	}

	immediate = {
		#Adds traits/secrets, sends return visit event in 1-5 years (unless died), shows a tooltip if physician ranked up
		disease_treatment_results_effect = { TREATMENT = mystic OUTCOME = failure }

		#Set my opinion here (if forgive/chastise, it is later downgraded to non-crime opinion)
		hidden_effect = { add_failed_treatment_of_me_opinions_effect = yes }

		#Message for close relatives, or punishment event if relative is your liege
		inform_liege_about_disease_treatment_effect = { TREATMENT = mystic OUTCOME = failure }
		scope:physician.location ?= { save_scope_as = background_terrain_scope }
	}

	#Chastise
	option = {
		trigger = {
			NOT = { has_character_flag = die_risky_treatment }
			can_punish_court_physician = { PHYSICIAN = scope:physician }
		}
		name = health.3107.b

		chastise_physician_effect = yes

		ai_chance = {
			factor = 30
			modifier = {
				scope:physician = { has_character_modifier = chastised_physician_modifier }
				add = -20
			}
		}
	}

	#Forgive
	option = {
		trigger = {
			NOT = { has_character_flag = die_risky_treatment }
			can_punish_court_physician = { PHYSICIAN = scope:physician }
		}
		name = health.3107.c

		forgive_physician_effect = yes

		ai_chance = {
			factor = 20
			ai_value_modifier = {
				max = 80
				ai_compassion = tiny_chance_impact_positive_ai_value #+50 for max compassionate, -50 for max uncompassionate
				ai_vengefulness = low_chance_impact_negative_ai_value #-100 for max vengeful, +100 for max forgiving
			}
		}
	}

	#Imprison!
	option = {
		trigger = {
			NOT = { has_character_flag = die_risky_treatment }
			can_punish_court_physician = { PHYSICIAN = scope:physician }
			scope:physician = { is_imprisoned = no }
		}
		name = health.3107.d

		imprison_physician_effect = yes

		ai_chance = {
			factor = 30 #Can go up to ~80 for lowest compassion characters and becomes 0 for characters with medium positive compassion
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_negative_ai_value
			}
		}
	}

	#Execute!
	option = {
		trigger = {
			NOT = { has_character_flag = die_risky_treatment }
			can_punish_court_physician = { PHYSICIAN = scope:physician }
		}
		name = health.3107.e

		execute_physician_effect = yes

		ai_chance = {
			factor = 15 #Can go up to ~65 for lowest compassion characters and becomes 0 for characters with low positive compassion
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_negative_ai_value
			}
		}
	}

	#OK (I am not liege and can't punish)
	option = {
		trigger = {
			NOR = {
				has_character_flag = die_risky_treatment
				can_punish_court_physician = { PHYSICIAN = scope:physician }
			}
		}
	}

	after = {
		hidden_effect = {
			if = {
				limit = {
					has_global_variable = tutorial_completed
				}
				add_character_flag = force_court_positions_tutorial
			}
		}
	}
}


###########################################
# FAILED TREATMENT FOR IMPORTANT COURTIER # by Mathilda Bjarnehed and Linnéa Thimrén
###########################################

#Failed risky treatment
health.3200 = {
	type = character_event
	title = health.3107.t
	desc = {
		first_valid = {
			triggered_desc = { #Dead!
				trigger = { scope:outcome = flag:death }
				desc = health.3200.death.desc
			}
			desc = {
				random_valid = {
					triggered_desc = {
					    trigger = {
							scope:physician = scope:sick_character
					    }
					    desc = health.3200.failure.desc_3
					}
					desc = health.3200.failure.desc_2
					desc = health.3200.failure.desc
				}
			}
		}
		triggered_desc = {
		    trigger = { scope:sick_character != scope:physician }
		    desc = health.3200.end.desc
		}
	}
	theme = healthcare
	override_background = {
		trigger = { scope:sick_character ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	override_icon = {
		trigger = { scope:outcome = flag:death }
		reference = "gfx/interface/icons/event_types/type_illness.dds"
	}
	left_portrait = {
		character = scope:sick_character
		animation = sick
	}
	right_portrait = {
		trigger = { scope:sick_character != scope:physician }
		character = scope:physician
		triggered_animation = {
			trigger = {
				health_failed_physician_fears_trigger = yes
			}
			animation = fear
		}
		animation = shame
	}


	immediate = {
		scope:sick_character.location ?= { save_scope_as = background_terrain_scope }
		if = {
			limit = { NOT = { scope:outcome = flag:death } }
			if = {
				limit = { scope:disease_or_wound = flag:disease }
				disease_treatment_result_tooltip_effect = { TREATMENT = risky OUTCOME = failure }
			}
			else_if = {
				limit = { scope:disease_or_wound = flag:wound }
				wound_treatment_result_tooltip_effect = { TREATMENT = risky OUTCOME = failure }
			}
		}
		else = {
			show_as_tooltip = {
				play_music_cue = "mx_cue_death"
				scope:sick_character = {
					death = {
						death_reason = death_treatment
						killer = scope:physician
					}
				}
			}
		}
	}

	#Chastise
	option = {
		name = health.3107.b
		trigger = {
			can_punish_court_physician = { PHYSICIAN = scope:physician }
			scope:sick_character != scope:physician
		}

		chastise_physician_effect = yes

		ai_chance = {
			factor = 30
			modifier = {
				scope:physician = { has_character_modifier = chastised_physician_modifier }
				add = -20
			}
		}
	}

	#Forgive
	option = {
		name = health.3107.c
		trigger = { scope:sick_character != scope:physician }

		forgive_physician_effect = yes

		ai_chance = {
			factor = 20
			ai_value_modifier = {
				max = 80
				ai_compassion = tiny_chance_impact_positive_ai_value #+50 for max compassionate, -50 for max uncompassionate
				ai_vengefulness = low_chance_impact_negative_ai_value #-100 for max vengeful, +100 for max forgiving
			}
		}
	}

	#Imprison!
	option = {
		name = health.3107.d
		trigger = {
			can_punish_court_physician = { PHYSICIAN = scope:physician }
			scope:physician = { is_imprisoned = no }
			scope:sick_character != scope:physician
		}

		imprison_physician_effect = yes

		ai_chance = {
			factor = 30 #Can go up to ~80 for lowest compassion characters and becomes 0 for characters with medium positive compassion
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_negative_ai_value
			}
		}
	}

	#Execute!
	option = {
		name = health.3107.e
		trigger = {
			can_punish_court_physician = { PHYSICIAN = scope:physician }
			scope:sick_character != scope:physician
		}

		execute_physician_effect = yes

		ai_chance = {
			factor = 15 #Can go up to ~65 for lowest compassion characters and becomes 0 for characters with low positive compassion
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_negative_ai_value
			}
		}
	}

	#They treated themselves...
	option = {
		name = health.3107.f
		trigger = {
			scope:sick_character = scope:physician
		}

		chastise_physician_effect = yes

		ai_chance = { #Will be only option available if it's available
			base = 100
		}
	}
}

#Failed mystic treatment
health.3201 = {
	type = character_event
	title = health.3107.t
	desc = {
		desc = health.3201.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:sick_character = {
							var:treatment_strategy = flag:occult
							var:treatment_strategy = flag:occult_cannibal
							var:treatment_strategy = flag:occult_deviant
						}
				}
				desc = {
					first_valid = {
						triggered_desc = {
						    trigger = {
								scope:sick_character = scope:physician
						    }
						    desc = health.3201.occult.desc_sick_physician
						}
						desc = health.3201.occult.desc
					}
				}
			}
			desc = health.3201.questionable.desc
		}
	}
	theme = healthcare
	override_background = {
		trigger = { scope:sick_character ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:sick_character
		animation = stress
	}
	right_portrait = {
		trigger = { scope:sick_character != scope:physician }
		character = scope:physician
		triggered_animation = {
			trigger = {
				health_failed_physician_fears_trigger = yes
			}
			animation = fear
		}
		animation = shame
	}

	immediate = {
		scope:sick_character.location ?= { save_scope_as = background_terrain_scope }
		disease_treatment_result_tooltip_effect = { TREATMENT = risky OUTCOME = failure }
	}

	#Chastise
	option = {
		name = health.3107.b
		trigger = {
			can_punish_court_physician = { PHYSICIAN = scope:physician }
		}

		chastise_physician_effect = yes

		ai_chance = {
			factor = 30
			modifier = {
				scope:physician = { has_character_modifier = chastised_physician_modifier }
				add = -20
			}
		}
	}

	#Forgive
	option = {
		name = health.3201.c
		trigger = { scope:sick_character != scope:physician }

		forgive_physician_effect = yes

		ai_chance = {
			factor = 20
			ai_value_modifier = {
				max = 80
				ai_compassion = tiny_chance_impact_positive_ai_value #+50 for max compassionate, -50 for max uncompassionate
				ai_vengefulness = low_chance_impact_negative_ai_value #-100 for max vengeful, +100 for max forgiving
			}
		}
	}

	#Imprison!
	option = {
		name = health.3107.d
		trigger = {
			can_punish_court_physician = { PHYSICIAN = scope:physician }
			scope:physician = { is_imprisoned = no }
			scope:sick_character != scope:physician
		}

		imprison_physician_effect = yes

		ai_chance = {
			factor = 30 #Can go up to ~80 for lowest compassion characters and becomes 0 for characters with medium positive compassion
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_negative_ai_value
			}
		}
	}

	#Execute!
	option = {
		name = health.3107.e
		trigger = {
			can_punish_court_physician = { PHYSICIAN = scope:physician }
			scope:sick_character != scope:physician
		}

		execute_physician_effect = yes

		ai_chance = {
			factor = 15 #Can go up to ~65 for lowest compassion characters and becomes 0 for characters with low positive compassion
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_negative_ai_value
			}
		}
	}

	#They treated themselves...
	option = {
		name = health.3107.f
		trigger = {
			scope:sick_character = scope:physician
		}

		chastise_physician_effect = yes

		ai_chance = { #Will be only option available if it's available
			base = 100
		}
	}
}






###################
# WOUND TREATMENT # by Linnéa Thimrén
###################

#Who should decide about my treatment?
health.4999 = {
	hidden = yes

	trigger = {
		has_wounds_trigger = yes
		has_recent_wound_treatment_trigger = no
		court_physician_available_trigger = yes
	}

	immediate = {
		save_scope_as = sick_character
		decide_who_picks_wound_treatment_effect = yes #Sends health.4001 to me or 4002 to liege
	}

	on_trigger_fail = {
		#No wound/no physician: do nothing (if we hire a new physician, they will treat everyone upon being hired)
		#Has a wound but treatment is still active? Try again
		if = {
			limit = {
				has_wounds_trigger = yes
				has_recent_wound_treatment_trigger = yes #The only difference
				court_physician_available_trigger = yes
			}
			trigger_event = { id = health.4999 years = 1 }
		}
	}
}

#Someone important to you is wounded. If you're their liege and you have a court physician, you may chose their treatment.
health.4000 = {
	type = character_event
	title = health.4000.t
	desc = {
		desc = health.4000.start.desc
		first_valid = {
			triggered_desc = { #Gangrene
				trigger = {
					scope:sick_character = {
						has_character_modifier = gangrene_modifier
					}
				}
				desc = health.4000.gangrene.desc
			}
			triggered_desc = { #Close to death
				trigger = {
					scope:sick_character = {
						has_trait_rank = {
							trait = wounded
							rank = 3
						}
					}
				}
				desc = health.4000.close_to_death_wounded.desc
			}
			triggered_desc = { #Infection
				trigger = {
					scope:sick_character = {
						has_character_modifier = infected_wound_modifier
					}
				}
				desc = health.4000.infected_wound.desc
			}
			triggered_desc = { #wounded lvl 2
				trigger = {
					scope:sick_character = {
						has_trait_rank = {
							trait = wounded
							rank = 2
						}
					}
				}
				desc = health.4000.very_wounded.desc
			}
			desc = health.4000.wounded.desc #Wounded lvl 1
		}
		triggered_desc = {
			trigger = {
				root_picks_treatment_for_sick_character_trigger = yes
				court_physician_available_trigger = yes
			}
			desc = {
				first_valid = {
					triggered_desc = {
					    trigger = {
							scope:sick_character = scope:physician
					    }
					    desc = health.2201.court_physician.desc_sick_physician
					}
					desc = health.2201.court_physician.desc
				}
			}
		}
	}
	theme = healthcare
	override_background = {
		trigger = { scope:sick_character ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:sick_character
		triggered_animation = {
			trigger = { has_trait = wounded_1 }
			animation = sick
		}
		animation = severelywounded
	}
	#Show physician portrait if you're picking the sick character's treatment
	right_portrait = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			scope:sick_character != scope:physician
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = scope:sick_character } } }
			animation = worry
		}
		animation = physician
	}

	trigger = {
		scope:sick_character = { is_alive = yes }
	}

	immediate = {
		scope:sick_character.location ?= { save_scope_as = background_terrain_scope }
		show_as_tooltip = {
			if = {
				limit = {
					scope:sick_character = {
						has_trait = wounded_3
					}
				}
				scope:sick_character = { add_trait_force_tooltip = wounded_3 }
			}
			else_if = {
				limit = {
					scope:sick_character = {
						has_trait = wounded_2
					}
				}
				scope:sick_character = { add_trait_force_tooltip = wounded_2 }
			}
			else_if = {
				limit = {
					scope:sick_character = {
						has_trait = wounded_1
					}
				}
				scope:sick_character = { add_trait_force_tooltip = wounded_1 }
			}
			if = {
				limit = {
					scope:sick_character = {
						has_character_modifier = infected_wound_modifier
					}
				}
				scope:sick_character = {
					add_character_modifier = {
						modifier = infected_wound_modifier
					}
				}
			}
			if = {
				limit = {
					scope:sick_character = {
						has_character_modifier = gangrene_modifier
					}
				}
				scope:sick_character = {
					add_character_modifier = {
						modifier = gangrene_modifier
					}
				}
			}
		}
	}

	###PHYSICIAN OPTIONS###
	#Safe
	option = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			court_physician_available_trigger = yes
			NOT = { scope:sick_character = { has_character_modifier = gangrene_modifier } } #not available if they have gangrene
		}
		name = health.3102.a
		scope:sick_character = { safe_wound_treatment_effect = yes }
		ai_chance = { base = 10 }
	}

	#Risky
	option = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			court_physician_available_trigger = yes
		}
		name = health.3102.b
		scope:sick_character = { risky_wound_treatment_effect = yes }
		ai_chance = { base = 1 }
	}

	#No treatment
	option = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			court_physician_available_trigger = yes
		}
		name = health.3102.d
		deny_treatment_effect = { PATIENT = scope:sick_character TREATMENT_PICKER = root }
		ai_chance = { base = 0 }
	}

	#Let them pick
	option = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			court_physician_available_trigger = yes
			NOT = { scope:sick_character = { has_character_modifier = gangrene_modifier } } #not available if they have gangrene
		}
		name = {
			trigger = {
				OR = {
					scope:sick_character = { is_adult = yes }
					scope:sick_character != scope:physician
				}
			}
			text = health.3102.e_adult
		}
		name = {
			trigger = {
				OR = {
					scope:sick_character = { is_adult = no }
					scope:sick_character = scope:physician
				}
			}
			text = health.3102.e_child
		}
		scope:sick_character = { pick_own_wound_treatment_effect = yes }
		ai_chance = { base = 0 }
	}

	###NO PHYSICIAN OPTIONS###
	#Find physician
	option = {
		trigger = {
			court_physician_available_trigger = no
			root_picks_treatment_for_sick_character_trigger = yes
		}
		name = health.3101.e
		find_court_physician_effect = yes #This will trigger 4001 (they decide treatment) or 4002 (liege decides treatment) further down the line in which the patient's wound will actually be treated
		ai_chance = { base = 1 }
	}

	#Nothing to do
	option = {
		trigger = {
			NAND = {
				root_picks_treatment_for_sick_character_trigger = yes
				court_physician_available_trigger = yes
			}
		}
		name = health.4000.a
		ai_chance = { base = 10 }
	}
}



#I decide my treatment
health.4001 = {
	type = character_event
	title = health.3101.t
	desc = {
		desc = health.4001.start.desc
		random_valid = {
			triggered_desc = {
				trigger = {
					NOT = {
						scope:sick_character = {
							has_character_modifier = gangrene_modifier
						}
					}
					OR = {
						scope:sick_character = {
							OR = {
								has_trait_rank = {
									trait = wounded
									rank <= 2
								}
								health >= death_chance_starts_health
							}
						}
						scope:physician = {
							has_trait = lifestyle_physician
						}
					}
				}
				desc = health.4001.safe_recommendation.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						scope:sick_character = {
							OR = {
								has_character_modifier = gangrene_modifier
								health < death_chance_starts_health
							}
						}
						scope:physician = {
							NOT = { has_trait = lifestyle_physician }
						}
					}
				}
				desc = {
					first_valid = {
						triggered_desc = {
							trigger = {
								scope:sick_character = {
									has_character_modifier = gangrene_modifier
								}
							}
							desc = health.4001.gangrene.desc
						}
						triggered_desc = {
							trigger = {
								scope:sick_character = {
									has_character_modifier = infected_wound_modifier
								}
							}
							desc = health.4001.infection.desc
						}
						desc = health.4001.risky_recommendation.desc
					}
				}
			}
		}
		desc = health.3101.end.desc
	}

	theme = healthcare
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain
	}
	left_portrait = {
		character = scope:sick_character
		triggered_animation = {
			trigger = { has_trait = wounded_1 }
			animation = sick
		}
		animation = severelywounded
	}
	right_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = root } } }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:physician = { ai_rationality >= 0 } } #Don't look rational if you're not
			animation = personality_rational
		}
		animation = physician
	}

	trigger = {
		court_physician_available_trigger = yes
	}

	immediate = {
		hidden_effect = {
			save_court_physician_as_effect = { SCOPE_NAME = physician }
			#Are wounds infected? Gangrene??
		}
	}

	#Safe
	option = {
		name = health.3101.a
		trigger = {
			NOT = { scope:sick_character = { has_character_modifier = gangrene_modifier } } #not available if they have gangrene
		}
		scope:sick_character = { safe_wound_treatment_effect = yes }
		ai_chance = { base = 10 }
	}

	#Risky
	option = {
		name = health.3101.b
		scope:sick_character = { risky_wound_treatment_effect = yes }
		ai_chance = { base = 1 }
	}

	#No treatment
	option = {
		name = health.3101.d
		ai_chance = { base = 1 }
	}
}

#I have now hired a court physician, and an important courtier is wounded: time to decide their treatment
health.4002 = {
	type = character_event
	title = health.4000.t
	desc = {
		first_valid = {
			triggered_desc = {
			    trigger = {
					scope:sick_character = scope:physician
			    }
			    desc = health.4002.start.desc_sick_physician
			}
			desc = health.4002.start.desc
		}
		random_valid = {
			triggered_desc = {
				trigger = {
					NOT = {
						scope:sick_character = {
							has_character_modifier = gangrene_modifier
						}
					}
					OR = {
						scope:sick_character = {
							OR = {
								has_trait_rank = {
									trait = wounded
									rank <= 2
								}
								health >= death_chance_starts_health
							}
						}
						scope:physician = {
							has_trait = lifestyle_physician
						}
					}
				}
				desc = health.4001.safe_recommendation.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						OR = {
							has_character_modifier = gangrene_modifier
							health < death_chance_starts_health
						}
						scope:physician = {
							NOT = { has_trait = lifestyle_physician }
						}
					}
				}
				desc = {
					first_valid = {
						triggered_desc = {
							trigger = {
								scope:sick_character = {
									has_character_modifier = gangrene_modifier
								}
							}
							desc = health.4001.gangrene.desc
						}
						triggered_desc = {
							trigger = {
								scope:sick_character = {
									has_character_modifier = infected_wound_modifier
								}
							}
							desc = health.4001.infection.desc
						}
						desc = health.4001.risky_recommendation.desc
					}
				}
			}
		}
		desc = health.3101.end.desc
	}
	theme = healthcare
	override_background = {
		trigger = { scope:sick_character ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:sick_character
		triggered_animation = {
			trigger = { has_trait = wounded_1 }
			animation = sick
		}
		animation = severelywounded
	}
	#Show physician portrait if you're picking the sick character's treatment
	right_portrait = {
		trigger = {
			root_picks_treatment_for_sick_character_trigger = yes
			scope:sick_character != scope:physician
		}
		character = scope:physician
		triggered_animation = {
			trigger = { scope:physician = { health_event_is_worried_trigger = { CHARACTER = scope:sick_character } } }
			animation = worry
		}
		animation = physician
	}

	trigger = {
		court_physician_available_trigger = yes
		scope:sick_character = { is_alive = yes }
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		scope:sick_character.location ?= { save_scope_as = background_terrain_scope }
		hidden_effect = {
			save_court_physician_as_effect = { SCOPE_NAME = physician }
			#Are wounds infected? Gangrene??
		}
	}

	#Safe
	option = {
		name = health.3101.a
		trigger = {
			NOT = { scope:sick_character = { has_character_modifier = gangrene_modifier } } #not available if they have gangrene
		}
		scope:sick_character = { safe_wound_treatment_effect = yes }
		ai_chance = { base = 10 }
	}

	#Risky
	option = {
		name = health.3101.b
		scope:sick_character = { risky_wound_treatment_effect = yes }
		ai_chance = { base = 1 }
	}

	#No treatment
	option = {
		name = health.3102.d
		deny_treatment_effect = { PATIENT = scope:sick_character TREATMENT_PICKER = root }
		ai_chance = { base = 1 }
	}

	#Let them pick
	option = {
		trigger = {
			NOT = { scope:sick_character = { has_character_modifier = gangrene_modifier } } #not available if they have gangrene
		}
		name = {
			trigger = {
				OR = {
					scope:sick_character = { is_adult = yes }
					scope:sick_character != scope:physician
				}
			}
			text = health.3102.e_adult
		}
		name = {
			trigger = {
				OR = {
					scope:sick_character = { is_adult = no }
					scope:sick_character = scope:physician
				}
			}
			text = health.3102.e_child
		}
		scope:sick_character = { pick_own_wound_treatment_effect = yes }
		ai_chance = { base = 0 }
	}
}


#Safe treatment - success!
health.4101 = {
	type = character_event
	title = health.4101.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:infection
				}
				desc = health.4101.desc_infection
			}
			desc = health.4101.desc_1
			desc = health.4101.desc_2
		}
		desc = health.4101.desc_end
	}
	theme = healthcare
	override_background = {
		trigger = { scope:physician ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = { health_successful_physician_happy_for_trigger = { CHARACTER = root } }
			animation = happiness
		}
		animation = physician
	}

	immediate = {
		scope:physician.location ?= { save_scope_as = background_terrain_scope }
		#Currently no message to liege because liege never picks wound treatment and safe success is not noteworthy

		#Adds modifiers, sends return visit event in 1 years, shows a tooltip if physician ranked up
		wound_treatment_results_effect = { TREATMENT = safe OUTCOME = success }

	}

	option = {
		name = health.4101.a
	}
}

#safe treatment - failure!
health.4102 = {
	type = character_event
	title = health.4102.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:infection
				}
				desc = {
					random_valid = {
						desc = health.4102.desc_infection
						desc = health.4101.desc_infection
					}
				}
			}
			desc = health.4101.desc_2
		}
		desc = health.4102.desc_end
	}

	theme = healthcare
	override_background = {
		trigger = { scope:physician ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = {
				health_failed_physician_fears_trigger = yes
			}
			animation = fear
		}
		animation = shame
	}

	immediate = {
		scope:physician.location ?= { save_scope_as = background_terrain_scope }
		#Currently no message to liege because liege never picks wound treatment and safe failure is not noteworthy

		#Adds modifiers, sends return visit event in 1 year, shows a tooltip if physician ranked up
		wound_treatment_results_effect = { TREATMENT = safe OUTCOME = failure }

	}

	#Ok...
	option = {
		name = health.4102.a
		ai_chance = {
			factor = 40
		}
	}

	#Imprison!
	option = {
		trigger = {
			can_punish_court_physician = { PHYSICIAN = scope:physician }
			scope:physician = { is_imprisoned = no }
			OR = {
				has_trait = wrathful
				has_trait = vengeful
				has_trait = arbitrary
				has_trait = paranoid
				has_trait = sadistic
				has_trait = callous
			}
		}
		trait = wrathful
		trait = vengeful
		trait = arbitrary
		trait = paranoid
		trait = sadistic
		trait = callous

		name = health.3107.d

		imprison_physician_effect = yes

		ai_chance = {
			factor = 30 #Can go up to ~80 for lowest compassion characters and becomes 0 for characters with medium positive compassion
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_negative_ai_value
			}
		}
	}

	#Execute!
	option = {
		trigger = {
			can_punish_court_physician = { PHYSICIAN = scope:physician }
			OR = {
				has_trait = wrathful
				has_trait = vengeful
				has_trait = arbitrary
				has_trait = paranoid
				has_trait = sadistic
				has_trait = callous
			}
		}
		trait = wrathful
		trait = vengeful
		trait = arbitrary
		trait = paranoid
		trait = sadistic
		trait = callous

		name = health.3107.e

		execute_physician_effect = yes

		ai_chance = {
			factor = 15 #Can go up to ~65 for lowest compassion characters and becomes 0 for characters with low positive compassion
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_negative_ai_value
			}
		}
	}
}



#Risky treatment - Critical success
health.4103 = {
	type = character_event
	title = health.4103.t
	desc = {
		#Treatment type
		random_valid = {
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.4103.risky_treatment_medicine.1.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						var:treatment_strategy = flag:amputation
						var:treatment_strategy = flag:disfigurement
						var:treatment_strategy = flag:castration
					}
				}
				desc = health.risky_treatment_surgery.1.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						var:treatment_strategy = flag:amputation
						var:treatment_strategy = flag:disfigurement
						var:treatment_strategy = flag:eye
						var:treatment_strategy = flag:castration
					}
				}
				desc = health.risky_treatment_surgery.2.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:amputation }
				desc = health.risky_treatment_amputation.1.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:disfigurement }
				desc = health.4103.risky_treatment_disfigurement.1.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:eye }
				desc = health.risky_treatment_eye.1.desc
			}
		}
		desc = health.4103.end.desc
	}

	theme = healthcare
	override_background = {
		trigger = { scope:physician ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = {
				health_successful_physician_happy_for_trigger = { CHARACTER = root }
			}
			animation = happiness
		}
		animation = physician
	}

	immediate = {
		scope:physician.location ?= { save_scope_as = background_terrain_scope }
		#Removes traits, removes body part if the treatment strategy demands it, shows a tooltip if physician ranked up
		wound_treatment_results_effect = { TREATMENT = risky OUTCOME = critical_success }

		#Currently no message to liege because liege never picks wound treatment and critical risky success is not noteworthy
	}

	#I am healed!
	option = {
		name = health.3105.a
	}
}

#Risky treatment - Normal success
health.4104 = {
	type = character_event
	title = health.4104.t
	desc = {
		#Treatment type
		random_valid = {
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.4103.risky_treatment_medicine.1.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						var:treatment_strategy = flag:amputation
						var:treatment_strategy = flag:disfigurement
						var:treatment_strategy = flag:castration
					}
				}
				desc = health.risky_treatment_surgery.1.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						var:treatment_strategy = flag:amputation
						var:treatment_strategy = flag:disfigurement
						var:treatment_strategy = flag:eye
						var:treatment_strategy = flag:castration
					}
				}
				desc = health.risky_treatment_surgery.2.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:amputation }
				desc = health.risky_treatment_amputation.1.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:disfigurement }
				desc = health.4103.risky_treatment_disfigurement.1.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:eye }
				desc = health.risky_treatment_eye.1.desc
			}
		}
		desc = health.4104.end.desc
	}
	theme = healthcare
	override_background = {
		trigger = { scope:physician ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = {
				health_successful_physician_happy_for_trigger = { CHARACTER = root }
			}
			animation = happiness
		}
		animation = physician
	}

	immediate = {
		scope:physician.location ?= { save_scope_as = background_terrain_scope }
		#Adds modifiers, removes body part if the treatment strategy demands it, sends return visit event in 1 years, shows a tooltip if physician ranked up
		wound_treatment_results_effect = { TREATMENT = risky OUTCOME = success }

		#Currently no message to liege because liege never picks wound treatment and risky success is not noteworthy
	}

	#I feel better!
	option = {
		name = health.3106.a
	}
}

#Risky treatment - Failure
health.4105 = {
	type = character_event
	title = health.4105.t
	desc = {
		#Treatment type
		random_valid = {
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:medicine }
				desc = health.4103.risky_treatment_medicine.1.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						var:treatment_strategy = flag:amputation
						var:treatment_strategy = flag:disfigurement
						var:treatment_strategy = flag:castration
					}
				}
				desc = health.risky_treatment_surgery.1.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						var:treatment_strategy = flag:amputation
						var:treatment_strategy = flag:disfigurement
						var:treatment_strategy = flag:eye
						var:treatment_strategy = flag:castration
					}
				}
				desc = health.risky_treatment_surgery.2.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:amputation }
				desc = health.risky_treatment_amputation.1.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:disfigurement }
				desc = health.4103.risky_treatment_disfigurement.1.desc
			}
			triggered_desc = {
				trigger = { var:treatment_strategy = flag:eye }
				desc = health.risky_treatment_eye.1.desc
			}
		}
		desc = health.4105.end.desc
	}
	theme = healthcare
	override_background = {
		trigger = { scope:physician ?= { is_travelling = yes } exists = scope:background_terrain_scope }
		reference = terrain_scope
	}
	left_portrait = {
		character = scope:physician
		triggered_animation = {
			trigger = {
				health_failed_physician_fears_trigger = yes
			}
			animation = fear
		}
		animation = shame
	}

	immediate = {
		scope:physician.location ?= { save_scope_as = background_terrain_scope }
		#Adds modifiers, removes body part if the treatment strategy demands it, sends return visit event in 1 years (unless died), shows a tooltip if physician ranked up
		wound_treatment_results_effect = { TREATMENT = risky OUTCOME = failure }

		#Set my opinion here (if forgive/chastise, it is later downgraded to non-crime opinion)
		hidden_effect = { add_failed_treatment_of_me_opinions_effect = yes }
	}

	#I'm dying
	option = {
		trigger = { has_character_flag = die_surgery }
		name = health.3107.a

		#Message for close relatives, or punishment event if relative is your liege
		inform_liege_about_wound_treatment_effect = { TREATMENT = risky OUTCOME = death }

		death = {
			death_reason = death_treatment
			killer = scope:physician
		}
	}

	#Chastise
	option = {
		trigger = {
			NOT = { has_character_flag = die_surgery }
			can_punish_court_physician = { PHYSICIAN = scope:physician }
		}
		name = health.3107.b

		chastise_physician_effect = yes
		inform_liege_about_wound_treatment_effect = { TREATMENT = risky OUTCOME = failure } #Messages my relatives

		ai_chance = {
			factor = 30
			modifier = {
				scope:physician = { has_character_modifier = chastised_physician_modifier }
				add = -20
			}
		}
	}

	#Forgive
	option = {
		trigger = {
			NOT = { has_character_flag = die_surgery }
			can_punish_court_physician = { PHYSICIAN = scope:physician }
		}
		name = health.3107.c

		forgive_physician_effect = yes
		inform_liege_about_wound_treatment_effect = { TREATMENT = risky OUTCOME = failure } #Messages my relatives

		ai_chance = {
			factor = 20
			ai_value_modifier = {
				max = 80
				ai_compassion = tiny_chance_impact_positive_ai_value #+50 for max compassionate, -50 for max uncompassionate
				ai_vengefulness = low_chance_impact_negative_ai_value #-100 for max vengeful, +100 for max forgiving
			}
		}
	}

	#Imprison!
	option = {
		trigger = {
			NOT = { has_character_flag = die_surgery }
			can_punish_court_physician = { PHYSICIAN = scope:physician }
			scope:physician = { is_imprisoned = no }
		}
		name = health.3107.d

		imprison_physician_effect = yes
		inform_liege_about_wound_treatment_effect = { TREATMENT = risky OUTCOME = failure } #Messages my relatives

		ai_chance = {
			factor = 30 #Can go up to ~80 for lowest compassion characters and becomes 0 for characters with medium positive compassion
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_negative_ai_value
			}
		}
	}

	#Execute!
	option = {
		trigger = {
			NOT = { has_character_flag = die_surgery }
			can_punish_court_physician = { PHYSICIAN = scope:physician }
		}
		name = health.3107.e

		execute_physician_effect = yes
		inform_liege_about_wound_treatment_effect = { TREATMENT = risky OUTCOME = failure } #Messages my relatives

		ai_chance = {
			factor = 15 #Can go up to ~65 for lowest compassion characters and becomes 0 for characters with low positive compassion
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_negative_ai_value
			}
		}
	}

	#OK (I am not liege and can't punish)
	option = {
		trigger = {
			NOR = {
				has_character_flag = die_surgery
				can_punish_court_physician = { PHYSICIAN = scope:physician }
			}
		}
		name = health.4102.a

		#Message for close relatives, or punishment event if relative is your liege
		inform_liege_about_wound_treatment_effect = { TREATMENT = risky OUTCOME = failure }
	}
}



###################
###################
# WEIGHT EVENTS #
###################
###################
# by Linnéa Thimrén

#To increase weight more rapidly, and steadily, when taking the gain_weight_decision
health.5004 = {
	hidden = yes

	trigger = {
		has_character_modifier = gaining_weight_modifier # Will continue to trigger until you take the decision to stop
	}

	immediate = {
		change_current_weight = 5
		trigger_event = {
			id = health.5004
			days = 180
		}
	}
}

#To reduce weight more rapidly, and steadily, when taking the lose_weight_decision
health.5005 = {
	hidden = yes

	trigger = {
		has_character_modifier = losing_weight_modifier # Will continue to trigger until you take the decision to stop
	}

	immediate = {
		change_current_weight = -5
		trigger_event = {
			id = health.5005
			days = 90
		}
	}
}



######################
######################
#	SUICIDE EVENTS 	 #
######################
######################
#We have tried to treat suicide as respectfully as possible while still modeling it to work as a game mechanic. Research has been conducted on medieval views and methods of suicide, and any opinions expressed through this chain is a reflection of those values, not the developers. If you have thoughts about suicide, please reach out to people around you, or to a helpline. People will surprise you with how much they care.


#How will you do it?
#by Linnéa Thimrén
health.6001 = {
	type = character_event
	title = health.6001.t
	desc = {
		desc = health.6001.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					has_trait = depressed
				}
				desc = health.6001.desc_depression
			}
			triggered_desc = {
				trigger = {
					OR = {
						has_trait = cancer
						has_trait = leper
						has_trait = great_pox
					}
				}
				desc = health.6001.desc_sickness
			}
			triggered_desc = {
				trigger = {
					has_trait = lunatic
				}
				desc = health.6001.desc_lunacy
			}
			triggered_desc = {
				trigger = {
					has_character_flag = make_suicide_available
				}
				desc = health.6001.desc_loss
			}
			triggered_desc = {
				trigger = {
					stress >= very_high_stress
				}
				desc = health.6001.desc_stress
			}
		}
		desc = health.6001.desc_ending
	}
	theme = death
	left_portrait = {
		character = root
		animation = sick
	}

	trigger = {
		NOT = { has_trait = incapable }
	}

	option = { #Fall
		name = {
			trigger = {
				OR = {
					government_has_flag = government_is_tribal
					government_has_flag = government_is_nomadic
					has_government = landless_adventurer_government
				}
			}
			text = health.6001.a_tribal
		}
		name = {
			trigger = {
				NOR = {
					government_has_flag = government_is_tribal
					government_has_flag = government_is_nomadic
					has_government = landless_adventurer_government
				}
			}
			text = health.6001.a
		}
		custom_tooltip = health.6001.warning
		save_scope_value_as = {
			name = fall
			value = yes
		}
	}

	option = { #Poison
		name = health.6001.b
		custom_tooltip = health.6001.warning
		save_scope_value_as = {
			name = poison
			value = yes
		}
	}

	option = { #Knife
		name = health.6001.c
		custom_tooltip = health.6001.warning
		save_scope_value_as = {
			name = knife
			value = yes
		}
	}

	option = { #Back out
		name = health.6001.d
		custom_tooltip = health.6001.d_tt
	}

	after = {
		if = {
			limit = {
				OR = {
					exists = scope:fall
					exists = scope:poison
					exists = scope:knife
				}
			}
			hidden_effect = {
				random_list = {
					90 = { #Someone tries to intervene
						trigger_event = {
							id = health.6002
							days = { 3 5 }
						}
					}
					0 = { #You go straight to the attempt
						modifier = { #You are not well-liked
							add = 5
							dread >= medium_dread
						}
						modifier = { #You are seriously not well-liked
							add = 10
							dread >= high_dread
						}
						modifier = { #You are not liked by people close to you
							add = 20
							any_close_family_member = {
								NOT = { is_spouse_of = root }
								OR = {
									AND = {
										ai_compassion > 0
										opinion = {
											target = root
											value <= -20
										}
									}
									AND = {
										ai_compassion < 0
										opinion = {
											target = root
											value <= 0
										}
									}
								}
							}
							any_spouse = {
								OR = {
									AND = {
										ai_compassion > 0
										opinion = {
											target = root
											value <= -20
										}
									}
									AND = {
										ai_compassion < 0
										opinion = {
											target = root
											value <= 0
										}
									}
								}
							}
						}
						if = {
							limit = {
								exists = scope:fall
							}
							trigger_event = {
								id = health.6003
								days = { 3 5 }
							}
						}
						else_if = {
							limit = {
								exists = scope:poison
							}
							trigger_event = {
								id = health.6006
								days = { 3 5 }
							}
						}
						else = {
							trigger_event = {
								id = health.6009
								days = { 3 5 }
							}
						}
					}
				}
			}
		}
	}
}

#Intervention
#by Linnéa Thimrén
health.6002 = {
	type = character_event
	title = health.6001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:fall
				}
				desc = health.6002.desc_fall
			}
			triggered_desc = {
				trigger = {
					exists = scope:poison
				}
				desc = health.6002.desc_poison
			}
			triggered_desc = {
				trigger = {
					exists = scope:knife
				}
				desc = health.6002.desc_knife
			}
		}
		desc = health.6002.desc_ending
	}
	theme = death
	override_background = {
		trigger = {
			has_government = landless_adventurer_government
		}
		reference = wilderness
	}
	override_background = {
		trigger = {
			is_landless_adventurer = no
		}
		reference = corridor_day
	}
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		character = scope:friendly_person
		animation = shock
	}

	immediate = {
		if = {
			limit = {
				any_spouse = {
					opinion = {
						target = root
						value >= 0
					}
					NOR = {
						has_relation_rival = root
						has_relation_potential_rival = root
						any_scheme = {
							type = murder
							scheme_target_character = root
						}
					}
					is_ai = yes
				}
			}
			every_spouse = {
				limit = {
					opinion = {
						target = root
						value >= 0
					}
					NOR = {
						has_relation_rival = root
						has_relation_potential_rival = root
						any_scheme = {
							type = murder
							scheme_target_character = root
						}
					}
					is_ai = yes
				}
				add_to_list = possiple_people_to_intervene
			}
		}
		if = {
			limit = {
				any_close_family_member = {
					opinion = {
						target = root
						value >= 0
					}
					NOR = {
						has_relation_rival = root
						has_relation_potential_rival = root
						any_scheme = {
							type = murder
							scheme_target_character = root
						}
					}
					is_ai = yes
					is_adult = yes
				}
			}
			every_close_family_member = {
				limit = {
					opinion = {
						target = root
						value >= 0
					}
					NOR = {
						has_relation_rival = root
						has_relation_potential_rival = root
						any_scheme = {
							type = murder
							scheme_target_character = root
						}
					}
					is_ai = yes
					is_adult = yes
				}
				add_to_list = possiple_people_to_intervene
			}
		}
		if = {
			limit = {
				any_relation = {
					type = friend
					count >= 1
					is_ai = yes
					opinion = {
						target = root
						value >= 10
					}
				}
			}
			every_relation = {
				type = friend
				limit = {
					is_ai = yes
					opinion = {
						target = root
						value >= 10
					}
				}
				add_to_list = possiple_people_to_intervene
			}
		}
		if = {
			limit = {
				any_relation = {
					type = potential_friend
					count >= 1
					is_ai = yes
					opinion = {
						target = root
						value >= 10
					}
				}
			}
			every_relation = {
				type = potential_friend
				limit = {
					is_ai = yes
					opinion = {
						target = root
						value >= 10
					}
				}
				add_to_list = possiple_people_to_intervene
			}
		}
		if = {
			limit = {
				any_relation = {
					type = lover
					count >= 1
					is_ai = yes
					opinion = {
						target = root
						value >= 10
					}
				}
			}
			every_relation = {
				type = lover
				limit = {
					is_ai = yes
					opinion = {
						target = root
						value >= 10
					}
				}
				add_to_list = possiple_people_to_intervene
			}
		}

		if = {
			limit = {
				any_in_list = {
					list = possiple_people_to_intervene
					count >= 1
				}
			}
			random_in_list = {
				list = possiple_people_to_intervene
				weight = {
					base = 1
					modifier = {
						add = {
							value = ai_compassion
							multiply = 0.5
						}
					}
					opinion_modifier = {
						opinion_target = root
						multiplier = 1
					}
					modifier = {
						add = 2
						is_in_the_same_court_as = root
					}
				}
				save_scope_as = friendly_person
			}
		}
		else = {
			create_character = {
				template = merchant_template
				location = root.capital_province
				trait = compassionate
				save_scope_as = friendly_person
			}
		}
	}

	option = { #I'm still going for it
		name = health.6002.a
		show_as_tooltip = {
			random_list = {
				50 = {
					show_chance = no
					desc = health.6002.a_success
					committed_suicide_effect = yes
				}
				50 = {
					show_chance = no
					desc = health.6002.a_failure
					attempted_suicide_effect = yes
				}
			}
		}
		#To trigger the failure/success events
		if = {
			limit = {
				exists = scope:fall
			}
			trigger_event = health.6003
		}
		else_if = {
			limit = {
				exists = scope:poison
			}
			trigger_event = health.6006
		}
		else = {
			trigger_event = health.6009
		}
	}

	option = { #Back out
		name = health.6002.b
		custom_tooltip = health.6001.d_tt
		scope:friendly_person = {
			add_opinion = {
				modifier = relieved_opinion
				target = root
				opinion = 10
			}
			hidden_effect = {
	 			if = {
					limit = {
						can_set_relation_potential_friend_trigger = { CHARACTER = root }
					}
					set_relation_potential_friend = root
				}
				root = {
					random = { #Check up event
						chance = 500
						trigger_event = {
							id = health.6100
							days = { 365 730 }
						}
					}
				}
			}
		}
	}
}

#Fall - attempt
#by Linnéa Thimrén
health.6003 = {
	hidden = yes

	immediate = {
		random_list = {
			50 = {
				trigger_event = health.6004
			}
			50 = {
				trigger_event = health.6005
			}
		}
	}
}

#Fall - Success
#by Linnéa Thimrén
health.6004 = {
	type = character_event
	title = health.6001.t
	desc = health.6004.desc
	theme = death
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		character = scope:friendly_person
		animation = shock
	}
	override_background = {
		trigger = {
			has_government = landless_adventurer_government
		}
		reference = wilderness
	}
	override_background = {
		trigger = {
			is_landless_adventurer = no
		}
		reference = corridor_day
	}

	option = {
		name = health.6004.a
	}

	immediate = {
		committed_suicide_effect = yes
	}
}

#Fall - Failure
#by Linnéa Thimrén
health.6005 = {
	type = character_event
	title = health.6001.t
	desc = {
		desc = health.6005.desc
		desc = health.6005.desc_ending
	}
	theme = death
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		character = scope:friendly_person
		animation = shock
	}
	override_background = {
		trigger = {
			has_government = landless_adventurer_government
		}
		reference = wilderness
	}
	override_background = {
		trigger = {
			is_landless_adventurer = no
		}
		reference = corridor_day
	}

	immediate = {
		attempted_suicide_effect = yes
	}

	option = {
		name = health.6005.a
		hidden_effect = {
			if = {
				limit = {
					exists = scope:friendly_person
				}
				random = { #Check up event
					chance = 50
					trigger_event = {
						id = health.6100
						days = { 365 730 }
					}
				}
			}
		}
	}
}


#Poison - attempt
#by Linnéa Thimrén
health.6006 = {
	hidden = yes

	immediate = {
		random_list = {
			50 = {
				trigger_event = health.6007
			}
			50 = {
				trigger_event = health.6008
			}
		}
	}
}

#Poison - Success
#by Linnéa Thimrén
health.6007 = {
	type = character_event
	title = health.6001.t
	desc = health.6007.desc
	theme = death
	left_portrait = {
		character = root
		animation = sick
	}

	option = {
		name = health.6004.a
	}

	immediate = {
		committed_suicide_effect = yes
	}
}

#Poison - Failure
#by Linnéa Thimrén
health.6008 = {
	type = character_event
	title = health.6001.t
	desc = {
		desc = health.6008.desc
		desc = health.6005.desc_ending
	}
	theme = death
	left_portrait = {
		character = root
		animation = sick
	}

	immediate = {
		attempted_suicide_effect = yes
		random_dummy_gender_soldier_effect = { SCOPE_NAME = dummy_gender }
	}

	option = {
		name = health.6005.a
		hidden_effect = {
			if = {
				limit = {
					exists = scope:friendly_person
				}
				random = { #Check up event
					chance = 50
					trigger_event = {
						id = health.6100
						days = { 365 730 }
					}
				}
			}
		}
	}
}

#Knife - attempt
#by Linnéa Thimrén
health.6009 = {
	hidden = yes

	immediate = {
		random_list = {
			50 = {
				trigger_event = health.6010
			}
			50 = {
				trigger_event = health.6011
			}
		}
	}
}

#Knife - Success
#by Linnéa Thimrén
health.6010 = {
	type = character_event
	title = health.6001.t
	desc = health.6010.desc
	theme = death
	left_portrait = {
		character = root
		animation = sick
	}

	option = {
		name = health.6004.a
	}

	immediate = {
		committed_suicide_effect = yes
	}
}

#Knife - Failure
#by Linnéa Thimrén
health.6011 = {
	type = character_event
	title = health.6001.t
	desc = {
		desc = health.6011.desc
		desc = health.6005.desc_ending
	}
	theme = death
	left_portrait = {
		character = root
		animation = sick
	}

	immediate = {
		attempted_suicide_effect = yes
	}

	option = {
		name = health.6005.a
		hidden_effect = {
			if = {
				limit = {
					exists = scope:friendly_person
				}
				random = { #Check up event
					chance = 50
					trigger_event = {
						id = health.6100
						days = { 182 500 }
					}
				}
			}
		}
	}
}

#Friendly person checks up on you
health.6100 = {
	type = character_event
	title = health.6001.t
	desc = health.6100.desc
	theme = friendly
	left_portrait = {
		character = scope:friendly_person
		animation = personality_compassionate
	}

	trigger = {
		scope:friendly_person = {
			is_alive = yes
			is_ai = yes
		}
	}

	option = { #Thank you for asking
		name = health.6100.a
		progress_towards_friend_effect = {
			CHARACTER = scope:friendly_person
			REASON = friend_checked_on_health
			OPINION = 0
		}
		scope:friendly_person = {
			add_opinion = {
				modifier = relieved_opinion
				target = root
				opinion = 5
			}
		}
	}

	option = { #It's no concern of yours.
		name = health.6100.b
		scope:friendly_person = {
			add_opinion = {
				modifier = friendliness_opinion
				target = root
				opinion = -10
			}
		}
	}
}



#Incapable
#by Linnéa Thimrén
health.6200 = {
	type = character_event
	title = health.6001.t
	desc = {
		desc = health.6200.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:close_person
				}
				desc = health.6200.desc_close_person
			}
			desc = health.6200.desc
		}
	}
	theme = death
	left_portrait = root
	right_portrait = scope:close_person

	trigger = {
		has_trait = incapable
	}

	immediate = {
		save_scope_as = incapable_person
		#To save a person close to you
		if = {
			limit = {
				any_spouse = {
					is_in_the_same_court_as = root
					NOR = {
						has_relation_rival = root
						has_relation_potential_rival = root
					}
				}
			}
			every_spouse = {
				limit = {
					is_in_the_same_court_as = root
					NOR = {
						has_relation_rival = root
						has_relation_potential_rival = root
					}
				}
				add_to_list = possiple_close_person
			}
		}
		if = {
			limit = {
				any_close_family_member = {
					is_in_the_same_court_as = root
					is_adult = yes
					NOR = {
						has_relation_rival = root
						has_relation_potential_rival = root
					}
				}
			}
			every_close_family_member = {
				limit = {
					is_in_the_same_court_as = root
					is_adult = yes
					NOR = {
						has_relation_rival = root
						has_relation_potential_rival = root
					}
				}
				add_to_list = possiple_close_person
			}
		}
		if = {
			limit = {
				any_relation = {
					type = friend
					count >= 1
					is_in_the_same_court_as = root
				}
			}
			every_relation = {
				type = friend
				limit = {
					is_in_the_same_court_as = root
				}
				add_to_list = possiple_close_person
			}
		}
		if = {
			limit = {
				any_relation = {
					type = potential_friend
					count >= 1
					is_in_the_same_court_as = root
				}
			}
			every_relation = {
				type = potential_friend
				limit = {
					is_in_the_same_court_as = root
				}
				add_to_list = possiple_close_person
			}
		}
		if = {
			limit = {
				any_relation = {
					type = lover
					count >= 1
					is_in_the_same_court_as = root
				}
			}
			every_relation = {
				type = lover
				limit = {
					is_in_the_same_court_as = root
				}
				add_to_list = possiple_close_person
			}
		}

		if = {
			limit = {
				any_in_list = {
					list = possiple_close_person
					count >= 1
				}
			}
			random_in_list = {
				list = possiple_close_person
				weight = {
					base = 1
					modifier = {
						add = {
							value = ai_compassion
							multiply = 0.25
						}
					}
					opinion_modifier = {
						opinion_target = root
						multiplier = 1
					}
					modifier = {
						add = 2
						is_in_the_same_court_as = root
					}
				}
				save_scope_as = close_person
			}
		}
	}

	option = { #I will ask a person close to me
		name = health.6200.a
		trigger = {
			exists = scope:close_person
		}
		show_as_tooltip = {
			random_list = {
				50 = {
					desc = health.6200.a_success
					show_chance = no
					death = {
						death_reason = death_mysterious
					}
				}
				50 = {
					desc = health.6200.a_failure
					show_chance = no
					custom_tooltip = health.6200.a_failure_tt
				}
			}
		}
		scope:close_person = {
			trigger_event = {
				id = health.6203
				days = { 3 7 }
			}
		}
	}

	option = { #I will ask a servant
		name = {
			trigger = {
				exists = scope:close_person
			}
			text = health.6200.b
		}
		name = {
			trigger = {
				NOT = { exists = scope:close_person }
			}
			text = health.6200.b_2
		}
		show_as_tooltip = {
			random_list = {
				50 = {
					desc = health.6200.b_success
					show_chance = no
					death = {
						death_reason = death_mysterious
					}
				}
				50 = {
					desc = health.6200.b_failure
					show_chance = no
					custom_tooltip = health.6200.a_failure_tt
				}
			}
		}
		trigger_event = {
			id = health.6207
			days = { 3 7 }
		}
	}

	option = { #Back out
		name = health.6001.d
		custom_tooltip = health.6001.d_tt
	}
}

#Someone close to you asks you to kill them
health.6203 = {
	type = character_event
	title = health.6001.t
	desc = {
		desc = health.6203.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					any_scheme = {
						type = murder
						scheme_target_character = scope:incapable_person
					}
				}
				desc = health.6203.desc_murder
			}
		}
	}
	theme = death
	left_portrait = {
		character = scope:incapable_person
		animation = sick
	}

	option = { #Agree
		name = health.6203.a
		show_as_tooltip = {
			scope:incapable_person = {
				death = {
					death_reason = death_mysterious
				}
			}
		}
		hidden_effect = {
			if = {
				limit = { #If they're ai they might not be able to go through with it even when agreeing
					is_ai = yes
				}
				random_list = {
					90 = { #They do it
						modifier = {
							add = 100
							any_scheme = { #They have a murder scheme against you
								type = murder
								scheme_target_character = scope:incapable_person
							}
						}
						scope:incapable_person = {
							trigger_event = {
								id = health.6204
								days = { 3 7 }
							}
						}
					}
					10 = { #Chance that ai might not be able to go through with it
						modifier = {
							add = {
								value = ai_compassion
								multiply = 0.5
							}
						}
						scope:incapable_person = {
							trigger_event = {
								id = health.6205
								days = { 3 7 }
							}
						}
					}
				}
			}
			else = { #If it's a player they do it
				scope:incapable_person = {
					trigger_event = {
						id = health.6204
						days = { 3 7 }
					}
				}
			}
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_compassion_target_modifier = { VALUE = 25 }
			ai_vengefulness_target_modifier = { VALUE = 50 }
			modifier = { #They have a murder scheme against you
				add = 100
				any_scheme = {
					type = murder
					scheme_target_character = scope:incapable_person
				}
			}
		}
	}

	option = { #No!
		name = health.6203.b
		scope:incapable_person = {
			add_opinion = {
				modifier = refusal_opinion
				target = scope:close_person
				opinion = -15
			}
			trigger_event = health.6206
		}
		ai_chance = {
			base = 50
			modifier = {
				add = {
					value = ai_compassion
					multiply = 0.25
				}
			}
			modifier = {
				add = 20
				piety_level >= medium_piety_level
			}
			modifier = {
				add = 50
				piety_level >= high_piety_level
			}
			modifier = {
				add = 50
				has_trait = craven
			}
			modifier = {
				add = 50
				has_trait = zealous
			}
		}
	}
}

#They help you
health.6204 = {
	type = character_event
	title = health.6001.t
	desc = {
		desc = health.6204.desc_opening
		random_valid = {
			desc = health.6204.desc_1
			desc = health.6204.desc_2
		}
	}
	theme = death
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		character = scope:close_person
		animation = worry
	}

	trigger = {
		scope:close_person = { is_alive = yes }
	}

	on_trigger_fail = {
		trigger_event = health.6210
	}

	immediate = {
		death = {
			death_reason = death_mysterious
		}
	}

	option = {
		name = health.6204.a
	}
}

#They cannot go though with it
health.6205 = {
	type = character_event
	title = health.6001.t
	desc = {
		desc = health.6204.desc_opening
		random_valid = {
			desc = health.6205.desc_1
			desc = health.6205.desc_2
		}
	}
	theme = death
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		character = scope:close_person
		animation = grief
	}

	trigger = {
		scope:close_person = { is_alive = yes }
	}

	on_trigger_fail = {
		trigger_event = health.6210
	}

	option = {
		name = health.6205.a
	}
}

#They will not help you
health.6206 = {
	type = character_event
	title = health.6001.t
	desc = health.6206.desc
	theme = death
		left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		character = scope:close_person
		animation = grief
	}

	trigger = {
		scope:close_person = { is_alive = yes }
	}

	on_trigger_fail = {
		trigger_event = health.6210
	}

	option = {
		name = health.6205.a
	}
}


#You ask a servant
health.6207 = {
	type = character_event
	title = health.6001.t
	desc = health.6207.desc
	theme = death
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		character = scope:servant
		animation = worry
	}

	immediate = {
		create_character = {
			save_scope_as = servant
			employer = root
			template = servant_character
			gender_female_chance = root_faith_dominant_gender_adjusted_female_chance
		}
	}

	option = { #You ask them
		name = health.6207.a
		show_as_tooltip = {
			random_list = {
				50 = {
					desc = health.6207.a_success
					show_chance = no
					death = {
						death_reason = death_mysterious
					}
				}
				50 = {
					desc = health.6207.a_failure
					show_chance = no
					custom_tooltip = health.6200.a_failure_tt
				}
			}
		}
		hidden_effect = {
			random_list = {
				75 = { #Servant says yes
					modifier = {
						add = 100
						has_trait = sadistic
					}
					modifier = {
						add = 75
						has_trait = callous
					}
					trigger_event = {
						id = health.6208
						days = { 3 7 }
					}
				}
				10 = { #Servant says yes but can't do it
					modifier = {
						add = {
							value = ai_compassion
							multiply = 0.5
						}
					}
					modifier = {
						add = 75
						has_trait = compassionate
					}
					save_scope_value_as = {
						name = refusal
						value = yes
					}
					trigger_event = {
						id = health.6209
						days = { 3 7 }
					}
				}
				10 = { #Servant says no
					modifier = {
						add = {
							value = ai_compassion
							multiply = 0.5
						}
					}
					modifier = {
						add = 50
						has_trait = compassionate
					}
					trigger_event = {
						id = health.6209
						days = { 3 7 }
					}
				}
			}
		}
	}

	option = { #Back out
		name = health.6001.d
		custom_tooltip = health.6001.d_tt
	}
}

#Servant says yes
health.6208 = {
	type = character_event
	title = health.6001.t
	desc = {
		desc = health.6204.desc_opening
		random_valid = {
			desc = health.6204.desc_1
			desc = health.6204.desc_2
		}
	}
	theme = death
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		character = scope:servant
		animation = worry
	}

	trigger = {
		scope:servant = { is_alive = yes }
	}

	on_trigger_fail = {
		trigger_event = health.6210
	}

	immediate = {
		scope:servant = { #To be able to reuse descs
			save_scope_as = close_person
		}
		death = {
			death_reason = death_mysterious
		}
	}

	option = {
		name = health.6204.a
	}
}

#Servant says no or can't do it
health.6209 = {
	type = character_event
	title = health.6001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { #They try to, but can't do it
					exists = scope:refusal
				}
				desc = {
					desc = health.6209.desc_refusal
					random_valid = {
						desc = health.6205.desc_1
						desc = health.6205.desc_2
					}
				}
			}
			desc = health.6209.desc
		}
	}
	theme = death
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = {
		character = scope:servant
		animation = shock
	}

	trigger = {
		scope:servant = { is_alive = yes }
	}

	on_trigger_fail = {
		trigger_event = health.6210
	}

	option = {
		name = health.6205.a
	}
}

#Close person or servant died (oh cruel fate)
health.6210 = {
	type = character_event
	title = health.6001.t
	desc = health.6210.desc
	theme = death
	left_portrait = {
		character = root
		animation = sick
	}
	right_portrait = scope:close_person

	immediate = {
		if = { #To make it the same scope for ease of work
			limit = {
				exists = scope:servant
			}
			scope:servant = {
				save_scope_as = close_person
			}
		}
	}

	option = {
		name = health.6210.a
		remove_decision_cooldown = commit_suicide_decision
	}
}


##################
# INFIRM EVENTS
##################

# You have become infirm
health.7000 = {
	type = character_event
	title = health.7000.t

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					age <= 40
				}
				desc = health.7000.desc_collapse
			}
			desc = health.7000.desc
		}
		desc = health.7000.desc_closing
	}

	left_portrait = {
		character = root
		animation = sick
	}
	theme = physical_health

	trigger = {
		NOT = { has_trait = infirm }
		OR = {
			age >= 50
			AND = {
				age >= 30
				OR = {
					has_trait = physique_bad
					has_trait = spindly
					has_trait = weak
				}
			}
		}
	}

	weight_multiplier = {
		base = 1

		modifier = { #Shouldn't happen randomly for healthy characters
			health >= good_health
			factor = 0
		}
		modifier = {
			health >= fine_health
			factor = 0.8
		}
		modifier = {
			health <= poor_health
			factor = 5
		}
		modifier = {
			has_trait = physique_bad_2
			factor = 1.2
		}
		modifier = {
			has_trait = physique_bad_3
			factor = 1.5
		}
		modifier = {
			age < 50
			factor = 0.7
		}
		modifier = {
			age > 60
			factor = 2
		}
		modifier = {
			age > 70
			factor = 2
		}
		modifier = {
			age > 80
			factor = 3
		}
		modifier = {
			has_trait = athletic
			factor = 0.8
		}
		modifier = {
			has_trait = whole_of_body
			factor = 0.5
		}
		modifier = {
			has_trait = physique_good_1
			factor = 0.8
		}
		modifier = {
			has_trait = physique_good_2
			factor = 0.5
		}
		modifier = {
			has_trait = physique_good_3
			factor = 0.3
		}
		modifier = {
			has_trait = cancer
			factor = 3
		}
		modifier = {
			faith = { has_doctrine_parameter = less_likely_to_become_infirm }
			factor = 0.5
		}
	}

	option = {
		name = {
			trigger = { has_trait = lazy }
			text = health.7000.a.lazy
		}
		name = {
			text = health.7000.a
		}

		add_trait = infirm

		stress_impact = {
			lazy = minor_stress_loss
			diligent = medium_stress_gain
		}
	}
}

# What day is it? You become depressed while infirm
health.7100 = {
	type = character_event
	title = health.7000.t

	desc = health.7100.desc

	left_portrait = {
		character = root
		animation = sick
	}
	theme = physical_health

	trigger = {
		OR = {
			has_trait = infirm
			has_trait = incapable
		}
		NOR = {
			has_trait = depressed
			has_character_flag = had_event_health_7100
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 0
			ai_energy >= medium_positive_energy
		}
		modifier = {
			factor = 1.2
			ai_energy <= low_positive_energy
		}
		modifier = {
			factor = 2
			ai_energy <= low_negative_energy
		}
		modifier = {
			factor = 3
			ai_energy <= medium_negative_energy
		}
		modifier = {
			factor = 4
			ai_energy <= high_negative_energy
		}
	}

	immediate = {
		add_character_flag = had_event_health_7100
	}

	option = {
		name = health.7100.a

		add_trait = depressed_1
	}
}

