﻿##################################################
# Landless Adventurer Camp Scripted Triggers
##################################################

##################################################
# Interaction Triggers

maa_regiments_valid_for_cheap_reinforcement_trigger = {
	maa_current_troops_count < maa_max_troops_count
	NOR = {
		is_unit_type = heavy_cavalry
		is_unit_type = camel_cavalry
		maa_regiments_cost_more_to_reinforce_per_soldier_trigger = yes
	}
}

maa_regiments_cost_more_to_reinforce_per_soldier_trigger = {
	regiment_owner = { government_has_flag = government_is_landless_adventurer }
	OR = {
		is_unit_type = elephant_cavalry
		is_unit_type = siege_weapon
	}
}

maa_regiments_valid_to_refill_trigger = {
	maa_current_troops_count < maa_max_troops_count
	trigger_if = {
		limit = {
			scope:actor = { government_has_flag = government_is_landless_adventurer }
			is_unit_type = elephant_cavalry
		}
		scope:actor.domicile ?= { has_domicile_parameter = camp_reinforce_elephant_regiments_anywhere }
	}
}

any_laamp_portion_at_sea_trigger = {
	OR = {
		current_travel_plan ?= {
			is_travel_with_domicile = yes
			current_location = {
				OR = {
					is_sea_province = yes
					is_river_province = yes
				}
			}
		}
		any_army = {
			location = {
				OR = {
					is_sea_province = yes
					is_river_province = yes
				}
			}
		}
	}
}

character_is_valid_for_harrying_of_the_north_trigger = {
	title:k_england.holder ?= { owns_story_of_type = story_cycle_harrying_of_the_north }
	trigger_if = {
		limit = { is_ruler = yes }
		OR = {
			this = title:k_england.holder
			any_liege_or_above = { this = title:k_england.holder }
		}
	}
	trigger_else = {
		domicile ?= {
			domicile_location = {
				county ?= {
					holder = {
						OR = {
							this = title:k_england.holder
							any_liege_or_above = { this = title:k_england.holder }
						}
					}
				}
			}
		}
	}
	OR = {
		character_is_valid_anglo_saxon_for_harrying_of_the_north_trigger = yes
		character_is_valid_norman_for_harrying_of_the_north_trigger = yes
	}
}

character_is_valid_anglo_saxon_for_harrying_of_the_north_trigger = {
	culture = {
		OR = {
			this = culture:anglo_saxon
			any_parent_culture_or_above = { this = culture:anglo_saxon }
		}
		NOR = {
			this = culture:norman
			any_parent_culture_or_above = { this = culture:norman }
		}
	}
}

character_is_valid_norman_for_harrying_of_the_north_trigger = {
	culture = {
		OR = {
			this = culture:norman
			any_parent_culture_or_above = { this = culture:norman }
		}
		NOR = {
			this = culture:anglo_saxon
			any_parent_culture_or_above = { this = culture:anglo_saxon }
		}
	}
}

disable_interaction_for_hereward_trigger = {
	trigger_if = {
		limit = { scope:recipient = character:90028 }
		custom_tooltip = {
			text = owns_a_story_trigger
			scope:actor = {
				NOR = {
					owns_story_of_type = story_cycle_harrying_of_the_north
					any_liege_or_above = { owns_story_of_type = story_cycle_harrying_of_the_north }
				}
			}
		}
	}
}

disable_interaction_for_hasan_trigger = {
	trigger_if = {
		limit = { scope:recipient = character:41702 }
		custom_tooltip = {
			text = owns_a_story_trigger
			scope:recipient = { owns_story_of_type = story_hasan }
		}
	}
}

laamp_request_likely_marriable_woman_trigger = {
	is_available_quick = {
		female = yes
		adult = yes
	}
	can_marry_trigger = yes
}

laamp_request_likely_marriable_man_trigger = {
	is_available_quick = {
		female = no
		adult = yes
	}
	can_marry_trigger = yes
}

##################################################
# Transition Triggers

