armored_SOV = {
	
	role = armor

	available_for = {
		SOV
	}	
	upgrade_prio = {
		factor = 2000
	}

	medium_armor_standard_SOV = {

		upgrade_prio = {
			factor = 5000

			modifier = {
				factor = 0
				can_equip_mech = yes
				SOV_can_swap_to_mech_tank = yes
			}
		}


		target_template = {
			support = {
				medium_flame_tank = 1
				anti_air = 1
				logistics_company = 1
				artillery = 1
				engineer = 1
			}

			regiments = {
				medium_armor = 8
				infantry = 9
				anti_tank_brigade = 1
			}
		}
	}

	medium_armor_standard_SOV_upgrade = {

		upgrade_prio = {
			factor = 8000

			modifier = {
				factor = 0
				OR = {
					can_equip_mech = no
					SOV_can_swap_to_mech_tank = no
				}
			}
			modifier = {
				factor = 0
				has_ranger = yes
			}
		}


		target_template = {
			support = {
				medium_flame_tank = 1
				anti_air = 1
				logistics_company = 1
				artillery = 1
				engineer = 1
			}

			regiments = {
				medium_armor = 8
				mechanized = 9
				mot_anti_tank_brigade = 1
			}
		}
	}

	medium_armor_standard_SOV_upgrade_2 = {

		upgrade_prio = {
			factor = 15000
			#modifier = {
			#	factor = 0
			#	SOV_is_tank_build = no
			#}

			modifier = {
				factor = 0
				OR = {
					can_equip_mech = no
					SOV_can_swap_to_mech_tank = no
				}
			}
			modifier = {
				factor = 0
				has_ranger = no
			}
		}


		target_template = {
			support = {
				medium_flame_tank = 1
				anti_air = 1
				logistics_company = 1
				rangers_support = 1
				engineer = 1
			}

			regiments = {
				medium_armor = 8
				mechanized = 9
				mot_anti_tank_brigade = 1
			}
		}
	}

	heavy_armor_no_nsb = {

		upgrade_prio = {
			factor = 1000
	
			modifier = {
				factor = 0
				has_dlc = "No Step Back"
			}

			modifier = {
				factor = 0.2
				date > 1942.5.1
			}
		}


		target_template = {
			support = {
				artillery = 1
				field_hospital = 1
				logistics_company = 1
				anti_air = 1
				engineer = 1
			}

			regiments = {
				heavy_armor = 8
				motorized = 8
				mot_anti_tank_brigade = 1
			}
		}
	}

	heavy_armor_no_nsb_late = {

		upgrade_prio = {
			factor = 1550
	
			modifier = {
				factor = 0
				has_dlc = "No Step Back"
			}

			modifier = {
				factor = 5
				date > 1942.5.1
			}
		}

		can_upgrade_in_field = {
			has_equipment = { mechanized_equipment > 500 }
		}

		target_template = {
			support = {
				artillery = 1
				field_hospital = 1
				logistics_company = 1
				anti_air = 1
				engineer = 1
			}

			regiments = {
				heavy_armor = 8
				mechanized = 8
				mot_anti_tank_brigade = 1
			}
		}
	}
}

