﻿namespace = mpo_events_ariana
##################################################
# Ariana's Events for MPO

# Nest Sighting - You spot a nest, and decide if you would like to capture the eaglets in it
mpo_events_ariana.0001 = {
    type = character_event
    title = mpo_events_ariana.0001.t
    desc = {
        desc = mpo_events_ariana.0001.desc
        first_valid = {
            triggered_desc = { # Had an eagle before, and doesn't have one now
                trigger = {
                    has_variable = had_eagle_story
                    NOT = { has_eagle_trigger = yes }
                }
                desc = mpo_events_ariana.0001.desc_had_story
            }
            triggered_desc = { # Has one now
                trigger = {
                    has_eagle_trigger = yes
                }
                desc = mpo_events_ariana.0001.desc_has_eagle
            }
            desc = mpo_events_ariana.0001.desc_ending
        }
    }

    theme = nomads

    cooldown = { years = 10 }

    weight_multiplier = {
        base = 1
        modifier = {
            add = 10
            current_season_trigger = { SEASON = spring }
        }
    }

    left_portrait = {
        character = root
        animation = admiration
    }

    trigger = {
		has_mpo_dlc_trigger = yes
        location = { geographical_region = world_steppe } 
        government_has_flag = government_is_nomadic
        is_available_adult = yes
        NOT = { current_season_trigger = { SEASON = winter } }
    }

    immediate = {
        if = {
            limit = {
                is_ai = no # So AI don't spam add modifiers
            }
            if = {
                limit = { # Your observant eagle helps you here
                    location.county = { NOT = { has_county_modifier = hunt_sighting_legendary_modifier } }
                    has_eagle_trigger = yes
                    var:eagle_personality_trait_2 ?= flag:observant
                }
                location.county = {
                    hunt_create_sighting_effect = {
			        	TYPE = legendary
			        	ANIMAL = flag:deer
			        	OWNER = root
			        } 
                }
            }
            else_if = {
                limit = {
                    location.county = { NOT = { has_county_modifier = hunt_sighting_falconry_modifier } }
                }
                location.county = {
                    random_county_province = {
                        save_scope_as = falconry_province
                    }
                    hunt_activity_falconry_game_effect = { PROVINCE = scope:falconry_province }
                    hunt_create_sighting_effect = {
			        	TYPE = falconry
			        	ANIMAL = var:animal_type
			        	OWNER = root
			        } 
                }
            }
        }
    }


    option = { # Standard capture method
        name = mpo_events_ariana.0001.a
        duel = {
            skill = prowess
            value = decent_skill_rating
            desc = mpo_events_ariana.0001.a_tt
            70 = {
                desc = mpo_events_ariana.0001.a_win
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -69
                }
                modifier = {
                    factor = 1.2
                    has_trait = lifestyle_hunter
                }
                save_scope_value_as = {
                    name = eagle_capture_method
                    value = flag:standard
                }
                hidden_effect = {
                    random = {
                        chance = 30 # Get both eaglets
                        add_character_flag = {
                            flag = mpo_events_ariana.0001.both_eaglets
                            days = 10
                        }
                    }
                }
                show_as_tooltip = {
                    add_prestige = medium_prestige_gain
                    add_trait_xp = {
                        trait = lifestyle_hunter
                        track = falconer
                        value = 10
                    }
                }
                custom_tooltip = mpo_events_ariana.0001.a_win_desc
                trigger_event = {
                    id = mpo_events_ariana.0002
                }
            }
            30 = {
                desc = travel_events_mpo.0001_lose
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -29
                }
                send_interface_toast = {
                    type = event_toast_effect_bad
                    title = travel_events_mpo.0001_lose
                    left_icon = root
                    add_prestige = minor_prestige_loss
                    random_list = {
                        50 = {
                            show_chance = no
                            desc = mpo_events_ariana.0001.a_lose_ok
                        }
                        50 = {
                            show_chance = no
                            desc = mpo_events_ariana.0001.a_lose_bad
                            change_trait_rank = {
                                trait = wounded
                                rank = 1
                                max = 3
                            }
                        }
                    }

                }
            }
        }

        ai_chance = {
            base = 15
            ai_value_modifier = {
                ai_energy = 0.7
            }
            modifier = {
                has_trait = lifestyle_hunter
                add = 5
            }
            modifier = {
                has_trait = brave
                add = 5
            }
            modifier = {
                has_trait = compassionate
                add = 5
            }
        }
    }

    option = { # Lure the eaglets
        name = mpo_events_ariana.0001.b
        trigger = {
            learning >= 10
        }
        show_as_unavailable = {
            always = yes
        }
        save_scope_value_as = {
            name = eagle_capture_method
            value = flag:lure
        }
        hidden_effect = {
            random_list = {
                50 = { }
                30 = { # Get both eaglets
                    modifier = { add = learning }
                    add_character_flag = {
                        flag = mpo_events_ariana.0001.both_eaglets
                        days = 10
                    }
                }
            }
        }
        show_as_tooltip = {
            add_prestige = medium_prestige_gain
            add_trait_xp = {
                trait = lifestyle_hunter
                track = falconer
                value = 10
            }
        }
        custom_tooltip = mpo_events_ariana.0001.b_win_desc

        trigger_event = {
            id = mpo_events_ariana.0002
        }

        ai_chance = {
            base = 15
            ai_value_modifier = {
                ai_rationality = 1
            }
            modifier = {
                has_trait = shrewd
                factor = 1.3
            }
            modifier = {
                has_trait = lifestyle_hunter
                add = 5
            }
            modifier = {
                has_trait = craven
                add = 5
            }
        }
    }

    option = { # Observe them
        name = mpo_events_ariana.0001.c
        stress_impact = {
            base = minor_stress_impact_loss
        }
        add_character_modifier = {
            modifier = mpo_daydreaming_birds_modifier
            years = 5
        }

        ai_chance = {
            base = 10
            modifier = {
                has_trait = compassionate
                add = 5
            }
            modifier = {
                has_trait = calm
                add = 5
            }
            modifier = {
                has_trait = content
                add = 10
            }
        }
    }
}

scripted_effect mpo_events_ariana_002_gift_effect = {
    save_scope_as = target
    root = {
        send_interface_toast = {
            type = event_toast_effect_good
            title = court_ongoing.1030.d.success
            left_icon = root
            right_icon = scope:target
            scope:target = {
                save_scope_value_as = {
                    name = eagle_capture_method
                    value = flag:gift
                }
                start_eagle_story_cycle_effect = yes
                add_opinion = {
                    target = root
                    modifier = grateful_opinion
                    opinion = 10
                }
            }
        }
    }
}

