﻿namespace = ep3_laamps

####
# ep3_laamps.8000		The Truth
# ep3_laamps.8010		Loyal Companion
# ep3_laamps.8020		The Trip of a Lifetime
# ep3_laamps.8030		A Rare Orepportunity
# ep3_laamps.8040		Let Sleeping Dogs Lie
# ep3_laamps.8050		Without Friends or Protection
# ep3_laamps.8060		Nary a Drop
# ep3_laamps.8070		Foreign Fruits
# ep3_laamps.8080		A Strange Sailor
# ep3_laamps.8090		The Distant Shores
# by James Beaumont

# The Truth
# Come back to lands you claim, begin rallying support!
# 8000
ep3_laamps.8000 = {
	type = character_event
	title = ep3_laamps.8000.t
	desc = {
		desc = ep3_laamps.8000.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					num_sinful_traits >= 1
					num_virtuous_traits < 1
				}
				desc = ep3_laamps.8000.desc.outro.sinner
			}
			desc = ep3_laamps.8000.desc.outro
		}
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = personality_bold
	}

	cooldown = { years = 25 }

	trigger = {
		has_government = landless_adventurer_government
		is_adult = yes
		is_available_allow_travelling = yes
		any_memory = {
			memory_type = lost_title_memory
			memory_age_years >= 10
			var:landed_title = {
				tier >= tier_duchy
				save_temporary_scope_as = title_temp
			}
		}
		current_travel_plan.departure_location.county = {
			NOR = {
				target_is_de_jure_liege_or_above = scope:title_temp
				target_is_de_facto_liege_or_above = scope:title_temp
			}
		}
		exists = location.county
		location.county = {
			target_is_de_jure_liege_or_above = scope:title_temp
			OR = {
				root = { has_claim_on = prev }
				holder = {
					any_held_title = {
						is_de_facto_liege_or_above_target = root.location.county
						root = { has_claim_on = prev }
					}
				}
				holder = {
					any_liege_or_above = {
						any_held_title = {
							is_de_facto_liege_or_above_target = root.location.county
							root = { has_claim_on = prev }
						}
					}
				}
			}
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_nimbo_8000
				VAL = 1
			}
		}
		if = {
			limit = {
				location.county.holder = {
					any_held_title = {
						title_tier >= duchy
						is_de_facto_liege_or_above_target = root.location.county
						root = { has_claim_on = prev }
					}
				}
			}
			location.county.holder = {
				random_held_title = {
					title_tier >= duchy
					limit = {
						is_de_facto_liege_or_above_target = root.location.county
						root = { has_claim_on = prev }
					}
					holder = { save_scope_as = claim_holder }
					save_scope_as = claimed_land
				}
			}
		}
		else_if = {
			limit = {
				location.county.holder = {
					any_liege_or_above = {
						any_held_title = {
							is_de_facto_liege_or_above_target = root.location.county
							root = { has_claim_on = prev }
						}
					}
				}
			}
			location.county.holder = {
				random_liege_or_above = {
					limit = {
						any_held_title = {
							is_de_facto_liege_or_above_target = root.location.county
							root = { has_claim_on = prev }
						}
					}
					random_held_title = {
						limit = {
							is_de_facto_liege_or_above_target = root.location.county
							root = { has_claim_on = prev }
						}
						holder = { save_scope_as = claim_holder }
						save_scope_as = claimed_land
					}
				}
			}
		}
		else = {
			root.location.county = {
				holder = { save_scope_as = claim_holder }
				save_scope_as = claimed_land
			}
		}
	}

	option = { # I'm here to get my title back!
		name = ep3_laamps.8000.a
		add_character_modifier = {
			modifier = laamp_prepping_for_invasion
			years = 15
		}
		reverse_add_opinion = {
			modifier = laamp_claimant_opinion
			target = scope:claim_holder
			years = 10
		}

		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 1.5
			}
		}
	}

	option = { # I'm just here to have a wander
		name = ep3_laamps.8000.b
		add_character_modifier = {
			modifier = laamp_familiar_lands
			years = 15
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = -1.5
			}
		}
	}
}

# The Loyal Companion
# Adopt a puppy
# 8010
# Loyal Companion
ep3_laamps.8010 = {
	type = character_event
	title = ep3_laamps.8010.t
	desc = ep3_laamps.8010.desc
	theme = laamp
	override_background = { reference = terrain }
	left_portrait = {
		character = root
		animation = personality_compassionate
	}

	# Come along puppy
	option = {
		name = ep3_laamps.8010.a
		start_dog_story_cycle_effect = yes
		ai_chance = {
			base = 10
		}
	}
}

# The Adventure of a Lifetime
# Courtier at your location wants to join you
# 8020
scripted_trigger valid_adventurous_character = {
	NOR = {
		# They got that adventuring spirit in em
		has_trait = craven
		has_trait = lazy
		# Don't steal people super important to the realm
		is_child_of = root.location.county.holder
		is_player_heir_of = root.location.county.holder
		is_consort_of = root.location.county.holder
	}
	# They're at least somewhat in control of their own life
	OR = {
		AND = {
			is_married = no
			is_concubine = no
		}
		AND = {
			is_married = yes
			is_female = yes
			matrilinear_marriage = yes
		}
		AND = {
			is_married = yes
			is_male = yes
			patrilinear_marriage = yes
		}
	}
	# Someone the player will care about
	has_any_high_skill_rating = yes
	# And make sure there's more than just animosity here.
	opinion = {
		target = root
		value >= -40
	}
	NOT = {
		has_any_moderate_bad_relationship_with_character_trigger = { CHARACTER = root }
	}
	# Plus must be eligible for one of your officer positions.
	OR = {
		camp_officer_generator_pickable_trigger = { POS = second EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = quartermaster EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = armorer EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = chief_forager EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = master_thief EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = head_porter EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = head_groom EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = huntperson EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = kennelperson EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = chief_engineer EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = witness EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = person_haggler EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = camp_cook EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = master_bard EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = stooge EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = master_of_arms EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = light_cavalry_captain EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = camelry_captain EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = elephantry_captain EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = heavy_cavalry_captain EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = horse_archer_captain EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = archer_captain EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = heavy_infantry_captain EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = light_infantry_captain EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = pike_captain EMPLOYER = root }
		camp_officer_generator_pickable_trigger = { POS = master_of_spoils EMPLOYER = root }
	}
}
ep3_laamps.8020 = {
	type = character_event
	title = ep3_laamps.8020.t
	desc = ep3_laamps.8020.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:wouldbe_companion
		triggered_animation = {
			trigger = {
				ai_boldness <= ai_compassion
			}
			animation = beg
		}
		triggered_animation = {
			trigger = {
				ai_boldness > ai_compassion
			}
			animation = personality_bold
		}
	}

	cooldown = { years = 20 }

	trigger = {
		trigger_if = {
			limit = {
				is_ai = yes
			}
			static_group_filter = {
				group = ep3_laamps.8020
				match = 0.2
			}
		}
		has_government = landless_adventurer_government
		is_adult = yes
		is_available_allow_travelling = yes
		location.county.holder ?= {
			is_ai = yes
			any_courtier = {
				valid_adventurous_character = yes
			}
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_nimbo_8020
				VAL = 1
			}
		}
		location.county.holder = {
			save_scope_as = holder
			random_courtier = {
				limit = {
					valid_adventurous_character = yes
				}
				save_scope_as = wouldbe_companion
				camp_officer_generator_effect = {
					VAR = target
					EMPLOYER = root
				}
			}
		}
	}

	# Come with me
	option = {
		name = ep3_laamps.8020.a
		set_relation_friend = {
			target = scope:wouldbe_companion
			reason = friend_trip_of_a_lifetime
		}
		add_courtier = scope:wouldbe_companion
		reverse_add_opinion = {
			target = scope:wouldbe_companion
			modifier = grateful_opinion
			opinion = 100
		}
		camp_officer_generator_assignment_effect = {
			VAR = target
			CANDIDATE = scope:wouldbe_companion
			EMPLOYER = root
		}
		stress_impact = {
			shy = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 2.5
				ai_sociability = 2.5
				ai_honor = -2.5
			}
		}
	}

	# I'll take you on gladly.
	option = {
		name = ep3_laamps.8020.a.2
		add_courtier = scope:wouldbe_companion
		reverse_add_opinion = {
			target = scope:wouldbe_companion
			modifier = grateful_opinion
			opinion = 70
		}
		add_prestige = minor_prestige_gain
		stress_impact = {
			shy = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 1
				ai_rationality = 2.5
				ai_honor = -2.5
			}
		}
	}

	option = {
		name = ep3_laamps.8020.b
		progress_towards_friend_effect = {
			REASON = friend_returned_my_companion
			CHARACTER = root.location.county.holder
			OPINION = default_friend_opinion
		}
		stress_impact = {
			gregarious = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = -2.5
				ai_sociability = -2.5
				ai_honor = 2.5
			}
		}
	}
}