is_valid_for_laampdom = {
	save_temporary_scope_as = potential_laamp_temp
	trigger_if = {
		limit = {
			NAND = {
				is_ai = no
				government_allows = administrative
				top_liege = this
				is_landed = no
			}
		}
		custom_tooltip = {
			text = adventurer_not_nf_head_trigger_tt
			NOT = {
				any_held_title = { is_noble_family_title = yes }
			}
		}
		is_landless_ruler = no # Admin gov vassals should not become laamps
	}
	trigger_if = {
		limit = { is_ai = yes }
		trigger_if = {
			limit = {
				NOT = { exists = scope:allow_imprisoned_landless }
			}
			is_imprisoned = no # Must be free
		}
		is_adult = yes # Old enough to venture forth
		age < 60 # Young enough to venture forth
		health >= fine_health # Healthy enough to venture forth
		OR = {
			highest_skill_value >= decent_skill_rating
			prowess >= decent_skill_rating
		}
		# Can't be completely unwilling to go outside.
		OR = {
			ai_boldness >= low_negative_ai_value
			ai_energy >= low_negative_ai_value
		}
		NOR = {
			has_trait = content # Too chill to adventure
			has_trait = craven # Too scared to adventure
			has_trait = lazy # Too lazy to adventure
		}
		# Block admin members of noble families
		NOT = {
			house ?= {
				any_house_member = {
					any_held_title = { is_noble_family_title = yes }
				}
			}
		}
	}
}

ep3_laamp_interesting_enough_to_be_a_laamp_trigger = {
	OR = {
		has_trait_rank = { # Prettier
			trait = beauty_good
			character > $COMPARISON$
		}
		has_trait_rank = { # Cleverer
			trait = intellect_good
			character > $COMPARISON$
		}
		has_trait_rank = { # Dencher
			trait = physique_good
			character > $COMPARISON$
		}
		AND = { # Strong people are just more interesting
			has_trait = strong
			NOT = {
				$COMPARISON$ = { has_trait = strong }
			}
		}
		sum_of_all_skills_value > $COMPARISON$.sum_of_all_skills_value # Skillful people are interesting
		prowess >= high_skill_rating # Good fighters are interesting
		prestige_level > $COMPARISON$.prestige_level # Famous people are interesting
		piety_level > $COMPARISON$.piety_level # Religious people are interesting
		AND = { # People with nicknames are just more interesting
			has_any_nickname = yes
			$COMPARISON$ = { has_any_nickname = no }
		}
		has_character_modifier = bp2_tool_of_fate_modifier # Destiny's child is interesting
		has_trait = reincarnation # Reincarnies are interesting
		has_trait = immortal
		is_twin_of = $COMPARISON$ # Twins are interesting
	}
}

playable_relative_trigger = {
	is_available_quick = {
		ai = yes
		advanced_ruler = yes
	}
	house = root.house
}

ep3_laamp_interesting_sibling_trigger = {
	is_available_quick = {
		ai = yes
		landed = no
		advanced_ruler = no
	}
	NOT = {
		any_consort = {
			is_ruler = yes
		}
	}
	is_valid_for_laampdom = yes # Age, health, personality
	ep3_laamp_interesting_enough_to_be_a_laamp_trigger = { COMPARISON = $COMPARISON$ }
}

ep3_purchase_land_valid_county_trigger = {
	holder.top_liege = scope:recipient
	NOR = {
		scope:recipient.capital_county ?= this
		scope:recipient.primary_title ?= this
	}
}

ep3_negotiate_settlement_valid_county_trigger = {
	OR = {
		holder = scope:actor
		trigger_if = {
			limit = {
				scope:actor = { government_has_flag = government_is_special_administrative }
			}
			holder = { target_is_liege_or_above = scope:actor }
		}
	}
	NOR = {
		holder.capital_county ?= this
		holder.primary_title ?= this
	}
}

