﻿######################
# HUNT STUFF
######################

hunt_activity_base_cost = {
	value = standard_activity_base_cost
	if = {
		limit = {
			has_character_modifier = peregrine_falcon
		}
		multiply = 0.9
	}
	# Done like this so that it stacks
	if = {
		limit = { has_character_modifier = master_of_hunt_activity_bonus }
		multiply = 0.9
	}
	# Adventurer
	if = {
		limit = { is_landless_adventurer = yes }
		multiply = 0.25
	}
}

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

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

standard_hunting_cooldown_time = {
	value = 2
	if = {
		limit = {
			root.culture = { has_cultural_parameter = more_frequent_hunts }
		}
		multiply = 0.5
	}
}

hunt_secondary_outcome = 1
hunt_participants = 10

hunt_event_delay_min = 25
hunt_event_delay_max = 35

min_default_hunt_events = 2
max_default_hunt_events = 3
chance_of_extra_hunt_events = 25

min_hunt_event_spacing = 2
max_hunt_event_spacing = 4

hunt_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
	}
}

hunt_prestige_guest_gain_value = {
	value = hunt_prestige_reward_value
	divide = 2
}

hunt_prestige_with_piety_guest_gain_value = {
	value = hunt_prestige_with_piety_reward_value
	divide = 2
}

hunt_piety_guest_gain_value = {
	value = hunt_piety_reward_value
	divide = 2
}

hunt_activity_success_increase_minor_value = 3
hunt_activity_success_increase_medium_value = 5
hunt_activity_success_increase_major_value = 10
hunt_activity_success_increase_massive_value = 15 # use very sparingly, this is huge
hunt_activity_success_increase_adventurer_initial_medium_value = 30
hunt_activity_success_increase_adventurer_initial_high_value = 50

hunt_activity_success_decrease_minor_value = {
	value = hunt_activity_success_increase_minor_value
	multiply = -1
}
hunt_activity_success_decrease_medium_value = {
	value = hunt_activity_success_increase_medium_value
	multiply = -1
}
hunt_activity_success_decrease_major_value = {
	value = hunt_activity_success_increase_major_value
	multiply = -1
}
hunt_activity_success_decrease_massive_value = {
	value = hunt_activity_success_increase_massive_value
	multiply = -1
}

hunt_hunting_grounds_success_value = {
	value = 0
	add = {
		if = {
			limit = { has_building = hunting_grounds_01 }
			add = 3
		}
		if = {
			limit = { has_building = hunting_grounds_02 }
			add = 6
		}
		if = {
			limit = { has_building = hunting_grounds_03 }
			add = 9
		}
		if = {
			limit = { has_building = hunting_grounds_04 }
			add = 12
		}
		if = {
			limit = { has_building = hunting_grounds_05 }
			add = 15
		}
		if = {
			limit = { has_building = hunting_grounds_06 }
			add = 18
		}
		if = {
			limit = { has_building = hunting_grounds_07 }
			add = 21
		}
		if = {
			limit = { has_building = hunting_grounds_08 }
			add = 24
		}
		desc = hunt_success_chance.hunting_grounds
	}
	add = {
		if = {
			limit = { has_building = rainbow_mountains_01 }
			add = 24
		}
		desc = hunt_success_chance.rainbow_mountains_01
	}
}

hunt_logging_camps_success_value = {
	value = 0
	add = {
		if = {
			limit = { has_building = logging_camps_01 }
			add = -3
		}
		if = {
			limit = { has_building = logging_camps_02 }
			add = -6
		}
		if = {
			limit = { has_building = logging_camps_03 }
			add = -9
		}
		if = {
			limit = { has_building = logging_camps_04 }
			add = -12
		}
		if = {
			limit = { has_building = logging_camps_05 }
			add = -15
		}
		if = {
			limit = { has_building = logging_camps_06 }
			add = -18
		}
		if = {
			limit = { has_building = logging_camps_07 }
			add = -21
		}
		if = {
			limit = { has_building = logging_camps_08 }
			add = -24
		}
		desc = hunt_success_chance.logging_camps
	}
}

hunt_royal_reserves_success_value = {
	value = 0
	add = {
		if = {
			limit = { has_building = royal_forest_01 }
			add = 6
		}
		else_if = {
			limit = { has_building = royal_forest_02 }
			add = 12
		}
		else_if = {
			limit = { has_building = royal_forest_03 }
			add = 18
		}
		desc = hunt_success_chance.royal_forest
	}
}