# A Rare Orepportunity
# Local materials are high quality, use them to improve your artifact?
# 8030
ep3_laamps.8030 = {
	type = character_event
	title = ep3_laamps.8030.t
	desc = ep3_laamps.8030.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = war_over_tie
	}
	right_portrait = {
		character = scope:armorer
		animation = personality_bold
	}
	artifact = {
		target = scope:artifact
		position = lower_left_portrait
	}

	cooldown = { years = 15 }

	trigger = {
		has_government = landless_adventurer_government
		is_adult = yes
		is_available_allow_travelling = yes
		employs_court_position = armorer_camp_officer
		any_equipped_character_artifact = {
			OR = {
				artifact_slot_type = armor
				artifact_slot_type = primary_armament
			}
		}
		location = {
			OR = {
				is_mountainous_trigger = yes
				has_building_or_higher = royal_armory_01
				has_building_or_higher = blacksmiths_01
			}
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_nimbo_8030
				VAL = 1
			}
		}
		location = { save_scope_as = location }
		court_position:armorer_camp_officer = {
			save_scope_as = armorer
		}
		random_equipped_character_artifact = {
			limit = {
				OR = {
					artifact_slot_type = armor
					artifact_slot_type = primary_armament
				}
			}
			save_scope_as = artifact
		}
	}

	# Improve my artifact!
	option = {
		name = ep3_laamps.8030.a
		scope:armorer = {
			duel = {
				skill = stewardship
				value = medium_skill_rating
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -49
					}
					root = {
						send_interface_toast = {
							title = ep3_laamps.8030.a.win
							left_icon = scope:armorer
							right_icon = scope:artifact
							scope:artifact = {
								add_artifact_modifier = artifact_durable_materials_02
							}
						}
					}
				}
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
						min = -49
					}
					root = {
						send_interface_toast = {
							title = ep3_laamps.8030.a.lose
							left_icon = scope:armorer
							right_icon = scope:artifact
							scope:artifact = {
								add_durability = -10
							}
						}
					}
				}
			}
		}
		stress_impact = {
			craven = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			fickle = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 2.5
				ai_sociability = 2.5
				ai_rationality = 2.5
				ai_greed = -2.5
			}
		}
	}

	# Use the materials to repair my damaged artifacts
	option = {
		name = ep3_laamps.8030.b
		trigger = {
			any_character_artifact = {
				OR = {
					artifact_slot_type = armor
					artifact_slot_type = primary_armament
				}
				artifact_durability <= 75
			}
		}
		every_character_artifact = {
			limit = {
				OR = {
					artifact_slot_type = armor
					artifact_slot_type = primary_armament
				}
				artifact_durability <= 75
			}
			add_durability = 25
		}
		stress_impact = {
			ambitious = minor_stress_impact_gain
			brave = minor_stress_impact_gain
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = -2.5
				ai_sociability = -2.5
				ai_rationality = 2.5
			}
		}
	}

	# Gather the materials, and sell them!
	option = {
		name = ep3_laamps.8030.c
		add_gold = medium_gold_value
		stress_impact = {
			ambitious = minor_stress_impact_gain
			brave = minor_stress_impact_gain
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = -2.5
				ai_sociability = -2.5
				ai_greed = 2.5
			}
		}
	}
}

# Let Sleeping Dogs Lie
# A pregnant wolf is giving birth in one of your tents
# 8040
ep3_laamps.8040 = {
	type = character_event
	title = ep3_laamps.8040.t
	desc = ep3_laamps.8040.desc
	theme = laamp
	override_background = { reference = bp1_bonfire }
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:frightened_courtier
		animation = fear
	}

	cooldown = { years = 15 }

	trigger = {
		has_government = landless_adventurer_government
		is_adult = yes
		is_available_allow_travelling = yes
		location = {
			is_wooded_trigger = yes
		}
		any_courtier = {
			NOT = { is_child_of = root }
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_nimbo_8040
				VAL = 1
			}
		}
		random_courtier = {
			limit = {
				NOT = { is_child_of = root }
			}
			weight = {
				base = 1
				modifier = {
					add = {
						subtract = ai_boldness
					}
				}
			}
			save_scope_as = frightened_courtier
		}
	}

	# Oh hush, I'll slay the beast
	option = {
		name = ep3_laamps.8040.a
		duel = {
			skill = prowess
			value = medium_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				send_interface_toast = {
					title = ep3_laamps.8040.a.win
					left_icon = root
					add_prestige = major_prestige_gain
					if = {
						limit = {
							OR = {
								has_any_nickname = no
								has_bad_nickname = yes
							}
						}
						if = {
							limit = {
								is_ai = yes
							}
							random = {
								chance = 5
								give_nickname = nick_wolf_slayer
							}
						}
						else = {
							give_nickname = nick_wolf_slayer
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				send_interface_toast = {
					title = ep3_laamps.8040.a.lose
					left_icon = root
					add_prestige = minor_prestige_gain
					increase_wounds_effect = { REASON = wolf }
				}
			}
		}
		stress_impact = {
			brave = medium_stress_impact_loss
			craven = medium_stress_impact_gain
			humble = minor_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 2.5
				ai_rationality = -2.5
			}
		}
	}

	# Slay the mother and give the pups to my kids
	option = {
		name = ep3_laamps.8040.b
		trigger = {
			any_child = {
				is_courtier_of = root
			}
		}
		every_child = {
			limit = {
				is_courtier_of = root
			}
			custom = every_child_in_camp
			root = {
				progress_towards_friend_effect = {
					REASON = friend_gave_them_a_dog
					CHARACTER = prev
					OPINION = default_friend_opinion
				}
			}
			start_dog_story_cycle_effect = yes
		}
		if = {
			limit = {
				is_male = yes
				OR = {
					has_any_nickname = no
					has_bad_nickname = yes
				}
			}
			if = {
				limit = {
					is_ai = yes
				}
				random = {
					chance = 5
					give_nickname = nick_wolf_father
				}
			}
			else = {
				give_nickname = nick_wolf_father
			}
		}
		else_if = {
			limit = {
				is_female = yes
				OR = {
					has_any_nickname = no
					has_bad_nickname = yes
				}
			}
			if = {
				limit = {
					is_ai = yes
				}
				random = {
					chance = 5
					give_nickname = nick_wolf_mother
				}
			}
			else = {
				give_nickname = nick_wolf_mother
			}
		}
		stress_impact = {
			brave = minor_stress_impact_gain
			sadistic = medium_stress_impact_gain
			callous = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_sociability = 2.5
				ai_rationality = 1.5
			}
		}
	}

	# Looks like we have the beginnings of a kennel!
	option = {
		name = ep3_laamps.8040.c
		trigger = {
			domicile = {
				NOT = {
					has_domicile_building = baggage_train_kennel
				}
			}
			OR = {
				has_trait = eccentric
				has_trait = avaricious
			}
		}
		domicile = {
			if = {
				limit = {
					NOT = {
						has_domicile_building = baggage_train_01
					}
				}
				add_domicile_building = baggage_train_01
			}
			add_domicile_building = baggage_train_kennel
		}
		stress_impact = {
			brave = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
			callous = minor_stress_impact_gain
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_sociability = 2.5
				ai_rationality = 1.5
			}
		}
	}

	# We'll get you a new tent
	option = {
		name = ep3_laamps.8040.d
		stress_impact = {
			craven = medium_stress_impact_loss
			brave = medium_stress_impact_gain
			sadistic = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			generous = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_sociability = 2.5
				ai_rationality = 1.5
			}
		}
	}
}

# Without Friends or Protection
# A talented minority wishes to join you
# 8050
scripted_trigger laamp_8050_valid_minority = {
	save_temporary_scope_as = courtier_to_check
	# Someone the player will care about
	has_any_high_skill_rating = yes
	# Ruling class hates their faith
	root.location.county.holder.faith = {
		faith_hostility_level = {
			target = scope:courtier_to_check.faith
			value >= faith_hostile_level
		}
	}
	OR = {
		root.location.county.holder = {
			OR = {
				has_trait = zealous
				has_trait = callous
				has_trait = sadistic
				has_trait = torturer
				has_trait = holy_warrior
				ai_zeal > ai_compassion
			}
		}
		# Locals hate their faith
		root.location.faith = {
			faith_hostility_level = {
				target = scope:courtier_to_check.faith
				value >= faith_hostile_level
			}
		}
	}
}

ep3_laamps.8050 = {
	type = character_event
	title = ep3_laamps.8050.t
	desc = {
		desc = ep3_laamps.8050.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					faith = scope:minority.faith
				}
				desc = ep3_laamps.8050.desc.mid.samefaith
			}
			triggered_desc = {
				trigger = {
					root.location.county.holder.faith = {
						faith_hostility_level = {
							target = root.faith
							value >= faith_hostile_level
						}
					}
				}
				desc = ep3_laamps.8050.desc.mid.alsohated
			}
			desc = ep3_laamps.8050.desc.mid.fallback
		}
		desc = ep3_laamps.8050.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = personality_bold
	}
	right_portrait = {
		character = scope:minority
		animation = beg
	}
	lower_right_portrait = {
		character = root.location.county.holder
	}

	cooldown = { years = 15 }

	trigger = {
		has_government = landless_adventurer_government
		is_adult = yes
		is_available_allow_travelling = yes
		is_location_valid_for_travel_event_on_land = yes
		OR = {
			any_pool_character = {
				province = root.location
				laamp_8050_valid_minority = yes
			}
			AND = {
				location.county.holder = { is_ai = yes }
				location.county.holder = {
					any_courtier_or_guest = {
						laamp_8050_valid_minority = yes
					}
				}
			}
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_nimbo_8050
				VAL = 1
			}
		}
		if = {
			limit = {
				any_pool_character = {
					province = root.location
					laamp_8050_valid_minority = yes
				}
			}
			random_pool_character = {
				province = root.location
				limit = {
					laamp_8050_valid_minority = yes
				}
				weight = {
					base = 1
					modifier = {
						add = 2
						OR = {
							# Smaller religions unlikely to have a *homeland* to return to
							religion = religion:dualism_religion
							religion = religion:judaism_religion
							religion = religion:yazidi_religion
							religion = religion:zoroastrianism_religion
							religion = religion:zunism_religion
						}
					}
				}
				save_scope_as = minority
			}
		}
		else = {
			location.county.holder = {
				random_courtier_or_guest = {
					limit = {
						laamp_8050_valid_minority = yes
					}
					weight = {
						base = 1
						modifier = {
							add = 2
							OR = {
								# Smaller religions unlikely to have a *homeland* to return to
								religion = religion:dualism_religion
								religion = religion:judaism_religion
								religion = religion:yazidi_religion
								religion = religion:zoroastrianism_religion
								religion = religion:zunism_religion
							}
						}
					}
					save_scope_as = minority
				}
			}
		}
	}

	# Of course, join me as my companion!
	option = {
		name = ep3_laamps.8050.a
		set_relation_friend = {
			target = scope:minority
			reason = friend_trip_of_a_lifetime
		}
		add_courtier = scope:minority
		if = {
			limit = {
				scope:minority.faith = root.faith
			}
			add_piety = medium_piety_gain
			stress_impact = {
				callous = minor_stress_impact_gain
				sadistic = minor_stress_impact_gain
				shy = minor_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				zealous = medium_stress_impact_gain
				callous = minor_stress_impact_gain
				sadistic = minor_stress_impact_gain
				shy = minor_stress_impact_gain
			}
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 2.5
				ai_sociability = 2.5
				ai_rationality = 2.5
				ai_honor = 2.5
				ai_vengefulness = -2.5
				ai_zeal = -2.5
			}
		}
	}

	# I shall help you flee to safer lands
	option = {
		name = ep3_laamps.8050.b
		trigger = {
			culture = { this != scope:minority.culture }
		}
		scope:minority = {
			if = {
				limit = {
					is_pool_character = no
				}
				move_to_pool = yes
			}
		}
		root.culture = {
			change_cultural_acceptance = {
				target = scope:minority.culture
				value = minor_cultural_acceptance_gain
				desc = cultural_acceptance_fled_persecution
			}
		}
		if = {
			limit = {
				scope:minority.faith = root.faith
			}
			add_piety = medium_piety_gain
			stress_impact = {
				sadistic = medium_stress_impact_gain
				callous = minor_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				sadistic = medium_stress_impact_gain
				callous = minor_stress_impact_gain
				zealous = minor_stress_impact_gain
			}
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_vengefulness = -2.5
				ai_sociability = -2.5
				ai_rationality = 2.5
				ai_zeal = -2.5
			}
		}
	}

	# Run home to your master now. Go on. Get.
	option = {
		name = ep3_laamps.8050.c
		#Oppression is fun, I guess
		if = {
			limit = { faith = root.location.county.holder.faith }
			add_piety = medium_piety_gain
		}
		else = { add_prestige = medium_prestige_gain }
		stress_impact = {
			gregarious = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
			callous = minor_stress_impact_loss
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = -2.5
				ai_sociability = -2.5
				ai_honor = 2.5
			}
		}
	}
}

