country_decisions = {
	####################
	##UPGRADE FORTS 1 ##
	####################
	xorme_ai_upgrade_forts_1 = {
		potential = {
			NOT = { has_country_modifier = xorme_ai_u_forts_cooldown_1 }
			mil_tech = 14
			NOT = { mil_tech = 19 }
			xorme_ai_valid_nation = yes
			is_at_war = no
			NOT = { num_of_loans = 1 }
		}

		allow = {
			treasury = 425
			monthly_income = 10
			current_income_balance = 4
			any_owned_province = {
				AND = {
					has_building = fort_15th
					can_build = fort_16th
				}
			}
		}

		effect = {
			random_owned_province = {
				limit = {
					AND = {
						has_building = fort_15th
						can_build = fort_16th
					}
				}
				add_building_construction = {
					building = fort_16th
					speed = 1
					cost = 1
				}
			}
			add_country_modifier = {
				name = xorme_ai_u_forts_cooldown_1
				duration = 300
			}
		}

		ai_will_do = {
			factor = 1.0
			modifier = {
				factor = 0
				OR = {
					is_in_deficit = yes
					NOT = { current_income_balance = 9 }
				}
			}
			modifier = {
				factor = 0
				AND = {
					mil_tech = 19
					monthly_income = 25
					current_income_balance = 10
				}
			}
		}
	}
	####################
	##UPGRADE FORTS 2 ##
	####################
	xorme_ai_upgrade_forts_2 = {
		potential = {
			NOT = { has_country_modifier = xorme_ai_u_forts_cooldown_2 }
			mil_tech = 19
			NOT = { mil_tech = 24 }
			xorme_ai_valid_nation = yes
			is_at_war = no
			NOT = { num_of_loans = 1 }
		}

		allow = {
			treasury = 625
			monthly_income = 15
			current_income_balance = 5
			any_owned_province = {
				AND = {
					OR = {
						has_building = fort_15th
						has_building = fort_16th
					}
					can_build = fort_17th
				}
			}
		}

		effect = {
			random_owned_province = {
				limit = {
					AND = {
						OR = {
							has_building = fort_15th
							has_building = fort_16th
						}
					}
				}
				add_building_construction = {
					building = fort_17th
					speed = 1
					cost = 1
				}
			}
			add_country_modifier = {
				name = xorme_ai_u_forts_cooldown_2
				duration = 400
			}
		}

		ai_will_do = {
			factor = 1.0
			modifier = {
				factor = 0
				OR = {
					is_in_deficit = yes
					NOT = { current_income_balance = 11 }
				}
			}
			modifier = {
				factor = 0
				AND = {
					mil_tech = 24
					monthly_income = 30
					current_income_balance = 12
				}
			}
		}
	}
	####################
	##UPGRADE FORTS 3 ##
	####################
	xorme_ai_upgrade_forts_3 = {
		potential = {
			NOT = { has_country_modifier = xorme_ai_u_forts_cooldown_3 }
			mil_tech = 24
			xorme_ai_valid_nation = yes
			is_at_war = no
			NOT = { num_of_loans = 1 }
		}

		allow = {
			treasury = 825
			monthly_income = 20
			current_income_balance = 7
			any_owned_province = {
				AND = {
					OR = {
						has_building = fort_15th
						has_building = fort_16th
						has_building = fort_17th
					}
					can_build = fort_18th
				}
			}
		}

		effect = {
			random_owned_province = {
				limit = {
					AND = {
						OR = {
							has_building = fort_15th
							has_building = fort_16th
							has_building = fort_17th
						}
						can_build = fort_18th
					}
				}
				add_building_construction = {
					building = fort_18th
					speed = 1
					cost = 1
				}
			}
			add_country_modifier = {
				name = xorme_ai_u_forts_cooldown_3
				duration = 500
			}
		}

		ai_will_do = {
			factor = 1.0
			modifier = {
				factor = 0
				OR = {
					is_in_deficit = yes
					NOT = { current_income_balance = 13 }
				}
			}
		}
	}
}