hunt_success_chance_roco_amenity_level_value = {
	value = 0
	if = {
		limit = {
			activity_host = { has_royal_court = yes }
			has_dlc_feature = royal_court
		}
		if = {
			limit = {
				activity_host = {
					amenity_level = { type = court_servants value = low_amenity_level }
				}
			}
			add = 1
		}
		else_if = {
			limit = {
				activity_host = {
					amenity_level = { type = court_servants value = medium_amenity_level }
				}
			}
			add = 2
		}
		else_if = {
			limit = {
				activity_host = {
					amenity_level = { type = court_servants value = high_amenity_level }
				}
			}
			add = 3
		}
		else_if = {
			limit = {
				activity_host = {
					amenity_level = { type = court_servants value = very_high_amenity_level }
				}
			}
			add = 4
		}
		else_if = {
			limit = {
				activity_host = {
					amenity_level = { type = court_servants value = max_amenity_level }
				}
			}
			add = 5
		}
	}
	else = { add = 2 }
}

hunt_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_hunter }
				add = 3
			}
			if = {
				limit = {
					has_trait = lifestyle_hunter
					involved_activity = {
						has_activity_option = { category = special_type option = hunt_type_falconry }
					}
					has_trait_xp = { trait = lifestyle_hunter track = falconer value >= 25 }
				}
				add = {
					value = 3
					if = {
						limit = {
							has_trait_xp = { trait = lifestyle_hunter track = falconer value >= 50 }
						}
						add = 3
					}
					if = {
						limit = {
							has_trait_xp = { trait = lifestyle_hunter track = falconer value >= 75 }
						}
						add = 3
					}
				}
			}
			else_if = {
				limit = {
					has_trait = lifestyle_hunter
					involved_activity = {
						NOT = {
							has_activity_option = { category = special_type option = hunt_type_falconry }
						}
					}
					has_trait_xp = { trait = lifestyle_hunter track = hunter value >= 25 }
				}
				add = {
					value = 3
					if = {
						limit = {
							has_trait_xp = { trait = lifestyle_hunter track = hunter value >= 50 }
						}
						add = 3
					}
					if = {
						limit = {
							has_trait_xp = { trait = lifestyle_hunter track = hunter value >= 75 }
						}
						add = 3
					}
				}
			}
			desc = hunt_success_chance.trait
		}
		# MODIFIERS
		if = { # Shrek
			limit = {
				has_character_modifier = hunt_guide_local_madman_modifier
				var:hunt_guide_local_madman_place ?= involved_activity.activity_location.county
			}
			add = {
				value = 5
				desc = hunt_success_chance.hunt_guide_local_madman_modifier
			}
		}
		if = { # Tame Deer
			limit = {
				has_character_modifier = hunt_tame_deer_modifier
				exists = involved_activity.var:animal_type
				var:tame_animal_type ?= involved_activity.var:animal_type
			}
			add = {
				value = 5
				desc = hunt_success_chance.hunt_tame_deer_modifier
			}
		}
		if = { # Beastmaster
			limit = { has_character_modifier = ep2_beastmaster_modifier }
			add = {
				value = 5
				desc = hunt_success_chance.ep2_beastmaster_modifier
			}
		}
		if = { # Scenthound
			limit = {
				has_character_modifier = dog_story_scenthound_modifier
				involved_activity = {
					NOR = {
						has_activity_option = { category = special_type option = hunt_type_falconry }
						hunt_animal_type_dangerous_trigger = { VAR = var:animal_type }
					}
				}
			}
			add = {
				value = 5
				desc = hunt_success_chance.dog_story_scenthound_modifier
			}
		}
		if = { # Beasthound
			limit = {
				has_character_modifier = dog_story_beasthound_modifier
				involved_activity = {
					hunt_animal_type_dangerous_trigger = { VAR = var:animal_type }
					NOT = {
						has_activity_option = { category = special_type option = hunt_type_falconry }
					}
				}
			}
			add = {
				value = 5
				desc = hunt_success_chance.dog_story_beasthound_modifier
			}
		}
		# MASTER OF THE HUNT
		if = {
			limit = { exists = court_position:master_of_hunt_court_position }
			add = {
				value = 0
				court_position:master_of_hunt_court_position = {
					if = {
						limit = {
							aptitude = { court_position = master_of_hunt_court_position value <= 1 }
						}
						add = 3
					}
					else_if = {
						limit = {
							aptitude = { court_position = master_of_hunt_court_position value = 2 }
						}
						add = 6
					}
					else_if = {
						limit = {
							aptitude = { court_position = master_of_hunt_court_position value = 3 }
						}
						add = 9
					}
					else_if = {
						limit = {
							aptitude = { court_position = master_of_hunt_court_position value = 4 }
						}
						add = 12
					}				
					else = { add = 15 }
				}
				desc = hunt_success_chance.master_of_hunt
			}
		}
		# HUNTSMAN
		if = {
			limit = { exists = court_position:huntperson_camp_officer }
			add = {
				value = 0
				court_position:huntperson_camp_officer = {
					if = {
						limit = {
							aptitude = { court_position = huntperson_camp_officer value <= 1 }
						}
						add = 3
					}
					else_if = {
						limit = {
							aptitude = { court_position = huntperson_camp_officer value = 2 }
						}
						add = 6
					}
					else_if = {
						limit = {
							aptitude = { court_position = huntperson_camp_officer value = 3 }
						}
						add = 9
					}
					else_if = {
						limit = {
							aptitude = { court_position = huntperson_camp_officer value = 4 }
						}
						add = 12
					}				
					else = { add = 15 }
				}
				desc = hunt_success_chance.master_of_hunt
			}
		}
		# ESTATE
		if = {
			limit = {
				domicile ?= { has_domicile_parameter = kennels_more_successful_hunts_1 }
			}
			add = {
				value = kennels_more_successful_hunts_1_value
				desc = estate_has_kennels
			}
		}
		else_if = {
			limit = {
				domicile ?= { has_domicile_parameter = kennels_more_successful_hunts_2 }
			}
			add = {
				value = kennels_more_successful_hunts_2_value
				desc = estate_has_kennels
			}
		}
	}
	# GUESTS
	if = { # Hunters
		limit = {
			any_attending_character = {
				NOR = {
					this = prev.activity_host
					prev.activity_host.court_position:master_of_hunt_court_position ?= this
				}
				OR = {
					has_trait = lifestyle_hunter
					has_character_modifier = ep2_beastmaster_modifier
				}
			}
		}
		add = {
			value = 0
			every_attending_character = {
				limit = {
					NOR = {
						this = prev.activity_host
						prev.activity_host.court_position:master_of_hunt_court_position ?= this
					}
					has_trait = lifestyle_hunter
				}
				add = 3
			}
			every_attending_character = {
				limit = {
					NOR = {
						this = prev.activity_host
						prev.activity_host.court_position:master_of_hunt_court_position ?= this
					}
					has_character_modifier = ep2_beastmaster_modifier
				}
				add = 3
			}
			desc = hunt_success_chance.attending_hunters
		}
	}
	#OPTION
	if = {
		limit = {
			has_activity_option = { category = hunt_option_attendants option = hunt_attendants_normal }
		}
		add = {
			value = 1.25
			multiply = hunt_success_chance_roco_amenity_level_value
			desc = hunt_success_chance.hunt_option_attendants
		}
	}
	else_if = {
		limit = {
			has_activity_option = { category = hunt_option_attendants option = hunt_attendants_many }
		}
		add = {
			value = 2.5
			multiply = hunt_success_chance_roco_amenity_level_value
			desc = hunt_success_chance.hunt_option_attendants
		}
	}
	# FORCED ANIMAL
	if = {
		limit = { exists = var:hunt_forced_type }
		add = {
			value = 0
			if = {
				limit = { var:hunt_forced_type = flag:deer }
				add = -10
			}
			else_if = {
				limit = { var:hunt_forced_type = flag:fox }
				add = -5
			}
			else_if = {
				limit = { var:hunt_forced_type = flag:hare }
				add = -10
			}
			else_if = {
				limit = { var:hunt_forced_type = flag:wolf }
				add = -10
			}
			desc = hunt_success_chance.forced_type
		}
	}
	# METHOD	
	if = { # Captive
		limit = { exists = var:captive_release }
		add = {
			value = 15
			desc = hunt_success_chance.captive_release
		}
	}
	# LOCATION
	activity_location = { add = hunt_province_reference_value }
	# CULTURE
	save_temporary_scope_as = activity_temp
	add = {
		value = 0
		activity_host.culture ?= {
			if = { # Forests
				limit = {
					has_cultural_parameter = forest_hunt_success_chance
					scope:activity_temp.activity_location = {
						OR = {
							terrain = forest
							terrain = taiga
						}
					}
				}
				add = 5
			}
			if = { # Hills
				limit = {
					has_cultural_parameter = hills_hunt_success_chance
					scope:activity_temp.activity_location = { terrain = hills }
				}
				add = 5
			}
			if = { # Deserts
				limit = {
					has_cultural_parameter = desert_hunt_success_chance
					scope:activity_temp.activity_location = {
						OR = {
							terrain = desert
							terrain = oasis
						}
					}
				}
				add = 5
			}
			if = { # Steppes
				limit = {
					has_cultural_parameter = steppe_hunt_success_chance
					scope:activity_temp.activity_location = { terrain = steppe }
				}
				add = 5
			}
			if = { # Mountains
				limit = {
					has_cultural_parameter = mountains_hunt_success_chance
					scope:activity_temp.activity_location = {
						OR = {
							terrain = mountains
							terrain = desert_mountains
						}
					}
				}
				add = 5
			}
			if = { # Drylands
				limit = {
					has_cultural_parameter = drylands_hunt_success_chance
					scope:activity_temp.activity_location = {
						OR = {
							terrain = drylands
							terrain = desert
						}
					}
				}
				add = 5
			}
			if = { # Jungle
				limit = {
					has_cultural_parameter = jungle_hunt_success_chance
					scope:activity_temp.activity_location = { terrain = jungle }
				}
				add = 5
			}
			if = { # Wetlands
				limit = {
					has_cultural_parameter = wetlands_hunt_success_chance
					scope:activity_temp.activity_location = {
						OR = {
							terrain = wetlands
							terrain = floodplains
						}
					}
				}
				add = 5
			}
		}
		desc = hunt_success_chance.culture
	}
	# SIGHTINGS
	if = {
		limit = {
			OR = {
				# Standard
				AND = {
					OR = {
						activity_location.county = { has_county_modifier = hunt_sighting_standard_modifier }
						activity_location.county = { has_county_modifier = hunt_sighting_dangerous_modifier }
					}
					has_activity_option = { category = special_type option = hunt_type_standard }
				}
				# Falconry
				AND = {
					activity_location.county = { has_county_modifier = hunt_sighting_falconry_modifier }
					has_activity_option = { category = special_type option = hunt_type_falconry }
				}
			}
			# Sighting animal is same as activity animal
			exists = var:animal_type
			exists = activity_location.county.var:animal_type
			var:animal_type = activity_location.county.var:animal_type
		}
		add = {
			value = 20
			desc = hunt_success_chance.sighting
		}
	}
	# MODIFIERS
	if = { # Mismanaged Game
		limit = {
			activity_location.county = { has_county_modifier = hunt_mismanaged_game_modifier }
			exists = var:animal_type
			activity_host.var:mismanaged_animal_type ?= var:animal_type
		}
		add = {
			value = -5
			desc = hunt_success_chance.hunt_mismanaged_game_modifier
		}
	}
	if = { # Abundant Game
		limit = {
			activity_location.county = { has_county_modifier = ep3_abundant_game_modifier }
		}
		add = {
			value = 10
			desc = hunt_success_chance.hunt_abundant_game_modifier
		}
	}
	if = { # Wild Predators
		limit = {
			activity_location.county = { has_county_modifier = ep3_wild_predators_modifier }
		}
		add = {
			value = -5
			desc = hunt_success_chance.hunt_wild_predators_modifier
		}
	}
	# EVENTS
	if = {
		limit = { exists = var:hunt_success_chance_event }
		add = {
			value = var:hunt_success_chance_event
			desc = hunt_success_chance.events
		}
	}
	# TYPE
	if = { # Falconry is somewhat more difficult
		limit = {
			has_activity_option = { category = special_type option = hunt_type_falconry }
		}
		multiply = 0.75
	}
	else_if = { # Legendary is a lot more difficult
		limit = {
			has_activity_option = { category = special_type option = hunt_type_legendary }
		}
		multiply = 0.5
	}
	if = {
		limit = { var:hunt_success ?= flag:no }
		multiply = 0
	}
	min = 10
	max = 80
}