# Nary a Drop
# Your water supplies spring a leak
# 8060
ep3_laamps.8060 = {
	type = character_event
	title = ep3_laamps.8060.t
	desc = ep3_laamps.8060.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = rage
	}
	right_portrait = {
		character = scope:idiot
		animation = beg
	}

	cooldown = { years = 15 }

	trigger = {
		has_government = landless_adventurer_government
		is_adult = yes
		is_available_allow_travelling = yes
		domicile ?= {
			domicile_location = {
				# Water should be precious
				is_desert_trigger = yes
				NOT = { terrain = oasis }
			}
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_nimbo_8060
				VAL = 1
			}
		}
		random_courtier = {
			weight = {
				base = 100
				modifier = {
					add = {
						subtract = learning
						subtract = prowess
					}
				}
				# Clumsy
				modifier = {
					add = 50
					has_trait = intellect_bad
				}
				# Clumsy
				modifier = {
					add = 50
					has_trait = physique_bad
				}
				modifier = {
					factor = 0
					is_adult = no
				}
			}
			save_scope_as = idiot
		}
	}

	# Quickly, we must find some!
	option = {
		name = ep3_laamps.8060.a
		duel = {
			skill = stewardship
			value = medium_skill_rating
			50 = {
				desc = ep3_laamps.8060.a.win
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = ep3_laamps.8060.a.win
					left_icon = root
					domicile ?= { change_provisions = minor_provisions_gain }
				}
			}
			50 = {
				desc = ep3_laamps.8060.a.lose
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = ep3_laamps.8060.a.lose
					left_icon = root
					domicile ?= { change_provisions = minor_provisions_loss }
				}
			}
		}
		stress_impact = {
			wrathful = medium_stress_impact_gain
			vengeful = medium_stress_impact_gain
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = -2.5
				ai_sociability = 2.5
				ai_rationality = 2.5
				ai_honor = 2.5
				ai_vengefulness = -5
			}
		}
	}

	# Maybe we need to... recycle
	option = {
		name = ep3_laamps.8060.b
		trigger = { has_trait = eccentric }
		every_courtier = {
			custom = every_camp_member
			random = {
				chance = 15
				contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = no }
			}
		}
		hidden_effect = {
			random = {
				chance = 15
				contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = yes }
			}
		}
		stress_impact = {
			base = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
			wrathful = medium_stress_impact_gain
			vengeful = medium_stress_impact_gain
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = -2.5
				ai_rationality = -2.5
				ai_vengefulness = -5
			}
		}
	}

	# You blundering imbecile! You fix this!
	option = {
		name = ep3_laamps.8060.c
		scope:idiot = {
			duel = {
				skill = stewardship
				value = medium_skill_rating
				50 = {
					desc = ep3_laamps.8060.c.win
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -49
					}
					root = {
						send_interface_toast = {
							title = ep3_laamps.8060.c.win
							left_icon = root
							domicile ?= { change_provisions = minor_provisions_gain }
						}
					}
				}
				50 = {
					desc = ep3_laamps.8060.c.lose
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
						min = -49
					}
					root = {
						send_interface_toast = {
							title = ep3_laamps.8060.c.lose
							left_icon = root
							domicile ?= { change_provisions = minor_provisions_loss }
						}
					}
				}
			}
		}
		stress_impact = {
			fickle = medium_stress_impact_gain
			humble = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			calm = medium_stress_impact_gain
			vengeful = medium_stress_impact_loss
			wrathful = medium_stress_impact_loss
			callous = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 2.5
				ai_rationality = 2.5
				ai_vengefulness = 5
			}
		}
	}

	# Time to ransack some local caravans
	option = {
		name = ep3_laamps.8060.d
		add_gold = medium_gold_value
		random = {
			chance = 15
			send_interface_toast = {
				title = ep3_laamps.8060.d.lose
				left_icon = root
				right_icon = root.location.county.holder
				reverse_add_opinion = {
					modifier = theft_opinion
					target = root.location.county.holder
				}
			}
		}
		stress_impact = {
			fickle = medium_stress_impact_gain
			humble = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			calm = medium_stress_impact_gain
			vengeful = medium_stress_impact_loss
			wrathful = medium_stress_impact_loss
			callous = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 2.5
				ai_greed = 2.5
				ai_vengefulness = 5
			}
		}
	}

	# We can live without it
	option = {
		name = ep3_laamps.8060.e
		domicile = { change_provisions = medium_provisions_loss }
		stress_impact = {
			wrathful = medium_stress_impact_gain
			vengeful = medium_stress_impact_gain
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = -2.5
				ai_sociability = 2.5
				ai_rationality = -2.5
				ai_honor = 2.5
				ai_vengefulness = -5
			}
		}
	}
}

# Foreign Fruits
# You find some strange looking fruit, eat it?
# 8070
ep3_laamps.8070 = {
	type = character_event
	title = ep3_laamps.8070.t
	desc = ep3_laamps.8070.desc
	theme = laamp
	left_portrait = {
		character = root
		animation = thinking
	}
	lower_left_portrait = {
		character = scope:forager
	}
	
	override_background = {
		reference = terrain_scope
	}

	cooldown = { years = 15 }

	trigger = {
		has_government = landless_adventurer_government
		is_adult = yes
		is_available_allow_travelling = yes
		location = { is_sea_province = no }
		domicile ?= {
			domicile_location = {
				is_likely_to_contain_trees_trigger = yes
			}
			NOT = { provisions >= max_provisions }
		}
	}

	immediate = {
		domicile.domicile_location ?= { save_scope_as = background_terrain_scope }
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_nimbo_8070
				VAL = 1
			}
		}
		court_position:chief_forager_camp_officer ?= { save_scope_as = forager }
	}

	# Forager, what say you?
	option = {
		name = ep3_laamps.8070.a
		trigger = {
			exists = scope:forager
			scope:forager = {
				aptitude = {
					court_position = chief_forager_camp_officer
					value >= 2
				}
			}
		}
		domicile = { change_provisions = medium_provisions_gain }
		ai_chance = { # This is just the best option
			base = 1000
		}
	}

	# Ah, I know these plants!
	option = {
		name = ep3_laamps.8070.b
		trigger = {
			has_trait = lifestyle_herbalist
		}
		domicile = { change_provisions = medium_provisions_gain }
		add_prestige = minor_prestige_gain
		ai_chance = { # This is the other best option
			base = 1000
		}
	}

	# Let's just try...
	option = {
		name = ep3_laamps.8070.c
		random_list = {
			75 = {
				send_interface_toast = {
					title = ep3_laamps.8070.c.win
					domicile = { change_provisions = medium_provisions_gain }
				}
			}
			25 = {
				send_interface_toast = {
					title = ep3_laamps.8070.c.lose
					hidden_effect = {
						contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = yes }
					}
					every_courtier = {
						custom = every_camp_member
						contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = no }
					}
				}
			}
		}
		stress_impact = {
			craven = medium_stress_impact_gain
			diligent = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 2.5
				ai_rationality = -2.5
			}
		}
	}

	# I think we'll survive without them
	option = {
		name = ep3_laamps.8070.d
		stress_impact = {
			brave = medium_stress_impact_gain
			eccentric = medium_stress_impact_gain
			ambitious = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = -2.5
				ai_rationality = 2.5
			}
		}
	}
}

