#######################################
#
# ANCIENT RELIGIONS
# - Celtic Minor Titles Events
#
# Event ID celtic.2200 - celtic.2399 reserved
# by Adam 'theStormWeaver/xirsoi' Chevalier
#
###################################

namespace = celtic

# things are going well, perhaps some of that money could be better spent elsewhere...
character_event = {
    id = celtic.2200
    desc = celtic.2200.desc
    picture = GFX_evt_scientist
    border = GFX_event_normal_frame_war

    religion_group = pagan_group

    is_triggered_only = yes

    trigger = {
        has_minor_title = title_headsman
        NOR = {
            block_general_event_trigger = yes
            had_character_flag = {
                flag = ancrel_good_headsman_admin
                years < 3
            }
        }
    }

    weight_multiplier = {
        days = 1
        modifier = {
            factor = 2
            stewardship = 10
        }
        modifier = {
            factor = 2
            stewardship = 12
        }
        modifier = {
            factor = 2
            stewardship = 14
        }
        modifier = {
            factor = 2
            stewardship = 16
        }
        modifier = {
            factor = 2
            stewardship = 18
        }
        modifier = {
            factor = 2
            trait = administrator
        }
    }

    option = { # invest it in the budget
        name = celtic.2200.a
        random_list = {
            15 = { add_trait_partially_honest_effect = yes }
            10 = { add_trait_partially_diligent_effect = yes }
            75 = { } # nothing
        }

        custom_tooltip = {
            text = ancrel.good_admin
            hidden_tooltip = {
                set_character_flag = ancrel_good_headsman_admin
            }
        }

        ai_chance = {
            factor = 50
            modifier = {
                factor = 2
                trait = honest
            }
            modifier = {
                factor = 2
                trait = just
            }
        }
    }

    option = { # keep it
        name = celtic.2200.b
        random = {
            chance = 25
            add_trait_partially_greedy_effect = yes
        }
        scaled_wealth = {
            value = 0.05
            min = 10
            max = 100
        }
    }

    option = { # give it to your liege
        liege = {
            letter_event = { id = celtic.2201 }
            opinion = {
                modifier = ancrel_pleased
                who = PREV
                years = 2
            }
        }
    }
}

# your headsman has sent you some extra cash from the budget
letter_event = {
    id = celtic.2201
    desc = celtic.2201.desc

    is_triggered_only = yes

    option = {
        name = celtic.2201.a
        
        scaled_wealth = {
            value = 0.05
            min = 10
            max = 100
        }
    }
}

# your headsman has done a very good job, perhaps they deserve a reward? (headsman)
character_event = {
    id = celtic.2202
    hide_window = yes

    is_triggered_only = yes

    trigger = {
        has_minor_title = title_headsman
        OR = {
            had_character_flag = {
                flag = ancrel_celtic_2202
                years > 5
            }
            NOT = {
                has_character_flag = ancrel_celtic_2202
            }
        }
        block_general_event_trigger = no
    }

    weight_multiplier = {
        days = 1
        modifier = {
            factor = 2
            had_character_flag = { 
                flag = ancrel_invested_in_headsman_administration
                days > 30
            }
            had_character_flag = {
                flag = ancrel_invested_in_headsman_administration
                years < 3
            } 
        }
        modifier = {
            factor = 0
            stewardship < 5
        }
        modifier = {
            factor = 0.9
            stewardship < 6
        }
        modifier = {
            factor = 0.9
            stewardship < 7
        }
        modifier = {
            factor = 0.9
            stewardship < 8
        }
        modifier = {
            factor = 1.1
            stewardship = 8
        }
        modifier = {
            factor = 1.1
            stewardship = 10
        }
        modifier = {
            factor = 1.1
            stewardship = 12
        }
        modifier = {
            factor = 1.1
            stewardship = 14
        }
        modifier = {
            factor = 1.1
            stewardship = 16
        }
        modifier = {
            factor = 1.1
            stewardship = 18
        }
        modifier = {
            factor = 1.1
            stewardship = 20
        }
        modifier = {
            factor = 1.1
            stewardship = 22
        }
        modifier = {
            factor = 1.1
            stewardship = 24
        }
        modifier = {
            factor = 1.5
            trait = diligent
        }
    }

    immediate = {
        liege = { character_event = { id = celtic.2203 days = 1} }
    }
}

