﻿##############################################
# Rise and Fall - Warlord Player Path Decisions
# Lets the player toggle between warlord rebellion and remaining loyal.
##############################################

riseandfall_warlord_path_manager = {
    picture = { reference = "gfx/interface/illustrations/decisions/decision_misc.dds" }
    sort_order = 31
    ai_check_interval = 0
    desc = riseandfall_warlord_path_manager_desc
    selection_tooltip = riseandfall_warlord_path_manager_tooltip
    decision_group_type = riseandfall

    is_shown = {
        is_ai = no
        is_landed = yes
        NOT = { is_independent_ruler = yes }
        has_game_rule = riseandfall_low_stability_events_enabled
        OR = {
            has_trait = warlord
            has_trait = loyalwarlord
        }
    }

    is_valid = {
        is_landed = yes
        exists = liege
        NOT = { exists = var:riseandfall_warlord_alignment_switch_cooldown }
    }

    effect = {
        custom_tooltip = riseandfall_warlord_path_manager_tooltip_tt
        if = {
            limit = { has_trait = warlord }
            riseandfall_warlord_become_loyal = yes
        }
        else_if = {
            limit = { has_trait = loyalwarlord }
            riseandfall_warlord_become_warlord = yes
        }
    }

    ai_potential = {}
    ai_will_do = { base = 0 }
}

riseandfall_warlord_create_realm_titles = {
    picture = { reference = "gfx/interface/illustrations/decisions/decision_misc.dds" }
    sort_order = 34
    ai_check_interval = 1
    desc = riseandfall_warlord_create_realm_titles_desc
    selection_tooltip = riseandfall_warlord_create_realm_titles_tooltip
    decision_group_type = riseandfall

    is_shown = {
        is_landed = yes
        riseandfall_is_any_warlord_trigger = yes
        has_game_rule = riseandfall_low_stability_events_enabled
        # Warlords use a scripted creation path and therefore do not use the
        # vanilla alert, which is blocked by some top-liege governments.
        riseandfall_warlord_has_majority_creatable_title_trigger = yes
    }

    is_valid = {
        is_landed = yes
        riseandfall_is_any_warlord_trigger = yes
        riseandfall_warlord_has_majority_creatable_title_trigger = yes
    }

    should_create_alert = {
        is_ai = no
    }

    effect = {
        riseandfall_warlord_create_realm_titles_se = yes
    }

    ai_potential = {
        is_landed = yes
        riseandfall_is_any_warlord_trigger = yes
        has_game_rule = riseandfall_low_stability_events_enabled
        riseandfall_warlord_has_majority_creatable_title_trigger = yes
    }

    ai_will_do = { base = 100 }
}

riseandfall_choose_warlord_loyal = {
    picture = { reference = "gfx/interface/illustrations/decisions/decision_misc.dds" }
    sort_order = 32
    ai_check_interval = 0
    desc = riseandfall_choose_warlord_loyal_desc
    selection_tooltip = riseandfall_choose_warlord_loyal_tooltip
    decision_group_type = riseandfall
    is_shown = { always = no }
    is_valid = { always = yes }
    effect = {}
    ai_potential = {}
    ai_will_do = { base = 0 }
}

riseandfall_choose_warlord_rebel = {
    picture = { reference = "gfx/interface/illustrations/decisions/decision_misc.dds" }
    sort_order = 33
    ai_check_interval = 0
    desc = riseandfall_choose_warlord_rebel_desc
    selection_tooltip = riseandfall_choose_warlord_rebel_tooltip
    decision_group_type = riseandfall
    is_shown = { always = no }
    is_valid = { always = yes }
    effect = {}
    ai_potential = {}
    ai_will_do = { base = 0 }
}
