﻿loaa_valid_laamp_basic_trigger = {
	$EMPLOYER$ = {
		is_alive = yes
		age >= 10
	}
	$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 }
			is_landless_adventurer = no
		}
	}
	# 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
	# 	}
	# }
}

loaa_is_savable_murder_scheme_trigger = {
	OR = {
		scheme_type = murder
		scheme_type = laamp_base_3011_contract_scheme
		scheme_type = loaa_laamp_base_3011_contract_scheme
	}
}

loaa_ep3_laamp_diplo_range_trigger = {
	custom_description = {
		text = target_too_far_away_landed
		subject = scope:actor
		object = scope:recipient
		trigger_if = {
			limit = { exists = $LAAMP$.domicile.domicile_location }
			trigger_if = {
				limit = {
					NOT = { exists = $TARGET$.capital_province }
					exists = $TARGET$.host.capital_province
				}
				$TARGET$.host.capital_province ?= {
					squared_distance = {
						target = $LAAMP$.domicile.domicile_location
						value < define:NTaskContract|ADVENTURER_DISTANCE_RESTRICTION
					}
				}
			}
			trigger_else_if = {
				limit = {
					NOT = { exists = $TARGET$.capital_province }
					exists = $TARGET$.location
				}
				$TARGET$.location ?= {
					squared_distance = {
						target = $LAAMP$.domicile.domicile_location
						value < define:NTaskContract|ADVENTURER_DISTANCE_RESTRICTION
					}
				}
			}
			trigger_else = {
				$TARGET$.capital_province ?= {
					squared_distance = {
						target = $LAAMP$.domicile.domicile_location
						value < define:NTaskContract|ADVENTURER_DISTANCE_RESTRICTION
					}
				}
			}
		}
		trigger_else = { always = no }
	}
}