infantry_SOV = {
	
	role = infantry

	available_for = {
		SOV
	}

	upgrade_prio = {
		factor = 1000
	}
	infantry_default_SOV = {

		upgrade_prio = {
			factor = 1000

			modifier = {
				factor = 0
				OR = { 
					num_of_military_factories > 100
					date > 1939.1.1
					has_country_flag = mobile_warfare_roach_1
					has_country_flag = mobile_warfare_roach_2
					has_country_flag = pure_infantry
				}
			}
			
			modifier = {
				factor = 0
				OR = {
					AND = {
						has_country_flag = spacemarine
						has_army_manpower = { size < 1500000 }
					}
					AND = {
						has_country_flag = mech_brick
						has_army_manpower = { size < 2000000 }
					}
				}
			}
		}
		target_template = {
			support = {
				engineer = 1
				anti_air = 1
				logistics_company = 1
				artillery = 1
				anti_tank = 1
			}

			regiments = {
				infantry = 9
			}
		}
	}

	standard_mass_infantry = {

		upgrade_prio = {
			factor = 1000

			modifier = {
				factor = 0
				NOT = { has_country_flag = mass_assault_standard }
			}
		}

		target_template = {
			support = {
				engineer = 1
				artillery = 1
				field_hospital = 1
				rangers_support = 1
				logistics_company = 1
			}

			regiments = {
				infantry = 19
				anti_air_brigade = 1
				anti_tank_brigade = 1
			}
		}
	}

	anti_tank_true = {

		upgrade_prio = {
			factor = 1000

			modifier = {
				factor = 0
				NOT = { has_country_flag = mass_assault_meatwall }
			}

		}

		target_template = {
			support = {
				engineer = 1
				logistics_company = 1
				artillery = 1
				anti_air = 1
				rangers_support = 1
			}

			regiments = {
				infantry = 10
				anti_tank_brigade = 1
			}
		}
	}

	artillery_battalion = {

		upgrade_prio = {
			factor = 1000

			modifier = {
				factor = 0
				NOT = { has_country_flag = superior_firepower_high }
			}
		}
		target_template = {
			support = {
				engineer = 1
				artillery = 1
				anti_air = 1
				rangers_support = 1
				logistics_company = 1
			}

			regiments = {
				infantry = 13
				anti_tank_brigade = 1
				artillery_brigade = 3
			}
		}
	}

	super_roach_infantry = {

		upgrade_prio = {
			factor = 1000

			modifier = {
				factor = 0
				NOT = { has_country_flag = mobile_warfare_roach_1 }
			}
		}
		target_template = {
			support = {
				logistics_company = 1
				signal_company = 1
				artillery = 1
			}

			regiments = {
				anti_air_brigade = 1
				infantry = 7
			}
		}
	}

	super_roach_infantry2 = {

		upgrade_prio = {
			factor = 1000

			modifier = {
				factor = 0
				NOT = { has_country_flag = mobile_warfare_roach_2 }
			}
		}

		target_template = {

			regiments = {
				infantry = 3
			}
		}
	}

	very_basic_infantry = {

		upgrade_prio = {
			factor = 1000

			modifier = {
				factor = 0
				OR = {
					NOT = { has_country_flag = superior_firepower_low }
					has_equipment = { support_equipment > 5000 }
				}
			}
		}

		target_template = {
			support = {
				artillery = 1
				anti_air = 1
				anti_tank = 1
				rangers_support = 1 
			}

			regiments = {
				infantry = 8
			}
		}
	}

	very_basic_infantry_2 = {

		upgrade_prio = {
			factor = 1000

			modifier = {
				factor = 0
				OR = {
					NOT = { has_country_flag = superior_firepower_low }
					has_equipment = { support_equipment < 5000 }
				}
			}
		}

		target_template = {
			support = {
				artillery = 1
				anti_air = 1
				anti_tank = 1
				rangers_support = 1 
				engineer = 1
			}

			regiments = {
				infantry = 8
			}
		}
	}

	SFP_mech_infantry = {

		upgrade_prio = {
			factor = 1000

			modifier = {
				factor = 0
				NOT = { has_country_flag = superior_firepower_mech }
			}
		}

		target_template = {
			support = {
				logistics_company = 1
				artillery = 1
				engineer = 1
				anti_air = 1
				rangers_support = 1 
			}

			regiments = {
				mechanized = 7
			}
		}
	}

	infantry_GBP_35 = {

		upgrade_prio = {
			factor = 1000

			modifier = {
				factor = 0
				NOT = { has_country_flag = grand_battleplan_35w }
			}
		}

		target_template = {
			support = {
				engineer = 1
				rangers_support = 1
				artillery = 1
				signal_company = 1
				logistics_company = 1
			}

			regiments = {
				anti_tank_brigade = 1
				anti_air_brigade = 1
				artillery_brigade = 3
				infantry = 12
			}
		}
	}

	infantry_GBP_30 = {

		upgrade_prio = {
			factor = 1000

			modifier = {
				factor = 0
				NOT = { has_country_flag = grand_battleplan_30w }
			} 
		}

		target_template = {
			support = {
				engineer = 1
				rangers_support = 1
				artillery = 1
				logistics_company = 1
				signal_company = 1
			}

			regiments = {
				anti_tank_brigade = 1
				anti_air_brigade = 1
				artillery_brigade = 2
				infantry = 12
			}
		}
	}

	infantry_GBP_15 = {

		upgrade_prio = {
			factor = 1000

			modifier = {
				factor = 0
				OR = {
					NOT = { has_country_flag = grand_battleplan_15w }
					has_equipment = { support_equipment > 5000 }
				}
			} 
		}
		target_template = {
			support = {
				artillery = 1
				logistics_company = 1
				anti_tank = 1
			}

			regiments = {
				anti_air_brigade = 1
				infantry = 7
			}
		}
	}

	infantry_GBP_15_2 = {

		upgrade_prio = {
			factor = 1000

			modifier = {
				factor = 0
				OR = {
					NOT = { has_country_flag = grand_battleplan_15w }
					has_equipment = { support_equipment < 5000 }
				}
			} 
		}
		target_template = {
			support = {
				artillery = 1
				logistics_company = 1
				anti_tank = 1
				engineer = 1
			}

			regiments = {
				anti_air_brigade = 1
				infantry = 7
			}
		}
	}

	SOV_spacemarine_no_logi = {

		upgrade_prio = {
			factor = 2000
			
			modifier = {
				factor = 0
				OR = {
					NOT = { has_country_flag = spacemarine }
					has_army_manpower = { size < 1500000 }
					date < 1939.1.1
				}
			}
			
			modifier = {
				factor = 0
				has_logistics = yes
			}
		}
		
		target_template = {
			support = {
				engineer = 1
				artillery = 1
				field_hospital = 1
				anti_air = 1
				rangers_support = 1
			}
			
			regiments = {
				heavy_tank_destroyer_brigade = 1
				infantry = 8
			}
		}
	}
	SOV_spacemarine = {

		upgrade_prio = {
			factor = 2000
			
			modifier = {
				factor = 0
				OR = {
					NOT = { has_country_flag = spacemarine }
					has_army_manpower = { size < 1500000 }
					date < 1939.1.1
				}
			}
			
			modifier = {
				factor = 0
				has_logistics = no
			}
		}
		
		target_template = {
			support = {
				engineer = 1
				logistics_company = 1
				field_hospital = 1
				anti_air = 1
				artillery = 1
			}
			
			regiments = {
				heavy_tank_destroyer_brigade = 1
				infantry = 8
			}
		}
	}

	spacemarine_infantry_tier = {

		upgrade_prio = {
			factor = 1000

			modifier = {
				factor = 0
				OR = {
					NOT = { has_country_flag = spacemarine }
					NOT = { has_country_flag = tank_is_good }
				}
			}
		}
		target_template = {
			support = {
				engineer = 1
				rangers_support = 1
				artillery = 1
				anti_air = 1
				logistics_company = 1
			}
			
			regiments = {
				heavy_tank_destroyer_brigade = 1
				mechanized = 7
				light_tank_destroyer_brigade = 10
			}
		}
	}

	SOV_mech_brick = {

		upgrade_prio = {
			factor = 1000

			modifier = {
				factor = 0
				OR = {
					NOT = { has_country_flag = mech_brick }
					has_army_manpower = { size < 2000000 }
				}
			} 
		}
		
		target_template = {
			support = {
				engineer = 1
				rangers_support = 1
				field_hospital = 1
				anti_tank = 1
				logistics_company = 1
			}
			
			regiments = {
				mot_anti_tank_brigade = 1
				mot_anti_air_brigade = 1
				mechanized = 11
			}
		}
		
	}

	SOV_pure_infantry = {

		upgrade_prio = {
			factor = 25000

			modifier = {
				factor = 0
				OR = {
					NOT = { has_country_flag = pure_infantry }
					has_tech = tech_logistics_company
					has_country_flag = pure_infantry_no_air
				}
			} 
		}
		target_template = {
			support = {
				engineer = 1
				medium_flame_tank = 1
				field_hospital = 1
				rangers_support = 1
				artillery = 1
			}
			
			regiments = {
				infantry = 20
				anti_air_brigade = 2
				anti_tank_brigade = 1
			}
		}
	}

	SOV_pure_infantry_2 = {

		upgrade_prio = {
			factor = 25000

			modifier = {
				factor = 0
				OR = {
					NOT = { has_country_flag = pure_infantry }
					NOT = { has_tech = tech_logistics_company }
					has_country_flag = pure_infantry_no_air
				}
			} 
		}
		target_template = {
			support = {
				engineer = 1
				medium_flame_tank = 1
				field_hospital = 1
				rangers_support = 1
				logistics_company = 1
			}
			
			regiments = {
				infantry = 20
				anti_air_brigade = 2
				anti_tank_brigade = 1
			}
		}
	}

	SOV_pure_infantry_less_air = {

		upgrade_prio = {
			factor = 25000

			modifier = {
				factor = 0
				OR = {
					NOT = { has_country_flag = pure_infantry }
					has_ranger = yes
					NOT = { has_country_flag = pure_infantry_no_air }
				}
			} 
		}
		target_template = {
			support = {
				engineer = 1
				medium_flame_tank = 1
				field_hospital = 1
				artillery = 1
				anti_air = 1
			}
			
			regiments = {
				infantry = 20
				heavy_tank_destroyer_brigade = 1
			}
		}
	}

	SOV_pure_infantry_less_air_2 = {

		upgrade_prio = {
			factor = 25000

			modifier = {
				factor = 0
				OR = {
					NOT = { has_country_flag = pure_infantry }
					has_ranger = no
					NOT = { has_country_flag = pure_infantry_no_air }
				}
			} 
		}
		target_template = {
			support = {
				anti_air = 1
				medium_flame_tank = 1
				field_hospital = 1
				rangers_support = 1
				logistics_company = 1
			}
			
			regiments = {
				infantry = 20
				heavy_tank_destroyer_brigade = 1
			}
		}
	}
}


