
#eds_debugstrat = {
#	allowed = {
#		tag = EDS
#	}
#    enable = {
#        always = yes
#    }
#	abort_when_not_enabled = yes
#	ai_strategy = {
#		type = wanted_supply_trains
#		#id = arms_factory
#		value = 105
#	}
#}



######################################
#########CONSTRUCTION MANAGEMENT##########
######################################
eds_not_busy_building_other_stuff = {
	allowed = {
		tag = EDS
	}
    enable = {
        NOT = {
			OR = {
				eds_need_forward_airbases = yes
				check_variable = {resource@aluminium < 0}
				check_variable = {resource@steel < 20}
			}
		}
    }
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = arms_factory
		value = 400
	}
}


setup_airbases_before_war = {
    allowed = {
		tag = EDS
	}
    enable = {
        eds_need_forward_airbases = yes
    }
	abort_when_not_enabled = yes
    ai_strategy = {
		type = build_building
		id = air_base
		target = 27
		value = 6000
	}	
    ai_strategy = {
		type = build_building
		id = air_base
		target = 30
		value = 6000
	}
	ai_strategy = {
		type = build_building
		id = air_base
		target = 154
		value = 6000
	}
	ai_strategy = {
		type = build_building
		id = air_base
		target = 152
		value = 4
	}
}


#RESOURCE MANAGEMENT
eds_aluminium_shortages = {
	allowed = {
		tag = EDS
	}
    enable = {
        check_variable = {resource@aluminium < 0}
    }
	abort_when_not_enabled = yes
	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 6
		value = 30000
	}
	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 12
		value = 29000
	}
	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 102
		value = 28000
	}

	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 55
		value = 28000
	}
	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 50
		value = 28000
	}
}


eds_iron_shortages = {
	allowed = {
		tag = EDS
	}
    enable = {
        check_variable = {resource@steel < 20}
    }
	abort_when_not_enabled = yes
	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 9
		value = 30000
	}
	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 51
		value = 29000
	}
	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 12
		value = 28000
	}

	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 102
		value = 28000
	}

	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 7
		value = 28000
	}
	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 2
		value = 28000
	}
}


######################################
##########PRODUCTION MANAGEMENT###########
######################################

#################
#Shortage/Surplus covering#
#################
EDS_supply_truck_shortage = {
	allowed = {
		tag = EDS
	}
	enable = {
		check_variable = {num_equipment@motorized_equipment < 750}
	}
	abort_when_not_enabled = yes

	#tell AI to produce more
	ai_strategy = {
		type = equipment_production_min_factories
		id = motorized
		value = 9#Default is 2
	}
	#tell the AI to stockpile some stuffs
	ai_strategy = {
		type = save_equipment
		id = motorized_equipment
		value = 10
	}

	#then tell it to not go overboard
	ai_strategy = {
		type = equipment_variant_production_factor
		id = motorized_equipment
		value = 10#Default is -50
	}
}

EDS_supply_truck_overproduction = {
	allowed = {
		tag = EDS
	}
	enable = {
		check_variable = {num_equipment@motorized_equipment > 2000}
	}
	abort_when_not_enabled = yes
	#tell AI to produce more
	#ai_strategy = {
	#	type = equipment_production_min_factories
	#	id = motorized
	#	value = -2#Default is 2
	#}
	#ai_strategy = {
	#	type = equipment_variant_production_factor
	#	id = motorized_equipment
	#	value = -100
	#}
	ai_strategy = {
		type = equipment_production_factor
		id = motorized
		value = -9000
	}	
	ai_strategy = {
		type = wanted_supply_trucks
		value = -1000
	}	
	ai_strategy = {
		type = min_wanted_supply_trucks
		value = -1000
	}	
	
}

EDS_train_shortage = {
	allowed = {
		tag = EDS
	}
	enable = {
		check_variable = {num_equipment@train_equipment < 100}
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = equipment_production_min_factories
		id = train
		value = 9#5
	}
	ai_strategy = {
		type = equipment_variant_production_factor
		id = train_equipment
		value = 10
	}	
	ai_strategy = {
		type = equipment_production_factor
		id = train 
		value = 10
	}
	ai_strategy = {
		type = save_equipment
		id = train_equipment
		value = 10
	}
	#ai_strategy = {
	#	type = wanted_supply_trains
	#	#id = arms_factory
	#	value = 120
	#}
}

