﻿# 建造所有建筑 阈值50个
qing_htool_building_build_construct_all_to_max = {
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
    if = { limit = { NOT = { has_free_building_slot = yes } qing_htool_building_slot_add_trigger = yes qing_htool_building_has_constructible_trigger = yes } qing_htool_building_slot_add_effect = yes }
    qing_htool_building_build_construct_all = yes
}

# 执行加槽（含变量初始化/递增 + 扣费）
qing_htool_building_slot_add_effect = {
    if = {
        limit = { NOT = { has_variable = qing_htool_building_slot_information_count } }
        set_variable = {
            name = qing_htool_building_slot_information_count
            value = 0
        }
    }
    add_province_modifier = qing_htool_building_slot_add_modifier
    change_variable = {
        name = qing_htool_building_slot_information_count
        add = 1
    }
    # 扣费
    if = {
        limit = { qing_htool_building_slot_cost_total > 0 }
        if = {
            limit = { has_game_rule = qing_htool_main_pay_method_gold }
            root = { remove_long_term_gold = qing_htool_building_slot_cost_total }
        }
        else_if = {
            limit = { has_game_rule = qing_htool_main_pay_method_treasury }
            if = {
                limit = { root = { has_treasury = yes } }
                root = { remove_treasury = qing_htool_building_slot_cost_total }
            }
            else = { root = { remove_long_term_gold = qing_htool_building_slot_cost_total } }
        }
        else_if = {
            limit = { has_game_rule = qing_htool_main_pay_method_gold_first }
            if = {
                limit = { root.gold >= qing_htool_building_slot_cost_total }
                root = { remove_long_term_gold = qing_htool_building_slot_cost_total }
            }
            else_if = {
                limit = { root = { has_treasury = yes } root.treasury >= qing_htool_building_slot_cost_total }
                root = { remove_treasury = qing_htool_building_slot_cost_total }
            }
            else = { root = { remove_long_term_gold = qing_htool_building_slot_cost_total } }
        }
        else_if = {
            limit = { has_game_rule = qing_htool_main_pay_method_treasury_first }
            if = {
                limit = { root = { has_treasury = yes } root.treasury >= qing_htool_building_slot_cost_total }
                root = { remove_treasury = qing_htool_building_slot_cost_total }
            }
            else = { root = { remove_long_term_gold = qing_htool_building_slot_cost_total } }
        }
    }
}

