﻿domcom_cuck_xp_display_value = {
    value = 0
    if = {
        limit = { has_variable = domcom_cuck_xp }
        add = var:domcom_cuck_xp
    }
}


domcom_obedience_display_value = {
    value = 0
    if = {
        limit = { has_variable = domcom_obedience }
        add = var:domcom_obedience
    }
    min = 0
    max = 1000
}

domcom_monthly_tribute_value = {
    value = monthly_character_income
    multiply = 0.22
    if = {
        limit = { has_character_flag = domcom_household_dominion }
        add = { value = monthly_character_income multiply = 0.08 }
    }
    if = {
        limit = { has_character_flag = domcom_bound_ruler }
        add = { value = monthly_character_income multiply = 0.13 }
    }
    min = 0
    max = gold
}

# Direct-war submission begins at Broken (500 Cuck XP), becomes highly likely at Abject (750), and
# is certain at 1000. Ownership and intimate/terminal submission deepen the pressure.
domcom_direct_war_submission_chance_value = {
    value = 0
    if = { limit = { has_variable = domcom_cuck_xp var:domcom_cuck_xp >= 500 } add = 35 }
    if = { limit = { has_variable = domcom_cuck_xp var:domcom_cuck_xp >= 750 } add = 40 }
    if = { limit = { has_variable = domcom_cuck_xp var:domcom_cuck_xp >= 1000 } add = 25 }
    if = { limit = { has_character_flag = domcom_owned_cuck } add = 10 }
    if = {
        limit = {
            OR = {
                has_character_flag = domcom_pet
                has_character_flag = domcom_dynasty_slave
                has_character_modifier = domcom_inherited_submission_modifier
            }
        }
        add = 100
    }
    if = { limit = { has_relation_soulmate = scope:domcom_war_patron } add = 15 }
    else_if = { limit = { has_relation_lover = scope:domcom_war_patron } add = 10 }
    if = {
        limit = {
            OR = {
                has_character_flag = domcom_absolute_devotion
                has_character_flag = domcom_feminized
                has_trait = domcom_feminized_trait
                has_character_flag = domcom_bound_ruler
                has_character_modifier = domcom_inherited_submission_modifier
            }
        }
        add = 15
    }
    min = 0
    max = 100
    round = yes
}

# How often an AI Patron deliberately deepens one existing Lover/Soulmate relationship each year.
domcom_ai_devotion_activity_chance_value = {
    value = 60
    if = { limit = { has_game_rule = domcom_ai_activity_conservative } add = -35 }
    else_if = { limit = { has_game_rule = domcom_ai_activity_aggressive } add = 25 }
    else_if = { limit = { has_game_rule = domcom_ai_activity_chaotic } add = 40 }
    min = 0
    max = 100
    round = yes
}

domcom_bound_ruler_treasury_surrender_value = {
    value = gold
    multiply = 0.50
    min = 0
    max = gold
}

# Standard and Harsh defensive capitulation values are kept separate so the game rule can choose the
# package cleanly without trying to place a dynamic cap on a scripted value.
domcom_defensive_capitulation_gold_value = {
    value = gold
    multiply = 0.25
    min = 0
    max = 500
}

domcom_defensive_capitulation_prestige_value = {
    value = prestige
    multiply = 0.10
    min = 0
    max = 300
}

domcom_harsh_capitulation_gold_value = {
    value = gold
    multiply = 0.50
    min = 0
    max = 1000
}

domcom_harsh_capitulation_prestige_value = {
    value = prestige
    multiply = 0.20
    min = 0
    max = 600
}

# AI intent is separate from Alpha success. The activity rule changes how often eligible AI Patrons act;
# Cuck Autonomy changes the initiative penalty for a publicly Cucked actor. Their actual contest chance
# remains based on stats/evidence once an attempt begins.
domcom_ai_relationship_dominion_activity_chance_value = {
    value = 100
    if = { limit = { has_game_rule = domcom_ai_activity_conservative } multiply = 0.50 }
    if = {
        limit = { has_character_flag = domcom_cucked }
        if = { limit = { has_game_rule = domcom_cuck_autonomy_static } multiply = 0.10 }
        else_if = { limit = { has_game_rule = domcom_cuck_autonomy_dynamic } multiply = 0.50 }
        else = { multiply = 0.25 }
    }
    min = 1
    max = 100
    round = yes
}

# Aggressive/Chaotic can make a second relationship-Dominion attempt each yearly pulse. Standard keeps
# v1.7's one attempt; Conservative never receives an extra attempt.
domcom_ai_extra_relationship_activity_chance_value = {
    value = 0
    if = { limit = { has_game_rule = domcom_ai_activity_aggressive } add = 45 }
    else_if = { limit = { has_game_rule = domcom_ai_activity_chaotic } add = 100 }
    if = {
        limit = { has_character_flag = domcom_cucked }
        if = { limit = { has_game_rule = domcom_cuck_autonomy_static } multiply = 0.10 }
        else_if = { limit = { has_game_rule = domcom_cuck_autonomy_dynamic } multiply = 0.50 }
        else = { multiply = 0.25 }
    }
    min = 0
    max = 100
    round = yes
}

domcom_ai_general_alpha_activity_chance_value = {
    value = 65
    if = { limit = { has_game_rule = domcom_ai_activity_conservative } subtract = 30 }
    else_if = { limit = { has_game_rule = domcom_ai_activity_aggressive } add = 20 }
    else_if = { limit = { has_game_rule = domcom_ai_activity_chaotic } add = 35 }
    if = {
        limit = { has_character_flag = domcom_cucked }
        if = { limit = { has_game_rule = domcom_cuck_autonomy_static } multiply = 0.10 }
        else_if = { limit = { has_game_rule = domcom_cuck_autonomy_dynamic } multiply = 0.50 }
        else = { multiply = 0.25 }
    }
    min = 1
    max = 100
    round = yes
}

domcom_ai_public_humiliation_activity_chance_value = {
    value = 8
    if = { limit = { has_game_rule = domcom_ai_activity_conservative } subtract = 4 }
    else_if = { limit = { has_game_rule = domcom_ai_activity_aggressive } add = 4 }
    else_if = { limit = { has_game_rule = domcom_ai_activity_chaotic } add = 10 }
    if = {
        limit = { has_character_flag = domcom_cucked }
        if = { limit = { has_game_rule = domcom_cuck_autonomy_static } multiply = 0.10 }
        else_if = { limit = { has_game_rule = domcom_cuck_autonomy_dynamic } multiply = 0.50 }
        else = { multiply = 0.25 }
    }
    min = 1
    max = 100
    round = yes
}

# Passive household pressure values. Manual bypasses the whole passive effect in on_actions; these values
# determine Reduced/Standard/Accelerated rates without changing manual Alpha/Taunt rewards.
domcom_passive_cuck_bond_xp_value = {
    value = 5
    if = { limit = { has_game_rule = domcom_passive_progression_reduced } subtract = 3 }
    else_if = { limit = { has_game_rule = domcom_passive_progression_accelerated } add = 5 }
}

domcom_passive_cuck_devotion_xp_value = {
    value = 3
    if = { limit = { has_game_rule = domcom_passive_progression_reduced } subtract = 2 }
    else_if = { limit = { has_game_rule = domcom_passive_progression_accelerated } add = 3 }
}

domcom_passive_cuck_child_xp_value = {
    value = 2
    if = { limit = { has_game_rule = domcom_passive_progression_reduced } subtract = 1 }
    else_if = { limit = { has_game_rule = domcom_passive_progression_accelerated } add = 2 }
}