# A Strange Sailor
# You find Tom Baker sitting at a bar missing most of his body parts
# 8080
scripted_trigger valid_weird_sailor = {
	is_adult = yes
	has_trait = eccentric
	has_any_high_skill_rating = yes
	would_be_valid_for_court_position = {
		court_position = quartermaster_camp_officer
		employer = root
	}
}
ep3_laamps.8080 = {
	type = character_event
	title = ep3_laamps.8080.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					location = {
						is_sea_province = yes
					}
				}
				desc = ep3_laamps.8080.desc.intro_sea
			}
			desc = ep3_laamps.8080.desc.intro
		}
		desc = ep3_laamps.8080.desc.outro
	}
	theme = laamp
	override_background = { 
		reference = tavern 
	}
	left_portrait = {
		character = root
		animation = laugh
	}
	right_portrait = {
		character = scope:sailor
		animation = eccentric
	}

	cooldown = { years = 15 }

	trigger = {
		has_government = landless_adventurer_government
		is_adult = yes
		is_available_allow_travelling = yes
		location = {
			OR = {
				is_coastal = yes
				any_neighboring_province = { is_river_province = yes }
			}
		}
		NOT = { employs_court_position = quartermaster_camp_officer }
		can_employ_court_position_type = quartermaster_camp_officer
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_nimbo_8080
				VAL = 1
			}
		}
		root.location = {
			random_neighboring_province = {
				limit = {
					is_sea_province = no
				}
				save_scope_as = sailor_home
			}
		}
		hidden_effect = {
			random_pool_character = {
				province = scope:sailor_home
				limit = { valid_weird_sailor = yes }
				if = {
					limit = {
						has_permanent_physical_injury = no
					}
					add_trait = one_legged
				}
				save_scope_as = sailor
			}
			random_memory = {
				limit = {
					has_memory_category = positive
					has_memory_category = martial
				}
				save_scope_as = memory
			}
		}
		if = {
			limit = {
				NOT = { exists = scope:sailor }
			}
			create_character = {
				location = scope:sailor_home
				template = weird_sailor_template
				culture = scope:sailor_home.culture
				faith = scope:sailor_home.faith
				save_scope_as = sailor
				after_creation = {
					random_list = {
						1 = { set_nickname_effect = { NICKNAME = nick_the_mad } }
						1 = { set_nickname_effect = { NICKNAME = nick_the_red } }
						1 = { set_nickname_effect = { NICKNAME = nick_the_drunkard } }
						1 = { set_nickname_effect = { NICKNAME = nick_the_jolly } }
						1 = { set_nickname_effect = { NICKNAME = nick_the_jovial } }
						1 = { set_nickname_effect = { NICKNAME = nick_the_bellower } }
						1 = { set_nickname_effect = { NICKNAME = nick_twistedbeard } }
						1 = { set_nickname_effect = { NICKNAME = nick_foul_fart } }
						1 = { set_nickname_effect = { NICKNAME = nick_the_flash } }
						1 = { set_nickname_effect = { NICKNAME = nick_the_insane } }
						1 = { set_nickname_effect = { NICKNAME = nick_ale_lover } }
						1 = { set_nickname_effect = { NICKNAME = nick_the_gambler } }
					}
				}
			}
		}
	}

	# AAAAHHHHAAAAAAAAAAHAAHAAAAAAAAA... me laddy!
	option = {
		name = ep3_laamps.8080.a
		trigger = {
			has_trait = eccentric
		}
		set_relation_friend = {
			target = scope:sailor
			reason = friend_eccentric
		}
		add_courtier = scope:sailor
		camp_officer_grant_effect = {
			EMPLOYER = root
			POS = second
			CANDIDATE = scope:sailor
		}
		stress_impact = {
			eccentric = medium_stress_impact_loss
			shy = minor_stress_impact_loss
			cynical = medium_stress_impact_gain
			paranoid = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 2.5
				ai_sociability = 2.5
				ai_rationality = -10
			}
		}
	}

	# Do... do you wanna come with me?
	option = {
		name = ep3_laamps.8080.b
		add_courtier = scope:sailor
		camp_officer_grant_effect = {
			EMPLOYER = root
			POS = quartermaster
			CANDIDATE = scope:sailor
		}
		pay_short_term_gold = {
			target = scope:sailor
			gold = minor_gold_value
		}
		stress_impact = {
			arrogant = medium_stress_impact_gain
			cynical = medium_stress_impact_gain
			shy = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 2.5
				ai_sociability = 2.5
				ai_rationality = -2.5
			}
			modifier = {
				factor = 0
				short_term_gold < minor_gold_value
			}
		}
	}

	# Try to out-macho him
	option = {
		name = ep3_laamps.8080.c
		duel = {
			skills = { martial diplomacy }
			target = scope:sailor
			50 = {
				desc = ep3_laamps.8080.c.win
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				send_interface_toast = {
					title = ep3_laamps.8080.c.win
					left_icon = root
					right_icon = scope:sailor
					add_prestige = medium_prestige_gain
					every_courtier = {
						custom = every_camp_member
						add_opinion = {
							modifier = impressed_opinion
							target = root
							opinion = 15
						}
					}
				}
			}
			50 = {
				desc = ep3_laamps.8080.c.lose
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				send_interface_toast = {
					title = ep3_laamps.8080.c.lose
					left_icon = root
					right_icon = scope:sailor
					add_prestige = medium_prestige_loss
				}
			}
		}
		stress_impact = {
			humble = medium_stress_impact_gain
			gregarious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 2.5
				ai_sociability = 2.5
				ai_rationality = -2.5
			}
		}
	}

	# Get away from me you mad old sea dog
	option = {
		name = ep3_laamps.8080.d
		stress_impact = {
			humble = medium_stress_impact_gain
			gregarious = minor_stress_impact_gain
			eccentric = major_stress_impact_gain
			shy = minor_stress_impact_loss
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = -2.5
				ai_sociability = -2.5
				ai_rationality = 2.5
			}
		}
	}
}

# The Distant Shores
# You have an out-of-body experience in a strange land and question your identity
# 8090
ep3_laamps.8090 = {
	type = character_event
	title = ep3_laamps.8090.t
	desc = {
		desc = ep3_laamps.8090.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					root.domicile.domicile_location = {
						OR = {
							geographical_region = world_europe
							geographical_region = world_asia_minor
						}
					}
				}
				desc = ep3_laamps.8090.desc.world_europe
			}
			triggered_desc = {
				trigger = {
					root.domicile.domicile_location = {
						geographical_region = world_middle_east
					}
				}
				desc = ep3_laamps.8090.desc.world_middle_east
			}
			triggered_desc = {
				trigger = {
					root.domicile.domicile_location = {
						geographical_region = world_india
					}
				}
				desc = ep3_laamps.8090.desc.world_india
			}
			triggered_desc = {
				trigger = {
					root.domicile.domicile_location = {
						geographical_region = world_africa
					}
				}
				desc = ep3_laamps.8090.desc.world_africa
			}
			triggered_desc = {
				trigger = {
					root.domicile.domicile_location = {
						geographical_region = world_steppe
					}
				}
				desc = ep3_laamps.8090.desc.world_steppe
			}
			triggered_desc = {
				trigger = {
					root.domicile.domicile_location = {
						geographical_region = world_tibet
					}
				}
				desc = ep3_laamps.8090.desc.world_tibet
			}
			triggered_desc = {
				trigger = {
					root.domicile.domicile_location = {
						geographical_region = world_burma
					}
				}
				desc = ep3_laamps.8090.desc.world_burma
			}
			triggered_desc = {
				trigger = {
					root.domicile.domicile_location = {
						geographical_region = world_asia_china
					}
				}
				desc = ep3_laamps.8090.desc.world_asia_china
			}
			triggered_desc = {
				trigger = {
					root.domicile.domicile_location = {
						geographical_region = world_asia_japan
					}
				}
				desc = ep3_laamps.8090.desc.world_asia_japan
			}
			triggered_desc = {
				trigger = {
					root.domicile.domicile_location = {
						geographical_region = world_asia_korea
					}
				}
				desc = ep3_laamps.8090.desc.world_asia_korea
			}
			triggered_desc = {
				trigger = {
					root.domicile.domicile_location = {
						geographical_region = world_asia_southeast
					}
				}
				desc = ep3_laamps.8090.desc.world_asia_southeast
			}
		}
		desc = ep3_laamps.8090.desc.outro
	}
	theme = laamp
	left_portrait = {
		character = root
		animation = admiration
	}
	override_background = { reference = market }

	cooldown = { years = 15 }

	trigger = {
		has_government = landless_adventurer_government
		is_adult = yes
		is_available_allow_travelling = yes
		is_location_valid_for_travel_event_on_land = yes
		OR = {
			AND = {
				root.domicile.domicile_location = {
					OR = {
						geographical_region = world_europe
						geographical_region = world_asia_minor
					}
				}
				NOR = {
					root.culture = { culture_overlaps_geographical_region = world_europe }
					root.culture = { culture_overlaps_geographical_region = world_asia_minor }
				}
			}
			AND = {
				root.domicile.domicile_location = { geographical_region = world_middle_east }
				NOT = {
					root.culture = { culture_overlaps_geographical_region = world_middle_east }
				}
			}
			AND = {
				root.domicile.domicile_location = { geographical_region = world_india }
				NOT = {
					root.culture = { culture_overlaps_geographical_region = world_india }
				}
			}
			AND = {
				root.domicile.domicile_location = { geographical_region = world_africa }
				NOT = {
					root.culture = { culture_overlaps_geographical_region = world_africa }
				}
			}
			AND = {
				root.domicile.domicile_location = { geographical_region = world_steppe }
				NOT = {
					root.culture = { culture_overlaps_geographical_region = world_steppe }
				}
			}
			AND = {
				root.domicile.domicile_location = { geographical_region = world_tibet }
				NOT = {
					root.culture = { culture_overlaps_geographical_region = world_tibet }
				}
			}
			AND = {
				root.domicile.domicile_location = { geographical_region = world_burma }
				NOT = {
					root.culture = { culture_overlaps_geographical_region = world_burma }
				}
			}
			AND = {
				root.domicile.domicile_location = { geographical_region = world_asia_china }
				NOT = {
					root.culture = { culture_overlaps_geographical_region = world_asia_china }
				}
			}
			AND = {
				root.domicile.domicile_location = { geographical_region = world_asia_japan }
				NOT = {
					root.culture = { culture_overlaps_geographical_region = world_asia_japan }
				}
			}
			AND = {
				root.domicile.domicile_location = { geographical_region = world_asia_korea }
				NOT = {
					root.culture = { culture_overlaps_geographical_region = world_asia_korea }
				}
			}
			AND = {
				root.domicile.domicile_location = { geographical_region = world_asia_southeast }
				NOT = {
					root.culture = { culture_overlaps_geographical_region = world_asia_southeast }
				}
			}
		}
	}

	immediate = {
		if = {
			limit = { enable_debug_laamp_event_logging_toggle_trigger = yes }
			increment_global_variable_effect = {
				VAR = tally_nimbo_8090
				VAL = 1
			}
		}
		root.domicile.domicile_location.county = { save_scope_as = county }
		root.domicile.domicile_location.county.culture = { save_scope_as = culture }
	}

	# Can a man not be both one culture AND another?
	option = {
		name = ep3_laamps.8090.a
		culture = {
			change_cultural_acceptance = {
				target = scope:culture
				value = medium_cultural_acceptance_gain
				desc = cultural_acceptance_distant_hero
			}
		}
		stress_impact = {
			arrogant = medium_stress_impact_gain
			stubborn = medium_stress_impact_gain
			gregarious = minor_stress_impact_gain
			eccentric = minor_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = -2.5
				ai_sociability = 2.5
				ai_rationality = 2.5
			}
		}
	}

	# I think it's time I embrace my place here
	option = {
		name = ep3_laamps.8090.b
		every_courtier = {
			custom = every_relative_in_camp_your_culture
			limit = {
				is_close_family_of = root
				culture = root.culture
			}
			set_culture = scope:culture
		}
		set_culture = scope:culture
		stress_impact = {
			gregarious = medium_stress_impact_loss
			eccentric = medium_stress_impact_loss
			arrogant = medium_stress_impact_gain
			stubborn = medium_stress_impact_gain
			cynical = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0 # Player only
		}
	}

	# Maybe I should build a new home here!
	option = {
		name = ep3_laamps.8090.c
		add_character_modifier = {
			modifier = laamps_8090_preparing_invasion
			years = 15
		}
		stress_impact = {
			gregarious = medium_stress_impact_gain
			humble = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			just = medium_stress_impact_gain
			forgiving = medium_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_boldness = 2.5
				ai_sociability = -2.5
				ai_rationality = -2.5
			}
		}
	}
}