garrison_SOV = {
	
	role = garrison

	available_for = {
		SOV
	}

	upgrade_prio = {
		factor = 80
	}
	garrison_SOV = {

		upgrade_prio = {
			factor = 1

			modifier = {
				factor = 15
			}
		}

		reinforce_prio = 0
		custom_icon = 7

		target_template = {
			support = {
				military_police = 1
			}

			regiments = {
				cavalry = 10
			}
		}
	}
}


anti_armor_SOV = {
	
	role = motorized

	available_for = {
		SOV
	}

	upgrade_prio = {
		factor = 10

		modifier = {
			factor = 30
			any_enemy_country = {
				ROOT = {
					estimated_intel_max_armor = {
						tag = PREV
						value > 20
					}
				}
			}
		}

		modifier = {
			factor = 0
			has_country_flag = mass_assault_meatwall
		}
			
		modifier = {
			factor = 0
			has_country_flag = spacemarine
		}
			
		modifier = {
			factor = 0
			has_country_flag = mech_brick
			date > 1942.1.1
		}
	}
	infantry_anti_tank_SOV = {

		upgrade_prio = {
			factor = 20

			modifier = {
				factor = 3
				has_tech = interwar_antitank
				any_enemy_country = {
					ROOT = {
						estimated_intel_max_armor = {
							tag = PREV
							value > 20
						}
					}
				}
			}

			modifier = {
				factor = 0
				has_country_flag = mass_assault_meatwall
			}
			
			modifier = {
				factor = 0
				has_country_flag = spacemarine
			}
			
			modifier = {
				factor = 0
				has_country_flag = mech_brick
				date > 1940.1.1 #only do some at the start
			}
		}
		target_template = {
			support = {
				engineer = 1
				artillery = 1
				anti_tank = 1
				anti_air = 1
			}

			regiments = {
				infantry = 9
			}
		}
	}

	SOV_mech_brick_AT = {
	
		upgrade_prio = {
			factor = 200
			
			modifier = {
				factor = 0
				OR = {
					NOT = { has_country_flag = mech_brick }
					date < 1940.1.1
				}
			}
		}

		can_upgrade_in_field = {
			has_equipment = { mechanized_equipment > 200 }
		}
		target_template = {
			support = {
				engineer = 1
				anti_air = 1
				field_hospital = 1
				anti_tank = 1
				logistics_company = 1
			}
			
			regiments = {
				mechanized = 11
				mot_anti_tank_brigade = 1
			}
		}
	}
}