hunt_success_chance_inverse_value = {
	value = 100
	subtract = hunt_success_chance_value
}

hunt_province_reference_value = {
	value = 0
	# TERRAIN
	add = {
		value = 0
		if = {
			limit = {
				OR = {
					terrain = farmlands
					terrain = floodplains
				}
			}
			add = -10
		}
		else_if = {
			limit = {
				OR = {
					terrain = desert
					terrain = desert_mountains
					terrain = oasis
				}
			}
			add = -5
		}
		else_if = {
			limit = {
				OR = {
					terrain = hills
					terrain = wetlands
				}
			}
			add = 5
		}
		else_if = {
			limit = {
				OR = {
					terrain = taiga
					terrain = forest
					terrain = mountains
					terrain = jungle
				}
			}
			add = 10
		}
		desc = hunt_success_chance.terrain
	}
	# POPULATION
	if = {
		limit = { has_holding = no }
		add = {
			value = 10
			desc = hunt_success_chance.no_holding
		}
	}
	if = {
		limit = { county.development_level >= terrible_development_level }
		# Example: development = 15 / 3 * -1 = -5
		county ?= {
			add = {
				value = development_level
				divide = 3
				multiply = -1
				desc = hunt_success_chance.development
			}
		}
	}
	# BUILDINGS
	if = { # Hunting Grounds
		limit = {
			OR = {
				has_building_or_higher = hunting_grounds_01
				has_building_or_higher = rainbow_mountains_01
			}
		}
		add = hunt_hunting_grounds_success_value
	}
	if = { # Logging Camps
		limit = { has_building_or_higher = logging_camps_01 }
		add = hunt_logging_camps_success_value
	}
	if = { # Royal Reserves
		limit = {
			county.title_province ?= { has_building_or_higher = royal_forest_01 }
		}
		county.title_province = { add = hunt_royal_reserves_success_value }
	}
	# MODIFIERS
	if = {
		limit = {
			county ?= { has_county_modifier = hunt_mismanaged_game_modifier }
		}
		add = {
			value = -5
			desc = hunt_success_chance.hunt_mismanaged_game_modifier
		}
	}
	if = { # Abundant Game
		limit = {
			county ?= { has_county_modifier = ep3_abundant_game_modifier }
		}
		add = {
			value = 10
			desc = hunt_success_chance.hunt_abundant_game_modifier
		}
	}
	if = { # Wild Predators
		limit = {
			county ?= { has_county_modifier = ep3_wild_predators_modifier }
		}
		add = {
			value = -5
			desc = hunt_success_chance.hunt_wild_predators_modifier
		}
	}
	if = {
		limit = {
			county ?= { has_county_modifier = hunt_punished_locals_modifier }
		}
		add = {
			value = 5
			desc = hunt_success_chance.hunt_punished_locals_modifier
		}
	}
	if = { # Inspection Modifiers
		limit = {
			has_province_modifier = inspection_hidden_hinterlands_recruit_modifier
		}
		add = {
			value = 10
			desc = hunt_success_chance.hidden_hinterlands_recruit_modifier
		}
	}
	if = { # Inspection Modifiers
		limit = {
			has_province_modifier = inspection_hidden_hinterlands_hunters_modifier
		}
		add = {
			value = 10
			desc = hunt_success_chance.hidden_hinterlands_huntsmen_modifier
		}
	}
	# VARIABLES
	if = {
		limit = { exists = var:recent_hunt_held }
		add = {
			value = -10
			multiply = var:recent_hunt_held
			desc = hunt_success_chance.recent_hunt_held
		}
	}
}

