﻿#Capital
# 迁移公国首都
qing_htool_duchy_capital_move = {
    scope = character
    saved_scopes = { gui_holding }

    is_shown = {
        scope:gui_holding = {
            exists = province_owner
            qing_htool_main_scope_value = 1
            is_county_capital = yes
            county = {
                duchy = {
                    exists = yes
                    NOT = { title_capital_county = prev }
                }
            }
        }
    }

    is_valid = {
        scope:gui_holding = {
            has_ongoing_construction = no
        }
    }

    effect = {
        hidden_effect = {
            scope:gui_holding = {
                county = {
                    save_scope_as = new_capital
                    
                    duchy = {
                        save_scope_as = target_duchy
                        
                        every_de_jure_county = {
                            limit = {
                                NOT = { this = scope:new_capital }
                            }
                            set_de_jure_liege_title = title:d_zun_warriors
                            add_to_list = correction_list
                        }
                        
                        scope:new_capital = {
                            scope:target_duchy = {
                                set_capital_county = scope:new_capital
                            }
                        }
                        
                        every_in_list = {
                            list = correction_list
                            set_de_jure_liege_title = scope:target_duchy
                        }
                    }
                }
            }
        }
        custom_tooltip = "qing_htool_duchy_capital_move_tip"
    }
}