armor_generic = {

	blocked_for = {
		GER
		JAP
		ENG
		USA
		ITA
		SOV
		HUN
		SIA
	}

	role = armor
	
	upgrade_prio = {
		base = 2

		modifier = {
			factor = 3
			OR = {
				has_tech = basic_medium_tank
				has_tech = basic_medium_tank_chassis
			}
		}
		
		modifier = {
			factor = 2
			OR = {
				has_tech = main_battle_tank
				has_tech = main_battle_tank_chassis
			}
		}
	}

	light_armor_early = {
		upgrade_prio = {
			base = 1

			modifier = {
				factor = 2
			}
		}
		
		can_upgrade_in_field = {
			has_equipment = { light_tank_chassis < 500 } 
		}
		
		target_template = {
			
			support = {
				engineer = 1
				mot_recon = 1
				artillery = 1
				anti_tank = 1
			}
			
			regiments = {
				light_armor = 5
				motorized = 4
			}
		}
		
		replace_at_match = 1.5  # value higher than 1.0 means it will only upgrade/replace when upgrade_prio takes over
		replace_with = medium_armor_early
		target_min_match = 0.5
	}


# TODO reintroduce a fortress buster role maybe?
#	heavy_armor_default = {
#		upgrade_prio = {
#			base = 2
#
#			modifier = {
#				factor = 1
#			}
#		}
#
#		target_width = 18.0
#		width_weight = 3.0
#		column_swap_factor = 0.1
#
#		stat_weights = {
#			0.00 #-- default_morale
#			1.10 #-- defense
#			1.10 #-- breakthrough
#			0.60 #-- hardness
#			2.00 #-- soft_attack
#			0.00 #-- hard_attack
#			0.10 #-- recon
#			0.01 #-- entrenchment
#			0.10 #-- initiative
#			0.01 #-- casualty_trickleback
#			-0.05 #-- supply_consumption_factor
#			-0.01 #-- supply_consumption
#			0.00 #-- suppression
#			0.00 #-- suppression_factor
#			0.01 #-- experience_loss_factor
#			0.00 #-- equipment_capture_factor
#			0.00 #-- fuel_capacity
#			#-- Air Values
#			0.02 #-- air_attack
#			#-- Common Values
#			10.00 #-- max_organisation
#			0.80 #-- max_strength
#			0.0 #-- maximum_speed
#			0.20 #-- armor_value
#			0.05 #-- ap_attack
#			0.10 #-- reliability
#			0.10 #-- reliability_factor
#			0.00 #-- weight
#			0.00 #-- fuel_consumption
#			0.00 #-- fuel_consumption_factor
#			0.00 #-- strat_attack
#			0.00 #-- carrier_size
#			0.00 #-- acc_hot_gain
#			0.00 #-- acc_cold_gain
#			0.00 #-- build_cost_ic
#		}
#
#		target_template = {
#			weight = 1.0
#			match_value = 1000.0
#
#			support = {
#				engineer = 1
#				recon = 1
#				logistics_company = 1
#				maintenance_company = 1
#			}
#
#			regiments = {
#				heavy_armor = 6
#				infantry = 3
#			}
#		}
#
#		replace_at_match = 0.4
#		replace_with = modern_armor_default
#		target_min_match = 0.5
#	}

	medium_armor_early = {
	
		upgrade_prio = {
			base = 1

			modifier = {
				factor = 3
				OR = {
					has_tech = basic_medium_tank
					has_tech = basic_medium_tank_chassis
				}
			}
		}

		target_template = {
			
			support = {
				engineer = 1
				mot_recon = 1
				maintenance_company = 1
				logistics_company = 1
			}
			
			regiments = {
				medium_armor = 4
				light_armor = 2
				motorized = 4
			}
		}
		
		replace_at_match = 1.5  # value higher than 1.0 means it will only upgrade/replace when upgrade_prio takes over
		replace_with = medium_armor_mid
		target_min_match = 0.5
	}

	medium_armor_mid = {
	
		upgrade_prio = {
			base = 1

			modifier = {
				factor = 4
				OR = {
					has_tech = improved_medium_tank
					has_tech = improved_medium_tank_chassis
				}
			}

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

		target_template = {
			
			support = {
				engineer = 1
				armored_car_recon = 1
				maintenance_company = 1
				logistics_company = 1
			}
			
			regiments = {
				medium_armor = 6
				motorized = 4
			}
		}
		
		replace_at_match = 1.5  # value higher than 1.0 means it will only upgrade/replace when upgrade_prio takes over
		replace_with = modern_armor_default
		target_min_match = 0.5
	}

	modern_armor_default = {
	
		upgrade_prio = {
			base = 1

			modifier = {
				factor = 5
				OR = {
					has_tech = main_battle_tank
					has_tech = main_battle_tank_chassis
				}
			}
		}

		target_template = {
			
			support = {
				engineer = 1
				light_tank_recon = 1
				maintenance_company = 1
				logistics_company = 1
				signal_company = 1
			}
			
			regiments = {
				modern_armor = 6
				mechanized = 4
				modern_sp_artillery_brigade = 1
			}
		}
	}
}

garrison_generic = {

	blocked_for = {
		GER
		JAP
		ENG
		USA
		ITA
		SOV
		HUN
		SIA
	}
	
	role = garrison
	
	upgrade_prio = {
		base = 0.5

		modifier = {
			factor = 20
			NOT = { ai_has_role_template = garrison }
		}
	}

	garrison_generic = {
		reinforce_prio = 0
		custom_icon = 7
	
		upgrade_prio = {
			base = 2

			modifier = {
				factor = 1
			}
		}
		
		target_template = {
			
			support = { 
				engineer = 1
			}
			
			regiments = {
				infantry = 4
			}
		}
	}
}

suppression_generic = {
	
	role = suppression
	blocked_for = {
		SIA
	}
	upgrade_prio = {
		base = 0.5

		modifier = {
			factor = 20
			has_war = yes
		}

		modifier = {
			factor = 50
			tag = GER
			OR = {
				AND = {
					has_completed_focus = GER_anschluss
					NOT = { ai_has_role_template = garrison }
				}

				AND = {
					any_country = {
						is_justifying_wargoal_against = ROOT
					}
					NOT = { ai_has_role_template = garrison }
				}
			}
		}
	}

	suppression_generic = {
	
		reinforce_prio = 0
		custom_icon = 13
	
		upgrade_prio = {
			base = 2
		}
		
		target_template = {
			
			support = { 
				military_police = 1
			}

			regiments = {
				cavalry = 4
			}
		}
	}
}

infantry_generic = {

	blocked_for = {
		GER
		JAP
		ENG
		USA
		ITA
		SOV
		HUN
		CHI
		PRC
		GXC
		YUN
		SHX
		HCH
		SND
		XSM
		SIK
		MEN
		MAN
		SIA
	}

	role = infantry
	
	upgrade_prio = {
		base = 5
	}
	
	infantry_early = {
	
		upgrade_prio = {
			base = 1

			modifier = {
				factor = 2
			}
		}
		
		target_template = {
			
			support = {
				engineer = 1
				recon = 1
				logistics_company = 1
				anti_air = 1
				artillery = 1
			}
			
			regiments = {
				infantry = 9
				artillery_brigade = 1
			}
		}

		replace_at_match = 1.5  # value higher than 1.0 means it will only upgrade/replace when upgrade_prio takes over
		replace_with = infantry_improved
		target_min_match = 0.9
	}

	infantry_mid = {

		upgrade_prio = {
			base = 1

			modifier = {
				factor = 3
				date > 1940.1.1
			}
		}
		
		target_template = {
			
			support = {
				engineer = 1
				recon = 1
				logistics_company = 1
				anti_air = 1
				anti_tank = 1
			}
			
			regiments = {
				infantry = 9
				artillery_brigade = 2
			}
		}
	}
}

mountaineers_generic = {

	blocked_for = {
		GER
		JAP
		ENG
		USA
		ITA
		SOV
		SIA
	}

	role = mountaineers
	
	upgrade_prio = {
		base = 2

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

	mountaineers_default = {
	
		upgrade_prio = {
			base = 1

			modifier = {
				factor = 1
			}
		}

		target_template = {
			
			support = {
				engineer = 1
				artillery = 1
				anti_tank = 1
				logistics_company = 1
			}
			
			regiments = {
				mountaineers = 8
				artillery_brigade = 2
			}
		}
	}
}

marines_generic = {

	blocked_for = {
		GER
		JAP
		ENG
		USA
		ITA
		SOV
	}

	role = marines
	
	upgrade_prio = {
		base = 2

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

	marine_default = {
	
		upgrade_prio = {
			base = 1

			modifier = {
				factor = 1
			}
		}

		target_template = {
			
			support = {
				recon = 1
				logistics_company = 1
			}
			
			regiments = {
				marine = 9
			}
		}
	}
	marine_armored = {
	
		upgrade_prio = {
			base = 3

			modifier = {
				factor = 0

				# disable if we are missing either of amph mech inf or amph tank
				OR = {
					NOT = {
						has_tech = amphibious_mechanized_infantry
					}
					NOT = {
						OR = {
							has_tech = amphibious_tank
							has_tech = amphibious_tank_chassis
						}
					}
				}

			}
			modifier = {
				is_major = no
				factor = 0
			}
		}

		target_template = {
			
			support = {
				recon = 1
				logistics_company = 1
				engineer = 1
			}
			
			regiments = {
				amphibious_armor = 4
				amphibious_mechanized = 6
			}
		}
	}
}


paratrooper_generic = {

	blocked_for = {
		GER
		JAP
		ENG
		USA
		ITA
		SOV
	}

	role = paratroopers
	
	upgrade_prio = {
		base = 2

		modifier = {
			factor = 0
			NOT = {
				has_tech = paratroopers
			}
		}
	}
	
	paratrooper_default = {
	
		upgrade_prio = {
			base = 1

			modifier = {
				factor = 1
			}
		}

		target_template = {
			
			support = {
				engineer = 1
				artillery = 1
				anti_tank = 1
			}
			
			regiments = {
				paratrooper = 9
			}
		}
	}
}

landcruiser_generic = {


	role = mega_heavy_breakthrough_role
	
	upgrade_prio = {
		base = 2

		modifier = {
			factor = 0
			NOT = { is_special_project_completed = sp:sp_land_land_cruiser }
		}
	}
	 
	landcruiser_default = {
	
		upgrade_prio = {
			base = 1

			modifier = {
				factor = 1
			}
		}

		target_template = {
			
			support = {
				engineer = 1
				land_cruiser = 1
				anti_air = 1
			}
			
			regiments = {
				medium_armor = 2
				heavy_armor = 1
				motorized = 6
			}
		}
	}
}

super_heavy_generic = {


	role = super_heavy_breakthrough_role
	
	upgrade_prio = {
		base = 0

		modifier = {
			add = 1
			is_major = yes
			num_of_military_factories > 150 # nly if we have loads of factories
			date > 1943.6.1 # Lets wait until late war
			NOT = { has_tech = main_battle_tank_chassis } # Abandon Super heavy projects if we start doing modern tanks instead
			NOT = { has_government = democratic } # Let the authoritarian regimes spend money on this 
		}

		modifier = {
			factor = 0
			is_special_project_completed = sp:sp_land_land_cruiser # Lets stop this if and when we have landcruisers
		}
	}
	 
	super_heavy_default = {
	
		upgrade_prio = {
			base = 1

			modifier = {
				factor = 1
			}
		}

		target_template = {
			
			support = {
				engineer = 1
				anti_air = 1
				super_heavy_armor = 1
			}
			
			regiments = {
				medium_armor = 2
				motorized = 6
			}
		}
	}
}



# Non-complete list of sub-units

# REGIMENTS:
# - infantry
# - light_armor
# - medium_armor
# - heavy_armor
# - super_heavy_armor
# - modern_armor
# - cavalry
# - motorized
# - mechanized
# - marine
# - mountaineers
# - paratrooper
# - artillery_brigade
# - anti_air_brigade
# - anti_tank_brigade
# - light_tank_destroyer_brigade
# - medium_tank_destroyer_brigade
# - heavy_tank_destroyer_brigade
# - super_heavy_tank_destroyer_brigade
# - modern_tank_destroyer_brigade
# - light_sp_anti_air_brigade
# - light_sp_artillery_brigade

# SUPPORT:
# - engineer
# - recon
# - signal_company
# - maintenance_company
# - artillery
# - anti_air
# - anti_tank
# - field_hospital
# - logistics_company
# - military_police
# - rocket_artillery