ep3_adventurer_invasion_allowed_for_character_trigger = {
	has_ep3_dlc_trigger = yes
	government_has_flag = government_is_landless_adventurer
	is_landed = no
}

ep3_adventurer_invasion_allowed_for_character_display_regardless_trigger = {
	has_ep3_dlc_trigger = yes
	is_at_war = no
}

ep3_adventurer_landless_allowed_against_character_trigger = {
	is_landed = yes
	# Players vs. AI filtering.
	OR = {
		# Can always target the AI.
		is_ai = yes
		# Cannot target a player unless they completely control at least two duchies.
		any_sub_realm_duchy = {
			count >= 2
			save_temporary_scope_as = player_controlled_duchy
			# Custom description to suppress errors.
			custom_description = {
				text = SUPPRESS
				scope:defender = { completely_controls = scope:player_controlled_duchy }
			}
		}
	}
	# Scope:defender cannot be liege of attacker.
	scope:defender = {
		this != scope:attacker.liege
	}
}

ep3_adventurer_invasion_sponsorship_applies_trigger = {
	var:adventurer_invasion_supporter ?= { ep3_adventurer_sponsorship_valid_trigger = yes }
	var:adventurer_invasion_target ?= scope:defender
}

ep3_adventurer_landless_should_invalidate_trigger = {
	OR = {
		NOT = {
			any_in_list = {
				list = target_titles
				any_in_de_jure_hierarchy = {
					tier = tier_county
					is_landless_type_title = no
					holder = { target_is_same_character_or_above = scope:defender }
				}
			}
		}
		scope:attacker = { is_landed = yes }
	}
}

ep3_adventurer_sponsorship_valid_trigger = {
	scope:attacker.var:adventurer_invasion_supporter ?= {
		var:adventurer_invasion_target ?= scope:defender
		NOR = {
			this = scope:defender
			top_liege = scope:defender.top_liege
			is_allied_to = scope:defender
			is_spouse_of = scope:defender
			AND = {
				is_close_family_of = scope:defender
				opinion = {
					target = scope:defender
					value >= -25
				}
			}
			has_relation_friend = scope:defender
			has_relation_lover = scope:defender
			any_character_war = {
				primary_attacker = scope:attacker.var:adventurer_invasion_supporter
				primary_defender = scope:defender
			}
		}
		in_diplomatic_range = scope:defender
	}
}

##################################################
# Contract Triggers

# Can this employer ever offer this contract?
## This is basically an is_valid_showing_failures_only, so we deliberately break out into lots of unnecessarily small sections for nicer tooltipping.
valid_laamp_basic_trigger = {
	custom_description = {
		text = adventurer_not_famous_or_patron_trigger_tt
		object = $EMPLOYER$
		value = $EMPLOYER$.highest_held_title_tier
		OR = {
			$EMPLOYER$.highest_held_title_tier <= tier_county
			AND = {
				$EMPLOYER$.highest_held_title_tier <= tier_duchy
				$EMPLOYER$ = { government_has_flag = government_is_nomadic }
			}
			$EMPLOYER$.highest_held_title_tier <= $LAAMP$.prestige_level
			$EMPLOYER$ = { is_contact_of = $LAAMP$ }
		}
	}
	$EMPLOYER$ = {
		# Players shouldn't get tangled up in contracts, ever.
		is_ai = yes
		# Plus some standard stuff.
		is_alive = yes
		is_adult = yes
		NOT = { government_has_flag = government_is_herder }
	}
	$EMPLOYER$ = { is_incapable = no }
	# Laamps shouldn't offer contracts in their local area, ever.
	$EMPLOYER$ = {
		OR = {
			employer = $LAAMP$
			NOT = { government_has_flag = government_is_landless_adventurer }
		}
	}
	# Don't offer to work with those who've wronged us.
	## No one we're at war with.
	$EMPLOYER$ = {
		NOT = { is_at_war_with = $LAAMP$ }
	}
	## Rivals are cheap to avoid.
	$EMPLOYER$ = {
		NOT = { has_relation_rival = $LAAMP$ }
	}
	## Expulsion
	$EMPLOYER$ = {
		custom_tooltip = {
			text = adventurer_expelled_trigger_tt
			NOR = {
				reverse_has_opinion_modifier = {
					target = $LAAMP$
					modifier = demanded_eviction_opinion
				}
				any_liege_or_above = {
					reverse_has_opinion_modifier = {
						target = $LAAMP$
						modifier = demanded_eviction_opinion
					}
				}
			}
		}
	}
	$LAAMP$ = { government_has_flag = government_is_landless_adventurer }
	$LAAMP$ = {
		trigger_if = {
			limit = { is_at_war = no }
			is_commanding_army = no
		}
	}
	# If we're looking at the player, make sure there's no uhh... weird legacies between us.
	$LAAMP$ = {
		trigger_if = {
			limit = { is_ai = no }
			NOR = {
				has_any_major_negative_opinion_against_character_trigger = { CHARACTER = $EMPLOYER$ }
				$EMPLOYER$ = {
					has_any_major_negative_opinion_against_character_trigger = { CHARACTER = $LAAMP$ }
				}
			}
		}
	}
}

