# ############################################################
# ##                 ESC : AI Economic Plans                ##
# ############################################################

@esc_food_target_ships = 75
@esc_food_target_beastmaster = 300
@esc_rare_resource_limit = 20
@esc_scaling_rare_resource_target = 0.20
@esc_rare_crystals_target = 30
@esc_rare_resources_target = 20

### ESC now extends basic economy plan rather than overwriting it completely
basic_economy_plan = {

	# food production
	subplan = {
		optional = yes
		set_name = "ESC food production"
		potential = { ESC_TRIGGER_needs_food_for_ship_components = yes }
		income = { food = @esc_food_target_ships }
	}
	subplan = {
		set_name = "ESC food production for space fauna"
		potential = {
			OR = {
				is_beastmasters_empire = yes
				has_tradition = tr_domestication_adopt
			}
		}
		income = { food = @esc_food_target_beastmaster }
	}

	# rare crystals don't have vanilla scaling subplans. adding one
	subplan = {
		optional = yes
		scaling = yes
		set_name = "Scaling rare crystals"

		potential = {
			NOT = { has_technology = esc_tech_crystal_cannon_1 }
			has_monthly_income = { resource = rare_crystals value < @esc_rare_resource_limit }
		}

		income = { rare_crystals = @esc_scaling_rare_resource_target }
	}

	# rare crystals production by empires that can build crystalline weapons
	subplan = {
		optional = yes
		set_name = "ESC crystals production"
		potential = { has_technology = esc_tech_crystal_cannon_1 }
		income = { rare_crystals = @esc_rare_crystals_target }
	}
	subplan = {
		optional = yes
		scaling = yes
		set_name = "ESC scaling rare crystals"

		potential = {
			has_technology = esc_tech_crystal_cannon_1
			has_monthly_income = { resource = rare_crystals value < @esc_rare_crystals_target }
		}

		income = { rare_crystals = @esc_scaling_rare_resource_target }
	}

	# zro production by empires that can build psionic weapons
	subplan = {
		optional = yes
		set_name = "ESC zro production"
		potential = { has_technology = esc_tech_psionic_weapons }
		income = { sr_zro = @esc_rare_resources_target }
	}

	# dark matter production by empires that can build special weapons that use dark matter
	subplan = {
		optional = yes
		set_name = "ESC dark matter production"
		potential = { ESC_TRIGGER_needs_dark_matter_for_ship_components = yes }
		income = { sr_dark_matter = @esc_rare_resources_target }
	}

	# nanite production by empires that can build nanite weapons
	subplan = {
		optional = yes
		set_name = "ESC nanites production"
		potential = { has_technology = esc_tech_synthetic_lifeform_studies }
		income = { nanites = @esc_rare_resources_target }
	}
}