# Nest Sighting follow up - You've captured the eaglets, now what?
mpo_events_ariana.0002 = {
    type = character_event
    title = mpo_events_ariana.0001.t
    desc = {
        desc = mpo_events_ariana.0002.desc_intro
        first_valid = { # Describing the capture
            triggered_desc = {
                trigger = {
                    scope:eagle_capture_method = flag:standard
                }
                desc = mpo_events_ariana.0002.desc_standard
            }
            triggered_desc = {
                trigger = {
                    scope:eagle_capture_method = flag:lure
                }
                desc = mpo_events_ariana.0002.desc_lure
            }
        }
        first_valid = { # If the result is one or both
            triggered_desc = {
                trigger = {
                    scope:eagle_capture_method = flag:standard
                    has_character_flag = mpo_events_ariana.0001.both_eaglets
                }
                desc = mpo_events_ariana.0002.desc_both_standard
            }
            triggered_desc = {
                trigger = {
                    scope:eagle_capture_method = flag:standard
                }
                desc = mpo_events_ariana.0002.desc_one_standard
            }
            triggered_desc = {
                trigger = {
                    scope:eagle_capture_method = flag:lure
                    has_character_flag = mpo_events_ariana.0001.both_eaglets
                }
                desc = mpo_events_ariana.0002.desc_both_lure
            }
            triggered_desc = {
                trigger = {
                    scope:eagle_capture_method = flag:lure
                }
                desc = mpo_events_ariana.0002.desc_one_lure
            }
        }
    }

    theme = nomads

    left_portrait = {
        character = root
        animation = thinking
    }

    right_portrait = {
        trigger = {
            exists = scope:eagle_first_recipient
            scope:eagle_first_recipient = {
                NOT = { has_eagle_trigger = yes }
            }
        }
        character = scope:eagle_first_recipient
        animation = admiration
    }

    lower_center_portrait = {
        trigger = {
            exists = scope:eagle_second_recipient
            scope:eagle_second_recipient = {
                NOT = { has_eagle_trigger = yes }
            }
        }
        character = scope:eagle_second_recipient
    }

    trigger = {
		has_mpo_dlc_trigger = yes
        exists = scope:eagle_capture_method
        location = { geographical_region = world_steppe } 
        government_has_flag = government_is_nomadic
    }

    immediate = {
        add_prestige = medium_prestige_gain
        if = {
            limit = {
                NOT = {
                    has_trait = lifestyle_hunter
                }
            }
            add_trait = lifestyle_hunter
        }
        add_trait_xp = {
            trait = lifestyle_hunter
            track = falconer
            value = 10
        }

        # Looking for possible recipients
        # A romantic relation
        if = { # Find your main spouse first if you have one
            limit = {
                exists = primary_spouse
                primary_spouse = {
                    NOT = { has_eagle_trigger = yes }
                }
            }
            primary_spouse = { save_scope_as = eagle_first_recipient }
        }
        else_if = { # Maybe a concubine instead
            limit = {
                any_consort = {
                    NOT = { has_eagle_trigger = yes }
                }
            }
            random_consort = {
                limit = {
                    NOT = { has_eagle_trigger = yes }
                }
                save_scope_as = eagle_first_recipient
            }
        }
        else_if = { # Maybe a lover
            limit = {
                any_relation = {
                    type = lover
                    NOT = { has_eagle_trigger = yes }
                }
            }
            random_relation = {
                type = lover
                limit = {
                    NOT = { has_eagle_trigger = yes }
                }
                save_scope_as = eagle_first_recipient
            }
        }
        # Do I have a child or ward old enough to care for an eagle?
        if = {
            limit = {
                any_child = {
                    age >= 13
                    is_courtier_of = root
                    NOT = { has_eagle_trigger = yes }
                }
            }
            random_child = {
                limit = {
                    age >= 13
                    is_courtier_of = root
                    NOT = { has_eagle_trigger = yes }
                }
                if = {
                    limit = {
                        exists = scope:eagle_first_recipient
                    }
                    save_scope_as = eagle_second_recipient
                }
                else = {
                    save_scope_as = eagle_first_recipient
                }
            }
        }
        else_if = {
            limit = {
                any_relation = {
                    type = ward
                    age >= 13
                    NOT = { has_eagle_trigger = yes }
                }
            }
            random_relation = {
                type = ward
                limit = {
                    age >= 13
                    NOT = { has_eagle_trigger = yes }
                }
                if = {
                    limit = {
                        exists = scope:eagle_first_recipient
                    }
                    save_scope_as = eagle_second_recipient
                }
                else = {
                    save_scope_as = eagle_first_recipient
                }
            }
        }
        if = {
            limit = {
                NOT = { exists = scope:eagle_second_recipient } # If we already have a second recipient by now, we don't need to find another
            }
            if = { # Maybe a friend
                limit = {
                    any_relation = {
                        type = friend
                        age >= 13
                        NOT = { has_eagle_trigger = yes }
                    }
                }
                random_relation = {
                    type = friend
                    limit = {
                        age >= 13
                        NOT = { has_eagle_trigger = yes }
                    }
                    if = {
                        limit = {
                            exists = scope:eagle_first_recipient
                        }
                        save_scope_as = eagle_second_recipient
                    }
                    else = {
                        save_scope_as = eagle_first_recipient
                    }
                }
            }
            # Or a hunt guy?
            if = {
                limit = {
                    exists = court_position:master_of_hunt_court_position
                }
                court_position:master_of_hunt_court_position = {
                    if = {
                        limit = {
                            exists = scope:eagle_first_recipient
                        }
                        save_scope_as = eagle_second_recipient
                    }
                    else = {
                        save_scope_as = eagle_first_recipient
                    }
                }
            }
            else_if = {
                limit = {
                    exists = court_position:huntperson_camp_officer
                }
                court_position:huntperson_camp_officer = {
                    if = {
                        limit = {
                            exists = scope:eagle_first_recipient
                        }
                        save_scope_as = eagle_second_recipient
                    }
                    else = {
                        save_scope_as = eagle_first_recipient
                    }
                }
            }
        }
    }


    option = { # Keep the one for yourself
        name = mpo_events_ariana.0002.a
        trigger = {
            NOT = { has_character_flag = mpo_events_ariana.0001.both_eaglets }
            NOT = { has_eagle_trigger = yes } # You don't have an eagle
        }
        start_eagle_story_cycle_effect = yes

        ai_chance = {
            base = 200
        }
    }

    option = { # Give the one to your first recipient
        name = mpo_events_ariana.0002.b
        trigger = {
            exists = scope:eagle_first_recipient
            NOT = { has_character_flag = mpo_events_ariana.0001.both_eaglets }
            scope:eagle_first_recipient = {
                NOT = { has_eagle_trigger = yes }
            }
        }

        scope:eagle_first_recipient = {
            save_scope_as = target
            mpo_events_ariana_002_gift_effect = yes
        }

        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_compassion = 1
            }
            modifier = { # They already like you
                add = 50
                scope:eagle_first_recipient = {
                    opinion = {
                        target = root
                        value >= low_positive_opinion
                    }
                }
            }
            modifier = {
                add = 50
                any_relation = {
                    type = lover
                    this = scope:eagle_first_recipient
                }
            }
            modifier = {
                add = 25
                any_relation = {
                    type = friend
                    this = scope:eagle_first_recipient
                }
            }
        }
    }

    option = { # Keep one for yourself, and give the other to your first recipient
        name = mpo_events_ariana.0002.b_two
        trigger = {
            exists = scope:eagle_first_recipient
            has_character_flag = mpo_events_ariana.0001.both_eaglets
            NOT = { has_eagle_trigger = yes } # You don't have an eagle
            scope:eagle_first_recipient = {
                NOT = { has_eagle_trigger = yes }
            }
        }
        start_eagle_story_cycle_effect = yes
        scope:eagle_first_recipient = {
            save_scope_as = target
            mpo_events_ariana_002_gift_effect = yes
        }
        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_compassion = 1
            }
            modifier = { # They already like you
                add = 50
                scope:eagle_first_recipient = {
                    opinion = {
                        target = root
                        value >= low_positive_opinion
                    }
                }
            }
            modifier = {
                add = 50
                any_relation = {
                    type = lover
                    this = scope:eagle_first_recipient
                }
            }
            modifier = {
                add = 25
                any_relation = {
                    type = friend
                    this = scope:eagle_first_recipient
                }
            }
        }
    }

    option = { # Give the one to your second recipient
        name = mpo_events_ariana.0002.c
        trigger = {
            exists = scope:eagle_second_recipient
            NOT = { has_character_flag = mpo_events_ariana.0001.both_eaglets }
            scope:eagle_second_recipient = {
                NOT = { has_eagle_trigger = yes }
            }
        }
        scope:eagle_second_recipient = {
            save_scope_as = target
            mpo_events_ariana_002_gift_effect = yes
        }
        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_compassion = 1
            }
            modifier = { # They already like you
                add = 50
                scope:eagle_second_recipient = {
                    opinion = {
                        target = root
                        value >= low_positive_opinion
                    }
                }
            }
            modifier = {
                add = 50
                any_relation = {
                    type = lover
                    this = scope:eagle_second_recipient
                }
            }
            modifier = {
                add = 25
                any_relation = {
                    type = friend
                    this = scope:eagle_second_recipient
                }
            }
        }
    }

    option = { # Keep one for yourself, and give the other to your second recipient
        name = mpo_events_ariana.0002.c_two
        trigger = {
            exists = scope:eagle_second_recipient
            has_character_flag = mpo_events_ariana.0001.both_eaglets
            NOT = { has_eagle_trigger = yes } # You don't have an eagle
            scope:eagle_second_recipient = {
                NOT = { has_eagle_trigger = yes }
            }
        }
        start_eagle_story_cycle_effect = yes
        scope:eagle_second_recipient = {
            save_scope_as = target
            mpo_events_ariana_002_gift_effect = yes
        }
        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_compassion = 1
            }
            modifier = { # They already like you
                add = 50
                scope:eagle_second_recipient = {
                    opinion = {
                        target = root
                        value >= low_positive_opinion
                    }
                }
            }
            modifier = {
                add = 50
                any_relation = {
                    type = lover
                    this = scope:eagle_second_recipient
                }
            }
            modifier = {
                add = 25
                any_relation = {
                    type = friend
                    this = scope:eagle_second_recipient
                }
            }
        }
    }

    option = { # Give to each recipient
        name = mpo_events_ariana.0002.d
        trigger = {
            exists = scope:eagle_first_recipient
            exists = scope:eagle_second_recipient
            has_character_flag = mpo_events_ariana.0001.both_eaglets
            scope:eagle_second_recipient = {
                NOT = { has_eagle_trigger = yes }
            }
            scope:eagle_first_recipient = {
                NOT = { has_eagle_trigger = yes }
            }
        }
        scope:eagle_first_recipient = {
            save_scope_as = target
            mpo_events_ariana_002_gift_effect = yes
        }
        scope:eagle_second_recipient = {
            save_scope_as = target
            mpo_events_ariana_002_gift_effect = yes
        }
        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_compassion = 2
                ai_honor = 1
            }
            modifier = {
                add = 50
                scope:eagle_first_recipient = {
                    opinion = {
                        target = root
                        value >= low_positive_opinion
                    }
                }
            }
            modifier = {
                add = 50
                scope:eagle_second_recipient = {
                    opinion = {
                        target = root
                        value >= low_positive_opinion
                    }
                }
            }
            modifier = {
                add = 50
                any_relation = {
                    type = lover
                    this = scope:eagle_first_recipient
                }
            }
            modifier = {
                add = 25
                any_relation = {
                    type = friend
                    this = scope:eagle_first_recipient
                }
            }
            modifier = {
                add = 50
                any_relation = {
                    type = lover
                    this = scope:eagle_second_recipient
                }
            }
            modifier = {
                add = 25
                any_relation = {
                    type = friend
                    this = scope:eagle_second_recipient
                }
            }
        }
    }

    option = { # Keep one, sell one
        name = mpo_events_ariana.0002.e
        trigger = {
            has_character_flag = mpo_events_ariana.0001.both_eaglets
            NOT = { has_eagle_trigger = yes } # You don't have an eagle
        }
        send_interface_toast = {
            title = mpo_events_ariana.0002.e_tt
            type = event_toast_effect_good
            left_icon = root
            start_eagle_story_cycle_effect = yes
            add_short_term_gold = medium_gold_value
            if = {
                limit = {
                    exists = scope:eagle_first_recipient
                    scope:eagle_first_recipient = {
                        NOT = { has_eagle_trigger = yes }
                    }
                }
                reverse_add_opinion = {
                    target = scope:eagle_first_recipient
                    modifier = disappointed_opinion
                    opinion = -10
                }
            }
            if = {
                limit = {
                    exists = scope:eagle_second_recipient
                    scope:eagle_second_recipient = {
                        NOT = { has_eagle_trigger = yes }
                    }
                }
                reverse_add_opinion = {
                    target = scope:eagle_second_recipient
                    modifier = disappointed_opinion
                    opinion = -10
                }
            }
        }

        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_greed = 1
            }
            modifier = {
                add = 50
                scope:eagle_first_recipient ?= {
                    opinion = {
                        target = root
                        value <= low_positive_opinion
                    }
                }
            }
            modifier = {
                add = 50
                scope:eagle_second_recipient ?= {
                    opinion = {
                        target = root
                        value <= low_positive_opinion
                    }
                }
            }
        }
    }

    option = { # Give one to first recipient, sell one (only if you have one already)
        name = mpo_events_ariana.0002.e_sell_first
        trigger = {
            has_character_flag = mpo_events_ariana.0001.both_eaglets
            exists = scope:eagle_first_recipient
            has_eagle_trigger = yes
            scope:eagle_first_recipient = {
                NOT = { has_eagle_trigger = yes }
            }
        }
        scope:eagle_first_recipient = {
            save_scope_as = target
            mpo_events_ariana_002_gift_effect = yes
        }
        custom_tooltip = mpo_events_ariana.0002.e_tt
        add_short_term_gold = medium_gold_value

        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_compassion = 1
                ai_greed = 0.8
            }
            modifier = {
                add = 50
                scope:eagle_first_recipient = {
                    opinion = {
                        target = root
                        value >= low_positive_opinion
                    }
                }
            }
            modifier = {
                add = 50
                any_relation = {
                    type = lover
                    this = scope:eagle_first_recipient
                }
            }
            modifier = {
                add = 25
                any_relation = {
                    type = friend
                    this = scope:eagle_first_recipient
                }
            }
        }
    }

    option = { # Give one to second recipient, sell one (only if you have one already)
        name = mpo_events_ariana.0002.e_sell_second
        trigger = {
            has_character_flag = mpo_events_ariana.0001.both_eaglets
            exists = scope:eagle_second_recipient
            has_eagle_trigger = yes
            scope:eagle_second_recipient = {
                NOT = { has_eagle_trigger = yes }
            }
        }
        scope:eagle_second_recipient = {
            save_scope_as = target
            mpo_events_ariana_002_gift_effect = yes
        }
        custom_tooltip = mpo_events_ariana.0002.e_tt
        add_short_term_gold = medium_gold_value

        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_compassion = 1
                ai_greed = 0.8
            }
            modifier = {
                add = 50
                scope:eagle_second_recipient = {
                    opinion = {
                        target = root
                        value >= low_positive_opinion
                    }
                }
            }
            modifier = {
                add = 50
                any_relation = {
                    type = lover
                    this = scope:eagle_second_recipient
                }
            }
            modifier = {
                add = 25
                any_relation = {
                    type = friend
                    this = scope:eagle_second_recipient
                }
            }
        }
    }

    option = { # Sell the one (or both)
        name = {
            text = {
                first_valid = {
                    triggered_desc = {
                        trigger = {
                            has_character_flag = mpo_events_ariana.0001.both_eaglets
                        }
                        desc = mpo_events_ariana.0002.f_two
                    }
                    desc = mpo_events_ariana.0002.f_one
                }
            }
        }


        if = {
            limit = {
                has_character_flag = mpo_events_ariana.0001.both_eaglets
            }
            send_interface_toast = {
                title = mpo_events_ariana.0002.f_tt_two
                type = event_toast_effect_good
                add_short_term_gold = major_gold_value
                if = {
                    limit = {
                        exists = scope:eagle_first_recipient
                        scope:eagle_first_recipient = {
                            NOT = { has_eagle_trigger = yes }
                        }
                    }
                    reverse_add_opinion = {
                        target = scope:eagle_first_recipient
                        modifier = disappointed_opinion
                        opinion = -15
                    }
                }
                if = {
                    limit = {
                        exists = scope:eagle_second_recipient
                        scope:eagle_second_recipient = {
                            NOT = { has_eagle_trigger = yes }
                        }
                    }
                    reverse_add_opinion = {
                        target = scope:eagle_second_recipient
                        modifier = disappointed_opinion
                        opinion = -15
                    }
                }
                left_icon = root
            }

        }
        else = {
            send_interface_toast = {
                title = mpo_events_ariana.0002.f_tt
                type = event_toast_effect_good
                add_short_term_gold = medium_gold_value
                if = {
                    limit = {
                        exists = scope:eagle_first_recipient
                        scope:eagle_first_recipient = {
                            NOT = { has_eagle_trigger = yes }
                        }
                    }
                    reverse_add_opinion = {
                        target = scope:eagle_first_recipient
                        modifier = disappointed_opinion
                        opinion = -15
                    }
                }
                if = {
                    limit = {
                        exists = scope:eagle_second_recipient
                        scope:eagle_second_recipient = {
                            NOT = { has_eagle_trigger = yes }
                        }
                    }
                    reverse_add_opinion = {
                        target = scope:eagle_second_recipient
                        modifier = disappointed_opinion
                        opinion = -15
                    }
                }
                left_icon = root
            }
        }

        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_greed = 1
            }
            modifier = {
                add = 50
                scope:eagle_second_recipient ?= {
                    opinion = {
                        target = root
                        value <= low_positive_opinion
                    }
                }
            }
            modifier = {
                add = 50
                scope:eagle_first_recipient ?= {
                    opinion = {
                        target = root
                        value <= low_positive_opinion
                    }
                }
            }
        }
    }
}

