﻿form_polish_commonwealth_scripted_effect = {
    save_scope_as = scoped_ruler

    title:k_lithuania = { set_de_jure_liege_title = title:e_polish_commonwealth }
    title:k_poland    = { set_de_jure_liege_title = title:e_polish_commonwealth }

    create_title_and_vassal_change = {
        type = created
        save_scope_as = change
        add_claim_on_loss = no
    }

    title:e_polish_commonwealth = {
        change_title_holder = {
            holder = ROOT
            change = scope:change
        }
    }

    resolve_title_and_vassal_change = scope:change

    add_character_modifier = { modifier = disicion_cpl_modifier }
    set_primary_title_to = title:e_polish_commonwealth
    add_prestige = 500

    if = {
        limit = {
            OR = {
                has_realm_law = crown_authority_0
                has_realm_law = crown_authority_1
                has_realm_law = crown_authority_2
            }
        }
        add_realm_law_skip_effects = crown_authority_3
    }
}

plc_apply_sejm_county_modifier_effect = {
    every_realm_county = {
        limit = {
            exists = holder
            holder = { top_liege = ROOT }
        }
        add_county_modifier = { modifier = $MODIFIER$ years = $YEARS$ }
    }
}
