Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improved ai monetary calculations #481

Merged
merged 2 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 8 additions & 98 deletions common/history/global/00_global.txt
Original file line number Diff line number Diff line change
Expand Up @@ -347,104 +347,14 @@ GLOBAL = {
denominationValue = 100
}
# Fiscal
every_country = {
limit = {
not = {
has_variable = foreign_reserves
}
}
set_variable = {
name = foreign_reserves
value = 0
}
}
every_country = {
limit = {
not = {
has_variable = inflation_rate
}
}
set_variable = {
name = inflation_rate
value = 0
}
}
every_country = {
limit = {
not = {
has_variable = interest_rate_gui
}
}
set_variable = {
name = interest_rate_gui
value = 2
}
}
every_country = {
limit = {
not = {
has_variable = interest_rate
}
}
set_variable = {
name = interest_rate
value = 2
}
add_modifier = {
name = interest_rates
multiplier = 2
}
}
every_country = {
limit = {
nor = {
has_variable = contractionary_monetary_policy
has_variable = stable_monetary_policy
has_variable = expansionary_monetary_policy
}
}
set_variable = stable_monetary_policy
}
every_country = {
limit = {
not = {
has_variable = bank_credibility
}
}
set_variable = {
name = bank_credibility
value = 19
}
set_variable = {
name = previous_bank_credibility
value = var:bank_credibility
}
}
every_country = {
limit = {
not = {
has_variable = money_supply
}
}
set_variable = {
name = money_supply
value = {
add = gold_reserves_limit
divide = 2
}
}
}
every_country = {
limit = {
not = {
has_variable = cwp_currency
}
}
set_variable = {
name = cwp_currency
value = flag:currency_usd
}
}
every_country = { limit = { not = { has_variable = foreign_reserves } } set_variable = { name = foreign_reserves value = 0 } }
every_country = { limit = { not = { has_variable = inflation_rate } } set_variable = { name = inflation_rate value = 0 } }
every_country = { limit = { not = { has_variable = interest_rate_gui } } set_variable = { name = interest_rate_gui value = 2 } }
every_country = { limit = { not = { has_variable = interest_rate } } set_variable = { name = interest_rate value = 2 } add_modifier = { name = interest_rates multiplier = 2 } }
every_country = { limit = { nor = { has_variable = contractionary_monetary_policy has_variable = stable_monetary_policy has_variable = expansionary_monetary_policy } } set_variable = stable_monetary_policy }
every_country = { limit = { not = { has_variable = bank_credibility } } set_variable = { name = bank_credibility value = 19 } set_variable = { name = previous_bank_credibility value = var:bank_credibility } }
every_country = { limit = { not = { has_variable = money_supply } } set_variable = { name = money_supply value = { add = gold_reserves_limit divide = 2 } } }
every_country = { limit = { not = { has_variable = cwp_currency } } set_variable = { name = cwp_currency value = flag:currency_usd } }
# International List
every_country = {
limit = {
Expand Down
12 changes: 9 additions & 3 deletions common/scripted_effects/cwp_onaction_fiscal_effects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@
}

fiscal_money_supply_calculation = {
change_variable = {
name = money_supply
add = money_supply_growth
if = {
limit = {
money_supply_percentage > -100
money_supply_percentage < 100
}
change_variable = {
name = money_supply
add = money_supply_growth
}
}
if = {
limit = {
Expand Down
30 changes: 30 additions & 0 deletions events/CWP_events/ai_fiscal.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ ai_fiscal.1 = { #Sets Monetary policy

ai_chance = {
base = 0
modifier = {
trigger = {
money_supply_percentage >= 50
}
add = 50
}
modifier = {
trigger = {
gold_reserve_ratio >= 0.2
Expand All @@ -44,6 +50,12 @@ ai_fiscal.1 = { #Sets Monetary policy
}
add = 30
}
modifier = {
trigger = {
money_supply_percentage >= 15
}
add = 30
}
modifier = {
trigger = {
inflation_value >= 20
Expand Down Expand Up @@ -100,6 +112,18 @@ ai_fiscal.1 = { #Sets Monetary policy
}
ai_chance = {
base = 0
modifier = {
trigger = {
money_supply_percentage <= -100
}
add = 100
}
modifier = {
trigger = {
money_supply_percentage <= -50
}
add = 50
}
modifier = {
trigger = {
scaled_debt >= 0.2
Expand All @@ -112,6 +136,12 @@ ai_fiscal.1 = { #Sets Monetary policy
}
add = 30
}
modifier = {
trigger = {
money_supply_percentage <= -15
}
add = 30
}
modifier = {
trigger = {
money_supply_percentage < 5
Expand Down