castle = {
	# Study
	ca_study_1 = {
		prerequisites = { ca_keep_1 }
		gold_cost = 100
		build_time = 730
		tech_growth_modifier = 0.05
		military_techpoints = 0.05
		ai_creation_factor = 92
		extra_tech_building_start = 0.2

		potential = {
			OR = {
				FROMFROM = { has_building = ca_study_1 }

				AND = {
					FROMFROM = { has_building = ca_keep_1 }
					TECH_CASTLE_CONSTRUCTION >= 3
				}
			}
		}

		trigger = {
			TECH_CASTLE_CONSTRUCTION >= 3
			ai_can_build_trigger = yes
		}
	}

	ca_study_2 = {
		prerequisites = { ca_keep_2 }
		upgrades_from = ca_study_1
		gold_cost = 200
		build_time = 1095
		tech_growth_modifier = 0.1
		military_techpoints = 0.05
		ai_creation_factor = 92
		extra_tech_building_start = 0.2

		trigger = {
			TECH_CASTLE_CONSTRUCTION >= 6
			ai_can_build_trigger = yes
		}
	}

	# Imperial Decadence
	ca_imperial_dec_1 = {
		desc = ca_imperial_dec_desc
		gold_cost = 0
		build_time = 0
		levy_size = -0.07
		ai_creation_factor = 0

		potential = {
			FROM = { has_character_modifier = imperial_decadence_1 }
		}

		trigger = {
			always = no
		}
	}

	ca_imperial_dec_2 = {
		desc = ca_imperial_dec_desc
		gold_cost = 0
		build_time = 0
		levy_size = -0.14
		ai_creation_factor = 0

		potential = {
			FROM = { has_character_modifier = imperial_decadence_2 }
		}

		trigger = {
			always = no
		}
	}

	ca_imperial_dec_3 = {
		desc = ca_imperial_dec_desc
		gold_cost = 0
		build_time = 0
		levy_size = -0.21
		ai_creation_factor = 0

		potential = {
			FROM = { has_character_modifier = imperial_decadence_3 }
		}

		trigger = {
			always = no
		}
	}

	ca_imperial_dec_4 = {
		desc = ca_imperial_dec_desc
		gold_cost = 0
		build_time = 0
		levy_size = -0.28
		ai_creation_factor = 0

		potential = {
			FROM = { has_character_modifier = imperial_decadence_4 }
		}

		trigger = {
			always = no
		}
	}

	ca_imperial_dec_5 = {
		desc = ca_imperial_dec_desc
		potential = {
			FROM = { has_character_modifier = imperial_decadence_5 }
		}
		trigger = {
			always = no
		}
		gold_cost = 0
		build_time = 0
		levy_size = -0.35
		ai_creation_factor = 0
	}

	ca_imperial_dec_6 = {
		desc = ca_imperial_dec_desc
		gold_cost = 0
		build_time = 0
		levy_size = -0.42
		ai_creation_factor = 0

		potential = {
			FROM = { has_character_modifier = imperial_decadence_6 }
		}

		trigger = {
			always = no
		}
	}

	ca_imperial_dec_7 = {
		desc = ca_imperial_dec_desc
		gold_cost = 0
		build_time = 0
		levy_size = -0.49
		ai_creation_factor = 0

		potential = {
			FROM = { has_character_modifier = imperial_decadence_7 }
		}

		trigger = {
			always = no
		}
	}

	ca_imperial_dec_8 = {
		desc = ca_imperial_dec_desc
		gold_cost = 0
		build_time = 0
		levy_size = -0.56
		ai_creation_factor = 0

		potential = {
			FROM = { has_character_modifier = imperial_decadence_8 }
		}

		trigger = {
			always = no
		}
	}

	# Extra troops for holy orders
	ca_order_house = {
		gold_cost = 50
		build_time = 360
		knights = 100
		heavy_infantry = 250
		archers = 150
		ai_creation_factor = 10000
		extra_tech_building_start = 0

		potential = {
			OR = {
				FROMFROM = { has_building = ca_order_house }

				AND = {
					FROM = { government = order_government }
					FROMFROM = { has_building = ca_keep_1 }
				}
			}
		}

		trigger = {
			TECH_CASTLE_CONSTRUCTION >= 0
			ai_can_build_trigger = yes
		}
	}


	ca_estate_1 = {
		desc = ca_estate_1_desc
		gold_cost = 50
		build_time = 365
		monthly_character_wealth = 0.3
		monthly_character_prestige = 0.01
		ai_creation_factor = 95
		extra_tech_building_start = 1

		add_number_to_name = no

		trigger = {
			TECH_CASTLE_CONSTRUCTION >= 2
			ai_can_build_trigger = yes
		}
	}

	ca_estate_2 = {
		desc = ca_estate_2_desc
		upgrades_from = ca_estate_1
		gold_cost = 60
		build_time = 547
		monthly_character_wealth = 0.3
		monthly_character_prestige = 0.015
		ai_creation_factor = 95
		extra_tech_building_start = 1

		add_number_to_name = no

		trigger = {
			TECH_CASTLE_CONSTRUCTION >= 3
			ai_can_build_trigger = yes
		}
	}

	ca_estate_3 = {
		desc = ca_estate_3_desc
		upgrades_from = ca_estate_2
		gold_cost = 75
		build_time = 620
		monthly_character_wealth = 0.3
		monthly_character_prestige = 0.02
		ai_creation_factor = 95
		extra_tech_building_start = 1

		add_number_to_name = no

		trigger = {
			TECH_CASTLE_CONSTRUCTION >= 4
			ai_can_build_trigger = yes
		}
	}

	ca_estate_4 = {
		desc = ca_estate_4_desc
		upgrades_from = ca_estate_3
		gold_cost = 90
		build_time = 620
		monthly_character_wealth = 0.3
		monthly_character_prestige = 0.025
		ai_creation_factor = 95
		extra_tech_building_start = 1

		add_number_to_name = no

		trigger = {
			TECH_CASTLE_CONSTRUCTION >= 6
			ai_can_build_trigger = yes
		}
	}

	ca_estate_5 = {
		desc = ca_estate_5_desc
		upgrades_from = ca_estate_4
		gold_cost = 120
		build_time = 620
		monthly_character_wealth = 0.3
		monthly_character_prestige = 0.03
		ai_creation_factor = 95
		extra_tech_building_start = 1

		add_number_to_name = no

		trigger = {
			TECH_CASTLE_CONSTRUCTION >= 8
			ai_can_build_trigger = yes
		}
	}
}

