namespace = mpo_migration_travel_events

# A ruler in the county you're in offers you some herd to help you on your way
mpo_migration_travel_events.0001 = {
    type = character_event
    title = mpo_migration_travel_events.0001.t
    desc = mpo_migration_travel_events.0001.desc
    theme = migration

    left_portrait = {
        character = root
        animation = personality_honorable
    }

    right_portrait = {
        character = scope:messenger
        animation = shepherd_with_sheep
    }

    lower_center_portrait = scope:ruler

    cooldown = { years = 25 }

    immediate = {
        location.county.holder = { save_scope_as = ruler }
        scope:ruler = {
            random_courtier = {
                limit = {
                    is_available_ai_adult = yes
                }
                save_scope_as = messenger
            }
        }
    }

    trigger = {
        is_migrating = yes
        domicile ?= {
            herd <= twenty_percent_herd_value
        }
        location.county.holder = {
            NOR = {
                this = root
                has_hook = root
                has_trait = greedy
                has_trait = callous
            }
            has_good_opinion_of_root_trigger = yes
            is_available_ai_adult = yes
            any_courtier = {
                is_available_adult = yes
            }
        }
    }

    # Take it
    option = {
        name = mpo_migration_travel_events.0001.a
        scope:ruler = {
            pay_herd = {
                target = root
                value = domicile.medium_herd_value
            }
            add_hook = {
                target = root
                type = favor_hook
            }
        }
        hidden_effect = {
            add_opinion = {
                modifier = grateful_opinion
                target = scope:ruler
                opinion = 15
            }
        }

        stress_impact = {
            paranoid = minor_stress_impact_gain
        }

        ai_chance = {
            base = 100
            modifier = {
                factor = 2
                domicile = { herd <= domicile.ten_percent_herd_value }
            }
            modifier = {
                factor = 1.5
                domicile = { herd <= domicile.twenty_percent_herd_value }
            }
            modifier = {
                factor = 0
                has_trait = paranoid
            }
            ai_value_modifier = {
                ai_greed = 1
            }
        }
    }

    # Decline
    option = {
        name = mpo_migration_travel_events.0001.b

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

        stress_impact = {
            arrogant = minor_stress_impact_gain
        }

        ai_chance = {
            base = 50
            modifier = {
                factor = 0
                has_trait = arrogant
            }
        }
    }
}