# triggers that prevent you from only accepting the contract
valid_laamp_basic_accept_only_trigger = {
	is_imprisoned = no
}

# Should this employer be putting this out for tender?
## Naturally, if they're being becrimed, we don't care about this.
employer_has_treasury_to_offer_job_trigger = {
	trigger_if = {
		limit = { is_ai = no }
		scope:employer.treasury_or_gold >= 50
	}
}

# Does it make sense that this employer offers this contract to start with?
## So we don't penalise you if their circumstances change beyond your control, but _also_ so that there aren't local job listings going up in Middlesex for someone currently pilgrimaging in Jerusalem.
valid_laamp_sensible_start_trigger = {
	scope:employer = {
		is_available_quick = {
			travel = no
			in_army = no
			imprisoned = no
		}
	}
	trigger_if = {
		limit = {
			any_character_task_contract = {
				count >= 1
				task_contract_employer = scope:employer
			}
		}
		always = no
	}
}

# Prevent inappropriate characters, like the Byzantine Emperor or the Sunni Caliph, from giving contracts that'd seem beneath them.
## This isn't a comment on whether they _would_ (or even did) put out such things, more just trying to preserve verisimilitude.
rule_out_dramatic_laamp_employers_trigger = {
	scope:employer = {
		NOR = {
			faith.religious_head ?= this
			highest_held_title_tier >= tier_empire
		}
	}
}

# We do not spawn contracts in the Sahara without the right CulTrad.
lock_contracts_from_spawning_in_sahara_trigger = {
	OR = {
		NOT = {
			location = { geographical_region = custom_sahara_proper }
		}
		culture = { has_cultural_tradition = tradition_saharan_nomads }
	}
}

# How far do we have to travel (or to where) before we start spawning more contracts to play with?
player_adventurer_sufficient_distance_for_contract_spawn_trigger = {
	is_ai = no
	save_temporary_scope_as = char_temp
	OR = {
		# Either we've moved to a neighbouring kingdom that we've not been to recently.
		AND = {
			location.kingdom = { save_temporary_scope_as = kingdom_temp }
			NOT = {
				is_target_in_variable_list = {
					name = laamp_recently_visited_kingdoms
					target = scope:kingdom_temp
				}
			}
		}
		# Or we've travelled some distance.
		trigger_if = {
			limit = { exists = scope:char_temp.current_travel_plan }
			"location.squared_distance(scope:char_temp.current_travel_plan.departure_location)" >= squared_distance_medium
		}
	}
}

# Would this employer have some trait that means they don't want to see/don't trust strangers?
laamp_task_contract_employer_not_antisocial_trigger = {
	scope:employer = {
		NOR = {
			has_trait = shy
			has_trait = paranoid
			has_trait = cynical
		}
	}
}

