﻿##################################################
# Regula Landless Adventurer Camp Scripted Effects
##################################################

##################################################
# Contract Effects

populate_location_with_regula_contracts_effect = {
	if = {
		limit = {
			# The AI have their own system for getting contracts.
			trigger_if = {
				limit = { is_landless_adventurer = yes }
				is_ai = no

				# Based on Lewd contracts game rule
				OR = {
                    has_game_rule = regula_lewd_contracts_availability_always
                    AND = {
                        has_game_rule = regula_lewd_contracts_availability_regula_cultist_only
                        has_realm_law = camp_purpose_regula_magistri_cult
                    }
                }
			}
			is_adult = yes
			lock_contracts_from_spawning_in_sahara_trigger = yes
		}
		# Flag our pre-existing contracts if necessary.
		if = {
			limit = { exists = scope:toggle_distance_ignore }
			every_character_task_contract = { add_to_list = pre_existing_contracts_list }
		}
		# Now populate.
		populate_task_contracts_for_area = {
			location = $AREA_CHAR$.capital_province
			amount = $AMOUNT$
			group = { 
				laamp_contracts_regula_group 
			}
		}
		# Then flag our new contracts (again, if necessary).
		if = {
			limit = { exists = scope:toggle_distance_ignore }
			every_character_task_contract = {
				limit = {
					NOT = { is_in_list = pre_existing_contracts_list }
				}
				set_variable = {
					name = retain_despite_distance
					value = yes
				}
			}
		}
	}
}