# An old vassal and a new vassal urge you to give them some herd
mpo_migration_travel_events.0010 = {
    type = character_event
    title = mpo_migration_travel_events.0010.t
    desc = mpo_migration_travel_events.0010.desc
    theme = migration

    left_portrait = {
        character = root
        animation = worry
    }

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

    lower_left_portrait = scope:vassal_1
    lower_right_portrait = scope:vassal_2

    cooldown = { years = 10 }

    immediate = {
        random_courtier = {
            limit = {
                is_adult = yes 
            }
            save_scope_as = messenger
        }
        random_vassal = {
            limit = {
                government_has_flag = government_is_nomadic    
                domicile ?= { herd < max_herd }
            }
            save_scope_as = vassal_1
        }
        var:migration_title.holder = {
            random_vassal = {
                limit = {
                    government_has_flag = government_is_nomadic    
                    domicile ?= { herd < max_herd }
                }
                save_scope_as = vassal_2
            }
        }
    }

    trigger = {
        is_migrating = yes
        has_variable = migration_title
        domicile ?= {
            herd > max_herd
        }
        any_courtier = { count >=1 }
        any_vassal = { count >= 1 government_has_flag = government_is_nomadic domicile ?= { herd < max_herd } }
        var:migration_title.holder = { any_vassal = { count >= 1 government_has_flag = government_is_nomadic domicile ?= { herd < max_herd } } }
    }

    # Give to vassal 1
    option = {
        name = mpo_migration_travel_events.0010.a

        pay_herd = {
            target = scope:vassal_1
            value = domicile.excess_herd_value
        }

        reverse_add_opinion = {
            modifier = grateful_opinion
            target = scope:vassal_1
            opinion = excess_herd_opinion_value
        }

        custom_tooltip = no_longer_herd_limit_tt

        stress_impact = {
            generous = minor_stress_impact_loss
            compassionate = minor_stress_impact_loss
        }

        ai_chance = {
            base = 50 
            ai_value_modifier = {
                ai_rationality = 1
            }
            opinion_modifier = {
                opinion_target = scope:vassal_1
                multiplier = 1
            }
        }
    }

    # Give to vassal 2
    option = {
        name = mpo_migration_travel_events.0010.b

        pay_herd = {
            target = scope:vassal_2
            value = domicile.excess_herd_value
        }

        reverse_add_opinion = {
            modifier = grateful_opinion
            target = scope:vassal_2
            opinion = excess_herd_opinion_value
        }

        custom_tooltip = no_longer_herd_limit_tt

        stress_impact = {
            generous = minor_stress_impact_loss
            compassionate = minor_stress_impact_loss
        }

        ai_chance = {
            base = 50 
            ai_value_modifier = {
                ai_rationality = 1
            }
            opinion_modifier = {
                opinion_target = scope:vassal_2
                multiplier = 1
            }
        }
    }

    # Give to none
    option = {
        name = mpo_migration_travel_events.0010.c

        domicile = {
            change_herd = root.excess_herd_value_negative
        }

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

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

        reverse_add_opinion = {
            modifier = disappointed_opinion
            target = scope:messenger
            opinion = -5
        }

        custom_tooltip = no_longer_herd_limit_tt

        stress_impact = {
            callous = minor_stress_impact_loss
            greedy = minor_stress_impact_loss
        }

        ai_chance = {
            base = 50 
            ai_value_modifier = {
                ai_compassion = -0.5
            }
        }
    }

    option = {
        name = mpo_migration_travel_events.0010.d

        reverse_add_opinion = {
            modifier = disappointed_opinion
            target = scope:vassal_2
            opinion = -5
        }

        reverse_add_opinion = {
            modifier = disappointed_opinion
            target = scope:vassal_1
            opinion = -5
        }

        reverse_add_opinion = {
            modifier = disappointed_opinion
            target = scope:messenger
            opinion = -5
        }

        stress_impact = {
            greedy = medium_stress_impact_loss
            diligent = minor_stress_impact_gain
        }

        add_character_modifier = {
            modifier = nomad_keep_herd_modifier
            years = 5
        }

        ai_chance = {
            base = 50 
            ai_value_modifier = {
                ai_greed = 1
            }
            modifier = {
                factor = 0
                has_trait = diligent
            }
        }
    }
}

