﻿namespace = travel_danger_events

##########################################################
# Travel Danger Terrain Events							#
# travel_danger_events - 3000-3999						#
# by Krzysztof Lankowski					 			#
##########################################################

travel_danger_events.3000 = { # Highlands terrain. Someone falls from a mountain
	type = character_event
	title = travel_danger_events.3000.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = had_travel_danger_event_3000_recently
				}
				desc = travel_danger_events.3000.desc.first_time
			}
			triggered_desc = { 
				desc = travel_danger_events.3000.desc.second_time
			}
			
		}
	}

	theme = travel_danger

	left_portrait = {
		character = root
		animation = disbelief
	}

	right_portrait = {
		character = scope:char_next_in_line
		animation = shock
	}

	lower_right_portrait = {
		character = scope:fallen_victim
	}

	trigger = {

		NOT = {
			has_character_flag = had_twice_travel_danger_events_3000
		}

		is_available_travelling_adult = yes
		is_location_valid_for_travel_event_on_land = yes

		current_travel_plan = {
			any_entourage_character = {
				this != root
				is_ai = yes
				is_adult = yes
				count >= 2
			}
		}

		location = {
			OR = {
				travel_danger_type = {
					travel_plan = root.current_travel_plan
					terrain = desert_mountains
				}
				travel_danger_type = {
					travel_plan = root.current_travel_plan
					terrain = mountains
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = { #the event should trigger for the second time as soon as possible
			has_character_flag = had_travel_danger_event_3000_recently
			factor = 4
		}
		modifier = {
			current_travel_plan = {
				any_entourage_character = {
					OR = {
						has_relation_rival = root
						has_relation_nemesis = root
					}			
				}
			}
			factor = 4
		}

	}
	cooldown = { months = 1 }

	immediate = {
		wayfarer_storyteller_fame_effect = { VALUE = roaming_reward_fame_small }
		mp_delay_travel_plan = { DAYS = 90 }

		current_travel_plan = {
			hidden_effect = {
				every_entourage_character = {
					limit = {
						is_ai = yes
						this != root
					}
					traveler_danger_xp_effect = {
						MIN = 7
						MAX = 14
					}
				}
			}

			ordered_entourage_character = {
				limit = {
					is_ai = yes
					this != root
				}
				order_by = { #low prowess makes chars fall more easily. That makes older and more frail characters more likely to fall.
					value = prowess
					multiply = -1

					if = { #more impactful narrative
						limit = {
							has_any_relation_trigger = { CHARACTER = root }
						}
						add = 10
					}
					if = { #rivals falling down is funni. stacks with any_relation_trigger above
						limit = {
							OR = {
								has_relation_rival = root
								has_relation_nemesis = root
							}
						}
						add = 20
					}
					if = { #since children have low prowess, we don't want only them falling down and dying, that's what meet peers is for. children are actually very nimble. 
						limit = {
							is_adult = no
						}
						add = -25
					}
				}
				save_scope_as = fallen_victim
			}

			ordered_entourage_character = {
				limit = {
					is_ai = yes
					is_adult = yes
					NOR = {
						this = scope:fallen_victim
						this = root
					}
				}
				order_by = { #highest prowess char makes the rescue operation a bit more viable
					value = prowess
				}
				save_scope_as = char_next_in_line
			}

		}
		traveler_danger_xp_effect = {
			MIN = 7
			MAX = 14
		}
		if = {
			limit = {
				has_character_flag = had_travel_danger_event_3000_recently
			}
			remove_character_flag = had_travel_danger_event_3000_recently
			add_character_flag = { #flag blocking the event from firing more than twice. We don't want whole entourages falling to their deaths.
				flag = had_twice_travel_danger_events_3000
				years = 10
			}
		}
		else = {
			add_character_flag = { #people do forget what happened recently
				flag = had_travel_danger_event_3000_recently
				years = 2
			}
		}
	}
	
	option = { #watch where you step! We press on! / second time: I TOLD you to watch where you step!
		trigger = {
			NOR = {
				has_trait = zealous
				has_trait = callous
				has_trait = sadistic
				piety_level >= 2
				scope:fallen_victim = {
					OR = {
						has_relation_rival = root
						has_relation_nemesis = root
					}
				}
			}
		}
		name = {
			trigger = {
				has_character_flag = had_travel_danger_event_3000_recently
			}
			text = travel_danger_events.3000.a.first_time
		}
		name = {
			trigger = {
				NOT = {
					has_character_flag = had_travel_danger_event_3000_recently
				}
			}
			text = travel_danger_events.3000.a.second_time
		}

		flavor = travel_danger_events.3000.a.tt
		scope:fallen_victim = {
			death = { 
				death_reason = death_fallen_from_a_mountain
			}
		}

		stress_impact = {
			compassionate = minor_stress_impact_gain
		}

		if = {
			limit = {
				has_friendly_relationship_trigger = { CHARACTER = scope:fallen_victim }
			}
			stress_impact = {
				base = medium_stress_impact_gain
			}
		}

		ai_chance = {
			base = 100
		}

	}

	option = { #fallen_victim! We will save you!
		name = travel_danger_events.3000.b
		custom_tooltip = travel_danger_events.3000.b.tt

		show_as_unavailable = {
			AND = {
				OR = {
					has_relation_rival = scope:fallen_victim
					has_relation_nemesis = scope:fallen_victim
				}
				OR = {
					has_trait = vengeful
					has_trait = callous
					has_trait = sadistic
				}
			}
		}

		hidden_effect = { #you attempt a rescue operation in the mountains, YOU SHOULD KNOW IT IS DANGEROUS.
			if = {
				limit = { 
					scope:char_next_in_line = {
						prowess >= root.prowess
					}
				}
				save_scope_as = mountain_rescuer
			}
			else = {
				root = {
					save_scope_as = mountain_rescuer
				}
			}
			scope:mountain_rescuer = { #highest prowess char in the entourage, including root. the result providing toasts imply both you and char next in line went down to see wazzup
				duel = {
					skill = prowess
					value = very_high_skill_rating

					50 = {
						compare_modifier = {
							value = scope:duel_value
							multiplier = 3.5
							min = -49
						}
						random_list = { #congratulations, you both managed to climb down. IT IS STILL DANGEROUS.
							25 = { #wounds all the rescuers, bad outcome
								root = { #root since mountain_rescuer could be char_next_in_line
									send_interface_toast = {
										title = travel_danger_events.3000.b.found_nothing
										increase_wounds_no_death_effect = { REASON = mountain_rescue_operation }
										scope:char_next_in_line = {
											increase_wounds_no_death_effect = { REASON = mountain_rescue_operation }
										}
										scope:fallen_victim = {
											death = {
												death_reason = death_fallen_from_a_mountain
											}
										}
										left_icon = scope:char_next_in_line
										right_icon = scope:fallen_victim
									}
								}
							}
							20 = { #kills the other rescuer, wounds root, bad outcome
								root = {
									send_interface_toast = {
										title = travel_danger_events.3000.b.found_nothing
										increase_wounds_no_death_effect = { REASON = mountain_rescue_operation }
										scope:char_next_in_line = {
											death = { 
												death_reason = death_mountain_rescue_operation
											}
										}
										scope:fallen_victim = {
											death = {
												death_reason = death_fallen_from_a_mountain
											}
										}
										left_icon = scope:char_next_in_line
										right_icon = scope:fallen_victim
									}
								}
							}
							20 = { #only wounds the other char, bad outcome
								root = {
									send_interface_toast = {
										title = travel_danger_events.3000.b.found_nothing
									
										scope:char_next_in_line = {
											increase_wounds_no_death_effect = { REASON = mountain_rescue_operation }
										}
										scope:fallen_victim = {
											death = {
												death_reason = death_fallen_from_a_mountain
											}
										}
										left_icon = scope:char_next_in_line
										right_icon = scope:fallen_victim
									}
								}
							}
							25 = { #a bit of narrative reward, still bad outcome. YES, IT IS THAT HARD RESCUING PEOPLE IN THE MOUNTAINS.
								root = {
									send_interface_toast = {
										title = travel_danger_events.3000.b.found_cloth
									
										scope:char_next_in_line = {
											increase_wounds_no_death_effect = { REASON = mountain_rescue_operation }
										}
										scope:fallen_victim = {
											death = {
												death_reason = death_fallen_from_a_mountain
											}
										}
										left_icon = scope:char_next_in_line
										
										#Question for reviewers - is it worth it to create a toekn artifact here?
									}
								}
							}
							10 = {
								root = { #The only good outcome here, a miracle, the fallen_victim is safe yet wounded
									send_interface_toast = {
										title = travel_danger_events.3000.b.found_fallen_victim
									
										scope:fallen_victim = {
											increase_wounds_no_death_effect = { REASON = fallen_from_a_mountain }
										}
										add_hook = {
											target = scope:fallen_victim
											type = saved_my_life_hook
										}

										traveler_danger_xp_effect = {
											MIN = 15
											MAX = 30
										}

										left_icon = scope:char_next_in_line
										right_icon = scope:fallen_victim
									}

									create_character_memory = {
										type = rescued_fallen_victim_memory
							
										participants = {
											rescued_victim = scope:fallen_victim
										}
									}
								}
								scope:char_next_in_line = {
									traveler_danger_xp_effect = {
											MIN = 15
											MAX = 30
									}
								}
							}
						}
					}

					50 = {
						compare_modifier = {
							value = scope:duel_value
							multiplier = -3.5
							min = -49
						}
						random_list = { #kills the other rescuer, wounds root, bad outcome
							80 = {
								root = {
									send_interface_toast = {
										title = travel_danger_events.3000.b.found_nothing
										increase_wounds_no_death_effect = { REASON = mountain_rescue_operation }
										scope:char_next_in_line = {
											death = { 
												death_reason = death_mountain_rescue_operation
											}
										}
										scope:fallen_victim = {
											death = {
												death_reason = death_fallen_from_a_mountain
											}
										}
										left_icon = scope:char_next_in_line
										right_icon = scope:fallen_victim
									}
								}
							}
							20 = { #wounds the other rescuer, wounds root, bad outcome
								root = {
									send_interface_toast = {
										title = travel_danger_events.3000.b.found_nothing
									
										scope:char_next_in_line = {
											increase_wounds_no_death_effect = { REASON = mountain_rescue_operation }
										}

										scope:fallen_victim = {
											death = {
												death_reason = death_fallen_from_a_mountain
											}
										}
										left_icon = scope:char_next_in_line
										right_icon = scope:fallen_victim
									}
								}
							}
						}
					}
				}
			}

		}

		ai_chance = {
			base = 0
			ai_value_modifier = { #only a bold character would attempt that
				ai_boldness = tiny_chance_impact_positive_ai_value 
			}
			modifier = { #AI shouldn't save their rivals, no matter what
				factor = 0
				OR = {
					has_relation_rival = scope:fallen_victim
					has_relation_nemesis = scope:fallen_victim
				}
			}
			modifier = { #and with questionable intellect
				factor = 2
				OR = {
					has_trait = dull
					has_trait = intellect_bad
				}
			}

			
		}

	}

	option = { #High piety or Zealous trait option: fallen victim will be in our prayers/ second time: Oh Deity, deliver us from peril!
		trigger = {
			OR = {
				has_trait = zealous
				piety_level >= 2
			}
		}
		name = {
			trigger = {
				has_character_flag = had_travel_danger_event_3000_recently
			}
			text = travel_danger_events.3000.c.first_time
		}
		name = {
			trigger= {
				NOT = {
					has_character_flag = had_travel_danger_event_3000_recently
				}
			}
			text = travel_danger_events.3000.c.second_time
		}

		scope:fallen_victim = {
			death = {
				death_reason = death_fallen_from_a_mountain
			}
		}

		add_piety = minor_piety_gain
		current_travel_plan = {
			every_entourage_character = {
				custom = every_entourage_tt
				limit = {
					has_faith = root.faith
				}
				add_opinion = {
					target = root
					modifier = pious_opinion
					opinion = 20
				}
			}
		}

		ai_chance = {
			base = 100
		}

	}

	option = { #Callous trait or if a rival is a fallen victim option: Ha! Nice one fallen_victim!/ second time: It is even funnier the second time!
		trigger = {
			OR = {
				has_trait = callous
				has_trait = sadistic
				scope:fallen_victim = {
					OR = {
						has_relation_rival = root
						has_relation_nemesis = root
					}
				}
			}
		}
		name = {
			trigger = {
				has_character_flag = had_travel_danger_event_3000_recently
			}
			text = travel_danger_events.3000.d.first_time
		}
		name = {
			trigger = {
				NOT = {
					has_character_flag = had_travel_danger_event_3000_recently
				}
			}
			text = travel_danger_events.3000.d.second_time
		}

		scope:fallen_victim = {
			death = {
				death_reason = death_fallen_from_a_mountain
			}
		}
		stress_impact = {
			base = medium_stress_impact_loss
			compassionate = major_stress_impact_gain
		}
		add_dread = medium_dread_gain

		ai_chance = {
			base = 200
		}
	}

	after = {
		mp_resume_travel_plan = yes
	}
	
}

travel_danger_events.3001 = { #Avalanche, Highlands terrain. Based on Gesta Abbatum Trudonensium
	type = character_event
	title = travel_danger_events.3001.t
	desc = travel_danger_events.3001.desc

	theme = travel_danger

	left_portrait = {
		character = root
		animation = disbelief
	}

	lower_center_portrait = {
		character = scope:first_avalanche_victim
	}

	lower_right_portrait = {
		character = scope:second_avalanche_victim
	}

	override_background = { reference = tavern }

	trigger = {
		is_available_travelling_adult = yes
		is_location_valid_for_travel_event_on_land = yes

		current_travel_plan = {
			any_entourage_character = {
				this != root
				is_ai = yes
				is_adult = yes
				count >= 2
			}
		}
		location_has_winter_trigger = yes

		location = {
			OR = {
				travel_danger_type = {
					travel_plan = root.current_travel_plan
					terrain = desert_mountains
				}
				travel_danger_type = {
					travel_plan = root.current_travel_plan
					terrain = mountains
				}
			}
			has_holding = yes
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			location = {
				has_province_modifier = winter_harsh_modifier
			}
			factor = 2
		}
	}

	cooldown = { months = 1 }

	immediate = {
		wayfarer_storyteller_fame_effect = { VALUE = roaming_reward_fame_high }
		mp_delay_travel_plan = { DAYS = 90 }

		hidden_effect = {
			current_travel_plan = {
				every_entourage_character = {
					limit = {
						is_ai = yes
						this != root
					}
				
					traveler_danger_xp_effect = {
						MIN = 7
						MAX = 14
					}
				}
				travel_leader ?= {
					save_scope_as = travel_leader
				}
			}
		}

		traveler_danger_xp_effect = {
			MIN = 7
			MAX = 14
		}

		if = { 
			limit = {
				NOT = { #those cultures know how to build sturdy buildings away from the avalanche paths
					location.culture = { has_cultural_parameter = mountain_trait_bonuses }
				}
			}
			root = {
				save_scope_as = avalanche_traveler
			}
			location = {
				save_scope_as = avalanche_location
			}
			location.county.holder = {
				trigger_event = { #notification for county holder about the negative province modifier
					id = travel_danger_events.3002
					days = 7 
				}
			}
			



		}
		current_travel_plan = {
			random_entourage_character = {
				limit = {
					is_ai = yes
					is_adult = yes
					this != root
				}
				save_scope_as = first_avalanche_victim
			}

			random_entourage_character = {
				limit = {
					is_ai = yes
					is_adult = yes
					NOR = {
						this = root
						this = scope:first_avalanche_victim
					}
				}
				save_scope_as = second_avalanche_victim
			}
		}
	}

	option = { #mountaineer culture for root or travel leader. Fear not! the culture people know how to survive an avalanche
		trigger = {
			OR = {
				culture = { has_cultural_parameter = mountain_trait_bonuses }
				current_travel_plan = {
					any_entourage_character = {
						this = current_travel_plan.travel_leader
						culture = {
							has_cultural_parameter = mountain_trait_bonuses
						}
					}
				}
			}
		}

		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							culture = { has_cultural_parameter = mountain_trait_bonuses }
						}
						desc = travel_danger_events.3001.a
					}
					triggered_desc = {
						desc = travel_danger_events.3001.a.alternate
					}
				}
			}
		}

		flavor = {
			first_valid = {
				triggered_desc = {
					trigger = {
						culture = { has_cultural_parameter = mountain_trait_bonuses }
					}
					desc = travel_danger_events.3001.a.flavor
				}
				triggered_desc = {
					desc = travel_danger_events.3001.a.flavor.alternate
				}
			}

		}

		traveler_danger_xp_effect = {
			MIN = 7
			MAX = 14
		}
		stress_impact = {
			base = medium_stress_loss
		}

		ai_chance = {
			base = 200
		}

	}

	option = { #bravelike - prowess duel, chance of wounded root, yet slightly better outcomes for the rest

		name = travel_danger_events.3001.b
		flavor = travel_danger_events.3001.b.flavor

		stress_impact = {
			brave = medium_stress_loss
			craven = medium_stress_gain
		}

		duel = {
			skill = prowess
			value = high_skill_rating

			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = travel_danger_events.3001.b.success
					left_icon = scope:first_avalanche_victim
					right_icon = scope:second_avalanche_victim

					scope:first_avalanche_victim = {
						add_opinion = {
							modifier = thankful_opinion
							opinion = 30
							target = root
						}
					}
					scope:second_avalanche_victim = {
						add_opinion = {
							modifier = thankful_opinion
							opinion = 30
							target = root
						}
					}
					traveler_danger_xp_effect = {
						MIN = 7
						MAX = 14
					}
				}
			}

			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = travel_danger_events.3001.b.failure
					left_icon = scope:first_avalanche_victim
					right_icon = scope:second_avalanche_victim

					increase_wounds_no_death_effect = { REASON = avalanche }
					scope:first_avalanche_victim = {
						increase_wounds_no_death_effect = { REASON = avalanche }
					}
					scope:second_avalanche_victim = {
						increase_wounds_no_death_effect = { REASON = avalanche }
					}
					current_travel_plan = {
		 				delay_travel_plan = { days = 20 }
					}
				}	
			}
		}

		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_honor = tiny_chance_impact_positive_ai_value 
				ai_compassion = tiny_chance_impact_positive_ai_value 
			}
		}

	}

	option = { #cowardly - death and wounds

		name = travel_danger_events.3001.c

		
		scope:first_avalanche_victim = {
			increase_wounds_no_death_effect = { REASON = avalanche }
		}
		scope:second_avalanche_victim = {
			death = {
				death_reason = death_avalanche
			}
		}
		current_travel_plan = {
		 	delay_travel_plan = { days = 30 }
		}

		stress_impact = {
			craven = medium_stress_loss
			brave = medium_stress_gain
		}

		ai_chance = {
			base = 50 #ai should avoid getting themselves wounded
			ai_value_modifier = {
				ai_honor = tiny_chance_impact_negative_ai_value 
				ai_compassion = tiny_chance_impact_negative_ai_value 
			}
		}
	}

	after = {
		mp_resume_travel_plan = yes
	}
		
}

