﻿##########
# Duchy Capital Buildings
# These are built in the first barony of the first county of any duchy
# Holding the associated duchy is required both to build, and for the buildings to be enabled
##########

# SPECIAL DUCHY BUILDINGS
# We place these at the top to make them more visible in the building interface.

##########################
### WATER FILTER MILLS ###
##########################

water_filter_mills_01 = {
	construction_time = slow_construction_time

	can_construct_potential = {
		building_requirement_castle_city_church = { LEVEL = 01 }
		building_requirement_tribal = no
	}
	
	can_construct_showing_failures_only = {
		
		culture ?= {
			has_innovation = innovation_manorialism
		}
	}
	
	is_enabled = {
		county.holder = { has_title = prev.duchy }
	}
	show_disabled = yes
	
	cost_gold = expensive_building_tier_3_cost
	
	duchy_capital_county_modifier = {
		supply_limit_mult = 0.25
		levy_reinforcement_rate = 0.25
		development_growth_factor = 0.1
		tax_mult = 0.05
	}
	
	next_building = water_filter_mills_02

	type_icon = "icon_building_watermills.dds"
	
	type = duchy_capital
	
	flag = duchy_building
	
	ai_value = {
		base = 20
		modifier = {
			factor = 2
			scope:holder.capital_province = this
		}
		modifier = {
			factor = 2
			AND = {
				building_watermills_requirement_terrain = yes
				building_windmills_requirement_terrain = yes
			}
		}
		modifier = {
			factor = 2
			OR = {
				has_building_or_higher = watermills_01
				has_building_or_higher = windmills_01
				has_building_or_higher = caravanserai_01
			}
		}
		modifier = { # Fill all building slots before going for duchy buildings
			factor = 0
			free_building_slots > 0
		}
		modifier = { # Less likely when the AI should build regular buildings first
			factor = 0.1
			scope:holder = { ai_should_focus_on_building_in_their_capital = yes }
		}
	}
}

water_filter_mills_02 = {
	construction_time = slow_construction_time

	can_construct_potential = {
		building_requirement_castle_city_church = { LEVEL = 01 }
		building_requirement_tribal = no
	}
	
	can_construct_showing_failures_only = {
		
		culture ?= {
			has_innovation = innovation_windmills
		}
	}
	
	is_enabled = {
		county.holder = { has_title = prev.duchy }
	}
	show_disabled = yes
	
	cost_gold = expensive_building_tier_4_cost
	
	duchy_capital_county_modifier = {
		supply_limit_mult = 0.5
		levy_reinforcement_rate = 0.5
		development_growth_factor = 0.2
		tax_mult = 0.10
	}
	
	next_building = water_filter_mills_03
	
	type = duchy_capital
	
	flag = duchy_building
	
	ai_value = {
		base = 20
		modifier = {
			factor = 2
			scope:holder.capital_province = this
		}
	}
}

water_filter_mills_03 = {
	construction_time = slow_construction_time

	can_construct_potential = {
		building_requirement_castle_city_church = { LEVEL = 01 }
		building_requirement_tribal = no
	}
	
	can_construct_showing_failures_only = {
		
		culture ?= {
			has_innovation = innovation_cranes
		}
	}
	
	is_enabled = {
		county.holder = { has_title = prev.duchy }
	}
	show_disabled = yes
	
	cost_gold = expensive_building_tier_5_cost
	
	duchy_capital_county_modifier = {
		supply_limit_mult = 1
		levy_reinforcement_rate = 1
		development_growth_factor = 0.3
		tax_mult = 0.15
	}
	
	type = duchy_capital
	
	flag = duchy_building
	flag = fully_upgraded_duchy_capital_building
	
	ai_value = {
		base = 20
		modifier = {
			factor = 2
			scope:holder.capital_province = this
		}
	}
}
