namespace = eps_travel_events

################################
#      The Simplest Thing	   #
################################
eps_travel_event.01 = {
	type = character_event
	title = eps_travel_event.01.t
	desc = eps_travel_event.01.desc
	theme = travel
	left_portrait = {
		character = root 
		animation = personality_rational
	}
	right_portrait = {
		character = scope:starving_parent_scope
		animation = pain
		triggered_outfit = {
			outfit_tags = { beggar_rags }
		}
	}

	lower_right_portrait = scope:starving_baby_scope

	cooldown = { years = 50 }

	trigger = {
		is_available_travelling = yes
        is_playable_character = yes
        is_location_valid_for_travel_event_on_land = yes
	}
	immediate = {
		create_character = {
			template = starving_peasant_character
			location = root.location
			culture = root.location.county.culture # They should look like a local
			faith = root.location.county.faith
			dynasty = none
			#Set up the scope
			save_scope_as = starving_parent_scope
		}
		create_character = {
			template = starving_peasant_baby_character
			location = root.location
			culture = root.location.county.culture # They should look like a local
			faith = root.location.county.faith
			dynasty = none
			#Set up the scope
			save_scope_as = starving_baby_scope
		}	
	}
	#Give them some gold
	option = { #maybe make small chance this character becomes an adventurer
		name = eps_travel_event.01.a
		remove_short_term_gold = tiny_gold_value
		stress_impact = {
			generous = medium_stress_impact_loss
			greedy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				short_term_gold < tiny_gold_value
			}
			modifier = {
				factor = 0
					has_trait = greedy
					has_trait = callous
			}
			modifier = {
				factor = 1
				has_trait = generous
			}
		}
	}

	# Take them as your ward
	option = {
		name = eps_travel_event.01.b
		trigger = {
			num_of_relation_ward < 2
		}
		#remove_short_term_gold = medium_gold_value
		add_courtier = scope:starving_baby_scope
		root.current_travel_plan = {
			add_companion = scope:starving_baby_scope
		}
		scope:starving_baby_scope = { set_relation_guardian = root }
		stress_impact = {
			paranoid = medium_stress_impact_gain
			callous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = paranoid
					has_trait = callous
				}
			}
			modifier = {
				factor = 1
				has_trait = gregarious
			}
		}
	}

	#Adopt them as your child
	option = {
		name = eps_travel_event.01.c
		#remove_short_term_gold = medium_gold_value
		if = {
			limit = {
				exists = dynasty
				dynasty.dynast = root
			}
			dynasty = { add_dynasty_prestige = major_dynasty_prestige_loss }
		}
		else = {
			add_prestige = massive_prestige_loss
		}
		if = {
			limit = {
				is_male = yes
			}
			scope:starving_baby_scope = { set_father = root }
		}
		else = {
			scope:starving_baby_scope = { set_mother = root }
		}
		if = {
			limit = { exists = house }
			scope:starving_baby_scope = { set_house = root.house }
		}
		set_relation_friend = {
			reason = friend_adopted
			target = scope:starving_baby_scope
		}
		stress_impact = {
			compassionate = medium_stress_impact_loss
			paranoid = medium_stress_impact_gain
			callous = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
		}
		ai_chance = {
			base = 10 # The AI should really avoid doing this
			modifier = {
				factor = 0
				OR = {
					has_trait = paranoid
					has_trait = arrogant
					has_trait = callous
					has_trait = sadistic
				}
			}
		}
	}
	# Ignore them
	option = {
		name = eps_travel_event.01.d

		#One day make it so samll chance to live and smaller chance
		#to seek revenge (like 1%)
		hidden_effect = {
			scope:starving_baby_scope = {
				death = {
					death_reason = death_starved
				}
			}
			scope:starving_parent_scope = {
				death = {
					death_reason = death_starved
				}
			}
		}

		stress_impact = {
			compassionate = minor_stress_impact_gain
			generous = minor_stress_impact_gain
		}

		ai_chance = {
			modifier = {
				factor = 0
				has_trait = arrogant
				has_trait = callous
			}
		}
	}
}