EDS_train_surplus = {
	allowed = {
		tag = EDS
	}
	enable = {
		check_variable = {num_equipment@train_equipment > 300}
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = equipment_production_min_factories
		id = train
		value = -5#5
	}
	ai_strategy = {
		type = equipment_variant_production_factor
		id = train_equipment
		value = -10
	}	
	ai_strategy = {
		type = equipment_production_factor
		id = train 
		value = -9000
	}
}

EDS_low_arty = {
	allowed = {
		tag = EDS
	}
	enable = {
		check_variable = {num_equipment@artillery_equipment < 200}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_variant_production_factor
		id = artillery_equipment 
		value = 40
	}
	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = 200
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = 2
	}
}

EDS_over_arty = {
	allowed = {
		tag = EDS
	}
	enable = {
		check_variable = {num_equipment@artillery_equipment > 500}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_variant_production_factor
		id = artillery_equipment 
		value = -400
	}
	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = -4000
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = -1
	}
}

#EDS_low_sup = {
#	allowed = {
#		tag = EDS
#	}
#	enable = {
#		check_variable = {num_equipment@support_equipment < 200}
#	}
#	abort_when_not_enabled = yes
#
#	ai_strategy = {
#		type = equipment_variant_production_factor
#		id = support_equipment 
#		value = 25
#	}
#}

EDS_over_sup = {
	allowed = {
		tag = EDS
	}
	enable = {
		check_variable = {num_equipment@support_equipment > 200}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_variant_production_factor
		id = support_equipment 
		value = -100
	}
	ai_strategy = {
		type = equipment_production_factor
		id = support 
		value = -1000
	}
}

#deprioritize other stuff if low guns
EDS_low_guns = {
	allowed = {
		tag = EDS
	}
	enable = {
		has_equipment = {
			infantry_equipment < 10000
		}
		#eds_tank_focus = no
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_variant_production_factor
		id = infantry_equipment 
		value = 40
	}
	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 40
	}
	ai_strategy = {
		type = equipment_variant_production_factor
		id = small_plane_airframe 
		value = -50
	}	
	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -50
	}
	ai_strategy = {
		type = equipment_variant_production_factor
		id = small_plane_cas_airframe
		value = -100
	}
	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = -100
	}
    ai_strategy = {
		type = air_factory_balance
		value = -100
	}
}

EDS_very_low_guns = {
	allowed = {
		tag = EDS
	}
	enable = {
		has_equipment = {
			infantry_equipment < 2000
		}
		#eds_tank_focus = no
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 40
	}
	ai_strategy = {
		type = save_equipment
		id = infantry_equipment
		value = 100
	}
	ai_strategy = {
		type = air_factory_balance
		value = -75
	}
}

EDS_many_guns_not_going_for_tonk = {
	allowed = {
		tag = EDS
	}
	enable = {
		has_equipment = {
			infantry_equipment > 20000
		}
		#eds_tank_focus = no
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_variant_production_factor
		id = infantry_equipment 
		value = -30
	}
	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = -30
	}
	ai_strategy = {
		type = equipment_variant_production_factor
		id = small_plane_airframe 
		value = 20
	}	
	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = 20
	}
	ai_strategy = {
		type = equipment_variant_production_factor
		id = small_plane_cas_airframe
		value = 50
	}
	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = 50
	}
    ai_strategy = {
		type = air_factory_balance
		value = 100
	}
}

#EDS_many_guns_divert_to_tonk = {
#	allowed = {
#		tag = EDS
#	}
#	enable = {
#		has_equipment = {
#			infantry_equipment > 20000
#		}
#		eds_tank_focus = yes
#	}
#	abort_when_not_enabled = yes
#
#	ai_strategy = {
#		type = equipment_variant_production_factor
#		id = infantry_equipment 
#		value = -30
#	}
#	ai_strategy = {
#		type = equipment_production_factor
#		id = infantry
#		value = -30
#	}
#	ai_strategy = {
#		type = equipment_production_factor
#		id = armor 
#		value = 50
#	}
#	ai_strategy = {
#		type = equipment_production_min_factories
#		id = armor
#		value = 20
#	}
#}


