diff --git a/common/character_interactions/pam_interactions.txt b/common/character_interactions/pam_interactions.txt index 24125bd81..fe0ccd929 100644 --- a/common/character_interactions/pam_interactions.txt +++ b/common/character_interactions/pam_interactions.txt @@ -11059,7 +11059,13 @@ split_ecclesiastical_title_interaction = { random_held_title = { limit = { has_clerical_region = yes - is_head_of_faith = no + OR = { + is_head_of_faith = no + AND = { + is_head_of_faith = yes + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + } + } } random_county_in_clerical_region = { limit = { @@ -11116,7 +11122,13 @@ split_ecclesiastical_title_interaction = { every_held_title = { limit = { has_clerical_region = yes - is_head_of_faith = no + OR = { + is_head_of_faith = no + AND = { + is_head_of_faith = yes + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + } + } } every_county_in_clerical_region = { holder = { @@ -11209,7 +11221,10 @@ split_ecclesiastical_title_interaction = { # Clerical region supporting HoF is_available = { is_ai = no - pam_is_clerical_title_authority_trigger = yes # HoF, or the Head of Rites when the faith has no HoF + OR = { + pam_is_clerical_title_authority_trigger = yes # HoF, or the Head of Rites when the faith has no HoF + pam_symphonia_secular_emperor_investiture_trigger = yes + } faith ?= { has_doctrine_parameter = has_clerical_regions } has_pam_dlc_trigger = yes is_adult = yes @@ -11227,10 +11242,13 @@ split_ecclesiastical_title_interaction = { pam_government_is_religious_playable_trigger = yes any_held_title = { has_clerical_region = yes - # The HoF may split their own see; other rulers' head-of-faith titles stay protected + # The HoF may split their own see, and a Symphonia emperor may split one within their realm. trigger_if = { limit = { scope:recipient != scope:actor } - is_head_of_faith = no + OR = { + is_head_of_faith = no + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + } } any_county_in_clerical_region = { OR = { @@ -11258,17 +11276,29 @@ split_ecclesiastical_title_interaction = { scope:recipient = { is_imprisoned = no is_adult = yes - pam_actor_is_clerical_title_authority_of_this_trigger = yes + OR = { + pam_actor_is_clerical_title_authority_of_this_trigger = yes + AND = { + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + any_held_title = { + has_clerical_region = yes + pam_symphonia_clerical_region_in_realm_trigger = { RULER = scope:actor } + } + } + } } custom_tooltip = { text = split_ecclesiastical_title_no_eligible_secular_ruler_tt scope:recipient = { any_held_title = { has_clerical_region = yes - # Mirror is_shown: the HoF may split their own see, other rulers' head-of-faith titles stay protected + # Match is_shown: allow a Symphonia emperor to split a Head-of-Faith see. trigger_if = { limit = { scope:recipient != scope:actor } - is_head_of_faith = no + OR = { + is_head_of_faith = no + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + } } any_county_in_clerical_region = { OR = { @@ -11366,7 +11396,10 @@ merge_new_ecclesiastical_title_interaction = { # Clerical region supporting HoF is_available = { is_ai = no - pam_is_clerical_title_authority_trigger = yes # HoF, or the Head of Rites when the faith has no HoF + OR = { + pam_is_clerical_title_authority_trigger = yes # HoF, or the Head of Rites when the faith has no HoF + pam_symphonia_secular_emperor_investiture_trigger = yes + } faith ?= { has_doctrine_parameter = has_clerical_regions } has_pam_dlc_trigger = yes is_adult = yes @@ -11382,9 +11415,21 @@ merge_new_ecclesiastical_title_interaction = { pam_government_is_religious_playable_trigger = yes any_held_title = { has_clerical_region = yes - is_head_of_faith = no + OR = { + is_head_of_faith = no + AND = { + is_head_of_faith = yes + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + } + } + } + OR = { + pam_actor_is_clerical_title_authority_of_this_trigger = yes + AND = { + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + pam_symphonia_imperial_merge_acting_region_trigger = { ARCHBISHOP = this } + } } - pam_actor_is_clerical_title_authority_of_this_trigger = yes } } @@ -11401,16 +11446,39 @@ merge_new_ecclesiastical_title_interaction = { text = merge_new_ecclesiastical_title_cooldown_trigger NOT = { exists = capital_province.county.clerical_region_title.var:merge_clerical_region_cooldown } } - # Must be the recipient's own region, because a landed archbishop's capital can sit in another region - pam_acting_clerical_region_trigger = { ARCHBISHOP = this } - capital_province.county.clerical_region_title ?= { - pam_has_adjacent_mergeable_clerical_region_trigger = yes + # For a Symphonia emperor both regions must touch imperial territory. + # Church authorities retain their original merge permission and checks. + OR = { + AND = { + scope:actor = { pam_is_clerical_title_authority_trigger = yes } + pam_acting_clerical_region_trigger = { ARCHBISHOP = this } + capital_province.county.clerical_region_title ?= { + pam_has_adjacent_mergeable_clerical_region_trigger = yes + } + } + AND = { + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + pam_symphonia_imperial_merge_acting_region_trigger = { ARCHBISHOP = this } + capital_province.county.clerical_region_title ?= { + pam_symphonia_imperial_has_adjacent_mergeable_clerical_region_trigger = yes + } + } } } } can_be_picked_title = { - pam_acting_clerical_region_trigger = { ARCHBISHOP = scope:recipient } + OR = { + AND = { + scope:actor = { pam_is_clerical_title_authority_trigger = yes } + pam_acting_clerical_region_trigger = { ARCHBISHOP = scope:recipient } + } + AND = { + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + pam_symphonia_imperial_merge_acting_region_trigger = { ARCHBISHOP = scope:recipient } + scope:target = { pam_symphonia_clerical_region_in_realm_trigger = { RULER = scope:actor } } + } + } pam_potential_merge_clerical_region_title_trigger = { TITLE = scope:target ABSORBING_TITLE = scope:recipient.capital_province.county.clerical_region_title @@ -11419,7 +11487,17 @@ merge_new_ecclesiastical_title_interaction = { # can_be_picked_title is picker-only and is not rechecked on send has_valid_target_showing_failures_only = { - pam_acting_clerical_region_trigger = { ARCHBISHOP = scope:recipient } + OR = { + AND = { + scope:actor = { pam_is_clerical_title_authority_trigger = yes } + pam_acting_clerical_region_trigger = { ARCHBISHOP = scope:recipient } + } + AND = { + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + pam_symphonia_imperial_merge_acting_region_trigger = { ARCHBISHOP = scope:recipient } + scope:target = { pam_symphonia_clerical_region_in_realm_trigger = { RULER = scope:actor } } + } + } pam_potential_merge_clerical_region_title_trigger = { TITLE = scope:target ABSORBING_TITLE = scope:recipient.capital_province.county.clerical_region_title @@ -11536,10 +11614,12 @@ replace_ecclesiastical_title_holder_interaction = { } } - # Church authority (HoF / Head of Rites), or a liege the faith's Clerical Appointment doctrine empowers + # Church authority, an empowered lay liege, or a secular emperor whose rite has Symphonia is_available = { faith ?= { has_doctrine_parameter = has_clerical_regions } OR = { + # Symphonia grants imperial secular rulers a separate right of investiture. + pam_symphonia_secular_emperor_investiture_trigger = yes # A secular liege when the doctrine grants rulers the right (Temporal/Revocable, Conditional) AND = { faith ?= { has_doctrine_parameter = clerical_appointment_ruler_can_replace_ecc } @@ -11569,7 +11649,7 @@ replace_ecclesiastical_title_holder_interaction = { cooldown = { years = 10 } - # Same-faith AI archbishops; the HoF's own see stays protected + # Same-faith AI archbishops, including heads of faith under imperial Symphonia is_shown = { scope:recipient = { is_ai = yes @@ -11579,14 +11659,30 @@ replace_ecclesiastical_title_holder_interaction = { pam_government_is_religious_playable_trigger = yes any_held_title = { has_clerical_region = yes - is_head_of_faith = no + OR = { + is_head_of_faith = no + AND = { + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + pam_symphonia_clerical_region_in_realm_trigger = { RULER = scope:actor } + } + } } - # A liege acting on the doctrine right (not the HoF / Head of Rites) may only depose their own vassals + # Secular rulers normally may depose only vassals. Symphonia emperors may also depose + # a region's independent bishop if the region extends into their own realm. trigger_if = { limit = { pam_actor_is_clerical_title_authority_of_this_trigger = no } - is_vassal_or_below_of = scope:actor + OR = { + is_vassal_or_below_of = scope:actor + AND = { + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + any_held_title = { + has_clerical_region = yes + pam_symphonia_clerical_region_in_realm_trigger = { RULER = scope:actor } + } + } + } } } } @@ -11665,7 +11761,26 @@ replace_ecclesiastical_title_holder_interaction = { scope:target = { holder = scope:recipient has_clerical_region = yes - is_head_of_faith = no + # Normally HoF sees are protected. Symphonia allows a secular emperor to fill them, + # but only where the ecclesiastical region reaches the emperor's own realm. + OR = { + is_head_of_faith = no + AND = { + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + pam_symphonia_clerical_region_in_realm_trigger = { RULER = scope:actor } + } + } + # When relying on Symphonia rather than a separate secular-appointment doctrine, + # only sees covering land in the emperor's own realm qualify. + trigger_if = { + limit = { + scope:actor = { + pam_symphonia_secular_emperor_investiture_trigger = yes + faith ?= { NOT = { has_doctrine_parameter = clerical_appointment_ruler_can_replace_ecc } } + } + } + pam_symphonia_clerical_region_in_realm_trigger = { RULER = scope:actor } + } } } @@ -11689,11 +11804,16 @@ replace_ecclesiastical_title_holder_interaction = { on_accept = { scope:secondary_recipient = { save_scope_as = pam_new_archbishop } scope:recipient = { save_scope_as = pam_old_archbishop } + NEOW_symphonia_prepare_head_of_faith_investiture_effect = yes pam_grant_ecclesiastical_title_interaction_effect = yes + NEOW_symphonia_finish_head_of_faith_investiture_effect = yes # Meddling by a liege (not the HoF / Head of Rites) angers the wider clergy if = { limit = { - scope:actor = { pam_is_clerical_title_authority_trigger = no } + scope:actor = { + pam_is_clerical_title_authority_trigger = no + pam_symphonia_secular_emperor_investiture_trigger = no + } } scope:actor = { add_character_modifier = { @@ -11757,6 +11877,17 @@ replace_ecclesiastical_title_holder_interaction = { } } } + # A secular emperor with Symphonia may replace disloyal bishops in the imperial realm. + modifier = { + add = 30 + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + scope:recipient = { + opinion = { + target = scope:actor + value <= -20 + } + } + } # The Head of Faith removes disloyal bishops (Spiritual/Revocable, Conditional) modifier = { add = 40 @@ -11791,11 +11922,14 @@ grant_ecclesiastical_title_interaction = { target_filter = clerical_region show_all_targets = no - # Clerical region supporting HoF + # Heads of Faith/Rites appoint freely; secular Symphonia emperors appoint to sees in their own realm. is_available = { faith ?= { has_doctrine_parameter = has_clerical_regions } is_adult = yes - pam_is_clerical_title_authority_trigger = yes # HoF, or the Head of Rites when the faith has no HoF + OR = { + pam_is_clerical_title_authority_trigger = yes + pam_symphonia_secular_emperor_investiture_trigger = yes + } has_pam_dlc_trigger = yes } @@ -11856,9 +11990,24 @@ grant_ecclesiastical_title_interaction = { can_be_picked_title = { scope:target = { has_clerical_region = yes - is_head_of_faith = no + # A sitting Head of Faith's clerical regions must be transferred by replacement, + # even if the region title is distinct from the Head-of-Faith title itself. + NOT = { pam_clerical_title_held_by_own_hof_trigger = yes } + OR = { + is_head_of_faith = no + AND = { + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + pam_symphonia_clerical_region_in_realm_trigger = { RULER = scope:actor } + } + } # An absorbed region lingers as an empty shell, and granting one mints a landless archbishop clerical_region_size > 0 + trigger_if = { + limit = { + scope:actor = { pam_is_clerical_title_authority_trigger = no } + } + pam_symphonia_clerical_region_in_realm_trigger = { RULER = scope:actor } + } trigger_if = { limit = { exists = holder } holder = { @@ -11889,6 +12038,17 @@ grant_ecclesiastical_title_interaction = { text = grant_ecclesiastical_title_empty_region_tt scope:target ?= { clerical_region_size > 0 } } + custom_tooltip = { + text = neow_clerical_grant_hof_must_replace_tt + scope:target ?= { NOT = { pam_clerical_title_held_by_own_hof_trigger = yes } } + } + trigger_if = { + limit = { scope:actor = { pam_is_clerical_title_authority_trigger = no } } + custom_tooltip = { + text = neow_symphonia_imperial_region_in_realm_tt + scope:target ?= { pam_symphonia_clerical_region_in_realm_trigger = { RULER = scope:actor } } + } + } custom_tooltip = { text = grant_ecclesiastical_title_antipope_obedience_tt pam_antipope_may_grant_clerical_region_trigger = { SEE = scope:target } @@ -11922,12 +12082,21 @@ grant_ecclesiastical_title_interaction = { } on_accept = { - scope:recipient = { save_scope_as = pam_new_archbishop } + # Re-check at execution time: title ownership may have changed since picking it. + # This guard is grant-only, so the separate HoF replacement is unaffected. if = { - limit = { exists = scope:target.holder } - scope:target.holder = { save_scope_as = pam_old_archbishop } + limit = { + scope:target = { NOT = { pam_clerical_title_held_by_own_hof_trigger = yes } } + } + scope:recipient = { save_scope_as = pam_new_archbishop } + if = { + limit = { exists = scope:target.holder } + scope:target.holder = { save_scope_as = pam_old_archbishop } + } + NEOW_symphonia_prepare_head_of_faith_investiture_effect = yes + pam_grant_ecclesiastical_title_interaction_effect = yes + NEOW_symphonia_finish_head_of_faith_investiture_effect = yes } - pam_grant_ecclesiastical_title_interaction_effect = yes } on_decline = { diff --git a/common/religion/tenet_types/00_NEOW_tenet_types.txt b/common/religion/tenet_types/00_NEOW_tenet_types.txt index 8518d2769..c7727fb2d 100644 --- a/common/religion/tenet_types/00_NEOW_tenet_types.txt +++ b/common/religion/tenet_types/00_NEOW_tenet_types.txt @@ -144,6 +144,7 @@ legalism_reduced_faction_virtues legalism_increased_faction_sins neow_theocrats_can_use_secular_cbs + neow_symphonia_secular_imperial_investiture } personal_tenet_parameters = { diff --git a/common/scripted_effects/NEOW_religion_effects.txt b/common/scripted_effects/NEOW_religion_effects.txt index 17298b528..aab142334 100644 --- a/common/scripted_effects/NEOW_religion_effects.txt +++ b/common/scripted_effects/NEOW_religion_effects.txt @@ -862,3 +862,60 @@ neow_tribunal_install_restored_pope_effect = { add_piety = 1000 add_prestige = 500 } + +# Symphonia: record the patriarchal office when an emperor replaces its holder in the +# clerical region containing the Head of Faith title's capital. The ordinary interaction +# moves the bishopric; the second effect keeps the HoF title with the new bishop. +NEOW_symphonia_prepare_head_of_faith_investiture_effect = { + if = { + limit = { + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + exists = scope:pam_old_archbishop + scope:pam_old_archbishop = { + religious_head_or_challenger ?= this + faith = { exists = religious_head_title } + } + scope:pam_old_archbishop.faith.religious_head_title = { + holder ?= scope:pam_old_archbishop + } + scope:target = { + has_clerical_region = yes + pam_symphonia_clerical_region_in_realm_trigger = { RULER = scope:actor } + OR = { + is_head_of_faith = yes + this = scope:pam_old_archbishop.faith.religious_head_title.title_capital_county.clerical_region_title + this = scope:pam_old_archbishop.capital_county.clerical_region_title + } + } + } + scope:pam_old_archbishop.faith.religious_head_title = { + save_scope_as = neow_symphonia_investiture_hof_title + } + } +} + +NEOW_symphonia_finish_head_of_faith_investiture_effect = { + # A HoF title that was itself transferred by the normal interaction is already done. + if = { + limit = { + exists = scope:neow_symphonia_investiture_hof_title + exists = scope:pam_new_archbishop + scope:neow_symphonia_investiture_hof_title = { + this != scope:target + holder ?= scope:pam_old_archbishop + } + } + create_title_and_vassal_change = { + type = returned + save_scope_as = neow_symphonia_investiture_hof_change + add_claim_on_loss = no + } + scope:neow_symphonia_investiture_hof_title = { + change_title_holder = { + holder = scope:pam_new_archbishop + change = scope:neow_symphonia_investiture_hof_change + } + } + resolve_title_and_vassal_change = scope:neow_symphonia_investiture_hof_change + } +} diff --git a/common/scripted_triggers/pam_scripted_triggers.txt b/common/scripted_triggers/pam_scripted_triggers.txt index 69bbcc4fc..a0b825894 100644 --- a/common/scripted_triggers/pam_scripted_triggers.txt +++ b/common/scripted_triggers/pam_scripted_triggers.txt @@ -1585,6 +1585,45 @@ pam_is_clerical_title_authority_trigger = { } } +# An imperial secular ruler of a Symphonia rite may invest and depose clergy in sees covering their realm. +pam_symphonia_secular_emperor_investiture_trigger = { + is_ruler = yes + highest_held_title_tier >= tier_empire + government_is_religious_trigger = no + rite ?= { rite_has_parameter = neow_symphonia_secular_imperial_investiture } +} + +# Called from a clerical-region TITLE; limit imperial investiture to sees with counties in the emperor's realm.# An ecclesiastical title owned by the faith's sitting Head of Faith or the +# actor's recognised Head of Faith/Antipope cannot be passed on via the grant +# interaction. The bishop must be replaced using the replacement interaction. +# Evaluate this in a TITLE scope with scope:actor set to the grantor. +pam_clerical_title_held_by_own_hof_trigger = { + holder ?= { + OR = { + AND = { + exists = scope:actor.faith.religious_head + this = scope:actor.faith.religious_head + } + AND = { + exists = scope:actor.religious_head_or_challenger + this = scope:actor.religious_head_or_challenger + } + } + } +} + + +pam_symphonia_clerical_region_in_realm_trigger = { + any_county_in_clerical_region = { + holder ?= { + OR = { + this = $RULER$ + is_vassal_or_below_of = $RULER$ + } + } + } +} + pam_recipient_is_clerical_title_authority_trigger = { trigger_if = { limit = { exists = scope:puppet_or_actor.religious_head_or_challenger } @@ -3382,6 +3421,14 @@ pam_potential_secular_clerical_split_ruler_trigger = { } highest_held_title_tier >= tier_duchy NOT = { pam_government_is_religious_playable_trigger = yes } + # An emperor exercising Symphonia may only split land held by them or their vassals. + trigger_if = { + limit = { scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } } + OR = { + this = scope:actor + is_vassal_or_below_of = scope:actor + } + } capital_county = { exists = clerical_region_title clerical_region_title.holder = scope:recipient @@ -3461,7 +3508,15 @@ pam_potential_merge_clerical_region_title_trigger = { } $ABSORBING_TITLE$ ?= { has_clerical_region = yes - is_head_of_faith = no + # A Symphonia emperor can enlarge the principal see of a Head of Faith. + # A Head-of-Faith title must never be the ABSORBED title (it would be destroyed). + OR = { + is_head_of_faith = no + AND = { + is_head_of_faith = yes + scope:actor = { pam_symphonia_secular_emperor_investiture_trigger = yes } + } + } custom_tooltip = { text = pam_potential_merge_clerical_region_title_neighboring_trigger any_county_in_clerical_region = { @@ -3498,6 +3553,44 @@ pam_clerical_region_at_most_three_duchies_trigger = { } } +# The recipient's principal clerical region must be located in a Symphonia emperor's realm. +# This also permits a Head of Faith to act as the recipient when their principal see is a clerical region. +pam_symphonia_imperial_merge_acting_region_trigger = { + $ARCHBISHOP$ = { + save_temporary_scope_as = neow_symphonia_merge_archbishop_temp + capital_province.county.clerical_region_title ?= { + has_clerical_region = yes + holder = scope:neow_symphonia_merge_archbishop_temp + pam_symphonia_clerical_region_in_realm_trigger = { RULER = scope:actor } + } + } +} + +# Find an adjacent, eligible clerical region which also contains land in the emperor's realm. +# Keep the normal merger's same-Head-of-Faith, non-rite-head, and AI-holder protections. +pam_symphonia_imperial_has_adjacent_mergeable_clerical_region_trigger = { + custom_tooltip = { + text = pam_has_adjacent_mergeable_clerical_region_trigger + save_temporary_scope_as = absorbing_clerical_region_temp + any_county_in_clerical_region = { + any_neighboring_county = { + clerical_region_title ?= { + has_clerical_region = yes + is_head_of_faith = no + this != scope:absorbing_clerical_region_temp + clerical_region_size > 0 + pam_symphonia_clerical_region_in_realm_trigger = { RULER = scope:actor } + holder ?= { + is_ai = yes + religious_head_or_challenger = scope:absorbing_clerical_region_temp.holder.religious_head_or_challenger + NOT = { this = rite.head_of_rite } + } + } + } + } + } +} + pam_has_adjacent_mergeable_clerical_region_trigger = { custom_tooltip = { text = pam_has_adjacent_mergeable_clerical_region_trigger diff --git a/localization/english/replace/religion/doctrines/zz_NEOW_religion_core_tenets_l_english.yml b/localization/english/replace/religion/doctrines/zz_NEOW_religion_core_tenets_l_english.yml index 289c622f5..b619b0e47 100644 --- a/localization/english/replace/religion/doctrines/zz_NEOW_religion_core_tenets_l_english.yml +++ b/localization/english/replace/religion/doctrines/zz_NEOW_religion_core_tenets_l_english.yml @@ -372,4 +372,7 @@ pam_1_timothy_2_2_greek_glossary:0 "#bold 1 Timothy 2:2#!\nPray for kings and all who hold authority, that we may live a calm and peaceful life in all godliness and dignity.\n\n#italic Greek New Testament (English rendering)#!" doctrine_parameter_tenet_symphonia_puppeting_cost_reduction:0 "As a [personal_tenet|E], reduces the Piety cost of clerical puppeting and the Prestige cost of secular puppeting by #P 50%#!" doctrine_parameter_neow_theocrats_can_use_secular_cbs:0 "[rulers|E] with Ecclesiastical Government may use secular [casus_belli|E], subject to the usual requirements" - + doctrine_parameter_neow_symphonia_secular_imperial_investiture:0 "Secular rulers of Empire rank may appoint and replace bishops, including Heads of Faith, in clerical regions extending into their realm. They may also split and merge such regions, even where Clerical Appointment doctrine reserves these powers to the priesthood." + neow_symphonia_imperial_region_in_realm_tt:0 "This clerical region must include land within your realm." + neow_clerical_grant_hof_must_replace_tt:0 "A clerical title held by your Head of Faith cannot be granted away. Replace the Head of Faith to appoint a new holder." +