﻿namespace = coronation_events_klank

coronation_events_klank.1001 = { # Different clothing gfx vassals are talking suspiciously - Isolate Opponents intent
	type = activity_event
	title = coronation_events_klank.1001.t
	desc = coronation_events_klank.1001.desc

	left_portrait = {
		character = root
		animation = personality_vengeful
	}

    center_portrait = {
        character = scope:first_culture_char
        animation = personality_coward
        camera = camera_event_right_pointing_left
    }

    right_portrait = {
        character = scope:second_culture_char
        animation = personality_callous
    }

    cooldown = { years = 1 }

	theme = coronation_activity

	trigger = {
        has_activity_intent = coronation_weaken_detractors
        scope:activity = {
            any_attending_character = {
                is_vassal_of = root
                has_different_clothing_gfx = { CHAR = root }
                is_ai = yes
                opinion = {
                    target = root
                    value <= -10
                }
                save_temporary_scope_as = first_char
            }
            any_attending_character = {
                is_vassal_of = root
                has_different_clothing_gfx = { CHAR = scope:first_char }
                has_different_clothing_gfx = { CHAR = root }
                is_ai = yes
                opinion = {
                    target = root
                    value <= -10
                }
            }
        }
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

        custom_tooltip = happened_because_intent_tt
        scope:activity = {
            random_attending_character = {
                limit = {
                    is_vassal_of = root
                    has_different_clothing_gfx = { CHAR = root }
                    is_ai = yes
                    opinion = {
                        target = root
                        value <= -10
                    }
                }
                save_scope_as = first_culture_char
            }
            random_attending_character = {
                limit = {
                    is_vassal_of = root
                    has_different_clothing_gfx = { CHAR = scope:first_culture_char }
                    has_different_clothing_gfx = { CHAR = root }
                    is_ai = yes
                    opinion = {
                        target = root
                        value <= -10
                    }
                }
                save_scope_as = second_culture_char
            }
        }
	}

	option = { #make them swear an oath of loyalty
		name = coronation_events_klank.1001.a
        scope:first_culture_char = {
            root = {
                if = {
                    limit = {
                        can_add_hook = {
                            type = threat_hook
                            target = scope:first_culture_char
                        }
                    }
                    add_hook = {
                        type = threat_hook
                        target = scope:first_culture_char
                    }
                }
            }
            if = {
                limit = {
                    OR = {
                        is_ai = yes
                        AND = {
                            root = { is_ai = no }
                            is_ai = no
                        }
                    }
                }
                progress_towards_rival_effect = {
                    REASON = rival_force_to_kneel
                    CHARACTER = root
                    OPINION = 0 #intentional separate opinion
                }
            }    
           
            add_opinion = {
                target = root
                modifier = forced_to_kneel_opinion
            }
            add_stress = medium_stress_gain
            coronation_move_towards_detractor_effect = { CHARACTER = scope:first_culture_char }
        }
        scope:second_culture_char = {
            root = {
                if = {
                    limit = {
                        can_add_hook = {
                            type = threat_hook
                            target = scope:second_culture_char
                        }
                    }
                    add_hook = {
                        type = threat_hook
                        target = scope:second_culture_char
                    }
                }
            }
            if = {
                limit = {
                    OR = {
                        is_ai = yes
                        AND = {
                            root = { is_ai = no }
                            is_ai = no
                        }
                    }
                }
                progress_towards_rival_effect = {
			     	REASON = rival_force_to_kneel
			     	CHARACTER = root
			     	OPINION = 0 #intentional separate opinion
                }
            }
            add_opinion = {
                target = root
                modifier = forced_to_kneel_opinion
            }
            add_stress = medium_stress_gain
            coronation_move_towards_detractor_effect = { CHARACTER = scope:second_culture_char }
        }

        stress_impact = {
            paranoid = medium_stress_impact_loss
            wrathful = medium_stress_impact_loss
        }

        ai_chance = { #it's better for ai to grab hooks, hence the simplistic ai weights
            base = 40
        }
	}

	option = { #pretend not to see them
		name = coronation_events_klank.1001.b
        culture = {
            change_cultural_acceptance = {
                target = scope:first_culture_char.culture
                value = minor_cultural_acceptance_loss
                desc = cultural_acceptance_gain_event
            }
            change_cultural_acceptance = {
                target = scope:second_culture_char.culture
                value = minor_cultural_acceptance_loss
                desc = cultural_acceptance_gain_event
            }
        }

        stress_impact = {
            shy = medium_stress_impact_loss
            gregarious = medium_stress_impact_gain
        }

        ai_chance = { #it's better for ai to grab hooks, hence the simplistic ai weights
            base = 10
        }
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

coronation_events_klank.1002 = { # Different clothing gfx vassals are talking - Empower Loyalist intent
	type = activity_event
	title = coronation_events_klank.1002.t
	desc = coronation_events_klank.1002.desc

	left_portrait = {
		character = root
		animation = personality_content
	}

    center_portrait = {
        character = scope:first_culture_char
        animation = throne_room_conversation_1
        camera = camera_event_right_pointing_left
    }

    right_portrait = {
        character = scope:second_culture_char
        animation = throne_room_conversation_4
    }

    cooldown = { years = 1 }

	theme = coronation_activity

	trigger = {
        has_activity_intent = coronation_embrace_supporters
        scope:activity = {
            any_attending_character = {
                is_vassal_of = root
                has_different_clothing_gfx = { CHAR = root }
                is_ai = yes
                opinion = {
                    target = root
                    value >= 20
                }
                save_temporary_scope_as = first_char
            }
            any_attending_character = {
                is_vassal_of = root
                has_different_clothing_gfx = { CHAR = scope:first_char }
                has_different_clothing_gfx = { CHAR = root }
                opinion = {
                    target = root
                    value >= 20
                }
                is_ai = yes
            }
        }
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

        custom_tooltip = happened_because_intent_tt
        scope:activity = {
            random_attending_character = {
                limit = {
                    is_vassal_of = root
                    has_different_clothing_gfx = { CHAR = root }
                    is_ai = yes
                    opinion = {
                        target = root
                        value >= 20
                    }
                }
                save_scope_as = first_culture_char
            }
            random_attending_character = {
                limit = {
                    is_vassal_of = root
                    has_different_clothing_gfx = { CHAR = scope:first_culture_char }
                    has_different_clothing_gfx = { CHAR = root }
                    is_ai = yes
                    opinion = {
                        target = root
                        value >= 20
                    }
                }
                save_scope_as = second_culture_char
            }
        }
	}

	option = { #nod to them, how cool
		name = coronation_events_klank.1002.a
        add_prestige = minor_prestige_gain
        custom_tooltip = coronation_tt_positive_tiny
        scope:activity = { activity_special_type_progression_tiny = yes }
        coronation_add_magnificence_log_effect = {
            VALUE = flag:positive_tiny
            CHAR = root
        }
        stress_impact = {
            shy = medium_stress_impact_loss
            gregarious = medium_stress_impact_gain
        }
        ai_chance = {
            base = 100
        }
	}

	option = { #cool, increase cultural acceptance with both
		name = coronation_events_klank.1002.b
        
        scope:first_culture_char = {
            add_opinion = {
                target = root
                opinion = 20
                modifier = respect_opinion
            }
        }
        scope:second_culture_char = {
            add_opinion = {
                target = root
                opinion = 20
                modifier = respect_opinion
            }
        }

        culture = {
            change_cultural_acceptance = {
                target = scope:first_culture_char.culture
                value = minor_cultural_acceptance_gain
                desc = cultural_acceptance_gain_event
            }
            change_cultural_acceptance = {
                target = scope:second_culture_char.culture
                value = minor_cultural_acceptance_gain
                desc = cultural_acceptance_gain_event
            }
        }
        
        stress_impact = {
            gregarious = medium_stress_impact_loss
            shy = medium_stress_impact_gain
        }
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

coronation_events_klank.1003 = { # Your ancestor has executed your vassal's ancestor - Isolate Opponents intent
	type = activity_event
	title = coronation_events_klank.1003.t
	desc = coronation_events_klank.1003.desc
	right_portrait = {
		character = root
		animation = personality_vengeful
	}

    lower_left_portrait = {
        character = scope:executor_ancestor
    }

    left_portrait = {
        character = scope:child_of_executee
        animation = fear
        camera = camera_event_right_pointing_left
    }

    lower_right_portrait = {
        character = scope:executed_previous_holder
    }
    cooldown = { years = 1 }

    override_background = { reference = corridor_night }

	theme = coronation_activity

	trigger = {
        OR = {
            has_activity_intent = coronation_weaken_detractors
            has_activity_intent = coronation_impress_attendees
        }
        exists = root.primary_title.previous_holder
        scope:activity = {
            any_attending_character = {
                is_vassal_of = root
                is_ai = yes
                primary_title = {
                    previous_holder ?= {
                        is_alive = No
                        OR = {
                            death_reason = death_execution
                            death_reason = death_execution_blood_eagle
                            death_reason = death_execution_blot
                        }
                        killer ?= {
                            is_alive = no
                            OR = {
                                this = root.primary_title.previous_holder
                                killer.house = root.house
                            }            
                        }
                    }
                }
                save_temporary_scope_as = temp_check
                #NOT = {
                    #root.house.house_head = {
                        #any_owned_story = {
                            #story_type = story_cycle_house_feud
                            #has_variable = house_feud_house
                            #var:house_feud_house = scope:temp_check.house
                        #}
                    #}
                #}
            }
        }
	}

	immediate = {
		# For MP
		coronation_busy_effect = yes

        custom_tooltip = happened_because_intent_tt
        scope:activity = {
            random_attending_character = {
                limit = {
                    is_vassal_of = root
                    is_ai = yes
                    primary_title = {
                        previous_holder ?= {
                            is_alive = no
                            OR = {
                                death_reason = death_execution
                                death_reason = death_execution_blood_eagle
                                death_reason = death_execution_blot
                            }
                            killer ?= {
                                is_alive = no
                                OR = {
                                    this = root.primary_title.previous_holder
                                    killer.house = root.house
                                }            
                            }
                        }
                    }
                    save_temporary_scope_as = temp_check
                    #NOT = {
                        #root.house.house_head = {
                            #any_owned_story = {
                                #story_type = story_cycle_house_feud
                                #has_variable = house_feud_house
                                #var:house_feud_house = scope:temp_check.house
                            #}
                        #}
                    #}
                }
                save_scope_as = child_of_executee
            }
            scope:child_of_executee.primary_title.previous_holder = {
                save_scope_as = executed_previous_holder
                killer = { save_scope_as = executor_ancestor }
            }
        }
	}

	option = { #forgiveness is a virtue
		name = coronation_events_klank.1003.a
        trigger = {
            faith = { trait_is_virtue = forgiving }
        }
        add_piety = medium_piety_gain
        custom_tooltip = coronation_tt_positive_medium
        scope:activity = { activity_special_type_progression_medium = yes }
        coronation_add_magnificence_log_effect = {
            VALUE = flag:positive_medium
            CHAR = root
        }
        
        if = {
            limit = {
                scope:child_of_executee = {
                    OR = {
                        faith = root.faith
                        has_trait = forgiving
                        has_trait = loyal
                        has_trait = craven
                        has_trait = trusting
                    }
                    NOT = {
                        has_trait = paranoid
                    }
                }    
            }
            scope:child_of_executee = {
                add_opinion = {
                    target = root
                    modifier = kindness_opinion
                    opinion = 20
                }
            }
        }
        
        stress_impact = {
            zealous = medium_stress_impact_loss
            forgiving = medium_stress_impact_loss
            paranoid = major_stress_impact_gain
        }

        ai_chance = {
            base = 100
            modifier = {
                factor = 0
                has_trait = paranoid
            }
        }
	}	

    option = { #how cool, let's do it again!
		name = coronation_events_klank.1003.c
        custom_tooltip = coronation_tt_positive_tiny
        scope:activity = { activity_special_type_progression_tiny = yes }
        coronation_add_magnificence_log_effect = {
            VALUE = flag:positive_tiny
            CHAR = root
        }
        imprison_character_effect = {
			TARGET = scope:child_of_executee
			IMPRISONER = root
		}

        stress_impact = {
            forgiving = medium_stress_impact_gain
            paranoid = medium_stress_impact_loss
        }

        ai_chance = { #AI should never go for random imprisonment
            base = 0
        }
	}

    option = { #remember to fear us
		name = coronation_events_klank.1003.b
        add_dread = medium_dread_gain
        if = {
            limit = {
                can_add_hook = {
                    type = threat_hook
                    target = scope:child_of_executee
                }
            }
            add_hook = {
                type = threat_hook
                target = scope:child_of_executee
            }
        }

        scope:child_of_executee = {
            stress_impact = { base = medium_stress_impact_gain }
        }

        stress_impact = {
            forgiving = minor_stress_impact_gain
            paranoid = minor_stress_impact_loss
        }
        
        ai_chance = { #AI should choose this option always, if the faith option s not present
            base = 10
        }
	}

	after = {
		# For MP
		coronation_ready_effect = yes
	}
}

coronation_events_klank.1004 = { # You have 2+ kings at your coronation
    type = activity_event
	title = coronation_events_klank.1004.t
	desc = {
        first_valid = {
            triggered_desc = {
                trigger = { scope:activity.var:king_plus_number > 5}
                desc = coronation_events_klank.1004.desc.intro_many_kings
            }
            desc = coronation_events_klank.1004.desc.intro
        }   
        first_valid = {
            triggered_desc = {
                trigger = { exists = scope:fifth_king }
                desc = coronation_events_klank.1004.desc.fifth_king
            }
            triggered_desc = {
                trigger = { exists = scope:fourth_king }
                desc = coronation_events_klank.1004.desc.third_king
            }
            triggered_desc = {
                trigger = { exists = scope:third_king }
                desc = coronation_events_klank.1004.desc.third_king
            }
            desc = coronation_events_klank.1004.desc.second_king
        }
        first_valid = {
            triggered_desc = {
                trigger = { has_activity_intent = coronation_exalt_crown } 
                desc = coronation_events_klank.1004.desc.extoll_reign_intent
            }
            triggered_desc = {
                trigger = { has_activity_intent = coronation_embrace_supporters }
                desc = coronation_events_klank.1004.desc.empower_loyalists_intent
            }
            desc = coronation_events_klank.1004.desc.other_intent
        }
        desc = coronation_events_klank.1004.desc.outro
    }

    left_portrait = {
        triggered_animation = {
            trigger = { has_activity_intent = coronation_exalt_crown }
            animation = personality_bold
        }
        triggered_animation = {
            trigger = { has_activity_intent = coronation_embrace_supporters }
            animation = happiness
        }
        animation = personality_honorable
        character = root
    }

    center_portrait = {
        character = scope:first_king
        animation = personality_content
        camera = camera_event_right
    }

    right_portrait = {
        character = scope:second_king
        animation = personality_rational
    }

    lower_left_portrait = {
        trigger = { exists = scope:third_king }
        character = scope:third_king
    }

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

    lower_right_portrait = {
        trigger = { exists = scope:fifth_king }
        character = scope:fifth_king
    }


    cooldown = { years = 1 }

	theme = coronation_activity

    trigger = {
        involved_activity = {
            any_attending_character = {
                count >= 2
                NOT = { this = root }
                primary_title.tier >= tier_kingdom
                is_independent_ruler = yes
            }
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        scope:activity = {
            set_variable = {
                name = king_plus_number
                value = 0
            }
            set_variable = {
                name = king_independent_number
                value = 0
            }
            every_attending_character = {
                limit = {
                    NOT = { this = root }
                    primary_title.tier >= tier_kingdom
                }
                add_to_list = king_plus_guests
                if = {
                    limit = {
                        is_independent_ruler = yes
                    }
                    scope:activity = {
                        change_variable = {
                            name = king_independent_number
                            add = 1
                        }
                    } 
                }
                scope:activity = {
                    change_variable = {
                        name = king_plus_number
                        add = 1
                    }
                }           
            }
            ordered_in_list = {
                list = king_plus_guests
                order_by = max_military_strength
                save_scope_as = first_king
            }
            ordered_in_list = {
                list = king_plus_guests
                order_by = max_military_strength
                limit = {
                    NOT = {
                        this = scope:first_king
                    } 
                }
                save_scope_as = second_king
            }
            if = {
                limit = {
                    var:king_plus_number >= 3
                }
                ordered_in_list = {
                    list = king_plus_guests
                    order_by = max_military_strength
                    limit = {
                        NOR = {
                            this = scope:first_king
                            this = scope:second_king
                        } 
                    }
                    save_scope_as = third_king
                }
            }
            if = {
                limit = {
                    var:king_plus_number >= 4
                }
                ordered_in_list = {
                    list = king_plus_guests
                    order_by = max_military_strength
                    limit = {
                        NOR = {
                            this = scope:first_king
                            this = scope:second_king
                            this = scope:third_king
                        } 
                    }
                    save_scope_as = fourth_king
                }
            }
            if = {
                limit = {
                    var:king_plus_number >= 5
                }
                ordered_in_list = {
                    list = king_plus_guests
                    order_by = max_military_strength
                    limit = {
                        NOR = {
                            this = scope:first_king
                            this = scope:second_king
                            this = scope:third_king
                            this = scope:fourth_king
                        } 
                    }
                    save_scope_as = fifth_king
                }
            }
        }
    }

    weight_multiplier = {
        base = 1
        modifier = {
            involved_activity = {
                any_attending_character = {
                    count < 4
                    NOT = { this = root }
                    primary_title.tier >= tier_kingdom
                    is_independent_ruler = yes
                }
            }
            add = -0.5
        }
        modifier = {
            involved_activity = {
                any_attending_character = {
                    count >= 5
                    NOT = { this = root }
                    primary_title.tier >= tier_kingdom
                    is_independent_ruler = yes
                }
            }
            add = 1
        }
        modifier = {
            involved_activity = {
                any_attending_character = {
                    count >= 10
                    NOT = { this = root }
                    primary_title.tier >= tier_kingdom
                }
            }
            add = 1
        }
    }

    option = { # Glorify the Crown - I am the coolest
        name = coronation_events_klank.1004.a
        trigger = { has_activity_intent = coronation_exalt_crown }
        if = {
            limit = {
                any_in_list = {
                    list = king_plus_guests
                    count > 5
                }
            }
            every_in_list = {
                list = king_plus_guests
                custom = custom.every_king_plus_attendee
                add_opinion = {
                    target = root
                    modifier = disrespect_opinion
                    opinion = -25
                }
            }
        }
        else = {
            every_in_list = {
                list = king_plus_guests
                add_opinion = {
                    target = root
                    modifier = disrespect_opinion
                    opinion = -30
                }
            }
        }
        if = {
            limit = {
                exists = dynasty
            }
            dynasty = {
                add_dynasty_prestige = {
                    value = miniscule_dynasty_prestige_gain
                    multiply = {
                        value = scope:activity.var:king_independent_number
                        min = 2
                    }
                }
            }
        }

        coronation_exalt_crown_opinion_effect = yes

        custom_tooltip = coronation_events_klank.1004.a_tt

        stress_impact = {
            ambitious = major_stress_impact_loss
            gregarious = major_stress_impact_gain
        }

        ai_chance = {
            base = 40
            modifier = {
                factor = 4
                has_trait = ambitious
            }
            modifier = {
                factor = 0
                has_trait = gregarious
            }
        }
    }

    option = { # embrace supporters - they are the coolest
        name = coronation_events_klank.1004.b
        trigger = { has_activity_intent = coronation_embrace_supporters }
        if = {
            limit = {
                any_in_list = {
                    list = king_plus_guests
                    count > 5
                }
            }
            every_in_list = {
                list = king_plus_guests
                custom = custom.every_king_plus_attendee
                add_opinion = {
                    target = root
                    modifier = respect_opinion
                    opinion = 15
                }
            }
        }
        else = {
            every_in_list = {
                list = king_plus_guests
                add_opinion = {
                    target = root
                    modifier = respect_opinion
                    opinion = 20
                }
            }
        }

        coronation_embrace_supporters_opinion_effect = yes

        stress_impact = {
            ambitious = major_stress_impact_gain
            gregarious = major_stress_impact_loss
        }

        ai_chance = {
            base = 40
            modifier = {
                factor = 0
                has_trait = ambitious
            }
        }
    }

    option = { # I am cool
        name = coronation_events_klank.1004.c
        trigger = {
            NOT = { has_activity_intent = coronation_exalt_crown }
        }
        if = {
            limit = {
                any_in_list = {
                    list = king_plus_guests
                    count > 5
                }
            }
            every_in_list = {
                list = king_plus_guests
                custom = custom.every_king_plus_attendee
                add_opinion = {
                    target = root
                    modifier = disrespect_opinion
                    opinion = -15
                }
            }
        }
        else = {
            every_in_list = {
                list = king_plus_guests
                add_opinion = {
                    target = root
                    modifier = disrespect_opinion
                    opinion = -20
                }
            }
        }
        add_prestige = {
            value = minor_prestige_gain
            multiply = {
                value = scope:activity.var:king_independent_number
                min = 2
            }
        }
        if = {
        	limit = {
        		has_legitimacy = yes
        	}
        	add_legitimacy = {
	            value = miniscule_legitimacy_gain
	            multiply = 0.75
	            multiply = {
	                value = scope:activity.var:king_independent_number
	                min = 2
	            }
	        }
        }

        custom_tooltip = coronation_events_klank.1004.a_tt

        stress_impact = {
            ambitious = medium_stress_impact_loss
            gregarious = medium_stress_impact_gain
        }

        ai_chance = {
            base = 10
            modifier = {
                factor = 4
                legitimacy_level <= 3
            }
            modifier = {
                factor = 0
                has_trait = gregarious
            }
        }
    }

    option = { # They are cool
        name = coronation_events_klank.1004.d
        trigger = {
            NOT = { has_activity_intent = coronation_embrace_supporters }
        }
        if = {
            limit = {
                any_in_list = {
                    list = king_plus_guests
                    count > 5
                }
            }
            every_in_list = {
                list = king_plus_guests
                custom = custom.every_king_plus_attendee
                add_opinion = {
                    target = root
                    modifier = respect_opinion
                    opinion = 10
                }
            }
        }
        else = {
            every_in_list = {
                list = king_plus_guests
                add_opinion = {
                    target = root
                    modifier = respect_opinion
                    opinion = 15
                }
            }
        }

        stress_impact = {
            ambitious = medium_stress_impact_gain
            gregarious = medium_stress_impact_loss
        }

        ai_chance = {
            base = 20
            modifier = {
                factor = 0
                has_trait = ambitious
            }
        }     
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}

coronation_events_klank.1005 = { # Independent duke+ guest wants revenge on a third party
	type = activity_event
	title = coronation_events_klank.1005.t
	desc = coronation_events_klank.1005.desc

	left_portrait = {
		character = root
		animation = interested 
        camera = camera_event_very_left
	}

    center_portrait = {
        character = scope:friendly_king
        animation = rage
    }

    right_portrait = {
        character = scope:npc_guest
        animation = boredom
        camera = camera_event_very_right
    }

    lower_right_portrait = {
        character = scope:unfriendly_king
    }

    cooldown = { years = 1 }

	theme = coronation_activity

    trigger = {
        scope:activity = {
            any_attending_character = {
                is_ai = yes
                is_independent_ruler = yes
                primary_title.tier >= tier_duchy
                NOR = {
                    has_character_modifier = ach_partners_in_revanchism_active_modifier
                    has_character_modifier = ach_partners_in_revanchism_passive_modifier
                }
                save_temporary_scope_as = temp_check_guest
                any_memory = {
                    has_memory_type = war_lost
                    any_memory_participant = {
                        is_alive = yes
                        is_independent_ruler = yes
                        scope:temp_check_guest = {
                            opinion = {
                                target = prev
                                value <= -20
                            }
                        }
                        NOT = { this = root }
                    }
                }
                NOT = { this  = root }
            }
        }
        NOR = {
            has_character_modifier = ach_partners_in_revanchism_active_modifier
            has_character_modifier = ach_partners_in_revanchism_passive_modifier
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        scope:activity = {
            random_attending_character = {
                limit = {
                    NOT = { this = root }
                    is_ai = yes
                    is_independent_ruler = yes
                    primary_title.tier >= tier_duchy
                    NOR = {
                        has_character_modifier = ach_partners_in_revanchism_active_modifier
                        has_character_modifier = ach_partners_in_revanchism_passive_modifier
                    }
                    save_temporary_scope_as = temp_check_guest
                    any_memory = {
                        has_memory_type = war_lost
                        any_memory_participant = {
                            is_alive = yes
                            is_independent_ruler = yes
                            scope:temp_check_guest = {
                                opinion = {
                                    target = prev
                                    value <= -20
                                }
                            }
                        }
                    }
                }
                save_scope_as = friendly_king
                           
                random_memory = {
                    limit = {
                        has_memory_type = war_lost
                        any_memory_participant = {
                            is_alive = yes
                            is_independent_ruler = yes
                            scope:temp_check_guest = {
                                opinion = {
                                    target = prev
                                    value <= -20
                                }
                            }
                            NOT = { this = root }
                        }
                    }
                    save_scope_as = war_memory
                    random_memory_participant = {
                        limit = {
                            NOT = { this = scope:friendly_king }
                            NOT = { this = root }
                        }
                        save_scope_as = unfriendly_king
                    }
                }

                hidden_effect = { #we pull a couple sneakies
                    if = {
                        limit = {
                            stress_level <= 2
                        }
                        add_stress = 100 #guy is stressed from the experience and cannot let go
                    }
                    if = {
                        limit = {
                            has_trait = forgiving
                        }
                        remove_trait = forgiving
                        add_trait = vengeful
                    }
                    else_if = {
                        limit = {
                            NOR = {
                                has_trait = vengeful
                                number_of_personality_traits <= 3
                            }
                        }
                        add_trait = vengeful
                    }
                }
            }
            random_attending_character = {
                limit = {
                    NOT = {
                        is_playable_character = yes
                    }
                }         
                save_scope_as = npc_guest
            }
        }
    }

    option = { #Simply listen to his tales of woes and be supportive
        name = coronation_events_klank.1005.a
        trigger = {
            has_activity_intent = coronation_embrace_supporters
        }
        scope:activity = { activity_special_type_progression_medium = yes }
        custom_tooltip = coronation_tt_positive_medium
        coronation_add_magnificence_log_effect = {
            VALUE = flag:positive_medium
            CHAR = root
        }

        add_character_modifier = {
            modifier = ach_how_to_lose_a_war_listener_modifier
            years = 4
        }
        if = {
            limit = {
                OR = {
                    scope:friendly_king = { is_ai = yes }
                    AND = {
                        scope:friendly_king = { is_ai = no }
                        is_ai = no
                    }
                }
                reverse_opinion = {
                    target = scope:friendly_king
                    value > 20
                }
            }
            progress_towards_friend_effect = {
		      	REASON = friend_free_therapy
		      	CHARACTER = scope:friendly_king
		      	OPINION = 10
            }
        }
        else = {
            reverse_add_opinion = {
                modifier = kindness_opinion
                target = scope:friendly_king
                opinion = 20
            }
        }
        coronation_move_towards_supporter_effect = { CHARACTER = scope:friendly_king }
        scope:friendly_king = {
            stress_impact = {
                base = massive_stress_impact_loss
                paranoid = major_stress_impact_gain
            }
            add_character_modifier = {
                modifier = ach_how_to_lose_a_war_talker_modifier
                years = 4
            }
        }

        coronation_embrace_supporters_opinion_effect = yes

        stress_impact = {
            calm = medium_stress_impact_loss
            forgiving = medium_stress_impact_loss
            gregarious = medium_stress_impact_loss
            diplomat = major_stress_impact_loss
        }

        ai_chance = {
            base = 10
            opinion_modifier = {
		    	opinion_target = scope:unfriendly_king
		    	multiplier = 0.5
		    }
            opinion_modifier = {
		    	opinion_target = scope:friendly_king
		    	multiplier = -0.5
		    }
        }
    }

    option = { #Get him to chill permanently
        name = coronation_events_klank.1005.b
         flavor = coronation_events_klank.1005.flavor
        
        if = {
            limit = {
                scope:unfriendly_king = { is_ai = no }
            }
            custom_tooltip = coronation_events_klank.1005.other_player_informed_tt
            save_scope_as = coronation_host
            scope:activity = { save_scope_as = coronation_activity }
            location = { save_scope_as = location }

            scope:unfriendly_king = {
                trigger_event = {
                    id = coronation_events_klank.1006
                    days = { 12 24 }
                }
            }
        }

        trigger = {
            intrigue >= scope:friendly_king.intrigue
            diplomacy >= 14
        }

        show_as_unavailable = { always = yes }

        
        scope:friendly_king = {
            add_character_modifier = {
                modifier = ach_neutered_revanchist_modifier
                years = 8
            }
            remove_trait = vengeful
            add_trait = craven
        }
        add_character_modifier = {
            modifier = ach_peace_broker_modifier
            years = 4
        }

        stress_impact = {
            callous = medium_stress_impact_loss
            vengeful = major_stress_impact_gain
        }

        ai_chance = {
            base = 10
            opinion_modifier = {
		    	opinion_target = scope:unfriendly_king
		    	multiplier = 0.5
		    }
            opinion_modifier = {
		    	opinion_target = scope:friendly_king
		    	multiplier = -0.5
		    }
            modifier = {
                has_trait = vengeful
                factor = 0
            }
        }

       
    }

    option = { #yeah, let's go wreck the guy
        name = coronation_events_klank.1005.c
        name = {
            trigger = { has_trait = vengeful}
            text = coronation_events_klank.1005.c.vengeful
        }
        custom_tooltip = coronation_events_klank.1005.c.tooltip

        

        if = {
            limit = {
                scope:unfriendly_king = { is_ai = no }
            }
            custom_tooltip = coronation_events_klank.1005.other_player_informed_tt
            save_scope_as = coronation_host
            scope:activity = { save_scope_as = coronation_activity }
            location = { save_scope_as = location }

            scope:unfriendly_king = {
                trigger_event = {
                    id = coronation_events_klank.1007
                    days = { 12 24}
                }
            }
        }

        add_character_modifier = {
            modifier = ach_partners_in_revanchism_passive_modifier
            years = 6
        }
        set_variable = {
            name = coronation_event_1005_target
            value = scope:unfriendly_king
        }
        scope:friendly_king = {
            add_character_modifier = {
                modifier = ach_partners_in_revanchism_passive_modifier
                years = 6
            }
            set_variable = {
                name = coronation_event_1005_target
                value = scope:unfriendly_king
            }
        }
        

        stress_impact = {
            vengeful = medium_stress_impact_loss
            wrathful = medium_stress_impact_loss
            ambitious = medium_stress_impact_loss
        }

        ai_chance = {
            base = 10
            opinion_modifier = {
		    	opinion_target = scope:unfriendly_king
		    	multiplier = -1
		    }
            opinion_modifier = {
		    	opinion_target = scope:friendly_king
		    	multiplier = 0.5
		    }
            modifier = {
                OR = {
                    has_trait = vengeful
                    has_trait = wrathful
                    has_trait = ambitious
                }
                add = 40
            }
        }
    }

    option = { #NPC! Take care of this.
        name = coronation_events_klank.1005.d

        custom_tooltip = coronation_tt_positive_tiny
        scope:activity = { activity_special_type_progression_tiny = yes }
        coronation_add_magnificence_log_effect = {
            VALUE = flag:positive_tiny
            CHAR = root
        }

        scope:friendly_king = {
            add_opinion = {
                target = root
                modifier = friendliness_opinion
                opinion = 10
            }
            stress_impact = {
                base = major_stress_impact_loss
                paranoid = major_stress_impact_gain
            }
            add_character_modifier = {
                modifier = ach_how_to_lose_a_war_talker_modifier
                years = 2
            }
        }
        scope:npc_guest = {
            stress_impact = {
                base = major_stress_gain
            }
        }

        ai_chance = {
            base = 40 #balanced out by the other options
        }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}

coronation_events_klank.1006 = {
    type = letter_event
    opening = coronation_events_klank.1006.t
    desc = coronation_events_klank.1006.desc
    sender = scope:npc_guest

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        scope:friendly_king = {
            show_as_tooltip = {
                add_character_modifier = {
                    modifier = ach_neutered_revanchist_modifier
                    years = 8
                }
                remove_trait = vengeful
                add_trait = craven
            }
        }
        scope:coronation_host = {
            show_as_tooltip = {
                add_character_modifier = {
                    modifier = ach_peace_broker_modifier
                    years = 4
                }
            }
        }  
    }

    option = {
        name = coronation_events_klank.1006.a
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}

coronation_events_klank.1007 = {
    type = letter_event
    opening = coronation_events_klank.1007.t
    desc = coronation_events_klank.1007.desc
    sender = scope:npc_guest

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        show_as_tooltip = {
            scope:coronation_host = {
                add_character_modifier = {
                    modifier = ach_partners_in_revanchism_passive_modifier
                    years = 6
                }
            }
            scope:friendly_king = {
                add_character_modifier = {
                    modifier = ach_partners_in_revanchism_passive_modifier
                    years = 6
                }
            }
        }
    }

    option = {
        name = coronation_events_klank.1007.a
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}

coronation_events_klank.1008 = { # King from your dynasty attends your coronation
	type = activity_event
	title = coronation_events_klank.1008.t
	desc = {
        first_valid = {
            triggered_desc = {
                trigger = { scope:king_opinion ?= flag:friendly }
                desc = coronation_events_klank.1008.desc.friendly
            }
            triggered_desc = {
                trigger = { scope:king_opinion ?= flag:hostile }
                desc = coronation_events_klank.1008.desc.hostile
            }
            desc = coronation_events_klank.1008.desc.neutral
        }
        desc = coronation_events_klank.1008.desc.outro
    }

    left_portrait = {
        character = root
        triggered_animation = {
            trigger = { scope:king_opinion ?= flag:friendly }
            animation = happiness
        }
        triggered_animation = {
            trigger = { scope:king_opinion ?= flag:hostile }
            animation = disgust
        }
        animation = personality_bold
    }

    right_portrait = {
        character = scope:dynasty_king
        triggered_animation = {
            trigger = { scope:king_opinion ?= flag:friendly }
            animation = admiration
        }
        triggered_animation = {
            trigger = { scope:king_opinion ?= flag:hostile }
            animation = personality_callous
        }
        animation = personality_content
    }

    cooldown = { years = 1 }

	theme = coronation_activity

    trigger = {
        scope:activity = {
            any_attending_character = {
                primary_title.tier >= tier_kingdom
                dynasty = root.dynasty
                is_ai = yes
                NOT = {
                    this = root
                }
            }
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        save_scope_value_as = { #error suppresion
            name = king_opinion
            value = flag:empty
        }
        scope:activity = {
            random_attending_character = {
                limit = {
                    primary_title.tier >= tier_kingdom
                    dynasty = root.dynasty
                    is_ai = yes
                    NOT = {
                        this = root
                    }
                }
                save_scope_as = dynasty_king
                if = {
                    limit = {
                        likes_character_trigger = { CHARACTER = root }
                    }
                    save_scope_value_as = {
                        name = king_opinion 
                        value = flag:friendly
                    }
                }
                else_if = {
                    limit = {
                        OR = {
                            has_any_bad_relationship_with_character_trigger = { CHARACTER = root }
                            opinion = {
		                    	target = root
		                    	value <= -25
		                    }
                            AND = {
                                has_relation_potential_rival = root
                                opinion = {
		                        	target = root
		                        	value <= 0
		                        }
                            }
                        }
                    }
                    save_scope_value_as = {
                        name = king_opinion 
                        value = flag:hostile
                    }
                }
            }
        }
    }

    option = { #Embrace Supporters Intent - how cool to have you here
        name = coronation_events_klank.1008.a
        trigger = {
            has_activity_intent = coronation_embrace_supporters
            NOT = { scope:king_opinion ?= flag:hostile }
        }

        dynasty = { add_dynasty_prestige = medium_dynasty_prestige_gain }

        custom_tooltip = coronation_tt_positive_medium
        scope:activity = { activity_special_type_progression_medium = yes }
        coronation_add_magnificence_log_effect = {
            VALUE = flag:positive_medium
            CHAR = root
        }

        progress_towards_friend_effect = {
			REASON = friend_dynasty_welcomed_at_coronation
			CHARACTER = scope:dynasty_king
            OPINION = default_friend_opinion
		}

		coronation_embrace_supporters_opinion_effect = yes

        stress_impact = {
            shy = minor_stress_impact_gain
            gregarious = medium_stress_impact_loss
            trusting = medium_stress_impact_loss
            compassionate = medium_stress_impact_loss
            humble = medium_stress_impact_loss
        }

        ai_chance = {
            base = 100 #Always go for intents
        }
    }

    option = { # How cool to have you here
        name = coronation_events_klank.1008.b
        trigger = {
            NOR = {
                scope:king_opinion ?= flag:hostile
                has_activity_intent = coronation_embrace_supporters
            }
        }

        dynasty = { add_dynasty_prestige = minor_dynasty_prestige_gain }
        if = {
            limit = {
                OR = {
                    scope:dynasty_king = { is_ai = yes }
                    AND = {
                        scope:dynasty_king = { is_ai = no }
                        is_ai = no
                    }
                }
                reverse_opinion = {
                    target = scope:dynasty_king
                    value >= 20
                }
            }
            progress_towards_friend_effect = {
		      	REASON = friend_dynasty_welcomed_at_coronation
		      	CHARACTER = scope:dynasty_king
		      	OPINION = default_friend_opinion
            }
        }
        else = {
            reverse_add_opinion = {
                modifier = grateful_opinion
                target = scope:dynasty_king
                opinion = 20
            }
        }
        coronation_move_towards_supporter_effect = { CHARACTER = scope:dynasty_king }

        stress_impact = {
            shy = minor_stress_impact_gain
            gregarious = minor_stress_impact_loss
            trusting = minor_stress_impact_loss
            compassionate = minor_stress_impact_loss
            humble = minor_stress_impact_loss
        }

        ai_chance = {
            base = 10
            modifier = {
                has_trait = shy
                factor = 0.1
            }
        }
    }

    option = { # Glorify the Crown - How cool our dynasty is
        name = coronation_events_klank.1008.c
        trigger = {
            has_activity_intent = coronation_exalt_crown
            NOT = { scope:king_opinion ?= flag:hostile }
        }

        custom_tooltip = coronation_tt_positive_medium
        scope:activity = { activity_special_type_progression_medium = yes }
        coronation_add_magnificence_log_effect = {
            VALUE = flag:positive_medium
            CHAR = root
        }

        dynasty = { add_dynasty_prestige = major_dynasty_prestige_gain }
        add_legitimacy = medium_legitimacy_gain
        scope:dynasty_king = { add_legitimacy = medium_legitimacy_gain }

        if = {
            limit = {
                scope:dynasty_king = dynasty.dynast
            }
            scope:dynasty_king = {
                add_opinion = {
                    modifier = respect_opinion
                    target = root
                    opinion = 20
                }   
            }
        }
        else_if = {
            limit = {
                NOT = { root = dynasty.dynast}
            }
            dynasty.dynast = {
                add_opinion = {
                    modifier = respect_opinion
                    target = root
                    opinion = 10
                }
                add_opinion = {
                    modifier = respect_opinion
                    target = scope:dynasty_king
                    opinion = 10
                }      
            }
        }

        coronation_exalt_crown_opinion_effect = yes

        stress_impact = {
            ambitious = medium_stress_impact_loss
        }

        ai_chance = {
            base = 100 #Always go for intents
        }
    }

    option = { # How cool our dynasty is
        name = coronation_events_klank.1008.d

        trigger = { NOT = { has_activity_intent = coronation_exalt_crown } }

        dynasty = { add_dynasty_prestige = minor_dynasty_prestige_gain }
        add_legitimacy = minor_legitimacy_gain
        scope:dynasty_king = { add_legitimacy = minor_legitimacy_gain }

        if = {
            limit = {
                scope:dynasty_king = dynasty.dynast
            }
            scope:dynasty_king = {
                add_opinion = {
                    modifier = respect_opinion
                    target = root
                    opinion = 10
                }   
            }
        }
        else_if = {
            limit = {
                NOT = { root = dynasty.dynast}
            }
            dynasty.dynast = {
                add_opinion = {
                    modifier = respect_opinion
                    target = root
                    opinion = 5
                }
                add_opinion = {
                    modifier = respect_opinion
                    target = scope:dynasty_king
                    opinion = 5
                }      
            }
        }

        stress_impact = {
            ambitious = minor_stress_impact_loss
        }

        ai_chance = {
            base = 10
        }
    }

    option = { # How cool am I
        name = coronation_events_klank.1008.e

        dynasty = { add_dynasty_prestige = minor_dynasty_prestige_gain }
        add_legitimacy = medium_legitimacy_gain

        scope:dynasty_king = {
            add_opinion = {
                modifier = disrespect_opinion
                target = root
                opinion = -10
            } 
        }

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

        ai_chance = {
            base = 10
            modifier = {
                has_trait = humble
                factor = 0.1
            }
        }
    }

    option = { #Isolate Opponents Intent - render upon me
        name = coronation_events_klank.1008.f
        trigger = {
            has_activity_intent = coronation_weaken_detractors
            scope:king_opinion ?= flag:hostile
        }

        custom_tooltip = coronation_tt_positive_tiny
        scope:activity = { activity_special_type_progression_tiny = yes }
        coronation_add_magnificence_log_effect = {
            VALUE = flag:positive_tiny
            CHAR = root
        }

        if = {
            limit = {
                can_add_hook = {
                    type = threat_hook
                    target = scope:dynasty_king
                }
            }
            add_hook = {
                type = threat_hook
                target = scope:dynasty_king
            }
        }

        scope:dynasty_king = {
            add_opinion = {
                modifier = forced_to_kneel_opinion
                target = root
                opinion = -40
            } 
        }

        coronation_weaken_detractors_opinion_effect = yes

        stress_impact = {
            compassionate = medium_stress_impact_gain
            wrathful = medium_stress_impact_loss
            arrogant = medium_stress_impact_loss
        }

        ai_chance = {
            base = 100 #Always go for intents
        }
    }

    option = { #I AM THE GETDYNASTY.GETNAME
        name = coronation_events_klank.1008.g
        trigger = {
            scope:king_opinion ?= flag:hostile
            this = dynasty.dynast
        }

        add_legitimacy = major_legitimacy_gain

        if = {
            limit = {
                can_add_hook = {
                    type = threat_hook
                    target = scope:dynasty_king
                }
            }
            add_hook = {
                type = threat_hook
                target = scope:dynasty_king
            }
        }

        scope:dynasty_king = {
            add_opinion = {
                modifier = forced_to_kneel_opinion
                target = root
                opinion = -40
            } 
        }
        dynasty = {
            every_dynasty_member = {
                limit = {
                    is_independent_ruler = yes
                    primary_title.tier >= scope:dynasty_king.primary_title.tier
                    NOR = {
                        this = root
                        this = scope:dynasty_king
                        has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:dynasty_king }
                    }
                }

                add_opinion = {
                    modifier = insult_opinion
                    target = root
                    opinion = -10
                }
            }
        }
        

        stress_impact = {
            wrathful = minor_stress_impact_loss
            ambitious = minor_stress_impact_loss
        }

        ai_chance = {
            base = 10 #modified by other options, also a good unlock
            modifier = {
                max_military_strength <= scope:dynasty_king.max_military_strength # do not alienate somebody stronger than you
                factor = 0
            }
        }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}

coronation_events_klank.1009 = {
    type = activity_event
	title = coronation_events_klank.1009.t
	desc = coronation_events_klank.1009.desc

    left_portrait = {
        character = scope:left_struggle
        animation = personality_content
    }

    center_portrait = {
        character = root
        animation = personality_bold
    }

    right_portrait = {
        character = scope:right_struggle
        animation = personality_vengeful
    }

    cooldown = { years = 10 }

    weight_multiplier = {
        base = 1

        modifier = {
            add = 3
            is_ai = no
        }
    }

	theme = coronation_activity

    trigger = {
        any_character_struggle = {
			involvement = involved
            OR = {
                is_struggle_type = iberian_struggle
                is_struggle_type = persian_struggle
            }
            save_temporary_scope_as = temp_struggle
		}
        scope:activity = {
            any_attending_character = {
                is_in_guest_subset = { name = supporter }
                NOT = { this = root}
                any_character_struggle = {
                    involvement = involved
                    this = scope:temp_struggle
                }
                save_temporary_scope_as = char_check
            }
            any_attending_character = {
                is_in_guest_subset = { name = detractor }
                NOR = { this = root this = scope:char_check }
                any_character_struggle = {
                    involvement = involved
                    this = scope:temp_struggle
                }
            }
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        random_character_struggle = {
            involvement = involved
            limit = {
                OR = {
                    is_struggle_type = iberian_struggle
                    is_struggle_type = persian_struggle
                }
            }
            save_scope_as = char_struggle
        }
        scope:activity = {
            activity_host = { save_scope_as = host }
            random_attending_character = {
                limit = {
                    is_in_guest_subset = { name = supporter }
                    NOT = {
                        this = root
                    }
                    any_character_struggle = {
                        involvement = involved
                        this = scope:char_struggle
                    }
                }
                save_scope_as = left_struggle
            }
            random_attending_character = {
                limit = {
                    is_in_guest_subset = { name = detractor }
                    NOR = {
                        this = root
                        this = scope:left_struggle
                    }
                    any_character_struggle = {
                        involvement = involved
                        this = scope:char_struggle
                    }
                }
                save_scope_as = right_struggle
            }
        }
        random_religion_global = { 
            limit = {
                any_faith = {
                    scope:char_struggle = { is_faith_involved_in_struggle = prev }
                    num_county_followers > 0
                    NOT = {
                        this = root.faith
                        this = scope:right_struggle.faith
                        this = scope:left_struggle.faith
                    }
                }
            }
            random_faith = {
                limit = {             
                    scope:char_struggle = { is_faith_involved_in_struggle = prev }
                    num_county_followers > 0
                    NOT = {
                        this = root.faith
                        this = scope:right_struggle.faith
                        this = scope:left_struggle.faith
                    }
                }
                save_scope_as = first_struggle_faith
            }
        }

        random_culture_global = {
            limit = {
                scope:char_struggle = { is_culture_involved_in_struggle = prev }
                culture_number_of_counties > 0
                NOT = {
                    this = root.culture
                    this = scope:right_struggle.culture
                    this = scope:left_struggle.culture
                }
            }
            save_scope_as = first_struggle_culture
        }
    }

    option = { #Forget the outside, enjoy my coronation
        name = coronation_events_klank.1009.a
        trigger = { has_activity_intent = coronation_impress_attendees }
        scope:activity = { activity_special_type_progression_tiny = yes }
        custom_tooltip = coronation_tt_positive_tiny
        coronation_add_magnificence_log_effect = {
            VALUE = flag:positive_tiny
            CHAR = root
        }

        culture = {
            change_cultural_acceptance = {
		    	target = scope:first_struggle_culture
		    	value = miniscule_negative_culture_acceptance
		    	desc = cultural_acceptance_gain_event
		    }
            if = {
                limit = {
                    scope:first_struggle_faith.religious_head.culture != scope:first_struggle_culture
                }
                change_cultural_acceptance = {
                    target = scope:first_struggle_faith.religious_head.culture
                    value = miniscule_negative_culture_acceptance
                    desc = cultural_acceptance_gain_event
                }
            }
        }

        scope:left_struggle = {
            add_opinion = {
                target = root
                modifier = friendliness_opinion
                opinion = 5
            }
        }
        scope:right_struggle = {
            add_opinion = {
                target = root
                modifier = friendliness_opinion
                opinion = 5
            }
        }

        coronation_impress_attendees_opinion_effect = yes

        stress_impact = {
            base = medium_stress_impact_gain
            gregarious = minor_stress_impact_loss
            calm = minor_stress_impact_loss
        }

        ai_chance = {
            base = 10
            modifier = {
                has_trait = gregarious
                add = 10
            }
            modifier = {
                has_trait = calm
                add = 10
            }
        }
    }

    option = { #Silence, detractor
        name = coronation_events_klank.1009.b

        culture = {
            change_cultural_acceptance = {
		    	target = scope:right_struggle.culture
		    	value = miniscule_positive_culture_acceptance
		    	desc = cultural_acceptance_gain_event
		    }
            change_cultural_acceptance = {
		    	target = scope:first_struggle_culture
		    	value = miniscule_negative_culture_acceptance
		    	desc = cultural_acceptance_gain_event
		    }
            if = {
                limit = {
                    scope:first_struggle_faith.religious_head.culture != scope:first_struggle_culture
                }
                change_cultural_acceptance = {
                    target = scope:first_struggle_faith.religious_head.culture
                    value = miniscule_positive_culture_acceptance
                    desc = cultural_acceptance_gain_event
                }
            }
        }

        scope:left_struggle = {
            add_opinion = {
                target = root
                modifier = respect_opinion
                opinion = 10
            }
        }
        scope:right_struggle = {
            add_opinion = {
                target = root
                modifier = irritated_opinion
                opinion = -10
            }
        }

        if = {
            limit = {
                NOT = {
                    this = scope:host
                }
            }    
            scope:host = {
                add_opinion = {
                    target = root
                    modifier = respect_opinion
                    opinion = 5
                }
            }
        }

        stress_impact = {
            wrathful = minor_stress_impact_loss
        }

        ai_chance = {
            base = 1
            modifier = {
                has_trait = wrathful
                factor = 0.2
            }
        }
    }

    option = { #we need to support our guy in time of current_phase
        name = coronation_events_klank.1009.c
        trigger = { has_activity_intent = coronation_offer_support }
        scope:activity = {
            add_activity_log_entry = {
                key = coronation_guest_struggle_support_log
				score = 25
				character = root
				target = scope:host
                if = {
                    limit = {
                        scope:host = {
                           government_allows = administrative
                        }
                    }
                    scope:host = { change_influence = medium_influence_gain add_legitimacy = miniscule_legitimacy_gain }
                }
                scope:host = { add_prestige = medium_prestige_gain add_legitimacy = miniscule_legitimacy_gain }

                activity_special_type_progression_tiny = yes
                custom_tooltip = coronation_tt_positive_tiny
            }
        }

        scope:left_struggle = {
            add_opinion = {
                target = root
                modifier = respect_opinion
                opinion = 20
            }
        }
        scope:right_struggle = {
            add_opinion = {
                target = root
                modifier = irritated_opinion
                opinion = -20
            }
        }
        scope:host = {
            add_opinion = {
                target = root
                modifier = respect_opinion
                opinion = 10
            }
        }

        stress_impact = {
            loyal = minor_stress_impact_loss
        }

        ai_chance = {
            base = 10
            modifier = {
                has_trait = loyal
                add = 10
            }
        }
    }

    option = { #this is a good, ekhm, opportunity
        name = coronation_events_klank.1008.c
        trigger = { has_activity_intent = coronation_disrupt_loyalists }
        scope:activity = {
            add_activity_log_entry = {
                key = coronation_guest_struggle_undermine_log
				score = 25
				character = root
				target = scope:host
                if = {
                    limit = {
                       scope:host = { government_allows = administrative }
                    }
                    scope:host = { change_influence = medium_influence_loss add_legitimacy = miniscule_legitimacy_loss }
                }
                scope:host = { add_prestige = medium_prestige_loss add_legitimacy = miniscule_legitimacy_loss }

                activity_special_type_progression_variable = { NUM = -5 }
                custom_tooltip = coronation_tt_negative
            }
        }

        scope:right_struggle = {
            add_opinion = {
                target = root
                modifier = respect_opinion
                opinion = 20
            }
        }
        scope:left_struggle = {
            add_opinion = {
                target = root
                modifier = irritated_opinion
                opinion = -20
            }
        }
        scope:host = {
            add_opinion = {
                target = root
                modifier = respect_opinion
                opinion = 10
            }
        }

        stress_impact = {
            disloyal = minor_stress_impact_loss
        }

        ai_chance = {
            base = 10
            modifier = {
                has_trait = disloyal
                add = 10
            }
        }
    }

    option = { #Alas, this truly be the times
        name = coronation_events_klank.1008.b

        add_character_modifier = {
            modifier = ach_enlightened_centrist
            years = 4
        }

        scope:right_struggle = {
            add_opinion = {
                target = root
                modifier = irritated_opinion
                opinion = -10
            }
        }
        scope:left_struggle = {
            add_opinion = {
                target = root
                modifier = irritated_opinion
                opinion = -10
            }
        }

        stress_impact = {
            ambitious = minor_stress_impact_loss
        }

        ai_chance = {
            base = 10
            modifier = {
                has_trait = ambitious
                add = 10
            }
        }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}

coronation_events_klank.1010 = {
    type = activity_event
	title = coronation_events_klank.1010.t
	desc = {
        first_valid = {
            triggered_desc = {
                desc = coronation_events_klank.1010.desc.intro_caliph
                trigger = { scope:activity.activity_host = { has_title = title:d_sunni } }
            }
            triggered_desc = {
                desc = coronation_events_klank.1010.desc.intro_supporter
                trigger = { has_trait = fp3_struggle_supporter }
            }
            desc = coronation_events_klank.1010.desc.intro_detractor
        }
        first_valid = {
            triggered_desc = {
                desc = coronation_events_klank.1010.desc.mid_supporter
                trigger = { has_trait = fp3_struggle_supporter }
            }
            desc = coronation_events_klank.1010.desc.mid_detractor
        }
        desc = coronation_events_klank.1010.outro
    }

    left_portrait = {
        character = root
        camera = camera_event_very_left
        animation = storyteller
    }

    center_portrait = {
        character = scope:struggle_participant
        camera = camera_event_very_right
        animation = personality_vengeful
    }

    lower_left_portrait = {
        character = scope:caliph
        trigger = {
            scope:coronation_host ?= {
                exists = this
                NOT = { this = scope:caliph }
            }
        }
    }

    right_portrait = {
        character = scope:coronation_host
        camera = camera_event_very_right_fov50
        animation = throne_room_cheer_2
        trigger = {
            scope:coronation_host ?= {
                exists = this
            }
        }
    }

    cooldown = { years = 10 }

    weight_multiplier = {
        base = 1

        modifier = {
            add = 3
            is_ai = no
        }
    }

	theme = coronation_activity

    trigger = {
        NOT = { has_activity_intent = coronation_disrupt_loyalists }
        faith.religion = religion:islam_religion
        NOT = { has_title = title:d_sunni }
        any_character_struggle = {
            involvement = involved
            this = struggle:persian_struggle
        }
        scope:activity = {
            activity_host = {
                NOT = { has_character_flag = fp3_struggle_coronation_event }
                trigger_if = {
                    limit = { has_trait = fp3_struggle_supporter }
                    root = { has_trait = fp3_struggle_supporter }
                }
                trigger_else_if = {
                    limit = { has_trait = fp3_struggle_detractor }
                    root = { has_trait = fp3_struggle_detractor }
                }
                trigger_else = {
                    has_title = title:d_sunni
                    root = { has_trait = fp3_struggle_supporter }
                }
            }
            any_attending_character = {
                NOT = { this = root }
                faith.religion = religion:islam_religion
                NOT = { has_title = title:d_sunni }
                any_character_struggle = {
                    involvement = involved
                    this = struggle:persian_struggle        
                }
                trigger_if = {
                    limit = { root = { has_trait = fp3_struggle_detractor } }
                    has_trait = fp3_struggle_supporter
                }
                trigger_else = { has_trait = fp3_struggle_detractor }
            }
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        scope:activity = {
            activity_location = { save_scope_as = location }

            random_attending_character = {
                limit = {
                    NOT = { this = root }
                    faith.religion = religion:islam_religion
                    NOT = { has_title = title:d_sunni}
                    any_character_struggle = {
                        involvement = involved
                        this = struggle:persian_struggle
                    }
                    trigger_if = {
                        limit = { root = { has_trait = fp3_struggle_detractor } }
                        has_trait = fp3_struggle_supporter
                    }
                    trigger_else = { has_trait = fp3_struggle_detractor }
                }
                save_scope_as = struggle_participant
            }
            title:d_sunni.holder = { save_scope_as = caliph }
        }
        struggle:persian_struggle = { save_scope_as = persian_struggle }
        scope:activity.activity_host = {
            add_character_flag = fp3_struggle_coronation_event
            if = {
                limit = { NOT = { this = root} }
                save_scope_as = coronation_host
            }
        } 
    }

    option = { #join my side?
        name = coronation_events_klank.1010.a
        trigger = { diplomacy >= 16 }
        show_as_unavailable = { scope:struggle_participant = { is_ai = yes } }

        scope:struggle_participant = {
            if = {
                limit = { has_trait = fp3_struggle_detractor }
                remove_trait = fp3_struggle_detractor
                add_trait = fp3_struggle_supporter
                scope:caliph = {
                    add_opinion = {
                        modifier = helpful_opinion
                        opinion = 10
                        target = root
                    }
                }
            }
            else = {
                remove_trait = fp3_struggle_supporter
                add_trait = fp3_struggle_detractor
                scope:caliph = {
                    add_opinion = {
                        modifier = hate_opinion
                        opinion = -10
                        target = root
                    }
                }
            }
        }

        stress_impact = {
            zealous = minor_stress_impact_loss
        }

        struggle:persian_struggle = {
            if = {
                limit = {
                    is_struggle_phase = struggle_persia_phase_unrest
                    root = { has_trait = fp3_struggle_supporter }
                }
                custom_tooltip = coronation_events_klank.1010.b.catalyst_stabilization
                hidden_effect = {
                    activate_struggle_catalyst = {
		            	catalyst = catalyst_coronation_event_stabilization
		            	character = root
		            }
                }
            }
            else_if = {
                limit = {
                    is_struggle_phase = struggle_persia_phase_stabilisation
                    root = { has_trait = fp3_struggle_detractor }
                }
                custom_tooltip = coronation_events_klank.1010.b.catalyst_unrest
                hidden_effect = {
                    activate_struggle_catalyst = {
		            	catalyst = catalyst_coronation_event_unrest
		            	character = root
		            }
                }
            }
            else = {
                custom_tooltip = coronation_events_klank.1010.b.catalyst_concession
                hidden_effect = {
                    struggle:persian_struggle = {
                        activate_struggle_catalyst = {
		                	catalyst = catalyst_coronation_event_concession
		                	character = root
		                }
                    }
                }
            }
        }

        ai_chance = 100
    }

    option = { #loudly push for other phase
        name = coronation_events_klank.1010.b

        trigger = {
            OR = {
                AND = { has_trait = fp3_struggle_detractor struggle:persian_struggle = { is_struggle_phase = struggle_persia_phase_stabilisation } }
                AND = { has_trait = fp3_struggle_supporter struggle:persian_struggle = { is_struggle_phase = struggle_persia_phase_unrest } }
            }
        }
        
        struggle:persian_struggle = {
            if = {
                limit = {
                    is_struggle_phase = struggle_persia_phase_unrest
                }
                custom_tooltip = coronation_events_klank.1010.b.catalyst_stabilization
                hidden_effect = {
                    activate_struggle_catalyst = {
		            	catalyst = catalyst_coronation_event_stabilization
		            	character = root
		            }
                }
            }
            else = {
                custom_tooltip = coronation_events_klank.1010.b.catalyst_unrest
                hidden_effect = {
                    activate_struggle_catalyst = {
		            	catalyst = catalyst_coronation_event_unrest
		            	character = root
		            }
                }
            }
        }


        stress_impact = {
            arbitrary = minor_stress_impact_loss
            fickle = minor_stress_impact_loss
        }
        
        ai_chance = {
            base = 1
            modifier = {
                add = 10
                has_trait = fickle
            }
        }
    }

    option = { #loudly push for Concession
        name = coronation_events_klank.1010.c
        custom_tooltip = coronation_events_klank.1010.b.catalyst_concession
        hidden_effect = {
            struggle:persian_struggle = {
                activate_struggle_catalyst = {
		        	catalyst = catalyst_coronation_event_concession
		        	character = root
		        }
            }
        }

        stress_impact = {
            compassionate = minor_stress_impact_loss
            calm = minor_stress_impact_loss
        }

        ai_chance = {
            base = 1
            modifier = {
                add = 10
                has_trait = compassionate
            }
        }
    }

    option = { #render upon caliph
        name = coronation_events_klank.1010.d
        trigger = {
            has_trait = fp3_struggle_supporter scope:activity.activity_host = { has_title = title:d_sunni }
        }

        if = {
            limit = {
                scope:struggle_participant = { is_ai = yes }

                scope:caliph = {
                    can_add_hook = {
                        target = scope:struggle_participant
                        type = threat_hook
                    }
                }    
            }
            scope:caliph = {
                add_hook = {
                    target = scope:struggle_participant
                    type = threat_hook
                }
            }
        }
        if = {
            limit = {
                OR = {
                    scope:caliph = { is_ai = yes }
                    AND = {
                        scope:caliph = { is_ai = no }
                        is_ai = no
                    }
                }
                reverse_opinion = {
                    target = scope:caliph
                    value >= 20
                }
            }
            progress_towards_friend_effect = {
                REASON = friend_coronation_caliph_support
                CHARACTER = scope:caliph
                OPINION = default_friend_opinion
            }
        }
        else = {
            reverse_add_opinion = {
                modifier = support_opinion
                target = scope:caliph
                opinion = 20
            }
            
        }
       
        if = {
            limit = {
                OR = {
                    scope:activity = {
                        is_target_in_variable_list = {
                            name = major_supporter
                            target = root
                        }                   
                    }
                    has_activity_intent = coronation_offer_support
                    is_ai = no
                }
            }
            scope:activity = { activity_special_type_progression_tiny = yes }
            custom_tooltip = coronation_tt_positive_tiny
            coronation_add_magnificence_log_effect = {
                VALUE = flag:positive_tiny
                CHAR = root
            }
        }

        add_piety = medium_piety_gain

        ai_chance = {
            base = 100
            modifier = {
                factor = 0
                OR = {
                    has_activity_intent = coronation_disrupt_loyalists
                    is_in_guest_subset = { name = detractor }
                }
            }
        }
    }

    option = {
        name = coronation_events_klank.1010.e

        scope:struggle_participant = {
            remove_from_activity = involved_activity
            if = {
                limit = {
                    OR = {
                        is_ai = yes
                        AND = {
                            root = { is_ai = no }
                            is_ai = no
                        }
                    }
                }
                progress_towards_rival_effect = {
                    REASON = rival_coronation_yeeted_from_coronation
                    CHARACTER = root
                    OPINION = default_rival_opinion
                }
            }
            
            if = {
                limit = { has_trait = fp3_struggle_detractor }
                scope:caliph = {
                    add_opinion = {
                        opinion = 5
                        modifier = respect_opinion
                        target = root
                    }
                }
            }
        }
        if = {
            limit = {
                OR = {
                    scope:activity.activity_host = root
                    scope:activity = {
                        is_target_in_variable_list = {
                            name = major_supporter
                            target = root
                        }                   
                    }
                    has_activity_intent = coronation_offer_support
                    is_ai = no
                }
            }
            scope:activity = { activity_special_type_progression_tiny = yes }
            custom_tooltip = coronation_tt_positive_tiny
            coronation_add_magnificence_log_effect = {
                VALUE = flag:positive_tiny
                CHAR = root
            }
        }

        if = {
            limit = {
                NOT = { scope:activity.activity_host = root }
            }
            scope:coronation_host = {
                add_opinion = {
                    opinion = 10
                    modifier = respect_opinion
                    target = root
                }
            }
        }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}

# Big Realm Reform

coronation_events_klank.1011 = {
    type = activity_event
	title = coronation_events_klank.1011.t
    desc = coronation_events_klank.1011.desc

    left_portrait = {
        character = root
        animation = personality_honorable
    }

    center_portrait = {
        character = scope:first_char
        animation = throne_room_bow_3
        camera = camera_event_right
    }

    right_portrait = {
        character = scope:second_char
        animation = obsequious_bow
    }

    lower_left_portrait = {
        character = scope:third_char
    }

    lower_right_portrait = {
        character = scope:fourth_char
    }

    lower_center_portrait = {
        character = scope:fifth_char
    }

    cooldown = { years = 10 }

    weight_multiplier = {
        base = 1
        modifier = {
            add = 3
            has_trait = ambitious
        }
        modifier = {
            add = 2
            has_trait = diligent
        }
        modifier = {
            add = 2
            stewardship >= 14
        }
        modifier = {
            add = 2
            learning >= 14
        }
        modifier = {
            add = 2
            is_ai = no
        }
        modifier = {
            add = 1
            realm_size >= 200
        }
        modifier = {
            add = 2
            realm_size >= 400
        }
        modifier = {
            add = 4
            realm_size >= 800
        }
    }

    theme = coronation_activity

    trigger = {
        NOR = {
            has_character_modifier = ach_realm_centralization_liege_lvl_1
            has_character_modifier = ach_realm_centralization_liege_lvl_2
            has_character_modifier = ach_realm_autonomy_liege_lvl_1
            has_character_modifier = ach_realm_autonomy_liege_lvl_2
        }
        scope:activity = {
            any_attending_character = {
                count >= 6
                is_vassal_of = root
                primary_title.tier >= tier_duchy
                sub_realm_size >= 30
            }
        }
        primary_title.previous_holder ?= {
            house = root.house
            is_alive = no
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        primary_title.previous_holder ?= {
            save_scope_as = previous_holder
        }
        scope:activity = {
            ordered_attending_character = {
                order_by = sub_realm_size
                max = 10
                limit = {
                    is_vassal_of = root
                    primary_title.tier >= tier_duchy
                    sub_realm_size >= 30
                }
                add_to_list = characters
            }
            ordered_in_list = {
                list = characters
                order_by = sub_realm_size
                save_scope_as = first_char
            }
            ordered_in_list = {
                list = characters
                order_by = sub_realm_size
                
                limit = {
                    NOT = {
                        this = scope:first_char
                    }
                }
                save_scope_as = second_char
            }
            ordered_in_list = {
                list = characters
                order_by = sub_realm_size
                
                limit = {
                    NOR = {
                        this = scope:first_char
                        this = scope:second_char
                    }
                }
                save_scope_as = third_char
            }
            ordered_in_list = {
                list = characters
                order_by = sub_realm_size
                
                limit = {
                    NOR = {
                        this = scope:first_char
                        this = scope:second_char
                        this = scope:third_char
                    }
                }
                save_scope_as = fourth_char
            }
            ordered_in_list = {
                list = characters
                order_by = sub_realm_size
                
                limit = {
                    NOR = {
                        this = scope:first_char
                        this = scope:second_char
                        this = scope:third_char
                        this = scope:fourth_char
                    }
                }
                save_scope_as = fifth_char
            }
        }
    }

    option = { #centralization
        name = coronation_events_klank.1011.a
        custom_tooltip = coronation_events_klank.1011.a.custom_tooltip
        every_in_list = {
            list = characters
            custom = custom.ten_most_powerful_vassals
            add_character_modifier = {
                modifier = ach_realm_centralization_vassal_lvl_1
                years = 12
            }
            custom_tooltip = coronation_events_klank.1011.a.county_modifier
            hidden_effect = {
                every_held_county = {
                    add_county_modifier = {
                        modifier = ach_realm_centralization_county_lvl_1
                        years = 12
                    }
                }
            } 
        }
        every_in_list = {
            list = characters
            limit = {
                is_ai = no
            }
            trigger_event = {
                id = coronation_events_klank.1012
                days = 3
            }
        }
        every_in_list = {
            list = characters
            limit = {
                is_in_guest_subset = { name = detractor }
            }
            custom = custom.coronation_events_klank.1011.a.disrespect
            add_opinion = {
                modifier = disrespect_opinion
                target = root
                opinion = -40
            }
        }
        every_in_list = {
            list = characters
            limit = {
                is_in_guest_subset = { name = supporter }
            }
            custom = custom.coronation_events_klank.1011.a.respect
            add_opinion = {
                modifier = disrespect_opinion
                target = root
                opinion = -20
            }
        }

        trigger_event = {
            id = coronation_events_klank.1014
            years = 10
        }

        stress_impact = {
            ambitious = medium_stress_impact_loss
            diligent = minor_stress_impact_loss
            lazy = medium_stress_impact_gain
            compassionate = medium_stress_impact_gain
            generous = medium_stress_impact_gain
        }

        ai_chance = {
            base = 10
            modifier = {
                add = 10
                stewardship >= 10
            }
            modifier = {
                add = 10
                learning > 10
            }
            modifier = {
                add = 40
                has_trait = ambitious
            }
            modifier = {
                add = 40
                has_trait = diligent
            }
        }
    }

    option = { #autonomy
        name = coronation_events_klank.1011.b
        custom_tooltip = coronation_events_klank.1011.b.custom_tooltip
        add_character_modifier = {
            modifier = ach_realm_autonomy_liege_lvl_1
            years = 12
        }
        every_in_list = {
            list = characters
            custom = custom.ten_most_powerful_vassals
            add_character_modifier = {
                modifier = ach_realm_autonomy_vassal_lvl_1
                years = 12
            }
            custom_tooltip = coronation_events_klank.1011.b.county_modifier
            hidden_effect = {
                every_held_county = {
                    add_county_modifier = {
                        modifier = ach_realm_autonomy_county_lvl_1
                        years = 12
                    }
                }
            }
        }
        every_in_list = {
            list = characters
            limit = {
                is_ai = no
            }
            trigger_event = {
                id = coronation_events_klank.1013
                days = 3
            }
        }
        every_in_list = {
            list = characters
            limit = {
                is_in_guest_subset = { name = detractor }
            }
            custom = custom.coronation_events_klank.1011.b.disrespect
            add_opinion = {
                modifier = disrespect_opinion
                target = root
                opinion = -20
            }
        }
        every_in_list = {
            list = characters
            limit = {
                OR = {
                    is_in_guest_subset = { name = supporter }
                    has_vassal_stance = parochial
                }
            }
            custom = custom.coronation_events_klank.1011.b.respect
            add_opinion = {
                modifier = respect_opinion
                target = root
                opinion = 20
            }
        }

        trigger_event = {
            id = coronation_events_klank.1015
            years = 10
        }
        
        stress_impact = {
            compassionate = medium_stress_impact_loss
            generous = medium_stress_impact_loss
            lazy = medium_stress_impact_gain
            ambitious = medium_stress_impact_gain
            diligent = minor_stress_impact_gain
        }

        ai_chance = {
            base = 10
            modifier = {
                add = 10
                diplomacy >= 10
            }
            modifier = {
                add = 10
                learning >= 10
            }
            modifier = {
                add = -40
                has_trait = ambitious
            }
            modifier = {
                add = -40
                has_trait = diligent
            }
            modifier = {
                add = 20
                has_trait = generous
            }
        }
    }

    option = { # I just want to grill for ROOT.Char.GetFaith.HighGodNamePossesive sake
        name = coronation_events_klank.1011.c

        scope:activity = {
            activity_special_type_progression_tiny = yes
            custom_tooltip = coronation_tt_positive_tiny
        }
        coronation_add_magnificence_log_effect = {
            VALUE = flag:positive_tiny
            CHAR = root
        }

        stress_impact = {
            lazy = major_stress_impact_loss
            shy = major_stress_impact_loss
            ambitious = medium_stress_impact_gain
            diligent = minor_stress_impact_gain
        }

        add_character_modifier = {
            modifier = ach_no_reforms_modifier
            years = 6
        }

        ai_chance = {
            base = 10
            modifier = {
                add = 100
                has_trait = lazy
            }
            modifier = {
                add = 40
                has_trait = shy
            }
            modifier = {
                factor = 0
                has_trait = ambitious
            }
            modifier = {
                factor = 0
                has_trait = diligent
            }
        }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}


coronation_events_klank.1012 = {
    type = activity_event
	title = coronation_events_klank.1012.t
    desc = coronation_events_klank.1012.desc

    cooldown = { years = 10 }

    theme = coronation_activity

    left_portrait = {
        character = root
        animation = disapproval
    }

    center_portrait = {
        character = scope:host
        animation = storyteller
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        scope:activity = {
            activity_host = { save_scope_as = host }
        }
        show_as_tooltip = {
            add_character_modifier = {
                modifier = ach_realm_centralization_vassal_lvl_1
                years = 12
            }
            every_held_county = {
                add_county_modifier = {
                    modifier = ach_realm_centralization_county_lvl_1
                    years = 12
                }
            }
        }
        custom_tooltip = coronation_events_klank.1012.ten_year_plan
    }

    option = { #huh
        name = coronation_events_klank.1012.a
        custom_tooltip = coronation_events_klank.1013.ten_year_plan
    }

    option = { #sabotage liege's plan
        name = coronation_events_klank.1012.b
        custom_tooltip = coronation_events_klank.1012.b.desc
        remove_character_modifier = ach_realm_centralization_vassal_lvl_1
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}


coronation_events_klank.1013 = {
    type = activity_event
	title = coronation_events_klank.1013.t
    desc = coronation_events_klank.1013.desc

    cooldown = { years = 10 }

    theme = coronation_activity

    left_portrait = {
        character = root
        animation = interested
    }

    center_portrait = {
        character = scope:host
        animation = storyteller
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        show_as_tooltip = {
            add_character_modifier = {
                modifier = ach_realm_autonomy_vassal_lvl_1
                years = 12
            }
            every_held_county = {
                add_county_modifier = {
                    modifier = ach_realm_autonomy_county_lvl_1
                    years = 12
                }
            }
        }      
    }

    option = { #huh
        name = coronation_events_klank.1013.a
        custom_tooltip = coronation_events_klank.1013.ten_year_plan
    }


    option = { #sabotage liege's plan
        name = coronation_events_klank.1013.b
        custom_tooltip = coronation_events_klank.1013.b.desc
        remove_character_modifier = ach_realm_autonomy_vassal_lvl_1
        every_held_county = {
            remove_county_modifier = ach_realm_autonomy_county_lvl_1
        }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}


coronation_events_klank.1014 = {
    type = character_event
    title = coronation_events_klank.1014.t
    desc = coronation_events_klank.1014.desc

    theme = stewardship

    left_portrait = {
        character = root
        animation = storyteller
    }

    right_portrait = {
        character = scope:first_vassal
        animation = personality_vengeful
    }

    lower_left_portrait = {
        trigger = { exists = scope:second_vassal }
        character = scope:second_vassal
    }

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

    lower_right_portrait = {
        trigger = { exists = scope:fourth_vassal }
        character = scope:fourth_vassal
    }

    trigger = {
        has_character_modifier = ach_realm_centralization_liege_lvl_1
        any_vassal = {
            has_character_modifier = ach_realm_centralization_vassal_lvl_1
            any_held_county = {
                has_county_modifier = ach_realm_centralization_county_lvl_1
            }
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        remove_character_modifier = ach_realm_centralization_liege_lvl_1
        set_variable = {
            name = development_lost
            value = 0
        }
        every_vassal = {
            limit = {
                has_character_modifier = ach_realm_centralization_vassal_lvl_1
                any_held_county = {
                    has_county_modifier = ach_realm_centralization_county_lvl_1
                }
            }
            add_to_list = vassals
        }
        ordered_in_list = {
            list = vassals
            order_by = sub_realm_size
            save_scope_as = first_vassal
        }
        ordered_in_list = {
            list = vassals
            order_by = sub_realm_size
            limit = {
                NOT = {
                    this = scope:first_vassal
                }
            }
            save_scope_as = second_vassal
        }
        ordered_in_list = {
            list = vassals
            order_by = sub_realm_size
            limit = {
                NOR = {
                    this = scope:first_vassal
                    this = scope:second_vassal
                }
            }
            save_scope_as = third_vassal
        }
        ordered_in_list = {
            list = vassals
            order_by = sub_realm_size
            limit = {
                NOR = {
                    this = scope:first_vassal
                    this = scope:second_vassal
                    this = scope:third_vassal
                }
            }
            save_scope_as = fourth_vassal
        }
        every_in_list = {
            list = vassals
            custom = custom.ten_most_powerful_vassals.1014
            remove_character_modifier = ach_realm_centralization_vassal_lvl_1
            custom_tooltip = coronation_events_klank.1014.county_effect
            hidden_effect = {
                every_held_county = {
                    limit = {
                        has_county_modifier = ach_realm_centralization_county_lvl_1
                    }
                    remove_county_modifier = ach_realm_centralization_county_lvl_1

                    change_variable = {
                        name = development_lost
                        add = {
                            add = development_level
                            multiply = 0.2
                        }
                    }

                    change_development_level = {
                        subtract = development_level
					    multiply = 0.2
                        floor = yes
                    }
                }
            }
        }

        set_variable = {
            name = development_gain_percent
            value = {
                add = learning
                add = stewardship
                divide = 60
                max = 0.8
                min = 0.1
            }
        }
        custom_tooltip = coronation_events_klank.1014.development_gain
        every_held_county = {
            change_development_level = {
                add = root.var:development_lost
                multiply = root.var:development_gain_percent
                divide = root.domain_size
                floor = yes
            }
        }
    }

    option = { #reap the benefits
        name = coronation_events_klank.1014.a

        ai_chance = {
            base = 10
        }
    }

    option = { #expand the plan for the next decade
        name = coronation_events_klank.1014.b
        add_character_modifier = {
            modifier = ach_realm_centralization_liege_lvl_2
            years = 10
        }
        every_in_list = {
            list = vassals
            custom = custom.ten_most_powerful_vassals.1014
            add_opinion = {
                modifier = disrespect_opinion
                target = root
                opinion = -40
            }
            add_character_modifier = {
                modifier = ach_realm_centralization_vassal_lvl_2
                years = 10
            }
            custom_tooltip = coronation_events_klank.1014.b.county_effect
            hidden_effect = {
                every_held_county = {
                    add_county_modifier = {
                        modifier = ach_realm_centralization_county_lvl_2
                        years = 10
                    }
                }
            }
        }
        ai_chance = { #this is a bad idea for AI
            base = 0
        }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes

        remove_variable = development_lost
        remove_variable = development_gain_percent
    }
}

coronation_events_klank.1015 = {
    type = character_event
    title = coronation_events_klank.1015.t
    desc = coronation_events_klank.1015.desc

    theme = stewardship

    left_portrait = {
        character = root
        animation = storyteller
    }

    right_portrait = {
        character = scope:first_vassal
        animation = personality_vengeful
    }

    lower_left_portrait = {
        trigger = { exists = scope:second_vassal }
        character = scope:second_vassal
    }

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

    lower_right_portrait = {
        trigger = { exists = scope:fourth_vassal }
        character = scope:fourth_vassal
    }

    trigger = {
        has_character_modifier = ach_realm_autonomy_liege_lvl_1
        any_vassal = {
            has_character_modifier = ach_realm_autonomy_vassal_lvl_1
            any_held_county = {
                has_county_modifier = ach_realm_autonomy_county_lvl_1
            }
        }
    }

    immediate = {
    	# For MP
		coronation_busy_effect = yes

        remove_character_modifier = ach_realm_autonomy_liege_lvl_1
        every_vassal = {
            limit = {
                has_character_modifier = ach_realm_autonomy_vassal_lvl_1
                any_held_county = {
                    has_county_modifier = ach_realm_autonomy_county_lvl_1
                }
            }
            add_to_list = vassals
        }
        ordered_in_list = {
            list = vassals
            order_by = sub_realm_size
            save_scope_as = first_vassal
        }
        ordered_in_list = {
            list = vassals
            order_by = sub_realm_size
            limit = {
                NOT = {
                    this = scope:first_vassal
                }
            }
            save_scope_as = second_vassal
        }
        ordered_in_list = {
            list = vassals
            order_by = sub_realm_size
            limit = {
                NOR = {
                    this = scope:first_vassal
                    this = scope:second_vassal
                }
            }
            save_scope_as = third_vassal
        }
        ordered_in_list = {
            list = vassals
            order_by = sub_realm_size
            limit = {
                NOR = {
                    this = scope:first_vassal
                    this = scope:second_vassal
                    this = scope:third_vassal
                }
            }
            save_scope_as = fourth_vassal
        }
        set_variable = {
            name = development_gain_percent
            value = {
                add = stewardship
                add = diplomacy
                divide = 400
                max = 0.2
                min = 0.05
            }
        }
        every_in_list = {
            list = vassals
            custom = custom.ten_most_powerful_vassals.1015
            remove_character_modifier = ach_realm_autonomy_vassal_lvl_1
            custom_tooltip = coronation_events_klank.1015.county_effect
            hidden_effect = {
                every_held_county = {
                    limit = {
                        has_county_modifier = ach_realm_autonomy_county_lvl_1
                    }
                    remove_county_modifier = ach_realm_autonomy_county_lvl_1

                    change_development_level = {
                        add = development_level
                        multiply = var:development_gain_percent
                        floor = yes
                    }
                }
            }
        }
    }

    option = { #reap the benefits
        name = coronation_events_klank.1015.a

        ai_chance = {
            base = 0
        }
    }

    option = {
        name = coronation_events_klank.1015.b
        add_character_modifier = {
            modifier = ach_realm_autonomy_liege_lvl_2
            years = 10
        }
        every_in_list = {
            list = vassals
            custom = custom.ten_most_powerful_vassals.1015
            add_opinion = {
                modifier = respect_opinion
                target = root
                opinion = 20
            }
            add_character_modifier = {
                modifier = ach_realm_autonomy_vassal_lvl_2
                years = 10
            }
            custom_tooltip = coronation_events_klank.1015.b.county_effect
            hidden_effect = {
                every_held_county = {
                    add_county_modifier = {
                        modifier = ach_realm_autonomy_county_lvl_2
                        years = 10
                    }
                }
            }
        }

        ai_chance = { #this is not a bad idea for AI
            base = 10
        }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes

        remove_variable = development_gain_percent
    }
}

# You have a memory of coronation host when they were a childe

coronation_events_klank.1016 = {
    type = activity_event
    title = coronation_events_klank.1016.t
    desc = {
        desc = coronation_events_klank.1016.desc
        first_valid = {
            triggered_desc = {
                desc = coronation_events_klank.1016.desc.detractor
                trigger = { is_in_guest_subset = { name = detractor } }
            }
            desc = coronation_events_klank.1016.desc.supporter
        }
    }

    theme = coronation

    left_portrait = {
        character = root
        animation = storyteller
    }

    center_portrait = {
        character = scope:teller
        animation = dismissal
    }

    right_portrait = {
        character = scope:listener
        animation = interested 
    }

    lower_left_portrait = {
        character = scope:host
    }

    trigger = {
        any_memory = {
            trigger_if = {
                limit = {
                    root = { is_in_guest_subset = { name = supporter } }
                }
                has_memory_category = positive
            }
            trigger_else = {
                has_memory_category = negative
            }
            
            memory_age_years >= {
                value = scope:activity.activity_host.age
                subtract = 12
            }
            any_memory_participant = {
                this = scope:activity.activity_host
            }
        }
        scope:activity = {
            any_attending_character = {
                is_in_guest_subset = { name = supporter }
                is_ai = yes
                NOT = { this = root }
                opinion = {
                    target = scope:activity.activity_host
                    value < 40
                }
            }
            any_attending_character = {
                is_in_guest_subset = { name = detractor }
                is_ai = yes
                NOT = { this = root }
                opinion = {
                    target = scope:activity.activity_host
                    value > -40
                }
            }
        }
    }

    cooldown = { years = 1 }

    immediate = {
    	# For MP
		coronation_busy_effect = yes
        scope:activity = {
            activity_host = { save_scope_as = host }
            random_attending_character = {
                limit = {
                    NOT = { this = root }
                    is_in_guest_subset = { name = supporter }
                    is_ai = yes
                    opinion = {
                        target = scope:activity.activity_host
                        value < 40
                    }
                }
                save_scope_as = supporter
            }
            random_attending_character = {
                limit = {
                    NOT = { this = root }
                    is_in_guest_subset = { name = detractor }
                    is_ai = yes
                    opinion = {
                        target = scope:activity.activity_host
                        value > -40
                    }
                }
                save_scope_as = detractor
            }
        }
        random_memory = {
            limit = {
                trigger_if = {
                    limit = {
                        root = { is_in_guest_subset = { name = supporter } }
                    }
                    has_memory_category = positive
                }
                trigger_else = {
                    has_memory_category = negative
                }
                memory_age_years >= {
                    value = scope:activity.activity_host.age
                    subtract = 12
                }
                any_memory_participant = {
                    this = scope:host
                }
            }
            save_scope_as = memory
        }

        if = {
            limit = {
                is_in_guest_subset = { name = supporter }
            }
            scope:supporter = { save_scope_as = teller }
            scope:detractor = { save_scope_as = listener }
        }
        else = {
            scope:supporter = { save_scope_as = listener }
            scope:detractor = { save_scope_as = teller }
        }
    }

    option = { #use it to detract
        name = coronation_events_klank.1016.a

        trigger = {
            has_activity_intent = coronation_disrupt_loyalists
        }

        scope:host = {
            add_opinion = {
                modifier = upset_opinion
                target = root
                opinion = -10
            }
        }
        
        scope:activity = {
            add_activity_log_entry = {
                key = coronation_guest_struggle_support_log
		    	score = 25
		    	character = root
		    	target = scope:supporter
                scope:supporter = {
                    custom_tooltip = hater_becomes_detractor_tt
                }
                scope:activity = {
                    add_to_guest_subset = { name = detractor target = scope:supporter }
                }
                scope:supporter = {
                    add_opinion = {
                        modifier = disrespect_opinion
                        target = scope:host
                        opinion = -40
                    }
                }
            }
        }

        stress_impact = {
            disloyal = minor_stress_impact_loss
            loyal = minor_stress_impact_gain
        }
        

        ai_chance = {
            base = 40 #AI should pursue their intents
            modifier = {
                add = 10
                has_trait = disloyal
            }
            modifier = {
                add = -10
                scope:host = { is_ai = no }
            }
        }

    }

    option = { #use it to support
        name = coronation_events_klank.1016.b

        trigger = {
            has_activity_intent = coronation_offer_support
        }

        scope:host = {
            add_opinion = {
                modifier = pleased_opinion
                target = root
                opinion = 10
            }
        }
        
        scope:activity = {
            add_activity_log_entry = {
                key = coronation_guest_struggle_support_log
		    	score = 25
		    	character = root
		    	target = scope:detractor
                scope:supporter = {
                    custom_tooltip = buddy_becomes_supporter_tt
                }
                scope:activity = {
                    add_to_guest_subset = { name = supporter target = scope:detractor }
                }
                scope:detractor = {
                    add_opinion = {
                        modifier = respect_opinion
                        target = scope:host
                        opinion = 40
                    }
                }
            }
        }

        stress_impact = {
            loyal = minor_stress_impact_loss
            disloyal = minor_stress_impact_gain
        }

        ai_chance = {
            base = 40 #AI should pursue their intents
            modifier = {
                add = 10
                has_trait = loyal
            }
        }
        
    }

    option = { #this is about me actually
        name = coronation_events_klank.1016.c

        scope:host = {
            add_opinion = {
                modifier = reputation_opinion
                target = root
                opinion = -20
            }
        }

        add_prestige = medium_prestige_gain

        scope:detractor = {
            add_opinion = {
                modifier = respect_opinion
                target = root
                opinion = 20
            }
        }

        scope:supporter = {
            add_opinion = {
                modifier = respect_opinion
                target = root
                opinion = 10
            }
        }

        stress_impact = {
            ambitious = minor_stress_impact_loss
            callous = minor_stress_impact_loss
            deceitful = medium_stress_impact_loss
            compassionate = medium_stress_impact_gain
            honest = medium_stress_impact_gain
        }

        if = {
            limit = { faith = { trait_is_virtue = honest }}
            add_piety = medium_piety_loss
        }

        ai_chance = {
            base = 10
            modifier = {
                add = 10
                has_trait = ambitious
            }
            modifier = {
                add = 10
                has_trait = callous
            }
            modifier = {
                add = 10
                has_trait = deceitful
            }
            modifier = {
                add = -10
                has_trait = compassionate
            }
            modifier = {
                add = -10
                has_trait = honest
            }
            modifier = {
                add = -20
                faith = { trait_is_virtue = honest }
            }
        }
    }

    option = { #just tell the story straight
        name = coronation_events_klank.1016.d
        if = {
            limit = {
                OR = {
                    is_ai = no
                    scope:activity = {
                        is_target_in_variable_list = {
                            name = major_supporter
                            target = root
                        }
                    }
                    has_activity_intent = coronation_offer_support
                }
            }
            scope:activity = {
                activity_special_type_progression_tiny = yes
                custom_tooltip = coronation_tt_positive_tiny
            }
            coronation_add_magnificence_log_effect = {
                VALUE = flag:positive_tiny
                CHAR = root
            }
        }

        scope:detractor = {
            add_opinion = {
                modifier = reputation_opinion
                target = scope:host
                opinion = 10
            }
        }

        scope:supporter = {
            add_opinion = {
                modifier = reputation_opinion
                target = scope:host
                opinion = 20
            }
        }

        scope:host = {
            add_opinion = {
                modifier = respect_opinion
                target = root
                opinion = 10
            }
        }

        if = {
            limit = { faith = { trait_is_virtue = honest } }
            add_piety = medium_piety_gain
        }

        stress_impact = {
            compassionate = minor_stress_impact_loss
            honest = minor_stress_impact_loss
            deceitful = medium_stress_impact_gain
        }

        ai_chance = {
            base = 10
            modifier = {
                add = 10
                has_trait = compassionate
            }
            modifier = {
                add = 10
                has_trait = honest
            }
            modifier = {
                add = -10
                has_trait = deceitful
            }
            modifier = {
                add = 20
                faith = { trait_is_virtue = honest }
            }
            modifier = {
                factor = 0
                OR = {
                    is_in_guest_subset = { name = detractor }
                    has_activity_intent = coronation_weaken_detractors
                }
            }
        }
    }

    after = {
    	# For MP
		coronation_ready_effect = yes
    }
}