# The Fire Inside - Your heir wants to convert to a different faith in your realm
mpo_events_ariana.0010 = {
    type = character_event
    title = mpo_events_ariana.0010.t

    desc = {
        desc = mpo_events_ariana.0010.desc
        triggered_desc = {
            trigger = {
                has_trait = zealous
            }
            desc = mpo_events_ariana.0010.desc_zealous
        }
    }

    theme = faith
    override_background = { reference = throne_room }

    left_portrait = {
        character = root
        triggered_animation = {
            trigger = { has_trait = zealous }
            animation = disapproval
        }
        animation = personality_rational
    }

    right_portrait = {
        character = scope:converting_heir
        animation = worry
    }

    cooldown = { years = 50 }

    weight_multiplier = {
        base = 1
        modifier = {
            add = 10
            scope:converting_heir = { has_trait = fickle }
        }
    }

    trigger = {
		has_mpo_dlc_trigger = yes
        is_available_adult = yes
        location = { geographical_region = world_steppe }
        government_has_flag = government_is_nomadic
        exists = scope:converting_heir
        scope:converting_heir = {
            NOT = { has_trait = zealous }
            faith = scope:old_faith
            is_available_adult = yes
        }
        exists = scope:new_faith
    }

    immediate = {
        player_heir ?= { save_scope_as = converting_heir }

        faith = { save_scope_as = old_faith }

        every_sub_realm_county = {
            limit = {
                NOR = {
                    faith = scope:old_faith
                    faith = scope:converting_heir.faith
                }
            }
            save_scope_as = possible_faith_county
            root = {
                add_to_variable_list = {
                    name = possible_faiths
                    target = scope:possible_faith_county.faith
                }
            }
        }

        # Find a faith to convert to
        ordered_in_list = {
            variable = possible_faiths
            order_by = {
                value = 0
                # Do not convert to a Righteous faith
                if = {
                    limit = {
                        faith_hostility_level = {
                            target = scope:old_faith
                            value = faith_fully_accepted_level
                        }
                    }
                    add = -1
                }
                else_if = {
                    limit = {
                        faith_hostility_level = {
                            target = scope:old_faith
                            value = faith_astray_level
                        }
                    }
                    add = 3
                }
                else_if = {
                    limit = {
                        faith_hostility_level = {
                            target = scope:old_faith
                            value = faith_hostile_level
                        }
                    }
                    add = 2
                }
                else_if = {
                    limit = {
                        faith_hostility_level = {
                            target = scope:old_faith
                            value = faith_evil_level
                        }
                    }
                    add = 1
                }
            }
            save_scope_as = new_faith
        }
    }

    option = { # Accept the conversion
        name = {
            text = {
                first_valid = {
                    triggered_desc = {
                        trigger = {
                            has_trait = zealous
                        }
                        desc = mpo_events_ariana.0010.a_zealous
                    }
                    desc = mpo_events_ariana.0010.a
                }
            }
        }

        scope:converting_heir = {
            set_character_faith = scope:new_faith
        }

        set_character_faith = scope:new_faith
        stress_impact = {
            zealous = major_stress_impact_gain
            eccentric = minor_stress_impact_loss
            cynical = minor_stress_impact_loss
            stubborn = medium_stress_impact_gain
        }
        scope:converting_heir = {
            add_opinion = {
                target = root
                modifier = grateful_opinion
                opinion = 25
            }
        }


        ai_chance = {
            base = 50
            ai_value_modifier = {
                ai_boldness = 0.1
                ai_zeal = -1.5
            }
            modifier = {
                factor = 1
                scope:old_faith = {
                    faith_hostility_level = {
                        target = scope:new_faith
                        value >= faith_astray_level
                    }
                }
            }
            modifier = {
                factor = 0.5
                scope:old_faith = {
                    faith_hostility_level = {
                        target = scope:new_faith
                        value = faith_hostile_level
                    }
                }
            }
            modifier = {
                factor = 0.25
                scope:old_faith = {
                    faith_hostility_level = {
                        target = scope:new_faith
                        value = faith_evil_level
                    }
                }
            }
        }
    }

    option = { # Accept it, but secretly continue to practice the old faith
        name = {
            text = {
                first_valid = {
                    triggered_desc = {
                        trigger = {
                            has_trait = zealous
                        }
                        desc = mpo_events_ariana.0010.b_zealous
                    }
                    desc = mpo_events_ariana.0010.b
                }
            }
        }

        trigger = {
            NOT = { any_secret = { secret_type = secret_crypto_religionist } }
            untrustworthy_trigger = yes
        }

        scope:converting_heir = {
            set_character_faith = scope:new_faith
        }

        custom_tooltip = mpo_events_ariana.0010.b.tt

        hidden_effect = {
            set_character_faith = scope:new_faith
        }
        show_as_tooltip = {
            add_secret = {
                type = secret_crypto_religionist
            }
        }
        stress_impact = {
            honest = medium_stress_impact_gain
            zealous = minor_stress_impact_gain
            deceitful = minor_stress_impact_loss
        }
        scope:converting_heir = {
            add_opinion = {
                target = root
                modifier = grateful_opinion
                opinion = 25
            }
        }

        hidden_effect = {
            make_character_crypto_religionist_effect = { CRYPTO_RELIGION = scope:old_faith }
        }

        ai_chance = {
            base = 50
            ai_value_modifier = {
                ai_zeal = -0.5
                ai_honor = -1
            }
        }
    }

    option = { # Reject the conversion
        name = {
            text = {
                first_valid = {
                    triggered_desc = {
                        trigger = {
                            has_trait = zealous
                        }
                        desc = mpo_events_ariana.0010.c_zealous
                    }
                    triggered_desc = {
                        trigger = {
                            has_trait = cynical
                        }
                        desc = mpo_events_ariana.0010.c_cynical
                    }
                    desc = mpo_events_ariana.0010.c
                }
            }
        }

        add_piety = medium_piety_gain

        hidden_effect = {
            if = {
                limit = {
                    NOT = { has_trait = zealous }
                }
                add_piety = medium_piety_gain
                scope:converting_heir = {
                    add_opinion = {
                        target = root
                        modifier = hurt_opinion
                        opinion = -25
                    }
                }
            }
            else = {
                add_piety = medium_piety_gain
                scope:converting_heir = {
                    add_opinion = {
                        target = root
                        modifier = disappointed_opinion
                        opinion = -15
                    }
                }
            }
        }

        scope:converting_heir = {
            set_character_faith = scope:new_faith
        }

        ai_chance = {
            base = 75
            ai_value_modifier = {
                ai_zeal = 1
                ai_rationality = 1
            }
        }
    }

    option = {
        name = mpo_events_ariana.0010.d
        trigger = {
            has_trait = zealous
        }
        custom_tooltip = mpo_events_ariana.0010.d_tt
        duel = {
            skill = learning
            target = scope:converting_heir
            60 = {
                desc = mpo_events_ariana.0010.d_success
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -59
                }
                send_interface_toast = {
                    title = mpo_events_ariana.0010.d_success
                    type = event_toast_effect_good
                    left_icon = root
                    right_icon = scope:converting_heir
                    add_piety = major_piety_gain
                }
            }
            40 = {
                desc = mpo_events_ariana.0010.d_failure
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = 39
                }
                send_interface_toast = {
                    title = mpo_events_ariana.0010.d_failure
                    type = event_toast_effect_bad
                    left_icon = root
                    right_icon = scope:converting_heir
                    scope:converting_heir = {
                        set_character_faith = scope:new_faith
                    }
                    add_stress = minor_stress_gain
                }
            }
        }

        ai_chance = {
            base = 75
            ai_value_modifier = {
                ai_zeal = 1
                ai_rationality = 1
            }
            modifier = {
                factor = 1.5
                highest_skill = learning
            }
            modifier = {
                factor = 0.5
                learning <= scope:converting_heir.learning
            }
        }
    }

    after = {
        clear_variable_list = possible_faiths
    }
}

scripted_trigger is_valid_spouse_mpo_events_ariana_0020 = {
    probably_superstitious = yes
    is_available_adult = yes
    culture = root.culture
}

scripted_trigger is_valid_councillor_mpo_events_ariana_0020 = {
    NOT = { culture = root.culture }
    culture = {
        cultural_acceptance = { target = root.culture value <= 75 }
    }
}

# Untrustworthy - A spouse is suspicious of a councillor that has a different culture
mpo_events_ariana.0020 = {
    type = character_event
    title = mpo_events_ariana.0020.t
    desc = {
        desc = mpo_events_ariana.0020.desc_intro
        first_valid = {
            triggered_desc = {
                trigger = {
                    scope:sus_councillor = { is_kurultai_trigger = yes }
                }
                desc = mpo_events_ariana.0020.desc_marshal
            }
            triggered_desc = {
                trigger = {
                    scope:sus_councillor = { has_council_position = councillor_spymaster }
                }
                desc = mpo_events_ariana.0020.desc_spymaster
            }
        }
        desc = mpo_events_ariana.0020.desc_end
    }

    theme = court
    override_background = { reference = study }

    left_portrait = {
        character = root
        animation = disbelief
    }

    right_portrait = {
        character = scope:worried_spouse
        animation = worry
    }

    lower_center_portrait = scope:sus_councillor

    cooldown = { years = 10 }

    weight_multiplier = {
        base = 1
        modifier = {
            factor = 0.5
            scope:worried_spouse ?= { has_personality_levelheaded_trigger = yes }
        }
    }

    trigger = {
		has_mpo_dlc_trigger = yes
        is_available_adult = yes
        location = { geographical_region = world_steppe }  
        government_has_flag = government_is_nomadic
        any_spouse = { is_valid_spouse_mpo_events_ariana_0020 = yes }
        any_councillor = { is_valid_councillor_mpo_events_ariana_0020 = yes }
    }

    immediate = {
        random_spouse = {
            limit = {
                is_valid_spouse_mpo_events_ariana_0020 = yes
            }
            save_scope_as = worried_spouse
        }
        random_councillor = {
            limit = {
                is_valid_councillor_mpo_events_ariana_0020 = yes
            }
            save_scope_as = sus_councillor
        }
        scope:sus_councillor.culture = {
            save_scope_as = councillor_culture
        }
    }

    option = { # No worries, they'll be gone
        name = mpo_events_ariana.0020.a
        fire_councillor = scope:sus_councillor
        show_as_tooltip = {
            scope:sus_councillor = {
                add_opinion = {
                    target = root
                    modifier = fired_from_council_opinion
                    opinion = -20
                }
            }
        }
        scope:worried_spouse = {
            add_opinion = {
                target = root
                modifier = grateful_opinion
                opinion = 30
            }
        }
        culture = {
            change_cultural_acceptance = {
                target = scope:councillor_culture
                value = low_negative_culture_acceptance
                desc = cultural_acceptance_gain_event
            }
        }
        custom_tooltip = mpo_events_ariana.0020.a_tt
        hidden_effect = {
            every_vassal = {
                limit = {
                    culture = scope:councillor_culture
                }
                add_opinion = {
                    target = root
                    modifier = disappointed_opinion
                    opinion = -10
                }
            }
        }

        stress_impact = {
            honest = minor_stress_impact_gain
            paranoid = medium_stress_impact_loss
        }

        ai_chance = {
            base = 50
            ai_value_modifier = {
                ai_compassion = 0.5
                ai_honor = 0.5
            }
            modifier = {
                factor = 1.5
                has_trait = paranoid
            }
            opinion_modifier = { opinion_target = scope:worried_spouse multiplier = 1.5 }
            opinion_modifier = { opinion_target = scope:sus_councillor multiplier = 0.5 }
        }
    }

    option = { # I suppose I can be more careful
        name = mpo_events_ariana.0020.b
        scope:worried_spouse = {
            add_opinion = {
                target = root
                modifier = disappointed_opinion
                opinion = -5
            }
        }
        add_character_modifier = {
            modifier = cultural_suspicion_modifier
            years = 5
        }

        stress_impact = {
            paranoid = minor_stress_impact_loss
        }

        ai_chance = {
            base = 75
            ai_value_modifier = {
                ai_rationality = 1
            }
            modifier = {
                factor = 1.5
                has_trait = paranoid
            }
            opinion_modifier = { opinion_target = scope:worried_spouse multiplier = 1.5 }
        }
    }

    option = { # They're fine...
        name = {
            text = {
                first_valid = {
                    triggered_desc = {
                        trigger = {
                            scope:worried_spouse = { has_trait = paranoid }
                        }
                        desc = mpo_events_ariana.0020.c_paranoid
                    }
                    desc = mpo_events_ariana.0020.c
                }
            }
        }
        add_prestige = minor_prestige_gain
        scope:worried_spouse = {
            add_opinion = {
                target = root
                modifier = angry_opinion
                opinion = -20
            }
        }
        scope:sus_councillor = {
            add_opinion = {
                target = root
                modifier = grateful_opinion
                opinion = 15
            }
        }
        culture = {
            change_cultural_acceptance = {
                target = scope:councillor_culture
                value = low_positive_culture_acceptance
                desc = cultural_acceptance_gain_event
            }
        }
        custom_tooltip = mpo_events_ariana.0020.c_tt
        hidden_effect = {
            every_vassal = {
                limit = {
                    culture = scope:councillor_culture
                }
                add_opinion = {
                    target = root
                    modifier = pleased_opinion
                    opinion = 10
                }
            }
        }

        stress_impact = {
            paranoid = medium_stress_impact_gain
        }

        ai_chance = {
            base = 75
            ai_value_modifier = {
                ai_rationality = 1
            }
            modifier = {
                factor = 1.5
                has_personality_levelheaded_trigger = yes
            }
            opinion_modifier = { opinion_target = scope:worried_spouse multiplier = 0.5 }
            modifier = {
                factor = 1.3
                scope:worried_spouse = { has_trait = paranoid }
            }
        }
    }
}

