﻿# Auto-generated by DI Updater Tool. Do not edit.
DI_spawn_court_position = {
    scope = character
    saved_scopes = { court_position_type }

    effect = {
        save_scope_as = root_target
        random_owned_story = {
            limit = { story_type = DI_misc_variables_story }
            save_scope_as = DI_story
        }
        scope:DI_story = {
            save_scope_value_as = {
                name = DI_char_spawner_count_increment_value
                value = var:DI_char_spawner_count_increment_value
            }
        }
        DI_apply_court_position_profile_effect = { COURT_POSITION = scope:court_position_type }

        if = {
            limit = { scope:DI_story = { has_variable = DI_pinned_char_var } }
            every_in_list = {
                variable = pinned_characters
                save_scope_as = target
                while = {
                    count = scope:DI_char_spawner_count_increment_value
                    DI_spawn_selected_court_position_effect = yes
                }
            }
        }
        else = {
            save_scope_as = target
            while = {
                count = scope:DI_char_spawner_count_increment_value
                DI_spawn_selected_court_position_effect = yes
            }
        }

        if = {
            limit = { scope:root_target.var:DI_cs_random_traits ?= no }
            DI_no_random_traits_effect = yes
        }
        else_if = {
            limit = { scope:root_target.var:DI_cs_random_traits ?= yes }
            DI_random_traits_effect = yes
        }
    }
}