# Root/this is the interaction recipient. scope:actor and scope:recipient are supplied by the character
# interaction. The result is a percentage, capped at 5-95.
domcom_alpha_check_chance_value = {
    value = 18
    if = {
        limit = { scope:recipient = { has_variable = domcom_cuck_xp } }
        add = { value = scope:recipient.var:domcom_cuck_xp multiply = 0.05 }
    }
    # A previous pre-cuck Alpha victory gives a modest edge once the same rival returns for a post-cuck
    # reassertion.
    if = {
        limit = {
            scope:recipient = {
                has_character_flag = domcom_dominated
                has_variable = domcom_dominance_patron
                var:domcom_dominance_patron = scope:actor
            }
        }
        add = 12
    }
    if = {
        limit = { scope:recipient = { domcom_has_lover_betrayal_from_actor_trigger = yes } }
        add = 8
    }
    if = {
        limit = { scope:recipient = { domcom_spouse_taken_by_actor_trigger = yes } }
        add = 14
    }
    add = { value = scope:actor.diplomacy multiply = 0.70 }
    subtract = { value = scope:recipient.diplomacy multiply = 0.65 }
    add = { value = scope:actor.intrigue multiply = 0.75 }
    subtract = { value = scope:recipient.intrigue multiply = 0.70 }
    add = { value = scope:actor.prowess multiply = 0.45 }
    subtract = { value = scope:recipient.prowess multiply = 0.40 }
    add = { value = scope:actor.prestige_level multiply = 5 }
    subtract = { value = scope:recipient.prestige_level multiply = 5 }
    add = { value = scope:actor.dread multiply = 0.12 }

    if = { limit = { scope:actor = { highest_held_title_tier >= tier_empire } } add = 18 }
    else_if = { limit = { scope:actor = { highest_held_title_tier = tier_kingdom } } add = 12 }
    else_if = { limit = { scope:actor = { highest_held_title_tier = tier_duchy } } add = 6 }
    else_if = { limit = { scope:actor = { is_landed = no } } add = -8 }

    if = { limit = { scope:recipient = { highest_held_title_tier >= tier_empire } } add = -22 }
    else_if = { limit = { scope:recipient = { highest_held_title_tier = tier_kingdom } } add = -14 }
    else_if = { limit = { scope:recipient = { highest_held_title_tier = tier_duchy } } add = -7 }

    if = { limit = { scope:actor.max_military_strength > scope:recipient.max_military_strength } add = 7 }
    if = { limit = { scope:recipient.max_military_strength > scope:actor.max_military_strength } add = -7 }

    if = { limit = { scope:actor = { has_trait = brave } } add = 6 }
    if = { limit = { scope:actor = { has_trait = ambitious } } add = 6 }
    if = { limit = { scope:actor = { has_trait = arrogant } } add = 5 }
    if = { limit = { scope:actor = { has_trait = gregarious } } add = 4 }
    if = { limit = { scope:actor = { has_trait = callous } } add = 4 }
    if = { limit = { scope:actor = { has_trait = sadistic } } add = 4 }

    if = { limit = { scope:recipient = { has_trait = stubborn } } add = -8 }
    if = { limit = { scope:recipient = { has_trait = brave } } add = -8 }
    if = { limit = { scope:recipient = { has_trait = arrogant } } add = -6 }
    if = { limit = { scope:recipient = { has_trait = ambitious } } add = -5 }
    if = { limit = { scope:recipient = { has_trait = craven } } add = 12 }
    if = { limit = { scope:recipient = { has_trait = content } } add = 8 }
    if = { limit = { scope:recipient = { has_trait = trusting } } add = 6 }

    if = {
        limit = {
            scope:recipient = {
                domcom_slave_network_target_trigger = { PATRON = scope:actor }
            }
        }
        add = 8
    }

    min = 3
    max = 97
    round = yes
}

# Sexual influence is intentionally separate from Alpha. This chance uses mutual orientation, social
# skill, personality, existing intimacy, Obedience momentum, and male Endowment compatibility only when
# the recipient is attracted to men.
domcom_tantalize_chance_value = {
    value = 22
    if = {
        limit = { scope:recipient = { has_variable = domcom_obedience } }
        add = { value = scope:recipient.var:domcom_obedience multiply = 0.02 }
    }
    add = { value = scope:actor.diplomacy multiply = 0.80 }
    add = { value = scope:actor.intrigue multiply = 0.35 }
    add = { value = scope:actor.prestige_level multiply = 4 }
    add = { value = scope:actor.dread multiply = 0.04 }
    subtract = { value = scope:recipient.diplomacy multiply = 0.25 }

    if = { limit = { scope:actor = { has_trait = seducer } } add = 12 }
    if = { limit = { scope:actor = { has_trait = lustful } } add = 8 }
    if = { limit = { scope:actor = { has_trait = gregarious } } add = 5 }
    if = { limit = { scope:recipient = { has_trait = lustful } } add = 15 }
    if = { limit = { scope:recipient = { has_trait = trusting } } add = 5 }
    if = { limit = { scope:recipient = { has_trait = chaste } } add = -22 }
    if = { limit = { scope:recipient = { has_trait = shy } } add = -10 }
    if = { limit = { scope:recipient = { has_trait = stubborn } } add = -6 }

    if = { limit = { scope:recipient = { has_relation_crush = scope:actor } } add = 18 }
    if = { limit = { scope:recipient = { has_relation_lover = scope:actor } } add = 30 }
    if = { limit = { scope:recipient = { has_relation_soulmate = scope:actor } } add = 40 }
    if = {
        limit = {
            scope:recipient = {
                has_character_flag = domcom_dominated
                has_variable = domcom_dominance_patron
                var:domcom_dominance_patron = scope:actor
            }
        }
        add = 15
    }
    if = {
        limit = { scope:recipient = { domcom_spouse_dominated_by_actor_trigger = yes } }
        add = 12
    }

    # Endowment is sexual compatibility, so it belongs here rather than in Alpha.
    if = {
        limit = {
            scope:actor = { is_male = yes has_variable = domcom_endowment_category }
            scope:recipient = { is_attracted_to_men = yes has_variable = domcom_size_preference_primary }
        }
        if = { limit = { OR = { AND = { scope:recipient = { var:domcom_size_preference_primary = flag:micro } scope:actor = { var:domcom_endowment_category = flag:micro } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:small } scope:actor = { var:domcom_endowment_category = flag:small } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:average } scope:actor = { var:domcom_endowment_category = flag:average } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:big } scope:actor = { var:domcom_endowment_category = flag:big } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:hung } scope:actor = { var:domcom_endowment_category = flag:hung } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:massive } scope:actor = { var:domcom_endowment_category = flag:massive } } } } add = 16 }
        else_if = { limit = { OR = { AND = { scope:recipient = { var:domcom_size_preference_primary = flag:micro } scope:actor = { var:domcom_endowment_category = flag:small } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:small } scope:actor = { var:domcom_endowment_category = flag:micro } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:small } scope:actor = { var:domcom_endowment_category = flag:average } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:average } scope:actor = { var:domcom_endowment_category = flag:small } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:average } scope:actor = { var:domcom_endowment_category = flag:big } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:big } scope:actor = { var:domcom_endowment_category = flag:average } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:big } scope:actor = { var:domcom_endowment_category = flag:hung } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:hung } scope:actor = { var:domcom_endowment_category = flag:big } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:hung } scope:actor = { var:domcom_endowment_category = flag:massive } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:massive } scope:actor = { var:domcom_endowment_category = flag:hung } } } } add = 8 }
        else_if = { limit = { OR = { AND = { scope:recipient = { var:domcom_size_preference_primary = flag:micro } scope:actor = { var:domcom_endowment_category = flag:average } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:small } scope:actor = { var:domcom_endowment_category = flag:big } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:average } scope:actor = { var:domcom_endowment_category = flag:micro } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:average } scope:actor = { var:domcom_endowment_category = flag:hung } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:big } scope:actor = { var:domcom_endowment_category = flag:small } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:big } scope:actor = { var:domcom_endowment_category = flag:massive } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:hung } scope:actor = { var:domcom_endowment_category = flag:average } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:massive } scope:actor = { var:domcom_endowment_category = flag:big } } } } add = 0 }
        else_if = { limit = { OR = { AND = { scope:recipient = { var:domcom_size_preference_primary = flag:micro } scope:actor = { var:domcom_endowment_category = flag:big } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:small } scope:actor = { var:domcom_endowment_category = flag:hung } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:average } scope:actor = { var:domcom_endowment_category = flag:massive } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:big } scope:actor = { var:domcom_endowment_category = flag:micro } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:hung } scope:actor = { var:domcom_endowment_category = flag:small } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:massive } scope:actor = { var:domcom_endowment_category = flag:average } } } } add = -5 }
        else_if = { limit = { OR = { AND = { scope:recipient = { var:domcom_size_preference_primary = flag:micro } scope:actor = { var:domcom_endowment_category = flag:hung } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:small } scope:actor = { var:domcom_endowment_category = flag:massive } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:hung } scope:actor = { var:domcom_endowment_category = flag:micro } } AND = { scope:recipient = { var:domcom_size_preference_primary = flag:massive } scope:actor = { var:domcom_endowment_category = flag:small } } } } add = -8 }
        else = { add = -10 }
    }

    if = {
        limit = {
            scope:recipient = {
                domcom_slave_network_target_trigger = { PATRON = scope:actor }
            }
        }
        add = 8
    }

    min = 5
    max = 95
    round = yes
}
domcom_ui_alpha_check_chance_value = {
    value = 18
    if = { limit = { has_variable = domcom_cuck_xp } add = { value = var:domcom_cuck_xp multiply = 0.05 } }
    if = {
        limit = {
            has_character_flag = domcom_dominated
            has_variable = domcom_dominance_patron
            var:domcom_dominance_patron = scope:domcom_ui_patron
        }
        add = 12
    }
    add = { value = scope:domcom_ui_patron.diplomacy multiply = 0.70 }
    subtract = { value = diplomacy multiply = 0.65 }
    add = { value = scope:domcom_ui_patron.intrigue multiply = 0.75 }
    subtract = { value = intrigue multiply = 0.70 }
    add = { value = scope:domcom_ui_patron.prowess multiply = 0.45 }
    subtract = { value = prowess multiply = 0.40 }
    add = { value = scope:domcom_ui_patron.prestige_level multiply = 5 }
    subtract = { value = prestige_level multiply = 5 }
    add = { value = scope:domcom_ui_patron.dread multiply = 0.12 }

    if = { limit = { scope:domcom_ui_patron = { highest_held_title_tier >= tier_empire } } add = 18 }
    else_if = { limit = { scope:domcom_ui_patron = { highest_held_title_tier = tier_kingdom } } add = 12 }
    else_if = { limit = { scope:domcom_ui_patron = { highest_held_title_tier = tier_duchy } } add = 6 }
    else_if = { limit = { scope:domcom_ui_patron = { is_landed = no } } add = -8 }

    if = { limit = { highest_held_title_tier >= tier_empire } add = -22 }
    else_if = { limit = { highest_held_title_tier = tier_kingdom } add = -14 }
    else_if = { limit = { highest_held_title_tier = tier_duchy } add = -7 }

    if = { limit = { scope:domcom_ui_patron.max_military_strength > max_military_strength } add = 7 }
    if = { limit = { max_military_strength > scope:domcom_ui_patron.max_military_strength } add = -7 }

    if = { limit = { scope:domcom_ui_patron = { has_trait = brave } } add = 6 }
    if = { limit = { scope:domcom_ui_patron = { has_trait = ambitious } } add = 6 }
    if = { limit = { scope:domcom_ui_patron = { has_trait = arrogant } } add = 5 }
    if = { limit = { scope:domcom_ui_patron = { has_trait = gregarious } } add = 4 }
    if = { limit = { scope:domcom_ui_patron = { has_trait = callous } } add = 4 }
    if = { limit = { scope:domcom_ui_patron = { has_trait = sadistic } } add = 4 }

    if = { limit = { has_trait = stubborn } add = -8 }
    if = { limit = { has_trait = brave } add = -8 }
    if = { limit = { has_trait = arrogant } add = -6 }
    if = { limit = { has_trait = ambitious } add = -5 }
    if = { limit = { has_trait = craven } add = 12 }
    if = { limit = { has_trait = content } add = 8 }
    if = { limit = { has_trait = trusting } add = 6 }

    if = {
        limit = {
            domcom_slave_network_target_trigger = { PATRON = scope:domcom_ui_patron }
        }
        add = 8
    }

    min = 3
    max = 97
    round = yes
}
domcom_family_attraction_chance_value = {
    value = 18
    if = { limit = { is_attracted_to_gender_of = scope:domcom_attraction_patron } add = 20 }
    else = { add = -100 }
    if = { limit = { scope:domcom_attraction_patron = { is_attracted_to_gender_of = prev } } add = 10 }
    else = { add = -100 }
    add = { value = scope:domcom_attraction_patron.diplomacy multiply = 0.8 }
    add = { value = scope:domcom_attraction_patron.prestige_level multiply = 5 }
    add = { value = scope:domcom_attraction_patron.dread multiply = 0.08 }
    if = { limit = { has_trait = lustful } add = 16 }
    if = { limit = { has_trait = seducer } add = 10 }
    if = { limit = { has_trait = brave } add = 4 }
    if = { limit = { has_trait = chaste } add = -25 }
    if = { limit = { has_trait = shy } add = -10 }
    if = { limit = { has_trait = stubborn } add = -8 }
    if = {
        limit = { exists = scope:domcom_attraction_source scope:domcom_attraction_source = { has_variable = domcom_cuck_xp } }
        add = { value = scope:domcom_attraction_source.var:domcom_cuck_xp multiply = 0.02 }
    }

    if = {
        limit = {
            scope:domcom_attraction_patron = { is_male = yes has_variable = domcom_endowment_category }
            is_attracted_to_men = yes
            has_variable = domcom_size_preference_primary
        }
        if = { limit = { OR = { AND = { var:domcom_size_preference_primary = flag:micro scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:micro } } AND = { var:domcom_size_preference_primary = flag:small scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:small } } AND = { var:domcom_size_preference_primary = flag:average scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:average } } AND = { var:domcom_size_preference_primary = flag:big scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:big } } AND = { var:domcom_size_preference_primary = flag:hung scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:hung } } AND = { var:domcom_size_preference_primary = flag:massive scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:massive } } } } add = 14 }
        else_if = { limit = { OR = { AND = { var:domcom_size_preference_primary = flag:micro scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:small } } AND = { var:domcom_size_preference_primary = flag:small scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:micro } } AND = { var:domcom_size_preference_primary = flag:small scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:average } } AND = { var:domcom_size_preference_primary = flag:average scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:small } } AND = { var:domcom_size_preference_primary = flag:average scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:big } } AND = { var:domcom_size_preference_primary = flag:big scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:average } } AND = { var:domcom_size_preference_primary = flag:big scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:hung } } AND = { var:domcom_size_preference_primary = flag:hung scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:big } } AND = { var:domcom_size_preference_primary = flag:hung scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:massive } } AND = { var:domcom_size_preference_primary = flag:massive scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:hung } } } } add = 7 }
        else_if = { limit = { OR = { AND = { var:domcom_size_preference_primary = flag:micro scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:average } } AND = { var:domcom_size_preference_primary = flag:small scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:big } } AND = { var:domcom_size_preference_primary = flag:average scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:micro } } AND = { var:domcom_size_preference_primary = flag:average scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:hung } } AND = { var:domcom_size_preference_primary = flag:big scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:small } } AND = { var:domcom_size_preference_primary = flag:big scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:massive } } AND = { var:domcom_size_preference_primary = flag:hung scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:average } } AND = { var:domcom_size_preference_primary = flag:massive scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:big } } } } add = 0 }
        else_if = { limit = { OR = { AND = { var:domcom_size_preference_primary = flag:micro scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:big } } AND = { var:domcom_size_preference_primary = flag:small scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:hung } } AND = { var:domcom_size_preference_primary = flag:average scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:massive } } AND = { var:domcom_size_preference_primary = flag:big scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:micro } } AND = { var:domcom_size_preference_primary = flag:hung scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:small } } AND = { var:domcom_size_preference_primary = flag:massive scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:average } } } } add = -4 }
        else_if = { limit = { OR = { AND = { var:domcom_size_preference_primary = flag:micro scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:hung } } AND = { var:domcom_size_preference_primary = flag:small scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:massive } } AND = { var:domcom_size_preference_primary = flag:hung scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:micro } } AND = { var:domcom_size_preference_primary = flag:massive scope:domcom_attraction_patron = { var:domcom_endowment_category = flag:small } } } } add = -7 }
        else = { add = -10 }
    }
    min = 0
    max = 90
    round = yes
}

