.\common\decisions

xyh_decision = {
    is_shown = { NOT = { has_modifier = modifier_xyh_empire } }
    possible = { is_player = yes }
    
    when_taken = {
        if = {
            limit = { NOT = { has_modifier = modifier_xyh_empire  } }
            add_modifier = { name = modifier_xyh_empire}
        }
        ig:ig_devout = { set_interest_group_name = ig_fairy }
        if = {
            limit = { NOT = { has_ruling_interest_group = ig_devout } }
            ig:ig_devout = {
                leader = { set_ideology = ideology:ideology_royalist }
                add_ruling_interest_group = yes
            }
        }
        if = { # 教会学校
            limit = { NOT = { has_law = law_type:law_religious_schools } }
            activate_law = law_type:law_religious_schools
        }
        #if = { # 慈善医院
        #    limit = { NOT = { has_law = law_type:law_charitable_health_system } }
        #    activate_law = law_type:law_charitable_health_system
        #}
        if = {
            limit = {
                tag = CHI
                NOT = { capital = { state_region = s:STATE_NANJING } }
            }
            set_capital = STATE_NANJING
            every_scope_state = {
                limit = {
                    state_region = s:STATE_BEIJING
                }
                set_state_name = STATE_BEIJING_noncapital
                remove_building = "building_forbidden_city"
            }
            capital = {
                create_building={
                    building="building_forbidden_city"
                    level=1
                }
            }
        }
        
        if = {
            limit = {
                tag = CHI
                has_journal_entry = je_warlord_china
            }
            set_variable = china_warlord_abolished_monarchy
            set_variable = won_boxer_rebellion
        }
        if = {
            limit = {
                tag = CHI
                is_country_type = unrecognized
            }
            set_country_type = recognized
        }
        if = {
            limit = { cu:manchu = { is_primary_culture_of = root } }
            remove_primary_culture = cu:manchu
        }
        if = { # 国教
            limit = { NOT = { has_law = law_type:law_state_religion } }
            activate_law = law_type:law_state_religion
        }
        if = { # 佃农
            limit = { NOT = { has_law = law_type:law_tenant_farmers } }
            activate_law = law_type:law_tenant_farmers
        }
        if = {
            limit = { any_scope_character = { is_heir = yes } }
            heir = { kill_character = yes }
        }
        
        create_character = {
            first_name = "name_yuheng"
            last_name = "name_xian"
            historical = no                     # 历史人物
            culture = primary_culture           # 主流文化
            ruler = yes                         # 统治者
            age = 18                            # 年龄
            #is_general = yes                   # 是指挥官
            interest_group = ig_devout          # 利益集团 教士
            #interest_group = ig_landowners     # 利益集团 地主
            ideology = ideology_moderate        # 温和主义者
            on_created = { set_character_immortal = yes }   # 永生
            traits = {
                #pious
                innovative
                masterful_diplomat
                expert_political_operator
            }
        }
    }
}