﻿# overriding vanilla adventurer requirements

is_valid_for_laampdom = {
	save_temporary_scope_as = potential_laamp_temp
	custom_tooltip = {
		text = adventurer_not_nf_head_trigger_tt
		NOT = {
			any_held_title = { is_noble_family_title = yes }
		}
	}
	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 = { tgp_realm_has_ceremonial_liege_trigger = yes }
		custom_tooltip = {
			text = tgp_japan_imperial_branch_decision_imperial_heir_trigger
			NOT = {
				top_liege.primary_title.var:administrative_ui_special_title = {
					place_in_line_of_succession = {
						target = scope:potential_laamp_temp
						value <= 4
					}
				}
			}
		}
	}
	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
		
		# Higher base skill requirement than vanilla (15 vs 12)
		OR = {
			highest_skill_value >= high_skill_rating
			prowess >= high_skill_rating
		}
		
		# Can't be completely unwilling to go outside (in vanilla only one of these needs to be true)
		ai_boldness >= low_negative_ai_value
		ai_energy >= low_negative_ai_value
		
		# Non-combatants must be brave or ambitious
		OR = {
			can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:potential_laamp_temp }
			AND = {
				ai_boldness > 0
				ai_energy > 0
				OR = {
					has_trait = brave
					has_trait = ambitious
				}
			}
		}
		
		# Women must not have young children
		trigger_if = {
			limit = { is_female = yes }
			NOT = {
				any_child = {
					is_alive = yes
					age < 10
				}
			}
		}
		
		NOR = {
			has_trait = content # Too chill to adventure
			has_trait = craven # Too scared to adventure
			has_trait = humble # Not ambitious enough to adventure
			has_trait = lazy # Too lazy to adventure
			has_trait = blind
			has_trait = pregnant
			has_trait = infirm
		}
		
		# Block admin members of noble families
		NOT = {
			house ?= {
				any_house_member = {
					any_held_title = { is_noble_family_title = yes }
				}
			}
		}
	}
}

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
	save_temporary_scope_as = youth_adventurer_check
	can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:youth_adventurer_check }

	trigger_if = {
		limit = {
			exists = liege
		}
		liege = {
			NOT = { has_government = landless_adventurer_government }
			is_ai = yes
		}
	}
	NOT = {
		any_heir_title = {}
	}
}

