faction_goal_update_daily_condition_caches = { scope:faction = { set_variable = { faction_goal_aggressive_defense_condition_cache = 0 } set_variable = { faction_goal_secure_europe_condition_cache = 0 } set_variable = { faction_goal_nato_gdp_condition_cache = 0 } set_variable = { faction_goal_crush_democracy_condition_cache = 0 } set_variable = { faction_goal_secure_east_asia_condition_cache = 0 } set_variable = { faction_goal_liberate_visible_cache = 0 } set_variable = { faction_goal_liberate_completed_cache = 0 } set_variable = { faction_goal_liberate_ai_4_cache = 0 } set_variable = { faction_goal_liberate_ai_10_cache = 0 } set_variable = { faction_goal_great_offensive_visible_cache = 0 } set_variable = { faction_goal_great_offensive_completed_cache = 0 } set_variable = { faction_goal_great_offensive_secure_cache = 0 } set_variable = { faction_goal_no_communist_members_cache = 0 } set_variable = { faction_goal_communist_states_available_cache = 0 } set_variable = { faction_goal_communist_states_completed_cache = 0 } set_variable = { faction_goal_no_fascist_members_cache = 0 } set_variable = { faction_goal_fascist_states_available_cache = 0 } set_variable = { faction_goal_fascist_states_completed_cache = 0 } set_variable = { faction_goal_no_anti_communist_members_cache = 0 } set_variable = { faction_goal_anti_communist_states_available_cache = 0 } set_variable = { faction_goal_anti_communist_states_completed_cache = 0 } set_variable = { faction_goal_long_live_revolution_cache = 0 } set_variable = { faction_goal_democracy_in_europe_cache = 0 } set_variable = { faction_goal_communist_controlled_states_count_cache = 0 } set_variable = { faction_goal_fascist_controlled_states_count_cache = 0 } set_variable = { faction_goal_anti_communist_controlled_states_count_cache = 0 } } if = { limit = { OR = { has_war = yes has_faction_goal = faction_goal_aggressive_defense has_faction_goal = faction_goal_liberate_territory has_faction_goal = faction_goal_great_offensive } } set_temp_variable = { faction_goal_core_states_not_controlled_count_cache_temp = 0 } set_temp_variable = { faction_goal_core_states_not_fully_controlled_count_cache_temp = 0 } every_collection_element = { input = collection:faction_owned_core_states_collection if = { limit = { is_controlled_by_ROOT_or_ally = no } add_to_temp_variable = { ROOT.faction_goal_core_states_not_controlled_count_cache_temp = 1 } } if = { limit = { NOT = { is_fully_controlled_by = OWNER } } add_to_temp_variable = { ROOT.faction_goal_core_states_not_fully_controlled_count_cache_temp = 1 } } } scope:faction = { set_variable = { faction_goal_core_states_not_controlled_count_cache = ROOT.faction_goal_core_states_not_controlled_count_cache_temp } set_variable = { faction_goal_core_states_not_fully_controlled_count_cache = ROOT.faction_goal_core_states_not_fully_controlled_count_cache_temp } } } scope:faction = { if = { limit = { check_variable = { var = faction_goal_core_states_not_controlled_count_cache value = 0 compare = less_than_or_equals } } set_variable = { faction_goal_aggressive_defense_condition_cache = 1 } } if = { limit = { check_variable = { var = faction_goal_core_states_not_fully_controlled_count_cache value = 1 compare = greater_than_or_equals } } set_variable = { faction_goal_liberate_visible_cache = 1 } } if = { limit = { check_variable = { var = faction_goal_core_states_not_fully_controlled_count_cache value = 0 compare = less_than_or_equals } } set_variable = { faction_goal_liberate_completed_cache = 1 } set_variable = { faction_goal_great_offensive_secure_cache = 1 } } if = { limit = { check_variable = { var = faction_goal_core_states_not_fully_controlled_count_cache value = 5 compare = greater_than_or_equals } } set_variable = { faction_goal_liberate_ai_4_cache = 1 } } if = { limit = { check_variable = { var = faction_goal_core_states_not_fully_controlled_count_cache value = 11 compare = greater_than_or_equals } } set_variable = { faction_goal_liberate_ai_10_cache = 1 } } if = { limit = { check_variable = { var = faction_goal_communist_member_count_cache value = 0 compare = less_than_or_equals } } set_variable = { faction_goal_no_communist_members_cache = 1 } } if = { limit = { check_variable = { var = faction_goal_fascist_member_count_cache value = 0 compare = less_than_or_equals } } set_variable = { faction_goal_no_fascist_members_cache = 1 } } if = { limit = { check_variable = { var = faction_goal_anti_communist_member_count_cache value = 0 compare = less_than_or_equals } } set_variable = { faction_goal_no_anti_communist_members_cache = 1 } } } if = { limit = { NOT = { has_completed_faction_goal = faction_goal_secure_european_continent } OR = { original_tag = GER has_faction_goal = faction_goal_secure_european_continent } } set_temp_variable = { faction_goal_secure_europe_count_cache_temp = 0 } every_collection_element = { input = { input = constant:country_groups.continental_europe_2000 name = COLLECTION_COUNTRIES_ALL_EUROPEAN_COUNTRIES operators = { limit = { OR = { is_in_faction_with = ROOT has_capitulated = yes exists = no is_subject_of = ROOT } } } } add_to_temp_variable = { ROOT.faction_goal_secure_europe_count_cache_temp = 1 } } scope:faction = { set_variable = { faction_goal_secure_europe_count_cache = ROOT.faction_goal_secure_europe_count_cache_temp } if = { limit = { check_variable = { var = faction_goal_secure_europe_count_cache value = 17 compare = greater_than_or_equals } } set_variable = { faction_goal_secure_europe_condition_cache = 1 } } } } if = { limit = { NOT = { has_completed_faction_goal = faction_goal_secure_east_asia_continent } OR = { original_tag = JAP has_faction_goal = faction_goal_secure_east_asia_continent } } set_temp_variable = { faction_goal_secure_east_asia_count_cache_temp = 0 } every_collection_element = { input = { input = constant:country_groups.continental_east_asia_2000 name = COLLECTION_COUNTRIES_ASIA operators = { limit = { OR = { is_in_faction_with = ROOT has_capitulated = yes exists = no is_subject_of = ROOT } } } } add_to_temp_variable = { ROOT.faction_goal_secure_east_asia_count_cache_temp = 1 } } scope:faction = { set_variable = { faction_goal_secure_east_asia_count_cache = ROOT.faction_goal_secure_east_asia_count_cache_temp } if = { limit = { check_variable = { var = faction_goal_secure_east_asia_count_cache value = 17 compare = greater_than_or_equals } } set_variable = { faction_goal_secure_east_asia_condition_cache = 1 } } } } if = { limit = { NOT = { has_completed_faction_goal = faction_goal_nato_gdp_per_capita } OR = { has_faction_template = faction_template_nato has_faction_goal = faction_goal_nato_gdp_per_capita } } scope:faction = { if = { limit = { check_variable = { faction_goal_nato_gdp_eligible_member_count_cache = faction_goal_member_count_cache } } set_variable = { faction_goal_nato_gdp_condition_cache = 1 } } } } if = { limit = { NOT = { has_completed_faction_goal = faction_goal_crush_the_democracy } OR = { has_elections = no has_faction_goal = faction_goal_crush_the_democracy } } scope:faction = { if = { limit = { check_variable = { var = faction_goal_below_30_democracy_member_count_cache value = 11 compare = greater_than_or_equals } } set_variable = { faction_goal_crush_democracy_condition_cache = 1 } } } } if = { limit = { has_war = yes } set_temp_variable = { faction_goal_enemy_core_states_controlled_count_cache_temp = 0 } every_collection_element = { input = collection:faction_enemy_owned_core_states_collection if = { limit = { is_controlled_by_ROOT_or_ally = yes } add_to_temp_variable = { ROOT.faction_goal_enemy_core_states_controlled_count_cache_temp = 1 } } } scope:faction = { set_variable = { faction_goal_enemy_core_states_controlled_count_cache = ROOT.faction_goal_enemy_core_states_controlled_count_cache_temp } if = { limit = { check_variable = { var = faction_goal_enemy_core_states_controlled_count_cache value = 0 compare = less_than_or_equals } } set_variable = { faction_goal_great_offensive_visible_cache = 1 } } if = { limit = { check_variable = { var = faction_goal_enemy_core_states_controlled_count_cache value = 1 compare = greater_than_or_equals } } set_variable = { faction_goal_great_offensive_completed_cache = 1 } } } } if = { limit = { OR = { AND = { has_faction_goal = faction_goal_defeat_of_communism NOT = { has_completed_faction_goal = faction_goal_defeat_of_communism } } AND = { has_faction_goal = faction_goal_defeat_of_fascism NOT = { has_completed_faction_goal = faction_goal_defeat_of_fascism } } AND = { has_faction_goal = faction_goal_defeat_of_anti_communists NOT = { has_completed_faction_goal = faction_goal_defeat_of_anti_communists } } } } set_temp_variable = { faction_goal_communist_controlled_states_count_cache_temp = 0 } set_temp_variable = { faction_goal_fascist_controlled_states_count_cache_temp = 0 } set_temp_variable = { faction_goal_anti_communist_controlled_states_count_cache_temp = 0 } every_collection_element = { input = collection:states_on_my_continent_collection if = { limit = { controller = { has_government = communism } } add_to_temp_variable = { ROOT.faction_goal_communist_controlled_states_count_cache_temp = 1 } } if = { limit = { controller = { has_government = fascism } } add_to_temp_variable = { ROOT.faction_goal_fascist_controlled_states_count_cache_temp = 1 } add_to_temp_variable = { ROOT.faction_goal_anti_communist_controlled_states_count_cache_temp = 1 } } if = { limit = { controller = { has_government = democratic } } add_to_temp_variable = { ROOT.faction_goal_anti_communist_controlled_states_count_cache_temp = 1 } } } scope:faction = { set_variable = { faction_goal_communist_controlled_states_count_cache = ROOT.faction_goal_communist_controlled_states_count_cache_temp } set_variable = { faction_goal_fascist_controlled_states_count_cache = ROOT.faction_goal_fascist_controlled_states_count_cache_temp } set_variable = { faction_goal_anti_communist_controlled_states_count_cache = ROOT.faction_goal_anti_communist_controlled_states_count_cache_temp } if = { limit = { check_variable = { var = faction_goal_communist_controlled_states_count_cache value = 1 compare = greater_than_or_equals } } set_variable = { faction_goal_communist_states_available_cache = 1 } } if = { limit = { check_variable = { var = faction_goal_communist_controlled_states_count_cache value = 0 compare = less_than_or_equals } } set_variable = { faction_goal_communist_states_completed_cache = 1 } } if = { limit = { check_variable = { var = faction_goal_fascist_controlled_states_count_cache value = 1 compare = greater_than_or_equals } } set_variable = { faction_goal_fascist_states_available_cache = 1 } } if = { limit = { check_variable = { var = faction_goal_fascist_controlled_states_count_cache value = 0 compare = less_than_or_equals } } set_variable = { faction_goal_fascist_states_completed_cache = 1 } } if = { limit = { check_variable = { var = faction_goal_anti_communist_controlled_states_count_cache value = 1 compare = greater_than_or_equals } } set_variable = { faction_goal_anti_communist_states_available_cache = 1 } } if = { limit = { check_variable = { var = faction_goal_anti_communist_controlled_states_count_cache value = 0 compare = less_than_or_equals } } set_variable = { faction_goal_anti_communist_states_completed_cache = 1 } } } } if = { limit = { NOT = { has_completed_faction_goal = faction_goal_long_live_the_revolution } OR = { has_faction_template = faction_template_pol_rep has_faction_goal = faction_goal_long_live_the_revolution } } scope:faction = { if = { limit = { check_variable = { var = faction_goal_above_75_communism_member_count_cache value = 20 compare = greater_than_or_equals } } set_variable = { faction_goal_long_live_revolution_cache = 1 } } } } if = { limit = { NOT = { has_completed_faction_goal = faction_goal_democracy_in_europe } OR = { has_faction_template = faction_template_nato has_faction_goal = faction_goal_democracy_in_europe } } if = { limit = { all_of_scopes = { array = global.european_nations has_elections = yes NOT = { has_government = fascism } NOT = { has_government = nationalist } NOT = { has_government = communism } } } scope:faction = { set_variable = { faction_goal_democracy_in_europe_cache = 1 } } } } } faction_goal_update_weekly_condition_caches = { if = { limit = { faction_goal_member_metrics_needed = yes } faction_goal_update_member_metrics_cache = yes } else = { faction_goal_clear_member_metrics_cache = yes faction_goal_clear_member_metric_targets = yes } scope:faction = { set_variable = { faction_goal_resource_control_available_cache = 0 } set_variable = { faction_goal_resource_control_completed_cache = 0 } set_variable = { faction_goal_facilities_visible_cache = 0 } set_variable = { faction_goal_facilities_completed_cache = 0 } set_variable = { faction_goal_great_fortress_available_cache = 0 } set_variable = { faction_goal_technology_sharing_cache = 0 } set_variable = { faction_goal_semiconductor_visible_cache = 0 } set_variable = { faction_goal_semiconductor_supremacy_cache = 0 } set_variable = { faction_goal_strategic_resources_available_cache = 0 } set_variable = { faction_goal_strategic_resources_completed_cache = 0 } set_variable = { faction_goal_secure_oil_cache = 0 } set_variable = { faction_goal_industrial_visible_cache = 0 } set_variable = { faction_goal_industrial_completed_cache = 0 } set_variable = { faction_goal_military_base_visible_cache = 0 } set_variable = { faction_goal_military_base_completed_cache = 0 } set_variable = { faction_goal_land_facility_states_count_cache = 0 } set_variable = { faction_goal_naval_facility_states_count_cache = 0 } set_variable = { faction_goal_air_facility_states_count_cache = 0 } } set_temp_variable = { faction_goal_civilian_factories_cache_temp = 0 } set_temp_variable = { faction_goal_military_factory_buildings_cache_temp = 0 } set_temp_variable = { faction_goal_internet_station_cache_temp = 0 } set_temp_variable = { faction_goal_microchip_plant_cache_temp = 0 } every_faction_member = { add_to_temp_variable = { ROOT.faction_goal_civilian_factories_cache_temp = industrial_complex_total } add_to_temp_variable = { ROOT.faction_goal_military_factory_buildings_cache_temp = military_factory_total } add_to_temp_variable = { ROOT.faction_goal_internet_station_cache_temp = internet_station_total } add_to_temp_variable = { ROOT.faction_goal_microchip_plant_cache_temp = microchip_plant_total } } scope:faction = { set_variable = { faction_goal_civilian_factories_cache = ROOT.faction_goal_civilian_factories_cache_temp } set_variable = { faction_goal_military_factory_buildings_cache = ROOT.faction_goal_military_factory_buildings_cache_temp } set_variable = { faction_goal_internet_station_cache = ROOT.faction_goal_internet_station_cache_temp } set_variable = { faction_goal_microchip_plant_cache = ROOT.faction_goal_microchip_plant_cache_temp } } if = { limit = { check_variable = { faction_resource_extracted@oil < 500 } check_variable = { faction_resource_extracted@rubber < 200 } check_variable = { faction_resource_extracted@aluminium < 200 } check_variable = { faction_resource_extracted@chromium < 200 } check_variable = { faction_resource_extracted@tungsten < 200 } } scope:faction = { set_variable = { faction_goal_resource_control_available_cache = 1 } } } if = { limit = { check_variable = { faction_resource_extracted@oil > 499 } check_variable = { faction_resource_extracted@rubber > 199 } check_variable = { faction_resource_extracted@aluminium > 199 } check_variable = { faction_resource_extracted@chromium > 199 } check_variable = { faction_resource_extracted@tungsten > 199 } } scope:faction = { set_variable = { faction_goal_resource_control_completed_cache = 1 } } } if = { limit = { check_variable = { faction_resource_extracted@oil < 300 } } scope:faction = { set_variable = { faction_goal_strategic_resources_available_cache = 1 } } } if = { limit = { check_variable = { faction_resource_extracted@oil > 299 } check_variable = { faction_resource_extracted@rubber > 149 } check_variable = { faction_resource_extracted@aluminium > 149 } } scope:faction = { set_variable = { faction_goal_strategic_resources_completed_cache = 1 } } } set_temp_variable = { faction_goal_land_facility_states_count_cache_temp = 0 } set_temp_variable = { faction_goal_naval_facility_states_count_cache_temp = 0 } set_temp_variable = { faction_goal_air_facility_states_count_cache_temp = 0 } every_collection_element = { input = collection:faction_controlled_states_collection if = { limit = { land_facility > 0 } add_to_temp_variable = { ROOT.faction_goal_land_facility_states_count_cache_temp = 1 } } if = { limit = { naval_facility > 0 } add_to_temp_variable = { ROOT.faction_goal_naval_facility_states_count_cache_temp = 1 } } if = { limit = { air_facility > 0 } add_to_temp_variable = { ROOT.faction_goal_air_facility_states_count_cache_temp = 1 } } } scope:faction = { set_variable = { faction_goal_land_facility_states_count_cache = ROOT.faction_goal_land_facility_states_count_cache_temp } set_variable = { faction_goal_naval_facility_states_count_cache = ROOT.faction_goal_naval_facility_states_count_cache_temp } set_variable = { faction_goal_air_facility_states_count_cache = ROOT.faction_goal_air_facility_states_count_cache_temp } if = { limit = { check_variable = { var = faction_goal_land_facility_states_count_cache value = 0 compare = less_than_or_equals } check_variable = { var = faction_goal_naval_facility_states_count_cache value = 0 compare = less_than_or_equals } check_variable = { var = faction_goal_air_facility_states_count_cache value = 0 compare = less_than_or_equals } } set_variable = { faction_goal_facilities_visible_cache = 1 } } if = { limit = { check_variable = { var = faction_goal_land_facility_states_count_cache value = 1 compare = greater_than_or_equals } check_variable = { var = faction_goal_naval_facility_states_count_cache value = 1 compare = greater_than_or_equals } check_variable = { var = faction_goal_air_facility_states_count_cache value = 1 compare = greater_than_or_equals } } set_variable = { faction_goal_facilities_completed_cache = 1 } } if = { limit = { check_variable = { var = faction_goal_core_states_not_fully_controlled_count_cache value = 0 compare = less_than_or_equals } } set_variable = { faction_goal_great_fortress_available_cache = 1 } } if = { limit = { check_variable = { faction_goal_microchip_plant_cache > 0 } } set_variable = { faction_goal_semiconductor_visible_cache = 1 } } if = { limit = { check_variable = { faction_goal_microchip_plant_cache > 49 } } set_variable = { faction_goal_semiconductor_supremacy_cache = 1 } } if = { limit = { check_variable = { faction_goal_civilian_factories_cache > 49 } } set_variable = { faction_goal_industrial_visible_cache = 1 } } if = { limit = { check_variable = { faction_goal_civilian_factories_cache > 149 } } set_variable = { faction_goal_industrial_completed_cache = 1 } } if = { limit = { check_variable = { faction_goal_military_factory_buildings_cache > 49 } } set_variable = { faction_goal_military_base_visible_cache = 1 } } if = { limit = { check_variable = { faction_goal_military_factory_buildings_cache > 149 } } set_variable = { faction_goal_military_base_completed_cache = 1 } } } if = { limit = { NOT = { has_completed_faction_goal = faction_goal_technology_sharing } OR = { has_faction_research_unlocked = yes has_faction_goal = faction_goal_technology_sharing } scope:faction = { check_variable = { faction_goal_internet_station_cache > 49 } } } scope:faction = { set_variable = { faction_goal_technology_sharing_cache = 1 } } } if = { limit = { NOT = { has_completed_faction_goal = faction_goal_secure_the_oil_supply } OR = { original_tag = JAP has_faction_goal = faction_goal_secure_the_oil_supply } has_resources_in_collection = { collection = collection:faction_members_collection resource = oil amount > 199 } } scope:faction = { set_variable = { faction_goal_secure_oil_cache = 1 } } } } faction_goal_update_member_metrics_cache = { faction_goal_clear_member_metrics_cache = yes if = { limit = { has_faction_goal = faction_goal_unlock_research } scope:faction = { clear_variable = unlock_target } } else_if = { limit = { has_faction_goal = faction_goal_unlock_military } scope:faction = { clear_variable = unlock_military_techs_researched_target } } else = { faction_goal_clear_member_metric_targets = yes } set_temp_variable = { faction_goal_member_metrics_land = 0 } if = { limit = { OR = { check_variable = { faction_goal_force_infantry_cache = 1 } check_variable = { faction_goal_force_mechanized_cache = 1 } check_variable = { faction_goal_force_tank_cache = 1 } has_faction_goal = faction_goal_joint_military_exercises has_faction_goal = faction_goal_an_infantry_army has_faction_goal = faction_goal_transform_nato_forces has_faction_goal = faction_goal_transform_eap_forces has_faction_goal = faction_goal_an_armored_fist } } set_temp_variable = { faction_goal_member_metrics_land = 1 } } set_temp_variable = { faction_goal_member_metrics_naval = 0 } if = { limit = { OR = { check_variable = { faction_goal_force_capital_ships_cache = 1 } has_faction_goal = faction_goal_high_seas_fleet has_faction_goal = faction_goal_marine_corps has_faction_goal = faction_goal_submarine_force has_faction_goal = faction_goal_convoy_escort_force } } set_temp_variable = { faction_goal_member_metrics_naval = 1 } } set_temp_variable = { faction_goal_member_metrics_air = 0 } if = { limit = { OR = { has_faction_goal = faction_goal_airborne_corps has_faction_goal = faction_goal_air_superiority } } set_temp_variable = { faction_goal_member_metrics_air = 1 } } set_temp_variable = { faction_goal_member_metrics_research = 0 } if = { limit = { OR = { check_variable = { faction_goal_force_researched_technologies_cache = 1 } check_variable = { faction_goal_force_armies_cache = 1 } has_faction_goal = faction_goal_unlock_research has_faction_goal = faction_goal_unlock_military } } set_temp_variable = { faction_goal_member_metrics_research = 1 } } set_temp_variable = { faction_goal_infantry_battalions_cache_temp = 0 } set_temp_variable = { faction_goal_mechanized_battalions_cache_temp = 0 } set_temp_variable = { faction_goal_tank_battalions_cache_temp = 0 } set_temp_variable = { faction_goal_capital_ships_cache_temp = 0 } set_temp_variable = { faction_goal_marine_battalions_cache_temp = 0 } set_temp_variable = { faction_goal_airborne_battalions_cache_temp = 0 } set_temp_variable = { faction_goal_submarines_cache_temp = 0 } set_temp_variable = { faction_goal_screen_ships_cache_temp = 0 } set_temp_variable = { faction_goal_fighters_cache_temp = 0 } set_temp_variable = { faction_goal_strategic_bombers_cache_temp = 0 } set_temp_variable = { faction_goal_researched_technologies_cache_temp = 0 } set_temp_variable = { faction_goal_armies_cache_temp = 0 } set_temp_variable = { faction_goal_military_factories_cache_temp = 0 } set_temp_variable = { faction_goal_member_count_cache_temp = 0 } set_temp_variable = { faction_goal_communist_member_count_cache_temp = 0 } set_temp_variable = { faction_goal_fascist_member_count_cache_temp = 0 } set_temp_variable = { faction_goal_anti_communist_member_count_cache_temp = 0 } set_temp_variable = { faction_goal_below_30_democracy_member_count_cache_temp = 0 } set_temp_variable = { faction_goal_above_75_communism_member_count_cache_temp = 0 } set_temp_variable = { faction_goal_nato_gdp_eligible_member_count_cache_temp = 0 } set_temp_variable = { faction_goal_panama_visible_cache_temp = 0 } set_temp_variable = { faction_goal_gibraltar_visible_cache_temp = 0 } set_temp_variable = { faction_goal_bosporus_visible_cache_temp = 0 } set_temp_variable = { faction_goal_suez_visible_cache_temp = 0 } set_temp_variable = { faction_goal_mandeb_visible_cache_temp = 0 } every_faction_member = { add_to_temp_variable = { PREV.faction_goal_member_count_cache_temp = 1 } if = { limit = { is_major = yes } set_temp_variable = { PREV.faction_goal_panama_visible_cache_temp = 1 } set_temp_variable = { PREV.faction_goal_gibraltar_visible_cache_temp = 1 } set_temp_variable = { PREV.faction_goal_bosporus_visible_cache_temp = 1 } set_temp_variable = { PREV.faction_goal_suez_visible_cache_temp = 1 } set_temp_variable = { PREV.faction_goal_mandeb_visible_cache_temp = 1 } } else = { if = { limit = { capital_scope = { OR = { is_on_continent = north_america is_on_continent = south_america } } } set_temp_variable = { PREV.faction_goal_panama_visible_cache_temp = 1 } } if = { limit = { capital_scope = { OR = { is_on_continent = europe is_on_continent = africa } } } set_temp_variable = { PREV.faction_goal_gibraltar_visible_cache_temp = 1 } } if = { limit = { capital_scope = { OR = { is_on_continent = europe is_on_continent = asia is_on_continent = middle_east } } } set_temp_variable = { PREV.faction_goal_bosporus_visible_cache_temp = 1 } } if = { limit = { capital_scope = { OR = { is_on_continent = europe is_on_continent = africa is_on_continent = asia is_on_continent = middle_east } } } set_temp_variable = { PREV.faction_goal_suez_visible_cache_temp = 1 } } if = { limit = { capital_scope = { OR = { is_on_continent = africa is_on_continent = middle_east } } } set_temp_variable = { PREV.faction_goal_mandeb_visible_cache_temp = 1 } } } if = { limit = { PREV = { check_variable = { faction_goal_member_metrics_land = 1 } } } add_to_temp_variable = { PREV.faction_goal_infantry_battalions_cache_temp = num_battalions_with_type@Militia_Bat } add_to_temp_variable = { PREV.faction_goal_infantry_battalions_cache_temp = num_battalions_with_type@L_Inf_Bat } add_to_temp_variable = { PREV.faction_goal_infantry_battalions_cache_temp = num_battalions_with_type@L_Air_Inf_Bat } add_to_temp_variable = { PREV.faction_goal_infantry_battalions_cache_temp = num_battalions_with_type@Mot_Air_Inf_Bat } add_to_temp_variable = { PREV.faction_goal_infantry_battalions_cache_temp = num_battalions_with_type@Mech_Air_Inf_Bat } add_to_temp_variable = { PREV.faction_goal_infantry_battalions_cache_temp = num_battalions_with_type@Arm_Air_Inf_Bat } add_to_temp_variable = { PREV.faction_goal_infantry_battalions_cache_temp = num_battalions_with_type@L_Marine_Bat } add_to_temp_variable = { PREV.faction_goal_infantry_battalions_cache_temp = num_battalions_with_type@L_Air_assault_Bat } add_to_temp_variable = { PREV.faction_goal_infantry_battalions_cache_temp = num_battalions_with_type@L_Ranger_Bat } add_to_temp_variable = { PREV.faction_goal_infantry_battalions_cache_temp = num_battalions_with_type@L_Marine_Cdo_Bat } add_to_temp_variable = { PREV.faction_goal_infantry_battalions_cache_temp = num_battalions_with_type@Special_Forces } add_to_temp_variable = { PREV.faction_goal_infantry_battalions_cache_temp = num_battalions_with_type@fake_intel_unit } } if = { limit = { PREV = { check_variable = { faction_goal_member_metrics_naval = 1 } } } add_to_temp_variable = { PREV.faction_goal_capital_ships_cache_temp = num_ships_with_type@battleship } add_to_temp_variable = { PREV.faction_goal_capital_ships_cache_temp = num_ships_with_type@battle_cruiser } add_to_temp_variable = { PREV.faction_goal_capital_ships_cache_temp = num_ships_with_type@cruiser } add_to_temp_variable = { PREV.faction_goal_capital_ships_cache_temp = num_ships_with_type@stealth_destroyer } add_to_temp_variable = { PREV.faction_goal_capital_ships_cache_temp = num_ships_with_type@destroyer } add_to_temp_variable = { PREV.faction_goal_capital_ships_cache_temp = num_ships_with_type@heavy_frigate } } if = { limit = { PREV = { check_variable = { faction_goal_member_metrics_air = 1 } } } add_to_temp_variable = { PREV.faction_goal_airborne_battalions_cache_temp = num_battalions_with_type@Arm_Air_Inf_Bat } add_to_temp_variable = { PREV.faction_goal_airborne_battalions_cache_temp = num_battalions_with_type@Mech_Air_Inf_Bat } add_to_temp_variable = { PREV.faction_goal_airborne_battalions_cache_temp = num_battalions_with_type@Mot_Air_Inf_Bat } add_to_temp_variable = { PREV.faction_goal_airborne_battalions_cache_temp = num_battalions_with_type@L_Air_Inf_Bat } } if = { limit = { PREV = { check_variable = { faction_goal_member_metrics_naval = 1 } } } add_to_temp_variable = { PREV.faction_goal_submarines_cache_temp = num_ships_with_type@missile_submarine } add_to_temp_variable = { PREV.faction_goal_submarines_cache_temp = num_ships_with_type@attack_submarine } } if = { limit = { PREV = { check_variable = { faction_goal_member_metrics_naval = 1 } } } add_to_temp_variable = { PREV.faction_goal_screen_ships_cache_temp = num_ships_with_type@screen_destroyer } add_to_temp_variable = { PREV.faction_goal_screen_ships_cache_temp = num_ships_with_type@stealth_frigate } add_to_temp_variable = { PREV.faction_goal_screen_ships_cache_temp = num_ships_with_type@frigate } add_to_temp_variable = { PREV.faction_goal_screen_ships_cache_temp = num_ships_with_type@corvette } add_to_temp_variable = { PREV.faction_goal_screen_ships_cache_temp = num_ships_with_type@stealth_corvette } add_to_temp_variable = { PREV.faction_goal_screen_ships_cache_temp = num_ships_with_type@patrol_boat } } if = { limit = { PREV = { check_variable = { faction_goal_member_metrics_air = 1 } } } add_to_temp_variable = { PREV.faction_goal_fighters_cache_temp = num_deployed_planes_with_type@small_plane_airframe } add_to_temp_variable = { PREV.faction_goal_fighters_cache_temp = num_deployed_planes_with_type@cv_small_plane_airframe } } if = { limit = { PREV = { check_variable = { faction_goal_member_metrics_air = 1 } } } add_to_temp_variable = { PREV.faction_goal_strategic_bombers_cache_temp = num_deployed_planes_with_type@large_plane_airframe } } if = { limit = { PREV = { check_variable = { faction_goal_member_metrics_research = 1 } } } add_to_temp_variable = { PREV.faction_goal_researched_technologies_cache_temp = num_researched_technologies } } if = { limit = { PREV = { check_variable = { faction_goal_member_metrics_research = 1 } } } add_to_temp_variable = { PREV.faction_goal_armies_cache_temp = num_armies } } add_to_temp_variable = { PREV.faction_goal_military_factories_cache_temp = num_of_military_factories } if = { limit = { has_government = communism } add_to_temp_variable = { PREV.faction_goal_communist_member_count_cache_temp = 1 } } if = { limit = { has_government = fascism } add_to_temp_variable = { PREV.faction_goal_fascist_member_count_cache_temp = 1 } } if = { limit = { OR = { has_government = fascism has_government = democratic } } add_to_temp_variable = { PREV.faction_goal_anti_communist_member_count_cache_temp = 1 } } if = { limit = { democratic < 0.3 } add_to_temp_variable = { PREV.faction_goal_below_30_democracy_member_count_cache_temp = 1 } } if = { limit = { communism > 0.75 } add_to_temp_variable = { PREV.faction_goal_above_75_communism_member_count_cache_temp = 1 } } if = { limit = { check_variable = { gdp_per_capita > 24.999 } } add_to_temp_variable = { PREV.faction_goal_nato_gdp_eligible_member_count_cache_temp = 1 } } } if = { limit = { check_variable = { faction_goal_member_metrics_land = 1 } } every_collection_element = { input = collection:faction_members_collection add_to_temp_variable = { ROOT.faction_goal_mechanized_battalions_cache_temp = num_battalions_with_type@Mech_Inf_Bat } add_to_temp_variable = { ROOT.faction_goal_mechanized_battalions_cache_temp = num_battalions_with_type@Arm_Inf_Bat } add_to_temp_variable = { ROOT.faction_goal_mechanized_battalions_cache_temp = num_battalions_with_type@Mech_Air_Inf_Bat } add_to_temp_variable = { ROOT.faction_goal_mechanized_battalions_cache_temp = num_battalions_with_type@Arm_Air_Inf_Bat } add_to_temp_variable = { ROOT.faction_goal_mechanized_battalions_cache_temp = num_battalions_with_type@Mech_Marine_Bat } add_to_temp_variable = { ROOT.faction_goal_mechanized_battalions_cache_temp = num_battalions_with_type@Arm_Marine_Bat } } } if = { limit = { check_variable = { faction_goal_member_metrics_land = 1 } } every_collection_element = { input = collection:faction_members_collection add_to_temp_variable = { ROOT.faction_goal_tank_battalions_cache_temp = num_battalions_with_type@armor_Bat } add_to_temp_variable = { ROOT.faction_goal_tank_battalions_cache_temp = num_battalions_with_type@L_arm_Bat } add_to_temp_variable = { ROOT.faction_goal_tank_battalions_cache_temp = num_battalions_with_type@A_L_arm_Bat } } } if = { limit = { check_variable = { faction_goal_member_metrics_naval = 1 } } every_collection_element = { input = collection:faction_members_collection add_to_temp_variable = { ROOT.faction_goal_marine_battalions_cache_temp = num_battalions_with_type@L_Marine_Bat } add_to_temp_variable = { ROOT.faction_goal_marine_battalions_cache_temp = num_battalions_with_type@L_Marine_Cdo_Bat } add_to_temp_variable = { ROOT.faction_goal_marine_battalions_cache_temp = num_battalions_with_type@Mot_Marine_Bat } add_to_temp_variable = { ROOT.faction_goal_marine_battalions_cache_temp = num_battalions_with_type@Mech_Marine_Bat } add_to_temp_variable = { ROOT.faction_goal_marine_battalions_cache_temp = num_battalions_with_type@Arm_Marine_Bat } } } if = { limit = { check_variable = { faction_goal_member_metrics_land = 1 } } set_variable = { faction_goal_mechanized_battalions_cache = faction_goal_mechanized_battalions_cache_temp } set_variable = { faction_goal_tank_battalions_cache = faction_goal_tank_battalions_cache_temp } } scope:faction = { if = { limit = { PREV = { check_variable = { faction_goal_member_metrics_land = 1 } } } set_variable = { faction_goal_infantry_battalions_cache = PREV.faction_goal_infantry_battalions_cache_temp } } if = { limit = { PREV = { check_variable = { faction_goal_member_metrics_naval = 1 } } } set_variable = { faction_goal_capital_ships_cache = PREV.faction_goal_capital_ships_cache_temp } set_variable = { faction_goal_marine_battalions_cache = PREV.faction_goal_marine_battalions_cache_temp } set_variable = { faction_goal_submarines_cache = PREV.faction_goal_submarines_cache_temp } set_variable = { faction_goal_screen_ships_cache = PREV.faction_goal_screen_ships_cache_temp } } if = { limit = { PREV = { check_variable = { faction_goal_member_metrics_air = 1 } } } set_variable = { faction_goal_airborne_battalions_cache = PREV.faction_goal_airborne_battalions_cache_temp } set_variable = { faction_goal_fighters_cache = PREV.faction_goal_fighters_cache_temp } set_variable = { faction_goal_strategic_bombers_cache = PREV.faction_goal_strategic_bombers_cache_temp } } if = { limit = { PREV = { check_variable = { faction_goal_member_metrics_research = 1 } } } set_variable = { faction_goal_researched_technologies_cache = PREV.faction_goal_researched_technologies_cache_temp } set_variable = { faction_goal_armies_cache = PREV.faction_goal_armies_cache_temp } } set_variable = { faction_goal_military_factories_cache = PREV.faction_goal_military_factories_cache_temp } set_variable = { faction_goal_member_count_cache = PREV.faction_goal_member_count_cache_temp } set_variable = { faction_goal_communist_member_count_cache = PREV.faction_goal_communist_member_count_cache_temp } set_variable = { faction_goal_fascist_member_count_cache = PREV.faction_goal_fascist_member_count_cache_temp } set_variable = { faction_goal_anti_communist_member_count_cache = PREV.faction_goal_anti_communist_member_count_cache_temp } set_variable = { faction_goal_below_30_democracy_member_count_cache = PREV.faction_goal_below_30_democracy_member_count_cache_temp } set_variable = { faction_goal_above_75_communism_member_count_cache = PREV.faction_goal_above_75_communism_member_count_cache_temp } set_variable = { faction_goal_nato_gdp_eligible_member_count_cache = PREV.faction_goal_nato_gdp_eligible_member_count_cache_temp } set_variable = { faction_goal_panama_visible_cache = PREV.faction_goal_panama_visible_cache_temp } set_variable = { faction_goal_gibraltar_visible_cache = PREV.faction_goal_gibraltar_visible_cache_temp } set_variable = { faction_goal_bosporus_visible_cache = PREV.faction_goal_bosporus_visible_cache_temp } set_variable = { faction_goal_suez_visible_cache = PREV.faction_goal_suez_visible_cache_temp } set_variable = { faction_goal_mandeb_visible_cache = PREV.faction_goal_mandeb_visible_cache_temp } } } faction_goal_clear_member_metrics_cache = { scope:faction = { clear_variable = faction_goal_infantry_battalions_cache clear_variable = faction_goal_mechanized_battalions_cache clear_variable = faction_goal_tank_battalions_cache clear_variable = faction_goal_capital_ships_cache clear_variable = faction_goal_marine_battalions_cache clear_variable = faction_goal_airborne_battalions_cache clear_variable = faction_goal_submarines_cache clear_variable = faction_goal_screen_ships_cache clear_variable = faction_goal_fighters_cache clear_variable = faction_goal_strategic_bombers_cache clear_variable = faction_goal_researched_technologies_cache clear_variable = faction_goal_armies_cache clear_variable = faction_goal_military_factories_cache clear_variable = faction_goal_member_count_cache clear_variable = faction_goal_communist_member_count_cache clear_variable = faction_goal_fascist_member_count_cache clear_variable = faction_goal_anti_communist_member_count_cache clear_variable = faction_goal_below_30_democracy_member_count_cache clear_variable = faction_goal_above_75_communism_member_count_cache clear_variable = faction_goal_nato_gdp_eligible_member_count_cache clear_variable = faction_goal_panama_visible_cache clear_variable = faction_goal_gibraltar_visible_cache clear_variable = faction_goal_bosporus_visible_cache clear_variable = faction_goal_suez_visible_cache clear_variable = faction_goal_mandeb_visible_cache } } faction_goal_clear_member_metric_targets = { scope:faction = { clear_variable = unlock_military_techs_researched_target clear_variable = unlock_target } } faction_goal_select_unlock_research = { set_temp_variable = { faction_goal_force_researched_technologies_cache = 1 } set_temp_variable = { faction_goal_unlock_research_target_temp = 0 } every_faction_member = { set_temp_variable = { faction_goal_research_factor = 0 } if = { limit = { num_researched_technologies < 50 } set_temp_variable = { faction_goal_research_factor = 1.25 } } else_if = { limit = { num_researched_technologies < 75 } set_temp_variable = { faction_goal_research_factor = 1.2 } } else_if = { limit = { num_researched_technologies < 100 } set_temp_variable = { faction_goal_research_factor = 1.15 } } else_if = { limit = { num_researched_technologies < 150 } set_temp_variable = { faction_goal_research_factor = 1.1 } } else_if = { limit = { num_researched_technologies < 200 } set_temp_variable = { faction_goal_research_factor = 1.05 } } set_temp_variable = { faction_goal_research_contribution = num_researched_technologies } multiply_temp_variable = { faction_goal_research_contribution = faction_goal_research_factor } add_to_temp_variable = { ROOT.faction_goal_unlock_research_target_temp = faction_goal_research_contribution } } round_temp_variable = faction_goal_unlock_research_target_temp scope:faction = { set_variable = { unlock_military_techs_researched_target = ROOT.faction_goal_unlock_research_target_temp } } faction_goal_update_member_metrics_cache = yes } faction_goal_select_unlock_military = { set_temp_variable = { faction_goal_force_armies_cache = 1 } faction_goal_update_member_metrics_cache = yes scope:faction = { set_variable = { unlock_target = faction_goal_armies_cache } multiply_variable = { unlock_target = 1.2 } } } faction_goal_update_strategic_bombing_campaign_cache = { set_temp_variable = { faction_goal_recently_bombed_states_cache_temp = 0 } if = { limit = { has_war = yes } every_collection_element = { input = collection:faction_enemy_owned_core_states_recently_bombed_collection add_to_temp_variable = { ROOT.faction_goal_recently_bombed_states_cache_temp = 1 } } } scope:faction = { set_variable = { faction_goal_recently_bombed_states_cache = ROOT.faction_goal_recently_bombed_states_cache_temp } } } faction_goal_update_great_fortress_cache = { set_temp_variable = { faction_goal_great_fortress_cache_temp = 0 } if = { limit = { count_in_collection = { collection = collection:faction_members_collection buildings = { bunker coastal_bunker } size > 29 } } set_temp_variable = { faction_goal_great_fortress_cache_temp = 1 } } scope:faction = { set_variable = { faction_goal_great_fortress_cache = ROOT.faction_goal_great_fortress_cache_temp } } } faction_goal_refresh_all_caches = { faction_goal_update_daily_caches = yes faction_goal_update_weekly_caches = yes } faction_goal_update_daily_caches = { if = { limit = { is_faction_leader = yes } if = { limit = { faction_goal_member_metrics_needed = yes } faction_goal_update_member_metrics_cache = yes } else = { faction_goal_clear_member_metrics_cache = yes faction_goal_clear_member_metric_targets = yes } faction_goal_update_daily_condition_caches = yes if = { limit = { OR = { has_war = yes AND = { has_faction_goal = faction_goal_strategic_bombing_campaign NOT = { has_completed_faction_goal = faction_goal_strategic_bombing_campaign } } } } faction_goal_update_strategic_bombing_campaign_cache = yes } if = { limit = { scope:faction = { NOT = { has_variable = faction_goal_technology_sharing_cache } } } faction_goal_update_weekly_condition_caches = yes } } } faction_goal_update_weekly_caches = { if = { limit = { is_faction_leader = yes } faction_goal_update_weekly_condition_caches = yes if = { limit = { has_faction_goal = faction_goal_a_great_fortress NOT = { has_completed_faction_goal = faction_goal_a_great_fortress } } faction_goal_update_great_fortress_cache = yes } } }