# The county you're migrating to has low fertility
mpo_migration_travel_events.0020 = {
    type = character_event
    title = mpo_migration_travel_events.0020.t
    desc = mpo_migration_travel_events.0020.desc
    theme = migration

    left_portrait = {
        character = root
        animation = worry
    }

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

    trigger = {
        is_migrating = yes
        has_variable = migration_title
        var:migration_title ?= { 
            tier = tier_county 
            county_fertility <= bad_county_fertility_level
        }
    }

    cooldown = { years = 15 }

    immediate = {
        if = {
            limit = {
                employs_court_position = court_astrologer_court_position
            }
            random_courtier = {
                limit = {
                    has_court_position = court_astrologer_court_position
                }
                save_scope_as = astrologer
            }
        }
        var:migration_title = { save_scope_as = target_title }
    }

    option = {
        name = mpo_migration_travel_events.0020.a

        stress_impact = {
            base = minor_stress_impact_gain
            lazy = minor_stress_impact_loss
            diligent = minor_stress_impact_gain
        }

        ai_chance = {
            base = 50 
        }
    }

    option = {
        name = mpo_migration_travel_events.0020.c
        trigger = {
            domicile = { herd >= major_herd_value }
        }
        show_as_unavailable = { always = yes }
        
        domicile = {
            change_herd = major_herd_loss
        }

        var:migration_title = {
            change_county_fertility = minor_county_fertility_level_gain
        }

        ai_chance = {
            base = 25 
        }
    }

    option = {
        name = mpo_migration_travel_events.0020.d
        trigger = {
            employs_court_position = court_astrologer_court_position
        }
        show_as_unavailable = { always = yes }
        scope:astrologer = {
            duel = {
                desc = mpo_migration_travel_events.0020.d_tt
                skill = learning
                value = very_high_skill_rating
                50 = {
                    compare_modifier = {
                        value = scope:duel_value
                        multiplier = 3.5
                        min = -49
                    }
                    desc = mpo_migration_travel_events.0020.win
                    root = {
                        send_interface_toast = {
                            title = mpo_migration_travel_events.0020.win
                            type = event_toast_effect_good
                            left_icon = root
                            right_icon = scope:astrologer
                            var:migration_title = {
                                change_county_fertility = major_county_fertility_level_gain
                            }
                        }
                    }
                }
                50 = {
                    compare_modifier = {
                        value = scope:duel_value
                        multiplier = -3.5
                        min = -49
                    }
                    desc = mpo_migration_travel_events.0020.lose
                    root = {
                        send_interface_toast = {
                            title = mpo_migration_travel_events.0020.lose
                            type = event_toast_effect_bad
                            left_icon = root
                            right_icon = scope:astrologer
                            stress_impact = {
                                base = minor_stress_impact_gain
                            }
                        }
                    }
                }
            }
        }

        ai_chance = {
            base = 75 
        }
    }
}

# Danger! A sickness effecting the herd
mpo_migration_travel_events.0030 = {
    type = character_event
    title = mpo_migration_travel_events.0030.t
    desc = mpo_migration_travel_events.0030.desc
    theme = migration

    left_portrait = {
        character = root
        animation = worry
    }
    
    right_portrait = {
        character = scope:messenger
        animation = jockey_idle
        camera = camera_event_horse_right
    }

    cooldown = { years = 5 }

    trigger = {
        is_migrating = yes
        NOT = { domicile ?= { herd <= twenty_percent_herd_value } }
    }

    immediate = {
        traveler_danger_xp_effect = {
			MIN = 3
			MAX = 7
		}
        domicile = {
            change_herd = minor_herd_loss
        }
        random_courtier = {
            limit = {
                is_adult = yes 
            }
            save_scope_as = messenger
        }
        current_travel_plan = { delay_travel_plan = { days = 30 } }
    }

    weight_multiplier = {
		base = 1
		modifier = {
			factor = 1.5
			domicile ?= { herd >= max_herd }
		}
	}

    # Lose more herd
    option = {
        name = mpo_migration_travel_events.0030.a
        domicile = {
            change_herd = medium_herd_loss
        }
        stress_impact = {
            base = minor_stress_impact_gain
            compassionate = minor_stress_impact_gain
            callous = minor_stress_impact_loss
        }
        ai_chance = {
            base = 50
            ai_value_modifier = {
                ai_rationality = 1
            }
            modifier = {
                factor = 0
                has_trait = compassionate
            }
        }
    }

    # Consult a local shepherd
    option = {
        name = mpo_migration_travel_events.0030.b
        trigger = {
            short_term_gold >= medium_gold_value
        }
        show_as_unavailable = { always = yes }
        remove_short_term_gold = medium_gold_value
        random_list = {
            50 = {
                show_chance = no 
                desc = mpo_migration_travel_events.0030.b_good
                send_interface_toast = {
                    title = mpo_migration_travel_events.0030.b_good
                    type = event_toast_effect_good
                    left_icon = root
                    right_icon = scope:messenger
                }
            }
            50 = {
                show_chance = no
                desc = mpo_migration_travel_events.0030.b_bad
                send_interface_toast = {
                    title = mpo_migration_travel_events.0030.b_bad
                    type = event_toast_effect_bad
                    left_icon = root
                    right_icon = scope:messenger
                    current_travel_plan = {
						add_travel_plan_modifier = nomad_slow_horses_modifier
					}
                }
            }
        }
        stress_impact = {
            greedy = minor_stress_impact_gain
        }
        ai_chance = {
            base = 75
            ai_value_modifier = {
                ai_rationality = 1
                ai_greed = -0.75
            }
            modifier = {
                factor = 0
                has_trait = greedy
            }
            modifier = {
                gold <= major_gold_value
                factor = 0
            }
        }
    }

    # Ignore it
    option = {
        name = mpo_migration_travel_events.0030.c

        random_list = {
            10 = {
                show_chance = no
                desc = mpo_migration_travel_events.0030.c_none
                send_interface_toast = {
                    title = mpo_migration_travel_events.0030.c_none
                    type = event_toast_effect_neutral
                    left_icon = root
                    right_icon = scope:messenger
                    add_character_modifier = {
                        modifier = nomad_weak_herd_modifier
                        years = 2
                    }
                }
            }
            30 = { 
                show_chance = no
                desc = mpo_migration_travel_events.0030.c_medium
                send_interface_toast = {
                    title = mpo_migration_travel_events.0030.c_medium
                    type = event_toast_effect_bad
                    left_icon = root
                    right_icon = scope:messenger
                    domicile = {
                        change_herd = miniscule_herd_loss
                    }
                }
            }
            40 = {
                show_chance = no
                desc = mpo_migration_travel_events.0030.c_major
                send_interface_toast = {
                    title = mpo_migration_travel_events.0030.c_major
                    type = event_toast_effect_bad
                    left_icon = root
                    right_icon = scope:messenger
                    domicile = {
                        change_herd = minor_herd_loss
                    }
                }
            }
            20 = {
                show_chance = no
                desc = mpo_migration_travel_events.0030.c_massive
                send_interface_toast = {
                    title = mpo_migration_travel_events.0030.c_massive
                    type = event_toast_effect_bad
                    left_icon = root
                    right_icon = scope:messenger
                    domicile = {
                        change_herd = medium_herd_loss
                    }
                }
            }
        }

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

        current_travel_plan = { delay_travel_plan = { days = 90 } }

        ai_chance = {
            base = 50
            ai_value_modifier = {
                ai_compassion = -0.5
            }
            modifier = {
                factor = 0.5
                domicile ?= { herd <= forty_percent_herd_value }
            }
            modifier = {
                factor = 2
                domicile ?= { herd >= max_herd }
            }
        }
    }
}