hunt_melee_danger_value = {
	value = 25
	scope:activity = {
		if = {
			limit = { exists = var:animal_type }
			if = {
				limit = {
					OR = {
						var:animal_type = flag:lion
						var:animal_type = flag:tiger
						var:animal_type = flag:leopard
					}
				}
				add = 25
			}
			else_if = {
				limit = { var:animal_type = flag:bear }
				add = 20
			}	
			else_if = {
				limit = {
					var:animal_type = flag:boar
					var:animal_type = flag:bison
					var:animal_type = flag:hart
					var:animal_type = flag:reindeer
					var:animal_type = flag:elk
				}
				add = 15
			}
			else_if = {
				limit = {
					OR = {
						var:animal_type = flag:wolf
						var:animal_type = flag:hyena
						var:animal_type = flag:lynx
						var:animal_type = flag:stag
						var:animal_type = flag:antelope
					}
				}
				add = 10
			}
			else_if = {
				limit = {
					OR = {
						var:animal_type = flag:fox
						var:animal_type = flag:roe
						var:animal_type = flag:gazelle
					}
				}
				add = -10
			}
			else_if = {
				limit = { var:animal_type = flag:hare }
				add = -20
			}
		}
		# huntsmaster accolade bonuses
		if = {
			limit = {
				scope:host = {
					any_active_accolade = {
						has_accolade_parameter = acclaimed_knight_reduces_hunting_danger
					}
				}
			}
			add = acclaimed_knight_hunt_danger_value
		}
		else_if = {
			limit = {
				scope:host = {
					any_active_accolade = {
						has_accolade_parameter = acclaimed_knight_reduces_hunting_danger_high
					}
				}
			}
			add = acclaimed_knight_hunt_danger_value_high
		}
	}
}

