CES_unit_production = {
	allowed = { 
		original_tag = CES
	}
	enable = {
		always = yes
	}
	abort = {
		always = no
	}
	
	ai_strategy = {
		type = role_ratio
		id = garrison
		value = 5
	}
	
	ai_strategy = {
		type = role_ratio
		id = paratroopers
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = mountaineers
		value = 5
	}

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

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

	ai_strategy = {
		type = role_ratio
		id = motorized
		value = 5 #because doctrine this = 2
	}

	ai_strategy = {
		type = role_ratio
		id = mechanized
		value = -5 #because doctrine this = 0
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 20 #because doctrine this = 10
	}

	ai_strategy = {
		type = role_ratio
		id = infantry
		value = 70 #88 to 70
	}
	
	#Air unit factors
	ai_strategy = {
		type = unit_ratio
		id = fighter
		value = 50
	}
	
	ai_strategy = {
		type = unit_ratio
		id = cas
		value = 15 #because doctrine this = 15
	}
	
	ai_strategy = {
		type = unit_ratio
		id = tactical_bomber
		value = 5
	}
	
	ai_strategy = {
		type = unit_ratio
		id = strategic_bomber
		value = -10
	}
	
	ai_strategy = {
		type = unit_ratio
		id = naval_bomber
		value = -25
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = 10
	}

	ai_strategy = {
		type = equipment_production_factor
		id = strategic_bomber
		value = -10
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 20 #30 to 50
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = 20 #20 to 40
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = armor
		value = 20
	}
	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = artillery_equipment
		value = 1
	}
	#ai_strategy = {
	#	type = equipment_production_min_factories
	#	id = fighter
	#	value = 3
	#}
	ai_strategy = {
		type = equipment_variant_production_factor
		id = large_plane_airframe
		value = -100
	}
}	



CES_armored_production = {
	allowed = {
		original_tag = CES
	}
	enable = {
		ai_wants_divisions > 24 #Decreasing the amount of tanks the AI wants
	}
	abort = {
		ai_wants_divisions < 25 #Decreasing the amount of tanks the AI wants
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 5
	}
}

CES_shift_production = {
	allowed = {
		original_tag = CES
	}
	enable = {
		has_equipment = { infantry_equipment > 5000 }
	}
	abort = {
		has_equipment = { infantry_equipment < 5000 }	
	}

	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = -25
	}
}

CES_halt_light_armor_production_in_transitioning = {
	allowed = {
		original_tag = CES
	}
	enable = {
		has_template_majority_unit = medium_armor
		OR = {
			has_equipment = { light_tank_chassis > 600 }
			date > 1939.1.1
		}		
	}
	abort = {
		always = no  # once we start we never go back to light armor
	}

	ai_strategy = {
		type = equipment_variant_production_factor
		id = light_tank_chassis
		value = -100
	}
}


CES_highered_armored_production = {
	allowed = { original_tag = CES }
	enable = {
		num_of_military_factories > 19
	}
	abort = {
		num_of_military_factories < 20
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 10
	}
}

CES_dont_waste_xp_until_medium_armor = {

	allowed = { original_tag = CES	}	
	enable = {
		always = yes
	}

	abort = {	
		has_template_majority_unit = medium_armor
	}

	ai_strategy = {
		type = template_prio
		id = paratrooper
		value = -100
	}

	ai_strategy = {
		type = template_prio
		id = mountaineers
		value = -100
	}
}

CES_super_boost_light_for_med_armor = {

	allowed = { original_tag = CES }
	
	enable = {
		OR = {
			has_tech = basic_medium_tank
			has_tech = basic_medium_tank_chassis
		}
		NOT = { has_template_ai_majority_unit = medium_armor }
	}

	abort = {	
		has_template_ai_majority_unit = medium_armor
	}

	# lets do changes more often during this period too
	ai_strategy = {
		type = land_xp_spend_priority
		id = division_template
		value = 100
	}

	# this is gateway
	ai_strategy = {
		type = template_prio
		id = light_armor
		value = 100
	}

	ai_strategy = {
		type = template_prio
		id = medium_armor
		value = 150
	}
	
	# Germany is set up to change their SS division into medium armor.
	ai_strategy = {
		type = template_prio
		id = motorized
		value = 200
	}
}

CES_super_boost_light_for_modern_armor = {
	
	allowed = { original_tag = CES }
	enable = {
		OR = {
			has_tech = main_battle_tank
			has_tech = main_battle_tank_chassis
		}
		NOT = { has_template_ai_majority_unit = modern_armor }
	}

	abort = {	
		has_template_ai_majority_unit = modern_armor
	}

	# lets do changes more often during this period too
	ai_strategy = {
		type = land_xp_spend_priority
		id = division_template
		value = 100
	}

	# this is gateway
	ai_strategy = {
		type = template_prio
		id = medium_armor
		value = 100
	}

	ai_strategy = {
		type = template_prio
		id = modern_armor
		value = 150
	}
}


CES_template_design = {
	allowed = { original_tag = CES }
	enable = {
	
		date < 1940.1.1				
	}
	abort = { 
		date > 1940.1.1
	}

	ai_strategy = {
		type = template_prio
		id = motorized
		value = -50
	}

	ai_strategy = {
		type = template_prio
		id = cavalry
		value = -100
	}
	
	ai_strategy = {
		type = template_prio
		id = light_armor
		value = 30
	}

	ai_strategy = {
		type = template_prio
		id = medium_armor
		value = 50
	}

	ai_strategy = {
		type = template_prio
		id = heavy_armor
		value = -50
	}

	ai_strategy = {
		type = template_prio
		id = paratroopers
		value = -50
	}
}
CES_industry = {
	allowed = { original_tag = CES }
	enable = {
		date < 1940.1.1
		date > 1936.1.1
	}
	abort={
		date > 1940.1.1
	}

	ai_strategy = {
		type = added_military_to_civilian_factory_ratio
		value = 50
	}
}

CES_tank_export = { #TONKS
	allowed = {
		original_tag = CES
	}
	enable = {
		has_dlc = "Arms Against Tyranny"
		GER = {
			has_war = no
		}
		has_war = no
		controls_state = 69 #Sudetenland
		controls_state = 972 #Southern Sudetenland
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories
		id = armor
		value = 2
	}
	ai_strategy = {
		type = equipment_variant_production_factor
		id = light_tank_chassis
		value = 50
	}
	ai_strategy = {
		type = equipment_market_for_sale_factor
		id = armor
		value = 150
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = armor
		value = 10
	}
}

CES_historical_already_got_our_tanks_mate = {
	allowed = {
		original_tag = CES
	}
	abort_when_not_enabled = yes
	
	enable = {
		has_dlc = "Arms Against Tyranny"
		is_historical_focus_on = yes
	}
	ai_strategy = {
		type = role_ratio
		id = armor
		value = -25 #because doctrine this = 10
	}
}

CES_german_ally = {
	allowed = {
		original_tag = CES
	}
	enable = {
		country_exists = GEM
	}
	abort = {
		NOT = { country_exists = GEM }
	}

	ai_strategy = {
		type = befriend
		id = GEM
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = GEM
		value = 200
	}
}