# You have to cross a river with your herd
mpo_migration_travel_events.0040 = {
    type = character_event
    title = mpo_migration_travel_events.0040.t
    desc = mpo_migration_travel_events.0040.desc
    theme = migration

    left_portrait = {
        character = root
        animation = jockey_idle
        camera = camera_event_horse_right
    }

    cooldown = { years = 5 }

    trigger = {
        is_migrating = yes
        location = {
            OR = {
                is_riverside_province = yes
                is_river_province = yes
            }
        }
    }

    immediate = {
        location.county = { save_scope_as = county }
    }

    override_background = {
		reference = bp3_riverside
	}

    # Bum rush it
    option = {
        name = mpo_migration_travel_events.0040.a
        duel = {
            desc = mpo_migration_travel_events.0040.a_tt
            skill = prowess
            value = decent_skill_rating
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -49
                }
                desc = mpo_migration_travel_events.0040.win
                send_interface_toast = {
                    title = mpo_migration_travel_events.0040.win
                    type = event_toast_effect_good
                    left_icon = root
                    if = {
                        limit = {
                            NOT = { has_trait = lifestyle_traveler }
                        }
                        add_trait = lifestyle_traveler
                    }
                    traveler_travel_xp_effect = {
                        MIN = 3
                        MAX = 7
                    }
                }
                if = {
                    limit = {
                        NOR = { 
                            has_trait = brave
                            has_trait = craven
                        }
                    }
                    random = {
                        chance = 5
                        add_trait = brave
                    }
                }
            }
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -49
                }
                desc = mpo_migration_travel_events.0040.lose
                root = {
                    send_interface_toast = {
                        title = mpo_migration_travel_events.0040.lose
                        type = event_toast_effect_bad
                        left_icon = root
                        domicile = {
                            change_herd = medium_herd_loss
                        }
                    }
                }
            }
        }

        stress_impact = {
            brave = minor_stress_impact_loss
            craven = minor_stress_impact_gain
        }

        ai_chance = {
            base = 75
            modifier = {
                factor = 0
                has_trait = craven
            }
        }
    }

    # Build a raft
    option = {
        name = mpo_migration_travel_events.0040.b
        trigger = {
            short_term_gold >= minor_gold_value
        }
        show_as_unavailable = { always = yes }
        flavor = mpo_migration_travel_events.0040.b_flavor
        remove_short_term_gold = minor_gold_value

        stress_impact = {
            base = miniscule_stress_impact_loss
            greedy = miniscule_stress_impact_gain
        }

        current_travel_plan = { delay_travel_plan = { days = 15 } }

        stress_impact = {
            diligent = minor_stress_impact_loss
        }

        ai_chance = {
            base = 50
            ai_value_modifier = {
                ai_rationality = 1
            }
            modifier = {
                gold <= medium_gold_value
                factor = 0
            }
        }
    }

    # Look for a ford
    option = {
        name = {
            text = {
                first_valid = {
                    triggered_desc = {
                        trigger = {
                            OR = { faith.religion = religion:eastern_orthodox_religion faith.religion = religion:catholic_religion faith.religion = religion:protestant_religion }
                        }
                        desc = mpo_migration_travel_events.0040.c_christian
                    }
                    desc = mpo_migration_travel_events.0040.c
                }
            }
        }

        current_travel_plan = { delay_travel_plan = { days = 60 } }

        stress_impact = {
            lazy = minor_stress_impact_loss
        }

        ai_chance = {
            base = 50
            ai_value_modifier = {
                ai_energy = -1
            }
        }
    }
}