hunt_bow_danger_value = {
	value = hunt_melee_danger_value
	multiply = 0.25
	scope:activity = {
		# huntsmaster accolade bonuses
		if = {
			limit = {
				scope:host = {
					any_active_accolade = {
						has_accolade_parameter = acclaimed_knight_reduces_hunting_danger
					}
				}
			}
			add = acclaimed_knight_hunt_danger_value
		}
		else_if = {
			limit = {
				scope:host = {
					any_active_accolade = {
						has_accolade_parameter = acclaimed_knight_reduces_hunting_danger_high
					}
				}
			}
			add = acclaimed_knight_hunt_danger_value_high
		}
	}
}

hunt_melee_kill_prowess_value = {
	value = 10
	if = {
		limit = { exists = scope:activity.var:animal_type }
		if = {
			limit = {
				OR = {
					scope:activity.var:animal_type = flag:lion
					scope:activity.var:animal_type = flag:tiger
					scope:activity.var:animal_type = flag:leopard
				}
			}
			add = 12
		}
		else_if = {
			limit = { scope:activity.var:animal_type = flag:bear }
			add = 9
		}	
		else_if = {
			limit = {
				scope:activity.var:animal_type = flag:boar
				scope:activity.var:animal_type = flag:bison
				scope:activity.var:animal_type = flag:hart
				scope:activity.var:animal_type = flag:reindeer
				scope:activity.var:animal_type = flag:elk
			}
			add = 6
		}
		else_if = {
			limit = {
				OR = {
					scope:activity.var:animal_type = flag:wolf
					scope:activity.var:animal_type = flag:hyena
					scope:activity.var:animal_type = flag:lynx
					scope:activity.var:animal_type = flag:stag
					scope:activity.var:animal_type = flag:antelope
				}
			}
			add = 3
		}
		else_if = {
			limit = {
				OR = {
					scope:activity.var:animal_type = flag:roe
					scope:activity.var:animal_type = flag:gazelle
				}
			}
			add = -5
		}
		else_if = {
			limit = { scope:activity.var:animal_type = flag:hare }
			add = -9
		}
	}
}