# your headsman has done a very good job, perhaps they deserve a reward? (liege)
character_event = {
    id = celtic.2203
    desc = celtic.2203.desc
    picture = GFX_evt_emissary
    border = GFX_event_normal_frame_economy

    is_triggered_only = yes

    immediate = {
        # calculate money to transfer ahead of time, for localisation
        export_to_variable = {
            which = headsman_bonus
            value = monthly_income
        }

        if = {
            limit = {
                check_variable = {
                    which = headsman_bonus
                    value < 5
                }
            }
            set_variable = { which = headsman_bonus value = 5 }
        }
        if = {
            limit = {
                check_variable = {
                    which = headsman_bonus
                    value > 50
                }
            }
            set_variable = { which = headsman_bonus value = 50 }
        }
    }

    option = { # cash bonus
        name = celtic.2203.a

        FROM = {
            opinion = { modifier = ancrel_pleased who = PREV years = 3 }
            letter_event = {
                id = celtic.2204
                days = 1
                tooltip = celtic.2204.tt
            }
        }
    }
    option = { # praise at court
        name = celtic.2203.b

        prestige = -50

        FROM = {
            opinion = { modifier = ancrel_pleased who = PREV years = 3 }
            character_event = {
                id = celtic.2205
                days = 1
                tooltip = celtic.2205.tt
            }
        }
    }
    option = { # it's their job!
        name = celtic.2203.c

        FROM = {
            opinion = { modifier = ancrel_dissapointed who = PREV years = 3 }
        }
    }
}

# your liege has decided to reward you for your good work! (headsman)
letter_event = {
    id = celtic.2204
    desc = celtic.2204.desc

    is_triggered_only = yes

    option = {
        name = ancrel.excellent

        transfer_scaled_wealth = {
            from = FROM
            value = 0.083
            min = 5
            max = 50
        }
    }
}

# your liege has praised you at court for your good work! (headsman)
character_event = {
    id = celtic.2205
    desc = celtic.2205.desc
    picture = GFX_evt_courtiers

    is_triggered_only = yes

    option = {
        name = ancrel.fantastic

        scaled_prestige = {
            value = 0.083 # roughly one months worth
            min = 50
            max = 200
        }
    }
}

# an accident / bad oil shipment / etc. has increased costs (headsman)
# - ask for more funds
# - absorb the cost yourself
# - cut corners
character_event = {
    id = celtic.2206
    desc = celtic.2206.desc
    picture = GFX_evt_scientist

    is_triggered_only = yes

    trigger = {
        has_minor_title = title_headsman
        OR = {
            NOT = { has_character_flag = ancrel_bad_headsman_admin }
            had_character_flag = { flag = ancrel_bad_headsman_admin days > 60 }
        }
        block_general_event_trigger = no
    }

    weight_multiplier = {
        days = 1
        modifier = {
            factor = 0
            had_character_flag = { 
                flag = ancrel_good_headsman_admin
                days > 30
            }
            had_character_flag = {
                flag = ancrel_good_headsman_admin
                years < 3
            } 
        }
        modifier = {
            factor = 2
            had_character_flag = { 
                flag = ancrel_bad_headsman_admin
                days > 30
            }
            had_character_flag = {
                flag = ancrel_bad_headsman_admin
                years < 3
            } 
        }
        modifier = {
            factor = 2
            stewardship < 5
        }
        modifier = {
            factor = 1.1
            stewardship < 6
        }
        modifier = {
            factor = 1.1
            stewardship < 7
        }
        modifier = {
            factor = 1.1
            stewardship < 8
        }
        modifier = {
            factor = 0.9
            stewardship = 8
        }
        modifier = {
            factor = 0.9
            stewardship = 10
        }
        modifier = {
            factor = 0.9
            stewardship = 12
        }
        modifier = {
            factor = 0.9
            stewardship = 14
        }
        modifier = {
            factor = 0.9
            stewardship = 16
        }
        modifier = {
            factor = 0.9
            stewardship = 18
        }
        modifier = {
            factor = 0.1
            stewardship >= 20
        }
        modifier = {
            factor = 0.5
            trait = diligent
        }
    }

    option = { # request more funds from your liege
        name = celtic.2206.a

        liege = {
            opinion = {
                who = PREV
                modifier = ancrel_dissapointed
                years = 2
            }
            letter_event = {
                id = celtic.2207
                days = 1
                tooltip = celtic.2207.tt
            }
        }
    }
    option = { # absorb the costs yourself
        name = celtic.2206.b

        scaled_wealth = {
            value = -0.083 # one month
            min = 5
            max = 25
        }
    }
    option = { # cut corners
        name = celtic.2206.c
		custom_tooltip = { text = celtic.2206.c.tt }
        
        set_character_flag = ancrel_bad_headsman_admin
    }
}

