 # Triggers are in Province scope. The From Scope contains the settlement holder (character)
 # start trigger is in title scope.
 
 #<tag> = {
 #	desc = description used in the tooltip of the building
 #	trigger = used for tech requirement of the building, set to 0 if no requirement so it can be build automatically on new games
 #	gold_cost = cost to build the building
 #	build_time = time to build, in days
 #	
 #	ai_creation_factor = weight that the AI uses to determine what building to build
 #	extra_tech_building_start = when starting a new game this building will be pre-built if the province has higher tech than the requirement + this + random 0-1
 #}
 
 # Castle


castle = {
	ca_imp_pal_1 = {
		desc = ca_imp_pal_1_desc
		potential = {
			OR = {
				FROM = {
					OR = {
						tier = BARON
						tier = COUNT
						tier = DUKE
						tier = KING
						tier = EMPEROR
					}
					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_imp_pal_1
				}
			}
		}
		trigger = { TECH_CONSTRUCTION = 1 }
		prestige_cost = 1000
		build_time = 1100
		ai_creation_factor = 90
		extra_tech_building_start = 100
		add_number_to_name = no
		liege_piety = 0.2
		liege_prestige = 0.2
		retinuesize = 100
		light_infantry = 100
	}
	ca_imp_pal_2 = {
		desc = ca_imp_pal_2_desc
		potential = {
			OR = {
				FROM = {
					OR = {
						tier = COUNT
						tier = DUKE
						tier = KING
						tier = EMPEROR
					}
					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_imp_pal_2
				}
			}
		}
		trigger = { TECH_CONSTRUCTION = 2 }
		prestige_cost = 2000
		build_time = 1100
		ai_creation_factor = 90
		extra_tech_building_start = 100
		add_number_to_name = no
		liege_piety = 0.2
		liege_prestige = 0.2
		retinuesize = 100
		light_infantry = 100
		upgrades_from = ca_imp_pal_1
	}
	ca_imp_pal_3 = {
		desc = ca_imp_pal_3_desc
		potential = {
			OR = {
				FROM = {
					OR = {
						tier = DUKE
						tier = KING
						tier = EMPEROR

					}
					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_imp_pal_3
				}
			}
		}
		trigger = { TECH_CONSTRUCTION = 3 }
		prestige_cost = 3000
		build_time = 1100
		ai_creation_factor = 88
		extra_tech_building_start = 100
		add_number_to_name = no
		liege_piety = 0.2
		liege_prestige = 0.2
		retinuesize = 100
		light_infantry = 100
		heavy_infantry = 100
		upgrades_from = ca_imp_pal_2
	}
	ca_imp_pal_4 = {
		desc = ca_imp_pal_4_desc
		potential = {
			OR = {
				FROM = {
					OR = {
						tier = KING
						tier = EMPEROR

					}
					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_imp_pal_4
				}
			}
		}
		trigger = { TECH_CONSTRUCTION = 4 }
		prestige_cost = 4000
		build_time = 1100
		ai_creation_factor = 90
		extra_tech_building_start = 100
		add_number_to_name = no
		liege_piety = 0.2
		liege_prestige = 0.2
		retinuesize = 100
		light_infantry = 100
		heavy_infantry = 100
		upgrades_from = ca_imp_pal_3
	}
	ca_imp_pal_5 = {
		desc = ca_imp_pal_5_desc
		potential = {
			OR = {
				FROM = {
					OR = {
						tier = EMPEROR

					}
					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_imp_pal_5
				}
			}
		}
		trigger = { TECH_CONSTRUCTION = 5 }
		prestige_cost = 5000
		build_time = 1100
		ai_creation_factor = 88
		extra_tech_building_start = 100
		add_number_to_name = no
		liege_piety = 0.2
		liege_prestige = 0.2
		retinuesize = 100
		light_infantry = 100
		heavy_infantry = 100
		pikemen = 100
		upgrades_from = ca_imp_pal_4
	}
}
castle = {
	# Wall quality, gives fortlevel
	ca_wall_q_1 = {
		desc = ca_wall_q_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 0 }
		gold_cost = 50
		build_time = 182
		fort_level = 0.5
		ai_creation_factor = 80
		
		extra_tech_building_start = 1.0
	}
	ca_wall_q_2 = {
		desc = ca_wall_q_2_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 1 }
		upgrades_from = ca_wall_q_1
		prerequisites = { ca_wall_1 }
		gold_cost = 50
		build_time = 182
		fort_level = 0.5
		ai_creation_factor = 79

		extra_tech_building_start = 1.4
	}
	ca_wall_q_3 = {
		desc = ca_wall_q_3_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 3 }
		upgrades_from = ca_wall_q_2
		gold_cost = 50
		build_time = 182
		fort_level = 0.5
		ai_creation_factor = 78
		
		extra_tech_building_start = 1.2
	}
	ca_wall_q_4 = {
		desc = ca_wall_q_4_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 5 }
		upgrades_from = ca_wall_q_3
		gold_cost = 100
		build_time = 365
		fort_level = 1.0
		ai_creation_factor = 77
		
		extra_tech_building_start = 0.8
	}
	ca_wall_q_5 = {
		desc = ca_wall_q_5_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 7 }
		upgrades_from = ca_wall_q_4
		gold_cost = 100
		build_time = 365
		fort_level = 1.0
		ai_creation_factor = 76

		extra_tech_building_start = 0.4
	}
	
	#Walls, gives fortlevel, levysize and income
	ca_wall_1 = {
		desc = ca_wall_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 0 }
		gold_cost = 25
		build_time = 365
		fort_level = 0.5
		ai_creation_factor = 90
		
		extra_tech_building_start = 1.0
	}
	ca_wall_2 = {
		desc = ca_wall_2_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 2 }
		upgrades_from = ca_wall_1
		gold_cost = 25
		build_time = 547 #1.5y
		fort_level = 0.5
		ai_creation_factor = 89
		
		extra_tech_building_start = 1.4
	}
	ca_wall_3 = {
		desc = ca_wall_3_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 4 }
		upgrades_from = ca_wall_2
		gold_cost = 50
		build_time = 730 #2y
		fort_level = 1.0
		ai_creation_factor = 88

		extra_tech_building_start = 1.2
	}
	ca_wall_4 = {
		desc = ca_wall_4_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 6 }
		upgrades_from = ca_wall_3
		gold_cost = 75
		build_time = 1095 #3y
		fort_level = 1.0
		ai_creation_factor = 87

		extra_tech_building_start = 0.8
	}
	ca_wall_5 = {
		desc = ca_wall_5_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 8 }
		upgrades_from = ca_wall_4
		gold_cost = 75
		build_time = 1460 #4y
		fort_level = 1.5
		ai_creation_factor = 86

		extra_tech_building_start = 0.4
	}
	ca_con_wall_6 = { # Theodosian Walls
		potential = {
			FROMFROM = { title = b_constantinople }
		}
		desc = ca_con_wall_6_desc
		upgrades_from = ca_wall_5
		gold_cost = 150
		build_time = 1460 #4y
		fort_level = 6.0
		garrison_size = 1.00
		ai_creation_factor = 86

		extra_tech_building_start = 0.0
	}
	ca_moat_1 = {
		desc = ca_moat_1_desc
		potential = {
			NOR = { 
				terrain = desert
				terrain = mountain
				}
			}
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 2 }
		gold_cost = 50
		build_time = 182
		fort_level = 0.3
		ai_creation_factor = 80
		
		extra_tech_building_start = 1.0
	}
	ca_moat_2 = {
		desc = ca_moat_1_desc
		potential = {
			NOR = { 
				terrain = desert
				terrain = mountain
				}
			}
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 4 }
		upgrades_from = ca_moat_1
		prerequisites = { ca_wall_1 }
		gold_cost = 50
		build_time = 182
		fort_level = 0.3
		ai_creation_factor = 79

		extra_tech_building_start = 0.6
	}
	ca_moat_3 = {
		desc = ca_moat_1_desc
		potential = {
			NOR = { 
				terrain = desert
				terrain = mountain

				}
			}
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 5 }
		upgrades_from = ca_moat_2
		gold_cost = 50
		build_time = 182
		fort_level = 0.4
		ai_creation_factor = 78
		
		extra_tech_building_start = 0.2
	}
	ca_geld_1 = {
		desc = ca_geld_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 0 }
		gold_cost = 25
		build_time = 365
		levy_size = 0.025
		tax_income = 0.2
		ai_creation_factor = 90
		
		extra_tech_building_start = 1.0
	}
	ca_geld_2 = {
		desc = ca_geld_2_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 2 }
		upgrades_from = ca_geld_1
		gold_cost = 25
		build_time = 547 #1.5y
		levy_size = 0.025
		tax_income = 0.2
		ai_creation_factor = 89
		
		extra_tech_building_start = 1.4
	}
	ca_geld_3 = {
		desc = ca_geld_3_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 4 }
		upgrades_from = ca_geld_2
		gold_cost = 50
		build_time = 730 #2y
		levy_size = 0.05
		tax_income = 0.2
		ai_creation_factor = 88

		extra_tech_building_start = 1.2
	}
	ca_geld_4 = {
		desc = ca_geld_4_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 6 }
		upgrades_from = ca_geld_3
		gold_cost = 75
		build_time = 1095 #3y
		levy_size = 0.05
		tax_income = 0.2
		ai_creation_factor = 87

		extra_tech_building_start = 0.8
	}
	ca_geld_5 = {
		desc = ca_geld_5_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 8 }
		upgrades_from = ca_geld_4
		gold_cost = 75
		build_time = 1460 #4y
		levy_size = 0.1
		tax_income = 0.5
		ai_creation_factor = 86

		extra_tech_building_start = 0.4
	}

	#Keeps, gives levy and garrison size
	ca_keep_1 = {
		desc = ca_keep_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 0 }
		gold_cost = 75
		build_time = 547 #1.5y
		garrison_size = 0.05
		ai_creation_factor = 102
		
		extra_tech_building_start = 1.0
	}
	ca_keep_2 = {
		desc = ca_keep_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 0 }
		prerequisites = { ca_wall_1 }
		upgrades_from = ca_keep_1
		gold_cost = 100
		build_time = 730 #2y
		garrison_size = 0.1
		ai_creation_factor = 101

		extra_tech_building_start = 2.2
	}
	ca_keep_3 = {
		desc = ca_keep_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 2 }
		prerequisites = { ca_wall_2 }
		upgrades_from = ca_keep_2
		gold_cost = 150
		build_time = 1095 #3y
		garrison_size = 0.15
		ai_creation_factor = 100
		
		extra_tech_building_start = 1.6
	}
	ca_keep_4 = {	
		desc = ca_keep_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 4 }
		upgrades_from = ca_keep_3
		gold_cost = 200
		build_time = 1460 #4y
		garrison_size = 0.2
		ai_creation_factor = 99

		extra_tech_building_start = 1.0
	}
	ca_keep_5 = {
		desc = ca_keep_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 6 }
		upgrades_from = ca_keep_4
		gold_cost = 250
		build_time = 2190 #6y
		garrison_size = 0.2
		ai_creation_factor = 98

		extra_tech_building_start = 1.0
	}
	ca_keep_6 = {
		desc = ca_keep_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 8 }
		upgrades_from = ca_keep_5
		gold_cost = 250
		build_time = 2190 #6y
		garrison_size = 0.2
		ai_creation_factor = 97
		
		extra_tech_building_start = 0.2
	}
	ca_keeplevy_1 = {
		desc = ca_keeplevy_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 0 }
		gold_cost = 75
		build_time = 547 #1.5y
		levy_size = 0.05
		ai_creation_factor = 102
		
		extra_tech_building_start = 1.0
	}
	ca_keeplevy_2 = {
		desc = ca_keeplevy_2_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 0 }
		prerequisites = { ca_wall_1 }
		upgrades_from = ca_keeplevy_1
		gold_cost = 100
		build_time = 730 #2y
		levy_size = 0.1
		ai_creation_factor = 101

		extra_tech_building_start = 2.2
	}
	ca_keeplevy_3 = {
		desc = ca_keeplevy_3_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 2 }
		prerequisites = { ca_wall_2 }
		upgrades_from = ca_keeplevy_2
		gold_cost = 150
		build_time = 1095 #3y
		levy_size = 0.15
		ai_creation_factor = 100
		
		extra_tech_building_start = 1.6
	}
	ca_keeplevy_4 = {	
		desc = ca_keeplevy_4_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 4 }
		upgrades_from = ca_keeplevy_3
		gold_cost = 200
		build_time = 1460 #4y
		levy_size = 0.2
		ai_creation_factor = 99

		extra_tech_building_start = 1.0
	}
	ca_keeplevy_5 = {
		desc = ca_keeplevy_5_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 6 }
		upgrades_from = ca_keeplevy_4
		gold_cost = 250
		build_time = 2190 #6y
		levy_size = 0.25
		ai_creation_factor = 98

		extra_tech_building_start = 1.0
	}
	ca_keeplevy_6 = {
		desc = ca_keeplevy_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 8 }
		upgrades_from = ca_keeplevy_5
		gold_cost = 250
		build_time = 2190 #6y
		levy_size = 0.3
		ai_creation_factor = 97
		
		extra_tech_building_start = 0.2
	}
	
	# Militia barracks, gives light infantry and archers.
	ca_militia_barracks_1 = {
		desc = ca_militia_barracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		gold_cost = 50
		build_time = 365
		light_infantry = 80
		ai_creation_factor = 100
		
		extra_tech_building_start = 1.0
	}
	ca_militia_barracks_2 = {
		desc = ca_militia_barracks_2_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 1 }
		prerequisites = { ca_wall_1 }
		upgrades_from = ca_militia_barracks_1
		gold_cost = 60
		build_time = 547
		light_infantry = 50
		ai_creation_factor = 99

		extra_tech_building_start = 2.2
	}
	ca_militia_barracks_3 = {
		desc = ca_militia_barracks_3_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 5 }
		upgrades_from = ca_militia_barracks_2
		gold_cost = 100
		build_time = 1095
		light_infantry = 20
		ai_creation_factor = 98

		extra_tech_building_start = 1.2
	}
	ca_militia_barracks_4 = {
		desc = ca_militia_barracks_3_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 7 }
		upgrades_from = ca_militia_barracks_3
		gold_cost = 150
		build_time = 1095
		light_infantry = 30
		ai_creation_factor = 98

		extra_tech_building_start = 0.5
	}
	ca_archer_range_1 = {
		desc = ca_militia_barracks_2_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		gold_cost = 50
		build_time = 365
		archers = 10
		ai_creation_factor = 100
		
		extra_tech_building_start = 1.0
	}
	ca_archer_range_2 = {
		desc = ca_archer_range_2_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 1 }
		prerequisites = { ca_wall_1 }
		upgrades_from = ca_archer_range_1
		gold_cost = 60
		build_time = 547
		archers = 50
		ai_creation_factor = 99

		extra_tech_building_start = 2.2
	}
	ca_archer_range_3 = {
		desc = ca_militia_barracks_3_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 5 }
		upgrades_from = ca_archer_range_2
		gold_cost = 100
		build_time = 1095
		archers = 90
		ai_creation_factor = 98

		extra_tech_building_start = 1.2
	}
	ca_archer_range_4 = {
		desc = ca_archer_range_4_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 7 }
		upgrades_from = ca_archer_range_3
		gold_cost = 150
		build_time = 1095
		archers = 120
		ai_creation_factor = 98

		extra_tech_building_start = 0.5
	}

	#Training grounds, gives morale and reinforce rate
	ca_training_grounds_1 = {
		desc = ca_training_grounds_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		prerequisites = { ca_wall_2 }
		gold_cost = 100
		build_time = 730
		land_morale = 0.1
		levy_reinforce_rate = 0.1
		ai_creation_factor = 89

		extra_tech_building_start = 1.2
	}
	ca_training_grounds_2 = {
		desc = ca_training_grounds_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 3 }
		upgrades_from = ca_training_grounds_1
		gold_cost = 125
		build_time = 1095
		land_morale = 0.15
		levy_reinforce_rate = 0.15
		ai_creation_factor = 88
		
		extra_tech_building_start = 1.0
	}
	ca_training_grounds_3 = {
		desc = ca_training_grounds_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 6 }
		upgrades_from = ca_training_grounds_2
		gold_cost = 150
		build_time = 2190
		land_morale = 0.2
		levy_reinforce_rate = 0.2
		ai_creation_factor = 88
		
		extra_tech_building_start = 1.0
	}
	ca_retinuegrounds_1 = {
		desc = ca_retinuegrounds_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		prerequisites = { ca_wall_2 }
		gold_cost = 100
		build_time = 730
		retinuesize = 20
		ai_creation_factor = 89

		extra_tech_building_start = 1.2
	}
	ca_retinuegrounds_2 = {
		desc = ca_retinuegrounds_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 3 }
		upgrades_from = ca_retinuegrounds_1
		gold_cost = 125
		build_time = 1095
		retinuesize = 20
		ai_creation_factor = 88
		
		extra_tech_building_start = 1.0
	}
	ca_retinuegrounds_3 = {
		desc = ca_retinuegrounds_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 6 }
		upgrades_from = ca_retinuegrounds_2
		gold_cost = 150
		build_time = 2190
		retinuesize = 20
		ai_creation_factor = 88
		
		extra_tech_building_start = 0.2
	}
	# Barracks, gives heavy infantry and pikemen
	ca_barracks_1 = {
		desc = ca_barracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		gold_cost = 50
		build_time = 365
		heavy_infantry = 30
		ai_creation_factor = 105
		
		extra_tech_building_start = 1.0
	}
	ca_barracks_2 = {
		desc = ca_barracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		prerequisites = { ca_wall_1 }
		upgrades_from = ca_barracks_1
		gold_cost = 60
		build_time = 547
		heavy_infantry = 40
		ai_creation_factor = 104
		
		extra_tech_building_start = 2.2
	}
	ca_barracks_3 = {
		desc = ca_barracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 1 }
		prerequisites = { ca_wall_2 }
		upgrades_from = ca_barracks_2
		gold_cost = 100
		build_time = 730
		heavy_infantry = 45
		ai_creation_factor = 103

		extra_tech_building_start = 3.0
	}
	ca_barracks_4 = {
		desc = ca_barracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 3 }
		upgrades_from = ca_barracks_3
		gold_cost = 150
		build_time = 1095
		heavy_infantry = 50
		ai_creation_factor = 102

		extra_tech_building_start = 3.0
	}
	ca_barracks_5 = {
		desc = ca_barracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 5 }
		upgrades_from = ca_barracks_4
		gold_cost = 200
		build_time = 2190
		heavy_infantry = 60
		ai_creation_factor = 101

		extra_tech_building_start = 2.0
	}
	ca_barracks_6 = {
		desc = ca_barracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 7 }
		upgrades_from = ca_barracks_5
		gold_cost = 250
		build_time = 2190
		heavy_infantry = 65
		ai_creation_factor = 100

		extra_tech_building_start = 0.2
	}
	ca_spearbarracks_1 = {
		desc = ca_spearbarracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		gold_cost = 50
		build_time = 365
		pikemen = 15
		ai_creation_factor = 105
		
		extra_tech_building_start = 1.0
	}
	ca_spearbarracks_2 = {
		desc = ca_spearbarracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		prerequisites = { ca_wall_1 }
		upgrades_from = ca_spearbarracks_1
		gold_cost = 60
		build_time = 547
		pikemen = 15
		ai_creation_factor = 104
		
		extra_tech_building_start = 2.2
	}
	ca_spearbarracks_3 = {
		desc = ca_spearbarracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 1 }
		prerequisites = { ca_wall_2 }
		upgrades_from = ca_spearbarracks_2
		gold_cost = 100
		build_time = 730
		pikemen = 20
		ai_creation_factor = 103

		extra_tech_building_start = 3.0
	}
	ca_spearbarracks_4 = {
		desc = ca_spearbarracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 3 }
		upgrades_from = ca_spearbarracks_3
		gold_cost = 150
		build_time = 1095
		pikemen = 25
		ai_creation_factor = 102

		extra_tech_building_start = 3.0
	}
	ca_spearbarracks_5 = {
		desc = ca_spearbarracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 5 }
		upgrades_from = ca_spearbarracks_4
		gold_cost = 250
		build_time = 2190
		pikemen = 25
		ai_creation_factor = 101

		extra_tech_building_start = 2.0
	}
	ca_spearbarracks_6 = {
		desc = ca_spearbarracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 7 }
		upgrades_from = ca_spearbarracks_5
		gold_cost = 250
		build_time = 2190
		pikemen = 30
		ai_creation_factor = 100

		extra_tech_building_start = 0.2
	}
	
	#Stable, gives light cavalry and some heavy cavalry
	ca_stable_1 = {
		desc = ca_stable_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		gold_cost = 100
		build_time = 365
		light_cavalry = 35
		ai_creation_factor = 89
		
		extra_tech_building_start = 0.8
	}
	ca_stable_2 = {
		desc = ca_stable_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		prerequisites = { ca_wall_1 }
		upgrades_from = ca_stable_1
		gold_cost = 120
		build_time = 547
		light_cavalry = 45
		ai_creation_factor = 88

		extra_tech_building_start = 2.2
	}
	ca_stable_3 = {
		desc = ca_stable_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 2 }
		prerequisites = { ca_wall_2 }
		upgrades_from = ca_stable_2
		gold_cost = 200
		build_time = 730
		light_cavalry = 55
		ai_creation_factor = 87

		extra_tech_building_start = 1.6
	}
	ca_stable_4 = {
		desc = ca_stable_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 4 }
		upgrades_from = ca_stable_3
		gold_cost = 150
		build_time = 1095
		light_cavalry = 55
		ai_creation_factor = 86

		extra_tech_building_start = 1.2
	}
	ca_stable_5 = {
		desc = ca_stable_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 6 }
		upgrades_from = ca_stable_4
		gold_cost = 200
		build_time = 2190
		light_cavalry = 55
		ai_creation_factor = 85

		extra_tech_building_start = 0.8
	}
	ca_stable_6 = {
		desc = ca_stable_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 8 }
		upgrades_from = ca_stable_5
		gold_cost = 250
		build_time = 2190
		light_cavalry = 55
		ai_creation_factor = 85

		extra_tech_building_start = 0.2
	}
	ca_grandstable_1 = {
		desc = ca_grandstable_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 4 }
		gold_cost = 150
		build_time = 1095
		knights = 5
		ai_creation_factor = 86

		extra_tech_building_start = 1.2
	}
	ca_grandstable_2 = {
		desc = ca_grandstable_2_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 6 }
		upgrades_from = ca_grandstable_1
		gold_cost = 200
		build_time = 2190
		knights = 10
		ai_creation_factor = 85

		extra_tech_building_start = 0.8
	}
	ca_grandstable_3 = {
		desc = ca_grandstable_3_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 8 }
		upgrades_from = ca_grandstable_2
		gold_cost = 250
		build_time = 2190
		knights = 20
		ai_creation_factor = 85

		extra_tech_building_start = 0.2
	}
	
	#Castle town, gives income
	ca_town_1 = {
		desc = ca_town_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		gold_cost = 100
		build_time = 365
		tax_income = 2
		ai_creation_factor = 100
		
		court_size_modifier = 1
		extra_tech_building_start = 0.5
	}
	ca_town_2 = {
		desc = ca_town_2_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		prerequisites = { ca_wall_1 }
		upgrades_from = ca_town_1
		gold_cost = 120
		build_time = 547
		tax_income = 2
		ai_creation_factor = 99

		court_size_modifier = 1
		extra_tech_building_start = 1.0
	}
	ca_town_3 = {
		desc = ca_town_3_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 2 }
		prerequisites = { ca_wall_2 }
		upgrades_from = ca_town_2
		gold_cost = 200
		build_time = 730
		tax_income = 2
		ai_creation_factor = 98

		court_size_modifier = 1
		extra_tech_building_start = 1.2
	}
	ca_town_4 = {
		desc = ca_town_4_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 4 }
		upgrades_from = ca_town_3
		gold_cost = 300
		build_time = 1095
		tax_income = 2
		ai_creation_factor = 97

		court_size_modifier = 1
		extra_tech_building_start = 1.2
	}
	ca_town_5 = {
		desc = ca_town_4_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 6 }
		upgrades_from = ca_town_4
		gold_cost = 400
		build_time = 2190
		tax_income = 2
		ai_creation_factor = 96

		court_size_modifier = 1
		extra_tech_building_start = 1.0
	}
	ca_town_6 = {
		desc = ca_town_5_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 8 }
		upgrades_from = ca_town_5
		gold_cost = 500
		build_time = 2190
		tax_income = 2
		ai_creation_factor = 96

		court_size_modifier = 1
		extra_tech_building_start = 0.2
	}

	ca_lmill_1 = {
		desc = ca_lmill_1_desc
		potential = {
				terrain = forest
				
			}
		trigger = { TECH_CONSTRUCTION = 3 }
		gold_cost = 50
		build_time = 182
		tax_income = 0.2
		ai_creation_factor = 80
		
		extra_tech_building_start = 1.0
	}
	ca_lmill_2 = {
		desc = ca_lmill_1_desc
		potential = {
				terrain = forest
			}
		trigger = { TECH_CONSTRUCTION = 4 }
		upgrades_from = ca_lmill_1
		prerequisites = { ca_wall_1 }
		gold_cost = 50
		build_time = 182
		tax_income = 0.2
		ai_creation_factor = 79

		extra_tech_building_start = 0.6
	}
	ca_lmill_3 = {
		desc = ca_lmill_1_desc
		potential = {
				terrain = forest
			}
		trigger = { TECH_CONSTRUCTION = 5 }
		upgrades_from = ca_lmill_2
		gold_cost = 50
		build_time = 182
		tax_income = 0.2
		ai_creation_factor = 78
		
		extra_tech_building_start = 0.2
	}
	ca_gmine_1 = {
		desc = ca_gmine_1_desc
		potential = {
				terrain = mountain
				
			}
		trigger = { TECH_CONSTRUCTION = 2 }
		gold_cost = 50
		build_time = 182
		tax_income = 0.2
		ai_creation_factor = 80
		
		extra_tech_building_start = 1.0
	}
	ca_gmine_2 = {
		desc = ca_gmine_1_desc
		potential = {
				terrain = mountain
			}
		trigger = { TECH_CONSTRUCTION = 3 }
		upgrades_from = ca_gmine_1
		prerequisites = { ca_wall_1 }
		gold_cost = 50
		build_time = 182
		tax_income = 0.2
		ai_creation_factor = 79

		extra_tech_building_start = 0.6
	}
	ca_gmine_3 = {
		desc = ca_gmine_1_desc
		potential = {
				terrain = mountain
			}
		trigger = { TECH_CONSTRUCTION = 5 }
		upgrades_from = ca_gmine_2
		gold_cost = 50
		build_time = 182
		tax_income = 0.2
		ai_creation_factor = 78
		
		extra_tech_building_start = 0.2
	}
	ca_university_1 = {
		desc = ca_university_1_desc
		trigger = { TECH_CONSTRUCTION = 2 }
		gold_cost = 600
		build_time = 1095
		
		tech_growth_modifier = 0.3
		military_techpoints = 0.05
		
		ai_creation_factor = 90

		extra_tech_building_start = 6.2
	}
	ca_university_2 = {
		desc = ca_university_1_desc
		trigger = { TECH_CONSTRUCTION = 4 }
		upgrades_from = ca_university_1
		gold_cost = 800
		build_time = 2190
		
		tech_growth_modifier = 0.3
		military_techpoints = 0.05
		
		ai_creation_factor = 89

		extra_tech_building_start = 6.2
	}
	ca_university_3 = {
		desc = ca_university_1_desc
		trigger = { TECH_CONSTRUCTION = 6 }
		upgrades_from = ca_university_2
		gold_cost = 800
		build_time = 2190
		
		tech_growth_modifier = 0.3
		military_techpoints = 0.05
		
		ai_creation_factor = 88

		extra_tech_building_start = 6.2
	}
	
	ca_shipyard_1 = {
		desc = shipyard_desc
		port = yes
		trigger = { TECH_NAVAL = 1 }
		gold_cost = 100
		build_time = 365
		galleys = 6
		ai_creation_factor = 100
		
		extra_tech_building_start = 0.3
	}
	
	ca_shipyard_2 = {
		desc = shipyard_desc
		port = yes
		trigger = { TECH_NAVAL = 2 }
		upgrades_from = ca_shipyard_1
		gold_cost = 100
		build_time = 730
		galleys = 7
		ai_creation_factor = 99
		
		extra_tech_building_start = 0.3
	}
	
	ca_shipyard_3 = {
		desc = shipyard_desc
		port = yes
		trigger = { TECH_NAVAL = 3 }
		upgrades_from = ca_shipyard_2
		gold_cost = 100
		build_time = 1095
		galleys = 8
		ai_creation_factor = 98
		
		extra_tech_building_start = 0.3
	}
	
	ca_shipyard_4 = {
		desc = shipyard_desc
		port = yes
		trigger = { TECH_NAVAL = 4 }
		upgrades_from = ca_shipyard_3
		gold_cost = 100
		build_time = 1460
		galleys = 9
		ai_creation_factor = 97
		
		extra_tech_building_start = 0.3
	}

	#Castellan Bloodline buildings.
	ca_special_fortifications_1 = { #Insulated Sections
		desc = ca_special_fortifications_1_desc
		potential = { 
			OR = {
				FROMFROM = { has_building = ca_special_fortifications_1 } #Show the building only if it has been already built or if the owner has the proper bloodline to build it.
				FROM = {
					any_owned_bloodline = {
						has_bloodline_flag = bloodline_castellan 
					}
				}
				FROM = {
					any_liege = {
						any_owned_bloodline = {
							has_bloodline_flag = bloodline_castellan 
						}	
					}
				}
			}
		}
		trigger = { 
			TECH_FORTIFICATIONS_CONSTRUCTION = 1 
			custom_tooltip = {
				text = tooltip_has_castellan_bloodline
				hidden_tooltip = {
					OR = {
						FROM = {
							any_owned_bloodline = {
								has_bloodline_flag = bloodline_castellan 
							}
						}
						FROM = {
							any_liege = {
								any_owned_bloodline = {
									has_bloodline_flag = bloodline_castellan 
								}	
							}
						}
					}
				}
			}
		}
		is_active_trigger = {
			FROM = {
				NOR = {
					is_tribal = yes
					is_nomadic = yes
				}
			}
		}

		gold_cost = 125
		build_time = 365
		fort_level = 0.5
		land_morale = 0.05
		
		add_number_to_name = no

		ai_creation_factor = 88

		extra_tech_building_start = 1.2
	}
	ca_special_fortifications_2 = { #Killing Fields
		desc = ca_special_fortifications_2_desc
		trigger = { 
			TECH_FORTIFICATIONS_CONSTRUCTION = 3
			custom_tooltip = {
				text = tooltip_has_castellan_bloodline
				hidden_tooltip = {
					OR = {
						FROM = {
							any_owned_bloodline = {
								has_bloodline_flag = bloodline_castellan 
							}
						}
						FROM = {
							any_liege = {
								any_owned_bloodline = {
									has_bloodline_flag = bloodline_castellan 
								}	
							}
						}
					}
				}
			}
		}
		is_active_trigger = {
			FROM = {
				NOR = {
					is_tribal = yes
					is_nomadic = yes
				}
			}
		}
		upgrades_from = ca_special_fortifications_1
		gold_cost = 250
		build_time = 560
		fort_level = 1
		land_morale = 0.05
		garrison_size = 0.05

		add_number_to_name = no
		
		ai_creation_factor = 88

		extra_tech_building_start = 1.2
	}
	ca_special_fortifications_3 = { #Extended Machicolations
		desc = ca_special_fortifications_3_desc
		trigger = { 
			TECH_FORTIFICATIONS_CONSTRUCTION = 5
			custom_tooltip = {
				text = tooltip_has_castellan_bloodline
				hidden_tooltip = {
					OR = {
						FROM = {
							any_owned_bloodline = {
								has_bloodline_flag = bloodline_castellan 
							}
						}
						FROM = {
							any_liege = {
								any_owned_bloodline = {
									has_bloodline_flag = bloodline_castellan 
								}	
							}
						}
					}
				}
			}
		}
		is_active_trigger = {
			FROM = {
				NOR = {
					is_tribal = yes
					is_nomadic = yes
				}
			}
		}
		upgrades_from = ca_special_fortifications_2
		gold_cost = 450
		build_time = 760
		fort_level = 1.5
		garrison_size = 0.15
		archers = 50

		add_number_to_name = no
		
		ai_creation_factor = 88

		extra_tech_building_start = 1.2
	}
	ca_special_fortifications_4 = { #Reinforced Barbican
		desc = ca_special_fortifications_4_desc
		trigger = { 
			TECH_FORTIFICATIONS_CONSTRUCTION = 7
			custom_tooltip = {
				text = tooltip_has_castellan_bloodline
				hidden_tooltip = {
					OR = {
						FROM = {
							any_owned_bloodline = {
								has_bloodline_flag = bloodline_castellan 
							}
						}
						FROM = {
							any_liege = {
								any_owned_bloodline = {
									has_bloodline_flag = bloodline_castellan 
								}	
							}
						}
					}
				}
			}
		}
		is_active_trigger = {
			FROM = {
				NOR = {
					is_tribal = yes
					is_nomadic = yes
				}
			}
		}
		upgrades_from = ca_special_fortifications_3
		gold_cost = 750
		build_time = 1250
		fort_level = 2
		levy_size = 0.2
		garrison_size = 0.3
		light_infantry = 100

		add_number_to_name = no
		
		ai_creation_factor = 88

		extra_tech_building_start = 1.2
	}

	#Murder Builder Bloodline buildings.
	ca_oppressive_fortifications_1 = { #Gloomy Monument
		desc = ca_oppressive_fortifications_1_desc
		potential = { 
			OR = {
				FROMFROM = { has_building = ca_oppressive_fortifications_1 } #Show the building only if it has been already built or if the owner has the proper bloodline to build it.
				FROM = {
					any_owned_bloodline = {
						has_bloodline_flag = bloodline_blood_building 
					}
				}
				FROM = {
					any_liege = {
						any_owned_bloodline = {
							has_bloodline_flag = bloodline_blood_building 
						}	
					}
				}
			}
		}
		trigger = { 
			TECH_CASTLE_CONSTRUCTION = 2 
			custom_tooltip = {
				text = tooltip_has_murder_builder_bloodline
				hidden_tooltip = {
					OR = {
						FROM = {
							any_owned_bloodline = {
								has_bloodline_flag = bloodline_blood_building 
							}
						}
						FROM = {
							any_liege = {
								any_owned_bloodline = {
									has_bloodline_flag = bloodline_blood_building 
								}	
							}
						}
					}
				}
			}
		}
		is_active_trigger = {
			FROM = {
				NOR = {
					is_tribal = yes
					is_nomadic = yes
				}
			}
		}

		gold_cost = 125
		build_time = 365
		fort_level = 0.5
		garrison_size = 0.025
		
		add_number_to_name = no

		ai_creation_factor = 88

		extra_tech_building_start = 1.2
	}
	ca_oppressive_fortifications_2 = { #Connected Watchtowers
		desc = ca_oppressive_fortifications_2_desc
		trigger = { 
			TECH_CASTLE_CONSTRUCTION = 4
			custom_tooltip = {
				text = tooltip_has_murder_builder_bloodline
				hidden_tooltip = {
					OR = {
						FROM = {
							any_owned_bloodline = {
								has_bloodline_flag = bloodline_blood_building 
							}
						}
						FROM = {
							any_liege = {
								any_owned_bloodline = {
									has_bloodline_flag = bloodline_blood_building 
								}	
							}
						}
					}
				}
			}
		}
		is_active_trigger = {
			FROM = {
				NOR = {
					is_tribal = yes
					is_nomadic = yes
				}
			}
		}
		upgrades_from = ca_oppressive_fortifications_1
		gold_cost = 250
		build_time = 560
		fort_level = 1
		fort_level = 0.5
		garrison_size = 0.025

		add_number_to_name = no
		
		ai_creation_factor = 88

		extra_tech_building_start = 1.2
	}
	ca_oppressive_fortifications_3 = { #Lonely Spire
		desc = ca_oppressive_fortifications_3_desc
		trigger = { 
			TECH_CASTLE_CONSTRUCTION = 6
			custom_tooltip = {
				text = tooltip_has_murder_builder_bloodline
				hidden_tooltip = {
					OR = {
						FROM = {
							any_owned_bloodline = {
								has_bloodline_flag = bloodline_blood_building 
							}
						}
						FROM = {
							any_liege = {
								any_owned_bloodline = {
									has_bloodline_flag = bloodline_blood_building 
								}	
							}
						}
					}
				}
			}
		}
		is_active_trigger = {
			FROM = {
				NOR = {
					is_tribal = yes
					is_nomadic = yes
				}
			}
		}
		upgrades_from = ca_oppressive_fortifications_2
		gold_cost = 300
		build_time = 560
		fort_level = 1
		fort_level = 0.5
		garrison_size = 0.025

		add_number_to_name = no
		
		ai_creation_factor = 88

		extra_tech_building_start = 1.2
	}
	ca_oppressive_fortifications_4 = { #Palace of Justice
		desc = ca_oppressive_fortifications_4_desc
		trigger = { 
			TECH_CASTLE_CONSTRUCTION = 8
			custom_tooltip = {
				text = tooltip_has_murder_builder_bloodline
				hidden_tooltip = {
					OR = {
						FROM = {
							any_owned_bloodline = {
								has_bloodline_flag = bloodline_blood_building 
							}
						}
						FROM = {
							any_liege = {
								any_owned_bloodline = {
									has_bloodline_flag = bloodline_blood_building 
								}	
							}
						}
					}
				}
			}
		}
		is_active_trigger = {
			FROM = {
				NOR = {
					is_tribal = yes
					is_nomadic = yes
				}
			}
		}
		upgrades_from = ca_oppressive_fortifications_3
		gold_cost = 450
		build_time = 760
		fort_level = 1
		fort_level = 0.5
		garrison_size = 0.025

		add_number_to_name = no
		
		ai_creation_factor = 88

		extra_tech_building_start = 1.2
	}
	ca_honorg_1 = {
		desc = ca_honorg_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_honorg_1
				}
			}
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		prestige_cost = 500
		build_time = 100
		retinuesize = 100
		ai_creation_factor = 89

		extra_tech_building_start = 8.2
	}
	ca_honorg_2 = {
		desc = ca_honorg_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_honorg_2
				}
			}
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_honorg_1
		prestige_cost = 1000
		build_time = 100
		retinuesize = 100
		ai_creation_factor = 88
		
		extra_tech_building_start = 8.0
	}
	ca_honorg_3 = {
		desc = ca_honorg_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_honorg_3
				}
			}
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_honorg_2
		prestige_cost = 1500
		build_time = 100
		retinuesize = 100
		ai_creation_factor = 88
		
		extra_tech_building_start = 8.2
	}
	ca_honorg_4 = {
		desc = ca_honorg_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_honorg_4
				}
			}
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_honorg_3
		prestige_cost = 2000
		build_time = 100
		retinuesize = 100
		ai_creation_factor = 89

		extra_tech_building_start = 8.2
	}
	ca_honorg_5 = {
		desc = ca_honorg_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_honorg_5
				}
			}
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_honorg_4
		prestige_cost = 2500
		build_time = 100
		retinuesize = 100
		ai_creation_factor = 88
		
		extra_tech_building_start = 8.0
	}
	ca_honorg_6 = {
		desc = ca_honorg_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_honorg_6
				}
			}
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_honorg_5
		prestige_cost = 3000
		build_time = 100
		retinuesize = 100
		ai_creation_factor = 88
		
		extra_tech_building_start = 8.2
	}
	ca_honorg_7 = {
		desc = ca_honorg_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_honorg_7
				}
			}
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_honorg_6
		prestige_cost = 3500
		build_time = 100
		retinuesize = 100
		ai_creation_factor = 88
		
		extra_tech_building_start = 8.2
	}
	ca_honorg_8 = {
		desc = ca_honorg_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_honorg_8
				}
			}
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_honorg_7
		prestige_cost = 4000
		build_time = 100
		retinuesize = 100
		ai_creation_factor = 89

		extra_tech_building_start = 8.2
	}
	ca_honorg_9 = {
		desc = ca_honorg_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_honorg_9
				}
			}
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_honorg_8
		prestige_cost = 4500
		build_time = 100
		retinuesize = 100
		ai_creation_factor = 88
		
		extra_tech_building_start = 8.0
	}
	ca_honorg_10 = {
		desc = ca_honorg_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_honorg_10
				}
			}
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_honorg_9
		prestige_cost = 5000
		build_time = 100
		retinuesize = 100
		ai_creation_factor = 88
		
		extra_tech_building_start = 8.2
	}
	ca_pchurch_1 = {
		desc = ca_pchurch_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_pchurch_1
				}
			}	
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		piety_cost = 500
		build_time = 100
		liege_piety = 0.2
		ai_creation_factor = 89

		extra_tech_building_start = 8.2
	}
	ca_pchurch_2 = {
		desc = ca_pchurch_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_pchurch_2
				}
			}	
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_pchurch_1
		piety_cost = 1000
		build_time = 100
		liege_piety = 0.2
		ai_creation_factor = 88
		
		extra_tech_building_start = 8.0
	}
	ca_pchurch_3 = {
		desc = ca_pchurch_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_pchurch_3
				}
			}	
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_pchurch_2
		piety_cost = 1500
		build_time = 100
		liege_piety = 0.2
		ai_creation_factor = 88
		
		extra_tech_building_start = 8.2
	}
	ca_pchurch_4 = {
		desc = ca_pchurch_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_pchurch_4
				}
			}	
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_pchurch_3
		piety_cost = 2000
		build_time = 100
		liege_piety = 0.2
		ai_creation_factor = 89

		extra_tech_building_start = 8.2
	}
	ca_pchurch_5 = {
		desc = ca_pchurch_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_pchurch_5
				}
			}	
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_pchurch_4
		piety_cost = 2500
		build_time = 100
		liege_piety = 0.2
		ai_creation_factor = 88
		
		extra_tech_building_start = 8.0
	}
	ca_pchurch_6 = {
		desc = ca_pchurch_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_pchurch_6
				}
			}	
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_pchurch_5
		piety_cost = 3000
		build_time = 100
		liege_piety = 0.2
		ai_creation_factor = 88
		
		extra_tech_building_start = 8.2
	}
	ca_pchurch_7 = {
		desc = ca_pchurch_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_pchurch_7
				}
			}	
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_pchurch_6
		piety_cost = 3500
		build_time = 100
		liege_piety = 0.2
		ai_creation_factor = 88
		
		extra_tech_building_start = 8.2
	}
	ca_pchurch_8 = {
		desc = ca_pchurch_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_pchurch_8
				}
			}	
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_pchurch_7
		piety_cost = 4000
		build_time = 100
		liege_piety = 0.2
		ai_creation_factor = 89

		extra_tech_building_start = 8.2
	}
	ca_pchurch_9 = {
		desc = ca_pchurch_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_pchurch_9
				}
			}	
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_pchurch_8
		piety_cost = 4500
		build_time = 100
		liege_piety = 0.2
		ai_creation_factor = 88
		
		extra_tech_building_start = 8.0
	}
	ca_pchurch_10 = {
		desc = ca_pchurch_1_desc
		potential = {
			OR = {
				FROM = {

					capital_holding = {
						title = FROMFROM
					}
				}
				FROMFROM = {
					has_building = ca_pchurch_10
				}
			}	
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		upgrades_from = ca_pchurch_9
		piety_cost = 5000
		build_time = 100
		liege_piety = 0.2
		ai_creation_factor = 88
		
		extra_tech_building_start = 8.2
	}
		ca_great_pillar_architect = {
		desc = ca_great_pillar_architect_desc
		potential = {
			OR = {
				FROM = {
					trait = architect
				}
				FROMFROM = {
					has_building = ca_great_pillar_architect
				}
			}
		}
		trigger = { 
			TECH_CASTLE_CONSTRUCTION = 0 
			ROOT = {
				OR = {
					FROM = { 
					trait = architect
						}
				has_building = ca_great_pillar_architect
				}
			}
		}
		gold_cost = 300
		build_time = 365

		liege_piety = 0.1
		land_morale = 0.1
		
		ai_creation_factor = 92
		extra_tech_building_start = 8
		add_number_to_name = no
	}
	ca_genschool = {
		desc = ca_genschool_desc
		potential = {
			OR = {
				FROM = {
					AND = {
					trait = genius
					trait = scholar
				}
			}
				FROMFROM = {
					has_building = ca_genschool
				}
			}
		}
		trigger = { 
			TECH_CASTLE_CONSTRUCTION = 0 
			ROOT = {
				OR = {
					FROM = { 
					trait = genius
					trait = scholar
						}
				has_building = ca_genschool
				}
			}
		}
		gold_cost = 300
		build_time = 365

		liege_piety = 0.1
		tech_growth_modifier = 0.1
		culture_techpoints = 0.02
		
		ai_creation_factor = 92
		extra_tech_building_start = 8
		add_number_to_name = no
	}
	ca_pscholar = {
		desc = ca_pscholar_desc
		potential = {
			OR = {
				FROM = {
					trait = scholar
				}
				FROMFROM = {
					has_building = ca_pscholar
				}
			}
		}
		trigger = { 
			TECH_CASTLE_CONSTRUCTION = 0 
			ROOT = {
				OR = {
					FROM = { 
					trait = scholar
						}
				has_building = ca_pscholar
				}
			}
		}
		gold_cost = 300
		build_time = 365

		culture_techpoints = 0.02
		
		ai_creation_factor = 92
		extra_tech_building_start = 8
		add_number_to_name = no
	}
	ca_trophroom = {
		desc = ca_trophroom_desc
		potential = {
			OR = {
				FROM = {
					trait = hunter
				}
				FROMFROM = {
					has_building = ca_trophroom
				}
			}
		}
		trigger = { 
			TECH_CASTLE_CONSTRUCTION = 0 
			ROOT = {
				OR = {
					FROM = { 
					trait = hunter
						}
				has_building = ca_trophroom
				}
			}
		}
		gold_cost = 75
		build_time = 365

		liege_prestige = 0.2
		
		ai_creation_factor = 92
		extra_tech_building_start = 8
		add_number_to_name = no
	}
	ca_drunktavern = {
		desc = ca_drunktavern_desc
		potential = {
			OR = {
				FROM = {
					trait = drunkard
				}
				FROMFROM = {
					has_building = ca_drunktavern
				}
			}
		}
		trigger = { 
			TECH_CASTLE_CONSTRUCTION = 0 
			ROOT = {
				OR = {
					FROM = { 
					trait = drunkard
						}
				has_building = ca_drunktavern
				}
			}
		}
		gold_cost = 75
		build_time = 365

		tax_income = 0.2
		
		ai_creation_factor = 92
		extra_tech_building_start = 8
		add_number_to_name = no
	}
	ca_garena = {
		desc = ca_garena_desc
		potential = {
			OR = {
				FROM = {
					trait = gladiator
				}
				FROMFROM = {
					has_building = ca_garena
				}
			}
		}
		trigger = { 
			TECH_CASTLE_CONSTRUCTION = 0 
			ROOT = {
				OR = {
					FROM = { 
					trait = gladiator
						}
				has_building = ca_garena
				}
			}
		}
		gold_cost = 75
		build_time = 365

		levy_reinforce_rate = 0.05
		
		ai_creation_factor = 92
		extra_tech_building_start = 8
		add_number_to_name = no
	}
	ca_duelhall = {
		desc = ca_duelhall_desc
		potential = {
			OR = {
				FROM = {
					trait = duelist
				}
				FROMFROM = {
					has_building = ca_duelhall
				}
			}
		}
		trigger = { 
			TECH_CASTLE_CONSTRUCTION = 0 
			ROOT = {
				OR = {
					FROM = { 
					trait = duelist
						}
				has_building = ca_duelhall
				}
			}
		}
		gold_cost = 75
		build_time = 365

		liege_prestige = 0.2
		
		ai_creation_factor = 92
		extra_tech_building_start = 8
		add_number_to_name = no
	}
	ca_poetlib = {
		desc = ca_poetlib_desc
		potential = {
			OR = {
				FROM = {
					trait = poet
				}
				FROMFROM = {
					has_building = ca_poetlib
				}
			}
		}
		trigger = { 
			TECH_CASTLE_CONSTRUCTION = 0 
			ROOT = {
				OR = {
					FROM = { 
					trait = poet
						}
				has_building = ca_poetlib
				}
			}
		}
		gold_cost = 75
		build_time = 365

		liege_prestige = 0.2
		
		ai_creation_factor = 92
		extra_tech_building_start = 8
		add_number_to_name = no
	}
	ca_jesstat = {
		desc = ca_jesstat_desc
		potential = {
			OR = {
				FROM = {
					religion = catholic
					trait = crusader
					trait = zealous
				}
				FROMFROM = {
					has_building = ca_jesstat
				}
			}
		}
		trigger = { 
			TECH_CASTLE_CONSTRUCTION = 0 
			ROOT = {
				OR = {
					FROM = { 
					trait = crusader
					trait = zealous
						}
				has_building = ca_jesstat
				}
			}
		}
		gold_cost = 75
		build_time = 365

		liege_piety = 0.2
		
		ai_creation_factor = 92
		extra_tech_building_start = 8
		add_number_to_name = no
	}
		ca_moneyvault = {
		desc = ca_moneyvault_desc
		potential = {
			OR = {
				FROM = {
					trait = greedy
					trait = genius
				}
				FROMFROM = {
					has_building = ca_moneyvault
				}
			}
		}
		trigger = { 
			TECH_CASTLE_CONSTRUCTION = 0 
			ROOT = {
				OR = {
					FROM = { 
					trait = greedy
					trait = genius
						}
				has_building = ca_moneyvault
				}
			}
		}
		gold_cost = 25
		build_time = 365

		tax_income = 0.2
		
		ai_creation_factor = 92
		extra_tech_building_start = 8
		add_number_to_name = no
	}
	ca_pergard = {
		desc = ca_pergard_desc
		potential = {
			OR = {
				FROM = {
					trait = gardener
				}
				FROMFROM = {
					has_building = ca_pergard
				}
			}
		}
		trigger = { 
			TECH_CASTLE_CONSTRUCTION = 0 
			ROOT = {
				OR = {
					FROM = { 
					trait = gardener
						}
				has_building = ca_pergard
				}
			}
		}
		gold_cost = 75
		build_time = 365

		liege_prestige = 0.2
		
		ai_creation_factor = 92
		extra_tech_building_start = 8
		add_number_to_name = no
	}
}
