automation_select_bureaucracy = { if = { limit = { budget_law_parliament_change_allowed = yes if = { limit = { check_variable = { automation_budget_next_level > automation_budget_current_level } } bureau_increase_blocked = no } else = { bureau_decrease_blocked = no } if = { limit = { original_tag = DEN } if = { limit = { check_variable = { automation_budget_next_level < 4 } } NOT = { has_idea = DEN_direct_governance_idea } } if = { limit = { check_variable = { automation_budget_next_level = 1 } } NOT = { has_idea = DEN_special_municipal_districts_idea } } } if = { limit = { original_tag = FRA } if = { limit = { check_variable = { automation_budget_next_level < 3 } } NOT = { has_idea = FRA_administrative_reforms_2 } NOT = { has_idea = FRA_idea_central } } if = { limit = { check_variable = { automation_budget_next_level = 1 } } NOT = { has_idea = FRA_administrative_reforms_1 } } if = { limit = { check_variable = { automation_budget_next_level > 3 } } NOT = { has_idea = FRA_idea_decentral } } } if = { limit = { check_variable = { automation_budget_next_level > 3 } } GER_Grundgesetz_allows_budget_law_change = yes if = { limit = { original_tag = SIN } NOT = { has_idea = SIN_decentralize_the_government_idea } } } } add_to_temp_array = { automation_budget_laws = token:bureau_01 } add_to_temp_array = { automation_budget_costs = 200 } add_to_temp_array = { automation_budget_laws = token:bureau_02 } add_to_temp_array = { automation_budget_costs = 80 } add_to_temp_array = { automation_budget_laws = token:bureau_03 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:bureau_04 } add_to_temp_array = { automation_budget_costs = 30 } add_to_temp_array = { automation_budget_laws = token:bureau_05 } add_to_temp_array = { automation_budget_costs = 10 } } } automation_select_crime_fighting = { if = { limit = { budget_law_parliament_change_allowed = yes if = { limit = { check_variable = { automation_budget_next_level > automation_budget_current_level } } police_increase_blocked = no } else = { police_decrease_blocked = no } if = { limit = { check_variable = { automation_budget_next_level = 1 } } GER_Grundgesetz_allows_budget_law_change = yes } } add_to_temp_array = { automation_budget_laws = token:police_01 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:police_02 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:police_03 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:police_04 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:police_05 } add_to_temp_array = { automation_budget_costs = 50 } } } automation_select_education_budget = { if = { limit = { budget_law_parliament_change_allowed = yes if = { limit = { check_variable = { automation_budget_next_level > automation_budget_current_level } } edu_increase_blocked = no } else = { edu_decrease_blocked = no } if = { limit = { original_tag = SIN check_variable = { automation_budget_next_level < 3 } } NOT = { has_idea = SIN_centralized_education_idea } } } add_to_temp_array = { automation_budget_laws = token:edu_01 } add_to_temp_array = { automation_budget_costs = 200 } add_to_temp_array = { automation_budget_laws = token:edu_02 } add_to_temp_array = { automation_budget_costs = 80 } add_to_temp_array = { automation_budget_laws = token:edu_03 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:edu_04 } add_to_temp_array = { automation_budget_costs = 30 } add_to_temp_array = { automation_budget_laws = token:edu_05 } add_to_temp_array = { automation_budget_costs = 10 } } } automation_select_health_budget = { if = { limit = { budget_law_parliament_change_allowed = yes if = { limit = { check_variable = { automation_budget_next_level > automation_budget_current_level } } health_increase_blocked = no } else = { health_decrease_blocked = no } if = { limit = { check_variable = { automation_budget_next_level < 3 } } NOT = { has_idea = fully_nationalized_healthcare } NOT = { has_idea = partially_nationalized_healthcare } } else_if = { limit = { check_variable = { automation_budget_next_level = 3 } } NOT = { has_idea = fully_nationalized_healthcare } } else_if = { limit = { check_variable = { automation_budget_next_level = 4 } } NOT = { has_idea = fully_privatized_healthcare } } else = { NOT = { has_idea = fully_privatized_healthcare } NOT = { has_idea = partially_privatized_healthcare } } } add_to_temp_array = { automation_budget_laws = token:health_01 } add_to_temp_array = { automation_budget_costs = 200 } add_to_temp_array = { automation_budget_laws = token:health_02 } add_to_temp_array = { automation_budget_costs = 80 } add_to_temp_array = { automation_budget_laws = token:health_03 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:health_04 } add_to_temp_array = { automation_budget_costs = 40 } add_to_temp_array = { automation_budget_laws = token:health_05 } add_to_temp_array = { automation_budget_costs = 30 } add_to_temp_array = { automation_budget_laws = token:health_06 } add_to_temp_array = { automation_budget_costs = 10 } } } automation_select_social_budget = { if = { limit = { budget_law_parliament_change_allowed = yes if = { limit = { check_variable = { automation_budget_next_level > automation_budget_current_level } } social_increase_blocked = no } else = { social_decrease_blocked = no } if = { limit = { original_tag = DEN check_variable = { automation_budget_next_level = 1 } } NOT = { has_idea = DEN_intensify_the_flexicurity_idea } } } add_to_temp_array = { automation_budget_laws = token:social_01 } add_to_temp_array = { automation_budget_costs = 200 } add_to_temp_array = { automation_budget_laws = token:social_02 } add_to_temp_array = { automation_budget_costs = 80 } add_to_temp_array = { automation_budget_laws = token:social_03 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:social_04 } add_to_temp_array = { automation_budget_costs = 40 } add_to_temp_array = { automation_budget_laws = token:social_05 } add_to_temp_array = { automation_budget_costs = 30 } add_to_temp_array = { automation_budget_laws = token:social_06 } add_to_temp_array = { automation_budget_costs = 10 } } } automation_select_military_spending = { if = { limit = { military_law_parliament_change_allowed = yes if = { limit = { check_variable = { automation_budget_next_level > automation_budget_current_level } } defence_increase_blocked = no } else = { defence_decrease_blocked = no } if = { limit = { check_variable = { automation_budget_next_level = 1 } } has_idea = no_military } if = { limit = { original_tag = GER check_variable = { automation_budget_next_level > 4 } } NOT = { has_idea = german_legacy } } if = { limit = { check_variable = { automation_budget_next_level > 8 } } OR = { has_war = yes AND = { check_variable = { automation_budget_next_level = 9 } threat > 0.4 } AND = { check_variable = { automation_budget_next_level = 10 } threat > 0.6 } any_of_scopes = { array = ROOT.potential_and_current_enemies is_justifying_wargoal_against = ROOT strength_ratio = { tag = ROOT ratio > 2.0 } } } } } add_to_temp_array = { automation_budget_laws = token:defence_00 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:defence_01 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:defence_02 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:defence_03 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:defence_04 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:defence_05 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:defence_06 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:defence_07 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:defence_08 } add_to_temp_array = { automation_budget_costs = 50 } add_to_temp_array = { automation_budget_laws = token:defence_09 } add_to_temp_array = { automation_budget_costs = 50 } } } automation_review_budget = { set_temp_variable = { automation_budget_next_level = automation_budget_current_level } if = { limit = { check_variable = { automation_budget_current_level < automation_budget_expected_level } check_variable = { treasury_rate > 0 } NOT = { has_active_mission = bankruptcy_incoming_collapse } OR = { check_variable = { automation_budget_category = 5 } NOT = { has_active_mission = cheap_loan_from_the_imf_mission } } } add_to_temp_variable = { automation_budget_next_level = 1 } } else_if = { limit = { check_variable = { automation_budget_current_level > automation_budget_expected_level } } subtract_from_temp_variable = { automation_budget_next_level = 1 } } if = { limit = { NOT = { check_variable = { automation_budget_next_level = automation_budget_current_level } } } clear_temp_array = automation_budget_laws clear_temp_array = automation_budget_costs if = { limit = { check_variable = { automation_budget_category = 0 } } automation_select_bureaucracy = yes } else_if = { limit = { check_variable = { automation_budget_category = 1 } } automation_select_crime_fighting = yes } else_if = { limit = { check_variable = { automation_budget_category = 2 } } automation_select_education_budget = yes } else_if = { limit = { check_variable = { automation_budget_category = 3 } } automation_select_health_budget = yes } else_if = { limit = { check_variable = { automation_budget_category = 4 } } automation_select_social_budget = yes } else_if = { limit = { check_variable = { automation_budget_category = 5 } } automation_select_military_spending = yes } if = { limit = { check_variable = { automation_budget_next_level > 0 } check_variable = { var = automation_budget_next_level value = automation_budget_laws^num compare = less_than_or_equals } } set_temp_variable = { automation_budget_index = { value = automation_budget_next_level subtract = 1 } } set_temp_variable = { automation_budget_law = automation_budget_laws^automation_budget_index } set_temp_variable = { automation_law_pp_cost = { value = automation_budget_costs^automation_budget_index multiply = automation_law_cost_factor max = 0 } } set_temp_variable = { automation_law_available_pp = { value = political_power subtract = automation_pp_reserve } } if = { limit = { check_variable = { var = automation_law_available_pp value = automation_law_pp_cost compare = greater_than_or_equals } } multiply_temp_variable = { automation_law_pp_cost = -1 } add_political_power = automation_law_pp_cost meta_effect = { text = { add_ideas = [LAW] } LAW = "[?automation_budget_law.GetTokenKey]" } set_temp_variable = { automation_budget_changed = 1 } } } } } automation_economy_weekly = { if = { limit = { OR = { has_country_flag = automation_population_tax has_country_flag = automation_corporate_tax } } calculate_tax_adjustments = yes if = { limit = { has_country_flag = automation_population_tax NOT = { has_country_flag = no_personal_tax_rate_change } has_political_power > tax_rate_change NOT = { check_variable = { pop_tax_change = 0 } } } set_temp_variable = { automation_tax_next_rate = { value = population_tax_rate add = pop_tax_change } } set_temp_variable = { automation_tax_available_pp = { value = political_power subtract = automation_pp_reserve } } if = { limit = { check_variable = { var = automation_tax_available_pp value = tax_rate_change compare = greater_than_or_equals } check_variable = { automation_tax_next_rate > -1 } check_variable = { automation_tax_next_rate < 51 } } set_temp_variable = { automation_tax_pp_cost = { value = tax_rate_change multiply = -1 } } add_political_power = automation_tax_pp_cost set_temp_variable = { previous_tax_rate = population_tax_rate } add_to_variable = { population_tax_rate = pop_tax_change } clamp_variable = { var = population_tax_rate min = 0 max = 50 } ingame_update_setup = yes if = { limit = { is_debug = yes } log = "[GetDateText]: [THIS.GetName]: DEBUG: Automated population tax change: Old Taxes: [?previous_tax_rate]%, New Taxes: [?population_tax_rate]% (Balance: [?treasury_rate])" } } } if = { limit = { has_country_flag = automation_corporate_tax NOT = { has_country_flag = no_corporate_tax_rate_change } has_political_power > tax_rate_change NOT = { check_variable = { corp_tax_change = 0 } } } set_temp_variable = { automation_tax_next_rate = { value = corporate_tax_rate add = corp_tax_change } } set_temp_variable = { automation_tax_available_pp = { value = political_power subtract = automation_pp_reserve } } if = { limit = { check_variable = { var = automation_tax_available_pp value = tax_rate_change compare = greater_than_or_equals } check_variable = { automation_tax_next_rate > -1 } check_variable = { automation_tax_next_rate < 51 } } set_temp_variable = { automation_tax_pp_cost = { value = tax_rate_change multiply = -1 } } add_political_power = automation_tax_pp_cost set_temp_variable = { previous_tax_rate = corporate_tax_rate } add_to_variable = { corporate_tax_rate = corp_tax_change } clamp_variable = { var = corporate_tax_rate min = 0 max = 50 } ingame_update_setup = yes if = { limit = { is_debug = yes } log = "[GetDateText]: [THIS.GetName]: DEBUG: Automated corporate tax change: Old Taxes: [?previous_tax_rate]%, New Taxes: [?corporate_tax_rate]% (Balance: [?treasury_rate])" } } } } set_temp_variable = { automation_budget_changed = 0 } for_loop_effect = { start = 0 end = 5 value = automation_budget_offset set_temp_variable = { automation_budget_category = { value = automation_budget_next_category add = automation_budget_offset mod = 6 } } if = { limit = { check_variable = { automation_budget_changed = 0 } } if = { limit = { check_variable = { automation_budget_category = 0 } has_country_flag = automation_budget_bureaucracy has_variable = bureau_law has_variable = expected_adm_spending } set_temp_variable = { automation_budget_current_level = bureau_law } set_temp_variable = { automation_budget_expected_level = expected_adm_spending } set_temp_variable = { automation_law_cost_factor = { value = 1 add = modifier@bureaucracy_cost_factor } } automation_review_budget = yes } else_if = { limit = { check_variable = { automation_budget_category = 1 } has_country_flag = automation_budget_crime_fighting has_variable = police_law has_variable = expected_police_spending } set_temp_variable = { automation_budget_current_level = police_law } set_temp_variable = { automation_budget_expected_level = expected_police_spending } set_temp_variable = { automation_law_cost_factor = { value = 1 add = modifier@crime_fighting_cost_factor } } automation_review_budget = yes } else_if = { limit = { check_variable = { automation_budget_category = 2 } has_country_flag = automation_budget_education_budget has_variable = education_law has_variable = expected_edu_spending } set_temp_variable = { automation_budget_current_level = education_law } set_temp_variable = { automation_budget_expected_level = expected_edu_spending } set_temp_variable = { automation_law_cost_factor = { value = 1 add = modifier@education_budget_cost_factor } } automation_review_budget = yes } else_if = { limit = { check_variable = { automation_budget_category = 3 } has_country_flag = automation_budget_health_budget has_variable = health_law has_variable = expected_health_spending } set_temp_variable = { automation_budget_current_level = health_law } set_temp_variable = { automation_budget_expected_level = expected_health_spending } set_temp_variable = { automation_law_cost_factor = { value = 1 add = modifier@health_budget_cost_factor } } automation_review_budget = yes } else_if = { limit = { check_variable = { automation_budget_category = 4 } has_country_flag = automation_budget_social_budget has_variable = social_law has_variable = expected_welfare_spending } set_temp_variable = { automation_budget_current_level = social_law } set_temp_variable = { automation_budget_expected_level = expected_welfare_spending } set_temp_variable = { automation_law_cost_factor = { value = 1 add = modifier@social_budget_cost_factor } } automation_review_budget = yes } else_if = { limit = { check_variable = { automation_budget_category = 5 } has_country_flag = automation_budget_military_spending has_variable = military_law has_variable = expected_military_sp } set_temp_variable = { automation_budget_current_level = military_law } set_temp_variable = { automation_budget_expected_level = expected_military_sp } set_temp_variable = { automation_law_cost_factor = { value = 1 add = modifier@military_spending_cost_factor } } automation_review_budget = yes } } } if = { limit = { check_variable = { automation_budget_changed = 1 } } md_check_spending_alerts = yes } set_variable = { automation_budget_next_category = { value = automation_budget_next_category add = 1 mod = 6 } } }