# your headsman has requested extra funds to cover unexpected costs (liege)
# - nope
# - sure
letter_event = {
    id = celtic.2207
    desc = celtic.2207.desc

    is_triggered_only = yes

    option = { # pay the expense
        name = celtic.2207.a

        scaled_wealth = {
            value = -0.083
            min = 5
            max = 25
        }

        FROM = {
            letter_event = { id = celtic.2209 days = 3 tooltip = celtic.2209.tt }
        }
    }

    option = { # refuse to pay the expense
        name = celtic.2207.b

        FROM = {
            letter_event = { id = celtic.2208 days = 3 tooltip = celtic.2208.tt }
        }
    }
}

# your liege has denied your request! (headsman)
# - absorb the cost
# - cut corners
letter_event = {
    id = celtic.2208
    desc = celtic.2208.desc

    is_triggered_only = yes

    option = { # absorb the costs yourself
        name = celtic.2208.a

        scaled_wealth = {
            value = -0.083 # one month
            min = 5
            max = 25
        }
    }
    option = { # cut corners
        name = celtic.2208.b
		custom_tooltip = { text = celtic.2206.c.tt }
        
        set_character_flag = ancrel_bad_headsman_admin
    }
}

# your liege has fulfilled your request! (headsman)
letter_event = {
	id = celtic.2209
	desc = celtic.2209.desc
	#picture = GFX_evt_emissary
	border = GFX_event_letter_frame_economy
	
	is_triggered_only = yes
	
	option = {
		name = OK
	}
}
	

# one of the workers stands out as excellent (headsman)
# - i'll hire them as my own headsman!
# - sniping them would be dishonorable
character_event = {
    id = celtic.2210
    desc = celtic.2210.desc
    picture = GFX_evt_courtiers
    border = GFX_event_normal_frame_diplomacy

    is_triggered_only = yes

    trigger = {
        has_minor_title = title_headsman
        block_general_event_trigger = no
    }

    weight_multiplier = {
        days = 1
        modifier = {
            factor = 1.2
            trait = gregarious
        }
        modifier = {
            factor = 1.2
            stewardship > 7
        }
        modifier = {
            factor = 1.2
            diplomacy > 7
        }
    }

    option = { # promote them
        name = celtic.2210.a
        custom_tooltip = { text = ancrel.good_admin }

        set_character_flag = ancrel_good_headsman_admin

        random = {
            chance = 20

            add_trait_partially_just_effect = yes
        }
    }

    option = { # leave them where they are
        name = celtic.2210.b

        random = {
            chance = 20

            add_trait_partially_content_effect = yes
        }
    }

    option = { # hire them on as your own headsman
        name = celtic.2210.c
        trigger = {
            can_grant_title = title_headsman
        }

        liege = {
            prev = {
                create_random_steward = {
                    culture = root
                    religion = root
                    attributes = {
                        martial = 4
                        diplomacy = 9
                        stewardship = 12
                        intrigue = 9
                        learning = 6
                    }
                    age = 29
                    female = 40
                    dynasty = none
                    random_traits = yes
                }
                new_character = {
                    opinion = {
                        who = prev
                        modifier = opinion_patron
                        years = 10
                    }

                    give_minor_title = title_headsman
                }
            }


        }
    }
}

