## Categories used in this file must have use_for_ai_budget = yes defined in economic_categories ##
## It is possible to have multiple entries with the same category and resource ##

#################
## Expenditure ##
#################
unity_expenditure_edicts = {
	resource = unity
	type = expenditure
	category = edicts

	potential = {
		has_resource = {
			type = unity
			amount > 300
		}
	}

	weight = {
		weight = 0.2
	}
}

unity_expenditure_traditions = {
	resource = unity
	type = expenditure
	category = traditions

	potential = {
		has_unlocked_all_traditions = no
	}

	weight = {
		weight = 0.8
	}

	# Tradition cost climbs past any fixed share of the stockpile, so a weight alone leaves the AI hoarding
	# unity it is never allowed to spend. The minimum is capped at what the empire actually holds, so this
	# means "a tradition may draw on the whole stockpile" rather than an amount in its own right.
	desired_min = {
		base = 100000
	}
}

unity_expenditure_megastructures = {
	resource = unity
	type = expenditure
	category = megastructures

	potential = {
		is_at_war = no
		can_build_unity_megastructures = yes

		has_resource = {
			type = unity
			amount > 7500
		}
	}

	weight = {
		weight = 0.1
	}


	desired_max = {
		base = 7500
	}
}

unity_expenditure_decisions = {
	resource = unity
	type = expenditure
	category = decisions

	potential = {
		always = yes
	}

	weight = {
		weight = 0.20
	}

	desired_max = {
		base = 1000
	}
}

unity_expenditure_leaders = {
	resource = unity
	type = expenditure
	category = leaders

	potential = {
		always = yes
	}

	weight = {
		weight = 0.4
	}

	# Covers a level 3 hire, so the traditions minimum cannot squeeze recruitment out of the budget.
	desired_min = {
		base = 500
	}
}

unity_expenditure_deposit_blockers = {
	resource = unity
	type = expenditure
	category = deposit_blockers

	potential = {
		any_owned_planet = {
			num_uncleared_blockers > 0
		}
	}

	weight = {
		weight = 0

		modifier = {
			add = 1.5

			# if we have any planet that is currently completely blocked that has a unity blocker
			any_owned_planet = {
				num_uncleared_blockers > 0
				num_free_districts = { type = any value < 1 }
				has_unity_blocker = yes
			}
		}
	}

	desired_min = {
		base = 500
	}
	
	desired_max = {
		base = 1500
	}
}

unity_expenditure_starbases = {
	resource = unity
	type = expenditure
	category = starbases

	potential = {
		is_nomadic = yes
		has_technology = tech_arkship_tier_3
	}

	weight = {
		weight = 0.2
	}

	desired_min = {
		base = @arkship_cost_unity_500
	}

	desired_max = {
		base = @arkship_cost_unity_500
	}
}

unity_upkeep_country = {
	resource = unity
	type = upkeep
	category = country

	potential = {
		always = yes
	}

	weight = {
		weight = 0.2
	}

	desired_max = {
		base = 200
	}
}

unity_upkeep_leaders = {
	resource = unity
	type = upkeep
	category = leaders

	potential = {
		always = yes
	}

	weight = {
		weight = 0.3
	}

	desired_max = {
		base = 50
	}
}

unity_upkeep_edicts = {
	resource = unity
	type = upkeep
	category = edicts

	potential = {
		always = yes
	}

	weight = {
		weight = 0.07
	}
}
