diff --git a/common/scripted_effects/00_administrative_effects.txt b/common/scripted_effects/00_administrative_effects.txt index 8fb381ded..f15d8dea7 100644 --- a/common/scripted_effects/00_administrative_effects.txt +++ b/common/scripted_effects/00_administrative_effects.txt @@ -260,14 +260,12 @@ change_to_administrative_effect = { change_government = meritocratic_government } else = { # Administrative - add_character_flag = new_government_is_byz_admin change_to_administrative_holding_effect = yes tgp_domicile_conversion_when_changing_government_type = { NEW_DOMICILE_TYPE = estate NEW_GOVERNMENT_TYPE = administrative_government } change_government = administrative_government - remove_character_flag = new_government_is_byz_admin } } # Set up a noble family title @@ -307,16 +305,6 @@ change_to_administrative_effect = { set_up_domicile_estate_effect = yes } } - if = { - limit = { - has_treasury = yes - exists = scope:new_treasury # do not give it mutiple times - } - add_treasury = { - value = gold - min = 100 - } - } } change_to_administrative_interaction_effect = { @@ -427,17 +415,21 @@ change_to_administrative_interaction_effect = { give_new_noble_family_title_effect = { if = { limit = { - is_house_head = yes government_allows = noble_families trigger_if = { - limit = { - government_has_flag = government_has_county_tier_noble_families - } - highest_held_title_tier >= tier_county + limit = { government_has_mechanic = administrative } # excludes republic/soryo + is_house_head = yes + highest_held_title_tier >= min_appointment_tier + liege = { government_allows = noble_families } } - trigger_else = { highest_held_title_tier >= tier_duchy } - liege = { - government_allows = noble_families + # Republic house members in the same republic as their house head must not found a cadet branch + trigger_if = { + limit = { + government_has_flag = government_is_republic + is_house_head = no + exists = house.house_head.highest_liege_matching_mechanic:republic + } + NOT = { highest_liege_matching_mechanic:republic = house.house_head.highest_liege_matching_mechanic:republic } } trigger_if = { limit = { any_held_title = { is_noble_family_title = yes } } @@ -576,3 +568,19 @@ noble_family_title_realm_setup_effect = { } } } + +empty_treasury_effect = { + if = { + limit = { treasury > 0 } + remove_treasury = treasury + } + else_if = { + limit = { treasury < 0 } + hidden_effect = { + add_treasury = { + value = treasury + multiply = -1 + } + } + } +} diff --git a/common/scripted_effects/00_ep3_decision_effects.txt b/common/scripted_effects/00_ep3_decision_effects.txt index 4645cb221..1f9260be7 100644 --- a/common/scripted_effects/00_ep3_decision_effects.txt +++ b/common/scripted_effects/00_ep3_decision_effects.txt @@ -168,6 +168,15 @@ convert_to_administrative_from_feudalism_effect = { } } } + every_vassal = { # If we are republic make sure to convert patricians to admin noble families + limit = { + government_has_flag = government_is_republic + is_landed = no + } + add_character_flag = government_republic_conversion_protection + change_to_administrative_effect = yes + remove_character_flag = government_republic_conversion_protection + } every_vassal = { limit = { highest_held_title_tier >= tier_duchy @@ -206,6 +215,11 @@ convert_to_administrative_from_feudalism_effect = { convert_to_administrative_from_feudalism_game_start_effect = { if = { limit = { has_dlc_feature = roads_to_power } + # Vassals should not start the game grateful for holdings converted at game start. + save_scope_value_as = { + name = feudalize_without_opinion + value = yes + } # Because we run this twice, since folks can change in the lobby. if = { limit = { @@ -241,6 +255,24 @@ convert_to_administrative_from_feudalism_game_start_effect = { } } +convert_to_administrative_from_tribalism_game_start_effect = { + if = { + limit = { has_dlc_feature = roads_to_power } + save_scope_as = actor + convert_to_administrative_from_feudalism_game_start_effect = yes + + # Administrative governments cannot use tribal holdings + # change_to_administrative_effect only converts capitals, so we convert the rest here + every_realm_province = { + limit = { + has_holding_type = tribal_holding + province_owner ?= { government_has_mechanic = administrative } + } + holding_convert_tribal_keeping_buildings_effect = { HOLDING = castle_holding } + } + } +} + apply_historic_administrative_game_rule_effect = { # We'll be doing some excessive triggers below in a bid to lightly future-proof + error-spam mods less, don't worry about it. ## We also do player-specific realms separately — we need to know what their realm is so we do it after the lobby exclusively. @@ -276,7 +308,7 @@ apply_historic_administrative_game_rule_effect = { } if = { limit = { has_game_rule = historicity_extra_admin_ghana_historic_always } - title:k_ghana.holder ?= { convert_to_administrative_from_feudalism_game_start_effect = yes } + title:k_ghana.holder ?= { convert_to_administrative_from_tribalism_game_start_effect = yes } } } # Kabulistan/the Ghaznivids. diff --git a/common/scripted_effects/00_government_effects.txt b/common/scripted_effects/00_government_effects.txt index 3112b884e..b05755bce 100644 --- a/common/scripted_effects/00_government_effects.txt +++ b/common/scripted_effects/00_government_effects.txt @@ -145,6 +145,7 @@ assign_new_government_effect = { } } } + ## Administrative govs else_if = { limit = { OR = { diff --git a/common/scripted_effects/00_holy_order_effects.txt b/common/scripted_effects/00_holy_order_effects.txt index ba08cb442..3c6920a1b 100644 --- a/common/scripted_effects/00_holy_order_effects.txt +++ b/common/scripted_effects/00_holy_order_effects.txt @@ -3547,7 +3547,7 @@ monastic_lease_swapping_effect = { save_scope_as = target_order ordered_leased_title = { order_by = { - value = county.development_level + value = county.prosperity_level multiply = -1 } limit = { @@ -3567,7 +3567,7 @@ monastic_lease_swapping_effect = { } ordered_leased_title = { order_by = { - value = county.development_level + value = county.prosperity_level multiply = -1 } limit = { diff --git a/common/scripted_effects/00_interaction_effects.txt b/common/scripted_effects/00_interaction_effects.txt index 66af458ca..92caf679c 100644 --- a/common/scripted_effects/00_interaction_effects.txt +++ b/common/scripted_effects/00_interaction_effects.txt @@ -5,6 +5,13 @@ # !!! Remember to add all new effects with a short description here !!! ####################################################################### + +####################################################################### +# EFFECT LIST +####################################################################### +# !!! Remember to add all new effects with a short description here !!! +####################################################################### + notify_puppeteer_of_outcome_effect = { if = { limit = { @@ -23,7 +30,6 @@ notify_puppeteer_of_outcome_effect = { } } } - blackmail_interaction_effect = { if = { limit = { NOT = { exists = scope:puppet_or_actor } } @@ -910,9 +916,7 @@ vassal_revocation_tyranny_effect = { #Despite its name this is referenced when _ else_if = { #Admin liege revoking from admin vassal limit = { government_has_mechanic = administrative - scope:recipient = { - government_has_mechanic = administrative - } + scope:recipient = { government_has_mechanic = administrative } } } else = { change_strife_opinion = major_strife_gain } @@ -940,13 +944,25 @@ vassal_revocation_tyranny_effect = { #Despite its name this is referenced when _ } multiply = 2 } + #HRE should not revoke vassals from North Italians + if = { + limit = { + gg_hre_causes_additional_tyranny_trigger = { TARGET = scope:recipient } + } + multiply = 4 + } } } else_if = { - limit = { - has_revoke_title_reason = scope:recipient - } + limit = { has_revoke_title_reason = scope:recipient } custom_tooltip = IS_ALLOWED_TO_REVOKE_VASSAL_DESC + #HRE should not revoke vassals from North Italians + if = { + limit = { + gg_hre_causes_additional_tyranny_trigger = { TARGET = scope:recipient } + } + add_tyranny = revoke_title_tyranny_gain + } } else_if = { limit = { @@ -992,25 +1008,42 @@ vassal_revocation_tyranny_effect = { #Despite its name this is referenced when _ } } } + #HRE should not revoke vassals from North Italians + if = { + limit = { + gg_hre_causes_additional_tyranny_trigger = { TARGET = scope:recipient } + } + add_tyranny = revoke_title_tyranny_gain + } } } revocation_tyranny_effect = { save_scope_as = liege_temp_scope + $VASSAL$ = { save_scope_as = vassal_scope } if = { limit = { exists = scope:use_strife_not_tyranny } # If you have revocation reason, we allow that. if = { - limit = { has_revoke_title_reason = $VASSAL$ } - consume_revoke_title_reason = $VASSAL$ + limit = { has_revoke_title_reason = scope:vassal_scope } + consume_revoke_title_reason = scope:vassal_scope } else = { change_strife_opinion = major_strife_gain } } else_if = { limit = { - title_revocation_is_tyrannical_trigger = { VASSAL = $VASSAL$ } + title_revocation_is_tyrannical_trigger = { VASSAL = scope:vassal_scope } + } + add_tyranny = { + value = revoke_title_tyranny_gain + #HRE should not revoke titles from North Italians + if = { + limit = { + gg_hre_causes_additional_tyranny_trigger = { TARGET = scope:vassal_scope } + } + multiply = 2 + } } - add_tyranny = revoke_title_tyranny_gain # Special Legitimacy loss if you're revoking without a reason if = { limit = { @@ -1027,9 +1060,9 @@ revocation_tyranny_effect = { #If my culture is different from the recipients if = { limit = { - NOT = { culture = $VASSAL$.culture } + NOT = { culture = scope:vassal_scope.culture } } - $VASSAL$.culture = { + scope:vassal_scope.culture = { change_cultural_acceptance = { target = scope:liege_temp_scope.culture value = revoke_title_culture_acceptance_impact @@ -1041,7 +1074,7 @@ revocation_tyranny_effect = { else = { if = { limit = { - title_revocation_is_admin_governor_trigger = { VASSAL = $VASSAL$ } + title_revocation_is_admin_governor_trigger = { VASSAL = scope:vassal_scope } } custom_description = { text = IS_ALLOWED_TO_REVOKE_ADMIN_GOVERNMENT @@ -1107,6 +1140,13 @@ revocation_tyranny_effect = { } } } + #HRE should not revoke vassals from North Italians + if = { + limit = { + gg_hre_causes_additional_tyranny_trigger = { TARGET = scope:recipient } + } + add_tyranny = revoke_title_tyranny_gain + } } } @@ -1532,9 +1572,9 @@ disinherit_effect = { has_trait = humble } } - set_relation_rival = { - target = $DISINHERITOR$ - reason = rival_disinherited + set_relation_rival_effect = { + TARGET = $DISINHERITOR$ + REASON = rival_disinherited } } else_if = { @@ -1591,9 +1631,9 @@ disinherit_effect = { has_trait = humble } } - set_relation_rival = { - target = $DISINHERITOR$.primary_heir - reason = rival_disinherited + set_relation_rival_effect = { + TARGET = $DISINHERITOR$.primary_heir + REASON = rival_disinherited } } else_if = { @@ -1671,9 +1711,9 @@ disinherit_effect = { } } } - set_relation_rival = { - target = scope:new_primary_heir - reason = rival_disinherited + set_relation_rival_effect = { + TARGET = scope:new_primary_heir + REASON = rival_disinherited } } else_if = { @@ -1760,7 +1800,18 @@ disinherit_effect = { } restore_inheritance_effect = { - remove_trait = disinherited + if = { + limit = { + has_trait = disinherited + } + remove_trait = disinherited + } + if = { + limit = { + has_trait = adopted_no_inheritance + } + remove_trait = adopted_no_inheritance + } if = { limit = { has_opinion_modifier = { @@ -1833,14 +1884,12 @@ denounce_effect = { add_trait = denounced if = { limit = { - NOT = { - has_relation_rival = $ACTOR$ - } + NOT = { has_relation_rival = scope:actor } } #Rivalry - set_relation_rival = { - target = $ACTOR$ - reason = rival_denounced + set_relation_rival_effect = { + TARGET = scope:actor + REASON = rival_denounced } } if = { @@ -2088,14 +2137,18 @@ education_flags_tooltips_effect = { } scope:puppet_or_actor = { remove_short_term_gold = { - value = monumental_gold_value + value = medium_gold_value if = { - limit = { house = { has_house_modifier = ep3_eparch_university_influence_modifier } } + limit = { house ?= { has_house_modifier = ep3_eparch_university_influence_modifier } } multiply = { value = 1 subtract = university_cost_reduction_value } } + if = { + limit = { culture ?= { has_cultural_parameter = roman_law_cheaper_university } } + multiply = roman_law_university_cost_mult + } } } if = { @@ -2327,8 +2380,28 @@ start_tributary_interaction_effect = { $TRIBUTARY$ = { save_scope_as = tributary_loc } $SUZERAIN$ = { save_scope_as = suzerain_loc } - #Mandala Tributaries + #Merchant Tributaries if = { + limit = { + $TRIBUTARY$ = { government_has_flag = government_is_merchant } + } + $TRIBUTARY$ = { + # Clear up old patron contracts + every_character_task_contract = { + limit = { has_task_contract_group = merchant_patron_contract_group } + scheme ?= { invalidate_scheme = yes } + invalidate_contract = yes + } + remove_character_flag = patron_contract_cooldown_hobnob + # Create tributary + start_tributary = { + contract_group = tributary_merchant + suzerain = $SUZERAIN$ + } + } + } + #Mandala Tributaries + else_if = { limit = { should_be_mandala_tributary_trigger = { SUZERAIN = $SUZERAIN$ @@ -2863,7 +2936,7 @@ start_tributary_interaction_effect = { custom_tooltip = no_tributary_war_obligations custom_tooltip = no_suzerain_guarantee } - } + } } else_if = { limit = { @@ -3013,7 +3086,15 @@ start_tributary_interaction_effect = { custom_tooltip = no_tributary_war_obligations } } - setup_tributary_truces_effect = { SUZERAIN = $SUZERAIN$ TRIBUTARY = $TRIBUTARY$ } + # Truces + if = { + limit = { + NOT = { + $TRIBUTARY$ = { government_has_flag = government_is_merchant } + } + } + setup_tributary_truces_effect = { SUZERAIN = $SUZERAIN$ TRIBUTARY = $TRIBUTARY$ } + } } @truce_duration_war_default = 15 @@ -3058,6 +3139,14 @@ setup_tributary_truces_effect = { name = TRUCE_TRIBUTARY } } + else_if = { + limit = { has_government = merchant_government } + add_truce_both_ways = { + character = $SUZERAIN$ + years = @truce_duration_negotiated_default + name = TRUCE_TRIBUTARY_MERCHANT + } + } else = { add_truce_both_ways = { character = $SUZERAIN$ @@ -3301,6 +3390,14 @@ call_ally_interaction_event_effect = { } pam_peace_of_god_personal_tenet_cheaper_alliance_call_effect = yes } + else_if = { + limit = { + scope:actor = { + culture = { has_cultural_parameter = binding_oaths_word_is_trusted } + } + } + gdp_binding_oaths_cheaper_alliance_call_effect = yes + } else = { add_prestige = { value = 0 @@ -3510,6 +3607,14 @@ ask_for_pardon_interaction_effect = { } revoke_title_interaction_effect = { + if = { + limit = { scope:landed_title.tier != tier_barony } + gg_triggered_catalyst_effect = { + ACTOR = scope:actor + RECIPIENT = scope:recipient + CATALYST = catalyst_gg_title_revoked_from_opposite_party + } + } if = { limit = { scope:recipient = { @@ -3533,6 +3638,23 @@ revoke_title_interaction_effect = { } } } + scope:recipient.capital_county.clerical_region_title.holder ?= { + if = { + limit = { + faith = scope:puppet_or_actor.faith + NOR = { + this = scope:puppet_or_actor + this = scope:recipient + scope:puppet_or_actor.faith.religious_head ?= this + } + } + add_opinion = { + target = scope:puppet_or_actor + modifier = impious_opinion + opinion = -20 + } + } + } } if = { limit = { @@ -3695,11 +3817,11 @@ revoke_title_interaction_effect = { } } - # If we're a clan this interaction affects unity + # House Unity if = { limit = { - scope:puppet_or_actor = { government_has_flag = government_is_clan } - scope:recipient = { government_has_flag = government_is_clan } + scope:puppet_or_actor = { government_has_flag = government_uses_house_unity } + scope:recipient = { government_has_flag = government_uses_house_unity } exists = scope:puppet_or_actor.house exists = scope:recipient.house scope:puppet_or_actor.house = scope:recipient.house @@ -3707,27 +3829,21 @@ revoke_title_interaction_effect = { } scope:puppet_or_actor.house = { if = { - limit = { - scope:landed_title.tier = tier_county - } + limit = { scope:landed_title.tier = tier_county } save_scope_value_as = { name = revoke_title_unity_loss value = minor_unity_loss } } - if = { - limit = { - scope:landed_title.tier = tier_duchy - } + else_if = { + limit = { scope:landed_title.tier = tier_duchy } save_scope_value_as = { name = revoke_title_unity_loss value = medium_unity_loss } } else_if = { - limit = { - scope:landed_title.tier = tier_kingdom - } + limit = { scope:landed_title.tier = tier_kingdom } save_scope_value_as = { name = revoke_title_unity_loss value = major_unity_loss @@ -3735,7 +3851,7 @@ revoke_title_interaction_effect = { } if = { limit = { exists = scope:revoke_title_unity_loss } - add_clan_unity_interaction_effect = { + add_house_unity_interaction_effect = { CHARACTER = scope:puppet_or_actor TARGET = scope:recipient VALUE = scope:revoke_title_unity_loss @@ -3750,7 +3866,7 @@ revoke_title_interaction_effect = { scope:recipient = { if = { limit = { - has_ep3_dlc_trigger = yes + has_playable_adventurer_dlc_trigger = yes is_valid_for_laampdom = yes } # Plus for our memory variable. @@ -3841,19 +3957,15 @@ revoke_title_interaction_effect = { var:requested_my_excommunication = scope:puppet_or_actor } } - NOT = { - has_relation_rival = scope:puppet_or_actor - } + NOT = { has_relation_rival = scope:puppet_or_actor } } if = { - limit = { - has_relation_potential_rival = scope:puppet_or_actor - } + limit = { has_relation_potential_rival = scope:puppet_or_actor } remove_relation_potential_rival = scope:puppet_or_actor } - set_relation_rival = { - target = scope:puppet_or_actor - reason = rival_revoked_title_reversed + set_relation_rival_effect = { + TARGET = scope:puppet_or_actor + REASON = rival_revoked_title_reversed } } else = { @@ -3880,6 +3992,28 @@ revoke_title_interaction_effect = { } } + # Handling for destruction of Republics (losing their last landed county) + scope:recipient = { + if = { + limit = { + scope:landed_title = { + tier = tier_county + is_landless_type_title = no + is_noble_family_title = no + } + gdp_holds_republic_title_trigger = yes + NOT = { + any_held_county = { + is_landless_type_title = no + is_noble_family_title = no + NOT = { this = scope:landed_title } # last landed county lost + } + } + } + gdp_republic_patricians_become_merchants_warning_effect = { DESTROYER = scope:puppet_or_actor } + } + } + # Penalty for taking the Party Baron's last title. I mean, come on... if = { limit = { @@ -4262,10 +4396,20 @@ seek_indulgences_interaction_effect = { } else = { remove_trait = gallowsbait } } + else_if = { + limit = { has_trait = dealbreaker } + pay_treasury_or_gold = { + target = scope:recipient + value = seek_indulgences_minor_criminal_trait_value + } + remove_trait = dealbreaker + } if = { limit = { - scope:recipient = { - pam_antipope_is_sponsored_by_trigger = { SPONSOR = scope:actor } + scope:actor.faith = { + any_religious_head_challenger = { + holder ?= scope:recipient + } } } send_interface_message = { @@ -4497,6 +4641,7 @@ hof_ask_for_gold_interaction_effect = { } if = { limit = { + faith.religious_head ?= scope:recipient any_vassal = { vassal_stance = zealot } @@ -4871,6 +5016,10 @@ revoke_holy_order_lease_effect = { save_scope_as = holy_order } } + if = { # The faith search can find no order they lead + limit = { NOT = { exists = scope:holy_order } } + holy_order ?= { save_scope_as = holy_order } + } primary_title = { save_scope_as = holy_order_title } @@ -4984,6 +5133,7 @@ revoke_holy_order_lease_effect = { } } + #TODO_PAM_JC Revoking titles from High Worldliness Orders should have severe consequences, but cost less spiritual fulfillment $CHARACTER$ = { send_interface_message = { type = holy_order_lease_revoked_message @@ -4994,8 +5144,8 @@ revoke_holy_order_lease_effect = { $BARONY$ = { save_scope_as = barony county = { - #Scaled development loss based on level of holding - change_development_level = revoking_lease_development_cost + #Scaled prosperity loss based on level of holding + change_prosperity_level = revoking_lease_prosperity_cost } } @@ -5067,7 +5217,7 @@ revoke_holy_order_lease_effect = { } else = { if = { - limit = { exists = $CHARACTER$.faith.religious_head } + limit = { exists = $CHARACTER$.faith.religious_head $CHARACTER$.faith.religious_head != $CHARACTER$ } # The canceller can be the head of faith $CHARACTER$.faith.religious_head = { add_opinion = { modifier = pleased_opinion @@ -5105,6 +5255,7 @@ revoke_holy_order_lease_effect = { modifier = lost_holy_order_modifier years = 10 } + change_county_control = -5 } } } @@ -5141,6 +5292,18 @@ revoke_holy_order_lease_effect = { } } } + #TODO_PAM_JC Worldliness gain reduction as result of having fewer monasteries + if = { + limit = { + scope:holy_order = { + num_leased_titles > 1 + } + $TARGET$ = { + government_has_flag = government_is_monastic_holy_order + } + } + custom_tooltip = reduces_order_worldliness_tt + } # revoke_lease clears $BARONY$.lessee, so it must run after all $TARGET$ (= scope:barony.lessee) checks above. $BARONY$ = { revoke_lease = yes @@ -5251,6 +5414,106 @@ apply_clan_unity_interaction_effect = { } } +add_house_unity_interaction_effect = { + if = { + limit = { # Check if unity is relevant + exists = $TARGET$.house + $CHARACTER$.house ?= $TARGET$.house + $CHARACTER$ = { government_has_flag = government_uses_house_unity } + $TARGET$ = { government_has_flag = government_uses_house_unity } + trigger_if = { + limit = { + exists = scope:actor + exists = scope:recipient + scope:actor != scope:recipient + } + NOT = { $CHARACTER$ = $TARGET$ } # As a safety, let's make sure that we are not interacting with ourselves + } + } + apply_house_unity_interaction_effect = { + CHARACTER = $CHARACTER$ + TARGET = $TARGET$ + DESC = $DESC$ + VALUE = $VALUE$ + VALUE_REVERSED = no + } + } + else_if = { + limit = { # Only apply reversed effect for the house head to keep the gauge in check + $REVERSE_NON_HOUSE_TARGET$ = yes + $CHARACTER$ = { + house.house_head ?= $CHARACTER$ + government_has_flag = government_uses_house_unity + } + OR = { + AND = { + exists = $TARGET$.house + NOT = { $CHARACTER$.house = $TARGET$.house } + } + $TARGET$ = { is_lowborn = yes } + } + } + apply_house_unity_interaction_effect = { + CHARACTER = $CHARACTER$ + TARGET = $TARGET$ + DESC = $DESC$ + VALUE = $VALUE$ + VALUE_REVERSED = yes + } + } +} + +apply_house_unity_interaction_effect = { + # Save scopes for localisation + $CHARACTER$ = { save_scope_as = unity_character } + $TARGET$ = { save_scope_as = unity_target } + + $CHARACTER$.house ?= { + save_scope_as = character_house + + add_unity_value = { + value = { + value = $VALUE$ + if = { # House heads have a larger impact on unity + limit = { house_head ?= $CHARACTER$ } + multiply = unity_house_head_multiplier_value + } + if = { + limit = { + house_head.culture = { has_cultural_parameter = increased_company_direction_gain } + } + multiply = 2 + } + if = { + limit = { $VALUE_REVERSED$ = yes } + multiply = -1 + } + } + character = $CHARACTER$ + desc = $DESC$ + } + } + + # Notify human players if they are not involved! + if = { + limit = { + trigger_if = { + limit = { $VALUE$ >= 0 } + $VALUE$ >= major_unity_value + } + trigger_else = { + $VALUE$ <= major_unity_value + } + } + # Notify human players if they are not involved! + notify_players_about_unity_change_effect = { + CHARACTER = $CHARACTER$ + TARGET = $TARGET$ + DESC = $DESC$ + } + } +} + diarch_declare_recipient_criminal_effect = { scope:actor = { # First we process the diarch. @@ -5685,3 +5948,58 @@ ai_religious_request_blocker_effect = { } } } + +invite_to_court_interaction_effect = { + $ACTOR$ = { save_scope_as = actor_scope } + $RECIPIENT$ = { save_scope_as = recipient_scope } + hidden_effect = { + scope:recipient_scope = { + set_variable = { + name = invite_to_court_cooldown + years = 5 + } + } + + if = { + limit = { + exists = scope:recipient_scope.liege + } + scope:recipient_scope.liege = { + send_interface_message = { + type = event_generic_neutral + title = msg_courtier_left_court_interaction_title + + right_icon = scope:recipient_scope + + show_as_tooltip = { + remove_courtier_or_guest = scope:recipient_scope + } + } + } + } + } + + scope:actor_scope = { + send_interface_message = { + type = event_generic_neutral + title = invite_to_court_interaction_notification + right_icon = scope:recipient_scope + + scope:recipient_scope = { + every_traveling_family_member = { + scope:actor_scope = { add_courtier = prev } + hidden_effect = { + return_to_court = yes + } + } + } + + if = { + limit = { always = scope:hook } + scope:actor_scope = { + use_hook = scope:recipient_scope + } + } + } + } +} diff --git a/common/scripted_effects/00_nickname_effects.txt b/common/scripted_effects/00_nickname_effects.txt index 15a2a61aa..0cb88746d 100644 --- a/common/scripted_effects/00_nickname_effects.txt +++ b/common/scripted_effects/00_nickname_effects.txt @@ -146,6 +146,7 @@ assign_random_nickname_effect = { government_has_flag = government_is_theocracy government_has_flag = government_is_landless_adventurer } + is_landed = yes NOT = { exists = scope:had_nick_the_faith } } modifier = { @@ -218,7 +219,7 @@ assign_random_nickname_effect = { count >= 4 title_tier = county title_province = { - has_ongoing_construction = yes + has_ongoing_holding_construction = yes } } NOT = { exists = scope:had_nick_the_builder } @@ -228,7 +229,7 @@ assign_random_nickname_effect = { count = all title_tier = county title_province = { - has_ongoing_construction = yes + has_ongoing_holding_construction = yes } } factor = 2 @@ -3083,7 +3084,7 @@ assign_random_nickname_effect = { trigger = { has_education_martial_trigger = yes exists = capital_county - capital_county.county_opinion >= 50 + capital_county.popular_opinion >= 50 NOT = { exists = scope:had_nick_the_shield_of_capital } } give_nickname = nick_the_shield_of_capital @@ -3337,7 +3338,7 @@ assign_random_nickname_effect = { count >= 4 title_tier = county title_province = { - has_ongoing_construction = yes + has_ongoing_holding_construction = yes } } NOT = { exists = scope:had_nick_the_castellan } @@ -3347,7 +3348,7 @@ assign_random_nickname_effect = { count = all title_tier = county title_province = { - has_ongoing_construction = yes + has_ongoing_holding_construction = yes } } factor = 2 @@ -3367,7 +3368,7 @@ assign_random_nickname_effect = { count >= 4 title_tier = county title_province = { - has_ongoing_construction = yes + has_ongoing_holding_construction = yes } } NOT = { exists = scope:had_nick_the_carpenter } @@ -3377,7 +3378,7 @@ assign_random_nickname_effect = { count = all title_tier = county title_province = { - has_ongoing_construction = yes + has_ongoing_holding_construction = yes } } factor = 2 @@ -4365,6 +4366,7 @@ set_random_negative_nickname_effect = { government_has_flag = government_is_theocracy government_has_flag = government_is_landless_adventurer } + is_landed = yes } modifier = { has_trait = zealous diff --git a/common/scripted_effects/00_religion_effects.txt b/common/scripted_effects/00_religion_effects.txt index 604f93e16..3249c46e8 100644 --- a/common/scripted_effects/00_religion_effects.txt +++ b/common/scripted_effects/00_religion_effects.txt @@ -533,13 +533,43 @@ add_excommunication_tooltip_only_effect = { } } add_excommunication_actual_effect = { - custom_tooltip = { - text = get_excommunicated_tt - add_trait = excommunicated - } - add_character_modifier = { # Minor negative modifier that stops us from immediately getting our excommunication recinded (so you have a guaranteed 'penance period'). - modifier = recent_excommunication - days = 365 + if = { + limit = { + NOT = { has_trait = excommunicated } + } + custom_tooltip = { + text = get_excommunicated_tt + add_trait = excommunicated + } + add_character_modifier = { # Minor negative modifier that stops us from immediately getting our excommunication recinded (so you have a guaranteed 'penance period'). + modifier = recent_excommunication + days = 365 + } + #Guelphs & Ghibellines + if = { + limit = { + exists = situation:guelph_ghibelline + exists = scope:requesting_character + gg_phase_is_pre_gg_trigger = yes + is_ghibelline_trigger = yes + } + if = { + limit = { is_ghibelline_leader_trigger = yes } + gg_triggered_catalyst_effect = { + ACTOR = scope:requesting_character + RECIPIENT = scope:target_character + CATALYST = catalyst_excommunicated_hre + } + } + else = { + gg_triggered_catalyst_effect = { + ACTOR = scope:requesting_character + RECIPIENT = scope:target_character + CATALYST = catalyst_excommunicated_ghibellines + } + } + scope:requesting_character = { gg_involvement_catalyst_effect = yes } + } } } @@ -563,6 +593,25 @@ create_holy_order_neutral_effect = { capital = $CAPITAL$ save_scope_as = $NEW_HO_SCOPE$ } + # Struggle Catalysts. + $FOUNDER$ = { + if = { + limit = { + any_character_struggle = { + involvement = involved + phase_has_catalyst = catalyst_creating_a_holy_order + } + } + every_character_struggle = { + involvement = involved + limit = { phase_has_catalyst = catalyst_creating_a_holy_order } + activate_struggle_catalyst = { + catalyst = catalyst_creating_a_holy_order + character = $FOUNDER$ + } + } + } + } } # Get random faith @@ -814,16 +863,21 @@ remove_sinful_trait_effect = { scope:trait_changer.rite = { trait_is_sin_rite = prev } + trait_can_be_edited_by_yourself_trigger = yes } save_scope_as = sinful_trait } - remove_trait = scope:sinful_trait + if = { + limit = { exists = scope:sinful_trait } + remove_trait = scope:sinful_trait + } } add_virtuous_trait_effect = { save_scope_as = trait_changer random_trait = { limit = { + trait_can_be_edited_by_yourself_trigger = yes save_temporary_scope_as = temp_trait scope:trait_changer.rite = { trait_is_virtue_rite = prev @@ -851,6 +905,23 @@ add_virtuous_trait_effect = { } } } + weight = { + base = 1 + modifier = { + add = 100 + scope:trait_changer = { + number_of_personality_traits < 3 + } + has_trait_category = personality + } + modifier = { + add = -1 + scope:trait_changer = { + number_of_personality_traits > 3 + } + has_trait_category = personality + } + } save_scope_as = virtuous_trait } add_trait_force_tooltip = scope:virtuous_trait @@ -1322,30 +1393,30 @@ release_dynamic_holy_site_kingdom_effect = { } # Province scope, $FAITH$ = faith, used at start and on new holy-site creation -add_holy_site_fallback_special_building_slot_effect = { +add_holy_site_fallback_special_district_slot_effect = { if = { limit = { - has_special_building_slot = no + has_special_district_slot = no } if = { limit = { $FAITH$ = { religion = religion:islam_religion } } - add_special_building_slot = holy_site_mosque_01 + add_special_district_slot = holy_site_mosque_01_district } else_if = { limit = { $FAITH$ = { religion = religion:christianity_religion } } - add_special_building_slot = holy_site_cathedral_01 + add_special_district_slot = holy_site_cathedral_01_district } else_if = { limit = { $FAITH$ = { religion = religion:zoroastrianism_religion } } - add_special_building_slot = holy_site_fire_temple_01 + add_special_district_slot = holy_site_fire_temple_01_district } else_if = { limit = { $FAITH$ = { religion = religion:buddhism_religion } } - add_special_building_slot = holy_site_buddhist_grand_temple_01 + add_special_district_slot = holy_site_buddhist_grand_temple_01_district } else_if = { limit = { $FAITH$ = { religion = religion:shintoism_religion } } - add_special_building_slot = holy_site_japanese_temple_01 + add_special_district_slot = holy_site_japanese_temple_01_district } else_if = { limit = { @@ -1356,7 +1427,7 @@ add_holy_site_fallback_special_building_slot_effect = { } } } - add_special_building_slot = holy_site_chinese_temple_01 + add_special_district_slot = holy_site_chinese_temple_01_district } else_if = { limit = { @@ -1371,7 +1442,7 @@ add_holy_site_fallback_special_building_slot_effect = { } } } - add_special_building_slot = holy_site_indian_grand_temple_01 + add_special_district_slot = holy_site_indian_grand_temple_01_district } else_if = { limit = { @@ -1390,14 +1461,14 @@ add_holy_site_fallback_special_building_slot_effect = { } } } - add_special_building_slot = holy_site_se_asia_pagan_temple_01 + add_special_district_slot = holy_site_se_asia_pagan_temple_01_district } else_if = { limit = { $FAITH$ = { religion = { is_in_family = rf_pagan } } } - add_special_building_slot = holy_site_pagan_grand_temple_01 + add_special_district_slot = holy_site_pagan_grand_temple_01_district } else = { - add_special_building_slot = holy_site_other_grand_temple_01 + add_special_district_slot = holy_site_other_grand_temple_01_district } } } diff --git a/common/scripted_effects/00_scheme_scripted_effects.txt b/common/scripted_effects/00_scheme_scripted_effects.txt index 3e34d0997..9aea76dd1 100644 --- a/common/scripted_effects/00_scheme_scripted_effects.txt +++ b/common/scripted_effects/00_scheme_scripted_effects.txt @@ -406,6 +406,7 @@ generic_scheme_process_ending_effect = { scope:owner = { play_sound_effect = "event:/DLC/EP3/SFX/Stingers/Scheme_Rework/ep3_mx_sting_schemerework_positive" mandala_trickster_increment_successful_schemes_effect = yes + gg_involvement_scheme_effect = { STATE = success } } # Keep the commanding puppeteer informed of the outcome of the scheme they ordered. @@ -11384,66 +11385,33 @@ cap_schemes_and_fire_reminders_effect = { } switch = { trigger = scheme_type - murder = { - murder_scheme_prep_effect = yes - } - abduct = { - abduct_scheme_prep_effect = yes - } - challenge_status = { - challenge_status_scheme_prep_effect = yes - } - claim_throne = { - claim_throne_scheme_prep_effect = yes - } - depose = { - depose_scheme_prep_effect = yes - } - overthrow_regent = { - overthrow_regent_scheme_prep_effect = yes - } - expand_power_base = { - expand_power_base_scheme_prep_effect = yes - } - fabricate_hook = { - fabricate_hook_scheme_prep_effect = yes - } - generate_claim = { - generate_claim_scheme_prep_effect = yes - } - promote = { - promote_scheme_prep_effect = yes - } - slander = { - slander_scheme_prep_effect = yes - } - steal_back_artifact = { - steal_back_artifact_scheme_prep_effect = yes - } - seize_realm = { - seize_realm_scheme_prep_effect = yes - } - found_despotate = { - found_despotate_scheme_prep_effect = yes - } - raid_estate = { - raid_estate_scheme_prep_effect = yes - } - prepare_fire_dromons_scheme = { - prepare_fire_dromons_scheme_prep_effect = yes - } - steal_herd = { - steal_herd_scheme_prep_effect = yes - } - celestial_siphon_treasury = { - celestial_siphon_treasury_prep_effect = yes - } - disbelieve_mandala = { - disbelieve_mandala_scheme_prep_effect = yes - } - coerce_tributary = { - coerce_tributary_scheme_prep_effect = yes - } + murder = { murder_scheme_prep_effect = yes } + abduct = { abduct_scheme_prep_effect = yes } + challenge_status = { challenge_status_scheme_prep_effect = yes } + claim_throne = { claim_throne_scheme_prep_effect = yes } + depose = { depose_scheme_prep_effect = yes } + overthrow_regent = { overthrow_regent_scheme_prep_effect = yes } + expand_power_base = { expand_power_base_scheme_prep_effect = yes } + fabricate_hook = { fabricate_hook_scheme_prep_effect = yes } + generate_claim = { generate_claim_scheme_prep_effect = yes } + promote = { promote_scheme_prep_effect = yes } + patrician_promote = { promote_scheme_prep_effect = yes } + slander = { slander_scheme_prep_effect = yes } + patrician_slander = { slander_scheme_prep_effect = yes } + patrician_find_secrets = { gdp_patrician_find_secrets_scheme_prep_effect = yes } + steal_back_artifact = { steal_back_artifact_scheme_prep_effect = yes } + seize_realm = { seize_realm_scheme_prep_effect = yes } + found_despotate = { found_despotate_scheme_prep_effect = yes } + raid_estate = { raid_estate_scheme_prep_effect = yes } + prepare_fire_dromons_scheme = { prepare_fire_dromons_scheme_prep_effect = yes } + steal_herd = { steal_herd_scheme_prep_effect = yes } + celestial_siphon_treasury = { celestial_siphon_treasury_prep_effect = yes } + disbelieve_mandala = { disbelieve_mandala_scheme_prep_effect = yes } + coerce_tributary = { coerce_tributary_scheme_prep_effect = yes } + gg_switch_sides = { gg_switch_sides_scheme_prep_effect = yes } + gg_claim_leadership = { gg_claim_leadership_scheme_prep_effect = yes } + gg_align_undecided = { gg_align_undecided_scheme_prep_effect = yes } + gg_replace_ruler = { gg_replace_ruler_scheme_prep_effect = yes } } } # If the player hasn't been reminded once, tell them that their scheme has hit max opportunities. @@ -11803,6 +11771,34 @@ fabricate_hook_scheme_prep_effect = { } } +overthrow_government_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.8310 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +gdp_incite_unrest_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:gdp_incite_unrest_scheme_event.0004 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + foster_legitimacy_scheme_prep_effect = { roll_critical_moment_options_03_agent_types_effect = { # Success results event. @@ -12104,6 +12100,62 @@ leverage_contribution_scheme_prep_effect = { } } +gg_switch_sides_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1261 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +gg_claim_leadership_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1271 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +gg_align_undecided_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1281 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +gg_replace_ruler_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.1291 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + ################################################## # AI Usage Critical Moment Effects — Contract Schemes @@ -12736,6 +12788,22 @@ celestial_minister_find_secrets_scheme_prep_effect = { } } +gdp_patrician_find_secrets_scheme_prep_effect = { + save_scope_as = scheme + scheme_owner = { save_scope_as = owner } + scheme_target_character = { save_scope_as = target } + save_scope_value_as = { + name = follow_up_event + value = event_id:gdp_patrician_find_secrets.0001 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + ################################################## # Murder Scheme Effects @@ -12779,6 +12847,8 @@ murder_consequences_known_or_exposed_apply_dread_effect = { # Apply scope:owner's general ending & consequences. scheme_owner_pov_murder_success_effect = { + #Guelphs & Ghibellines Involvement + gg_involvement_scheme_effect = { STATE = success } # Murdering your rival gets you some bonus cred. ## Presumably in how you comport yourself & who's a thorn in your side. if = { @@ -12794,6 +12864,12 @@ scheme_owner_pov_murder_success_effect = { if = { limit = { exists = scope:scheme_discovered } murder_consequences_known_or_exposed_apply_dread_effect = { VICTIM = scope:target } + #Guelphs & Ghibellines + gg_triggered_catalyst_effect = { + ACTOR = scope:owner + RECIPIENT = scope:target + CATALYST = catalyst_attempt_murder_opposite_party + } } # Piety, if appropriate. if = { @@ -12953,6 +13029,13 @@ murder_success_kill_entourage_too_effect = { # Distribute murder failure effects. murder_failure_effect = { + #Guelphs & Ghibellines + gg_involvement_scheme_effect = { STATE = failure } + gg_triggered_catalyst_effect = { + ACTOR = scope:owner + RECIPIENT = scope:target + CATALYST = catalyst_attempt_murder_opposite_party + } # Add Watchful Modifier to the target scope:target = { add_character_modifier = { @@ -12969,7 +13052,7 @@ murder_failure_effect = { limit = { scope:target = { is_landed = yes } } - add_clan_unity_interaction_effect = { + add_house_unity_interaction_effect = { CHARACTER = scope:owner TARGET = scope:target VALUE = medium_unity_loss @@ -12979,7 +13062,7 @@ murder_failure_effect = { } ## For unlanded characters, we don't care as much, but you still lose some. else = { - add_clan_unity_interaction_effect = { + add_house_unity_interaction_effect = { CHARACTER = scope:owner TARGET = scope:target VALUE = minor_unity_loss @@ -14148,6 +14231,7 @@ set_random_entertainment_text_effect = { } } 1 = { + #Not in Byzantium trigger = { OR = { root.culture = { @@ -14516,24 +14600,31 @@ abduct_outcome_roll_effect = { hidden_effect = { #FIRE CORRECT ON ACTIONS if = { - limit = { - exists = scope:scheme_successful - } - trigger_event = { - on_action = abduct_succeeded - } + limit = { exists = scope:scheme_successful } + trigger_event = { on_action = abduct_succeeded } } else = { - trigger_event = { - on_action = abduct_failed + if = { + limit = { + NOT = { exists = scope:scheme_discovered } + } + #Guelphs & Ghibellines + gg_failed_scheme_effect = { SCHEME = abduct } } + trigger_event = { on_action = abduct_failed } } } } #Used in the immediate of the Scheme Owner's success event abduct_success_effect = { - + #Guelphs & Ghibellines + gg_involvement_scheme_effect = { STATE = success } + gg_triggered_catalyst_effect = { + ACTOR = scope:owner + RECIPIENT = scope:target + CATALYST = catalyst_attempt_abduct_opposite_party + } scope:target = { add_character_flag = { flag = was_abducted_block_notification_event @@ -14560,6 +14651,10 @@ abduct_success_effect = { TARGET = scope:target IMPRISONER = scope:owner } + abduct_relatives_opinion_effect = { + VICTIM = scope:target + ABDUCTER = scope:owner + } if = { limit = { @@ -14736,12 +14831,12 @@ failed_befriend_opinion_critical_change_effect = { else_if = { #If you already are potential rivals, you have a chance of becoming Rivals limit = { has_relation_potential_rival = root - NOT = { has_relation_rival = root } + NOT = { has_relation_rival = root } } hidden_effect = { remove_relation_potential_rival = root } - set_relation_rival = { - target = root - reason = rival_disastrous_befriend_attempt + set_relation_rival_effect = { + TARGET = root + REASON = rival_disastrous_befriend_attempt } } } @@ -14754,9 +14849,7 @@ failed_befriend_opinion_critical_change_effect = { claim_throne_outcome_roll_setup_effect = { # Find appropriate title scope:target = { - primary_title = { - save_scope_as = target_title - } + primary_title = { save_scope_as = target_title } } # Discovery Roll setup save_scope_value_as = { @@ -14922,9 +15015,9 @@ claim_throne_failure_effect = { } if = { limit = { exists = scope:set_rivalry } - set_relation_rival = { - target = scope:owner - reason = rival_claimed_throne_failed + set_relation_rival_effect = { + TARGET = scope:owner + REASON = rival_claimed_throne_failed } } } @@ -14933,18 +15026,16 @@ claim_throne_failure_effect = { successful_claim_throne_event_option_effect = { if = { - limit = { - exists = scope:scheme_discovered - } + limit = { exists = scope:scheme_discovered } add_prestige = claim_throne_discovered_prestige_loss } show_as_tooltip = { scope:target = { if = { limit = { exists = scope:set_rivalry } - set_relation_rival = { - target = scope:owner - reason = rival_claimed_throne + set_relation_rival_effect = { + TARGET = scope:owner + REASON = rival_claimed_throne } } if = { @@ -15358,7 +15449,6 @@ elope_success_opinion_rivalry_effect = { #Rivalry if = { limit = { - can_set_relation_rival_trigger = { CHARACTER = $CHARACTER$ } is_ai = yes trigger_if = { limit = { is_spouse_of = $CHARACTER$ } @@ -15370,28 +15460,22 @@ elope_success_opinion_rivalry_effect = { } if = { limit = { + has_relation_rival = $CHARACTER$ can_set_relation_nemesis_trigger = { CHARACTER = $CHARACTER$ } - ai_vengefulness >= medium_positive_ai_value } - set_relation_nemesis = { - reason = nemesis_elopement - copy_reason = rival - target = $CHARACTER$ + set_relation_nemesis_effect = { + TARGET = $CHARACTER$ + REASON = nemesis_elopement } } else = { - set_relation_rival = { - target = $CHARACTER$ - reason = rival_eloped + progress_towards_rival_effect = { + REASON = rival_eloped + CHARACTER = $CHARACTER$ + OPINION = 0 } } } - else_if = { - limit = { - can_set_relation_potential_rival_trigger = { CHARACTER = $CHARACTER$ } - } - hidden_effect = { set_relation_potential_rival = $CHARACTER$ } - } } elope_success_personal_consequences_effect = { @@ -16401,7 +16485,7 @@ end_court_scheme_effect = { scope:court_outcome = flag:failure_hard } culture = { - has_cultural_parameter = romance_scheme_bonuses + has_cultural_parameter = romance_scheme_penalty } } add_stress = medium_stress_impact_gain @@ -16739,6 +16823,48 @@ subsume_province_scheme_prep_effect = { } } +hostile_takeover_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.8401 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +steal_market_insights_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.8501 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + +steal_trade_post_scheme_prep_effect = { + save_scope_as = scheme + save_scope_value_as = { + name = follow_up_event + value = event_id:scheme_critical_moments.8601 + } + if = { + limit = { + NOT = { exists = scope:suppress_next_event } + } + scheme_owner = { trigger_event = scheme_critical_moments.0002 } + } +} + raid_estate_opinion_effect = { $TARGET$ = { save_temporary_scope_as = target_temp } $OWNER$ = { save_temporary_scope_as = owner_temp } @@ -17069,20 +17195,44 @@ coup_ceremonial_liege_scheme_prep_effect = { } } +# Simple effect for rolling if a scheme with no secrecy succeeded or failed. No thrills, no frills. +roll_scheme_success_or_failure_effect = { + random = { + chance = scope:scheme.scheme_success_chance + save_scope_value_as = { + name = scheme_successful + value = yes + } + } + scope:owner = { + if = { + limit = { exists = scope:scheme_successful } + mandala_trickster_increment_successful_schemes_effect = yes + # Pre-determine success type here to avoid potentially incorrect tooltip in $SUCCESS_EVENT$ + random_list = { + 67 = { + save_scope_value_as = { name = scheme_success_type value = flag:success_standard } + } + 33 = { + save_scope_value_as = { name = scheme_success_type value = flag:success_critical } + } + } + trigger_event = $SUCCESS_EVENT$ + } + else = { trigger_event = $FAILURE_EVENT$ } + } +} + abduction_rivalry_progress_effect = { scope:target = { #Target is a ruler if = { - limit = { - abduct_ruler_rivalling_trigger = yes - } + limit = { abduct_ruler_rivalling_trigger = yes } if = { - limit = { - is_close_family_of = scope:owner - } - set_relation_rival = { - target = scope:owner - reason = rival_abducted_family + limit = { is_close_family_of = scope:owner } + set_relation_rival_effect = { + TARGET = scope:owner + REASON = rival_abducted_family } } else = { @@ -17095,9 +17245,7 @@ abduction_rivalry_progress_effect = { } #Target is close family if = { - limit = { - abduct_family_rivalling_trigger = yes - } + limit = { abduct_family_rivalling_trigger = yes } progress_towards_rival_effect = { CHARACTER = scope:owner REASON = rival_abducted_family @@ -17107,14 +17255,10 @@ abduction_rivalry_progress_effect = { #Target has parents that are rulers of superior power if = { limit = { - any_parent = { - abduct_rivalling_relative_trigger = yes - } + any_parent = { abduct_rivalling_relative_trigger = yes } } every_parent = { - limit = { - abduct_rivalling_relative_trigger = yes - } + limit = { abduct_rivalling_relative_trigger = yes } progress_towards_rival_effect = { CHARACTER = scope:owner REASON = rival_abducted_child @@ -17295,24 +17439,79 @@ abduction_rivalry_progress_tooltip_forecast_effect = { } } -debug_test_scheme_event_effect = { - random_scheme = { - save_scope_as = scheme - root = { - save_scope_as = owner +######################################################## +# Influence House Ambition Scheme + +influence_house_ambition_end_effect = { + if = { + limit = { + scope:owner.house = { + NOT = { + has_same_house_aspiration_as = scope:target.house + } + } } - scheme_target_character ?= { - save_scope_as = target + if = { + limit = { + exists = scope:scheme + } + hidden_effect = { + scope:scheme = { + reset_failed_scheme_effect = yes + } + } } - scheme_target_title ?= { - save_scope_as = target - } - scheme_target_culture ?= { - save_scope_as = target - } - scheme_target_faith ?= { - save_scope_as = target + else_if = { + limit = { + exists = scope:scheme_successful + } + scope:scheme = { + end_scheme = yes + } + } + } + else = { + scope:scheme = { + end_scheme = yes + } + } +} + +republic_promote_candidate_scheme_end_effect = { + # If target is first in the line of succession, we end the scheme + if = { + limit = { + scope:scheme.var:target_candidate_title = { + place_in_line_of_succession = { + target = scope:target + value = 1 + } + } + } + scope:scheme = { + end_scheme = yes + } + } + # Otherwise, we'll continue + else = { + if = { + limit = { + exists = scope:scheme + } + hidden_effect = { + scope:scheme = { + reset_failed_scheme_effect = yes + } + } + if = { + limit = { + exists = scope:scheme_successful + } + custom_tooltip = sway_continue + } + else = { + custom_tooltip = sway_try_again + } } } - trigger_event = $EVENT$ } diff --git a/common/scripted_effects/01_ep1_court_artifact_creation_effects.txt b/common/scripted_effects/01_ep1_court_artifact_creation_effects.txt index f4bc0741c..da6eafee2 100644 --- a/common/scripted_effects/01_ep1_court_artifact_creation_effects.txt +++ b/common/scripted_effects/01_ep1_court_artifact_creation_effects.txt @@ -37,8 +37,13 @@ create_artifact_chest_effect = { name = big_chest value = yes } - - add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { exists = scope:merchant } + add_scaled_artifact_modifier_prestige_effect = yes + } + else = { + add_scaled_artifact_modifier_grandeur_small_effect = yes + } add_scaled_artifact_modifier_piety_effect = yes if = { limit = { @@ -128,8 +133,13 @@ create_artifact_cabinet_effect = { } scope:newly_created_artifact = { get_artifact_feature_references_effect = yes - - add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { exists = scope:merchant } + add_scaled_artifact_modifier_prestige_effect = yes + } + else = { + add_scaled_artifact_modifier_grandeur_small_effect = yes + } add_scaled_artifact_modifier_piety_effect = yes if = { limit = { @@ -212,6 +222,7 @@ create_artifact_throne_effect = { # All thrones have a chance to get some extra Grandeur add_scaled_artifact_modifier_grandeur_big_effect = yes + remove_artifact_modifier = artifact_placeholder_modifier } } @@ -1450,14 +1461,14 @@ create_artifact_goblet_effect = { # Let's add another random effect to keep goblets interesting! random_list = { 10 = { - add_scaled_artifact_modifier_minor_prestige_effect = yes + add_scaled_artifact_modifier_piety_effect = yes } 10 = { add_scaled_artifact_modifier_majesty_effect = yes } 30 = { trigger = { rarity = common } - # Common goblets have a chance to not get any extra modifiers + add_scaled_artifact_modifier_minor_prestige_effect = yes } } remove_artifact_modifier = artifact_placeholder_modifier @@ -2613,7 +2624,10 @@ create_artifact_pedestal_diamond_effect = { } } scope:newly_created_artifact = { - add_scaled_artifact_modifier_grandeur_big_effect = yes + if = { + limit = { scope:owner = { has_royal_court = yes } } + add_scaled_artifact_modifier_grandeur_big_effect = yes + } add_scaled_artifact_modifier_prestige_effect = yes } } @@ -2641,7 +2655,10 @@ create_artifact_pedestal_gold_effect = { } scope:newly_created_artifact = { - add_scaled_artifact_modifier_grandeur_small_effect = yes + if = { + limit = { scope:owner = { has_royal_court = yes } } + add_scaled_artifact_modifier_grandeur_small_effect = yes + } add_2_scaled_artifact_modifier_majesty_effect = yes } } @@ -4107,61 +4124,73 @@ create_artifact_book_effect = { limit = { has_artifact_feature = book_subject_empire } add_scaled_artifact_modifier_dynasty_prestige_effect = yes if = { - limit = { - rarity = illustrious + limit = { short_reign_artifact_modifier_trigger = yes } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_short_reign_duration_mult_7_modifier } - add_artifact_modifier = artifact_short_reign_duration_mult_7_modifier - } - else_if = { - limit = { - rarity = famed + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_short_reign_duration_mult_5_modifier } - add_artifact_modifier = artifact_short_reign_duration_mult_5_modifier - } - else_if = { - limit = { - rarity = masterwork + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_short_reign_duration_mult_3_modifier } - add_artifact_modifier = artifact_short_reign_duration_mult_3_modifier - } - else_if = { - limit = { - rarity = common + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_short_reign_duration_mult_1_modifier } - add_artifact_modifier = artifact_short_reign_duration_mult_1_modifier } add_artifact_modifier = artifact_dynasty_opinion_2_modifier - add_artifact_modifier = artifact_court_grandeur_baseline_add_1_modifier + if = { + limit = { scope:owner = { has_royal_court = yes } artifact_not_luxury_contract_trigger = yes } + add_artifact_modifier = artifact_court_grandeur_baseline_add_1_modifier + } } else_if = { limit = { has_artifact_feature = book_subject_kingdom } add_scaled_artifact_modifier_dynasty_prestige_effect = yes if = { - limit = { - rarity = illustrious + limit = { short_reign_artifact_modifier_trigger = yes } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_short_reign_duration_mult_7_modifier } - add_artifact_modifier = artifact_short_reign_duration_mult_7_modifier - } - else_if = { - limit = { - rarity = famed + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_short_reign_duration_mult_5_modifier } - add_artifact_modifier = artifact_short_reign_duration_mult_5_modifier - } - else_if = { - limit = { - rarity = masterwork + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_short_reign_duration_mult_3_modifier } - add_artifact_modifier = artifact_short_reign_duration_mult_3_modifier - } - else_if = { - limit = { - rarity = common + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_short_reign_duration_mult_1_modifier } - add_artifact_modifier = artifact_short_reign_duration_mult_1_modifier } add_artifact_modifier = artifact_dynasty_opinion_2_modifier - add_artifact_modifier = artifact_court_grandeur_baseline_add_1_modifier + if = { + limit = { scope:owner = { has_royal_court = yes } artifact_not_luxury_contract_trigger = yes } + add_artifact_modifier = artifact_court_grandeur_baseline_add_1_modifier + } } else_if = { limit = { @@ -4198,28 +4227,58 @@ create_artifact_book_effect = { else_if = { limit = { has_artifact_feature = book_subject_reveler } if = { - limit = { - rarity = illustrious + limit = { vassal_artifact_modifier_trigger = yes } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_courtly_vassal_opinion_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_courtly_vassal_opinion_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_courtly_vassal_opinion_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_courtly_vassal_opinion_2_modifier } - add_artifact_modifier = artifact_courtly_vassal_opinion_4_modifier } else_if = { - limit = { - rarity = famed + limit = { merchant_artifact_modifier_trigger = yes } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_7_modifier } - add_artifact_modifier = artifact_courtly_vassal_opinion_3_modifier - } - else_if = { - limit = { - rarity = masterwork + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_5_modifier } - add_artifact_modifier = artifact_courtly_vassal_opinion_2_modifier - } - else_if = { - limit = { - rarity = common + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_3_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_courtier_and_guest_opinion_1_modifier } - add_artifact_modifier = artifact_courtly_vassal_opinion_2_modifier } } else_if = { @@ -4307,7 +4366,13 @@ create_artifact_book_effect = { limit = { NOT = { scope:owner.rite = { rite_has_parameter = witchcraft_accepted } } } - add_artifact_modifier = artifact_clergy_opinion_penalty_2_modifier + if = { + limit = { merchant_artifact_modifier_trigger = yes } + add_artifact_modifier = artifact_monthly_piety_negative_1_modifier + } + else = { + add_artifact_modifier = artifact_clergy_opinion_penalty_2_modifier + } } } else_if = { @@ -4402,6 +4467,8 @@ create_artifact_book_effect = { if = { limit = { artifact_type = book + scope:owner = { has_royal_court = yes } + artifact_not_luxury_contract_trigger = yes } add_artifact_modifier = artifact_court_grandeur_baseline_add_1_modifier } @@ -4411,6 +4478,7 @@ create_artifact_book_effect = { if = { # Vassal Opinion limit = { scope:story ?= { has_variable = opinion_artifact } + vassal_artifact_modifier_trigger = yes } if = { limit = { rarity = illustrious } @@ -4466,6 +4534,7 @@ create_artifact_book_effect = { if = { # Controlled Province Advantage limit = { scope:story ?= { has_variable = advantage_artifact } + merchant_artifact_modifier_trigger = no } if = { # 10 limit = { rarity = illustrious } @@ -4508,33 +4577,25 @@ create_artifact_book_effect = { add_artifact_modifier = artifact_owned_personal_scheme_success_chance_add_8_modifier # 8 } } - if = { # Monthly Piety + Same Faith Domain Tax + if = { # Monthly Piety limit = { scope:story ?= { has_variable = piety_artifact } } - if = { # 0.4 + 1 + if = { # 0.4 limit = { rarity = illustrious } add_artifact_modifier = artifact_monthly_piety_4_modifier # 0.4 - add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier # 1 - add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier - add_artifact_modifier = artifact_domain_tax_same_faith_mult_2_modifier } - else_if = { # 0.3 + 0.8 + else_if = { # 0.3 limit = { rarity = famed } add_artifact_modifier = artifact_monthly_piety_3_modifier - add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier - add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier } - else_if = { # 0.2 + 0.6 + else_if = { # 0.2 limit = { rarity = masterwork } add_artifact_modifier = artifact_monthly_piety_2_modifier - add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier - add_artifact_modifier = artifact_domain_tax_same_faith_mult_2_modifier } - else_if = { # 0.1 + 0.4 + else_if = { # 0.1 limit = { rarity = common } add_artifact_modifier = artifact_monthly_piety_1_modifier - add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier } } if = { @@ -4806,28 +4867,57 @@ create_artifact_book_effect = { } } if = { - limit = { - rarity = illustrious + limit = { merchant_artifact_modifier_trigger = no } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_build_time_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_build_time_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_build_time_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_build_time_1_modifier } - add_artifact_modifier = artifact_build_time_4_modifier } - else_if = { - limit = { - rarity = famed + else = { + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_4_modifier } - add_artifact_modifier = artifact_build_time_3_modifier - } - else_if = { - limit = { - rarity = masterwork + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_3_modifier } - add_artifact_modifier = artifact_build_time_2_modifier - } - else_if = { - limit = { - rarity = common + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_1_modifier } - add_artifact_modifier = artifact_build_time_1_modifier } } else_if = { @@ -4850,28 +4940,31 @@ create_artifact_book_effect = { } add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_1_modifier if = { - limit = { - rarity = illustrious + limit = { merchant_artifact_modifier_trigger = no } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_raid_speed_8_modifier } - add_artifact_modifier = artifact_raid_speed_8_modifier - } - else_if = { - limit = { - rarity = famed + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_raid_speed_6_modifier } - add_artifact_modifier = artifact_raid_speed_6_modifier - } - else_if = { - limit = { - rarity = masterwork + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_raid_speed_4_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_raid_speed_2_modifier } - add_artifact_modifier = artifact_raid_speed_4_modifier - } - else_if = { - limit = { - rarity = common - } - add_artifact_modifier = artifact_raid_speed_2_modifier } } else_if = { @@ -5217,28 +5310,31 @@ create_artifact_book_effect = { } } if = { - limit = { - rarity = illustrious + limit = { merchant_artifact_modifier_trigger = no } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_controlled_province_advantage_7_modifier } - add_artifact_modifier = artifact_controlled_province_advantage_7_modifier - } - else_if = { - limit = { - rarity = famed + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_controlled_province_advantage_5_modifier } - add_artifact_modifier = artifact_controlled_province_advantage_5_modifier - } - else_if = { - limit = { - rarity = masterwork + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_controlled_province_advantage_3_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_controlled_province_advantage_1_modifier } - add_artifact_modifier = artifact_controlled_province_advantage_3_modifier - } - else_if = { - limit = { - rarity = common - } - add_artifact_modifier = artifact_controlled_province_advantage_1_modifier } if = { @@ -5907,22 +6003,25 @@ create_artifact_book_effect = { } if = { - limit = { - rarity = illustrious + limit = { merchant_artifact_modifier_trigger = no } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_hard_casualty_modifier_3_modifier } - add_artifact_modifier = artifact_hard_casualty_modifier_3_modifier - } - else_if = { - limit = { - rarity = famed + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_hard_casualty_modifier_2_modifier } - add_artifact_modifier = artifact_hard_casualty_modifier_2_modifier - } - else_if = { - limit = { - rarity = masterwork + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_hard_casualty_modifier_1_modifier } - add_artifact_modifier = artifact_hard_casualty_modifier_1_modifier } if = { @@ -5965,30 +6064,33 @@ create_artifact_book_effect = { } if = { - limit = { - rarity = illustrious + limit = { merchant_artifact_modifier_trigger = no } + if = { + limit = { + rarity = illustrious + } + random_list = { + 50 = { add_artifact_modifier = artifact_heavy_cavalry_toughness_3_modifier } + 50 = { add_artifact_modifier = artifact_heavy_infantry_toughness_3_modifier } + } } - random_list = { - 50 = { add_artifact_modifier = artifact_heavy_cavalry_toughness_3_modifier } - 50 = { add_artifact_modifier = artifact_heavy_infantry_toughness_3_modifier } + else_if = { + limit = { + rarity = famed + } + random_list = { + 50 = { add_artifact_modifier = artifact_heavy_cavalry_toughness_2_modifier } + 50 = { add_artifact_modifier = artifact_heavy_infantry_toughness_2_modifier } + } } - } - else_if = { - limit = { - rarity = famed - } - random_list = { - 50 = { add_artifact_modifier = artifact_heavy_cavalry_toughness_2_modifier } - 50 = { add_artifact_modifier = artifact_heavy_infantry_toughness_2_modifier } - } - } - else_if = { - limit = { - rarity = masterwork - } - random_list = { - 50 = { add_artifact_modifier = artifact_heavy_cavalry_toughness_1_modifier } - 50 = { add_artifact_modifier = artifact_heavy_infantry_toughness_1_modifier } + else_if = { + limit = { + rarity = masterwork + } + random_list = { + 50 = { add_artifact_modifier = artifact_heavy_cavalry_toughness_1_modifier } + 50 = { add_artifact_modifier = artifact_heavy_infantry_toughness_1_modifier } + } } } @@ -6132,28 +6234,6 @@ create_artifact_book_effect = { } } - if = { - limit = { - rarity = illustrious - } - add_artifact_modifier = artifact_development_growth_3_modifier - } - else_if = { - limit = { - rarity = famed - } - add_artifact_modifier = artifact_development_growth_2_modifier - } - else_if = { - limit = { - OR = { - rarity = common - rarity = masterwork - } - } - add_artifact_modifier = artifact_development_growth_1_modifier - } - if = { limit = { rarity = illustrious @@ -6178,6 +6258,33 @@ create_artifact_book_effect = { } add_artifact_modifier = artifact_monthly_stewardship_lifestyle_xp_1_modifier } + if = { + limit = { scope:owner = { gdp_is_trade_ruler_trigger = yes } } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = gdp_tgf_artifact_capacity_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = gdp_tgf_artifact_capacity_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = gdp_tgf_artifact_capacity_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = gdp_tgf_artifact_capacity_1_modifier + } + } } else_if = { limit = { @@ -6196,13 +6303,13 @@ create_artifact_book_effect = { limit = { rarity = illustrious } - add_artifact_modifier = artifact_domain_tax_mult_3_modifier + add_artifact_modifier = artifact_stewardship_3_modifier } else_if = { limit = { rarity = famed } - add_artifact_modifier = artifact_domain_tax_mult_2_modifier + add_artifact_modifier = artifact_stewardship_2_modifier } } else_if = { @@ -6256,28 +6363,58 @@ create_artifact_book_effect = { } if = { - limit = { - rarity = illustrious + limit = { vassal_artifact_modifier_trigger = yes } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_vassal_limit_4_modifier + } + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_vassal_limit_3_modifier + } + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_vassal_limit_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_vassal_limit_1_modifier } - add_artifact_modifier = artifact_vassal_limit_4_modifier } else_if = { - limit = { - rarity = famed + limit = { merchant_artifact_modifier_trigger = yes } + if = { + limit = { + rarity = illustrious + } + add_artifact_modifier = artifact_stewardship_3_modifier } - add_artifact_modifier = artifact_vassal_limit_3_modifier - } - else_if = { - limit = { - rarity = masterwork + else_if = { + limit = { + rarity = famed + } + add_artifact_modifier = artifact_stewardship_3_modifier } - add_artifact_modifier = artifact_vassal_limit_2_modifier - } - else_if = { - limit = { - rarity = common + else_if = { + limit = { + rarity = masterwork + } + add_artifact_modifier = artifact_stewardship_2_modifier + } + else_if = { + limit = { + rarity = common + } + add_artifact_modifier = artifact_stewardship_1_modifier } - add_artifact_modifier = artifact_vassal_limit_1_modifier } } @@ -6292,7 +6429,10 @@ create_artifact_book_effect = { trait_is_criminal_in_rite_trigger = { TRAIT = trait:cannibal RITE = root.rite GENDER_CHARACTER = root } } add_artifact_modifier = artifact_dread_baseline_add_2_modifier - add_artifact_modifier = artifact_vassal_opinion_penalty_1_modifier + if = { + limit = { vassal_artifact_modifier_trigger = yes } + add_artifact_modifier = artifact_vassal_opinion_penalty_1_modifier + } } else = { add_artifact_modifier = artifact_dread_baseline_add_1_modifier @@ -6339,7 +6479,10 @@ create_artifact_book_effect = { limit = { trait_is_criminal_in_rite_trigger = { TRAIT = trait:deviant RITE = root.rite GENDER_CHARACTER = root } } - add_artifact_modifier = artifact_vassal_opinion_penalty_1_modifier + if = { + limit = { vassal_artifact_modifier_trigger = yes } + add_artifact_modifier = artifact_vassal_opinion_penalty_1_modifier + } add_artifact_modifier = artifact_stress_gain_2_modifier add_artifact_modifier = artifact_seduce_scheme_phase_duration_mult_1_modifier } @@ -6500,18 +6643,35 @@ create_artifact_pedestal_reliquary_christian_effect = { get_artifact_wealth_effect = yes scope:owner = { - create_artifact = { - name = artifact_pedestal_reliquary_christian_name - creator = scope:owner - description = artifact_pedestal_reliquary_christian_description - visuals = reliquary - type = pedestal - template = christian_relic_template - modifier = artifact_monthly_piety_3_modifier - save_scope_as = newly_created_artifact - wealth = scope:wealth - quality = scope:quality - #decaying = no + if = { + limit = { exists = scope:religious_building_faith } + create_artifact = { + name = artifact_pedestal_reliquary_christian_name + creator = scope:owner + description = artifact_pedestal_reliquary_christian_description + visuals = reliquary + type = pedestal + modifier = artifact_monthly_piety_3_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + else = { + create_artifact = { + name = artifact_pedestal_reliquary_christian_name + creator = scope:owner + description = artifact_pedestal_reliquary_christian_description + visuals = reliquary + type = pedestal + template = christian_relic_template + modifier = artifact_monthly_piety_3_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } } } @@ -6521,7 +6681,7 @@ create_artifact_pedestal_reliquary_christian_effect = { add_scaled_artifact_modifier_grandeur_small_effect = yes set_variable = { name = relic_religion - value = religion:catholic_religion + value = religion:christianity_religion } } } @@ -6578,18 +6738,35 @@ create_artifact_pedestal_reliquary_islam_effect = { get_artifact_wealth_effect = yes scope:owner = { - create_artifact = { - name = artifact_pedestal_reliquary_islam_name - creator = scope:owner - description = artifact_pedestal_reliquary_islam_description - visuals = reliquary - type = pedestal - template = islam_relic_template - modifier = artifact_monthly_piety_3_modifier - save_scope_as = newly_created_artifact - wealth = scope:wealth - quality = scope:quality - #decaying = no + if = { + limit = { exists = scope:religious_building_faith } + create_artifact = { + name = artifact_pedestal_reliquary_islam_name + creator = scope:owner + description = artifact_pedestal_reliquary_islam_description + visuals = reliquary + type = pedestal + modifier = artifact_monthly_piety_3_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + else = { + create_artifact = { + name = artifact_pedestal_reliquary_islam_name + creator = scope:owner + description = artifact_pedestal_reliquary_islam_description + visuals = reliquary + type = pedestal + template = islam_relic_template + modifier = artifact_monthly_piety_3_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } } } @@ -6662,18 +6839,35 @@ create_artifact_pedestal_reliquary_buddhism_effect = { get_artifact_wealth_effect = yes scope:owner = { - create_artifact = { - name = artifact_pedestal_reliquary_buddhism_name - creator = scope:owner - description = artifact_pedestal_reliquary_buddhism_description - visuals = reliquary - type = pedestal - template = buddhism_relic_template - modifier = artifact_monthly_piety_3_modifier - save_scope_as = newly_created_artifact - wealth = scope:wealth - quality = scope:quality - #decaying = no + if = { + limit = { exists = scope:religious_building_faith } + create_artifact = { + name = artifact_pedestal_reliquary_buddhism_name + creator = scope:owner + description = artifact_pedestal_reliquary_buddhism_description + visuals = reliquary + type = pedestal + modifier = artifact_monthly_piety_3_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + else = { + create_artifact = { + name = artifact_pedestal_reliquary_buddhism_name + creator = scope:owner + description = artifact_pedestal_reliquary_buddhism_description + visuals = reliquary + type = pedestal + template = buddhism_relic_template + modifier = artifact_monthly_piety_3_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } } } @@ -6704,18 +6898,35 @@ create_artifact_pedestal_reliquary_judaism_effect = { get_artifact_wealth_effect = yes scope:owner = { - create_artifact = { - name = artifact_pedestal_reliquary_judaism_name - creator = scope:owner - description = artifact_pedestal_reliquary_judaism_description - visuals = reliquary - type = pedestal - template = judaism_relic_template - modifier = artifact_monthly_piety_3_modifier - save_scope_as = newly_created_artifact - wealth = scope:wealth - quality = scope:quality - #decaying = no + if = { + limit = { exists = scope:religious_building_faith } + create_artifact = { + name = artifact_pedestal_reliquary_judaism_name + creator = scope:owner + description = artifact_pedestal_reliquary_judaism_description + visuals = reliquary + type = pedestal + modifier = artifact_monthly_piety_3_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } + } + else = { + create_artifact = { + name = artifact_pedestal_reliquary_judaism_name + creator = scope:owner + description = artifact_pedestal_reliquary_judaism_description + visuals = reliquary + type = pedestal + template = judaism_relic_template + modifier = artifact_monthly_piety_3_modifier + save_scope_as = newly_created_artifact + wealth = scope:wealth + quality = scope:quality + #decaying = no + } } } @@ -6731,49 +6942,6 @@ create_artifact_pedestal_reliquary_judaism_effect = { } } -create_artifact_pedestal_reliquary_fracture_effect = { - $OWNER$ = { save_scope_as = owner } - - random_list = { - 15 = { - save_scope_value_as = { - name = fracture_relic_name - value = flag:amethyst - } - } - } - - get_artifact_quality_effect = yes - get_artifact_wealth_effect = yes - - scope:owner = { - create_artifact = { - name = artifact_pedestal_reliquary_fracture_name - creator = scope:owner - description = artifact_pedestal_reliquary_fracture_description - visuals = reliquary - type = pedestal - template = fracture_relic_template - modifier = artifact_monthly_piety_3_modifier - save_scope_as = newly_created_artifact - wealth = scope:wealth - quality = scope:quality - #decaying = no - } - } - - scope:newly_created_artifact = { - add_scaled_artifact_modifier_piety_effect = yes - add_scaled_artifact_modifier_devotion_effect = yes - add_scaled_artifact_modifier_grandeur_small_effect = yes - save_scope_as = epic - set_variable = { - name = relic - value = flag:fracture - } - } -} - create_artifact_sculpture_religious_effect = { $OWNER$ = { save_scope_as = owner } $CREATOR$ = { save_scope_as = creator } @@ -6784,14 +6952,7 @@ create_artifact_sculpture_religious_effect = { scope:owner = { random_list = { # To have different statue names 1 = { - trigger = { - OR = { - religion != religion:protestant_religion - religion != religion:catholic_religion - religion != religion:eastern_orthodox_religion - religion != religion:oriental_orthodox_religion - } - } + trigger = { religion != religion:christianity_religion } create_artifact = { name = artifact_sculpture_religious_highgod_name description = artifact_sculpture_religious_highgod_description @@ -6806,14 +6967,7 @@ create_artifact_sculpture_religious_effect = { } } 1 = { - trigger = { - OR = { - religion = religion:protestant_religion - religion = religion:catholic_religion - religion = religion:eastern_orthodox_religion - religion = religion:oriental_orthodox_religion - } - } + trigger = { religion = religion:christianity_religion } create_artifact = { name = artifact_sculpture_religious_mary_name description = artifact_sculpture_religious_mary_description @@ -6907,9 +7061,14 @@ create_artifact_sculpture_religious_effect = { } scope:newly_created_artifact = { - set_variable = { # required to track equipability in template (based on dynamic religion) - name = statue_religion - value = scope:owner.religion + if = { + limit = { + NOT = { exists = scope:religious_building_faith } + } + set_variable = { # required to track equipability in template (based on dynamic religion) + name = statue_religion + value = scope:owner.religion + } } add_scaled_artifact_modifier_piety_effect = yes add_scaled_artifact_modifier_devotion_effect = yes diff --git a/common/scripted_effects/06_dlc_ce1_legend_effects.txt b/common/scripted_effects/06_dlc_ce1_legend_effects.txt index 387e7dbab..9b09d0d30 100644 --- a/common/scripted_effects/06_dlc_ce1_legend_effects.txt +++ b/common/scripted_effects/06_dlc_ce1_legend_effects.txt @@ -2102,17 +2102,20 @@ give_legendary_building_mythical_holy_tooltip_effect = { root = { locale_valid_for_legendary_buildings = yes } - capital_province = { has_special_building_slot = no } + capital_province = { has_special_district_slot = no } any_sub_realm_barony = { - title_province = { has_special_building_slot = no } + title_province = { has_special_district_slot = no } } } } give_legendary_building_location_holy_effect = yes } - set_variable = { - name = legendary_reward_location - value = scope:legendary_locale + if = { + limit = { exists = scope:legendary_locale } + set_variable = { + name = legendary_reward_location + value = scope:legendary_locale + } } set_variable = { name = legendary_figure @@ -2127,17 +2130,20 @@ give_legendary_building_mythical_heroic_tooltip_effect = { root = { locale_valid_for_legendary_buildings = yes } - capital_province = { has_special_building_slot = no } + capital_province = { has_special_district_slot = no } any_sub_realm_barony = { - title_province = { has_special_building_slot = no } + title_province = { has_special_district_slot = no } } } } give_legendary_building_location_heroic_effect = yes } - set_variable = { - name = legendary_reward_location - value = scope:legendary_locale + if = { + limit = { exists = scope:legendary_locale } + set_variable = { + name = legendary_reward_location + value = scope:legendary_locale + } } set_variable = { name = legendary_figure @@ -2152,17 +2158,20 @@ give_legendary_building_mythical_legitimizing_tooltip_effect = { root = { locale_valid_for_legendary_buildings = yes } - capital_province = { has_special_building_slot = no } + capital_province = { has_special_district_slot = no } any_sub_realm_barony = { - title_province = { has_special_building_slot = no } + title_province = { has_special_district_slot = no } } } } give_legendary_building_location_legitimizing_effect = yes } - set_variable = { - name = legendary_reward_location - value = scope:legendary_locale + if = { + limit = { exists = scope:legendary_locale } + set_variable = { + name = legendary_reward_location + value = scope:legendary_locale + } } set_variable = { name = legendary_figure @@ -2180,9 +2189,9 @@ give_legendary_building_holy_tooltip_effect = { #50% chance root = { locale_valid_for_legendary_buildings = yes } - capital_province = { has_special_building_slot = no } + capital_province = { has_special_district_slot = no } any_sub_realm_barony = { - title_province = { has_special_building_slot = no } + title_province = { has_special_district_slot = no } } } } @@ -2193,9 +2202,12 @@ give_legendary_building_holy_tooltip_effect = { #50% chance give_legendary_building_location_holy_effect = yes } } - set_variable = { - name = legendary_reward_location - value = scope:legendary_locale + if = { + limit = { exists = scope:legendary_locale } + set_variable = { + name = legendary_reward_location + value = scope:legendary_locale + } } set_variable = { name = legendary_figure @@ -2211,9 +2223,9 @@ give_legendary_building_heroic_tooltip_effect = { #50% chance root = { locale_valid_for_legendary_buildings = yes } - capital_province = { has_special_building_slot = no } + capital_province = { has_special_district_slot = no } any_sub_realm_barony = { - title_province = { has_special_building_slot = no } + title_province = { has_special_district_slot = no } } } } @@ -2242,9 +2254,9 @@ give_legendary_building_legitimizing_tooltip_effect = { #50% chance root = { locale_valid_for_legendary_buildings = yes } - capital_province = { has_special_building_slot = no } + capital_province = { has_special_district_slot = no } any_sub_realm_barony = { - title_province = { has_special_building_slot = no } + title_province = { has_special_district_slot = no } } } } @@ -2255,9 +2267,12 @@ give_legendary_building_legitimizing_tooltip_effect = { #50% chance give_legendary_building_location_legitimizing_effect = yes } } - set_variable = { - name = legendary_reward_location - value = scope:legendary_locale + if = { + limit = { exists = scope:legendary_locale } + set_variable = { + name = legendary_reward_location + value = scope:legendary_locale + } } set_variable = { name = legendary_figure @@ -2276,7 +2291,7 @@ give_legendary_building_location_standard_effect = { } else_if = { # Otherwise, get the capital limit = { - capital_province = { has_special_building_slot = no } + capital_province = { has_special_district_slot = no } } capital_province = { save_scope_as = legendary_locale } } @@ -2284,13 +2299,13 @@ give_legendary_building_location_standard_effect = { limit = { any_held_title = { title_tier = county - title_province = { has_special_building_slot = no } + title_province = { has_special_district_slot = no } } } random_held_title = { title_tier = county limit = { - title_province = { has_special_building_slot = no } + title_province = { has_special_district_slot = no } } title_province = { save_scope_as = legendary_locale } } @@ -2300,7 +2315,7 @@ give_legendary_building_location_standard_effect = { any_held_title = { title_tier = barony title_province = { - has_special_building_slot = no + has_special_district_slot = no } } } @@ -2308,7 +2323,7 @@ give_legendary_building_location_standard_effect = { title_tier = barony limit = { title_province = { - has_special_building_slot = no + has_special_district_slot = no } } title_province = { @@ -2321,17 +2336,17 @@ give_legendary_building_location_standard_effect = { limit = { any_held_title = { title_tier = county - any_county_province = { has_special_building_slot = no } + any_county_province = { has_special_district_slot = no } } } random_held_title = { title_tier = county limit = { - any_county_province = { has_special_building_slot = no } + any_county_province = { has_special_district_slot = no } } random_county_province = { limit = { - has_special_building_slot = no + has_special_district_slot = no } save_scope_as = legendary_locale } @@ -2341,7 +2356,7 @@ give_legendary_building_location_standard_effect = { limit = { any_sub_realm_barony = { title_province = { - has_special_building_slot = no + has_special_district_slot = no has_holding_type = castle_holding } } @@ -2349,7 +2364,7 @@ give_legendary_building_location_standard_effect = { random_sub_realm_barony = { limit = { title_province = { - has_special_building_slot = no + has_special_district_slot = no has_holding_type = castle_holding } } @@ -2360,7 +2375,7 @@ give_legendary_building_location_standard_effect = { limit = { any_sub_realm_barony = { title_province = { - has_special_building_slot = no + has_special_district_slot = no has_holding = yes } } @@ -2368,7 +2383,7 @@ give_legendary_building_location_standard_effect = { random_sub_realm_barony = { limit = { title_province = { - has_special_building_slot = no + has_special_district_slot = no has_holding = yes } } diff --git a/common/scripted_effects/07_dlc_ep3_scripted_effects.txt b/common/scripted_effects/07_dlc_ep3_scripted_effects.txt index 36ac398d7..dc3da2f8e 100644 --- a/common/scripted_effects/07_dlc_ep3_scripted_effects.txt +++ b/common/scripted_effects/07_dlc_ep3_scripted_effects.txt @@ -23,6 +23,29 @@ create_landless_minority_title_history_effect = { } } } +set_landless_adventurer_government_type_effect = { + scope:new_landless_adventurer = { + if = { + limit = { + NOT = { has_government = landless_adventurer_government } + } + change_government = landless_adventurer_government + } + if = { + limit = { + NOT = { has_realm_law = landless_adventurer_succession_law } + } + add_realm_law = landless_adventurer_succession_law + } + if = { + limit = { + has_realm_law = crown_authority_0 + } + remove_realm_law = crown_authority_0 + } + domicile = { change_provisions = starting_provisions_value } + } +} create_landless_adventurer_title_effect = { save_scope_as = new_landless_adventurer @@ -44,6 +67,17 @@ create_landless_adventurer_title_effect = { } $FLAVOR_CHAR$ = { save_scope_as = adventurer_flavor_char } hidden_effect = { + if = { + limit = { exists = scope:adventurer_flavor_char } + set_variable = { + name = pending_adventurer_creation_reason + value = scope:adventurer_creation_reason + } + set_variable = { + name = pending_adventurer_flavor_char + value = scope:adventurer_flavor_char + } + } random_list = { #Acclaimed knights become laamps interaction 10000 = { @@ -56,6 +90,7 @@ create_landless_adventurer_title_effect = { holder = scope:new_landless_adventurer save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 10000 = { trigger = { @@ -67,6 +102,7 @@ create_landless_adventurer_title_effect = { holder = scope:new_landless_adventurer save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 10000 = { trigger = { @@ -79,6 +115,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 10000 = { trigger = { @@ -91,6 +128,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 10000 = { trigger = { @@ -103,6 +141,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 10000 = { trigger = { @@ -115,6 +154,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 10000 = { trigger = { @@ -127,6 +167,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 10000 = { trigger = { @@ -139,6 +180,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 10000 = { trigger = { @@ -150,6 +192,7 @@ create_landless_adventurer_title_effect = { holder = scope:new_landless_adventurer save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } #Confederation event laamps 1000 = { @@ -162,6 +205,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 1000 = { trigger = { @@ -175,6 +219,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 5 = { create_adventurer_title = { @@ -183,6 +228,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 5 = { trigger = { @@ -194,6 +240,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 5 = { create_adventurer_title = { @@ -202,6 +249,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 5 = { create_adventurer_title = { @@ -210,6 +258,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 5 = { trigger = { @@ -223,6 +272,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 5 = { create_adventurer_title = { @@ -231,6 +281,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 5 = { create_adventurer_title = { @@ -239,6 +290,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 5 = { trigger = { @@ -249,6 +301,7 @@ create_landless_adventurer_title_effect = { holder = scope:new_landless_adventurer save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 5 = { create_adventurer_title = { @@ -257,6 +310,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 3 = { trigger = { @@ -268,6 +322,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 3 = { trigger = { @@ -279,6 +334,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 3 = { trigger = { @@ -290,6 +346,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 3 = { trigger = { @@ -301,6 +358,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 3 = { trigger = { @@ -312,6 +370,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 3 = { trigger = { @@ -323,6 +382,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 3 = { trigger = { @@ -342,6 +402,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 3 = { trigger = { @@ -361,6 +422,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 3 = { trigger = { @@ -378,6 +440,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 3 = { trigger = { @@ -395,6 +458,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 3 = { trigger = { @@ -412,6 +476,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 3 = { trigger = { @@ -426,6 +491,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 3 = { create_adventurer_title = { @@ -434,6 +500,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 5 = { trigger = { @@ -445,6 +512,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 5 = { trigger = { @@ -463,6 +531,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 3 = { trigger = { @@ -475,6 +544,7 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 5 = { create_adventurer_title = { @@ -482,6 +552,7 @@ create_landless_adventurer_title_effect = { holder = scope:new_landless_adventurer save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } 1 = { trigger = { @@ -502,8 +573,11 @@ create_landless_adventurer_title_effect = { article = DEFAULT_TITLE_NAME_ARTICLE save_scope_as = new_title } + set_landless_adventurer_government_type_effect = yes } } + remove_variable = pending_adventurer_creation_reason + remove_variable = pending_adventurer_flavor_char scope:new_title ?= { create_landless_adventurer_title_history_effect = yes @@ -518,27 +592,6 @@ create_landless_adventurer_title_effect = { } scope:new_title = { save_scope_as = new_landless_adventurer_title } - scope:new_landless_adventurer = { - if = { - limit = { - NOT = { has_government = landless_adventurer_government } - } - change_government = landless_adventurer_government - } - if = { - limit = { - NOT = { has_realm_law = landless_adventurer_succession_law } - } - add_realm_law = landless_adventurer_succession_law - } - if = { - limit = { - has_realm_law = crown_authority_0 - } - remove_realm_law = crown_authority_0 - } - domicile = { change_provisions = starting_provisions_value } - } every_player = { limit = { NOR = { @@ -578,13 +631,13 @@ create_landless_adventurer_title_effect = { flag:runaway_forbidden = { custom_tooltip = nearby_landless_adventurer_created_message_runaway_forbidden_tt } flag:wanderer = { custom_tooltip = nearby_landless_adventurer_created_message_wanderer_tt } flag:eradicate = { custom_tooltip = nearby_landless_adventurer_created_message_eradicate_tt } + flag:fleeing_republic = { custom_tooltip = fleeing_republic_landless_adventurer_created_message_eradicate_tt } flag:acclaimed_mercenary = { custom_tooltip = nearby_landless_adventurer_created_message_acclaimed_mercenary_tt } fallback = { custom_tooltip = nearby_landless_adventurer_created_message_fallback_tt } } } } } - custom_tooltip = laamp_become_adventurer_tt if = { limit = { OR = { @@ -656,6 +709,7 @@ create_landless_adventurer_title_effect = { every_courtier = { limit = { NOR = { + is_in_list = courtiers_list is_close_or_extended_family_of = scope:new_landless_adventurer has_relation_lover = scope:new_landless_adventurer has_relation_friend = scope:new_landless_adventurer @@ -691,7 +745,7 @@ create_landless_adventurer_title_effect = { set_landless_government_effect = { if = { limit = { - has_dlc_feature = roads_to_power + has_playable_adventurer_dlc_trigger = yes } change_government = landless_adventurer_government } @@ -733,9 +787,7 @@ destroy_laamp_effect = { save_scope_as = the_adventurer # If we weren't an adventurer before, make us one. if = { - limit = { - NOT = { has_trait = adventurer } - } + limit = { NOT = { has_trait = adventurer } } add_trait = adventurer } hidden_effect = { @@ -747,9 +799,10 @@ destroy_laamp_effect = { add_trait = adventurer_follower } } + # Liquidate camp custom_tooltip = { text = destroy_laamp_effect.tt.domicile_liquidated - laamp_clear_domicile_buildings_effect = yes + laamp_clear_domicile_buildings_liquidator_effect = yes } # Contacts have opinions™ about you. ## Be they good. @@ -917,21 +970,34 @@ ep3_become_landed_save_liege_effect = { } ep3_become_landed_transfer_effect = { - ordered_in_list = { - list = $TITLE_LIST$ - order_by = tier - save_scope_as = new_primary_title - } - hidden_effect = { - # Liquidate camp - $TITLE_RECEIVER$ = { laamp_clear_domicile_buildings_liquidator_effect = yes } - } - $TITLE_RECEIVER$ = { -# if = { -# limit = { character:90028 ?= this } -# custom_tooltip = ep3_story_cycle_harrying.3053.b.tt -# add_character_flag = hereward_settled_flag -# } + $TITLE_RECEIVER$ = { save_scope_as = purchaser } + scope:purchaser = { + # LAAMP HANDLING + hidden_effect = { + if = { + limit = { + government_has_flag = government_is_landless_adventurer + } + set_variable = { # Used to prevent invalid NF creation + name = laamp_invasion_flag + value = scope:target + days = 1 + } + save_temporary_scope_as = was_adventurer + } + else_if = { + limit = { + government_has_flag = government_is_merchant + } + save_temporary_scope_as = was_merchant + } + } + if = { + limit = { character:90028 ?= this } + custom_tooltip = ep3_story_cycle_harrying.3053.b.tt + add_character_flag = hereward_settled_flag + } + # TRACKING set_variable = { name = ascended_throne_reason value = $REASON$ @@ -941,28 +1007,26 @@ ep3_become_landed_transfer_effect = { name = ascended_throne_value value = $REASON$ } - set_variable = { # Used to prevent invalid NF creation - name = laamp_invasion_flag - value = scope:new_primary_title - days = 1 - } } + # TRANSFER create_title_and_vassal_change = { type = $TYPE$ add_claim_on_loss = yes save_scope_as = title_change } - scope:new_primary_title.holder ?= { save_scope_as = old_holder } + # SAVE PREVIOUS HOLDER + scope:target.holder ?= { save_scope_as = old_holder } if = { limit = { NOT = { exists = scope:old_holder } } scope:new_primary_title = { ordered_de_jure_county = { limit = { holder.top_liege = scope:defender.top_liege } - order_by = development_level + order_by = prosperity_level holder = { save_scope_as = old_holder } } } } + # SAVE SPECIAL GOVERNMENT OVERRIDES scope:supporter ?= { save_scope_as = government_giver } if = { limit = { NOT = { exists = scope:government_giver } } @@ -971,31 +1035,52 @@ ep3_become_landed_transfer_effect = { scope:government_giver.government_type ?= { save_scope_as = old_government } + # SAVE FUTURE PRIMARY TITLE + ordered_in_list = { + list = $TITLE_LIST$ + order_by = tier + save_scope_as = new_primary_title + } + # SAVE FUTURE CAPITAL if = { - limit = { - NOT = { exists = scope:new_capital } - } + limit = { NOT = { exists = scope:new_capital } } ordered_in_list = { list = $TITLE_LIST$ limit = { tier = tier_county } - order_by = development_level + order_by = prosperity_level save_scope_as = new_capital } } if = { - limit = { - NOT = { exists = scope:new_capital } - } + limit = { NOT = { exists = scope:new_capital } } scope:new_primary_title ?= { ordered_de_jure_county = { limit = { holder = scope:old_holder } alternative_limit = { holder.top_liege = scope:old_holder.top_liege } - order_by = development_level + order_by = prosperity_level save_scope_as = new_capital } } } - $TITLE_RECEIVER$ = { + # ENNOBLED PENALTIES + if = { + limit = { + $NEVER_ENNOBLED$ = flag:no + trigger_if = { + limit = { exists = scope:republic } + scope:republic = no + } + } + scope:purchaser = { + # TODO_GDP_CD: Should TITLE_RECEIVER be needed here? + ep3_become_landed_ennobled_penalty_effect = { + TITLE = scope:new_primary_title + TITLE_RECEIVER = scope:purchaser + } + } + } + # TRANSFER TITLES + scope:purchaser = { if = { limit = { exists = scope:new_primary_title @@ -1007,7 +1092,7 @@ ep3_become_landed_transfer_effect = { else = { scope:new_primary_title ?= { change_title_holder_include_vassals = { - holder = $TITLE_RECEIVER$ + holder = scope:purchaser change = scope:title_change take_baronies = no } @@ -1062,13 +1147,13 @@ ep3_become_landed_transfer_effect = { NOT = { scope:new_primary_title ?= this } } change_title_holder_include_vassals = { - holder = $TITLE_RECEIVER$ + holder = scope:purchaser change = scope:title_change take_baronies = no } } if = { - limit = { $TITLE_RECEIVER$ = { has_character_flag = special_laamp_char } } + limit = { has_character_flag = special_laamp_char } resolve_title_and_vassal_change = scope:title_change # Then we resolve vassalage separately, so that we can lock in tiers. create_title_and_vassal_change = { @@ -1077,6 +1162,7 @@ ep3_become_landed_transfer_effect = { save_scope_as = title_change } } + # SET VASSALAGE/INDEPENDENCE if = { limit = { exists = scope:new_liege @@ -1088,7 +1174,7 @@ ep3_become_landed_transfer_effect = { } } } - $TITLE_RECEIVER$ = { + scope:purchaser = { change_liege = { liege = scope:new_liege change = scope:title_change @@ -1097,182 +1183,241 @@ ep3_become_landed_transfer_effect = { } else_if = { limit = { top_liege != this } - $TITLE_RECEIVER$ = { becomes_independent = { change = scope:title_change } } + becomes_independent = { change = scope:title_change } } resolve_title_and_vassal_change = scope:title_change + # Set government type + # Skip republics, gdp_found_a_republic_effect handles that path if = { limit = { - $REASON$ = flag:purchased - any_in_list = { - list = purchase_land_vassals_taken - always = yes + exists = scope:old_government + NOT = { + scope:republic ?= yes } } - create_title_and_vassal_change = { - type = $TYPE$ - add_claim_on_loss = yes - save_scope_as = purchase_land_vassal_change - } - every_in_list = { - list = purchase_land_vassals_taken - change_liege = { - liege = $TITLE_RECEIVER$ - change = scope:purchase_land_vassal_change - } - } - resolve_title_and_vassal_change = scope:purchase_land_vassal_change - } - # Set government type - $TITLE_RECEIVER$ = { - if = { - limit = { exists = scope:old_government } - # We don't expect to actually trigger most of the below, as most are not valid targets to begin with, but all are included for completeness and mod support - switch = { - trigger = scope:old_government - government_type:nomad_government = { - #Did you demand a herder's pastureland? - if = { - limit = { - scope:new_capital.title_province = { - has_holding = yes - NOT = { has_holding_type = nomad_holding } - } + # We don't expect to actually trigger most of the below, as most are not valid targets to begin with, but all are included for completeness and mod support + switch = { + trigger = scope:old_government + government_type:nomad_government = { + #Did you demand a herder's pastureland? + if = { + limit = { + scope:new_capital.title_province = { + has_holding = yes + NOT = { has_holding_type = nomad_holding } } - scope:new_capital.title_province = { set_holding_type = nomad_holding } } - change_government = nomad_government + scope:new_capital.title_province = { set_holding_type = nomad_holding } } - government_type:mandala_government = { + change_government = nomad_government + } + government_type:mandala_government = { + if = { + limit = { + faith = { has_doctrine = doctrine_polytheist } + } + change_government = mandala_government + #Sort out the House shenanigans if = { - limit = { - faith = { has_doctrine = doctrine_polytheist } - } - change_government = mandala_government - #Sort out the House shenanigans - if = { - limit = { is_house_head = no } - house = { - if = { - limit = { - house_head = { - is_landed = no - is_courtier_of = root - } + limit = { is_house_head = no } + house = { + if = { + limit = { + house_head = { + is_landed = no + is_courtier_of = root } - set_house_head = root } - } - } - else = { - house ?= { - set_house_aspiration = { type = no_aspect } + set_house_head = root } } } else = { - assign_feudal_governments_effect = yes - } - } - government_type:japan_administrative_government = { - if = { - limit = { - scope:new_liege ?= { has_government = japan_administrative_government } + house ?= { + set_house_aspiration = { type = no_aspect } } - change_government = japan_administrative_government } - else = { change_government = feudal_government } } - fallback = { - change_government = scope:old_government + else = { + assign_feudal_governments_effect = yes + } + } + government_type:herder_government = { + change_government = herder_government + } + government_type:celestial_government = { + change_government = celestial_government + } + government_type:steppe_admin_government = { + change_government = steppe_admin_government + } + government_type:meritocratic_government = { + change_government = meritocratic_government + } + government_type:japan_feudal_government = { + change_government = japan_feudal_government + } + government_type:japan_administrative_government = { + if = { + limit = { + scope:new_liege ?= { has_government = japan_administrative_government } + } + change_government = japan_administrative_government + } + else = { change_government = feudal_government } + } + fallback = { + change_government = scope:old_government + } + } + } + # Otherwise we proceed as normal + else_if = { + limit = { NOT = { scope:republic = yes } } + scope:purchaser = { + # Change our government according to the government of our liege. + assign_new_government_effect = yes + } + } + ### CLEANUP LANDLESS + if = { + limit = { exists = scope:was_adventurer } + destroy_laamp_effect = { ADVENTURER = scope:purchaser } + } + # When a merchant founds a republic, their company stays as the founding patrician family title + # gdp_found_a_republic_effect handles the full transition, so we do not destroy the company here + ### Setup Admin NF if valid + if = { + limit = { government_has_mechanic = administrative } + give_new_noble_family_title_effect = yes + } +} + +ep3_become_landed_ennobled_penalty_effect = { + save_temporary_scope_as = ennobled_temp + $TITLE$ = { + save_temporary_scope_as = title_temp + title_province.county = { save_scope_as = capital_temp } + } + if = { + limit = { + calc_true_if = { + amount = 3 + prestige_level <= 3 + scope:capital_temp.culture ?= { + NOR = { + scope:ennobled_temp.culture ?= this + scope:ennobled_temp.primary_spouse.culture ?= this + scope:ennobled_temp.primary_heir.culture ?= this + } + } + scope:capital_temp.faith != faith + } + } + if = { + limit = { government_has_flag = government_is_merchant } + custom_tooltip = { + text = gdp_ennobled_merchant_modifier_tt_3 + add_character_modifier = { + modifier = gdp_ennobled_merchant_modifier_3 + years = 30 } } } - # Otherwise we proceed as normal else = { - # Change our government according to the government of our liege. - assign_new_government_effect = yes - # Ennobled adventurer penalties - if = { - limit = { $ENNOBLED_ADVENTURER$ = flag:yes } - if = { - limit = { - calc_true_if = { - amount = 3 - prestige_level <= 3 - scope:new_capital.culture ?= { - NOR = { - $TITLE_RECEIVER$.culture ?= this - $TITLE_RECEIVER$.primary_spouse.culture ?= this - $TITLE_RECEIVER$.primary_heir.culture ?= this - } - } - scope:new_capital.faith != faith - } - } - custom_tooltip = ep3_ennobled_adventurer_modifier_reason_3 - add_character_modifier = { - modifier = ep3_ennobled_adventurer_modifier_3 - years = 30 - } - custom_tooltip = ep3_ennobled_adventurer_modifier_rules - } - else_if = { - limit = { - calc_true_if = { - amount = 2 - prestige_level <= 3 - scope:new_capital.culture ?= { - NOR = { - $TITLE_RECEIVER$.culture ?= this - $TITLE_RECEIVER$.primary_spouse.culture ?= this - $TITLE_RECEIVER$.primary_heir.culture ?= this - } - } - scope:new_capital.faith != faith - } - } - custom_tooltip = ep3_ennobled_adventurer_modifier_reason_2 - add_character_modifier = { - modifier = ep3_ennobled_adventurer_modifier_2 - years = 20 - } - custom_tooltip = ep3_ennobled_adventurer_modifier_rules - } - else_if = { - limit = { - calc_true_if = { - amount = 1 - prestige_level <= 3 - scope:new_capital.culture ?= { - NOR = { - $TITLE_RECEIVER$.culture ?= this - $TITLE_RECEIVER$.primary_spouse.culture ?= this - $TITLE_RECEIVER$.primary_heir.culture ?= this - } - } - scope:new_capital.faith != faith - } - } - custom_tooltip = ep3_ennobled_adventurer_modifier_reason_1 - add_character_modifier = { - modifier = ep3_ennobled_adventurer_modifier_1 - years = 10 - } - custom_tooltip = ep3_ennobled_adventurer_modifier_rules + custom_tooltip = { + text = ep3_ennobled_adventurer_modifier_tt_3 + add_character_modifier = { + modifier = ep3_ennobled_adventurer_modifier_3 + years = 30 } } } } - destroy_laamp_effect = { ADVENTURER = $TITLE_RECEIVER$ } - $TITLE_RECEIVER$ = { - # Setup NF if valid - if = { - limit = { - government_has_mechanic = administrative - government_allows = noble_families + else_if = { + limit = { + calc_true_if = { + amount = 2 + prestige_level <= 3 + scope:capital_temp.culture ?= { + NOR = { + scope:ennobled_temp.culture ?= this + scope:ennobled_temp.primary_spouse.culture ?= this + scope:ennobled_temp.primary_heir.culture ?= this + } + } + scope:capital_temp.faith != faith } - give_new_noble_family_title_effect = yes } + if = { + limit = { government_has_flag = government_is_merchant } + custom_tooltip = { + text = gdp_ennobled_merchant_modifier_tt_2 + add_character_modifier = { + modifier = gdp_ennobled_merchant_modifier_2 + years = 20 + } + } + } + else = { + custom_tooltip = { + text = ep3_ennobled_adventurer_modifier_tt_2 + add_character_modifier = { + modifier = ep3_ennobled_adventurer_modifier_2 + years = 20 + } + } + } + } + else_if = { + limit = { + calc_true_if = { + amount = 1 + prestige_level <= 3 + scope:title_temp.title_province.county.culture ?= { + NOR = { + scope:ennobled_temp.culture ?= this + scope:ennobled_temp.primary_spouse.culture ?= this + scope:ennobled_temp.primary_heir.culture ?= this + } + } + scope:capital_temp.faith != faith + } + } + if = { + limit = { government_has_flag = government_is_merchant } + custom_tooltip = { + text = gdp_ennobled_merchant_modifier_tt_1 + add_character_modifier = { + modifier = gdp_ennobled_merchant_modifier_1 + years = 10 + } + } + } + else = { + custom_tooltip = { + text = ep3_ennobled_adventurer_modifier_tt_1 + add_character_modifier = { + modifier = ep3_ennobled_adventurer_modifier_1 + years = 10 + } + } + } + } + if = { + limit = { government_has_flag = government_is_merchant } + destroy_merchant_effect = { MERCHANT = $TITLE_RECEIVER$ } + } + else = { + destroy_laamp_effect = { ADVENTURER = $TITLE_RECEIVER$ } + } + # Setup NF if valid + if = { + limit = { + government_has_mechanic = administrative + government_allows = noble_families + } + give_new_noble_family_title_effect = yes } } @@ -1330,82 +1475,124 @@ ep3_become_landed_warning_effect = { } purchase_land_interaction_effect = { - # scope:actor = adventurer - # scope:recipient = seller + # scope:purchaser = adventurer/merchant + # scope:seller = seller # purchased_titles = titles + $TITLE_RECEIVER$ = { save_scope_as = purchaser } + $TITLE_GIVER$ = { save_scope_as = seller } - hidden_effect = { - scope:actor = { - if = { - limit = { character:90028 ?= this } - add_character_flag = hereward_settled_flag - } - if = { - limit = { - NOT = { has_trait = adventurer } - } - add_trait = adventurer - } - every_courtier = { - set_variable = { - name = former_camp_leader - value = scope:actor - } - add_trait = adventurer_follower - } + # Determine post-sale hierarchy + if = { + limit = { scope:independent = yes } + ep3_become_landed_save_liege_effect = { + TITLE_GIVER = scope:seller + ALWAYS_INDEPENDENT = yes + TITLE_LIST = purchased_titles } } - - # Determine hierarchy - ep3_become_landed_save_liege_effect = { - TITLE_GIVER = scope:recipient - ALWAYS_INDEPENDENT = no - TITLE_LIST = purchased_titles + else = { + ep3_become_landed_save_liege_effect = { + TITLE_GIVER = scope:seller + ALWAYS_INDEPENDENT = no + TITLE_LIST = purchased_titles + } + # Republics are at least duchy tier, so a count or duke seller passes them to the nearest kingdom+ tier liege + if = { + limit = { + scope:republic ?= yes + scope:seller.highest_held_title_tier < tier_kingdom + } + scope:seller = { + ordered_liege_or_above = { + limit = { highest_held_title_tier >= tier_kingdom } + order_by = { + value = highest_held_title_tier + multiply = -1 + } + save_scope_as = new_liege + } + } + } } # Purchase land specific - # actual give recipient the gold - scope:actor = { - pay_short_term_gold = { - gold = scope:purchase_land_cost - target = scope:recipient + scope:purchaser = { + if = { + limit = { scope:purchase_land_cost != 0 } + show_as_tooltip = { + pay_short_term_gold = { + gold = scope:purchase_land_cost + target = scope:seller + } + } } } + # Forgive Loan + if = { + limit = { scope:forgive_loan = yes } + scope:seller = { + ordered_owned_story = { + limit = { + story_type = story_cycle_loan + var:lender = scope:purchaser + } + order_by = var:years_since + forgive_loan_effect = yes + } + } + } + if = { + limit = { + scope:purchaser = { government_has_flag = government_is_merchant } + } + gdp_merchant_feudalize_purchased_tribal_land_effect = yes + } # Resolve title, liege, government changes ep3_become_landed_transfer_effect = { - TITLE_RECEIVER = scope:actor + TITLE_RECEIVER = scope:purchaser TITLE_LIST = purchased_titles TYPE = granted REASON = flag:purchased - ENNOBLED_ADVENTURER = flag:yes + NEVER_ENNOBLED = flag:no } # Extra purchase land specific - scope:actor = { - stress_and_fulfillment_impact = { - greedy = minor_stress_impact_gain - lazy = minor_stress_impact_loss + if = { + limit = { + NOT = { scope:republic ?= yes } + } + scope:purchaser = { + stress_and_fulfillment_impact = { + greedy = minor_stress_impact_gain + lazy = minor_stress_impact_loss + } } } # Effects on land giver - scope:recipient = { add_legitimacy = scope:purchase_land_legitimacy_cost } + scope:seller = { add_legitimacy = scope:purchase_land_legitimacy_cost } # Messages for nearby players create_landed_ruler_message_effect = { - LANDED = scope:actor - FLAVOR_CHAR = scope:recipient + LANDED = scope:purchaser + FLAVOR_CHAR = scope:seller FLAVOR_TITLE = scope:target REASON = flag:purchased } # Hook if = { limit = { scope:offer_hook = yes } - scope:recipient = { + scope:seller = { add_hook = { type = obligation_hook - target = scope:actor + target = scope:purchaser } } } #Handle the government types if = { + limit = { scope:republic = yes } + scope:purchaser = { + gdp_found_a_republic_effect = yes + } + } + else_if = { limit = { scope:recipient = { government_has_flag = government_is_mandala } #... we're lenient @@ -1439,127 +1626,254 @@ purchase_land_interaction_effect = { } } } + hidden_effect = { + scope:purchaser = { return_home = yes } + } } + +purchase_land_interaction_save_scopes_effect = { + scope:actor = { save_scope_as = purchaser } + scope:target = { + save_scope_as = purchase_land_target + add_to_list = purchased_titles + if = { + limit = { tier = tier_duchy } + every_de_jure_county = { + limit = { + holder ?= { + OR = { + this = scope:recipient + target_is_liege_or_above = scope:recipient + } + } + } + if = { + limit = { holder = scope:recipient } + add_to_list = purchased_titles + } + else_if = { + limit = { + holder ?= { + highest_held_title_tier < scope:purchase_land_target.tier + NOT = { government_has_flag = government_is_administrative } + target_is_liege_or_above = scope:recipient + } + } + holder = { + if = { + limit = { + NOT = { is_in_list = purchase_land_vassals_taken } + } + add_to_list = purchase_land_vassals_taken + } + } + } + else = { + add_to_list = purchased_titles + } + } + + } + } + ordered_in_list = { + list = purchased_titles + order_by = tier + save_scope_as = new_primary_title + } + save_scope_value_as = { + name = purchase_land_cost + value = { + # Must match the gold the merchant interaction's cost block charges + if = { + limit = { scope:actor = { government_has_flag = government_is_merchant } } + add = merchant_purchase_land_total_cost_value + } + else = { + every_in_list = { + list = purchased_titles + if = { + limit = { tier = tier_county } + add = purchase_land_county_cost_value + } + else_if = { + limit = { tier = tier_duchy } + add = purchase_land_duchy_cost_value + } + } + if = { + limit = { + scope:actor = { has_variable = ep3_grace_to_the_family_var } + } + multiply = 0.5 + } + if = { + limit = { scope:forgive_loan = yes } + scope:recipient = { + ordered_owned_story = { + limit = { + story_type = story_cycle_loan + var:lender = scope:actor + } + order_by = var:years_since + add = { + value = var:amount_owed + multiply = -1 + } + } + } + } + if = { + limit = { scope:offer_gold = yes } + multiply = 2 + } + } + min = 0 + } + } + save_scope_value_as = { + name = purchase_land_legitimacy_cost + value = { + value = 0 + if = { + limit = { scope:target.holder != scope:recipient } + every_in_list = { + list = purchased_titles + if = { + limit = { tier = tier_county } + add = minor_legitimacy_loss + } + else = { add = medium_legitimacy_loss } + } + } + } + } +} + # not used. note check consistency with purchase_land_interaction etc to make sure actor do lose gold ONCE purchase_land_interaction_shortened_effect = { - scope:actor = { + $TITLE_RECEIVER$ = { save_scope_as = purchaser } + $TITLE_GIVER$ = { save_scope_as = seller } + scope:purchaser = { if = { limit = { character:90028 ?= this } custom_tooltip = ep3_story_cycle_harrying.3053.b.tt add_character_flag = hereward_settled_flag } show_as_tooltip = { - pay_short_term_gold = { - gold = scope:purchase_land_cost - target = scope:recipient + if = { + limit = { scope:purchase_land_cost != 0 } + show_as_tooltip = { + pay_short_term_gold = { + gold = scope:purchase_land_cost + target = scope:seller + } + } + } + } + # Forgive Loan + if = { + limit = { scope:forgive_loan = yes } + scope:seller = { + ordered_owned_story = { + limit = { + story_type = story_cycle_loan + var:lender = scope:purchaser + } + order_by = var:years_since + forgive_loan_effect = yes + } } } hidden_effect = { - scope:recipient = { add_gold = scope:purchase_land_cost } - } - } - scope:actor = { - stress_and_fulfillment_impact = { - humble = minor_stress_impact_gain - lazy = minor_stress_impact_loss + if = { + limit = { scope:purchase_land_cost != 0 } + scope:seller = { add_gold = scope:purchase_land_cost } + } } if = { - limit = { - scope:target.tier = tier_duchy - } + limit = { scope:target.tier = tier_duchy } custom_tooltip = purchase_land_interaction_shortened_effect_duchy_desc } - else = { - custom_tooltip = purchase_land_interaction_shortened_effect_county_desc - } + else = { custom_tooltip = purchase_land_interaction_shortened_effect_county_desc } if = { limit = { - scope:target.tier = tier_duchy + NOT = { scope:republic ?= yes } } - scope:target.title_capital_county = { - save_scope_as = new_primary_title + stress_and_fulfillment_impact = { + humble = minor_stress_impact_gain + lazy = minor_stress_impact_loss } } - else = { - scope:target = { - save_scope_as = new_primary_title + } + # Hook + if = { + limit = { scope:offer_hook = yes } + scope:seller = { + add_hook = { + type = obligation_hook + target = scope:purchaser } } + } + scope:target = { if = { - limit = { - calc_true_if = { - amount = 3 - prestige_level <= 3 - OR = { - scope:new_primary_title.culture != culture - primary_spouse ?= { - culture != scope:new_primary_title.culture - } - primary_heir ?= { - culture != scope:new_primary_title.culture + limit = { tier = tier_duchy } + title_capital_county = { save_scope_as = new_primary_title } + } + else = { save_scope_as = new_primary_title } + } + # ENNOBLED PENALTIES + if = { + limit = { scope:republic ?= no } + scope:purchaser = { + # TODO_GDP_CD: Should TITLE_RECEIVER be needed here? + ep3_become_landed_ennobled_penalty_effect = { + TITLE = scope:new_primary_title + TITLE_RECEIVER = scope:purchaser + } + } + } + # Vassal + if = { + limit = { + NOT = { scope:independent ?= yes } + } + create_title_and_vassal_change = { + type = granted + save_scope_as = change + } + scope:purchaser = { + if = { + limit = { + scope:republic ?= yes + scope:seller.highest_held_title_tier < tier_kingdom + } + scope:seller = { + ordered_liege_or_above = { + limit = { highest_held_title_tier >= tier_kingdom } + order_by = { + value = highest_held_title_tier + multiply = -1 } + save_temporary_scope_as = republic_liege_temp + } + } + if = { + limit = { exists = scope:republic_liege_temp } + change_liege = { + liege = scope:republic_liege_temp + change = scope:change } - scope:new_primary_title.faith != faith } } - custom_tooltip = ep3_ennobled_adventurer_modifier_reason_3 - add_character_modifier = { - modifier = ep3_ennobled_adventurer_modifier_3 - years = 30 - } - custom_tooltip = ep3_ennobled_adventurer_modifier_rules - } - else_if = { - limit = { - calc_true_if = { - amount = 2 - prestige_level <= 3 - OR = { - scope:new_primary_title.culture != culture - primary_spouse ?= { - culture != scope:new_primary_title.culture - } - primary_heir ?= { - culture != scope:new_primary_title.culture - } - } - scope:new_primary_title.faith != faith - + else = { + change_liege = { + liege = scope:seller + change = scope:change } } - custom_tooltip = ep3_ennobled_adventurer_modifier_reason_2 - add_character_modifier = { - modifier = ep3_ennobled_adventurer_modifier_2 - years = 20 - } - custom_tooltip = ep3_ennobled_adventurer_modifier_rules } - else_if = { - limit = { - calc_true_if = { - amount = 1 - prestige_level <= 3 - OR = { - scope:new_primary_title.culture != culture - primary_spouse ?= { - culture != scope:new_primary_title.culture - } - primary_heir ?= { - culture != scope:new_primary_title.culture - } - } - scope:new_primary_title.faith != faith - - } - } - custom_tooltip = ep3_ennobled_adventurer_modifier_reason_1 - add_character_modifier = { - modifier = ep3_ennobled_adventurer_modifier_1 - years = 10 - } - custom_tooltip = ep3_ennobled_adventurer_modifier_rules - } - + resolve_title_and_vassal_change = scope:change } } @@ -1614,10 +1928,6 @@ procure_estate_interaction_effect = { scope:recipient = { change_influence = medium_influence_loss } #Scope:actor becomes ladmin scope:actor = { - hidden_effect = { - # Liquidate camp - laamp_clear_domicile_buildings_liquidator_effect = yes - } if = { limit = { scope:actor.house ?= { @@ -1634,20 +1944,24 @@ procure_estate_interaction_effect = { } # Note our courtiers so that they don't escape. every_courtier = { add_to_list = courtiers_list } - # Change liege - save_scope_as = keep_title - every_held_title = { - limit = { - has_variable = adventurer_creation_reason + # Change liege, joining the realm with the noble family title before the camp goes, so we are never without titles + show_as_tooltip = { + create_title_and_vassal_change = { + type = swear_fealty + add_claim_on_loss = no + save_scope_as = title_change } - add_to_list = titles_list + change_liege = { + liege = scope:recipient.top_liege + change = scope:title_change + } + resolve_title_and_vassal_change = scope:title_change } - set_variable = { - name = laamp_transition - days = 1 # removing it in this effect will still fire game over + create_noble_family_with_liege_effect = { + GOVERNMENT_GIVER = scope:recipient + LIEGE = scope:recipient.top_liege } destroy_laamp_effect = { ADVENTURER = scope:actor } - create_noble_family_effect = { GOVERNMENT_GIVER = scope:recipient } hidden_effect = { # Return any escaped courtiers. every_in_list = { @@ -1671,16 +1985,6 @@ procure_estate_interaction_effect = { silent_disappearance_effect = yes } } - create_title_and_vassal_change = { - type = swear_fealty - add_claim_on_loss = no - save_scope_as = title_change - } - change_liege = { - liege = scope:recipient.top_liege - change = scope:title_change - } - resolve_title_and_vassal_change = scope:title_change add_character_modifier = { modifier = ep3_administrative_outsider_modifier years = 15 @@ -1694,17 +1998,6 @@ procure_estate_interaction_effect = { move_domicile = scope:recipient.capital_province } } - every_held_title = { - limit = { - is_noble_family_title = yes - } - add_to_list = titles_list - } - give_noble_family_title_effect = { GOVERNMENT_GIVER = scope:recipient } - every_in_list = { - list = titles_list - prev = { destroy_title = prev } - } } } scope:recipient.top_liege = { @@ -1794,18 +2087,20 @@ negotiate_settlement_interaction_effect = { remove_participant = scope:recipient } } - # Resolve title, liege, government changes - ep3_become_landed_transfer_effect = { - TITLE_RECEIVER = scope:recipient - TITLE_LIST = offered_titles - TYPE = granted - REASON = flag:negotiated - ENNOBLED_ADVENTURER = flag:yes + root = { + # Resolve title, liege, government changes + ep3_become_landed_transfer_effect = { + TITLE_RECEIVER = scope:recipient + TITLE_LIST = offered_titles + TYPE = granted + REASON = flag:negotiated + NEVER_ENNOBLED = flag:no + } } # Effects on land giver scope:actor = { if = { - limit = { + limit = { NOT = { exists = scope:negotiate_settlement_legitimacy_cost } } save_scope_value_as = { @@ -2053,7 +2348,7 @@ seize_realm_scheme_success_effect = { TITLE_LIST = seized_titles TYPE = usurped REASON = flag:seize_realm - ENNOBLED_ADVENTURER = flag:yes + NEVER_ENNOBLED = flag:no } # Old ruler's fate if = { @@ -2070,7 +2365,7 @@ seize_realm_scheme_success_effect = { IMPRISONER = scope:owner } } - add_clan_unity_interaction_effect = { + add_house_unity_interaction_effect = { CHARACTER = scope:owner TARGET = scope:target VALUE = medium_unity_loss @@ -2200,7 +2495,7 @@ seize_realm_scheme_failure_effect = { PLOTTER = scope:owner } # If we're a clan this affects unity - add_clan_unity_interaction_effect = { + add_house_unity_interaction_effect = { CHARACTER = scope:owner TARGET = scope:target VALUE = medium_unity_loss @@ -2236,9 +2531,9 @@ successful_seize_realm_opinion_effect = { target = $PLOTTER$ modifier = seized_my_realm_crime } - set_relation_rival = { - target = scope:owner - reason = rival_seized_realm_reason + set_relation_rival_effect = { + TARGET = scope:owner + REASON = rival_seized_realm_reason } } every_spouse = { @@ -3278,114 +3573,121 @@ create_noble_family_effect = { save_scope_as = new_noble_family_holder $GOVERNMENT_GIVER$ = { save_scope_as = government_giver } if = { - limit = { scope:government_giver ?= { government_allows = noble_families } } + limit = { exists = scope:noble_family_suggested_liege } + scope:noble_family_suggested_liege = { save_scope_as = liege } + } + else_if = { + limit = { is_ruler = no } if = { limit = { - is_ruler = no + scope:government_giver = { is_ruler = yes } } - if = { - limit = { - scope:government_giver = { is_ruler = yes } - } - scope:government_giver = { - if = { - limit = { - highest_held_title_tier <= tier_duchy - } - top_liege = { - save_scope_as = liege - } - } - else = { - save_scope_as = liege - } - } - } - else = { - liege_or_court_owner ?= { - save_scope_as = liege - } - } - } - hidden_effect = { # NF can only be held by house heads - if = { # Start by checking that we are not the house head already - limit = { - exists = house.house_head - NOT = { house.house_head = scope:new_noble_family_holder } - } - if = { # If not, let's see if it would be reasonable to become house head... - limit = { - house.house_head ?= { - is_ai = yes # Don't steal house head from a player - OR = { - # Within same realm but less important - AND = { - top_liege = scope:new_noble_family_holder.top_liege - OR = { - is_ruler = no - highest_held_title_tier < scope:new_noble_family_holder.highest_held_title_tier - } - } - # Wanderer - NOT = { exists = liege } - } - } - } - house = { set_house_head = scope:new_noble_family_holder } - } - else = { # ... Otherwise, we create a cadet branch - create_cadet_house_with_name_effect = yes - } - } - } - scope:new_noble_family_holder = { - if = { - limit = { - NOT = { - any_held_title = { is_noble_family_title = yes } - } - } - give_noble_family_title_effect = { GOVERNMENT_GIVER = scope:government_giver } - } - scope:new_title.holder ?= { + scope:government_giver = { if = { - limit = { - is_landed = no - exists = scope:liege - scope:liege.highest_held_title_tier > highest_held_title_tier - } - create_title_and_vassal_change = { - type = swear_fealty - save_scope_as = change - } - change_liege = { - liege = scope:liege - change = scope:change - } - resolve_title_and_vassal_change = scope:change - } - } - custom_description = { text = create_noble_family_tt } - - #Notifications - every_player = { - limit = { - top_liege = scope:new_noble_family_holder.top_liege - this != scope:new_noble_family_holder - # China has hundreds of Noble Families, it gets spammy - NOT = { government_allows = merit } - } - trigger_event = { - id = ep3_emperor_yearly.2410 - days = 1 + limit = { highest_held_title_tier <= tier_duchy } + top_liege = { save_scope_as = liege } } + else = { save_scope_as = liege } } } + else = { + liege_or_court_owner ?= { save_scope_as = liege } + } + } + # Who a non-ruler becomes a vassal of when getting the title, rulers keep their current liege unless one was suggested + if = { + limit = { exists = scope:liege } + scope:liege = { save_scope_as = noble_family_liege } } else = { - debug_log = "try create NF title but goverment does not allow" + scope:government_giver = { save_scope_as = noble_family_liege } } - debug_log_scopes = yes + hidden_effect = { # NF can only be held by house heads + if = { # Start by checking that we are not the house head already + limit = { + exists = house.house_head + NOT = { house.house_head = scope:new_noble_family_holder } + } + if = { # If not, let's see if it would be reasonable to become house head... + limit = { + house.house_head ?= { + is_ai = yes # Don't steal house head from a player + NOT = { any_held_title = { is_noble_family_title = yes } } + OR = { + # Within same realm but less important + AND = { + top_liege = scope:new_noble_family_holder.top_liege + OR = { + is_ruler = no + highest_held_title_tier < scope:new_noble_family_holder.highest_held_title_tier + } + } + # Wanderer + NOT = { exists = liege } + } + } + } + house = { set_house_head = scope:new_noble_family_holder } + } + else = { # ... Otherwise, we create a cadet branch + create_cadet_house_with_name_effect = yes + } + } + } + scope:new_noble_family_holder = { + if = { + limit = { + NOT = { + any_held_title = { is_noble_family_title = yes } + } + } + give_noble_family_title_effect = { + GOVERNMENT_GIVER = scope:government_giver + LIEGE = scope:noble_family_liege + } + } + scope:new_title.holder ?= { + save_scope_as = noble_family_head + if = { + limit = { + is_landed = no + exists = scope:liege + NOT = { liege = scope:liege } + scope:liege.highest_held_title_tier > highest_held_title_tier + } + create_title_and_vassal_change = { + type = swear_fealty + save_scope_as = change + } + change_liege = { + liege = scope:liege + change = scope:change + } + resolve_title_and_vassal_change = scope:change + } + } + custom_description = { text = create_noble_family_tt } + + #Notifications + every_player = { + limit = { + top_liege = scope:new_noble_family_holder.top_liege + this != scope:new_noble_family_holder + # China has hundreds of Noble Families, it gets spammy + NOT = { government_allows = merit } + } + trigger_event = { + id = ep3_emperor_yearly.2410 + days = 1 + } + } + } +} + +# Like create_noble_family_effect, but even a ruler joins LIEGE when that realm outranks the new title +create_noble_family_with_liege_effect = { + $LIEGE$ = { save_scope_as = noble_family_suggested_liege } + create_noble_family_effect = { GOVERNMENT_GIVER = $GOVERNMENT_GIVER$ } } give_noble_family_title_effect = { @@ -3399,6 +3701,7 @@ give_noble_family_title_effect = { tier = county article = DEFAULT_TITLE_NAME_ARTICLE government = japan_administrative_government + liege = $LIEGE$ save_scope_as = new_title } } @@ -3410,6 +3713,7 @@ give_noble_family_title_effect = { tier = county article = DEFAULT_TITLE_NAME_ARTICLE government = japan_feudal_government + liege = $LIEGE$ save_scope_as = new_title } } @@ -3421,6 +3725,7 @@ give_noble_family_title_effect = { tier = county article = DEFAULT_TITLE_NAME_ARTICLE government = celestial_government + liege = $LIEGE$ save_scope_as = new_title } trigger_event = { @@ -3436,6 +3741,7 @@ give_noble_family_title_effect = { tier = county article = DEFAULT_TITLE_NAME_ARTICLE government = meritocratic_government + liege = $LIEGE$ save_scope_as = new_title } } @@ -3447,17 +3753,50 @@ give_noble_family_title_effect = { tier = county article = DEFAULT_TITLE_NAME_ARTICLE government = steppe_admin_government + liege = $LIEGE$ save_scope_as = new_title } } } + republic_government = { # Republic Government also uses county NFs + prev = { + save_scope_as = republican_founder + if = { + limit = { NOT = { has_government = republic_government } } + change_government = republic_government + } + if = { + limit = { is_lowborn = no } + house = { save_temporary_scope_as = patrician_title_house } + every_close_family_member = { + limit = { + is_alive = yes + NOT = { exists = house } + } + set_house = scope:patrician_title_house + } + } + create_dynamic_title = { + name = NEW_PATRICIAN_TITLE_NAME + tier = county + type = title_type_merchant_family + holder = scope:republican_founder + article = DEFAULT_TITLE_NAME_ARTICLE + save_scope_as = new_title + } + scope:new_title ?= { + add_title_law = noble_family_succession_law + } + } + } fallback = { prev = { give_noble_family_title = { name = noble_family_name - tier = duchy + tier = county article = DEFAULT_TITLE_NAME_ARTICLE government = administrative_government + liege = $LIEGE$ save_scope_as = new_title } } @@ -3725,21 +4064,21 @@ remove_other_eparch_modifiers_effect = { limit = { any_realm_county = { any_county_province = { - has_province_modifier = ep3_eparch_county_opinion_modifier + has_province_modifier = ep3_eparch_popular_opinion_modifier } } } every_realm_county = { limit = { any_county_province = { - has_province_modifier = ep3_eparch_county_opinion_modifier + has_province_modifier = ep3_eparch_popular_opinion_modifier } } every_county_province = { limit = { - has_province_modifier = ep3_eparch_county_opinion_modifier + has_province_modifier = ep3_eparch_popular_opinion_modifier } - remove_province_modifier = ep3_eparch_county_opinion_modifier + remove_province_modifier = ep3_eparch_popular_opinion_modifier } } } @@ -3799,28 +4138,28 @@ remove_other_eparch_modifiers_effect = { } } - # And finally, the development modifier + # And finally, the prosperity modifier scope:liege ?= { # We check and scope to all counties to make sure we remove any stray modifiers in case the capital is moved, etc. if = { limit = { any_realm_county = { any_county_province = { - has_province_modifier = ep3_eparch_development_modifier + has_province_modifier = ep3_eparch_prosperity_modifier } } } every_realm_county = { limit = { any_county_province = { - has_province_modifier = ep3_eparch_development_modifier + has_province_modifier = ep3_eparch_prosperity_modifier } } every_county_province = { limit = { - has_province_modifier = ep3_eparch_development_modifier + has_province_modifier = ep3_eparch_prosperity_modifier } - remove_province_modifier = ep3_eparch_development_modifier + remove_province_modifier = ep3_eparch_prosperity_modifier } } } @@ -5494,7 +5833,7 @@ disburse_chariot_race_activity_host_rewards = { if = { limit = { scope:host.capital_county = { - county_opinion > 0 + popular_opinion > 0 } } add_legitimacy = miniscule_legitimacy_gain @@ -5506,12 +5845,12 @@ disburse_chariot_race_activity_host_rewards = { gregarious = miniscule_stress_loss } } - custom_tooltip = chariot_race_reward_high_county_opinion_tt + custom_tooltip = chariot_race_reward_high_popular_opinion_tt } else_if = { limit = { scope:host.capital_county = { - county_opinion <= -50 + popular_opinion <= -50 } } add_legitimacy = 5 @@ -5523,7 +5862,7 @@ disburse_chariot_race_activity_host_rewards = { gregarious = miniscule_stress_loss } } - custom_tooltip = chariot_race_reward_low_county_opinion_tt + custom_tooltip = chariot_race_reward_low_popular_opinion_tt } else = { add_legitimacy = 10 @@ -5541,7 +5880,7 @@ disburse_chariot_race_activity_host_rewards = { if = { limit = { scope:host.capital_county = { - county_opinion > 0 + popular_opinion > 0 } } add_legitimacy = minor_legitimacy_gain @@ -5557,12 +5896,12 @@ disburse_chariot_race_activity_host_rewards = { change_county_control = miniscule_county_control_gain } - custom_tooltip = chariot_race_reward_high_county_opinion_tt + custom_tooltip = chariot_race_reward_high_popular_opinion_tt } else_if = { limit = { scope:host.capital_county = { - county_opinion <= -50 + popular_opinion <= -50 } } add_legitimacy = 10 @@ -5574,7 +5913,7 @@ disburse_chariot_race_activity_host_rewards = { gregarious = miniscule_stress_loss } } - custom_tooltip = chariot_race_reward_low_county_opinion_tt + custom_tooltip = chariot_race_reward_low_popular_opinion_tt } else = { add_legitimacy = miniscule_legitimacy_gain @@ -5598,7 +5937,7 @@ disburse_chariot_race_activity_host_rewards = { if = { limit = { scope:host.capital_county = { - county_opinion > 0 + popular_opinion > 0 } } add_legitimacy = medium_legitimacy_gain @@ -5613,12 +5952,12 @@ disburse_chariot_race_activity_host_rewards = { capital_county = { change_county_control = minor_county_control_gain } - custom_tooltip = chariot_race_reward_high_county_opinion_tt + custom_tooltip = chariot_race_reward_high_popular_opinion_tt } else_if = { limit = { scope:host.capital_county = { - county_opinion <= -50 + popular_opinion <= -50 } } add_legitimacy = miniscule_legitimacy_gain @@ -5630,7 +5969,7 @@ disburse_chariot_race_activity_host_rewards = { gregarious = miniscule_stress_loss } } - custom_tooltip = chariot_race_reward_low_county_opinion_tt + custom_tooltip = chariot_race_reward_low_popular_opinion_tt } else = { add_legitimacy = minor_legitimacy_gain @@ -9932,65 +10271,69 @@ reinforce_soldiers_regiment_effect = { refill_maa_with_provisions_effect = { save_scope_as = laamp_temp - while = { - count = 100 # Hard bound; the limit below is what normally ends the loop - limit = { - scope:actor.domicile.provisions > 0 - any_maa_regiment = { - maa_regiments_valid_to_refill_trigger = yes - } - } - random_maa_regiment = { + hidden_effect = { + while = { + count = 100 # Hard bound; the limit below is what normally ends the loop limit = { - maa_regiments_valid_to_refill_trigger = yes - } - save_scope_as = maa_scope - save_scope_value_as = { - name = current_provisions_max_value_scope - value = scope:actor.domicile.provisions - } - scope:actor.domicile ?= { - change_provisions = { - value = { - add = scope:maa_scope.replenishable_troops_value - divide = provision_refill_value - max = scope:current_provisions_max_value_scope - multiply = -1 - } + scope:actor.domicile.provisions > 0 + any_maa_regiment = { + maa_regiments_valid_to_refill_trigger = yes } } - change_maa_troops_count = replenishable_troops_with_provisions_value + random_maa_regiment = { + limit = { + maa_regiments_valid_to_refill_trigger = yes + } + save_scope_as = maa_scope + save_scope_value_as = { + name = current_provisions_max_value_scope + value = scope:actor.domicile.provisions + } + scope:actor.domicile ?= { + change_provisions = { + value = { + add = scope:maa_scope.replenishable_troops_value + divide = provision_refill_value + max = scope:current_provisions_max_value_scope + multiply = -1 + } + } + } + change_maa_troops_count = replenishable_troops_with_provisions_value + } } } } refill_maa_with_gold_effect = { save_scope_as = laamp_temp - while = { - count = 100 # Hard bound; the limit below is what normally ends the loop - limit = { - scope:actor.gold > 0 - any_maa_regiment = { - maa_regiments_valid_to_refill_trigger = yes - } - } - random_maa_regiment = { + hidden_effect = { + while = { + count = 100 # Hard bound; the limit below is what normally ends the loop limit = { - maa_regiments_valid_to_refill_trigger = yes - } - save_scope_as = maa_scope - save_scope_value_as = { - name = current_gold_max_value_scope - value = scope:actor.gold - } - scope:actor = { - remove_short_term_gold = { - add = scope:maa_scope.replenishable_troops_value - divide = gold_refill_value - max = scope:current_gold_max_value_scope + scope:actor.gold > 0 + any_maa_regiment = { + maa_regiments_valid_to_refill_trigger = yes } } - change_maa_troops_count = replenishable_troops_with_gold_value + random_maa_regiment = { + limit = { + maa_regiments_valid_to_refill_trigger = yes + } + save_scope_as = maa_scope + save_scope_value_as = { + name = current_gold_max_value_scope + value = scope:actor.gold + } + scope:actor = { + remove_short_term_gold = { + add = scope:maa_scope.replenishable_troops_value + divide = gold_refill_value + max = scope:current_gold_max_value_scope + } + } + change_maa_troops_count = replenishable_troops_with_gold_value + } } } } @@ -10425,7 +10768,7 @@ ep3_war_loss_adventurer_tt_effect = { save_scope_as = war_loser if = { limit = { - has_ep3_dlc_trigger = yes + has_playable_adventurer_dlc_trigger = yes NOT = { any_held_title = { OR = { @@ -10557,7 +10900,7 @@ random_rain_snow_chance_effect = { } modifier = { factor = 1.02 - location.county = { is_riverside_county = yes } + location.county ?= { is_riverside_county = yes } } modifier = { factor = 0.05 @@ -10583,6 +10926,26 @@ governor_resignation_title_transfer_effect = { force_step_down_landed_titles = yes } +refresh_estate_household_clerks_house_modifier_effect = { + if = { + limit = { + house_head ?= { + domicile ?= { has_domicile_parameter = estate_governor_efficiency_bonus_for_house_members } + } + } + if = { + limit = { + NOT = { has_house_modifier = ep3_estate_household_clerks_house_modifier } + } + add_house_modifier = ep3_estate_household_clerks_house_modifier + } + } + else_if = { + limit = { has_house_modifier = ep3_estate_household_clerks_house_modifier } + remove_house_modifier = ep3_estate_household_clerks_house_modifier + } +} + boost_governor_efficiency_success_effect = { scope:actor = { send_interface_toast = { @@ -10610,9 +10973,11 @@ boost_governor_efficiency_success_effect = { } } else = { - add_character_modifier = { - modifier = ep3_boost_efficiency_modifier - years = 10 + show_as_tooltip = { + add_character_modifier = { + modifier = ep3_boost_efficiency_modifier + years = 10 + } } if = { limit = { has_variable = ep3_governor_efficiency_stack } @@ -10633,6 +10998,16 @@ boost_governor_efficiency_success_effect = { years = 10 } } + hidden_effect = { + remove_all_character_modifier_instances = ep3_boost_efficiency_modifier + while = { + count = var:ep3_governor_efficiency_stack + add_character_modifier = { + modifier = ep3_boost_efficiency_modifier + years = 10 + } + } + } } if = { limit = { @@ -10729,9 +11104,11 @@ damage_governor_efficiency_success_effect = { } } else = { - add_character_modifier = { - modifier = ep3_damage_efficiency_modifier - years = 10 + show_as_tooltip = { + add_character_modifier = { + modifier = ep3_damage_efficiency_modifier + years = 10 + } } if = { limit = { has_variable = ep3_governor_efficiency_stack } @@ -10752,6 +11129,16 @@ damage_governor_efficiency_success_effect = { years = 10 } } + hidden_effect = { + remove_all_character_modifier_instances = ep3_damage_efficiency_modifier + while = { + count = var:ep3_governor_efficiency_stack + add_character_modifier = { + modifier = ep3_damage_efficiency_modifier + years = 10 + } + } + } } if = { limit = { is_ai = yes } @@ -10819,7 +11206,13 @@ noble_family_adoption_effect = { NOT = { any_parent = { is_alive = yes - can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = liege } + trigger_if = { # Pool characters have no liege, while an independent ruler is their own + limit = { exists = liege } + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = liege } + } + trigger_else = { + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = this } + } } } } @@ -10896,7 +11289,13 @@ noble_family_adoption_effect = { NOT = { any_parent = { is_alive = yes - can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = liege } + trigger_if = { + limit = { exists = liege } + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = liege } + } + trigger_else = { + can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = this } + } } } } @@ -13094,7 +13493,7 @@ ep3_landless_invasion_titles_taken_effect = { TITLE_LIST = $TITLE_LIST$ TYPE = conquest_claim REASON = flag:conquest_claim - ENNOBLED_ADVENTURER = flag:yes + NEVER_ENNOBLED = flag:no } } else = { @@ -13103,7 +13502,7 @@ ep3_landless_invasion_titles_taken_effect = { TITLE_LIST = $TITLE_LIST$ TYPE = conquest REASON = flag:conquest - ENNOBLED_ADVENTURER = flag:yes + NEVER_ENNOBLED = flag:no } } # Vassals break away @@ -13567,7 +13966,7 @@ demand_pastureland_adventurer_interaction_effect = { TITLE_LIST = seized_pastureland TYPE = granted REASON = flag:seized_pastureland - ENNOBLED_ADVENTURER = flag:yes + NEVER_ENNOBLED = flag:no } # Messages for nearby players create_landed_ruler_message_effect = { @@ -13577,3 +13976,81 @@ demand_pastureland_adventurer_interaction_effect = { REASON = flag:seized_pastureland } } + +ep3_adventurer_sponsorship_invasion_effect = { + scope:attacker.var:adventurer_invasion_supporter ?= { save_scope_as = supporter } + if = { + limit = { ep3_adventurer_sponsorship_valid_trigger = yes } + scope:attacker = { + # Save scopes and cleanup variables + set_variable = { + name = adventurer_invasion_supporter + value = scope:attacker.var:adventurer_invasion_supporter + } + scope:war ?= { + set_variable = { + name = adventurer_invasion_supporter + value = scope:attacker.var:adventurer_invasion_supporter + } + } + scope:attacker.var:adventurer_invasion_supporter ?= { + set_variable = { + name = adventurer_invasion_supportee + value = scope:attacker + } + } + # Opinion loss + reverse_add_opinion = { + target = scope:defender + modifier = sponsored_laamp_invasion_against_me_opinion + } + # Support + send_interface_toast = { + type = msg_troops_gained + title = ep3_laamp_sponsor_troops_tt + left_icon = scope:supporter + right_icon = scope:defender + if = { + limit = { exists = scope:supporter.var:adventurer_invasion_request_soldiers } + capital_barony = { save_scope_as = capital_barony } + spawn_army = { + men_at_arms = { + type = armored_footmen + stacks = 3 + } + men_at_arms = { + type = accolade_maa_archers + stacks = 4 + } + men_at_arms = { + type = armored_horsemen + stacks = 2 + } + levies = 100 + inheritable = yes + location = scope:attacker.capital_province + war = scope:war + war_keep_on_attacker_victory = yes + save_scope_as = new_army + name = ep3_laamp_invasion_event_army + } + scope:supporter = { remove_variable = adventurer_invasion_request_soldiers } + } + if = { + limit = { exists = scope:supporter.var:adventurer_invasion_join_war } + scope:war ?= { add_attacker = scope:supporter } + scope:supporter = { remove_variable = adventurer_invasion_join_war } + } + } + } + } + else_if = { + limit = { + OR = { + scope:supporter ?= scope:defender + scope:supporter.top_liege ?= scope:defender.top_liege + } + } + scope:attacker = { ep3_laamp_supporter_invalidated_effect = yes } + } +} diff --git a/common/scripted_effects/09_dlc_mpo_scripted_effects.txt b/common/scripted_effects/09_dlc_mpo_scripted_effects.txt index 613335918..98f40f94e 100644 --- a/common/scripted_effects/09_dlc_mpo_scripted_effects.txt +++ b/common/scripted_effects/09_dlc_mpo_scripted_effects.txt @@ -254,7 +254,7 @@ migration_settle_down_obedient_vassal_effect = { value = culture } set_county_culture = scope:current_vassal.domicile.domicile_culture - set_county_faith = scope:current_vassal.domicile.domicile_faith + set_county_rite = scope:current_vassal.domicile.domicile_rite scope:current_vassal = { change_liege = { liege = scope:actor @@ -852,6 +852,7 @@ migration_set_obedient_vassal_effect = { create_character = { template = herder_character faith = scope:current_vassal.domicile.domicile_faith + rite = scope:current_vassal.domicile.domicile_rite culture = scope:current_vassal.domicile.domicile_culture location = scope:current_vassal.primary_title.title_capital_county.title_province save_scope_as = herder_character @@ -908,7 +909,29 @@ offer_confederation_accepter_effect = { custom_tooltip = join_confederation_recipient_tt } custom_tooltip = confederation_defensive_wars_tt - custom_tooltip = unlock_leave_confederation_interaction_tt + custom_tooltip = unlock_leave_confederation_decision_tt +} + +leave_confederation_membership_effect = { + if = { + limit = { + any_confederation_member = { + count >= 2 + NOT = { this = $LEAVER$ } + } + } + if = { + limit = { is_title_based = yes } + remove_confederation_member_title = $LEAVER$.primary_title + } + else = { + remove_confederation_member = $LEAVER$ + } + } + else = { + # Not enough members would remain, so the whole confederation is dissolved. + disband_confederation = yes + } } confederation_realm_transfer_effect = { @@ -1545,7 +1568,7 @@ mpo_find_suitable_merchant_effect = { 1 = { #Merv trigger = { title:c_bukhara = { - development_level >= 10 + prosperity_level >= 10 NOT = { holder.top_liege = { government_has_flag = government_is_nomadic @@ -1554,7 +1577,7 @@ mpo_find_suitable_merchant_effect = { } } modifier = { - add = title:c_bukhara.development_level + add = title:c_bukhara.prosperity_level } title:b_bukhara = { save_scope_as = merchant_origin @@ -1563,7 +1586,7 @@ mpo_find_suitable_merchant_effect = { 1 = { #Nishapur trigger = { title:c_nishapur = { - development_level >= 10 + prosperity_level >= 10 NOT = { holder.top_liege = { government_has_flag = government_is_nomadic @@ -1572,7 +1595,7 @@ mpo_find_suitable_merchant_effect = { } } modifier = { - add = title:c_nishapur.development_level + add = title:c_nishapur.prosperity_level } title:b_nishapur = { save_scope_as = merchant_origin @@ -1581,7 +1604,7 @@ mpo_find_suitable_merchant_effect = { 1 = { #Khotan trigger = { title:c_khotan = { - development_level >= 10 + prosperity_level >= 10 NOT = { holder.top_liege = { government_has_flag = government_is_nomadic @@ -1590,7 +1613,7 @@ mpo_find_suitable_merchant_effect = { } } modifier = { - add = title:c_khotan.development_level + add = title:c_khotan.prosperity_level } title:b_khotan = { save_scope_as = merchant_origin @@ -1599,7 +1622,7 @@ mpo_find_suitable_merchant_effect = { 1 = { #Wroclaw trigger = { title:c_breslau = { - development_level >= 10 + prosperity_level >= 10 NOT = { holder.top_liege = { government_has_flag = government_is_nomadic @@ -1608,7 +1631,7 @@ mpo_find_suitable_merchant_effect = { } } modifier = { - add = title:c_breslau.development_level + add = title:c_breslau.prosperity_level } title:b_breslau = { save_scope_as = merchant_origin @@ -1617,7 +1640,7 @@ mpo_find_suitable_merchant_effect = { 1 = { #Krakow trigger = { title:c_krakowska = { - development_level >= 10 + prosperity_level >= 10 NOT = { holder.top_liege = { government_has_flag = government_is_nomadic @@ -1626,7 +1649,7 @@ mpo_find_suitable_merchant_effect = { } } modifier = { - add = title:c_krakowska.development_level + add = title:c_krakowska.prosperity_level } title:b_krakow = { save_scope_as = merchant_origin @@ -1635,7 +1658,7 @@ mpo_find_suitable_merchant_effect = { 1 = { #Novgorod trigger = { title:c_novgorod = { - development_level >= 10 + prosperity_level >= 10 NOT = { holder.top_liege = { government_has_flag = government_is_nomadic @@ -1644,7 +1667,7 @@ mpo_find_suitable_merchant_effect = { } } modifier = { - add = title:c_novgorod.development_level + add = title:c_novgorod.prosperity_level } title:b_novgorod = { save_scope_as = merchant_origin @@ -1653,7 +1676,7 @@ mpo_find_suitable_merchant_effect = { 1 = { #Kyiv trigger = { title:c_kiev = { - development_level >= 10 + prosperity_level >= 10 NOT = { holder.top_liege = { government_has_flag = government_is_nomadic @@ -1662,7 +1685,7 @@ mpo_find_suitable_merchant_effect = { } } modifier = { - add = title:c_kiev.development_level + add = title:c_kiev.prosperity_level } title:b_kiev = { save_scope_as = merchant_origin @@ -1671,7 +1694,7 @@ mpo_find_suitable_merchant_effect = { 1 = { #Baghdad trigger = { title:c_baghdad = { - development_level >= 10 + prosperity_level >= 10 NOT = { holder.top_liege = { government_has_flag = government_is_nomadic @@ -1680,7 +1703,7 @@ mpo_find_suitable_merchant_effect = { } } modifier = { - add = title:c_baghdad.development_level + add = title:c_baghdad.prosperity_level } title:b_baghdad = { save_scope_as = merchant_origin @@ -1689,7 +1712,7 @@ mpo_find_suitable_merchant_effect = { 1 = { #Pisa trigger = { title:c_pisa = { - development_level >= 10 + prosperity_level >= 10 NOT = { holder.top_liege = { government_has_flag = government_is_nomadic @@ -1698,7 +1721,7 @@ mpo_find_suitable_merchant_effect = { } } modifier = { - add = title:c_pisa.development_level + add = title:c_pisa.prosperity_level } title:b_pisa = { save_scope_as = merchant_origin @@ -1707,7 +1730,7 @@ mpo_find_suitable_merchant_effect = { 1 = { #Venice trigger = { title:c_venezia = { - development_level >= 10 + prosperity_level >= 10 NOT = { holder.top_liege = { government_has_flag = government_is_nomadic @@ -1716,7 +1739,7 @@ mpo_find_suitable_merchant_effect = { } } modifier = { - add = title:c_venezia.development_level + add = title:c_venezia.prosperity_level } title:c_venezia = { save_scope_as = merchant_origin @@ -1725,7 +1748,7 @@ mpo_find_suitable_merchant_effect = { 1 = { #Cairo trigger = { title:c_cairo = { - development_level >= 10 + prosperity_level >= 10 NOT = { holder.top_liege = { government_has_flag = government_is_nomadic @@ -1734,7 +1757,7 @@ mpo_find_suitable_merchant_effect = { } } modifier = { - add = title:c_cairo.development_level + add = title:c_cairo.prosperity_level } title:b_cairo = { save_scope_as = merchant_origin @@ -1743,7 +1766,7 @@ mpo_find_suitable_merchant_effect = { 1 = { #Genua trigger = { title:c_genoa = { - development_level >= 10 + prosperity_level >= 10 NOT = { holder.top_liege = { government_has_flag = government_is_nomadic @@ -1752,7 +1775,7 @@ mpo_find_suitable_merchant_effect = { } } modifier = { - add = title:c_genoa.development_level + add = title:c_genoa.prosperity_level } title:b_genoa = { save_scope_as = merchant_origin @@ -1761,7 +1784,7 @@ mpo_find_suitable_merchant_effect = { 1 = { #Constantinople #something has to be in constantinople modifier = { - add = title:c_byzantion.development_level + add = title:c_byzantion.prosperity_level } title:b_constantinople = { save_scope_as = merchant_origin @@ -2256,7 +2279,6 @@ mpo_decisions_events_friend_fail_effect = { this = scope:friendship_target this = scope:heir has_relation_friend = scope:friendship_target - has_relation_best_friend = scope:friendship_target has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:friendship_target } is_at_war_with = scope:friendship_target } @@ -2270,7 +2292,6 @@ mpo_decisions_events_friend_fail_effect = { this = scope:friendship_target this = scope:heir has_relation_friend = scope:friendship_target - has_relation_best_friend = scope:friendship_target has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:friendship_target } is_at_war_with = scope:friendship_target } @@ -2287,7 +2308,6 @@ mpo_decisions_events_friend_fail_effect = { this = scope:friendship_target this = scope:heir has_relation_friend = scope:friendship_target - has_relation_best_friend = scope:friendship_target has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:friendship_target } is_at_war_with = scope:friendship_target } @@ -2310,7 +2330,6 @@ mpo_decisions_events_friend_fail_effect = { this = scope:friendship_target this = scope:heir has_relation_friend = scope:friendship_target - has_relation_best_friend = scope:friendship_target has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:friendship_target } is_at_war_with = scope:friendship_target } @@ -2337,7 +2356,6 @@ mpo_decisions_events_friend_fail_effect = { scope:friendship_target = { NOR = { has_relation_friend = scope:friendship_target - has_relation_best_friend = scope:friendship_target has_any_bad_relationship_with_character_trigger = { CHARACTER = root } } } @@ -3111,6 +3129,63 @@ nomad_convert_people_to_tribe_effect = { } } +nomad_convert_realm_to_tribal_effect = { + every_sub_realm_county = { + limit = { + title_province = { + OR = { + has_holding_type = nomad_holding + has_holding_type = herder_holding + } + } + } + title_province = { + set_holding_type = tribal_holding + } + add_to_list = holding_conversion + } + change_government = tribal_government + every_vassal_or_below = { + limit = { + has_government = nomad_government + } + if = { + limit = { has_realm_law = nomadic_authority_1 } + remove_realm_law = nomadic_authority_1 + } + if = { + limit = { has_realm_law = nomadic_authority_2 } + remove_realm_law = nomadic_authority_2 + } + if = { + limit = { has_realm_law = nomadic_authority_3 } + remove_realm_law = nomadic_authority_3 + } + if = { + limit = { has_realm_law = nomadic_authority_4 } + remove_realm_law = nomadic_authority_4 + } + if = { + limit = { has_realm_law = nomadic_authority_5 } + remove_realm_law = nomadic_authority_5 + } + change_government = tribal_government + if = { + limit = { + NOT = { has_realm_law = tribal_authority_1 } + } + add_realm_law_skip_effects = tribal_authority_1 + } + } + #Start off tribal authorities. + if = { + limit = { + NOT = { has_realm_law = tribal_authority_2 } + } + add_realm_law_skip_effects = tribal_authority_2 + } +} + nomad_convert_people_to_clan_effect = { change_government = clan_government @@ -3279,7 +3354,7 @@ mpo_overrunning_vassal_title_distribution_effect = { } else = { ordered_de_jure_county = { - order_by = development_level + order_by = prosperity_level limit = { holder = scope:attacker } @@ -3291,7 +3366,7 @@ mpo_overrunning_vassal_title_distribution_effect = { #Counts else = { ordered_in_list = { - order_by = development_level + order_by = prosperity_level list = overrun_counties save_scope_as = title_to_grant } @@ -3697,7 +3772,7 @@ mpo_duchy_overrunning_vassal_title_distribution_effect = { } } ordered_in_list = { - order_by = development_level + order_by = prosperity_level list = overrun_counties save_scope_as = title_to_grant } @@ -4875,12 +4950,14 @@ mpo_confederation_join_defensive_war_effect = { highest_held_title_tier >= tier_county NOR = { is_at_war_with = scope:defender + is_at_war_with = scope:attacker # Cannot join a second war against them is_allied_to = scope:attacker is_imprisoned_by = scope:defender is_imprisoned_by = scope:attacker is_defender_in_war = scope:war is_attacker_in_war = scope:war } + can_confederation_member_join_war_against = scope:attacker } scope:war = { add_defender = prev @@ -6016,7 +6093,7 @@ clean_up_ai_nomad_effect = { } if = { limit = { - has_dlc_feature = roads_to_power + has_playable_adventurer_dlc_trigger = yes is_physically_able_adult = yes exists = location.county ai_can_valid_to_create_laamp_trigger = yes @@ -6162,6 +6239,23 @@ expanding_steppe_effect = { SUB_REGION = central REGION = dlc_mpo_steppe_siberia_further_expansion } + custom_tooltip = permafrost_modifier_removal_desc + hidden_effect = { + situation:the_great_steppe ?= { + situation_sub_region:steppe_central = { + every_situation_sub_region_county = { + if = { + limit = { has_county_modifier = mpo_siberian_permafrost_modifier } + remove_county_modifier = mpo_siberian_permafrost_modifier + } + else_if = { + limit = { has_county_modifier = mpo_siberian_permafrost_modifier_bad } + remove_county_modifier = mpo_siberian_permafrost_modifier_bad + } + } + } + } + } } # East scope:dlc_mpo_steppe_hexi_tarim_expansion = { @@ -6718,3 +6812,67 @@ mpo_release_herder_land_effect = { } } } + +take_sub_realm_county_as_new_capital_effect = { + if = { + limit = { + capital_county.title_province = { + $EXCLUDE$ = no + } + } + capital_county = { + save_scope_as = new_capital + } + } + else = { + every_sub_realm_county = { + limit = { + is_landless_type_title = no + title_province = { + $EXCLUDE$ = no + } + # avoid steal player's title + trigger_if = { + limit = { holder != prev } + holder = { is_ai = yes } + } + } + alternative_limit = { + is_landless_type_title = no + title_province = { + $EXCLUDE$ = no + } + } + add_to_list = potential_new_capitals + } + ordered_in_list = { + order_by = title_province.province_size + list = potential_new_capitals + save_scope_as = new_capital + } + } + if = { + limit = { + exists = scope:new_capital + capital_county != scope:new_capital + } + if = { + limit = { + scope:new_capital.holder != root + } + create_title_and_vassal_change = { + type = usurped + save_scope_as = change + add_claim_on_loss = yes + } + scope:new_capital = { + change_title_holder = { + holder = root + change = scope:change + } + } + resolve_title_and_vassal_change = scope:change + } + set_realm_capital = scope:new_capital + } +} diff --git a/common/scripted_effects/pam_ecumenical_council_effects.txt b/common/scripted_effects/pam_ecumenical_council_effects.txt index b280c3591..f5e6be907 100644 --- a/common/scripted_effects/pam_ecumenical_council_effects.txt +++ b/common/scripted_effects/pam_ecumenical_council_effects.txt @@ -502,6 +502,136 @@ ecumenical_council_make_core_preview_effect = { } } +# Saves scope:ec_host_rite when the host leads a branched rite of the council's faith +ecumenical_council_save_host_branched_rite_effect = { + scope:host = { + if = { + limit = { + rite != faith.main_rite + rite.head_of_rite ?= this + } + rite = { + save_temporary_scope_as = ec_host_rite + } + } + } +} + +# A host who leads a branched rite carries a passed make-core ruling over to that rite +# At the core tenet limit the rite gives up the tenet the main rite demoted, else its least popular tenet that is not core in the main rite +# can_pick still sees the tenet about to be dropped +# The four exclusive ascetic tenets may swap for one another when it is the only one of them the rite holds +# Does nothing if the rite still cannot take the tenet, or has nothing to give up +# Uses rite_has_tenet, because has_tenet_status on a branched rite falls back to the main rite, which already holds $TENET$ +# Reads scope:ec_demoted_tenet, saved when the main rite demoted a tenet +ecumenical_council_host_rite_adopt_core_tenet_effect = { + ecumenical_council_save_host_branched_rite_effect = yes + $TENET$ = { + save_temporary_scope_as = ec_host_rite_new_tenet + } + if = { + limit = { + exists = scope:ec_host_rite + scope:ec_host_rite = { + NOT = { rite_has_tenet = scope:ec_host_rite_new_tenet } + } + } + scope:ec_host_rite = { + if = { + limit = { pam_rite_is_at_core_tenet_cap_trigger = yes } + if = { + limit = { + exists = scope:ec_demoted_tenet + rite_has_tenet = scope:ec_demoted_tenet + } + scope:ec_demoted_tenet = { + save_temporary_scope_as = ec_host_rite_dropped_tenet + } + } + else = { + ordered_rite_tenet = { + limit = { + save_temporary_scope_as = ec_host_rite_drop_candidate + scope:host.faith = { + NOT = { pam_faith_tenet_is_core_trigger = { TENET = scope:ec_host_rite_drop_candidate } } + } + } + order_by = { + save_temporary_scope_as = pam_popularity_tenet + scope:host.faith = { subtract = pam_faith_tenet_popularity_value } + } + position = 0 + save_temporary_scope_as = ec_host_rite_dropped_tenet + } + } + if = { + limit = { + exists = scope:ec_host_rite_dropped_tenet + OR = { + rite_can_choose_tenet = scope:ec_host_rite_new_tenet + pam_rite_can_swap_exclusive_ascetic_tenet_trigger = { + NEW = scope:ec_host_rite_new_tenet + DROPPED = scope:ec_host_rite_dropped_tenet + } + } + } + custom_tooltip = { + text = ecumenical_council_host_rite_drops_tenet_tt + hidden_effect = { + remove_rite_tenet = scope:ec_host_rite_dropped_tenet + } + } + custom_tooltip = { + text = ecumenical_council_host_rite_adopts_tenet_tt + hidden_effect = { + add_rite_tenet = scope:ec_host_rite_new_tenet + } + } + } + } + else_if = { + limit = { rite_can_choose_tenet = scope:ec_host_rite_new_tenet } + custom_tooltip = { + text = ecumenical_council_host_rite_adopts_tenet_tt + hidden_effect = { + add_rite_tenet = scope:ec_host_rite_new_tenet + } + } + } + } + } +} + +# A host who leads a branched rite carries a passed doctrine ruling over to that rite +# Reads scope:ec_proposal_doctrine +# Head of faith doctrines are main rite only, so they never carry over +ecumenical_council_host_rite_adopt_doctrine_effect = { + ecumenical_council_save_host_branched_rite_effect = yes + if = { + limit = { + exists = scope:ec_host_rite + exists = scope:ec_proposal_doctrine + NOR = { + scope:ec_proposal_doctrine = doctrine:doctrine_no_head + scope:ec_proposal_doctrine = doctrine:doctrine_spiritual_head + scope:ec_proposal_doctrine = doctrine:doctrine_temporal_head + } + scope:ec_host_rite = { + NOT = { rite_has_doctrine = scope:ec_proposal_doctrine } + rite_can_choose_doctrine = scope:ec_proposal_doctrine + } + } + scope:ec_host_rite = { + custom_tooltip = { + text = ecumenical_council_host_rite_adopts_doctrine_tt + hidden_effect = { + change_rite_doctrine = scope:ec_proposal_doctrine + } + } + } + } +} + # Applies the outcome of a passed debate vote to the host's faith. # scope:activity.var:current_topic holds the tenet/doctrine being debated. # scope:activity.var:current_debate_proposal holds the proposed change. @@ -690,6 +820,7 @@ ecumenical_council_apply_debate_outcome_effect = { limit = { has_tenet_popularity_trigger = yes } change_tenet_popularity = { target = scope:activity.var:current_topic change = major_tenet_popularity_gain } } + ecumenical_council_host_rite_adopt_core_tenet_effect = { TENET = scope:activity.var:current_topic } } } } @@ -735,64 +866,26 @@ ecumenical_council_apply_debate_outcome_effect = { scope:activity = { save_temporary_scope_as = ec_proposal_activity } - if = { - limit = { - OR = { - scope:ec_proposal_doctrine = doctrine:doctrine_liturgical_language_none - scope:ec_proposal_doctrine = doctrine:doctrine_liturgical_language_latin - scope:ec_proposal_doctrine = doctrine:doctrine_liturgical_language_koine - scope:ec_proposal_doctrine = doctrine:doctrine_liturgical_language_church_slavonic - scope:ec_proposal_doctrine = doctrine:doctrine_liturgical_language_irish - scope:ec_proposal_doctrine = doctrine:doctrine_liturgical_language_armenian - scope:ec_proposal_doctrine = doctrine:doctrine_liturgical_language_syriac - scope:ec_proposal_doctrine = doctrine:doctrine_liturgical_language_classical_georgian - scope:ec_proposal_doctrine = doctrine:doctrine_liturgical_language_church_romanian - scope:ec_proposal_doctrine = doctrine:doctrine_liturgical_language_arabic - scope:ec_proposal_doctrine = doctrine:doctrine_liturgical_language_hebrew - scope:ec_proposal_doctrine = doctrine:doctrine_liturgical_language_esperanto - } - } - scope:host.rite = { - custom_tooltip = { - text = neow_ecumenical_council_adopts_liturgical_language_tt - hidden_effect = { - change_rite_doctrine = scope:ec_proposal_doctrine - } - } - } - } - else = { - scope:host.faith = { - # Hide change_doctrine: its history text resolves FAITH from a scope gone on re-render - custom_tooltip = { - text = ecumenical_council_adopts_doctrine_tt - hidden_effect = { - change_doctrine = scope:ec_proposal_doctrine - # Conditional is crisis-wide, not per-rite - if = { - limit = { - scope:ec_proposal_doctrine ?= doctrine:doctrine_clerical_succession_conditional - } - every_faith_rite = { - limit = { NOT = { rite_has_doctrine = doctrine_clerical_succession_conditional } } - change_rite_doctrine = doctrine_clerical_succession_conditional - } + scope:host.faith = { + # Hide change_doctrine: its history text resolves FAITH from a scope gone on re-render + custom_tooltip = { + text = ecumenical_council_adopts_doctrine_tt + hidden_effect = { + change_doctrine = scope:ec_proposal_doctrine + # Conditional is crisis-wide, not per-rite + if = { + limit = { + scope:ec_proposal_doctrine ?= doctrine:doctrine_clerical_succession_conditional + } + every_faith_rite = { + limit = { NOT = { rite_has_doctrine = doctrine_clerical_succession_conditional } } + change_rite_doctrine = doctrine_clerical_succession_conditional } } } } } - # Orthodox synodal decrees bind all rites in communion with the hosting faith. - # The ordinary Ecumenical Council retains its original scope elsewhere. - if = { - limit = { - scope:host = { religion = religion:eastern_orthodox_religion } - exists = scope:ec_proposal_doctrine - } - neow_pan_orthodox_synod_promulgate_doctrine_effect = { - DOCTRINE = scope:ec_proposal_doctrine - } - } + ecumenical_council_host_rite_adopt_doctrine_effect = yes } scope:activity = { set_variable = { @@ -1059,38 +1152,9 @@ pam_sort_guests_into_ecumenical_council_groups_effect = { # Only eligible voters pam_valid_ecumenical_council_voter_trigger = yes NOT = { has_relation_rival = scope:host } - trigger_if = { - limit = { - scope:activity = { has_current_phase = ecumenical_council_phase_first_debate } - } - scope:activity.activity_tenet:1 = { - save_temporary_scope_as = tenet - } - OR = { - scope:host = { has_strong_hook = prev } - ecumenical_council_attendee_support_value > 0 - } - } - trigger_else_if = { - limit = { - scope:activity = { has_current_phase = ecumenical_council_phase_second_debate } - } - scope:activity.activity_tenet:2 = { - save_temporary_scope_as = tenet - } - OR = { - scope:host = { has_strong_hook = prev } - ecumenical_council_attendee_support_value > 0 - } - } - trigger_else = { - scope:activity.var:third_debate_proposal ?= { - save_temporary_scope_as = doctrine - } - OR = { - scope:host = { has_strong_hook = prev } - ecumenical_council_doctrine_attendee_support_value > 0 - } + OR = { + scope:host = { has_strong_hook = prev } + ecumenical_council_current_proposal_attendee_support_value > ecumenical_council_current_proposal_innovator_threshold_value } } add_to_list = innovator @@ -1144,42 +1208,51 @@ pam_sort_guests_into_ecumenical_council_groups_effect = { # populate the list otherwise we have no random event at all. ordered_in_list = { list = conservative - limit = { is_ai = yes } + limit = { + is_ai = yes + # Only flip attendees who lean towards the change, even if not past the innovator threshold + ecumenical_council_current_proposal_attendee_support_value > 0 + } max = { # a bit more to prevent all flipped value = list_size:conservative multiply = 0.1 max = 10 min = 1 } - order_by = { - if = { - limit = { - scope:activity = { has_current_phase = ecumenical_council_phase_first_debate } - } - scope:activity.activity_tenet:1 = { - save_temporary_scope_as = tenet - } - add = ecumenical_council_attendee_support_value + order_by = ecumenical_council_current_proposal_attendee_support_value + remove_from_list = conservative + add_to_list = innovator + scope:activity = { + remove_from_guest_subset = { + name = conservative + target = prev } - else_if = { - limit = { - scope:activity = { has_current_phase = ecumenical_council_phase_second_debate } - } - scope:activity.activity_tenet:2 = { - save_temporary_scope_as = tenet - } - add = ecumenical_council_attendee_support_value - } - else = { - if = { - limit = { exists = scope:activity.var:third_debate_proposal } - scope:activity.var:third_debate_proposal = { - save_temporary_scope_as = doctrine - } - } - add = ecumenical_council_doctrine_attendee_support_value + add_to_guest_subset = { + name = innovator + target = prev } } + } + } + # Nearly every sway event needs an AI innovator, so we draft the least opposed AI conservative if none leans towards the change + # The Head of Faith stays a conservative to argue against the host, and we always leave at least one conservative + if = { + limit = { + NOT = { + any_in_list = { + list = innovator + this != scope:host + } + } + list_size:conservative >= 2 + } + ordered_in_list = { + list = conservative + limit = { + NOT = { scope:host.faith.religious_head ?= this } + } + max = 1 + order_by = ecumenical_council_current_proposal_attendee_support_value remove_from_list = conservative add_to_list = innovator scope:activity = { diff --git a/common/scripted_effects/pam_heresy_shared_effects.txt b/common/scripted_effects/pam_heresy_shared_effects.txt index 3483c0724..07fd18dcd 100644 --- a/common/scripted_effects/pam_heresy_shared_effects.txt +++ b/common/scripted_effects/pam_heresy_shared_effects.txt @@ -203,30 +203,17 @@ pam_heresy_convert_ruler_to_new_rite_effect = { pam_heresy_convert_ruler_to_heresy_faith_effect = { if = { limit = { faith != scope:heresy_faith } - # Catholic heresies and Priestlessness use county-by-county conversion. - # The unrestricted conversion effect would bypass their local restrictions. + set_character_faith_with_conversion = scope:heresy_faith + # The faith_conversion rule can refuse a new heresy, so we convert the ruler directly instead if = { - limit = { - OR = { - scope:heresy_faith = { religion = religion:catholic_religion } - scope:heresy_faith = faith:bespopovtsy_faith - } - } + limit = { faith != scope:heresy_faith } set_character_faith = scope:heresy_faith } - else = { - set_character_faith_with_conversion = scope:heresy_faith - if = { - limit = { faith != scope:heresy_faith } - set_character_faith = scope:heresy_faith - } - } } every_held_title = { limit = { tier = tier_county faith = scope:origin_faith - pam_heresy_neow_permitted_county_trigger = yes } set_county_faith = scope:heresy_faith } @@ -268,7 +255,6 @@ pam_heresy_convert_ruler_to_heresy_faith_effect = { save_temporary_scope_as = title_check every_county_in_clerical_region = { limit = { - pam_heresy_neow_permitted_county_trigger = yes faith = scope:origin_faith OR = { this = scope:title_check.title_capital_county @@ -284,7 +270,6 @@ pam_heresy_convert_ruler_to_heresy_faith_effect = { limit = { is_physically_able_ai_adult = yes faith = scope:origin_faith - capital_county = { pam_heresy_neow_permitted_county_trigger = yes } NOR = { scope:founder ?= this has_trait = heresiarch diff --git a/common/scripted_effects/pam_saint_effects.txt b/common/scripted_effects/pam_saint_effects.txt index 0551a53e1..f6289897b 100644 --- a/common/scripted_effects/pam_saint_effects.txt +++ b/common/scripted_effects/pam_saint_effects.txt @@ -809,10 +809,8 @@ pam_extract_relic_from_saint_effect = { # Surface + rename the drawn relic (no repeated type per saint). if = { limit = { exists = scope:newly_created_artifact } - # Expose the artifact in the calling event's immediate scope before - # entering the new-object-only hidden block. - scope:newly_created_artifact = { save_scope_as = relic_artifact } hidden_effect_new_object = { + scope:newly_created_artifact = { save_scope_as = relic_artifact } scope:relic_artifact = { # Stamped onto the artifact because relic_creator_saint is only in scope during extraction. set_variable = {