From 8950de35852751567a9a5ae9222234ea956bdd26 Mon Sep 17 00:00:00 2001 From: ademblon <62746143+ademblon@users.noreply.github.com> Date: Thu, 22 Jun 2023 19:20:11 +0200 Subject: [PATCH 1/8] To transfert data over PC DO NOT USE AS IS, ITS PROBABLY FILLED WITH ERRORS --- .../aroai_budgeting_values_core.txt | 166 ++++++++++-------- .../aroai_construction_values.txt | 27 ++- .../aroai_construction_effects.txt | 37 +--- .../aroai_weekly_loop_effects.txt | 4 + .../ARoAI/aroai_construction_events.txt | 10 +- .../ARoAI/aroai_evaluation_events.txt | 13 +- .../ARoAI/aroai_preparation_events.txt | 79 ++------- .../ARoAI/aroai_weekly_loop_events.txt | 4 + 8 files changed, 140 insertions(+), 200 deletions(-) diff --git a/common/script_values/aroai_budgeting_values_core.txt b/common/script_values/aroai_budgeting_values_core.txt index 04345d218..f91b659c4 100644 --- a/common/script_values/aroai_budgeting_values_core.txt +++ b/common/script_values/aroai_budgeting_values_core.txt @@ -37,26 +37,6 @@ aroai_revenue_left_for_construction_military = { multiply = aroai_revenue_factor_construction_military } -aroai_revenue_left_for_construction_military_old = { - value = income - - subtract = aroai_investment_pool_net_spending - - multiply = aroai_subject_type_diplo_pact_income_mult - - subtract = { - value = aroai_building_government_administration_spending_value - add = aroai_building_university_spending_value - add = aroai_building_port_spending_value - add = aroai_building_research_institute_spending - add = var:aroai_total_subsidies - } - - multiply = aroai_revenue_factor_construction_military -} - - - # # tag : tag_aroai_revenue_left_for_construction # called by : aroai_budget_for_construction_sector_actual @@ -77,10 +57,38 @@ aroai_revenue_left_for_construction = { # General info about aroai_revenue_factor_construction_military # ---------------------------------------------- +# Income and depense are very unstable for many reasons. And we can't control that. But we still want : +# (1) To have enough reserve to be able to go to war without going bankrupt +# (2) To not go over the gold reserve limit +# This is why we try to have 50% of the gold reserve limit. +# If a country is below/above that threshold, it'll spend less/more on military and construction sector. + + +# +# tag : tag_aroai_revenue_factor_construction_military +# called by : aroai_revenue_left_for_construction_military +# +aroai_revenue_factor_construction_military = { + value = { + if = { + # If we're in debt + limit = { + aroai_debt_scaled_factor < 0.49 + } + # Use the debt factor + value = aroai_debt_scaled_factor + } + # else use the gold reserve factor + else = { + value = aroai_gold_reserve_scaled_factor + } + } +} + # # tag : tag_aroai_gold_reserves_percent -# Called by : aroai_country_budget_surplus_for_health_1 aroai_country_budget_surplus_for_health_2 aroai_country_budget_surplus_for_health_3 +# Called by : aroai_country_budget_surplus_for_health_1 aroai_country_budget_surplus_for_health_2 aroai_country_budget_surplus_for_health_3 aroai_gold_reserve_scaled_factor # return the current gold reserves as a % of the limit # aroai_gold_reserves_percent = { @@ -104,34 +112,25 @@ aroai_debt_scaled_factor = { min = 0 } -# We take the max value between the two -# The purpose of this functions is to keep budget balanced. -# Sometimes, the ai will spend more than they should on military this leads to less gold reserve, so smaller factor so smaller expense. -# Sometimes, the ai will spend less than allocated on military. This leads to bigger gold reserve, money that should be spend. The factor will then artificially raise the budget for construction and military. -# The balance is X weeks of revenue for the gold reserve. -aroai_revenue_factor_construction_military = { - value = { - if = { - limit = { - aroai_debt_scaled_factor < 0.49 - } - value = aroai_debt_scaled_factor - } - else = { - value = aroai_gold_reserve_scaled_factor - } - } -} - # ---------------------------------------------- # General info about aroai_revenue_factor_construction_military # ---------------------------------------------- +# +# tag : tag_aroai_construction_depense_maximum_from_budget +# Called by : aroai_budget_for_construction_sector_expected aroai_construction_points_wanted_total +# 75% of the revenue left for construction and military. This is the cap, we don't want to spend more than that. +# +aroai_construction_depense_maximum_from_budget = { + value = aroai_revenue_left_for_construction_military + multiply = 0.75 +} + # # tag : tag_aroai_max_wanted_constructions_depense_from_pop -# Called by : aroai_max_wanted_constructions_revenue_share_from_pop +# Called by : aroai_budget_for_construction_sector_expected aroai_budget_for_construction_sector_actual aroai_construction_points_wanted_total # Let's imagine we don't have any investment pool, how much money would we need to employ everyone ? # aroai_construction_depense_maximum_from_pop = { @@ -149,17 +148,23 @@ aroai_construction_depense_maximum_from_pop = { } } -aroai_construction_depense_maximum_from_budget = { - value = aroai_revenue_left_for_construction_military - multiply = 0.75 -} - +# +# tag : tag_aroai_investment_pool_net_spending +# Called by : aroai_construction_depense_maximum_from_pop +# How much money is the investment pool currently spending in the private sector +# aroai_investment_pool_net_spending = { value = investment_pool_gross_income subtract = investment_pool_net_income } + +# +# tag : tag_aroai_investment_pool_wanted_spending +# Called by : aroai_construction_points_wanted_total +# How much money we wished the investment pool would spend +# aroai_investment_pool_wanted_spending = { value = investment_pool_gross_income add = { @@ -168,19 +173,32 @@ aroai_investment_pool_wanted_spending = { } } - - - +# +# tag : tag_aroai_budget_for_construction_sector_expected +# Called by : aroai_budget_for_military_sector_expected +# In an ideal case, how much money do we wish to spend in the construction sector ? +# aroai_budget_for_construction_sector_expected = { value = aroai_construction_depense_maximum_from_pop max = aroai_construction_depense_maximum_from_budget } +# +# tag : tag_aroai_budget_for_military_sector_expected +# Called by : aroai_military_spending_share +# In an ideal case, how much money do we wish to spend in the military sector ? +# aroai_budget_for_military_sector_expected = { value = aroai_revenue_left_for_construction_military subtract = aroai_budget_for_construction_sector_expected } +# +# tag : tag_aroai_budget_for_construction_sector_actual +# Called by : aroai_construction_points_wanted_for_gov +# How much money can we actually spend on construction ? +# This is the actual amount of money the construction sector will try to spend +# aroai_budget_for_construction_sector_actual = { value = aroai_construction_depense_maximum_from_pop @@ -188,6 +206,12 @@ aroai_budget_for_construction_sector_actual = { } +# +# tag : tag_aroai_construction_points_wanted_total +# Called by : aroai_max_wanted_constructions_points_doubled aroai_current_constructions_points_percent_of_max_wanted +# If we want to spend money on construction sector, we need to have enough construction points ready. +# This is how many construction points the country should have to spend the investment pool and the gov spending +# aroai_construction_points_wanted_total = { # First we take the smallest value between the two value = aroai_construction_depense_maximum_from_pop @@ -201,13 +225,24 @@ aroai_construction_points_wanted_total = { } - +# +# tag : tag_aroai_construction_points_wanted_for_gov +# Called by : aroai_free_construction_points +# How many construction point the government can use +# It will never build if we're currently using more than that amount. +# aroai_construction_points_wanted_for_gov = { value = aroai_budget_for_construction_sector_actual divide = aroai_building_construction_sector_expenses_per_point } + +# +# tag : tag_aroai_military_spending_share +# Called by : aroai_building_barracks_spending_share aroai_building_naval_base_spending_share +# The share of income the military sector can use +# aroai_military_spending_share = { value = aroai_budget_for_military_sector_expected divide = income @@ -217,8 +252,7 @@ aroai_military_spending_share = { # # tag : tag_aroai_building_construction_sector_spending_value # Called by : aroai_calculate_budget_surplus aroai_building_construction_sector_spending_expected -# Effective Construction Spending -# Does NOT assume that we pay for every construction point +# How much is the government spending in construction currently # aroai_building_construction_sector_spending_value = { if = { @@ -235,6 +269,11 @@ aroai_building_construction_sector_spending_value = { } +# +# tag : tag_aroai_building_barracks_vs_naval_base_share +# Called by : aroai_building_barracks_spending_share aroai_building_naval_base_spending_share +# How much of the military budget should go in the barracks ? +# aroai_building_barracks_vs_naval_base_share = { if = { limit = { @@ -278,26 +317,3 @@ aroai_building_barracks_vs_naval_base_share = { } max = 0.80 } - - -aroai_subject_type_diplo_pact_income_mult = { - if = { - limit = { is_subject_type = subject_type_puppet} - value = 0.7 - } - else_if = { - limit = { is_subject_type = subject_type_dominion } - value = 0.75 - } - else_if = { - limit = { is_subject_type = subject_type_vassal } - value = 0.75 - } - else_if = { - limit = { is_subject_type = subject_type_tributary } - value = 0.8 - } - else = { - value = 1 - } -} \ No newline at end of file diff --git a/common/script_values/aroai_construction_values.txt b/common/script_values/aroai_construction_values.txt index d7e93dcb5..1a5a085b7 100644 --- a/common/script_values/aroai_construction_values.txt +++ b/common/script_values/aroai_construction_values.txt @@ -31,27 +31,24 @@ aroai_total_workforce_next_year = { # aroai_max_wanted_constructions_points_from_pop = { + # Number of people we want to employ next year value = aroai_total_workforce_next_year + # Number of factories we want to build next year + divide = 5000 # Average number of employee per factory + + # Number of construction point needed to those factories multiply = construction_cost_high # cost of a factory - divide = 5000 # Average number of employee per factory + # But we want weekly points divide = 52 # Weeks - # if Median state construction efficiency = +130%, - # then aroai_median_construction_efficiency = 23 - divide = { - if = { - limit = { - has_variable = aroai_median_construction_efficiency - } - value = var:aroai_median_construction_efficiency - divide = 10 - } - else = { - value = 2 - } - } + # Take account of state efficiency + multiply = aroai_construction_points_per_building + divide = define:NEconomy|MAX_WEEKLY_CONSTRUCTION_PROGRESS + + + # because the AI loves to build where there's no labor # TODO remove this when fixed multiply = 1.3 diff --git a/common/scripted_effects/aroai_construction_effects.txt b/common/scripted_effects/aroai_construction_effects.txt index 0a35a731c..c78ae90f0 100644 --- a/common/scripted_effects/aroai_construction_effects.txt +++ b/common/scripted_effects/aroai_construction_effects.txt @@ -9,20 +9,13 @@ aroai_choose_building_type_to_construct = { # don't build things if no construction points if = { limit = { - aroai_has_free_construction_points = no - } - - } - # If variable wasn't set, then there is nothing to construct - else_if = { - limit = { - NOT = { - has_local_variable = aroai_highest_building_priority + # If variable wasn't set, or there's no construction point available, then there is nothing to construct + OR = { + aroai_has_free_construction_points = no + NOT = { has_local_variable = aroai_highest_building_priority } } } - aroai_clear_country_iteration_variables = yes } - # Otherwise choose a building type with highest priority to construct else = { @@ -99,7 +92,6 @@ aroai_choose_building_type_to_construct = { # Otherwise exit this event chain else = { - # In rare cases even after constructing a dozen of building types there are still both free construction # points and some building types that were not yet processed, so we cycle through them all in one day. if = { @@ -108,11 +100,6 @@ aroai_choose_building_type_to_construct = { } aroai_choose_building_type_to_construct = yes } - - # But usually we just clear variables and that's it - else = { - aroai_clear_country_iteration_variables = yes - } } } } @@ -353,22 +340,14 @@ aroai_start_building_construction = { limit = { $scaling$ = 1 } - OR = { - # Either this is a state with one of the highest levels of this building type in a country - any_scope_state = { + # Or there are no states with higher level in this list + NOT = { + any_in_list = { + variable = $states$ has_variable = aroai_building_type_occupied_levels var:aroai_building_type_occupied_levels > aroai_current_aroai_building_type_occupied_levels } - - # Or there are no states with higher level in this list - NOT = { - any_in_list = { - variable = $states$ - has_variable = aroai_building_type_occupied_levels - var:aroai_building_type_occupied_levels > aroai_current_aroai_building_type_occupied_levels - } - } } } diff --git a/common/scripted_effects/aroai_weekly_loop_effects.txt b/common/scripted_effects/aroai_weekly_loop_effects.txt index 793112f46..c4fd50910 100644 --- a/common/scripted_effects/aroai_weekly_loop_effects.txt +++ b/common/scripted_effects/aroai_weekly_loop_effects.txt @@ -7,6 +7,10 @@ # aroai_perform_iteration_of_weekly_loop = { + if = { limit = {$day_1_of_main_loop$ = yes } + aroai_clear_country_iteration_variables = yes + } + # Add a week of progress to elements of aroai_ongoing_constructions aroai_add_progress_to_ongoing_constructions = yes diff --git a/events/CWP_events/ARoAI/aroai_construction_events.txt b/events/CWP_events/ARoAI/aroai_construction_events.txt index f43198b72..589b7d20b 100644 --- a/events/CWP_events/ARoAI/aroai_construction_events.txt +++ b/events/CWP_events/ARoAI/aroai_construction_events.txt @@ -15,23 +15,15 @@ aroai_construction_events.1 = { aroai_clear_country_cycle_variables = yes aroai_clear_country_iteration_variables = yes } - else_if = { - limit = { - aroai_is_construction_allowed = no - } - aroai_clear_country_iteration_variables = yes - } else = { if = { limit = { + aroai_is_construction_allowed = yes aroai_has_free_construction_points = yes } aroai_choose_building_type_to_construct = yes } - else = { - aroai_clear_country_iteration_variables = yes - } } } } \ No newline at end of file diff --git a/events/CWP_events/ARoAI/aroai_evaluation_events.txt b/events/CWP_events/ARoAI/aroai_evaluation_events.txt index 305916fbd..7a3f85039 100644 --- a/events/CWP_events/ARoAI/aroai_evaluation_events.txt +++ b/events/CWP_events/ARoAI/aroai_evaluation_events.txt @@ -9,19 +9,14 @@ aroai_evaluation_events.1 = { immediate = { if = { - limit = { - aroai_is_country_allowed = no - } + limit = { aroai_is_country_allowed = no } + aroai_clear_country_cycle_variables = yes aroai_clear_country_iteration_variables = yes } else_if = { - limit = { - aroai_is_construction_allowed = no - } - aroai_clear_country_iteration_variables = yes - } - else = { + limit = { aroai_is_construction_allowed = yes } + aroai_perform_for_every_building_type = { effect = 5 # aroai_check_priority_of_building } diff --git a/events/CWP_events/ARoAI/aroai_preparation_events.txt b/events/CWP_events/ARoAI/aroai_preparation_events.txt index 07b76aac9..4adcd8516 100644 --- a/events/CWP_events/ARoAI/aroai_preparation_events.txt +++ b/events/CWP_events/ARoAI/aroai_preparation_events.txt @@ -13,39 +13,24 @@ aroai_preparation_events.1 = { trigger = {} immediate = { - - # Collect budget costs and restart costs collection cycle 7 days later - aroai_perform_iteration_of_weekly_loop = { - day_1_of_main_loop = yes - } - + # Check if military expenses are higher than usual due to army being in use aroai_check_if_military_expenses_are_higher_than_usual = yes - + # Change tax level and government wages if needed aroai_manage_tax_and_wage_level = yes - - # Variables are used for performance and consistency but are rechecked later if needed - if = { - limit = { - aroai_is_downsizing_allowed = yes - } - set_local_variable = aroai_downsizing_is_allowed - } - if = { - limit = { - aroai_is_construction_allowed = yes - } - set_local_variable = aroai_construction_is_allowed - } + + # Data gathering + aroai_determine_highest_and_average_military_threat = yes + aroai_determine_roleplay_building_priorities = yes + aroai_collect_data_for_construction_and_downsizing = yes + aroai_collect_coastlines_of_market_capital_and_overseas_lands = yes # Track cycles since last check of data that is used in downsizing of production buildings if = { limit = { OR = { - NOT = { - has_variable = aroai_iterations_since_production_downsizing - } + NOT = { has_variable = aroai_iterations_since_production_downsizing } var:aroai_iterations_since_production_downsizing < aroai_max_iterations_since_production_downsizing } } @@ -54,51 +39,19 @@ aroai_preparation_events.1 = { value = 1 } } - + # Downsizing and building share a bunch of data required for both of them to function if = { limit = { - OR = { - has_local_variable = aroai_downsizing_is_allowed - has_local_variable = aroai_construction_is_allowed - } - } - - # Here's that data - aroai_determine_highest_and_average_military_threat = yes - aroai_determine_roleplay_building_priorities = yes - aroai_collect_data_for_construction_and_downsizing = yes - aroai_collect_coastlines_of_market_capital_and_overseas_lands = yes - - # Perform downsizing and immediately clear variables that won't be needed in construction - if = { - limit = { - has_local_variable = aroai_downsizing_is_allowed - } - - #TODO Create "unknown effect" error, to fix - aroai_downsize_excessive_buildings = yes + aroai_is_downsizing_allowed = yes } + aroai_downsize_excessive_buildings = yes aroai_clear_downsizing_variables = yes - - # Start construction if it is still allowed or clear variables otherwise - if = { - limit = { - has_local_variable = aroai_construction_is_allowed - } - trigger_event = { - id = aroai_evaluation_events.1 - days = 1 - } - } - else = { - aroai_clear_country_iteration_variables = yes - } } - - remove_local_variable = aroai_downsizing_is_allowed - remove_local_variable = aroai_construction_is_allowed - + # Collect budget costs and restart costs collection cycle 7 days later + aroai_perform_iteration_of_weekly_loop = { + day_1_of_main_loop = yes + } } } \ No newline at end of file diff --git a/events/CWP_events/ARoAI/aroai_weekly_loop_events.txt b/events/CWP_events/ARoAI/aroai_weekly_loop_events.txt index 812d616ec..8895794a6 100644 --- a/events/CWP_events/ARoAI/aroai_weekly_loop_events.txt +++ b/events/CWP_events/ARoAI/aroai_weekly_loop_events.txt @@ -18,6 +18,10 @@ aroai_weekly_loop_events.1 = { aroai_perform_iteration_of_weekly_loop = { day_1_of_main_loop = no } + trigger_event = { + id = aroai_construction_events.1 + days = 1 + } } } } \ No newline at end of file From 315a39db3b6706ce0d1b483683d6685e69a51661 Mon Sep 17 00:00:00 2001 From: ademblon Date: Fri, 23 Jun 2023 09:32:53 +0200 Subject: [PATCH 2/8] small rewrite --- .../aroai_construction_effects.txt | 22 ++---- .../ARoAI/aroai_preparation_events.txt | 68 +++++++++++++++---- 2 files changed, 60 insertions(+), 30 deletions(-) diff --git a/common/scripted_effects/aroai_construction_effects.txt b/common/scripted_effects/aroai_construction_effects.txt index c78ae90f0..74514635c 100644 --- a/common/scripted_effects/aroai_construction_effects.txt +++ b/common/scripted_effects/aroai_construction_effects.txt @@ -79,27 +79,13 @@ aroai_choose_building_type_to_construct = { # Clear successful construction flag remove_local_variable = aroai_started_building_construction - # If we have some days left in the iteration, book an event tomorrow + # In rare cases even after constructing a dozen of building types there are still both free construction + # points and some building types that were not yet processed, so we cycle through them all in one day. if = { limit = { - aroai_day_of_ongoing_iteration < aroai_half_of_days_in_iteration_rounded_down - } - trigger_event = { - id = aroai_construction_events.1 - days = 1 - } - } - - # Otherwise exit this event chain - else = { - # In rare cases even after constructing a dozen of building types there are still both free construction - # points and some building types that were not yet processed, so we cycle through them all in one day. - if = { - limit = { - aroai_has_free_construction_points = yes - } - aroai_choose_building_type_to_construct = yes + aroai_has_free_construction_points = yes } + aroai_choose_building_type_to_construct = yes } } } diff --git a/events/CWP_events/ARoAI/aroai_preparation_events.txt b/events/CWP_events/ARoAI/aroai_preparation_events.txt index 4adcd8516..f4a5eef29 100644 --- a/events/CWP_events/ARoAI/aroai_preparation_events.txt +++ b/events/CWP_events/ARoAI/aroai_preparation_events.txt @@ -14,23 +14,38 @@ aroai_preparation_events.1 = { immediate = { + # Collect budget costs and restart costs collection cycle 7 days later + aroai_perform_iteration_of_weekly_loop = { + day_1_of_main_loop = yes + } + # Check if military expenses are higher than usual due to army being in use aroai_check_if_military_expenses_are_higher_than_usual = yes # Change tax level and government wages if needed aroai_manage_tax_and_wage_level = yes - # Data gathering - aroai_determine_highest_and_average_military_threat = yes - aroai_determine_roleplay_building_priorities = yes - aroai_collect_data_for_construction_and_downsizing = yes - aroai_collect_coastlines_of_market_capital_and_overseas_lands = yes + # Variables are used for performance and consistency but are rechecked later if needed + if = { + limit = { + aroai_is_downsizing_allowed = yes + } + set_local_variable = aroai_downsizing_is_allowed + } + if = { + limit = { + aroai_is_construction_allowed = yes + } + set_local_variable = aroai_construction_is_allowed + } # Track cycles since last check of data that is used in downsizing of production buildings if = { limit = { OR = { - NOT = { has_variable = aroai_iterations_since_production_downsizing } + NOT = { + has_variable = aroai_iterations_since_production_downsizing + } var:aroai_iterations_since_production_downsizing < aroai_max_iterations_since_production_downsizing } } @@ -40,18 +55,47 @@ aroai_preparation_events.1 = { } } + + # data gathering + aroai_determine_highest_and_average_military_threat = yes + aroai_determine_roleplay_building_priorities = yes + aroai_collect_data_for_construction_and_downsizing = yes + aroai_collect_coastlines_of_market_capital_and_overseas_lands = yes + # Downsizing and building share a bunch of data required for both of them to function if = { limit = { - aroai_is_downsizing_allowed = yes + OR = { + has_local_variable = aroai_downsizing_is_allowed + has_local_variable = aroai_construction_is_allowed + } + } + # Perform downsizing and immediately clear variables that won't be needed in construction + if = { + limit = { + has_local_variable = aroai_downsizing_is_allowed + } + + #TODO Create "unknown effect" error, to fix + aroai_downsize_excessive_buildings = yes } - aroai_downsize_excessive_buildings = yes aroai_clear_downsizing_variables = yes - } - # Collect budget costs and restart costs collection cycle 7 days later - aroai_perform_iteration_of_weekly_loop = { - day_1_of_main_loop = yes + # Start construction if it is still allowed or clear variables otherwise + if = { + limit = { + has_local_variable = aroai_construction_is_allowed + } + trigger_event = { + id = aroai_evaluation_events.1 + days = 1 + } + } } + + remove_local_variable = aroai_downsizing_is_allowed + remove_local_variable = aroai_construction_is_allowed + + } } \ No newline at end of file From e09dec686d12dd679972697b1482459c96ec4c69 Mon Sep 17 00:00:00 2001 From: ademblon Date: Sun, 25 Jun 2023 15:20:42 +0200 Subject: [PATCH 3/8] onaction rewrite fix naval base training rate small rewrite for aroai --- common/on_actions/00_code_on_actions.txt | 1620 +---------------- common/production_methods/05_military.txt | 12 +- .../scripted_effects/cwp_onaction_effects.txt | 545 ++++++ .../cwp_onaction_military_effects.txt | 62 + .../cwp_onaction_nato_effects.txt | 120 ++ .../cwp_onaction_un_effects.txt | 97 + .../cwp_onaction_warsaw_effects.txt | 115 ++ .../vanilla_onaction_effects.txt | 96 + .../ARoAI/aroai_framework_events.txt | 5 +- 9 files changed, 1117 insertions(+), 1555 deletions(-) create mode 100644 common/scripted_effects/cwp_onaction_effects.txt create mode 100644 common/scripted_effects/cwp_onaction_military_effects.txt create mode 100644 common/scripted_effects/cwp_onaction_nato_effects.txt create mode 100644 common/scripted_effects/cwp_onaction_un_effects.txt create mode 100644 common/scripted_effects/cwp_onaction_warsaw_effects.txt create mode 100644 common/scripted_effects/vanilla_onaction_effects.txt diff --git a/common/on_actions/00_code_on_actions.txt b/common/on_actions/00_code_on_actions.txt index 365cb71e2..abfee4294 100644 --- a/common/on_actions/00_code_on_actions.txt +++ b/common/on_actions/00_code_on_actions.txt @@ -2,57 +2,7 @@ # ROOT = country on_yearly_pulse_country = { effect = { - # IG leader death - random_list = { - 1 = { - trigger_event = { - id = character_events.100 - } - } - 1 = { - } - } - if = { - limit = { - NOR = { - has_variable = gov_petition_fired - has_modifier = modifier_successfully_met_petition_legitimacy - any_interest_group = { - has_modifier = modifier_failed_to_meet_petition - } - has_journal_entry = je_government_petition - } - ig_desires_laws_for_petition = yes - } - if = { - limit = { - has_variable = gov_petition_coin_toss - } - random_list = { - 1 = { - set_variable = gov_petition_fired - trigger_event = { - id = government_petition_events.100 - } - } - 1 = { - } - } - remove_variable = gov_petition_coin_toss - } - else = { - random_list = { - 1 = { - set_variable = gov_petition_fired - trigger_event = { - id = government_petition_events.100 - } - } - 9 = { - } - } - } - } + onaction_ig_petition = yes } random_events = { 150 = 0 @@ -190,526 +140,23 @@ on_yearly_pulse_country = { #ROOT = country on_monthly_pulse_country = { effect = { - # Take out the trash - every_character_in_exile_pool = { - limit = { - popularity <= 15 - } - kill_character = yes - } - # Investment Pool Soft Cap - if = { - limit = { - investment_pool > 0 - gold_reserves_limit > 0 - } - set_local_variable = { - name = var_investment_pool_divisor - value = { - value = investment_pool - divide = gold_reserves_limit - multiply = 10 - round = yes - max = 1000 - } - } - } - remove_modifier = full_investment_pool - if = { - limit = { - has_local_variable = var_investment_pool_divisor - local_var:var_investment_pool_divisor >= 10 - } - add_modifier = { - name = full_investment_pool - multiplier = local_var:var_investment_pool_divisor - } - } - # Corruption Calculations - if = { - limit = { - is_player = yes - } - every_interest_group = { - calc_ig_corruption = yes - } - if = { - limit = { - NOT = { - has_variable = var_corruption - } - } - set_variable = { - name = var_corruption - value = corruption_baseline - } - } - else_if = { - limit = { - var:var_corruption < 0 - } - set_variable = { - name = var_corruption - value = 0 - } - } - else_if = { - limit = { - var:var_corruption >= 100 - } - set_variable = { - name = var_corruption - value = 100 - } - } - if = { - limit = { - var:var_corruption <= corruption_baseline - } - change_variable = { - name = var_corruption - add = { - value = corruption_baseline - subtract = var:var_corruption - max = 0.5 - } - } - } - else_if = { - limit = { - var:var_corruption >= corruption_baseline - } - change_variable = { - name = var_corruption - add = { - value = corruption_baseline - subtract = var:var_corruption - min = -0.5 - } - } - } - # Adds appropriate modifier - if = { - limit = { - var:var_corruption = { - exists = yes - } - } - remove_modifier = corruption_modifier_effects - add_modifier = { - name = corruption_modifier_effects - multiplier = corruption_modifier - } - } - else = { - set_variable = { - name = var_corruption - value = corruption_value - } - } - } - else_if = { - limit = { - has_variable = var_corruption - } - remove_variable = var_corruption - if = { - limit = { - has_modifier = corruption_modifier_effects - } - remove_modifier = corruption_modifier_effects - } - } - # UN Calculations - if = { - limit = { - global_var:var_un_memberlist = { - exists = yes - } - } - set_global_variable = { - name = var_un_memberlist - value = 0 - } - every_country = { - limit = { - has_variable = un_member - } - change_global_variable = { - name = var_un_memberlist - add = 1 - } - } - } - # Nuclear Calculations - if = { - limit = { - has_modifier = nuclear_capable - nuclear_stockpile_sv <= nuclear_stockpile_max - } - change_variable = { - name = nuclear_stockpile - add = nuclear_stockpile_growth - } - change_variable = { - name = nuclear_stockpile - subtract = nuclear_stockpile_decay - } - } - if = { - limit = { - has_modifier = nuclear_capable - nuclear_stockpile_sv >= nuclear_stockpile_max - } - change_variable = { - name = nuclear_stockpile - subtract = nuclear_stockpile_decay - } - } - #UN Voting for AI - if = { - limit = { - has_variable = un_member - } - trigger_event = un_ai_voting.1 - trigger_event = un_ai_voting.2 - } - # Readiness Calculations - if = { - limit = { - has_variable = var_readiness - has_variable = var_increase_readiness - var:var_readiness < 100 - } - change_variable = { - name = var_readiness - add = readiness_sum_value - } - } - if = { - limit = { - has_variable = var_readiness - has_variable = var_decrease_readiness - var:var_readiness >= 0 - } - change_variable = { - name = var_readiness - subtract = readiness_decrease_value - } - } - if = { - limit = { - has_variable = var_readiness - var:var_readiness < 0 - } - set_variable = { - name = var_readiness - value = 0 - } - } - if = { - limit = { - has_variable = var_readiness - var:var_readiness > 100 - } - set_variable = { - name = var_readiness - value = 100 - } - } - if = { - limit = { - has_variable = var_readiness - } - remove_modifier = readiness_modifier - add_modifier = { - name = readiness_modifier - multiplier = readiness - } - } - # AI Calculations - if = { - limit = { - has_variable = var_readiness - } - trigger_event = ai_readiness_calculations.1 - } - # UN Applications - if = { - limit = { - has_variable = application_progress_un - } - add_to_global_variable_list = { - name = un_application_list - target = THIS - } - } - if = { - limit = { - has_variable = application_progress_un - application_progress_un <= 100 - } - change_variable = { - name = application_progress_un - add = 3 - } - } - if = { - limit = { - has_variable = application_progress_un - application_progress_un <= 100 - supporting_countries > required_support_un - } - change_variable = { - name = application_progress_un - add = 2 - } - } - if = { - limit = { - has_variable = application_progress_un - application_progress_un >= 100 - application_progress_un <= 150 - } - change_variable = { - name = application_progress_un - add = 1 - } - } - if = { - limit = { - has_variable = application_progress_un - var:application_progress_un >= 100 - supporting_countries >= required_support_un - } - effect_un_application_approved = yes - rebuild_un_memberlist = yes - trigger_event = un_dynamic_resolution_events.4 - } - if = { - limit = { - has_variable = application_progress_un - var:application_progress_un >= 150 - not = { - supporting_countries >= required_support_un - } - } - effect_un_application_rejected = yes - trigger_event = un_dynamic_resolution_events.5 - } - # Military Alliance Calculations - if = { - limit = { - and = { - is_target_in_global_variable_list = { - name = nato_members - target = this - } - has_global_variable = nato - is_meeting_nato_standards = no - } - } - remove_modifier = nato_cohesion - remove_modifier = nato_not_meeting_standards - add_modifier = { - name = nato_not_meeting_standards - } - } - if = { - limit = { - and = { - is_target_in_global_variable_list = { - name = nato_members - target = this - } - has_global_variable = nato - is_meeting_nato_standards = yes - } - } - remove_modifier = nato_not_meeting_standards - remove_modifier = nato_cohesion - add_modifier = { - name = nato_cohesion - multiplier = nato_cohesion - } - } - # NATO Applications - if = { - limit = { - has_variable = application_progress_nato - } - add_to_global_variable_list = { - name = nato_application_list - target = THIS - } - } - if = { - limit = { - has_variable = application_progress_nato - application_progress_nato <= 100 - } - change_variable = { - name = application_progress_nato - add = 3 - } - } - if = { - limit = { - has_variable = application_progress_nato - application_progress_nato <= 100 - nato_supporting_countries > nato_membersize - } - change_variable = { - name = application_progress_nato - add = 2 - } - } - if = { - limit = { - has_variable = application_progress_nato - application_progress_nato >= 100 - application_progress_nato <= 150 - } - change_variable = { - name = application_progress_nato - add = 1 - } - } - if = { - limit = { - has_variable = application_progress_nato - var:application_progress_nato >= 100 # was 100 - nato_supporting_countries >= nato_membersize - is_meeting_nato_standards = yes - } - effect_nato_application_approved = yes + onaction_kill_unpopular_character = yes + onaction_investment_pool_softcap = yes - trigger_event = nato_application_events.1 - } - if = { - limit = { - has_variable = application_progress_nato - var:application_progress_nato >= 150 - not = { - nato_supporting_countries >= nato_membersize - } - } - effect_nato_application_rejected = yes - trigger_event = nato_application_events.2 - } - #NATO Voting for AI - if = { - limit = { - is_in_nato = yes - } - trigger_event = nato_ai_voting.1 - } - # Military Alliance Calculations / Warsaw Pact - if = { - limit = { - and = { - is_target_in_global_variable_list = { - name = warsaw_pact_members - target = this - } - has_global_variable = warsaw_pact - is_meeting_warsaw_pact_standards = no - } - } - remove_modifier = warsaw_pact_cohesion - remove_modifier = warsaw_pact_not_meeting_standards - add_modifier = { - name = warsaw_pact_not_meeting_standards - } - } - if = { - limit = { - and = { - is_target_in_global_variable_list = { - name = warsaw_pact_members - target = this - } - has_global_variable = warsaw_pact - is_meeting_warsaw_pact_standards = yes - } - } - remove_modifier = warsaw_pact_not_meeting_standards - remove_modifier = warsaw_pact_cohesion - add_modifier = { - name = warsaw_pact_cohesion - multiplier = warsaw_pact_cohesion - } - } - # warsaw_pact Applications - if = { - limit = { - has_variable = application_progress_warsaw_pact - } - add_to_global_variable_list = { - name = warsaw_pact_application_list - target = THIS - } - } - if = { - limit = { - has_variable = application_progress_warsaw_pact - application_progress_warsaw_pact <= 100 - } - change_variable = { - name = application_progress_warsaw_pact - add = 3 - } - } - if = { - limit = { - has_variable = application_progress_warsaw_pact - application_progress_warsaw_pact <= 100 - warsaw_pact_supporting_countries >= 1 - } - change_variable = { - name = application_progress_warsaw_pact - add = 2 - } - } - if = { - limit = { - has_variable = application_progress_warsaw_pact - application_progress_warsaw_pact >= 100 - application_progress_warsaw_pact <= 150 - } - change_variable = { - name = application_progress_warsaw_pact - add = 1 - } - } - if = { - limit = { - has_variable = application_progress_warsaw_pact - var:application_progress_warsaw_pact >= 100 # was 100 - warsaw_pact_supporting_countries >= warsaw_pact_membersize - } - effect_warsaw_pact_application_approved = yes + onaction_corruption_calculation = yes - trigger_event = warsaw_pact_application_events.1 - } - if = { - limit = { - has_variable = application_progress_warsaw_pact - var:application_progress_warsaw_pact >= 150 - not = { - warsaw_pact_supporting_countries >= warsaw_pact_membersize - } - } - effect_warsaw_pact_application_rejected = yes - trigger_event = warsaw_pact_application_events.2 - } - #warsaw_pact Voting for AI - if = { - limit = { - is_in_warsaw_pact = yes - } - trigger_event = warsaw_pact_ai_voting.1 - } + onaction_un_calculation = yes + onaction_un_application = yes + + onaction_nuclear_calculation = yes + + onaction_nato_cohesion_calculation = yes + onaction_nato_application = yes + onaction_nato_ai_voting = yes + + onaction_warsaw_cohesion_calculation = yes + onaction_warsaw_application = yes + onaction_warsaw_ai_voting = yes } random_events = { 20 = 0 @@ -893,25 +340,7 @@ on_half_yearly_pulse_state = { on_yearly_pulse_state = { effect = { - # Urbanization calcs - set_local_variable = { - name = var_urban_rate - value = { - value = total_urbanization - divide = { - value = arable_land - multiply = 100 - add = total_urbanization - } - add = -0.5 - multiply = 50 - } - } - remove_modifier = urbanization_modifier - add_modifier = { - name = urbanization_modifier - multiplier = local_var:var_urban_rate - } + onaction_urbanization_modifier = yes } } @@ -958,116 +387,18 @@ on_battle_lost = { } } -# Root = Building -on_building_built = { - effect = { - if = { - limit = { - is_building_type = building_nuclear_research_facility - } - owner = { - set_variable = nuclear_facility_established - } - } - if = { - limit = { - is_building_type = building_renewable_energy_facility - Root.state = { - is_excellent_solar_capacity = yes - } - } - add_modifier = { - name = excellent_solar_capacity - } - } - if = { - limit = { - is_building_type = building_renewable_energy_facility - Root.state = { - is_excellent_wind_capacity = yes - } - } - add_modifier = { - name = excellent_wind_capacity - } - } - if = { - limit = { - is_building_type = building_renewable_energy_facility - Root.state = { - is_excellent_hydroelectric_capacity = yes - } - } - add_modifier = { - name = excellent_hydroelectric_capacity - } - } - if = { - limit = { - is_building_type = building_renewable_energy_facility - Root.state = { - is_moderate_solar_capacity = yes - } - } - add_modifier = { - name = moderate_solar_capacity - } - } - if = { - limit = { - is_building_type = building_renewable_energy_facility - Root.state = { - is_moderate_wind_capacity = yes - } - } - add_modifier = { - name = moderate_wind_capacity - } - } - if = { - limit = { - is_building_type = building_renewable_energy_facility - Root.state = { - is_moderate_hydroelectric_capacity = yes - } - } - add_modifier = { - name = moderate_hydroelectric_capacity - } - } - if = { - limit = { - is_building_type = building_renewable_energy_facility - Root.state = { - is_poor_solar_capacity = yes - } - } - add_modifier = { - name = poor_solar_capacity - } - } - if = { - limit = { - is_building_type = building_renewable_energy_facility - Root.state = { - is_poor_wind_capacity = yes - } - } - add_modifier = { - name = poor_wind_capacity - } - } +# Root = Building +on_building_built = { + effect = { if = { limit = { - is_building_type = building_renewable_energy_facility - Root.state = { - is_poor_hydroelectric_capacity = yes - } + is_building_type = building_nuclear_research_facility } - add_modifier = { - name = poor_hydroelectric_capacity + owner = { + set_variable = nuclear_facility_established } } + onaction_renewable_modifier = yes } } @@ -1307,437 +638,45 @@ on_diplomatic_action_third_party_break_accepted = { # Root = Diplomatic Action on_diplomatic_action_third_party_break_declined = { effect = { - post_notification = diplomatic_proposal_third_party_break_declined - } -} - -# Root = Diplomatic Action -on_diplomats_expelled = { -} - -# Root = Diplomatic Pact -on_diplomatic_pact_auto_break = { - effect = { - post_notification = diplomatic_pact_auto_break_notification - } -} - -# Root = Diplomatic Pact -on_diplomatic_pact_third_party_auto_break = { - effect = { - post_notification = diplomatic_pact_third_party_auto_break_notification - } -} - -# Root = Releasing Country -# scope:target = Released Country -on_country_released_as_independent = { - effect = { - if = { - limit = { - scope:target = { - country_has_primary_culture = cu:ashkenazi - } - NOT = { - s:STATE_PALESTINE = { - is_homeland = cu:ashkenazi - } - } - } - s:STATE_PALESTINE = { - add_homeland = sephardic - add_homeland = ashkenazi - } - } - # Corruption Calculations - if = { - limit = { - var:var_corruption <= 20 - } - scope:target = { - effect_corruption_low = yes - } - } - if = { - limit = { - var:var_corruption > 20 - var:var_corruption <= 50 - } - scope:target = { - effect_corruption_medium = yes - } - } - if = { - limit = { - var:var_corruption > 50 - } - scope:target = { - effect_corruption_high = yes - } - } - # Currency Calculations - if = { - limit = { - var:cwp_currency = flag:currency_usd - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_usd = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_frf - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_frf = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_gbp - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_gbp = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_sur - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_sur = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_brz - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_brz = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_dem - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_dem = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_pen - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_pen = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_pes - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_pes = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_dnr - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_dnr = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_irr - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_irr = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_trl - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_trl = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_yum - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_yum = yes - } - } - } -} - -# Root = Releasing Country -# scope:target = Released Country -on_country_released_as_own_subject = { - effect = { - if = { - limit = { - scope:target = { - country_has_primary_culture = cu:ashkenazi - } - NOT = { - s:STATE_PALESTINE = { - is_homeland = cu:ashkenazi - } - } - } - s:STATE_PALESTINE = { - add_homeland = sephardic - add_homeland = ashkenazi - } - } - # Corruption Calculations - if = { - limit = { - var:var_corruption <= 20 - } - scope:target = { - effect_corruption_low = yes - } - } - if = { - limit = { - var:var_corruption > 20 - var:var_corruption <= 50 - } - scope:target = { - effect_corruption_medium = yes - } - } - if = { - limit = { - var:var_corruption > 50 - } - scope:target = { - effect_corruption_high = yes - } - } - # Currency Calculations - if = { - limit = { - var:cwp_currency = flag:currency_usd - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_usd = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_frf - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_frf = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_gbp - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_gbp = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_sur - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_sur = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_brz - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_brz = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_dem - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_dem = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_pen - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_pen = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_pes - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_pes = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_dnr - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_dnr = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_irr - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_irr = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_trl - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_trl = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_yum - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_yum = yes - } - } + post_notification = diplomatic_proposal_third_party_break_declined + } +} + +# Root = Diplomatic Action +on_diplomats_expelled = { +} + +# Root = Diplomatic Pact +on_diplomatic_pact_auto_break = { + effect = { + post_notification = diplomatic_pact_auto_break_notification + } +} + +# Root = Diplomatic Pact +on_diplomatic_pact_third_party_auto_break = { + effect = { + post_notification = diplomatic_pact_third_party_auto_break_notification + } +} + +# Root = Releasing Country +# scope:target = Released Country +on_country_released_as_independent = { + effect = { + onaction_palestine = yes + onaction_corruption_calculation_2 = yes + onaction_currency_calculation = yes + } +} + +# Root = Releasing Country +# scope:target = Released Country +on_country_released_as_own_subject = { + effect = { + onaction_palestine = yes + onaction_corruption_calculation_2 = yes + onaction_currency_calculation = yes } } @@ -1745,205 +684,9 @@ on_country_released_as_own_subject = { # scope:target = Released Country on_country_released_as_overlord_subject = { effect = { - if = { - limit = { - scope:target = { - country_has_primary_culture = cu:ashkenazi - } - NOT = { - s:STATE_PALESTINE = { - is_homeland = cu:ashkenazi - } - } - } - s:STATE_PALESTINE = { - add_homeland = sephardic - add_homeland = ashkenazi - } - } - # Corruption Calculation - if = { - limit = { - var:var_corruption <= 20 - } - scope:target = { - effect_corruption_low = yes - } - } - if = { - limit = { - var:var_corruption > 20 - var:var_corruption <= 50 - } - scope:target = { - effect_corruption_medium = yes - } - } - if = { - limit = { - var:var_corruption > 50 - } - scope:target = { - effect_corruption_high = yes - } - } - # Currency Calculations - if = { - limit = { - var:cwp_currency = flag:currency_usd - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_usd = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_frf - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_frf = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_gbp - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_gbp = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_sur - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_sur = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_brz - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_brz = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_dem - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_dem = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_pen - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_pen = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_pes - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_pes = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_dnr - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_dnr = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_irr - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_irr = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_trl - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_trl = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_yum - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_yum = yes - } - } + onaction_palestine = yes + onaction_corruption_calculation_2 = yes + onaction_currency_calculation = yes } } @@ -2458,43 +1201,9 @@ on_law_enactment_pass = { private_military_companies.2 } effect = { - if = { - limit = { - OR = { - is_enacting_law = law_type:law_ethnonationalist - is_enacting_law = law_type:law_supremacist - is_enacting_law = law_type:law_segregationist - is_enacting_law = law_type:law_integrationist - is_enacting_law = law_type:law_multiculturalist - } - } - add_modifier = { - name = racial_tension - is_decaying = yes - months = 120 - } - } - if = { - limit = { - has_law = law_type:law_hereditary - OR = { - is_enacting_law = law_type:law_executive - is_enacting_law = law_type:law_parliamentary - is_enacting_law = law_type:law_council_elective - } - } - add_modifier = { - name = recently_abolished_monarchy - years = 10 - } - } - if = { - limit = { - has_modifier = hired_pmc - is_enacting_law = law_type:law_private_military - } - remove_modifier = hired_pmc - } + onaction_ratial_tension_modifier = yes + onaction_monarchy_abolished_modifier = yes + onaction_hired_pmc = yes } } @@ -2556,163 +1265,7 @@ on_revolution_start = { scope:target = { enact_preferred_governance_principle = yes } - # Currency - if = { - limit = { - var:cwp_currency = flag:currency_usd - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_usd = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_frf - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_frf = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_gbp - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_gbp = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_sur - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_sur = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_brz - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_brz = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_dem - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_dem = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_pen - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_pen = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_pes - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_pes = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_dnr - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_dnr = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_irr - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_irr = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_trl - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_trl = yes - } - } - if = { - limit = { - var:cwp_currency = flag:currency_yum - scope:target = { - not = { - has_variable = cwp_currency - } - } - } - scope:target = { - effect_currency_yum = yes - } - } + onaction_currency_calculation = yes } } @@ -3232,36 +1785,9 @@ on_naval_invasion = { on_monthly_pulse_state = { #in every state, if the number of skyscrapers is greater than the number of urban centers, then the state is too urbanized. A modifier is applied to the state that greatly increases the upkeep of each skyscraper. The modifier is removed when the number of skyscrapers is less than the number of urban centers. effect = { - remove_modifier = state_skyscraper_modifier - add_modifier = { - name = state_skyscraper_modifier - multiplier = { - value = total_urbanization - divide = 1000 - ceiling = yes - max = 100 - } - } - if = { - limit = { - this = { - state_max_slums > 0 - } - } - remove_modifier = state_slum_modifier - add_modifier = { - name = state_slum_modifier - multiplier = state_max_slums - } - } - if = { - limit = { - this = { - state_max_slums <= 0 - } - } - remove_modifier = state_slum_modifier - } + onaction_skyscraper_modifier = yes + onaction_slums_modifier = yes + # Habitability Calculations calc_monthly_habitability = yes set_habitability_effects = yes diff --git a/common/production_methods/05_military.txt b/common/production_methods/05_military.txt index 9753662c5..80225ce53 100644 --- a/common/production_methods/05_military.txt +++ b/common/production_methods/05_military.txt @@ -2107,7 +2107,7 @@ pm_wartime_escort_ships = { level_scaled = { building_employment_servicemembers_add = -200 building_employment_officers_add = 200 - building_training_rate_add = 5 + building_training_rate_add = 400 } throughput_scaled = { unit_offense_add = 32 @@ -2142,7 +2142,7 @@ pm_modernized_wartime_escort_ships = { level_scaled = { building_employment_servicemembers_add = -200 building_employment_officers_add = 200 - building_training_rate_add = 5 + building_training_rate_add = 350 } throughput_scaled = { unit_offense_add = 48 @@ -2179,7 +2179,7 @@ pm_dedicated_asw_escort_ships = { level_scaled = { building_employment_servicemembers_add = -200 building_employment_officers_add = 200 - building_training_rate_add = 5 + building_training_rate_add = 300 } throughput_scaled = { unit_offense_add = 89 @@ -2217,7 +2217,7 @@ pm_missile_armed_escort_ships = { level_scaled = { building_employment_servicemembers_add = -200 building_employment_officers_add = 200 - building_training_rate_add = 5 + building_training_rate_add = 250 } throughput_scaled = { unit_offense_add = 125 @@ -2255,7 +2255,7 @@ pm_modernized_guided_missile_escort_ships = { level_scaled = { building_employment_servicemembers_add = -200 building_employment_officers_add = 200 - building_training_rate_add = 5 + building_training_rate_add = 200 } throughput_scaled = { unit_offense_add = 154 @@ -2293,7 +2293,7 @@ pm_multi_purpose_escort_ships = { level_scaled = { building_employment_servicemembers_add = -200 building_employment_officers_add = 200 - building_training_rate_add = 5 + building_training_rate_add = 175 } throughput_scaled = { unit_offense_add = 199 diff --git a/common/scripted_effects/cwp_onaction_effects.txt b/common/scripted_effects/cwp_onaction_effects.txt new file mode 100644 index 000000000..92a2a225f --- /dev/null +++ b/common/scripted_effects/cwp_onaction_effects.txt @@ -0,0 +1,545 @@ + +onaction_nuclear_calculation = { + # Nuclear Calculations + if = { + limit = { + has_modifier = nuclear_capable + nuclear_stockpile_sv <= nuclear_stockpile_max + } + change_variable = { + name = nuclear_stockpile + add = nuclear_stockpile_growth + } + change_variable = { + name = nuclear_stockpile + subtract = nuclear_stockpile_decay + } + } + if = { + limit = { + has_modifier = nuclear_capable + nuclear_stockpile_sv >= nuclear_stockpile_max + } + change_variable = { + name = nuclear_stockpile + subtract = nuclear_stockpile_decay + } + } +} + + + +onaction_corruption_calculation = { + # Corruption Calculations + if = { + limit = { + is_player = yes + } + every_interest_group = { + calc_ig_corruption = yes + } + if = { + limit = { + NOT = { + has_variable = var_corruption + } + } + set_variable = { + name = var_corruption + value = corruption_baseline + } + } + else_if = { + limit = { + var:var_corruption < 0 + } + set_variable = { + name = var_corruption + value = 0 + } + } + else_if = { + limit = { + var:var_corruption >= 100 + } + set_variable = { + name = var_corruption + value = 100 + } + } + if = { + limit = { + var:var_corruption <= corruption_baseline + } + change_variable = { + name = var_corruption + add = { + value = corruption_baseline + subtract = var:var_corruption + max = 0.5 + } + } + } + else_if = { + limit = { + var:var_corruption >= corruption_baseline + } + change_variable = { + name = var_corruption + add = { + value = corruption_baseline + subtract = var:var_corruption + min = -0.5 + } + } + } + # Adds appropriate modifier + if = { + limit = { + var:var_corruption = { + exists = yes + } + } + remove_modifier = corruption_modifier_effects + add_modifier = { + name = corruption_modifier_effects + multiplier = corruption_modifier + } + } + else = { + set_variable = { + name = var_corruption + value = corruption_value + } + } + } + else_if = { + limit = { + has_variable = var_corruption + } + remove_variable = var_corruption + if = { + limit = { + has_modifier = corruption_modifier_effects + } + remove_modifier = corruption_modifier_effects + } + } +} + +onaction_corruption_calculation_2 = { + # Corruption Calculations + if = { + limit = { + var:var_corruption <= 20 + } + scope:target = { + effect_corruption_low = yes + } + } + if = { + limit = { + var:var_corruption > 20 + var:var_corruption <= 50 + } + scope:target = { + effect_corruption_medium = yes + } + } + if = { + limit = { + var:var_corruption > 50 + } + scope:target = { + effect_corruption_high = yes + } + } +} + + +onaction_renewable_modifier = { + if = { + limit = { + is_building_type = building_renewable_energy_facility + Root.state = { + is_excellent_solar_capacity = yes + } + } + add_modifier = { + name = excellent_solar_capacity + } + } + if = { + limit = { + is_building_type = building_renewable_energy_facility + Root.state = { + is_excellent_wind_capacity = yes + } + } + add_modifier = { + name = excellent_wind_capacity + } + } + if = { + limit = { + is_building_type = building_renewable_energy_facility + Root.state = { + is_excellent_hydroelectric_capacity = yes + } + } + add_modifier = { + name = excellent_hydroelectric_capacity + } + } + if = { + limit = { + is_building_type = building_renewable_energy_facility + Root.state = { + is_moderate_solar_capacity = yes + } + } + add_modifier = { + name = moderate_solar_capacity + } + } + if = { + limit = { + is_building_type = building_renewable_energy_facility + Root.state = { + is_moderate_wind_capacity = yes + } + } + add_modifier = { + name = moderate_wind_capacity + } + } + if = { + limit = { + is_building_type = building_renewable_energy_facility + Root.state = { + is_moderate_hydroelectric_capacity = yes + } + } + add_modifier = { + name = moderate_hydroelectric_capacity + } + } + if = { + limit = { + is_building_type = building_renewable_energy_facility + Root.state = { + is_poor_solar_capacity = yes + } + } + add_modifier = { + name = poor_solar_capacity + } + } + if = { + limit = { + is_building_type = building_renewable_energy_facility + Root.state = { + is_poor_wind_capacity = yes + } + } + add_modifier = { + name = poor_wind_capacity + } + } + if = { + limit = { + is_building_type = building_renewable_energy_facility + Root.state = { + is_poor_hydroelectric_capacity = yes + } + } + add_modifier = { + name = poor_hydroelectric_capacity + } + } +} + +onaction_currency_calculation = { + # Currency Calculations + if = { + limit = { + var:cwp_currency = flag:currency_usd + scope:target = { + not = { + has_variable = cwp_currency + } + } + } + scope:target = { + effect_currency_usd = yes + } + } + if = { + limit = { + var:cwp_currency = flag:currency_frf + scope:target = { + not = { + has_variable = cwp_currency + } + } + } + scope:target = { + effect_currency_frf = yes + } + } + if = { + limit = { + var:cwp_currency = flag:currency_gbp + scope:target = { + not = { + has_variable = cwp_currency + } + } + } + scope:target = { + effect_currency_gbp = yes + } + } + if = { + limit = { + var:cwp_currency = flag:currency_sur + scope:target = { + not = { + has_variable = cwp_currency + } + } + } + scope:target = { + effect_currency_sur = yes + } + } + if = { + limit = { + var:cwp_currency = flag:currency_brz + scope:target = { + not = { + has_variable = cwp_currency + } + } + } + scope:target = { + effect_currency_brz = yes + } + } + if = { + limit = { + var:cwp_currency = flag:currency_dem + scope:target = { + not = { + has_variable = cwp_currency + } + } + } + scope:target = { + effect_currency_dem = yes + } + } + if = { + limit = { + var:cwp_currency = flag:currency_pen + scope:target = { + not = { + has_variable = cwp_currency + } + } + } + scope:target = { + effect_currency_pen = yes + } + } + if = { + limit = { + var:cwp_currency = flag:currency_pes + scope:target = { + not = { + has_variable = cwp_currency + } + } + } + scope:target = { + effect_currency_pes = yes + } + } + if = { + limit = { + var:cwp_currency = flag:currency_dnr + scope:target = { + not = { + has_variable = cwp_currency + } + } + } + scope:target = { + effect_currency_dnr = yes + } + } + if = { + limit = { + var:cwp_currency = flag:currency_irr + scope:target = { + not = { + has_variable = cwp_currency + } + } + } + scope:target = { + effect_currency_irr = yes + } + } + if = { + limit = { + var:cwp_currency = flag:currency_trl + scope:target = { + not = { + has_variable = cwp_currency + } + } + } + scope:target = { + effect_currency_trl = yes + } + } + if = { + limit = { + var:cwp_currency = flag:currency_yum + scope:target = { + not = { + has_variable = cwp_currency + } + } + } + scope:target = { + effect_currency_yum = yes + } + } +} + +onaction_palestine = { + if = { + limit = { + scope:target = { + country_has_primary_culture = cu:ashkenazi + } + NOT = { + s:STATE_PALESTINE = { + is_homeland = cu:ashkenazi + } + } + } + s:STATE_PALESTINE = { + add_homeland = sephardic + add_homeland = ashkenazi + } + } +} + +onaction_skyscraper_modifier = { + remove_modifier = state_skyscraper_modifier + add_modifier = { + name = state_skyscraper_modifier + multiplier = { + value = total_urbanization + divide = 1000 + ceiling = yes + max = 100 + } + } +} + +onaction_slums_modifier = { + if = { + limit = { + this = { + state_max_slums > 0 + } + } + remove_modifier = state_slum_modifier + add_modifier = { + name = state_slum_modifier + multiplier = state_max_slums + } + } + if = { + limit = { + this = { + state_max_slums <= 0 + } + } + remove_modifier = state_slum_modifier + } +} + +onaction_urbanization_modifier = { + # Urbanization calcs + set_local_variable = { + name = var_urban_rate + value = { + value = total_urbanization + divide = { + value = arable_land + multiply = 100 + add = total_urbanization + } + add = -0.5 + multiply = 50 + } + } + remove_modifier = urbanization_modifier + add_modifier = { + name = urbanization_modifier + multiplier = local_var:var_urban_rate + } +} + +onaction_ratial_tension_modifier = { + if = { + limit = { + OR = { + is_enacting_law = law_type:law_ethnonationalist + is_enacting_law = law_type:law_supremacist + is_enacting_law = law_type:law_segregationist + is_enacting_law = law_type:law_integrationist + is_enacting_law = law_type:law_multiculturalist + } + } + add_modifier = { + name = racial_tension + is_decaying = yes + months = 120 + } + } +} + +onaction_monarchy_abolished_modifier = { + if = { + limit = { + has_law = law_type:law_hereditary + OR = { + is_enacting_law = law_type:law_executive + is_enacting_law = law_type:law_parliamentary + is_enacting_law = law_type:law_council_elective + } + } + add_modifier = { + name = recently_abolished_monarchy + years = 10 + } + } +} + +onaction_hired_pmc = { + if = { + limit = { + has_modifier = hired_pmc + is_enacting_law = law_type:law_private_military + } + remove_modifier = hired_pmc + } +} + + diff --git a/common/scripted_effects/cwp_onaction_military_effects.txt b/common/scripted_effects/cwp_onaction_military_effects.txt new file mode 100644 index 000000000..69afd35f1 --- /dev/null +++ b/common/scripted_effects/cwp_onaction_military_effects.txt @@ -0,0 +1,62 @@ +onaction_readiness_calculation = { + # Readiness Calculations + if = { + limit = { + has_variable = var_readiness + has_variable = var_increase_readiness + var:var_readiness < 100 + } + change_variable = { + name = var_readiness + add = readiness_sum_value + } + } + if = { + limit = { + has_variable = var_readiness + has_variable = var_decrease_readiness + var:var_readiness >= 0 + } + change_variable = { + name = var_readiness + subtract = readiness_decrease_value + } + } + if = { + limit = { + has_variable = var_readiness + var:var_readiness < 0 + } + set_variable = { + name = var_readiness + value = 0 + } + } + if = { + limit = { + has_variable = var_readiness + var:var_readiness > 100 + } + set_variable = { + name = var_readiness + value = 100 + } + } + if = { + limit = { + has_variable = var_readiness + } + remove_modifier = readiness_modifier + add_modifier = { + name = readiness_modifier + multiplier = readiness + } + } + # AI Calculations + if = { + limit = { + has_variable = var_readiness + } + trigger_event = ai_readiness_calculations.1 + } +} \ No newline at end of file diff --git a/common/scripted_effects/cwp_onaction_nato_effects.txt b/common/scripted_effects/cwp_onaction_nato_effects.txt new file mode 100644 index 000000000..3e4a28e11 --- /dev/null +++ b/common/scripted_effects/cwp_onaction_nato_effects.txt @@ -0,0 +1,120 @@ + + + + +#todo rewrite this in one if +onaction_nato_cohesion_calculation = { + if = { + limit = { + and = { + is_target_in_global_variable_list = { + name = nato_members + target = this + } + has_global_variable = nato + is_meeting_nato_standards = no + } + } + remove_modifier = nato_cohesion + remove_modifier = nato_not_meeting_standards + add_modifier = { + name = nato_not_meeting_standards + } + } + if = { + limit = { + and = { + is_target_in_global_variable_list = { + name = nato_members + target = this + } + has_global_variable = nato + is_meeting_nato_standards = yes + } + } + remove_modifier = nato_not_meeting_standards + remove_modifier = nato_cohesion + add_modifier = { + name = nato_cohesion + multiplier = nato_cohesion + } + } +} + +onaction_nato_application = { + # NATO Applications + if = { + limit = { + has_variable = application_progress_nato + } + add_to_global_variable_list = { + name = nato_application_list + target = THIS + } + } + if = { + limit = { + has_variable = application_progress_nato + application_progress_nato <= 100 + } + change_variable = { + name = application_progress_nato + add = 3 + } + } + if = { + limit = { + has_variable = application_progress_nato + application_progress_nato <= 100 + nato_supporting_countries > nato_membersize + } + change_variable = { + name = application_progress_nato + add = 2 + } + } + if = { + limit = { + has_variable = application_progress_nato + application_progress_nato >= 100 + application_progress_nato <= 150 + } + change_variable = { + name = application_progress_nato + add = 1 + } + } + if = { + limit = { + has_variable = application_progress_nato + var:application_progress_nato >= 100 # was 100 + nato_supporting_countries >= nato_membersize + is_meeting_nato_standards = yes + } + effect_nato_application_approved = yes + + trigger_event = nato_application_events.1 + } + if = { + limit = { + has_variable = application_progress_nato + var:application_progress_nato >= 150 + not = { + nato_supporting_countries >= nato_membersize + } + } + effect_nato_application_rejected = yes + trigger_event = nato_application_events.2 + } +} + +onaction_nato_ai_voting = { + #NATO Voting for AI + if = { + limit = { + is_in_nato = yes + } + trigger_event = nato_ai_voting.1 + } + +} \ No newline at end of file diff --git a/common/scripted_effects/cwp_onaction_un_effects.txt b/common/scripted_effects/cwp_onaction_un_effects.txt new file mode 100644 index 000000000..7176bcb5d --- /dev/null +++ b/common/scripted_effects/cwp_onaction_un_effects.txt @@ -0,0 +1,97 @@ +onaction_un_calculation = { + # UN Calculations + if = { + limit = { + global_var:var_un_memberlist = { + exists = yes + } + } + set_global_variable = { + name = var_un_memberlist + value = 0 + } + every_country = { + limit = { + has_variable = un_member + } + change_global_variable = { + name = var_un_memberlist + add = 1 + } + } + } + #UN Voting for AI + if = { + limit = { + has_variable = un_member + } + trigger_event = un_ai_voting.1 + trigger_event = un_ai_voting.2 + } +} + +onaction_un_application = { + # UN Applications + if = { + limit = { + has_variable = application_progress_un + } + add_to_global_variable_list = { + name = un_application_list + target = THIS + } + } + if = { + limit = { + has_variable = application_progress_un + application_progress_un <= 100 + } + change_variable = { + name = application_progress_un + add = 3 + } + } + if = { + limit = { + has_variable = application_progress_un + application_progress_un <= 100 + supporting_countries > required_support_un + } + change_variable = { + name = application_progress_un + add = 2 + } + } + if = { + limit = { + has_variable = application_progress_un + application_progress_un >= 100 + application_progress_un <= 150 + } + change_variable = { + name = application_progress_un + add = 1 + } + } + if = { + limit = { + has_variable = application_progress_un + var:application_progress_un >= 100 + supporting_countries >= required_support_un + } + effect_un_application_approved = yes + rebuild_un_memberlist = yes + trigger_event = un_dynamic_resolution_events.4 + } + if = { + limit = { + has_variable = application_progress_un + var:application_progress_un >= 150 + not = { + supporting_countries >= required_support_un + } + } + effect_un_application_rejected = yes + trigger_event = un_dynamic_resolution_events.5 + } +} diff --git a/common/scripted_effects/cwp_onaction_warsaw_effects.txt b/common/scripted_effects/cwp_onaction_warsaw_effects.txt new file mode 100644 index 000000000..ecfe35b86 --- /dev/null +++ b/common/scripted_effects/cwp_onaction_warsaw_effects.txt @@ -0,0 +1,115 @@ +onaction_warsaw_application = { + # warsaw_pact Applications + if = { + limit = { + has_variable = application_progress_warsaw_pact + } + add_to_global_variable_list = { + name = warsaw_pact_application_list + target = THIS + } + } + if = { + limit = { + has_variable = application_progress_warsaw_pact + application_progress_warsaw_pact <= 100 + } + change_variable = { + name = application_progress_warsaw_pact + add = 3 + } + } + if = { + limit = { + has_variable = application_progress_warsaw_pact + application_progress_warsaw_pact <= 100 + warsaw_pact_supporting_countries >= 1 + } + change_variable = { + name = application_progress_warsaw_pact + add = 2 + } + } + if = { + limit = { + has_variable = application_progress_warsaw_pact + application_progress_warsaw_pact >= 100 + application_progress_warsaw_pact <= 150 + } + change_variable = { + name = application_progress_warsaw_pact + add = 1 + } + } + if = { + limit = { + has_variable = application_progress_warsaw_pact + var:application_progress_warsaw_pact >= 100 # was 100 + warsaw_pact_supporting_countries >= warsaw_pact_membersize + } + effect_warsaw_pact_application_approved = yes + + trigger_event = warsaw_pact_application_events.1 + } + if = { + limit = { + has_variable = application_progress_warsaw_pact + var:application_progress_warsaw_pact >= 150 + not = { + warsaw_pact_supporting_countries >= warsaw_pact_membersize + } + } + effect_warsaw_pact_application_rejected = yes + trigger_event = warsaw_pact_application_events.2 + } +} + +onaction_warsaw_ai_voting = { + #warsaw_pact Voting for AI + if = { + limit = { + is_in_warsaw_pact = yes + } + trigger_event = warsaw_pact_ai_voting.1 + } +} + +#todo rewrite this in one if +onaction_warsaw_cohesion_calculation = { + # Military Alliance Calculations / Warsaw Pact + if = { + limit = { + and = { + is_target_in_global_variable_list = { + name = warsaw_pact_members + target = this + } + has_global_variable = warsaw_pact + is_meeting_warsaw_pact_standards = no + } + } + remove_modifier = warsaw_pact_cohesion + remove_modifier = warsaw_pact_not_meeting_standards + add_modifier = { + name = warsaw_pact_not_meeting_standards + } + } + if = { + limit = { + and = { + is_target_in_global_variable_list = { + name = warsaw_pact_members + target = this + } + has_global_variable = warsaw_pact + is_meeting_warsaw_pact_standards = yes + } + } + remove_modifier = warsaw_pact_not_meeting_standards + remove_modifier = warsaw_pact_cohesion + add_modifier = { + name = warsaw_pact_cohesion + multiplier = warsaw_pact_cohesion + } + } +} \ No newline at end of file diff --git a/common/scripted_effects/vanilla_onaction_effects.txt b/common/scripted_effects/vanilla_onaction_effects.txt new file mode 100644 index 000000000..441d4c615 --- /dev/null +++ b/common/scripted_effects/vanilla_onaction_effects.txt @@ -0,0 +1,96 @@ +onaction_ig_petition = { + # IG leader death + random_list = { + 1 = { + trigger_event = { + id = character_events.100 + } + } + 1 = { + } + } + if = { + limit = { + NOR = { + has_variable = gov_petition_fired + has_modifier = modifier_successfully_met_petition_legitimacy + any_interest_group = { + has_modifier = modifier_failed_to_meet_petition + } + has_journal_entry = je_government_petition + } + ig_desires_laws_for_petition = yes + } + if = { + limit = { + has_variable = gov_petition_coin_toss + } + random_list = { + 1 = { + set_variable = gov_petition_fired + trigger_event = { + id = government_petition_events.100 + } + } + 1 = { + } + } + remove_variable = gov_petition_coin_toss + } + else = { + random_list = { + 1 = { + set_variable = gov_petition_fired + trigger_event = { + id = government_petition_events.100 + } + } + 9 = { + } + } + } + } +} + +onaction_kill_unpopular_character = { + + # Take out the trash + every_character_in_exile_pool = { + limit = { + popularity <= 15 + } + kill_character = yes + } +} + +onaction_investment_pool_softcap = { + # Investment Pool Soft Cap + if = { + limit = { + investment_pool > 0 + gold_reserves_limit > 0 + } + set_local_variable = { + name = var_investment_pool_divisor + value = { + value = investment_pool + divide = gold_reserves_limit + multiply = 10 + round = yes + max = 1000 + } + } + } + remove_modifier = full_investment_pool + if = { + limit = { + has_local_variable = var_investment_pool_divisor + local_var:var_investment_pool_divisor >= 10 + } + add_modifier = { + name = full_investment_pool + multiplier = local_var:var_investment_pool_divisor + } + } +} + diff --git a/events/CWP_events/ARoAI/aroai_framework_events.txt b/events/CWP_events/ARoAI/aroai_framework_events.txt index 1b86419f7..6f404bc9f 100644 --- a/events/CWP_events/ARoAI/aroai_framework_events.txt +++ b/events/CWP_events/ARoAI/aroai_framework_events.txt @@ -39,9 +39,10 @@ aroai_framework_events.1 = { } } + + # Once per game - aroai_set_date_of_next_iteration_for_all_countries = yes - aroai_count_barracks_and_conscription_centers_of_all_countries = yes + aroai_framework_once_per_game_effects = yes # Once per day aroai_framework_daily_effects = yes From f9457e796ff89e308981c0a5ed532beca6fe98a3 Mon Sep 17 00:00:00 2001 From: ademblon Date: Sun, 25 Jun 2023 19:16:36 +0200 Subject: [PATCH 4/8] IRAQ : Now a dominion of UK have 10 more oil building start with a few trade routes Iran : Added 3 barracks so they can finish their war Give a slightly better start for columbia venezuela Divided by 5 the ideological opinion value slightly reworked obligation value reworked bureaucracy downsizing Slighyly improved tax management A few bugfixes --- common/ai_strategies/00_default_strategy.txt | 38 ++- common/defines/cwp_defines.txt | 9 + common/history/buildings/07_south_america.txt | 16 +- common/history/buildings/08_middle_east.txt | 72 ++++-- .../diplomacy/00_subject_relationships.txt | 8 + .../history/trade_routes/00_trade_routes.txt | 25 ++ .../script_values/aroai_budgeting_values.txt | 12 + .../aroai_budgeting_values_bureaucracy.txt | 5 + .../aroai_budgeting_effects.txt | 65 ++++- .../aroai_downsizing_effects.txt | 226 ++++++++++-------- .../aroai_construction_triggers.txt | 1 + .../aroai_downsizing_triggers.txt | 5 +- .../scripted_triggers/cwp_bloc_triggers.txt | 13 + 13 files changed, 358 insertions(+), 137 deletions(-) create mode 100644 common/scripted_triggers/cwp_bloc_triggers.txt diff --git a/common/ai_strategies/00_default_strategy.txt b/common/ai_strategies/00_default_strategy.txt index c28d8a4e9..3184a4612 100644 --- a/common/ai_strategies/00_default_strategy.txt +++ b/common/ai_strategies/00_default_strategy.txt @@ -240,7 +240,7 @@ ai_strategy_default = { # How much value does the AI place on an obligation from another country? # Using this value in other strategies will function additively obligation_value = { - value = 15 + value = 0 # Compare ranks - higher rank than us has increased value, lower rank decreased value add = { value = scope:target_country.country_rank @@ -310,6 +310,42 @@ ai_strategy_default = { } add = 5 } + # Bonus if they have same alignment + if = { + limit = { + OR = { + AND = { + is_aligned_USA = yes + scope:target_country = { is_aligned_USA = yes} + } + AND = { + is_aligned_RUS = yes + scope:target_country = { is_aligned_RUS = yes} + } + } + } + add = 10 + } + # Obligation has no value if they have opposite alignment + if = { + limit = { + OR = { + AND = { + is_aligned_RUS = yes + scope:target_country = { is_aligned_USA = yes} + } + AND = { + is_aligned_USA = yes + scope:target_country = { is_aligned_RUS = yes} + } + } + } + subtract = 100 + } + + # TODO remove value if a country with same alignement is an opponent + + # If AI doesn't care about them, they don't want an obligation if = { limit = { diff --git a/common/defines/cwp_defines.txt b/common/defines/cwp_defines.txt index 04cca2e38..4aacd6a52 100644 --- a/common/defines/cwp_defines.txt +++ b/common/defines/cwp_defines.txt @@ -85,6 +85,15 @@ NAI = { # If a front is worth less than this, the AI will not assign any generals to it FRONT_IMPORTANCE_MIN_SCORE = 0.001 + + # diplo play + DIPLO_PLAY_SWAY_UNWANTED_OFFER = -1000 # For being offered unwanted wargoal or obligation + + IDEOLOGICAL_OPINION_LAW_APPROVAL_THRESHOLD = 0.5 # If ruling IGs have at least this much approval/disapproval for a law on average, it affects ideological opinion + IDEOLOGICAL_OPINION_STRONG_STANCE_THRESHOLD = 1.5 # If ruling IGs have at least this much approval/disapproval for a law on average, IDEOLOGICAL_OPINION_STRONG_STANCE_EFFECT_MULT comes into effect + IDEOLOGICAL_OPINION_SAME_LAW_STANCE_EFFECT = 0.1 # Added to ideological opinion for each law both governments approve or disapprove of + IDEOLOGICAL_OPINION_DIFFERENT_LAW_STANCE_EFFECT = -0.2 # Added to ideological opinion for each law where one government approves and the other disapproves + IDEOLOGICAL_OPINION_STRONG_STANCE_EFFECT_MULT = 2 # If AI has a strong stance on a law, multiply its effects on ideological opinion by this } NCharacters = { diff --git a/common/history/buildings/07_south_america.txt b/common/history/buildings/07_south_america.txt index 169bf4193..1f87f4679 100644 --- a/common/history/buildings/07_south_america.txt +++ b/common/history/buildings/07_south_america.txt @@ -715,6 +715,18 @@ } s:STATE_BOLIVAR = { region_state:VNZ = { + create_building = { + building = "building_paper_manufactories" + level = 2 + reserves = 1 + activate_production_methods = { + "pm_base_paper" + "pm_no_automation" + "pm_professional_service_industry_no" + "pm_no_environmental_tech" + "pm_privately_owned_general_industry" + } + } create_building = { building = "building_oil_rig" level = 2 @@ -1143,7 +1155,7 @@ } create_building = { building = "building_railway" - level = 1 + level = 2 reserves = 1 activate_production_methods = { "pm_steam_trains" @@ -1164,7 +1176,7 @@ } create_building = { building = "building_paper_manufactories" - level = 1 + level = 3 reserves = 1 activate_production_methods = { "pm_base_paper" diff --git a/common/history/buildings/08_middle_east.txt b/common/history/buildings/08_middle_east.txt index 95b4bd5fd..cc81bca0f 100644 --- a/common/history/buildings/08_middle_east.txt +++ b/common/history/buildings/08_middle_east.txt @@ -593,13 +593,45 @@ } s:STATE_BAGHDAD = { region_state:IRQ = { + create_building = { + building = "building_government_administration" + level = 3 + reserves = 1 + activate_production_methods = { + "pm_modern_bureaucracy" + "pm_professional_service_industry_no" + "pm_professional_bureaucrats" + } + } + create_building = { + building = "building_rice_farm" + level = 5 + reserves = 1 + activate_production_methods = { + "pm_simple_farming_building_rice_farm" + "pm_no_secondary" + "pm_no_honey_production" + "pm_manual_harvesting" + "pm_government_run_farm" + } + } + create_building = { + building = "building_oil_rig" + level = 10 + reserves = 1 + activate_production_methods = { + "pm_oil_rigs" + "pm_manual_transportation" + "pm_privately_owned_military_industry" + } + } } } s:STATE_MOSUL = { region_state:IRQ = { create_building = { building = "building_wheat_farm" - level = 1 + level = 3 reserves = 1 activate_production_methods = { "pm_simple_farming" @@ -782,7 +814,7 @@ region_state:PER = { create_building = { building = "building_railway" - level = 3 + level = 1 reserves = 1 activate_production_methods = { "pm_steam_trains" @@ -845,7 +877,7 @@ } create_building = { building = "building_government_administration" - level = 1 + level = 2 reserves = 1 activate_production_methods = { "pm_modern_bureaucracy" @@ -862,7 +894,7 @@ region_state:PER = { create_building = { building = "building_railway" - level = 3 + level = 1 reserves = 1 activate_production_methods = { "pm_steam_trains" @@ -904,7 +936,7 @@ } create_building = { building = "building_government_administration" - level = 1 + level = 2 reserves = 1 activate_production_methods = { "pm_modern_bureaucracy" @@ -936,17 +968,6 @@ "pm_government_run_plantation" } } - create_building = { - building = "building_railway" - level = 1 - reserves = 1 - activate_production_methods = { - "pm_steam_trains" - "pm_paved_roads" - "pm_cargo_prioritization" - "pm_privately_owned_building_railway" - } - } create_building = { building = "building_logging_camp" level = 1 @@ -998,7 +1019,7 @@ region_state:PER = { create_building = { building = "building_railway" - level = 3 + level = 1 reserves = 1 activate_production_methods = { "pm_steam_trains" @@ -1183,7 +1204,7 @@ } create_building = { building = "building_railway" - level = 2 + level = 1 reserves = 1 activate_production_methods = { "pm_steam_trains" @@ -1262,6 +1283,21 @@ } s:STATE_IRAKAJEMI = { region_state:PER = { + create_building = { + building = "building_barracks" + level = 3 + reserves = 1 + activate_production_methods = { + "pm_pre_war_infantry" + "pm_no_artillery" + "pm_no_armoured_integration" + "pm_no_motorized" + "pm_no_aircraft" + "pm_no_special_reconnaissance" + "pm_no_communications_support" + "pm_no_formal_medical_support" + } + } create_building = { building = "building_airport" level = 1 diff --git a/common/history/diplomacy/00_subject_relationships.txt b/common/history/diplomacy/00_subject_relationships.txt index 9f9e01fe6..881404d3e 100644 --- a/common/history/diplomacy/00_subject_relationships.txt +++ b/common/history/diplomacy/00_subject_relationships.txt @@ -165,6 +165,14 @@ country = c:NZL # Until 1986 type = dominion } + create_diplomatic_pact = { + country = c:NZL # Until 1986 + type = dominion + } + create_diplomatic_pact = { + country = c:IRQ + type = dominion + } } c:SPA = { create_diplomatic_pact = { diff --git a/common/history/trade_routes/00_trade_routes.txt b/common/history/trade_routes/00_trade_routes.txt index 9c6bfae26..96f2e2d25 100644 --- a/common/history/trade_routes/00_trade_routes.txt +++ b/common/history/trade_routes/00_trade_routes.txt @@ -282,6 +282,31 @@ direction = import target = c:USA.market } + create_trade_route = { + goods = engines + level = 4 + direction = export + target = c:IRQ.market + } + create_trade_route = { + goods = tools + level = 4 + direction = export + target = c:IRQ.market + } + create_trade_route = { + goods = oil + level = 14 + direction = import + target = c:IRQ.market + } + create_trade_route = { + goods = paper + level = 2 + direction = export + target = c:IRQ.market + } + } c:CUB = { create_trade_route = { diff --git a/common/script_values/aroai_budgeting_values.txt b/common/script_values/aroai_budgeting_values.txt index 71ade69aa..6f526c064 100644 --- a/common/script_values/aroai_budgeting_values.txt +++ b/common/script_values/aroai_budgeting_values.txt @@ -386,6 +386,18 @@ aroai_country_budget_surplus_percent = { } } +# +# tag : tag_aroai_country_net_balance_percent +# Called by : +# +aroai_country_net_balance_percent = { + value = weekly_net_fixed_income + divide = { + value = aroai_country_fixed_income + min = 1 + } +} + # Every following function are called by : aroai_budget_health_is_equal_or_higher aroai_country_budget_surplus_for_health_minus_3 = { # from 0 at 0.75 to 0.11 at 1.00 value = 0.11 diff --git a/common/script_values/aroai_budgeting_values_bureaucracy.txt b/common/script_values/aroai_budgeting_values_bureaucracy.txt index c31c7b7fa..9d1c0a0df 100644 --- a/common/script_values/aroai_budgeting_values_bureaucracy.txt +++ b/common/script_values/aroai_budgeting_values_bureaucracy.txt @@ -263,3 +263,8 @@ aroai_bureaucracy_ceiling = { } max = 1000000 } + +aroai_bureaucracy_ceiling_2 = { + value = produced_bureaucracy + multiply = 0.5 +} diff --git a/common/scripted_effects/aroai_budgeting_effects.txt b/common/scripted_effects/aroai_budgeting_effects.txt index 3de453549..19da06b47 100644 --- a/common/scripted_effects/aroai_budgeting_effects.txt +++ b/common/scripted_effects/aroai_budgeting_effects.txt @@ -385,24 +385,65 @@ aroai_manage_tax_and_wage_level_old = { aroai_manage_tax_and_wage_level = { if = { limit = { - has_variable = aroai_country_budget_surplus - is_player = no - NOT = { - has_variable = aroai_budget_settings_cooldown - } + is_player = yes + } + #do nothing + } + else_if = { + limit = { aroai_tax_level_equal_or_lower = { value = 3} } + set_tax_level = high + } + else_if = { + limit = { OR = { aroai_government_wages_are_high = yes aroai_government_wages_are_very_high = yes} } + set_military_wage_level = medium + set_government_wage_level = medium + } + else_if = { + limit = { + aroai_country_net_balance_percent > 0.3 } - + if = { - limit = { not = { tax_level = high } } + limit = { + aroai_government_wages_are_very_low = yes + } + set_military_wage_level = low + set_government_wage_level = low + } + else_if = { + limit = { + aroai_government_wages_are_low = yes + } + set_military_wage_level = medium + set_government_wage_level = medium + } + else_if = { + limit = { tax_level = very_high } set_tax_level = high } - if = { - limit = { not = { aroai_military_wages_are_medium = yes } } - set_military_wage_level = medium + } + else_if = { + limit = { + aroai_country_net_balance_percent < 0.05 } + if = { - limit = { not = { aroai_government_wages_are_medium = yes } } - set_government_wage_level = medium + limit = { tax_level = high } + set_tax_level = very_high + } + else_if = { + limit = { + aroai_government_wages_are_medium = yes + } + set_military_wage_level = low + set_government_wage_level = low + } + else_if = { + limit = { + aroai_government_wages_are_low = yes + } + set_military_wage_level = very_low + set_government_wage_level = very_low } } } \ No newline at end of file diff --git a/common/scripted_effects/aroai_downsizing_effects.txt b/common/scripted_effects/aroai_downsizing_effects.txt index 25b7f1bbe..44f8e8eeb 100644 --- a/common/scripted_effects/aroai_downsizing_effects.txt +++ b/common/scripted_effects/aroai_downsizing_effects.txt @@ -6,144 +6,164 @@ # if the economy of the country is bad, check which gov building we can downsize # aroai_downsize_excessive_buildings = { + # Government administration if = { limit = { - aroai_bureaucracy_load >= 0.75 + aroai_tax_level_equal_or_higher = { + value = 5 + } + bureaucracy >= aroai_bureaucracy_ceiling_2 } - - # Construction sector - if = { + random_scope_state = { limit = { - aroai_tax_level_equal_or_higher = { - value = 2 - } - OR = { - AND = { - aroai_construction_points_current >= aroai_max_wanted_constructions_points_doubled - } - } + aroai_downsize_government_administration = yes } - #TODO make removal more granular and spread over the country - random_scope_state = { - limit = { - aroai_downsize_construction_sector = yes + root = { + change_variable = { + name = aroai_building_government_administration_total + subtract = prev.var:aroai_building_government_administration_level } - root = { - change_variable = { - name = aroai_building_construction_sector_total - subtract = prev.var:aroai_building_construction_sector_level - } + } + set_variable = { + name = aroai_building_government_administration_level + value = 0 + } + remove_building = building_government_administration + } + } + + # Construction sector + if = { + limit = { + aroai_tax_level_equal_or_higher = { + value = 2 + } + OR = { + AND = { + aroai_construction_points_current >= aroai_max_wanted_constructions_points_doubled } - set_variable = { - name = aroai_building_construction_sector_level - value = 0 + } + } + #TODO make removal more granular and spread over the country + random_scope_state = { + limit = { + aroai_downsize_construction_sector = yes + } + root = { + change_variable = { + name = aroai_building_construction_sector_total + subtract = prev.var:aroai_building_construction_sector_level } - remove_building = building_construction_sector - root = { - if = { - limit = { - has_local_variable = aroai_construction_is_allowed - NOR = { - AND = { - aroai_is_regular_construction_allowed = yes - aroai_free_construction_points > 0 - } - aroai_is_critical_construction_allowed = yes + } + set_variable = { + name = aroai_building_construction_sector_level + value = 0 + } + remove_building = building_construction_sector + root = { + if = { + limit = { + has_local_variable = aroai_construction_is_allowed + NOR = { + AND = { + aroai_is_regular_construction_allowed = yes + aroai_free_construction_points > 0 } + aroai_is_critical_construction_allowed = yes } - remove_local_variable = aroai_construction_is_allowed } + remove_local_variable = aroai_construction_is_allowed } } } + } - # Port - if = { + # Port + if = { + limit = { + aroai_tax_level_equal_or_higher = { + value = 4 + } + weekly_net_fixed_income < 50000 + aroai_total_convoy_available_value > 1500 + } + random_scope_state = { limit = { - aroai_tax_level_equal_or_higher = { - value = 4 - } - weekly_net_fixed_income < 50000 - aroai_total_convoy_available_value > 1500 + aroai_downsize_port = yes } - random_scope_state = { - limit = { - aroai_downsize_port = yes + root = { + change_variable = { + name = aroai_building_port_total + subtract = prev.var:aroai_building_port_level } - root = { - change_variable = { - name = aroai_building_port_total - subtract = prev.var:aroai_building_port_level - } - } - set_variable = { - name = aroai_building_port_level - value = 0 - } - remove_building = building_port } + set_variable = { + name = aroai_building_port_level + value = 0 + } + remove_building = building_port } + } - # Barracks - if = { + # Barracks + if = { + limit = { + aroai_tax_level_equal_or_higher = { + value = 3 + } + aroai_is_using_military_forces = no + aroai_building_barracks_spending_value >= aroai_building_barracks_spending_excess + } + random_scope_state = { limit = { - aroai_tax_level_equal_or_higher = { - value = 3 - } - aroai_is_using_military_forces = no - aroai_building_barracks_spending_value >= aroai_building_barracks_spending_excess + aroai_downsize_barracks = yes } - random_scope_state = { - limit = { - aroai_downsize_barracks = yes + root = { + change_variable = { + name = aroai_building_barracks_total + subtract = prev.var:aroai_building_barracks_level } - root = { - change_variable = { - name = aroai_building_barracks_total - subtract = prev.var:aroai_building_barracks_level - } - } - set_variable = { - name = aroai_building_barracks_level - value = 0 - } - remove_building = building_barracks } + set_variable = { + name = aroai_building_barracks_level + value = 0 + } + remove_building = building_barracks } + } - if = { limit = { THIS = c:SWE } + if = { limit = { THIS = c:SWE } - # debug_log = "aroai_building_naval_base_spending_excess [THIS.ScriptValue('aroai_building_naval_base_spending_excess')]" - # debug_log = "aroai_building_naval_base_spending_value [THIS.ScriptValue('aroai_building_naval_base_spending_value')]" - } + # debug_log = "aroai_building_naval_base_spending_excess [THIS.ScriptValue('aroai_building_naval_base_spending_excess')]" + # debug_log = "aroai_building_naval_base_spending_value [THIS.ScriptValue('aroai_building_naval_base_spending_value')]" + } - # Naval base - if = { + # Naval base + if = { + limit = { + aroai_tax_level_equal_or_higher = { + value = 3 + } + aroai_is_using_military_forces = no + aroai_building_naval_base_spending_value >= aroai_building_naval_base_spending_excess + } + random_scope_state = { limit = { - aroai_tax_level_equal_or_higher = { - value = 3 - } - aroai_is_using_military_forces = no - aroai_building_naval_base_spending_value >= aroai_building_naval_base_spending_excess + aroai_downsize_naval_base = yes } - random_scope_state = { - limit = { - aroai_downsize_naval_base = yes - } - root = { - change_variable = { - name = aroai_building_naval_base_total - subtract = prev.var:aroai_building_naval_base_level - } - } - set_variable = { - name = aroai_building_naval_base_level - value = 0 + root = { + change_variable = { + name = aroai_building_naval_base_total + subtract = prev.var:aroai_building_naval_base_level } - remove_building = building_naval_base } + set_variable = { + name = aroai_building_naval_base_level + value = 0 + } + remove_building = building_naval_base } } diff --git a/common/scripted_triggers/aroai_construction_triggers.txt b/common/scripted_triggers/aroai_construction_triggers.txt index 9c8366283..ddd04f394 100644 --- a/common/scripted_triggers/aroai_construction_triggers.txt +++ b/common/scripted_triggers/aroai_construction_triggers.txt @@ -4,6 +4,7 @@ # aroai_requirements_for_construction_in_state = { owner = root + has_variable = aroai_building_type_occupied_levels OR = { # We don't care about workforce $workforce$ = 0 diff --git a/common/scripted_triggers/aroai_downsizing_triggers.txt b/common/scripted_triggers/aroai_downsizing_triggers.txt index 06e55c40d..6c503c9f3 100644 --- a/common/scripted_triggers/aroai_downsizing_triggers.txt +++ b/common/scripted_triggers/aroai_downsizing_triggers.txt @@ -6,7 +6,9 @@ # aroai_downsize_government_administration = { var:aroai_building_government_administration_level > 0 - var:aroai_building_government_administration_level <= aroai_building_government_administration_downsizing_threshold + #var:aroai_building_government_administration_level <= aroai_building_government_administration_downsizing_threshold + + #TODO fix in case of every state lacking tax capacity (think india pakistan china etc) any_scope_building = { is_building_type = building_government_administration prev.aroai_tax_capacity_balance_value >= aroai_tax_capacity_from_government_administration @@ -15,6 +17,7 @@ aroai_downsize_government_administration = { NOT = { root = { any_scope_state = { + has_variable = aroai_building_government_administration_level var:aroai_building_government_administration_level > 0 var:aroai_building_government_administration_level < aroai_current_government_administration_level any_scope_building = { diff --git a/common/scripted_triggers/cwp_bloc_triggers.txt b/common/scripted_triggers/cwp_bloc_triggers.txt new file mode 100644 index 000000000..389c9ea64 --- /dev/null +++ b/common/scripted_triggers/cwp_bloc_triggers.txt @@ -0,0 +1,13 @@ +is_aligned_USA = { + has_diplomatic_pact = { + who = c:USA + type = diplomatic_alignment + } +} + +is_aligned_RUS = { + has_diplomatic_pact = { + who = c:RUS + type = diplomatic_alignment + } +} \ No newline at end of file From b81bf7a2a4c24248d01fe77a4d62dad20931ea6f Mon Sep 17 00:00:00 2001 From: JackEPepper <100242026+JackEPepper@users.noreply.github.com> Date: Sun, 25 Jun 2023 13:43:26 -0400 Subject: [PATCH 5/8] feat: removed economic events --- common/on_actions/00_code_on_actions.txt | 3 - events/CWP_events/economic_events.txt | 259 ----------------------- 2 files changed, 262 deletions(-) diff --git a/common/on_actions/00_code_on_actions.txt b/common/on_actions/00_code_on_actions.txt index abfee4294..ffc98d510 100644 --- a/common/on_actions/00_code_on_actions.txt +++ b/common/on_actions/00_code_on_actions.txt @@ -272,9 +272,6 @@ on_half_yearly_pulse_country = { } } economic_events.1 # Farming Subsidies - economic_events.3 # Credit Expansion - economic_events.5 # Credit Crunch - economic_events.6 # Minor Economic Expansion } effect = { } diff --git a/events/CWP_events/economic_events.txt b/events/CWP_events/economic_events.txt index 109cd541b..d9301397f 100644 --- a/events/CWP_events/economic_events.txt +++ b/events/CWP_events/economic_events.txt @@ -112,263 +112,4 @@ economic_events.2 = { months = normal_modifier_time } } -} - -economic_events.3 = { - # Credit Expansion - type = country_event - title = economic_events.3.t - desc = economic_events.3.d - flavor = economic_events.3.f - icon = "gfx/interface/icons/event_icons/event_trade.dds" - event_image = { - video = "gfx/event_pictures/middleeast_courtroom_upheaval.bk2" #todo: use appriorate pic - } - on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear" - on_opened_soundeffect = "event:/SFX/Events/unspecific/leader_speaking_to_a_group_of_people" - duration = 3 - trigger = { - OR = { - has_law = law_type:law_free_market - has_law = law_type:law_interventionism - } - NOR = { - has_modifier = major_economic_boom - has_modifier = minor_economic_boom - has_modifier = financial_downturn - has_modifier = economic_downturn - } - ig:ig_capitalists= { - is_marginal = no - } - any_scope_state = { - AND = { - market = { - mg:financial_services = { - market_goods_pricier < -0.5 - } - } - market_access > 0.95 - has_building = building_financial_services - } - } - } - immediate = { - trigger_event = { - id = economic_events.4 - days = { - 800 - 1700 - } - } - } - option = { - name = economic_events.3.a - add_modifier = { - name = major_economic_boom - months = normal_modifier_time - } - } - option = { - name = economic_events.3.b - default_option = yes - add_modifier = { - name = minor_economic_boom - months = normal_modifier_time - } - } -} - -economic_events.4 = { - # Banks Over-Leveraged - type = country_event - title = economic_events.4.t - desc = economic_events.4.d - flavor = economic_events.4.f - icon = "gfx/interface/icons/event_icons/event_trade.dds" - event_image = { - video = "gfx/event_pictures/middleeast_courtroom_upheaval.bk2" #todo: use appriorate pic - } - on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear" - on_opened_soundeffect = "event:/SFX/Events/unspecific/leader_speaking_to_a_group_of_people" - duration = 3 - trigger = { - NOR = { - has_modifier = financial_downturn - has_modifier = economic_downturn - has_modifier = minor_economic_boom - } - OR = { - has_law = law_type:law_free_market - has_law = law_type:law_interventionism - } - ig:ig_capitalists= { - is_marginal = no - } - has_modifier = major_economic_boom - any_scope_state = { - AND = { - has_building = building_financial_services - } - } - } - option = { - name = economic_events.4.a - trigger = { - has_law = law_type:law_interventionism - } - remove_modifier = major_economic_boom - add_modifier = { - name = financial_downturn - months = short_modifier_time - is_decaying = yes - } - add_modifier = { - name = financial_bailouts - months = short_modifier_time - is_decaying = yes - } - } - option = { - name = economic_events.4.b - default_option = yes - remove_modifier = major_economic_boom - add_modifier = { - name = economic_downturn - months = short_modifier_time - is_decaying = yes - } - } -} - -economic_events.5 = { - # Credit Crunch - type = country_event - title = economic_events.5.t - desc = economic_events.5.d - flavor = economic_events.5.f - icon = "gfx/interface/icons/event_icons/event_trade.dds" - event_image = { - video = "gfx/event_pictures/middleeast_courtroom_upheaval.bk2" #todo: use appriorate pic - } - on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear" - on_opened_soundeffect = "event:/SFX/Events/unspecific/leader_speaking_to_a_group_of_people" - duration = 3 - trigger = { - NOR = { - has_modifier = major_economic_boom - has_modifier = minor_economic_boom - has_modifier = financial_downturn - has_modifier = economic_downturn - } - OR = { - has_law = law_type:law_free_market - has_law = law_type:law_interventionism - } - ig:ig_capitalists= { - is_marginal = no - } - any_scope_state = { - AND = { - market = { - mg:financial_services = { - market_goods_pricier > 0.5 - } - } - market_access > 0.95 - has_building = building_financial_services - } - } - } - option = { - name = economic_events.5.a - trigger = { - has_law = law_type:law_interventionism - } - add_modifier = { - name = financial_downturn - months = short_modifier_time - is_decaying = yes - } - add_modifier = { - name = financial_bailouts - months = short_modifier_time - is_decaying = yes - } - } - option = { - default_option = yes - name = economic_events.5.b - add_modifier = { - name = economic_downturn - months = short_modifier_time - } - } -} - -economic_events.6 = { - # Minor Economic Boom - type = country_event - title = economic_events.6.t - desc = economic_events.6.d - flavor = economic_events.6.f - icon = "gfx/interface/icons/event_icons/event_trade.dds" - event_image = { - video = "gfx/event_pictures/middleeast_courtroom_upheaval.bk2" #todo: use appriorate pic - } - on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear" - on_opened_soundeffect = "event:/SFX/Events/unspecific/leader_speaking_to_a_group_of_people" - duration = 3 - trigger = { - NOR = { - has_modifier = major_economic_boom - has_modifier = minor_economic_boom - has_modifier = financial_downturn - has_modifier = economic_downturn - } - ig:ig_capitalists= { - is_marginal = no - } - OR = { - has_law = law_type:law_free_market - has_law = law_type:law_interventionism - } - any_scope_state = { - AND = { - market = { - mg:financial_services = { - market_goods_pricier < 0 - } - } - market_access > 0.95 - has_building = building_financial_services - } - } - } - option = { - name = economic_events.6.a - add_modifier = { - name = major_economic_boom - months = short_modifier_time - is_decaying = yes - } - hidden_effect = { - trigger_event = { - id = economic_events.4 - days = { - 365 - 3650 - } - } - } - } - option = { - default_option = yes - name = economic_events.6.b - add_modifier = { - name = minor_economic_boom - months = normal_modifier_time - is_decaying = yes - } - } } \ No newline at end of file From cbc23d1cbd2b3e464c4bedc24e4860cde93152e6 Mon Sep 17 00:00:00 2001 From: JackEPepper <100242026+JackEPepper@users.noreply.github.com> Date: Sun, 25 Jun 2023 13:44:11 -0400 Subject: [PATCH 6/8] fix: divide by zero protection --- common/scripted_effects/cwp_onaction_effects.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/common/scripted_effects/cwp_onaction_effects.txt b/common/scripted_effects/cwp_onaction_effects.txt index 92a2a225f..0fd86c933 100644 --- a/common/scripted_effects/cwp_onaction_effects.txt +++ b/common/scripted_effects/cwp_onaction_effects.txt @@ -483,6 +483,7 @@ onaction_urbanization_modifier = { divide = { value = arable_land multiply = 100 + add = 1 add = total_urbanization } add = -0.5 From 70f6709410df2d88891f5a13d3e3840db444688b Mon Sep 17 00:00:00 2001 From: JackEPepper <100242026+JackEPepper@users.noreply.github.com> Date: Sun, 25 Jun 2023 13:44:47 -0400 Subject: [PATCH 7/8] fix: scope exists protection --- common/scripted_triggers/cwp_bloc_triggers.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/scripted_triggers/cwp_bloc_triggers.txt b/common/scripted_triggers/cwp_bloc_triggers.txt index 389c9ea64..c12d4b832 100644 --- a/common/scripted_triggers/cwp_bloc_triggers.txt +++ b/common/scripted_triggers/cwp_bloc_triggers.txt @@ -1,4 +1,5 @@ is_aligned_USA = { + exists = c:USA has_diplomatic_pact = { who = c:USA type = diplomatic_alignment @@ -6,6 +7,7 @@ } is_aligned_RUS = { + exists = c:RUS has_diplomatic_pact = { who = c:RUS type = diplomatic_alignment From 12d7f64df45fb5c2436eb07ef830364ca9ab6ef5 Mon Sep 17 00:00:00 2001 From: ademblon Date: Sun, 25 Jun 2023 20:26:49 +0200 Subject: [PATCH 8/8] refactored dom onaction effects --- common/history/global/00_global.txt | 4 ++-- common/on_actions/00_code_on_actions.txt | 4 ++-- common/scripted_effects/cwp_pollution_effects.txt | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/history/global/00_global.txt b/common/history/global/00_global.txt index e013b14c7..66395220c 100644 --- a/common/history/global/00_global.txt +++ b/common/history/global/00_global.txt @@ -115,8 +115,8 @@ GLOBAL = { # -1 < 0 < 1 every_country = { every_scope_state = { - calc_starting_habitability = yes - set_habitability_effects = yes + onaction_calc_starting_habitability = yes + onaction_set_habitability_effects = yes } } ## Dynamic Peace deal State Setup diff --git a/common/on_actions/00_code_on_actions.txt b/common/on_actions/00_code_on_actions.txt index abfee4294..1f06c1f7e 100644 --- a/common/on_actions/00_code_on_actions.txt +++ b/common/on_actions/00_code_on_actions.txt @@ -1789,7 +1789,7 @@ on_monthly_pulse_state = { onaction_slums_modifier = yes # Habitability Calculations - calc_monthly_habitability = yes - set_habitability_effects = yes + onaction_calc_monthly_habitability = yes + onaction_set_habitability_effects = yes } } diff --git a/common/scripted_effects/cwp_pollution_effects.txt b/common/scripted_effects/cwp_pollution_effects.txt index 1bbc6965d..961b704c2 100644 --- a/common/scripted_effects/cwp_pollution_effects.txt +++ b/common/scripted_effects/cwp_pollution_effects.txt @@ -1,5 +1,5 @@ # scope:state -set_habitability_effects = { +onaction_set_habitability_effects = { # Get the habitability of the region if = { limit = { @@ -47,7 +47,7 @@ set_habitability_effects = { #scope:state #This is process power intensive, only run this at the start of the game -calc_starting_habitability = { +onaction_calc_starting_habitability = { set_variable = { name = max_habitability value = 0.5 @@ -92,7 +92,7 @@ calc_starting_habitability = { } } -calc_monthly_habitability = { +onaction_calc_monthly_habitability = { if = { limit = { has_variable = habitability