paratrooper_SOV = {
	
	role = paratroopers

	available_for = {
		SOV
	}
	
	upgrade_prio = {
		factor = 25

		modifier = {
			factor = 0
			NOT = {
				has_tech = paratroopers
			}
		}

		modifier = {
			factor = 0
			has_country_flag = grand_battleplan_15w
		}
	}
	paratrooper_no_dlc = {
	
		upgrade_prio = {
			factor = 2000
			modifier = {
				factor = 0
				has_dlc = "Arms Against Tyranny"
				has_dlc = "No Step Back"
			}
		}

		target_template = {
			support = {
				engineer = 1
				field_hospital = 1
				artillery = 1
				logistics_company = 1
				recon = 1
			}
			
			regiments = {
				paratrooper = 17
				anti_tank_brigade = 1
				anti_air_brigade = 1
			}
		}
	}
	paratrooper_default = {
	
		upgrade_prio = {
			factor = 2000

			modifier = {
				factor = 0
				date > 1943.1.1
			}
			modifier = {
				factor = 0
				OR = {
					NOT = { has_dlc = "Arms Against Tyranny" }
					NOT = { has_dlc = "No Step Back" }
				}
			}
		}

		target_template = {
			support = {
				engineer = 1
				field_hospital = 1
				artillery = 1
				logistics_company = 1
				rangers_support = 1
			}
			
			regiments = {
				paratrooper = 17
				anti_tank_brigade = 1
				anti_air_brigade = 1
			}
		}
	}
	
	paratrooper_upgrade = {
	
		upgrade_prio = {
			factor = 2000

			modifier = {
				factor = 0
				date < 1943.1.1
			}
			modifier = {
				factor = 0
				OR = {
					NOT = { has_dlc = "Arms Against Tyranny" }
					NOT = { has_dlc = "No Step Back" }
				}
			}
		}

		target_template = {
			support = {
				artillery = 1
				field_hospital = 1
				rangers_support = 1
				logistics_company = 1
				medium_flame_tank = 1
			}
			
			regiments = {
				paratrooper = 17
				anti_tank_brigade = 1
				anti_air_brigade = 1
			}
		}
	}
}

