# Author(s): Angriest Bird, Hiddengearz, Killerrabbit # GDP Calculation # Calculating things for the money system # Interest rates are set in GDP/C - need modifier based on debt_ratio, to avoid rich countries getting infinite rich by taking huge loans and reinvesting abroad # Variable explanations # treasury_rate - How much money your country is making daily # tax_gain - money your gaining from taxes # int_investments_rate - weekly ROI generated by international investments # int_investments_collected_rate - share of that ROI added to the treasury # int_investments_reinvest_rate - share of that ROI added back to the principal # resource_sale_rate - money your gaining from exports # expense_gain - total amount of money your spending # debt_rate - How much money your country owes in debt # interest_rate - the interest rate you pay DAILY on debt. # econ_cycle_upg_cost - cost to upgrade economic cycle # bureaucracy_gain - cost for bureaucracy law # education_gain - cost of education law # health_gain - cost of health care law # welfare_gain - cost of welfare law # military_rate - cost of military law # personnel_cost - how much you pay soldiers and maintenance on equipment # corporation_tax - Value of the Corporate taxes # population_tax - value of the population tax # corporation_tax_rate - Corporate Tax rate # population_tax_rate - pop tax rate ###Treasury reset### -- Legacy commands. Moved this functionality to a update_display command #In a couple places I've left a comment saying referring to treasury reset explanation. This is the explanation #It took me a while to figure out why you add debt_rate to treasury_rate so ill try to explain (Gearz) #When your debt_rate changes you need to "reset the treasury_rate" so you return #how much you were taking from the treasury before and then take the new amount you need #e.g treasury_rate $10B, you take $2B for your current debt_rate. Treasury rate = $8B #Your new debt_rate is $4B. So you need to "reset the treasury" you give the treasury_rate back the $2B #So treasury_rate is now back to $10B, now subtract the $4B and now treasury rate is $6B # Constants # Adjusted the GDP scaling for all laws @spending_laws_gdp_scaling = 0.006 # Adjusts the money control factor for tax gain @money_control_factor_scaling = 0.238 # Adjusts the percentage of refugees off of your total population @refugee_percentage_adjuster = 0.005 # Minimum workers per building @minimum_workers_per_building = 0.00001 # Resource Sales Rate Constant @resource_sale_rate_constant = 0.00298 # Upper bound for math expression clamps — HOI4 requires both min and max on every clamp, so this serves as a sane "effectively unbounded" max @math_expressions_max = 1000000 # Upper clamp on spending-law base costs before the per-level multiplier; effectively unbounded, distinct from @math_expressions_max (1e6) @spending_cost_clamp_max = 100000000 # Population Tax Adjuster @population_tax_adjuster = 0.008 # GDP per-building contribution coefficients: output = total * (base_factor + prod_factor * productivity) * manpower_fulfillment @gdp_civ_base_factor = 17.5 @gdp_civ_prod_factor = 20 @gdp_mil_base_factor = 1.5 @gdp_mil_prod_factor = 1 @gdp_dockyard_base_factor = 1.5 @gdp_dockyard_prod_factor = 1 @gdp_office_base_factor = 50 @gdp_office_prod_factor = 50 @gdp_agriculture_district_base_factor = 25 @gdp_agriculture_district_prod_factor = 25 @gdp_microchip_base_factor = 32 @gdp_microchip_prod_factor = 35 @gdp_composite_base_factor = 28 @gdp_composite_prod_factor = 30 @gdp_synthetic_base_factor = 10 @gdp_synthetic_prod_factor = 10 # Spending-law base cost per capita (billion $ per 10 000 000 people) @bureau_base_cost_per_capita = 0.0007 @police_base_cost_per_capita = 0.00098 @education_base_cost_per_capita = 0.00036 @health_base_cost_per_capita = 0.00062 @social_base_cost_per_capita = 0.00115 # Civil servant salary per worker, added to the bureaucracy output term in calculate_gdp @bureau_salary_per_worker = 0.001 # tweak this to modify the operative cost of all equipment @equipment_operative_cost_multiplier = 5 setup_spending_law_tables = { clear_array = global.bureau_law_idea resize_array = { array = global.bureau_law_idea size = 1 } add_to_array = { global.bureau_law_idea = token:bureau_01 } add_to_array = { global.bureau_law_idea = token:bureau_02 } add_to_array = { global.bureau_law_idea = token:bureau_03 } add_to_array = { global.bureau_law_idea = token:bureau_04 } add_to_array = { global.bureau_law_idea = token:bureau_05 } clear_array = global.police_law_idea resize_array = { array = global.police_law_idea size = 1 } add_to_array = { global.police_law_idea = token:police_01 } add_to_array = { global.police_law_idea = token:police_02 } add_to_array = { global.police_law_idea = token:police_03 } add_to_array = { global.police_law_idea = token:police_04 } add_to_array = { global.police_law_idea = token:police_05 } clear_array = global.edu_law_idea resize_array = { array = global.edu_law_idea size = 1 } add_to_array = { global.edu_law_idea = token:edu_01 } add_to_array = { global.edu_law_idea = token:edu_02 } add_to_array = { global.edu_law_idea = token:edu_03 } add_to_array = { global.edu_law_idea = token:edu_04 } add_to_array = { global.edu_law_idea = token:edu_05 } clear_array = global.health_law_idea resize_array = { array = global.health_law_idea size = 1 } add_to_array = { global.health_law_idea = token:health_01 } add_to_array = { global.health_law_idea = token:health_02 } add_to_array = { global.health_law_idea = token:health_03 } add_to_array = { global.health_law_idea = token:health_04 } add_to_array = { global.health_law_idea = token:health_05 } add_to_array = { global.health_law_idea = token:health_06 } clear_array = global.social_law_idea resize_array = { array = global.social_law_idea size = 1 } add_to_array = { global.social_law_idea = token:social_01 } add_to_array = { global.social_law_idea = token:social_02 } add_to_array = { global.social_law_idea = token:social_03 } add_to_array = { global.social_law_idea = token:social_04 } add_to_array = { global.social_law_idea = token:social_05 } add_to_array = { global.social_law_idea = token:social_06 } clear_array = global.defence_law_idea resize_array = { array = global.defence_law_idea size = 1 } add_to_array = { global.defence_law_idea = token:defence_00 } add_to_array = { global.defence_law_idea = token:defence_01 } add_to_array = { global.defence_law_idea = token:defence_02 } add_to_array = { global.defence_law_idea = token:defence_03 } add_to_array = { global.defence_law_idea = token:defence_04 } add_to_array = { global.defence_law_idea = token:defence_05 } add_to_array = { global.defence_law_idea = token:defence_06 } add_to_array = { global.defence_law_idea = token:defence_07 } add_to_array = { global.defence_law_idea = token:defence_08 } add_to_array = { global.defence_law_idea = token:defence_09 } clear_array = global.bureau_workers resize_array = { array = global.bureau_workers size = 1 } add_to_array = { global.bureau_workers = 0.00075 } add_to_array = { global.bureau_workers = 0.0015 } add_to_array = { global.bureau_workers = 0.003 } add_to_array = { global.bureau_workers = 0.00525 } add_to_array = { global.bureau_workers = 0.009 } clear_array = global.health_workers resize_array = { array = global.health_workers size = 1 } add_to_array = { global.health_workers = 0.15 } add_to_array = { global.health_workers = 0.30 } add_to_array = { global.health_workers = 0.50 } add_to_array = { global.health_workers = 0.70 } add_to_array = { global.health_workers = 0.90 } add_to_array = { global.health_workers = 1.10 } } # Effect: setup_spending_ladders # Purpose: Populates the global per-level spending multiplier arrays once at game start for the ladders setup_spending_ladders = { setup_spending_law_tables = yes if = { limit = { NOT = { has_global_flag = spending_ladders_initialized } } clear_array = global.spending_ladder_standard add_to_array = { array = global.spending_ladder_standard value = 1 } add_to_array = { array = global.spending_ladder_standard value = 1.6 } add_to_array = { array = global.spending_ladder_standard value = 2.2 } add_to_array = { array = global.spending_ladder_standard value = 2.8 } add_to_array = { array = global.spending_ladder_standard value = 3.4 } clear_array = global.spending_ladder_education add_to_array = { array = global.spending_ladder_education value = 1 } add_to_array = { array = global.spending_ladder_education value = 2.25 } add_to_array = { array = global.spending_ladder_education value = 3.5 } add_to_array = { array = global.spending_ladder_education value = 4.75 } add_to_array = { array = global.spending_ladder_education value = 6 } clear_array = global.spending_ladder_health add_to_array = { array = global.spending_ladder_health value = 1.1 } add_to_array = { array = global.spending_ladder_health value = 2.2 } add_to_array = { array = global.spending_ladder_health value = 4.4 } add_to_array = { array = global.spending_ladder_health value = 6.5 } add_to_array = { array = global.spending_ladder_health value = 8.8 } add_to_array = { array = global.spending_ladder_health value = 11 } clear_array = global.spending_ladder_social add_to_array = { array = global.spending_ladder_social value = 1 } add_to_array = { array = global.spending_ladder_social value = 2.5 } add_to_array = { array = global.spending_ladder_social value = 4 } add_to_array = { array = global.spending_ladder_social value = 5.5 } add_to_array = { array = global.spending_ladder_social value = 7.5 } add_to_array = { array = global.spending_ladder_social value = 9.5 } clear_array = global.spending_ladder_defence add_to_array = { array = global.spending_ladder_defence value = 0.00046 } add_to_array = { array = global.spending_ladder_defence value = 0.005 } add_to_array = { array = global.spending_ladder_defence value = 0.01 } add_to_array = { array = global.spending_ladder_defence value = 0.015 } add_to_array = { array = global.spending_ladder_defence value = 0.023 } add_to_array = { array = global.spending_ladder_defence value = 0.03 } add_to_array = { array = global.spending_ladder_defence value = 0.04 } add_to_array = { array = global.spending_ladder_defence value = 0.05 } add_to_array = { array = global.spending_ladder_defence value = 0.063 } add_to_array = { array = global.spending_ladder_defence value = 0.1 } set_global_flag = spending_ladders_initialized } } # Effect: ingame_update_setup # Purpose: Aggregates every income and expense stream, then refreshes the economy UI; the weekly economic tick ingame_update_setup = { #National values (GDP, pop etc.) MUST BE FIRST update_state_variables = yes # create_dynamic_country (civil-war splits, copy_tag) can inherit an unowned capital, leaving capital_scope invalid; reassign it to an owned state. if = { limit = { any_owned_state = { always = yes } NOT = { capital_scope = { always = yes } } } random_owned_state = { ROOT = { set_capital = { state = PREV } } } } #Income calculate_int_investments_rate = yes calculate_resource_sale_rate = yes calculate_tax_gain = yes calculate_seigniorage_income = yes calculate_additional_income_rate = yes #Currency multipliers — applied after all income streams are computed apply_currency_multipliers = yes #Expenses expense_modifier_calculations = yes update_military_rate = yes update_bureaucracy_rate = yes update_police_rate = yes update_education_rate = yes update_health_rate = yes update_social_rate = yes update_infra_rate = yes calculate_interest_rate = yes calculate_additional_expense_rate = yes #Various update_economic_cycle_cost = yes update_employment_productivity_output_dynamic_modifier = yes calculate_migration_mechanic_values = yes #Visuals update_display = yes if = { limit = { is_ai = no } update_money_dirty_variable = yes refresh_investment_gui = yes } if = { limit = { is_debug = yes } log = "[GetDateText]: [THIS.GetName]: Weekly Economic Update: Treasury: [?THIS.treasury] Treasury Rate: [?THIS.treasury_rate] Debt: [?THIS.debt] Interest Rate: [?THIS.interest_rate] Population Tax Rate: [?THIS.population_tax_rate] Corporate Tax Rate: [?THIS.corporate_tax_rate]" } } # Effect: update_money_dirty_variable # Purpose: Updates the dirty variable which in turn updates the money UI and the research screen update_money_dirty_variable = { if = { limit = { is_ai = no } force_update_map_mode = { mapmode = gdp_c_map_mode } force_update_map_mode = { mapmode = energy_consumption_map_mode } force_update_map_mode = { mapmode = productivity_map_mode } md_check_research_slot_alert = yes } add_to_variable = { global.update_monie_ui = 1 } add_to_variable = { global.research_screen_ui = 1 } } # Effect: expense_modifier_calculations # Purpose: Computes the common spending modifier combining inflation and GDP-per-capita scaling expense_modifier_calculations = { set_temp_variable = { inflation_multiplier = { value = 1 add = modifier@inflation_cost_multiplier_modifier } } set_temp_variable = { gdp_scaling_modifier = { value = gdp_per_capita multiply = @spending_laws_gdp_scaling add = 1 } } set_variable = { common_money_modifier = { value = inflation_multiplier multiply = { value = gdp_per_capita multiply = @spending_laws_gdp_scaling add = 1 } } } } # Effect: calculate_tax_rate # Purpose: Calculates the tax rate of a given nation where you flow in the corporate_tax_rate of a given nation calculate_tax_rate = { hidden_effect = { if = { limit = { NOT = { has_dynamic_modifier = { modifier = impact_of_tax_dynamic_modifier } } } add_dynamic_modifier = { modifier = impact_of_tax_dynamic_modifier } } set_variable = { consumer_goods_from_corporate_tax = { value = corporate_tax_rate multiply = 0.015 } } set_variable = { receiving_investment_cost_form_corporate_tax = { value = corporate_tax_rate multiply = 0.01 } } # Productivity set_variable = { productivity_growth_modifier_from_corporate_tax = { value = corporate_tax_rate multiply = -1 add = 20 multiply = 0.005 } } set_variable = { stability_factor_from_population_tax = { value = population_tax_rate multiply = -0.01 } } # Average Tax Rate set_variable = { tax_rate = { value = corporate_tax_rate add = population_tax_rate multiply = 0.5 round = yes } } set_variable = { tax_rate_change_5 = { value = 250 multiply = { value = 1 add = modifier@tax_rate_change_multiplier_modifier } round = yes } } set_variable = { tax_rate_change = { value = 50 multiply = { value = 1 add = modifier@tax_rate_change_multiplier_modifier } round = yes } } } } # Effect: calculate_tax_gain # Purpose: Calculates the amount of taxes earned based of ROOT's corporate taxes and population taxes calculate_tax_gain = { # Update starting tax rate calculate_tax_rate = yes # Subsistence Agriculture Tax Gain Income # Build unified agriculture multiplier: 0.019 * corporate_tax_rate * 0.01 * (agricolture_productivity_modifier * agriculture_tax_modifier + 1) set_variable = { agriculture_tax_gain = { value = gdp_from_agriculture multiply = { value = modifier@agricolture_productivity_modifier multiply = modifier@agriculture_tax_modifier add = 1 multiply = corporate_tax_rate multiply = 0.00019 } clamp = { min = 0.001 max = 100000000 } } } set_temp_variable = { unified_building_multiplier = { value = @money_control_factor_scaling multiply = corporate_tax_rate # Tax Gain Multiplier multiply = { value = 1 add = modifier@tax_gain_multiplier_modifier } multiply = 0.007 # Corporate Tax Income multiply = { value = 1 add = modifier@corporate_tax_income_multiplier_modifier } # Overall productivity multiply = { value = overall_productivity divide = global.productivity_center } } } # Set base building counts (base tax constants will be factored into building-specific unified multipliers) # Civilian Factories - base constant 2.5 # Military Factories - base constant 0.2 # Naval Dockyards - base constant 0.2 # Offices - base constant 5 # Microchip Plants - base constant 4 # Composites Plants - base constant 3.5 # Synthetic Refineries - base constant 3 # Agriculture Districts - base constant 2.60 # Civilian Factories if = { limit = { check_variable = { industrial_complex_total > 0 } } set_variable = { civil_fac_tax = { value = industrial_complex_total multiply = { value = 1 add = modifier@civilian_industry_tax_modifier multiply = { value = 1 add = modifier@civilian_factories_productivity } multiply = civilian_factories_manpower_fulfillment multiply = { value = unified_building_multiplier multiply = 2.5 } } clamp = { min = 0 max = 100000000 } } } } else = { set_variable = { civil_fac_tax = 0 } } # Military Factories if = { limit = { check_variable = { military_factory_total > 0 } } set_variable = { military_fac_tax = { value = military_factory_total multiply = { value = 1 add = modifier@military_industry_tax_modifier multiply = { value = 1 add = modifier@military_factories_productivity } multiply = military_factories_manpower_fulfillment multiply = { value = unified_building_multiplier multiply = 0.2 } } clamp = { min = 0 max = 100000000 } } } } else = { set_variable = { military_fac_tax = 0 } } # Dockyards if = { limit = { check_variable = { naval_factory_total > 0 } } set_variable = { dockyard_tax = { value = naval_factory_total multiply = { value = 1 add = modifier@dockyard_income_tax_modifier multiply = { value = 1 add = modifier@dockyard_productivity } multiply = naval_factories_manpower_fulfillment multiply = { value = unified_building_multiplier multiply = 0.2 } } clamp = { min = 0 max = 100000000 } } } } else = { set_variable = { dockyard_tax = 0 } } # Offices if = { limit = { check_variable = { office_park_total > 0 } } set_variable = { office_tax = { value = office_park_total multiply = { value = 1 add = modifier@office_park_income_tax_modifier multiply = { value = 1 add = modifier@offices_productivity } multiply = offices_manpower_fulfillment multiply = { value = unified_building_multiplier multiply = 5 } } clamp = { min = 0 max = 100000000 } } } } else = { set_variable = { office_tax = 0 } } # Agriculture Districts if = { limit = { check_variable = { agriculture_district_total > 0 } } set_variable = { agriculture_district_tax = { value = agriculture_district_total multiply = { value = 1 add = modifier@agriculture_district_income_tax_modifier multiply = { value = 1 add = modifier@agricolture_productivity_modifier } multiply = agriculture_district_manpower_fulfillment multiply = { value = unified_building_multiplier multiply = 2.6 } } clamp = { min = 0 max = 100000000 } } } } else = { set_variable = { agriculture_district_tax = 0 } } # Microchip Plants if = { limit = { check_variable = { microchip_plant_total > 0 } } set_variable = { microchip_plant_tax = { value = microchip_plant_total multiply = { value = 1 add = modifier@microchip_plant_income_tax_modifier multiply = { value = 1 add = modifier@microchip_plant_productivity_modifier } multiply = microchip_plant_manpower_fulfillment multiply = { value = unified_building_multiplier multiply = 3.6 } } clamp = { min = 0 max = 100000000 } } } } else = { set_variable = { microchip_plant_tax = 0 } } # Composite Plants if = { limit = { check_variable = { composite_plant_total > 0 } } set_variable = { composite_plant_tax = { value = composite_plant_total multiply = { value = 1 add = modifier@composite_plant_income_tax_modifier multiply = { value = 1 add = modifier@composite_plant_productivity_modifier } multiply = composite_plant_manpower_fulfillment multiply = { value = unified_building_multiplier multiply = 3.15 } } clamp = { min = 0 max = 100000000 } } } } else = { set_variable = { composite_plant_tax = 0 } } # Synthetic Refineries if = { limit = { check_variable = { synthetic_refinery_total > 0 } } set_variable = { synthetic_refinery_tax = { value = synthetic_refinery_total multiply = { value = 1 add = modifier@synthetic_refinery_productivity_modifier multiply = { value = 1 add = modifier@synthetic_refinery_income_tax_modifier } multiply = synthetic_refinery_manpower_fulfillment multiply = { value = unified_building_multiplier multiply = 2.7 } } clamp = { min = 0 max = 100000000 } } } } else = { set_variable = { synthetic_refinery_tax = 0 } } # Nuclear Reactors if = { limit = { check_variable = { nuclear_reactors > 0 } } set_variable = { nuclear_reactor_tax = { value = nuclear_reactors multiply = { value = 1 add = modifier@infrastructure_tax_gain_multiplier_modifier multiply = nuclear_reactors_manpower_fulfillment multiply = { value = unified_building_multiplier multiply = 2.875 } } clamp = { min = 0 max = 100000000 } } } } else = { set_variable = { nuclear_reactor_tax = 0 } } # Fossil Power Plants if = { limit = { check_variable = { number_of_fossil_pps > 0 } } set_variable = { fossil_powerplant_tax = { value = number_of_fossil_pps multiply = { value = 1 add = modifier@infrastructure_tax_gain_multiplier_modifier multiply = fossil_powerplants_manpower_fulfillment multiply = { value = unified_building_multiplier multiply = 0.31875 } } clamp = { min = 0 max = 100000000 } } } } else = { set_variable = { fossil_powerplant_tax = 0 } } # Renewable Energy Infrastructure if = { limit = { check_variable = { renewable_energy_infra > 0 } } set_variable = { renewable_energy_tax = { value = renewable_energy_infra multiply = { value = 1 add = modifier@infrastructure_tax_gain_multiplier_modifier multiply = renewable_energy_infra_manpower_fulfillment multiply = { value = unified_building_multiplier multiply = 1.5 } } clamp = { min = 0 max = 100000000 } } } } else = { set_variable = { renewable_energy_tax = 0 } } # Internet Stations if = { limit = { check_variable = { internet_station_total > 0 } } set_variable = { internet_station_tax = { value = internet_station_total multiply = { value = 1 add = modifier@infrastructure_tax_gain_multiplier_modifier multiply = internet_stations_manpower_fulfillment multiply = { value = unified_building_multiplier multiply = 0.525 } } clamp = { min = 0 max = 100000000 } } } } else = { set_variable = { internet_station_tax = 0 } } # Rail Terminals if = { limit = { check_variable = { rail_terminal_total > 0 } } set_variable = { rail_terminal_tax = { value = rail_terminal_total multiply = { value = 1 add = modifier@infrastructure_tax_gain_multiplier_modifier multiply = rail_terminal_manpower_fulfillment multiply = { value = unified_building_multiplier multiply = 0.4375 } } clamp = { min = 0 max = 100000000 } } } } else = { set_variable = { rail_terminal_tax = 0 } } # Healthcare Corporate Income Tax # Represents the private healthcare market: hospitals, pharmaceutical companies, medical devices, insurance # Uses healthcare_gdp_var computed in calculate_gdp (last cycle) as the tax base if = { limit = { has_idea = health_01 } set_temp_variable = { healthcare_income_rate = 0.01 } } else_if = { limit = { has_idea = health_02 } set_temp_variable = { healthcare_income_rate = 0.016 } } else_if = { limit = { has_idea = health_03 } set_temp_variable = { healthcare_income_rate = 0.022 } } else_if = { limit = { has_idea = health_04 } set_temp_variable = { healthcare_income_rate = 0.028 } } else_if = { limit = { has_idea = health_05 } set_temp_variable = { healthcare_income_rate = 0.034 } } else_if = { limit = { has_idea = health_06 } set_temp_variable = { healthcare_income_rate = 0.04 } } set_variable = { healthcare_tax_gain = { value = healthcare_gdp_var multiply = healthcare_income_rate multiply = { value = 1 add = modifier@healthcare_income_multiplier_modifier clamp = { min = 0 max = 100 } } # Corporate tax rate + display factor (0.007) + gain multipliers # Does NOT include overall_productivity — healthcare_gdp_var already absorbed it via gdp_total multiply = { value = corporate_tax_rate multiply = { value = 1 add = modifier@tax_gain_multiplier_modifier } multiply = 0.007 multiply = { value = 1 add = modifier@corporate_tax_income_multiplier_modifier } } clamp = { min = 0 max = 100000000 } } } set_variable = { corporate_tax = { value = 0 add = healthcare_tax_gain add = agriculture_tax_gain add = agriculture_district_tax add = civil_fac_tax add = military_fac_tax add = dockyard_tax add = office_tax add = microchip_plant_tax add = composite_plant_tax add = synthetic_refinery_tax add = nuclear_reactor_tax add = fossil_powerplant_tax add = renewable_energy_tax add = internet_station_tax add = rail_terminal_tax clamp = { min = 0 max = 100000000 } } } ##POP set_variable = { population_tax = { value = population_total_m multiply = population_tax_rate multiply = 0.45 # Build unified population tax multiplier: gdp/c_scaling * (1 + pop_tax_modifier) * tax gain modifier * 0.007 multiply = { value = gdp_per_capita multiply = @population_tax_adjuster add = 0.75 multiply = { value = 1 add = modifier@tax_gain_multiplier_modifier } multiply = { value = 1 add = modifier@population_tax_income_multiplier_modifier } multiply = 0.007 } clamp = { min = 0 max = 100000000 } } } set_variable = { tax_gain = { value = corporate_tax add = population_tax } } } # Effect: calculate_additional_income_rate # Purpose: Aggregates special income sources (seigniorage, ideas, canal revenue, foreign aid) calculate_additional_income_rate = { set_variable = { additional_income_rate = 0 } # Apply seigniorage_income_modifier as a multiplier on the issuer base: # income = base × (1 + modifier). When no decision is active modifier = 0, # so the factor is 1.0 and the base is unchanged. if = { limit = { check_variable = { seigniorage_base > 0 } } add_to_temp_variable = { seigniorage_mod = 1.0 } multiply_temp_variable = { seigniorage_base = seigniorage_mod } add_to_variable = { additional_income_rate = seigniorage_base } set_variable = { seigniorage_income_display = seigniorage_base } } else = { set_variable = { seigniorage_income_display = 0 } } # Additional incomes, set income amount as a variable (weekly gain) if = { limit = { original_tag = GRN } if = { limit = { has_idea = GRN_idea_colonial_subsidy } set_temp_variable = { GRN_colonial_subsidy = 0.300 } add_to_variable = { additional_income_rate = GRN_colonial_subsidy } } } if = { limit = { original_tag = HEZ } if = { limit = { has_idea = HEZ_our_cartels_in_south_america } set_variable = { HEZ_south_american_cartels_income = 0.250 } add_to_variable = { additional_income_rate = HEZ_south_american_cartels_income } } if = { limit = { has_completed_focus = HEZ_International_Hezbollah } add_to_variable = { additional_income_rate = hezbollah_weekly_income_from_sold_weapons_variable } } if = { limit = { OR = { has_idea = HEZ_iranian_business_5 has_idea = HEZ_iranian_business_6 } } set_variable = { HEZ_iranian_business_income = 0.200 } add_to_variable = { additional_income_rate = HEZ_iranian_business_income } } if = { limit = { has_completed_focus = HEZ_Lebanese_Support country_exists = LEB NOT = { has_war_with = LEB } } if = { limit = { LEB = { OR = { AND = { check_variable = { influence_array^0 = HEZ } check_variable = { influence_array_val^0 > 49.999 } } AND = { check_variable = { influence_array^1 = HEZ } check_variable = { influence_array_val^1 > 49.999 } } } } } set_variable = { HEZ_lebanese_support_money = 2.000 } } else_if = { limit = { LEB = { OR = { AND = { check_variable = { influence_array^0 = HEZ } check_variable = { influence_array_val^0 > 19.999 } } AND = { check_variable = { influence_array^1 = HEZ } check_variable = { influence_array_val^1 > 19.999 } } AND = { check_variable = { influence_array^2 = HEZ } check_variable = { influence_array_val^2 > 19.999 } } AND = { check_variable = { influence_array^3 = HEZ } check_variable = { influence_array_val^3 > 19.999 } } } } } set_variable = { HEZ_lebanese_support_money = 1.000 } } else = { set_variable = { HEZ_lebanese_support_money = 0.250 } } add_to_variable = { additional_income_rate = HEZ_lebanese_support_money } } if = { limit = { has_completed_focus = HEZ_Increased_Iranian_Support country_exists = PER has_government = communism NOT = { has_war_with = PER } } if = { limit = { PER = { OR = { AND = { check_variable = { influence_array^0 = HEZ } check_variable = { influence_array_val^0 > 49.999 } } AND = { check_variable = { influence_array^1 = HEZ } check_variable = { influence_array_val^1 > 49.999 } } } } } set_variable = { HEZ_iranian_support_money = 2.000 } } else_if = { limit = { PER = { OR = { AND = { check_variable = { influence_array^0 = HEZ } check_variable = { influence_array_val^0 > 19.999 } } AND = { check_variable = { influence_array^1 = HEZ } check_variable = { influence_array_val^1 > 19.999 } } AND = { check_variable = { influence_array^2 = HEZ } check_variable = { influence_array_val^2 > 19.999 } } AND = { check_variable = { influence_array^3 = HEZ } check_variable = { influence_array_val^3 > 19.999 } } } } } set_variable = { HEZ_iranian_support_money = 1.000 } } else = { set_variable = { HEZ_iranian_support_money = 0.250 } } add_to_variable = { additional_income_rate = HEZ_iranian_support_money } } if = { limit = { always = yes } # This is to stop Hezbollah's economy collapsing early. set_variable = { HEZ_unknown_funds_income = 0.400 } add_to_variable = { additional_income_rate = HEZ_unknown_funds_income } } } if = { limit = { has_idea = full_control_of_suez } set_variable = { additional_income_suez = 0.1 } add_to_variable = { additional_income_rate = additional_income_suez } } if = { limit = { has_idea = partial_control_of_suez } set_variable = { additional_income_suez_partial = 0.05 } add_to_variable = { additional_income_rate = additional_income_suez_partial } } if = { limit = { has_idea = full_control_of_panama } set_variable = { additional_income_panama = 0.05 } add_to_variable = { additional_income_rate = additional_income_panama } } if = { limit = { has_idea = gateway_to_asia } set_variable = { gateway_to_asia_income = 0.1 } add_to_variable = { additional_income_rate = gateway_to_asia_income } } if = { limit = { has_idea = MICROSTATE_fix } set_variable = { additional_income_microstate_fix_var = 0.35 } add_to_variable = { additional_income_rate = additional_income_microstate_fix_var } } if = { limit = { has_idea = saudi_aid } set_variable = { additional_income_saudi_aid = { value = population_total multiply = 0.00002 } } #Millions of people add_to_variable = { additional_income_rate = additional_income_saudi_aid } } if = { limit = { has_idea = iranian_aid } set_variable = { additional_income_iranian_aid = { value = gdp_total multiply = 0.004 } } #20% of GDP yearly add_to_variable = { additional_income_rate = additional_income_iranian_aid } } if = { limit = { has_idea = iranian_aid_custom } set_variable = { additional_income_iranian_aid_custom = { value = gdp_total multiply = 0.004 } } #20% of GDP yearly add_to_variable = { additional_income_rate = additional_income_iranian_aid_custom } } if = { limit = { check_variable = { ROOT.pmc_profits > 0 } } set_variable = { additional_income_pmc = ROOT.pmc_profits } add_to_variable = { additional_income_rate = additional_income_pmc } } if = { limit = { has_country_flag = is_cartel_nation } if = { limit = { has_country_flag = CARTEL_deal_with_the_devil_flag } set_variable = { cartel_deal_with_the_devil = { value = gdp_total multiply = 0.005 } } add_to_variable = { additional_income_rate = cartel_deal_with_the_devil } } if = { limit = { OR = { neutrality_neutral_oligarch_are_in_power = yes has_dynamic_modifier = { modifier = narco_state_bonuses } } } set_temp_variable = { strength_modifier = { value = ROOT.strength_of_cartels multiply = 0.01 add = 1 } } set_variable = { CARTEL_drug_trade_money = { value = gdp_total multiply = 0.009 multiply = strength_modifier } } add_to_variable = { additional_income_rate = CARTEL_drug_trade_money } } } if = { limit = { has_idea = agrarian_economy } set_variable = { additional_income_agrarian_economy = weekly_harvest_billion } add_to_variable = { additional_income_rate = additional_income_agrarian_economy } } # EU if = { limit = { NOT = { has_global_flag = GAME_RULE_eu_disabled } } if = { limit = { has_idea = EU_member NOT = { has_idea = EUU_subsidies_suspended } } set_variable = { EU_subsidies = { value = THIS.EU_natural_subsidies add = THIS.EU_growth_subsidies add = THIS.EU_admin_subsidies add = THIS.EU_global_exp_subsidies multiply = 0.019 } } add_to_variable = { additional_income_rate = EU_subsidies } } } if = { limit = { has_idea = blood_diamond_trade } set_variable = { additional_income_blood_diamond_trade = 0.04 } add_to_variable = { additional_income_rate = additional_income_blood_diamond_trade } } if = { limit = { has_idea = USA_usaid } set_variable = { additional_income_USA_usaid = { value = population_total multiply = 0.00016 } } #Millions of people add_to_variable = { additional_income_rate = additional_income_USA_usaid } } if = { limit = { has_idea = HOL_dutchaid } set_variable = { additional_income_HOL_dutchaid = { value = population_total multiply = 0.00004 } } #Millions of people add_to_variable = { additional_income_rate = additional_income_HOL_dutchaid } } # Overlord Subsidization if = { limit = { has_country_flag = overlord_subsidies } set_variable = { additional_income_overlord_subsidies = { value = gdp_total multiply = 0.005 } } add_to_variable = { additional_income_rate = additional_income_overlord_subsidies } } # Imposing Taxation on Religious Institutions if = { limit = { has_idea = internal_factions_taxing_religious_institutions } set_variable = { additional_income_taxing_religious_institutions = population_total_m } set_temp_variable = { gdp_per_capita_temp = { value = gdp_per_capita divide = 750 } } multiply_variable = { additional_income_taxing_religious_institutions = gdp_per_capita_temp } add_to_variable = { additional_income_rate = additional_income_taxing_religious_institutions } } # Landmark Income from Tourism if = { limit = { has_full_control_of_state = 177 } set_temp_variable = { total_arabic_population = 0 } for_each_scope_loop = { array = global.arabic_countries add_to_temp_variable = { PREV.total_arabic_population = population_total_m } } set_variable = { additional_income_landmark_kaaba_tourism = { value = total_arabic_population multiply = 0.003 } } add_to_variable = { additional_income_rate = additional_income_landmark_kaaba_tourism } } # Country Specific Income # Abkhazia if = { limit = { original_tag = ABK } if = { limit = { has_idea = ABK_tourism1_idea } set_variable = { additional_income_ABK_tourism = 0.20 } add_to_variable = { additional_income_rate = additional_income_ABK_tourism } } if = { limit = { has_idea = ABK_tourism2_idea } set_variable = { additional_income_ABK_tourism2 = 0.35 } add_to_variable = { additional_income_rate = additional_income_ABK_tourism2 } } } # Albion Defence Services else_if = { limit = { original_tag = ADS } if = { limit = { has_idea = ENG_ADS_money } set_variable = { additional_income_ENG_ADS_money = 2.0 } #10% of GDP yearly estimated weekly add_to_variable = { additional_income_rate = additional_income_ENG_ADS_money } } } # United Kingdom else_if = { limit = { original_tag = ENG } if = { limit = { has_idea = ENG_the_macabre_alliance } set_variable = { additional_income_ENG_columbia_oil = { value = COL.oil_exports multiply = 0.2 } } add_to_variable = { additional_income_rate = additional_income_ENG_columbia_oil } } } # Afghanistan else_if = { limit = { original_tag = AFG } if = { limit = { has_idea = AFG_idea_opium_economy } set_variable = { additional_income_AFG_idea_opium_economy = { value = population_total multiply = 0.00375 } } #Millions of people add_to_variable = { additional_income_rate = additional_income_AFG_idea_opium_economy } } if = { limit = { has_idea = AFG_idea_opium_barons } set_variable = { additional_income_AFG_idea_opium_barons = { value = population_total multiply = 0.00625 } } #Millions of people add_to_variable = { additional_income_rate = additional_income_AFG_idea_opium_barons } } if = { limit = { has_idea = AFG_idea_state_sponsored_opium_industry } set_variable = { additional_income_AFG_idea_state_sponsored_opium_industry = { value = population_total multiply = 0.00875 } } #per million of people add_to_variable = { additional_income_rate = additional_income_AFG_idea_state_sponsored_opium_industry } } if = { limit = { has_idea = AFG_agro_income1 } set_variable = { additional_income_AFG_agro_modernisation = 0.12 } add_to_variable = { additional_income_rate = additional_income_AFG_agro_modernisation } } if = { limit = { has_idea = AFG_western_klep1 } set_variable = { additional_income_AFG_western_klep1 = 0.18 } add_to_variable = { additional_income_rate = additional_income_AFG_western_klep1 } } if = { limit = { has_idea = AFG_tolls_income1 } #Maintained by AFG_update_national_tollage, which runs when a toll level or state control moves add_to_variable = { additional_income_rate = additional_income_AFG_tolls_income1 } } } # Armenia else_if = { limit = { original_tag = ARM } if = { limit = { has_idea = ARM_has_artsakh_idea } set_variable = { additional_income_ARM_marz_arm = 0.350 } add_to_variable = { additional_income_rate = additional_income_ARM_marz_arm } } } # Belarus else_if = { limit = { original_tag = BLR } if = { limit = { has_idea = BLR_tourism } set_variable = { additional_income_BLR_tourism = 0.15 } add_to_variable = { additional_income_rate = additional_income_BLR_tourism } } if = { limit = { has_idea = BLR_Kommunarka_invest } set_variable = { BLR_Kommunarka_invest_gain = 0.02 } add_to_variable = { additional_income_rate = BLR_Kommunarka_invest_gain } } if = { limit = { has_idea = BLR_Kommunarka_invest_cis } set_variable = { BLR_Kommunarka_invest_cis_gain = 0.12 } add_to_variable = { additional_income_rate = BLR_Kommunarka_invest_cis_gain } } if = { limit = { has_idea = BLR_minotor_servise_blr } set_variable = { additional_income_BLR_minotor_servise_blr = 0.300 } add_to_variable = { additional_income_rate = additional_income_BLR_minotor_servise_blr } } if = { limit = { has_idea = BLR_mzkt_contract_blr } set_variable = { additional_income_BLR_mzkt_contract_blr = 0.100 } add_to_variable = { additional_income_rate = additional_income_BLR_mzkt_contract_blr } } if = { limit = { check_variable = { BLR.current_azot_capacity > 0 } } set_variable = { additional_income_azot = { value = BLR.current_azot_capacity multiply = 0.050 } } add_to_variable = { additional_income_rate = additional_income_azot } } if = { limit = { has_idea = BLR_kal_with } set_variable = { additional_income_BLR_kal_with = 0.150 } add_to_variable = { additional_income_rate = additional_income_BLR_kal_with } } else_if = { limit = { has_idea = BLR_kal_without } set_variable = { additional_income_BLR_kal_without = 0.210 } add_to_variable = { additional_income_rate = additional_income_BLR_kal_without } } } # Bolivia else_if = { limit = { original_tag = BOL } if = { limit = { OR = { has_idea = BOL_tourism has_idea = BOL_tourism2 } } set_variable = { additional_income_BOL_tourism = 0.50 } add_to_variable = { additional_income_rate = additional_income_BOL_tourism } } } # Bosnia else_if = { limit = { original_tag = BOS } if = { limit = { has_idea = BOS_SFOR } set_variable = { BOS_united_nations_aid = 0.4 } add_to_variable = { additional_income_rate = BOS_united_nations_aid } } if = { limit = { has_idea = BOS_EUFOR } set_variable = { BOS_EUFOR_aid_money = 0.2 } add_to_variable = { additional_income_rate = BOS_EUFOR_aid_money } } if = { limit = { has_idea = BOS_diaspora_remittances } set_variable = { BOS_diaspora_remittances_income = gdp_total } multiply_variable = { BOS_diaspora_remittances_income = 0.002 } #10% of GDP yearly if = { limit = { has_country_flag = BOS_expanded_dual_citizenship } multiply_variable = { BOS_diaspora_remittances_income = 1.2 } } add_to_variable = { additional_income_rate = BOS_diaspora_remittances_income } } } # Botswana else_if = { limit = { original_tag = BOT } if = { limit = { has_idea = BOT_coal_focused_energy_small_profit } set_variable = { additional_income_BOT_coal_focused_energy_small_profit = 0.05 } add_to_variable = { additional_income_rate = additional_income_BOT_coal_focused_energy_small_profit } } if = { limit = { has_idea = BOT_coal_focused_energy_rich } set_variable = { additional_income_BOT_coal_focused_energy_rich = 0.1 } add_to_variable = { additional_income_rate = additional_income_BOT_coal_focused_energy_rich } } if = { limit = { has_idea = BOT_renewable_focused_energy_small_profit } set_variable = { additional_income_BOT_renewable_focused_energy_small_profit = 0.04 } add_to_variable = { additional_income_rate = additional_income_BOT_renewable_focused_energy_small_profit } } if = { limit = { has_idea = BOT_renewable_focused_energy_rich } set_variable = { additional_income_BOT_renewable_focused_energy_rich = 0.08 } add_to_variable = { additional_income_rate = additional_income_BOT_renewable_focused_energy_rich } } } # Bulgaria else_if = { limit = { original_tag = BUL } if = { limit = { has_idea = BUL_tourism_0 } set_variable = { additional_income_BUL_tourism = 0.075 } add_to_variable = { additional_income_rate = additional_income_BUL_tourism } } if = { limit = { has_idea = BUL_tourism_1 } set_variable = { additional_income_BUL_tourism_1 = 0.15 } add_to_variable = { additional_income_rate = additional_income_BUL_tourism_1 } } if = { limit = { has_idea = BUL_tourism_2 } set_variable = { additional_income_BUL_tourism_2 = 0.30 } add_to_variable = { additional_income_rate = additional_income_BUL_tourism_2 } } if = { limit = { has_idea = BUL_sunny_beach_revenue } set_variable = { additional_income_BUL_sunny_beach = 0.60 } add_to_variable = { additional_income_rate = additional_income_BUL_sunny_beach } } if = { limit = { has_idea = BUL_borovets_revenue } set_variable = { additional_income_BUL_borovets = 0.40 } add_to_variable = { additional_income_rate = additional_income_BUL_borovets } } if = { limit = { has_idea = BUL_varna_beaches_revenue } set_variable = { additional_income_BUL_varna_beaches = 0.45 } add_to_variable = { additional_income_rate = additional_income_BUL_varna_beaches } } } # Chechnya else_if = { limit = { original_tag = CHE } if = { limit = { has_idea = CHE_black_market_idea } set_variable = { additional_income_CHE_black_market_idea = 0.030 } add_to_variable = { additional_income_rate = additional_income_CHE_black_market_idea } } if = { limit = { has_idea = CHE_black_market_idea_aze } set_variable = { additional_income_CHE_black_market_idea_aze = 0.060 } add_to_variable = { additional_income_rate = additional_income_CHE_black_market_idea_aze } } if = { limit = { has_idea = CHE_black_market_idea_tur } set_variable = { additional_income_CHE_black_market_idea_tur = 0.120 } add_to_variable = { additional_income_rate = additional_income_CHE_black_market_idea_tur } } if = { limit = { has_idea = CHE_black_market_idea_arm } set_variable = { additional_income_CHE_black_market_idea_arm = 0.060 } add_to_variable = { additional_income_rate = additional_income_CHE_black_market_idea_arm } } if = { limit = { has_idea = CHE_black_market_idea_per } set_variable = { additional_income_CHE_black_market_idea_per = 0.120 } add_to_variable = { additional_income_rate = additional_income_CHE_black_market_idea_per } } if = { limit = { has_idea = CHE_narcos4_idea } set_variable = { additional_income_CHE_narcos4_idea = 0.080 } add_to_variable = { additional_income_rate = additional_income_CHE_narcos4_idea } } if = { limit = { has_idea = CHE_narcos5_idea } set_variable = { additional_income_CHE_narcos5_idea = 0.160 } add_to_variable = { additional_income_rate = additional_income_CHE_narcos5_idea } } } # Comoros else_if = { limit = { original_tag = COM } if = { limit = { has_completed_focus = COM_african_mercenaries has_completed_focus = COM_a_rifle_for_hire } set_variable = { additional_income_COM_african_mercenaries = { value = 0.500 multiply = COM_volunteer_nations^num } } add_to_variable = { additional_income_rate = additional_income_COM_african_mercenaries } } else_if = { limit = { OR = { has_completed_focus = COM_african_mercenaries has_completed_focus = COM_a_rifle_for_hire } } set_variable = { additional_income_COM_african_mercenaries = { value = 0.350 multiply = COM_volunteer_nations^num } } add_to_variable = { additional_income_rate = additional_income_COM_african_mercenaries } } } #Crimea else_if = { limit = { original_tag = CRM } if = { limit = { has_idea = CRM_tourism_idea } set_variable = { additional_income_CRM_tourism_idea = 0.100 } add_to_variable = { additional_income_rate = additional_income_CRM_tourism_idea } } if = { limit = { has_idea = CRM_naval } set_variable = { additional_income_CRM_naval = 0.045 } add_to_variable = { additional_income_rate = additional_income_CRM_naval } } } # Denmark else_if = { limit = { original_tag = DEN } if = { limit = { has_dynamic_modifier = { modifier = DEN_colonial_holding_modifier } } set_variable = { additional_income_gulf_exploitation = { value = gdp_total multiply = 0.0003 } } add_to_variable = { additional_income_rate = additional_income_gulf_exploitation } } set_variable = { additional_income_DEN_consume_tax = { value = gdp_per_capita multiply = 0.0084 multiply = welfare_gain } } add_to_variable = { additional_income_rate = additional_income_DEN_consume_tax } } ##DPR # Egypt else_if = { limit = { original_tag = EGY } if = { limit = { has_idea = EGY_mubarak_money } set_variable = { additional_income_mubarak = 0.484 } add_to_variable = { additional_income_rate = additional_income_mubarak } } if = { limit = { has_idea = EGY_us_helps } set_variable = { additional_income_us_helps = 0.215 } add_to_variable = { additional_income_rate = additional_income_us_helps } } if = { limit = { has_idea = EGY_suez_deal_idea } set_variable = { additional_income_newsuez = 0.215 } add_to_variable = { additional_income_rate = additional_income_newsuez } } if = { limit = { has_idea = EGY_al_azhar_uni_idea } set_variable = { additional_income_azhar = 0.215 } add_to_variable = { additional_income_rate = additional_income_azhar } } if = { limit = { check_variable = { EGY.current_evergreen_capacity > 0 } } set_variable = { additional_income_evergreen = { value = EGY.current_evergreen_capacity multiply = 0.1 } } add_to_variable = { additional_income_rate = additional_income_evergreen } } } # France else_if = { limit = { original_tag = FRA } if = { limit = { has_idea = FRA_idea_Light_for_Europe } set_variable = { additional_income_FRA_Light_for_Europe = 2.00 } add_to_variable = { additional_income_rate = additional_income_FRA_Light_for_Europe } } if = { limit = { has_idea = FRA_cfa_franc_custodian } set_variable = { FRA_cfa_franc_gdp_total = { value = 0 every_collection = { named_collection = FRA_cfa_franc_nations_collection add = gdp_total } } } set_variable = { additional_income_FRA_cfa_franc_custodian = { value = FRA_cfa_franc_gdp_total multiply = 0.0025 } } add_to_variable = { additional_income_rate = additional_income_FRA_cfa_franc_custodian } } if = { limit = { has_completed_focus = FRA_the_space_program is_subject = no has_capitulated = no } add_to_variable = { additional_income_rate = FRA.FRA_space_income_var } # NOTE: This can be negative as its an income } } # Georgia else_if = { limit = { original_tag = GEO } if = { limit = { has_idea = GEO_nationalized_gold_reserves_idea } set_variable = { additional_income_GEO_nationalized_gold_reserves = 0.175 } add_to_variable = { additional_income_rate = additional_income_GEO_nationalized_gold_reserves } } } #Germany else_if = { limit = { original_tag = GER } if = { limit = { has_idea = GER_russian_buddies } set_variable = { additional_income_GER_russian_buddies = { value = gdp_total multiply = 0.0004 } } #2% of yearly GDP yearly estimated weekly add_to_variable = { additional_income_rate = additional_income_GER_russian_buddies } } if = { limit = { has_idea = GER_idea_okosteuer } set_variable = { additional_income_GER_Ökosteuer = { value = GER.gdp_per_capita multiply = 0.009 } } #2% of yearly GDP estimated weekly add_to_variable = { additional_income_rate = additional_income_GER_Ökosteuer } } if = { limit = { has_country_flag = GER_Solidaritatszuschlag } set_variable = { additional_income_GER_Solidaritatszuschlag = { value = GER.gdp_per_capita multiply = 0.0044 } } #2% of yearly GDP estimated weekly add_to_variable = { additional_income_rate = additional_income_GER_Solidaritatszuschlag } } if = { limit = { has_country_flag = GER_Mehrwertsteuer } set_variable = { additional_income_GER_Mehrwertsteuer = { value = GER.gdp_per_capita multiply = 0.052 } } #8% of yearly GDP add_to_variable = { additional_income_rate = additional_income_GER_Mehrwertsteuer } } } # Vatican City else_if = { limit = { original_tag = HLS } if = { limit = { has_idea = HLS_idea_holy_see } set_variable = { HLS_holy_see_tithe_income = { value = 0 every_collection = { named_collection = christian_countries_of_the_world_collection add = gdp_total } multiply = 0.00002 } } add_to_variable = { additional_income_rate = HLS_holy_see_tithe_income } } } #Netherlands else_if = { limit = { original_tag = HOL } if = { limit = { has_country_flag = HOL_BOT } set_variable = { additional_income_HOL_BOT = { value = HOL.gdp_per_capita multiply = 0.0004 } } #2% of yearly GDP add_to_variable = { additional_income_rate = additional_income_HOL_BOT } } if = { limit = { has_idea = HOL_weed_center1 } set_variable = { additional_income_HOL_Weed_Center1 = { value = HOL.gdp_per_capita multiply = 0.002 } } #10% of yearly GDP add_to_variable = { additional_income_rate = additional_income_HOL_Weed_Center1 } } } # Iraq else_if = { limit = { original_tag = IRQ } if = { limit = { has_idea = IRQ_mosque_income_idea } set_variable = { additional_income_IRQ_mosque_donations = 0.200 } add_to_variable = { additional_income_rate = additional_income_IRQ_mosque_donations } } if = { limit = { OR = { has_idea = IRQ_party_coffers has_idea = IRQ_party_coffers3 } } set_variable = { additional_income_IRQ_party_coffers_1 = 0.100 } add_to_variable = { additional_income_rate = additional_income_IRQ_party_coffers_1 } } if = { limit = { has_idea = IRQ_party_coffers2 } set_variable = { additional_income_IRQ_party_coffers_2 = 0.300 } add_to_variable = { additional_income_rate = additional_income_IRQ_party_coffers_2 } } } #ISRAEL else_if = { limit = { original_tag = ISR } if = { limit = { has_idea = civ_guns_exports } set_variable = { additional_income_civ_guns = 0.484 } add_to_variable = { additional_income_rate = additional_income_civ_guns } } if = { limit = { has_idea = ISR_gay_parades } set_variable = { additional_earn_lgbt = 0.488 } add_to_variable = { additional_income_rate = additional_earn_lgbt } } } # Kazakhstan else_if = { limit = { original_tag = KAZ } if = { limit = { has_idea = SOV_baikonur_kaz_idea } set_variable = { additional_income_SOV_baikonur_kaz_idea = 0.055 } add_to_variable = { additional_income_rate = additional_income_SOV_baikonur_kaz_idea } } } #Yugra else_if = { limit = { original_tag = KHM } if = { limit = { has_idea = KHM_Idea_Forestry_Development } set_variable = { additional_income_KHM_Forestry_Development = 0.082 } add_to_variable = { additional_income_rate = additional_income_KHM_Forestry_Development } } } ##South KOREA else_if = { limit = { original_tag = KOR } if = { limit = { has_idea = KOR_samsung_phone_sales } set_variable = { additional_income_KOR_samsung_phone_sales_gain = 0.5 } add_to_variable = { additional_income_rate = additional_income_KOR_samsung_phone_sales_gain } } } # Kosovo else_if = { limit = { original_tag = KOS } if = { limit = { has_idea = KOS_international_aid } set_variable = { KOS_international_aid_income = 0.3 } add_to_variable = { additional_income_rate = KOS_international_aid_income } } } #Libya else_if = { limit = { OR = { original_tag = LBA original_tag = FEZ original_tag = CYR original_tag = TRP } NOT = { has_country_flag = libya_noc_dismantled } } set_variable = { libya_oil_nationalisation_additional_income = { value = resource_produced@oil multiply = oil_nationalisation_income } } add_to_variable = { additional_income_rate = libya_oil_nationalisation_additional_income } } # Liechtenstein else_if = { limit = { original_tag = LIC } if = { limit = { has_idea = LIC_idea_international_investments } set_variable = { additional_income_LIC_international_investments = 0.4 } add_to_variable = { additional_income_rate = additional_income_LIC_international_investments } } if = { limit = { has_idea = LIC_idea_USA_cooperation } set_variable = { additional_income_LIC_USA_cooperation = 0.1 } add_to_variable = { additional_income_rate = additional_income_LIC_USA_cooperation } } if = { limit = { has_idea = LIC_idea_EU_cooperation } set_variable = { additional_income_LIC_EU_cooperation = 0.1 } add_to_variable = { additional_income_rate = additional_income_LIC_EU_cooperation } } if = { limit = { has_idea = LIC_idea_huge_tax_haven } set_variable = { additional_income_LIC_huge_tax_haven = 0.075 } add_to_variable = { additional_income_rate = additional_income_LIC_huge_tax_haven } } } # Montenegro else_if = { limit = { original_tag = MNT } if = { limit = { has_idea = MNT_yacht } set_variable = { additional_income_mnt_yacht = 0.215 } add_to_variable = { additional_income_rate = additional_income_mnt_yacht } } } ##North Korea else_if = { limit = { original_tag = NKO } if = { limit = { has_idea = NKO_korean_repair_frontline_workers_sov } set_variable = { additional_income_NKO_korean_repair_frontline_workers_sov = 0.100 } add_to_variable = { additional_income_rate = additional_income_NKO_korean_repair_frontline_workers_sov } } if = { limit = { has_idea = NKO_korean_repair_civil_workers_sov } set_variable = { additional_income_NKO_korean_repair_civil_workers_sov = 0.075 } add_to_variable = { additional_income_rate = additional_income_NKO_korean_repair_civil_workers_sov } } if = { limit = { has_idea = NKO_china_economic_assistant } set_variable = { additional_income_china_economic_assistant = 0.200 } add_to_variable = { additional_income_rate = additional_income_china_economic_assistant } } if = { limit = { has_idea = NKO_jangmadang_idea } set_variable = { additional_income_NKO_jangmadang_idea = 0.200 } add_to_variable = { additional_income_rate = additional_income_NKO_jangmadang_idea } } if = { limit = { has_country_flag = NKO_storm_corps_income_sov } set_variable = { additional_income_NKO_storm_corps_sov = 0.250 } add_to_variable = { additional_income_rate = additional_income_NKO_storm_corps_sov } } if = { limit = { has_country_flag = NKO_storm_corps_income_chi } set_variable = { additional_income_NKO_storm_corps_chi = 0.250 } add_to_variable = { additional_income_rate = additional_income_NKO_storm_corps_chi } } } # Norway else_if = { limit = { original_tag = NRY } if = { limit = { has_idea = NRY_bergen_engines } set_variable = { additional_income_NRY_engines = 0.700 } add_to_variable = { additional_income_rate = additional_income_NRY_engines } } } #Iran else_if = { limit = { original_tag = PER } if = { limit = { has_idea = PER_irgc_black_market_exploits } set_variable = { additional_income_irgc_black_market = { value = gdp_total multiply = 0.002 } } #10% of GDP yearly estimated weekly add_to_variable = { additional_income_rate = additional_income_irgc_black_market } } if = { limit = { has_idea = PER_redirecting_money_from_proxies } set_variable = { additional_income_redirection_money_from_proxies = { value = gdp_total multiply = 0.0004 } } #2% of GDP yearly estimated weekly add_to_variable = { additional_income_rate = additional_income_redirection_money_from_proxies } } if = { limit = { has_country_flag = PER_iraq_accepted_to_pay_half_billion_weekly } set_variable = { additional_income_iran_war_compensation = 0.5 } add_to_variable = { additional_income_rate = additional_income_iran_war_compensation } } if = { limit = { has_country_flag = PER_iraq_accepted_to_pay_one_billion_weekly } set_variable = { additional_income_iran_war_compensation = 1.0 } add_to_variable = { additional_income_rate = additional_income_iran_war_compensation } } if = { limit = { has_country_flag = PER_iraq_accepted_to_pay_two_billion_weekly } set_variable = { additional_income_iran_war_compensation = 2.0 } add_to_variable = { additional_income_rate = additional_income_iran_war_compensation } } } #INDIA else_if = { limit = { original_tag = RAJ } if = { limit = { has_idea = RAJ_Local_markets } set_variable = { RAJ_Local_markets_income = 0.08 } add_to_variable = { additional_income_rate = RAJ_Local_markets_income } } } # Singapore else_if = { limit = { original_tag = SIN } if = { limit = { has_dynamic_modifier = { modifier = SIN_singaporean_trade_strength } } set_variable = { SIN_tariff_income = { value = signed_trade_agreements multiply = 0.075 } } add_to_variable = { additional_income_rate = SIN_tariff_income } } if = { limit = { has_idea = SIN_temasek } set_variable = { SIN_temasek_dividend_income = 0.25 } add_to_variable = { additional_income_rate = SIN_temasek_dividend_income } } } # San-Marino else_if = { limit = { original_tag = SMA } if = { limit = { has_idea = SMA_increased_tourism } set_variable = { SMA_increased_tourism_gain = 0.2 } add_to_variable = { additional_income_rate = SMA_increased_tourism_gain } } if = { limit = { has_idea = SMA_balance_tourism_ii } set_variable = { SMA_balance_tourism_ii_gain = 0.15 } add_to_variable = { additional_income_rate = SMA_balance_tourism_ii_gain } } if = { limit = { has_idea = SMA_balance_tourism_i } set_variable = { SMA_balance_tourism_i_gain = 0.1 } add_to_variable = { additional_income_rate = SMA_balance_tourism_i_gain } } if = { limit = { has_idea = SMA_balance_balance } set_variable = { SMA_balance_balance_gain = 0.08 } add_to_variable = { additional_income_rate = SMA_balance_balance_gain } } if = { limit = { has_idea = SMA_balance_economy_i } set_variable = { SMA_balance_economy_i_gain = 0.1 } add_to_variable = { additional_income_rate = SMA_balance_economy_i_gain } } if = { limit = { has_idea = SMA_balance_economy_ii } set_variable = { SMA_balance_economy_ii_gain = 0.15 } add_to_variable = { additional_income_rate = SMA_balance_economy_ii_gain } } if = { limit = { has_idea = SMA_increased_economy } set_variable = { SMA_increased_economy_gain = 0.2 } add_to_variable = { additional_income_rate = SMA_increased_economy_gain } } } # South Ossetia else_if = { limit = { original_tag = SOO } if = { limit = { has_idea = SOO_help_ossetia } set_variable = { additional_income_SOO_help_ossetia = 0.120 } add_to_variable = { additional_income_rate = additional_income_SOO_help_ossetia } } if = { limit = { has_idea = SOO_develop_turism } set_variable = { additional_income_SOO_develop_turism = 0.100 } add_to_variable = { additional_income_rate = additional_income_SOO_develop_turism } } if = { limit = { has_idea = SOO_Idea_Forestry_Development } set_variable = { additional_income_SOO_Forestry_Development = 0.012 } add_to_variable = { additional_income_rate = additional_income_SOO_Forestry_Development } } if = { limit = { has_idea = SOO_Raise_Import_Tariffs_idea } set_variable = { additional_income_SOO_Raise_Import_Tariffs = 0.012 } add_to_variable = { additional_income_rate = additional_income_SOO_Raise_Import_Tariffs } } if = { limit = { has_idea = SOO_Roki_tunnel_toll } set_variable = { additional_income_SOO_Roki_tunnel_toll = 0.014 } add_to_variable = { additional_income_rate = additional_income_SOO_Roki_tunnel_toll } } if = { limit = { has_completed_focus = SOO_increase_tolls_on_Roki_Tunnel } set_variable = { additional_income_SOO_Roki_tunnel_toll = 0.024 } add_to_variable = { additional_income_rate = additional_income_SOO_Roki_tunnel_toll } } if = { limit = { has_completed_focus = SOO_the_Russian_bankroll } set_variable = { additional_income_SOO_russian_bank = 0.010 } add_to_variable = { additional_income_rate = additional_income_SOO_russian_bank } } if = { limit = { has_completed_focus = SOO_subsidise_the_Farmers } set_variable = { additional_income_SOO_farming_income_idea = 0.005 } add_to_variable = { additional_income_rate = additional_income_SOO_farming_income_idea } } if = { limit = { has_completed_focus = SOO_Move_towards_cash_crop_growth } set_variable = { additional_income_SOO_farming_income_idea = 0.012 } add_to_variable = { additional_income_rate = additional_income_SOO_farming_income_idea } } if = { limit = { has_completed_focus = SOO_Boost_the_local_flour_production } set_variable = { additional_income_SOO_farming_income_idea = 0.008 } add_to_variable = { additional_income_rate = additional_income_SOO_farming_income_idea } } if = { limit = { has_completed_focus = SOO_Geared_for_hardship } set_variable = { additional_income_SOO_farming_income_idea = 0.008 } add_to_variable = { additional_income_rate = additional_income_SOO_farming_income_idea } } } # Russia else_if = { limit = { original_tag = SOV } if = { limit = { check_variable = { SOV.current_azot_capacity > 0 } } set_variable = { additional_income_azot = { value = SOV.current_azot_capacity multiply = 0.050 } } add_to_variable = { additional_income_rate = additional_income_azot } } if = { limit = { has_idea = BLR_minotor_servise_sov } set_variable = { BLR_minotor_servise_sov_gain = -0.300 } add_to_variable = { additional_income_rate = BLR_minotor_servise_sov_gain } } if = { limit = { has_idea = BLR_mzkt_contract } set_variable = { BLR_mzkt_contract_gain = -0.100 } add_to_variable = { additional_income_rate = BLR_mzkt_contract_gain } } if = { limit = { has_idea = CRM_naval } set_variable = { CRM_naval_gain = -0.45 } add_to_variable = { additional_income_rate = CRM_naval_gain } } if = { limit = { has_idea = BLR_oil_sov } set_variable = { additional_income_BLR_oil_sov = 0.044 } add_to_variable = { additional_income_rate = additional_income_BLR_oil_sov } } else_if = { limit = { has_idea = BLR_oil_sov_positive } set_variable = { additional_income_BLR_oil_sov = 0.066 } add_to_variable = { additional_income_rate = additional_income_BLR_oil_sov } } if = { limit = { has_idea = SOV_kal_with } set_variable = { additional_income_SOV_kal_with = 0.150 } add_to_variable = { additional_income_rate = additional_income_SOV_kal_with } } if = { limit = { has_idea = UKR_russian_gas_sov } set_variable = { additional_income_UKR_russian_gas_sov = 0.175 } add_to_variable = { additional_income_rate = additional_income_UKR_russian_gas_sov } } if = { limit = { has_idea = UKR_russian_gas_cheap_sov } set_variable = { additional_income_UKR_russian_gas_cheap_sov = 0.100 } add_to_variable = { additional_income_rate = additional_income_UKR_russian_gas_cheap_sov } } if = { limit = { has_idea = UKR_russian_gas_cheaper_sov } set_variable = { additional_income_UKR_russian_gas_cheaper_sov = 0.100 } add_to_variable = { additional_income_rate = additional_income_UKR_russian_gas_cheaper_sov } } if = { limit = { has_completed_focus = SOV_economic_phos_agro } set_variable = { additional_income_SOV_azod_phosagro_income = 0.685 } add_to_variable = { additional_income_rate = additional_income_SOV_azod_phosagro_income } } #Jirinovsky if = { limit = { has_idea = SOV_jirik_unloyal_party_idea2 } set_variable = { additional_income_SOV_jirik_unloyal_party_idea2 = 0.300 } add_to_variable = { additional_income_rate = additional_income_SOV_jirik_unloyal_party_idea2 } } else_if = { limit = { has_idea = SOV_jirik_unloyal_party_idea3 } set_variable = { additional_income_SOV_jirik_unloyal_party_idea3 = 0.300 } add_to_variable = { additional_income_rate = additional_income_SOV_jirik_unloyal_party_idea3 } } if = { limit = { has_idea = SOV_otkos_army_idea } set_variable = { additional_income_SOV_otkos_army_idea = { value = population_total multiply = 0.00015 } } #Millions of people add_to_variable = { additional_income_rate = additional_income_SOV_otkos_army_idea } } #Gazprom Pipelines if = { limit = { has_idea = SOV_turkey_stream_sov_idea } set_variable = { additional_income_SOV_turkey_stream_sov_idea = 1.375 } add_to_variable = { additional_income_rate = additional_income_SOV_turkey_stream_sov_idea } } if = { limit = { has_idea = SOV_blue_stream_sov_idea } set_variable = { additional_income_SOV_blue_stream_sov_idea = 1.375 } add_to_variable = { additional_income_rate = additional_income_SOV_blue_stream_sov_idea } } if = { limit = { has_idea = SOV_nord_stream_sov_idea } set_variable = { additional_income_SOV_nord_stream_sov_idea = 1.375 } add_to_variable = { additional_income_rate = additional_income_SOV_nord_stream_sov_idea } } if = { limit = { has_idea = SOV_nord_stream2_sov_idea } set_variable = { additional_income_SOV_nord_stream2_sov_idea = 1.375 } add_to_variable = { additional_income_rate = additional_income_SOV_nord_stream2_sov_idea } } if = { limit = { has_idea = SOV_korean_stream_sov_idea } set_variable = { additional_income_SOV_korean_stream_sov_idea = 0.375 } add_to_variable = { additional_income_rate = additional_income_SOV_korean_stream_sov_idea } } } #Spain else_if = { limit = { original_tag = SPR } if = { limit = { has_idea = SPR_idea_tourist_industry_1 } add_to_variable = { additional_income_rate = SPR_tourism_1_effect } } if = { limit = { has_idea = SPR_idea_tourist_industry_2 } add_to_variable = { additional_income_rate = SPR_tourism_2_effect } } if = { limit = { has_idea = SPR_idea_tourist_industry_3 } add_to_variable = { additional_income_rate = SPR_tourism_3_effect } } } #Sweden else_if = { limit = { original_tag = SWE } set_variable = { additional_income_SWE_Value_added_Tax = { value = gdp_per_capita multiply = 0.0012 } } #20% of yearly GDP add_to_variable = { additional_income_rate = additional_income_SWE_Value_added_Tax } if = { limit = { country_exists = NRY } set_variable = { additional_income_SWE_border_trade = { value = NRY.gdp_per_capita multiply = 0.0002 } } #2% of yearly GDP add_to_variable = { additional_income_rate = additional_income_SWE_border_trade } } if = { limit = { NOT = { has_idea = social_01 } } set_variable = { additional_income_SWE_Social_insurance = { value = welfare_gain multiply = 0.08 } } #gdp_per_capita #30% of yearly GDP add_to_variable = { additional_income_rate = additional_income_SWE_Social_insurance } } if = { limit = { has_country_flag = SWE_idea_tourist_industry_1 NOT = { has_war = yes } } set_variable = { additional_income_SWE_tourism_1 = { value = SWE.gdp_per_capita multiply = 0.01 } } #1% of yearly GDP add_to_variable = { additional_income_rate = additional_income_SWE_tourism_1 } } if = { limit = { has_country_flag = SWE_idea_tourist_industry_2 NOT = { has_war = yes } } set_variable = { additional_income_SWE_tourism_2 = { value = SWE.gdp_per_capita multiply = 0.02 } } #2% of yearly GDP add_to_variable = { additional_income_rate = additional_income_SWE_tourism_2 } } if = { limit = { has_country_flag = SWE_idea_tourist_industry_3 NOT = { has_war = yes } } set_variable = { additional_income_SWE_tourism_3 = { value = SWE.gdp_per_capita multiply = 0.03 } } #3% of yearly GDP add_to_variable = { additional_income_rate = additional_income_SWE_tourism_3 } } if = { limit = { has_country_flag = SWE_idea_tourist_industry_4 NOT = { has_war = yes } } set_variable = { additional_income_SWE_tourism_4 = { value = SWE.gdp_per_capita multiply = 0.04 } } #3% of yearly GDP add_to_variable = { additional_income_rate = additional_income_SWE_tourism_4 } } if = { limit = { has_country_flag = SWE_Crypto_invest } add_to_variable = { additional_income_rate = SWE_Crypto_income_effect } } } # Syria else_if = { limit = { original_tag = SYR } if = { limit = { has_idea = syria_bakdash } set_variable = { syria_bakdash_income = 0.12 } add_to_variable = { additional_income_rate = syria_bakdash_income } } } # Tajikistan else_if = { limit = { original_tag = TAJ } if = { limit = { OR = { has_idea = TAJ_201st_base has_idea = TAJ_201st_base_usa has_idea = TAJ_201st_base_chi has_idea = TAJ_201st_base_raj } } set_variable = { additional_income_TAJ_201st = 0.075 } add_to_variable = { additional_income_rate = additional_income_TAJ_201st } } if = { limit = { has_idea = TAJ_201st_base_upgrade } set_variable = { additional_income_TAJ_201st_upgrade = 0.175 } add_to_variable = { additional_income_rate = additional_income_TAJ_201st_upgrade } } if = { limit = { has_idea = TAJ_gulfs_bankroll_idea } set_variable = { additional_income_TAJ_bankroll = 0.050 } add_to_variable = { additional_income_rate = additional_income_TAJ_bankroll } } } # Tatarstan else_if = { limit = { original_tag = TAT } if = { limit = { has_idea = TAT_develop_turism } set_variable = { additional_income_TAT_develop_turism = 0.100 } add_to_variable = { additional_income_rate = additional_income_TAT_develop_turism } } } # Tanzania else_if = { limit = { original_tag = TNZ } if = { limit = { has_country_flag = COM_the_zanzibar_agreement_payee } set_variable = { additional_income_COM_zanzibar_agreement_payee = 0.250 } add_to_variable = { additional_income_rate = additional_income_COM_zanzibar_agreement_payee } } } #Turkey else_if = { limit = { original_tag = TUR } if = { limit = { has_idea = TUR_taxing_bosphor } set_variable = { TUR_taxing_bosphorus = { value = gdp_total multiply = 0.002 } } #10% of GDP yearly add_to_variable = { additional_income_rate = TUR_taxing_bosphorus } } if = { limit = { has_idea = SOV_turkey_stream_idea } set_variable = { additional_expense_SOV_turkey_stream_idea = 1.375 } add_to_variable = { additional_expenses_rate = additional_expense_SOV_turkey_stream_idea } } if = { limit = { has_idea = SOV_blue_stream_idea } set_variable = { additional_expense_SOV_blue_stream_idea = 1.375 } add_to_variable = { additional_expenses_rate = additional_expense_SOV_blue_stream_idea } } } #Venezuela else_if = { limit = { original_tag = VEN } if = { limit = { has_idea = VEN_iron_control_vdp } set_variable = { additional_income_iron_control_vdp = { value = gdp_total multiply = 0.002 } } #10% of GDP yearly estimated weekly add_to_variable = { additional_income_rate = additional_income_iron_control_vdp } } } if = { limit = { has_idea = AZE_indian_ports_idea } set_variable = { AZE_indian_ports_idea_gain = 0.25 } add_to_variable = { additional_income_rate = AZE_indian_ports_idea_gain } } ##Wa State if = { limit = { original_tag = WAA has_idea = WAA_Narcotics_Producer } set_variable = { additional_income_WAA_Narcotics_Producer = 0.08 } add_to_variable = { additional_income_rate = additional_income_WAA_Narcotics_Producer } } # Gulf if = { limit = { has_idea = gulf_exploitation } set_variable = { additional_income_gulf_exploitation = { value = gdp_total multiply = 0.0003 } } add_to_variable = { additional_income_rate = additional_income_gulf_exploitation } } # Saudi Arabia - Seperate from GULF # === Saudi pipeline Additional Income (added by SAU pipeline feature) === # Each route must out-earn the transit fees charged for it in calculate_additional_expenses_rate, # or opening it is a straight loss. The Turkey extension is billed there too, so it is paid here. if = { limit = { original_tag = SAU } set_variable = { additional_income_SAU_pipeline_export = 0 } # Arabian Sea route - fee 1.00 / 1.15 / 1.25 if = { limit = { has_idea = SAU_yemen_pipeline_t1 } add_to_variable = { additional_income_SAU_pipeline_export = 2.0 } } if = { limit = { has_idea = SAU_yemen_pipeline_t2 } add_to_variable = { additional_income_SAU_pipeline_export = 2.5 } } if = { limit = { has_idea = SAU_yemen_pipeline_t3 } add_to_variable = { additional_income_SAU_pipeline_export = 3.0 } } # Levant route - fee 2.00 / 2.30 / 2.50 if = { limit = { has_idea = SAU_syria_pipeline_t1 } add_to_variable = { additional_income_SAU_pipeline_export = 3.5 } } if = { limit = { has_idea = SAU_syria_pipeline_t2 } add_to_variable = { additional_income_SAU_pipeline_export = 4.25 } } if = { limit = { has_idea = SAU_syria_pipeline_t3 } add_to_variable = { additional_income_SAU_pipeline_export = 5.0 } } # Europe route - fee 1.00 / 1.15 / 1.25 if = { limit = { has_idea = SAU_iraq_pipeline_t1 } add_to_variable = { additional_income_SAU_pipeline_export = 2.25 } } if = { limit = { has_idea = SAU_iraq_pipeline_t2 } add_to_variable = { additional_income_SAU_pipeline_export = 2.75 } } if = { limit = { has_idea = SAU_iraq_pipeline_t3 } add_to_variable = { additional_income_SAU_pipeline_export = 3.25 } } # Europe extension through Turkey - fee 1.25 if = { limit = { has_country_flag = SAU_turkey_pipeline_open } add_to_variable = { additional_income_SAU_pipeline_export = 2.25 } } if = { limit = { check_variable = { additional_income_SAU_pipeline_export > 0 } } add_to_variable = { additional_income_rate = additional_income_SAU_pipeline_export } } } # One entry per transit country the pipeline crosses; a host on more than one route is paid for each. set_variable = { additional_income_SAU_pipeline_transit = 0 } if = { limit = { OR = { has_idea = SAU_pipeline_transit_YEM_t1 has_idea = SAU_pipeline_transit_YEM_t2 has_idea = SAU_pipeline_transit_YEM_t3 has_idea = SAU_pipeline_transit_JOR_t1 has_idea = SAU_pipeline_transit_JOR_t2 has_idea = SAU_pipeline_transit_JOR_t3 has_idea = SAU_pipeline_transit_SYR_t1 has_idea = SAU_pipeline_transit_SYR_t2 has_idea = SAU_pipeline_transit_SYR_t3 has_idea = SAU_pipeline_transit_IRQ_t1 has_idea = SAU_pipeline_transit_IRQ_t2 has_idea = SAU_pipeline_transit_IRQ_t3 has_idea = SAU_pipeline_transit_TUR_t1 has_idea = SAU_pipeline_transit_TUR_t2 has_idea = SAU_pipeline_transit_TUR_t3 } } if = { limit = { has_idea = SAU_pipeline_transit_YEM_t1 } add_to_variable = { additional_income_SAU_pipeline_transit = 1.0 } } if = { limit = { has_idea = SAU_pipeline_transit_YEM_t2 } add_to_variable = { additional_income_SAU_pipeline_transit = 1.15 } } if = { limit = { has_idea = SAU_pipeline_transit_YEM_t3 } add_to_variable = { additional_income_SAU_pipeline_transit = 1.25 } } if = { limit = { has_idea = SAU_pipeline_transit_JOR_t1 } add_to_variable = { additional_income_SAU_pipeline_transit = 1.0 } } if = { limit = { has_idea = SAU_pipeline_transit_JOR_t2 } add_to_variable = { additional_income_SAU_pipeline_transit = 1.15 } } if = { limit = { has_idea = SAU_pipeline_transit_JOR_t3 } add_to_variable = { additional_income_SAU_pipeline_transit = 1.25 } } if = { limit = { has_idea = SAU_pipeline_transit_SYR_t1 } add_to_variable = { additional_income_SAU_pipeline_transit = 1.0 } } if = { limit = { has_idea = SAU_pipeline_transit_SYR_t2 } add_to_variable = { additional_income_SAU_pipeline_transit = 1.15 } } if = { limit = { has_idea = SAU_pipeline_transit_SYR_t3 } add_to_variable = { additional_income_SAU_pipeline_transit = 1.25 } } if = { limit = { has_idea = SAU_pipeline_transit_IRQ_t1 } add_to_variable = { additional_income_SAU_pipeline_transit = 1.0 } } if = { limit = { has_idea = SAU_pipeline_transit_IRQ_t2 } add_to_variable = { additional_income_SAU_pipeline_transit = 1.15 } } if = { limit = { has_idea = SAU_pipeline_transit_IRQ_t3 } add_to_variable = { additional_income_SAU_pipeline_transit = 1.25 } } if = { limit = { has_idea = SAU_pipeline_transit_TUR_t1 } add_to_variable = { additional_income_SAU_pipeline_transit = 1.0 } } if = { limit = { has_idea = SAU_pipeline_transit_TUR_t2 } add_to_variable = { additional_income_SAU_pipeline_transit = 1.15 } } if = { limit = { has_idea = SAU_pipeline_transit_TUR_t3 } add_to_variable = { additional_income_SAU_pipeline_transit = 1.25 } } add_to_variable = { additional_income_rate = additional_income_SAU_pipeline_transit } } #Sold Equipment Tax Income if = { limit = { check_variable = { market_sold_contracts > 0 } } # start the math add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.inf_cost_mult multiply = amount_inf_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.cnc_cost_mult multiply = amount_cnc_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.aa_cost_mult multiply = amount_aa_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.at_cost_mult multiply = amount_at_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.hat_cost_mult multiply = amount_hat_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.art_cost_mult multiply = amount_art_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.atk_helo_cost_mult multiply = amount_atk_helo_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.trans_helo_cost_mult multiply = amount_trans_helo_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.util_cost_mult multiply = amount_util_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.mbt_cost_mult multiply = amount_mbt_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.apc_cost_mult multiply = amount_apc_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.ifv_cost_mult multiply = amount_ifv_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.spart_cost_mult multiply = amount_spart_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.light_tank_cost_mult multiply = amount_light_tank_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.spaa_cost_mult multiply = amount_spaa_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.train_cost_mult multiply = amount_train_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.convoy_cost_mult multiply = amount_convoy_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.sml_pln_cost_mult multiply = amount_sml_pln_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.med_pln_cost_mult multiply = amount_med_pln_equip_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.lrg_pln_cost_mult multiply = amount_lrg_pln_equip_sold } } if = { limit = { has_dlc = "Gotterdammerung" } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.missile_cost_mult multiply = amount_ballistic_missile_equipment_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.missile_cost_mult multiply = amount_nuclear_ballistic_missile_equipment_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.missile_cost_mult multiply = amount_guided_missile_equipment_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.missile_cost_mult multiply = amount_hypersonic_missile_equipment_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.missile_cost_mult multiply = amount_nuclear_missile_equipment_sold } } add_to_temp_variable = { var = market_sold_cost value = { value = global.base_unit_cost multiply = global.missile_cost_mult multiply = amount_sam_missile_equipment_sold } } } multiply_temp_variable = { var = market_sold_cost value = { value = 1 add = modifier@international_market_income_modifier } } add_to_variable = { additional_income_rate = market_sold_cost } set_variable = { market_sold_value_track = market_sold_cost } } #Czech-Hungarian trade if = { limit = { OR = { has_idea = CZE_HUN_receive_additional_income_from_hungary_5 has_idea = CZE_HUN_receive_additional_income_from_hungary_3 has_idea = CZE_HUN_receive_additional_income_from_hungary_2 has_idea = CZE_HUN_receive_additional_income_from_hungary_1 } } CZE_HUN_gdp_stolen_calculation = yes add_to_variable = { additional_income_rate = CZE_HUN_gain_income_trade } } # Greece if = { limit = { original_tag = GRE } # Golden Visa Programme income if = { limit = { has_completed_focus = GRE_golden_visa_deals } # Higher corruption draws more visa buyers; scale income by corruption tier set_temp_variable = { GRE_visa_corruption_tier = 1 } if = { limit = { has_idea = corruption_level_02 } set_temp_variable = { GRE_visa_corruption_tier = 2 } } else_if = { limit = { has_idea = corruption_level_03 } set_temp_variable = { GRE_visa_corruption_tier = 3 } } else_if = { limit = { has_idea = corruption_level_04 } set_temp_variable = { GRE_visa_corruption_tier = 4 } } else_if = { limit = { has_idea = corruption_level_05 } set_temp_variable = { GRE_visa_corruption_tier = 5 } } else_if = { limit = { has_idea = corruption_level_06 } set_temp_variable = { GRE_visa_corruption_tier = 6 } } else_if = { limit = { has_idea = corruption_level_07 } set_temp_variable = { GRE_visa_corruption_tier = 7 } } else_if = { limit = { has_idea = corruption_level_08 } set_temp_variable = { GRE_visa_corruption_tier = 8 } } else_if = { limit = { has_idea = corruption_level_09 } set_temp_variable = { GRE_visa_corruption_tier = 9 } } else_if = { limit = { has_idea = corruption_level_10 } set_temp_variable = { GRE_visa_corruption_tier = 10 } } set_temp_variable = { GRE_visa_rate = GRE_visa_corruption_tier } subtract_from_temp_variable = { GRE_visa_rate = 1 } multiply_temp_variable = { GRE_visa_rate = 0.00001 } add_to_temp_variable = { GRE_visa_rate = 0.00006 } set_variable = { GRE_golden_visa_income = gdp_total } multiply_variable = { GRE_golden_visa_income = GRE_visa_rate } add_to_variable = { additional_income_rate = GRE_golden_visa_income } } } # Creditor income from holding Greek debt (runs on creditor nation scope) if = { limit = { country_exists = GRE check_variable = { GRE_interest_income_from_greece > 0 } } set_variable = { additional_income_GRE_creditor = GRE_interest_income_from_greece } add_to_variable = { additional_income_rate = additional_income_GRE_creditor } } # Interest on Belt and Road loans (China is the only creditor; ledger at the end of 05_CHI_scripted_effects.txt) if = { limit = { original_tag = CHI check_variable = { CHI_bri_loan_income > 0 } } set_variable = { additional_income_CHI_bri_loans = CHI_bri_loan_income } add_to_variable = { additional_income_rate = additional_income_CHI_bri_loans } } # Energy Load Sharing Income if = { limit = { check_variable = { energy_load_sharing_nations^num > 0 } } set_variable = { energy_load_sharing_income_var = { value = energy_load_sharing_use_var multiply = global.price_per_gw_for_els clamp = { min = 0 max = @math_expressions_max } } } add_to_variable = { additional_income_rate = energy_load_sharing_income_var } } # CPD War Reparations Income — variable set in 02_peace_deal_effects.txt on sign if = { limit = { has_idea = CPD_war_reparations_receiver } add_to_variable = { additional_income_rate = CPD_reparations_weekly } } } # Effect: update_tension_premium # Purpose: Weekly decay of the tension-cause borrowing premium, plus intake of newly generated tension update_tension_premium = { set_temp_variable = { recent_threat = { value = has_added_tension_amount subtract = tracked_threat } } # 3.5%/week: 20 weeks to decay 50%, 66 weeks to decay 90% set_variable = { tension_premium = { value = tension_premium multiply = 0.965 add = recent_threat } } set_variable = { tracked_threat = has_added_tension_amount } } # Effect: calculate_interest_rate # Purpose: Computes daily interest rate on debt based on debt-to-GDP ratio, monetary policy, and world threat calculate_interest_rate = { # Handle no debt case - skip all debt calculations if = { limit = { check_variable = { debt = 0 } } set_variable = { interest_rate = 0 } set_variable = { debt_rate = 0 } set_variable = { debt_ratio = 0 } set_variable = { debt_interest_premium = 0 } set_variable = { interest_rate_multiplier = 0 } set_variable = { cb_rate_premium = 0 } set_variable = { threat_interest_premium = 0 } set_variable = { adjusted_tension_premium = 0 } set_variable = { interest_rate_clamp_adjustment = 0 } } else = { # Country has debt - calculate interest rate, debt_rate, and debt_ratio clamp_variable = { var = gdp_total min = 0.001 } #Base value comes from debt/gdp ratio set_variable = { debt_interest_premium = { value = debt divide = gdp_total multiply = 10 } } set_variable = { interest_rate = debt_interest_premium } #Additional additive modifiers set_variable = { interest_rate_multiplier = modifier@interest_rate_multiplier_modifier } add_to_variable = { interest_rate = interest_rate_multiplier } #CB policy rate raises sovereign borrowing premium — tighter monetary policy = costlier debt #Coefficient 0.5: a 6% CB rate adds +3pp to interest_rate set_variable = { cb_rate_premium = { value = cb_policy_rate multiply = 0.5 } } add_to_variable = { interest_rate = cb_rate_premium } # Threat premium - current threat level raises borrowing costs; decays with world tension. # as 1.825% per year. 80% (0.8) tensioon -> 4% interest rate (4.0). set_variable = { threat_interest_premium = { value = global.threat multiply = 5 clamp = { min = 0 max = 5 } } } add_to_variable = { interest_rate = threat_interest_premium } # World tension cause premium - Countries which cause world tension are chaotic and less # stable. set_variable = { adjusted_tension_premium = { value = tension_premium multiply = 0.1 } } # 100% tension -> 10% interest rate add_to_variable = { interest_rate = adjusted_tension_premium } set_temp_variable = { pre_clamp_interest_rate = interest_rate } clamp_variable = { var = interest_rate min = 0.8 max = 50 } #Min is 0.8% on debt max is 50% set_variable = { interest_rate_clamp_adjustment = interest_rate } subtract_from_variable = { interest_rate_clamp_adjustment = pre_clamp_interest_rate } #Calculate weekly debt rate based on interest (52 weeks in a year) set_variable = { debt_rate = { value = debt multiply = 0.00019 multiply = interest_rate } } # Only debt denominated in an external reserve currency takes the exchange hit. # Must follow the set_variable above: applied before it, the adjustment is # overwritten and never reaches the player. if = { limit = { OR = { has_idea = us_dollar has_idea = euro has_idea = chinese_yuan has_idea = chinese_yuan_2 has_idea = chinese_yuan_3 has_idea = russia_rouble has_idea = japanese_yen has_idea = british_pound has_idea = swiss_frank has_idea = gulden } } set_temp_variable = { debt_fx_factor = { value = 1 divide = currency_strength } } multiply_variable = { debt_rate = debt_fx_factor } } #If interest rate is really high, add additional modifier if = { limit = { check_variable = { interest_rate > 14.999 } } if = { limit = { NOT = { has_dynamic_modifier = { modifier = very_high_interest_country_modifiers } } } add_dynamic_modifier = { modifier = very_high_interest_country_modifiers } } # Construction/factories/dockyard speed set_variable = { high_interest_penalty_modifier = { value = interest_rate subtract = 15 multiply = -0.05 } } # Stability set_variable = { stability_factor_very_high_interest_modifier = { value = interest_rate subtract = 15 multiply = -0.02 } } # Popularity ##Set all to 0 in case an Outlook change between weeklys clear_variable = western_drift_very_high_interest_modifier clear_variable = emerging_drift_very_high_interest_modifier clear_variable = nonaligned_drift_very_high_interest_modifier clear_variable = salafist_drift_very_high_interest_modifier clear_variable = nationalist_drift_very_high_interest_modifier set_temp_variable = { outlook_drift = { value = interest_rate subtract = 15 multiply = -0.01 } } if = { limit = { has_government = democratic } add_to_variable = { western_drift_very_high_interest_modifier = outlook_drift } } else_if = { limit = { has_government = communism } add_to_variable = { emerging_drift_very_high_interest_modifier = outlook_drift } } else_if = { limit = { has_government = neutrality } add_to_variable = { nonaligned_drift_very_high_interest_modifier = outlook_drift } } else_if = { limit = { has_government = fascism } add_to_variable = { salafist_drift_very_high_interest_modifier = outlook_drift } } else_if = { limit = { has_government = nationalist } add_to_variable = { nationalist_drift_very_high_interest_modifier = outlook_drift } } } # Debt to GDP Ratio # Math Explanation: # The Debt to GDP Ratio helps dictate the ability of the nation to repay the debts # debt / total gdp = debt_ratio set_variable = { debt_ratio = debt } if = { limit = { check_variable = { gdp_total > 0 } } divide_variable = { debt_ratio = gdp_total } } } # Remove high interest modifier if interest rate dropped below 15% if = { limit = { check_variable = { interest_rate < 15 } has_dynamic_modifier = { modifier = very_high_interest_country_modifiers } } remove_dynamic_modifier = { modifier = very_high_interest_country_modifiers } clear_variable = high_interest_penalty_modifier clear_variable = stability_factor_very_high_interest_modifier clear_variable = western_drift_very_high_interest_modifier clear_variable = emerging_drift_very_high_interest_modifier clear_variable = nonaligned_drift_very_high_interest_modifier clear_variable = salafist_drift_very_high_interest_modifier clear_variable = nationalist_drift_very_high_interest_modifier } } # Effect: update_military_rate # Purpose: Computes daily military upkeep: defence-industry cost plus fielded-unit personnel cost update_military_rate = { # Recreate the Array resize_array = { array = array_defence_spend size = 10 value = 0 } #A variable that stores the current military law the player has set_temp_variable = { def_index = { value = military_law subtract = 1 clamp = { min = 0 max = 9 } } } ## Calculate cost for defence industry (military factories and dockyards) ## #A higher GDP/c makes defence industry more expensive, computed before the spending loop so each level reads the finished modifier set_temp_variable = { gdp_defence_modifier_industry = gdp_per_capita } if = { #Linear approximation -0.007 * gdp/c + 2.333 limit = { check_variable = { gdp_defence_modifier_industry > 50 } } multiply_temp_variable = { gdp_defence_modifier_industry = -0.007 } add_to_temp_variable = { gdp_defence_modifier_industry = 2.333 } } else_if = { #Linear approximation -0.046 * gdp/c + 4.286 limit = { check_variable = { gdp_defence_modifier_industry > 15 } } multiply_temp_variable = { gdp_defence_modifier_industry = -0.046 } add_to_temp_variable = { gdp_defence_modifier_industry = 4.286 } } else_if = { #Linear approximation -0.3 * gdp/c + 8.1 limit = { check_variable = { gdp_defence_modifier_industry > -1 } } multiply_temp_variable = { gdp_defence_modifier_industry = -0.3 } add_to_temp_variable = { gdp_defence_modifier_industry = 8.1 } } multiply_temp_variable = { gdp_defence_modifier_industry = 1.1 } #tweak this to modify gdp/c impact on industrial cost without having to rewrite the whole system clamp_temp_variable = { var = gdp_defence_modifier_industry min = 1 } #Base cost per spending level = (naval + mil factories) * inflation * level ladder / gdp/c modifier * 1.1 for_each_loop = { array = array_defence_spend value = v index = i set_variable = { array_defence_spend^i = { value = num_of_naval_factories add = military_factory_total multiply = inflation_multiplier multiply = global.spending_ladder_defence^i divide = gdp_defence_modifier_industry multiply = 1.1 #tweak this to modify industrial cost spending in relations to everything else } } } ## Calculate the cost of fielded military ## ### Land ### #Below sets up the personnel cost for mil spending based on how many battalions a country has (divided into special, elite, regular and irregular units) if = { limit = { check_variable = { num_battalions > 0 } } #Count number of special units set_temp_variable = { special_btn = num_battalions_with_type@Special_Forces } #Count number of elite units - Kal's note; set normal support battalions to be regular set_temp_variable = { elite_btn = { value = num_battalions_with_type@L_Air_assault_Bat add = num_battalions_with_type@L_Air_Inf_Bat add = num_battalions_with_type@Mot_Air_Inf_Bat add = num_battalions_with_type@Mech_Air_Inf_Bat add = num_battalions_with_type@Arm_Air_Inf_Bat add = num_battalions_with_type@L_Marine_Bat add = num_battalions_with_type@Mot_Marine_Bat add = num_battalions_with_type@Mech_Marine_Bat add = num_battalions_with_type@Arm_Marine_Bat add = num_battalions_with_type@L_Ranger_Bat } } #Count number of regular units (SP_AA_Bat was previously elite - Kal) set_temp_variable = { regular_btn = { value = num_battalions_with_type@L_Inf_Bat add = num_battalions_with_type@Mot_Inf_Bat add = num_battalions_with_type@Mech_Inf_Bat add = num_battalions_with_type@Arm_Inf_Bat add = num_battalions_with_type@armor_Bat add = num_battalions_with_type@L_arm_Bat add = num_battalions_with_type@Arty_Bat add = num_battalions_with_type@SP_Arty_Bat add = num_battalions_with_type@SP_AA_Bat } } #Count number of irregular units set_temp_variable = { irregular_btn = { value = num_battalions_with_type@Militia_Bat add = num_battalions_with_type@Mot_Militia_Bat } } } # Multiply each category with a weight value, and then add up categories together (eg. one special forces battalion is worth 1 militia battalion etc). # Use these if you want to control costs of different land units to each other set_temp_variable = { land_count = { value = special_btn multiply = 5 add = { value = elite_btn multiply = 3 } add = { value = regular_btn multiply = 2 } add = irregular_btn add = { value = manpower multiply = 0.0002 } } } #Land equipment #num_equipment is for stockpile, num_equipment_in_armies is for deployed, num_equipment_in_armies_k is for small arms and support eq (1 = 1000 eq) #Each item folds deployed cost + stockpile cost straight into the equipment_operative_cost accumulator set_variable = { equipment_operative_cost = 0 } # Infantry equipment (per 1000 guns, cost: 0.3M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies_k@infantry_weapons_type multiply = 0.3 add = { value = num_equipment@infantry_weapons_type multiply = 0.00006 } # 0.001 (to thousands) × 0.2 (stockpile) × 0.3 (cost) } } # CNC equipment (per 1000 units, cost: 0.4M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies_k@cnc_equipment_type multiply = 0.4 add = { value = num_equipment@cnc_equipment_type multiply = 0.00008 } # 0.001 × 0.2 × 0.4 } } # AA Equipment (cost: 0.012M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@AA_Equipment multiply = 0.012 add = { value = num_equipment@AA_Equipment multiply = 0.0024 } # 0.2 × 0.012 } } # Medium tank AA chassis (cost: 0.231M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@medium_tank_aa_chassis multiply = 0.231 add = { value = num_equipment@medium_tank_aa_chassis multiply = 0.0462 } # 0.2 × 0.231 } } # Light AT Equipment (cost: 0.011M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@L_AT_Equipment multiply = 0.011 add = { value = num_equipment@L_AT_Equipment multiply = 0.0022 } # 0.2 × 0.011 } } # Heavy AT Equipment (cost: 0.5M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@H_AT_Equipment multiply = 0.5 add = { value = num_equipment@H_AT_Equipment multiply = 0.1 } # 0.2 × 0.5 } } # Medium tank amphibious chassis (cost: 0.16M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@medium_tank_amphibious_chassis multiply = 0.16 add = { value = num_equipment@medium_tank_amphibious_chassis multiply = 0.032 } # 0.2 × 0.16 } } # Medium tank flame chassis (cost: 0.435M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@medium_tank_flame_chassis multiply = 0.435 add = { value = num_equipment@medium_tank_flame_chassis multiply = 0.087 } # 0.2 × 0.435 } } # Artillery equipment (cost: 0.07M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@artillery_equipment multiply = 0.07 add = { value = num_equipment@artillery_equipment multiply = 0.014 } # 0.2 × 0.07 } } # SP Artillery (cost: 0.5M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@medium_tank_artillery_chassis multiply = 0.5 add = { value = num_equipment@medium_tank_artillery_chassis multiply = 0.1 } # 0.2 × 0.5 } } # MLRS (cost: 0.5M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@medium_tank_rocket_chassis multiply = 0.5 add = { value = num_equipment@medium_tank_rocket_chassis multiply = 0.1 } # 0.2 × 0.5 } } # Medium tank chassis (cost: 0.7M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@medium_tank_chassis multiply = 0.7 add = { value = num_equipment@medium_tank_chassis multiply = 0.14 } # 0.2 × 0.7 } } # Medium tank destroyer chassis (cost: 0.35M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@medium_tank_destroyer_chassis multiply = 0.35 add = { value = num_equipment@medium_tank_destroyer_chassis multiply = 0.07 } # 0.2 × 0.35 } } # Heavy tank amphibious chassis / Transport helicopters (cost: 0.75M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@heavy_tank_amphibious_chassis multiply = 0.75 add = { value = num_equipment@heavy_tank_amphibious_chassis multiply = 0.15 } # 0.2 × 0.75 } } # Heavy tank chassis / Attack helicopters (cost: 1.0M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@heavy_tank_chassis multiply = 1 add = { value = num_equipment@heavy_tank_chassis multiply = 0.2 } # 0.2 × 1 } } # Light Walker Tank (cost: 0.8M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@super_heavy_tank_destroyer_chassis multiply = 0.8 add = { value = num_equipment@super_heavy_tank_destroyer_chassis multiply = 0.16 } # 0.2 × 0.8 } } # Medium Walker Tank (cost: 1.0M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@super_heavy_tank_chassis multiply = 1 add = { value = num_equipment@super_heavy_tank_chassis multiply = 0.2 } # 0.2 × 1 } } # Heavy Walker Tank (cost: 1.2M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@super_heavy_tank_artillery_chassis multiply = 1.2 add = { value = num_equipment@super_heavy_tank_artillery_chassis multiply = 0.24 } # 0.2 × 1.2 } } # Utility vehicles (cost: 0.022M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@util_vehicle_type multiply = 0.022 add = { value = num_equipment@util_vehicle_type multiply = 0.0044 } # 0.2 × 0.022 } } # Heavy Utility vehicles (cost: 0.022M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@heavy_util_vehicle_type multiply = 0.022 add = { value = num_equipment@heavy_util_vehicle_type multiply = 0.0044 } # 0.2 × 0.022 } } # Land drones (cost: 0.022M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@land_drone_equipment_type multiply = 0.022 add = { value = num_equipment@land_drone_equipment_type multiply = 0.0044 } # 0.2 × 0.022 } } # Orbital Fire Control Relay (cost: 2.0M yearly) add_to_variable = { var = equipment_operative_cost value = { value = num_equipment_in_armies@space_artillery_equipment_type multiply = 2 add = { value = num_equipment@space_artillery_equipment_type multiply = 0.4 } # 0.2 × 2 } } #from millions yearly to billions weekly set_variable = { equipment_operative_cost = { value = equipment_operative_cost multiply = @equipment_operative_cost_multiplier multiply = 0.019 multiply = 0.001 } } if = { limit = { has_war = yes } if = { limit = { is_ai = no } multiply_variable = { equipment_operative_cost = 2.25 } } else = { multiply_variable = { equipment_operative_cost = 1.45 } } } ### Navy ### #Below sets the cost for ships based on the number of ships (divided into carriers, capitals, destroyers and minors - children are cheap) #Count number of carriers set_temp_variable = { carrier_count = num_ships_with_type@carrier } #Count number of capital/large ships set_temp_variable = { capital_count = { value = num_ships_with_type@cruiser add = num_ships_with_type@battle_cruiser add = num_ships_with_type@helicopter_operator add = num_ships_with_type@attack_submarine add = num_ships_with_type@missile_submarine add = num_ships_with_type@battleship } } #Count number of destroyers and heavy frigates set_temp_variable = { destroyer_count = { value = num_ships_with_type@destroyer add = num_ships_with_type@heavy_frigate add = num_ships_with_type@stealth_destroyer } } #Count number of screens/small ships set_temp_variable = { frigate_count = { value = num_ships_with_type@frigate add = num_ships_with_type@stealth_frigate } } set_temp_variable = { corvette_count = { value = num_ships_with_type@corvette add = num_ships_with_type@stealth_corvette } } set_temp_variable = { patrol_boat_count = { value = num_ships_with_type@patrol_boat add = num_ships_with_type@repair_ship add = num_ships_with_type@support_ship } } #Multiply each category with a weight value, and then add up categories together (eg. one carrier is worth 10 frigates etc). Use these if you want to control costs of different ships to each other - Kal's note: changed math to match land stuff set_temp_variable = { navy_count = { value = carrier_count multiply = 20 add = { value = capital_count multiply = 4 } add = { value = destroyer_count multiply = 3 } add = { value = frigate_count multiply = 2 } add = corvette_count add = { value = patrol_boat_count multiply = 0.25 } } } ### Airforce ### # Calculate costs for different aircraft types. Cost weights match land/navy ratios. # Stockpiled planes cost 2/3 of deployed planes. set_temp_variable = { stockpiled_cost_multiplier = 0.667 } # Strategic aircraft (weight 14) set_temp_variable = { strategic_airforce = { value = num_equipment@large_plane_airframe add = num_equipment@large_plane_cas_airframe add = num_equipment@large_plane_awacs_airframe multiply = stockpiled_cost_multiplier add = num_deployed_planes_with_type@large_plane_airframe add = num_deployed_planes_with_type@large_plane_cas_airframe add = num_deployed_planes_with_type@large_plane_awacs_airframe multiply = 14 } } # Expensive aircraft (weight 5) set_temp_variable = { expensive_airforce = { value = num_equipment@large_plane_air_transport_airframe add = num_equipment@large_plane_maritime_patrol_airframe add = num_equipment@cv_medium_plane_air_transport_airframe add = num_equipment@cv_medium_plane_maritime_patrol_airframe add = num_equipment@medium_plane_air_transport_airframe add = num_equipment@medium_plane_maritime_patrol_airframe add = num_equipment@cv_medium_plane_scout_airframe multiply = stockpiled_cost_multiplier add = num_deployed_planes_with_type@large_plane_air_transport_airframe add = num_deployed_planes_with_type@large_plane_maritime_patrol_airframe add = num_deployed_planes_with_type@cv_medium_plane_air_transport_airframe add = num_deployed_planes_with_type@cv_medium_plane_maritime_patrol_airframe add = num_deployed_planes_with_type@medium_plane_air_transport_airframe add = num_deployed_planes_with_type@medium_plane_maritime_patrol_airframe add = num_deployed_planes_with_type@cv_medium_plane_scout_airframe multiply = 5 } } # Regular aircraft (weight 3) set_temp_variable = { regular_airforce = { value = num_equipment@medium_plane_airframe add = num_equipment@cv_medium_plane_airframe add = num_equipment@medium_plane_fighter_airframe add = num_equipment@cv_medium_plane_fighter_airframe add = num_equipment@small_plane_suicide_airframe add = num_equipment@medium_plane_cas_airframe add = num_equipment@cv_medium_plane_cas_airframe multiply = stockpiled_cost_multiplier add = num_deployed_planes_with_type@medium_plane_airframe add = num_deployed_planes_with_type@cv_medium_plane_airframe add = num_deployed_planes_with_type@medium_plane_fighter_airframe add = num_deployed_planes_with_type@cv_medium_plane_fighter_airframe add = num_deployed_planes_with_type@small_plane_suicide_airframe add = num_deployed_planes_with_type@medium_plane_cas_airframe add = num_deployed_planes_with_type@cv_medium_plane_cas_airframe multiply = 3 } } # Cheap aircraft (weight 1) set_temp_variable = { cheap_airforce = { value = num_equipment@small_plane_airframe add = num_equipment@small_plane_cas_airframe add = num_equipment@small_plane_naval_bomber_airframe add = num_equipment@cv_small_plane_airframe add = num_equipment@cv_small_plane_cas_airframe add = num_equipment@cv_small_plane_naval_bomber_airframe add = num_equipment@small_plane_strike_airframe add = num_equipment@cv_small_plane_strike_airframe multiply = stockpiled_cost_multiplier add = num_deployed_planes_with_type@small_plane_airframe add = num_deployed_planes_with_type@small_plane_cas_airframe add = num_deployed_planes_with_type@small_plane_naval_bomber_airframe add = num_deployed_planes_with_type@cv_small_plane_airframe add = num_deployed_planes_with_type@cv_small_plane_cas_airframe add = num_deployed_planes_with_type@cv_small_plane_naval_bomber_airframe } } # Add missile buildings multiply_temp_variable = { num_missile_silo = 28 } multiply_temp_variable = { num_anti_air_building = 14 } # Calculate total airforce cost set_temp_variable = { airforce_count = { value = strategic_airforce add = expensive_airforce add = regular_airforce add = cheap_airforce add = num_missile_silo add = num_anti_air_building } } ### Total ### # Control factors to scale different branches with each other in cost. # Use these to control how expensive different branches are against each other # Land Forces - Cost weights per battalion: # - Special: 1.25 # - Elite: 0.75 # - Regular: 0.50 # - Irregular: 0.25 multiply_temp_variable = { land_count = 0.5 } # Naval Forces - Cost weights per ship: # - Carrier: 40 # - Capital: 8 # - Destroyer: 6 # - Frigate: 4 # - Corvette: 2 multiply_temp_variable = { navy_count = 1 } # Air Forces - Cost weights per aircraft: # - Strategic: 1.00 # - Expensive: 0.35 # - Regular: 0.21 # - Cheap: 0.07 multiply_temp_variable = { airforce_count = 0.071 } #Additive personnel cost multiplier set_temp_variable = { personnel_cost_multiplier = { value = 1 add = modifier@personnel_cost_multiplier_modifier } } set_temp_variable = { army_personnel_cost_multiplier = { value = 1 add = modifier@army_personnel_cost_multiplier_modifier } } set_temp_variable = { navy_personnel_cost_multiplier = { value = 1 add = modifier@navy_personnel_cost_multiplier_modifier } } set_temp_variable = { airforce_personnel_cost_multiplier = { value = 1 add = modifier@airforce_personnel_cost_multiplier_modifier } } #Additive equipment cost multiplier set_temp_variable = { equipment_cost_multiplier = { value = 1 add = modifier@equipment_cost_multiplier_modifier } } #Modify personnel cost with total wage modifier multiply_temp_variable = { land_count = personnel_cost_multiplier } multiply_temp_variable = { navy_count = personnel_cost_multiplier } multiply_temp_variable = { airforce_count = personnel_cost_multiplier } multiply_temp_variable = { land_count = army_personnel_cost_multiplier } multiply_temp_variable = { navy_count = navy_personnel_cost_multiplier } multiply_temp_variable = { airforce_count = airforce_personnel_cost_multiplier } #Modify equipment cost with modifier set_variable = { equipment_operative_cost = { value = equipment_operative_cost multiply = equipment_cost_multiplier multiply = inflation_multiplier } } #Multiply personnel costs basde on GDP/c, higher GDP makes things more expensive (linear approximation 0.003 * gdp/c + 0.129) set_temp_variable = { gdp_defence_modifier_personnel = { value = gdp_per_capita multiply = 0.004 add = 0.129 } } multiply_temp_variable = { land_count = gdp_defence_modifier_personnel } multiply_temp_variable = { navy_count = gdp_defence_modifier_personnel } multiply_temp_variable = { airforce_count = gdp_defence_modifier_personnel } set_temp_variable = { gdp_defence_modifier_equipment = { value = gdp_per_capita multiply = 0.015 add = 1 } } multiply_variable = { equipment_operative_cost = gdp_defence_modifier_equipment } set_temp_variable = { mobilization_level_modifier = { value = 0.25 multiply = def_index add = 0.75 } } multiply_temp_variable = { land_count = mobilization_level_modifier } multiply_temp_variable = { navy_count = mobilization_level_modifier } multiply_temp_variable = { airforce_count = mobilization_level_modifier } set_temp_variable = { equipment_cost_mobilization_level_modifier = { value = 0.25 multiply = def_index add = 0.75 } } multiply_variable = { equipment_operative_cost = equipment_cost_mobilization_level_modifier } if = { limit = { has_war = yes } multiply_temp_variable = { land_count = 1.20 } multiply_temp_variable = { navy_count = 1.50 } multiply_temp_variable = { airforce_count = 1.50 } } #Divide by control factors (same for all!) - Use this if you want to scale cost of military personnel in relation to defence industry multiply_temp_variable = { land_count = 0.00076 } multiply_temp_variable = { navy_count = 0.001 } multiply_temp_variable = { airforce_count = 0.001 } multiply_temp_variable = { airforce_count = 0.667 } #Add up armed forces set_temp_variable = { personnel_cost = { value = land_count add = navy_count add = airforce_count } } #Values for breakdown tooltips set_variable = { defence_breakdown_industry = { value = array_defence_spend^def_index multiply = 7 } } set_variable = { defence_breakdown_land = { value = land_count multiply = 7 add = equipment_operative_cost } } set_variable = { defence_breakdown_navy = { value = navy_count multiply = 7 } } set_variable = { defence_breakdown_airforce = { value = airforce_count multiply = 7 } } set_variable = { defence_breakdown_industry_gdp_modifier = 8.1 } #Maximum modifier clamp_variable = { var = gdp_defence_modifier_industry min = 0.001 } divide_variable = { defence_breakdown_industry_gdp_modifier = gdp_defence_modifier_industry } subtract_from_variable = { defence_breakdown_industry_gdp_modifier = 1 } #Working with percentages set_variable = { defence_breakdown_personnel_gdp_modifier = { value = gdp_defence_modifier_personnel multiply = 7.752 subtract = 1 } } #7.752 = minimum modifier; -1 to work with percentages set_variable = { defence_breakdown_cyber = { value = gdp_total multiply = { value = 0 if = { limit = { value = cyber_capability greater_than = 11 } add = 0.00005 } if = { limit = { value = cyber_capability greater_than = 7 } add = 0.00004 } if = { limit = { value = cyber_capability greater_than = 3 } add = 0.00003 } if = { limit = { value = cyber_capability greater_than = 0 } add = 0.00003 } } multiply = { value = 1 add = modifier@cyber_cost_multiplier_modifier } multiply = 7 } } #Add military industry and personnel costs together for the total for_each_loop = { array = array_defence_spend index = i value = v #Industry cost + personnel, over 7 days, plus equipment upkeep set_variable = { array_defence_spend^i = { value = array_defence_spend^i add = personnel_cost multiply = 7 add = equipment_operative_cost clamp = { min = 0 max = @math_expressions_max } } } } set_variable = { defence_gain = { value = array_defence_spend^def_index add = defence_breakdown_cyber clamp = { min = 0 max = @math_expressions_max } } } } # Effect: update_bureaucracy_rate # Purpose: Computes daily bureaucracy/civil-service spending based on population and selected law level update_bureaucracy_rate = { # Recreate the Array resize_array = { array = array_bureaucracy_spend size = 5 value = 0 } #Calculate the base cost of each bureaucracy level, scaled by the per-level multiplier ladder for_each_loop = { array = array_bureaucracy_spend index = i value = v set_variable = { array_bureaucracy_spend^i = { value = population_total multiply = { value = 1 add = modifier@bureaucracy_cost_multiplier_modifier } multiply = common_money_modifier multiply = @bureau_base_cost_per_capita clamp = { min = 0 max = @spending_cost_clamp_max } multiply = global.spending_ladder_standard^i } } } #Set which spending level the country is at set_temp_variable = { bureau_index = { value = bureau_law subtract = 1 clamp = { min = 0 max = 4 } } } set_variable = { var = bureaucracy_gain value = { value = array_bureaucracy_spend^bureau_index clamp = { min = 0 max = @math_expressions_max } } } } # Effect: update_police_rate # Purpose: Computes daily police/public-security spending based on population and selected law level update_police_rate = { # Recreate the Array resize_array = { array = array_security_spend size = 5 value = 0 } #Calculate the base cost of each police level, scaled by the per-level multiplier ladder for_each_loop = { array = array_security_spend index = i value = v set_variable = { array_security_spend^i = { value = population_total multiply = { value = 1 add = modifier@police_cost_multiplier_modifier add = ct_police_cost_var } multiply = common_money_modifier multiply = @police_base_cost_per_capita clamp = { min = 0 max = @spending_cost_clamp_max } multiply = global.spending_ladder_standard^i } } } #Set which spending level the country is at set_temp_variable = { security_index = { value = police_law subtract = 1 clamp = { min = 0 max = 4 } } } set_variable = { security_gain = { value = array_security_spend^security_index clamp = { min = 0 max = @math_expressions_max } } } } # Effect: update_education_rate # Purpose: Computes daily education spending based on population, research slots, and selected law level update_education_rate = { #Set the base cost of education (billion $ per 10 000 000 people) set_temp_variable = { education_base_cost = @education_base_cost_per_capita } #Education spending is more expensive the more research slots a country has set_variable = { research_slot_modifier = { value = 0.04 multiply = amount_research_slots add = -0.2 } } #Education spending was more expensive for poor countries - linear approximation with -0.086 * GDP/C + 2.182 #helps balance large countries (china/india/ecc) and represents poor countries setting up infrastructure that western countries already have #but this was scrapped because poor countries were struggling with high tax rates despite very low spending levels #now spending cost increases with gdpc set_variable = { education_cost_gdp_multiplier_display = { value = gdp_scaling_modifier subtract = 1 } } # Calculate Base Cost + Modifiers set_temp_variable = { education_cost_multiplier = { value = 1 add = modifier@education_cost_multiplier_modifier add = research_slot_modifier multiply = common_money_modifier } } set_variable = { education_cost_multiplier_display = { value = education_cost_multiplier subtract = 1 } } multiply_temp_variable = { education_cost_multiplier = education_base_cost } # Recreate the Array resize_array = { array = array_education_spend size = 5 value = 0 } set_temp_variable = { facilities_cost = 0 } if = { limit = { nuclear_facility > 2 } add_to_temp_variable = { facilities_cost = 0.15 } } else_if = { limit = { nuclear_facility > 1 } add_to_temp_variable = { facilities_cost = 0.1 } } else_if = { limit = { nuclear_facility > 0 } add_to_temp_variable = { facilities_cost = 0.05 } } if = { limit = { air_facility > 2 } add_to_temp_variable = { facilities_cost = 0.15 } } else_if = { limit = { air_facility > 1 } add_to_temp_variable = { facilities_cost = 0.1 } } else_if = { limit = { air_facility > 0 } add_to_temp_variable = { facilities_cost = 0.05 } } if = { limit = { land_facility > 2 } add_to_temp_variable = { facilities_cost = 0.15 } } else_if = { limit = { land_facility > 1 } add_to_temp_variable = { facilities_cost = 0.1 } } else_if = { limit = { land_facility > 0 } add_to_temp_variable = { facilities_cost = 0.05 } } if = { limit = { naval_facility > 2 } add_to_temp_variable = { facilities_cost = 0.15 } } else_if = { limit = { naval_facility > 1 } add_to_temp_variable = { facilities_cost = 0.1 } } else_if = { limit = { naval_facility > 0 } add_to_temp_variable = { facilities_cost = 0.05 } } set_variable = { THIS.total_facilities_spending_display_var = facilities_cost } #Calculate the base cost of each education level (pop * cost multiplier + facilities), scaled by the per-level multiplier ladder # Update facility display var if you change the ladder! for_each_loop = { array = array_education_spend index = i value = v set_variable = { array_education_spend^i = { value = population_total #Unit 100 000 multiply = education_cost_multiplier add = total_facilities_spending_display_var clamp = { min = 0 max = @spending_cost_clamp_max } multiply = global.spending_ladder_education^i } } } #Set which spending level the country is at set_temp_variable = { education_index = { value = education_law subtract = 1 clamp = { min = 0 max = 4 } } } set_temp_variable = { edu_facilities_mult = { value = education_index multiply = 0.5 add = 1 } } multiply_variable = { THIS.total_facilities_spending_display_var = edu_facilities_mult } set_variable = { education_gain = { value = array_education_spend^education_index clamp = { min = 0 max = @math_expressions_max } } } clamp_variable = { var = total_facilities_spending_display_var min = 0 } } # Effect: update_health_rate # Purpose: Computes daily healthcare spending based on population and selected law level update_health_rate = { # Recreate the Array resize_array = { array = array_health_spend size = 6 value = 0 } #Calculate the base cost of each health level, scaled by the per-level multiplier ladder for_each_loop = { array = array_health_spend index = i value = v set_variable = { array_health_spend^i = { value = population_total #Unit 100 000 multiply = { value = 1 add = modifier@health_cost_multiplier_modifier } multiply = common_money_modifier multiply = @health_base_cost_per_capita clamp = { min = 0 max = @spending_cost_clamp_max } multiply = global.spending_ladder_health^i } } } #Set which spending level the country is at set_temp_variable = { health_index = { value = health_law subtract = 1 clamp = { min = 0 max = 5 } } } set_variable = { health_gain = { value = array_health_spend^health_index clamp = { min = 0 max = @math_expressions_max } } } } # Effect: update_social_rate # Purpose: Computes daily welfare/social-benefit spending based on population and selected law level update_social_rate = { # Recreate the Array resize_array = { array = array_social_spend size = 6 value = 0 } #Calculate the base cost of each social level, scaled by the per-level multiplier ladder for_each_loop = { array = array_social_spend index = i value = v set_variable = { array_social_spend^i = { value = population_total #Unit 100 000 multiply = { value = 1 add = modifier@social_cost_multiplier_modifier } multiply = common_money_modifier multiply = @social_base_cost_per_capita clamp = { min = 0 max = @spending_cost_clamp_max } multiply = global.spending_ladder_social^i } } } #Set which spending level the country is at set_temp_variable = { social_index = { value = social_law subtract = 1 clamp = { min = 0 max = 5 } } } set_variable = { welfare_gain = { value = array_social_spend^social_index clamp = { min = 0 max = @math_expressions_max } } } } # Effect: update_infra_rate # Purpose: Computes daily infrastructure maintenance costs for power plants and network update_infra_rate = { # Nations under ~1M population pay proportionally less upkeep; floor keeps it non-trivial set_temp_variable = { infra_size_scaling = { value = population_total_m clamp = { min = 0.25 max = 1 } } } set_variable = { nuclear_infra_expense = { value = nuclear_reactors multiply = 0.125 multiply = { value = 1 add = modifier@infrastructure_cost_multiplier_modifier multiply = common_money_modifier add = modifier@nuclear_infra_cost_multiplier_modifier clamp = { min = 0 max = 100000000 } } multiply = infra_size_scaling } } set_variable = { fossil_infra_expense = { value = number_of_fossil_pps multiply = 0.012 multiply = { value = 1 add = modifier@infrastructure_cost_multiplier_modifier multiply = common_money_modifier add = modifier@fossil_infra_cost_multiplier_modifier clamp = { min = 0 max = 100000000 } } multiply = infra_size_scaling } } set_variable = { renewable_infra_expense = { value = renewable_energy_infra multiply = 0.03 multiply = { value = 1 add = modifier@infrastructure_cost_multiplier_modifier multiply = common_money_modifier add = modifier@renewable_infra_cost_multiplier_modifier clamp = { min = 0 max = 100000000 } } multiply = infra_size_scaling } } set_variable = { internet_infra_expense = { value = internet_station_total multiply = 0.018 multiply = { value = 1 add = modifier@infrastructure_cost_multiplier_modifier multiply = common_money_modifier add = modifier@internet_infra_cost_multiplier_modifier clamp = { min = 0 max = 100000000 } } multiply = infra_size_scaling } } set_variable = { rail_infra_expense = { value = rail_terminal_total multiply = 0.015 multiply = { value = 1 add = modifier@infrastructure_cost_multiplier_modifier multiply = common_money_modifier } multiply = infra_size_scaling } } set_variable = { infra_gain = { value = nuclear_infra_expense add = fossil_infra_expense add = renewable_infra_expense add = internet_infra_expense add = rail_infra_expense clamp = { min = 0 max = 100000000 } } } } # Effect: calculate_additional_expense_rate # Purpose: Aggregates special expenses (propaganda campaigns, diplomatic actions, special projects) calculate_additional_expense_rate = { set_variable = { additional_expenses_rate = 0 } # Interest owed on a Belt and Road loan if = { limit = { check_variable = { bri_loan_payment > 0 } CHI = { has_completed_focus = CHI_Belt_and_Road_Initiative } } set_variable = { additional_expense_bri_loan = bri_loan_payment } add_to_variable = { additional_expenses_rate = additional_expense_bri_loan } } # Additional expenses, set expense amount as a variable (weekly gain) # Generic Propaganda Campaign Decisions # AI do not use the propganda campaigns at all. Wrap them in a check to minimize checking. if = { limit = { is_ai = no } calculate_all_propaganda_costs = yes if = { limit = { has_country_flag = prowestern_propaganda } add_to_variable = { additional_expenses_rate = promote_outlook_western_costs } } if = { limit = { has_country_flag = emerging_propaganda } add_to_variable = { additional_expenses_rate = promote_outlook_emerging_costs } } if = { limit = { has_country_flag = nonaligned_propaganda } add_to_variable = { additional_expenses_rate = promote_outlook_nonaligned_costs } } if = { limit = { has_country_flag = nationalist_propaganda } add_to_variable = { additional_expenses_rate = promote_outlook_nationalist_costs } } if = { limit = { has_country_flag = fascism_propaganda } add_to_variable = { additional_expenses_rate = promote_outlook_salafist_costs } } # NOTE: For now the AI do not lease factories. Do not count these. set_temp_variable = { inflation_on_leases = { value = 1 add = modifier@inflation_cost_multiplier_modifier } } if = { limit = { check_variable = { leased_civilian_factories > 0 } } set_temp_variable = { lease_civilian_factories_cost = { value = lease_factories_cumulative_cost multiply = gdp_per_capita multiply = 0.001 add = { value = lease_factories_cumulative_cost multiply = 0.1 multiply = inflation_on_leases } multiply = leased_civilian_factories divide = leased_factories } } set_variable = { lease_civilian_factories_cost_display = lease_civilian_factories_cost } add_to_variable = { additional_expenses_rate = lease_civilian_factories_cost } } if = { limit = { check_variable = { leased_military_factories > 0 } } set_temp_variable = { lease_military_factories_cost = { value = lease_factories_cumulative_cost multiply = gdp_per_capita multiply = 0.001 add = { value = lease_factories_cumulative_cost multiply = 0.1 multiply = inflation_on_leases } multiply = leased_military_factories divide = leased_factories } } set_variable = { lease_military_factories_cost_display = lease_military_factories_cost } add_to_variable = { additional_expenses_rate = lease_military_factories_cost } } if = { limit = { check_variable = { leased_dockyards > 0 } } set_temp_variable = { lease_naval_factories_cost = { value = lease_factories_cumulative_cost multiply = gdp_per_capita multiply = 0.001 add = { value = lease_factories_cumulative_cost multiply = 0.1 multiply = inflation_on_leases } multiply = leased_dockyards divide = leased_factories } } set_variable = { lease_naval_factories_cost_display = lease_naval_factories_cost } add_to_variable = { additional_expenses_rate = lease_naval_factories_cost } } if = { limit = { has_country_flag = active_economic_project } set_variable = { project_decisions_cost = { value = gdp_total multiply = 0.001 } } set_temp_variable = { project_cost_multiplier = { value = 1 add = modifier@projects_cost_modifier } } multiply_variable = { project_decisions_cost = project_cost_multiplier } add_to_variable = { additional_expenses_rate = project_decisions_cost } } } if = { limit = { has_country_flag = large_company_subsidies } set_variable = { large_company_subsidies = { value = gdp_total multiply = 0.001 } } add_to_variable = { additional_expenses_rate = large_company_subsidies } } if = { limit = { has_country_flag = farmer_subsidies } set_variable = { farmer_subsidies = { value = gdp_total multiply = 0.001 } } add_to_variable = { additional_expenses_rate = farmer_subsidies } } if = { limit = { has_country_flag = DEF_military_industry_thriving_expense } set_variable = { defence_industry_subsidies = { value = gdp_total multiply = 0.002 } } add_to_variable = { additional_expenses_rate = defence_industry_subsidies } } if = { limit = { OR = { has_active_mission = missile_construction_10 has_active_mission = missile_construction_11 has_active_mission = missile_construction_12 has_active_mission = missile_construction_13 has_active_mission = missile_construction_14 } } space_prod_weekly_expense = yes add_to_variable = { additional_expenses_rate = space_prod_expense } } else = { set_variable = { space_prod_expense = 0 } } if = { limit = { NOT = { check_variable = { subjects^0 = 0 } } NOT = { check_variable = { subject_subsidization^0 = 0 } } } set_temp_variable = { overlord_subsidies_cost = 0 } for_each_scope_loop = { array = subject_subsidization add_to_temp_variable = { var = overlord_subsidies_cost value = { value = gdp_total multiply = 0.01 multiply = 0.5 } } } set_variable = { overlord_subsidies_total_cost = overlord_subsidies_cost } add_to_variable = { additional_expenses_rate = overlord_subsidies_total_cost } } if = { limit = { check_variable = { market_purchase_factories > 0 } } #start the math add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.inf_cost_mult multiply = amount_inf_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.cnc_cost_mult multiply = amount_cnc_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.aa_cost_mult multiply = amount_aa_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.at_cost_mult multiply = amount_at_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.hat_cost_mult multiply = amount_hat_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.art_cost_mult multiply = amount_art_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.atk_helo_cost_mult multiply = amount_atk_helo_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.trans_helo_cost_mult multiply = amount_trans_helo_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.util_cost_mult multiply = amount_util_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.mbt_cost_mult multiply = amount_mbt_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.apc_cost_mult multiply = amount_apc_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.ifv_cost_mult multiply = amount_ifv_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.spart_cost_mult multiply = amount_spart_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.light_tank_cost_mult multiply = amount_light_tank_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.spaa_cost_mult multiply = amount_spaa_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.train_cost_mult multiply = amount_train_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.convoy_cost_mult multiply = amount_convoy_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.sml_pln_cost_mult multiply = amount_sml_pln_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.med_pln_cost_mult multiply = amount_med_pln_equip_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.lrg_pln_cost_mult multiply = amount_lrg_pln_equip_purchased } } if = { limit = { has_dlc = "Gotterdammerung" } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.missile_cost_mult multiply = amount_ballistic_missile_equipment_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.missile_cost_mult multiply = amount_nuclear_ballistic_missile_equipment_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.missile_cost_mult multiply = amount_guided_missile_equipment_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.missile_cost_mult multiply = amount_hypersonic_missile_equipment_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.missile_cost_mult multiply = amount_nuclear_missile_equipment_purchased } } add_to_temp_variable = { var = market_purchase_factories_cost value = { value = global.base_unit_cost multiply = global.missile_cost_mult multiply = amount_sam_missile_equipment_purchased } } } multiply_temp_variable = { var = market_purchase_factories_cost value = { value = 1 add = modifier@international_market_purchase_modifier } } #assign the final cost add_to_variable = { additional_expenses_rate = market_purchase_factories_cost } set_variable = { market_purchase_factories_cost_track = market_purchase_factories_cost } } # European Union Contribution Expenses if = { limit = { has_idea = EU_member } add_to_variable = { additional_expenses_rate = EU_budget_contribution_weekly } } # Cartel Mechanic Costs if = { limit = { has_country_flag = anti_cartel_propaganda_flag } set_variable = { anti_cartel_propaganda_var = { value = gdp_total multiply = 0.001 } } add_to_variable = { additional_expenses_rate = anti_cartel_propaganda_var } } # PMC Company Expenses if = { limit = { check_variable = { ROOT.pmc_expenses > 0 } } set_variable = { additional_expenses_pmc_salary = ROOT.pmc_expenses } add_to_variable = { additional_expenses_rate = additional_expenses_pmc_salary } } # Maritime Industry Event Subsidies if = { limit = { has_country_flag = MAR_industry_subsidies } set_variable = { additional_expense_maritime_industry = { value = gdp_total multiply = 0.002 } } add_to_variable = { additional_expenses_rate = additional_expense_maritime_industry } } # Energy Load Sharing if = { limit = { has_country_flag = energy_load_sharing_recipient } set_variable = { energy_load_sharing_payment_var = { value = energy_load_sharing_gain_var multiply = global.price_per_gw_for_els clamp = { min = 0 max = @math_expressions_max } } } add_to_variable = { additional_expenses_rate = energy_load_sharing_payment_var } } # Country Specific if = { limit = { original_tag = NKR } if = { limit = { has_idea = NKR_marz_arm } set_variable = { additional_expense_NKR_marz_arm = 0.350 } add_to_variable = { additional_expenses_rate = additional_expense_NKR_marz_arm } } } else_if = { limit = { original_tag = CAN } add_to_variable = { additional_expenses_rate = CAN_subsidy_total } } else_if = { limit = { original_tag = SYR } if = { limit = { OR = { has_idea = syria_agricultural_subsidies has_idea = syria_increased_agricultural_subsidies has_idea = syria_decreased_agricultural_subsidies } } set_variable = { additional_expense_syria_agricultural_subsidies = gdp_total } if = { limit = { has_idea = syria_agricultural_subsidies } multiply_variable = { additional_expense_syria_agricultural_subsidies = 0.004 } } else_if = { limit = { has_idea = syria_increased_agricultural_subsidies } multiply_variable = { additional_expense_syria_agricultural_subsidies = 0.006 } } else_if = { limit = { has_idea = syria_decreased_agricultural_subsidies } multiply_variable = { additional_expense_syria_agricultural_subsidies = 0.002 } } multiply_variable = { additional_expense_syria_agricultural_subsidies = 0.2 } add_to_variable = { additional_expenses_rate = additional_expense_syria_agricultural_subsidies } } if = { limit = { OR = { has_idea = syrian_digital_investment1 has_idea = syrian_digital_investment2 has_idea = syrian_digital_investment3 has_idea = syrian_digital_investment4 has_idea = syrian_digital_investment5 } } set_variable = { additional_expense_syria_digital_investments = gdp_total } if = { limit = { has_idea = syrian_digital_investment1 } multiply_variable = { additional_expense_syria_digital_investments = 0.002 } } else_if = { limit = { has_idea = syrian_digital_investment2 } multiply_variable = { additional_expense_syria_digital_investments = 0.004 } } else_if = { limit = { has_idea = syrian_digital_investment3 } multiply_variable = { additional_expense_syria_digital_investments = 0.006 } } else_if = { limit = { has_idea = syrian_digital_investment4 } multiply_variable = { additional_expense_syria_digital_investments = 0.008 } } else_if = { limit = { has_idea = syrian_digital_investment5 } multiply_variable = { additional_expense_syria_digital_investments = 0.01 } } multiply_variable = { additional_expense_syria_digital_investments = 0.2 } add_to_variable = { additional_expenses_rate = additional_expense_syria_digital_investments } } if = { limit = { has_dynamic_modifier = { modifier = occupation_of_lebanon_dynamic_modifier } } set_variable = { additional_expense_occupation_of_lebanon = 0.25 } add_to_variable = { additional_expenses_rate = additional_expense_occupation_of_lebanon } } if = { limit = { has_idea = subsidized_counter_terror_operations } set_variable = { additional_expense_subsidized_counter_terror_operations = { value = gdp_total_display multiply = 0.006 } } add_to_variable = { additional_expenses_rate = additional_expense_subsidized_counter_terror_operations } } if = { limit = { has_idea = idea_syrian_development_projects } set_variable = { additional_expense_syrian_development_projects = { value = gdp_total_display multiply = 0.005 } } add_to_variable = { additional_expenses_rate = additional_expense_subsidized_counter_terror_operations } } } else_if = { limit = { original_tag = ROM } if = { limit = { has_idea = ROM_economy_of_the_new_century3 } set_variable = { additional_expense_pnt_liberal_economy = 0.05 } add_to_variable = { additional_expenses_rate = additional_expense_pnt_liberal_economy } } if = { limit = { has_idea = ROM_rural_infrastructure_renewal } set_variable = { additional_expense_pnt_infrastructure_project = 0.05 } add_to_variable = { additional_expenses_rate = additional_expense_pnt_infrastructure_project } } } else_if = { limit = { original_tag = QAT } if = { limit = { has_idea = al_jazeera } set_variable = { additional_expense_al_jazeera = 0.02 } add_to_variable = { additional_expenses_rate = additional_expense_al_jazeera } } } else_if = { limit = { original_tag = BOT } if = { limit = { has_idea = BOT_coal_focused_energy } set_variable = { additional_expense_BOT_coal_focused_energy = 0.05 } add_to_variable = { additional_expenses_rate = additional_expense_BOT_coal_focused_energy } } if = { limit = { has_idea = BOT_renewable_focused_energy } set_variable = { additional_expense_BOT_renewable_focused_energy = 0.05 } add_to_variable = { additional_expenses_rate = additional_expense_BOT_renewable_focused_energy } } } else_if = { limit = { original_tag = LIC } if = { limit = { has_idea = LIC_idea_foreign_workers } set_variable = { additional_expense_LIC_foreign_workers = 0.01 } add_to_variable = { additional_expenses_rate = additional_expense_LIC_foreign_workers } } } else_if = { limit = { original_tag = CHI } if = { limit = { has_idea = CHI_china_economic_assistant } set_variable = { additional_expense_CHI_china_economic_assistant = 0.200 } add_to_variable = { additional_expenses_rate = additional_expense_CHI_china_economic_assistant } } if = { limit = { has_country_flag = NKO_storm_corps_subsidy } set_variable = { additional_expense_NKO_storm_corps = 0.250 } add_to_variable = { additional_expenses_rate = additional_expense_NKO_storm_corps } } } else_if = { limit = { original_tag = ITA } add_to_variable = { additional_expenses_rate = ITA_additional_expenses_var } } else_if = { limit = { original_tag = GER } if = { limit = { has_idea = GER_idea_war_reparations } set_variable = { additional_expense_GER_war_debt = 0.731 } add_to_variable = { additional_expenses_rate = additional_expense_GER_war_debt } } if = { limit = { has_country_flag = GER_subventions_mining } set_variable = { additional_expense_GER_subventions_mining = { value = GER.gdp_per_capita multiply = 0.5 multiply = 0.02 } } #yearly GDP share, weekly add_to_variable = { additional_expenses_rate = additional_expense_GER_subventions_mining } } if = { limit = { has_country_flag = GER_subventions_agrar } set_variable = { additional_expense_GER_subventions_agrar = { value = GER.gdp_per_capita multiply = 0.7 multiply = 0.02 } } #yearly GDP share, weekly add_to_variable = { additional_expenses_rate = additional_expense_GER_subventions_agrar } } if = { limit = { has_idea = SOV_nord_stream_idea } set_variable = { additional_expense_SOV_nord_stream_idea = 1.375 } add_to_variable = { additional_expenses_rate = additional_expense_SOV_nord_stream_idea } } if = { limit = { has_idea = SOV_nord_stream2_idea } set_variable = { additional_expense_SOV_nord_stream2_idea = 1.375 } add_to_variable = { additional_expenses_rate = additional_expense_SOV_nord_stream2_idea } } } #United Kingdom - UK, Great Britian else_if = { limit = { original_tag = ENG } if = { limit = { has_idea = ENG_good_friday_agreement } set_variable = { additional_expenditure_good_friday = { value = gdp_total multiply = 0.0003 } } add_to_variable = { additional_expenses_rate = additional_expenditure_good_friday } } } else_if = { limit = { original_tag = USA } if = { limit = { has_idea = USA_iraq_war_cost } set_variable = { additional_expense_USA_war_cost = 2.00 } add_to_variable = { additional_expenses_rate = additional_expense_USA_war_cost } } } else_if = { limit = { original_tag = IRQ } if = { limit = { has_country_flag = IRQ_iraq_accepted_to_pay_half_billion_weekly } set_variable = { additional_expense_iraq_war_compensation = 0.5 } add_to_variable = { additional_expenses_rate = additional_expense_iraq_war_compensation } } else_if = { limit = { has_country_flag = IRQ_iraq_accepted_to_pay_one_billion_weekly } set_variable = { additional_expense_iraq_war_compensation = 1.0 } add_to_variable = { additional_expenses_rate = additional_expense_iraq_war_compensation } } else_if = { limit = { has_country_flag = IRQ_iraq_accepted_to_pay_two_billion_weekly } set_variable = { additional_expense_iraq_war_compensation = 2.0 } add_to_variable = { additional_expenses_rate = additional_expense_iraq_war_compensation } } } else_if = { limit = { original_tag = BLR } if = { limit = { has_idea = BLR_oil_russian } set_variable = { additional_expense_BLR_oil_russian = 0.044 } add_to_variable = { additional_expenses_rate = additional_expense_BLR_oil_russian } } else_if = { limit = { has_idea = BLR_oil_russian_positive } set_variable = { additional_expense_BLR_oil_russian_positive = 0.066 } add_to_variable = { additional_expenses_rate = additional_expense_BLR_oil_russian_positive } } } else_if = { limit = { original_tag = SOV } if = { limit = { has_idea = SOV_baikonur_sov_kaz_idea } set_variable = { additional_expense_SOV_baikonur_sov_kaz_idea = 0.055 } add_to_variable = { additional_expenses_rate = additional_expense_SOV_baikonur_sov_kaz_idea } } if = { limit = { has_country_flag = NKO_storm_corps_subsidy } set_variable = { additional_expense_NKO_storm_corps = 0.250 } add_to_variable = { additional_expenses_rate = additional_expense_NKO_storm_corps } } #Korea Workers if = { limit = { has_idea = NKO_korean_repair_civil_workers } set_variable = { additional_expense_NKO_korean_repair_civil_workers = 0.075 } add_to_variable = { additional_expenses_rate = additional_expense_NKO_korean_repair_civil_workers } } if = { limit = { has_idea = NKO_korean_repair_frontline_workers } set_variable = { additional_expense_NKO_korean_repair_frontline_workers = 0.100 } add_to_variable = { additional_expenses_rate = additional_expense_NKO_korean_repair_frontline_workers } } } else_if = { limit = { original_tag = UKR } if = { limit = { has_idea = UKR_russian_gas } set_variable = { additional_expense_UKR_russian_gas = 0.175 } add_to_variable = { additional_expenses_rate = additional_expense_UKR_russian_gas } } else_if = { limit = { OR = { has_idea = UKR_russian_gas_cheap has_idea = UKR_russian_gas_cheaper } } set_variable = { additional_expense_UKR_russian_gas = 0.100 } add_to_variable = { additional_expenses_rate = additional_expense_UKR_russian_gas } } } else_if = { limit = { original_tag = EGY } if = { limit = { has_idea = EGY_broken_economy_idea } set_variable = { additional_expense_broken = 4 } add_to_variable = { additional_expenses_rate = additional_expense_broken } } else_if = { limit = { has_idea = EGY_broken_economy_idea_1 } set_variable = { additional_expense_broken = 3 } add_to_variable = { additional_expenses_rate = additional_expense_broken } } else_if = { limit = { has_idea = EGY_broken_economy_idea_2 } set_variable = { additional_expense_broken = 2 } add_to_variable = { additional_expenses_rate = additional_expense_broken } } else_if = { limit = { has_idea = EGY_broken_economy_idea_3 } set_variable = { additional_expense_broken = 1 } add_to_variable = { additional_expenses_rate = additional_expense_broken } } } else_if = { limit = { original_tag = FRA } if = { limit = { has_dynamic_modifier = { modifier = FRA_idea_nepad_modifier } } add_to_variable = { additional_expenses_rate = FRA.FRA_nepad_sponsor_weekly_cost } } } else_if = { limit = { original_tag = ISR } if = { limit = { has_idea = israeli_intelligenc_idea } set_variable = { additional_spend_mossad = 0.215 } add_to_variable = { additional_expenses_rate = additional_spend_mossad } } else_if = { limit = { has_idea = israeli_intelligenc2_idea } set_variable = { additional_spend_mossad = 0.415 } add_to_variable = { additional_expenses_rate = additional_spend_mossad } } else_if = { limit = { has_idea = israeli_intelligenc3_idea } set_variable = { additional_spend_mossad = 0.615 } add_to_variable = { additional_expenses_rate = additional_spend_mossad } } } # Czech Republic else_if = { limit = { original_tag = CZE } if = { limit = { has_completed_focus = CZE_keynesianism } set_variable = { CZE_increased_state_expenditure = { value = gdp_total multiply = CZE.CZE_increased_state_expenditure_multiplier } } add_to_variable = { additional_expenses_rate = CZE_increased_state_expenditure } } if = { limit = { has_idea = CZE_foreign_monarchy_intromision } set_variable = { CZE_foreign_monarchy = 0.5 } add_to_variable = { additional_expenses_rate = CZE_foreign_monarchy } } } # Greece else_if = { limit = { original_tag = GRE } # Creditor debt interest payments if = { limit = { GRE_has_creditors = yes check_variable = { GRE_creditor_payment_total > 0 } } set_variable = { GRE_creditor_debt_expense = GRE_creditor_payment_total } add_to_variable = { additional_expenses_rate = GRE_creditor_debt_expense } } } # Hungary else_if = { limit = { original_tag = HUN } if = { limit = { has_idea = CZE_HUN_manipulating_our_commerce } set_variable = { CZE_HUN_stolen_income = { value = resource_sale_rate multiply = 0.1 } } add_to_variable = { additional_expenses_rate = CZE_HUN_stolen_income } } } else_if = { limit = { original_tag = NKO } if = { limit = { has_idea = SOV_korean_stream_idea } set_variable = { additional_expense_SOV_korean_stream_idea = 0.375 } add_to_variable = { additional_expenses_rate = additional_expense_SOV_korean_stream_idea } } } else_if = { limit = { original_tag = COM } if = { limit = { has_country_flag = COM_the_zanzibar_agreement_pay } set_variable = { additional_expense_COM_zanzibar_agreement = 0.250 } add_to_variable = { additional_expenses_rate = additional_expense_COM_zanzibar_agreement } } } else_if = { limit = { original_tag = JAP } if = { limit = { has_idea = JAP_focus_renewable_energy_idea } set_variable = { JAP_focus_renewable_energy_expenses = { value = gdp_total multiply = 0.001 } } add_to_variable = { additional_expenses_rate = JAP_focus_renewable_energy_expenses } } if = { limit = { has_idea = JAP_focus_thermal_power_idea } set_variable = { JAP_focus_thermal_power_expenses = { value = gdp_total multiply = 0.001 } } add_to_variable = { additional_expenses_rate = JAP_focus_thermal_power_expenses } } } # Antarctica station maintenance costs if = { limit = { has_idea = at_member } set_variable = { antarctica_maintenance_cost = { value = antarctica_station_total_upkeep_multiplier clamp = { min = 0 max = @math_expressions_max } } } add_to_variable = { additional_expenses_rate = antarctica_maintenance_cost } } #Compensate for inflation on the final value set_temp_variable = { additional_expenses_inflation = { value = 1 add = modifier@inflation_cost_multiplier_modifier } } multiply_variable = { additional_expenses_rate = additional_expenses_inflation } # Event Horizon if = { limit = { has_idea = EH_intensive_research_effort_idea } set_variable = { EH_intensive_research_effort_expenditure = { value = gdp_total multiply = EH_intensive_research_effort_expenditure_multiplier_var } } add_to_variable = { additional_expenses_rate = EH_intensive_research_effort_expenditure } } # CPD War Reparations Expense — variable set in 02_peace_deal_effects.txt on sign. # Added after inflation multiplier because the weekly amount is already a # fraction of GDP captured at sign-time (no double-inflation). if = { limit = { has_idea = CPD_war_reparations_payer } add_to_variable = { additional_expenses_rate = CPD_reparations_weekly } } # Saudi Arabia - Seperate from GULF # === Saudi pipeline transit fees (Additional Expense) === if = { limit = { original_tag = SAU } set_variable = { additional_expense_SAU_pipeline = 0 } # Yemen route - 1 transit country (Yemen) if = { limit = { has_idea = SAU_yemen_pipeline_t1 } add_to_variable = { additional_expense_SAU_pipeline = 1.0 } } if = { limit = { has_idea = SAU_yemen_pipeline_t2 } add_to_variable = { additional_expense_SAU_pipeline = 1.15 } } if = { limit = { has_idea = SAU_yemen_pipeline_t3 } add_to_variable = { additional_expense_SAU_pipeline = 1.25 } } # Levant route - 2 transit countries (Jordan + Syria) if = { limit = { has_idea = SAU_syria_pipeline_t1 } add_to_variable = { additional_expense_SAU_pipeline = 2.0 } } if = { limit = { has_idea = SAU_syria_pipeline_t2 } add_to_variable = { additional_expense_SAU_pipeline = 2.3 } } if = { limit = { has_idea = SAU_syria_pipeline_t3 } add_to_variable = { additional_expense_SAU_pipeline = 2.5 } } # Iraq route - 1 transit country (Iraq) if = { limit = { has_idea = SAU_iraq_pipeline_t1 } add_to_variable = { additional_expense_SAU_pipeline = 1.0 } } if = { limit = { has_idea = SAU_iraq_pipeline_t2 } add_to_variable = { additional_expense_SAU_pipeline = 1.15 } } if = { limit = { has_idea = SAU_iraq_pipeline_t3 } add_to_variable = { additional_expense_SAU_pipeline = 1.25 } } # Europe extension - 1 transit country (Turkey) if = { limit = { has_country_flag = SAU_turkey_pipeline_open } add_to_variable = { additional_expense_SAU_pipeline = 1.25 } } add_to_variable = { additional_expenses_rate = additional_expense_SAU_pipeline } } } # Effect: calculate_int_investments_rate # Purpose: Computes weekly ROI from international investments and splits it into treasury vs reinvested shares calculate_int_investments_rate = { # Base ROI + stacked return_on_investment_modifier, clamped to the engine-wide ceiling set_variable = { roi_rate = { value = 0.06 add = modifier@return_on_investment_modifier clamp = { min = 0 max = 0.20 } } } #This is how much money we get back in a year, converted to weekly set_variable = { int_investments_rate = { value = int_investments multiply = roi_rate multiply = 0.019 clamp = { min = 0 max = @math_expressions_max } } } if = { limit = { check_variable = { int_reinvest_mode = 1 } } set_variable = { int_investments_collected_rate = 0 } set_variable = { int_investments_reinvest_rate = int_investments_rate } } else_if = { limit = { check_variable = { int_reinvest_mode = 2 } } set_variable = { int_investments_collected_rate = { value = int_investments_rate multiply = 0.5 } } set_variable = { int_investments_reinvest_rate = int_investments_collected_rate } } else = { set_variable = { int_investments_collected_rate = int_investments_rate } set_variable = { int_investments_reinvest_rate = 0 } } } # Effect: calculate_resource_sale_rate # Purpose: Computes weekly revenue from resource exports at market prices calculate_resource_sale_rate = { #Additive export multipliers (base + per-resource modifiers), computed before the export revenue so each fold reads the finished multiplier set_temp_variable = { resource_export_multiplier = { value = 1 add = modifier@resource_export_multiplier_modifier } } set_temp_variable = { oil_export_multiplier = { value = resource_export_multiplier add = modifier@oil_export_multiplier_modifier } } set_temp_variable = { steel_export_multiplier = { value = resource_export_multiplier add = modifier@steel_export_multiplier_modifier } } set_temp_variable = { aluminium_export_multiplier = { value = resource_export_multiplier add = modifier@aluminium_export_multiplier_modifier } } set_temp_variable = { tungsten_export_multiplier = { value = resource_export_multiplier add = modifier@tungsten_export_multiplier_modifier } } set_temp_variable = { chromium_export_multiplier = { value = resource_export_multiplier add = modifier@chromium_export_multiplier_modifier } } set_temp_variable = { rubber_export_multiplier = { value = resource_export_multiplier add = modifier@rubber_export_multiplier_modifier } } set_temp_variable = { microchip_export_multiplier = { value = resource_export_multiplier add = modifier@microchip_export_multiplier_modifier } } set_temp_variable = { composite_export_multiplier = { value = resource_export_multiplier add = modifier@composite_export_multiplier_modifier } } #Revenue = exported amount * market price * export multiplier * yearly-to-weekly constant set_variable = { oil_exports = { value = resource_exported@oil multiply = global.oil_price multiply = oil_export_multiplier multiply = @resource_sale_rate_constant } } set_variable = { steel_exports = { value = resource_exported@steel multiply = global.steel_price multiply = steel_export_multiplier multiply = @resource_sale_rate_constant } } set_variable = { aluminium_exports = { value = resource_exported@aluminium multiply = global.aluminium_price multiply = aluminium_export_multiplier multiply = @resource_sale_rate_constant } } set_variable = { tungsten_exports = { value = resource_exported@tungsten multiply = global.tungsten_price multiply = tungsten_export_multiplier multiply = @resource_sale_rate_constant } } set_variable = { chromium_exports = { value = resource_exported@chromium multiply = global.chromium_price multiply = chromium_export_multiplier multiply = @resource_sale_rate_constant } } set_variable = { rubber_exports = { value = resource_exported@rubber multiply = global.rubber_price multiply = rubber_export_multiplier multiply = @resource_sale_rate_constant } } set_variable = { microchip_exports = { value = resource_exported@microchips multiply = global.microchip_price multiply = microchip_export_multiplier multiply = @resource_sale_rate_constant } } set_variable = { composite_exports = { value = resource_exported@composites multiply = global.composite_price multiply = composite_export_multiplier multiply = @resource_sale_rate_constant } } # Clamp Export Values at 0 so Luigi's massive negatives don't break my shit clamp_variable = { var = oil_exports min = 0 } clamp_variable = { var = steel_exports min = 0 } clamp_variable = { var = aluminium_exports min = 0 } clamp_variable = { var = tungsten_exports min = 0 } clamp_variable = { var = chromium_exports min = 0 } clamp_variable = { var = rubber_exports min = 0 } clamp_variable = { var = microchip_exports min = 0 } clamp_variable = { var = composite_exports min = 0 } #Add total cost set_variable = { resource_sale_rate = { value = oil_exports add = steel_exports add = aluminium_exports add = tungsten_exports add = chromium_exports add = rubber_exports add = microchip_exports add = composite_exports clamp = { min = 0 max = @math_expressions_max } } } } # Effect: update_display # Purpose: Aggregates expense streams and computes net treasury change for the UI update_display = { set_variable = { display_expense = { value = bureaucracy_gain add = defence_gain add = security_gain add = education_gain add = health_gain add = welfare_gain add = infra_gain add = additional_expenses_rate add = border_control_gain add = united_nations_expenses } } if = { limit = { NOT = { OR = { has_active_mission = cheap_loan_from_the_imf_mission has_country_flag = paused_debt_repayment } } } add_to_variable = { display_expense = debt_rate } } set_variable = { display_income = { value = tax_gain add = resource_sale_rate add = int_investments_collected_rate add = additional_income_rate } } # Calculate for Rentier State set_variable = { resource_to_tax_income = { value = resource_sale_rate divide = { value = tax_gain clamp = { min = 0.001 max = 100000000 } } } } # Adjusted Potential Income to the international investments so that people can't exploit the incoming financial collapse set_variable = { potential_income = { value = display_income add = int_investments_reinvest_rate } } # Adjust Potential Expense to Include the Debt Rate set_variable = { potential_expense = display_expense } if = { limit = { OR = { has_active_mission = cheap_loan_from_the_imf_mission has_country_flag = paused_debt_repayment } } add_to_variable = { potential_expense = debt_rate } } set_variable = { treasury_rate = { value = display_income subtract = display_expense } } if = { limit = { is_in_array = { global.arabic_countries = THIS.id } } calculate_monthly_arab_spring_change = yes } } # Effect: update_economic_cycle_cost # Purpose: Computes the cost to unlock and upgrade economic cycles (5% of GDP) update_economic_cycle_cost = { set_variable = { econ_cycle_upg_cost = { value = gdp_total multiply = 0.05 # 5% of GDP Total in billions multiply = { value = 1 add = modifier@econ_cycle_upg_cost_multiplier_modifier } } } } # Effect: update_state_variables # Purpose: Calculates national aggregate variables (consumer goods, military buildings, population state) update_state_variables = { # Calculate Consumer Goods Factor set_variable = { actual_consumer_goods_percent_display = { value = modifier@consumer_goods_expected_value multiply = { value = 1 add = modifier@consumer_goods_factor } } } hidden_effect = { productivity_growth_country_display_effect = yes set_temp_variable = { num_missile_silo = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@rocket_site } } } set_temp_variable = { num_anti_air_building = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@anti_air_building } } } set_variable = { rocket_sites = num_missile_silo } set_variable = { anti_air_building = num_anti_air_building } set_variable = { agriculture_district_total = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@agriculture_district } } } set_variable = { office_park_total = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@offices } } } set_variable = { industrial_complex_total = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@industrial_complex } } } set_variable = { military_factory_total = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@arms_factory } } } set_variable = { naval_factory_total = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@dockyard } } } set_variable = { renewable_energy_infra = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@renewable_energy_infra } } } set_variable = { nuclear_reactors = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@nuclear_reactor } } } set_variable = { hydroelectric_energy_generation_base = { value = 0 every_collection = { named_collection = controlled_states_collection add = hydroelectric_energy_production_var } } } set_variable = { geothermal_energy_generation_base = { value = 0 every_collection = { named_collection = controlled_states_collection add = geothermal_energy_production_var } } } set_variable = { max_stored_energy_base = { value = 0 every_collection = { named_collection = controlled_states_collection add = hydroelectric_energy_storage_var } } } set_variable = { number_of_battery_parks = { value = 0 every_collection = { named_collection = controlled_states_collection add = number_of_battery_parks_state_var } } } set_variable = { number_of_fossil_pps = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@fossil_powerplant } } } set_variable = { fuel_silos = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@fuel_silo } } } set_variable = { nuclear_facility_total = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@nuclear_facility } } } set_variable = { air_facility_total = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@air_facility } } } set_variable = { land_facility_total = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@land_facility } } } set_variable = { naval_facility_total = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@naval_facility } } } set_variable = { microchip_plant_total = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@microchip_plant } } } set_variable = { synthetic_refinery_total = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@synthetic_refinery } } } set_variable = { composite_plant_total = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@composite_plant } } } set_variable = { internet_station_total = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@internet_station } } } set_variable = { rail_terminal_total = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@rail_terminal } } } set_variable = { undamaged_enrichment_facilities = { value = 0 every_collection = { named_collection = controlled_states_collection add = non_damaged_building_level@enrichment_facility } } } set_variable = { total_enrichment_facilities = { value = 0 every_collection = { named_collection = controlled_states_collection add = building_level@enrichment_facility } } } set_variable = { population_total = { value = 0 every_collection = { named_collection = controlled_states_collection add = { value = state_population_k multiply = 0.01 } } } } # Population Total (millions) set_variable = { population_total_m = { value = population_total multiply = 0.1 clamp = { min = 0.0001 max = 100000000 } } } set_variable = { var = last_overall_productivity value = overall_productivity } set_variable = { overall_productivity = { value = 0 every_collection = { named_collection = controlled_states_collection add = { value = productivity_state_var multiply = 0.001 multiply = { value = state_population_k multiply = 0.01 } } } multiply = 0.1 divide = population_total_m multiply = 1000 # INFO: This is a workaround to prevent the overflow of produtcivity to 424 million. clamp = { min = 0 max = 1000000 } } } # Calculate Renewable Infrastructure Information set_variable = { state_renewable_energy_var = { value = 0 every_collection = { named_collection = controlled_states_collection if = { limit = { value = building_level@renewable_energy_infra greater_than = 0 } add = { value = building_level@renewable_energy_infra multiply = 0.5 multiply = renewable_energy_random_var multiply = { value = 1 add = THIS.modifier@state_renewable_energy_generation_modifier } } } } } } set_variable = { minimum_renewable_energy_var_base = { value = 0 every_collection = { named_collection = controlled_states_collection if = { limit = { value = building_level@renewable_energy_infra greater_than = 0 } add = { value = building_level@renewable_energy_infra multiply = 0.5 multiply = min_renewable_energy_var multiply = { value = 1 add = THIS.modifier@state_renewable_energy_generation_modifier } } } } } } set_variable = { maximum_renewable_energy_var_base = { value = 1 every_collection = { named_collection = controlled_states_collection if = { limit = { value = building_level@renewable_energy_infra greater_than = 0 } add = { value = building_level@renewable_energy_infra multiply = 0.5 multiply = max_renewable_energy_var multiply = { value = 1 add = THIS.modifier@state_renewable_energy_generation_modifier } } } } } } # Per-state building output only; country idea bonuses to fossil_energy_gain stay applied at the country level set_variable = { state_fossil_energy_var = { value = 0 every_collection = { named_collection = controlled_states_collection if = { limit = { value = building_level@fossil_powerplant greater_than = 0 } add = { value = building_level@fossil_powerplant multiply = 2 multiply = { value = 1 add = THIS.modifier@state_fossil_fuel_energy_generation_modifier } } } } } } set_variable = { state_nuclear_energy_var = { value = 0 every_collection = { named_collection = controlled_states_collection if = { limit = { value = building_level@nuclear_reactor greater_than = 0 } add = { value = building_level@nuclear_reactor multiply = 4 multiply = { value = 1 add = THIS.modifier@state_nuclear_energy_generation_modifier } } } } } } productivity_growth_controlled_display_effect = yes } set_variable = { total_resource_amount = { value = resource_produced@oil add = resource_produced@steel add = resource_produced@chromium add = resource_produced@rubber add = resource_produced@aluminium add = resource_produced@tungsten add = resource_produced@microchips add = resource_produced@composites } } # If no controlled states (capitulated/exiled), preserve last known productivity so the economy isn't permanently destroyed on liberation if = { limit = { check_variable = { overall_productivity < 1 } } set_variable = { overall_productivity = last_overall_productivity } } calculate_gdp = yes } # Effect: calculate_gdp # Purpose: Sums per-building GDP contributions into gdp_total and derives gdp_per_capita calculate_gdp = { # Calculate Last Quarter's GDP if = { limit = { NOT = { has_country_flag = calculated_quarterly_gdp } OR = { check_variable = { global.month = 3 } check_variable = { global.month = 6 } check_variable = { global.month = 9 } check_variable = { global.month = 12 } } } set_variable = { last_quarter_gdp_growth_rate = { value = gdp_total divide = { value = last_quarter_gdp_total clamp = { min = 0.001 max = @math_expressions_max } } add = -1 clamp = { min = -1 max = @math_expressions_max } } } set_variable = { last_quarter_gdp_total = gdp_total } add_to_array = { quarterly_gdp_growth_rate = last_quarter_gdp_growth_rate } #GDP/C Quarterly Growth set_variable = { last_quarter_gdpc_growth_rate = { value = gdp_per_capita divide = { value = last_quarter_gdpc_total clamp = { min = 0.001 max = @math_expressions_max } } add = -1 clamp = { min = -1 max = 0.5 } } } set_variable = { last_quarter_gdpc_total = gdp_per_capita } add_to_array = { quarterly_gdpc_growth_rate = last_quarter_gdpc_growth_rate } set_country_flag = { flag = calculated_quarterly_gdp days = 85 value = 1 } quarterly_inflation_calculation = yes } # Reset the Gross Domestic Product set_variable = { var = gdp_total value = 0 } # Calculates Unemployment set_temp_variable = { workforce_total = { value = population_total_m multiply = 0.6 multiply = { value = 1 add = modifier@total_workforce_modifier clamp = { min = 0 max = 1.5 } } clamp = { min = 0.01 max = @math_expressions_max } } } # Sets the total workforce displays set_variable = { workforce_total_display = workforce_total } set_variable = { workforce_total_percentage_display = { value = workforce_total_display divide = { value = population_total_m clamp = { min = 0.001 max = @math_expressions_max } } } } # Primary Sector # Employment in the Resource Sector set_variable = { resource_sector_workers = { value = total_resource_amount multiply = 0.075 multiply = { value = 1 add = modifier@resource_sector_workers_modifier } divide = { value = gdpc_converging_var clamp = { min = 0.1 max = @math_expressions_max } } multiply = { value = 1 add = modifier@resource_extraction_workforce_requirement_modifier clamp = { min = 0.10 max = @math_expressions_max } } } } set_temp_variable = { max_resource_workers = { value = workforce_total multiply = 0.75 } } subtract_from_temp_variable = { workforce_total = max_resource_workers } if = { limit = { check_variable = { resource_sector_workers < 0.001 } } set_variable = { resource_sector_worker_fulfillment = 1 } set_variable = { resource_sector_worker_fulfillment_var = 0 } set_variable = { resource_sector_workers = 0 } add_to_temp_variable = { workforce_total = max_resource_workers } } else = { set_variable = { resource_sector_worker_fulfillment = { value = max_resource_workers divide = { value = resource_sector_workers clamp = { min = 0.001 max = @math_expressions_max } } clamp = { min = 0 max = 1 } } } set_variable = { resource_sector_worker_fulfillment_var = { value = -1 add = resource_sector_worker_fulfillment } } if = { limit = { check_variable = { resource_sector_workers > max_resource_workers } } set_variable = { resource_sector_workers = max_resource_workers } } subtract_from_temp_variable = { max_resource_workers = resource_sector_workers } add_to_temp_variable = { workforce_total = max_resource_workers } } # Calculates GDP from the resource sector set_temp_variable = { gdp_from_resource_sector = { value = total_resource_amount multiply = 0.5 multiply = { value = 1 add = modifier@gdp_from_resource_sector_modifier } multiply = { value = 1 add = modifier@local_resources_factor } } } # Employment in Subsistence Agriculture if = { limit = { check_variable = { gdpc_converging_var < 1.3 } } set_variable = { agriculture_workers = { value = workforce_total multiply = { value = gdpc_converging_var multiply = -0.02 add = 0.9 } } } } else = { set_variable = { agriculture_workers = { value = workforce_total multiply = { value = 1.076 multiply = 0.9 divide = gdpc_converging_var multiply = { value = 1.076 multiply = -1 divide = gdpc_converging_var add = 2 } multiply = { value = 1 add = modifier@agriculture_workers_modifier } clamp = { min = 0.0 max = 0.9 } } } } } set_variable = { gdp_from_agriculture = { value = agriculture_workers multiply = { value = 2.75 multiply = { value = 1 add = modifier@agricolture_productivity_modifier } } multiply = 1.337 } } subtract_from_temp_variable = { workforce_total = agriculture_workers } # Factories & Offices Employment (all values in millions) set_temp_variable = { workers_per_civ_fac = 0.206 } #millions of people who depend from these jobs, not just direct workers but including retail, services, food industry set_temp_variable = { workers_per_mil_fac = 0.0188 } set_temp_variable = { workers_per_dockyard = 0.0188 } set_temp_variable = { workers_per_office = 0.473 } set_temp_variable = { workers_per_agriculture_district = 0.188 } set_temp_variable = { workers_per_microchip_plant = 0.0375 } set_temp_variable = { workers_per_composite_plant = 0.0375 } set_temp_variable = { workers_per_synthetic_refinery = 0.184 } set_temp_variable = { workers_per_nuclear_reactor = 0.115 } set_temp_variable = { workers_per_fossil_powerplant = 0.0075 } set_temp_variable = { workers_per_renewable_energy = 0.0225 } set_temp_variable = { workers_per_internet_station = 0.012 } set_temp_variable = { workers_per_rail_terminal = 0.015 } set_temp_variable = { mil_facs_worker_requirement_multiplier = { value = 1 add = modifier@mil_facs_worker_requirement_modifier add = modifier@buildings_worker_requirement_modifier clamp = { min = 0.10 max = @math_expressions_max } } } # Power Plants — allocated first so the grid is staffed before any industrial demand # Nuclear Reactors if = { limit = { check_variable = { nuclear_reactors = 0 } } set_variable = { nuclear_reactors_manpower_fulfillment = 1 } } else = { set_temp_variable = { max_workers_in_nuclear_reactors = { value = nuclear_reactors multiply = workers_per_nuclear_reactor multiply = { value = 1 add = modifier@buildings_worker_requirement_modifier clamp = { min = 0.10 max = @math_expressions_max } } } } set_variable = { workers_in_nuclear_reactors = { value = max_workers_in_nuclear_reactors multiply = nuclear_reactor_employment_var clamp = { min = 0 max = workforce_total } } } set_variable = { nuclear_reactors_manpower_fulfillment = { value = workers_in_nuclear_reactors divide = { value = max_workers_in_nuclear_reactors clamp = { min = 0.001 max = @math_expressions_max } } } } subtract_from_temp_variable = { workforce_total = workers_in_nuclear_reactors } } # Fossil Power Plants if = { limit = { check_variable = { number_of_fossil_pps = 0 } } set_variable = { fossil_powerplants_manpower_fulfillment = 1 } } else = { set_temp_variable = { max_workers_in_fossil_powerplants = { value = number_of_fossil_pps multiply = workers_per_fossil_powerplant multiply = { value = 1 add = modifier@buildings_worker_requirement_modifier add = modifier@infrastructure_workforce_requirement_modifier clamp = { min = 0.10 max = @math_expressions_max } } } } set_variable = { workers_in_fossil_powerplants = { value = max_workers_in_fossil_powerplants multiply = fossil_powerplant_employment_var clamp = { min = 0 max = workforce_total } } } set_variable = { fossil_powerplants_manpower_fulfillment = { value = workers_in_fossil_powerplants divide = { value = max_workers_in_fossil_powerplants clamp = { min = 0.001 max = @math_expressions_max } } } } subtract_from_temp_variable = { workforce_total = workers_in_fossil_powerplants } } # Renewable Energy Infrastructure if = { limit = { check_variable = { renewable_energy_infra = 0 } } set_variable = { renewable_energy_infra_manpower_fulfillment = 1 } } else = { set_temp_variable = { max_workers_in_renewable_energy = { value = renewable_energy_infra multiply = workers_per_renewable_energy multiply = { value = 1 add = modifier@buildings_worker_requirement_modifier add = modifier@infrastructure_workforce_requirement_modifier clamp = { min = 0.10 max = @math_expressions_max } } } } set_variable = { workers_in_renewable_energy = { value = max_workers_in_renewable_energy multiply = renewable_energy_employment_var clamp = { min = 0 max = workforce_total } } } set_variable = { renewable_energy_infra_manpower_fulfillment = { value = workers_in_renewable_energy divide = { value = max_workers_in_renewable_energy clamp = { min = 0.001 max = @math_expressions_max } } } } subtract_from_temp_variable = { workforce_total = workers_in_renewable_energy } } set_variable = { state_renewable_energy_var = { value = state_renewable_energy_var multiply = renewable_energy_infra_manpower_fulfillment } } set_variable = { minimum_renewable_energy_var_base = { value = minimum_renewable_energy_var_base multiply = renewable_energy_infra_manpower_fulfillment } } set_variable = { maximum_renewable_energy_var_base = { value = maximum_renewable_energy_var_base multiply = renewable_energy_infra_manpower_fulfillment } } if = { limit = { check_variable = { military_factory_total = 0 } } set_variable = { military_factories_manpower_fulfillment = 1 } set_variable = { workers_per_mil_fac_display = { value = workers_per_mil_fac multiply = mil_facs_worker_requirement_multiplier multiply = 1000 } } } else = { set_temp_variable = { workers_per_mil_fac = { value = workers_per_mil_fac multiply = mil_facs_worker_requirement_multiplier } } set_variable = { workers_per_mil_fac_display = { value = workers_per_mil_fac multiply = 1000 } } set_temp_variable = { max_workers_in_mil_facs = { value = military_factory_total multiply = workers_per_mil_fac } } set_variable = { workers_in_mil_facs = { value = max_workers_in_mil_facs multiply = military_factory_employment_var clamp = { min = 0 max = workforce_total } } } set_variable = { military_factories_manpower_fulfillment = { value = workers_in_mil_facs divide = { value = max_workers_in_mil_facs clamp = { min = 0.001 max = @math_expressions_max } } } } subtract_from_temp_variable = { workforce_total = workers_in_mil_facs } } if = { limit = { check_variable = { naval_factory_total = 0 } } set_variable = { naval_factories_manpower_fulfillment = 1 } set_variable = { workers_per_dockyard_display = { value = workers_per_dockyard multiply = mil_facs_worker_requirement_multiplier multiply = 1000 } } } else = { set_temp_variable = { workers_per_dockyard = { value = workers_per_dockyard multiply = mil_facs_worker_requirement_multiplier } } set_variable = { workers_per_dockyard_display = { value = workers_per_dockyard multiply = 1000 } } set_temp_variable = { max_workers_in_dockyards = { value = naval_factory_total multiply = workers_per_dockyard } } set_variable = { workers_in_dockyards = { value = max_workers_in_dockyards multiply = naval_factory_employment_var clamp = { min = 0 max = workforce_total } } } set_variable = { naval_factories_manpower_fulfillment = { value = workers_in_dockyards divide = { value = max_workers_in_dockyards clamp = { min = 0.001 max = @math_expressions_max } } } } subtract_from_temp_variable = { workforce_total = workers_in_dockyards } } set_temp_variable = { worker_requirement_gdp_multiplier = { value = 3 divide = { value = gdpc_converging_var clamp = { min = 5 max = @math_expressions_max } } add = 1 } } set_temp_variable = { workers_per_civ_fac = { value = workers_per_civ_fac multiply = worker_requirement_gdp_multiplier } } set_temp_variable = { workers_per_office = { value = workers_per_office multiply = worker_requirement_gdp_multiplier } } set_temp_variable = { workers_per_agriculture_district = { value = workers_per_agriculture_district multiply = worker_requirement_gdp_multiplier } } set_temp_variable = { workers_per_microchip_plant = { value = workers_per_microchip_plant multiply = worker_requirement_gdp_multiplier } } set_temp_variable = { workers_per_composite_plant = { value = workers_per_composite_plant multiply = worker_requirement_gdp_multiplier } } set_temp_variable = { workers_per_synthetic_refinery = { value = workers_per_synthetic_refinery multiply = worker_requirement_gdp_multiplier } } if = { limit = { check_variable = { industrial_complex_total = 0 } } set_variable = { civilian_factories_manpower_fulfillment = 1 } set_variable = { workers_per_civ_fac_display = { value = workers_per_civ_fac multiply = 1000 } } } else = { set_temp_variable = { workers_per_civ_fac = { value = workers_per_civ_fac multiply = { value = 1 add = modifier@civ_facs_worker_requirement_modifier add = modifier@buildings_worker_requirement_modifier clamp = { min = 0.10 max = @math_expressions_max } } } } set_variable = { workers_per_civ_fac_display = { value = workers_per_civ_fac multiply = 1000 } } set_temp_variable = { max_workers_in_civ_facs = { value = industrial_complex_total multiply = workers_per_civ_fac } } set_variable = { workers_in_civ_facs = { value = max_workers_in_civ_facs multiply = civilian_factory_employment_var clamp = { min = 0 max = workforce_total } } } set_variable = { civilian_factories_manpower_fulfillment = { value = workers_in_civ_facs divide = { value = max_workers_in_civ_facs clamp = { min = 0.001 max = @math_expressions_max } } } } subtract_from_temp_variable = { workforce_total = workers_in_civ_facs } } if = { limit = { check_variable = { office_park_total = 0 } } set_variable = { offices_manpower_fulfillment = 1 } set_variable = { workers_per_office_display = { value = workers_per_office multiply = 1000 } } } else = { set_temp_variable = { workers_per_office = { value = workers_per_office multiply = { value = 1 add = modifier@offices_worker_requirement_modifier add = modifier@buildings_worker_requirement_modifier clamp = { min = 0.10 max = @math_expressions_max } } } } set_variable = { workers_per_office_display = { value = workers_per_office multiply = 1000 } } set_temp_variable = { max_workers_in_offices = { value = office_park_total multiply = workers_per_office } } set_variable = { workers_in_offices = { value = max_workers_in_offices multiply = office_employment_var clamp = { min = 0 max = workforce_total } } } set_variable = { offices_manpower_fulfillment = { value = workers_in_offices divide = { value = max_workers_in_offices clamp = { min = 0.001 max = @math_expressions_max } } } } subtract_from_temp_variable = { workforce_total = workers_in_offices } } if = { limit = { check_variable = { agriculture_district_total = 0 } } set_variable = { agriculture_district_manpower_fulfillment = 1 } set_variable = { workers_per_agriculture_district_display = { value = workers_per_agriculture_district multiply = 1000 } } } else = { set_temp_variable = { workers_per_agriculture_district = { value = workers_per_agriculture_district multiply = { value = 1 add = modifier@agriculture_district_worker_requirement_modifier add = modifier@buildings_worker_requirement_modifier clamp = { min = 0.10 max = @math_expressions_max } } } } set_variable = { workers_per_agriculture_district_display = { value = workers_per_agriculture_district multiply = 1000 } } set_temp_variable = { max_workers_in_agriculture_district = { value = agriculture_district_total multiply = workers_per_agriculture_district } } set_variable = { workers_in_agriculture_district = { value = max_workers_in_agriculture_district multiply = agriculture_district_employment_var clamp = { min = 0 max = workforce_total } } } set_variable = { agriculture_district_manpower_fulfillment = { value = workers_in_agriculture_district divide = { value = max_workers_in_agriculture_district clamp = { min = 0.001 max = @math_expressions_max } } } } subtract_from_temp_variable = { workforce_total = workers_in_agriculture_district } } if = { limit = { check_variable = { microchip_plant_total = 0 } } set_variable = { microchip_plant_manpower_fulfillment = 1 } set_variable = { workers_per_microchip_plant_display = { value = workers_per_microchip_plant multiply = 1000 } } } else = { set_temp_variable = { workers_per_microchip_plant = { value = workers_per_microchip_plant multiply = { value = 1 add = modifier@microchip_plant_worker_requirement_modifier add = modifier@buildings_worker_requirement_modifier clamp = { min = 0.10 max = @math_expressions_max } } } } set_variable = { workers_per_microchip_plant_display = { value = workers_per_microchip_plant multiply = 1000 } } set_temp_variable = { max_workers_in_microchip_plant = { value = microchip_plant_total multiply = workers_per_microchip_plant } } set_variable = { workers_in_microchip_plant = { value = max_workers_in_microchip_plant multiply = microchip_plant_employment_var clamp = { min = 0 max = workforce_total } } } set_variable = { microchip_plant_manpower_fulfillment = { value = workers_in_microchip_plant divide = { value = max_workers_in_microchip_plant clamp = { min = 0.001 max = @math_expressions_max } } } } subtract_from_temp_variable = { workforce_total = workers_in_microchip_plant } } if = { limit = { check_variable = { composite_plant_total = 0 } } set_variable = { composite_plant_manpower_fulfillment = 1 } set_variable = { workers_per_composite_plant_display = { value = workers_per_composite_plant multiply = 1000 } } } else = { set_temp_variable = { workers_per_composite_plant = { value = workers_per_composite_plant multiply = { value = 1 add = modifier@composite_plant_worker_requirement_modifier add = modifier@buildings_worker_requirement_modifier clamp = { min = 0.10 max = @math_expressions_max } } } } set_variable = { workers_per_composite_plant_display = { value = workers_per_composite_plant multiply = 1000 } } set_temp_variable = { max_workers_in_composite_plant = { value = composite_plant_total multiply = workers_per_composite_plant } } set_variable = { workers_in_composite_plant = { value = max_workers_in_composite_plant multiply = composite_plant_employment_var clamp = { min = 0 max = workforce_total } } } set_variable = { composite_plant_manpower_fulfillment = { value = workers_in_composite_plant divide = { value = max_workers_in_composite_plant clamp = { min = 0.001 max = @math_expressions_max } } } } subtract_from_temp_variable = { workforce_total = workers_in_composite_plant } } if = { limit = { check_variable = { synthetic_refinery_total = 0 } } set_variable = { synthetic_refinery_manpower_fulfillment = 1 } set_variable = { workers_per_synthetic_refinery_display = { value = workers_per_synthetic_refinery multiply = 1000 } } } else = { set_temp_variable = { workers_per_synthetic_refinery = { value = workers_per_synthetic_refinery multiply = { value = 1 add = modifier@synthetic_refinery_worker_requirement_modifier add = modifier@buildings_worker_requirement_modifier clamp = { min = 0.10 max = @math_expressions_max } } } } set_variable = { workers_per_synthetic_refinery_display = { value = workers_per_synthetic_refinery multiply = 1000 } } set_temp_variable = { max_workers_in_synthetic_refinery = { value = synthetic_refinery_total multiply = workers_per_synthetic_refinery } } set_variable = { workers_in_synthetic_refinery = { value = max_workers_in_synthetic_refinery multiply = synthetic_refinery_employment_var clamp = { min = 0 max = workforce_total } } } set_variable = { synthetic_refinery_manpower_fulfillment = { value = workers_in_synthetic_refinery divide = { value = max_workers_in_synthetic_refinery clamp = { min = 0.001 max = @math_expressions_max } } } } subtract_from_temp_variable = { workforce_total = workers_in_synthetic_refinery } } # Internet Stations if = { limit = { check_variable = { internet_station_total = 0 } } set_variable = { internet_stations_manpower_fulfillment = 1 } } else = { set_temp_variable = { max_workers_in_internet_stations = { value = internet_station_total multiply = workers_per_internet_station multiply = { value = 1 add = modifier@buildings_worker_requirement_modifier add = modifier@infrastructure_workforce_requirement_modifier clamp = { min = 0.10 max = @math_expressions_max } } } } set_variable = { workers_in_internet_stations = { value = max_workers_in_internet_stations multiply = internet_station_employment_var clamp = { min = 0 max = workforce_total } } } set_variable = { internet_stations_manpower_fulfillment = { value = workers_in_internet_stations divide = { value = max_workers_in_internet_stations clamp = { min = 0.001 max = @math_expressions_max } } } } subtract_from_temp_variable = { workforce_total = workers_in_internet_stations } } # Rail Terminals if = { limit = { check_variable = { rail_terminal_total = 0 } } set_variable = { rail_terminal_manpower_fulfillment = 1 } } else = { set_temp_variable = { max_workers_in_rail_terminals = { value = rail_terminal_total multiply = workers_per_rail_terminal multiply = { value = 1 add = modifier@buildings_worker_requirement_modifier add = modifier@infrastructure_workforce_requirement_modifier clamp = { min = 0.10 max = @math_expressions_max } } } } set_variable = { workers_in_rail_terminals = { value = max_workers_in_rail_terminals multiply = rail_terminal_employment_var clamp = { min = 0 max = workforce_total } } } set_variable = { rail_terminal_manpower_fulfillment = { value = workers_in_rail_terminals divide = { value = max_workers_in_rail_terminals clamp = { min = 0.001 max = @math_expressions_max } } } } subtract_from_temp_variable = { workforce_total = workers_in_rail_terminals } } # Healthcare Sector — Workforce set_temp_variable = { healthcare_workforce_level_scalar = global.health_workers^health_law } set_temp_variable = { max_workers_in_healthcare = { value = population_total multiply = 0.003 multiply = healthcare_workforce_level_scalar multiply = { value = 1 add = modifier@healthcare_workforce_requirement_modifier clamp = { min = 0.10 max = @math_expressions_max } } } } if = { limit = { check_variable = { max_workers_in_healthcare < 0.001 } } set_variable = { workers_in_healthcare = 0 } set_variable = { healthcare_manpower_fulfillment = 1 } } else = { set_variable = { workers_in_healthcare = { value = max_workers_in_healthcare clamp = { min = 0 max = workforce_total } } } set_variable = { healthcare_manpower_fulfillment = { value = workers_in_healthcare divide = { value = max_workers_in_healthcare clamp = { min = 0.001 max = @math_expressions_max } } clamp = { min = 0.1 max = 1 } } } subtract_from_temp_variable = { workforce_total = workers_in_healthcare } } # Bureaucracy — civil servants required by government administration level set_temp_variable = { workers_per_bureau = global.bureau_workers^bureau_law } if = { limit = { check_variable = { workers_per_bureau = 0 } } set_variable = { bureaucracy_manpower_fulfillment = 1 } } else = { set_temp_variable = { max_workers_in_bureaucracy = { value = population_total_m multiply = workers_per_bureau clamp = { min = 0 max = @math_expressions_max } } } set_variable = { workers_in_bureaucracy = { value = max_workers_in_bureaucracy clamp = { min = 0 max = workforce_total } } } set_variable = { bureaucracy_manpower_fulfillment = { value = workers_in_bureaucracy divide = { value = max_workers_in_bureaucracy clamp = { min = 0.001 max = @math_expressions_max } } clamp = { min = 0.1 max = 1 } } } subtract_from_temp_variable = { workforce_total = workers_in_bureaucracy } # Salary cost — civil servant wages add to total bureaucracy expenditure add_to_variable = { var = bureaucracy_gain value = { value = workers_in_bureaucracy multiply = @bureau_salary_per_worker } } } # Average Worker Fulfillment set_variable = { average_worker_fulfillment = { value = civilian_factories_manpower_fulfillment add = military_factories_manpower_fulfillment add = naval_factories_manpower_fulfillment add = offices_manpower_fulfillment add = microchip_plant_manpower_fulfillment add = composite_plant_manpower_fulfillment add = synthetic_refinery_manpower_fulfillment add = agriculture_district_manpower_fulfillment add = nuclear_reactors_manpower_fulfillment add = fossil_powerplants_manpower_fulfillment add = renewable_energy_infra_manpower_fulfillment add = internet_stations_manpower_fulfillment add = rail_terminal_manpower_fulfillment add = healthcare_manpower_fulfillment add = bureaucracy_manpower_fulfillment divide = 15 } } set_variable = { total_unemployed = workforce_total } set_variable = { total_unemployed_k = { value = total_unemployed multiply = 1000 } } set_variable = { total_unemployed_percentage_display = { value = total_unemployed divide = { value = workforce_total_display clamp = { min = 0.001 max = @math_expressions_max } } } } # Calculate Threshold set_variable = { unemployment_threshold_display_var = { value = modifier@high_unemployment_threshold_modifier add = 0.06 clamp = { min = 0 max = @math_expressions_max } } } set_variable = { high_unemployment_modifier_var = { value = total_unemployed_percentage_display subtract = unemployment_threshold_display_var multiply = -1 multiply = { value = gdp_per_capita multiply = 0.025 } clamp = { min = -0.3 max = 0 } } } set_variable = { high_unemployment_modifier_var_2 = { value = high_unemployment_modifier_var multiply = -2 } } set_temp_variable = { gdp_from_civs = { value = industrial_complex_total multiply = { value = @gdp_civ_base_factor add = { value = @gdp_civ_prod_factor multiply = modifier@civilian_factories_productivity } } multiply = civilian_factories_manpower_fulfillment } } set_temp_variable = { gdp_from_mils = { value = military_factory_total multiply = { value = @gdp_mil_base_factor add = { value = @gdp_mil_prod_factor multiply = modifier@military_factories_productivity } } multiply = military_factories_manpower_fulfillment } } set_temp_variable = { gdp_from_dockyards = { value = naval_factory_total multiply = { value = @gdp_dockyard_base_factor add = { value = @gdp_dockyard_prod_factor multiply = modifier@dockyard_productivity } } multiply = naval_factories_manpower_fulfillment } } set_temp_variable = { gdp_from_offices = { value = office_park_total multiply = { value = @gdp_office_base_factor add = { value = @gdp_office_prod_factor multiply = modifier@offices_productivity } } multiply = offices_manpower_fulfillment } } set_temp_variable = { gdp_from_agriculture_district = { value = agriculture_district_total multiply = { value = @gdp_agriculture_district_base_factor add = { value = @gdp_agriculture_district_prod_factor multiply = modifier@agricolture_productivity_modifier } } multiply = agriculture_district_manpower_fulfillment } } set_temp_variable = { gdp_from_microchip_plant = { value = microchip_plant_total multiply = { value = @gdp_microchip_base_factor add = { value = @gdp_microchip_prod_factor multiply = modifier@microchip_plant_productivity_modifier } } multiply = microchip_plant_manpower_fulfillment } } set_temp_variable = { gdp_from_composite_plant = { value = composite_plant_total multiply = { value = @gdp_composite_base_factor add = { value = @gdp_composite_prod_factor multiply = modifier@composite_plant_productivity_modifier } } multiply = composite_plant_manpower_fulfillment } } set_temp_variable = { gdp_from_synthetic_refinery = { value = synthetic_refinery_total multiply = { value = @gdp_synthetic_base_factor add = { value = @gdp_synthetic_prod_factor multiply = modifier@synthetic_refinery_productivity_modifier } } multiply = synthetic_refinery_manpower_fulfillment } } set_temp_variable = { gdp_from_nuclear_reactors = { value = nuclear_reactors multiply = 4 multiply = nuclear_reactors_manpower_fulfillment } } set_temp_variable = { gdp_from_fossil_powerplants = { value = number_of_fossil_pps multiply = 1.7 multiply = fossil_powerplants_manpower_fulfillment } } set_temp_variable = { gdp_from_renewable_energy = { value = renewable_energy_infra multiply = 2 multiply = renewable_energy_infra_manpower_fulfillment } } set_temp_variable = { gdp_from_internet_stations = { value = internet_station_total multiply = 3.5 multiply = internet_stations_manpower_fulfillment } } set_temp_variable = { gdp_from_rail_terminals = { value = rail_terminal_total multiply = 2.5 multiply = rail_terminal_manpower_fulfillment } } # Healthcare Sector — GDP Contribution # Formula: population_total * 0.01 * gdp_per_capita * level_mult * fulfillment # Global overall_productivity multiplier is applied to the full gdp_total pool below if = { limit = { has_idea = health_01 } set_temp_variable = { health_gdp_level_mult = 0.10 } } else_if = { limit = { has_idea = health_02 } set_temp_variable = { health_gdp_level_mult = 0.20 } } else_if = { limit = { has_idea = health_03 } set_temp_variable = { health_gdp_level_mult = 0.35 } } else_if = { limit = { has_idea = health_04 } set_temp_variable = { health_gdp_level_mult = 0.50 } } else_if = { limit = { has_idea = health_05 } set_temp_variable = { health_gdp_level_mult = 0.65 } } else_if = { limit = { has_idea = health_06 } set_temp_variable = { health_gdp_level_mult = 0.80 } } set_temp_variable = { gdp_from_healthcare = { value = population_total multiply = 0.01 multiply = gdp_per_capita multiply = health_gdp_level_mult multiply = healthcare_manpower_fulfillment } } # Store as persistent variable for corporate tax calculation in calculate_tax_gain set_variable = { healthcare_gdp_var = gdp_from_healthcare } set_variable = { gdp_total = { value = gdp_from_civs add = gdp_from_mils add = gdp_from_dockyards add = gdp_from_offices add = gdp_from_agriculture_district add = gdp_from_microchip_plant add = gdp_from_composite_plant add = gdp_from_synthetic_refinery add = gdp_from_nuclear_reactors add = gdp_from_fossil_powerplants add = gdp_from_renewable_energy add = gdp_from_internet_stations add = gdp_from_rail_terminals add = gdp_from_healthcare add = gdp_from_agriculture add = gdp_from_resource_sector } } # Calculate GDP Percentages set_variable = { civil_fac_percent = { value = gdp_from_civs divide = { value = gdp_total clamp = { min = 0.001 max = @math_expressions_max } } clamp = { min = 0 max = 1 } } } set_variable = { military_factory_total_percent = { value = gdp_from_mils divide = { value = gdp_total clamp = { min = 0.001 max = @math_expressions_max } } clamp = { min = 0 max = 1 } } } set_variable = { naval_factory_total_percent = { value = gdp_from_dockyards divide = { value = gdp_total clamp = { min = 0.001 max = @math_expressions_max } } clamp = { min = 0 max = 1 } } } set_variable = { office_fac_percent = { value = gdp_from_offices divide = { value = gdp_total clamp = { min = 0.001 max = @math_expressions_max } } clamp = { min = 0 max = 1 } } } set_variable = { agriculture_district_fac_percent = { value = gdp_from_agriculture_district divide = { value = gdp_total clamp = { min = 0.001 max = @math_expressions_max } } clamp = { min = 0 max = 1 } } } set_variable = { agriculture_percent = { value = gdp_from_agriculture divide = { value = gdp_total clamp = { min = 0.001 max = @math_expressions_max } } clamp = { min = 0 max = 1 } } } set_variable = { resources_percent = { value = gdp_from_resource_sector divide = { value = gdp_total clamp = { min = 0.001 max = @math_expressions_max } } clamp = { min = 0 max = 1 } } } set_variable = { microchip_plant_percent = { value = gdp_from_microchip_plant divide = { value = gdp_total clamp = { min = 0.001 max = @math_expressions_max } } clamp = { min = 0 max = 1 } } } set_variable = { composite_plant_percent = { value = gdp_from_composite_plant divide = { value = gdp_total clamp = { min = 0.001 max = @math_expressions_max } } clamp = { min = 0 max = 1 } } } set_variable = { synthetic_refinery_percent = { value = gdp_from_synthetic_refinery divide = { value = gdp_total clamp = { min = 0.001 max = @math_expressions_max } } clamp = { min = 0 max = 1 } } } set_variable = { infrastructure_gdp_percent = { value = gdp_from_nuclear_reactors add = gdp_from_fossil_powerplants add = gdp_from_renewable_energy add = gdp_from_internet_stations add = gdp_from_rail_terminals divide = { value = gdp_total clamp = { min = 0.001 max = @math_expressions_max } } clamp = { min = 0 max = 1 } } } set_variable = { healthcare_gdp_percent = { value = gdp_from_healthcare divide = { value = gdp_total clamp = { min = 0.001 max = @math_expressions_max } } clamp = { min = 0 max = 1 } } } # Overall productivity grows over time (on_monthly) and with techs and its the main source of economic growth for developed countries multiply_variable = { var = gdp_total value = { value = overall_productivity divide = global.productivity_center } } clamp_variable = { var = gdp_total min = 0.1 } set_variable = { gdp_per_capita = { value = gdp_total divide = population_total_m clamp = { min = 0 max = 100000 } } } calculate_gdp_modifiers = yes set_country_flag = energy_state_bases_initialized calculate_energy_use = yes } # Effect: calculate_gdp_modifiers # Purpose: Updates dynamic modifiers keyed to GDP-per-capita thresholds (development stages) calculate_gdp_modifiers = { if = { limit = { NOT = { check_variable = { gdp_total = last_gdp_check } } } set_variable = { last_gdp_check = gdp_total } #Add the modifier if not existing if = { limit = { NOT = { has_dynamic_modifier = { modifier = gdp_per_capita_country_modifiers } } } add_dynamic_modifier = { modifier = gdp_per_capita_country_modifiers } } #Construction speed factor #-0.012 * GDP/C + 0.572 - GDP/C c [0,30] #-0.001 * GDP/C + 0.230 - GDP/C c [30, 200] #Cap at 0 set_variable = { production_speed_buildings_factor_gdp_modifier = { value = gdp_per_capita if = { limit = { value = gdp_per_capita less_than = 30 } multiply = -0.012 add = 0.572 } else = { multiply = -0.001 add = 0.230 } clamp = { min = 0 max = 20000 } } } #Population growth rate # (60 - GDP/c) * 0.02 # Break-even at GDP/c = 60, clamped to 0 above set_variable = { monthly_population_gdp_modifier = { value = 60 subtract = gdp_per_capita multiply = 0.02 clamp = { min = 0 max = 20000 } } } #Research speed factor # 0.003 * GDP/C - 0.153 # Break-even at GDP/c = 51, clamped to 0 above set_variable = { research_speed_factor_gdp_modifier = { value = gdp_per_capita multiply = 0.003 add = -0.153 clamp = { min = -1000 max = 0 } } } #Stability factor # 0.001 * GDP/C - 0.100 # Break-even at GDP/c = 100 set_variable = { stability_factor_gdp_modifier = { value = gdp_per_capita multiply = 0.001 add = -0.1 } } # max workforce # 0.100 - 0.001 * GDP/C # Break-even at GDP/c = 100, min clamp (-0.30) at GDP/c = 400 set_variable = { total_workforce_gdp_c_modifier_var = { value = gdp_per_capita multiply = -0.001 add = 0.1 clamp = { min = -0.30 max = 20000 } } } #fossil powerplants construction speed # 0.5 - 0.0125 * GDP/C # Break-even at GDP/c = 40, min clamp (-0.75) at GDP/c = 100 set_variable = { fossil_pp_construction_gdp_c_modifier_var = { value = gdp_per_capita multiply = -0.0125 add = 0.5 clamp = { min = -0.75 max = 20000 } } } } } calculate_tax_adjustments = { if = { limit = { NOT = { has_variable = population_tax_rate } } set_variable = { var = population_tax_rate value = 20 } } if = { limit = { NOT = { has_variable = corporate_tax_rate } } set_variable = { var = corporate_tax_rate value = 20 } } set_temp_variable = { pop_tax_change = 0 } set_temp_variable = { corp_tax_change = 0 } # --- TAX INCREASES (deficit response) --- # Population tax: raise at mild deficit (treasury_rate < -1) # Skip if low stability unless deficit is severe (< -5) if = { limit = { check_variable = { treasury_rate < -1 } check_variable = { population_tax_rate < 40 } OR = { has_stability > 0.24 check_variable = { treasury_rate < -5 } } } set_temp_variable = { pop_tax_change = 1 } } # Corporate tax: raise at moderate deficit (treasury_rate < -2) # Only after population tax reaches a moderate level (> 24), or at severe deficit regardless if = { limit = { check_variable = { treasury_rate < -2 } check_variable = { corporate_tax_rate < 50 } OR = { check_variable = { population_tax_rate > 24 } check_variable = { treasury_rate < -5 } } } set_temp_variable = { corp_tax_change = 1 } } # Interest rate escalation: if interest > 8% and any deficit, force tax increases # Catches debt spirals early before treasury_rate thresholds are hit if = { limit = { check_variable = { interest_rate > 8 } check_variable = { treasury_rate < 0 } } if = { limit = { check_variable = { population_tax_rate < 40 } check_variable = { pop_tax_change = 0 } } set_temp_variable = { pop_tax_change = 1 } } if = { limit = { check_variable = { corporate_tax_rate < 50 } check_variable = { corp_tax_change = 0 } } set_temp_variable = { corp_tax_change = 1 } } } # --- TAX DECREASES (surplus response) --- # When surplus is healthy and debt is manageable, lower taxes # Prefer lowering corporate tax first (it drags productivity and investment) if = { limit = { check_variable = { treasury_rate > 2 } check_variable = { debt_ratio < 0.30 } check_variable = { interest_rate < 5 } check_variable = { pop_tax_change = 0 } check_variable = { corp_tax_change = 0 } } if = { limit = { check_variable = { corporate_tax_rate > 10 } } set_temp_variable = { corp_tax_change = -1 } } else_if = { limit = { check_variable = { population_tax_rate > 15 } } set_temp_variable = { pop_tax_change = -1 } } } # Low stability override: lower population tax to restore stability if = { limit = { has_stability < 0.30 check_variable = { population_tax_rate > 20 } check_variable = { treasury_rate > 0 } check_variable = { pop_tax_change = 0 } } set_temp_variable = { pop_tax_change = -1 } } # Factory scarcity: lower corporate tax to attract investment if = { limit = { num_of_available_civilian_factories < 10 check_variable = { corporate_tax_rate > 15 } check_variable = { treasury_rate > 0 } check_variable = { corp_tax_change = 0 } } set_temp_variable = { corp_tax_change = -1 } } } calculate_ai_taxes_desire = { calculate_tax_adjustments = yes # --- APPLY AND CLAMP --- if = { limit = { is_debug = yes } log = "[GetDateText]: [THIS.GetName]: AI Tax: Pop [?pop_tax_change] ([?population_tax_rate]%), Corp [?corp_tax_change] ([?corporate_tax_rate]%), Treasury: [?treasury_rate], Interest: [?interest_rate]%" } if = { limit = { NOT = { check_variable = { pop_tax_change = 0 } } } add_to_variable = { population_tax_rate = pop_tax_change } } if = { limit = { NOT = { check_variable = { corp_tax_change = 0 } } } add_to_variable = { corporate_tax_rate = corp_tax_change } } clamp_variable = { var = population_tax_rate min = 0 max = 50 } clamp_variable = { var = corporate_tax_rate min = 0 max = 50 } } # Effect: calculate_new_education_spending_tooltip # Purpose: Calculates next-level education spending cost for the education law tooltip calculate_new_education_spending_tooltip = { set_temp_variable = { research_slot_tot = { value = amount_research_slots add = 1 multiply = 0.04 add = -0.2 } } custom_effect_tooltip = calculate_new_education_spending_tt } # Effect: worker_requirements_variable_gdpc_converging # Purpose: Converges worker requirements toward sector baselines as GDP per capita rises worker_requirements_variable_gdpc_converging = { set_temp_variable = { temp_difference = { value = gdp_per_capita subtract = gdpc_converging_var multiply = 0.25 } } add_to_variable = { gdpc_converging_var = temp_difference } } # Effect: calculate_migration_mechanic_values # Purpose: Calculates the effects of the migration mechanic. calculate_migration_mechanic_values = { # Recreate the Array resize_array = { array = array_border_control_spend size = 5 value = 0 } #Calculate the base cost of police levels for_each_loop = { array = array_border_control_spend index = i value = v set_variable = { array_border_control_spend^i = { value = population_total # Multiplier for Country Content multiply = { value = 1 add = modifier@border_control_multiplier_modifier } multiply = { value = 1 add = modifier@inflation_cost_multiplier_modifier } # GDP Per Capita Scaling multiply = { value = gdp_per_capita multiply = @spending_laws_gdp_scaling add = 1 } # Scaling Costs + base cost per 10 000 000 people multiply = 0.07 multiply = 0.004 clamp = { min = 0 max = @spending_cost_clamp_max } multiply = global.spending_ladder_standard^i } } } #Set which spending level the country is at set_temp_variable = { border_control_index = { value = migration_law subtract = 1 clamp = { min = 0 max = 4 } } } set_variable = { border_control_gain = { value = array_border_control_spend^border_control_index clamp = { min = 0 max = @math_expressions_max } } } # Productivity Calculation set_variable = { immigration_productivity_calculations_display = { value = overall_productivity divide = global.average_world_productivity subtract = 1 } } # Calculate Unemployment/Worker fulfillment set_variable = { immigration_employment_factor_display = { value = 0 if = { limit = { value = average_worker_fulfillment less_than = 1 } add = 1 subtract = average_worker_fulfillment } else = { add = total_unemployed_percentage_display multiply = -2 } } } # Government Section set_temp_variable = { immigration_government_factor = 0 } if = { limit = { has_liberal_government = yes } add_to_temp_variable = { immigration_government_factor = 0.05 } } if = { limit = { has_conservative_government = yes } add_to_temp_variable = { immigration_government_factor = -0.05 } } set_variable = { immigration_government_factor_display = immigration_government_factor } # Sum population of neighbors at war, scaled by the refugee adjuster set_variable = { neighbour_war_refugees_display = { value = 0 every_collection = { named_collection = neighbors_collection if = { limit = { value = enemies^num greater_than = 0 } add = population_total_m multiply = @refugee_percentage_adjuster } } } } # Outflow when we are at war set_variable = { personal_war_refugees_display = { value = 0 if = { limit = { value = enemies^num greater_than = 0 } add = population_total_m multiply = @refugee_percentage_adjuster multiply = 0.20 multiply = { value = 0.50 subtract = modifier@war_support_factor clamp = { min = 0 max = 1 } } multiply = -1 } } } # Calculate Net Immigration Rate set_variable = { max_net_immigration_rate = { value = immigration_productivity_calculations_display add = immigration_employment_factor_display add = immigration_government_factor_display add = modifier@maximum_migration_rate_value add = neighbour_war_refugees_display add = personal_war_refugees_display clamp = { min = -2.0 max = 2.0 } } } # Calculate Migration Rate set_temp_variable = { migration_rate_value = { value = modifier@base_migration_rate_value if = { limit = { value = modifier@base_migration_rate_value greater_than = 0 } multiply = { value = 1 add = modifier@migration_rate_value_factor clamp = { min = 0.01 max = @math_expressions_max } } } else = { divide = { value = 1 add = modifier@migration_rate_value_factor clamp = { min = 0.01 max = @math_expressions_max } } } } } # Check if there are other countries if = { limit = { check_variable = { global.countries^num < 2 } } set_variable = { max_net_immigration_rate = 0 } } set_variable = { net_immigration_rate = { value = max_net_immigration_rate multiply = migration_rate_value if = { limit = { value = global.countries^num greater_than = 0 } clamp = { min = -2.0 max = max_net_immigration_rate } } else = { clamp = { min = 0 max = 0 } } } } } # Effect: calculate_cost_pp_economic_cycles # Purpose: Computes political-point cost to unlock economic-cycle tiers calculate_cost_pp_economic_cycles = { set_temp_variable = { tmp_tax_gain_multiplier_modifier = modifier@tax_gain_multiplier_modifier } set_temp_variable = { tmp_production_speed_buildings_factor = modifier@production_speed_buildings_factor } set_temp_variable = { tmp_stability_factor = modifier@stability_factor } set_temp_variable = { tmp_political_power_gain = modifier@political_power_gain } if = { limit = { has_idea = recession } set_variable = { pp_cost_economic = 150 } add_to_temp_variable = { tmp_tax_gain_multiplier_modifier = 0.20 } add_to_temp_variable = { tmp_production_speed_buildings_factor = 0.15 } add_to_temp_variable = { tmp_stability_factor = 0.05 } } else_if = { limit = { has_idea = stagnation } set_variable = { pp_cost_economic = 200 } add_to_temp_variable = { tmp_tax_gain_multiplier_modifier = 0.10 } add_to_temp_variable = { tmp_production_speed_buildings_factor = 0.40 } add_to_temp_variable = { tmp_stability_factor = 0.02 } } else_if = { limit = { has_idea = stable_growth } set_variable = { pp_cost_economic = 250 } add_to_temp_variable = { tmp_production_speed_buildings_factor = 0.65 } } else_if = { limit = { has_idea = fast_growth } set_variable = { pp_cost_economic = 300 } add_to_temp_variable = { tmp_tax_gain_multiplier_modifier = 0.05 } add_to_temp_variable = { tmp_production_speed_buildings_factor = 0.90 } add_to_temp_variable = { tmp_stability_factor = 0.02 } } else_if = { limit = { has_idea = economic_boom } set_variable = { pp_cost_economic = 350 } add_to_temp_variable = { tmp_tax_gain_multiplier_modifier = 0.10 } add_to_temp_variable = { tmp_production_speed_buildings_factor = 1.10 } add_to_temp_variable = { tmp_stability_factor = 0.04 } } multiply_variable = { pp_cost_economic = tmp_tax_gain_multiplier_modifier } multiply_variable = { pp_cost_economic = tmp_production_speed_buildings_factor } multiply_variable = { pp_cost_economic = tmp_stability_factor } clamp_temp_variable = { var = tmp_political_power_gain min = 0.001 } divide_variable = { pp_cost_economic = tmp_political_power_gain } if = { limit = { is_debug = yes } log = "[GetDateText]: [THIS.GetName]: Next Cycle Political Power Cost: [?pp_cost_economic]" } } # Effect: setup_employment_variables # Purpose: Sets up default employment variables for nations when this is called. Mostly used in the in game startup effects setup_employment_variables = { if = { limit = { check_variable = { nation_to_copy_from = 0 } } set_variable = { market_sold_contracts = 0 } set_variable = { civilian_factory_employment_var = 1 } set_variable = { naval_factory_employment_var = 1 } set_variable = { military_factory_employment_var = 1 } set_variable = { office_employment_var = 1 } set_variable = { microchip_plant_employment_var = 1 } set_variable = { composite_plant_employment_var = 1 } set_variable = { agriculture_district_employment_var = 1 } set_variable = { synthetic_refinery_employment_var = 1 } set_variable = { nuclear_reactor_employment_var = 1 } set_variable = { fossil_powerplant_employment_var = 1 } set_variable = { renewable_energy_employment_var = 1 } set_variable = { internet_station_employment_var = 1 } set_variable = { rail_terminal_employment_var = 1 } if = { limit = { NOT = { has_variable = corporate_tax_rate } } set_variable = { var = corporate_tax_rate value = 20 } } if = { limit = { NOT = { has_variable = population_tax_rate } } set_variable = { var = population_tax_rate value = 20 } } } else = { var:nation_to_copy_from = { set_variable = { PREV.civilian_factory_employment_var = civilian_factory_employment_var } set_variable = { PREV.naval_factory_employment_var = naval_factory_employment_var } set_variable = { PREV.military_factory_employment_var = military_factory_employment_var } set_variable = { PREV.office_employment_var = office_employment_var } set_variable = { PREV.microchip_plant_employment_var = microchip_plant_employment_var } set_variable = { PREV.composite_plant_employment_var = composite_plant_employment_var } set_variable = { PREV.agriculture_district_employment_var = agriculture_district_employment_var } set_variable = { PREV.synthetic_refinery_employment_var = synthetic_refinery_employment_var } set_variable = { PREV.nuclear_reactor_employment_var = nuclear_reactor_employment_var } set_variable = { PREV.fossil_powerplant_employment_var = fossil_powerplant_employment_var } set_variable = { PREV.renewable_energy_employment_var = renewable_energy_employment_var } set_variable = { PREV.internet_station_employment_var = internet_station_employment_var } set_variable = { PREV.rail_terminal_employment_var = rail_terminal_employment_var } set_variable = { var = PREV.corporate_tax_rate value = corporate_tax_rate } set_variable = { var = PREV.population_tax_rate value = population_tax_rate } } } # Set for the power ranking system set_country_group_flags = yes } # Effect: set_initial_cost_resources # Purpose: Initializes base market prices for all resources (oil, steel, minerals, microchips, composites) set_initial_cost_resources = { #Set the base price for single unit of resource, this is the relative price between resources set_variable = { global.oil_price = 7.2 } #Divided 50/50 based on oil/natural gas price #Limited to 5, was 28 set_variable = { global.steel_price = 0.04 } #Based on steel price set_variable = { global.aluminium_price = 0.26 } #Based on aluminium price set_variable = { global.tungsten_price = 0.28 } #Based on copper price set_variable = { global.chromium_price = 0.18 } #Based on gold price set_variable = { global.rubber_price = 0.09 } #Based on rubber price set_variable = { global.microchip_price = 2.5 } set_variable = { global.composite_price = 2.1 } set_variable = { global.starting_oil_price = 7.2 } #Divided 50/50 based on oil/natural gas price #Limited to 5, was 28 set_variable = { global.starting_steel_price = 0.04 } #Based on steel price set_variable = { global.starting_aluminium_price = 0.26 } #Based on aluminium price set_variable = { global.starting_tungsten_price = 0.28 } #Based on copper price set_variable = { global.starting_chromium_price = 0.18 } #Based on gold price set_variable = { global.starting_rubber_price = 0.09 } #Based on rubber price set_variable = { global.starting_microchips_price = 2.5 } set_variable = { global.starting_composites_price = 2.1 } } # Effect: recalculate_resources_price # Purpose: Adjusts resource prices based on global supply and demand shifts recalculate_resources_price = { #Set the current global supply + demand set_temp_variable = { sum_steel = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_exported@steel } } } set_temp_variable = { sum_rubber = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_exported@rubber } } } set_temp_variable = { sum_oil = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_exported@oil } } } set_temp_variable = { sum_alum = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_exported@aluminium } } } set_temp_variable = { sum_tungsten = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_exported@tungsten } } } set_temp_variable = { sum_chromium = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_exported@chromium } } } set_temp_variable = { sum_microchips = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_exported@microchips } } } set_temp_variable = { sum_composites = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_exported@composites } } } set_temp_variable = { sum_import_steel = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_imported@steel } } } set_temp_variable = { sum_import_rubber = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_imported@rubber } } } set_temp_variable = { sum_import_oil = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_imported@oil } } } set_temp_variable = { sum_import_alum = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_imported@aluminium } } } set_temp_variable = { sum_import_tungsten = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_imported@tungsten } } } set_temp_variable = { sum_import_chromium = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_imported@chromium } } } set_temp_variable = { sum_import_microchips = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_imported@microchips } } } set_temp_variable = { sum_import_composites = { value = 0 every_collection = { named_collection = all_countries_collection add = resource_imported@composites } } } #Set the % of supply used by doing demand / supply #If using > 50% of supply, price should go up #If using < 50% of supply, price should go down #Average this around the base price, so that we dont end with constant rising / falling prices divide_temp_variable = { sum_import_steel = sum_steel } divide_temp_variable = { sum_import_rubber = sum_rubber } divide_temp_variable = { sum_import_oil = sum_oil } divide_temp_variable = { sum_import_alum = sum_alum } divide_temp_variable = { sum_import_tungsten = sum_tungsten } divide_temp_variable = { sum_import_chromium = sum_chromium } divide_temp_variable = { sum_import_microchips = sum_microchips } divide_temp_variable = { sum_import_composites = sum_composites } multiply_temp_variable = { sum_import_steel = 2 } multiply_temp_variable = { sum_import_rubber = 2 } multiply_temp_variable = { sum_import_oil = 2 } multiply_temp_variable = { sum_import_alum = 2 } multiply_temp_variable = { sum_import_tungsten = 2 } multiply_temp_variable = { sum_import_chromium = 2 } multiply_temp_variable = { sum_import_microchips = 2 } multiply_temp_variable = { sum_import_composites = 2 } set_temp_variable = { oil_price_adjuster = global.starting_oil_price } set_temp_variable = { steel_price_adjuster = global.starting_steel_price } set_temp_variable = { rubber_price_adjuster = global.starting_rubber_price } set_temp_variable = { alum_price_adjuster = global.starting_aluminium_price } set_temp_variable = { tungsten_price_adjuster = global.starting_tungsten_price } set_temp_variable = { chromium_price_adjuster = global.starting_chromium_price } set_temp_variable = { microchips_price_adjuster = global.starting_microchips_price } set_temp_variable = { composites_price_adjuster = global.starting_composites_price } multiply_temp_variable = { oil_price_adjuster = sum_import_oil } multiply_temp_variable = { steel_price_adjuster = sum_import_steel } multiply_temp_variable = { rubber_price_adjuster = sum_import_rubber } multiply_temp_variable = { alum_price_adjuster = sum_import_alum } multiply_temp_variable = { tungsten_price_adjuster = sum_import_tungsten } multiply_temp_variable = { chromium_price_adjuster = sum_import_chromium } multiply_temp_variable = { microchips_price_adjuster = sum_import_microchips } multiply_temp_variable = { composites_price_adjuster = sum_import_composites } #Clamp the prices at their min / max after adjusting them for supply & demand clamp_temp_variable = { var = steel_price_adjuster min = 0.005 max = 0.120 } clamp_temp_variable = { var = oil_price_adjuster min = 1.36 max = 38 } clamp_temp_variable = { var = rubber_price_adjuster min = 0.018 max = 0.45 } clamp_temp_variable = { var = alum_price_adjuster min = 0.042 max = 1.05 } clamp_temp_variable = { var = tungsten_price_adjuster min = 0.056 max = 1.4 } clamp_temp_variable = { var = chromium_price_adjuster min = 0.036 max = 0.9 } clamp_temp_variable = { var = microchips_price_adjuster min = 1.58 max = 40.0 } clamp_temp_variable = { var = composites_price_adjuster min = 1.42 max = 35.0 } set_variable = { global.oil_price = oil_price_adjuster } #Divided 50/50 based on oil/natural gas price #Limited to 5, was 28 set_variable = { global.steel_price = steel_price_adjuster } #Based on steel price set_variable = { global.aluminium_price = alum_price_adjuster } #Based on aluminium price set_variable = { global.tungsten_price = tungsten_price_adjuster } #Based on copper price set_variable = { global.chromium_price = chromium_price_adjuster } #Based on gold price set_variable = { global.rubber_price = rubber_price_adjuster } #Based on rubber price set_variable = { global.microchip_price = microchips_price_adjuster } set_variable = { global.composite_price = composites_price_adjuster } if = { limit = { is_debug = yes } log = "Current resource prices: steel = [?global.steel_price] rubber = [?global.rubber_price] oil = [?global.oil_price] alum = [?global.aluminium_price] tungsten = [?global.tungsten_price] chromium = [?global.chromium_price] Resource coeff = [?global.resource_gdp_coeff]" } } # Effect: calculate_united_nations_base_budget # Purpose: Computes total UN operating budget and collects per-nation mandatory contributions calculate_united_nations_base_budget = { set_variable = { global.un_operating_budget_base = 0 } set_variable = { global.total_aid_expenses_sum = 0 } clear_array = global.UN_budget_contribution_tracker clear_variable = global.target_const_speed_mod clear_variable = global.target_research_speed_mod clear_variable = global.target_civ_count clear_variable = global.average_gdp_capita set_temp_variable = { peak_const_speed_mod = 0 } set_temp_variable = { peak_research_speed_mod = 0 } set_temp_variable = { peak_civ_count = 0 } set_temp_variable = { average_gdp_capita = 0 } set_temp_variable = { peak_prod_mod = 0 } every_collection_element = { input = { input = collection:un_general_assembly_members_collection } set_variable = { united_nations_base_expenses = { value = gdp_total multiply = global.general_operating_budget_contribute_percent divide = 52 } } if = { limit = { check_variable = { united_nations_base_expenses > 0.001 } } add_to_variable = { global.un_operating_budget_base = united_nations_base_expenses } add_to_array = { global.un_operating_budget_contributors = THIS } set_variable = { united_nations_expenses = { value = united_nations_base_expenses multiply = { value = 1 add = modifier@inflation_cost_multiplier_modifier } } } set_variable = { united_nations_old_aid_expenses = 0 } } set_temp_variable = { unsubsidized_const_speed = modifier@production_speed_buildings_factor } set_temp_variable = { unsubsidized_research_speed = modifier@research_speed_factor } set_temp_variable = { unsubsidized_civ_count = industrial_complex_total } if = { limit = { has_country_flag = is_getting_ido_subsidies } subtract_from_temp_variable = { unsubsidized_const_speed = un_ido_construction_speed_var } subtract_from_temp_variable = { unsubsidized_civ_count = un_ido_old_building_count } } if = { limit = { has_country_flag = is_getting_esco_subsidies } subtract_from_temp_variable = { unsubsidized_research_speed = un_esco_research_speed_var } } add_to_variable = { global.target_const_speed_mod = unsubsidized_const_speed } add_to_variable = { global.target_research_speed_mod = unsubsidized_research_speed } add_to_variable = { global.target_civ_count = unsubsidized_civ_count } add_to_variable = { global.average_gdp_capita = gdp_per_capita } if = { limit = { check_variable = { peak_const_speed_mod < unsubsidized_const_speed } } set_temp_variable = { peak_const_speed_mod = unsubsidized_const_speed } } if = { limit = { check_variable = { peak_research_speed_mod < unsubsidized_research_speed } } set_temp_variable = { peak_research_speed_mod = unsubsidized_research_speed } } if = { limit = { check_variable = { peak_civ_count < unsubsidized_civ_count } } set_temp_variable = { peak_civ_count = unsubsidized_civ_count } } if = { limit = { check_variable = { peak_prod_mod < overall_productivity } } set_temp_variable = { peak_prod_mod = overall_productivity } } set_country_flag = update_cdf set_country_flag = update_ido set_country_flag = update_esco calculate_base_program_contributions = yes add_to_variable = { global.total_aid_expenses_sum = united_nations_aid_expenses } } set_temp_variable = { un_member_count = { value = 0 every_collection = { named_collection = un_general_assembly_members_collection add = 1 } } } if = { limit = { check_variable = { un_member_count > 0 } } divide_variable = { global.target_const_speed_mod = un_member_count } divide_variable = { global.target_research_speed_mod = un_member_count } divide_variable = { global.target_civ_count = un_member_count } divide_variable = { global.average_gdp_capita = un_member_count } } multiply_temp_variable = { peak_const_speed_mod = 0.6 } multiply_temp_variable = { peak_civ_count = 0.05 } multiply_temp_variable = { peak_research_speed_mod = 0.4 } multiply_temp_variable = { peak_prod_mod = 0.1 } set_variable = { global.world_productivity_target = { value = global.average_world_productivity add = peak_prod_mod } } add_to_variable = { global.target_const_speed_mod = peak_const_speed_mod } add_to_variable = { global.target_research_speed_mod = peak_research_speed_mod } add_to_variable = { global.target_civ_count = peak_civ_count } for_each_loop = { array = global.un_operating_budget_contributors value = v var:v = { set_variable = { united_nations_contribution_percent = united_nations_base_expenses } if = { limit = { check_variable = { global.un_operating_budget_base > 0 } } divide_variable = { united_nations_contribution_percent = global.un_operating_budget_base } } add_to_temp_array = { temp_array_mover = united_nations_base_expenses } add_to_temp_array = { nation_tracker = THIS } } } set_temp_variable = { end_number = temp_array_mover^num } for_loop_effect = { end = end_number value = temp find_highest_in_array = { array = temp_array_mover value = var_tracker index = temp_index_track } set_temp_variable = { nation_adder = nation_tracker^temp_index_track } add_to_array = { global.UN_budget_contribution_tracker = nation_adder } remove_from_temp_array = { array = nation_tracker index = temp_index_track } remove_from_temp_array = { array = temp_array_mover index = temp_index_track } } clear_array = global.un_operating_budget_contributors calculate_un_program_budgets = yes } # Effect: calculate_base_program_contributions # Purpose: Computes mandatory UN program contributions (UNESCO, IAEA, ILO) for UN members calculate_base_program_contributions = { if = { limit = { has_idea = un_aid_esco_member has_country_flag = update_esco } set_variable = { united_nations_esco_mandatory_funding = { value = display_income multiply = 0.01 } } set_variable = { united_nations_unescoe_funding = united_nations_esco_mandatory_funding } clr_country_flag = update_esco } else_if = { limit = { NOT = { has_idea = un_aid_esco_member } } set_variable = { united_nations_esco_mandatory_funding = 0 } set_variable = { united_nations_unescoe_funding = 0 } } if = { limit = { has_idea = un_aid_ido_member has_country_flag = update_ido } set_variable = { united_nations_ido_mandatory_funding = { value = display_income multiply = 0.015 } } set_variable = { united_nations_unido_funding = united_nations_ido_mandatory_funding } clr_country_flag = update_ido } else_if = { limit = { NOT = { has_idea = un_aid_ido_member } } set_variable = { united_nations_ido_mandatory_funding = 0 } set_variable = { united_nations_unido_funding = 0 } } if = { limit = { has_idea = un_aid_cdf_member has_country_flag = update_cdf } set_variable = { united_nations_cdf_mandatory_funding = { value = display_income multiply = 0.025 } } set_variable = { united_nations_uncdf_funding = united_nations_cdf_mandatory_funding } clr_country_flag = update_cdf } else_if = { limit = { NOT = { has_idea = un_aid_cdf_member } } set_variable = { united_nations_cdf_mandatory_funding = 0 } set_variable = { united_nations_uncdf_funding = 0 } } update_optional_contributions = yes } # Effect: update_optional_contributions # Purpose: Adds optional UN program contributions on top of mandatory amounts update_optional_contributions = { # United Nations Contribution Expenses if = { limit = { has_dynamic_modifier = { modifier = united_nations_member } } set_variable = { united_nations_aid_expenses = 0 } if = { limit = { has_idea = un_aid_esco_member } set_variable = { united_nations_unescoe_funding = { value = united_nations_esco_mandatory_funding add = united_nations_esco_optional_funding } } add_to_variable = { united_nations_aid_expenses = united_nations_unescoe_funding } } else = { set_variable = { united_nations_esco_optional_funding = 0 } } if = { limit = { has_idea = un_aid_ido_member } set_variable = { united_nations_unido_funding = { value = united_nations_ido_mandatory_funding add = united_nations_ido_optional_funding } } add_to_variable = { united_nations_aid_expenses = united_nations_unido_funding } } else = { set_variable = { united_nations_ido_optional_funding = 0 } } if = { limit = { has_idea = un_aid_cdf_member } set_variable = { united_nations_uncdf_funding = { value = united_nations_cdf_mandatory_funding add = united_nations_cdf_optional_funding } } add_to_variable = { united_nations_aid_expenses = united_nations_uncdf_funding } } else = { set_variable = { united_nations_cdf_optional_funding = 0 } } if = { limit = { NOT = { check_variable = { united_nations_old_aid_expenses = united_nations_aid_expenses } } } set_variable = { united_nations_expenses = { value = united_nations_base_expenses multiply = { value = 1 add = modifier@inflation_cost_multiplier_modifier } add = united_nations_aid_expenses } } set_variable = { united_nations_old_aid_expenses = united_nations_aid_expenses } } } } # Effect: calculate_un_program_budgets # Purpose: Distributes UN operating budget among UN programs (UNESCO, UNDIO, UNCDF) calculate_un_program_budgets = { set_temp_variable = { base_budget_number = { value = global.un_operating_budget_base divide = 3 } } set_variable = { global.unescoe_budget = { value = 0 add = base_budget_number } } set_variable = { global.undio_budget = { value = 0 add = base_budget_number } } set_variable = { global.uncdf_budget = { value = 0 add = base_budget_number } } every_collection_element = { input = { input = collection:un_general_assembly_members_collection } add_to_variable = { global.unescoe_budget = united_nations_unescoe_funding } add_to_variable = { global.undio_budget = united_nations_unido_funding } add_to_variable = { global.uncdf_budget = united_nations_uncdf_funding } set_variable = { united_nations_aid_program_contribution_percent = united_nations_aid_expenses } if = { limit = { check_variable = { global.total_aid_expenses_sum > 0 } } divide_variable = { united_nations_aid_program_contribution_percent = global.total_aid_expenses_sum } } check_for_subsidy_expiration = yes } calcluate_program_distributions = yes } # Effect: calcluate_program_distributions # Purpose: Divides UN program budgets among eligible recipient countries # Note: function name is misspelled (calcluate); kept as-is because external callers depend on it calcluate_program_distributions = { set_variable = { global.esco_recipient_divisor = { value = 0 every_collection = { named_collection = un_esco_recipients_collection add = 1 } clamp = { min = 1 max = @math_expressions_max } } } set_variable = { global.ido_recipient_divisor = { value = 0 every_collection = { named_collection = un_ido_recipients_collection add = 1 } clamp = { min = 1 max = @math_expressions_max } } } set_variable = { global.cdf_recipient_divisor = { value = 0 every_collection = { named_collection = un_cdf_recipients_collection add = 1 } clamp = { min = 1 max = @math_expressions_max } } } set_temp_variable = { esco_political_budget = { value = global.unescoe_budget multiply = 0.25 divide = global.esco_recipient_divisor } } set_temp_variable = { esco_research_budget = { value = global.unescoe_budget multiply = 0.75 divide = global.esco_recipient_divisor } } every_collection_element = { input = { input = collection:un_esco_recipients_collection } set_variable = { un_esco_political_power_var = { value = esco_political_budget multiply = 0.2 } } set_variable = { un_esco_research_speed_var = { value = esco_research_budget multiply = 0.2 clamp = { min = 0 max = 0.30 } } } } set_temp_variable = { construction_speed_buffs = { value = global.undio_budget multiply = 0.25 divide = global.ido_recipient_divisor } } set_temp_variable = { factory_lease_amounts = { value = global.undio_budget multiply = 0.75 divide = global.ido_recipient_divisor divide = 0.14 round = yes } } set_temp_variable = { un_ido_building_count = factory_lease_amounts } every_collection_element = { input = { input = collection:un_ido_recipients_collection } set_variable = { un_ido_current_building_count = un_ido_building_count } set_variable = { un_ido_construction_speed_var = { value = construction_speed_buffs multiply = 0.2 clamp = { min = 0 max = 0.30 } } } set_variable = { un_ido_investment_speed_var = { value = un_ido_construction_speed_var multiply = -1 } } if = { limit = { NOT = { check_variable = { un_ido_old_building_count = un_ido_building_count } } } set_temp_variable = { building_holder = { value = un_ido_building_count subtract = un_ido_old_building_count } } add_offsite_building = { type = industrial_complex level = building_holder } set_variable = { un_ido_old_building_count = un_ido_building_count } } } set_temp_variable = { prod_var = { value = global.uncdf_budget multiply = 0.45 divide = global.cdf_recipient_divisor } } set_temp_variable = { cost_var = { value = global.uncdf_budget multiply = 0.55 divide = global.cdf_recipient_divisor multiply = -0.2 } } every_collection_element = { input = { input = collection:un_cdf_recipients_collection } set_variable = { un_cdf_productivity_var = { value = prod_var multiply = 0.2 clamp = { min = 0 max = 0.30 } } } set_variable = { un_cdf_construction_cost_var = cost_var } } set_variable = { global.full_aid_budget_calculator = { value = global.uncdf_budget add = global.undio_budget add = global.unescoe_budget } } every_collection_element = { input = { input = collection:un_general_assembly_members_collection } calculate_final_un_benefits = yes } sort_un_aid_contributor_arrays = yes international_systems_update = yes } # Effect: sort_un_aid_contributor_arrays # Purpose: Sorts UN program contributors by contribution amount (for subsidy distribution rank) sort_un_aid_contributor_arrays = { #Sort ESCO contributors by united_nations_unescoe_funding (highest first) for_each_loop = { array = global.un_aid_esco_contributor value = v var:v = { add_to_temp_array = { esco_sort_values = united_nations_unescoe_funding } add_to_temp_array = { esco_sort_nations = THIS } } } clear_array = global.un_aid_esco_contributor set_temp_variable = { esco_sort_end = esco_sort_values^num } for_loop_effect = { end = esco_sort_end find_highest_in_array = { array = esco_sort_values index = esco_sort_idx } set_temp_variable = { esco_sort_nation = esco_sort_nations^esco_sort_idx } add_to_array = { global.un_aid_esco_contributor = esco_sort_nation } remove_from_temp_array = { array = esco_sort_nations index = esco_sort_idx } remove_from_temp_array = { array = esco_sort_values index = esco_sort_idx } } #Sort IDO contributors by united_nations_unido_funding (highest first) for_each_loop = { array = global.un_aid_ido_contributor value = v var:v = { add_to_temp_array = { ido_sort_values = united_nations_unido_funding } add_to_temp_array = { ido_sort_nations = THIS } } } clear_array = global.un_aid_ido_contributor set_temp_variable = { ido_sort_end = ido_sort_values^num } for_loop_effect = { end = ido_sort_end find_highest_in_array = { array = ido_sort_values index = ido_sort_idx } set_temp_variable = { ido_sort_nation = ido_sort_nations^ido_sort_idx } add_to_array = { global.un_aid_ido_contributor = ido_sort_nation } remove_from_temp_array = { array = ido_sort_nations index = ido_sort_idx } remove_from_temp_array = { array = ido_sort_values index = ido_sort_idx } } #Sort CDF contributors by united_nations_uncdf_funding (highest first) for_each_loop = { array = global.un_aid_cdf_contributor value = v var:v = { add_to_temp_array = { cdf_sort_values = united_nations_uncdf_funding } add_to_temp_array = { cdf_sort_nations = THIS } } } clear_array = global.un_aid_cdf_contributor set_temp_variable = { cdf_sort_end = cdf_sort_values^num } for_loop_effect = { end = cdf_sort_end find_highest_in_array = { array = cdf_sort_values index = cdf_sort_idx } set_temp_variable = { cdf_sort_nation = cdf_sort_nations^cdf_sort_idx } add_to_array = { global.un_aid_cdf_contributor = cdf_sort_nation } remove_from_temp_array = { array = cdf_sort_nations index = cdf_sort_idx } remove_from_temp_array = { array = cdf_sort_values index = cdf_sort_idx } } }