qing_htool_building_build_construct_all = {
    if = { limit = { qing_htool_building_build_construct_ramparts_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 100 root.treasury >= 100 } }
        add_building = ramparts_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 100 }
                    root = { remove_long_term_gold = 100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_curtain_walls_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 100 root.treasury >= 100 } }
        add_building = curtain_walls_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 100 }
                    root = { remove_long_term_gold = 100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_watchtowers_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 100 root.treasury >= 100 } }
        add_building = watchtowers_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 100 }
                    root = { remove_long_term_gold = 100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_hill_forts_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 100 root.treasury >= 100 } }
        add_building = hill_forts_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 100 }
                    root = { remove_long_term_gold = 100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_palisades_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 75 root.treasury >= 75 } }
        add_building = palisades_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 75 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 75 }
                    root = { remove_long_term_gold = 75 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_idjang_forts_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 75 root.treasury >= 75 } }
        add_building = idjang_forts_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 75 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 75 }
                    root = { remove_long_term_gold = 75 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_common_tradeport_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = common_tradeport_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_pastures_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = pastures_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_hunting_grounds_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 100 root.treasury >= 100 } }
        add_building = hunting_grounds_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 100 }
                    root = { remove_long_term_gold = 100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_orchards_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = orchards_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_farm_estates_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = farm_estates_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_cereal_fields_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = cereal_fields_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_logging_camps_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 100 root.treasury >= 100 } }
        add_building = logging_camps_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 100 }
                    root = { remove_long_term_gold = 100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_peat_quarries_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 100 root.treasury >= 100 } }
        add_building = peat_quarries_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 100 }
                    root = { remove_long_term_gold = 100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_hill_farms_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 100 root.treasury >= 100 } }
        add_building = hill_farms_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 100 }
                    root = { remove_long_term_gold = 100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_elephant_pens_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = elephant_pens_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_plantations_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 100 root.treasury >= 100 } }
        add_building = plantations_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 100 }
                    root = { remove_long_term_gold = 100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_quarries_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 100 root.treasury >= 100 } }
        add_building = quarries_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 100 }
                    root = { remove_long_term_gold = 100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_qanats_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = qanats_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_murex_farm_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = murex_farm_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_paddy_fields_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = paddy_fields_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_spice_plantation_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = spice_plantation_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_waterworks_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = waterworks_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_caravanserai_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 200 root.treasury >= 200 } }
        add_building = caravanserai_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 200 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 200 }
                    root = { remove_treasury = 200 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 200 }
                    root = { remove_long_term_gold = 200 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 200 }
                    root = { remove_treasury = 200 }
                }
                else = { root = { remove_long_term_gold = 200 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 200 }
                    root = { remove_treasury = 200 }
                }
                else = { root = { remove_long_term_gold = 200 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_watermills_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 200 root.treasury >= 200 } }
        add_building = watermills_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 200 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 200 }
                    root = { remove_treasury = 200 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 200 }
                    root = { remove_long_term_gold = 200 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 200 }
                    root = { remove_treasury = 200 }
                }
                else = { root = { remove_long_term_gold = 200 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 200 }
                    root = { remove_treasury = 200 }
                }
                else = { root = { remove_long_term_gold = 200 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_windmills_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 200 root.treasury >= 200 } }
        add_building = windmills_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 200 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 200 }
                    root = { remove_treasury = 200 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 200 }
                    root = { remove_long_term_gold = 200 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 200 }
                    root = { remove_treasury = 200 }
                }
                else = { root = { remove_long_term_gold = 200 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 200 }
                    root = { remove_treasury = 200 }
                }
                else = { root = { remove_long_term_gold = 200 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_guild_halls_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = guild_halls_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_market_villages_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 75 root.treasury >= 75 } }
        add_building = market_villages_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 75 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 75 }
                    root = { remove_long_term_gold = 75 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_stilted_granaries_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 75 root.treasury >= 75 } }
        add_building = stilted_granaries_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 75 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 75 }
                    root = { remove_long_term_gold = 75 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_capital_bureau_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = capital_bureau_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_breweries_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = breweries_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_military_camps_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 100 root.treasury >= 100 } }
        add_building = military_camps_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 100 }
                    root = { remove_long_term_gold = 100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_regimental_grounds_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 200 root.treasury >= 200 } }
        add_building = regimental_grounds_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 200 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 200 }
                    root = { remove_treasury = 200 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 200 }
                    root = { remove_long_term_gold = 200 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 200 }
                    root = { remove_treasury = 200 }
                }
                else = { root = { remove_long_term_gold = 200 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 200 }
                    root = { remove_treasury = 200 }
                }
                else = { root = { remove_long_term_gold = 200 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_barracks_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = barracks_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_warrior_lodges_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 100 root.treasury >= 100 } }
        add_building = warrior_lodges_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 100 }
                    root = { remove_long_term_gold = 100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_hillside_grazing_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 100 root.treasury >= 100 } }
        add_building = hillside_grazing_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 100 }
                    root = { remove_long_term_gold = 100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_outposts_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 100 root.treasury >= 100 } }
        add_building = outposts_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 100 }
                    root = { remove_long_term_gold = 100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_camel_farms_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = camel_farms_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_horse_pastures_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 100 root.treasury >= 100 } }
        add_building = horse_pastures_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 100 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 100 }
                    root = { remove_long_term_gold = 100 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 100 }
                    root = { remove_treasury = 100 }
                }
                else = { root = { remove_long_term_gold = 100 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_stables_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = stables_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_smiths_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = smiths_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_workshops_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 200 root.treasury >= 200 } }
        add_building = workshops_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 200 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 200 }
                    root = { remove_treasury = 200 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 200 }
                    root = { remove_long_term_gold = 200 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 200 }
                    root = { remove_treasury = 200 }
                }
                else = { root = { remove_long_term_gold = 200 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 200 }
                    root = { remove_treasury = 200 }
                }
                else = { root = { remove_long_term_gold = 200 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_wind_furnace_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = wind_furnace_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_powder_magazine_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = powder_magazine_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_war_camps_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 75 root.treasury >= 75 } }
        add_building = war_camps_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 75 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 75 }
                    root = { remove_long_term_gold = 75 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_kora_kora_yards_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 75 root.treasury >= 75 } }
        add_building = kora_kora_yards_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 75 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 75 }
                    root = { remove_long_term_gold = 75 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_wantilan_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 75 root.treasury >= 75 } }
        add_building = wantilan_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 75 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 75 }
                    root = { remove_long_term_gold = 75 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_hospices_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = hospices_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_scriptorium_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = scriptorium_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_monastic_schools_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = monastic_schools_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_megalith_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = megalith_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_longhouses_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 75 root.treasury >= 75 } }
        add_building = longhouses_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 75 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 75 }
                    root = { remove_long_term_gold = 75 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_water_temples_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 75 root.treasury >= 75 } }
        add_building = water_temples_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 75 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 75 }
                    root = { remove_long_term_gold = 75 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 75 }
                    root = { remove_treasury = 75 }
                }
                else = { root = { remove_long_term_gold = 75 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_citadel_shrine_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = citadel_shrine_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_sacred_pool_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = sacred_pool_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
    if = { limit = { qing_htool_building_build_construct_vihara_halls_trigger = yes has_free_building_slot = yes OR = { NOT = { qing_htool_building_build_construct_cost_switch_trigger = yes } root.gold >= 150 root.treasury >= 150 } }
        add_building = vihara_halls_01
        if = { limit = { qing_htool_building_build_construct_cost_switch_trigger = yes }
            if = { limit = { qing_htool_building_pay_gold_trigger = yes }
                root = { remove_long_term_gold = 150 }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
            }
            else_if = { limit = { qing_htool_building_pay_gold_first_trigger = yes }
                if = { limit = { root.gold >= 150 }
                    root = { remove_long_term_gold = 150 }
                }
                else_if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
            else_if = { limit = { qing_htool_building_pay_treasury_first_trigger = yes }
                if = { limit = { root.has_treasury = yes root.treasury >= 150 }
                    root = { remove_treasury = 150 }
                }
                else = { root = { remove_long_term_gold = 150 } }
            }
        }
    }
}
