settlement_decisions = {

	cfh_districts_building_move_capital_decision = {
		
		only_playable = yes
		is_high_prio = yes
		
		filter = owned
		ai_target_filter = owned
		ai_check_interval = 12

		from_potential = {
			clan = no
		}

		potential = {
			NOT = { 
				has_game_rule = {
					name = cfh_rule_districts
					value = off
				}
			}
			NOT = { has_holding_modifier = cfh_districts_building_capital_modifier }
			NOT = {	location = { is_variable_equal = { which = cfh_districts_num_dist_types_var value = 0 } } }
			OR = {
				holding_type = castle
				holding_type = city
				holding_type = temple
				holding_type = tribal
			}
			is_capital = yes
		}

		allow = {
			always = yes
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.9
				always = yes
			}
		}

		effect = {
			add_holding_modifier = { 
				modifier = cfh_districts_building_capital_modifier
				duration = -1
			}
			if = {
				limit = { holding_type = castle }
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_military_0_flag } }
					add_building = cfh_districts_ca_building_military_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_military_1_flag } }
					add_building = cfh_districts_ca_building_military_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_military_2_flag } }
					add_building = cfh_districts_ca_building_military_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_industry_0_flag } }
					add_building = cfh_districts_ca_building_industry_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_industry_1_flag } }
					add_building = cfh_districts_ca_building_industry_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_industry_2_flag } }
					add_building = cfh_districts_ca_building_industry_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_religion_0_flag } }
					add_building = cfh_districts_ca_building_religion_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_religion_1_flag } }
					add_building = cfh_districts_ca_building_religion_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_religion_2_flag } }
					add_building = cfh_districts_ca_building_religion_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_trade_0_flag } }
					add_building = cfh_districts_ca_building_trade_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_trade_1_flag } }
					add_building = cfh_districts_ca_building_trade_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_trade_2_flag } }
					add_building = cfh_districts_ca_building_trade_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_monument_0_flag } }
					add_building = cfh_districts_ca_building_monument_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_monument_1_flag } }
					add_building = cfh_districts_ca_building_monument_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_monument_2_flag } }
					add_building = cfh_districts_ca_building_monument_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_poor_0_flag } }
					add_building = cfh_districts_ca_building_citizen_poor_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_poor_1_flag } }
					add_building = cfh_districts_ca_building_citizen_poor_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_poor_2_flag } }
					add_building = cfh_districts_ca_building_citizen_poor_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_rich_0_flag } }
					add_building = cfh_districts_ca_building_citizen_rich_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_rich_1_flag } }
					add_building = cfh_districts_ca_building_citizen_rich_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_rich_2_flag } }
					add_building = cfh_districts_ca_building_citizen_rich_2
				}
			}
			else_if = {
				limit = { holding_type = city }
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_military_0_flag } }
					add_building = cfh_districts_ct_building_military_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_military_1_flag } }
					add_building = cfh_districts_ct_building_military_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_military_2_flag } }
					add_building = cfh_districts_ct_building_military_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_industry_0_flag } }
					add_building = cfh_districts_ct_building_industry_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_industry_1_flag } }
					add_building = cfh_districts_ct_building_industry_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_industry_2_flag } }
					add_building = cfh_districts_ct_building_industry_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_religion_0_flag } }
					add_building = cfh_districts_ct_building_religion_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_religion_1_flag } }
					add_building = cfh_districts_ct_building_religion_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_religion_2_flag } }
					add_building = cfh_districts_ct_building_religion_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_trade_0_flag } }
					add_building = cfh_districts_ct_building_trade_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_trade_1_flag } }
					add_building = cfh_districts_ct_building_trade_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_trade_2_flag } }
					add_building = cfh_districts_ct_building_trade_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_monument_0_flag } }
					add_building = cfh_districts_ct_building_monument_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_monument_1_flag } }
					add_building = cfh_districts_ct_building_monument_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_monument_2_flag } }
					add_building = cfh_districts_ct_building_monument_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_poor_0_flag } }
					add_building = cfh_districts_ct_building_citizen_poor_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_poor_1_flag } }
					add_building = cfh_districts_ct_building_citizen_poor_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_poor_2_flag } }
					add_building = cfh_districts_ct_building_citizen_poor_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_rich_0_flag } }
					add_building = cfh_districts_ct_building_citizen_rich_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_rich_1_flag } }
					add_building = cfh_districts_ct_building_citizen_rich_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_rich_2_flag } }
					add_building = cfh_districts_ct_building_citizen_rich_2
				}
			}
			else_if = {
				limit = { holding_type = temple }
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_military_0_flag } }
					add_building = cfh_districts_tp_building_military_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_military_1_flag } }
					add_building = cfh_districts_tp_building_military_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_military_2_flag } }
					add_building = cfh_districts_tp_building_military_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_industry_0_flag } }
					add_building = cfh_districts_tp_building_industry_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_industry_1_flag } }
					add_building = cfh_districts_tp_building_industry_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_industry_2_flag } }
					add_building = cfh_districts_tp_building_industry_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_religion_0_flag } }
					add_building = cfh_districts_tp_building_religion_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_religion_1_flag } }
					add_building = cfh_districts_tp_building_religion_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_religion_2_flag } }
					add_building = cfh_districts_tp_building_religion_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_trade_0_flag } }
					add_building = cfh_districts_tp_building_trade_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_trade_1_flag } }
					add_building = cfh_districts_tp_building_trade_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_trade_2_flag } }
					add_building = cfh_districts_tp_building_trade_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_monument_0_flag } }
					add_building = cfh_districts_tp_building_monument_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_monument_1_flag } }
					add_building = cfh_districts_tp_building_monument_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_monument_2_flag } }
					add_building = cfh_districts_tp_building_monument_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_poor_0_flag } }
					add_building = cfh_districts_tp_building_citizen_poor_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_poor_1_flag } }
					add_building = cfh_districts_tp_building_citizen_poor_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_poor_2_flag } }
					add_building = cfh_districts_tp_building_citizen_poor_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_rich_0_flag } }
					add_building = cfh_districts_tp_building_citizen_rich_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_rich_1_flag } }
					add_building = cfh_districts_tp_building_citizen_rich_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_rich_2_flag } }
					add_building = cfh_districts_tp_building_citizen_rich_2
				}
			}
			else_if = {
				limit = { holding_type = tribal }
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_military_0_flag } }
					add_building = cfh_districts_tb_building_military_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_military_1_flag } }
					add_building = cfh_districts_tb_building_military_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_military_2_flag } }
					add_building = cfh_districts_tb_building_military_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_industry_0_flag } }
					add_building = cfh_districts_tb_building_industry_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_industry_1_flag } }
					add_building = cfh_districts_tb_building_industry_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_industry_2_flag } }
					add_building = cfh_districts_tb_building_industry_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_religion_0_flag } }
					add_building = cfh_districts_tb_building_religion_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_religion_1_flag } }
					add_building = cfh_districts_tb_building_religion_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_religion_2_flag } }
					add_building = cfh_districts_tb_building_religion_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_trade_0_flag } }
					add_building = cfh_districts_tb_building_trade_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_trade_1_flag } }
					add_building = cfh_districts_tb_building_trade_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_trade_2_flag } }
					add_building = cfh_districts_tb_building_trade_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_monument_0_flag } }
					add_building = cfh_districts_tb_building_monument_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_monument_1_flag } }
					add_building = cfh_districts_tb_building_monument_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_monument_2_flag } }
					add_building = cfh_districts_tb_building_monument_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_poor_0_flag } }
					add_building = cfh_districts_tb_building_citizen_poor_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_poor_1_flag } }
					add_building = cfh_districts_tb_building_citizen_poor_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_poor_2_flag } }
					add_building = cfh_districts_tb_building_citizen_poor_2
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_rich_0_flag } }
					add_building = cfh_districts_tb_building_citizen_rich_0
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_rich_1_flag } }
					add_building = cfh_districts_tb_building_citizen_rich_1
				}
				if = {
					limit = { location = { has_province_flag = cfh_districts_building_citizen_rich_2_flag } }
					add_building = cfh_districts_tb_building_citizen_rich_2
				}
			}
			location = {
				any_province_holding = {
					limit = { 
						has_holding_modifier = cfh_districts_building_capital_modifier
						is_capital = no
					}
					remove_holding_modifier = cfh_districts_building_capital_modifier
					cfh_districts_remove_military_district_buildings_effect = yes
					cfh_districts_remove_industry_district_buildings_effect = yes
					cfh_districts_remove_trade_district_buildings_effect = yes
					cfh_districts_remove_religion_district_buildings_effect = yes
					cfh_districts_remove_monument_district_buildings_effect = yes
					cfh_districts_remove_citizen_poor_district_buildings_effect = yes
					cfh_districts_remove_citizen_rich_district_buildings_effect = yes
					cfh_districts_remove_citizen_noble_district_buildings_effect = yes
				}
			}
		}
	}

	cfh_districts_building_military_decision = {
		
		only_playable = yes
		is_high_prio = yes
		
		filter = owned
		ai_target_filter = owned
		ai_check_interval = 12

		from_potential = {
			clan = no
		}

		potential = {
			NOT = { 
				has_game_rule = {
					name = cfh_rule_districts
					value = off
				}
			}
			OR = {
				has_holding_modifier = cfh_districts_building_capital_modifier
				location = { is_variable_equal = { which = cfh_districts_num_dist_types_var value = 0 } }
			}
			location = {
				has_province_flag = cfh_districts_pop_expand_flag
				NOT = { has_province_flag = cfh_districts_military_2_flag }
				OR = {
					NOT = { check_variable = { which = cfh_districts_num_dist_types_var value = 5 } }
					AND = {
						check_variable = { which = cfh_districts_num_dist_types_var value = 5 }
						OR = {
							has_province_flag = cfh_districts_military_0_flag
							has_province_flag = cfh_districts_military_1_flag
						}
					
					}
				}
			}
			OR = {
				holding_type = castle
				holding_type = city
				holding_type = temple
				holding_type = tribal
			}
			is_capital = yes
		}

		allow = {
			FROM = { prestige >= 500 }
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.1
				always = yes
			}
		}

		effect = {
			FROM = { prestige = -500 }
			ROOT = {
				add_holding_modifier = { modifier = cfh_districts_building_capital_modifier duration = -1 }
				if = {
					limit = { holding_type = castle }
					if = {
						limit = { NOT = { has_building = cfh_districts_ca_building_military_0 } }
						add_building = cfh_districts_ca_building_military_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_military_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_military_1 } }
						add_building = cfh_districts_ca_building_military_1
						location = { set_province_flag = cfh_districts_military_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_military_2 } }
						add_building = cfh_districts_ca_building_military_2
						location = { set_province_flag = cfh_districts_military_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = city }
					if = {
						limit = { NOT = { has_building = cfh_districts_ct_building_military_0 } }
						add_building = cfh_districts_ct_building_military_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_military_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_military_1 } }
						add_building = cfh_districts_ct_building_military_1
						location = { set_province_flag = cfh_districts_military_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_military_2 } }
						add_building = cfh_districts_ct_building_military_2
						location = { set_province_flag = cfh_districts_military_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = temple }
					if = {
						limit = { NOT = { has_building = cfh_districts_tp_building_military_0 } }
						add_building = cfh_districts_tp_building_military_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_military_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_military_1 } }
						add_building = cfh_districts_tp_building_military_1
						location = { set_province_flag = cfh_districts_military_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_military_2 } }
						add_building = cfh_districts_tp_building_military_2
						location = { set_province_flag = cfh_districts_military_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = tribal }
					if = {
						limit = { NOT = { has_building = cfh_districts_tb_building_military_0 } }
						add_building = cfh_districts_tb_building_military_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_military_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_military_1 } }
						add_building = cfh_districts_tb_building_military_1
						location = { set_province_flag = cfh_districts_military_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_military_2 } }
						add_building = cfh_districts_tb_building_military_2
						location = { set_province_flag = cfh_districts_military_2_flag }
					}
				}
				location = { 
					clr_province_flag = cfh_districts_pop_expand_flag
					change_variable = { which = cfh_districts_pop_var value = 1 }
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_building_industry_decision = {
		
		only_playable = yes
		is_high_prio = yes
		
		filter = owned
		ai_target_filter = owned
		ai_check_interval = 12

		from_potential = {
			clan = no
		}

		potential = {
			NOT = { 
				has_game_rule = {
					name = cfh_rule_districts
					value = off
				}
			}
			OR = {
				has_holding_modifier = cfh_districts_building_capital_modifier
				location = { is_variable_equal = { which = cfh_districts_num_dist_types_var value = 0 } }
			}
			location = { 
				has_province_flag = cfh_districts_pop_expand_flag
				NOT = { has_province_flag = cfh_districts_industry_2_flag }
				OR = {
					NOT = { check_variable = { which = cfh_districts_num_dist_types_var value = 5 } }
					AND = {
						check_variable = { which = cfh_districts_num_dist_types_var value = 5 }
						OR = {
							has_province_flag = cfh_districts_industry_0_flag
							has_province_flag = cfh_districts_industry_1_flag
						}
					
					}
				}
			}
			OR = {
				holding_type = castle
				holding_type = city
				holding_type = temple
				holding_type = tribal
			}
			is_capital = yes
		}

		allow = {
			FROM = { prestige >= 500 }
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.1
				always = yes
			}
		}

		effect = {
			FROM = { prestige = -500 }
			ROOT = {
				add_holding_modifier = { modifier = cfh_districts_building_capital_modifier duration = -1 }
				if = {
					limit = { holding_type = castle }
					if = {
						limit = { NOT = { has_building = cfh_districts_ca_building_industry_0 } }
						add_building = cfh_districts_ca_building_industry_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_industry_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_industry_1 } }
						add_building = cfh_districts_ca_building_industry_1
						location = { set_province_flag = cfh_districts_industry_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_industry_2 } }
						add_building = cfh_districts_ca_building_industry_2
						location = { set_province_flag = cfh_districts_industry_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = city }
					if = {
						limit = { NOT = { has_building = cfh_districts_ct_building_industry_0 } }
						add_building = cfh_districts_ct_building_industry_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_industry_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_industry_1 } }
						add_building = cfh_districts_ct_building_industry_1
						location = { set_province_flag = cfh_districts_industry_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_industry_2 } }
						add_building = cfh_districts_ct_building_industry_2
						location = { set_province_flag = cfh_districts_industry_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = temple }
					if = {
						limit = { NOT = { has_building = cfh_districts_tp_building_industry_0 } }
						add_building = cfh_districts_tp_building_industry_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_industry_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_industry_1 } }
						add_building = cfh_districts_tp_building_industry_1
						location = { set_province_flag = cfh_districts_industry_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_industry_2 } }
						add_building = cfh_districts_tp_building_industry_2
						location = { set_province_flag = cfh_districts_industry_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = tribal }
					if = {
						limit = { NOT = { has_building = cfh_districts_tb_building_industry_0 } }
						add_building = cfh_districts_tb_building_industry_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_industry_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_industry_1 } }
						add_building = cfh_districts_tb_building_industry_1
						location = { set_province_flag = cfh_districts_industry_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_industry_2 } }
						add_building = cfh_districts_tb_building_industry_2
						location = { set_province_flag = cfh_districts_industry_2_flag }
					}
				}
				location = { 
					clr_province_flag = cfh_districts_pop_expand_flag
					change_variable = { which = cfh_districts_pop_var value = 1 }
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_building_trade_decision = {
		
		only_playable = yes
		is_high_prio = yes
		
		filter = owned
		ai_target_filter = owned
		ai_check_interval = 12

		from_potential = {
			clan = no
		}

		potential = {
			NOT = { 
				has_game_rule = {
					name = cfh_rule_districts
					value = off
				}
			}
			OR = {
				has_holding_modifier = cfh_districts_building_capital_modifier
				location = { is_variable_equal = { which = cfh_districts_num_dist_types_var value = 0 } }
			}
			location = { 
				has_province_flag = cfh_districts_pop_expand_flag
				NOT = { has_province_flag = cfh_districts_trade_2_flag }
				OR = {
					NOT = { check_variable = { which = cfh_districts_num_dist_types_var value = 5 } }
					AND = {
						check_variable = { which = cfh_districts_num_dist_types_var value = 5 }
						OR = {
							has_province_flag = cfh_districts_trade_0_flag
							has_province_flag = cfh_districts_trade_1_flag
						}
					
					}
				}
			}
			OR = {
				holding_type = castle
				holding_type = city
				holding_type = temple
				holding_type = tribal
			}
			is_capital = yes
		}

		allow = {
			FROM = { prestige >= 500 }
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.1
				always = yes
			}
		}

		effect = {
			FROM = { prestige = -500 }
			ROOT = {
				add_holding_modifier = { modifier = cfh_districts_building_capital_modifier duration = -1 }
				if = {
					limit = { holding_type = castle }
					if = {
						limit = { NOT = { has_building = cfh_districts_ca_building_trade_0 } }
						add_building = cfh_districts_ca_building_trade_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_trade_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_trade_1 } }
						add_building = cfh_districts_ca_building_trade_1
						location = { set_province_flag = cfh_districts_trade_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_trade_2 } }
						add_building = cfh_districts_ca_building_trade_2
						location = { set_province_flag = cfh_districts_trade_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = city }
					if = {
						limit = { NOT = { has_building = cfh_districts_ct_building_trade_0 } }
						add_building = cfh_districts_ct_building_trade_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_trade_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_trade_1 } }
						add_building = cfh_districts_ct_building_trade_1
						location = { set_province_flag = cfh_districts_trade_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_trade_2 } }
						add_building = cfh_districts_ct_building_trade_2
						location = { set_province_flag = cfh_districts_trade_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = temple }
					if = {
						limit = { NOT = { has_building = cfh_districts_tp_building_trade_0 } }
						add_building = cfh_districts_tp_building_trade_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_trade_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_trade_1 } }
						add_building = cfh_districts_tp_building_trade_1
						location = { set_province_flag = cfh_districts_trade_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_trade_2 } }
						add_building = cfh_districts_tp_building_trade_2
						location = { set_province_flag = cfh_districts_trade_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = tribal }
					if = {
						limit = { NOT = { has_building = cfh_districts_tb_building_trade_0 } }
						add_building = cfh_districts_tb_building_trade_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_trade_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_trade_1 } }
						add_building = cfh_districts_tb_building_trade_1
						location = { set_province_flag = cfh_districts_trade_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_trade_2 } }
						add_building = cfh_districts_tb_building_trade_2
						location = { set_province_flag = cfh_districts_trade_2_flag }
					}
				}
				location = { 
					clr_province_flag = cfh_districts_pop_expand_flag
					change_variable = { which = cfh_districts_pop_var value = 1 }
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_building_religion_decision = {
		
		only_playable = yes
		is_high_prio = yes
		
		filter = owned
		ai_target_filter = owned
		ai_check_interval = 12

		from_potential = {
			clan = no
		}

		potential = {
			NOT = { 
				has_game_rule = {
					name = cfh_rule_districts
					value = off
				}
			}
			OR = {
				has_holding_modifier = cfh_districts_building_capital_modifier
				location = { is_variable_equal = { which = cfh_districts_num_dist_types_var value = 0 } }
			}
			location = { 
				has_province_flag = cfh_districts_pop_expand_flag
				NOT = { has_province_flag = cfh_districts_religion_2_flag }
				OR = {
					NOT = { check_variable = { which = cfh_districts_num_dist_types_var value = 5 } }
					AND = {
						check_variable = { which = cfh_districts_num_dist_types_var value = 5 }
						OR = {
							has_province_flag = cfh_districts_religion_0_flag
							has_province_flag = cfh_districts_religion_1_flag
						}
					
					}
				}
			}
			OR = {
				holding_type = castle
				holding_type = city
				holding_type = temple
				holding_type = tribal
			}
			is_capital = yes
		}

		allow = {
			FROM = { prestige >= 500 }
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.1
				always = yes
			}
		}

		effect = {
			FROM = { prestige = -500 }
			ROOT = {
				add_holding_modifier = { modifier = cfh_districts_building_capital_modifier duration = -1 }
				if = {
					limit = { holding_type = castle }
					if = {
						limit = { NOT = { has_building = cfh_districts_ca_building_religion_0 } }
						add_building = cfh_districts_ca_building_religion_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_religion_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_religion_1 } }
						add_building = cfh_districts_ca_building_religion_1
						location = { set_province_flag = cfh_districts_religion_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_religion_2 } }
						add_building = cfh_districts_ca_building_religion_2
						location = { set_province_flag = cfh_districts_religion_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = city }
					if = {
						limit = { NOT = { has_building = cfh_districts_ct_building_religion_0 } }
						add_building = cfh_districts_ct_building_religion_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_religion_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_religion_1 } }
						add_building = cfh_districts_ct_building_religion_1
						location = { set_province_flag = cfh_districts_religion_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_religion_2 } }
						add_building = cfh_districts_ct_building_religion_2
						location = { set_province_flag = cfh_districts_religion_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = temple }
					if = {
						limit = { NOT = { has_building = cfh_districts_tp_building_religion_0 } }
						add_building = cfh_districts_tp_building_religion_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_religion_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_religion_1 } }
						add_building = cfh_districts_tp_building_religion_1
						location = { set_province_flag = cfh_districts_religion_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_religion_2 } }
						add_building = cfh_districts_tp_building_religion_2
						location = { set_province_flag = cfh_districts_religion_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = tribal }
					if = {
						limit = { NOT = { has_building = cfh_districts_tb_building_religion_0 } }
						add_building = cfh_districts_tb_building_religion_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_religion_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_religion_1 } }
						add_building = cfh_districts_tb_building_religion_1
						location = { set_province_flag = cfh_districts_religion_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_religion_2 } }
						add_building = cfh_districts_tb_building_religion_2
						location = { set_province_flag = cfh_districts_religion_2_flag }
					}
				}
				location = { 
					clr_province_flag = cfh_districts_pop_expand_flag
					change_variable = { which = cfh_districts_pop_var value = 1 }
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_building_monument_decision = {
		
		only_playable = yes
		is_high_prio = yes
		
		filter = owned
		ai_target_filter = owned
		ai_check_interval = 12

		from_potential = {
			clan = no
		}

		potential = {
			NOT = { 
				has_game_rule = {
					name = cfh_rule_districts
					value = off
				}
			}
			OR = {
				has_holding_modifier = cfh_districts_building_capital_modifier
				location = { is_variable_equal = { which = cfh_districts_num_dist_types_var value = 0 } }
			}
			location = { 
				has_province_flag = cfh_districts_pop_expand_flag
				NOT = { has_province_flag = cfh_districts_monument_2_flag }
				OR = {
					NOT = { check_variable = { which = cfh_districts_num_dist_types_var value = 5 } }
					AND = {
						check_variable = { which = cfh_districts_num_dist_types_var value = 5 }
						OR = {
							has_province_flag = cfh_districts_monument_0_flag
							has_province_flag = cfh_districts_monument_1_flag
						}
					
					}
				}
			}
			OR = {
				holding_type = castle
				holding_type = city
				holding_type = temple
				holding_type = tribal
			}
			is_capital = yes
		}

		allow = {
			FROM = { prestige >= 500 }
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.1
				always = yes
			}
		}

		effect = {
			FROM = { prestige = -500 }
			ROOT = {
				add_holding_modifier = { modifier = cfh_districts_building_capital_modifier duration = -1 }
				if = {
					limit = { holding_type = castle }
					if = {
						limit = { NOT = { has_building = cfh_districts_ca_building_monument_0 } }
						add_building = cfh_districts_ca_building_monument_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_monument_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_monument_1 } }
						add_building = cfh_districts_ca_building_monument_1
						location = { set_province_flag = cfh_districts_monument_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_monument_2 } }
						add_building = cfh_districts_ca_building_monument_2
						location = { set_province_flag = cfh_districts_monument_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = city }
					if = {
						limit = { NOT = { has_building = cfh_districts_ct_building_monument_0 } }
						add_building = cfh_districts_ct_building_monument_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_monument_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_monument_1 } }
						add_building = cfh_districts_ct_building_monument_1
						location = { set_province_flag = cfh_districts_monument_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_monument_2 } }
						add_building = cfh_districts_ct_building_monument_2
						location = { set_province_flag = cfh_districts_monument_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = temple }
					if = {
						limit = { NOT = { has_building = cfh_districts_tp_building_monument_0 } }
						add_building = cfh_districts_tp_building_monument_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_monument_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_monument_1 } }
						add_building = cfh_districts_tp_building_monument_1
						location = { set_province_flag = cfh_districts_monument_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_monument_2 } }
						add_building = cfh_districts_tp_building_monument_2
						location = { set_province_flag = cfh_districts_monument_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = tribal }
					if = {
						limit = { NOT = { has_building = cfh_districts_tb_building_monument_0 } }
						add_building = cfh_districts_tb_building_monument_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_monument_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_monument_1 } }
						add_building = cfh_districts_tb_building_monument_1
						location = { set_province_flag = cfh_districts_monument_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_monument_2 } }
						add_building = cfh_districts_tb_building_monument_2
						location = { set_province_flag = cfh_districts_monument_2_flag }
					}
				}
				location = { 
					clr_province_flag = cfh_districts_pop_expand_flag
					change_variable = { which = cfh_districts_pop_var value = 1 }
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_building_citizen_poor_decision = {
		
		only_playable = yes
		is_high_prio = yes
		
		filter = owned
		ai_target_filter = owned
		ai_check_interval = 12

		from_potential = {
			clan = no
		}

		potential = {
			NOT = { 
				has_game_rule = {
					name = cfh_rule_districts
					value = off
				}
			}
			OR = {
				has_holding_modifier = cfh_districts_building_capital_modifier
				location = { is_variable_equal = { which = cfh_districts_num_dist_types_var value = 0 } }
			}
			location = { 
				has_province_flag = cfh_districts_pop_expand_flag
				NOT = { has_province_flag = cfh_districts_citizen_poor_2_flag }
				OR = {
					NOT = { check_variable = { which = cfh_districts_num_dist_types_var value = 5 } }
					AND = {
						check_variable = { which = cfh_districts_num_dist_types_var value = 5 }
						OR = {
							has_province_flag = cfh_districts_citizen_poor_0_flag
							has_province_flag = cfh_districts_citizen_poor_1_flag
						}
					
					}
				}
			}
			OR = {
				holding_type = castle
				holding_type = city
				holding_type = temple
				holding_type = tribal
			}
			is_capital = yes
		}

		allow = {
			FROM = { prestige >= 500 }
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.1
				always = yes
			}
		}

		effect = {
			FROM = { prestige = -500 }
			ROOT = {
				add_holding_modifier = { modifier = cfh_districts_building_capital_modifier duration = -1 }
				if = {
					limit = { holding_type = castle }
					if = {
						limit = { NOT = { has_building = cfh_districts_ca_building_citizen_poor_0 } }
						add_building = cfh_districts_ca_building_citizen_poor_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_citizen_poor_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_citizen_poor_1 } }
						add_building = cfh_districts_ca_building_citizen_poor_1
						location = { set_province_flag = cfh_districts_citizen_poor_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_citizen_poor_2 } }
						add_building = cfh_districts_ca_building_citizen_poor_2
						location = { set_province_flag = cfh_districts_citizen_poor_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = city }
					if = {
						limit = { NOT = { has_building = cfh_districts_ct_building_citizen_poor_0 } }
						add_building = cfh_districts_ct_building_citizen_poor_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_citizen_poor_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_citizen_poor_1 } }
						add_building = cfh_districts_ct_building_citizen_poor_1
						location = { set_province_flag = cfh_districts_citizen_poor_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_citizen_poor_2 } }
						add_building = cfh_districts_ct_building_citizen_poor_2
						location = { set_province_flag = cfh_districts_citizen_poor_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = temple }
					if = {
						limit = { NOT = { has_building = cfh_districts_tp_building_citizen_poor_0 } }
						add_building = cfh_districts_tp_building_citizen_poor_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_citizen_poor_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_citizen_poor_1 } }
						add_building = cfh_districts_tp_building_citizen_poor_1
						location = { set_province_flag = cfh_districts_citizen_poor_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_citizen_poor_2 } }
						add_building = cfh_districts_tp_building_citizen_poor_2
						location = { set_province_flag = cfh_districts_citizen_poor_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = tribal }
					if = {
						limit = { NOT = { has_building = cfh_districts_tb_building_citizen_poor_0 } }
						add_building = cfh_districts_tb_building_citizen_poor_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_citizen_poor_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_citizen_poor_1 } }
						add_building = cfh_districts_tb_building_citizen_poor_1
						location = { set_province_flag = cfh_districts_citizen_poor_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_citizen_poor_2 } }
						add_building = cfh_districts_tb_building_citizen_poor_2
						location = { set_province_flag = cfh_districts_citizen_poor_2_flag }
					}
				}
				location = { 
					clr_province_flag = cfh_districts_pop_expand_flag
					change_variable = { which = cfh_districts_pop_var value = 1 }
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_building_citizen_rich_decision = {
		
		only_playable = yes
		is_high_prio = yes
		
		filter = owned
		ai_target_filter = owned
		ai_check_interval = 12

		from_potential = {
			clan = no
		}

		potential = {
			NOT = { 
				has_game_rule = {
					name = cfh_rule_districts
					value = off
				}
			}
			OR = {
				has_holding_modifier = cfh_districts_building_capital_modifier
				location = { is_variable_equal = { which = cfh_districts_num_dist_types_var value = 0 } }
			}
			location = { 
				has_province_flag = cfh_districts_pop_expand_flag
				NOT = { has_province_flag = cfh_districts_citizen_rich_2_flag }
				OR = {
					NOT = { check_variable = { which = cfh_districts_num_dist_types_var value = 5 } }
					AND = {
						check_variable = { which = cfh_districts_num_dist_types_var value = 5 }
						OR = {
							has_province_flag = cfh_districts_citizen_rich_0_flag
							has_province_flag = cfh_districts_citizen_rich_1_flag
						}
					
					}
				}
			}
			OR = {
				holding_type = castle
				holding_type = city
				holding_type = temple
				holding_type = tribal
			}
			is_capital = yes
		}

		allow = {
			FROM = { prestige >= 500 }
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.1
				always = yes
			}
		}

		effect = {
			FROM = { prestige = -500 }
			ROOT = {
				add_holding_modifier = { modifier = cfh_districts_building_capital_modifier duration = -1 }
				if = {
					limit = { holding_type = castle }
					if = {
						limit = { NOT = { has_building = cfh_districts_ca_building_citizen_rich_0 } }
						add_building = cfh_districts_ca_building_citizen_rich_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_citizen_rich_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_citizen_rich_1 } }
						add_building = cfh_districts_ca_building_citizen_rich_1
						location = { set_province_flag = cfh_districts_citizen_rich_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_citizen_rich_2 } }
						add_building = cfh_districts_ca_building_citizen_rich_2
						location = { set_province_flag = cfh_districts_citizen_rich_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = city }
					if = {
						limit = { NOT = { has_building = cfh_districts_ct_building_citizen_rich_0 } }
						add_building = cfh_districts_ct_building_citizen_rich_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_citizen_rich_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_citizen_rich_1 } }
						add_building = cfh_districts_ct_building_citizen_rich_1
						location = { set_province_flag = cfh_districts_citizen_rich_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_citizen_rich_2 } }
						add_building = cfh_districts_ct_building_citizen_rich_2
						location = { set_province_flag = cfh_districts_citizen_rich_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = temple }
					if = {
						limit = { NOT = { has_building = cfh_districts_tp_building_citizen_rich_0 } }
						add_building = cfh_districts_tp_building_citizen_rich_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_citizen_rich_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_citizen_rich_1 } }
						add_building = cfh_districts_tp_building_citizen_rich_1
						location = { set_province_flag = cfh_districts_citizen_rich_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_citizen_rich_2 } }
						add_building = cfh_districts_tp_building_citizen_rich_2
						location = { set_province_flag = cfh_districts_citizen_rich_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = tribal }
					if = {
						limit = { NOT = { has_building = cfh_districts_tb_building_citizen_rich_0 } }
						add_building = cfh_districts_tb_building_citizen_rich_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_citizen_rich_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_citizen_rich_1 } }
						add_building = cfh_districts_tb_building_citizen_rich_1
						location = { set_province_flag = cfh_districts_citizen_rich_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_citizen_rich_2 } }
						add_building = cfh_districts_tb_building_citizen_rich_2
						location = { set_province_flag = cfh_districts_citizen_rich_2_flag }
					}
				}
				location = { 
					clr_province_flag = cfh_districts_pop_expand_flag
					change_variable = { which = cfh_districts_pop_var value = 1 }
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_building_citizen_noble_decision = {
		
		only_playable = yes
		is_high_prio = yes
		
		filter = owned
		ai_target_filter = owned
		ai_check_interval = 12

		from_potential = {
			clan = no
		}

		potential = {
			NOT = { 
				has_game_rule = {
					name = cfh_rule_districts
					value = off
				}
			}
			OR = {
				has_holding_modifier = cfh_districts_building_capital_modifier
				location = { is_variable_equal = { which = cfh_districts_num_dist_types_var value = 0 } }
			}
			location = { 
				has_province_flag = cfh_districts_pop_expand_flag
				NOT = { has_province_flag = cfh_districts_citizen_noble_2_flag }
				OR = {
					NOT = { check_variable = { which = cfh_districts_num_dist_types_var value = 5 } }
					AND = {
						check_variable = { which = cfh_districts_num_dist_types_var value = 5 }
						OR = {
							has_province_flag = cfh_districts_citizen_noble_0_flag
							has_province_flag = cfh_districts_citizen_noble_1_flag
						}
					
					}
				}
			}
			OR = {
				holding_type = castle
				holding_type = city
				holding_type = temple
				holding_type = tribal
			}
			is_capital = yes
		}

		allow = {
			FROM = { prestige >= 500 }
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.1
				always = yes
			}
		}

		effect = {
			FROM = { prestige = -500 }
			ROOT = {
				add_holding_modifier = { modifier = cfh_districts_building_capital_modifier duration = -1 }
				if = {
					limit = { holding_type = castle }
					if = {
						limit = { NOT = { has_building = cfh_districts_ca_building_citizen_noble_0 } }
						add_building = cfh_districts_ca_building_citizen_noble_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_citizen_noble_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_citizen_noble_1 } }
						add_building = cfh_districts_ca_building_citizen_noble_1
						location = { set_province_flag = cfh_districts_citizen_noble_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ca_building_citizen_noble_2 } }
						add_building = cfh_districts_ca_building_citizen_noble_2
						location = { set_province_flag = cfh_districts_citizen_noble_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = city }
					if = {
						limit = { NOT = { has_building = cfh_districts_ct_building_citizen_noble_0 } }
						add_building = cfh_districts_ct_building_citizen_noble_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_citizen_noble_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_citizen_noble_1 } }
						add_building = cfh_districts_ct_building_citizen_noble_1
						location = { set_province_flag = cfh_districts_citizen_noble_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_ct_building_citizen_noble_2 } }
						add_building = cfh_districts_ct_building_citizen_noble_2
						location = { set_province_flag = cfh_districts_citizen_noble_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = temple }
					if = {
						limit = { NOT = { has_building = cfh_districts_tp_building_citizen_noble_0 } }
						add_building = cfh_districts_tp_building_citizen_noble_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_citizen_noble_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_citizen_noble_1 } }
						add_building = cfh_districts_tp_building_citizen_noble_1
						location = { set_province_flag = cfh_districts_citizen_noble_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tp_building_citizen_noble_2 } }
						add_building = cfh_districts_tp_building_citizen_noble_2
						location = { set_province_flag = cfh_districts_citizen_noble_2_flag }
					}
				}
				else_if = {
					limit = { holding_type = tribal }
					if = {
						limit = { NOT = { has_building = cfh_districts_tb_building_citizen_noble_0 } }
						add_building = cfh_districts_tb_building_citizen_noble_0
						location = { 
							change_variable = { which = cfh_districts_num_dist_types_var value = 1 } 
							set_province_flag = cfh_districts_citizen_noble_0_flag
						}
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_citizen_noble_1 } }
						add_building = cfh_districts_tb_building_citizen_noble_1
						location = { set_province_flag = cfh_districts_citizen_noble_1_flag }
					}
					else_if ={
						limit = { NOT = { has_building = cfh_districts_tb_building_citizen_noble_2 } }
						add_building = cfh_districts_tb_building_citizen_noble_2
						location = { set_province_flag = cfh_districts_citizen_noble_2_flag }
					}
				}
				location = { 
					clr_province_flag = cfh_districts_pop_expand_flag
					change_variable = { which = cfh_districts_pop_var value = 1 }
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_building_destroy_district_decision = {
		filter = owned
		ai = no

		from_potential = {
			clan = no
		}

		potential = {
			is_capital = yes
			location = {
				OR = {
					check_variable = { which = cfh_districts_num_dist_types_var value = 1 }
					check_variable = { which = cfh_districts_pop_var value = 1 }
				}
			}
		}

		allow = {
			always = yes
		}

		effect = {
			ROOT = {
				location = { 
					set_province_flag = cfh_districts_destroy_flag
				}
			}
		}
	}

	cfh_districts_building_dont_destroy_district_decision = {
		is_high_prio = yes
		
		filter = owned
		ai = no

		from_potential = {
			clan = no
		}

		potential = {
			is_capital = yes
			location = {
				has_province_flag = cfh_districts_destroy_flag
			}
		}

		allow = {
			always = yes
		}

		effect = {
			ROOT = {
				location = { 
					clr_province_flag = cfh_districts_destroy_flag
				}
			}
		}
	}

	cfh_districts_building_military_destroy_decision = {
		filter = owned
		ai = no

		from_potential = {
			clan = no
		}

		potential = {
			is_capital = yes
			OR = {
				has_building = cfh_districts_ca_building_military_0
				has_building = cfh_districts_ct_building_military_0
				has_building = cfh_districts_tp_building_military_0
				has_building = cfh_districts_tb_building_military_0
			}
			location = {
				has_province_flag = cfh_districts_destroy_flag
			}
		}

		allow = {
			FROM = { prestige >= 200 }
		}

		effect = {
			FROM = { prestige = -200 }
			ROOT = {
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_military_2
							has_building = cfh_districts_ct_building_military_2
							has_building = cfh_districts_tb_building_military_2
							has_building = cfh_districts_tp_building_military_2
						}
					}
					remove_building = cfh_districts_ca_building_military_2
					remove_building = cfh_districts_ct_building_military_2
					remove_building = cfh_districts_tb_building_military_2
					remove_building = cfh_districts_tp_building_military_2
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_military_2_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_military_1
							has_building = cfh_districts_ct_building_military_1
							has_building = cfh_districts_tb_building_military_1
							has_building = cfh_districts_tp_building_military_1
						}
					}
					remove_building = cfh_districts_ca_building_military_1
					remove_building = cfh_districts_ct_building_military_1
					remove_building = cfh_districts_tb_building_military_1
					remove_building = cfh_districts_tp_building_military_1
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_military_1_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_military_0
							has_building = cfh_districts_ct_building_military_0
							has_building = cfh_districts_tb_building_military_0
							has_building = cfh_districts_tp_building_military_0
						}
					}
					remove_building = cfh_districts_ca_building_military_0
					remove_building = cfh_districts_ct_building_military_0
					remove_building = cfh_districts_tb_building_military_0
					remove_building = cfh_districts_tp_building_military_0
					location = { 
						subtract_variable = { which = cfh_districts_num_dist_types_var value = 1 }
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_military_0_flag
					}
				}
				cfh_districts_remove_military_district_buildings_effect = yes
				location = { 
					cfh_districts_mil_mod_0_effect = yes
					clr_province_flag = cfh_districts_pop_expand_flag
					clr_province_flag = cfh_districts_destroy_flag
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_building_industry_destroy_decision = {
		filter = owned
		ai = no

		from_potential = {
			clan = no
		}

		potential = {
			is_capital = yes
			OR = {
				has_building = cfh_districts_ca_building_industry_0
				has_building = cfh_districts_ct_building_industry_0
				has_building = cfh_districts_tp_building_industry_0
				has_building = cfh_districts_tb_building_industry_0
			}
			location = {
				has_province_flag = cfh_districts_destroy_flag
			}
		}

		allow = {
			FROM = { prestige >= 200 }
		}

		effect = {
			FROM = { prestige = -200 }
			ROOT = {
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_industry_2
							has_building = cfh_districts_ct_building_industry_2
							has_building = cfh_districts_tb_building_industry_2
							has_building = cfh_districts_tp_building_industry_2
						}
					}
					remove_building = cfh_districts_ca_building_industry_2
					remove_building = cfh_districts_ct_building_industry_2
					remove_building = cfh_districts_tb_building_industry_2
					remove_building = cfh_districts_tp_building_industry_2
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_industry_2_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_industry_1
							has_building = cfh_districts_ct_building_industry_1
							has_building = cfh_districts_tb_building_industry_1
							has_building = cfh_districts_tp_building_industry_1
						}
					}
					remove_building = cfh_districts_ca_building_industry_1
					remove_building = cfh_districts_ct_building_industry_1
					remove_building = cfh_districts_tb_building_industry_1
					remove_building = cfh_districts_tp_building_industry_1
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_industry_1_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_industry_0
							has_building = cfh_districts_ct_building_industry_0
							has_building = cfh_districts_tb_building_industry_0
							has_building = cfh_districts_tp_building_industry_0
						}
					}
					remove_building = cfh_districts_ca_building_industry_0
					remove_building = cfh_districts_ct_building_industry_0
					remove_building = cfh_districts_tb_building_industry_0
					remove_building = cfh_districts_tp_building_industry_0
					location = { 
						subtract_variable = { which = cfh_districts_num_dist_types_var value = 1 }
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_industry_0_flag
					}
				}
				cfh_districts_remove_industry_district_buildings_effect = yes
				location = { 
					cfh_districts_ind_mod_0_effect = yes
					clr_province_flag = cfh_districts_pop_expand_flag
					clr_province_flag = cfh_districts_destroy_flag
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_building_trade_destroy_decision = {
		filter = owned
		ai = no

		from_potential = {
			clan = no
		}

		potential = {
			is_capital = yes
			OR = {
				has_building = cfh_districts_ca_building_trade_0
				has_building = cfh_districts_ct_building_trade_0
				has_building = cfh_districts_tp_building_trade_0
				has_building = cfh_districts_tb_building_trade_0
			}
			location = {
				has_province_flag = cfh_districts_destroy_flag
			}
		}

		allow = {
			FROM = { prestige >= 200 }
		}

		effect = {
			FROM = { prestige = -200 }
			ROOT = {
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_trade_2
							has_building = cfh_districts_ct_building_trade_2
							has_building = cfh_districts_tb_building_trade_2
							has_building = cfh_districts_tp_building_trade_2
						}
					}
					remove_building = cfh_districts_ca_building_trade_2
					remove_building = cfh_districts_ct_building_trade_2
					remove_building = cfh_districts_tb_building_trade_2
					remove_building = cfh_districts_tp_building_trade_2
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_trade_2_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_trade_1
							has_building = cfh_districts_ct_building_trade_1
							has_building = cfh_districts_tb_building_trade_1
							has_building = cfh_districts_tp_building_trade_1
						}
					}
					remove_building = cfh_districts_ca_building_trade_1
					remove_building = cfh_districts_ct_building_trade_1
					remove_building = cfh_districts_tb_building_trade_1
					remove_building = cfh_districts_tp_building_trade_1
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_trade_1_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_trade_0
							has_building = cfh_districts_ct_building_trade_0
							has_building = cfh_districts_tb_building_trade_0
							has_building = cfh_districts_tp_building_trade_0
						}
					}
					remove_building = cfh_districts_ca_building_trade_0
					remove_building = cfh_districts_ct_building_trade_0
					remove_building = cfh_districts_tb_building_trade_0
					remove_building = cfh_districts_tp_building_trade_0
					location = { 
						subtract_variable = { which = cfh_districts_num_dist_types_var value = 1 }
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_trade_0_flag
					}
				}
				cfh_districts_remove_trade_district_buildings_effect = yes
				location = { 
					cfh_districts_tra_mod_0_effect = yes
					clr_province_flag = cfh_districts_pop_expand_flag
					clr_province_flag = cfh_districts_destroy_flag
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_building_religion_destroy_decision = {
		filter = owned
		ai = no

		from_potential = {
			clan = no
		}

		potential = {
			is_capital = yes
			OR = {
				has_building = cfh_districts_ca_building_religion_0
				has_building = cfh_districts_ct_building_religion_0
				has_building = cfh_districts_tp_building_religion_0
				has_building = cfh_districts_tb_building_religion_0
			}
			location = {
				has_province_flag = cfh_districts_destroy_flag
			}
		}

		allow = {
			FROM = { prestige >= 200 }
		}

		effect = {
			FROM = { prestige = -200 }
			ROOT = {
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_religion_2
							has_building = cfh_districts_ct_building_religion_2
							has_building = cfh_districts_tb_building_religion_2
							has_building = cfh_districts_tp_building_religion_2
						}
					}
					remove_building = cfh_districts_ca_building_religion_2
					remove_building = cfh_districts_ct_building_religion_2
					remove_building = cfh_districts_tb_building_religion_2
					remove_building = cfh_districts_tp_building_religion_2
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_religion_2_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_religion_1
							has_building = cfh_districts_ct_building_religion_1
							has_building = cfh_districts_tb_building_religion_1
							has_building = cfh_districts_tp_building_religion_1
						}
					}
					remove_building = cfh_districts_ca_building_religion_1
					remove_building = cfh_districts_ct_building_religion_1
					remove_building = cfh_districts_tb_building_religion_1
					remove_building = cfh_districts_tp_building_religion_1
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_religion_1_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_religion_0
							has_building = cfh_districts_ct_building_religion_0
							has_building = cfh_districts_tb_building_religion_0
							has_building = cfh_districts_tp_building_religion_0
						}
					}
					remove_building = cfh_districts_ca_building_religion_0
					remove_building = cfh_districts_ct_building_religion_0
					remove_building = cfh_districts_tb_building_religion_0
					remove_building = cfh_districts_tp_building_religion_0
					location = { 
						subtract_variable = { which = cfh_districts_num_dist_types_var value = 1 }
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_religion_0_flag
					}
				}
				cfh_districts_remove_religion_district_buildings_effect = yes
				location = { 
					cfh_districts_rel_mod_0_effect = yes
					clr_province_flag = cfh_districts_pop_expand_flag
					clr_province_flag = cfh_districts_destroy_flag
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_building_monument_destroy_decision = {
		filter = owned
		ai = no

		from_potential = {
			clan = no
		}

		potential = {
			is_capital = yes
			OR = {
				has_building = cfh_districts_ca_building_monument_0
				has_building = cfh_districts_ct_building_monument_0
				has_building = cfh_districts_tp_building_monument_0
				has_building = cfh_districts_tb_building_monument_0
			}
			location = {
				has_province_flag = cfh_districts_destroy_flag
			}
		}

		allow = {
			FROM = { prestige >= 200 }
		}

		effect = {
			FROM = { prestige = -200 }
			ROOT = {
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_monument_2
							has_building = cfh_districts_ct_building_monument_2
							has_building = cfh_districts_tb_building_monument_2
							has_building = cfh_districts_tp_building_monument_2
						}
					}
					remove_building = cfh_districts_ca_building_monument_2
					remove_building = cfh_districts_ct_building_monument_2
					remove_building = cfh_districts_tb_building_monument_2
					remove_building = cfh_districts_tp_building_monument_2
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_monument_2_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_monument_1
							has_building = cfh_districts_ct_building_monument_1
							has_building = cfh_districts_tb_building_monument_1
							has_building = cfh_districts_tp_building_monument_1
						}
					}
					remove_building = cfh_districts_ca_building_monument_1
					remove_building = cfh_districts_ct_building_monument_1
					remove_building = cfh_districts_tb_building_monument_1
					remove_building = cfh_districts_tp_building_monument_1
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts__1_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_monument_0
							has_building = cfh_districts_ct_building_monument_0
							has_building = cfh_districts_tb_building_monument_0
							has_building = cfh_districts_tp_building_monument_0
						}
					}
					remove_building = cfh_districts_ca_building_monument_0
					remove_building = cfh_districts_ct_building_monument_0
					remove_building = cfh_districts_tb_building_monument_0
					remove_building = cfh_districts_tp_building_monument_0
					location = { 
						subtract_variable = { which = cfh_districts_num_dist_types_var value = 1 }
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_monument_0_flag
					}
				}
				cfh_districts_remove_monument_district_buildings_effect = yes
				location = { 
					cfh_districts_mon_mod_0_effect = yes
					clr_province_flag = cfh_districts_pop_expand_flag
					clr_province_flag = cfh_districts_destroy_flag
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_building_citizen_poor_destroy_decision = {
		filter = owned
		ai = no

		from_potential = {
			clan = no
		}

		potential = {
			is_capital = yes
			OR = {
				has_building = cfh_districts_ca_building_citizen_poor_0
				has_building = cfh_districts_ct_building_citizen_poor_0
				has_building = cfh_districts_tp_building_citizen_poor_0
				has_building = cfh_districts_tb_building_citizen_poor_0
			}
			location = {
				has_province_flag = cfh_districts_destroy_flag
			}
		}

		allow = {
			FROM = { prestige >= 200 }
		}

		effect = {
			FROM = { prestige = -200 }
			ROOT = {
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_citizen_poor_2
							has_building = cfh_districts_ct_building_citizen_poor_2
							has_building = cfh_districts_tb_building_citizen_poor_2
							has_building = cfh_districts_tp_building_citizen_poor_2
						}
					}
					remove_building = cfh_districts_ca_building_citizen_poor_2
					remove_building = cfh_districts_ct_building_citizen_poor_2
					remove_building = cfh_districts_tb_building_citizen_poor_2
					remove_building = cfh_districts_tp_building_citizen_poor_2
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_citizen_poor_2_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_citizen_poor_1
							has_building = cfh_districts_ct_building_citizen_poor_1
							has_building = cfh_districts_tb_building_citizen_poor_1
							has_building = cfh_districts_tp_building_citizen_poor_1
						}
					}
					remove_building = cfh_districts_ca_building_citizen_poor_1
					remove_building = cfh_districts_ct_building_citizen_poor_1
					remove_building = cfh_districts_tb_building_citizen_poor_1
					remove_building = cfh_districts_tp_building_citizen_poor_1
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_citizen_poor_1_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_citizen_poor_0
							has_building = cfh_districts_ct_building_citizen_poor_0
							has_building = cfh_districts_tb_building_citizen_poor_0
							has_building = cfh_districts_tp_building_citizen_poor_0
						}
					}
					remove_building = cfh_districts_ca_building_citizen_poor_0
					remove_building = cfh_districts_ct_building_citizen_poor_0
					remove_building = cfh_districts_tb_building_citizen_poor_0
					remove_building = cfh_districts_tp_building_citizen_poor_0
					location = { 
						subtract_variable = { which = cfh_districts_num_dist_types_var value = 1 }
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_citizen_poor_0_flag
					}
				}
				cfh_districts_remove_citizen_poor_district_buildings_effect = yes
				location = { 
					cfh_districts_poor_mod_0_effect = yes
					clr_province_flag = cfh_districts_pop_expand_flag
					clr_province_flag = cfh_districts_destroy_flag
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_building_citizen_rich_destroy_decision = {
		filter = owned
		ai = no

		from_potential = {
			clan = no
		}

		potential = {
			is_capital = yes
			OR = {
				has_building = cfh_districts_ca_building_citizen_rich_0
				has_building = cfh_districts_ct_building_citizen_rich_0
				has_building = cfh_districts_tp_building_citizen_rich_0
				has_building = cfh_districts_tb_building_citizen_rich_0
			}
			location = {
				has_province_flag = cfh_districts_destroy_flag
			}
		}

		allow = {
			FROM = { prestige >= 200 }
		}

		effect = {
			FROM = { prestige = -200 }
			ROOT = {
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_citizen_rich_2
							has_building = cfh_districts_ct_building_citizen_rich_2
							has_building = cfh_districts_tb_building_citizen_rich_2
							has_building = cfh_districts_tp_building_citizen_rich_2
						}
					}
					remove_building = cfh_districts_ca_building_citizen_rich_2
					remove_building = cfh_districts_ct_building_citizen_rich_2
					remove_building = cfh_districts_tb_building_citizen_rich_2
					remove_building = cfh_districts_tp_building_citizen_rich_2
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_citizen_rich_2_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_citizen_rich_1
							has_building = cfh_districts_ct_building_citizen_rich_1
							has_building = cfh_districts_tb_building_citizen_rich_1
							has_building = cfh_districts_tp_building_citizen_rich_1
						}
					}
					remove_building = cfh_districts_ca_building_citizen_rich_1
					remove_building = cfh_districts_ct_building_citizen_rich_1
					remove_building = cfh_districts_tb_building_citizen_rich_1
					remove_building = cfh_districts_tp_building_citizen_rich_1
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_citizen_rich_1_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_citizen_rich_0
							has_building = cfh_districts_ct_building_citizen_rich_0
							has_building = cfh_districts_tb_building_citizen_rich_0
							has_building = cfh_districts_tp_building_citizen_rich_0
						}
					}
					remove_building = cfh_districts_ca_building_citizen_rich_0
					remove_building = cfh_districts_ct_building_citizen_rich_0
					remove_building = cfh_districts_tb_building_citizen_rich_0
					remove_building = cfh_districts_tp_building_citizen_rich_0
					location = { 
						subtract_variable = { which = cfh_districts_num_dist_types_var value = 1 }
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_citizen_rich_0_flag
					}
				}
				cfh_districts_remove_citizen_rich_district_buildings_effect = yes
				location = { 
					cfh_districts_rich_mod_0_effect = yes
					clr_province_flag = cfh_districts_pop_expand_flag
					clr_province_flag = cfh_districts_destroy_flag
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_building_citizen_noble_destroy_decision = {
		filter = owned
		ai = no

		from_potential = {
			clan = no
		}

		potential = {
			is_capital = yes
			OR = {
				has_building = cfh_districts_ca_building_citizen_noble_0
				has_building = cfh_districts_ct_building_citizen_noble_0
				has_building = cfh_districts_tp_building_citizen_noble_0
				has_building = cfh_districts_tb_building_citizen_noble_0
			}
			location = {
				has_province_flag = cfh_districts_destroy_flag
			}
		}

		allow = {
			FROM = { prestige >= 200 }
		}

		effect = {
			FROM = { prestige = -200 }
			ROOT = {
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_citizen_noble_2
							has_building = cfh_districts_ct_building_citizen_noble_2
							has_building = cfh_districts_tb_building_citizen_noble_2
							has_building = cfh_districts_tp_building_citizen_noble_2
						}
					}
					remove_building = cfh_districts_ca_building_citizen_noble_2
					remove_building = cfh_districts_ct_building_citizen_noble_2
					remove_building = cfh_districts_tb_building_citizen_noble_2
					remove_building = cfh_districts_tp_building_citizen_noble_2
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_citizen_noble_2_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_citizen_noble_1
							has_building = cfh_districts_ct_building_citizen_noble_1
							has_building = cfh_districts_tb_building_citizen_noble_1
							has_building = cfh_districts_tp_building_citizen_noble_1
						}
					}
					remove_building = cfh_districts_ca_building_citizen_noble_1
					remove_building = cfh_districts_ct_building_citizen_noble_1
					remove_building = cfh_districts_tb_building_citizen_noble_1
					remove_building = cfh_districts_tp_building_citizen_noble_1
					location = { 
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_citizen_noble_1_flag
					}
				}
				if = {
					limit = {
						OR = {
							has_building = cfh_districts_ca_building_citizen_noble_0
							has_building = cfh_districts_ct_building_citizen_noble_0
							has_building = cfh_districts_tb_building_citizen_noble_0
							has_building = cfh_districts_tp_building_citizen_noble_0
						}
					}
					remove_building = cfh_districts_ca_building_citizen_noble_0
					remove_building = cfh_districts_ct_building_citizen_noble_0
					remove_building = cfh_districts_tb_building_citizen_noble_0
					remove_building = cfh_districts_tp_building_citizen_noble_0
					location = { 
						subtract_variable = { which = cfh_districts_num_dist_types_var value = 1 }
						subtract_variable = { which = cfh_districts_pop_var value = 1 }
						clr_province_flag = cfh_districts_citizen_noble_0_flag
					}
				}
				cfh_districts_remove_citizen_noble_district_buildings_effect = yes
				location = { 
					cfh_districts_noble_mod_0_effect = yes
					clr_province_flag = cfh_districts_pop_expand_flag
					clr_province_flag = cfh_districts_destroy_flag
					province_event = { id = cfhdistricts.0002 days = 10 }
				}
			}
		}
	}

	cfh_districts_show_pop_decision = {
		ai = no
		filter = owned

		from_potential = {
			clan = no
		}

		potential = {
			NOT = { 
				has_game_rule = {
					name = cfh_rule_districts
					value = off
				}
			}
			OR = {
				holding_type = castle
				holding_type = city
				holding_type = temple
				holding_type = tribal
			}
			is_capital = yes
		}

		allow = {
			always = yes
		}

		effect = {
			location = { province_event = { id = cfhdistricts.0100 } }
		}
	}
}