# you find yourself getting along with one of the workers very well (headsman)
# - new friends are great! (spawn character in *liege* court)
# - you shall make an excellent spy... (hidden modifier)
character_event = {
    id = celtic.2211
    desc = celtic.2211.desc
    picture = GFX_evt_courtiers
    border = GFX_event_normal_frame_diplomacy

    is_triggered_only = yes

    trigger = {
        has_minor_title = title_headsman
        block_general_event_trigger = no
    }

    weight_multiplier = {
        days = 1
        modifier = {
            factor = 1.2
            trait = gregarious
        }
        modifier = {
            factor = 1.2
            intrigue > 7
        }
        modifier = {
            factor = 1.2
            diplomacy > 7
        }
    }

    option = { # friends are great :)
        name = celtic.2211.a

        liege = {
            create_random_steward = {
                culture = root
                religion = root
                attributes = {
                    martial = 4
                    diplomacy = 6
                    stewardship = 6
                    intrigue = 9
                    learning = 6
                }
                age = 29
                female = no
                dynasty = none
                random_traits = yes
            }
            new_character = {
                opinion = {
                    who = prev
                    modifier = opinion_patron
                    years = 1
                }

                add_friend = root
            }
        }
    }

    option = { # perhaps you could keep an eye out for me <.<
        name = celtic.2211.b

        add_character_modifier = {
            modifier = ancrel_friend_at_court
            years = 10
        }
    }
}

# you find yourself getting into arguments with one of the workers constantly (headsman)
# - you have a rival at court!
character_event = {
    id = celtic.2212
    desc = celtic.2212.desc
    picture = GFX_evt_poke_king_in_chest
	border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes

    trigger = {
        has_minor_title = title_headsman
        block_general_event_trigger = no
    }

    weight_multiplier = {
        days = 1
        modifier = {
            factor = 0.8
            trait = gregarious
        }
        modifier = {
            factor = 0.8
            diplomacy > 7
        }
        modifier = {
            factor = 0.8
            diplomacy > 9
        }
        modifier = {
            factor = 0.8
            diplomacy > 11
        }
        modifier = {
            factor = 0.8
            diplomacy > 13
        }
    }

    immediate = {
        spawn_good_commander_effect = yes
        new_character = {
            save_event_target_as = work_rival
        }
    }

    option = { # i hate them!
        name = celtic.2212.a
        event_target:work_rival = {
            add_rival = ROOT
        }
    }
}

# you've learned some new management techniques in your work as headsman (headsman)
# - +1/2/3 stewardship

# you've learned how to snoop better during your work as headsman (headsman)
# - +1/2/3 intrigue

# you've learned some fighting techniques during your work as headsman (headsman)
# - +1/2/3 martial

# one of the heads has been spoiled due to some mistake/accident/etc. (headsman)
# - be honest and report it to your liege
# - say nothing and hope no one notices...? (someone's gonna notice!)
# - replace the head with one of your own courtiers' (at least one cruel and NO kind traits, might get caught!)

# (headsman and liege are, or were formally, rivals)
# you've found an empty head jar in storage with your name on it! (headsman)
# - the fucker! i'll kill them! (???)
# - this has gotten out of hand... (try to end the rivalry?)
# - ???

# the stress has gotten to you, you can hear the heads talking to you, telling you to do terrible things!
# - become insane

# when insane?
# Abi Normal?