# Would this employer have someone executed or hurt without (what passes for in-period as) a fair trial?
laamp_task_contract_employer_would_resort_to_violence_trigger = {
	scope:employer = {
		NOT = { has_trait = compassionate }
	}
}

# Would this employer happily tell a lie or manipulate someone if they at least had a good reason?
laamp_task_contract_employer_would_resort_to_deceit_trigger = {
	scope:employer = {
		NOT = { has_trait = honest }
	}
}

# Would this employer go grubbing for money they're owed?
laamp_task_contract_employer_would_chase_money_trigger = {
	scope:employer = {
		NOR = {
			has_trait = generous
			has_trait = improvident
			# Compassionates avoid this unless they're also greedy.
			AND = {
				has_trait = compassionate
				NOT = { has_trait = greedy }
			}
		}
	}
}

# Check to see if it's appropriate to apply a county modifier — basically, don't let barons putting out contracts apply modifiers to players.
contract_employer_can_apply_county_modifier_trigger = {
	OR = {
		highest_held_title_tier >= tier_county
		liege = { is_ai = yes }
	}
}

# Could this potential rival be removed without unexpectedly affecting a player?
laamp_base_0011_valid_potential_rival_trigger = {
	# Exempt players.
	NOT = {
		this = { is_ai = no }
	}
}

# Search for counties that could be affected by the modifiers we apply at the conclusion of the contract.
laamp_base_1001_valid_neighbouring_county_trigger = {
	holder = root.task_contract_employer
	county_control < full_county_control
}

laamp_base_2001_valid_mayor_trigger = {
	highest_held_title_tier = tier_barony
	government_has_flag = government_is_republic
	NOT = { is_close_or_extended_family_of = scope:employer }
}

laamp_base_3001_valid_neighbours_trigger = {
	NOR = {
		# Don't collect intelligence on people we trust.
		has_any_moderate_good_relationship_with_character_trigger = { CHARACTER = $EMPLOYER$ }
		is_allied_to = $EMPLOYER$
		# Or on people we're currently at war with — it's a little late for court whispers.
		is_at_war_with = $EMPLOYER$
	}
	is_adult = yes
	is_incapable = no
	is_imprisoned = no
}

# used in task contracts triggered from council tasks to check if employer and their liege or councillor are valid to issue a contract for you
# COUNCILLOR_TYPE = councillor type name
# COUNCIL_TASK_TYPE = council task type name
council_task_contract_valid_employer_trigger = {
	trigger_if = {
		limit = {
			NOT = { exists = scope:laamp }
		}
		save_temporary_scope_as = laamp
	}
	valid_laamp_basic_trigger = {
		EMPLOYER = scope:employer
		LAAMP = scope:laamp
	}
	custom_tooltip = {
		text = councillor_leaving_court_message_title
		scope:employer = {
			OR = {
				AND = {
					cp:$COUNCILLOR_TYPE$ ?= {
						is_performing_council_task = $COUNCIL_TASK_TYPE$
					}
					valid_laamp_basic_trigger = {
						EMPLOYER = scope:employer.cp:$COUNCILLOR_TYPE$
						LAAMP = scope:laamp
					}
				}	
				AND = {
					is_performing_council_task = $COUNCIL_TASK_TYPE$
					valid_laamp_basic_trigger = {
						EMPLOYER = scope:employer.liege
						LAAMP = scope:laamp
					}
				}
			}
		}
	}
}

##################################################
# Travel Triggers

is_laamp_exiled_from_province_trigger = {
	$PROVINCE$.county.holder = {
		is_laamp_exiled_from_holder_or_liege_trigger = { LAAMP = $LAAMP$ }
	}
}

is_laamp_exiled_from_holder_or_liege_trigger = {
	OR = {
		AND = {
			save_temporary_scope_as = char_temp
			$LAAMP$ = {
				has_opinion_modifier = {
					target = scope:char_temp
					modifier = demanded_eviction_opinion
				}
			}
		}
		AND = {
			any_liege_or_above = {
				save_temporary_scope_as = char_temp
				$LAAMP$ = {
					has_opinion_modifier = {
						target = scope:char_temp
						modifier = demanded_eviction_opinion
					}
				}
			}
		}
	}
}