# LEGITIMIST SUPPORT NEGOTIATION EVENTS
# Choose your title for support
ep3_laamps.8101 = { 
	type = character_event
	title = ep3_laamps.8101.t
	desc = ep3_laamps.8101.desc

	theme = diplomacy

	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = debating
	}

	right_portrait = {
		character = scope:petitioned_ruler
		animation = admiration
	}

	trigger = {
		any_claim = {
			count > 1
			tier >= tier_kingdom
		}
		NOT = {
			has_variable = legitimist_claimed_title
		}
	}

	immediate = {
		ordered_claim = {
			limit = {
				tier >= tier_kingdom
			}
			order_by = tier
			max = 4

			# First title.
			if = {
				limit = {
					NOT = { exists = scope:title_1 }
				}
				save_scope_as = title_1
			}
			# Second title.
			else_if = {
				limit = {
					NOT = {
						this = scope:title_1
						exists = scope:title_2
					}
				}
				save_scope_as = title_2
			}
			# Third title.
			else_if = {
				limit = {
					NOT = {
						this = scope:title_1
						this = scope:title_2
						exists = scope:title_3
					}
				}
				save_scope_as = title_3
			}
			# Fourth title
			else_if = {
				limit = {
					NOT = {
						this = scope:title_1
						this = scope:title_2
						this = scope:title_3
						exists = scope:title_4
					}
				}
				save_scope_as = title_4
			}
		}
	}

	on_trigger_fail = {
		trigger_event = ep3_laamps.8102
	}

	option = {
		name = ep3_laamps.8101.a
		custom_tooltip = ep3_laamps.8101.a.desc
		trigger = {
			exists = scope:title_1
		}
		scope:title_1 = {
			save_scope_as = claimed_title
		}

		ai_chance = {
			base = 100
		}
	}

	option = {
		name = ep3_laamps.8101.b
		custom_tooltip = ep3_laamps.8101.a.desc
		trigger = {
			exists = scope:title_2
		}
		scope:title_2 = {
			save_scope_as = claimed_title
		}
	}

	option = {
		name = ep3_laamps.8101.c
		custom_tooltip = ep3_laamps.8101.a.desc
		trigger = {
			exists = scope:title_3
		}
		scope:title_3 = {
			save_scope_as = claimed_title
		}
	}

	option = {
		name = ep3_laamps.8101.d
		custom_tooltip = ep3_laamps.8101.a.desc
		trigger = {
			exists = scope:title_4
		}
		scope:title_4 = {
			save_scope_as = claimed_title
		}
	}

	after = {
		trigger_event = ep3_laamps.8102
	}
}

#Negotiations intro
ep3_laamps.8102 = {
	type = character_event
	title = ep3_laamps.8102.t
	desc = ep3_laamps.8102.desc

	theme = diplomacy

	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = debating
	}

	right_portrait = {
		character = scope:petitioned_ruler
		animation = bribing
	}

	immediate = {
		#save the claim
		if = {
			limit = {
				NOT = {
					exists = scope:claimed_title
					has_variable = legitimist_claimed_title
				}
			}
			random_claim = {
				limit = {
					tier >= tier_kingdom
				}
				save_scope_as = claimed_title
			}
		}
		scope:claimed_title.holder.capital_barony = { save_scope_as = capital_barony }
		if = {
			limit = {
				NOT = {
					has_variable = legitimist_claimed_title
				}
			}
			set_variable = {
				name = legitimist_claimed_title
				value = scope:claimed_title
			}
		}
		else = {
			var:legitimist_claimed_title = {
				save_scope_as = claimed_title
			}
		}
		
		#setup turns

		set_variable = {
			name = legitimist_turns
			value = {
				value = 4
				if = {
					limit = {
						scope:claimed_title = {
							tier = tier_empire
						}
					}
					add = 4
				}
				if = {
					limit = {
						scope:petitioned_ruler.faith = root.faith
					}
					add = {
						value = root.piety_level
						subtract = 2
						max = 2
						min = 0
					}
				}
				add = {
					value = root.prestige_level
					subtract = 2
					max = 2
					min = 0
				}
				add = {
					value = root.dynasty.dynasty_prestige_level
					subtract = 2
					max = 3
					min = 0
				}
			}
		}

		#setup support and obligations level

		set_variable = {
			name = legitimist_support
			value = 1
		}

		set_variable = {
			name = legitimist_obligations
			value = 2
		}

	}

	option = { #Let us dicuss the deal-o
		name = ep3_laamps.8102.a
		custom_tooltip = ep3_laamps.8102.a.desc

		if = {
			limit = {
				is_ai = yes
			}
			change_variable = {
				name = legitimist_support
				add = 2
			}
			change_variable = {
				name = legitimist_obligations
				add = 1
			}
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #Try to dazzle them with brilliance - more turns
		name = ep3_laamps.8102.b
		trigger = {
			NOT = {
				has_relation_friend = scope:petitioned_ruler
			}
		}
		duel = {
			target = scope:petitioned_ruler
			skill = diplomacy

			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				custom_tooltip = ep3_laamps.8102.b.desc
				send_interface_toast = {
					title = ep3_laamps.8102.b.success
					left_icon = scope:petitioned_ruler
				}
				change_variable = {
					name = legitimist_support
					add = 1
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = ep3_laamps.8102.b.failure
				send_interface_toast = {
					title = ep3_laamps.8102.b.failure
					left_icon = scope:petitioned_ruler
				}
				add_prestige = medium_prestige_loss
				change_variable = {
					name = legitimist_turns
					subtract = 1
				}
			}
		}
	}

	option = { #Or baffle them with bs - more turns
		name = ep3_laamps.8102.c
		trigger = {
			NOT = {
				has_relation_friend = scope:petitioned_ruler
			}
		}
		duel = {
			target = scope:petitioned_ruler
			skill = intrigue

			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				custom_tooltip = ep3_laamps.8102.c.desc
				send_interface_toast = {
					title = ep3_laamps.8102.b.success
					left_icon = scope:petitioned_ruler
				}
				change_variable = {
					name = legitimist_turns
					add = 4
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = ep3_laamps.8102.b.failure
				send_interface_toast = {
					title = ep3_laamps.8102.b.failure
					left_icon = scope:petitioned_ruler
				}
				add_prestige = medium_prestige_loss
				change_variable = {
					name = legitimist_turns
					subtract = 1
				}
			}
		}
	}

	option = { #we are friends, more turns
		name = ep3_laamps.8102.d
		custom_tooltip = ep3_laamps.8102.d.desc
		trigger = {
			has_relation_friend = scope:petitioned_ruler

		}
		change_variable = {
			name = legitimist_turns
			add = 4
		}
		change_variable = {
			name = legitimist_support
			add = 1
		}

	}

	option = { #spend hook - more support!
		name = ep3_laamps.8102.e
		custom_tooltip = ep3_laamps.8102.e.desc
		trigger = {
			has_hook = scope:petitioned_ruler
		}
		remove_hook = { target = scope:petitioned_ruler }
		change_variable = {
			name = legitimist_support
			add = 2
		}
	}

	after = {
		trigger_event = ep3_laamps.8103
	}
}