# City
city = {
	# Jewish Community
	ct_jewish_community_1 = {
		gold_cost = 0
		build_time = 0
		tax_income = 2
		ai_creation_factor = 1
		extra_tech_building_start = 10.0

		potential = {
			FROMFROM = { has_building = ct_jewish_community_1 } # Built by event. Don't want to see it before.

			# OR = {
			#	FROMFROM = { has_building = ct_jewish_community_1 }
			#	NOR = {
			#		FROM = { religion_group = jewish_group }
			#		NOT = { religion_group = jewish_group }
			#	}
			# }
		}

		trigger = {
			always = no
		}
	}

	ct_jewish_community_2 = {
		upgrades_from = ct_jewish_community_1
		gold_cost = 0
		build_time = 0
		tax_income = 2
		ai_creation_factor = 1
		extra_tech_building_start = 10.0

		potential = {
			OR = {
				FROMFROM = { has_building = ct_jewish_community_2 }

				NOR = {
					FROM = { religion_group = jewish_group }
					NOT = { religion_group = jewish_group }
				}
			}
		}

		trigger = {
			always = no
		}
	}

	ct_jewish_community_3 = {
		upgrades_from = ct_jewish_community_2
		gold_cost = 0
		build_time = 0
		tax_income = 2
		ai_creation_factor = 1
		extra_tech_building_start = 10.0

		potential = {
			OR = {
				FROMFROM = { has_building = ct_jewish_community_3 }

				NOR = {
					FROM = { religion_group = jewish_group }
					NOT = { religion_group = jewish_group }
				}
			}
		}

		trigger = {
			always = no
		}
	}
}