#########################
# Shadow in the Alley   #
#########################
eps_travel_events.02 = { 
	type = character_event
	title = eps_travel_events.02.t
	desc = eps_travel_events.02.desc
	theme = travel

	override_background = { reference = alley_night }

	left_portrait = {
		character = root 
		animation = admiration
	}

	right_portrait = {
		character = scope:local_prostitute_scope
		animation = flirtation
	}

	cooldown = { years = 10}

	trigger = {
		is_available_travelling_adult = yes
		is_location_valid_for_travel_event_on_land = yes
		NOR = {
			has_trait = celibate
			has_sexuality = asexual
		}
	}
	weight_multiplier = {
		base = 1
		modifier = {
			exists = involved_activity
			involved_activity = {
				has_activity_type = activity_pilgrimage
			}
			add = -0.5
		}
		modifier = {
			NOR = {
				has_trait = lustful
				has_trait = seducer
				has_trait = rakish
			}
			add = -0.5
		}
	}

	immediate = {
		create_character = {
			template = lowly_prostitute_character
			location = root.location
			culture = root.location.county.culture
			faith = root.location.county.faith
			#Set up the scope
			save_scope_as = local_prostitute_scope
		}
	}

	#Follow her to the Inn
	option = { 
		name = eps_travel_events.02.a

		trigger_event = eps_travel_events.03

		stress_impact = {
			gregarious = medium_stress_impact_loss
			shy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				OR = {
					has_trait = shy
					has_trait = chaste
				}
			}
			modifier = {
				factor = 5
				OR = {
					has_trait = lustful
					has_trait = gregarious
				}
			}
		}
	}

	#Pay to bed outside deviant
	option = { 
		name = eps_travel_events.02.b
		pay_short_term_gold = {
			target = scope:local_prostitute_scope
			gold = medium_gold_value
		}

		stress_impact = {
			lustful = medium_stress_impact_loss
			greedy = medium_stress_impact_gain
		}

		had_sex_with_effect = {
			CHARACTER = scope:local_prostitute_scope
			PREGNANCY_CHANCE = pregnancy_chance
		}

		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				OR = {
					short_term_gold < tiny_gold_value
					has_trait = greedy
					has_trait = chaste
				}
			}
			modifier = {
				factor = 5
				has_trait = lustful
			}
		}
		scope:local_prostitute_scope = {
			if = {
				limit = {
					root = { is_ai = yes }
				}
				silent_disappearance_effect = yes
			}
		}
	}

	# No Thank You
	option = {
		name = eps_travel_events.02.c
		scope:local_prostitute_scope = {
			if = {
				limit = {
					root = { is_ai = yes }
				}
				silent_disappearance_effect = yes
			}
		}
		stress_impact = {
			lustful = medium_stress_impact_gain
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = lustful
					has_trait = rakish
				}
			}
		}
		scope:local_prostitute_scope = {
			if = {
				limit = {
					root = { is_ai = yes }
				}
				silent_disappearance_effect = yes
			}
		}
	}
}


#At the prostitute's room
eps_travel_events.03 = { 
	type = character_event
	title = eps_travel_events.03.t
	desc = eps_travel_events.03.desc
	theme = travel
	override_background = { reference = tavern }

	left_portrait = {
		character = root 
	   	animation = admiration
	}

	right_portrait = {
		character = scope:local_prostitute_scope
		animation = flirtation
	}

	#Pay to bed
	option = {
		name = eps_travel_events.03.a
		pay_short_term_gold = {
			target = scope:local_prostitute_scope
			gold = minor_gold_value
		}

		scope:local_prostitute_scope = {
			if = {
				limit = {
					root = { is_ai = yes }
				}
				silent_disappearance_effect = yes
			}
		}

		had_sex_with_effect = {
			CHARACTER = scope:local_prostitute_scope
			PREGNANCY_CHANCE = pregnancy_chance
		}

		stress_impact = {
			lustful = medium_stress_impact_loss
			greedy = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				short_term_gold < tiny_gold_value
			}
			modifier = {
				factor = 0
					has_trait = greedy
					has_trait = chaste
			}
			modifier = {
				factor = 1
				has_trait = lustful
			}
		}
	}

	#Ask to just talk
	option = {
		name = eps_travel_events.03.b

		pay_short_term_gold = {
			target = scope:local_prostitute_scope
			gold = minor_gold_value
		}

		scope:local_prostitute_scope = {
			if = {
				limit = {
					root = { is_ai = yes }
				}
				silent_disappearance_effect = yes
			}
		}

		stress_impact = {   
			lustful = medium_stress_impact_loss
			rakish = medium_stress_impact_loss
			seducer = medium_stress_impact_loss
			paranoid = medium_stress_impact_gain
			chaste = medium_stress_impact_gain
			shy = medium_stress_impact_gain
		}

		ai_chance = {
			base = 5
			modifier = {
				add = 0
				OR = {
					has_trait = lustful
					has_trait = rakish
					has_trait = seducer
					has_trait = paranoid
					has_trait = chaste
					has_trait = shy
				}
			}
			modifier = {
				factor = 50
				OR = {
					has_trait = gregarious
				}
			}
		}
	}

	# Say Nevermind
	option = {
		name = eps_travel_events.03.c
		stress_impact = {
			lustful = medium_stress_impact_gain
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = lustful
					has_trait = rakish
				}
			}
		}

		scope:local_prostitute_scope = {
			if = {
				limit = {
					root = { is_ai = yes }
				}
				silent_disappearance_effect = yes
			}
		}
	}
}