#Negotiations for the level of support
ep3_laamps.8103 = {
	type = character_event
	title = ep3_laamps.8103.t
	desc = {
		random_valid = {
			desc = ep3_laamps.8103.intro_1
			desc = ep3_laamps.8103.intro_2
			desc = ep3_laamps.8103.intro_3
		}
		first_valid = {
			triggered_desc = {
				trigger = { var:legitimist_turns = 0 }
				desc = ep3_laamps.8103.no_more_turns_flavor
			}
			random_valid = {
				desc = ep3_laamps.8103.mid_1
				desc = ep3_laamps.8103.mid_2
				desc = ep3_laamps.8103.mid_3
			}
		}
		
		desc = ep3_laamp.8103.turns_left
		first_valid = {
			triggered_desc = {
				trigger = { var:legitimist_support >= 6 }
				desc = ep3_laamps.8103.support_6
			}
			triggered_desc = {
				trigger = { var:legitimist_support >= 5 }
				desc = ep3_laamps.8103.support_5
			}
			triggered_desc = {
				trigger = { var:legitimist_support >= 4 }
				desc = ep3_laamps.8103.support_4
			}
			triggered_desc = {
				trigger = { var:legitimist_support >= 3 }
				desc = ep3_laamps.8103.support_3
			}
			triggered_desc = {
				trigger = { var:legitimist_support >= 2 }
				desc = ep3_laamps.8103.support_2
			}
			triggered_desc = {
				trigger = { var:legitimist_support >= 1 }
				desc = ep3_laamps.8103.support_1
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = { var:legitimist_obligations = 1 }
				desc = ep3_laamps.8103.one_obligations
			}
			desc = ep3_laamps.8103.obligations
		}	
	}

	theme = diplomacy
	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = debating
	}

	right_portrait = {
		character = scope:petitioned_ruler
		animation = personality_forgiving
	}

	trigger = {
		var:legitimist_turns >= 1
	}

	on_trigger_fail = {
		trigger_event = ep3_laamps.8105
	}

	option = { #Moar troops!
		name = ep3_laamps.8103.a
		custom_tooltip = ep3_laamps.8103.a.desc
		trigger = {
			var:legitimist_support < 6
			var:legitimist_turns >= 1
		}
		change_variable = {
			name = legitimist_support
			add = 1
		}
		change_variable = {
			name = legitimist_obligations
			add = 1
		}
		trigger_event = ep3_laamps.8103
	}

	option = { #Moar troops, but without obligations increase. harder with obligations/support imbalance
		name = ep3_laamps.8103.b
		
		trigger = {
			var:legitimist_support < 6
			var:legitimist_turns >= 1
		}
		duel = {
			target = scope:petitioned_ruler
			skill = diplomacy

			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				custom_tooltip = ep3_laamps.8103.b.desc
				send_interface_toast = {
					title = ep3_laamps.8103.b.success
					left_icon = scope:petitioned_ruler
				}
				change_variable = {
					name = legitimist_support
					add = 1
				}
			}
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				modifier = {
					add = {
						value = var:legitimist_support
						add = 1
						subtract = var:legitimist_obligations
						multiply = 10
					}
				}
				desc = ep3_laamps.8103.b.failure
				send_interface_toast = {
					title = ep3_laamps.8103.b.failure
					left_icon = scope:petitioned_ruler
				}
				add_prestige = minor_prestige_loss
			}
		}
		trigger_event = ep3_laamps.8103
	}

	option = { #Try to get the level of obligations down. harder with obligations/support imbalance
		name = ep3_laamps.8103.c
		custom_tooltip = ep3_laamps.8103.c.desc
		trigger = {
			var:legitimist_obligations > 1
			var:legitimist_turns >= 1
		}
		duel = {
			target = scope:petitioned_ruler
			skill = stewardship

			70 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = ep3_laamps.8103.c.success
				send_interface_toast = {
					title = ep3_laamps.8103.c.success
					left_icon = scope:petitioned_ruler
				}
				change_variable = {
					name = legitimist_obligations
					subtract = 1
				}
			}
			30 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				modifier = {
					add = {
						value = var:legitimist_support
						add = 1
						subtract = var:legitimist_obligations
						multiply = 10
					}
				}
				desc = ep3_laamps.8103.c.failure
				send_interface_toast = {
					title = ep3_laamps.8103.c.failure
					left_icon = scope:petitioned_ruler
				}
				add_prestige = minor_prestige_loss
			}
		}
		trigger_event = ep3_laamps.8103
	}

	option = { #I'm good
		name = ep3_laamps.8103.d
		custom_tooltip = ep3_laamps.8103.d.desc
		trigger_event = ep3_laamps.8105

		ai_chance = {
			base = 100
		}
	}

	after = {
		change_variable = {
			name = legitimist_turns
			subtract = 1
		}
	}
}

#End on negotiations - spit on it

scripted_effect legitimist_support_add_effect = {
	add_gold = {
		value = 300
		multiply = var:legitimist_support
	}
	spawn_army = {
		men_at_arms = {
			type = accolade_maa_vanguards
			stacks = {
				value = 2
				multiply = var:legitimist_support
			}
		}
		men_at_arms = {
			type = accolade_maa_archers
			stacks = {
				value = 2
				multiply = var:legitimist_support
			}
		}
		men_at_arms = {
			type = accolade_maa_lancers
			stacks = {
				value = var:legitimist_support
				min = 1
			}
		}
		inheritable = no
		uses_supply = no
		location = root.location
		name = ep3_legitimist_army
	}
	scope:petitioned_ruler = {
		add_hook = {
			target = root
			type = favor_hook
		}
	}
}

ep3_laamps.8105 = {
	type = character_event
	title = ep3_laamps.8105.t
	desc = ep3_laamps.8105.desc

	theme = diplomacy
	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = thinking
	}

	right_portrait = {
		character = scope:petitioned_ruler
		animation = toast_goblet
	}

	option = { #ask for time extension
		name = ep3_laamps.8105.a
		custom_tooltip = ep3_laamps.8105.invalidations_reasons
		custom_tooltip = ep3_laamps.8105.a.desc
		duel = {
			target = scope:petitioned_ruler
			skill = martial

			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = ep3_laamps.8105.a.success
				send_interface_toast = {
					title = ep3_laamps.8105.a.success
					left_icon = scope:petitioned_ruler
				}
				trigger_event = {
					id = ep3_laamps.8106
					years = 8
				}
			}
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = ep3_laamps.8105.a.failure
				send_interface_toast = {
					title = ep3_laamps.8105.a.failure
					left_icon = scope:petitioned_ruler
				}
				trigger_event = {
					id = ep3_laamps.8106
					years = 4
				}
				add_prestige = medium_prestige_loss
			}
		}

		legitimist_support_add_effect = yes

		add_to_variable_list = { #used to handle root death
			name = legitimist_supporters
			target = scope:petitioned_ruler
		}

		scope:petitioned_ruler = {
			set_variable = {
				name = legitimist_obligations_left
				value = root.var:legitimist_obligations
			}
		}
		hidden_effect = {
			scope:task_contract = {
				complete_task_contract = success_standard
			}
		}
	}

	option = { #spit on it
		name = ep3_laamps.8105.b
		custom_tooltip = ep3_laamps.8105.invalidations_reasons
		custom_tooltip = ep3_laamps.8105.b.desc
		trigger_event = {
			id = ep3_laamps.8106
			years = 4
		}

		scope:petitioned_ruler = {
			set_variable = {
				name = legitimist_obligations_left
				value = root.var:legitimist_obligations
			}
		}
		add_prestige = medium_prestige_gain

		legitimist_support_add_effect = yes

		add_to_variable_list = { #used to handle root death
			name = legitimist_supporters
			target = scope:petitioned_ruler
		}
		hidden_effect = {
			scope:task_contract = {
				complete_task_contract = success_standard
			}
		}

		ai_chance = {
			base = 100
		}
	}

	option = { #actually, nvm, byeeee
		name = ep3_laamps.8105.c
		custom_tooltip = ep3_laamps.8105.c.desc
		trigger_event = {
			id = ep3_laamps.8107
			months = { 1 2 }
		}
		hidden_effect = {
			scope:task_contract = {
				complete_task_contract = failure_standard
			}
		}
	}

	after = {
		remove_variable = legitimist_turns
		remove_variable = legitimist_support
		remove_variable = legitimist_obligations
	}
}

scripted_effect ep3_laamps_8106_designate_targets_effect = {
	if = {
		limit = {
			NOT = { exists = scope:target_1 }
		}
		save_scope_as = target_1
	}
	else_if = {
		limit = {
			NOT = { exists = scope:target_2 }
		}
		save_scope_as = target_2
	}
	else_if = {
		limit = {
			NOT = { exists = scope:target_3 }
		}
		save_scope_as = target_3
	}
	else_if = {
		limit = {
			NOT = { exists = scope:target_4 }
		}
		save_scope_as = target_4
	}
	else_if = {
		limit = {
			NOT = { exists = scope:target_5 }
		}
		save_scope_as = target_5
	}
	else_if = {
		limit = {
			NOT = { exists = scope:target_6 }
		}
		save_scope_as = target_6
	}
	else_if = {
		limit = {
			NOT = { exists = scope:target_7 }
		}
		save_scope_as = target_7
	}
	else_if = {
		limit = {
			NOT = { exists = scope:target_8 }
		}
		save_scope_as = target_8
	}
	else_if = {
		limit = {
			NOT = { exists = scope:target_9 }
		}
		save_scope_as = target_9
	}
	else_if = {
		limit = {
			NOT = { exists = scope:target_10 }
		}
		save_scope_as = target_10
	}
}

#Reminder about the timer!