hunt_prestige_melee_value = {
	value = 75
	if = {
		limit = {
			OR = {
				scope:activity.var:animal_type = flag:fox
				scope:activity.var:animal_type = flag:hare
			}
		}
		add = -25
	}
	else_if = {
		limit = {
			OR = {
				scope:activity.var:animal_type = flag:wolf
				scope:activity.var:animal_type = flag:hyena
				scope:activity.var:animal_type = flag:lynx
			}
		}
		add = 25
	}
	else_if = {
		limit = {
			OR = {
				scope:activity.var:animal_type = flag:boar
				scope:activity.var:animal_type = flag:hart
				scope:activity.var:animal_type = flag:elk
				scope:activity.var:animal_type = flag:bison
				scope:activity.var:animal_type = flag:aurochs
			}
		}
		add = 50
	}
	else_if = {
		limit = {
			OR = {
				scope:activity.var:animal_type = flag:leopard
				scope:activity.var:animal_type = flag:lion
				scope:activity.var:animal_type = flag:tiger
				scope:activity.var:animal_type = flag:bear
			}
		}
		add = 75
	}
	if = {
		limit = { exists = scope:activity.var:female_quarry }
		divide = 2
	}
}

hunt_prestige_melee_group_value = {
	value = hunt_prestige_melee_value
	divide = 3
}

