﻿
ucp_interaction_cure_typhus = {
	category = interaction_category_friendly
	common_interaction = yes
	desc = ucp_interaction_cure_typhus_desc
	icon = physician_request

	auto_accept = yes
	ignores_pending_interaction_block = yes

	is_shown = {

		# only show this option if the character is afflicted by the disease

		scope:recipient = {
			has_trait = typhus
		}

		# only show this option for self, family members and courtiers

		OR = {

			# yourself

			scope:recipient = scope:actor

			# family members

			AND = {
				scope:actor = {
					is_dynast = yes
					scope:recipient.dynasty = dynasty
				}

				scope:actor = {
					is_house_head = yes
				}
			}

			# they are a courtier or prisoner

			scope:recipient = {
				OR = {
					is_courtier_of = scope:actor
					is_imprisoned_by = scope:actor
					is_vassal_or_below_of = scope:actor
				}
			}

		}

	}

	is_valid_showing_failures_only = {
		scope:recipient = {
			# this option is not valid if the character is too far away
			is_busy_in_events_localised = yes

			# character is already undergoing treatment
			custom_description = {
				text = already_undergoing_treament
				NOT = {
					has_character_flag = ucp_undergoing_treatment
				}
			}
		}

		custom_description = {
			text = court_physician_trait_required_2

			scope:actor = {
				any_court_position_holder = {
					type = court_physician_court_position
					has_trait_xp = {
						trait = lifestyle_physician
						value >= 50
					}
				}
			}
		}
	}

	on_send = {
		scope:actor = {
			random_court_position_holder = {
				type = court_physician_court_position
				save_scope_as = court_physician
			}

			set_variable = {
				name = court_physician
				value = scope:court_physician
			}

			trigger_event = event_cure_typhus.0001
		}
	}
}