ep3_laamps.8106 = {
	type = character_event
	title = ep3_laamps.8106.t
	desc = ep3_laamps.8106.desc

	theme = diplomacy
	override_background = { reference = army_camp }

	left_portrait = {
		character = root
		animation = personality_rational
	}

	right_portrait = {
		character = scope:petitioned_ruler
		animation = personality_vengeful
	}

	trigger = {
		government_has_flag = government_is_landless_adventurer
		has_realm_law = camp_purpose_legitimists
		NOT = {
			is_at_war = yes
			any_held_title = {
				this = scope:claimed_title
			}
		}
		scope:petitioned_ruler = {
			is_alive = yes
			is_landed = yes
			NOR = {
				is_imprisoned_by = root
				AND = {
					is_at_war = yes
					any_character_war = {
						OR = {
							primary_attacker = root
							primary_defender = root
						}
					}
				}
			}
		}
	}

	on_trigger_fail = {
		if = {
			limit = {
				is_at_war = yes
			}
			trigger_event = { #let us try again later
				id = ep3_laamps.8106
				months = { 2 4 }
			}
		}
		else_if = {
			limit = {
				any_held_title = {
					this = scope:claimed_title
				}
			}
			trigger_event = { #payup buddy boi
				id = ep3_laamps.8111
				months = { 18 20 }
			}
		}
		else_if = {
			limit = {
				scope:petitioned_ruler = {
					OR = {
						is_alive = no
						is_landed = no
						is_imprisoned_by = root
						AND = {
							is_at_war = yes
							any_character_war = {
								OR = {
									primary_attacker = root
									primary_defender = root
								}
							}
						}
					}
				}
			}
			trigger_event = {
				id = ep3_laamps.8110
			}
		}	
		else = {
			trigger_event = { #you failed
				id = ep3_laamps.8107
				months = { 1 2 }
			}
		}	
	}

	option = { #go to war
		name = ep3_laamps.8106.a
		flavor = ep3_laamps.8106.a.desc
		#it is ugly, but it seems there is no other way
		every_claim = {
			limit = {
				OR = {
					holder = scope:claimed_title.holder
					holder.top_liege = scope:claimed_title.holder
				}
			}
			ep3_laamps_8106_designate_targets_effect = yes
		}

		# Ugly war targeting.
			## 10 targets.
			if = {
				limit = { exists = scope:target_10 }
				start_war = {
					casus_belli = claim_cb
					target = scope:claimed_title.holder
					claimant = root
					target_title = scope:target_1
					target_title = scope:target_2
					target_title = scope:target_3
					target_title = scope:target_4
					target_title = scope:target_5
					target_title = scope:target_6
					target_title = scope:target_7
					target_title = scope:target_8
					target_title = scope:target_9
					target_title = scope:target_10
				}
			}
			## 09 targets.
			else_if = {
				limit = { exists = scope:target_9 }
				start_war = {
					casus_belli = claim_cb
					target = scope:claimed_title.holder
					claimant = root
					target_title = scope:target_1
					target_title = scope:target_2
					target_title = scope:target_3
					target_title = scope:target_4
					target_title = scope:target_5
					target_title = scope:target_6
					target_title = scope:target_7
					target_title = scope:target_8
					target_title = scope:target_9
				}
			}
			## 08 targets.
			else_if = {
				limit = { exists = scope:target_8 }
				start_war = {
					casus_belli = claim_cb
					target = scope:claimed_title.holder
					claimant = root
					target_title = scope:target_1
					target_title = scope:target_2
					target_title = scope:target_3
					target_title = scope:target_4
					target_title = scope:target_5
					target_title = scope:target_6
					target_title = scope:target_7
					target_title = scope:target_8
				}
			}
			## 07 targets.
			else_if = {
				limit = { exists = scope:target_7 }
				start_war = {
					casus_belli = claim_cb
					target = scope:claimed_title.holder
					claimant = root
					target_title = scope:target_1
					target_title = scope:target_2
					target_title = scope:target_3
					target_title = scope:target_4
					target_title = scope:target_5
					target_title = scope:target_6
					target_title = scope:target_7
				}
			}
			## 06 targets.
			else_if = {
				limit = { exists = scope:target_6 }
				start_war = {
					casus_belli = claim_cb
					target = scope:claimed_title.holder
					claimant = root
					target_title = scope:target_1
					target_title = scope:target_2
					target_title = scope:target_3
					target_title = scope:target_4
					target_title = scope:target_5
					target_title = scope:target_6
				}
			}
			## 05 targets.
			else_if = {
				limit = { exists = scope:target_5 }
				start_war = {
					casus_belli = claim_cb
					target = scope:claimed_title.holder
					claimant = root
					target_title = scope:target_1
					target_title = scope:target_2
					target_title = scope:target_3
					target_title = scope:target_4
					target_title = scope:target_5
				}
			}
			## 04 targets.
			else_if = {
				limit = { exists = scope:target_4 }
				start_war = {
					casus_belli = claim_cb
					target = scope:claimed_title.holder
					claimant = root
					target_title = scope:target_1
					target_title = scope:target_2
					target_title = scope:target_3
					target_title = scope:target_4
				}
			}
			## 03 targets.
			else_if = {
				limit = { exists = scope:target_3 }
				start_war = {
					casus_belli = claim_cb
					target = scope:claimed_title.holder
					claimant = root
					target_title = scope:target_1
					target_title = scope:target_2
					target_title = scope:target_3
				}
			}
			## 02 targets.
			else_if = {
				limit = { exists = scope:target_2 }
				start_war = {
					casus_belli = claim_cb
					target = scope:claimed_title.holder
					claimant = root
					target_title = scope:target_1
					target_title = scope:target_2
				}
			}
			## 01 targets.
			else_if = {
				limit = { exists = scope:target_1 }
				start_war = {
					casus_belli = claim_cb
					target = scope:claimed_title.holder
					claimant = root
					target_title = scope:target_1
				}
			}

		ai_chance = {
			base = 100
		}

		trigger_event = {
			id = ep3_laamps.8106
			months = { 11 13 }
		}
	}

	option = { #ask for a delay
		name = ep3_laamps.8106.b
		custom_tooltip = ep3_laamps.8106.b.desc
		#diplo/martial duel - the time is not right for war you see
		#trigger this event after next 2 years
		#obligations increase if you don't succeed
		duel = {
			target = scope:petitioned_ruler
			skill = martial

			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5 
					min = -49
				}
				custom_tooltip = ep3_laamps.8106.b.success
				send_interface_toast = {
					title = ep3_laamps.8106.b.success
					left_icon = scope:petitioned_ruler
				}
			}
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				custom_tooltip = ep3_laamps.8106.b.failure
				send_interface_toast = {
					title = ep3_laamps.8106.b.failure
					left_icon = scope:petitioned_ruler
				}
				scope:petitioned_ruler = {
					change_variable = {
						name = legitimist_obligations_left
						add = 1
					}
				}
				trigger_event = {
					id = ep3_laamps.8106
					years = 2
				}
			}
		}
	}

	option = { #actually, nvm, I have other plans now
		name = ep3_laamps.8106.c
		custom_tooltip = ep3_laamps.8106.c.desc

		trigger_event = {
			id = ep3_laamps.8107
			months = { 1 2 }
		}
	}
}

#Invalidation upon changing the camp type or becoming landed

ep3_laamps.8107 = {
	type = letter_event
	opening = ep3_laamps.8107.t
	desc = ep3_laamps.8107.desc
	sender = scope:petitioned_ruler

	option = { #well, fate had another things in mind
		name = ep3_laamps.8107.a
		add_prestige_level = -1
		if = {
			limit = {
				NOT = {
					has_relation_rival = scope:petitioned_ruler
				}
			}
			set_relation_rival = {
				target = scope:petitioned_ruler
				reason = rival_nithing
			}
		}
		scope:petitioned_ruler = {
			remove_variable = legitimist_obligations_left
			remove_character_flag = legitimist_supporter
		}
		add_to_variable_list = {
			name = legitimist_payed_supporters
			target = scope:petitioned_ruler
		}
		scope:petitioned_ruler = {
			remove_hook = {
				target = root
			}
		}
	}

}

#Obligations payment

ep3_laamps.8108 = {
	type = character_event
	title = ep3_laamps.8108.t
	desc = ep3_laamps.8108.desc

	theme = stewardship
	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = personality_rational
	}

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

	trigger = {
		scope:petitioned_ruler = {
			is_alive = yes
			is_landed = yes
			NOR = {
				is_imprisoned_by = root
				AND = {
					is_at_war = yes
					any_character_war = {
						OR = {
							primary_attacker = root
							primary_defender = root
						}
					}
				}
			}
		}
	}

	immediate = {
		add_to_variable_list = { #error suppresion
			name = legitimist_supporters
			target = root
		}
	}

	on_trigger_fail = {
		trigger_event = {
			id = ep3_laamps.8110
			days = { 1 2 }
		}
	}

	option = { #gimmie ur lunch monies, pacta sunt servanta
		name = ep3_laamps.8108.a
		if = {
			limit = {
				scope:petitioned_ruler.var:legitimist_obligations_left > 1
			}
			custom_tooltip = ep3_laamps.8108.payments_left
		}
		else = {
			custom_tooltip = ep3_laamps.8108.no_payments_left
			scope:petitioned_ruler = {
				remove_variable = legitimist_obligations_left
				remove_character_flag = legitimist_supporter
			}
			add_to_variable_list = {
				name = legitimist_payed_supporters
				target = scope:petitioned_ruler
			}
			scope:petitioned_ruler = {
				remove_hook = {
					target = root
				}
			}
		}

		if = {
			limit = {
				monthly_character_income <= 50
			}
			custom_tooltip = ep3_laamps.8108.legitimist_too_poor
		}

		pay_short_term_gold = {
			target = scope:petitioned_ruler
			gold = {
				value = monthly_character_income
				multiply = 6
				min = 300
			}
		}
		add_legitimacy = medium_legitimacy_gain
		scope:petitioned_ruler = {
			change_variable = {
				name = legitimist_obligations_left
				subtract = 1
			}
		}
		
		if = {
			limit = {
				scope:petitioned_ruler.var:legitimist_obligations_left > 1
			}
			trigger_event = {
				id = ep3_laamps.8111
				months = { 18 20 }
			}
		}

		ai_chance = {
			base = 100
		}
	}

	option = { #Alas, I cannot pay you now, but I will in the future
		name = ep3_laamps.8108.b
		custom_tooltip = ep3_laamps.8108.b.desc

		duel = {
			target = scope:petitioned_ruler
			skill = stewardship

			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = ep3_laamps.8108.b.success
				send_interface_toast = {
					title = ep3_laamps.8108.b.success
					left_icon = scope:petitioned_ruler
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = ep3_laamps.8108.b.failure
				send_interface_toast = {
					title = ep3_laamps.8108.b.failure
					left_icon = scope:petitioned_ruler
					add_legitimacy = medium_legitimacy_loss
				}
			}
		}
		trigger_event = {
			id = ep3_laamps.8111
			months = { 6 7 } 
		}
		if = {
			limit = {
				scope:petitioned_ruler.var:legitimist_obligations_left > 1
			}
			custom_tooltip = ep3_laamps.8108.payments_left
		}
		else = {
			custom_tooltip = ep3_laamps.8108.no_payments_left
		}
	}

	option = { #GET REKKED
		name = ep3_laamps.8108.c
		custom_tooltip = ep3_laamps.8108.c.desc
		add_legitimacy = massive_legitimacy_loss
		add_prestige_level = -1
		trigger_event = {
			id = ep3_laamps.8107
			months = { 1 2 }
		}
	}
}

