﻿qing_htool_building_build_construct_cost_switch_trigger = {
	has_game_rule = qing_htool_building_build_construct_cost_switch_on
}

qing_htool_building_pay_gold_trigger = {
	has_game_rule = qing_htool_main_pay_method_gold
}
qing_htool_building_pay_treasury_trigger = {
	has_game_rule = qing_htool_main_pay_method_treasury
}
qing_htool_building_pay_gold_first_trigger = {
	has_game_rule = qing_htool_main_pay_method_gold_first
}
qing_htool_building_pay_treasury_first_trigger = {
	has_game_rule = qing_htool_main_pay_method_treasury_first
}

qing_htool_building_build_construct_ramparts_trigger = {
	NOT = { has_building_or_higher = ramparts_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	has_holding_type = castle_holding
	building_ramparts_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_curtain_walls_trigger = {
	NOT = { has_building_or_higher = curtain_walls_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	has_holding_type = castle_holding
	building_curtain_walls_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_watchtowers_trigger = {
	NOT = { has_building_or_higher = watchtowers_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	has_holding_type = castle_holding
	building_watchtowers_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_hill_forts_trigger = {
	NOT = { has_building_or_higher = hill_forts_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	has_holding_type = castle_holding
	building_hill_forts_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

# ========== ͨ�� ==========

qing_htool_building_build_construct_hospices_trigger = {
	NOT = { has_building_or_higher = hospices_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_requirement_castle_city_church = { LEVEL = 01 }
}

# ���ý���
qing_htool_building_build_construct_scriptorium_trigger = {
	NOT = { has_building_or_higher = scriptorium_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	has_building_or_higher = temple_01
	province_owner = { has_dlc_feature = legends }
}

qing_htool_building_build_construct_monastic_schools_trigger = {
	NOT = { has_building_or_higher = monastic_schools_01 }
	building_requirement_castle_city_church_temple_citadel_tribe = { LEVEL = 01 }
	trigger_if = {
		limit = {
			county.holder.faith = {
				NOT = { has_doctrine_parameter = monastic_schools_allowed_in_every_holding_type }
			}
		}
		has_holding_type = church_holding
	}
}

qing_htool_building_build_construct_megalith_trigger = {
	NOT = { has_building_or_higher = megalith_01 }
	has_building_or_higher = temple_01
	county.holder.faith = {
		has_doctrine_parameter = can_build_megaliths
	}
}

qing_htool_building_build_construct_breweries_trigger = {
	NOT = { has_building_or_higher = breweries_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	trigger_if = {
		limit = { has_building_or_higher = temple_01 }
		OR = {
			county.holder.faith = faith:catholic
			county.holder.faith = { has_doctrine_parameter = allows_brewery }
		}
	}
	trigger_else = {
		building_requirement_castle_city_church = { LEVEL = 01 }
		county.holder.culture = { has_cultural_parameter = allows_brewery }
	}
}

qing_htool_building_build_construct_longhouses_trigger = {
	NOT = { has_building_or_higher = longhouses_01 }
	has_building_or_higher = tribe_01
	county.holder = { NOT = { government_has_flag = government_is_wanua } }
}

qing_htool_building_build_construct_water_temples_trigger = {
	NOT = { has_building_or_higher = water_temples_01 }
	has_building_or_higher = tribe_01
	county.holder = { government_has_flag = government_is_wanua }
}


qing_htool_building_build_construct_common_tradeport_trigger = {
	NOT = { has_building_or_higher = common_tradeport_01 }
	building_common_tradeport_requirement_terrain = yes
	trigger_if = {
		limit = { NOT = { culture = { has_cultural_parameter = trade_ports_enabled_for_tribals } } }
		building_requirement_castle_city_church = { LEVEL = 01 }
	}
	trigger_else = {
		OR = {
			has_building_or_higher = tribe_01
			building_requirement_castle_city_church = { LEVEL = 01 }
		}
	}
}

qing_htool_building_build_construct_pastures_trigger = {
	NOT = { has_building_or_higher = pastures_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_pastures_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_hunting_grounds_trigger = {
	NOT = { has_building_or_higher = hunting_grounds_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_hunting_grounds_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_orchards_trigger = {
	NOT = { has_building_or_higher = orchards_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_orchards_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_farm_estates_trigger = {
	NOT = { has_building_or_higher = farm_estates_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	OR = {
		building_farm_estates_requirement_terrain = yes
		AND = {
			has_building_or_higher = pastures_04
			culture = {
				has_cultural_parameter = farm_estates_pastures_unlock
			}
		}
		building_paddy_fields_requirement_terrain = yes
	}
}

qing_htool_building_build_construct_cereal_fields_trigger = {
	NOT = { has_building_or_higher = cereal_fields_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_cereal_fields_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_logging_camps_trigger = {
	NOT = { has_building_or_higher = logging_camps_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_logging_camps_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_peat_quarries_trigger = {
	NOT = { has_building_or_higher = peat_quarries_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_peat_quarries_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_hill_farms_trigger = {
	NOT = { has_building_or_higher = hill_farms_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_hill_farms_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_elephant_pens_trigger = {
	NOT = { has_building_or_higher = elephant_pens_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_elephant_pens_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_plantations_trigger = {
	NOT = { has_building_or_higher = plantations_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_plantations_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_quarries_trigger = {
	NOT = { has_building_or_higher = quarries_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_quarries_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_qanats_trigger = {
	NOT = { has_building_or_higher = qanats_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_qanats_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_murex_farm_trigger = {
	NOT = { has_building_or_higher = murex_farm_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_murex_farm_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
	county = { NOT = { has_county_modifier = backwater_county_modifier } }
}

qing_htool_building_build_construct_paddy_fields_trigger = {
	NOT = { has_building_or_higher = paddy_fields_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_paddy_fields_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_spice_plantation_trigger = {
	NOT = { has_building_or_higher = spice_plantation_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_spice_plantation_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
	county = { NOT = { has_county_modifier = backwater_county_modifier } }
}

qing_htool_building_build_construct_waterworks_trigger = {
	NOT = { has_building_or_higher = waterworks_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	is_county_capital = yes
	NOR = {
		terrain = mountains
		terrain = desert_mountains
	}
	county.holder.culture = { has_cultural_parameter = unlocks_waterworks_buildings }
	building_requirement_castle_city_church = { LEVEL = 01 }
	county = { NOT = { has_county_modifier = backwater_county_modifier } }
}

# caravanserai
qing_htool_building_build_construct_caravanserai_trigger = {
	NOT = { has_building_or_higher = caravanserai_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_caravanserai_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }

	trigger_if = {
		limit = { has_game_rule = qing_htool_building_build_construct_condition_switch_on }
		county.holder.culture = {
			has_innovation = innovation_guilds
		}
	}
}

# watermills
qing_htool_building_build_construct_watermills_trigger = {
	NOT = { has_building_or_higher = watermills_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	OR = {
		building_watermills_requirement_terrain = yes
		AND = {
			has_building_or_higher = logging_camps_04
			culture = {
				has_cultural_parameter = watermills_forestries_unlock
			}
		}
	}
	building_requirement_castle_city_church = { LEVEL = 01 }

	trigger_if = {
		limit = { has_game_rule = qing_htool_building_build_construct_condition_switch_on }
		OR = {
			county.holder.culture = {
				has_innovation = innovation_windmills
			}
			AND = {
				county.holder.culture = {
					has_cultural_parameter = next_level_w_mills
				}
				county.holder.culture = {
					has_innovation = innovation_manorialism
				}
			}
		}
	}
}

# windmills
qing_htool_building_build_construct_windmills_trigger = {
	NOT = { has_building_or_higher = windmills_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	OR = {
		building_windmills_requirement_terrain = yes
		AND = {
			has_building_or_higher = hill_farms_04
			culture = {
				has_cultural_parameter = windmills_hill_farms_unlock
			}
		}
	}
	building_requirement_castle_city_church = { LEVEL = 01 }

	trigger_if = {
		limit = { has_game_rule = qing_htool_building_build_construct_condition_switch_on }
		OR = {
			county.holder.culture = {
				has_innovation = innovation_windmills
			}
			AND = {
				county.holder.culture = {
					has_cultural_parameter = next_level_w_mills
				}
				county.holder.culture = {
					has_innovation = innovation_manorialism
				}
			}
		}
	}
}

qing_htool_building_build_construct_guild_halls_trigger = {
	NOT = { has_building_or_higher = guild_halls_01 }
	has_building_or_higher = city_01
}

qing_htool_building_build_construct_market_villages_trigger = {
	NOT = { has_building_or_higher = market_villages_01 }
	has_building_or_higher = tribe_01
	county.holder = { NOT = { government_has_flag = government_is_wanua } }
}

qing_htool_building_build_construct_stilted_granaries_trigger = {
	NOT = { has_building_or_higher = stilted_granaries_01 }
	has_building_or_higher = tribe_01
	county.holder = { government_has_flag = government_is_wanua }
}

qing_htool_building_build_construct_capital_bureau_trigger = {
	NOT = { has_building_or_higher = capital_bureau_01 }
	province_owner = { government_has_flag = government_is_administrative }
	province_owner = { is_independent_ruler = yes }
	building_requirement_castle_city_church = { LEVEL = 01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
}


qing_htool_building_build_construct_wind_furnace_trigger = {
	NOT = { has_building_or_higher = wind_furnace_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	geographical_region = world_india
	OR = {
		is_coastal = yes
		AND = {
			county.holder.top_liege = {
				any_realm_county = {
					any_county_province = {
						has_building_or_higher = konasamudram_mines_01
					}
				}
			}
			duchy = {
				any_de_jure_county = {
					any_county_province = {
						has_building_or_higher = konasamudram_mines_01
					}
				}
			}
		}
	}
	county.holder.culture = { has_innovation = innovation_wootz_steel }
	building_requirement_castle_city_church = { LEVEL = 01 }
}

# powder_magazine
qing_htool_building_build_construct_powder_magazine_trigger = {
	NOT = { has_building_or_higher = powder_magazine_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_requirement_castle_city_church = { LEVEL = 01 }
	county.holder.culture = {
		has_cultural_parameter = unlock_powder_magazines
	}
}

# workshops
qing_htool_building_build_construct_workshops_trigger = {
	NOT = { has_building_or_higher = workshops_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_workshops_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }

	trigger_if = {
		limit = { has_game_rule = qing_htool_building_build_construct_condition_switch_on }
		county.holder.culture = {
			has_innovation = innovation_advanced_bowmaking
		}
	}
}

qing_htool_building_build_construct_horse_pastures_trigger = {
	NOT = { has_building_or_higher = horse_pastures_01 }
	building_horse_pastures_requirement_terrain = yes
}

qing_htool_building_build_construct_hillside_grazing_trigger = {
	NOT = { has_building_or_higher = hillside_grazing_01 }
	building_hillside_grazing_requirement_terrain = yes
}

qing_htool_building_build_construct_warrior_lodges_trigger = {
	NOT = { has_building_or_higher = warrior_lodges_01 }
	building_warrior_lodges_requirement_terrain = yes
	trigger_if = {
		limit = {
			NOT = { province_owner = { government_has_flag = government_is_tribal } }
		}
		NOT = { has_holding_type = tribal_holding }
	}
}

qing_htool_building_build_construct_military_camps_trigger = {
	NOT = { has_building_or_higher = military_camps_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_military_camps_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_regimental_grounds_trigger = {
	NOT = { has_building_or_higher = regimental_grounds_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_regimental_grounds_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_outposts_trigger = {
	NOT = { has_building_or_higher = outposts_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_outposts_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_barracks_trigger = {
	NOT = { has_building_or_higher = barracks_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_barracks_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_camel_farms_trigger = {
	NOT = { has_building_or_higher = camel_farms_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_camel_farms_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_stables_trigger = {
	NOT = { has_building_or_higher = stables_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_stables_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_smiths_trigger = {
	NOT = { has_building_or_higher = smiths_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	building_smiths_requirement_terrain = yes
	building_requirement_castle_city_church = { LEVEL = 01 }
}

qing_htool_building_build_construct_war_camps_trigger = {
	NOT = { has_building_or_higher = war_camps_01 }
	has_building_or_higher = tribe_01
	county.holder = { NOT = { government_has_flag = government_is_wanua } }
}

qing_htool_building_build_construct_kora_kora_yards_trigger = {
	NOT = { has_building_or_higher = kora_kora_yards_01 }
	has_building_or_higher = tribe_01
	county.holder = { government_has_flag = government_is_wanua }
	OR = {
		is_coastal = yes
		is_riverside_province = yes
	}
}

qing_htool_building_build_construct_wantilan_trigger = {
	NOT = { has_building_or_higher = wantilan_01 }
	has_building_or_higher = tribe_01
	county.holder = { government_has_flag = government_is_wanua }
}


qing_htool_building_build_construct_palisades_trigger = {
	NOT = { has_building_or_higher = palisades_01 }
	has_building_or_higher = tribe_01
	county.holder = { NOT = { government_has_flag = government_is_wanua } }
}

qing_htool_building_build_construct_idjang_forts_trigger = {
	NOT = { has_building_or_higher = idjang_forts_01 }
	has_building_or_higher = tribe_01
	county.holder = { government_has_flag = government_is_wanua }
}


qing_htool_building_build_construct_citadel_shrine_trigger = {
	NOT = { has_building_or_higher = citadel_shrine_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	has_building_or_higher = temple_citadel_01
	has_dlc = "All Under Heaven"
}

qing_htool_building_build_construct_sacred_pool_trigger = {
	NOT = { has_building_or_higher = sacred_pool_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	has_building_or_higher = temple_citadel_01
	has_dlc = "All Under Heaven"
}

qing_htool_building_build_construct_vihara_halls_trigger = {
	NOT = { has_building_or_higher = vihara_halls_01 }
	NOT = { province_owner = { government_has_flag = government_is_tribal } }
	has_building_or_higher = temple_citadel_01
	has_dlc = "All Under Heaven"
}





