# By 北风☭, 1.15.1
#####地面部队配比与装备生产#####
 ##@陆军构成设定@##
#固定配置#

#你必须有个固定比例池后再弄调整，记住，如果ai同时适用两个比例会出现bug，所以最好的办法就是把其他的删掉然后统一用一个#
#ai步坦#
default_unit_production = {
	enable = {
        always = yes 
	}
    abort_when_not_enabled = yes
	ai_strategy = {
		type = role_ratio
		id = armor_infantry
		value = 200
	}
    ai_strategy = { #added to railway gun define (set to 0 by default, increased in default strategies)
		type = railway_gun_divisions_ratio
		value = 0
	}
}
#force_unit_production = {
#	enable = {
#		num_of_military_factories > 150
#		num_divisions < 1000
#	}
#	abort_when_not_enabled = yes
#	ai_strategy = { type = build_army id = armor_infantry value = 999 }
#}
#ai全主力#
most_tank_mec = {
	enable = {
		num_of_military_factories > 199
        has_tech = amphibious_mechanized_infantry 
	}
    abort_when_not_enabled = yes
    ai_strategy = {
		type = role_ratio
		id = mec_marine
		value = 50
	}
    ai_strategy = { #added to railway gun define (set to 0 by default, increased in default strategies)
		type = railway_gun_divisions_ratio
		value = 0
	}
}


##@后勤与部署设定@##
#让小卡拉米强制拉部署#
force_unit_pro = {
	allowed = { 
		or = { has_completed_focus = production_effort is_major = no }
	}
	enable = {
		date > 1936.5.1
	}
	abort = { num_divisions > 50 }
	
	ai_strategy = {
        type = force_build_armies
        value = 300
    }
    ai_strategy = {
		type = ai_wanted_divisions_factor
		value = 300
	}  
}
#兵够了，该屯点装备了#
force_equip = {
	allowed = { 
		or = { has_completed_focus = production_effort is_major = no }
	}
	enable = {
		num_divisions > 50
	}
	abort_when_not_enabled = yes
        ai_strategy = {
		type = equipment_stockpile_surplus_ratio #装备盈余/赤字率，全局定义默认为0.2#
		value = 20 #单位为百分比
	}
}
#没人力就屯装备#
force_equip2 = {
	allowed = { 
		or = { has_completed_focus = production_effort is_major = no }
	}
	enable = {
        check_variable = { target_conscription_amount = current_conscription_amount }
        has_manpower < 500000
	}
	abort_when_not_enabled = yes
        ai_strategy = {
		type = equipment_stockpile_surplus_ratio #装备盈余/赤字率，全局定义默认为0.2#
		value = 100 #单位为百分比#
	}
}
#人力太少了#
force_equip3 = {
	allowed = { 
		or = { has_completed_focus = production_effort is_major = no }
	}
	enable = {
        check_variable = { target_conscription_amount = current_conscription_amount }
        has_manpower < 50000
	}
	abort_when_not_enabled = yes
        ai_strategy = {
		type = equipment_stockpile_surplus_ratio #装备盈余/赤字率，全局定义默认为0.2
		value = 9999 #单位为百分比
	}
}
#一个师都没有#
force_equip4 = {
	allowed = { 
		or = { has_completed_focus = production_effort is_major = no }
	}
	enable = {
               num_divisions < 1
	}
	abort_when_not_enabled = yes
        ai_strategy = {
		type = equipment_variant_production_factor
		id = infantry_equipment
		value = 999
	}
    ai_strategy = {
		type = equipment_production_min_factories
		id = infantry
		value = 2
	}
}
#大国屯装备#
force_equip5 = {
	allowed = { 
		is_major = yes
	}
	enable = {
        num_of_military_factories > 250  
        num_divisions > 1000
	}
	abort_when_not_enabled = yes
        ai_strategy = {
		type = equipment_stockpile_surplus_ratio #装备盈余/赤字率，全局定义默认为0.2
		value = 20 #单位为百分比
	}
}
#小卡拉米前期没人力还是存装备吧#
stockpile_less_early_game_minor = {
	enable = {
		date < 1940.1.1
        is_major = no
        NOT = { TAG = POL }#你不行，你得和德佬爆了！！#
        check_variable = { target_conscription_amount = current_conscription_amount }#征兵部表示指标征满了#
        has_manpower < 10000 #一个师都凑不出#
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_stockpile_surplus_ratio
		value = 20
	}
}
#有人力不屯装备吧#
stockpile_less_early_game = {
	enable = {
        check_variable = { target_conscription_amount = current_conscription_amount }#征兵部表示指标征满了#
        has_manpower > 1000000 #一个师都凑不出#
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_stockpile_surplus_ratio
		value = -50
	}
}
##@装备生产与升级@##
#不玩炮#
no_more_fukking_artillery = {
	enable = {
		always = yes
	}
	abort = { always = no }
        ai_strategy = {
		type = equipment_variant_production_factor
		id = artillery_equipment
		value = -99
	}
        ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = -99 #20 to 40
	}
        ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = artillery_equipment
		value = -99
	}
}
#垃圾装甲车#
no_more_fukking_armor_car = {
	enable = {
		always = yes
	}
	abort = { always = no }
        ai_strategy = {
		type = equipment_variant_production_factor
		id = armored_car_equipment
		value = -99
	}
        ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = armored_car_equipment
		value = -99
	}
}