#you have died, but you still have obligations to pay - reminder - ???
ep3_laamps.8109 = {
	type = letter_event
	opening = ep3_laamps.8109.t
	desc = ep3_laamps.8109.desc
	sender = scope:petitioned_ruler

	option = { #gulp
		name = ep3_laamps.8109.a
		custom_tooltip = ep3_laamps.8109.a.desc

		trigger_event = {
			id = ep3_laamps.8111
			months = { 6 7 } 
		}
	}
}

#something has happened to your benefactor, the debt has disappeared in the midst of time

ep3_laamps.8110 = {
	type = character_event
	title = ep3_laamps.8110.t
	desc = {
		desc = ep3_laamps.8110.desc_intro
		desc = {
			first_valid = {
				triggered_desc = {
					trigger = {
						scope:petitioned_ruler = {
							is_at_war = yes
							any_character_war = {
								OR = {
									primary_attacker = root
									primary_defender = root
								}
							}
						}
					}
					desc = ep3_laamps.8110.desc_war
				}
				triggered_desc = {
					trigger = { scope:petitioned_ruler = { is_imprisoned_by = root } }
					desc = ep3_laamps.8110.desc_imprisoned
				}
				triggered_desc = {
					trigger = {
						scope:petitioned_ruler = {
							is_alive = no
							killer ?= root
						}
					}
					desc = ep3_laamps.8110.desc_killer_root
				}
				triggered_desc = {
					trigger = { scope:petitioned_ruler = { is_alive = no } }
					desc = ep3_laamps.8110.desc_dead
				}
				triggered_desc = {
					trigger = { scope:petitioned_ruler = { is_landed = no } }
					desc = ep3_laamps.8110.desc_unlanded
				}
			}
		}
		desc = ep3_laamps.8110.desc_outro
	}

	theme = stewardship
	override_background = { reference = study }

	left_portrait = {
		character = root
		animation = manic
	}

	lower_right_portrait = {
		character = scope:petitioned_ruler
	}

	option = { #huzzah!
		name = ep3_laamps.8110.a
		stress_impact = {
			base = medium_stress_loss
			greedy = massive_stress_loss
		}
		add_to_variable_list = {
			name = legitimist_payed_supporters
			target = scope:petitioned_ruler
		}
	}
}

ep3_laamps.8111 = {
	hidden = yes

	immediate = {
		trigger_event = {
			id = ep3_laamps.8108
			months = 6
		}
		save_scope_value_as = {
			name = incoming_payment_value
			value = {
				value = monthly_character_income
				multiply = 6
				min = 300
			}
		}
		send_interface_toast = {
			type = event_toast_effect_bad
			title = ep3_laamps.8111.t
			left_icon = scope:petitioned_ruler
			custom_tooltip = ep3_laamps.8111.desc
		}
	}
}

#Interesting Personas LAAMP buildings assorted event

ep3_laamps.8200 = {
	type = character_event
	title = ep3_laamps.8200.t
	desc = {
		random_valid = {
			triggered_desc = {
				trigger = { scope:char_spawn_type = flag:porters } #porters - himbos
				desc = ep3_laamps.8200.desc_1
			}
			triggered_desc = {
				trigger = { scope:char_spawn_type = flag:fools } #capering fools - fools 
				desc = ep3_laamps.8200.desc_2
			}
			triggered_desc = {
				trigger = { scope:char_spawn_type = flag:locals } #hangers on - local ethos people 
				desc = ep3_laamps.8200.desc_3
			}
		}
	}
	theme = laamp
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				scope:char_spawn_type = flag:porters
			}
			animation = admiration
		}
		triggered_animation = {
			trigger = {
				scope:char_spawn_type = flag:fools
			}
			animation = laugh
		}
		triggered_animation = {
			trigger = {
				scope:char_spawn_type = flag:locals
			}
			animation = personality_rational
		}
	}
	right_portrait = {
		character = scope:new_person
		triggered_animation = {
			trigger = {
				scope:char_spawn_type = flag:porters
			}
			animation = hero_flex
		}
		triggered_animation = {
			trigger = {
				scope:char_spawn_type = flag:fools
			}
			animation = dancing
		}
		triggered_animation = {
			trigger = {
				scope:char_spawn_type = flag:locals
			}
			animation = beg
		}
		triggered_outfit = {
			trigger = { scope:char_spawn_type = flag:porters }
			outfit_tags = { beggar_rags }
		}
		triggered_outfit = {
			trigger = { scope:char_spawn_type = flag:fools }
			outfit_tags = { jester_outfit }
		}
	}

	override_background = {
		reference = bp1_bonfire
	}

	trigger = {
		NOT = {
			has_character_flag = had_ep3_laamps_8200
		}
		has_government = landless_adventurer_government
		is_available_adult = yes
		domicile ?= {
			OR = {
				has_domicile_parameter = camp_recruit_porters_events
				has_domicile_parameter = camp_recruit_fool_events 
				has_domicile_parameter = camp_recruit_locals_events
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 0.5
			domicile ?= {
				has_domicile_parameter = camp_recruit_porters_events
			}
		}
		modifier = {
			add = 0.5
			domicile ?= {
				has_domicile_parameter = camp_recruit_fool_events
			} 
		}
		modifier = {
			add = 0.5
			domicile ?= {
				has_domicile_parameter = camp_recruit_locals_events
			}
		}
	}

	immediate = {
		location = {
			save_scope_as = location
		}
		location.county = {
			save_scope_as = location_county
		}
		location.county.holder.top_liege = {
			save_scope_as = location_top_liege
		}
		if = {
			limit = {
				domicile ?= {
					has_domicile_parameter = camp_recruit_porters_events
				}
			}
			save_scope_value_as = {
				name = porters
				value = flag:porters
			}
			scope:porters = {
				add_to_temporary_list = spawn_type_selection
			}
		}
		if = {
			limit = {
				domicile ?= {
					has_domicile_parameter = camp_recruit_fool_events
				}
			}
			save_scope_value_as = {
				name = fools
				value = flag:fools
			}
			scope:fools = {
				add_to_temporary_list = spawn_type_selection
			}
		}
		if = {
			limit = {
				domicile ?= {
					has_domicile_parameter = camp_recruit_locals_events
				}
			}
			save_scope_value_as = {
				name = locals
				value = flag:locals
			}
			scope:locals = {
				add_to_temporary_list = spawn_type_selection
			}
		}
		random_in_list = {
			list = spawn_type_selection
			save_scope_as = char_spawn_type
		}
		if = {
			limit = {
				scope:char_spawn_type = flag:porters
			}
			#create a porter himbo
			create_character = {
				location = scope:location
				age = { 18 28 }
				random_traits_list = {
					count = 1
					education_martial_prowess_2 = {}
					education_martial_prowess_3 = {}
				}
				random_traits_list = {
					count = 1
					brave = {}
					diligent = {}
					humble = {}
				}
				random_traits_list = {
					honest = {}
					gregarious = {}
					trusting = {}
					compassionate = {}
					generous = {}
					calm = {}
				}
				random_traits_list = {
					count = 1
					lustful = {}
					chaste = {}
					wrathful = {}
					arrogant = {}
					impatient = {}
					patient = {}
					impatient  = {}
					ambitious = {}
					cynical = {}
					zealous = {}
					stubborn = {}
				}
				random_traits = no
				martial = {
					min_template_low_skill
					max_template_low_skill
				}
				prowess = {
					min_template_high_skill
					max_template_high_skill
				}
				faith = location.faith
				culture = location.culture
				gender_female_chance = {
					add = 25
				}
				save_scope_as = new_person
			}

			hidden_effect = {
				scope:new_person = {
					random_list = {
						2 = {
							add_trait = intellect_bad_2
							add_trait = physique_good_1
							add_trait = strong
						}
						2 = {
							add_trait = strong
						}
						2 = {
							add_trait = strong
							add_trait = giant
						}
						2 = {
							add_trait = intellect_bad_1
							add_trait = giant
						}
						1 = {
							add_trait = giant
							add_trait = physique_good_2
							add_trait = strong
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:char_spawn_type = flag:fools
			}
			create_character = {
				template = poet_template
				location = root.location
				save_scope_as = new_person
			}
			hidden_effect = {
				scope:new_person = {
					add_trait = fecund
					add_trait = lifestyle_traveler
					add_trait = loyal
				} 
			}
		}
		else_if = {
			limit = {
				scope:char_spawn_type = flag:locals
			}
			create_character = {
				template = merchant_template
				location = root.location
				save_scope_as = new_person
			}
			hidden_effect = {
				scope:new_person = {
					random_list = {
						8 = {
							add_trait = shrewd
						}
						1 = {
							add_trait = intellect_good_1
						}
						1 = {
							add_trait = intellect_good_2
						}
					}
				}
			}
		}

		add_character_flag = {
			flag = had_ep3_laamps_8200
			years = 4
		}
	}

	option = { #welcome, weary traveler
		name = ep3_laamps.8200.a
		add_courtier = scope:new_person
		add_character_flag = {
			flag = had_ep3_laamps_8200
			years = 4
		}

		ai_chance = 100

		stress_impact = {
			compassionate = minor_stress_loss
		}
	}

	option = { #please go away
		name = ep3_laamps.8200.b
		add_character_flag = {
			flag = had_ep3_laamps_8200
			years = 2
		}
		scope:new_person = {
			silent_disappearance_effect = yes
		}

		stress_impact = {
			paranoid = medium_stress_loss
			shy = medium_stress_loss
		}
	}

	option = { #don't bother me again for the next 20 years!
		name = ep3_laamps.8200.c
		add_character_flag = {
			flag = had_ep3_laamps_8200
			years = 20
		}
		scope:new_person = {
			silent_disappearance_effect = yes
		}
		stress_impact = {
			wrathful = medium_stress_loss
			paranoid = major_stress_loss
			shy = major_stress_loss
		}
	}
}


