# Currency System: per-country currency_strength, its monthly update, the income # multipliers it drives, and reserve-currency seigniorage and ROI bonuses. # Script Constants # Monthly currency_strength drift: each input scaled by one sensitivity, then summed. @currency_trade_sensitivity = 0.00005 @currency_debt_sensitivity = 0.02 @currency_stability_sensitivity = 0.003 @currency_inflation_sensitivity = 0.05 # Seigniorage income, in-game B/week. @seigniorage_per_adopter = 0.0225 # Reserve ROI bonus: per-currency curve multiplier plus a shared per-adopter factor. @usd_roi_curve = 0.06 @eur_roi_curve = 0.045 @cny_roi_curve = 0.0375 @rub_roi_curve = 0.0375 @jpy_roi_curve = 0.03 @gbp_roi_curve = 0.0375 @chf_roi_curve = 0.0225 @nlg_roi_curve = 0.0225 @reserve_network_factor = 0.0002 # Trade opinion for holding a reserve currency: a flat base every holder gets, rising # with the issuer ROI. Slope is (max - base) / the 0.03 ROI clamp, so a currency at the # ROI ceiling pays exactly @reserve_trade_max. @reserve_trade_base = 0.025 @reserve_trade_slope = 2.5 @reserve_trade_max = 0.10 clamp_currency_strength = { clamp_variable = { var = currency_strength min = 0.15 max = 2.0 } } currency_startup = { if = { limit = { NOT = { has_variable = currency_strength } } set_variable = { currency_strength = 1.0 } } update_currency_issuers = yes } # Point each issuer global at the current owner of that currency's home state. # Run at startup and after each peace conference so issuer status tracks conquest. # Each block clears the old issuer's flag, then flags the new owner. update_currency_issuers = { # USD: Washington DC (state 1182) if = { limit = { check_variable = { global.usd_issuer > 0 } } var:global.usd_issuer = { clr_country_flag = is_usd_issuer } } 1182 = { owner = { set_variable = { global.usd_issuer = THIS } set_country_flag = is_usd_issuer } } # EUR: EUU if it exists, otherwise Berlin (state 45) if = { limit = { check_variable = { global.eur_issuer > 0 } } var:global.eur_issuer = { clr_country_flag = is_eur_issuer } } if = { limit = { country_exists = EUU } EUU = { set_variable = { global.eur_issuer = THIS } set_country_flag = is_eur_issuer } } else = { 45 = { owner = { set_variable = { global.eur_issuer = THIS } set_country_flag = is_eur_issuer } } } # CNY: Beijing (state 547) if = { limit = { check_variable = { global.cny_issuer > 0 } } var:global.cny_issuer = { clr_country_flag = is_cny_issuer } } 547 = { owner = { set_variable = { global.cny_issuer = THIS } set_country_flag = is_cny_issuer } } # RUB: Moscow (state 652) if = { limit = { check_variable = { global.rub_issuer > 0 } } var:global.rub_issuer = { clr_country_flag = is_rub_issuer } } 652 = { owner = { set_variable = { global.rub_issuer = THIS } set_country_flag = is_rub_issuer } } # JPY: Tokyo (state 615) if = { limit = { check_variable = { global.jpy_issuer > 0 } } var:global.jpy_issuer = { clr_country_flag = is_jpy_issuer } } 615 = { owner = { set_variable = { global.jpy_issuer = THIS } set_country_flag = is_jpy_issuer } } # GBP: London (state 13) if = { limit = { check_variable = { global.gbp_issuer > 0 } } var:global.gbp_issuer = { clr_country_flag = is_gbp_issuer } } 13 = { owner = { set_variable = { global.gbp_issuer = THIS } set_country_flag = is_gbp_issuer } } # CHF: Bern (state 74) if = { limit = { check_variable = { global.chf_issuer > 0 } } var:global.chf_issuer = { clr_country_flag = is_chf_issuer } } 74 = { owner = { set_variable = { global.chf_issuer = THIS } set_country_flag = is_chf_issuer } } # NLG: Amsterdam (state 46) if = { limit = { check_variable = { global.nlg_issuer > 0 } } var:global.nlg_issuer = { clr_country_flag = is_nlg_issuer } } 46 = { owner = { set_variable = { global.nlg_issuer = THIS } set_country_flag = is_nlg_issuer } } } # ── Monthly recalculation ───────────────────────────────────────────────────── # Runs monthly for every country (on_monthly in MD_on_actions.txt). calculate_currency_strength = { # treasury_rate is display_income minus display_expense, refreshed weekly. set_temp_variable = { trade_contrib = { value = 0 add = treasury_rate multiply = @currency_trade_sensitivity } } set_temp_variable = { debt_contrib = { value = 0 add = debt_ratio multiply = @currency_debt_sensitivity } } set_temp_variable = { stab_contrib = { value = 0 add = stability multiply = @currency_stability_sensitivity } } set_temp_variable = { currency_delta = { value = 0 add = trade_contrib add = debt_contrib add = stab_contrib } } # Issuers and hard-money standards drift within a tighter band. if = { limit = { has_country_flag = is_usd_issuer } clamp_variable = { var = currency_delta min = -0.005 max = 0.02 } } else_if = { limit = { has_country_flag = is_eur_issuer } clamp_variable = { var = currency_delta min = -0.007 max = 0.015 } } else_if = { limit = { has_country_flag = is_rub_issuer } clamp_variable = { var = currency_delta min = -0.01 max = 0.012 } } else_if = { limit = { has_country_flag = is_gbp_issuer } clamp_variable = { var = currency_delta min = -0.008 max = 0.013 } } else_if = { limit = { has_country_flag = is_jpy_issuer } clamp_variable = { var = currency_delta min = -0.008 max = 0.012 } } else_if = { limit = { has_country_flag = is_chf_issuer } clamp_variable = { var = currency_delta min = -0.004 max = 0.010 } } else_if = { limit = { has_country_flag = is_nlg_issuer } clamp_variable = { var = currency_delta min = -0.004 max = 0.010 } } else_if = { limit = { has_idea = gold_standard_back } clamp_variable = { var = currency_delta min = -0.005 max = 0.008 } } else_if = { limit = { has_idea = silver_standard } clamp_variable = { var = currency_delta min = -0.008 max = 0.012 } } else_if = { limit = { has_idea = bi_metal_standard } clamp_variable = { var = currency_delta min = -0.010 max = 0.015 } } add_to_variable = { currency_strength = currency_delta } # Gold and silver pull currency_strength back toward par (1.0). if = { limit = { has_idea = gold_standard_back } if = { limit = { NOT = { check_variable = { currency_strength > 1.0 } } } add_to_variable = { currency_strength = 0.003 } } else_if = { limit = { check_variable = { currency_strength > 1.05 } } subtract_from_variable = { currency_strength = 0.002 } } } else_if = { limit = { has_idea = silver_standard } if = { limit = { NOT = { check_variable = { currency_strength > 1.0 } } } add_to_variable = { currency_strength = 0.002 } } } clamp_currency_strength = yes # A currency below par (weak) adds inflation pressure; above par eases it. set_variable = { currency_inflation_feed = { value = 1 divide = currency_strength subtract = 1 multiply = @currency_inflation_sensitivity } } set_variable = { inflation_cost_combined_var = inflation_rate_var } add_to_variable = { inflation_cost_combined_var = currency_inflation_feed } calculate_reserve_roi_bonus = yes # Currency relief can ease inflation but never push it negative. clamp_variable = { var = inflation_cost_combined_var min = 0 } } # ── Income stream multipliers ───────────────────────────────────────────────── # Runs in ingame_update_setup (00_money_system.txt) after income is computed. # Income scales by 1/currency_strength: a weak currency (< 1.0) boosts # foreign-earned income locally, a strong one suppresses it. The matching # adjustment for debt lives in calculate_interest_rate, which sets debt_rate # after this effect runs. apply_currency_multipliers = { set_temp_variable = { inv_factor = { value = 1 divide = currency_strength } } # Scale the per-resource breakdown too so the tooltip matches resource_sale_rate. multiply_variable = { resource_sale_rate = inv_factor } multiply_variable = { oil_exports = inv_factor } multiply_variable = { steel_exports = inv_factor } multiply_variable = { aluminium_exports = inv_factor } multiply_variable = { tungsten_exports = inv_factor } multiply_variable = { chromium_exports = inv_factor } multiply_variable = { rubber_exports = inv_factor } multiply_variable = { microchip_exports = inv_factor } multiply_variable = { composite_exports = inv_factor } } # ── Seigniorage income ──────────────────────────────────────────────────────── # Runs in ingame_update_setup before apply_currency_multipliers. Issuers earn from # how many nations hold their currency. calculate_additional_income_rate in # 00_money_system.txt applies the (1 + modifier) multiplier. calculate_seigniorage_income = { set_temp_variable = { seigniorage_mod = modifier@seigniorage_income_modifier } set_temp_variable = { seigniorage_base = 0 } set_variable = { seigniorage_income_display = 0 } set_variable = { EU_seigniorage_weekly = 0 } if = { limit = { has_country_flag = is_usd_issuer } set_temp_variable = { seigniorage_base = { value = global.usd_reserve_adoption_count multiply = @seigniorage_per_adopter } } } else_if = { limit = { has_country_flag = is_eur_issuer country_exists = EUU } set_temp_variable = { seigniorage_base = { value = global.eur_reserve_adoption_count multiply = @seigniorage_per_adopter } } } # EUU not spawned yet: bank EUR seigniorage in the EU budget instead of paying an # interim issuer. seigniorage_base stays 0. else_if = { limit = { has_country_flag = is_eur_issuer NOT = { country_exists = EUU } } add_to_temp_variable = { seigniorage_mod = 1.0 } set_temp_variable = { pool_base = { value = global.eur_reserve_adoption_count multiply = @seigniorage_per_adopter multiply = seigniorage_mod } } set_variable = { EU_seigniorage_weekly = pool_base } } else_if = { limit = { has_country_flag = is_rub_issuer } set_temp_variable = { seigniorage_base = { value = global.rub_reserve_adoption_count multiply = @seigniorage_per_adopter } } } else_if = { limit = { has_country_flag = is_gbp_issuer } set_temp_variable = { seigniorage_base = { value = global.gbp_reserve_adoption_count multiply = @seigniorage_per_adopter } } } else_if = { limit = { has_country_flag = is_jpy_issuer } set_temp_variable = { seigniorage_base = { value = global.jpy_reserve_adoption_count multiply = @seigniorage_per_adopter } } } else_if = { limit = { has_country_flag = is_chf_issuer } set_temp_variable = { seigniorage_base = { value = global.chf_reserve_adoption_count multiply = @seigniorage_per_adopter } } } else_if = { limit = { has_country_flag = is_cny_issuer } set_temp_variable = { seigniorage_base = { value = global.cny_reserve_adoption_count multiply = @seigniorage_per_adopter } } } else_if = { limit = { has_country_flag = is_nlg_issuer } set_temp_variable = { seigniorage_base = { value = global.nlg_reserve_adoption_count multiply = @seigniorage_per_adopter } } } } # ── Reserve currency ROI bonus ──────────────────────────────────────────────── # Positive above par, negative below, zero at par. # bonus = (1 - 1/tmp_strength) * tmp_roi_mult + tmp_adopters * @reserve_network_factor # Caller presets tmp_strength, tmp_roi_mult and tmp_adopters. reserve_roi_from_strength = { set_temp_variable = { tmp_reserve_roi = { value = 1 divide = tmp_strength multiply = -1 add = 1 multiply = tmp_roi_mult } } set_temp_variable = { tmp_network = { value = tmp_adopters multiply = @reserve_network_factor } } add_to_temp_variable = { tmp_reserve_roi = tmp_network } clamp_temp_variable = { var = tmp_reserve_roi min = -0.03 max = 0.03 } } # Runs at the end of calculate_currency_strength. Non-holders keep tmp_reserve_roi 0, # which zeroes all three outputs below. # reserve_roi_bonus -> reserve_currency_investment_modifier -> return_on_investment_modifier # reserve_trade_bonus -> reserve_currency_trade_modifier -> trade_opinion_factor calculate_reserve_roi_bonus = { set_temp_variable = { tmp_reserve_roi = 0 } set_temp_variable = { tmp_holds_reserve = 0 } if = { limit = { has_idea = us_dollar } set_temp_variable = { tmp_holds_reserve = 1 } set_temp_variable = { tmp_roi_mult = @usd_roi_curve } set_temp_variable = { tmp_adopters = global.usd_reserve_adoption_count } if = { limit = { check_variable = { global.usd_issuer > 0 } } var:global.usd_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } } else_if = { limit = { has_idea = euro } set_temp_variable = { tmp_holds_reserve = 1 } set_temp_variable = { tmp_roi_mult = @eur_roi_curve } set_temp_variable = { tmp_adopters = global.eur_reserve_adoption_count } if = { limit = { check_variable = { global.eur_issuer > 0 } } var:global.eur_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } } else_if = { limit = { OR = { has_idea = chinese_yuan has_idea = chinese_yuan_2 has_idea = chinese_yuan_3 } } set_temp_variable = { tmp_holds_reserve = 1 } set_temp_variable = { tmp_roi_mult = @cny_roi_curve } set_temp_variable = { tmp_adopters = global.cny_reserve_adoption_count } if = { limit = { check_variable = { global.cny_issuer > 0 } } var:global.cny_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } } else_if = { limit = { has_idea = russia_rouble } set_temp_variable = { tmp_holds_reserve = 1 } set_temp_variable = { tmp_roi_mult = @rub_roi_curve } set_temp_variable = { tmp_adopters = global.rub_reserve_adoption_count } if = { limit = { check_variable = { global.rub_issuer > 0 } } var:global.rub_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } } else_if = { limit = { has_idea = japanese_yen } set_temp_variable = { tmp_holds_reserve = 1 } set_temp_variable = { tmp_roi_mult = @jpy_roi_curve } set_temp_variable = { tmp_adopters = global.jpy_reserve_adoption_count } if = { limit = { check_variable = { global.jpy_issuer > 0 } } var:global.jpy_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } } else_if = { limit = { has_idea = british_pound } set_temp_variable = { tmp_holds_reserve = 1 } set_temp_variable = { tmp_roi_mult = @gbp_roi_curve } set_temp_variable = { tmp_adopters = global.gbp_reserve_adoption_count } if = { limit = { check_variable = { global.gbp_issuer > 0 } } var:global.gbp_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } } else_if = { limit = { has_idea = swiss_frank } set_temp_variable = { tmp_holds_reserve = 1 } set_temp_variable = { tmp_roi_mult = @chf_roi_curve } set_temp_variable = { tmp_adopters = global.chf_reserve_adoption_count } if = { limit = { check_variable = { global.chf_issuer > 0 } } var:global.chf_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } } else_if = { limit = { has_idea = gulden } set_temp_variable = { tmp_holds_reserve = 1 } set_temp_variable = { tmp_roi_mult = @nlg_roi_curve } set_temp_variable = { tmp_adopters = global.nlg_reserve_adoption_count } if = { limit = { check_variable = { global.nlg_issuer > 0 } } var:global.nlg_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } } set_variable = { reserve_roi_bonus = tmp_reserve_roi } set_variable = { reserve_trade_bonus = 0 } if = { limit = { check_variable = { tmp_holds_reserve > 0 } } set_variable = { reserve_trade_bonus = { value = tmp_reserve_roi multiply = @reserve_trade_slope add = @reserve_trade_base } } clamp_variable = { var = reserve_trade_bonus min = @reserve_trade_base max = @reserve_trade_max } } set_temp_variable = { tmp_inflation_buffer = { value = tmp_reserve_roi multiply = -0.5 } } add_to_variable = { inflation_cost_combined_var = tmp_inflation_buffer } } adopt_chinese_yuan_reserve = { if = { limit = { CHI = { has_completed_focus = CHI_yuan_internationalisation } } add_ideas = chinese_yuan_3 } else_if = { limit = { CHI = { has_completed_focus = CHI_Renminbi_Internationalization } } add_ideas = chinese_yuan_2 } else = { add_ideas = chinese_yuan } } # ── Reserve currency projections (for the law tooltips) ─────────────────────── # reserve_roi_bonus only covers the currency a country already holds, so the law # entries for the other seven would have nothing to show. These globals depend # only on issuer strength and adoption count, so one pass serves every country. # tmp_static_* are the idea's own flat modifiers of the same three types. They are # a separate modifier source, so they land outside the clamp and the trade floor. # They are cleared here so the next currency's block starts from zero. build_reserve_projection = { set_temp_variable = { tmp_proj_roi = { value = tmp_reserve_roi add = tmp_static_roi } } set_temp_variable = { tmp_proj_trade = { value = tmp_reserve_roi multiply = @reserve_trade_slope add = @reserve_trade_base } } clamp_temp_variable = { var = tmp_proj_trade min = @reserve_trade_base max = @reserve_trade_max } add_to_temp_variable = { tmp_proj_trade = tmp_static_trade } set_temp_variable = { tmp_proj_infl = { value = tmp_reserve_roi multiply = -0.5 add = tmp_static_infl } } set_temp_variable = { tmp_static_roi = 0 } set_temp_variable = { tmp_static_trade = 0 } set_temp_variable = { tmp_static_infl = 0 } } calculate_reserve_projections = { set_temp_variable = { tmp_static_roi = 0 } set_temp_variable = { tmp_static_trade = 0 } set_temp_variable = { tmp_static_infl = 0 } # US dollar set_temp_variable = { tmp_reserve_roi = 0 } set_temp_variable = { tmp_roi_mult = @usd_roi_curve } set_temp_variable = { tmp_adopters = global.usd_reserve_adoption_count } if = { limit = { check_variable = { global.usd_issuer > 0 } } var:global.usd_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } build_reserve_projection = yes set_variable = { global.proj_roi_usd = tmp_proj_roi } set_variable = { global.proj_trade_usd = tmp_proj_trade } set_variable = { global.proj_infl_usd = tmp_proj_infl } # Euro set_temp_variable = { tmp_reserve_roi = 0 } set_temp_variable = { tmp_roi_mult = @eur_roi_curve } set_temp_variable = { tmp_adopters = global.eur_reserve_adoption_count } if = { limit = { check_variable = { global.eur_issuer > 0 } } var:global.eur_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } set_temp_variable = { tmp_static_trade = 0.2 } build_reserve_projection = yes set_variable = { global.proj_roi_eur = tmp_proj_roi } set_variable = { global.proj_trade_eur = tmp_proj_trade } set_variable = { global.proj_infl_eur = tmp_proj_infl } # Chinese yuan. The three tiers share global.cny_*, but are mutually exclusive by # `visible`, so the statics follow whichever tier CHI's focus progress makes selectable. set_temp_variable = { tmp_reserve_roi = 0 } set_temp_variable = { tmp_roi_mult = @cny_roi_curve } set_temp_variable = { tmp_adopters = global.cny_reserve_adoption_count } if = { limit = { check_variable = { global.cny_issuer > 0 } } var:global.cny_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } if = { limit = { CHI = { has_completed_focus = CHI_yuan_internationalisation } } set_temp_variable = { tmp_static_roi = 0.02 } set_temp_variable = { tmp_static_trade = 0.25 } } else_if = { limit = { CHI = { has_completed_focus = CHI_Renminbi_Internationalization } } set_temp_variable = { tmp_static_roi = 0.015 } set_temp_variable = { tmp_static_trade = 0.20 } } else = { set_temp_variable = { tmp_static_trade = 0.10 } } build_reserve_projection = yes set_variable = { global.proj_roi_cny = tmp_proj_roi } set_variable = { global.proj_trade_cny = tmp_proj_trade } set_variable = { global.proj_infl_cny = tmp_proj_infl } # Russian rouble set_temp_variable = { tmp_reserve_roi = 0 } set_temp_variable = { tmp_roi_mult = @rub_roi_curve } set_temp_variable = { tmp_adopters = global.rub_reserve_adoption_count } if = { limit = { check_variable = { global.rub_issuer > 0 } } var:global.rub_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } build_reserve_projection = yes set_variable = { global.proj_roi_rub = tmp_proj_roi } set_variable = { global.proj_trade_rub = tmp_proj_trade } set_variable = { global.proj_infl_rub = tmp_proj_infl } # Japanese yen set_temp_variable = { tmp_reserve_roi = 0 } set_temp_variable = { tmp_roi_mult = @jpy_roi_curve } set_temp_variable = { tmp_adopters = global.jpy_reserve_adoption_count } if = { limit = { check_variable = { global.jpy_issuer > 0 } } var:global.jpy_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } set_temp_variable = { tmp_static_roi = -0.02 } set_temp_variable = { tmp_static_infl = -0.10 } build_reserve_projection = yes set_variable = { global.proj_roi_jpy = tmp_proj_roi } set_variable = { global.proj_trade_jpy = tmp_proj_trade } set_variable = { global.proj_infl_jpy = tmp_proj_infl } # British pound set_temp_variable = { tmp_reserve_roi = 0 } set_temp_variable = { tmp_roi_mult = @gbp_roi_curve } set_temp_variable = { tmp_adopters = global.gbp_reserve_adoption_count } if = { limit = { check_variable = { global.gbp_issuer > 0 } } var:global.gbp_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } build_reserve_projection = yes set_variable = { global.proj_roi_gbp = tmp_proj_roi } set_variable = { global.proj_trade_gbp = tmp_proj_trade } set_variable = { global.proj_infl_gbp = tmp_proj_infl } # Swiss franc set_temp_variable = { tmp_reserve_roi = 0 } set_temp_variable = { tmp_roi_mult = @chf_roi_curve } set_temp_variable = { tmp_adopters = global.chf_reserve_adoption_count } if = { limit = { check_variable = { global.chf_issuer > 0 } } var:global.chf_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } build_reserve_projection = yes set_variable = { global.proj_roi_chf = tmp_proj_roi } set_variable = { global.proj_trade_chf = tmp_proj_trade } set_variable = { global.proj_infl_chf = tmp_proj_infl } # Dutch gulden set_temp_variable = { tmp_reserve_roi = 0 } set_temp_variable = { tmp_roi_mult = @nlg_roi_curve } set_temp_variable = { tmp_adopters = global.nlg_reserve_adoption_count } if = { limit = { check_variable = { global.nlg_issuer > 0 } } var:global.nlg_issuer = { set_temp_variable = { tmp_strength = currency_strength } } reserve_roi_from_strength = yes } set_temp_variable = { tmp_static_roi = -0.02 } build_reserve_projection = yes set_variable = { global.proj_roi_nlg = tmp_proj_roi } set_variable = { global.proj_trade_nlg = tmp_proj_trade } set_variable = { global.proj_infl_nlg = tmp_proj_infl } }