#后勤生产#
default_support_production = {#默认支援装备生产#
	enable = {
		num_of_military_factories > 30 #调控生产的条件。这里为大于20个厂#
	}
	abort_when_not_enabled = yes

        ai_strategy = {
		type = equipment_production_min_factories
		id = train
		value = 1
	}
         ai_strategy = {
		type = equipment_production_min_factories
		id = motorized
		value = 1
	}
        ai_strategy = {
		type = equipment_production_min_factories
		id = support
		value = 1
	}
}
#浮动码头#
default_produce_floating_harbors = {
	enable = {
		has_war_with_major = yes
		num_of_naval_factories > 25
		num_of_military_factories > 40 # floating harbors are used for invasions. Why do large invasions if you don't have the industrial capacity?
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = unit_ratio
		id = floating_harbor # for floating harbors, 'unit_ratio' is actually not a ratio but an absolute desired number
		value = 10
	}
}
#5000卡车拉补给#
halt_truck_production_in_transitioning = {
	enable = {
		has_equipment = { motorized_equipment > 5000 }
	}
        abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_variant_production_factor
		id = motorized_equipment
		value = -99
	}
}
#1000火车拉补给#
halt_train_production_in_transitioning = {
	enable = {
		has_equipment = { motorized_equipment > 1000 }
	}
        abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_variant_production_factor
		id = train_equipment
		value = -99
	}
}
halt_aa_tank_production_in_transitioning = {
	enable = {
		has_equipment = { medium_tank_aa_chassis > 500 }
	}
        abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_variant_production_factor
		id = medium_tank_aa_chassis
		value = -80
	}
}
#防空炮造多了#
halt_aa_production_in_transitioning = {
	enable = {
		has_equipment = { anti_air_equipment > 1000 }
	}
       abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_factor
		id = anti_air
		value = -80
	}
}