domcom_abdication_chance_value = {
    value = 40
    if = { limit = { has_variable = domcom_cuck_xp } add = { value = var:domcom_cuck_xp multiply = 0.06 } }
    if = { limit = { has_character_flag = domcom_household_dominion } add = 10 }

    if = {
        limit = { has_variable = domcom_blood_successor }
        if = { limit = { var:domcom_blood_successor = { age < 6 } } add = -35 }
        else_if = { limit = { var:domcom_blood_successor = { age < 12 } } add = -25 }
        else_if = { limit = { var:domcom_blood_successor = { age < 16 } } add = -15 }
        else_if = { limit = { var:domcom_blood_successor = { age < 18 } } add = -8 }
        if = { limit = { var:domcom_blood_successor = { has_character_flag = domcom_blood_repudiated_by_cuck } } add = -15 }
        if = { limit = { var:domcom_blood_successor = { is_imprisoned = yes } } add = -10 }
    }
    else_if = {
        limit = { exists = primary_heir }
        if = { limit = { primary_heir = { age < 6 } } add = -35 }
        else_if = { limit = { primary_heir = { age < 12 } } add = -25 }
        else_if = { limit = { primary_heir = { age < 16 } } add = -15 }
        else_if = { limit = { primary_heir = { age < 18 } } add = -8 }
    }

    if = { limit = { has_trait = stubborn } add = -10 }
    if = { limit = { has_trait = brave } add = -8 }
    if = { limit = { has_trait = ambitious } add = -5 }
    if = { limit = { has_trait = craven } add = 12 }
    if = { limit = { has_trait = content } add = 8 }
    if = { limit = { has_trait = trusting } add = 5 }
    min = 10
    max = 100
    round = yes
}