# Forbidden Drinks - Someone is selling sus drinks at your feast
mpo_events_ariana.0030 = {
    type = activity_event
    title = mpo_events_ariana.0030.t
    desc = mpo_events_ariana.0030.desc

    theme = feast_activity

    left_portrait = {
        character = root
        animation = stress
    }

    lower_center_portrait = scope:bartender

    right_portrait = {
        character = scope:spymaster
        animation = disapproval
    }

    cooldown = { years = 15 }

    trigger = {
		has_mpo_dlc_trigger = yes
        is_adult = yes
        is_landed = yes
        location = { geographical_region = world_steppe } 
        government_has_flag = government_is_nomadic
        involved_activity = {
            any_attending_character = {
                is_lowborn = yes
                is_adult = yes
            }
        }
    }

    weight_multiplier = {
        base = 1
        modifier = {
            factor = 1.5
            involved_activity = {
                has_activity_option = {
                    category = special_type
                    option = feast_type_tsagaan_sar
                }
            }
        }
    }

    immediate = {
        if = {
            limit = {
                involved_activity = {
                    any_attending_character = {
                        is_lowborn = no
                        NOT = { this = root }
                        has_council_position = councillor_spymaster
                    }
                }
            }
            cp:councillor_spymaster = {
                save_scope_as = spymaster
            }
        }
        else = {
            involved_activity = {
                ordered_attending_character = {
                    limit = {
                        is_lowborn = no
                        NOT = { this = root }
                    }
                    order_by = intrigue
                    save_scope_as = spymaster
                }
            }
        }
        involved_activity = {
            random_attending_character = {
                limit = {
                    is_lowborn = yes
                    NOT = { this = root }
                }
                save_scope_as = bartender
            }
        }
    }

    option = { # Ok go to jail
        name = mpo_events_ariana.0030.jail
        custom_tooltip = mpo_events_ariana.0030.jail_effect
        rightfully_imprison_character_less_verbose_effect = {
            TARGET = scope:bartender
            IMPRISONER = root
        }

        add_dread = minor_dread_gain

        stress_impact = {
            just = minor_stress_impact_loss
            sadistic = minor_stress_impact_loss
        }

        custom_tooltip = {
            text = mpo_events_ariana.0030.jail_tt
            involved_activity = {
                every_attending_character = {
                    limit = {
                        is_lowborn = no
                        NOT = { this = root }
                    }
                    add_opinion = {
                        modifier = pleased_opinion
                        target = root
                        opinion = 10
                    }
                }
            }
        }

        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_honor = 0.5
            }
            modifier = {
                has_trait = gregarious
                factor = 0.5
            }
        }
    }

    option = { # Don't care
        name = mpo_events_ariana.0030.ignore
        custom_tooltip = mpo_events_ariana.0030.ignore_effect

        location.county = {
            add_county_modifier = {
                modifier = buzzed_peasants_county_modifier
                years = 3
            }
        }

        scope:bartender = {
            add_opinion = {
                target = root
                modifier = grateful_opinion
                opinion = 10
            }
        }

        custom_tooltip = {
            text = mpo_events_ariana.0030.ignore_tt
            involved_activity = {
                every_attending_character = {
                    limit = {
                        is_lowborn = no
                        NOT = { this = root }
                    }
                    add_opinion = {
                        modifier = disappointed_opinion
                        target = root
                        opinion = -10
                    }
                }
            }
        }

        custom_tooltip = {
            text = mpo_events_ariana.0030.ignore_tt_lowborn
            involved_activity = {
                every_attending_character = {
                    limit = {
                        is_lowborn = yes
                    }
                    add_opinion = {
                        modifier = pleased_opinion
                        target = root
                        opinion = 10
                    }
                }
            }
        }

        stress_impact = {
            base = minor_stress_impact_loss
            compassionate = minor_stress_impact_loss
            gregarious = minor_stress_impact_loss
        }

        ai_chance = {
            base = 75
            ai_value_modifier = {
                ai_compassion = 0.5
            }
            modifier = {
                has_trait = gregarious
                factor = 1
            }
        }
    }

    option = { # Let them go, but only if you get some of the cut
        name = mpo_events_ariana.0030.greedy
        trigger = {
            has_trait = greedy
        }
        custom_tooltip = mpo_events_ariana.0030.greedy_tt

        add_stress = medium_stress_loss
        add_short_term_gold = minor_gold_value
        add_character_modifier = {
            modifier = kumi_tax_modifier
            years = 2
        }

        scope:bartender = {
            add_opinion = {
                target = root
                modifier = annoyed_opinion
                opinion = -5
            }
        }

        scope:spymaster = {
            add_opinion = {
                target = root
                modifier = disappointed_opinion
                opinion = -15
            }
        }

        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_greed = 1
            }
        }
    }
}

scripted_trigger is_valid_lover_mpo_events_ariana_0040 = {
    is_ai = yes
    is_adult = yes
    NOR = {
        is_spouse_of = root
        has_relation_lover = root
        has_trait = celibate
        is_eunuch_trigger = yes
    }
    OR = {
        is_sibling_of = root
        has_relation_rival = root
    }
    is_attracted_to_gender_of = root
    root = { is_attracted_to_gender_of = prev }
}


# Unmasked - You flirt with an masked person at an event
mpo_events_ariana.0040 = {
    type = activity_event
    title = {
        first_valid = {
            triggered_desc = {
                trigger = {
                    involved_activity = { has_activity_type = activity_feast }
                }
                desc = mpo_events_ariana.0040.title_feast
            }
            triggered_desc = {
                trigger = {
                    involved_activity = { has_activity_type = activity_wedding }
                }
                desc = mpo_events_ariana.0040.title_wedding
            }
            triggered_desc = {
                trigger = {
                    involved_activity = { has_activity_type = activity_camp_party }
                }
                desc = mpo_events_ariana.0040.title_camp_party
            }
        }
    }
    desc = {
        first_valid = {
            triggered_desc = {
                trigger = {
                    OR = {
                        involved_activity = { has_activity_type = activity_feast }
                        involved_activity = { has_activity_type = activity_wedding }
                    }
                }
                desc = mpo_events_ariana.0040.desc_wedding_feast
            }
            triggered_desc = {
                trigger = {
                    involved_activity = { has_activity_type = activity_camp_party }
                }
                desc = mpo_events_ariana.0040.desc_camp_party
            }
        }
    }

    theme = love
    override_background = {
        trigger = {
            OR = {
                involved_activity ?= { has_activity_type = activity_feast }
                involved_activity ?= { has_activity_type = activity_wedding }
            }
        }
        reference = corridor_night
    }
    override_background = {
        trigger = {
            involved_activity ?= { has_activity_type = activity_camp_party }
        }
        reference = bp1_bonfire
    }

    left_portrait = {
        character = root
        animation = flirtation
    }

    right_portrait = {
        trigger = {
            exists = scope:talker
        }
        character = scope:talker
        animation = happiness
    }

    cooldown = { years = 50 }

    trigger = {
		has_mpo_dlc_trigger = yes
        is_adult = yes
        location = { geographical_region = world_steppe } 
        government_has_flag = government_is_nomadic
        involved_activity ?= {
            any_attending_character = {
                is_valid_lover_mpo_events_ariana_0040 = yes
            }
        }
        OR = {
            involved_activity ?= { has_activity_type = activity_feast }
            involved_activity ?= { has_activity_type = activity_wedding }
            involved_activity ?= { has_activity_type = activity_camp_party }
        }
        NOT = {
            has_trait = celibate
            is_eunuch_trigger = yes
        }
    }

    weight_multiplier = {
        base = 1
        modifier = {
            add = -0.3
            num_of_relation_lover > 1
        }
        modifier = {
            add = 0.5
            has_trait = rakish
        }
        modifier = {
            add = 1
            has_trait = lustful
        }
        modifier = {
            add = -0.5
            any_spouse = {
                reverse_opinion = {
                    target = root
                    value >= 60
                }
            }
        }
        modifier = {
            add = -0.4
            any_spouse = {
                reverse_has_opinion_modifier = {
                    target = root
                    modifier = love_opinion
                }
            }
        }
    }

    immediate = {
        involved_activity = { save_scope_as = activity }
        involved_activity = {
            every_attending_character = {
                limit = {
                    is_valid_lover_mpo_events_ariana_0040 = yes
                }
                save_scope_as = possible_lover
                root = {
                    add_to_variable_list = {
                        name = possible_lovers
                        target = scope:possible_lover
                    }
                }
                if = {
                    limit = {
                        involved_activity = {
                            any_attending_character = { is_spouse_of = scope:possible_lover }
                        }
                    }
                    involved_activity = {
                        every_attending_character = {
                            limit = { is_spouse_of = scope:possible_lover }
                            save_scope_as = possible_lover_spouse
                            root = {
                                add_to_variable_list = {
                                    name = possible_lovers
                                    target = scope:possible_lover_spouse
                                }
                            }
                        }
                    }
                }
            }
        }
        # Find a person
        ordered_in_list = {
            variable = possible_lovers
            order_by = {
                value = 1
                add = intrigue
                if = {
                    limit = {
                        matching_gender_and_sexuality_trigger = {
                            CHARACTER_1 = root
                            CHARACTER_2 = this
                        }
                    }
                    add = 10
                }
                if = {
                    limit = {
                        has_trait = beauty_good
                    }
                    add = 5
                }
                if = {
                    limit = {
                        has_trait = intellect_good
                    }
                    add = 5
                }
                if = {
                    limit = {
                        any_spouse = {
                            count = 0
                        }
                    }
                    add = 3
                }
                if = {
                    limit = {
                        OR = {
                            has_trait = lustful
                            has_trait = rakish
                        }
                    }
                    add = 5
                }
            }
            save_scope_as = masked_guest
        }
        clear_variable_list = possible_lovers
        if = {
            limit = {
                involved_activity = { has_activity_type = activity_camp_party }
                exists = scope:masked_guest
            }
            involved_activity = {
                random_attending_character = {
                    limit = {
                        NOT = { this = root }
                        NOT = { this = scope:masked_guest }
                    }
                    save_scope_as = talker
                }
            }
        }
    }

    option = {
        name = mpo_events_ariana.0040.a

        custom_tooltip = mpo_events_ariana.0040.a_tt
        trigger_event = mpo_events_ariana.0041

        stress_impact = {
            base = minor_stress_impact_loss
            lustful = minor_stress_impact_loss
            chaste = medium_stress_impact_gain
        }
    }

    option = {
        name = mpo_events_ariana.0040.b
        trigger = {
            OR = {
                has_trait = chaste
                has_trait = shy
            }
        }
        add_prestige = miniscule_prestige_loss

        stress_impact = {
            base = minor_stress_impact_loss
        }
    }
}