#喷火这种0可靠也是最低损耗的造一点就够了#
halt_flame_production_in_transitioning = {
	enable = {
		has_equipment = { medium_tank_flame_chassis > 500 }
	}
    abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_variant_production_factor
		id = medium_tank_flame_chassis
		value = -90
	}
}
#能的话造点列车炮#
default_railway_gun_management = {
	allowed = { always = yes }
	enable = {
		num_divisions > 100
        num_of_military_factories > 100
	}
	abort_when_not_enabled = yes

	ai_strategy = { # This will add the specified value to the RAILWAY_GUN_PRODUCTION_BASE_DIVISIONS_RATIO_PERCENT define and use that as the desired railway guns / divisions ratio (in %)
		type = railway_gun_divisions_ratio
		value = 1
	}
    ai_strategy = {
		type = equipment_production_min_factories
		id = railway_gun
		value = 1
	}
}
default_railway_gun_management2 = {
        allowed = { always = yes }
        enable = {
		date > 1942.9.1
	}
    abort_when_not_enabled = yes
	ai_strategy = {
		type = equipment_variant_production_factor
		id = railway_gun_equipment
		value = -80
	}
}
#机械化升级#
mech_up = {
	enable = {
		is_major = yes
        has_tech = mechanised_infantry
	}
    abort_when_not_enabled = yes
    ai_strategy = {
		type = production_upgrade_desire_offset
		id = mechanized_equipment_1
		value = 100  #100 百分之百不需要溢出#
	}
        ai_strategy = {
		type = production_upgrade_desire_offset
		id = mechanized_equipment_2
		value = 100  #100 百分之百不需要溢出#
	}
        ai_strategy = {
		type = production_upgrade_desire_offset
		id = mechanized_equipment_3
		value = 100  #100 百分之百不需要溢出#
	}
}
#步枪升级#
guns_up = {
	enable = {
		or = { has_tech = improved_infantry_weapons
                          has_tech = advanced_infantry_weapons }
	}
        abort_when_not_enabled = yes
       	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_1
		value = 100  #100 百分之百不需要溢出#
	}
        ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_2
		value = 100  #100 百分之百不需要溢出#
	}
        ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_3
		value = 100  #100 百分之百不需要溢出#
	}
}
#坦克/坦歼升级#
tanks_up_0 = {
	enable = {
		has_tech =  basic_medium_tank_chassis
	}
        abort_when_not_enabled = yes
        ai_strategy = {
		type = land_xp_spend_priority
		id = upgrade_xp_cutoff
		value = 100
	}
	ai_strategy = {
		type = production_upgrade_desire_offset
		id = medium_tank_chassis_0
		value = 999  #100 百分之百不需要溢出#
	}
        ai_strategy = {
		type = production_upgrade_desire_offset
		id = medium_tank_chassis_1
		value = 999  #100 百分之百不需要溢出#
	}
         ai_strategy = {
		type = production_upgrade_desire_offset
		id = medium_tank_destroyer_chassis_0
		value = 999  #100 百分之百不需要溢出#
	}
        ai_strategy = {
		type = production_upgrade_desire_offset
		id = medium_tank_destroyer_chassis_1
		value = 999  #100 百分之百不需要溢出#
	}
}
tanks_up = {
	enable = {
		has_tech =  improved_medium_tank_chassis
	}
        abort_when_not_enabled = yes
        ai_strategy = {
		type = land_xp_spend_priority
		id = upgrade_xp_cutoff
		value = 100
	}
	ai_strategy = {
		type = production_upgrade_desire_offset
		id = medium_tank_chassis_1
		value = 999  #100 百分之百不需要溢出#
	}
        ai_strategy = {
		type = production_upgrade_desire_offset
		id = medium_tank_chassis_2
		value = 999  #100 百分之百不需要溢出#
	}
         ai_strategy = {
		type = production_upgrade_desire_offset
		id = medium_tank_destroyer_chassis_0
		value = 999  #100 百分之百不需要溢出#
	}
        ai_strategy = {
		type = production_upgrade_desire_offset
		id = medium_tank_destroyer_chassis_1
		value = 999 #100 百分之百不需要溢出#
	}
        ai_strategy = {
		type = production_upgrade_desire_offset
		id = medium_tank_destroyer_chassis_2
		value = 999  #100 百分之百不需要溢出#
	}
}
#飞机升级#
air_up1 = {
	enable = {
		has_tech = basic_small_airframe
	}
        abort_when_not_enabled = yes
        ai_strategy = {
		type = air_xp_spend_priority
		id = upgrade_xp_cutoff
		value = 100
	}
	ai_strategy = {
		type = production_upgrade_desire_offset
		id = small_plane_airframe_0
		value = 100  #100 百分之百不需要溢出#
	}
        ai_strategy = {
		type = production_upgrade_desire_offset
		id = small_plane_cas_airframe_0
		value = 100  #100 百分之百不需要溢出#
	}
}
air_up2 = {
	enable = {
		has_tech = improved_small_airframe
	}
        abort_when_not_enabled = yes
        ai_strategy = {
		type = air_xp_spend_priority
		id = upgrade_xp_cutoff
		value = 100
	}
	ai_strategy = {
		type = production_upgrade_desire_offset
		id = small_plane_airframe_1
		value = 100  #100 百分之百不需要溢出#
	}
        ai_strategy = {
		type = production_upgrade_desire_offset
		id = small_plane_airframe_2
		value = 100  #战斗机得切#
	}
        ai_strategy = {
		type = production_upgrade_desire_offset
		id = small_plane_cas_airframe_1
		value = 100  #100 百分之百不需要溢出#
	}
        ai_strategy = {
		type = production_upgrade_desire_offset
		id = small_plane_cas_airframe_2
		value = 100  #cas得切#
	}
}

###@编制设计@###

#最好先让AI去升级编制#
division_upgrades_are_very_important = {
	enable = {
		date > 1937.1.1
                date < 1941.5.1
	}
	abort_when_not_enabled = yes

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