##################################################
# Event Triggers

# Do we want this character to occur in events around camp more frequently?
is_valid_active_event_recurrer_trigger = {
	is_ai = yes
	is_courtier_of = $LIEGE$
	is_healthy = yes
	OR = {
		has_any_court_position = yes
		is_close_or_extended_family_of = $LIEGE$
		is_consort_of = $LIEGE$
		has_important_relationship_with_character_trigger = { CHARACTER = $LIEGE$ }
	}
}

valid_laamp_contract_foe_trigger = {
	# Make sure they're at home if possible.
	NOR = {
		is_travelling = yes
		is_commanding_army = yes
		is_imprisoned = no
	}
	# Good sensible restrictions on mutual relationships.
	OR = {
		has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:employer_ref }
		# Ensure a bit of mild dislike.
		reverse_opinion = {
			target = scope:employer_ref
			value <= -25
		}
		opinion = {
			target = scope:employer_ref
			value <= -25
		}
	}
	NOR = {
		# Filter out anything that might look odd.
		has_any_good_relationship_with_character_trigger = { CHARACTER = scope:employer_ref }
		# Plus don't include anything connected to a player.
		save_temporary_scope_as = char_temp
		any_player = {
			OR = {
				this = scope:char_temp
				is_close_or_extended_family_of = scope:char_temp
				is_consort_of = scope:char_temp
				has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:char_temp }
				has_any_good_relationship_with_character_trigger = { CHARACTER = scope:char_temp }
			}
		}
	}
	# And check their location is valid.
	location = {
		# Which means making sure that they're not located too far away from our contractor.
		"squared_distance(root.task_contract_taker.location)" <= squared_distance_large
		# And that they're not located in the exact same province, else travel logic'll break.
		this != scope:employer_ref.location
	}
}

has_any_landed_title_trigger = {
	any_held_title = {
		NOR = {
			is_noble_family_title = yes
			is_landless_type_title = yes
			has_variable = adventurer_creation_reason
		}
	}
}

# Toggle on tally logging for laamp events, so we can see how often they're firing for a single run test.
enable_debug_laamp_event_logging_toggle_trigger = { always = no }

# Can the AI create a new laamp without threatening performance?
## Beware of expanding this past the soft-cap figure of around ~200: code estimations were made with this number in mind, so the more we let slip the net, the more they'll start to degrade performance.
### YOU HAVE BEEN WARNED.
ai_can_valid_to_create_laamp_trigger = {
	save_temporary_scope_as = char_temp
	OR = {
		# General checking.
		NOT = { has_global_variable_list = laamps_tally }
		global_variable_list_size = {
			name = laamps_tally
			value < max_desired_laamps_value
		}
		# Player-relevant.
		any_player = {
			OR = {
				is_close_or_extended_family_of = scope:char_temp
				is_consort_of = scope:char_temp
				has_important_relationship_with_character_trigger = { CHARACTER = scope:char_temp }
				is_allied_in_war = scope:char_temp
				is_allied_to = scope:char_temp
				is_at_war_with = scope:char_temp
			}
		}
		# Encourage legitimists.
		AND = {
			any_claim = { tier >= tier_kingdom }
			global_variable_list_size = {
				name = laamps_tally
				value < {
					value = max_desired_laamps_value
					multiply = 1.25
				}
			}
		}
	}
}

##################################################
# Decisions Triggers

# We want to refer to this in two places, is_shown and is_valid, within its decision so that we can explain where it's come from.
can_access_reject_inheritance_decision_trigger = {
	OR = {
		has_trait = content
		has_perk = carefree_perk
		has_government = landless_adventurer_government
	}
}