# Unmasked follow up - You find out who the masked person was
mpo_events_ariana.0041 = {
    type = activity_event
    title = mpo_events_ariana.0041.title
    desc = {
        first_valid = {
            triggered_desc = {
                trigger = {
                    OR = {
                        involved_activity = { has_activity_type = activity_feast }
                        involved_activity = { has_activity_type = activity_wedding }
                    }
                }
                desc = mpo_events_ariana.0041.desc_wedding_feast
            }
            triggered_desc = {
                trigger = {
                    involved_activity = { has_activity_type = activity_camp_party }
                }
                desc = mpo_events_ariana.0041.desc_camp_party
            }
        }
        desc = mpo_events_ariana.0041.desc_middle
        first_valid = {
            triggered_desc = {
                trigger = {
                    has_relation_rival = scope:masked_guest
                }
                desc = mpo_events_ariana.0041.desc_rival
            }
            triggered_desc = {
                trigger = {
                    OR = {
                        is_sibling_of = scope:masked_guest
                        is_child_of = scope:masked_guest
                        scope:masked_guest = { is_child_of = root }
                    }
                }
                desc = mpo_events_ariana.0041.desc_family
            }
            triggered_desc = {
                trigger = {
                    scope:masked_guest = {
                        any_spouse = {
                            OR = {
                                is_sibling_of = scope:masked_guest
                                is_child_of = scope:masked_guest
                                scope:masked_guest = { is_child_of = root }
                            }
                        }
                    }
                }
                desc = mpo_events_ariana.0041.desc_family_spouse
            }
            triggered_desc = {
                trigger = {
                    scope:masked_guest = {
                        any_spouse = {
                            has_relation_rival = root
                        }
                    }
                }
                desc = mpo_events_ariana.0041.desc_rival_spouse
            }
        }
        desc = mpo_events_ariana.0041.desc_outro
        triggered_desc = {
            trigger = {
                OR = {
                    is_sibling_of = scope:masked_guest
                    is_child_of = scope:masked_guest
                    scope:masked_guest = { is_child_of = root }
                }
            }
            desc = mpo_events_ariana.0041.desc_family_outro
        }
    }

    theme = love
    override_background = {
        trigger = {
            OR = {
                involved_activity ?= { has_activity_type = activity_feast }
                involved_activity ?= { has_activity_type = activity_wedding }
            }
        }
        reference = bedchamber
    }
    override_background = {
        trigger = {
            involved_activity ?= { has_activity_type = activity_camp_party }
        }
        reference = bp1_bonfire
    }

    left_portrait = {
        character = root
        animation = shock
    }

    lower_left_portrait = {
        trigger = {
            exists = primary_spouse
            primary_spouse = { has_relation_lover = root }
        }
        character = primary_spouse
    }

    lower_center_portrait = {
        trigger = { exists = scope:masked_guest_spouse }
        character = scope:masked_guest_spouse
    }

    right_portrait = {
        character = scope:masked_guest
        animation = flirtation
    }

    immediate = {
        if = {
            limit = {
                scope:masked_guest = {
                    any_spouse = {
                        is_sibling_of = root
                    }
                }
            }
            scope:masked_guest = {
                random_spouse = {
                    limit = { is_sibling_of = root }
                    save_scope_as = masked_guest_spouse
                }
            }
        }
        else_if = {
            limit = {
                scope:masked_guest = {
                    any_spouse = {
                        has_relation_rival = root
                    }
                }
            }
            scope:masked_guest = {
                random_spouse = {
                    limit = { has_relation_rival = root }
                    save_scope_as = masked_guest_spouse
                }
            }
        }
    }

    # Sleep with them anyways
    option = {
        name = {
            text = {
                first_valid = {
                    triggered_desc = {
                        trigger = {
                            OR = {
                                is_sibling_of = scope:masked_guest
                                is_child_of = scope:masked_guest
                                scope:masked_guest = { is_child_of = root }
                            }
                        }
                        desc = mpo_events_ariana.0041.a_family
                    }
                    triggered_desc = {
                        trigger = {
                            has_relation_rival = scope:masked_guest
                        }
                        desc = mpo_events_ariana.0041.a_rival
                    }
                    triggered_desc = {
                        trigger = {
                            scope:masked_guest = {
                                any_spouse = {
                                    has_relation_rival = root
                                }
                            }
                        }
                        desc = mpo_events_ariana.0041.a_rival_spouse
                    }
                    desc = mpo_events_ariana.0041.a
                }
            }
        }
        trigger = {
            is_attracted_to_gender_of = scope:masked_guest
            scope:masked_guest = { is_attracted_to_gender_of = root }
        }
        had_sex_with_effect = {
            CHARACTER = scope:masked_guest
            PREGNANCY_CHANCE = pregnancy_chance
        }
        if = {
            limit = {
                has_trait = lustful
                root.faith = { trait_is_virtue = lustful }
            }
            add_piety = minor_piety_gain
        }
        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_honor = -0.25
                ai_boldness = 0.75
            }
            modifier = {
                factor = 1.2
                OR = {
                    has_trait = lustful
                    has_trait = rakish
                }
            }
            modifier = {
                factor = 1.1
                scope:masked_guest = {
                    any_spouse = {
                        has_relation_rival = root
                    }
                }
            }
            modifier = {
                factor = 0.8
                has_relation_rival = scope:masked_guest
            }
            modifier = {
                factor = 0.1
                OR = {
                    is_sibling_of = scope:masked_guest
                    is_child_of = scope:masked_guest
                    scope:masked_guest = { is_child_of = root }
                }
            }
            modifier = {
                factor = 0.75
                scope:masked_guest = {
                    any_spouse = {
                        OR = {
                            is_sibling_of = root
                            is_child_of = root
                            root = { is_child_of = prev }
                        }
                    }
                }
            }
            modifier = {
                factor = 0.5
                OR = {
                    scope:activity.var:spouse_2_var ?= root
                    scope:activity.special_guest:spouse_1 ?= root
                }
            }
        }
    }

    # Become lovers
    option = {
        name = {
            text = {
                first_valid = {
                    triggered_desc = {
                        trigger = {
                            OR = {
                                is_sibling_of = scope:masked_guest
                                is_child_of = scope:masked_guest
                                scope:masked_guest = { is_child_of = root }
                            }
                        }
                        desc = mpo_events_ariana.0041.b_family
                    }
                    triggered_desc = {
                        trigger = {
                            has_relation_rival = scope:masked_guest
                        }
                        desc = mpo_events_ariana.0041.b_rival
                    }
                    triggered_desc = {
                        trigger = {
                            scope:masked_guest = {
                                any_spouse = {
                                    has_relation_rival = root
                                }
                            }
                        }
                        desc = mpo_events_ariana.0041.b_rival_spouse
                    }
                    desc = mpo_events_ariana.0041.b
                }
            }
        }
        trigger = {
            is_attracted_to_gender_of = scope:masked_guest
            scope:masked_guest = { is_attracted_to_gender_of = root }
        }
        had_sex_with_effect = {
            CHARACTER = scope:masked_guest
            PREGNANCY_CHANCE = pregnancy_chance
        }
        progress_towards_lover_effect = {
            CHARACTER = scope:masked_guest
            REASON = lover_masked_activity
            OPINION = 0
        }
        if = {
            limit = {
                has_trait = lustful
                root.faith = { trait_is_virtue = lustful }
            }
            add_piety = minor_piety_gain
        }
        ai_chance = {
            base = 60
            ai_value_modifier = {
                ai_honor = -0.25
                ai_boldness = 1
                ai_greed = 0.1
            }
            modifier = {
                factor = 1.2
                OR = {
                    has_trait = lustful
                    has_trait = rakish
                }
            }
            modifier = {
                factor = 1.1
                scope:masked_guest = {
                    any_spouse = {
                        has_relation_rival = root
                    }
                }
            }
            modifier = {
                factor = 0.7
                has_relation_rival = scope:masked_guest
            }
            modifier = {
                factor = 0.1
                OR = {
                    is_sibling_of = scope:masked_guest
                    is_child_of = scope:masked_guest
                    scope:masked_guest = { is_child_of = root }
                }
            }
            modifier = {
                factor = 0.5
                scope:masked_guest = {
                    any_spouse = {
                        OR = {
                            is_sibling_of = root
                            is_child_of = root
                            root = { is_child_of = prev }
                        }
                    }
                }
            }
            modifier = {
                factor = 0.5
                OR = {
                    scope:activity.var:spouse_2_var ?= root
                    scope:activity.special_guest:spouse_1 ?= root
                }
            }
        }
    }

    # Reject them
    option = {
        name = {
            text = {
                first_valid = {
                    triggered_desc = {
                        trigger = {
                            OR = {
                                is_sibling_of = scope:masked_guest
                                is_child_of = scope:masked_guest
                                scope:masked_guest = { is_child_of = root }
                            }
                        }
                        desc = mpo_events_ariana.0041.c_family
                    }
                    triggered_desc = {
                        trigger = {
                            has_relation_rival = scope:masked_guest
                        }
                        desc = mpo_events_ariana.0041.c_rival
                    }
                    triggered_desc = {
                        trigger = {
                            exists = primary_spouse
                            primary_spouse = { has_relation_lover = root }
                        }
                        desc = mpo_events_ariana.0041.c_spouse
                    }
                    triggered_desc = {
                        trigger = {
                            scope:masked_guest = {
                                any_spouse = {
                                    OR = {
                                        is_sibling_of = root
                                        is_child_of = root
                                        is_parent_of = root
                                    }
                                }
                            }
                        }
                        desc = mpo_events_ariana.0041.c_family_spouse
                    }
                    desc = mpo_events_ariana.0041.c
                }
            }
        }
        custom_tooltip = mpo_events_ariana.0041.c_tt

        reverse_add_opinion = {
            target = scope:masked_guest
            modifier = hurt_opinion
            opinion = -20
        }

        if = {
            limit = {
                OR = {
                    AND = {
                        any_spouse = {
                            count > 0
                        }
                        trait_is_shunned_or_criminal_in_faith_trigger = {
                            FAITH = faith
                            TRAIT = adulterer
                            GENDER_CHARACTER = root
                        }
                    }
                    trait_is_shunned_or_criminal_in_faith_trigger = {
                        FAITH = faith
                        TRAIT = fornicator
                        GENDER_CHARACTER = root
                    }
                }
            }
            add_piety = minor_piety_gain
        }

        ai_chance = {
            base = 75
            ai_value_modifier = {
                ai_honor = 0.5
                ai_vengefulness = 1
            }
            modifier = {
                factor = 1.5
                has_relation_rival = scope:masked_guest
            }
            modifier = {
                factor = 1.5
                OR = {
                    is_sibling_of = root
                    is_child_of = root
					is_parent_of = root
                }
            }
            modifier = {
                factor = 1.2
                scope:masked_guest = {
                    any_spouse = {
                        OR = {
                            is_sibling_of = root
                            is_child_of = root
                            is_parent_of = root
                        }
                    }
                }
            }
        }
    }

    # Reject them, but stop being rivals
    option = {
        name = mpo_events_ariana.0041.d
        trigger = {
            has_relation_rival = scope:masked_guest
        }
        custom_tooltip = mpo_events_ariana.0041.d_tt
        duel = {
            skill = intrigue
            target = scope:masked_guest
            60 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -59
                }
                send_interface_toast = {
                    title = mpo_events_ariana.0041.d_success
                    type = event_toast_effect_good
                    left_icon = root
                    right_icon = scope:masked_guest
                    remove_relation_rival = scope:masked_guest

                    if = {
                        limit = {
                            OR = {
                                AND = {
                                    any_spouse = {
                                        count > 0
                                    }
                                    trait_is_shunned_or_criminal_in_faith_trigger = {
                                        FAITH = faith
                                        TRAIT = adulterer
                                        GENDER_CHARACTER = root
                                    }
                                }
                                trait_is_shunned_or_criminal_in_faith_trigger = {
                                    FAITH = faith
                                    TRAIT = fornicator
                                    GENDER_CHARACTER = root
                                }
                            }
                        }
                        if = {
                            limit = {
                                has_trait = forgiving
                                faith = { trait_is_virtue = forgiving }
                            }
                            add_piety = medium_piety_gain
                        }
                        else = {
                            add_piety = minor_piety_gain
                        }
                    }

                    add_prestige = minor_prestige_gain

                    stress_impact = {
                        base = minor_stress_impact_loss
                        forgiving = medium_stress_impact_loss
                        vengeful = medium_stress_impact_gain
                    }
                }
            }
            40 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = 39
                }

                send_interface_toast = {
                    title = mpo_events_ariana.0041.d_failure
                    type = event_toast_effect_bad
                    left_icon = root
                    right_icon = scope:masked_guest
                    stress_impact = {
                        base = miniscule_stress_impact_gain
                    }
                }
            }
        }


        ai_chance = {
            base = 50
            ai_value_modifier = {
                ai_honor = 1
                ai_vengefulness = -0.5
            }
            modifier = {
                factor = 1.2
                OR = {
                    is_sibling_of = root
                    is_child_of = root
                    is_parent_of = root
                }
            }
            modifier = {
                factor = 1.2
                scope:masked_guest = {
                    any_spouse = {
                        OR = {
                            is_sibling_of = root
                            is_child_of = root
                            is_parent_of = root
                        }
                    }
                }
            }
        }
    }
}

scripted_effect mpo_events_ariana_0050_lose_effect = {
    add_prestige = major_prestige_loss
    custom_tooltip = mpo_events_ariana_0050_lose_effect_tt
    dynasty = {
        add_dynasty_modifier = {
            modifier = criminal_family_dynasty_modifier
            years = 10
        }
    }
    hidden_effect = {
        every_held_title = {
            limit = {
                is_landless_type_title = no
                tier > tier_barony
            }
            add_to_list = target_titles
        }
        create_title_and_vassal_change = {
            type = conquest
            save_scope_as = change
            add_claim_on_loss = yes
        }
        every_in_list = {
            list = target_titles
            change_title_holder_include_vassals = {
                holder = scope:criminal_family.primary_heir
                change = scope:change
            }
        }
        resolve_title_and_vassal_change = scope:change
    }
    if = {
        limit = {
            is_valid_for_laampdom = yes
            scope:criminal_family.ep3_laamp_chance_score_value >= 8
        }
        create_landless_adventurer_title_effect = {
            REASON = flag:voluntary
            FLAVOR_CHAR = root
        }
        add_trait_xp = {
            trait = gallowsbait
            track = thief
            value = 10
        }
    }
    scope:criminal_family = {
        add_stress = major_stress_gain
    }
}

scripted_effect mpo_events_ariana_0050_win_effect = {
    add_hook = {
        target = scope:criminal_family
        type = loyalty_hook
    }
    dynasty = { add_dynasty_prestige = medium_dynasty_prestige_value }
    scope:criminal_family = {
        add_opinion = {
            target = root
            modifier = grateful_opinion
            opinion = 30
        }
    }
}

scripted_trigger is_valid_family_mpo_events_ariana_0050 = {
    is_landed = yes
    is_available_adult = yes
    dynasty = root.dynasty
    exists = primary_heir
    highest_held_title_tier <= tier_duchy
    is_ai = yes
    OR = {
        has_trait = avaricious
        has_trait = deceitful
        has_trait = schemer
        has_trait = greedy
        has_trait = ambitious
    }
}

