qyv_apply_religious_protection = {
    add_character_modifier = { modifier = qyv_religious_protection years = 100 }
    if = {
        limit = { has_liege = yes }
        liege = { add_character_modifier = { modifier = qyv_religious_protection_liege years = 100 } }
    }
}

qyv_subsidize_vassals = {
    # Liege distributes gold to struggling vassals to stabilize realm
    if = {
        limit = {
            is_ai = yes
            OR = {
                game_rule = { rule = qyv_ai_gold_subsidies option = normal }
                game_rule = { rule = qyv_ai_gold_subsidies option = heavy }
            }
            gold >= 250
        }
        random_vassal = {
            limit = {
                OR = { opinion_of_liege < 20 has_negative_gold = yes }
            }
            save_scope_as = sub_vassal
        }
        if = {
            limit = { exists = sub_vassal }
            owner = {
                add_gold = -100
            }
            sub_vassal = {
                add_gold = 100
                add_opinion = { target = liege modifier = qyv_received_subsidy years = 5 }
                add_character_modifier = { modifier = qyv_subsidized years = 1 }
            }
        }
    }
}