﻿namespace = independence_event

independence_event.1 = {
    type = character_event
    title = independence_event.1.title
    desc = independence_event.1.desc
    theme = crown
    window = visit_settlement_window

    immediate = {
        save_scope_as = liege
    }

    left_portrait = {
        character = root
    }
    right_portrait = {
        character = liege
    }

    # Opción 1: Alianza
    option = {
        name = independence_event.1.option_1
        custom_tooltip = independence_event.1.option_1.tooltip

        # Condición para que la opción sea seleccionable
        trigger = {
            liege = {
                opinion = {
                    target = root
                    value >= 60
                }
            }
        }

        create_alliance = liege
        add_opinion = {
            modifier = perk_negotiated_alliance_opinion
            target = liege
        }
        liege = {
            add_opinion = {
                modifier = perk_negotiated_alliance_opinion
                target = root
            }
        }
        create_title_and_vassal_change = {
            type = independency
            save_scope_as = change
        }
        becomes_independent = {
            change = scope:change
        }
        resolve_title_and_vassal_change = scope:change

        # Generar estrés si el personaje tiene ciertos rasgos
        if = {
            limit = {
                OR = {
                    has_trait = craven
                    has_trait = loyal
                    has_trait = lazy
                    has_trait = content
                }
            }
            add_stress = 60
        }
    }

    # Opción 2: Rivalidad
    option = {
        name = independence_event.1.option_2
        set_relation_rival = {
            target = liege
        }
        create_title_and_vassal_change = {
            type = independency
            save_scope_as = change
        }
        becomes_independent = {
            change = scope:change
        }
        resolve_title_and_vassal_change = scope:change

        # Generar estrés si el personaje tiene ciertos rasgos
        if = {
            limit = {
                OR = {
                    has_trait = craven
                    has_trait = loyal
                    has_trait = lazy
                    has_trait = content
                }
            }
            add_stress = 60
        }
    }

    # Opción 3: Tregua
    option = {
        name = independence_event.1.option_3
        add_truce_both_ways = {
            character = liege
            years = 10
            override = yes
            result = white_peace
        }
        create_title_and_vassal_change = {
            type = independency
            save_scope_as = change
        }
        becomes_independent = {
            change = scope:change
        }
        resolve_title_and_vassal_change = scope:change

        # Generar estrés si el personaje tiene ciertos rasgos
        if = {
            limit = {
                OR = {
                    has_trait = craven
                    has_trait = loyal
                    has_trait = lazy
                    has_trait = content
                }
            }
            add_stress = 60
        }
    }

    # Nueva opción: Cancelar la decisión (Ai dont like this option)
    # option = {
    #     name = independence_event.1.option_4
    #     # Efectos de penalización al cancelar la decisión
    #         # Perder legitimidad y renombre ganados
    #         add_legitimacy = -140
    #         dynasty = {
    #             add_dynasty_prestige = -440
    #         }
    #
    #         # Generar estrés si se tienen ciertos rasgos
    #         if = {
    #             limit = {
    #                 OR = {
    #                     has_trait = brave
    #                     has_trait = ambitious
    #                     has_trait = disloyal
    #                     has_trait = arrogant
    #                 }
    #             }
    #             add_stress = 60
    #         }
    #
    #         # Perder opinión del liege
    #     liege = {
    #         add_opinion = {
    #             opinion = perk_negotiated_alliance_opinion
    #             target = root
    #         }
    #     }
    # }
}