##########
#Base Priorities#
##########
EDS_base_factory_allocation = {
	allowed = {
        tag = EDS
    }
    enable = {
       	always = yes
    }
	abort_when_not_enabled = yes
	#Set minimum factory values, breaks when near zero, but meh, if it's near zero they've near lost.
	#ai_strategy = {
	#	type = equipment_production_min_factories
	#	id = infantry
	#	value = 8
	#}
	#ai_strategy = {
	#	type = equipment_production_min_factories
	#	id = artillery
	#	value = 1
	#}
	#ai_strategy = {
	#	type = equipment_production_min_factories
	#	id = motorized
	#	value = 2
	#}
	#ai_strategy = {
	#	type = equipment_production_min_factories
	#	id = train
	#	value = 2
	#}

	ai_strategy = {
		type = equipment_production_min_factories
		id = convoy
		value = 6
	}

	ai_strategy = {
		type = equipment_variant_production_factor
		id = support_equipment
		value = -120
	}

	#Disable certain planes
	ai_strategy = {
        type = equipment_production_factor
        id = naval_bomber
        value = -100
    }

    ai_strategy = {
        type = equipment_production_factor
        id = naval_bomber
        value = -100
    }

    ai_strategy = {
        type = equipment_production_factor
        id = tactical_bomber
        value = -100
    }

    ai_strategy = {
        type = equipment_production_factor
        id = strategic_bomber
        value = -100
    }    
}



EDS_plane_factory_allocation = {
    allowed = {
        tag = EDS
    }
    enable = {
        num_of_military_factories > 24
		#NOT = {eds_tank_focus = yes}
    }
	abort_when_not_enabled = yes

	##allocate the factories
	ai_strategy = {
		type = equipment_production_min_factories
		id = fighter
		value = 10
	}
	ai_strategy = {
		type = save_equipment
		id = small_plane_airframe
		value = 100
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 10
	}
	ai_strategy = {
		type = save_equipment
		id = small_plane_cas_airframe
		value = 100
	}

	##up the air priority since the AI never seems to care, but planes good
	ai_strategy = {
		type = equipment_variant_production_factor
		id = small_plane_airframe 
		value = 200
	}	
	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = 200
	}
	ai_strategy = {
		type = equipment_variant_production_factor
		id = small_plane_cas_airframe
		value = 250
	}
	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = 250
	}
    ai_strategy = {
		type = air_factory_balance
		value = 400
	}
}


main_EDS_unit_setup = {
	allowed = {
		tag = EDS
	}
	enable = {
		always = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = land_xp_spend_priority
		id = division_template
		value = 10000
	}

	ai_strategy = {
		type = role_ratio
		id = garrison
		value = 0
	}

	ai_strategy = {
		type = unit_ratio
		id = naval_bomber
		value = 0
	}
	
	ai_strategy = {
		type = garrison
		value = -100
	}

	ai_strategy = {
		type = equipment_stockpile_surplus_ratio
		value = -35.0
	}
    
}

eds_prep_war = {
	allowed = {
		tag = EDS
	}
	enable = {
		has_war = no
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = prepare_for_war
		id = EDS
		value = 3000
	}
    ai_strategy = {
		type = declare_war
		id = EDS			
		value = 3000 
	}
}



eds_build_inf_armies = {
	allowed = {
		tag = EDS
	}
	enable = {
		eds_should_build_infantry = yes
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = force_build_armies
		value = 100
	}
	#ai_strategy = {
	#	type = build_army
	#	id = infantry
	#	value = 200
	#}
}

#eds_build_tank_inf_armies = {
#	allowed = {
#		tag = EDS
#	}
#	enable = {
#		eds_should_build_infantry = yes
#	}
#	abort_when_not_enabled = yes
#	ai_strategy = {
#		type = force_build_armies
#		value = 100
#	}
#	ai_strategy = {
#		type = build_army
#		id = infantry
#		value = 200
#	}
#}

#eds_build_tank_armies = {
#	allowed = {
#		tag = EDS
#	}
#	enable = {
#		eds_should_build_tanks = yes
#	}
#	abort_when_not_enabled = yes
#	ai_strategy = {
#		type = force_build_armies
#		value = 100
#	}
#	ai_strategy = {
#		type = build_army
#		id = armor
#		value = 200
#	}
#	#ai_strategy = {
#	#	type = save_equipment
#	#	id = light_tank_chassis
#	#	value = -1000
#	#}
#}

eds_build_cav_armies = {
	allowed = {
		tag = EDS
	}
	enable = {
		has_equipment = {
			infantry_equipment > 15000
		}
		has_game_rule = { 
			rule = EDS_ai_behavior 
			option = CAVALRYRUSH
		}
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = force_build_armies
		value = 100
	}
	ai_strategy = {
		type = build_army
		id = cavalry
		value = 100
	}
}



