# Branded - A family member is caught in a scandal
mpo_events_ariana.0050 = {
    type = character_event
    title = mpo_events_ariana.0050.t
    desc = mpo_events_ariana.0050.desc

    theme = realm

    left_portrait = {
        character = root
        animation = thinking
    }

    right_portrait = {
        character = scope:criminal_family
        animation = beg
    }

    cooldown = { years = 50 }

    trigger = {
		has_mpo_dlc_trigger = yes
        is_available_adult = yes
        location = { geographical_region = world_steppe } 
        government_has_flag = government_is_nomadic
        any_close_or_extended_family_member = {
            is_valid_family_mpo_events_ariana_0050 = yes
        }
    }

    immediate = {
        random_close_or_extended_family_member = {
            limit = {
                is_valid_family_mpo_events_ariana_0050 = yes
            }
            save_scope_as = criminal_family
        }
    }

    option = {
        name = mpo_events_ariana.0050.a
        trigger = {
            short_term_gold >= massive_gold_value
        }
        show_as_unavailable = {
            always = yes
        }
        custom_tooltip = mpo_events_ariana.0050.a_tt
        remove_short_term_gold = massive_gold_value
        add_prestige = medium_prestige_gain
        mpo_events_ariana_0050_win_effect = yes
        stress_impact = {
            greedy = medium_stress_impact_gain
            avaricious = medium_stress_impact_gain
            compassionate = medium_stress_impact_loss
            just = minor_stress_impact_loss
        }
        ai_chance = {
            base = 0
        }
    }

    option = {
        name = {
            text = {
                first_valid = {
                    triggered_desc = {
                        trigger = {
                            short_term_gold < massive_gold_value
                        }
                        desc = mpo_events_ariana.0050.b_broke
                    }
                    desc = mpo_events_ariana.0050.b
                }
            }
        }
        add_prestige = medium_prestige_loss
        scope:criminal_family = {
            mpo_events_ariana_0050_lose_effect = yes
        }
        stress_impact = {
            callous = medium_stress_impact_loss
        }
        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_compassion = -1
            }
            opinion_modifier = {
                opinion_target = scope:criminal_family
                multiplier = -2
            }
        }
    }

    option = {
        name = mpo_events_ariana.0050.c
        trigger =  {
            diplomacy >= high_skill_rating
        }
        show_as_unavailable = {
            always = yes
        }
        custom_tooltip = mpo_events_ariana.0050.c_tt
        duel = {
            skill = diplomacy
            value = high_skill_rating
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -49
                }
                desc = mpo_events_ariana.0050.win
                send_interface_toast = {
                    title = mpo_events_ariana.0050.win
                    type = event_toast_effect_good
                    left_icon = root
                    right_icon = scope:criminal_family
                    mpo_events_ariana_0050_win_effect = yes
                    stress_impact = {
                        compassionate = medium_stress_impact_loss
                        just = minor_stress_impact_loss
                    }
                }
            }
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -49
                }
                desc = mpo_events_ariana.0050.lose
                send_interface_toast = {
                    title = mpo_events_ariana.0050.lose
                    type = event_toast_effect_bad
                    left_icon = root
                    right_icon = scope:criminal_family
                    add_prestige = medium_prestige_loss
                    scope:criminal_family = {
                        mpo_events_ariana_0050_lose_effect = yes
                    }
                    stress_impact = {
                        callous = medium_stress_impact_loss
                    }
                }
            }
        }
        ai_chance = {
            base = 150
            ai_value_modifier = {
                ai_compassion = -1
            }
            opinion_modifier = {
                opinion_target = scope:criminal_family
                multiplier = -2
            }
        }
    }
}

scripted_trigger is_valid_child_mpo_events_ariana_0060 = {
    age > 4
	age <= 14 
	is_available = yes
	is_ai = yes
    is_courtier_of = root
}
scripted_effect mpo_events_ariana_0060_lose_effect = {
    send_interface_toast = {
        title = mpo_events_ariana.0010.failure
        type = event_toast_effect_bad
        left_icon = root
        right_icon = scope:appropriate_child
        random = {
            chance = 10
            increase_wounds_effect = { REASON = fall }
        }
        scope:appropriate_child = {
            add_opinion = {
                target = root
                modifier = disappointed_opinion
                opinion = -10
            }
        }
    }
}
scripted_effect mpo_events_ariana_0060_win_effect = {
    custom_tooltip =  mpo_events_ariana.0060.success_tt
    add_prestige = miniscule_prestige_gain
    trigger_event = mpo_events_ariana.0070
}

# Treasure Nest - A child comes to you saying they found treasure in an eagle's nest
mpo_events_ariana.0060 = {
    type = character_event
    title = mpo_events_ariana.0060.t
    desc = mpo_events_ariana.0060.desc

    theme = court

    left_portrait = {
        character = root
        animation = thinking
    }

    right_portrait = {
        character = scope:appropriate_child
        animation = storyteller
    }

    cooldown = { years = 15 }

    trigger = {
		has_mpo_dlc_trigger = yes
        is_available_adult = yes
        location = { geographical_region = world_steppe } 
        government_has_flag = government_is_nomadic
        OR = {
            any_close_family_member = { is_valid_child_mpo_events_ariana_0060 = yes }
            any_relation = { type = ward is_valid_child_mpo_events_ariana_0060 = yes }
            any_warden_hostage = { opinion = { target = root value >= low_negative_opinion } is_valid_child_mpo_events_ariana_0060 = yes }
        }
    }

    immediate = {
        if = {
			limit = {
				any_close_family_member = {
					is_valid_child_mpo_events_ariana_0060 = yes
				}
			}
            random_close_family_member = {
				#A child you care about
				limit = { 
					opinion = {
						target = root
						value >= low_positive_opinion
					}
					is_valid_child_mpo_events_ariana_0060 = yes 
				}
				#Otherwise pick whoever
				alternative_limit = { is_valid_child_mpo_events_ariana_0060 = yes }
				save_scope_as = appropriate_child
			}
        }
        else_if = {
			limit = {
				any_relation = {
					type = ward
					is_valid_child_mpo_events_ariana_0060 = yes
				}
			}
			random_relation = {
				type = ward
				#A child you care about
				limit = {
					opinion = {
						target = root
						value >= low_positive_opinion
					}
					is_valid_child_mpo_events_ariana_0060 = yes
				}
				#Otherwise pick whoever
				alternative_limit = { is_valid_child_mpo_events_ariana_0060 = yes }
				save_scope_as = appropriate_child
			}
		}
        else_if = {
			limit = {
				any_warden_hostage = {
					opinion = {
						target = root
						value >= low_negative_opinion
					}
					is_valid_child_mpo_events_ariana_0060 = yes
				}
			}
			random_warden_hostage = {
				limit = {
					opinion = {
						target = root
						value >= low_negative_opinion
					}
					is_valid_child_mpo_events_ariana_0060 = yes
				}
				save_scope_as = appropriate_child
			}
		}
        add_short_term_gold = 5
    }

    # Climb to the nest
    option = {
        name = mpo_events_ariana.0060.a 
        duel = {
            skill = prowess
            value = decent_skill_rating
            desc = mpo_events_ariana.0060.a_tt
            60 = {
                desc = mpo_events_ariana.0060.success
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -59
                }
                mpo_events_ariana_0060_win_effect = yes
            }
            40 = {
                desc = mpo_events_ariana.0010.a_failure
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -39
                }
                mpo_events_ariana_0060_lose_effect = yes
            }
        }

        stress_impact = {
            brave = minor_stress_impact_loss
            craven = medium_stress_impact_gain
        }

        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_boldness = 1
                ai_greed = 0.1
            }
            modifier = {
                factor = 1.5
                prowess > intrigue
            }
        }
    }

    # Sneak to the nest
    option = {
        name = mpo_events_ariana.0060.b
        duel = {
            skill = intrigue
            value = decent_skill_rating
            desc = mpo_events_ariana.0060.b_tt
            60 = {
                desc = mpo_events_ariana.0060.success
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -59
                }
                mpo_events_ariana_0060_win_effect = yes
            }
            40 = {
                desc = mpo_events_ariana.0010.b_failure
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -39
                }
                mpo_events_ariana_0060_lose_effect = yes
            }
        }

        stress_impact = {
            brave = minor_stress_impact_loss
            craven = medium_stress_impact_gain
        }
        
        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_boldness = 1
                ai_greed = 0.1
            }
            modifier = {
                factor = 1.5
                intrigue > prowess
            }
        }
    }

    # That's nice dear 
    option = {
        name = mpo_events_ariana.0060.d
        scope:appropriate_child = {
            add_opinion = {
                target = root
                modifier = hurt_opinion
                opinion = -15
            }
        }
        stress_impact = {
            lazy = minor_stress_impact_loss
            craven = minor_stress_impact_loss
        }
        ai_chance = {
            base = 75
            opinion_modifier = {
                opinion_target = scope:appropriate_child
                multiplier = -1
            }
            ai_value_modifier = {
                ai_energy = -1
            }
        }
    }
}

mpo_events_ariana.0070 = {
    type = character_event
    title = mpo_events_ariana.0060.t
    desc = mpo_events_ariana.0070.desc

    theme = court
    override_background = { reference = terrain }

    left_portrait = {
        character = root
        animation = hunting_falcon
    }

    right_portrait = {
        character = scope:appropriate_child
        animation = happiness
    }

    immediate = {
        add_character_flag = used_in_mpo_events_ariana_0070
        generate_trinket_effect = {
            TRINKET_RECEIVER = root
            TRINKET_GIVER = root
            GRAB_ALL_TRINKETS = no
            HISTORY_TYPE = discovered
        }
        if = {
			limit = { exists = scope:new_trinket }
			scope:new_trinket = {
				save_scope_as = newly_created_artifact
			}
		}
    }

    # Take the sachel
    option = {
        name = mpo_events_ariana.0070.a
        random_list = {
            desc = mpo_events_ariana.0070.a_tt
            20 = {
                desc = mpo_events_ariana.0070.a_trinket
                trigger = {
                    exists = scope:newly_created_artifact
                }
                send_interface_toast = {
                    title = mpo_events_ariana.0070.a_trinket
                    type = event_toast_effect_good
                    left_icon = root
                    scope:newly_created_artifact = { set_owner = root }
                    add_short_term_gold = 15
                }
            }
            30 = {
                desc = mpo_events_ariana.0070.a_good
                send_interface_toast = {
                    title = mpo_events_ariana.0070.a_good
                    type = event_toast_effect_good
                    left_icon = root
                    add_short_term_gold = 50
                }
            }
            15 = {              
                desc = mpo_events_ariana.0070.a_great
                send_interface_toast = {
                    title = mpo_events_ariana.0070.a_great
                    type = event_toast_effect_good
                    left_icon = root
                    add_short_term_gold = 100
                }
            }
            5 = {
                desc = mpo_events_ariana.0070.a_none
                send_interface_toast = {
                    title = mpo_events_ariana.0070.a_none
                    type = event_toast_effect_bad
                    left_icon = root
                }
                hidden_effect = {
                    stress_impact = {
                        greedy = minor_stress_impact_gain
                    }
                }
            }
        }

        stress_impact = {
            greedy = minor_stress_impact_loss
        }

        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_greed = 1
            }
        }
    }

    # Take the eagle
    option = {
        name = mpo_events_ariana.0070.b
        
        trigger = {
            OR = {
                has_eagle_trigger = no
                scope:appropriate_child = { has_eagle_trigger = no } 
            }
        }
        if = {
            limit = {
                has_eagle_trigger = no
            }
            custom_tooltip = mpo_events_ariana.0070.b_self
            start_eagle_story_cycle_effect = yes
        }
        else_if = {
            limit = {
                scope:appropriate_child = { has_eagle_trigger = no } 
            }
            custom_tooltip = mpo_events_ariana.0070.b_child
            scope:appropriate_child = { start_eagle_story_cycle_effect = yes }
            scope:appropriate_child = {
                add_opinion = {
                    target = root
                    modifier = grateful_opinion
                    opinion = 20
                }
            }
        }
        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_rationality = 1
            }
        }
    }

    # Give the sachel to bro
    option = {
        name = mpo_events_ariana.0070.c
        random_list = {
            desc = mpo_events_ariana.0070.c_tt
            20 = {
                desc = mpo_events_ariana.0070.a_trinket
                trigger = {
                    exists = scope:newly_created_artifact
                }
                send_interface_toast = {
                    title = mpo_events_ariana.0070.a_trinket
                    type = event_toast_effect_good
                    left_icon = root
                    right_icon = scope:appropriate_child
                    scope:newly_created_artifact = { set_owner = root }
                    scope:appropriate_child = { add_short_term_gold = 15 }
                }
            }
            30 = {
                desc = mpo_events_ariana.0070.a_good
                send_interface_toast = {
                    title = mpo_events_ariana.0070.a_good
                    type = event_toast_effect_good
                    left_icon = root
                    right_icon = scope:appropriate_child
                    add_short_term_gold = 25
                    scope:appropriate_child = { add_short_term_gold = 25 }
                }
            }
            15 = {    
                desc = mpo_events_ariana.0070.a_great    
                send_interface_toast = {
                    title = mpo_events_ariana.0070.a_great
                    type = event_toast_effect_good
                    left_icon = root
                    right_icon = scope:appropriate_child
                    add_short_term_gold = 50
                    scope:appropriate_child = { add_short_term_gold = 50 }
                }  
            }
            5 = {
                desc = mpo_events_ariana.0070.a_none
                custom_tooltip = mpo_events_ariana.0070.c_none_tt
                send_interface_toast = {
                    title = mpo_events_ariana.0070.a_none
                    type = event_toast_effect_bad
                    left_icon = root
                    right_icon = scope:appropriate_child
                    pay_short_term_gold = {
                        gold = 5
                        target = scope:appropriate_child
                    }
                } 
                hidden_effect = {
                    stress_impact = {
                        greedy = minor_stress_impact_gain
                    }
                }
            }
        }

        scope:appropriate_child = {
            add_opinion = {
                target = root
                modifier = grateful_opinion
                opinion = 15
            }
        }

        stress_impact = {
            greedy = minor_stress_impact_gain
            generous = major_stress_impact_loss
            compassionate = minor_stress_impact_loss
        }

        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_compassion = 1
                ai_greed = -1
            }
            opinion_modifier = {
                opinion_target = scope:appropriate_child
                multiplier = 2
            }
        }
    }

    # Leave it be
    option = {
        name = mpo_events_ariana.0070.d

        add_piety = minor_piety_gain

        scope:appropriate_child = {
            add_opinion = {
                target = root
                modifier = disappointed_opinion
                opinion = -15
            }
        }

        stress_impact = {
            temperate = minor_stress_impact_loss
            greedy = medium_stress_impact_gain
        }

        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_rationality = 0.1
                ai_greed = -1
            }
            modifier = {
                factor = 1.5
                has_trait = temperate 
            }
        }
    }

    after = {
        remove_character_flag = used_in_mpo_events_ariana_0070
    }
}

