﻿DI_add_diplomacy_pp = {
    scope = character

    effect = {
        random_owned_story = {
            limit = {
                story_type = DI_misc_variables_story
            }
            save_scope_as = DI_story
        }

        if = {
            limit = {
                scope:DI_story = { has_variable = DI_pinned_char_var }
            }
            every_living_character = {
                limit = { has_character_flag = pinned_for_edit }

                hidden_effect = {
                    add_diplomacy_lifestyle_perk_points = 1
                }
            }
        }
        else = {
            hidden_effect = {
                add_diplomacy_lifestyle_perk_points = 1
            }
        }
    }
}

DI_remove_diplomacy_pp = {
    scope = character

    effect = {
        random_owned_story = {
            limit = {
                story_type = DI_misc_variables_story
            }
            save_scope_as = DI_story
        }

        if = {
            limit = {
                scope:DI_story = { has_variable = DI_pinned_char_var }
            }
            every_living_character = {
                limit = { has_character_flag = pinned_for_edit }

                hidden_effect = {
                    add_diplomacy_lifestyle_perk_points = -1
                }
            }
        }
        else = {
            hidden_effect = {
                add_diplomacy_lifestyle_perk_points = -1
            }
        }
    }
}

DI_add_intrigue_pp = {
    scope = character

    effect = {
        random_owned_story = {
            limit = {
                story_type = DI_misc_variables_story
            }
            save_scope_as = DI_story
        }

        if = {
            limit = {
                scope:DI_story = { has_variable = DI_pinned_char_var }
            }
            every_living_character = {
                limit = { has_character_flag = pinned_for_edit }

                hidden_effect = {
                    add_intrigue_lifestyle_perk_points = 1
                }
            }
        }
        else = {
            hidden_effect = {
                add_intrigue_lifestyle_perk_points = 1
            }
        }
    }
}

DI_remove_intrigue_pp = {
    scope = character

    effect = {
        random_owned_story = {
            limit = {
                story_type = DI_misc_variables_story
            }
            save_scope_as = DI_story
        }

        if = {
            limit = {
                scope:DI_story = { has_variable = DI_pinned_char_var }
            }
            every_living_character = {
                limit = { has_character_flag = pinned_for_edit }

                hidden_effect = {
                    add_intrigue_lifestyle_perk_points = -1
                }
            }
        }
        else = {
            hidden_effect = {
                add_intrigue_lifestyle_perk_points = -1
            }
        }
    }
}

DI_add_learning_pp = {
    scope = character

    effect = {
        random_owned_story = {
            limit = {
                story_type = DI_misc_variables_story
            }
            save_scope_as = DI_story
        }

        if = {
            limit = {
                scope:DI_story = { has_variable = DI_pinned_char_var }
            }
            every_living_character = {
                limit = { has_character_flag = pinned_for_edit }

                hidden_effect = {
                    add_learning_lifestyle_perk_points = 1
                }
            }
        }
        else = {
            hidden_effect = {
                add_learning_lifestyle_perk_points = 1
            }
        }
    }
}

DI_remove_learning_pp = {
    scope = character

    effect = {
        random_owned_story = {
            limit = {
                story_type = DI_misc_variables_story
            }
            save_scope_as = DI_story
        }

        if = {
            limit = {
                scope:DI_story = { has_variable = DI_pinned_char_var }
            }
            every_living_character = {
                limit = { has_character_flag = pinned_for_edit }

                hidden_effect = {
                    add_learning_lifestyle_perk_points = -1
                }
            }
        }
        else = {
            hidden_effect = {
                add_learning_lifestyle_perk_points = -1
            }
        }
    }
}

DI_add_martial_pp = {
    scope = character

    effect = {
        random_owned_story = {
            limit = {
                story_type = DI_misc_variables_story
            }
            save_scope_as = DI_story
        }

        if = {
            limit = {
                scope:DI_story = { has_variable = DI_pinned_char_var }
            }
            every_living_character = {
                limit = { has_character_flag = pinned_for_edit }

                hidden_effect = {
                    add_martial_lifestyle_perk_points = 1
                }
            }
        }
        else = {
            hidden_effect = {
                add_martial_lifestyle_perk_points = 1
            }
        }
    }
}

DI_remove_martial_pp = {
    scope = character

    effect = {
        random_owned_story = {
            limit = {
                story_type = DI_misc_variables_story
            }
            save_scope_as = DI_story
        }

        if = {
            limit = {
                scope:DI_story = { has_variable = DI_pinned_char_var }
            }
            every_living_character = {
                limit = { has_character_flag = pinned_for_edit }

                hidden_effect = {
                    add_martial_lifestyle_perk_points = -1
                }
            }
        }
        else = {
            hidden_effect = {
                add_martial_lifestyle_perk_points = -1
            }
        }
    }
}

DI_add_stewardship_pp = {
    scope = character

    effect = {
        random_owned_story = {
            limit = {
                story_type = DI_misc_variables_story
            }
            save_scope_as = DI_story
        }

        if = {
            limit = {
                scope:DI_story = { has_variable = DI_pinned_char_var }
            }
            every_living_character = {
                limit = { has_character_flag = pinned_for_edit }

                hidden_effect = {
                    add_stewardship_lifestyle_perk_points = 1
                }
            }
        }
        else = {
            hidden_effect = {
                add_stewardship_lifestyle_perk_points = 1
            }
        }
    }
}

DI_remove_stewardship_pp = {
    scope = character

    effect = {
        random_owned_story = {
            limit = {
                story_type = DI_misc_variables_story
            }
            save_scope_as = DI_story
        }

        if = {
            limit = {
                scope:DI_story = { has_variable = DI_pinned_char_var }
            }
            every_living_character = {
                limit = { has_character_flag = pinned_for_edit }

                hidden_effect = {
                    add_stewardship_lifestyle_perk_points = -1
                }
            }
        }
        else = {
            hidden_effect = {
                add_stewardship_lifestyle_perk_points = -1
            }
        }
    }
}

DI_add_wanderer_pp = {
    scope = character

    effect = {
        random_owned_story = {
            limit = {
                story_type = DI_misc_variables_story
            }
            save_scope_as = DI_story
        }

        if = {
            limit = {
                scope:DI_story = { has_variable = DI_pinned_char_var }
            }
            every_living_character = {
                limit = { has_character_flag = pinned_for_edit }

                hidden_effect = {
                    add_wanderer_lifestyle_perk_points = 1
                }
            }
        }
        else = {
            hidden_effect = {
                add_wanderer_lifestyle_perk_points = 1
            }
        }
    }
}

DI_remove_wanderer_pp = {
    scope = character

    effect = {
        random_owned_story = {
            limit = {
                story_type = DI_misc_variables_story
            }
            save_scope_as = DI_story
        }

        if = {
            limit = {
                scope:DI_story = { has_variable = DI_pinned_char_var }
            }
            every_living_character = {
                limit = { has_character_flag = pinned_for_edit }

                hidden_effect = {
                    add_wanderer_lifestyle_perk_points = -1
                }
            }
        }
        else = {
            hidden_effect = {
                add_wanderer_lifestyle_perk_points = -1
            }
        }
    }
}
