﻿namespace = travl_travel_danger

scripted_effect travl_travel_danger_0006_outcome_effect = {
	# Setup character effects
	travl_travel_danger_0006_$OUTCOME$_effect = yes

	# Send messages to potential recipients and apply character effects
	travl_event_apply_outcome_effect = {
		EVENT = travel_danger_0006
		OUTCOME = $OUTCOME$
		RECIPIENTS = recipients
		TRAVELERS = travelers
	}
}

scripted_effect travl_travel_danger_0006_a_effect = {
	every_in_list = {
		list = travelers
		travl_event_death_effect = { REASON = death_sea_storm KILLER = this }
	}
}

# Danger: Sea Storm
travl_travel_danger.0006 = {
	type = character_event
	title = travl_travel_danger.0006.t
	desc = travl_travel_danger.0006.desc
	theme = travel_danger
	#hidden = yes

	override_background = { reference = ocean }
	left_portrait = {
		character = root
		animation = fear
	}

	trigger = {
		has_game_rule = travl_travel_events_enabled

		# Travel leader
		has_variable = travl_travel_leader
		var:travl_travel_leader = root

		# Available, traveling, adult, and unplayable
		is_available_travelling_adult = yes
		is_playable_character = no

		# Danger types
		location = {
			OR = {
				travel_danger_type = {
					travel_plan = root.current_travel_plan
					terrain = sea
				}
				travel_danger_type = {
					travel_plan = root.current_travel_plan
					terrain = coastal_sea
				}
			}
		}

		# Is not an expert in this type of terrain
		travl_event_is_location_terrain_expert_trigger = no

		# Already traveled for some time
		current_travel_plan.days_travelled >= 15
	}

	weight_multiplier = {
		base = 1
		modifier = {
			location = {
				travel_danger_type = {
					travel_plan = root.current_travel_plan
					terrain = coastal_sea
				}
			}
			factor = 0.25
		}
	}

	cooldown = { months = 6 }

	immediate = {
		travl_debug_log_travel_event_effect = { MSG = travl_debug_msg_travel_danger_0006_t }

		# Get travelers and message recipients
		travl_event_get_travelers_effect = { TRAVELERS = travelers }
		travl_event_get_message_recipients_effect = { RECIPIENTS = recipients }

		# Save location
		location = { save_scope_as = location }
	}

	# We die
	option = {
		name = travl_travel_danger.0006.a

		travl_travel_danger_0006_outcome_effect = { OUTCOME = a }

		ai_chance = {
			base = 100
		}
	}
}