#########################
#  Countryside Wedding  #
#########################
eps_travel_events.04 = {
	type = character_event
	title = eps_travel_events.04.t
	desc = eps_travel_events.04.desc
	theme = travel_diplomacy
	theme = travel

	#think of an override??

	cooldown = { years = 15 }
	
	left_portrait = {
		character = scope:groom
		animation = admiration
	}

	right_portrait = {
		character = scope:bride
		animation = flirtation
	}

	# override_effect_2d = {
	# 	trigger = {
	# 		current_season_rainy_season = yes
	# 	}
	# 	reference = rain
	# }

	override_effect_2d = {
		trigger = {
			OR = {
				current_season_dry_season = yes
				current_season_summer = yes
			}
		}
		reference = legend_glow
	}

	widget = {
		is_shown = {
			current_season_winter = yes
			location = { 
				has_winter_trigger = yes
			}
		}
		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
	}

	immediate = {
		mp_delay_travel_plan = { DAYS = 90 }
		hidden_effect = {
			create_character = {
				template = generic_female_peasant_character
				gender = female
				culture = location.culture
				faith = location.faith
				location = root.location
				age = { 16 25 }
				save_scope_as = bride
			}
			create_character = {
				template = generic_peasant_character
				gender = male
				culture = location.culture
				faith = location.faith
				location = root.location
				age = { 16 25 }
				save_scope_as = groom
			}
		}
	}
	
	
	option = { # give couple gift
		name = eps_travel_events.04.a

		remove_short_term_gold = minor_gold_value

		if = {
			limit = {
				faith = {
					OR = {
						trait_is_virtue = compassionate
						trait_is_virtue = generous
					}
				}
			}
			add_piety = major_piety_gain 
		}
		else = {
			add_prestige = medium_piety_gain 
		}

		stress_impact = {
			greedy = medium_stress_impact_gain
			generous = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = generous
			}
		}


		if = {
			limit = {
				OR = {
					has_trait = diligent
					has_trait = shy
					has_trait = arrogant
					has_trait = paranoid
				}
			}
			stress_impact = {
				diligent = minor_stress_impact_gain
				shy = minor_stress_impact_gain
				arrogant = miniscule_stress_impact_gain
				paranoid = miniscule_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				base = minor_stress_impact_loss
				gregarious = minor_stress_impact_loss
				lustful = minor_stress_impact_loss
				gluttonous = minor_stress_impact_loss
				lazy = miniscule_stress_impact_loss
			}
		}


		current_travel_plan = {
			delay_travel_plan = { days = 5 }
		}

	}
	
	# option = { # officiate the wedding
	# 	name = eps_travel_events.04.b
	# 	current_travel_plan = { 
	# 		delay_travel_plan = { days = 5 }
	# 	}
	# 	stress_impact = {
	# 		gregarious = minor_stress_impact_gain
	# 		lustful = minor_stress_impact_gain
	# 		gluttonous = minor_stress_impact_gain
	# 		lazy = miniscule_stress_impact_gain
	# 	}
	# 	#start a second event??
	# }


	option = { # beat them up (sadistic and/or callous)
		name = eps_travel_events.04.c
		trigger = {
			OR = {
				has_trait = cynical
				has_trait = callous
				has_trait = sadistic
			}
		}

		#eventually add this all to random list
		#with outcome of fight is random
		#or start duels?

		stress_impact = {
			gregarious = minor_stress_impact_gain
			lustful = minor_stress_impact_gain
			gluttonous = minor_stress_impact_gain
			lazy = miniscule_stress_impact_gain
		}

		#make this random eventually between lightly wounded, wounded, and dead
		scope:bride = {
  			death = {
				death_reason = death_execution
				killer = root 
			}
 		}

 		scope:groom = {
  			death = {
				death_reason = death_execution
				killer = root 
			}
 		}
	}

	option = { # I want her (lustful)
		name = eps_travel_events.04.d

		trigger = {
			OR = {
				has_trait = lustful
			}
		}

		had_sex_with_effect = {
			CHARACTER = scope:local_prostitute_scope
			PREGNANCY_CHANCE = pregnancy_chance
		}

		stress_impact = {
			compassionate = medium_stress_impact_gain
			lustful = medium_stress_impact_loss
			greedy = minor_stress_impact_loss
		}

		# random_list = {
        #     50 = {  # They accept
		# 		trigger_event = eps_travel_events.05
        #     }

        #     50 = {	#They refuse and hurt you
        #         trigger_event = eps_travel_events.06
        #     }         
        # }
	}

	# option = { # She's my bride now! (lustful and unmarried/marriage slot open)
	# 	name = eps_travel_events.04.e
	# 	stress_impact = {
	# 		gregarious = minor_stress_impact_gain
	# 		lustful = minor_stress_impact_gain
	# 		gluttonous = minor_stress_impact_gain
	# 		lazy = miniscule_stress_impact_gain
	# 	}
	# }

	option = { #Marriage Tax Time
		name = eps_travel_events.04.f

		trigger = {
			has_trait = greedy
		}

		add_short_term_gold = medium_gold_value

		#figure out how to lower popular opinion

		stress_impact = {
			gregarious = minor_stress_impact_gain
			greedy = minor_stress_impact_loss
		}
	}

	option = { # Lets move on
		name = eps_travel_events.04.g
		stress_impact = {
			gregarious = minor_stress_impact_gain
			lustful = minor_stress_impact_gain
		}
	}
}