call_parliament = { type = owncountry ai_tick = never automation_tick = never player_automated_category = parliament allow = { scope:actor = { is_active_parliament = no months_since_last_parliament_called > "define:NCountry|PARLIAMENT_COOLDOWN_MONTHS" NOT = { modifier:parliament_abolished = yes modifier:has_a_parliamentary_system = no } } } select_trigger = { show_if = { scope:actor = { NOR = { country_type = building country_type = pop } modifier:permanent_parliament_location = no } } looking_for_a = location source = actor ai_interaction_source_list = { scope:actor = { capital = { add_to_list = source } } } target_flag = parliament_location name = "select_parliament_location" none_available_msg_key = "call_parliament_no_locations" column = { data = rank } column = { data = name_no_rank } column = { data = population } column = { data = control } visible = { has_owner = yes owner ?= scope:actor controller ?= scope:actor local_control > 0 OR = { is_capital = yes AND = { OR = { is_core_of = scope:actor modifier:has_parliament_seat = yes } OR = { is_province_capital = yes has_fort = yes } OR = { is_city = yes scope:actor = { modifier:can_call_rural_parliaments = yes } } } } } } select_trigger = { looking_for_a = parliament_issue interaction_source_list = { scope:actor = { every_possible_parliament_issue = { add_to_list = source } } } ai_interaction_source_list = { scope:actor = { every_possible_parliament_issue = { if = { limit = { "ai_parliament_issue_resolution_vote_bias(scope:actor)" >= 0 } add_to_list = source } } } } cache_interaction_source_list = yes cache_targets = yes target_flag = parliament_issue name = "select_parliament_debate" none_available_msg_key = "select_parliament_debate_none_available" column = { data = parliament_issue_widget } visible = { is_available_for = scope:actor } } effect = { scope:actor = { if = { limit = { exists = scope:parliament_location } set_parliament_location = scope:parliament_location custom_tooltip = { text = select_parliament_location_modifier_tooltip } if = { limit = { scope:parliament_location = scope:actor.capital } custom_tooltip = { text = select_parliament_location_capital_modifier_tooltip } } else = { custom_tooltip = { text = select_parliament_location_not_capital_modifier_tooltip } } scope:parliament_location = { add_location_modifier = { modifier = parliament_location mode = replace days = 180 } } } else = { custom_tooltip = select_parliament_location_inform_choice_tt set_parliament_location = scope:actor.capital scope:actor.capital = { add_location_modifier = { modifier = parliament_location mode = replace days = 180 } } } set_parliament_active = yes if = { limit = { exists = scope:parliament_issue } set_parliament_issue = scope:parliament_issue set_parliament_issue_support = { add = { desc = parliament_base_support value = modifier:parliament_base_support } if = { limit = { scope:parliament_issue.estate_type = { always_loyal = no } } add = { desc = estate_power value = "estate_power(scope:parliament_issue.estate_type)" } } } } } } ai_will_do = { add = { if = { limit = { scope:actor = { months_since_last_parliament_called < 72 stability < 0 } } value = -10000 } if = { limit = { scope:actor = { months_since_last_parliament_called > 120 } } value = 500 } #Wants to get a CB out of parliament if = { limit = { scope:actor = { OR = { any_neighbor_country = { scope:actor = { wants_casus_belli_with = prev } } any_rival = { scope:actor = { wants_casus_belli_with = prev } } } } } value = 100 } } scope:actor = { if = { limit = { exists = scope:parliament_issue } add = "parliament_issue_chance(scope:parliament_issue)" add = "object_bias(scope:parliament_issue)" } } if = { limit = { exists = scope:parliament_location } scope:parliament_location = { save_temporary_scope_as = this_parliament_location } } else = { scope:actor = { capital = { save_temporary_scope_as = this_parliament_location } } } multiply = { scope:this_parliament_location = { if = { limit = { scope:actor = { capital = scope:this_parliament_location modifier:can_call_rural_parliaments = no } } value = 30 } else = { value = proximity # proximity goes from 0 to 100 add = { value = local_control # control goes from 0 to 1 multiply = 10 } add = { value = scope:actor.societal_value:centralization_vs_decentralization multiply = 0.1 } add = { value = random_integer modulo = 10 } } if = { limit = { location_rank = location_rank:town } add = 2 } else_if = { limit = { OR = { location_rank = location_rank:city location_rank = location_rank:megalopolis } } add = 10 } add = { value = modifier:fort_level multiply = 2 } } } } } request_more_taxes = { type = parliament sound = PARLIAMENT_REQUEST_MORE_TAXES ai_tick = daily ai_tick_frequency = 100 automation_tick = daily automation_tick_frequency = 1 player_automated_category = parliament allow = { scope:actor = { is_active_parliament = yes NOT = { has_country_modifier = parliament_approved_extra_taxes } parliament_issue_support > modifier:parliament_request_issue_support_needed } } effect = { scope:actor = { add_country_modifier = { modifier = parliament_approved_extra_taxes years = 1 mode = add_and_extend } change_parliament_issue_support = { value = modifier:parliament_request_issue_support_needed multiply = -1 } } } ai_will_do = { add = { if = { limit = { scope:actor = { OR = { parliament_issue_support > 0.9 stability >= 20 } higher_temporary_taxes_needed >= 0.05 NOT = { any_country_in_diplomatic_range = { scope:actor = { wants_casus_belli_with = prev } NOT = { has_target_casus_belli_on_us = scope:actor } } } } } value = 10 } } } } prepare_for_war = { type = parliament show_message_to_target = no sound = PARLIAMENT_PREPARE_FOR_WAR ai_tick = daily ai_tick_frequency = 30 automation_tick = daily automation_tick_frequency = 7 player_automated_category = parliament allow = { scope:actor = { country_type = location is_active_parliament = yes parliament_issue_support > { value = parliament_request_support } } } select_trigger = { looking_for_a = country ai_interaction_source_list = { scope:actor = { every_country_wants_casus_belli_with = { limit = { NOT = { this = scope:actor } scope:actor = { NOT = { has_casus_belli_of_type_on = { type = casus_belli:cb_parliament_conquer_province target = prev } is_at_war_with = prev } } } add_to_list = source } every_country_wants_to_attack = { limit = { NOT = { this = scope:actor } scope:actor = { NOT = { has_casus_belli_on = prev is_at_war_with = prev } } } add_to_list = source } if = { limit = { scope:actor = { OR = { ai_personality = ai_personality:ai_expansionist ai_personality = ai_personality:ai_aggressive } } } every_potential_expansion_target = { #Countries we want some CBs against limit = { scope:actor = { NOT = { has_casus_belli_on = prev is_at_war_with = prev } } } add_to_list = source } } } } target_flag = target pre_evaluation_sort_value = { if = { limit = { scope:target ?= { is_rival_of = scope:actor } } add = { desc = "game_concept_rival" value = 100 } } if = { limit = { exists = scope:actor exists = scope:target } subtract = { desc = "OUR_OPINION_TOOLTIP" value = "scope:actor.opinion(scope:target)" divide = 10 } } } pre_evaluation_number_to_evaluate_fully = 1 name = "prepare_for_war_select_title" none_available_msg_key = "prepare_for_war_no_countries" column = { data = name } column = { data = population } visible = { NOT = { has_target_casus_belli_on_us = root } NOT = { has_truce_with = scope:actor } NOT = { is_subject_of = scope:actor } is_rebel_country = no scope:actor = { within_diplomatic_range = root } capital ?= { is_discovered_by = scope:actor } } } select_trigger = { looking_for_a = province source = target target_flag = target_province pre_evaluation_sort_value = { add = { value = { capital = { add = { value = "border_distance_to(scope:actor)" # capital location only — one cache lookup vs O(locations_per_province) multiply = -10 } } } } add = province_tax_base } pre_evaluation_number_to_evaluate_fully = 1 name = "prepare_for_war_select_province_title" none_available_msg_key = "no_valid_provinces" column = { data = name } column = { data = population } column = { data = province_our_primary_culture_percentage } column = { data = province_tax_base } } effect = { scope:actor = { if = { limit = { exists = scope:target exists = scope:target_province } add_casus_belli = { target = scope:target type = casus_belli:cb_parliament_conquer_province province = scope:target_province } } else = { custom_tooltip = select_a_country_to_get_casus_belli_on } change_parliament_issue_support = { value = modifier:parliament_request_issue_support_needed multiply = -1 } } } ai_will_do = { # we are aggressive and dont have any CBs if = { limit = { or = { scope:actor = { ai_personality = ai_personality:ai_expansionist } scope:actor = { ai_personality = ai_personality:ai_aggressive } } scope:actor.num_cbs < 1 } add = { value = 100 desc = "we want CBs" } } # we want to attack specifically this target and we dont have any CBs, or we want a CB if = { limit = { scope:actor = { or = { and = { wants_to_attack = scope:target not = { scope:actor = { has_casus_belli_on = scope:target_country } } } wants_casus_belli_with = scope:target } } } add = { value = 1000 desc = "we want to attack" } } add = { value = -1 desc = "base reluctance" } } } ask_for_larger_levies = { type = parliament sound = PARLIAMENT_ASK_FOR_LARGER_LEVIES ai_tick = daily ai_tick_frequency = 100 automation_tick = daily automation_tick_frequency = 7 player_automated_category = parliament allow = { scope:actor = { is_active_parliament = yes NOT = { has_country_modifier = parliament_approved_extra_levies } parliament_issue_support > modifier:parliament_request_issue_support_needed } } effect = { scope:actor = { add_country_modifier = { modifier = parliament_approved_extra_levies years = 3 mode = add_and_extend } change_parliament_issue_support = { value = modifier:parliament_request_issue_support_needed multiply = -1 } } } ai_will_do = { #Base subtract = { value = 1 } add = { if = { limit = { scope:actor = { OR = { is_in_losing_war = yes AND = { at_war = yes stability >= 10 } } } } value = 2 } } } } ask_for_law_changes = { type = parliament sound = PARLIAMENT_ASK_FOR_LAW_CHANGES ai_tick = daily ai_tick_frequency = 100 automation_tick = daily automation_tick_frequency = 7 player_automated_category = parliament ai_prerequisite = { discount_needed_for_law_change > 0 has_ai_preferred_parliament_law_change = yes } allow = { scope:actor = { is_active_parliament = yes parliament_issue_support > modifier:parliament_request_issue_support_needed } } select_trigger = { looking_for_a = law interaction_source_list = { scope:actor = { every_current_law = { limit = { NOT = { is_locked_for = scope:actor } } add_to_list = source } } } ai_interaction_source_list = { scope:actor = { every_current_law = { limit = { NOT = { is_locked_for = scope:actor } is_ai_preferred_parliament_change_law = scope:actor } add_to_list = source } } } cache_interaction_source_list = yes target_flag = target_law name = "ask_for_law_changes_select_law_title" none_available_msg_key = "no_valid_laws" column = { data = law_attribute_column } } select_trigger = { looking_for_a = policy interaction_source_list = { scope:target_law = { every_policy_in_law = { limit = { policy_possible_for_country = scope:actor } add_to_list = source } } } ai_interaction_source_list = { scope:target_law = { every_policy_in_law = { limit = { is_ai_preferred_parliament_change_policy = scope:actor } add_to_list = source } } } target_flag = target_policy name = "ask_for_law_changes_select_policies_title" none_available_msg_key = "no_valid_policies" top_widget = law_card_header_at_parlaiment_policy_select column = { data = policy_name_desc } } effect = { scope:actor = { if = { limit = { exists = scope:target_law exists = scope:target_policy } add_policy = scope:target_policy } else = { custom_tooltip = ask_for_law_changes_select_law_title } pay_scaled_price = { price = price:change_policy scale = 0.2 reason = ask_for_law_changes_price_reason } change_parliament_issue_support = { value = modifier:parliament_request_issue_support_needed multiply = -1 } } } ai_will_do = { add = { value = 250 desc = "PREFERRED_LAW_CHANGE" } add = { value = "scope:actor.policy_utility(scope:target_law|scope:target_policy|yes)" } } } change_parliament_type = { type = owncountry allow = { scope:actor = { is_active_parliament = no modifier:parliament_abolished = no } } price = price:change_parliament_type select_trigger = { looking_for_a = parliament_type source = actor target_flag = parliament_type name = "select_parliament_type" none_available_msg_key = "change_parliament_type_no_types" top_widget = parliament_Type_context_widget column = { data = parliament_type_widget } visible = { is_visible_for = scope:actor } enabled = { is_allowed_for = scope:actor } } effect = { scope:actor = { if = { limit = { exists = scope:parliament_type } set_parliament_type = scope:parliament_type } } } ai_tick = never #done in code automation_tick = daily automation_tick_frequency = 365 player_automated_category = parliament } force_parliament_issue = { icon = call_parliament type = parliament allow = { scope:actor = { is_active_parliament = yes trigger_if = { limit = { tag = HUN } OR = { AND = { has_ruler = yes ruler = { has_character_modifier = hun_absolute_rule } } parliament_type = parliament_type:autocratic_parliament } } trigger_else = { parliament_type = parliament_type:autocratic_parliament } } } cooldown = { #only once per parliament session type = has_forced_parliament_issue years = 5 } effect = { scope:actor = { set_parliament_issue_support = { value = 1 } if = { limit = { current_age_or_later = { age = age_5_absolutism } } change_societal_value = { type = absolutism_vs_liberalism value = societal_value_move_to_left } } } } ai_tick = daily ai_tick_frequency = 90 automation_tick = daily automation_tick_frequency = 1 player_automated_category = parliament ai_will_do = { #Base subtract = { value = 1 } add = { if = { limit = { scope:actor = { calc_true_if = { estate_satisfaction:nobles_estate > 0.5 estate_satisfaction:clergy_estate > 0.5 estate_satisfaction:burghers_estate > 0.5 amount >= 2 } } } value = 2 } } } } challenge_bureaucratic_entrenchment = { type = parliament ai_tick = never potential = { scope:actor = { any_current_bureaucracy = { count > 0 } } } allow = { scope:actor = { is_active_parliament = yes modifier:parliament_abolished = no parliament_issue_support > modifier:parliament_request_issue_support_needed any_current_bureaucracy = { entrenchment > entrenchment_radical_penalty } } } select_trigger = { looking_for_a = bureaucracy interaction_source_list = { scope:actor = { every_current_bureaucracy = { limit = { entrenchment > entrenchment_radical_penalty } add_to_list = source } } } target_flag = target_bureaucracy name = "select_bureaucracy" none_available_msg_key = "no_bureaucracies_available" column = { data = name } } effect = { if = { limit = { exists = scope:target_bureaucracy } scope:target_bureaucracy = { change_entrenchment = entrenchment_extreme_bonus } } else = { custom_tooltip = selected_bureaucracy_entrenchment_extreme_bonus_tt } if = { limit = { scope:actor = { NOT = { has_country_modifier = bureaucratic_spending_reform_modifier } } } scope:actor = { add_country_modifier = { modifier = bureaucratic_spending_reform_modifier years = modifier_duration_years_short mode = replace size = { value = 1 if = { limit = { exists = scope:target_bureaucracy } add = { value = scope:target_bureaucracy.entrenchment multiply = 0.01 desc = current_entrenchment_of_selected_bureaucracy_desc } } } } } } scope:actor = { change_parliament_issue_support = { value = modifier:parliament_request_issue_support_needed multiply = -1 } } } ai_will_do = { add = { value = 25 desc = BASE_VALUE } if = { limit = { exists = scope:target_bureaucracy } add = { value = scope:target_bureaucracy.entrenchment desc = "[target_bureaucracy.GetName] entrenchment" } } } } declare_holidays_request = { type = parliament ai_tick = daily ai_tick_frequency = 100 automation_tick = daily automation_tick_frequency = 1 player_automated_category = parliament potential = { scope:actor = { has_reform = government_reform:enlightened_council_reform } } allow = { scope:actor = { has_reform = government_reform:enlightened_council_reform is_active_parliament = yes NOT = { has_country_modifier = parliament_declared_holidays } parliament_issue_support > modifier:parliament_request_issue_support_needed } } effect = { scope:actor = { add_country_modifier = { modifier = parliament_declared_holidays years = 1 mode = add_and_extend } add_stability = stability_severe_bonus change_parliament_issue_support = { value = modifier:parliament_request_issue_support_needed multiply = -1 } } } ai_will_do = { add = { if = { limit = { scope:actor = { OR = { parliament_issue_support > 0.9 stability <= -20 } NOT = { any_country_in_diplomatic_range = { scope:actor = { wants_casus_belli_with = prev } NOT = { has_target_casus_belli_on_us = scope:actor } } } } } value = 10 } } } } force_parliament_support = { type = parliament sound = PARLIAMENT_REQUEST_MORE_TAXES ai_tick = daily ai_tick_frequency = 100 automation_tick = daily automation_tick_frequency = 7 player_automated_category = parliament allow = { scope:actor = { is_active_parliament = yes political_influence >= 50 } } effect = { scope:actor = { add_political_influence = -50 change_parliament_issue_support = { value = 0.25 } if = { limit = { modifier:nobles_estate_can_participate_in_parliament = yes country_has_estate = estate_type:nobles_estate } add_estate_satisfaction = { type = estate_type:nobles_estate value = -0.10 } } if = { limit = { modifier:clergy_estate_can_participate_in_parliament = yes country_has_estate = estate_type:clergy_estate } add_estate_satisfaction = { type = estate_type:clergy_estate value = -0.10 } } if = { limit = { modifier:burghers_estate_can_participate_in_parliament = yes country_has_estate = estate_type:burghers_estate } add_estate_satisfaction = { type = estate_type:burghers_estate value = -0.10 } } if = { limit = { modifier:peasants_estate_can_participate_in_parliament = yes country_has_estate = estate_type:peasants_estate } add_estate_satisfaction = { type = estate_type:peasants_estate value = -0.10 } } } } ai_will_do = { # Base negative — costs 75 PI and upsets every participating estate subtract = { value = 2 desc = "base reluctance" } # Never waste this if support is already above the request threshold add = { if = { limit = { scope:actor = { or = { parliament_issue_support >= modifier:parliament_request_issue_support_needed parliament_issue_support < 0.25 } } } value = -1000 } desc = "too high or too low support" } # Core value: support is below threshold and we cannot act without a boost add = { if = { limit = { scope:actor = { parliament_issue_support < modifier:parliament_request_issue_support_needed } } value = 5 } desc = "below threshold" } # Urgency when at war — need taxes and levies from parliament add = { if = { limit = { scope:actor = { at_war = yes } } value = 3 } desc = "at war" } # Strong urgency when losing — every parliamentary tool matters add = { if = { limit = { scope:actor = { is_in_losing_war = yes } } value = 5 } desc = "losing war" } # Caution: avoid compounding estate grievances when multiple estates already discontented add = { if = { limit = { scope:actor = { calc_true_if = { amount >= 2 estate_satisfaction:nobles_estate < 0.5 estate_satisfaction:clergy_estate < 0.5 estate_satisfaction:burghers_estate < 0.5 } } } value = -4 } desc = "low estate satisfaction" } } } iw_militarize_country = { type = parliament sound = PARLIAMENT_ASK_FOR_LARGER_LEVIES ai_tick = daily ai_tick_frequency = 100 automation_tick = daily automation_tick_frequency = 7 player_automated_category = parliament potential = { situation:italian_wars = { situation_is_active = yes } scope:actor = { can_see_situation = situation:italian_wars } } allow = { scope:actor = { is_active_parliament = yes NOT = { has_country_modifier = parliament_approved_extra_levies } parliament_issue_support > modifier:parliament_request_issue_support_needed regular_army_size > 0 } situation:italian_wars = { var:iw_tension >= 50 } } effect = { scope:actor = { add_country_modifier = { modifier = parliament_approved_militarization years = 3 mode = add_and_extend } add_army_tradition = army_tradition_extreme_bonus if = { limit = { regular_army_size > 0 } ordered_army = { limit = { NOT = { has_unit_modifier = extensive_training_modifier} } order_by = num_subunits max = 1 check_range_bounds = no save_scope_as = target_army add_unit_modifier = { modifier = extensive_training_modifier years = modifier_duration_years_short mode = replace } } } change_parliament_issue_support = { value = modifier:parliament_request_issue_support_needed multiply = -1 } } } ai_will_do = { add = { value = -25 desc = "BASE_VALUE" } add = { value = situation:italian_wars.var:iw_tension desc = "[situation_tension|e]" } add = { value = scope:actor.military_strength desc = "military_strength" } } } seat_the_itinerant_court = { type = parliament ai_tick = daily ai_tick_frequency = 100 potential = { scope:actor = { has_policy = itinerant_court_policy } } allow = { scope:actor = { is_active_parliament = yes has_policy = itinerant_court_policy parliament_issue_support > modifier:parliament_request_issue_support_needed } } cooldown = { type = seat_the_itinerant_court years = 5 } select_trigger = { looking_for_a = location source = actor ai_interaction_source_list = { scope:actor = { every_owned_non_rural_location = { add_to_list = source } } } target_flag = court_seat_location name = "seat_the_itinerant_court_select_title" none_available_msg_key = "no_locations_available" column = { data = name } column = { data = population } column = { data = control } column = { data = rank } visible = { owner ?= scope:actor controller ?= scope:actor local_control > 0 is_core_of = scope:actor # Cannot Seat the Itinerant Court where a Local Governor or a Lieutenancy already sits NOR = { has_building = building_type:local_governor has_building = building_type:lieutenancy } OR = { is_city = yes # Rural locations qualify only if they are a province capital. is_province_capital = yes } } } effect = { scope:actor = { custom_tooltip = { text = seat_the_itinerant_court_passed_tt if = { limit = { any_owned_location = { has_building = building_type:itinerant_court_seat } } random_owned_location = { limit = { has_building = building_type:itinerant_court_seat } save_scope_as = old_court_seat } scope:court_seat_location ?= { move_building = { from = scope:old_court_seat type = itinerant_court_seat owner = scope:actor } } } else = { scope:court_seat_location = { change_building_level_in_location = { building = building_type:itinerant_court_seat value = 1 owner = scope:actor } } } } custom_tooltip = { text = seat_the_itinerant_court_in_session_tt scope:court_seat_location ?= { add_location_modifier = { modifier = itinerant_court_in_session years = 1 } } } change_parliament_issue_support = { value = modifier:parliament_request_issue_support_needed multiply = -1 } hidden_effect = { remove_variable = seat_the_itinerant_court_ai_cd set_variable = { name = seat_the_itinerant_court_ai_cd value = yes days = 7300 } } } } ai_will_do = { value = -250 if = { limit = { scope:court_seat_location = { is_city = no } } subtract = { desc = "not a city" value = 1000 } } add = { desc = "distance to capital" value = "scope:actor.capital.distance_to(scope:court_seat_location)" divide = 2 } add = { desc = "target control" value = 100 subtract = scope:court_seat_location.max_control divide = 2 } add = { desc = "location ranks" value = scope:court_seat_location.rank_index multiply = 10 } if = { limit = { scope:actor = { has_variable = seat_the_itinerant_court_ai_cd } } subtract = { desc = "ai already moved the itinerant court before" value = 1000 } } } }