travel_danger_events.3002 = { #follow up letter event to province owner
	type = letter_event
	opening = travel_danger_events.3002.opening
	desc = travel_danger_events.3002.desc

	sender = scope:news_bearer

	immediate = {
		if = {
			limit = { exists = cp:councillor_steward }
			cp:councillor_steward = { save_scope_as = news_bearer }
		}
		else_if = {
			limit = {
				any_councillor = { }
			}
			random_councillor = { save_scope_as = news_bearer }
		}
		else = {
			random_courtier = { save_scope_as = news_bearer }
		}
	}

	option = {
		name = {
			trigger = {
				scope:avalanche_traveler = root
			}
			text = travel_danger_events.3002.a.special #I WAS THERE
		}
		name = {
			trigger = {
				scope:avalanche_traveler != root
			}
			text = travel_danger_events.3002.a.default #oh no
		}
		
		scope:avalanche_location = {
			add_province_modifier = {
				modifier = avalanche_impact
				years = 4
			}
		}
	}

	option = {
		name = travel_danger_events.3002.b
		remove_short_term_gold = minor_gold_value
	}
}

travel_danger_events.3003 = { #Snowbound, all terrain, winter present
	type = character_event
	title = travel_danger_events.3003.t
	desc = travel_danger_events.3003.desc

	theme = travel_danger

	left_portrait = {
		character = root
		animation = disbelief
	}

	right_portrait = {
		character = scope:maron_leader
		animation = personality_greedy
	}

	override_background = {
		reference = ep2_hunt_snowy_forest
	}
	widget = {
		gui = "event_window_widget_vfx_snow"
		container = "foreground_shader_vfx_container"
	}

	trigger = {
		is_available_travelling_adult = yes
		is_location_valid_for_travel_event_on_land = yes
		location_has_winter_trigger = yes
	}

	cooldown = { months = 1 }

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }

		hidden_effect = {
			current_travel_plan = {
				every_entourage_character = {
					limit = {
						is_ai = yes
						this != root
					}

					traveler_danger_xp_effect = {
						MIN = 3
						MAX = 10
					}

					current_travel_plan.travel_leader ?= {
						save_scope_as = travel_leader
					}
				}
			}
		}

		if = {
			limit = {
				any_pool_character = {
					province = root.location
					culture = root.location.culture
					has_trait = winter_soldier
				}
			}
			random_pool_character = {
				province = root.location
				limit = {
					culture = root.location.culture
					has_trait = winter_soldier
				}
				save_scope_as = maron_leader
			}
		}
		else = {
			create_character = {
				template = new_warrior_character
				location = root.location
				culture = root.location.culture
				faith = root.location.faith
				gender_female_chance = root_soldier_female_chance
				save_scope_as = maron_leader
				after_creation = {
					add_trait = winter_soldier
					add_character_flag = created #Unop Add created flag so we could only disappear created characters
				}
			}
			scope:maron_leader = {
				add_character_flag = {
					flag = silently_disappear_me
					years = 1
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			location = {
				has_province_modifier = winter_harsh_modifier
			}
			factor = 2
		}
		modifier = { #less likely to be stranded in developed lands
			location.county.development_level > bad_development_level
			factor = 0.5
		}
		modifier = {
			location.county.development_level > medium_development_level
			factor = 0.5
		}
		modifier = {
			location.county.development_level > good_development_level
			factor = 0.5
		}
	}

	option = { #convince them via diplo check
		name = travel_danger_events.3003.a

		duel = {
			skill = diplomacy
			value = high_skill_rating

			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 10
				send_interface_toast = {
					title = travel_danger_events.3003.a.success
					left_icon = scope:maron_leader
				
					add_courtier = scope:maron_leader
					root.current_travel_plan = {
						add_companion = scope:maron_leader
					}
					traveler_danger_xp_effect = {
						MIN = 7
						MAX = 14
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 10
				send_interface_toast = {
					title = travel_danger_events.3003.a.failure
					left_icon = scope:maron_leader
					add_prestige = medium_prestige_loss
					current_travel_plan = {
			 			delay_travel_plan = { days = 14 }
					}
					traveler_danger_xp_effect = {
						MIN = 3
						MAX = 7
					}
				}
			}
		}

		stress_impact = {
			paranoid = medium_stress_gain
		}

		ai_chance = {
			base = 50 
			ai_value_modifier = {
				ai_sociability = tiny_chance_impact_positive_ai_value
				ai_boldness = tiny_chance_impact_positive_ai_value
			}
		}

	}

	option = { #pay them
		name = travel_danger_events.3003.b
		remove_short_term_gold = minor_gold_value

		stress_impact = {
			greedy = medium_stress_gain
		}

		ai_chance = {
			base = 100 
			ai_value_modifier = {
				ai_greed = tiny_chance_impact_negative_ai_value
				ai_rationality = tiny_chance_impact_positive_ai_value 
			}
			modifier = {
				current_gold_value < medium_gold_value
				factor = 0
			}
		}
	}

	option = { #we can manage on our own!
		name = travel_danger_events.3003.c
		flavor = travel_danger_events.3003.c.flavor

		random_list = { #root or travel leader having winter soldier trait or winter cultural traditions increase the chances of success. 
			10 = { #manage to pull through on our own. 12% base chance, 57% with one condition fulfilled
				custom_tooltip = travel_danger_events.3003.c.complete_success
				send_interface_toast = {
					title = travel_danger_events.3003.c.complete_success
					traveler_danger_xp_effect = {
						MIN = 7
						MAX = 14
					}
				}
				modifier = {
					has_trait = winter_soldier
					add = 30
				}
				modifier = {
					culture = { has_cultural_tradition = tradition_winter_warriors }
					add = 30
				}
				modifier = {
					culture = { has_cultural_tradition = tradition_himalayan_settlers }
					add = 30
				}
				modifier = {
					scope:travel_leader ?= { 
						has_trait = winter_soldier
					}
					add = 30
				}
				modifier = {
					scope:travel_leader ?= {
						culture = { has_cultural_tradition = tradition_winter_warriors }
					}
					add = 30
				}
				modifier = {
					scope:travel_leader ?= {
						culture = { has_cultural_tradition = tradition_himalayan_settlers }
					}
					add = 30
				}
			}
			20 = { #with great hardship manage to carry on, 25% base chance, 28% with one condition fulfilled
				custom_tooltip = travel_danger_events.3003.c.partial_success
				send_interface_toast = {
					title = travel_danger_events.3003.c.partial_success
					traveler_danger_xp_effect = {
						MIN = 5
						MAX = 13
					}
					current_travel_plan = {
			 			delay_travel_plan = { days = 7 }
					}
				}

			}
			50 = { #stuck, 62% base chance, 14% with one condition fulfilled
				custom_tooltip = travel_danger_events.3003.c.failure
				send_interface_toast = {
					title = travel_danger_events.3003.c.failure
					traveler_danger_xp_effect = {
						MIN = 3
						MAX = 7
					}
					current_travel_plan = {
			 			delay_travel_plan = { days = 14 }
					}
				}
				modifier = {
					has_trait = winter_soldier
					add = -40
				}
				modifier = {
					culture = { has_cultural_tradition = tradition_winter_warriors }
					add = -40
				}
				modifier = {
					culture = { has_cultural_tradition = tradition_himalayan_settlers }
					add = -40
				}
				modifier = {
					scope:travel_leader ?= { 
						has_trait = winter_soldier
					}
					add = -40
				}
				modifier = {
					scope:travel_leader ?= {
						culture = { has_cultural_tradition = tradition_winter_warriors }
					}
					add = -40
				}
				modifier = {
					scope:travel_leader ?= {
						culture = { has_cultural_tradition = tradition_himalayan_settlers }
					}
					add = -40
				}
			}

		}

		ai_chance = {
			base = 50 
			ai_value_modifier = {
				ai_energy = tiny_chance_impact_positive_ai_value 
			}

		}
	}

	after = {
		mp_resume_travel_plan = yes
		scope:maron_leader = {
			silent_disappearance_ai_if_created_effect = yes #Unop Only disappear created characters
		}
	}
}

travel_danger_events.3004 = { #White Squall, water terrain
	type = character_event
	title = travel_danger_events.3004.t
	desc = travel_danger_events.3004.desc

	theme = travel_danger

	left_portrait = {
		character = root
		animation = fear
	}

	trigger = {
		is_available_travelling_adult = yes

		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
				}
			}
		}
	}

	cooldown = { months = 1 }

	immediate = {
		wayfarer_storyteller_fame_effect = { VALUE = roaming_reward_fame_medium }

		mp_delay_travel_plan = { DAYS = 90 }

		hidden_effect = {
			current_travel_plan = {
				every_entourage_character = {
					limit = {
						is_ai = yes
						this != ROOT
					}

					traveler_danger_xp_effect = {
						MIN = 3
						MAX = 7
					}
				}
			}
		}
	}

	option = { #makeshift sails
		name = travel_danger_events.3004.a

		duel = {
			skill = learning
			value = high_skill_rating

			50 = { #it works!
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				custom_tooltip = travel_danger_events.3004.a.success
				send_interface_toast = {
					title = travel_danger_events.3004.a.success
					traveler_danger_xp_effect = {
						MIN = 7
						MAX = 14
					}
					stress_impact = {
						base = major_stress_impact_loss
					}
				}
			}
			50 = { #it doesnt, we drift
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				custom_tooltip = travel_danger_events.3004.a.failure
				send_interface_toast = {
					title = travel_danger_events.3004.a.failure
					traveler_danger_xp_effect = {
						MIN = 3
						MAX = 7
					}
					current_travel_plan = {
						delay_travel_plan = { days = 14 }
					}
				}
			}
		}

		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_rationality = tiny_chance_impact_positive_ai_value 
			}
		}

	}

	option = { #we have more sails, right?
		name = travel_danger_events.3004.b
		flavor = travel_danger_events.3004.b.flavor

		trigger = {
			OR = {
				culture = {
					OR = {
						has_cultural_tradition = tradition_seafaring
						has_cultural_tradition = tradition_fishermen
						has_cultural_tradition = tradition_maritime_mercantilism
						has_cultural_tradition = tradition_fp1_coastal_warriors
					}
				}
				current_travel_plan = {
					any_entourage_character = {
						this = current_travel_plan.travel_leader
						culture = {
							OR = {
								has_cultural_tradition = tradition_seafaring
								has_cultural_tradition = tradition_fishermen
								has_cultural_tradition = tradition_maritime_mercantilism
								has_cultural_tradition = tradition_fp1_coastal_warriors
							}
						}
					}
				}

				has_trait = forder
				current_travel_plan = {
					any_entourage_character = { #thus hire experienced captains travel option enables this as well
						has_trait = forder
					}
				}
			}
		}

		stress_impact = {
			base = major_stress_impact_loss
		}

		ai_chance = {
			base = 200
		}
	}

	option = { #maaybe somebody will find us
		name = travel_danger_events.3004.c

		random_list = {
			50 = { #somebody finds us
				custom_tooltip = travel_danger_events.3004.c.success
				send_interface_toast = {
					title = travel_danger_events.3004.c.success
					current_travel_plan = {
						delay_travel_plan = { days = 4 }
					}
					stress_impact = {
						base = medium_stress_loss
					}
				}

			}
			50 = { #we slowly drift
				custom_tooltip = travel_danger_events.3004.c.failure
				send_interface_toast = {
					title = travel_danger_events.3004.c.failure
					current_travel_plan = {
			 			delay_travel_plan = { days = 14 }
					}
				}
			}
		}

		ai_chance = {
			base = 10
		}
	}

	after = {
		mp_resume_travel_plan = yes
	}

}

