#written by Traiano # Roman border focuses claim states individually, but each controller should receive only one wargoal. ITA_queue_roman_wargoal_target = { controller = { if = { limit = { NOT = { tag = ITA } NOT = { is_in_faction_with = ITA } NOT = { is_in_array = { ITA.ITA_roman_wargoal_targets = THIS } } } add_to_array = { ITA.ITA_roman_wargoal_targets = THIS } } } } ITA_grant_roman_wargoals = { custom_effect_tooltip = ITA_roman_wargoals_tt hidden_effect = { for_each_scope_loop = { array = ITA_roman_wargoal_targets ITA = { set_temp_variable = { wargoal_on = PREV } add_threat_from_wargoal_effect = yes create_wargoal = { type = take_claimed_state target = PREV } } } clear_array = ITA_roman_wargoal_targets } } #mafia #police effectivness in each region is based on the italian baseline that is affected by focuses and laws #mafia_strength is used to calculate industrial focus costs and police effectivness and mafia dynamic modifier maluses update_mafia_strength = { set_variable = { mafia_strength = { value = cosa_nostra_strength add = camorra_strength add = ndrangheta_strength add = sacra_corona_unita_strength multiply = 0.25 } } set_variable = { mafia_strength_stab_var = { value = mafia_strength multiply = -0.0025 } } set_variable = { mafia_strength_construction_var = { value = mafia_strength multiply = -0.5 } } set_variable = { mafia_strength_investment_var = { value = mafia_strength multiply = 0.5 } } set_variable = { mafia_strength_pp_var = { value = mafia_strength multiply = -0.5 } } set_variable = { mafia_strength_lega_drift_var = { value = mafia_strength multiply = 0.1 } } set_variable = { mafia_strength_ai_factor_var = { value = 1 subtract = mafia_strength multiply = { value = 1 subtract = mafia_strength } } } if = { limit = { is_ai = no } update_ita_mafia_dirty_variable = yes } } update_ita_mafia_dirty_variable = { if = { limit = { check_variable = { global.ITA_mafia_dirty_update_var < 10000 } } add_to_variable = { global.ITA_mafia_dirty_update_var = 1 } } else = { set_variable = { global.ITA_mafia_dirty_update_var = 1 } } } update_police_effectiveness = { update_mafia_strength = yes set_variable = { police_effectivness = police_effectivness_base } if = { limit = { has_idea = police_01 } add_to_variable = { police_effectivness = -0.25 } } else_if = { limit = { has_idea = police_02 } add_to_variable = { police_effectivness = -0.05 } } else_if = { limit = { has_idea = police_03 } add_to_variable = { police_effectivness = 0.05 } } else_if = { limit = { has_idea = police_04 } add_to_variable = { police_effectivness = 0.15 } } else_if = { limit = { has_idea = police_05 } add_to_variable = { police_effectivness = 0.3 } } if = { limit = { has_idea = corruption_level_01 } add_to_variable = { police_effectivness = -0.025 } } else_if = { limit = { has_idea = corruption_level_02 } add_to_variable = { police_effectivness = -0.05 } } else_if = { limit = { has_idea = corruption_level_03 } add_to_variable = { police_effectivness = -0.075 } } else_if = { limit = { has_idea = corruption_level_04 } add_to_variable = { police_effectivness = -0.1 } } else_if = { limit = { has_idea = corruption_level_05 } add_to_variable = { police_effectivness = -0.125 } } else_if = { limit = { has_idea = corruption_level_06 } add_to_variable = { police_effectivness = -0.15 } } else_if = { limit = { has_idea = corruption_level_07 } add_to_variable = { police_effectivness = -0.175 } } else_if = { limit = { has_idea = corruption_level_08 } add_to_variable = { police_effectivness = -0.2 } } else_if = { limit = { has_idea = corruption_level_09 } add_to_variable = { police_effectivness = -0.225 } } else_if = { limit = { has_idea = corruption_level_10 } add_to_variable = { police_effectivness = -0.25 } } if = { limit = { has_country_flag = ITA_concentrating_on_camorra } add_to_variable = { police_effectivness = -0.1 } } if = { limit = { has_country_flag = ITA_concentrating_on_ndrangheta } add_to_variable = { police_effectivness = -0.1 } } if = { limit = { has_country_flag = ITA_concentrating_on_cosa_nostra } add_to_variable = { police_effectivness = -0.1 } } if = { limit = { has_country_flag = ITA_concentrating_on_sacra_corona_unita } add_to_variable = { police_effectivness = -0.1 } } set_variable = { police_effectiveness_sicily = { value = police_effectivness multiply = { value = 1 subtract = { value = cosa_nostra_strength multiply = 0.5 } } } } if = { limit = { has_country_flag = ITA_concentrating_on_cosa_nostra } multiply_variable = { police_effectiveness_sicily = 1.5 } } set_variable = { police_effectiveness_campania = { value = police_effectivness multiply = { value = 1 subtract = { value = camorra_strength multiply = 0.5 } } } } if = { limit = { has_country_flag = ITA_concentrating_on_camorra } multiply_variable = { police_effectiveness_campania = 1.5 } } set_variable = { police_effectiveness_calabria = { value = police_effectivness multiply = { value = 1 subtract = { value = ndrangheta_strength multiply = 0.5 } } } } if = { limit = { has_country_flag = ITA_concentrating_on_ndrangheta } multiply_variable = { police_effectiveness_calabria = 1.5 } } set_variable = { police_effectiveness_puglia = { value = police_effectivness multiply = { value = 1 subtract = { value = sacra_corona_unita_strength multiply = 0.5 } } } } if = { limit = { has_country_flag = ITA_concentrating_on_sacra_corona_unita } multiply_variable = { police_effectiveness_puglia = 1.5 } } # Clamp all undercover agents at 0 clamp_variable = { var = undercover_agents_campania min = 0 } clamp_variable = { var = undercover_agents_calabria min = 0 } clamp_variable = { var = undercover_agents_puglia min = 0 } clamp_variable = { var = undercover_agents_sicily min = 0 } #each undercover agent increases police effectivness by 5% multiply_variable = { var = police_effectiveness_sicily value = { value = undercover_agents_sicily multiply = 0.025 add = 1 } } multiply_variable = { var = police_effectiveness_campania value = { value = undercover_agents_campania multiply = 0.025 add = 1 } } multiply_variable = { var = police_effectiveness_calabria value = { value = undercover_agents_calabria multiply = 0.025 add = 1 } } multiply_variable = { var = police_effectiveness_puglia value = { value = undercover_agents_puglia multiply = 0.025 add = 1 } } } mafia_monthly_drift = { #monthly drifts in mafia strength, base value plus focus and events effects #sicily add_to_variable = { cosa_nostra_strength = monthly_drift_events_cosa_nostra } if = { limit = { has_idea = ITA_migrants_from_africa } add_to_variable = { cosa_nostra_strength = 0.002 } } else_if = { limit = { has_idea = ITA_migrants_from_africa_limited } add_to_variable = { cosa_nostra_strength = 0.004 } } else_if = { limit = { has_idea = ITA_migration_tolerated } add_to_variable = { cosa_nostra_strength = 0.001 } } if = { limit = { has_country_flag = ITA_concentrating_on_cosa_nostra } add_to_variable = { cosa_nostra_strength = -0.01 } add_to_variable = { camorra_strength = 0.003 } add_to_variable = { ndrangheta_strength = 0.003 } add_to_variable = { sacra_corona_unita_strength = 0.003 } } if = { limit = { check_variable = { cosa_nostra_strength < 0.05 } } add_to_variable = { cosa_nostra_strength = 0.018 } } else_if = { limit = { check_variable = { cosa_nostra_strength > 0.049 } check_variable = { cosa_nostra_strength < 0.1 } } add_to_variable = { cosa_nostra_strength = 0.012 } } else_if = { limit = { check_variable = { cosa_nostra_strength > 0.099 } check_variable = { cosa_nostra_strength < 0.400 } } add_to_variable = { cosa_nostra_strength = 0.003 } } else_if = { limit = { check_variable = { cosa_nostra_strength > 0.399 } check_variable = { cosa_nostra_strength < 0.666 } } add_to_variable = { cosa_nostra_strength = -0.003 } } else_if = { limit = { check_variable = { cosa_nostra_strength > 0.665 } } add_to_variable = { cosa_nostra_strength = -0.012 } } #campania add_to_variable = { camorra_strength = monthly_drift_events_camorra } if = { limit = { has_country_flag = ITA_concentrating_on_camorra } add_to_variable = { cosa_nostra_strength = 0.003 } add_to_variable = { camorra_strength = -0.01 } add_to_variable = { ndrangheta_strength = 0.003 } add_to_variable = { sacra_corona_unita_strength = 0.003 } } if = { limit = { check_variable = { camorra_strength < 0.05 } } add_to_variable = { camorra_strength = 0.018 } } else_if = { limit = { check_variable = { camorra_strength > 0.049 } check_variable = { camorra_strength < 0.1 } } add_to_variable = { camorra_strength = 0.012 } } else_if = { limit = { check_variable = { camorra_strength > 0.099 } check_variable = { camorra_strength < 0.400 } } add_to_variable = { camorra_strength = 0.003 } } else_if = { limit = { check_variable = { camorra_strength > 0.399 } check_variable = { camorra_strength < 0.666 } } add_to_variable = { camorra_strength = -0.003 } } else_if = { limit = { check_variable = { camorra_strength > 0.665 } } add_to_variable = { camorra_strength = -0.012 } } #calabria add_to_variable = { ndrangheta_strength = monthly_drift_events_ndrangheta } if = { limit = { has_country_flag = ITA_concentrating_on_ndrangheta } add_to_variable = { cosa_nostra_strength = 0.003 } add_to_variable = { camorra_strength = 0.003 } add_to_variable = { ndrangheta_strength = -0.01 } add_to_variable = { sacra_corona_unita_strength = 0.003 } } if = { limit = { check_variable = { ndrangheta_strength < 0.05 } } add_to_variable = { ndrangheta_strength = 0.018 } } else_if = { limit = { check_variable = { ndrangheta_strength > 0.049 } check_variable = { ndrangheta_strength < 0.1 } } add_to_variable = { ndrangheta_strength = 0.012 } } else_if = { limit = { check_variable = { ndrangheta_strength > 0.099 } check_variable = { ndrangheta_strength < 0.400 } } add_to_variable = { ndrangheta_strength = 0.003 } } else_if = { limit = { check_variable = { ndrangheta_strength > 0.399 } check_variable = { ndrangheta_strength < 0.666 } } add_to_variable = { ndrangheta_strength = -0.003 } } else_if = { limit = { check_variable = { ndrangheta_strength > 0.665 } } add_to_variable = { ndrangheta_strength = -0.012 } } #puglia add_to_variable = { sacra_corona_unita_strength = monthly_drift_events_sacra_corona_unita } if = { limit = { has_country_flag = ITA_concentrating_on_sacra_corona_unita } add_to_variable = { cosa_nostra_strength = 0.003 } add_to_variable = { camorra_strength = 0.003 } add_to_variable = { ndrangheta_strength = 0.003 } add_to_variable = { sacra_corona_unita_strength = -0.01 } } if = { limit = { check_variable = { sacra_corona_unita_strength < 0.05 } } add_to_variable = { sacra_corona_unita_strength = 0.018 } } else_if = { limit = { check_variable = { sacra_corona_unita_strength > 0.049 } check_variable = { sacra_corona_unita_strength < 0.1 } } add_to_variable = { sacra_corona_unita_strength = 0.012 } } else_if = { limit = { check_variable = { sacra_corona_unita_strength > 0.099 } check_variable = { sacra_corona_unita_strength < 0.400 } } add_to_variable = { sacra_corona_unita_strength = 0.003 } } else_if = { limit = { check_variable = { sacra_corona_unita_strength > 0.399 } check_variable = { sacra_corona_unita_strength < 0.666 } } add_to_variable = { sacra_corona_unita_strength = -0.003 } } else_if = { limit = { check_variable = { sacra_corona_unita_strength > 0.665 } } add_to_variable = { sacra_corona_unita_strength = -0.012 } } if = { limit = { has_completed_focus = ITA_security_cooperation_with_mexico NOT = { has_war_with = MEX } } add_to_variable = { cosa_nostra_strength = -0.001 } add_to_variable = { camorra_strength = -0.001 } add_to_variable = { ndrangheta_strength = -0.002 } #ndrangheta is the most concerned with drug trafficking add_to_variable = { sacra_corona_unita_strength = -0.001 } } if = { limit = { has_completed_focus = ITA_build_waste_incinerators } add_to_variable = { cosa_nostra_strength = -0.001 } add_to_variable = { camorra_strength = -0.002 } #camorra is the most concerned with waste trafficking add_to_variable = { ndrangheta_strength = -0.001 } add_to_variable = { sacra_corona_unita_strength = -0.001 } } if = { limit = { has_idea = ITA_legalized_light_drugs } add_to_variable = { cosa_nostra_strength = -0.003 } add_to_variable = { camorra_strength = -0.003 } add_to_variable = { ndrangheta_strength = -0.004 } #ndrangheta is the most concerned with drug trafficking add_to_variable = { sacra_corona_unita_strength = -0.003 } } if = { limit = { has_idea = ITA_legalized_all_drugs } add_to_variable = { cosa_nostra_strength = -0.004 } add_to_variable = { camorra_strength = -0.004 } add_to_variable = { ndrangheta_strength = -0.006 } #ndrangheta is the most concerned with drug trafficking add_to_variable = { sacra_corona_unita_strength = -0.004 } } if = { limit = { has_completed_focus = ITA_anti_mafia_education } add_to_variable = { cosa_nostra_strength = -0.003 } add_to_variable = { camorra_strength = -0.003 } add_to_variable = { ndrangheta_strength = -0.003 } add_to_variable = { sacra_corona_unita_strength = -0.003 } } if = { limit = { has_completed_focus = ITA_seek_support_of_the_church } add_to_variable = { cosa_nostra_strength = -0.004 } add_to_variable = { camorra_strength = -0.004 } add_to_variable = { ndrangheta_strength = -0.004 } add_to_variable = { sacra_corona_unita_strength = -0.004 } } if = { limit = { has_completed_focus = ITA_turn_the_population_against_them } add_to_variable = { cosa_nostra_strength = -0.005 } add_to_variable = { camorra_strength = -0.005 } add_to_variable = { ndrangheta_strength = -0.005 } add_to_variable = { sacra_corona_unita_strength = -0.005 } } if = { limit = { has_completed_focus = ITA_safeguard_european_development_funds } add_to_variable = { cosa_nostra_strength = -0.001 } add_to_variable = { camorra_strength = -0.001 } add_to_variable = { ndrangheta_strength = -0.001 } add_to_variable = { sacra_corona_unita_strength = -0.001 } } if = { limit = { has_completed_focus = ITA_protect_foreign_investment } add_to_variable = { cosa_nostra_strength = -0.001 } add_to_variable = { camorra_strength = -0.001 } add_to_variable = { ndrangheta_strength = -0.001 } add_to_variable = { sacra_corona_unita_strength = -0.001 } } if = { limit = { has_idea = ITA_building_abuse_1 } add_to_variable = { cosa_nostra_strength = 0.001 } add_to_variable = { camorra_strength = 0.001 } add_to_variable = { ndrangheta_strength = 0.001 } add_to_variable = { sacra_corona_unita_strength = 0.001 } } if = { limit = { has_idea = ITA_building_abuse_2 } add_to_variable = { cosa_nostra_strength = 0.002 } add_to_variable = { camorra_strength = 0.002 } add_to_variable = { ndrangheta_strength = 0.002 } add_to_variable = { sacra_corona_unita_strength = 0.002 } } } # Strength-tier gates mirror loc thresholds (<0.10 Negligible, <0.40 Low, etc.) # and a 14-day global cooldown caps total event frequency at ~2/month. mafia_event_counters = { if = { limit = { check_variable = { ITA_mafia_event_cd_days > 0 } } subtract_from_variable = { ITA_mafia_event_cd_days = 7 } clamp_variable = { var = ITA_mafia_event_cd_days min = 0 } } #general if = { limit = { check_variable = { mafia_strength > 0.399 } } random = { chance = 50 add_to_variable = { event_counter_1_mafia = 1 } } } else_if = { limit = { check_variable = { mafia_strength > 0.099 } } random = { chance = 25 add_to_variable = { event_counter_1_mafia = 1 } } } #sicily if = { limit = { check_variable = { cosa_nostra_strength > 0.399 } } random = { chance = 50 add_to_variable = { event_counter_1_sicily = 1 } } random = { chance = 50 add_to_variable = { event_counter_2_sicily = 1 } } random = { chance = 50 add_to_variable = { event_counter_3_sicily = 1 } } random = { chance = 50 add_to_variable = { event_counter_4_sicily = 1 } } } else_if = { limit = { check_variable = { cosa_nostra_strength > 0.099 } } random = { chance = 25 add_to_variable = { event_counter_1_sicily = 1 } } random = { chance = 25 add_to_variable = { event_counter_2_sicily = 1 } } random = { chance = 25 add_to_variable = { event_counter_3_sicily = 1 } } random = { chance = 25 add_to_variable = { event_counter_4_sicily = 1 } } } #campania if = { limit = { check_variable = { camorra_strength > 0.399 } } random = { chance = 50 add_to_variable = { event_counter_1_campania = 1 } } random = { chance = 50 add_to_variable = { event_counter_2_campania = 1 } } random = { chance = 50 add_to_variable = { event_counter_3_campania = 1 } } random = { chance = 50 add_to_variable = { event_counter_4_campania = 1 } } } else_if = { limit = { check_variable = { camorra_strength > 0.099 } } random = { chance = 25 add_to_variable = { event_counter_1_campania = 1 } } random = { chance = 25 add_to_variable = { event_counter_2_campania = 1 } } random = { chance = 25 add_to_variable = { event_counter_3_campania = 1 } } random = { chance = 25 add_to_variable = { event_counter_4_campania = 1 } } } #calabria if = { limit = { check_variable = { ndrangheta_strength > 0.399 } } random = { chance = 50 add_to_variable = { event_counter_1_calabria = 1 } } random = { chance = 50 add_to_variable = { event_counter_2_calabria = 1 } } random = { chance = 50 add_to_variable = { event_counter_3_calabria = 1 } } random = { chance = 50 add_to_variable = { event_counter_4_calabria = 1 } } } else_if = { limit = { check_variable = { ndrangheta_strength > 0.099 } } random = { chance = 25 add_to_variable = { event_counter_1_calabria = 1 } } random = { chance = 25 add_to_variable = { event_counter_2_calabria = 1 } } random = { chance = 25 add_to_variable = { event_counter_3_calabria = 1 } } random = { chance = 25 add_to_variable = { event_counter_4_calabria = 1 } } } #puglia if = { limit = { check_variable = { sacra_corona_unita_strength > 0.399 } } random = { chance = 50 add_to_variable = { event_counter_1_puglia = 1 } } random = { chance = 50 add_to_variable = { event_counter_2_puglia = 1 } } random = { chance = 50 add_to_variable = { event_counter_3_puglia = 1 } } random = { chance = 50 add_to_variable = { event_counter_4_puglia = 1 } } } else_if = { limit = { check_variable = { sacra_corona_unita_strength > 0.099 } } random = { chance = 25 add_to_variable = { event_counter_1_puglia = 1 } } random = { chance = 25 add_to_variable = { event_counter_2_puglia = 1 } } random = { chance = 25 add_to_variable = { event_counter_3_puglia = 1 } } random = { chance = 25 add_to_variable = { event_counter_4_puglia = 1 } } } # Only one mafia event fires per 14-day cooldown window. if = { limit = { check_variable = { ITA_mafia_event_cd_days < 1 } } #general if = { limit = { check_variable = { event_counter_1_mafia > 5 } } set_variable = { event_counter_1_mafia = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } random_list = { 25 = { country_event = mafia.33 } 25 = { country_event = mafia.34 } 25 = { country_event = mafia.35 } 25 = { country_event = mafia.36 } } } #sicily if = { limit = { check_variable = { event_counter_1_sicily > 15 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.6 set_variable = { event_counter_1_sicily = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } if = { limit = { check_variable = { event_counter_2_sicily > 15 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.9 set_variable = { event_counter_2_sicily = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } if = { limit = { check_variable = { event_counter_3_sicily > 15 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.25 set_variable = { event_counter_3_sicily = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } if = { limit = { check_variable = { event_counter_4_sicily > 23 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.26 set_variable = { event_counter_4_sicily = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } #campania if = { limit = { check_variable = { event_counter_1_campania > 15 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.6 set_variable = { event_counter_1_campania = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } if = { limit = { check_variable = { event_counter_2_campania > 15 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.10 set_variable = { event_counter_2_campania = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } if = { limit = { check_variable = { event_counter_3_campania > 15 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.21 set_variable = { event_counter_3_campania = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } if = { limit = { check_variable = { event_counter_4_campania > 23 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.22 set_variable = { event_counter_4_campania = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } #calabria if = { limit = { check_variable = { event_counter_1_calabria > 15 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.7 set_variable = { event_counter_1_calabria = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } if = { limit = { check_variable = { event_counter_2_calabria > 15 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.11 set_variable = { event_counter_2_calabria = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } if = { limit = { check_variable = { event_counter_3_calabria > 15 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.17 set_variable = { event_counter_3_calabria = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } if = { limit = { check_variable = { event_counter_4_calabria > 23 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.18 set_variable = { event_counter_4_calabria = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } #puglia if = { limit = { check_variable = { event_counter_1_puglia > 15 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.8 set_variable = { event_counter_1_puglia = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } if = { limit = { check_variable = { event_counter_2_puglia > 15 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.12 set_variable = { event_counter_2_puglia = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } if = { limit = { check_variable = { event_counter_3_puglia > 15 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.13 set_variable = { event_counter_3_puglia = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } if = { limit = { check_variable = { event_counter_4_puglia > 23 } check_variable = { ITA_mafia_event_cd_days < 1 } } country_event = mafia.14 set_variable = { event_counter_4_puglia = 0 } set_variable = { ITA_mafia_event_cd_days = 14 } } } } mafia_utilize_extraordinary_funds_effect = { add_to_variable = { extraordinary_police_funding_times_taken_var = 1 } set_temp_variable = { treasury_change = { value = extraordinary_police_funding_times_taken_var multiply = -0.25 } } modify_treasury_effect = yes } pizzo_decisions_effect = { set_temp_variable = { pizzo_required_cp = 0 } if = { limit = { has_country_flag = protect_from_pizzo_sicily_flag } multiply_variable = { cosa_nostra_strength = 0.995 } add_to_temp_variable = { var = pizzo_required_cp value = { value = cosa_nostra_strength multiply = -100 } } } if = { limit = { has_country_flag = protect_from_pizzo_campania_flag } multiply_variable = { camorra_strength = 0.995 } add_to_temp_variable = { var = pizzo_required_cp value = { value = camorra_strength multiply = -100 } } } if = { limit = { has_country_flag = protect_from_pizzo_calabria_flag } multiply_variable = { ndrangheta_strength = 0.995 } add_to_temp_variable = { var = pizzo_required_cp value = { value = ndrangheta_strength multiply = -100 } } } if = { limit = { has_country_flag = protect_from_pizzo_puglia_flag } multiply_variable = { sacra_corona_unita_strength = 0.995 } add_to_temp_variable = { var = pizzo_required_cp value = { value = sacra_corona_unita_strength multiply = -100 } } } set_variable = { ITA_max_command_power_var = pizzo_required_cp } } mafia_event_effect_cosa_nostra = { random_list = { 50 = { add_political_power = 50 custom_effect_tooltip = reduce_mafia_strength_tt add_to_variable = { cosa_nostra_strength = -0.010 } modifier = { factor = police_effectiveness_sicily } } 10 = { add_to_variable = { cosa_nostra_strength = -0.020 } add_political_power = 100 custom_effect_tooltip = permanent_decrease_in_mafia_drift_TT add_to_variable = { monthly_drift_events_cosa_nostra = -0.001 } modifier = { factor = police_effectiveness_sicily } } 30 = { add_to_variable = { cosa_nostra_strength = 0.010 } custom_effect_tooltip = mafia_strength_marginal_operation_success_TT } 10 = { add_to_variable = { cosa_nostra_strength = 0.020 } custom_effect_tooltip = permanent_increase_in_mafia_drift_TT add_to_variable = { monthly_drift_events_cosa_nostra = 0.001 } } } } mafia_event_effect_camorra = { random_list = { 50 = { add_political_power = 50 custom_effect_tooltip = reduce_mafia_strength_tt add_to_variable = { camorra_strength = -0.010 } modifier = { factor = police_effectiveness_campania } } 10 = { add_to_variable = { camorra_strength = -0.020 } add_political_power = 100 custom_effect_tooltip = permanent_decrease_in_mafia_drift_TT add_to_variable = { monthly_drift_events_camorra = -0.001 } modifier = { factor = police_effectiveness_campania } } 30 = { add_to_variable = { camorra_strength = 0.010 } custom_effect_tooltip = mafia_strength_marginal_operation_success_TT } 10 = { add_to_variable = { camorra_strength = 0.020 } custom_effect_tooltip = permanent_increase_in_mafia_drift_TT add_to_variable = { monthly_drift_events_camorra = 0.001 } } } } mafia_event_effect_ndrangheta = { random_list = { 50 = { add_political_power = 50 custom_effect_tooltip = reduce_mafia_strength_tt add_to_variable = { ndrangheta_strength = -0.010 } modifier = { factor = police_effectiveness_calabria } } 10 = { add_to_variable = { ndrangheta_strength = -0.020 } add_political_power = 100 custom_effect_tooltip = permanent_decrease_in_mafia_drift_TT add_to_variable = { monthly_drift_events_ndrangheta = -0.001 } modifier = { factor = police_effectiveness_calabria } } 30 = { add_to_variable = { ndrangheta_strength = 0.010 } custom_effect_tooltip = mafia_strength_marginal_operation_success_TT } 10 = { add_to_variable = { ndrangheta_strength = 0.020 } custom_effect_tooltip = permanent_increase_in_mafia_drift_TT add_to_variable = { monthly_drift_events_ndrangheta = 0.001 } } } } mafia_event_effect_sacra_corona_unita = { random_list = { 50 = { add_political_power = 50 custom_effect_tooltip = reduce_mafia_strength_tt add_to_variable = { sacra_corona_unita_strength = -0.010 } modifier = { factor = police_effectiveness_puglia } } 10 = { add_to_variable = { sacra_corona_unita_strength = -0.020 } add_political_power = 100 custom_effect_tooltip = permanent_decrease_in_mafia_drift_TT add_to_variable = { monthly_drift_events_sacra_corona_unita = -0.001 } modifier = { factor = police_effectiveness_puglia } } 30 = { add_to_variable = { sacra_corona_unita_strength = 0.010 } custom_effect_tooltip = mafia_strength_marginal_operation_success_TT } 10 = { add_to_variable = { sacra_corona_unita_strength = 0.020 } custom_effect_tooltip = permanent_increase_in_mafia_drift_TT add_to_variable = { monthly_drift_events_sacra_corona_unita = 0.001 } } } } #used to calculate money cost and mafia strength gain of industrial focuses mafia_industrial_focus_north_effect = { if = { limit = { NOT = { has_idea = ITA_mafia } } set_temp_variable = { treasury_change = mafia_industrial_focus_base_cost } modify_treasury_effect = yes } else_if = { limit = { has_idea = ITA_mafia } set_temp_variable = { mafia_industrial_focus_cost = { value = mafia_industrial_focus_base_cost multiply = { value = 1 add = mafia_strength } } } set_temp_variable = { treasury_change = mafia_industrial_focus_cost } modify_treasury_effect = yes custom_effect_tooltip = mafia_infiltrations_focus_TT set_temp_variable = { mafia_industrial_focus_cost = { value = mafia_industrial_focus_cost subtract = mafia_industrial_focus_base_cost multiply = -0.005 } } add_to_variable = { cosa_nostra_strength = mafia_industrial_focus_cost } add_to_variable = { camorra_strength = mafia_industrial_focus_cost } add_to_variable = { ndrangheta_strength = mafia_industrial_focus_cost } add_to_variable = { sacra_corona_unita_strength = mafia_industrial_focus_cost } } } mafia_industrial_focus_south_effect = { if = { limit = { NOT = { has_idea = ITA_mafia } } set_temp_variable = { treasury_change = mafia_industrial_focus_base_cost } modify_treasury_effect = yes } else_if = { limit = { has_idea = ITA_mafia } set_temp_variable = { mafia_industrial_focus_cost = { value = mafia_industrial_focus_base_cost multiply = { value = 1 add = mafia_strength } } } set_temp_variable = { treasury_change = mafia_industrial_focus_cost } modify_treasury_effect = yes custom_effect_tooltip = mafia_infiltrations_focus_TT set_temp_variable = { mafia_industrial_focus_cost = { value = mafia_industrial_focus_cost subtract = mafia_industrial_focus_base_cost multiply = -0.005 } } add_to_variable = { cosa_nostra_strength = mafia_industrial_focus_cost } add_to_variable = { camorra_strength = mafia_industrial_focus_cost } add_to_variable = { ndrangheta_strength = mafia_industrial_focus_cost } add_to_variable = { sacra_corona_unita_strength = mafia_industrial_focus_cost } } } modify_reform_expectance_effect = { custom_effect_tooltip = ITA_modify_reform_expectancy_effect_TT add_to_variable = { drift_switch_var_base = drift_switch_change } reforme_expectance_government_change_update = yes } #temporary/decaying reform-expectancy channel for one-off populist decisions (item 4e/10) ITA_modify_reform_expectance_temp_effect = { custom_effect_tooltip = ITA_modify_reform_expectancy_temp_effect_TT add_to_variable = { ITA_drift_switch_temp_var = drift_switch_change } reforme_expectance_government_change_update = yes } prevent_parties_disappearing = { if = { limit = { check_variable = { party_pop_array^1 < 0.005 } } add_popularity = { ideology = democratic popularity = 0.002 } add_to_variable = { party_pop_array^1 = 0.004 } } if = { limit = { check_variable = { party_pop_array^2 < 0.005 } } add_popularity = { ideology = democratic popularity = 0.002 } add_to_variable = { party_pop_array^2 = 0.004 } } if = { limit = { check_variable = { party_pop_array^3 < 0.005 } } add_popularity = { ideology = democratic popularity = 0.002 } add_to_variable = { party_pop_array^3 = 0.004 } } if = { limit = { check_variable = { party_pop_array^4 < 0.005 } } add_popularity = { ideology = communism popularity = 0.002 } add_to_variable = { party_pop_array^4 = 0.004 } } if = { limit = { check_variable = { party_pop_array^5 < 0.005 } has_country_flag = ITA_five_star_movement_founded } add_popularity = { ideology = communism popularity = 0.002 } add_to_variable = { party_pop_array^5 = 0.004 } } if = { limit = { check_variable = { party_pop_array^6 < 0.005 } has_country_flag = ITA_salvini_took_over_lega } add_popularity = { ideology = communism popularity = 0.002 } add_to_variable = { party_pop_array^6 = 0.004 } } if = { limit = { check_variable = { party_pop_array^14 < 0.005 } NOT = { has_country_flag = ITA_salvini_took_over_lega } } add_popularity = { ideology = neutrality popularity = 0.002 } add_to_variable = { party_pop_array^14 = 0.004 } } if = { limit = { check_variable = { party_pop_array^16 < 0.005 } } add_popularity = { ideology = neutrality popularity = 0.002 } add_to_variable = { party_pop_array^16 = 0.004 } } if = { limit = { check_variable = { party_pop_array^17 < 0.005 } } add_popularity = { ideology = neutrality popularity = 0.002 } add_to_variable = { party_pop_array^17 = 0.004 } } if = { limit = { check_variable = { party_pop_array^18 < 0.005 } has_country_flag = ITA_leu_founded } add_popularity = { ideology = neutrality popularity = 0.002 } add_to_variable = { party_pop_array^18 = 0.004 } } if = { limit = { check_variable = { party_pop_array^19 < 0.005 } } add_popularity = { ideology = neutrality popularity = 0.002 } add_to_variable = { party_pop_array^19 = 0.004 } } if = { limit = { check_variable = { party_pop_array^20 < 0.005 } } add_popularity = { ideology = nationalist popularity = 0.002 } add_to_variable = { party_pop_array^20 = 0.004 } } if = { limit = { check_variable = { party_pop_array^21 < 0.005 } } add_popularity = { ideology = nationalist popularity = 0.002 } add_to_variable = { party_pop_array^21 = 0.004 } } if = { limit = { is_historical_focus_on = yes check_variable = { party_pop_array^21 > 0.02 } } add_to_variable = { party_pop_array^21 = -0.003 } add_to_variable = { party_pop_array^20 = 0.003 } } recalculate_party = yes } ruling_subparty_drift_effect = { if = { limit = { has_country_leader_with_trait = western_technocrat } set_temp_variable = { coalition_subparty_drift_modified_var = { value = ruling_subparty_drift_store multiply = 0.07 } } if = { limit = { check_variable = { gov_coalition_array^num > 0 } } divide_temp_variable = { coalition_subparty_drift_modified_var = gov_coalition_array^num } } else = { set_temp_variable = { coalition_subparty_drift_modified_var = 0 } } for_each_loop = { array = gov_coalition_array set_temp_variable = { coalition_subparty_drift_modified_multiplied_var = coalition_subparty_drift_modified_var } set_temp_variable = { outlook_party_index = v } set_outlook_from_party_index = yes set_outlook_popularity_from_id = yes multiply_temp_variable = { coalition_subparty_drift_modified_multiplied_var = outlook_popularity } add_to_variable = { party_pop_array^v = coalition_subparty_drift_modified_multiplied_var } } } else_if = { limit = { NOT = { has_country_leader_with_trait = western_technocrat } } set_temp_variable = { coalition_subparty_drift_modified_var = { value = ruling_subparty_drift_store multiply = 0.07 divide = { value = gov_coalition_array^num add = 1 } } } if = { limit = { has_variable = ruling_party } set_temp_variable = { coalition_subparty_drift_modified_multiplied_var = coalition_subparty_drift_modified_var } set_temp_variable = { outlook_party_index = ruling_party } set_outlook_from_party_index = yes set_outlook_popularity_from_id = yes multiply_temp_variable = { coalition_subparty_drift_modified_multiplied_var = outlook_popularity } add_to_variable = { party_pop_array^ruling_party = coalition_subparty_drift_modified_multiplied_var } } for_each_loop = { array = gov_coalition_array set_temp_variable = { coalition_subparty_drift_modified_multiplied_var = coalition_subparty_drift_modified_var } set_temp_variable = { outlook_party_index = v } set_outlook_from_party_index = yes set_outlook_popularity_from_id = yes multiply_temp_variable = { coalition_subparty_drift_modified_multiplied_var = outlook_popularity } add_to_variable = { party_pop_array^v = coalition_subparty_drift_modified_multiplied_var } } } recalculate_party = yes } reforme_expectance_government_change_update = { set_variable = { fascism_drift_var = 0 } set_variable = { communism_drift_var = 0 } set_variable = { democratic_drift_var = 0 } set_variable = { neutrality_drift_var = 0 } set_variable = { nationalist_drift_var = 0 } clamp_variable = { var = drift_switch_var_base min = -0.5 max = 0.5 } #effective reform pressure = persistent level + decaying temporary channel (item 4e) set_temp_variable = { ITA_re_effective = { value = drift_switch_var_base add = ITA_drift_switch_temp_var } } if = { limit = { has_country_leader_with_trait = western_technocrat } set_temp_variable = { coalition_drift_switch_var = ITA_re_effective } if = { limit = { check_variable = { gov_coalition_array^num > 0 } } divide_temp_variable = { coalition_drift_switch_var = gov_coalition_array^num } } else = { set_temp_variable = { coalition_drift_switch_var = 0 } } if = { limit = { is_in_array = { gov_coalition_array = 0 } } add_to_variable = { democratic_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 1 } } add_to_variable = { democratic_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 2 } } add_to_variable = { democratic_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 3 } } add_to_variable = { democratic_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 4 } } add_to_variable = { communism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 5 } } add_to_variable = { communism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 6 } } add_to_variable = { communism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 7 } } add_to_variable = { communism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 8 } } add_to_variable = { fascism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 9 } } add_to_variable = { fascism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 10 } } add_to_variable = { fascism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 11 } } add_to_variable = { fascism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 12 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 13 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 14 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 15 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 16 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 17 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 18 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 19 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 20 } } add_to_variable = { nationalist_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 21 } } add_to_variable = { nationalist_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 22 } } add_to_variable = { nationalist_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 23 } } add_to_variable = { nationalist_drift_var = coalition_drift_switch_var } } } else_if = { limit = { NOT = { has_country_leader_with_trait = western_technocrat } } set_temp_variable = { coalition_drift_switch_var = { value = ITA_re_effective divide = { value = gov_coalition_array^num add = 1 } #the ruling party } } if = { limit = { is_in_array = { gov_coalition_array = 0 } } add_to_variable = { democratic_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 1 } } add_to_variable = { democratic_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 2 } } add_to_variable = { democratic_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 3 } } add_to_variable = { democratic_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 4 } } add_to_variable = { communism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 5 } } add_to_variable = { communism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 6 } } add_to_variable = { communism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 7 } } add_to_variable = { communism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 8 } } add_to_variable = { fascism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 9 } } add_to_variable = { fascism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 10 } } add_to_variable = { fascism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 11 } } add_to_variable = { fascism_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 12 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 13 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 14 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 15 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 16 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 17 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 18 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 19 } } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 20 } } add_to_variable = { nationalist_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 21 } } add_to_variable = { nationalist_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 22 } } add_to_variable = { nationalist_drift_var = coalition_drift_switch_var } } if = { limit = { is_in_array = { gov_coalition_array = 23 } } add_to_variable = { nationalist_drift_var = coalition_drift_switch_var } } if = { limit = { has_government = fascism } add_to_variable = { fascism_drift_var = coalition_drift_switch_var } } else_if = { limit = { has_government = communism } add_to_variable = { communism_drift_var = coalition_drift_switch_var } } else_if = { limit = { has_government = democratic } add_to_variable = { democratic_drift_var = coalition_drift_switch_var } } else_if = { limit = { has_government = neutrality } add_to_variable = { neutrality_drift_var = coalition_drift_switch_var } } else_if = { limit = { has_government = nationalist } add_to_variable = { nationalist_drift_var = coalition_drift_switch_var } } } #5%/30% popularity taper: reform-expectancy pressure can't drive a party below ~5% (item 4c) if = { limit = { check_variable = { democratic_drift_var < 0 } } multiply_variable = { var = democratic_drift_var value = { value = party_popularity@democratic subtract = 0.05 divide = 0.25 clamp = { min = 0 max = 1 } } } } if = { limit = { check_variable = { communism_drift_var < 0 } } multiply_variable = { var = communism_drift_var value = { value = party_popularity@communism subtract = 0.05 divide = 0.25 clamp = { min = 0 max = 1 } } } } if = { limit = { check_variable = { fascism_drift_var < 0 } } multiply_variable = { var = fascism_drift_var value = { value = party_popularity@fascism subtract = 0.05 divide = 0.25 clamp = { min = 0 max = 1 } } } } if = { limit = { check_variable = { neutrality_drift_var < 0 } } multiply_variable = { var = neutrality_drift_var value = { value = party_popularity@neutrality subtract = 0.05 divide = 0.25 clamp = { min = 0 max = 1 } } } } if = { limit = { check_variable = { nationalist_drift_var < 0 } } multiply_variable = { var = nationalist_drift_var value = { value = party_popularity@nationalist subtract = 0.05 divide = 0.25 clamp = { min = 0 max = 1 } } } } } reform_expectance_from_situation = { # Clamp stability input at 0.3 so a spiral can't compound reform pressure indefinitely set_temp_variable = { reform_expectance_from_stability = { value = 0.6 subtract = { value = stability clamp = { min = 0.3 max = 1.0 } } multiply = 0.1 } } #interest rate effect set_temp_variable = { reform_expectance_from_interest_rate = { value = interest_rate subtract = 3 clamp = { min = 0 max = 20 } multiply = 0.005 } } #laws effect if = { limit = { has_idea = social_01 } set_temp_variable = { reform_expectance_from_laws = 0.03 } } else_if = { limit = { has_idea = social_02 } set_temp_variable = { reform_expectance_from_laws = 0.02 } } else_if = { limit = { has_idea = social_03 } set_temp_variable = { reform_expectance_from_laws = 0.01 } } else_if = { limit = { has_idea = social_04 } set_temp_variable = { reform_expectance_from_laws = 0 } } else_if = { limit = { has_idea = social_05 } set_temp_variable = { reform_expectance_from_laws = -0.01 } } else_if = { limit = { has_idea = social_06 } set_temp_variable = { reform_expectance_from_laws = -0.02 } } if = { limit = { has_idea = health_01 } add_to_temp_variable = { reform_expectance_from_laws = 0.03 } } else_if = { limit = { has_idea = health_02 } add_to_temp_variable = { reform_expectance_from_laws = 0.02 } } else_if = { limit = { has_idea = health_03 } add_to_temp_variable = { reform_expectance_from_laws = 0.01 } } else_if = { limit = { has_idea = health_04 } add_to_temp_variable = { reform_expectance_from_laws = 0 } } else_if = { limit = { has_idea = health_05 } add_to_temp_variable = { reform_expectance_from_laws = -0.01 } } else_if = { limit = { has_idea = health_06 } add_to_temp_variable = { reform_expectance_from_laws = -0.02 } } if = { limit = { has_idea = edu_01 } add_to_temp_variable = { reform_expectance_from_laws = 0.02 } } else_if = { limit = { has_idea = edu_02 } add_to_temp_variable = { reform_expectance_from_laws = 0.01 } } else_if = { limit = { has_idea = edu_03 } add_to_temp_variable = { reform_expectance_from_laws = 0 } } else_if = { limit = { has_idea = edu_04 } add_to_temp_variable = { reform_expectance_from_laws = -0.01 } } else_if = { limit = { has_idea = edu_05 } add_to_temp_variable = { reform_expectance_from_laws = -0.02 } } #war effect if = { limit = { has_war = yes } set_temp_variable = { reform_expectance_from_war = { value = 1 subtract = war_support multiply = 0.1 } } } #taxes effect set_temp_variable = { reform_expectance_from_taxes = { value = tax_rate multiply = 0.001 } } #calculate the total change from all sources in a variable that is then displayed in the dynamic modifier set_variable = { reform_expectance_drift_display_var = 0 } #technocratic government effect if = { limit = { has_country_leader_with_trait = western_technocrat NOT = { has_country_leader_with_trait = roman_senate_trait } } add_to_variable = { reform_expectance_drift_display_var = 0.05 } } add_to_variable = { var = reform_expectance_drift_display_var value = { value = reform_expectance_from_stability add = reform_expectance_from_laws add = reform_expectance_from_taxes add = reform_expectance_from_war add = reform_expectance_from_interest_rate } } #reform_expectance_drift_display_var now holds only the situational pressure S; #mean-reversion (k*M) is applied monthly in 07_italy_on_actions.txt (item 4a) } remove_gov_crisis_ai_flags = { clr_country_flag = delayed_government_crisis_1 clr_country_flag = delayed_government_crisis_2 } calculate_abandon_coalition_threshold = { for_each_loop = { array = abandon_coalition_threshold index = i value = v if = { limit = { is_in_array = { gov_coalition_array = i } } set_variable = { abandon_coalition_threshold^i = { value = party_pop_array^i multiply = 0.5 } } } } } small_parties_leave_coalition = { for_each_loop = { array = abandon_coalition_threshold index = i value = v if = { limit = { is_in_array = { gov_coalition_array = i } check_variable = { party_pop_array^i < abandon_coalition_threshold^i } } remove_from_array = { gov_coalition_array = i } country_event = italy_md.47 } } reforme_expectance_government_change_update = yes update_government_coalition_strength = yes } government_crisis_check = { set_temp_variable = { government_failure_threshold = { value = majority_threshold multiply = 0.5 } } if = { limit = { check_variable = { government_coalition_strength < government_failure_threshold } NOT = { has_country_flag = coalition_forming } } country_event = italy_md.38 } set_variable = { highest_popularity_party_var = 0 } for_each_loop = { array = gov_coalition_array value = v if = { limit = { check_variable = { highest_popularity_party_var < party_pop_array^v } } set_variable = { highest_popularity_party_var = party_pop_array^v } } } if = { limit = { has_variable = ruling_party } set_variable = { ruling_party_var = ruling_party } } set_variable = { ruling_party_popularity_var = party_pop_array^ruling_party_var } multiply_variable = { highest_popularity_party_var = 0.75 } if = { limit = { check_variable = { ruling_party_popularity_var < highest_popularity_party_var } NOT = { has_country_flag = coalition_forming } NOT = { has_country_leader_with_trait = western_technocrat } } clear_array = gov_coalition_array country_event = italy_md.38 } } weekly_stability_dynamic_modifier_update = { set_temp_variable = { base_stability = { value = stability subtract = modifier@stability_factor } } if = { limit = { has_government = fascism } set_temp_variable = { party_pop_stab = { value = party_popularity@fascism multiply = 0.04 } } } else_if = { limit = { has_government = communism } set_temp_variable = { party_pop_stab = { value = party_popularity@communism multiply = 0.04 } } } else_if = { limit = { has_government = democratic } set_temp_variable = { party_pop_stab = { value = party_popularity@democratic multiply = 0.04 } } } else_if = { limit = { has_government = neutrality } set_temp_variable = { party_pop_stab = { value = party_popularity@neutrality multiply = 0.04 } } } else_if = { limit = { has_government = nationalist } set_temp_variable = { party_pop_stab = { value = party_popularity@nationalist multiply = 0.04 } } } subtract_from_temp_variable = { base_stability = party_pop_stab } if = { limit = { OR = { check_variable = { base_stability > 0.999 } check_variable = { base_stability < 0.001 } } } add_to_variable = { var = ITA_stability_factor_var value = modifier@stability_weekly } clamp_variable = { var = ITA_stability_factor_var min = -0.1 max = 0.1 } } } low_stability_protests_effect = { set_temp_variable = { stability_protests_gain = stability } add_to_temp_variable = { stability_protests_gain = -0.25 } add_to_variable = { stability_protests_counter = stability_protests_gain } if = { limit = { check_variable = { stability_protests_counter < -15 } } country_event = italy_md.69 } clamp_variable = { var = stability_protests_counter min = -16 max = 0 } } lsp_calculate_civil_war_volounteers = { if = { limit = { has_leftwing_populist_government = yes } set_variable = { civil_war_volounteers = { value = party_pop_array^6 add = party_pop_array^20 add = party_pop_array^21 multiply = 1.25 } } } if = { limit = { has_rightwing_populist_government = yes } set_variable = { civil_war_volounteers = { value = party_pop_array^4 add = party_pop_array^5 multiply = 1.25 } } } if = { limit = { NOT = { OR = { has_rightwing_populist_government = yes has_leftwing_populist_government = yes } } } set_variable = { civil_war_volounteers = { value = party_pop_array^4 add = party_pop_array^5 add = party_pop_array^6 add = party_pop_array^20 add = party_pop_array^21 } } } set_variable = { civil_war_volounteers = { value = civil_war_volounteers multiply = 50 round = yes clamp = { min = 0 max = 50 } } } } lsp_spawn_volounteers_effect = { division_template = { name = "Volontari" is_locked = yes regiments = { Mot_Militia_Bat = { x = 0 y = 0 } Mot_Militia_Bat = { x = 0 y = 1 } Mot_Militia_Bat = { x = 0 y = 2 } Mot_Militia_Bat = { x = 0 y = 3 } } support = { H_Engi_Comp = { x = 0 y = 0 } } } if = { limit = { NOT = { tag = ITA } } set_temp_variable = { spawn_count = 0 } if = { limit = { check_variable = { ITA.civil_war_volounteers > 0 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { ITA.civil_war_volounteers > 10 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { ITA.civil_war_volounteers > 20 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { ITA.civil_war_volounteers > 30 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { ITA.civil_war_volounteers > 40 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { spawn_count > 0 } } for_loop_effect = { end = spawn_count value = spawn_i every_state = { limit = { is_core_of = ITA } create_unit = { division = "name = \"Reggimento Volontari\" division_template = \"Volontari\" start_experience_factor = 0.1 start_equipment_factor = 1.0" owner = PREV allow_spawning_on_enemy_provs = yes count = 1 } } } } } } lsp_spawn_volounteers_effect_2 = { division_template = { name = "Volontari" is_locked = yes regiments = { Mot_Militia_Bat = { x = 0 y = 0 } Mot_Militia_Bat = { x = 0 y = 1 } Mot_Militia_Bat = { x = 0 y = 2 } Mot_Militia_Bat = { x = 0 y = 3 } } support = { H_Engi_Comp = { x = 0 y = 0 } } } if = { limit = { tag = ITA } set_temp_variable = { spawn_count = 0 } if = { limit = { check_variable = { civil_war_volounteers < 50 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { civil_war_volounteers < 40 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { civil_war_volounteers < 30 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { civil_war_volounteers < 20 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { civil_war_volounteers < 10 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { spawn_count > 0 } } for_loop_effect = { end = spawn_count value = spawn_i every_state = { limit = { is_core_of = ITA } create_unit = { division = "name = \"Reggimento Volontari\" division_template = \"Volontari\" start_experience_factor = 0.1 start_equipment_factor = 1.0" owner = ITA allow_spawning_on_enemy_provs = yes count = 1 } } } } } } lsp_popularity_effect = { if = { limit = { has_leftwing_populist_government = yes } set_temp_variable = { party_index = 6 } set_temp_variable = { party_popularity_increase = 0.02 } set_temp_variable = { temp_outlook_increase = 0.01 } change_relative_party_popularity = yes set_temp_variable = { party_index = 20 } set_temp_variable = { party_popularity_increase = 0.02 } set_temp_variable = { temp_outlook_increase = 0.01 } change_relative_party_popularity = yes set_temp_variable = { party_index = 21 } set_temp_variable = { party_popularity_increase = 0.02 } set_temp_variable = { temp_outlook_increase = 0.01 } change_relative_party_popularity = yes recalculate_party = yes } if = { limit = { has_rightwing_populist_government = yes } set_temp_variable = { party_index = 4 } set_temp_variable = { party_popularity_increase = 0.03 } set_temp_variable = { temp_outlook_increase = 0.015 } change_relative_party_popularity = yes set_temp_variable = { party_index = 5 } set_temp_variable = { party_popularity_increase = 0.03 } set_temp_variable = { temp_outlook_increase = 0.015 } change_relative_party_popularity = yes recalculate_party = yes } if = { limit = { NOT = { OR = { has_rightwing_populist_government = yes has_leftwing_populist_government = yes } } } set_temp_variable = { party_index = 4 } set_temp_variable = { party_popularity_increase = 0.012 } set_temp_variable = { temp_outlook_increase = 0.006 } change_relative_party_popularity = yes set_temp_variable = { party_index = 5 } set_temp_variable = { party_popularity_increase = 0.012 } set_temp_variable = { temp_outlook_increase = 0.006 } change_relative_party_popularity = yes set_temp_variable = { party_index = 6 } set_temp_variable = { party_popularity_increase = 0.012 } set_temp_variable = { temp_outlook_increase = 0.006 } change_relative_party_popularity = yes set_temp_variable = { party_index = 20 } set_temp_variable = { party_popularity_increase = 0.012 } set_temp_variable = { temp_outlook_increase = 0.006 } change_relative_party_popularity = yes set_temp_variable = { party_index = 21 } set_temp_variable = { party_popularity_increase = 0.012 } set_temp_variable = { temp_outlook_increase = 0.006 } change_relative_party_popularity = yes recalculate_party = yes } } ITA_calculate_civil_war_size = { set_temp_variable = { ITA_civil_war_auth_party_strength = { value = party_pop_array^0 add = party_pop_array^6 add = party_pop_array^7 add = party_pop_array^13 add = party_pop_array^15 add = party_pop_array^20 add = party_pop_array^21 add = party_pop_array^22 add = party_pop_array^23 } } if = { limit = { check_variable = { ITA_civil_war_auth_party_strength < 0.1 } } multiply_temp_variable = { ITA_civil_war_auth_party_strength = 2 } } else_if = { limit = { check_variable = { ITA_civil_war_auth_party_strength < 0.2 } } multiply_temp_variable = { ITA_civil_war_auth_party_strength = 1.75 } } else_if = { limit = { check_variable = { ITA_civil_war_auth_party_strength < 0.3 } } multiply_temp_variable = { ITA_civil_war_auth_party_strength = 1.5 } } else_if = { limit = { check_variable = { ITA_civil_war_auth_party_strength < 0.5 } } multiply_temp_variable = { ITA_civil_war_auth_party_strength = 1.25 } } else_if = { limit = { check_variable = { ITA_civil_war_auth_party_strength < 0.8 } } multiply_temp_variable = { ITA_civil_war_auth_party_strength = 1.1 } } set_temp_variable = { ITA_civil_war_size_var = { value = 1 subtract = ITA_civil_war_auth_party_strength } } set_variable = { ITA_civil_war_auth_party_strength_ai_factor = { value = ITA_civil_war_auth_party_strength multiply = ITA_civil_war_auth_party_strength multiply = ITA_civil_war_auth_party_strength multiply = ITA_civil_war_auth_party_strength } } #calculate volounteers amount set_variable = { civil_war_volounteers_2 = { value = ITA_civil_war_size_var multiply = 50 round = yes clamp = { min = 0 max = 50 } } } } seize_power_spawn_volounteers_effect_1 = { division_template = { name = "Volontari" is_locked = yes regiments = { Mot_Militia_Bat = { x = 0 y = 0 } Mot_Militia_Bat = { x = 0 y = 1 } Mot_Militia_Bat = { x = 0 y = 2 } Mot_Militia_Bat = { x = 0 y = 3 } } support = { H_Engi_Comp = { x = 0 y = 0 } } } if = { limit = { NOT = { tag = ITA } } set_temp_variable = { spawn_count = 0 } if = { limit = { check_variable = { ITA.civil_war_volounteers_2 > 0 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { ITA.civil_war_volounteers_2 > 10 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { ITA.civil_war_volounteers_2 > 20 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { ITA.civil_war_volounteers_2 > 30 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { ITA.civil_war_volounteers_2 > 40 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { spawn_count > 0 } } for_loop_effect = { end = spawn_count value = spawn_i every_state = { limit = { is_core_of = ITA } create_unit = { division = "name = \"Reggimento Volontari\" division_template = \"Volontari\" start_experience_factor = 0.1 start_equipment_factor = 1.0" owner = PREV allow_spawning_on_enemy_provs = yes count = 1 } } } } } } seize_power_spawn_volounteers_effect_2 = { division_template = { name = "Volontari" is_locked = yes regiments = { Mot_Militia_Bat = { x = 0 y = 0 } Mot_Militia_Bat = { x = 0 y = 1 } Mot_Militia_Bat = { x = 0 y = 2 } Mot_Militia_Bat = { x = 0 y = 3 } } support = { H_Engi_Comp = { x = 0 y = 0 } } } if = { limit = { tag = ITA } set_temp_variable = { spawn_count = 0 } if = { limit = { check_variable = { civil_war_volounteers_2 < 50 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { civil_war_volounteers_2 < 40 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { civil_war_volounteers_2 < 30 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { civil_war_volounteers_2 < 20 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { civil_war_volounteers_2 < 10 } } add_to_temp_variable = { spawn_count = 1 } } if = { limit = { check_variable = { spawn_count > 0 } } for_loop_effect = { end = spawn_count value = spawn_i every_state = { limit = { is_core_of = ITA } create_unit = { division = "name = \"Reggimento Volontari\" division_template = \"Volontari\" start_experience_factor = 0.1 start_equipment_factor = 1.0" owner = ITA allow_spawning_on_enemy_provs = yes count = 1 } } } } } } technocrats_coalition_popularity_lose_statalist = { custom_effect_tooltip = technocrats_coalition_popularity_lose_TT for_each_loop = { array = gov_coalition_array value = v if = { limit = { OR = { check_variable = { v = 3 } check_variable = { v = 4 } check_variable = { v = 5 } check_variable = { v = 6 } check_variable = { v = 7 } check_variable = { v = 17 } check_variable = { v = 18 } check_variable = { v = 19 } check_variable = { v = 20 } check_variable = { v = 21 } check_variable = { v = 22 } check_variable = { v = 23 } } } set_temp_variable = { party_index = v } set_temp_variable = { party_popularity_increase = -0.10 } set_temp_variable = { temp_outlook_increase = -0.08 } change_relative_party_popularity = yes } } } technocrats_coalition_popularity_lose_antistatalist = { custom_effect_tooltip = technocrats_coalition_popularity_lose_TT for_each_loop = { array = gov_coalition_array value = v if = { limit = { OR = { check_variable = { v = 2 } check_variable = { v = 16 } } } set_temp_variable = { party_index = v } set_temp_variable = { party_popularity_increase = -0.10 } set_temp_variable = { temp_outlook_increase = -0.08 } change_relative_party_popularity = yes } } } technocrats_coalition_popularity_lose_conservative = { custom_effect_tooltip = technocrats_coalition_popularity_lose_TT for_each_loop = { array = gov_coalition_array value = v if = { limit = { OR = { check_variable = { v = 1 } check_variable = { v = 6 } check_variable = { v = 10 } check_variable = { v = 11 } check_variable = { v = 12 } check_variable = { v = 14 } check_variable = { v = 20 } check_variable = { v = 21 } check_variable = { v = 22 } check_variable = { v = 23 } } } set_temp_variable = { party_index = v } set_temp_variable = { party_popularity_increase = -0.10 } set_temp_variable = { temp_outlook_increase = -0.08 } change_relative_party_popularity = yes } } } #additional expenses modify_additional_expenses_effect = { custom_effect_tooltip = ITA_modify_additional_expenses_effect_TT add_to_variable = { ITA_additional_expenses_var = additional_expenses_change } } #nimby modify_nimby_modifier_effect = { custom_effect_tooltip = ITA_modify_nimby_modifier_effect_TT add_to_variable = { nimby_culture_var = nimby_culture_change } clamp_variable = { var = nimby_culture_var max = 0 } } ITA_upgrade_astra_mining_division = { if = { limit = { has_idea = ITA_astra_idea1 } swap_ideas = { remove_idea = ITA_astra_idea1 add_idea = ITA_astra_idea2 } } else_if = { limit = { has_idea = ITA_astra_idea2 } swap_ideas = { remove_idea = ITA_astra_idea2 add_idea = ITA_astra_idea3 } } else_if = { limit = { has_idea = ITA_astra_idea3 } swap_ideas = { remove_idea = ITA_astra_idea3 add_idea = ITA_astra_idea4 } } else_if = { limit = { has_idea = ITA_astra_idea4 } swap_ideas = { remove_idea = ITA_astra_idea4 add_idea = ITA_astra_idea5 } } }