# Current scope is AI cuck target and scope:domcom_ai_patron is saved.
domcom_ai_alpha_check_chance_value = {
    value = 18
    if = { limit = { has_variable = domcom_cuck_xp } add = { value = var:domcom_cuck_xp multiply = 0.05 } }
    if = {
        limit = {
            has_character_flag = domcom_dominated
            has_variable = domcom_dominance_patron
            var:domcom_dominance_patron = scope:domcom_ai_patron
        }
        add = 12
    }
    if = {
        limit = {
            OR = {
                any_in_list = {
                    variable = domcom_betrayal_evidence_patrons
                    this = scope:domcom_ai_patron
                }
                any_relation = {
                    type = lover
                    is_alive = yes
                    age >= 18
                    OR = {
                        has_relation_lover = scope:domcom_ai_patron
                        has_relation_soulmate = scope:domcom_ai_patron
                        any_child = {
                            OR = {
                                father ?= scope:domcom_ai_patron
                                mother ?= scope:domcom_ai_patron
                                real_father ?= scope:domcom_ai_patron
                            }
                        }
                    }
                }
            }
        }
        add = 8
    }
    add = { value = scope:domcom_ai_patron.diplomacy multiply = 0.70 }
    subtract = { value = diplomacy multiply = 0.65 }
    add = { value = scope:domcom_ai_patron.intrigue multiply = 0.75 }
    subtract = { value = intrigue multiply = 0.70 }
    add = { value = scope:domcom_ai_patron.prowess multiply = 0.45 }
    subtract = { value = prowess multiply = 0.40 }
    add = { value = scope:domcom_ai_patron.prestige_level multiply = 5 }
    subtract = { value = prestige_level multiply = 5 }
    add = { value = scope:domcom_ai_patron.dread multiply = 0.12 }

    if = { limit = { scope:domcom_ai_patron = { highest_held_title_tier >= tier_empire } } add = 18 }
    else_if = { limit = { scope:domcom_ai_patron = { highest_held_title_tier = tier_kingdom } } add = 12 }
    else_if = { limit = { scope:domcom_ai_patron = { highest_held_title_tier = tier_duchy } } add = 6 }
    else_if = { limit = { scope:domcom_ai_patron = { is_landed = no } } add = -8 }

    if = { limit = { highest_held_title_tier >= tier_empire } add = -22 }
    else_if = { limit = { highest_held_title_tier = tier_kingdom } add = -14 }
    else_if = { limit = { highest_held_title_tier = tier_duchy } add = -7 }

    if = { limit = { scope:domcom_ai_patron.max_military_strength > max_military_strength } add = 7 }
    if = { limit = { max_military_strength > scope:domcom_ai_patron.max_military_strength } add = -7 }

    if = { limit = { scope:domcom_ai_patron = { has_trait = brave } } add = 6 }
    if = { limit = { scope:domcom_ai_patron = { has_trait = ambitious } } add = 6 }
    if = { limit = { scope:domcom_ai_patron = { has_trait = arrogant } } add = 5 }
    if = { limit = { scope:domcom_ai_patron = { has_trait = gregarious } } add = 4 }
    if = { limit = { scope:domcom_ai_patron = { has_trait = callous } } add = 4 }
    if = { limit = { scope:domcom_ai_patron = { has_trait = sadistic } } add = 4 }

    if = { limit = { has_trait = stubborn } add = -8 }
    if = { limit = { has_trait = brave } add = -8 }
    if = { limit = { has_trait = arrogant } add = -6 }
    if = { limit = { has_trait = ambitious } add = -5 }
    if = { limit = { has_trait = craven } add = 12 }
    if = { limit = { has_trait = content } add = 8 }
    if = { limit = { has_trait = trusting } add = 6 }

    if = {
        limit = {
            domcom_slave_network_target_trigger = { PATRON = scope:domcom_ai_patron }
        }
        add = 8
    }

    min = 3
    max = 97
    round = yes
}
domcom_ui_abdication_chance_value = {
    value = domcom_abdication_chance_value
}

domcom_annual_tribute_due_value = {
    value = monthly_character_income
    multiply = 2.64 # 22% x 12 months
    if = {
        limit = { has_character_flag = domcom_household_dominion }
        add = { value = monthly_character_income multiply = 0.96 } # total = 30% x 12
    }
    min = 0
    round = yes
}

domcom_sort_rank_value = {
    value = 0
    if = { limit = { highest_held_title_tier = tier_county } add = 1 }
    else_if = { limit = { highest_held_title_tier = tier_duchy } add = 2 }
    else_if = { limit = { highest_held_title_tier = tier_kingdom } add = 3 }
    else_if = { limit = { highest_held_title_tier = tier_empire } add = 4 }
    else_if = { limit = { highest_held_title_tier = tier_hegemony } add = 5 }
    add = domcom_sort_tiebreak_value
}

domcom_sort_alpha_value = {
    value = 0
    if = { limit = { has_variable = domcom_ui_alpha_chance } add = var:domcom_ui_alpha_chance }
    add = domcom_sort_tiebreak_value
}

# Scripted-GUI-safe descending key for the Alpha Gauntlet.
domcom_sort_alpha_desc_value = {
    value = domcom_sort_alpha_value
    multiply = -1
}

# Scripted-GUI-safe prestige reward for partial Gauntlet clears.
domcom_gauntlet_partial_prestige_value = {
    value = 0
    if = {
        limit = { has_variable = domcom_gauntlet_cleared }
        add = { value = var:domcom_gauntlet_cleared multiply = 30 }
    }
    round = yes
}

domcom_sort_xp_value = {
    value = 0
    if = { limit = { has_variable = domcom_cuck_xp } add = var:domcom_cuck_xp }
    add = domcom_sort_tiebreak_value
}

domcom_sort_tribute_value = {
    value = domcom_annual_tribute_due_value
    add = domcom_sort_tiebreak_value
}



# -----------------------------------------------------------------------------
# DISPLAY-ONLY ENDOWMENT UNITS
# Canonical body/preference data remains stored in tenths of an inch.  The
# Royale w/ Cheese Ledger toggle changes only these presentation values.
# Imperial: tenths-inch / 10 = inches.
# Metric:   tenths-inch * 0.254 = centimeters.
# -----------------------------------------------------------------------------
domcom_length_display_value = {
    value = 0
    if = {
        limit = { exists = root has_variable = domcom_length_tenths }
        if = {
            limit = { has_global_variable = domcom_metric_units }
            add = { value = var:domcom_length_tenths multiply = 0.508 round = yes divide = 2 }
        }
        else = {
            add = { value = var:domcom_length_tenths divide = 10 }
        }
    }
}

domcom_girth_display_value = {
    value = 0
    if = {
        limit = { exists = root has_variable = domcom_girth_tenths }
        if = {
            limit = { has_global_variable = domcom_metric_units }
            add = { value = var:domcom_girth_tenths multiply = 0.508 round = yes divide = 2 }
        }
        else = {
            add = { value = var:domcom_girth_tenths divide = 10 }
        }
    }
}

domcom_preferred_length_display_value = {
    value = 0
    if = {
        limit = { exists = root has_variable = domcom_pref_length_tenths }
        if = {
            limit = { has_global_variable = domcom_metric_units }
            add = { value = var:domcom_pref_length_tenths multiply = 0.508 round = yes divide = 2 }
        }
        else = {
            add = { value = var:domcom_pref_length_tenths divide = 10 }
        }
    }
}

domcom_preferred_girth_display_value = {
    value = 0
    if = {
        limit = { exists = root has_variable = domcom_pref_girth_tenths }
        if = {
            limit = { has_global_variable = domcom_metric_units }
            add = { value = var:domcom_pref_girth_tenths multiply = 0.508 round = yes divide = 2 }
        }
        else = {
            add = { value = var:domcom_pref_girth_tenths divide = 10 }
        }
    }
}

domcom_length_inches_value = {
    value = 0
    if = {
        limit = { exists = root }
        if = { limit = { has_variable = domcom_length_tenths } add = var:domcom_length_tenths }
    }
    divide = 10
}
domcom_girth_inches_value = {
    value = 0
    if = {
        limit = { exists = root }
        if = { limit = { has_variable = domcom_girth_tenths } add = var:domcom_girth_tenths }
    }
    divide = 10
}

domcom_preferred_length_inches_value = {
    value = 0
    if = {
        limit = { exists = root }
        if = { limit = { has_variable = domcom_pref_length_tenths } add = var:domcom_pref_length_tenths }
    }
    divide = 10
}
domcom_preferred_girth_inches_value = {
    value = 0
    if = {
        limit = { exists = root }
        if = { limit = { has_variable = domcom_pref_girth_tenths } add = var:domcom_pref_girth_tenths }
    }
    divide = 10
}
domcom_preferred_endowment_index_value = {
    # Deprecated compatibility alias. Combined preference scoring was removed in v2.5.1.
    value = domcom_sort_pref_length_value
}

# v2.4.3: Endowment Registry women's-preference ordering. These are the woman's stored ideal
# measurements, not a re-roll and not a judgment about the currently selected male.
domcom_sort_pref_length_value = {
    value = 0
    if = { limit = { has_variable = domcom_pref_length_tenths } add = var:domcom_pref_length_tenths }
    add = domcom_sort_tiebreak_value
}

domcom_sort_pref_girth_value = {
    value = 0
    if = { limit = { has_variable = domcom_pref_girth_tenths } add = var:domcom_pref_girth_tenths }
    add = domcom_sort_tiebreak_value
}

# Deprecated alias retained for save/compatibility safety; preference sorting is length-first now.
domcom_sort_pref_both_value = {
    value = domcom_sort_pref_length_value
}

# Deprecated display alias. Kept for external compatibility; Dominion no longer displays Combined.
domcom_preferred_endowment_index_display_value = {
    value = domcom_preferred_length_display_value
}

# Deprecated alias: Endowment registry ordering is now explicit Length/Girth/Mastery.
domcom_endowment_sort_value = {
    value = domcom_length_sort_value
}


domcom_length_sort_value = {
    value = 0
    if = { limit = { exists = root has_variable = domcom_length_tenths } add = var:domcom_length_tenths }
}

domcom_girth_sort_value = {
    value = 0
    if = { limit = { exists = root has_variable = domcom_girth_tenths } add = var:domcom_girth_tenths }
}

# v2.4.0 learned Endowment Mastery. Physical size and Mastery are intentionally independent.
domcom_endowment_mastery_xp_value = {
    value = 0
    if = {
        limit = { exists = root has_variable = domcom_endowment_mastery_xp }
        add = var:domcom_endowment_mastery_xp
    }
    min = 0
    max = 32
}

domcom_endowment_mastery_sort_value = {
    value = 0
    if = {
        limit = { exists = root has_variable = domcom_endowment_mastery_xp }
        add = var:domcom_endowment_mastery_xp
    }
    add = domcom_sort_tiebreak_value
}