travel_danger_events.3005 = { #brushfire, hill terrain, no winter present
	type = character_event
	title = travel_danger_events.3005.t
	desc = travel_danger_events.3005.desc

	theme = travel_danger

	left_portrait = {
		character = root
		animation = shock
	}

	right_portrait = {
		character = scope:burned_victim
		animation = fear
	}

	override_background = { reference = bp1_bonfire }

	trigger = {
		NOT = {
			location_has_winter_trigger = yes
		}
		is_available_travelling_adult = yes
		is_location_valid_for_travel_event_on_land = yes

		current_travel_plan = {
			any_entourage_character = {
				this != root
				is_ai = yes
				is_adult = yes
			}
		}

		location = {
			travel_danger_type = {
				travel_plan = root.current_travel_plan
				terrain = hills
			}
		}
	}

	cooldown = { years = 5 }

	immediate = {
		wayfarer_storyteller_fame_effect = { VALUE = roaming_reward_fame_medium }
		hidden_effect = {
			current_travel_plan = {
				every_entourage_character = {
					limit = {
						is_ai = yes
						this != root
					}
					traveler_danger_xp_effect = {
						MIN = 3
						MAX = 7
					}
				}
				random_entourage_character = {
					limit = {
						is_ai = yes
						is_adult = yes
						this != root
					}
					save_scope_as = burned_victim
				}
			}
		}
	}

	option = { #RUUUN
		name = travel_danger_events.3005.a
		add_prestige = minor_prestige_loss
		random_list = {
			40 = { #you and yours run away
				custom_tooltip = travel_danger_events.3005.a.success
				send_interface_toast = {
					title = travel_danger_events.3005.a.success
					current_travel_plan = {
				 		delay_travel_plan = { days = 2 }
					}
					stress_impact = {
						base = medium_stress_impact_loss
					}
				}

			}
			60 = { #you run away, entourage member gets burned
				custom_tooltip = travel_danger_events.3005.a.failure
				send_interface_toast = {
					title = travel_danger_events.3005.a.failure
					left_icon = scope:burned_victim
					scope:burned_victim = {
						increase_wounds_no_death_effect = { REASON = burned }
					}
					current_travel_plan = {
				 		delay_travel_plan = { days = 7 }
					}
				}
			}
		}

		stress_impact = {
			craven = medium_stress_impact_loss
			brave = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = tiny_chance_impact_negative_ai_value 
				ai_energy = tiny_chance_impact_negative_ai_value 
			}
		}

	}

	option = { #try to put it out
		name = travel_danger_events.3005.b
		duel = {
			skill = martial
			value = high_skill_rating

			40 = { #you manage to put out the fire
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				#gain prestige
				custom_tooltip = travel_danger_events.3005.b.success
				send_interface_toast = {
					title = travel_danger_events.3005.b.success
					add_prestige = minor_prestige_gain
					traveler_danger_xp_effect = {
						MIN = 7
						MAX = 14
					}
				}
			}
			40 = { #you manage to put out the fire, yet soembody gets burned
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				custom_tooltip = travel_danger_events.3005.b.failure
				send_interface_toast = {
					title = travel_danger_events.3005.b.failure
					left_icon = scope:burned_victim
					scope:burned_victim = {
						increase_wounds_no_death_effect = { REASON = burned }
					}
					traveler_danger_xp_effect = {
						MIN = 3
						MAX = 7
					}
				}
			}
			20 = { #fire engulfs you
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				custom_tooltip = travel_danger_events.3005.b.c_failure
				send_interface_toast = {
					title = travel_danger_events.3005.b.c_failure
					left_icon = scope:burned_victim
					right_icon = root
					increase_wounds_no_death_effect = { REASON = burned }
					scope:burned_victim = {
						increase_wounds_no_death_effect = { REASON = burned }
					}
					traveler_danger_xp_effect = {
						MIN = 3
						MAX = 7
					}
					current_travel_plan = {
				 		delay_travel_plan = { days = 7 }
					}
				}
			}

		}

		stress_impact = {
			brave = medium_stress_impact_loss
			craven = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = tiny_chance_impact_positive_ai_value 
				ai_energy = tiny_chance_impact_positive_ai_value 
			}
		}
	}


}