scripted_trigger is_eligible_courtier_0050 = {
    is_adult = yes
    is_ai = yes
    NOR = {
        is_consort_of = root
        is_close_family_of = root
    }
}

scripted_trigger is_eligible_local_0050 = {
    is_adult = yes
    is_ai = yes
    exists = liege
    liege ?= { NOT = { this = root } }
}

# A courtier falls in love with a local and wants to stay
mpo_migration_travel_events.0050 = {
    type = character_event
    title = mpo_migration_travel_events.0050.t
    desc = mpo_migration_travel_events.0050.desc
    theme = migration
    override_background = {
        reference = mpo_camp_steppe
    }

    left_portrait = {
        character = root
        animation = shock
    }

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

    lower_center_portrait = scope:local

    cooldown = { years = 15 }
    

    trigger = {
        is_migrating = yes
        any_courtier = {
            is_eligible_courtier_0050 = yes 
            save_temporary_scope_as = courtier_temp
        }
        location = {
            any_character_in_location = {
                is_eligible_local_0050 = yes
                can_set_relation_lover_trigger = { CHARACTER = scope:courtier_temp }
                is_similar_age_trigger = { CHARACTER = scope:courtier_temp }
            }
        }
    }

    immediate = {
        random_courtier = {
            limit = {
                is_eligible_courtier_0050 = yes
            }
            weight = {
                base = 10
                modifier = { # Someone we actually care about
                    add = 15
                    OR = {
                        has_any_court_position = yes
                        is_councillor = yes
                    }
                }
                modifier = {
                    add = -25
                    has_trait = chaste 
                }
                modifier = {
                    add = 25
                    has_trait = lustful
                }
                modifier = {
                    add = 100
                    has_relation_lover = root
                }
            }
            save_scope_as = courtier
        }
        location = {
            random_character_in_location = {
                limit = {
                    is_eligible_local_0050 = yes
                    can_set_relation_lover_trigger = { CHARACTER = scope:courtier }
                    is_similar_age_trigger = { CHARACTER = scope:courtier }
                }
                weight = {
                    base = 10
                    modifier = {
                        add = 25
                        might_cheat_on_every_partner_trigger = yes 
                    }
                }
                save_scope_as = local
            }
        }
        hidden_effect = {
            scope:courtier = {
                set_relation_lover = scope:local
                random_secret = {
                    limit = {
                        secret_type = secret_lover
                        secret_target = scope:local
                    }
                    save_scope_as = secret
                }
            }
        }
        scope:secret = { reveal_to = root }
    }

    # Okay, farewell
    option = {
        name = mpo_migration_travel_events.0050.a
        remove_courtier_or_guest = scope:courtier
        scope:local.liege = {
            add_courtier = scope:courtier
        }

        stress_impact = {
            compassionate = minor_stress_impact_loss
        }

        ai_chance = {
            base = 75
            modifier = {
                factor = 0.5
                scope:courtier = {
                    OR = {
                        is_councillor = yes
                        has_any_court_position = yes
                    }
                }
            }
            modifier = {
                factor = 0
                has_relation_lover = scope:courtier
            }
        }
    }

    # No, stay
    option = {
        name = mpo_migration_travel_events.0050.b

        reverse_add_opinion = {
            modifier = disappointed_opinion
            target = scope:courtier
            opinion = -20
        }

        stress_impact = {
            callous = minor_stress_impact_loss
        }

        ai_chance = {
            base = 50
            modifier = {
                factor = 2
                scope:courtier = {
                    OR = {
                        is_councillor = yes
                        has_any_court_position = yes
                    }
                }
            }
            ai_value_modifier = {
                ai_compassion = -1
            }
        }
    }

    # Be with me instead
    option = {
        name = mpo_migration_travel_events.0050.c
        trigger = {
            has_trait = lustful
            can_set_relation_lover_trigger = { CHARACTER = scope:courtier }
            is_similar_age_trigger = { CHARACTER = scope:courtier }
        }        

        duel = {
            desc = mpo_migration_travel_events.0050.c_tt
            skill = intrigue
            value = decent_skill_rating
            60 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                }
                desc = mpo_migration_travel_events.0050.win
                send_interface_toast = {
                    title = mpo_migration_travel_events.0050.win
                    type = event_toast_effect_good
                    left_icon = root
                    right_icon = scope:courtier
                    scope:courtier = { remove_relation_lover = scope:local }
                    set_relation_lover = scope:courtier
                }
                stress_impact = {
                    base = minor_stress_impact_loss
                }
            }
            40 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                }
                desc = mpo_migration_travel_events.0050.lose
                root = {
                    send_interface_toast = {
                        title = mpo_migration_travel_events.0050.lose
                        type = event_toast_effect_bad
                        left_icon = root
                        reverse_add_opinion = {
                            modifier = disgusted_opinion
                            target = scope:courtier
                            opinion = -10
                        }
                        remove_courtier_or_guest = scope:courtier
                        scope:local.liege = {
                            add_courtier = scope:courtier
                        }
                    }
                }
            }
        } 

        ai_chance = {
            base = 75
        }
    }

    # How could you betray me?
    option = {
        name = mpo_migration_travel_events.0050.d
        trigger = {
            has_relation_lover = scope:courtier
        }

        remove_relation_lover = scope:courtier

        rightfully_imprison_character_effect = {
			TARGET = scope:courtier
			IMPRISONER = root
		}

        stress_impact = {
            callous = medium_stress_impact_loss
            sadistic = minor_stress_impact_loss
        }

        ai_chance = {
            base = 50
            ai_value_modifier = {
                ai_compassion = -1
            }
        }
    }
}