# AI terminal choice. This is deliberately common enough to make Feminization part of the simulated
# world, but personality still matters and territorial/special-house collapses keep their own priorities.
domcom_ai_feminize_collapse_chance_value = {
    value = 25
    if = { limit = { has_game_rule = domcom_ai_activity_conservative } subtract = 10 }
    else_if = { limit = { has_game_rule = domcom_ai_activity_aggressive } add = 10 }
    else_if = { limit = { has_game_rule = domcom_ai_activity_chaotic } add = 20 }
    if = { limit = { scope:domcom_collapse_patron = { has_trait = sadistic } } add = 20 }
    if = { limit = { scope:domcom_collapse_patron = { has_trait = lustful } } add = 10 }
    if = { limit = { scope:domcom_collapse_patron = { has_trait = arrogant } } add = 5 }
    if = { limit = { scope:domcom_collapse_patron = { has_trait = wrathful } } add = 5 }
    if = { limit = { scope:domcom_collapse_patron = { has_trait = compassionate } } subtract = 15 }
    if = { limit = { scope:domcom_collapse_patron = { has_trait = chaste } } subtract = 10 }
    if = { limit = { scope:domcom_collapse_patron = { has_trait = humble } } subtract = 5 }
    min = 5
    max = 80
}

# Deprecated v2.5.1 compatibility alias. Combined Endowment no longer drives UI or gameplay.
domcom_endowment_index_value = {
    value = domcom_length_sort_value
}

# Deprecated display alias. Dominion no longer shows a Combined Endowment number.
domcom_endowment_index_display_value = {
    value = domcom_length_display_value
}



# Public embarrassment is an attempt, not a guaranteed repeatable farm. Run from the Patron with
# scope:domcom_humiliated_cuck saved. Strong social/intrigue advantage and deep existing Dominion help.
domcom_embarrass_success_chance_value = {
    value = 70
    add = { value = diplomacy multiply = 0.5 }
    add = { value = intrigue multiply = 0.5 }
    if = {
        limit = { exists = scope:domcom_humiliated_cuck }
        subtract = { value = scope:domcom_humiliated_cuck.diplomacy multiply = 0.5 }
        subtract = { value = scope:domcom_humiliated_cuck.intrigue multiply = 0.5 }
        if = {
            limit = { scope:domcom_humiliated_cuck = { has_variable = domcom_cuck_xp } }
            add = { value = scope:domcom_humiliated_cuck.var:domcom_cuck_xp multiply = 0.01 }
        }
    }
    min = 25
    max = 95
    round = yes
}

domcom_embarrass_failure_weight_value = {
    value = 100
    add = { value = domcom_embarrass_success_chance_value multiply = -1 }
    min = 5
    max = 75
    round = yes
}

domcom_embarrass_gui_success_chance_value = {
    value = 70
    add = { value = diplomacy multiply = 0.5 }
    add = { value = intrigue multiply = 0.5 }
    if = {
        limit = { exists = scope:domcom_gui_humiliated_cuck }
        subtract = { value = scope:domcom_gui_humiliated_cuck.diplomacy multiply = 0.5 }
        subtract = { value = scope:domcom_gui_humiliated_cuck.intrigue multiply = 0.5 }
        if = {
            limit = { scope:domcom_gui_humiliated_cuck = { has_variable = domcom_cuck_xp } }
            add = { value = scope:domcom_gui_humiliated_cuck.var:domcom_cuck_xp multiply = 0.01 }
        }
    }
    min = 25
    max = 95
    round = yes
}

domcom_embarrass_gui_failure_weight_value = {
    value = 100
    add = { value = domcom_embarrass_gui_success_chance_value multiply = -1 }
    min = 5
    max = 75
    round = yes
}

domcom_taunt_patron_duel_win_chance_value = {
    value = 50
    add = { value = scope:domcom_taunt_patron.prowess multiply = 2.5 }
    subtract = { value = prowess multiply = 2.5 }
    add = { value = scope:domcom_taunt_patron.martial multiply = 0.35 }
    subtract = { value = martial multiply = 0.35 }
    if = { limit = { scope:domcom_taunt_patron = { has_trait = brave } } add = 8 }
    if = { limit = { scope:domcom_taunt_patron = { has_trait = wrathful } } add = 5 }
    if = { limit = { scope:domcom_taunt_patron = { has_trait = strong } } add = 5 }
    if = { limit = { has_trait = brave } add = -8 }
    if = { limit = { has_trait = wrathful } add = -5 }
    if = { limit = { has_trait = strong } add = -5 }
    if = { limit = { has_trait = craven } add = 8 }
    min = 5
    max = 95
    round = yes
}


domcom_taunt_patron_duel_loss_weight_value = {
    value = 100
    add = { value = domcom_taunt_patron_duel_win_chance_value multiply = -1 }
    min = 5
    max = 95
    round = yes
}


domcom_sort_total_value = {
    value = diplomacy
    add = martial
    add = stewardship
    add = intrigue
    add = learning
    add = prowess
    add = domcom_sort_tiebreak_value
}

domcom_sort_prize_value = {
    value = diplomacy
    add = martial
    add = stewardship
    add = intrigue
    add = learning
    add = { value = prowess multiply = 0.5 }

    # Congenital quality.
    if = { limit = { has_trait = intellect_good_1 } add = 4 }
    if = { limit = { has_trait = intellect_good_2 } add = 8 }
    if = { limit = { has_trait = intellect_good_3 } add = 12 }
    if = { limit = { has_trait = intellect_bad_1 } add = -4 }
    if = { limit = { has_trait = intellect_bad_2 } add = -8 }
    if = { limit = { has_trait = intellect_bad_3 } add = -12 }
    if = { limit = { has_trait = beauty_good_1 } add = 4 }
    if = { limit = { has_trait = beauty_good_2 } add = 8 }
    if = { limit = { has_trait = beauty_good_3 } add = 12 }
    if = { limit = { has_trait = beauty_bad_1 } add = -4 }
    if = { limit = { has_trait = beauty_bad_2 } add = -8 }
    if = { limit = { has_trait = beauty_bad_3 } add = -12 }
    if = { limit = { has_trait = physique_good_1 } add = 3 }
    if = { limit = { has_trait = physique_good_2 } add = 6 }
    if = { limit = { has_trait = physique_good_3 } add = 9 }
    if = { limit = { has_trait = physique_bad_1 } add = -3 }
    if = { limit = { has_trait = physique_bad_2 } add = -6 }
    if = { limit = { has_trait = physique_bad_3 } add = -9 }

    # Personality. Weighted toward traits that make someone useful to hold.
    if = { limit = { has_trait = ambitious } add = 5 }
    if = { limit = { has_trait = diligent } add = 4 }
    if = { limit = { has_trait = brave } add = 3 }
    if = { limit = { has_trait = just } add = 3 }
    if = { limit = { has_trait = gregarious } add = 3 }
    if = { limit = { has_trait = patient } add = 3 }
    if = { limit = { has_trait = temperate } add = 2 }
    if = { limit = { has_trait = generous } add = 2 }
    if = { limit = { has_trait = compassionate } add = 2 }
    if = { limit = { has_trait = honest } add = 2 }
    if = { limit = { has_trait = content } add = -2 }
    if = { limit = { has_trait = lazy } add = -4 }
    if = { limit = { has_trait = craven } add = -3 }
    if = { limit = { has_trait = shy } add = -3 }
    if = { limit = { has_trait = impatient } add = -3 }
    if = { limit = { has_trait = arbitrary } add = -3 }

    # A subject already deep in Dominion is worth more as a holding.
    if = { limit = { has_variable = domcom_cuck_xp } add = { value = var:domcom_cuck_xp multiply = 0.01 } }
    add = domcom_sort_tiebreak_value
}


domcom_gauntlet_alpha_chance_value = {
    value = var:domcom_ui_alpha_chance
    multiply = scope:domcom_gauntlet_patron.var:domcom_gauntlet_multiplier
    min = 1
    max = 90
    round = yes
}


