# pam_canonize_saint_decision (character picker) chains into pam_choose_consecration_site_decision (title picker), which commits the canonization on confirm.
##############
# Put a deceased dynast forward for sainthood; the Head of Faith, if any, approves it.
pam_canonize_saint_decision = {
picture = {
reference = "gfx/interface/illustrations/decisions/decision_legitimacy.dds" # TODO_PAM_ALI placeholder art - TIT-74202
# Pre-select the worthiest forebear deterministically (virtues, age, learning), so the pre-selection is always the best candidate rather than a weighted roll.
# Capability gate only; the goal-facing Requirements live in is_valid below.
is_valid_showing_failures_only = {
is_available_quick = {
incapable = no
alive = yes
adult = yes
imprisoned = no
}
# Step 1 carries no cooldown of its own (it lives on the committing step so backing out is free), so mirror that cooldown here - otherwise this entry, and its alert, would resurface during the post-canonization cooldown.
NOT = { is_decision_on_cooldown = pam_choose_consecration_site_decision }
}
# Goal-facing Requirements, mirrored on pam_choose_consecration_site_decision - keep in sync.
text = pam_canonize_saint_decision_req_site_holy_site
pam_has_consecration_site_trigger = yes
}
}
}
# No cost or cooldown here: both live on the committing decision (pam_choose_consecration_site_decision) so a player who backs out of the site step loses nothing. minimum_cost still blocks opening the picker when the eventual cost is unaffordable.
# We store the saint so they survive the jump to the site decision
set_variable = {
name = pam_pending_saint
value = scope:saint_candidate
}
# Surface the HoF's estimated approval odds. The odds value is rooted at the saint, which can't see the HoF's cynicism, so we branch on it here and show the matching tooltip.
data = decision:pam_choose_consecration_site_decision
player = root
}
}
ai_potential = {
always = no
}
}
# The committing decision. For players it's step 2, opened from pam_canonize_saint_decision via open_view_data (enact_a_bull_decision chaining pattern) with the saint carried in var:pam_pending_saint. The AI reaches it directly (step 1 is player-only) and picks the saint in the effect. Cost + cooldown live here, so a player who backs out of the picker is never charged.
pam_choose_consecration_site_decision = {
picture = {
reference = "gfx/interface/illustrations/decisions/decision_legitimacy.dds" # TODO_PAM_ALI placeholder art - TIT-74202
}
# Share the parent title so the panel header stays "Canonize a Saint" across the hop (movement_petition_decision pattern); desc/confirm_text still speak to the site step.
title = pam_canonize_saint_decision
decision_group_type = major
is_invisible = yes
should_create_alert = { always = no }
# Invisible to players (reached via open_view_data from step 1), so this cadence and is_shown gate AI discovery only. Mirrors step 1.
text = pam_canonize_saint_decision_req_site_holy_site
pam_has_consecration_site_trigger = yes
}
}
}
cooldown = { years = 25 }
# Charged here (not on step 1), so backing out of the picker costs nothing.
cost = {
piety = pam_canonize_saint_piety_cost
treasury_or_gold = pam_canonize_saint_gold_cost
}
widget = {
# Reuses the vanilla realm-county picker GUI (renders any title, fine for baronies).
gui = "decision_view_widget_select_realm_county"
controller = select_scope_object
show_from_start = yes
decision_to_second_step_button = "SELECT"
# List the real consecration sites first - cathedral faiths: each cathedral barony in realm, whoever owns it; others: holy-site baronies in realm. Occupied ones stay listed (greyed by is_item_valid) so the player sees which are taken. Once every real site is full, open up county-capital baronies neighbouring one so the dynasty still has somewhere to bury (one saint per province).
# Pick the buried saint in the character picker. Per-saint data lives on the burial province, so list the sites and surface each one's saint, mapped back in the effect. Widget root = none, so the extractor is scope:actor.
widget = {
gui = "decision_view_widget_select_character"
controller = select_scope_object
show_from_start = yes
decision_to_second_step_button = "SELECT"
setup_items = {
scope:actor.faith = {
every_saint = {
limit = {
saint_burial_location = {
pam_can_extract_relic_from_saint_trigger = { EXTRACTOR = scope:actor SAINT = prev }
}
}
add_to_list = item_list
}
}
}
default_item = {
scope:actor.faith = {
random_saint = {
limit = {
saint_burial_location = {
pam_can_extract_relic_from_saint_trigger = { EXTRACTOR = scope:actor SAINT = prev }
}
}
save_scope_as = selected_item
}
}
}
is_item_valid = {
# custom_tooltip so the entry tooltip uses this line, not a failed auto-flatten of the helper's any_in_global_list.
pam_can_extract_relic_from_saint_trigger = { EXTRACTOR = scope:actor SAINT = prev }
}
}
save_scope_as = selected_item
}
}
}
}
ai_check_interval_by_tier = {
barony = 0
county = 48
duchy = 36
kingdom = 36
empire = 36
hegemony = 36
}
is_shown = {
is_landed = yes
# Hide unless at least one drawable saint exists (empty picker otherwise).
faith ?= {
any_saint = {
saint_burial_location = {
pam_can_extract_relic_from_saint_trigger = { EXTRACTOR = root SAINT = prev }
}
}
}
exists = faith
is_ruler = yes
has_pam_dlc_trigger = yes
}
# Transient availability only - generic failures on the confirm button.
is_valid_showing_failures_only = {
is_available_quick = {
incapable = no
alive = yes
adult = yes
imprisoned = no
}
}
# Goal-facing requirement (also the execute guard); is_shown gates discovery on the same check. Eligibility owned by pam_can_extract_relic_from_saint_trigger - keep its loc in sync.
is_valid = {
custom_description = {
text = pam_extract_relic_decision_req_saint
faith = {
any_saint = {
saint_burial_location = {
pam_can_extract_relic_from_saint_trigger = { EXTRACTOR = root SAINT = prev }
}
}
}
}
# Once a saint is picked, show how many of the per-saint relic cap they have left.
trigger_if = {
limit = { exists = scope:selected_item }
custom_description = {
text = pam_extract_relic_decision_req_saint_count
# subject exposes the picked saint to the loc as CHARACTER (widget's selected_item isn't a loc-visible scope).
# Fire an event telling the player the work has begun; its option starts the timer that delivers the relic (event 0016). scope:extract_site / relic_saint carry over.