# Would this character lose opinion with you if you declared "screw that" to your family's titular duties?
would_judge_new_gallivanters_trigger = {
	NOR = {
		# Traits that innately get it.
		has_trait = gallivanter
		has_trait = content
		# Traits that probably get it if the situation merits it.
		calc_true_if = {
			amount >= 2
			has_trait = compassionate
			has_trait = lazy
			has_trait = humble
			has_trait = eccentric
		}
	}
	is_adult = yes
}

butcher_animals_decision_available_dogs_trigger = {
	OR = {
		custom_tooltip = {
			text = butcher_animals_decision.tt.dog.you
			has_character_modifier = dog_story_modifier
		}
		custom_tooltip = {
			text = butcher_animals_decision.tt.dog.courtier
			any_courtier = { has_character_modifier = dog_story_modifier }
		}
		domicile = { has_domicile_building = baggage_train_kennel }
	}
	# Only show the cooldown flag if we already have it, so make our tooltips neater.
	trigger_if = {
		limit = { has_character_flag = recently_ate_dogs }
		custom_tooltip = {
			text = butcher_animals_decision.tt.recently_ate_dogs
			NOT = { has_character_flag = recently_ate_dogs }
		}
	}
}

butcher_animals_decision_available_cats_trigger = {
	OR = {
		custom_tooltip = {
			text = butcher_animals_decision.tt.cat.you
			has_character_modifier = cat_story_modifier
		}
		custom_tooltip = {
			text = butcher_animals_decision.tt.cat.courtier
			any_courtier = { has_character_modifier = cat_story_modifier }
		}
	}
	# Only show the cooldown flag if we already have it, so make our tooltips neater.
	trigger_if = {
		limit = { has_character_flag = recently_ate_cats }
		custom_tooltip = {
			text = butcher_animals_decision.tt.recently_ate_cats
			NOT = { has_character_flag = recently_ate_cats }
		}
	}
}

butcher_animals_decision_available_horses_trigger = {
	OR = {
		custom_tooltip = {
			text = butcher_animals_decision.tt.horse.you
			has_character_modifier = horse_story_modifier
		}
		domicile = { has_domicile_building = baggage_train_ample_steeds }
	}
	# Only show the cooldown flag if we already have it, so make our tooltips neater.
	trigger_if = {
		limit = { has_character_flag = recently_ate_horses }
		custom_tooltip = {
			text = butcher_animals_decision.tt.recently_ate_horses
			NOT = { has_character_flag = recently_ate_horses }
		}
	}
}

butcher_animals_decision_available_elephants_trigger = {
	domicile = { has_domicile_building = proving_grounds_elephantry_reserve }
	# Only show the cooldown flag if we already have it, so make our tooltips neater.
	trigger_if = {
		limit = { has_character_flag = recently_ate_elephants }
		custom_tooltip = {
			text = butcher_animals_decision.tt.recently_ate_elephants
			NOT = { has_character_flag = recently_ate_elephants }
		}
	}
}

laamp_youth_cultural_tradition_trigger = {
	has_global_variable_list = laamps_tally
	global_variable_list_size = {
		name = laamps_tally
		value < {
			value = max_desired_laamps_value
			add = 10
		}
	}
	culture = {
		OR = {
			has_cultural_parameter = much_more_likely_to_be_laamps
			has_cultural_parameter = more_likely_to_be_laamps
		}
	}
	any_close_or_extended_family_member = {
		is_ruler = yes
	}
	is_lowborn = no
	is_ruler = no
	is_ai = yes
	OR = {
		AND = {
			exists = liege
			can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = liege }
		}
		AND = {
			is_male = yes
			faith_dominant_gender_male_or_equal = yes
		}
		AND = {
			is_female = yes
			faith_dominant_gender_female_or_equal = yes
		}
	}
	trigger_if = {
		limit = {
			exists = liege
		}
		liege = {
			is_landless_adventurer = no
			is_ai = yes
		}
	}
	NOT = {
		any_heir_title = { }
	}
}