hunt_prestige_melee_wound_value = {
	value = hunt_prestige_melee_value
	multiply = 0.75
}

hunt_prestige_melee_wound_group_value = {
	value = hunt_prestige_melee_group_value
	divide = 2
}

hunt_prestige_bow_value = {
	value = hunt_prestige_melee_value
	divide = 2
}

hunt_murder_accomplice_prowess_value = {
	value = scope:murderer.prowess
	add = {
		value = scope:accomplice.prowess
		multiply = 0.5
	}
}

hunt_prestige_animal_level_value = {
	value = 2
	if = {
		limit = {
			OR = {
				scope:activity.var:animal_type ?= flag:hare
				scope:activity.var:animal_type ?= flag:fox
			}
		}
		subtract = 1
	}
	else_if = {
		limit = {
			OR = {
				scope:activity.var:animal_type ?= flag:wolf
				scope:activity.var:animal_type ?= flag:hyena
				scope:activity.var:animal_type ?= flag:lynx
			}
		}
		add = 1
	}
	else_if = {
		limit = {
			OR = {
				scope:activity.var:animal_type ?= flag:boar
				scope:activity.var:animal_type ?= flag:hart
				scope:activity.var:animal_type ?= flag:elk
				scope:activity.var:animal_type ?= flag:bison
				scope:activity.var:animal_type ?= flag:aurochs
			}
		}
		add = 2
	}
	else_if = {
		limit = {
			OR = {
				scope:activity.var:animal_type ?= flag:bear
				scope:activity.var:animal_type ?= flag:lion
				scope:activity.var:animal_type ?= flag:tiger
				scope:activity.var:animal_type ?= flag:leopard
				hunt_activity_exotic_bird_trigger = { VAR = var:animal_type }
			}
		}
		add = 3
	}
}

hunt_prestige_reward_value = {
	# Standard value for most chars.
	value = minor_prestige_value

	scope:activity = {
		if = {
			limit = {
				OR = {
					var:animal_type ?= flag:hare
					var:animal_type ?= flag:fox
				}
			}
			multiply = 2
		}
		else_if = {
			limit = {
				OR = {
					var:animal_type ?= flag:boar
					var:animal_type ?= flag:hart
					var:animal_type ?= flag:elk
					var:animal_type ?= flag:bison
					var:animal_type ?= flag:aurochs
				}
			}
			multiply = 6
		}
		else_if ={
			limit = {
				OR = {
					var:animal_type ?= flag:bear
					var:animal_type ?= flag:lion
					var:animal_type ?= flag:tiger
					var:animal_type ?= flag:leopard
					hunt_activity_exotic_bird_trigger = { VAR = var:animal_type }
				}
			}
			multiply = 8
		}
		else = { multiply = 4 }
		if = {
			limit = {
				has_activity_option = { category = hunt_option_party_size option = hunt_party_size_normal }
			}
			multiply = 1.25
		}
		else_if = {
			limit = {
				has_activity_option = { category = hunt_option_party_size option = hunt_party_size_many }
			}
			multiply = 1.5
		}
	}
	if = {
		limit = { scope:activity.var:hunt_success ?= flag:no }
		divide = 2
	}
	if = {
		limit = { exists = scope:activity.var:female_quarry }
		divide = 2
	}
	if = {
		limit = {
			scope:activity = {
				has_activity_option = { category = special_type option = hunt_type_legendary }
				var:hunt_success ?= flag:yes
			}
		}
		multiply = 2
	}
	else_if = {
		limit = {
			scope:activity = {
				has_activity_option = { category = special_type option = hunt_type_falconry }
			}
		}
		multiply = 2
	}
	if = {
		limit = {
			scope:activity.activity_host = {
				OR = {
					has_character_modifier = employer_booner_master_of_hunt_2_modifier
					has_character_modifier = employer_booner_master_of_hunt_3_modifier
				}
			}
		}
		multiply = 1.2
	}
	
	if = {
		limit = {
			scope:activity.activity_host = {
				is_landless_adventurer = yes
			}
		}
		multiply = 0.25
	}
}