paratrooper_SOV_tank = {
	
	role = paratroopers

	available_for = {
		SOV
	}
	
	upgrade_prio = {
		factor = 25

		modifier = {
			factor = 0
			NOT = {
				has_tech = paratroopers
			}
		}
		modifier = {
			factor = 0
			OR = {
				NOT = { has_dlc = "Arms Against Tyranny" }
				NOT = { has_dlc = "No Step Back" }
			}
		}

		modifier = {
			factor = 0
			NOT = {
				has_country_flag = grand_battleplan_15w
			}
		}
	}
	paratrooper_default = {
	
		upgrade_prio = {
			factor = 2000
		}

		target_template = {
			support = {
				medium_flame_tank = 1
				field_hospital = 1
				anti_air = 1
				logistics_company = 1
				engineer = 1
			}
			
			regiments = {
				paratrooper = 13
				medium_armor = 5
			}
		}
	}
}
	# REGIMENTS:
	#infantry
	#light_armor
	#super_heavy_tank_destroyer_brigade
	#modern_armor
	#heavy_tank_destroyer_brigade
	#medium_armor
	#light_armor
	#anti_tank
	#cavalry
	#motorized
	#mechanized
	#marine
	#mountaineers
	#paratrooper
	#rocket_artillery
	#light_tank_destroyer
	#anti_air
	#artillery

	# SUPPORT:
	#engineer
	#recon
	#signal_company
	#maintenance_company
	#anti_tank_brigade
	#anti_air_brigade
	#artillery_brigade
	#field_hospital
	#logistics_company
	#military_police
	#light_sp_anti_air_brigade
	#light_sp_artillery_brigade