# World Gauntlet uses the normal Alpha contest fundamentals, but deliberately does not borrow Cuck XP
# accumulated under another Patron and has no escalating Gauntlet multiplier. That makes a global run
# naturally harder because the targets are independent rivals rather than the player's conditioned roster.
domcom_world_gauntlet_alpha_chance_value = {
    value = 18
    add = { value = scope:domcom_world_gauntlet_patron.diplomacy multiply = 0.70 }
    subtract = { value = diplomacy multiply = 0.65 }
    add = { value = scope:domcom_world_gauntlet_patron.intrigue multiply = 0.75 }
    subtract = { value = intrigue multiply = 0.70 }
    add = { value = scope:domcom_world_gauntlet_patron.prowess multiply = 0.45 }
    subtract = { value = prowess multiply = 0.40 }
    add = { value = scope:domcom_world_gauntlet_patron.prestige_level multiply = 5 }
    subtract = { value = prestige_level multiply = 5 }
    add = { value = scope:domcom_world_gauntlet_patron.dread multiply = 0.12 }

    if = { limit = { scope:domcom_world_gauntlet_patron = { highest_held_title_tier >= tier_empire } } add = 18 }
    else_if = { limit = { scope:domcom_world_gauntlet_patron = { highest_held_title_tier = tier_kingdom } } add = 12 }
    else_if = { limit = { scope:domcom_world_gauntlet_patron = { highest_held_title_tier = tier_duchy } } add = 6 }
    else_if = { limit = { scope:domcom_world_gauntlet_patron = { is_landed = no } } add = -8 }

    if = { limit = { highest_held_title_tier >= tier_empire } add = -22 }
    else_if = { limit = { highest_held_title_tier = tier_kingdom } add = -14 }
    else_if = { limit = { highest_held_title_tier = tier_duchy } add = -7 }

    if = { limit = { scope:domcom_world_gauntlet_patron.max_military_strength > max_military_strength } add = 7 }
    if = { limit = { max_military_strength > scope:domcom_world_gauntlet_patron.max_military_strength } add = -7 }

    if = { limit = { scope:domcom_world_gauntlet_patron = { has_trait = brave } } add = 6 }
    if = { limit = { scope:domcom_world_gauntlet_patron = { has_trait = ambitious } } add = 6 }
    if = { limit = { scope:domcom_world_gauntlet_patron = { has_trait = arrogant } } add = 5 }
    if = { limit = { scope:domcom_world_gauntlet_patron = { has_trait = gregarious } } add = 4 }
    if = { limit = { scope:domcom_world_gauntlet_patron = { has_trait = callous } } add = 4 }
    if = { limit = { scope:domcom_world_gauntlet_patron = { has_trait = sadistic } } add = 4 }

    if = { limit = { has_trait = stubborn } add = -8 }
    if = { limit = { has_trait = brave } add = -8 }
    if = { limit = { has_trait = arrogant } add = -6 }
    if = { limit = { has_trait = ambitious } add = -5 }
    if = { limit = { has_trait = craven } add = 12 }
    if = { limit = { has_trait = content } add = 8 }
    if = { limit = { has_trait = trusting } add = 6 }

    if = {
        limit = { domcom_slave_network_target_trigger = { PATRON = scope:domcom_world_gauntlet_patron } }
        add = 8
    }

    min = 3
    max = 97
    round = yes
}

# Floating reward gates. Absolute requirements rise with the eligible pool, but cap as the world pool
# becomes enormous, so the required percentage falls instead of demanding a near-impossible global sweep.
domcom_world_gauntlet_tier_1_gate_value = {
    value = var:domcom_world_gauntlet_eligible
    multiply = 0.25
    min = 3
    max = 10
    round = yes
}
domcom_world_gauntlet_tier_2_gate_value = {
    value = var:domcom_world_gauntlet_eligible
    multiply = 0.40
    min = 5
    max = 20
    round = yes
}
domcom_world_gauntlet_tier_3_gate_value = {
    value = var:domcom_world_gauntlet_eligible
    multiply = 0.60
    min = 8
    max = 30
    round = yes
}

domcom_intimacy_escape_chance_value = {
    value = 50
    add = { value = scope:domcom_intimacy_patron.intrigue multiply = 1.35 }
    add = { value = scope:domcom_intimacy_patron.prowess multiply = 0.90 }
    add = { value = scope:domcom_intimacy_patron.martial multiply = 0.65 }
    add = { value = scope:domcom_intimacy_patron.dread multiply = 0.25 }
    subtract = { value = intrigue multiply = 1.20 }
    subtract = { value = prowess multiply = 0.85 }
    subtract = { value = martial multiply = 0.60 }
    subtract = { value = dread multiply = 0.15 }
    min = 5
    max = 95
    round = yes
}

domcom_blood_heir_retaliation_chance_value = {
    value = 20
    if = { limit = { has_variable = domcom_cuck_xp } add = { value = var:domcom_cuck_xp multiply = -0.025 } }
    if = { limit = { has_character_flag = domcom_household_dominion } add = -10 }
    if = { limit = { has_trait = vengeful } add = 25 }
    if = { limit = { has_trait = sadistic } add = 18 }
    if = { limit = { has_trait = wrathful } add = 12 }
    if = { limit = { has_trait = paranoid } add = 10 }
    if = { limit = { has_trait = arbitrary } add = 8 }
    if = { limit = { has_trait = stubborn } add = 5 }
    if = { limit = { has_trait = compassionate } add = -25 }
    if = { limit = { has_trait = forgiving } add = -20 }
    if = { limit = { has_trait = content } add = -12 }
    if = { limit = { has_trait = craven } add = -5 }
    if = { limit = { scope:domcom_blood_child = { age < 12 } } add = 5 }
    min = 0
    max = 75
    round = yes
}

domcom_alpha_check_failure_weight_value = {
    value = 100
    add = { value = domcom_alpha_check_chance_value multiply = -1 }
}

domcom_tantalize_failure_weight_value = {
    value = 100
    add = { value = domcom_tantalize_chance_v063_value multiply = -1 }
}


domcom_abdication_failure_weight_value = {
    value = 100
    add = { value = domcom_abdication_chance_value multiply = -1 }
}


domcom_crowned_heart_offer_chance_value = {
    value = 4
    if = { limit = { has_relation_crush = scope:domcom_crowned_partner } add = 6 }
    if = { limit = { has_relation_lover = scope:domcom_crowned_partner } add = 12 }
    if = { limit = { has_relation_soulmate = scope:domcom_crowned_partner } add = 18 }
    if = {
        limit = {
            has_character_flag = domcom_pet
            has_variable = domcom_pet_patron
            var:domcom_pet_patron = scope:domcom_crowned_partner
        }
        add = 15
    }
    if = { limit = { has_trait = lustful } add = 6 }
    if = { limit = { has_trait = ambitious } add = 5 }
    if = { limit = { has_trait = brave } add = 3 }
    if = { limit = { has_trait = deceitful } add = 3 }
    if = { limit = { has_trait = arbitrary } add = 2 }
    min = 2
    max = 35
    round = yes
}

domcom_sire_length_seed_value = {
    value = 0
    if = {
        limit = { exists = root has_variable = domcom_sire_length_tenths }
        add = var:domcom_sire_length_tenths
        subtract = 50
        multiply = 0.6
        add = 50
    }
    else = { add = 50 }
    round = yes
}

domcom_sire_girth_seed_value = {
    value = 0
    if = {
        limit = { exists = root has_variable = domcom_sire_girth_tenths }
        add = var:domcom_sire_girth_tenths
        subtract = 46
        multiply = 0.6
        add = 46
    }
    else = { add = 46 }
    round = yes
}

domcom_dominion_success_stress_value = {
    value = -5
    if = { limit = { has_trait = lustful } subtract = 8 }
    if = { limit = { has_trait = deviant } subtract = 6 }
    if = { limit = { has_trait = arrogant } subtract = 4 }
    if = { limit = { has_trait = sadistic } subtract = 4 }
    if = { limit = { has_trait = callous } subtract = 2 }
    if = { limit = { has_trait = ambitious } subtract = 2 }
    if = { limit = { has_trait = chaste } add = 12 }
    if = { limit = { has_trait = humble } add = 5 }
    if = { limit = { has_trait = compassionate } add = 4 }
    if = { limit = { has_trait = honest } add = 3 }
    if = { limit = { has_trait = shy } add = 3 }
}

# Rejection floors at zero rather than going negative: a shameless patron is unbothered by a refusal, but
# nobody is actively relieved by one.
domcom_dominion_rejection_stress_value = {
    value = 15
    if = { limit = { has_trait = lustful } subtract = 5 }
    if = { limit = { has_trait = deviant } subtract = 5 }
    if = { limit = { has_trait = arrogant } subtract = 4 }
    if = { limit = { has_trait = sadistic } subtract = 4 }
    if = { limit = { has_trait = brave } subtract = 2 }
    if = { limit = { has_trait = chaste } add = 8 }
    if = { limit = { has_trait = craven } add = 5 }
    if = { limit = { has_trait = shy } add = 5 }
    if = { limit = { has_trait = humble } add = 4 }
    if = { limit = { has_trait = compassionate } add = 3 }
    min = 0
}

# Evaluated on the partner, not the patron.
domcom_intimacy_discovered_stress_value = {
    value = 20
    if = { limit = { has_trait = lustful } subtract = 8 }
    if = { limit = { has_trait = deviant } subtract = 7 }
    if = { limit = { has_trait = arrogant } subtract = 3 }
    if = { limit = { has_trait = brave } subtract = 3 }
    if = { limit = { has_trait = callous } subtract = 3 }
    if = { limit = { has_trait = chaste } add = 10 }
    if = { limit = { has_trait = shy } add = 6 }
    if = { limit = { has_trait = humble } add = 4 }
    if = { limit = { has_trait = craven } add = 4 }
    if = { limit = { has_trait = honest } add = 3 }
    min = 0
}