# Someone tells you about a magical tree
mpo_events_ariana.0080 = {
    type = character_event
    title = mpo_events_ariana.0080.t
    desc = mpo_events_ariana.0080.desc

    theme = nomads
    
    left_portrait = {
        character = root
        animation = thinking
    }

    right_portrait = {
        character = scope:tree_lover
        animation = storyteller
    }

    cooldown = { years = 25 }

    trigger = {
		has_mpo_dlc_trigger = yes
        is_available_adult = yes
        location = { geographical_region = world_steppe }
        government_has_flag = government_is_nomadic
        any_courtier = {
            is_available_healthy_ai_adult = yes
        }
        any_county_in_region = {
            region = world_steppe
            NOR = {
                holder ?= root
                holder.liege ?= root
                holder.top_liege ?= root
            }
            squared_distance = {
				target = root.capital_county
				value >= squared_distance_medium
			}
            squared_distance = {
				target = root.capital_county
				value < squared_distance_almost_massive
			}
            any_county_province = {
                OR = {
                    terrain = forest
                    terrain = taiga
                }
            }
        }
    }
    
    immediate = {
        ordered_courtier = {
            limit = {
                is_available_healthy_ai_adult = yes
            }
            order_by = learning
            save_scope_as = tree_lover
        }
        random_county_in_region = {
            region = world_steppe
            limit = {
                NOR = {
                    holder ?= root
                    holder.liege ?= root
                    holder.top_liege ?= root
                }
                squared_distance = {
				    target = root.capital_county
				    value >= squared_distance_medium
			    }
                squared_distance = {
                    target = root.capital_county
                    value < squared_distance_almost_massive
                }
                any_county_province = {
                    OR = {
                        terrain = forest
                        terrain = taiga
                    }
                }
            }
            random_county_province = {
                limit = {
                    OR = {
                        terrain = forest
                        terrain = taiga
                    }
                }
                save_scope_as = tree_barony
            }
        }
    }

    # ok you can go
    option = {
        name = mpo_events_ariana.0080.a

        
        custom_tooltip = mpo_events_ariana.0080.a_tt
        save_scope_value_as = {
            name = tree_method
            value = flag:tree_guy
        }

        pay_short_term_gold = {
            gold = major_gold_value
            target = scope:tree_lover
        }

        scope:tree_lover = {
            add_opinion = {
                target = root
                modifier = grateful_opinion
                opinion = 15
            }
        }

        trigger_event = {
            id = mpo_events_ariana.0081
            days = { 30 90 }
        }
        
        stress_impact = {
            greedy = minor_stress_impact_gain
        }

        ai_chance = {
            base = 150
            ai_value_modifier = {
                ai_greed = -0.5
                ai_energy = -0.1
            }
            modifier = {
                factor = 1.25
                scope:tree_lover.learning >= root.learning
            }
            modifier = {
                gold <= massive_gold_value
                factor = 0
            }
        }
    }

    # ill go
    option = {
        name = {
            text = {
                first_valid = {
                    triggered_desc = {
                        trigger = {
                            has_trait = arrogant
                        }
                        desc = mpo_events_ariana.0080.b_arrogant
                    }
                    desc = mpo_events_ariana.0080.b
                }
            }
        }
        trigger = {
            learning >= high_skill_rating
        }
        show_as_unavailable = {
            always = yes
        }

        custom_tooltip = mpo_events_ariana.0080.b_tt
        save_scope_value_as = {
            name = tree_method
            value = flag:self
        }

        start_travel_plan = {
            destination = scope:tree_barony
            on_arrival_event = mpo_events_ariana.0081
        }
        

        ai_chance = {
            base = 75
            ai_value_modifier = {
                ai_rationality = 1
                ai_greed = 0.5
            }
            modifier = {
                factor = 2
                has_trait = arrogant
            }
        }
    }

    # who cares
    option = {
        name = {
            text = {
                first_valid = {
                    triggered_desc = {
                        trigger = {
                            probably_superstitious = yes
                        }
                        desc = mpo_events_ariana.0080.c_sus
                    }
                    desc = mpo_events_ariana.0080.c
                }
            }
        }
        flavor = mpo_events_ariana.0080.c_flavor

        stress_impact = {
            base = minor_stress_impact_loss
            cynical = minor_stress_impact_loss
        }

        scope:tree_lover = {
            add_opinion = {
                target = root
                modifier = disappointed_opinion
                opinion = -10
            }
        }
        

        ai_chance = {
            base = 50
            modifier = {
                factor = 1.5
                probably_superstitious = yes
            }
            modifier = {
                factor = 1.5
                has_trait = cynical
            }
        }
    }
}

# The magical tree is brought to you or you find it
mpo_events_ariana.0081 = {
    type = character_event
    title = mpo_events_ariana.0080.t
    desc = {
        triggered_desc = {
            trigger = {
                scope:tree_method = flag:self
            }
            desc = mpo_events_ariana.0081.desc_self
        }
        triggered_desc = {
            trigger = {
                scope:tree_method = flag:tree_guy
                scope:tree_lover = { is_alive = yes }
            }
            desc = mpo_events_ariana.0081.desc_guy
        }
        triggered_desc = {
            trigger = {
                scope:tree_method = flag:tree_guy
                scope:tree_lover = { is_alive = no }
            }
            desc = mpo_events_ariana.0081.desc_dead
        }
        triggered_desc = {
            trigger = {
                scope:tree_method = flag:tree_guy
                scope:tree_lover = { is_alive = yes }
            }
            desc = mpo_events_ariana.0081.desc
        }
        desc = mpo_events_ariana.0081.desc_outro
    }

    theme = realm
    override_background = { 
        trigger = {
            scope:tree_method = flag:tree_guy
        }
        reference = courtyard
    }
    override_background = { 
        trigger = {
            scope:tree_method = flag:self
        }
        reference = terrain
    }

    left_portrait = {
        character = root
        animation = happiness
    }

    right_portrait = {
        trigger = {
            scope:tree_method = flag:tree_guy
        }
        character = scope:tree_giver
        animation = storyteller
    }

    lower_center_portrait = {
        trigger = {
            scope:tree_lover = { is_alive = no }
        }
        character = scope:tree_lover
    }

    immediate = {
        # If the guy is dead for whatever reason we need to find a new one
        if = {
            limit = {
                scope:tree_lover = { is_alive = yes }
            }
            scope:tree_lover = { save_scope_as = tree_giver }
        }
        else = {
            random_courtier = {
                limit = {
                    is_available_healthy_ai_adult = yes
                }
                save_scope_as = tree_giver
            }
        }
    }

    # Wish for Fertility
    option = {
        name = mpo_events_ariana.0081.a

        duel = {
            skill = learning
            value = decent_skill_rating
            desc = mpo_events_ariana.0081.wish
            70 = {
                desc = mpo_events_ariana.0081.success
                modifier = {
                    factor = 1.5
                    scope:tree_method = flag:tree_guy
                }
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -69
                }
                send_interface_toast = {
                    title = mpo_events_ariana.0081.success
                    type = event_toast_effect_good
                    left_icon = root
                    add_character_modifier = {
                        modifier = mpo_magical_tree_fertility_modifier
                        years = 10
                    }
                }
            }
            30 = {
                desc = mpo_events_ariana.0081.failure
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -29
                }
                send_interface_toast = {
                    title = mpo_events_ariana.0081.failure
                    type = event_toast_effect_neutral
                    left_icon = root
                    add_character_modifier = {
                        modifier = mpo_magical_tree_modifier
                        years = 10
                    }
                }
            }
        }

        ai_chance = {
            base = 100
            modifier = {
                factor = 1.5
                has_trait = lustful
            }
        }
    }

    # Wish for Power
    option = {
        name = mpo_events_ariana.0081.b

        duel = {
            skill = learning
            value = decent_skill_rating
            desc = mpo_events_ariana.0081.wish
            70 = {
                desc = mpo_events_ariana.0081.success
                modifier = {
                    factor = 1.5
                    scope:tree_method = flag:tree_guy
                }
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -69
                }
                send_interface_toast = {
                    title = mpo_events_ariana.0081.success
                    type = event_toast_effect_good
                    left_icon = root
                    if = {
                        limit = {
                            domicile ?= { herd <= max_herd }
                        }
                        domicile ?= {
                            change_herd = medium_herd_gain
                        }
                    }
                    else = {
                        add_prestige = medium_prestige_gain
                    }
                    add_character_modifier = {
                        modifier = mpo_magical_tree_power_modifier
                        years = 10
                    }
                }
            }
            30 = {
                desc = mpo_events_ariana.0081.failure
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -29
                }
                send_interface_toast = {
                    title = mpo_events_ariana.0081.failure
                    type = event_toast_effect_neutral
                    left_icon = root
                    add_character_modifier = {
                        modifier = mpo_magical_tree_modifier
                        years = 10
                    }
                }
            }
        }
   
        ai_chance = {
            base = 100
            modifier = {
                factor = 1.5
                has_trait = wrathful
            }
        }
    }

    # Wish for Wisdom
    option = {
        name = mpo_events_ariana.0081.c

        duel = {
            skill = learning
            value = decent_skill_rating
            desc = mpo_events_ariana.0081.wish
            70 = {
                desc = mpo_events_ariana.0081.success
                modifier = {
                    factor = 1.5
                    scope:tree_method = flag:tree_guy
                }
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -69
                }
                send_interface_toast = {
                    title = mpo_events_ariana.0081.success
                    type = event_toast_effect_good
                    left_icon = root
                    add_character_modifier = {
                        modifier = mpo_magical_tree_wisdom_modifier
                        years = 10
                    }
                }
            }
            30 = {
                desc = mpo_events_ariana.0081.failure
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -29
                }
                send_interface_toast = {
                    title = mpo_events_ariana.0081.failure
                    type = event_toast_effect_neutral
                    left_icon = root
                    add_character_modifier = {
                        modifier = mpo_magical_tree_modifier
                        years = 10
                    }
                }
            }
        }

        ai_chance = {
            base = 100
        }
    }
}

scripted_trigger is_valid_family_mpo_events_ariana_0090 = {
    is_available = yes
    is_adult = no
    age >= 8 # Can't be too young
    number_of_personality_traits < personality_trait_limit
    NAND = {
        OR = {
            has_trait = content
            has_trait = ambitious
        }
        OR = {
            has_trait = lazy
            has_trait = diligent
        }
    }
    NOT = {
        has_character_modifier = mpo_destined_leader_modifier
    }
}