hunt_provisions_reward_value = {
	value = 50

	scope:activity = {
		if = {
			limit = {
				OR = {
					var:animal_type ?= flag:hare
					var:animal_type ?= flag:fox
				}
			}
			multiply = 2
		}
		else_if = {
			limit = {
				OR = {
					var:animal_type ?= flag:hart
					var:animal_type ?= flag:roe
					var:animal_type ?= flag:antelope
					var:animal_type ?= flag:gazelle
					var:animal_type ?= flag:saiga
				}
			}
			multiply = 6
		}
		else_if = {
			limit = {
				OR = {
					var:animal_type ?= flag:stag
					var:animal_type ?= flag:reindeer
					var:animal_type ?= flag:lion
					var:animal_type ?= flag:tiger
				}
			}
			multiply = 8
		}
		else_if ={
			limit = {
				OR = {
					var:animal_type ?= flag:bear
					var:animal_type ?= flag:boar
					var:animal_type ?= flag:elk
				}
			}
			multiply = 12
		}
		else_if ={
			limit = {
				OR = {
					var:animal_type ?= flag:bison
					var:animal_type ?= flag:aurochs
				}
			}
			multiply = 16
		}
		# Not that much meat on these, so they get a low modifier
		#var:animal_type ?= flag:wolf
		#var:animal_type ?= flag:hyena
		#var:animal_type ?= flag:leopard
		#var:animal_type ?= flag:lynx
		else = { multiply = 4 }
	}
	if = {
		limit = { scope:activity.var:hunt_success ?= flag:no }
		divide = 2
	}
	if = {
		limit = {
			scope:activity = {
				has_activity_option = { category = special_type option = hunt_type_legendary }
				var:hunt_success ?= flag:yes
			}
		}
		multiply = 2
	}
	else_if = {
		limit = {
			scope:activity = {
				has_activity_option = { category = special_type option = hunt_type_falconry }
			}
		}
		multiply = 0.25
	}
}

hunt_prestige_with_piety_reward_value = {
	value = hunt_prestige_reward_value
	divide = 2
}

hunt_piety_reward_value = {
	value = hunt_prestige_reward_value
	divide = 2
}

hunt_glory_hound_vassal_opinion_value = {
	value = 5
	add = {
		value = 5
		multiply = hunt_prestige_animal_level_value
	}
}

# PARTY SIZE

# These should ALWAYS be synced with the relevant activity option select_travel_entourage_max parameter.
hunt_entourage_party_size_small_max_value = 5
hunt_entourage_party_size_normal_max_value = 10
hunt_entourage_party_size_many_max_value = 15

hunt_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 = akolouthos_court_position
				has_court_position = court_physician_court_position
				has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
				has_trait = lifestyle_hunter
			}
			NAND = {
				scope:special_option ?= flag:hunt_type_falconry
				can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:host }
			}
		}
		# 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
		}
		# And EP3 akolouthos
		if = {
			limit = { has_court_position = akolouthos_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 = { is_landless_adventurer = yes }
			}
			add = 500
		}
		# We want friends too.
		if = {
			limit = {
				has_any_good_relationship_with_character_trigger = { CHARACTER = scope:host }
			}
			add = 500
		}
		# Sex
		if = {
			limit = {
				exists = scope:special_option
				NOT = { scope:special_option = flag:hunt_type_falconry }
				NOT = { 
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:host }
				}
			}
			divide = 2
		}
	}
	if = {
		limit = {
			bannable_serving_diarch_trigger = yes
		}
		add = -1000
	}
}

hunt_entourage_extras_set_weighting_value = {
	value = 0
	if = {
		limit = {
			is_available_healthy_adult = yes
			is_designated_diarch = no
			OR = {
				is_knight_of = scope:host
				has_trait = education_martial
				has_trait = education_martial_prowess
				has_trait = lazy
				prowess >= decent_skill_rating
			}
			trigger_if = {
				limit = {
					NOT = { scope:special_option ?= flag:hunt_type_falconry }
				}
				can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:host }
			}
			trigger_else = { always = yes }
		}
		# Base
		add = 150
	}
}

hunt_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.
		if = {
			limit = {
				can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:host }
			}
			multiply = 1.5
		}
	}
}
