ws_v15_add_materials = { # Organised recovery technology improves all v1.5 material yields. if = { limit = { has_country_flag = ws_recovery_tech_1940 } multiply_variable = { ws_v15_g_iron = 1.10 } multiply_variable = { ws_v15_g_alloy = 1.10 } multiply_variable = { ws_v15_g_parts = 1.10 } } if = { limit = { has_country_flag = ws_recovery_tech_1942 } multiply_variable = { ws_v15_g_iron = 1.10 } multiply_variable = { ws_v15_g_alloy = 1.10 } multiply_variable = { ws_v15_g_parts = 1.10 } } if = { limit = { has_country_flag = ws_recovery_tech_1944 } multiply_variable = { ws_v15_g_iron = 1.08 } multiply_variable = { ws_v15_g_alloy = 1.08 } multiply_variable = { ws_v15_g_parts = 1.08 } } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_iron } clamp_variable = { var = ws_v15_g_iron min = 0 max = ws_capacity } add_to_variable = { ws_iron = ws_v15_g_iron } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_alloy } clamp_variable = { var = ws_v15_g_alloy min = 0 max = ws_capacity } add_to_variable = { ws_alloy = ws_v15_g_alloy } set_variable = { ws_capacity = 1000000 } subtract_from_variable = { ws_capacity = ws_parts } clamp_variable = { var = ws_v15_g_parts min = 0 max = ws_capacity } add_to_variable = { ws_parts = ws_v15_g_parts } } ws_apply_national_doctrine = { if = { limit = { tag = GER NOT = { has_idea = ws_doctrine_ger } } add_ideas = ws_doctrine_ger } if = { limit = { tag = SOV NOT = { has_idea = ws_doctrine_sov } } add_ideas = ws_doctrine_sov } if = { limit = { tag = JAP NOT = { has_idea = ws_doctrine_jap } } add_ideas = ws_doctrine_jap } if = { limit = { tag = USA NOT = { has_idea = ws_doctrine_usa } } add_ideas = ws_doctrine_usa } if = { limit = { tag = ENG NOT = { has_idea = ws_doctrine_eng } } add_ideas = ws_doctrine_eng } } ws_v15_retire_smallarms = { ws_initialize = yes set_variable = { ws_v15_retired = 0 } set_variable = { ws_v15_g_iron = 0 } set_variable = { ws_v15_g_alloy = 0 } set_variable = { ws_v15_g_parts = 0 } if = { limit = { has_tech = infantry_weapons1 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 2000 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@infantry_equipment } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@infantry_equipment } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@infantry_equipment } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 1000 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 1000 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@infantry_equipment_0 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = infantry_equipment_0 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@infantry_equipment_0 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.07 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.01 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_tech = improved_infantry_weapons } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 2000 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@infantry_equipment } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@infantry_equipment } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@infantry_equipment } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 1000 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 1000 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@infantry_equipment_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = infantry_equipment_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@infantry_equipment_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.08 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.02 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_tech = advanced_infantry_weapons } set_variable = { ws_v15_protected = 2000 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@infantry_equipment } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@infantry_equipment } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@infantry_equipment } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 1000 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 1000 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@infantry_equipment_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = infantry_equipment_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@infantry_equipment_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.09 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.025 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { tag = JAP } multiply_variable = { ws_v15_g_iron = 1.25 } multiply_variable = { ws_v15_g_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_v15_g_iron = 1.12 } multiply_variable = { ws_v15_g_alloy = 1.12 } } ws_v15_add_materials = yes add_to_variable = { ws_total_processed = ws_v15_retired } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_last_removed = ws_v15_retired } set_variable = { ws_last_iron = ws_v15_g_iron } set_variable = { ws_last_alloy = ws_v15_g_alloy } set_variable = { ws_last_parts = ws_v15_g_parts } } ws_v15_retire_guns = { ws_initialize = yes set_variable = { ws_v15_retired = 0 } set_variable = { ws_v15_g_iron = 0 } set_variable = { ws_v15_g_alloy = 0 } set_variable = { ws_v15_g_parts = 0 } if = { limit = { has_tech = artillery1 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 150 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@artillery_equipment } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@artillery_equipment } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@artillery_equipment } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 100 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 100 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@artillery_equipment_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = artillery_equipment_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@artillery_equipment_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.8 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.12 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.04 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_tech = artillery4 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 150 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@artillery_equipment } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@artillery_equipment } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@artillery_equipment } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 75 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 75 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@artillery_equipment_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = artillery_equipment_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@artillery_equipment_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.9 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.14 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.05 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_tech = antiair2 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@anti_air_equipment } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@anti_air_equipment } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@anti_air_equipment } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 100 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 100 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@anti_air_equipment_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = anti_air_equipment_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@anti_air_equipment_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.7 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.1 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.05 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_tech = antiair5 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@anti_air_equipment } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@anti_air_equipment } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@anti_air_equipment } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 75 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 75 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@anti_air_equipment_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = anti_air_equipment_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@anti_air_equipment_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.8 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.12 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.06 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_tech = antitank2 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@anti_tank_equipment } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@anti_tank_equipment } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@anti_tank_equipment } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 100 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 100 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@anti_tank_equipment_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = anti_tank_equipment_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@anti_tank_equipment_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.65 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.2 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.04 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_tech = antitank5 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@anti_tank_equipment } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@anti_tank_equipment } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@anti_tank_equipment } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 75 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 75 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@anti_tank_equipment_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = anti_tank_equipment_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@anti_tank_equipment_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.75 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.24 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.05 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_tech = mechanised_infantry2 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 200 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@mechanized_equipment } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@mechanized_equipment } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@mechanized_equipment } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 100 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 100 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@mechanized_equipment_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = mechanized_equipment_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@mechanized_equipment_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 1.2 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.12 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.12 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_tech = mechanised_infantry3 } set_variable = { ws_v15_protected = 200 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@mechanized_equipment } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@mechanized_equipment } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@mechanized_equipment } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 60 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 60 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@mechanized_equipment_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = mechanized_equipment_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@mechanized_equipment_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 2.0 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.15 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.15 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { tag = JAP } multiply_variable = { ws_v15_g_iron = 1.25 } multiply_variable = { ws_v15_g_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_v15_g_iron = 1.12 } multiply_variable = { ws_v15_g_alloy = 1.12 } } ws_v15_add_materials = yes add_to_variable = { ws_total_processed = ws_v15_retired } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_last_removed = ws_v15_retired } set_variable = { ws_last_iron = ws_v15_g_iron } set_variable = { ws_last_alloy = ws_v15_g_alloy } set_variable = { ws_last_parts = ws_v15_g_parts } } ws_v15_retire_armor = { ws_initialize = yes set_variable = { ws_v15_retired = 0 } set_variable = { ws_v15_g_iron = 0 } set_variable = { ws_v15_g_alloy = 0 } set_variable = { ws_v15_g_parts = 0 } if = { limit = { has_dlc = "No Step Back" has_tech = basic_light_tank_chassis } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@light_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@light_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@light_tank_chassis } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 50 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 50 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@light_tank_chassis_0 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = light_tank_chassis_0 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@light_tank_chassis_0 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 1.2 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.15 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.12 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "No Step Back" has_tech = improved_light_tank_chassis } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@light_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@light_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@light_tank_chassis } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 50 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 50 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@light_tank_chassis_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = light_tank_chassis_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@light_tank_chassis_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 1.6 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.2 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.15 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "No Step Back" has_tech = advanced_light_tank_chassis } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@light_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@light_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@light_tank_chassis } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 40 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 40 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@light_tank_chassis_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = light_tank_chassis_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@light_tank_chassis_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 2 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.25 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.18 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "No Step Back" has_tech = basic_medium_tank_chassis } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@medium_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@medium_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@medium_tank_chassis } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 40 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 40 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@medium_tank_chassis_0 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = medium_tank_chassis_0 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@medium_tank_chassis_0 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 2 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.22 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.18 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "No Step Back" has_tech = improved_medium_tank_chassis } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@medium_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@medium_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@medium_tank_chassis } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 40 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 40 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@medium_tank_chassis_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = medium_tank_chassis_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@medium_tank_chassis_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 2.4 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.27 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.22 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "No Step Back" has_tech = advanced_medium_tank_chassis } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@medium_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@medium_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@medium_tank_chassis } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 30 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 30 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@medium_tank_chassis_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = medium_tank_chassis_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@medium_tank_chassis_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 2.8 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.3 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.25 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "No Step Back" has_tech = basic_heavy_tank_chassis } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 80 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@heavy_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@heavy_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@heavy_tank_chassis } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 30 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 30 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@heavy_tank_chassis_0 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = heavy_tank_chassis_0 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@heavy_tank_chassis_0 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 3 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.3 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.25 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "No Step Back" has_tech = improved_heavy_tank_chassis } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 80 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@heavy_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@heavy_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@heavy_tank_chassis } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 30 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 30 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@heavy_tank_chassis_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = heavy_tank_chassis_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@heavy_tank_chassis_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 3.5 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.35 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.3 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "No Step Back" has_tech = advanced_heavy_tank_chassis } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 80 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@heavy_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@heavy_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@heavy_tank_chassis } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 25 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 25 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@heavy_tank_chassis_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = heavy_tank_chassis_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@heavy_tank_chassis_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 4 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.4 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.35 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "No Step Back" } has_tech = improved_light_tank } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@light_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@light_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@light_tank_chassis } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 50 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 50 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@light_tank_equipment_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = light_tank_equipment_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@light_tank_equipment_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 1.6 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.2 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.15 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "No Step Back" } has_tech = advanced_light_tank } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@light_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@light_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@light_tank_chassis } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 40 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 40 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@light_tank_equipment_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = light_tank_equipment_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@light_tank_equipment_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 2 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.25 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.18 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "No Step Back" } has_tech = improved_medium_tank } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@medium_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@medium_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@medium_tank_chassis } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 40 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 40 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@medium_tank_equipment_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = medium_tank_equipment_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@medium_tank_equipment_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 2.4 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.27 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.22 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "No Step Back" } has_tech = advanced_medium_tank } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@medium_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@medium_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@medium_tank_chassis } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 30 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 30 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@medium_tank_equipment_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = medium_tank_equipment_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@medium_tank_equipment_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 2.8 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.3 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.25 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "No Step Back" } has_tech = improved_heavy_tank } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 80 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@heavy_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@heavy_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@heavy_tank_chassis } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 30 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 30 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@heavy_tank_equipment_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = heavy_tank_equipment_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@heavy_tank_equipment_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 3.5 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.35 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.3 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "No Step Back" } has_tech = advanced_heavy_tank } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 80 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@heavy_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@heavy_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@heavy_tank_chassis } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 25 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 25 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@heavy_tank_equipment_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = heavy_tank_equipment_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@heavy_tank_equipment_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 4 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.4 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.35 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { tag = JAP } multiply_variable = { ws_v15_g_iron = 1.25 } multiply_variable = { ws_v15_g_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_v15_g_iron = 1.12 } multiply_variable = { ws_v15_g_alloy = 1.12 } } ws_v15_add_materials = yes add_to_variable = { ws_total_processed = ws_v15_retired } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_last_removed = ws_v15_retired } set_variable = { ws_last_iron = ws_v15_g_iron } set_variable = { ws_last_alloy = ws_v15_g_alloy } set_variable = { ws_last_parts = ws_v15_g_parts } } ws_v15_retire_air = { ws_initialize = yes set_variable = { ws_v15_retired = 0 } set_variable = { ws_v15_g_iron = 0 } set_variable = { ws_v15_g_alloy = 0 } set_variable = { ws_v15_g_parts = 0 } if = { limit = { has_dlc = "By Blood Alone" has_tech = basic_small_airframe } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@small_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@small_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@small_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 50 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 50 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@small_plane_airframe_0 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = small_plane_airframe_0 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@small_plane_airframe_0 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.25 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.8 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.08 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "By Blood Alone" has_tech = improved_small_airframe } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@small_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@small_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@small_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 50 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 50 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@small_plane_airframe_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = small_plane_airframe_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@small_plane_airframe_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.3 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 1 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.1 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "By Blood Alone" has_tech = advanced_small_airframe } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@small_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@small_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@small_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 40 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 40 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@small_plane_airframe_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = small_plane_airframe_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@small_plane_airframe_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.35 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 1.2 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.12 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "By Blood Alone" has_tech = basic_medium_airframe } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 80 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@medium_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@medium_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@medium_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 40 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 40 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@medium_plane_airframe_0 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = medium_plane_airframe_0 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@medium_plane_airframe_0 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.4 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 1.4 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.15 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "By Blood Alone" has_tech = improved_medium_airframe } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 80 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@medium_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@medium_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@medium_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 35 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 35 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@medium_plane_airframe_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = medium_plane_airframe_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@medium_plane_airframe_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.5 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 1.8 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.18 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "By Blood Alone" has_tech = advanced_medium_airframe } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 80 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@medium_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@medium_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@medium_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 30 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 30 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@medium_plane_airframe_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = medium_plane_airframe_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@medium_plane_airframe_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.6 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 2.2 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.22 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "By Blood Alone" has_tech = basic_large_airframe } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 40 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@large_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@large_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@large_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 20 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 20 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@large_plane_airframe_0 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = large_plane_airframe_0 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@large_plane_airframe_0 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.7 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 2.5 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.25 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "By Blood Alone" has_tech = improved_large_airframe } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 40 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@large_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@large_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@large_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 20 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 20 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@large_plane_airframe_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = large_plane_airframe_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@large_plane_airframe_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.8 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 3 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.3 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { has_dlc = "By Blood Alone" has_tech = advanced_large_airframe } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 40 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@large_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@large_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@large_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 15 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 15 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@large_plane_airframe_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = large_plane_airframe_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@large_plane_airframe_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.9 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 3.5 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.35 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "By Blood Alone" } has_tech = fighter1 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@small_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@small_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@small_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 50 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 50 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@fighter_equipment_0 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = fighter_equipment_0 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@fighter_equipment_0 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.25 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.8 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.08 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "By Blood Alone" } has_tech = fighter2 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@small_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@small_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@small_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 50 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 50 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@fighter_equipment_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = fighter_equipment_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@fighter_equipment_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.3 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 1 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.1 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "By Blood Alone" } has_tech = fighter3 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@small_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@small_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@small_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 40 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 40 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@fighter_equipment_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = fighter_equipment_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@fighter_equipment_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.35 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 1.2 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.12 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "By Blood Alone" } has_tech = CAS2 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@small_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@small_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@small_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 50 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 50 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@CAS_equipment_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = CAS_equipment_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@CAS_equipment_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.3 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 1 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.1 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "By Blood Alone" } has_tech = CAS3 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@small_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@small_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@small_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 40 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 40 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@CAS_equipment_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = CAS_equipment_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@CAS_equipment_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.35 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 1.2 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.12 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "By Blood Alone" } has_tech = tactical_bomber1 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 80 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@medium_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@medium_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@medium_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 40 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 40 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@tac_bomber_equipment_0 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = tac_bomber_equipment_0 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@tac_bomber_equipment_0 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.4 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 1.4 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.15 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "By Blood Alone" } has_tech = tactical_bomber2 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 80 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@medium_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@medium_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@medium_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 35 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 35 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@tac_bomber_equipment_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = tac_bomber_equipment_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@tac_bomber_equipment_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.5 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 1.8 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.18 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "By Blood Alone" } has_tech = tactical_bomber3 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 80 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@medium_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@medium_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@medium_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 30 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 30 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@tac_bomber_equipment_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = tac_bomber_equipment_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@tac_bomber_equipment_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.6 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 2.2 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.22 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "By Blood Alone" } has_tech = strategic_bomber2 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 40 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@large_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@large_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@large_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 20 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 20 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@strat_bomber_equipment_1 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = strat_bomber_equipment_1 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@strat_bomber_equipment_1 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.8 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 3 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.3 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { NOT = { has_dlc = "By Blood Alone" } has_tech = strategic_bomber3 } # Preserve base reserve x user multiplier plus deployed-equipment shortfall. set_variable = { ws_v15_protected = 40 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@large_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@large_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_safe = num_equipment@large_plane_airframe } subtract_from_variable = { ws_v15_safe = ws_v15_protected } clamp_variable = { var = ws_v15_safe min = 0 max = 15 } subtract_from_variable = { ws_v15_safe = 0.5 } round_variable = ws_v15_safe clamp_variable = { var = ws_v15_safe min = 0 max = 15 } if = { limit = { check_variable = { ws_v15_safe > 0 } } set_variable = { ws_v15_before = num_equipment@strat_bomber_equipment_2 } set_variable = { ws_v15_take = ws_v15_safe } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = strat_bomber_equipment_2 amount = ws_v15_take producer = ROOT } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@strat_bomber_equipment_2 } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_safe } add_to_variable = { ws_v15_retired = ws_v15_delta } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.9 } add_to_variable = { ws_v15_g_iron = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 3.5 } add_to_variable = { ws_v15_g_alloy = ws_v15_tmp } set_variable = { ws_v15_tmp = ws_v15_delta } multiply_variable = { ws_v15_tmp = 0.35 } add_to_variable = { ws_v15_g_parts = ws_v15_tmp } } } if = { limit = { tag = JAP } multiply_variable = { ws_v15_g_iron = 1.25 } multiply_variable = { ws_v15_g_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_v15_g_iron = 1.12 } multiply_variable = { ws_v15_g_alloy = 1.12 } } ws_v15_add_materials = yes add_to_variable = { ws_total_processed = ws_v15_retired } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_last_removed = ws_v15_retired } set_variable = { ws_last_iron = ws_v15_g_iron } set_variable = { ws_last_alloy = ws_v15_g_alloy } set_variable = { ws_last_parts = ws_v15_g_parts } } ws_v15_refurb_light_tanks = { ws_initialize = yes set_variable = { ws_v15_pending_light_tanks = 0 } set_variable = { ws_v15_before_total = num_equipment@light_tank_chassis } set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@light_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@light_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_remaining = ws_v15_before_total } subtract_from_variable = { ws_v15_remaining = ws_v15_protected } clamp_variable = { var = ws_v15_remaining min = 0 max = 25 } set_variable = { ws_v15_unit_cost = 0.5 } if = { limit = { tag = GER } multiply_variable = { ws_v15_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_unit_cost = 0.8823529 } } set_variable = { ws_v15_room = ws_parts } set_variable = { ws_v15_room_cap = ws_v15_unit_cost } multiply_variable = { ws_v15_room_cap = 25 } clamp_variable = { var = ws_v15_room min = 0 max = ws_v15_room_cap } divide_variable = { ws_v15_room = ws_v15_unit_cost } clamp_variable = { var = ws_v15_remaining min = 0 max = ws_v15_room } subtract_from_variable = { ws_v15_remaining = 0.5 } round_variable = ws_v15_remaining clamp_variable = { var = ws_v15_remaining min = 0 max = 25 } set_variable = { ws_v15_removed = 0 } if = { limit = { check_variable = { ws_v15_remaining > 0 } } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@light_tank_chassis } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = light_tank_chassis amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@light_tank_chassis } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } } if = { limit = { check_variable = { ws_v15_removed > 0 } } set_variable = { ws_v15_charge = ws_v15_removed } multiply_variable = { ws_v15_charge = 0.5 } if = { limit = { tag = GER } multiply_variable = { ws_v15_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_v15_charge } set_variable = { ws_v15_pending_light_tanks = ws_v15_removed } multiply_variable = { ws_v15_pending_light_tanks = 0.75 } if = { limit = { tag = GER } multiply_variable = { ws_v15_pending_light_tanks = 1.20 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_pending_light_tanks = 1.1333333 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_pending_light_tanks = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_pending_light_tanks = 1.0588235 } } round_variable = ws_v15_pending_light_tanks clamp_variable = { var = ws_v15_pending_light_tanks min = 1 max = 25 } set_country_flag = ws_v15_busy_light_tanks country_event = { id = war_salvage.300 days = 10 } } set_variable = { ws_last_removed = ws_v15_removed } set_variable = { ws_last_pending = ws_v15_pending_light_tanks } } ws_v15_refurb_medium_tanks = { ws_initialize = yes set_variable = { ws_v15_pending_medium_tanks = 0 } set_variable = { ws_v15_before_total = num_equipment@medium_tank_chassis } set_variable = { ws_v15_protected = 80 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@medium_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@medium_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_remaining = ws_v15_before_total } subtract_from_variable = { ws_v15_remaining = ws_v15_protected } clamp_variable = { var = ws_v15_remaining min = 0 max = 20 } set_variable = { ws_v15_unit_cost = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_v15_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_unit_cost = 0.8823529 } } set_variable = { ws_v15_room = ws_parts } set_variable = { ws_v15_room_cap = ws_v15_unit_cost } multiply_variable = { ws_v15_room_cap = 20 } clamp_variable = { var = ws_v15_room min = 0 max = ws_v15_room_cap } divide_variable = { ws_v15_room = ws_v15_unit_cost } clamp_variable = { var = ws_v15_remaining min = 0 max = ws_v15_room } subtract_from_variable = { ws_v15_remaining = 0.5 } round_variable = ws_v15_remaining clamp_variable = { var = ws_v15_remaining min = 0 max = 20 } set_variable = { ws_v15_removed = 0 } if = { limit = { check_variable = { ws_v15_remaining > 0 } } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@medium_tank_chassis } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = medium_tank_chassis amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@medium_tank_chassis } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } } if = { limit = { check_variable = { ws_v15_removed > 0 } } set_variable = { ws_v15_charge = ws_v15_removed } multiply_variable = { ws_v15_charge = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_v15_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_v15_charge } set_variable = { ws_v15_pending_medium_tanks = ws_v15_removed } multiply_variable = { ws_v15_pending_medium_tanks = 0.75 } if = { limit = { tag = GER } multiply_variable = { ws_v15_pending_medium_tanks = 1.20 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_pending_medium_tanks = 1.1333333 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_pending_medium_tanks = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_pending_medium_tanks = 1.0588235 } } round_variable = ws_v15_pending_medium_tanks clamp_variable = { var = ws_v15_pending_medium_tanks min = 1 max = 20 } set_country_flag = ws_v15_busy_medium_tanks country_event = { id = war_salvage.301 days = 10 } } set_variable = { ws_last_removed = ws_v15_removed } set_variable = { ws_last_pending = ws_v15_pending_medium_tanks } } ws_v15_refurb_heavy_tanks = { ws_initialize = yes set_variable = { ws_v15_pending_heavy_tanks = 0 } set_variable = { ws_v15_before_total = num_equipment@heavy_tank_chassis } set_variable = { ws_v15_protected = 60 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@heavy_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@heavy_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_remaining = ws_v15_before_total } subtract_from_variable = { ws_v15_remaining = ws_v15_protected } clamp_variable = { var = ws_v15_remaining min = 0 max = 15 } set_variable = { ws_v15_unit_cost = 1 } if = { limit = { tag = GER } multiply_variable = { ws_v15_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_unit_cost = 0.8823529 } } set_variable = { ws_v15_room = ws_parts } set_variable = { ws_v15_room_cap = ws_v15_unit_cost } multiply_variable = { ws_v15_room_cap = 15 } clamp_variable = { var = ws_v15_room min = 0 max = ws_v15_room_cap } divide_variable = { ws_v15_room = ws_v15_unit_cost } clamp_variable = { var = ws_v15_remaining min = 0 max = ws_v15_room } subtract_from_variable = { ws_v15_remaining = 0.5 } round_variable = ws_v15_remaining clamp_variable = { var = ws_v15_remaining min = 0 max = 15 } set_variable = { ws_v15_removed = 0 } if = { limit = { check_variable = { ws_v15_remaining > 0 } } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@heavy_tank_chassis } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = heavy_tank_chassis amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@heavy_tank_chassis } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } } if = { limit = { check_variable = { ws_v15_removed > 0 } } set_variable = { ws_v15_charge = ws_v15_removed } multiply_variable = { ws_v15_charge = 1.0 } if = { limit = { tag = GER } multiply_variable = { ws_v15_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_v15_charge } set_variable = { ws_v15_pending_heavy_tanks = ws_v15_removed } multiply_variable = { ws_v15_pending_heavy_tanks = 0.75 } if = { limit = { tag = GER } multiply_variable = { ws_v15_pending_heavy_tanks = 1.20 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_pending_heavy_tanks = 1.1333333 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_pending_heavy_tanks = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_pending_heavy_tanks = 1.0588235 } } round_variable = ws_v15_pending_heavy_tanks clamp_variable = { var = ws_v15_pending_heavy_tanks min = 1 max = 15 } set_country_flag = ws_v15_busy_heavy_tanks country_event = { id = war_salvage.302 days = 10 } } set_variable = { ws_last_removed = ws_v15_removed } set_variable = { ws_last_pending = ws_v15_pending_heavy_tanks } } ws_v15_refurb_light_tanks_old = { ws_initialize = yes set_variable = { ws_v15_pending_light_tanks_old = 0 } set_variable = { ws_v15_before_total = num_equipment@light_tank_chassis } set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@light_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@light_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_remaining = ws_v15_before_total } subtract_from_variable = { ws_v15_remaining = ws_v15_protected } clamp_variable = { var = ws_v15_remaining min = 0 max = 25 } set_variable = { ws_v15_unit_cost = 0.5 } if = { limit = { tag = GER } multiply_variable = { ws_v15_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_unit_cost = 0.8823529 } } set_variable = { ws_v15_room = ws_parts } set_variable = { ws_v15_room_cap = ws_v15_unit_cost } multiply_variable = { ws_v15_room_cap = 25 } clamp_variable = { var = ws_v15_room min = 0 max = ws_v15_room_cap } divide_variable = { ws_v15_room = ws_v15_unit_cost } clamp_variable = { var = ws_v15_remaining min = 0 max = ws_v15_room } subtract_from_variable = { ws_v15_remaining = 0.5 } round_variable = ws_v15_remaining clamp_variable = { var = ws_v15_remaining min = 0 max = 25 } set_variable = { ws_v15_removed = 0 } if = { limit = { check_variable = { ws_v15_remaining > 0 } } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@light_tank_chassis } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = light_tank_chassis amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@light_tank_chassis } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } } if = { limit = { check_variable = { ws_v15_removed > 0 } } set_variable = { ws_v15_charge = ws_v15_removed } multiply_variable = { ws_v15_charge = 0.5 } if = { limit = { tag = GER } multiply_variable = { ws_v15_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_v15_charge } set_variable = { ws_v15_pending_light_tanks_old = ws_v15_removed } multiply_variable = { ws_v15_pending_light_tanks_old = 0.75 } if = { limit = { tag = GER } multiply_variable = { ws_v15_pending_light_tanks_old = 1.20 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_pending_light_tanks_old = 1.1333333 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_pending_light_tanks_old = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_pending_light_tanks_old = 1.0588235 } } round_variable = ws_v15_pending_light_tanks_old clamp_variable = { var = ws_v15_pending_light_tanks_old min = 1 max = 25 } set_country_flag = ws_v15_busy_light_tanks_old country_event = { id = war_salvage.303 days = 10 } } set_variable = { ws_last_removed = ws_v15_removed } set_variable = { ws_last_pending = ws_v15_pending_light_tanks_old } } ws_v15_refurb_medium_tanks_old = { ws_initialize = yes set_variable = { ws_v15_pending_medium_tanks_old = 0 } set_variable = { ws_v15_before_total = num_equipment@medium_tank_chassis } set_variable = { ws_v15_protected = 80 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@medium_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@medium_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_remaining = ws_v15_before_total } subtract_from_variable = { ws_v15_remaining = ws_v15_protected } clamp_variable = { var = ws_v15_remaining min = 0 max = 20 } set_variable = { ws_v15_unit_cost = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_v15_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_unit_cost = 0.8823529 } } set_variable = { ws_v15_room = ws_parts } set_variable = { ws_v15_room_cap = ws_v15_unit_cost } multiply_variable = { ws_v15_room_cap = 20 } clamp_variable = { var = ws_v15_room min = 0 max = ws_v15_room_cap } divide_variable = { ws_v15_room = ws_v15_unit_cost } clamp_variable = { var = ws_v15_remaining min = 0 max = ws_v15_room } subtract_from_variable = { ws_v15_remaining = 0.5 } round_variable = ws_v15_remaining clamp_variable = { var = ws_v15_remaining min = 0 max = 20 } set_variable = { ws_v15_removed = 0 } if = { limit = { check_variable = { ws_v15_remaining > 0 } } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@medium_tank_chassis } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = medium_tank_chassis amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@medium_tank_chassis } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } } if = { limit = { check_variable = { ws_v15_removed > 0 } } set_variable = { ws_v15_charge = ws_v15_removed } multiply_variable = { ws_v15_charge = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_v15_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_v15_charge } set_variable = { ws_v15_pending_medium_tanks_old = ws_v15_removed } multiply_variable = { ws_v15_pending_medium_tanks_old = 0.75 } if = { limit = { tag = GER } multiply_variable = { ws_v15_pending_medium_tanks_old = 1.20 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_pending_medium_tanks_old = 1.1333333 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_pending_medium_tanks_old = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_pending_medium_tanks_old = 1.0588235 } } round_variable = ws_v15_pending_medium_tanks_old clamp_variable = { var = ws_v15_pending_medium_tanks_old min = 1 max = 20 } set_country_flag = ws_v15_busy_medium_tanks_old country_event = { id = war_salvage.304 days = 10 } } set_variable = { ws_last_removed = ws_v15_removed } set_variable = { ws_last_pending = ws_v15_pending_medium_tanks_old } } ws_v15_refurb_heavy_tanks_old = { ws_initialize = yes set_variable = { ws_v15_pending_heavy_tanks_old = 0 } set_variable = { ws_v15_before_total = num_equipment@heavy_tank_chassis } set_variable = { ws_v15_protected = 60 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@heavy_tank_chassis } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@heavy_tank_chassis } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_remaining = ws_v15_before_total } subtract_from_variable = { ws_v15_remaining = ws_v15_protected } clamp_variable = { var = ws_v15_remaining min = 0 max = 15 } set_variable = { ws_v15_unit_cost = 1 } if = { limit = { tag = GER } multiply_variable = { ws_v15_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_unit_cost = 0.8823529 } } set_variable = { ws_v15_room = ws_parts } set_variable = { ws_v15_room_cap = ws_v15_unit_cost } multiply_variable = { ws_v15_room_cap = 15 } clamp_variable = { var = ws_v15_room min = 0 max = ws_v15_room_cap } divide_variable = { ws_v15_room = ws_v15_unit_cost } clamp_variable = { var = ws_v15_remaining min = 0 max = ws_v15_room } subtract_from_variable = { ws_v15_remaining = 0.5 } round_variable = ws_v15_remaining clamp_variable = { var = ws_v15_remaining min = 0 max = 15 } set_variable = { ws_v15_removed = 0 } if = { limit = { check_variable = { ws_v15_remaining > 0 } } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@heavy_tank_chassis } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = heavy_tank_chassis amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@heavy_tank_chassis } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } } if = { limit = { check_variable = { ws_v15_removed > 0 } } set_variable = { ws_v15_charge = ws_v15_removed } multiply_variable = { ws_v15_charge = 1.0 } if = { limit = { tag = GER } multiply_variable = { ws_v15_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_v15_charge } set_variable = { ws_v15_pending_heavy_tanks_old = ws_v15_removed } multiply_variable = { ws_v15_pending_heavy_tanks_old = 0.75 } if = { limit = { tag = GER } multiply_variable = { ws_v15_pending_heavy_tanks_old = 1.20 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_pending_heavy_tanks_old = 1.1333333 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_pending_heavy_tanks_old = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_pending_heavy_tanks_old = 1.0588235 } } round_variable = ws_v15_pending_heavy_tanks_old clamp_variable = { var = ws_v15_pending_heavy_tanks_old min = 1 max = 15 } set_country_flag = ws_v15_busy_heavy_tanks_old country_event = { id = war_salvage.305 days = 10 } } set_variable = { ws_last_removed = ws_v15_removed } set_variable = { ws_last_pending = ws_v15_pending_heavy_tanks_old } } ws_v15_refurb_small_air = { ws_initialize = yes set_variable = { ws_v15_pending_small_air = 0 } set_variable = { ws_v15_before_total = num_equipment@small_plane_airframe } set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@small_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@small_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_remaining = ws_v15_before_total } subtract_from_variable = { ws_v15_remaining = ws_v15_protected } clamp_variable = { var = ws_v15_remaining min = 0 max = 25 } set_variable = { ws_v15_unit_cost = 0.3 } if = { limit = { tag = GER } multiply_variable = { ws_v15_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_unit_cost = 0.8823529 } } set_variable = { ws_v15_room = ws_parts } set_variable = { ws_v15_room_cap = ws_v15_unit_cost } multiply_variable = { ws_v15_room_cap = 25 } clamp_variable = { var = ws_v15_room min = 0 max = ws_v15_room_cap } divide_variable = { ws_v15_room = ws_v15_unit_cost } clamp_variable = { var = ws_v15_remaining min = 0 max = ws_v15_room } subtract_from_variable = { ws_v15_remaining = 0.5 } round_variable = ws_v15_remaining clamp_variable = { var = ws_v15_remaining min = 0 max = 25 } set_variable = { ws_v15_removed = 0 } if = { limit = { check_variable = { ws_v15_remaining > 0 } } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@small_plane_airframe } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = small_plane_airframe amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@small_plane_airframe } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } } if = { limit = { check_variable = { ws_v15_removed > 0 } } set_variable = { ws_v15_charge = ws_v15_removed } multiply_variable = { ws_v15_charge = 0.3 } if = { limit = { tag = GER } multiply_variable = { ws_v15_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_v15_charge } set_variable = { ws_v15_pending_small_air = ws_v15_removed } multiply_variable = { ws_v15_pending_small_air = 0.75 } if = { limit = { tag = GER } multiply_variable = { ws_v15_pending_small_air = 1.20 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_pending_small_air = 1.1333333 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_pending_small_air = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_pending_small_air = 1.0588235 } } round_variable = ws_v15_pending_small_air clamp_variable = { var = ws_v15_pending_small_air min = 1 max = 25 } set_country_flag = ws_v15_busy_small_air country_event = { id = war_salvage.306 days = 10 } } set_variable = { ws_last_removed = ws_v15_removed } set_variable = { ws_last_pending = ws_v15_pending_small_air } } ws_v15_refurb_medium_air = { ws_initialize = yes set_variable = { ws_v15_pending_medium_air = 0 } set_variable = { ws_v15_before_total = num_equipment@medium_plane_airframe } set_variable = { ws_v15_protected = 80 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@medium_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@medium_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_remaining = ws_v15_before_total } subtract_from_variable = { ws_v15_remaining = ws_v15_protected } clamp_variable = { var = ws_v15_remaining min = 0 max = 20 } set_variable = { ws_v15_unit_cost = 0.5 } if = { limit = { tag = GER } multiply_variable = { ws_v15_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_unit_cost = 0.8823529 } } set_variable = { ws_v15_room = ws_parts } set_variable = { ws_v15_room_cap = ws_v15_unit_cost } multiply_variable = { ws_v15_room_cap = 20 } clamp_variable = { var = ws_v15_room min = 0 max = ws_v15_room_cap } divide_variable = { ws_v15_room = ws_v15_unit_cost } clamp_variable = { var = ws_v15_remaining min = 0 max = ws_v15_room } subtract_from_variable = { ws_v15_remaining = 0.5 } round_variable = ws_v15_remaining clamp_variable = { var = ws_v15_remaining min = 0 max = 20 } set_variable = { ws_v15_removed = 0 } if = { limit = { check_variable = { ws_v15_remaining > 0 } } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@medium_plane_airframe } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = medium_plane_airframe amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@medium_plane_airframe } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } } if = { limit = { check_variable = { ws_v15_removed > 0 } } set_variable = { ws_v15_charge = ws_v15_removed } multiply_variable = { ws_v15_charge = 0.5 } if = { limit = { tag = GER } multiply_variable = { ws_v15_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_v15_charge } set_variable = { ws_v15_pending_medium_air = ws_v15_removed } multiply_variable = { ws_v15_pending_medium_air = 0.75 } if = { limit = { tag = GER } multiply_variable = { ws_v15_pending_medium_air = 1.20 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_pending_medium_air = 1.1333333 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_pending_medium_air = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_pending_medium_air = 1.0588235 } } round_variable = ws_v15_pending_medium_air clamp_variable = { var = ws_v15_pending_medium_air min = 1 max = 20 } set_country_flag = ws_v15_busy_medium_air country_event = { id = war_salvage.307 days = 10 } } set_variable = { ws_last_removed = ws_v15_removed } set_variable = { ws_last_pending = ws_v15_pending_medium_air } } ws_v15_refurb_large_air = { ws_initialize = yes set_variable = { ws_v15_pending_large_air = 0 } set_variable = { ws_v15_before_total = num_equipment@large_plane_airframe } set_variable = { ws_v15_protected = 40 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@large_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@large_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_remaining = ws_v15_before_total } subtract_from_variable = { ws_v15_remaining = ws_v15_protected } clamp_variable = { var = ws_v15_remaining min = 0 max = 10 } set_variable = { ws_v15_unit_cost = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_v15_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_unit_cost = 0.8823529 } } set_variable = { ws_v15_room = ws_parts } set_variable = { ws_v15_room_cap = ws_v15_unit_cost } multiply_variable = { ws_v15_room_cap = 10 } clamp_variable = { var = ws_v15_room min = 0 max = ws_v15_room_cap } divide_variable = { ws_v15_room = ws_v15_unit_cost } clamp_variable = { var = ws_v15_remaining min = 0 max = ws_v15_room } subtract_from_variable = { ws_v15_remaining = 0.5 } round_variable = ws_v15_remaining clamp_variable = { var = ws_v15_remaining min = 0 max = 10 } set_variable = { ws_v15_removed = 0 } if = { limit = { check_variable = { ws_v15_remaining > 0 } } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@large_plane_airframe } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = large_plane_airframe amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@large_plane_airframe } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } } if = { limit = { check_variable = { ws_v15_removed > 0 } } set_variable = { ws_v15_charge = ws_v15_removed } multiply_variable = { ws_v15_charge = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_v15_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_v15_charge } set_variable = { ws_v15_pending_large_air = ws_v15_removed } multiply_variable = { ws_v15_pending_large_air = 0.75 } if = { limit = { tag = GER } multiply_variable = { ws_v15_pending_large_air = 1.20 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_pending_large_air = 1.1333333 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_pending_large_air = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_pending_large_air = 1.0588235 } } round_variable = ws_v15_pending_large_air clamp_variable = { var = ws_v15_pending_large_air min = 1 max = 10 } set_country_flag = ws_v15_busy_large_air country_event = { id = war_salvage.308 days = 10 } } set_variable = { ws_last_removed = ws_v15_removed } set_variable = { ws_last_pending = ws_v15_pending_large_air } } ws_v15_refurb_fighter_old = { ws_initialize = yes set_variable = { ws_v15_pending_fighter_old = 0 } set_variable = { ws_v15_before_total = num_equipment@small_plane_airframe } set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@small_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@small_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_remaining = ws_v15_before_total } subtract_from_variable = { ws_v15_remaining = ws_v15_protected } clamp_variable = { var = ws_v15_remaining min = 0 max = 25 } set_variable = { ws_v15_unit_cost = 0.3 } if = { limit = { tag = GER } multiply_variable = { ws_v15_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_unit_cost = 0.8823529 } } set_variable = { ws_v15_room = ws_parts } set_variable = { ws_v15_room_cap = ws_v15_unit_cost } multiply_variable = { ws_v15_room_cap = 25 } clamp_variable = { var = ws_v15_room min = 0 max = ws_v15_room_cap } divide_variable = { ws_v15_room = ws_v15_unit_cost } clamp_variable = { var = ws_v15_remaining min = 0 max = ws_v15_room } subtract_from_variable = { ws_v15_remaining = 0.5 } round_variable = ws_v15_remaining clamp_variable = { var = ws_v15_remaining min = 0 max = 25 } set_variable = { ws_v15_removed = 0 } if = { limit = { check_variable = { ws_v15_remaining > 0 } } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@small_plane_airframe } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = small_plane_airframe amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@small_plane_airframe } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } } if = { limit = { check_variable = { ws_v15_removed > 0 } } set_variable = { ws_v15_charge = ws_v15_removed } multiply_variable = { ws_v15_charge = 0.3 } if = { limit = { tag = GER } multiply_variable = { ws_v15_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_v15_charge } set_variable = { ws_v15_pending_fighter_old = ws_v15_removed } multiply_variable = { ws_v15_pending_fighter_old = 0.75 } if = { limit = { tag = GER } multiply_variable = { ws_v15_pending_fighter_old = 1.20 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_pending_fighter_old = 1.1333333 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_pending_fighter_old = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_pending_fighter_old = 1.0588235 } } round_variable = ws_v15_pending_fighter_old clamp_variable = { var = ws_v15_pending_fighter_old min = 1 max = 25 } set_country_flag = ws_v15_busy_fighter_old country_event = { id = war_salvage.309 days = 10 } } set_variable = { ws_last_removed = ws_v15_removed } set_variable = { ws_last_pending = ws_v15_pending_fighter_old } } ws_v15_refurb_cas_old = { ws_initialize = yes set_variable = { ws_v15_pending_cas_old = 0 } set_variable = { ws_v15_before_total = num_equipment@small_plane_airframe } set_variable = { ws_v15_protected = 100 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@small_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@small_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_remaining = ws_v15_before_total } subtract_from_variable = { ws_v15_remaining = ws_v15_protected } clamp_variable = { var = ws_v15_remaining min = 0 max = 25 } set_variable = { ws_v15_unit_cost = 0.3 } if = { limit = { tag = GER } multiply_variable = { ws_v15_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_unit_cost = 0.8823529 } } set_variable = { ws_v15_room = ws_parts } set_variable = { ws_v15_room_cap = ws_v15_unit_cost } multiply_variable = { ws_v15_room_cap = 25 } clamp_variable = { var = ws_v15_room min = 0 max = ws_v15_room_cap } divide_variable = { ws_v15_room = ws_v15_unit_cost } clamp_variable = { var = ws_v15_remaining min = 0 max = ws_v15_room } subtract_from_variable = { ws_v15_remaining = 0.5 } round_variable = ws_v15_remaining clamp_variable = { var = ws_v15_remaining min = 0 max = 25 } set_variable = { ws_v15_removed = 0 } if = { limit = { check_variable = { ws_v15_remaining > 0 } } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@small_plane_airframe } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = small_plane_airframe amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@small_plane_airframe } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } } if = { limit = { check_variable = { ws_v15_removed > 0 } } set_variable = { ws_v15_charge = ws_v15_removed } multiply_variable = { ws_v15_charge = 0.3 } if = { limit = { tag = GER } multiply_variable = { ws_v15_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_v15_charge } set_variable = { ws_v15_pending_cas_old = ws_v15_removed } multiply_variable = { ws_v15_pending_cas_old = 0.75 } if = { limit = { tag = GER } multiply_variable = { ws_v15_pending_cas_old = 1.20 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_pending_cas_old = 1.1333333 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_pending_cas_old = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_pending_cas_old = 1.0588235 } } round_variable = ws_v15_pending_cas_old clamp_variable = { var = ws_v15_pending_cas_old min = 1 max = 25 } set_country_flag = ws_v15_busy_cas_old country_event = { id = war_salvage.310 days = 10 } } set_variable = { ws_last_removed = ws_v15_removed } set_variable = { ws_last_pending = ws_v15_pending_cas_old } } ws_v15_refurb_tac_old = { ws_initialize = yes set_variable = { ws_v15_pending_tac_old = 0 } set_variable = { ws_v15_before_total = num_equipment@medium_plane_airframe } set_variable = { ws_v15_protected = 80 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@medium_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@medium_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_remaining = ws_v15_before_total } subtract_from_variable = { ws_v15_remaining = ws_v15_protected } clamp_variable = { var = ws_v15_remaining min = 0 max = 20 } set_variable = { ws_v15_unit_cost = 0.5 } if = { limit = { tag = GER } multiply_variable = { ws_v15_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_unit_cost = 0.8823529 } } set_variable = { ws_v15_room = ws_parts } set_variable = { ws_v15_room_cap = ws_v15_unit_cost } multiply_variable = { ws_v15_room_cap = 20 } clamp_variable = { var = ws_v15_room min = 0 max = ws_v15_room_cap } divide_variable = { ws_v15_room = ws_v15_unit_cost } clamp_variable = { var = ws_v15_remaining min = 0 max = ws_v15_room } subtract_from_variable = { ws_v15_remaining = 0.5 } round_variable = ws_v15_remaining clamp_variable = { var = ws_v15_remaining min = 0 max = 20 } set_variable = { ws_v15_removed = 0 } if = { limit = { check_variable = { ws_v15_remaining > 0 } } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@medium_plane_airframe } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = medium_plane_airframe amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@medium_plane_airframe } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } } if = { limit = { check_variable = { ws_v15_removed > 0 } } set_variable = { ws_v15_charge = ws_v15_removed } multiply_variable = { ws_v15_charge = 0.5 } if = { limit = { tag = GER } multiply_variable = { ws_v15_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_v15_charge } set_variable = { ws_v15_pending_tac_old = ws_v15_removed } multiply_variable = { ws_v15_pending_tac_old = 0.75 } if = { limit = { tag = GER } multiply_variable = { ws_v15_pending_tac_old = 1.20 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_pending_tac_old = 1.1333333 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_pending_tac_old = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_pending_tac_old = 1.0588235 } } round_variable = ws_v15_pending_tac_old clamp_variable = { var = ws_v15_pending_tac_old min = 1 max = 20 } set_country_flag = ws_v15_busy_tac_old country_event = { id = war_salvage.311 days = 10 } } set_variable = { ws_last_removed = ws_v15_removed } set_variable = { ws_last_pending = ws_v15_pending_tac_old } } ws_v15_refurb_strat_old = { ws_initialize = yes set_variable = { ws_v15_pending_strat_old = 0 } set_variable = { ws_v15_before_total = num_equipment@large_plane_airframe } set_variable = { ws_v15_protected = 40 } multiply_variable = { ws_v15_protected = ws_reserve_multiplier } set_variable = { ws_v15_shortfall = num_target_equipment_in_armies@large_plane_airframe } subtract_from_variable = { ws_v15_shortfall = num_equipment_in_armies@large_plane_airframe } clamp_variable = { var = ws_v15_shortfall min = 0 max = 1000000 } add_to_variable = { ws_v15_protected = ws_v15_shortfall } set_variable = { ws_v15_remaining = ws_v15_before_total } subtract_from_variable = { ws_v15_remaining = ws_v15_protected } clamp_variable = { var = ws_v15_remaining min = 0 max = 10 } set_variable = { ws_v15_unit_cost = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_v15_unit_cost = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_unit_cost = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_unit_cost = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_unit_cost = 0.8823529 } } set_variable = { ws_v15_room = ws_parts } set_variable = { ws_v15_room_cap = ws_v15_unit_cost } multiply_variable = { ws_v15_room_cap = 10 } clamp_variable = { var = ws_v15_room min = 0 max = ws_v15_room_cap } divide_variable = { ws_v15_room = ws_v15_unit_cost } clamp_variable = { var = ws_v15_remaining min = 0 max = ws_v15_room } subtract_from_variable = { ws_v15_remaining = 0.5 } round_variable = ws_v15_remaining clamp_variable = { var = ws_v15_remaining min = 0 max = 10 } set_variable = { ws_v15_removed = 0 } if = { limit = { check_variable = { ws_v15_remaining > 0 } } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@large_plane_airframe } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = large_plane_airframe amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@large_plane_airframe } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } } if = { limit = { check_variable = { ws_v15_removed > 0 } } set_variable = { ws_v15_charge = ws_v15_removed } multiply_variable = { ws_v15_charge = 0.8 } if = { limit = { tag = GER } multiply_variable = { ws_v15_charge = 0.80 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_charge = 0.85 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_charge = 0.875 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_charge = 0.8823529 } } subtract_from_variable = { ws_parts = ws_v15_charge } set_variable = { ws_v15_pending_strat_old = ws_v15_removed } multiply_variable = { ws_v15_pending_strat_old = 0.75 } if = { limit = { tag = GER } multiply_variable = { ws_v15_pending_strat_old = 1.20 } } if = { limit = { tag = ENG } multiply_variable = { ws_v15_pending_strat_old = 1.1333333 } } if = { limit = { tag = GER has_country_flag = ws_nat_upgrade_ger } multiply_variable = { ws_v15_pending_strat_old = 1.0555556 } } if = { limit = { tag = ENG has_country_flag = ws_nat_upgrade_eng } multiply_variable = { ws_v15_pending_strat_old = 1.0588235 } } round_variable = ws_v15_pending_strat_old clamp_variable = { var = ws_v15_pending_strat_old min = 1 max = 10 } set_country_flag = ws_v15_busy_strat_old country_event = { id = war_salvage.312 days = 10 } } set_variable = { ws_last_removed = ws_v15_removed } set_variable = { ws_last_pending = ws_v15_pending_strat_old } } ws_v15_record_battlefield_wreckage = { ws_initialize = yes if = { limit = { NOT = { has_country_flag = ws_v15_battle_record_cd } has_war = yes } set_country_flag = { flag = ws_v15_battle_record_cd days = 2 } set_variable = { ws_v15_wreck_gain = 1 } random_list = { 55 = { set_variable = { ws_v15_wreck_gain = 1 } } 30 = { set_variable = { ws_v15_wreck_gain = 2 } } 15 = { set_variable = { ws_v15_wreck_gain = 4 } } } if = { limit = { tag = SOV } multiply_variable = { ws_v15_wreck_gain = 1.5 } } if = { limit = { tag = SOV has_country_flag = ws_nat_upgrade_sov } multiply_variable = { ws_v15_wreck_gain = 1.2 } } add_to_variable = { ws_v15_wreckage = ws_v15_wreck_gain } clamp_variable = { var = ws_v15_wreckage min = 0 max = 10000 } } } ws_v15_record_captured_state = { ws_initialize = yes set_variable = { ws_v15_wreck_gain = 3 } if = { limit = { tag = SOV } multiply_variable = { ws_v15_wreck_gain = 1.5 } } if = { limit = { tag = SOV has_country_flag = ws_nat_upgrade_sov } multiply_variable = { ws_v15_wreck_gain = 1.2 } } add_to_variable = { ws_v15_wreckage = ws_v15_wreck_gain } clamp_variable = { var = ws_v15_wreckage min = 0 max = 10000 } } ws_v15_record_capitulation = { ws_initialize = yes set_variable = { ws_v15_wreck_gain = 25 } if = { limit = { tag = SOV } multiply_variable = { ws_v15_wreck_gain = 1.5 } } if = { limit = { tag = SOV has_country_flag = ws_nat_upgrade_sov } multiply_variable = { ws_v15_wreck_gain = 1.2 } } add_to_variable = { ws_v15_wreckage = ws_v15_wreck_gain } clamp_variable = { var = ws_v15_wreckage min = 0 max = 10000 } } ws_v15_recover_wreckage = { ws_initialize = yes set_variable = { ws_last_removed = 0 } if = { limit = { check_variable = { ws_v15_wreckage > 9.999 } check_variable = { ws_iron < 999960 } check_variable = { ws_alloy < 999992 } check_variable = { ws_parts < 999988 } } subtract_from_variable = { ws_v15_wreckage = 10 } set_variable = { ws_v15_g_iron = 20 } set_variable = { ws_v15_g_alloy = 4 } set_variable = { ws_v15_g_parts = 6 } if = { limit = { tag = JAP } multiply_variable = { ws_v15_g_iron = 1.25 } multiply_variable = { ws_v15_g_alloy = 1.25 } } if = { limit = { tag = JAP has_country_flag = ws_nat_upgrade_jap } multiply_variable = { ws_v15_g_iron = 1.12 } multiply_variable = { ws_v15_g_alloy = 1.12 } } ws_v15_add_materials = yes set_variable = { ws_last_removed = 10 } set_variable = { ws_last_iron = ws_v15_g_iron } set_variable = { ws_last_alloy = ws_v15_g_alloy } set_variable = { ws_last_parts = ws_v15_g_parts } add_to_variable = { ws_total_processed = 10 } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } add_timed_idea = { idea = ws_battlefield_recovery_active days = 30 } } } ws_v15_analyse_smallarms = { ws_initialize = yes set_variable = { ws_v15_remaining = 250 } set_variable = { ws_v15_removed = 0 } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@infantry_equipment } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = infantry_equipment amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@infantry_equipment } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } if = { limit = { check_variable = { ws_v15_removed > 249.999 } } if = { limit = { tag = USA has_country_flag = ws_nat_upgrade_usa } add_tech_bonus = { name = ws_research_smallarms_bonus bonus = 0.75 uses = 2 category = infantry_weapons } } else_if = { limit = { tag = USA } add_tech_bonus = { name = ws_research_smallarms_bonus bonus = 0.75 uses = 1 category = infantry_weapons } } else = { add_tech_bonus = { name = ws_research_smallarms_bonus bonus = 0.50 uses = 1 category = infantry_weapons } } } else_if = { limit = { check_variable = { ws_v15_removed > 122.500 } } add_tech_bonus = { name = ws_research_smallarms_bonus bonus = 0.25 uses = 1 category = infantry_weapons } } else_if = { limit = { check_variable = { ws_v15_removed > 0 } } army_experience = 5 } add_to_variable = { ws_total_processed = ws_v15_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_last_removed = ws_v15_removed } } ws_v15_analyse_artillery = { ws_initialize = yes set_variable = { ws_v15_remaining = 50 } set_variable = { ws_v15_removed = 0 } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@artillery_equipment } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = artillery_equipment amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@artillery_equipment } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } if = { limit = { check_variable = { ws_v15_removed > 49.999 } } if = { limit = { tag = USA has_country_flag = ws_nat_upgrade_usa } add_tech_bonus = { name = ws_research_artillery_bonus bonus = 0.75 uses = 2 category = artillery } } else_if = { limit = { tag = USA } add_tech_bonus = { name = ws_research_artillery_bonus bonus = 0.75 uses = 1 category = artillery } } else = { add_tech_bonus = { name = ws_research_artillery_bonus bonus = 0.50 uses = 1 category = artillery } } } else_if = { limit = { check_variable = { ws_v15_removed > 24.500 } } add_tech_bonus = { name = ws_research_artillery_bonus bonus = 0.25 uses = 1 category = artillery } } else_if = { limit = { check_variable = { ws_v15_removed > 0 } } army_experience = 5 } add_to_variable = { ws_total_processed = ws_v15_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_last_removed = ws_v15_removed } } ws_v15_analyse_armor_nsb = { ws_initialize = yes set_variable = { ws_v15_remaining = 20 } set_variable = { ws_v15_removed = 0 } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@medium_tank_chassis } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = medium_tank_chassis amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@medium_tank_chassis } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } if = { limit = { check_variable = { ws_v15_removed > 19.999 } } if = { limit = { tag = USA has_country_flag = ws_nat_upgrade_usa } add_tech_bonus = { name = ws_research_armor_nsb_bonus bonus = 0.75 uses = 2 category = armor } } else_if = { limit = { tag = USA } add_tech_bonus = { name = ws_research_armor_nsb_bonus bonus = 0.75 uses = 1 category = armor } } else = { add_tech_bonus = { name = ws_research_armor_nsb_bonus bonus = 0.50 uses = 1 category = armor } } } else_if = { limit = { check_variable = { ws_v15_removed > 9.800 } } add_tech_bonus = { name = ws_research_armor_nsb_bonus bonus = 0.25 uses = 1 category = armor } } else_if = { limit = { check_variable = { ws_v15_removed > 0 } } army_experience = 5 } add_to_variable = { ws_total_processed = ws_v15_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_last_removed = ws_v15_removed } } ws_v15_analyse_armor_old = { ws_initialize = yes set_variable = { ws_v15_remaining = 20 } set_variable = { ws_v15_removed = 0 } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@medium_tank_chassis } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = medium_tank_chassis amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@medium_tank_chassis } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } if = { limit = { check_variable = { ws_v15_removed > 19.999 } } if = { limit = { tag = USA has_country_flag = ws_nat_upgrade_usa } add_tech_bonus = { name = ws_research_armor_old_bonus bonus = 0.75 uses = 2 category = armor } } else_if = { limit = { tag = USA } add_tech_bonus = { name = ws_research_armor_old_bonus bonus = 0.75 uses = 1 category = armor } } else = { add_tech_bonus = { name = ws_research_armor_old_bonus bonus = 0.50 uses = 1 category = armor } } } else_if = { limit = { check_variable = { ws_v15_removed > 9.800 } } add_tech_bonus = { name = ws_research_armor_old_bonus bonus = 0.25 uses = 1 category = armor } } else_if = { limit = { check_variable = { ws_v15_removed > 0 } } army_experience = 5 } add_to_variable = { ws_total_processed = ws_v15_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_last_removed = ws_v15_removed } } ws_v15_analyse_air_bba = { ws_initialize = yes set_variable = { ws_v15_remaining = 20 } set_variable = { ws_v15_removed = 0 } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@small_plane_airframe } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = small_plane_airframe amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@small_plane_airframe } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } if = { limit = { check_variable = { ws_v15_removed > 19.999 } } if = { limit = { tag = USA has_country_flag = ws_nat_upgrade_usa } add_tech_bonus = { name = ws_research_air_bba_bonus bonus = 0.75 uses = 2 category = light_fighter } } else_if = { limit = { tag = USA } add_tech_bonus = { name = ws_research_air_bba_bonus bonus = 0.75 uses = 1 category = light_fighter } } else = { add_tech_bonus = { name = ws_research_air_bba_bonus bonus = 0.50 uses = 1 category = light_fighter } } } else_if = { limit = { check_variable = { ws_v15_removed > 9.800 } } add_tech_bonus = { name = ws_research_air_bba_bonus bonus = 0.25 uses = 1 category = light_fighter } } else_if = { limit = { check_variable = { ws_v15_removed > 0 } } air_experience = 5 } add_to_variable = { ws_total_processed = ws_v15_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_last_removed = ws_v15_removed } } ws_v15_analyse_air_old = { ws_initialize = yes set_variable = { ws_v15_remaining = 20 } set_variable = { ws_v15_removed = 0 } every_possible_country = { limit = { NOT = { tag = PREV } } PREV = { if = { limit = { check_variable = { ws_v15_remaining > 0 } } set_variable = { ws_v15_before = num_equipment@small_plane_airframe } set_variable = { ws_v15_take = ws_v15_remaining } multiply_variable = { ws_v15_take = -1 } add_equipment_to_stockpile = { type = small_plane_airframe amount = ws_v15_take producer = PREV } set_variable = { ws_v15_delta = ws_v15_before } subtract_from_variable = { ws_v15_delta = num_equipment@small_plane_airframe } clamp_variable = { var = ws_v15_delta min = 0 max = ws_v15_remaining } add_to_variable = { ws_v15_removed = ws_v15_delta } subtract_from_variable = { ws_v15_remaining = ws_v15_delta } } } } if = { limit = { check_variable = { ws_v15_removed > 19.999 } } if = { limit = { tag = USA has_country_flag = ws_nat_upgrade_usa } add_tech_bonus = { name = ws_research_air_old_bonus bonus = 0.75 uses = 2 category = light_fighter } } else_if = { limit = { tag = USA } add_tech_bonus = { name = ws_research_air_old_bonus bonus = 0.75 uses = 1 category = light_fighter } } else = { add_tech_bonus = { name = ws_research_air_old_bonus bonus = 0.50 uses = 1 category = light_fighter } } } else_if = { limit = { check_variable = { ws_v15_removed > 9.800 } } add_tech_bonus = { name = ws_research_air_old_bonus bonus = 0.25 uses = 1 category = light_fighter } } else_if = { limit = { check_variable = { ws_v15_removed > 0 } } air_experience = 5 } add_to_variable = { ws_total_processed = ws_v15_removed } clamp_variable = { var = ws_total_processed min = 0 max = 1000000 } set_variable = { ws_last_removed = ws_v15_removed } }