﻿######################
# excavation STUFF
######################

excavation_activity_base_cost = {
	value = standard_activity_base_cost
	# Adventurer
	if = {
		limit = { has_government = landless_adventurer_government }
		multiply = 0.25
	}
}

excavation_normal_option_cost = {
	value = 10
	multiply = activity_cost_scale_by_tier
	multiply = activity_cost_scale_by_era
}

excavation_good_option_cost = {
	value = 35
	multiply = activity_cost_scale_by_tier
	multiply = activity_cost_scale_by_era
}

standard_excavationing_cooldown_time = {
	value = 2
}

excavation_prestige_reward_value = {
	# Standard value for most chars.
	value = minor_prestige_value
}


excavation_piety_reward_value = {
	# Standard value for most chars.
	value = minor_piety_value
}


excavation_secondary_outcome = 1
excavation_participants = 10

excavation_event_delay_min = 25
excavation_event_delay_max = 35

min_default_excavation_events = 2
max_default_excavation_events = 3
chance_of_extra_excavation_events = 25

min_excavation_event_spacing = 2
max_excavation_event_spacing = 4

excavation_activity_guest_list_size_value = {
	value = 4
	if = {
		limit = { primary_title.tier = tier_duchy }
		add = 2
	}
	else_if = {
		limit = { primary_title.tier = tier_kingdom }
		add = 4
	}
	if = {
		limit = { primary_title.tier >= tier_empire }
		add = 6
	}
}

excavation_prestige_guest_gain_value = {
	value = excavation_prestige_reward_value
	divide = 2
}

excavation_piety_guest_gain_value = {
	value = excavation_piety_reward_value
	divide = 2
}

excavation_activity_success_increase_minor_value = 3
excavation_activity_success_increase_medium_value = 5
excavation_activity_success_increase_major_value = 10
excavation_activity_success_increase_massive_value = 15 # use very sparingly, this is huge
excavation_activity_success_increase_adventurer_initial_medium_value = 30
excavation_activity_success_increase_adventurer_initial_high_value = 50

excavation_activity_success_decrease_minor_value = {
	value = excavation_activity_success_increase_minor_value
	multiply = -1
}
excavation_activity_success_decrease_medium_value = {
	value = excavation_activity_success_increase_medium_value
	multiply = -1
}
excavation_activity_success_decrease_major_value = {
	value = excavation_activity_success_increase_major_value
	multiply = -1
}
excavation_activity_success_decrease_massive_value = {
	value = excavation_activity_success_increase_massive_value
	multiply = -1
}

excavation_success_chance_value = {
	activity_host = {
		### HOST
		# SKILLS
		add = {
			value = learning
			divide = 4
			ceiling = yes
			max = 10
			desc = learning_modifier
		}
		add = {
			value = martial
			divide = 8
			ceiling = yes
			max = 10
			desc = martial_modifier
		}
		add = {
			value = prowess
			divide = 4
			ceiling = yes
			max = 10
			desc = prowess_modifier
		}
		# TRAIT
		add = {
			value = 0
			if = {
				limit = { has_trait = lifestyle_antiquarian }
				add = 3
			}
			desc = excavation_success_chance.trait
		}
	}
	# GUESTS
	if = { # excavationers
		limit = {
			any_attending_character = {
				NOR = {
					this = prev.activity_host
#					prev.activity_host.court_position:master_of_excavation_court_position ?= this
				}
				OR = {
					has_trait = lifestyle_antiquarian
				}
			}
		}
		add = {
			value = 0
			every_attending_character = {
				limit = {
					NOR = {
						this = prev.activity_host
#						prev.activity_host.court_position:master_of_excavation_court_position ?= this
					}
					has_trait = lifestyle_antiquarian
				}
				add = 3
			}
			desc = excavation_success_chance.attending_excavationers
		}
	}
	min = 10
	max = 80
}

excavation_success_chance_inverse_value = {
	value = 100
	subtract = excavation_success_chance_value
}

# PARTY SIZE

# These should ALWAYS be synced with the relevant activity option select_travel_entourage_max parameter.
excavation_entourage_party_size_small_max_value = 5
excavation_entourage_party_size_normal_max_value = 10
excavation_entourage_party_size_many_max_value = 15

excavation_entourage_base_set_weighting_value = {
	if = {
		limit = {
			is_available_healthy_adult = yes
			bannable_serving_diarch_trigger = no
			OR = {
				has_court_position = master_of_hunt_court_position
				has_court_position = huntperson_camp_officer
				has_court_position = bodyguard_court_position
				has_court_position = court_physician_court_position
				has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
				has_trait = lifestyle_antiquarian
			}
		}
		# Base
		add = 50
		add = ai_energy
		add = ai_boldness
		# We want to have MoH most of all.
		if = {
			limit = { has_court_position = master_of_hunt_court_position }
			add = 100000
		}
		if = {
			limit = { has_court_position = huntperson_camp_officer }
			add = 100000
		}
		# We want bodyguards too.
		if = {
			limit = { has_court_position = bodyguard_court_position }
			add = 50000
		}
		# We want doctors too.
		if = {
			limit = { has_court_position = court_physician_court_position }
			add = 50000
		}
		# Adventurers bring their court.
		if = {
			limit = {
				scope:host = { has_government = landless_adventurer_government }
			}
			add = 500
		}
		# We want friends too.
		if = {
			limit = {
				has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
			}
			add = 500
		}
	}
	if = {
		limit = {
			bannable_serving_diarch_trigger = yes
		}
		add = -1000
	}
}

excavation_entourage_extras_set_weighting_value = {
	value = 0
	if = {
		limit = {
			is_available_healthy_adult = yes
			is_designated_diarch = no
		}
		# Base
		add = 150
	}
}

excavation_entourage_sodding_everyone_set_weighting_value = {
	value = 0
	if = {
		limit = {
			is_available_healthy_adult = yes
			is_designated_diarch = no
		}
		# Base
		add = 50
		# Alright, now we're just grabbing everyone.
		## Anyone who can fight.
	}
}


excavation_province_reference_value = {
	value = 0
	# TERRAIN
	if = {
		limit = { 
			exists = var:recent_excavation_held 
		}
		add = {
			value = -10
			multiply = var:recent_hunt_held
			desc = hunt_success_chance.recent_hunt_held
		}
	}
}