# Danger! A horse goes mad and might trample a courtier
mpo_migration_travel_events.0060 = {
    type = character_event
    title = mpo_migration_travel_events.0060.t
    desc = mpo_migration_travel_events.0060.desc
    theme = migration

    left_portrait = {
        character = root
        animation = stress
    }

    lower_center_portrait = scope:courtier

    trigger = {
        is_migrating = yes
        any_courtier = { count >= 4 }
    }

    immediate = {
        traveler_danger_xp_effect = {
			MIN = 3
			MAX = 7
		}
        random_courtier = {
            weight = {
                base = 10
                modifier = { # Someone we actually care about
                    add = 10
                    OR = {
                        has_any_court_position = yes
                        is_councillor = yes
                    }
                }
            }
            save_scope_as = courtier
        }
    }

    cooldown = { years = 5 }

    # Put it down
    option = {
        name = mpo_migration_travel_events.0060.a
        custom_tooltip = mpo_migration_travel_events.0060.a_tt

        domicile = {
            change_herd = miniscule_herd_loss
        }

        reverse_add_opinion = {
            modifier = grateful_opinion
            target = scope:courtier
            opinion = 10
        }

        ai_chance = {
            base = 50 
            ai_value_modifier = {
                ai_compassion = 1
            }
            opinion_modifier = {
                opinion_target = scope:courtier
                multiplier = 2
            }
        }
    }

    # Try to calm the horse
    option = {
        name = mpo_migration_travel_events.0060.b
        duel = {
            desc = mpo_migration_travel_events.0060.tt
            skill = diplomacy
            value = decent_skill_rating
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = 3.5
                    min = -49
                }
                desc = mpo_migration_travel_events.0060.win
                send_interface_toast = {
                    title = mpo_migration_travel_events.0060.win
                    type = event_toast_effect_good
                    left_icon = root
                    reverse_add_opinion = {
                        modifier = grateful_opinion
                        target = scope:courtier
                        opinion = 10
                    }
                    add_prestige = minor_prestige_gain
                }
                if = {
                    limit = {
                        NOR = { 
                            has_trait = brave
                            has_trait = craven
                        }
                    }
                    random = {
                        chance = 5
                        add_trait = brave
                    }
                }
            }
            50 = {
                compare_modifier = {
                    value = scope:duel_value
                    multiplier = -3.5
                    min = -49
                }
                desc = mpo_migration_travel_events.0060.lose
                send_interface_toast = {
                    title = mpo_migration_travel_events.0060.lose
                    type = event_toast_effect_bad
                    left_icon = root
                    scope:courtier = {
                        increase_wounds_effect = { REASON = trampled_by_horse }
                    }
                }
            }
        }

        stress_impact = {
            craven = minor_stress_impact_gain
            brave = minor_stress_impact_loss
        }

        ai_chance = {
            base = 75
            ai_value_modifier = {
                ai_rationality = 1
            }
            modifier = {
                factor = 0
                has_trait = craven
            }
        }
    }

    # Let the courtier die
    option = {
        name = mpo_migration_travel_events.0060.c

        random_list = {
            50 = {
                show_chance = no
                desc = mpo_migration_travel_events.0060.people
                send_interface_toast = {
                    title = mpo_migration_travel_events.0060.people
                    type = event_toast_effect_bad
                    left_icon = root
                    scope:courtier = {
                        increase_wounds_effect = { REASON = trampled_by_horse }
                    }
                    custom_tooltip = {
                        text = mpo_migration_travel_events.0060.people_tt
                        random = {
                            chance = 75
                            random_courtier = {
                                limit = {
                                    is_adult = yes  
                                    NOT = { this = scope:courtier }
                                }
                                save_scope_as = courtier_2
                                increase_wounds_effect = { REASON = trampled_by_horse }
                            }
                        }
                    }
                }
            }
            30 = {}
        }

        stress_impact = {
            compassionate = minor_stress_impact_gain
            callous = minor_stress_impact_loss
            lazy = minor_stress_impact_loss
        }

        ai_chance = {
            base = 50
            ai_value_modifier = {
                ai_compassion = -1
            }
            opinion_modifier = {
                opinion_target = scope:courtier
                multiplier = -2
            }
            modifier = {
                factor = 0
                has_trait = compassionate
            }
        }
    }
}