domcom_sort_tantalized_value = {
    value = 0
    if = {
        limit = { exists = scope:domcom_ui_patron scope:domcom_ui_patron = { var:domcom_ui_sort_mode = flag:rank } }
        add = { value = highest_held_title_tier multiply = 1000 }
    }
    else_if = { limit = { exists = scope:domcom_ui_patron scope:domcom_ui_patron = { var:domcom_ui_sort_mode = flag:diplomacy } }   add = { value = diplomacy   multiply = 10 } }
    else_if = { limit = { exists = scope:domcom_ui_patron scope:domcom_ui_patron = { var:domcom_ui_sort_mode = flag:martial } }     add = { value = martial     multiply = 10 } }
    else_if = { limit = { exists = scope:domcom_ui_patron scope:domcom_ui_patron = { var:domcom_ui_sort_mode = flag:stewardship } } add = { value = stewardship multiply = 10 } }
    else_if = { limit = { exists = scope:domcom_ui_patron scope:domcom_ui_patron = { var:domcom_ui_sort_mode = flag:intrigue } }    add = { value = intrigue    multiply = 10 } }
    else_if = { limit = { exists = scope:domcom_ui_patron scope:domcom_ui_patron = { var:domcom_ui_sort_mode = flag:learning } }    add = { value = learning    multiply = 10 } }
    else_if = { limit = { exists = scope:domcom_ui_patron scope:domcom_ui_patron = { var:domcom_ui_sort_mode = flag:prowess } }     add = { value = prowess     multiply = 10 } }
    else = { if = { limit = { has_variable = domcom_obedience } add = var:domcom_obedience } }
    add = domcom_sort_tiebreak_value
    if = {
        limit = { exists = scope:domcom_ui_patron scope:domcom_ui_patron = { var:domcom_ui_sort_direction = flag:ascending } }
        multiply = -1
    }
}

domcom_alpha_budget_cap_value = {
    value = 0
    if = { limit = { has_game_rule = domcom_alpha_budget_4 } add = 4 }
    else_if = { limit = { has_game_rule = domcom_alpha_budget_16 } add = 16 }
    else_if = { limit = { has_game_rule = domcom_alpha_budget_off } add = 9999 }
    else = { add = 8 }
}

# Remaining checks this quarter, for display. Never negative.
domcom_alpha_budget_left_value = {
    value = domcom_alpha_budget_cap_value
    if = { limit = { has_variable = domcom_alpha_budget_used } subtract = var:domcom_alpha_budget_used }
    min = 0
}

domcom_sort_tiebreak_value = {
    value = 0
    if = { limit = { has_variable = domcom_sort_seed } add = var:domcom_sort_seed }
    divide = 100000
}


# ROOT                            the existing partner, doing the judging
# scope:domcom_jealousy_patron    the Patron
# scope:domcom_jealousy_rival     the person he has just taken
domcom_jealousy_tier_value = {
    value = 3

    # --- how much she likes the Patron -------------------------------------
    if = { limit = { opinion = { target = scope:domcom_jealousy_patron value >= 80 } } add = -1.5 }
    else_if = { limit = { opinion = { target = scope:domcom_jealousy_patron value >= 50 } } add = -1 }
    else_if = { limit = { opinion = { target = scope:domcom_jealousy_patron value >= 20 } } add = -0.5 }
    else_if = { limit = { opinion = { target = scope:domcom_jealousy_patron value <= -50 } } add = 1.5 }
    else_if = { limit = { opinion = { target = scope:domcom_jealousy_patron value <= -20 } } add = 1 }

    # --- how much she likes the newcomer -----------------------------------
    if = { limit = { opinion = { target = scope:domcom_jealousy_rival value >= 50 } } add = -1 }
    else_if = { limit = { opinion = { target = scope:domcom_jealousy_rival value >= 20 } } add = -0.5 }
    else_if = { limit = { opinion = { target = scope:domcom_jealousy_rival value <= -50 } } add = 1.25 }
    else_if = { limit = { opinion = { target = scope:domcom_jealousy_rival value <= -20 } } add = 0.75 }

    # --- Obedience, the heaviest term --------------------------------------
    if = {
        limit = {
            has_variable = domcom_obedience_patron
            var:domcom_obedience_patron = scope:domcom_jealousy_patron
            has_variable = domcom_obedience
        }
        if = { limit = { var:domcom_obedience >= 800 } add = -2 }
        else_if = { limit = { var:domcom_obedience >= 600 } add = -1.5 }
        else_if = { limit = { var:domcom_obedience >= 400 } add = -1 }
        else_if = { limit = { var:domcom_obedience >= 200 } add = -0.5 }
        else = { add = 0.5 }
    }
    else = { add = 0.5 }

    # scope:domcom_compatibility_target for each and a script value cannot swap
    if = { limit = { var:domcom_jealousy_attr_patron >= 40 } add = 0.75 }
    else_if = { limit = { var:domcom_jealousy_attr_patron >= 20 } add = 0.4 }

    # --- her attraction to the newcomer: she sees the appeal too ------------
    if = { limit = { var:domcom_jealousy_attr_rival >= 40 } add = -1.25 }
    else_if = { limit = { var:domcom_jealousy_attr_rival >= 20 } add = -0.6 }
    else_if = { limit = { var:domcom_jealousy_attr_rival <= -20 } add = 0.5 }

    # --- temperament -------------------------------------------------------
    if = { limit = { has_trait = lustful } add = -0.5 }
    if = { limit = { has_trait = forgiving } add = -0.5 }
    if = { limit = { has_trait = deceitful } add = -0.25 }
    if = { limit = { has_trait = content } add = -0.25 }
    if = { limit = { has_trait = vengeful } add = 0.75 }
    if = { limit = { has_trait = wrathful } add = 0.75 }
    if = { limit = { has_trait = arrogant } add = 0.5 }
    if = { limit = { has_trait = paranoid } add = 0.5 }
    if = { limit = { has_trait = chaste } add = 0.5 }
    if = { limit = { has_trait = just } add = 0.25 }

    # A spouse who is watching her own husband's Patron collect another is a different case from a
    # courtier, and takes it harder.
    if = { limit = { is_married = yes NOT = { is_spouse_of = scope:domcom_jealousy_patron } } add = 0.25 }

    min = 0
    max = 6
    round = yes
}


# ---------------------------------------------------------------------------
# 2.0 — LICK THE TIP loyalty test
# ---------------------------------------------------------------------------
# Root is the person being tested; scope:domcom_lick_patron is the ruler calling the test.
domcom_lick_loyalty_chance_value = {
    value = 48
    add = { value = "opinion(scope:domcom_lick_patron)" multiply = 0.35 }
    add = { value = scope:domcom_lick_patron.dread multiply = 0.20 }

    # Existing Dominion is the strongest evidence that a public loyalty ritual will be obeyed.
    if = { limit = { has_character_flag = domcom_owned_cuck has_variable = domcom_patron var:domcom_patron = scope:domcom_lick_patron } add = 35 }
    else_if = { limit = { has_character_flag = domcom_cucked has_variable = domcom_cuck_patron var:domcom_cuck_patron = scope:domcom_lick_patron } add = 15 }

    if = { limit = { has_trait = content } add = 14 }
    if = { limit = { has_trait = craven } add = 12 }
    if = { limit = { has_trait = humble } add = 8 }
    if = { limit = { has_trait = trusting } add = 5 }
    if = { limit = { has_trait = brave } subtract = 10 }
    if = { limit = { has_trait = arrogant } subtract = 10 }
    if = { limit = { has_trait = stubborn } subtract = 12 }
    if = { limit = { has_trait = ambitious } subtract = 6 }

    # Landed vassals have more to lose, but also more independent standing from which to refuse.
    if = { limit = { is_landed = yes } subtract = 5 }
    if = { limit = { highest_held_title_tier >= tier_kingdom } subtract = 8 }

    # Loyalty XP makes later calls easier, while a recent public refusal stiffens resistance for the next call.
    if = { limit = { has_variable = domcom_lick_loyalty_xp var:domcom_lick_loyalty_xp >= 25 } add = 5 }
    if = { limit = { has_variable = domcom_lick_loyalty_xp var:domcom_lick_loyalty_xp >= 50 } add = 7 }
    if = { limit = { has_variable = domcom_lick_loyalty_xp var:domcom_lick_loyalty_xp >= 75 } add = 10 }
    if = { limit = { has_character_flag = domcom_lick_refusal_defiance } subtract = 12 }

    min = 5
    max = 95
    round = yes
}

# 2.0 — Lick the Tip roster sorting. These are evaluated with the tested character as Root and
# scope:domcom_ui_patron as the player viewing the loyalty ledger.
domcom_lick_status_sort_value = {
    value = 0
    if = { limit = { has_variable = domcom_lick_last_result var:domcom_lick_last_result = 0 } add = 1000 }
    if = { limit = { has_variable = domcom_lick_loyalty_xp } add = var:domcom_lick_loyalty_xp }
}
domcom_lick_oath_sort_value = {
    value = 0
    if = { limit = { has_variable = domcom_lick_loyalty_xp } add = var:domcom_lick_loyalty_xp }
}
domcom_lick_chance_sort_value = {
    value = 0
    if = { limit = { has_variable = domcom_lick_last_chance } add = var:domcom_lick_last_chance }
}
domcom_lick_opinion_sort_value = {
    value = "opinion(scope:domcom_ui_patron)"
}
domcom_lick_obedience_sort_value = {
    value = 0
    if = { limit = { has_variable = domcom_obedience } add = var:domcom_obedience }
}