# Your child wants to be a herder when they grow up 
mpo_events_ariana.0090 = {
    type = character_event
    title = mpo_events_ariana.0090.t
    desc = {
        desc = mpo_events_ariana.0090.desc
        first_valid = {
            triggered_desc = {
                trigger = {
                    scope:child = { age >= 12 }
                }
                desc = mpo_events_ariana.0090.desc_older
            }
            desc = mpo_events_ariana.0090.desc_younger
        }
    }
    theme = nomads

    left_portrait = {
        character = root
        animation = thinking
    }

    right_portrait = {
        character = scope:child
        animation = holding_staff
    }

    cooldown = { years = 10 }

    trigger = {
		has_mpo_dlc_trigger = yes
        is_available_adult = yes
        government_has_flag = government_is_nomadic
        any_child = {
            is_valid_family_mpo_events_ariana_0090 = yes 
        }
    }

    immediate = {
        random_child = {
            limit = {
                is_valid_family_mpo_events_ariana_0090 = yes 
            }
            weight = {
                base = 1
                modifier = {
                    factor = 2
                    OR = {
                        has_trait = shy
                        has_trait = craven
                    }
                }
            }
            save_scope_as = child
        }
    }

    # I'll show you their life before you decide
    option = {
        name = mpo_events_ariana.0090.c
        trigger = {
            scope:child = { age >= 10 }
            OR = {
                has_trait = callous
                has_trait = peasant_leader
                has_trait = diligent
            }
        }

        reverse_add_opinion = {
            target = scope:child
            modifier = annoyed_opinion
            opinion = -10
        }

        stress_impact = {
            callous = minor_stress_impact_loss
        }

        random_list = { 
            desc = mpo_events_ariana.0090.c_duel
            50 = { 
                desc = mpo_events_ariana.0090.c_1
                send_interface_toast = {
                    title = mpo_events_ariana.0090.c_1
                    type = event_toast_effect_good
                    left_icon = root
                    right_icon = scope:child
                    scope:child = { add_trait_force_tooltip = diligent }
                }
            }
            50 = { 
                desc = mpo_events_ariana.0090.c_2
                send_interface_toast = {
                    title = mpo_events_ariana.0090.c_2
                    type = event_toast_effect_good
                    left_icon = root
                    right_icon = scope:child
                    scope:child = { add_prowess_skill = 2 }
                }
            }
        }

        ai_chance = {
            base = 75
            modifier = {
                factor = 1.5
                has_trait = diligent
            }
        }
    }

    # That's nice dear
    option = {
        name = mpo_events_ariana.0090.a
        flavor = mpo_events_ariana.0090.a_flavor
        
        reverse_add_opinion = {
            target = scope:child
            modifier = grateful_opinion
            opinion = 15
        }

        scope:child = { 
            add_trait = content
            add_character_modifier = {
                modifier = mpo_child_herder_modifier
                years = 15
            }
        }

        stress_impact = {
            ambitious = minor_stress_impact_gain
            arrogant = minor_stress_impact_gain
            content = minor_stress_impact_loss
        }

        ai_chance = {
            base = 50
            modifier = {
                factor = 0
                OR = {
                    has_trait = ambitious
                    has_trait = arrogant
                }
            }
            modifier = {
                factor = 1.5
                has_trait = lazy
            }
            modifier = {
                scope:child.age <= 12
                factor = 1.5
            }
        }
    }

    # You're destined for more
    option = {
        name = mpo_events_ariana.0090.b

        reverse_add_opinion = {
            target = scope:child
            modifier = disappointed_opinion
            opinion = -15
        }

        random = {
            chance = 50
            scope:child = { add_trait = ambitious }
        }

        stress_impact = {
            ambitious = minor_stress_impact_loss
            content = minor_stress_impact_gain
            humble = minor_stress_impact_gain
        }

        ai_chance = {
            base = 100
            modifier = {
                factor = 0
                OR = {
                    has_trait = content
                    has_trait = humble
                }
            }
            modifier = {
                factor = 1.5
                has_trait = ambitious
            }
        }
    }
}

scripted_trigger is_valid_family_mpo_events_ariana_0100 = {
    is_available = yes
    age >= 14
    OR = {
        is_courtier_of = root
        is_vassal_or_below_of = root 
    }
    OR = {
        prowess >= decent_skill_rating
        martial >= decent_skill_rating
    }
    NOR = {
        can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
        is_eunuch_trigger = yes
        has_trait = disinherited
        has_trait = devoted
        has_trait = order_member
        has_trait = bastard
    }
    dynasty = root.dynasty
    NOT = { root.primary_heir ?= this }
}

# A non-marital gender relative is beasting people
mpo_events_ariana.0100 = {
    type = character_event
    title = mpo_events_ariana.0100.t
    desc = mpo_events_ariana.0100.desc 

    theme = nomads

    override_background = { reference = mpo_camp_steppe }

    left_portrait = {
        character = root
        animation = admiration
    }

    right_portrait = {
        character = scope:warrior
        animation = wrestling_victory
    }

    cooldown = { years = 10 }

    weight_multiplier = {
        base = 1
        modifier = {
            add = 10
            OR = {
                NOT = { exists = primary_heir }
                primary_heir ?= {
                    NOT = { dynasty = root.dynasty }
                }
            }
        }
    }

    trigger = {
		has_mpo_dlc_trigger = yes
        is_available_adult = yes
        government_has_flag = government_is_nomadic 
        NOT = { exists = designated_heir }
        any_child = {
            is_valid_family_mpo_events_ariana_0100 = yes
        }
    }

    immediate = {
        random_child = {
            limit = {
                is_valid_family_mpo_events_ariana_0100 = yes
            }
            save_scope_as = warrior
            add_character_flag = wear_armor
        }
    }

    option = {
        name = mpo_events_ariana.0100.a

        add_prestige = medium_prestige_loss
        add_legitimacy = minor_legitimacy_loss

        if = {
            limit = {
                exists = primary_heir
            }
            reverse_add_opinion = {
                target = primary_heir
                modifier = angry_opinion
                opinion = -30
            }
        }

        set_designated_heir = scope:warrior

        reverse_add_opinion = {
            target = scope:warrior
            modifier = grateful_opinion
            opinion = 30
        }

        every_vassal = {
			limit = { has_vassal_stance = parochial }
			custom = every_parochial_vassal
			add_opinion = {
				modifier = disapproval_opinion
				target = root
				opinion = -15
			}
		}

        if = {
            limit = {
                scope:warrior = { is_wrong_gender_in_faith_trigger = { FAITH = root.faith } }
            }
            every_vassal = {
                limit = { has_vassal_stance = zealot }
                custom = every_zealot_vassal
                add_opinion = {
                    modifier = disapproval_opinion
                    target = root
                    opinion = -15
                }
            }
        }

        scope:warrior = {
            add_prestige = minor_prestige_gain
            add_character_modifier = mpo_destined_leader_modifier
            set_knight_status = default
        }

        stress_impact = {
            base = minor_stress_impact_gain
            compassionate = minor_stress_impact_loss
            trusting = minor_stress_impact_loss
            stubborn = minor_stress_impact_gain
        }
        
        ai_chance = {
            base = 10
            opinion_modifier = { opinion_target = scope:warrior multiplier = 2 }
            modifier = {
                factor = 0
                has_trait = stubborn
            }
        }
    }

    option = {
        name = mpo_events_ariana.0100.b

        if = {
            limit = {
                scope:warrior = { is_wrong_gender_in_faith_trigger = { FAITH = root.faith } }
            }
            every_vassal = {
                limit = { has_vassal_stance = zealot }
                custom = every_zealot_vassal
                add_opinion = {
                    modifier = disapproval_opinion
                    target = root
                    opinion = -15
                }
            }
        }
        
        scope:warrior = {
            add_prestige = miniscule_prestige_gain
            add_character_modifier = ignores_gender_army_rules
            set_knight_status = default
        }

        if = {
            limit = {
                scope:warrior = { NOT = { has_trait = craven } }
            }
            reverse_add_opinion = {
                target = scope:warrior
                modifier = grateful_opinion
                opinion = 15
            }
        }

        ai_chance = {
            base = 50
            opinion_modifier = { opinion_target = scope:warrior multiplier = 2 }
        }
    }

    option = {
        name = mpo_events_ariana.0100.c
        trigger = {
            has_dlc_feature = reform_culture
        }

        add_character_modifier = {
            modifier = mpo_diverse_warriors_modifier
            years = 10
        }

        stress_impact = {
            ambitious = minor_stress_impact_loss
        }

        ai_chance = {
            base = 25
            ai_value_modifier = {
                ai_rationality = 0.5
                ai_boldness = 1
            }
            modifier = {
                factor = 2
                culture.culture_head = root
            }
        }
    }

    option = {
        name = mpo_events_ariana.0100.d

        if = {
            limit = {
                scope:warrior = { is_wrong_gender_in_faith_trigger = { FAITH = root.faith } }
            }
            add_piety = minor_piety_gain
        }

        reverse_add_opinion = {
            target = scope:warrior
            modifier = disappointed_opinion
            opinion = -15
        }

        stress_impact = {
            callous = minor_stress_impact_loss
            arrogant = minor_stress_impact_loss
            stubborn = minor_stress_impact_loss
        }

        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_rationality = 1
            }
            opinion_modifier = { opinion_target = scope:warrior multiplier = -1 }
        }
    }

    after = {
        scope:warrior = { remove_character_flag = wear_armor }
    }
}

scripted_trigger is_valid_county_0110 = {
    uses_county_fertility = yes
    is_landless_type_title = no
    NOT = { this = root.capital_county }
    OR = {
        county_fertility > root.capital_county.county_fertility
        county_opinion > root.capital_county.county_opinion        
    }
}

# Your court astrologer wants you to move your capital
mpo_events_ariana.0110 = {
    type = character_event
    title = mpo_events_ariana.0110.t
    desc = {
        desc = mpo_events_ariana.0110.desc
        random_valid = {
            triggered_desc = {
                trigger = {
                    scope:current_capital = { county_fertility <= 25 }
                }
                desc = mpo_events_ariana.0110.desc_fertility
            }
            triggered_desc = {
                trigger = {
                    scope:current_capital = { county_opinion < 0 }
                }
                desc = mpo_events_ariana.0110.desc_opinion
            }
        }
        desc = mpo_events_ariana.0110.desc_ending
    }

    theme = nomads

    override_background = { reference = mpo_camp_steppe }

    left_portrait = {
        character = root
        animation = worry
    }

    right_portrait = {
        character = scope:astrologer
        animation = storyteller
    }

    cooldown = { years = 25 }

    trigger = {
		has_mpo_dlc_trigger = yes
        is_available_adult = yes
        government_has_flag = government_is_nomadic
        employs_court_position = court_astrologer_court_position
        capital_county ?= {
            OR = {
                county_fertility <= 25
                county_opinion < 0
            }
        }
        any_held_title = {
            tier = tier_county 
            is_valid_county_0110 = yes 
        }
    }

    immediate = {
        random_courtier = {
            limit = {
                has_court_position = court_astrologer_court_position
            }
            save_scope_as = astrologer
        }
        capital_county = {
            save_scope_as = current_capital
        }
        random_held_title = {
            limit = {
                tier = tier_county 
                is_valid_county_0110 = yes
            }
            save_scope_as = new_capital
        }
    }

    option = {
        name = mpo_events_ariana.0110.a
        primary_title = { set_capital_county = scope:new_capital }
        set_realm_capital = scope:new_capital
        hidden_effect = { domicile = { move_domicile = scope:new_capital.title_province } }

        add_piety = minor_piety_gain

        reverse_add_opinion = {
            target = scope:astrologer
            modifier = pleased_opinion
            opinion = 15
        }

        stress_impact = {
            loyal = minor_stress_impact_loss
            trusting = minor_stress_impact_loss
            paranoid = minor_stress_impact_gain
            cynical = minor_stress_impact_gain
        }
        
        hidden_effect = {
            random = {
                chance = 50
                trigger_event = {
                    id = mpo_events_ariana.0111
                    days = { 30 90 }
                }
            }
        }

        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_zeal = 1
            }
            modifier = {
                factor = 0
                OR = {
                    has_trait = paranoid
                    has_trait = arbitrary
                    has_trait = cynical
                }
            }
            modifier = {
                factor = 2
                OR = {
                    has_trait = trusting
                    has_trait = loyal
                }
            }
            opinion_modifier = { opinion_target = scope:astrologer multiplier = 2 }
        }
    }

    option = {
        name = mpo_events_ariana.0110.b

        reverse_add_opinion = {
            target = scope:astrologer
            modifier = disappointed_opinion
            opinion = -15
        }

        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_zeal = -0.5
            }
        }
    }

    option = {
        name = {
            text = {
                first_valid = {
                    triggered_desc = {
                        trigger = {
                            has_trait = cynical
                        }
                        desc = mpo_events_ariana.0110.c_cynical
                    }
                    desc = mpo_events_ariana.0110.c
                }
            }
        }

        add_piety = minor_piety_loss

        stress_impact = {
            zealous = minor_stress_impact_gain
            cynical = minor_stress_impact_loss
            paranoid = minor_stress_impact_loss
        }

        revoke_court_position = {
			recipient = scope:astrologer
			court_position = court_astrologer_court_position
		}

        add_character_modifier = {
            modifier = mpo_home_sweet_home_modifier
            years = 10
        }

        ai_chance = {
            base = 100
            ai_value_modifier = {
                ai_zeal = -1
            }
            modifier = {
                factor = 2
                OR = {
                    has_trait = paranoid
                    has_trait = arbitrary
                }
            }
            opinion_modifier = { opinion_target = scope:astrologer multiplier = -2 }
        }
    }
}

mpo_events_ariana.0111 = {
    type = character_event
    title = mpo_events_ariana.0111.t
    desc = mpo_events_ariana.0111.desc

    theme = nomads

    override_background = { reference = mpo_camp_steppe }

    left_portrait = {
        character = root
        animation = admiration
    }

    right_portrait = {
        character = scope:astrologer
        animation = happiness
    }

    option = {
        name = mpo_events_ariana.0111.a
        add_prestige = minor_prestige_gain
        scope:new_capital = { change_county_fertility = major_county_fertility_gain }
        scope:astrologer = {
            add_learning_skill = 1
        }
    }
}