# -----------------------------------------------------------------------------
# WORLD ALPHA TOURNAMENT
# -----------------------------------------------------------------------------
# Composite rating used only for seeding/re-seeding. A large cuck record matters, but cannot substitute
# for actual competitive strength. The field is paired nearest-neighbour after sorting by this value.
domcom_world_tournament_seed_value = {
    # 2.2.0: this is the entrant's visible Alpha Rating. The same rating drives seeding AND match odds,
    # so there is no hidden second formula that can contradict the displayed strength order.
    value = 0
    add = { value = diplomacy multiply = 0.75 }
    add = { value = intrigue multiply = 1.00 }
    add = { value = prowess multiply = 0.90 }
    add = { value = martial multiply = 0.55 }
    add = { value = prestige_level multiply = 8 }
    add = { value = dread multiply = 0.10 }
    if = { limit = { highest_held_title_tier >= tier_empire } add = 18 }
    else_if = { limit = { highest_held_title_tier = tier_kingdom } add = 12 }
    else_if = { limit = { highest_held_title_tier = tier_duchy } add = 6 }
    else_if = { limit = { is_landed = no } add = -4 }
    if = { limit = { max_military_strength >= 30000 } add = 18 }
    else_if = { limit = { max_military_strength >= 15000 } add = 14 }
    else_if = { limit = { max_military_strength >= 7500 } add = 10 }
    else_if = { limit = { max_military_strength >= 3500 } add = 6 }
    else_if = { limit = { max_military_strength >= 1500 } add = 3 }
    if = { limit = { has_trait = brave } add = 5 }
    if = { limit = { has_trait = ambitious } add = 5 }
    if = { limit = { has_trait = arrogant } add = 3 }
    if = { limit = { has_trait = craven } add = -5 }
    if = { limit = { has_trait = weak } add = -8 }

    # Actual cuck record matters, but uses diminishing milestone returns instead of an uncapped linear bonus.
    if = { limit = { has_variable = domcom_world_tournament_cuck_count var:domcom_world_tournament_cuck_count >= 100 } add = 25 }
    else_if = { limit = { has_variable = domcom_world_tournament_cuck_count var:domcom_world_tournament_cuck_count >= 50 } add = 20 }
    else_if = { limit = { has_variable = domcom_world_tournament_cuck_count var:domcom_world_tournament_cuck_count >= 25 } add = 15 }
    else_if = { limit = { has_variable = domcom_world_tournament_cuck_count var:domcom_world_tournament_cuck_count >= 10 } add = 10 }
    else_if = { limit = { has_variable = domcom_world_tournament_cuck_count var:domcom_world_tournament_cuck_count >= 5 } add = 6 }
    else_if = { limit = { has_variable = domcom_world_tournament_cuck_count } add = var:domcom_world_tournament_cuck_count }
    min = 0
    round = yes
}


# Symmetric tournament contest. Run from the defender with scope:domcom_world_tournament_attacker saved.
# Unlike the old World Gauntlet, neither side receives a hidden player coefficient advantage.
domcom_world_tournament_match_chance_value = {
    # Run from the defender with scope:domcom_world_tournament_attacker saved. A 20-point Alpha Rating
    # edge is about 63/37; 50 points about 83/17; ~70 points reaches the 95/5 upset cap.
    value = 50
    add = { value = scope:domcom_world_tournament_attacker.var:domcom_world_tournament_alpha_rating multiply = 0.65 }
    subtract = { value = var:domcom_world_tournament_alpha_rating multiply = 0.65 }
    min = 5
    max = 95
    round = yes
}



# Number of survivors equivalent to winning an eight-person opening bracket. Reaching this point in the
# global gauntlet earns the lesser Gauntlet Qualifier standing even if the entrant later loses.
domcom_world_tournament_qualifier_cutoff_value = {
    value = var:domcom_world_tournament_entrant_count
    multiply = 0.125
    add = 0.49
    round = yes
    min = 1
}

domcom_world_tournament_top_10_cutoff_value = {
    value = var:domcom_world_tournament_entrant_count
    multiply = 0.10
    min = 1
    round = yes
}
domcom_world_tournament_top_5_cutoff_value = {
    value = var:domcom_world_tournament_entrant_count
    multiply = 0.05
    min = 1
    round = yes
}
domcom_world_tournament_top_1_cutoff_value = {
    value = var:domcom_world_tournament_entrant_count
    multiply = 0.01
    min = 1
    round = yes
}



# ---------------------------------------------------------------------------
# 2.1.1 — Cult of Personality monthly tribute values
# Whole-number, strength-scaled outputs with late-game caps.
# Root = Patron; domcom_cult_strength is rebuilt before these are evaluated.
# ---------------------------------------------------------------------------
domcom_cult_monthly_gold_value = {
    value = var:domcom_cult_strength
    multiply = 0.25
    max = 25
    round = yes
}

domcom_cult_monthly_prestige_value = {
    value = var:domcom_cult_strength
    multiply = 0.75
    max = 100
    round = yes
}

domcom_cult_monthly_piety_value = {
    value = var:domcom_cult_strength
    multiply = 0.05
    max = 8
    round = yes
}

domcom_cult_monthly_legitimacy_value = {
    value = var:domcom_cult_strength
    multiply = 0.10
    max = 10
    round = yes
}

domcom_cult_monthly_renown_value = {
    value = var:domcom_cult_strength
    multiply = 0.10
    max = 10
    round = yes
}


# v2.5.0 World Outcomes page sorting. Dedicated controls avoid changing sort state on other Ledger pages.
domcom_world_outcome_sort_value = {
    value = 0
    if = {
        limit = { exists = scope:domcom_ui_patron scope:domcom_ui_patron = { var:domcom_ui_outcomes_sort_mode = flag:outcome } }
        if = { limit = { has_variable = domcom_terminal_outcome var:domcom_terminal_outcome = flag:feminized } add = 6000 }
        else_if = { limit = { has_variable = domcom_terminal_outcome var:domcom_terminal_outcome = flag:household } add = 5000 }
        else_if = { limit = { has_variable = domcom_terminal_outcome var:domcom_terminal_outcome = flag:devotion } add = 4000 }
        else_if = { limit = { has_variable = domcom_terminal_outcome var:domcom_terminal_outcome = flag:bound_ruler } add = 3000 }
        else_if = { limit = { has_variable = domcom_terminal_outcome var:domcom_terminal_outcome = flag:noble_family } add = 2000 }
        else = { add = 1000 }
    }
    else_if = { limit = { exists = scope:domcom_ui_patron scope:domcom_ui_patron = { var:domcom_ui_outcomes_sort_mode = flag:rank } } add = { value = highest_held_title_tier multiply = 1000 } }
    else_if = { limit = { exists = scope:domcom_ui_patron scope:domcom_ui_patron = { var:domcom_ui_outcomes_sort_mode = flag:prowess } } add = { value = prowess multiply = 100 } }
    else_if = { limit = { exists = scope:domcom_ui_patron scope:domcom_ui_patron = { var:domcom_ui_outcomes_sort_mode = flag:age } } add = { value = age multiply = 100 } }
    else_if = {
        limit = { exists = scope:domcom_ui_patron scope:domcom_ui_patron = { var:domcom_ui_outcomes_sort_mode = flag:xp } }
        if = { limit = { has_variable = domcom_cuck_xp } add = { value = var:domcom_cuck_xp multiply = 10 } }
    }
    else_if = {
        limit = { exists = scope:domcom_ui_patron scope:domcom_ui_patron = { var:domcom_ui_outcomes_sort_mode = flag:slaves } }
        if = { limit = { has_variable = domcom_ui_outcome_patron_slave_count } add = { value = var:domcom_ui_outcome_patron_slave_count multiply = 100 } }
    }
    else = { add = { value = domcom_sort_total_value multiply = 10 } }
    add = domcom_sort_tiebreak_value
    if = { limit = { exists = scope:domcom_ui_patron scope:domcom_ui_patron = { var:domcom_ui_outcomes_sort_direction = flag:ascending } } multiply = -1 }
}


# v2.5.1 — target already desires the intermediary lover; this measures whether the Patron can turn
# access/attention into Dominion leverage without rewriting the target's orientation.
domcom_entice_through_lover_chance_value = {
    value = 55
    if = { limit = { has_relation_crush = scope:domcom_bait } add = 15 }
    if = { limit = { has_relation_lover = scope:domcom_bait } add = 25 }
    if = { limit = { has_relation_soulmate = scope:domcom_bait } add = 35 }
    add = { value = scope:domcom_bait_patron.diplomacy multiply = 0.5 }
    add = { value = scope:domcom_bait_patron.intrigue multiply = 0.5 }
    subtract = { value = diplomacy multiply = 0.25 }
    subtract = { value = intrigue multiply = 0.25 }
    if = { limit = { has_trait = stubborn } subtract = 10 }
    if = { limit = { has_trait = chaste } subtract = 8 }
    if = { limit = { has_trait = trusting } add = 8 }
    if = { limit = { has_trait = lustful } add = 8 }
    min = 15
    max = 95
    round = yes
}


domcom_entice_through_lover_failure_weight_value = {
    value = 100
    add = { value = domcom_entice_through_lover_chance_value multiply = -1 }
}

# Inner Household: named sort values are required by scripted GUI list iterators.
domcom_inner_sort_diplomacy_desc_value = { value = diplomacy multiply = -1 }
domcom_inner_sort_stewardship_desc_value = { value = stewardship multiply = -1 }
domcom_inner_sort_intrigue_desc_value = { value = intrigue multiply = -1 }
domcom_inner_sort_learning_desc_value = { value = learning multiply = -1 }
domcom_inner_sort_martial_desc_value = { value = martial multiply = -1 }
