decisions = {

	conscript_merchant_ships = {
		ai_check_interval = 12

		is_high_prio = yes

		only_playable = yes

		potential = {
			has_overseas_holdings = yes

			trigger_if = {
				limit = { ai = yes }
				year >= 1100
			}

			NOT = { has_earmarked_regiments = conscripted_merchant_ships }
		}

		allow = {
			war = yes
			wealth >= 50
		}

		effect = {
			wealth = -50

			spawn_fleet = {
				province = closest # closest sea zone
				owner = ROOT
				disband_on_peace = yes
				earmark = conscripted_merchant_ships

				troops = {
					galleys = { 20 20 }
				}
			}
		}

		ai_will_do = {
			factor = 1

			trigger = {
				OR = {
					is_primary_war_attacker = yes
					is_primary_war_defender = yes
				}
			}
		}
	}

	raise_tribal_units = {
		ai_check_interval = 12

		is_high_prio = yes
		is_mercenary = yes

		only_playable = yes

		potential = {
			is_tribal = yes

			# TODO: marking this in case we decide to import the tribal piety/prestige retinues from 3.0
			# NOT = { has_dlc = "Legacy of Rome" }

			trigger_if = {
				limit = { ai = yes }

				OR = {
					is_primary_war_attacker = yes
					is_primary_war_defender = yes
				}
			}
		}

		allow = {
			war = yes
			prestige >= 500

			custom_tooltip = {
				text = NOT_RECENTLY_RAISE_TRIBAL_UNITS

				NOT = { has_character_modifier = raise_tribal_units_timer }
			}
		}

		effect = {
			prestige = -500

			custom_tooltip = {
				text = TRIBAL_ARMY_RAISED

				spawn_unit = {
					owner = ROOT
					province = capital_scope
					home = capital_scope
					match_character = ROOT
					match_mult = 0.5
					match_min = 500
					match_max = 5000
					attrition = 1.0
					disband_on_peace = yes
					maintenance_multiplier = 0.5
				}
			}

			add_character_modifier = {
				name = raise_tribal_units_timer
				months = 1
				hidden = yes
			}
		}

		ai_will_do = {
			factor = 0 # decisions with "is_mercenary = yes" are not calculated from script
		}
	}

	raise_defensive_unit = {
		ai_check_interval = 12

		is_high_prio = yes
		is_mercenary = yes

		only_playable = yes

		potential = {
			is_tribal = yes
			is_landed = yes
			has_dlc = "The Old Gods"

			# TODO: marking this in case we decide to import the tribal piety/prestige retinues from 3.0
			# NOT = { has_dlc = "Legacy of Rome" }

			# Defensive pagans only
			OR = {
				religion_openly_finnish_or_reformed_trigger = yes
				religion_openly_west_african_or_reformed_trigger = yes
				religion_openly_baltic_or_reformed_trigger = yes
				religion_openly_slavic_or_reformed_trigger = yes
			}
		}

		allow = {
			war = yes
			piety >= 200

			custom_tooltip = {
				text = raise_defensive_unit_tooltip

				any_war = {
					is_primary_war_defender = yes

					# Defending against heathens
					trigger_if = {
						limit = { ROOT = { religion_openly_finnish_or_reformed_trigger = yes } }
						attacker = { religion_openly_finnish_or_reformed_trigger = no }
					}
					trigger_else_if = {
						limit = { ROOT = { religion_openly_west_african_or_reformed_trigger = yes } }
						attacker = { religion_openly_west_african_or_reformed_trigger = no }
					}
					trigger_else_if = {
						limit = { ROOT = { religion_openly_baltic_or_reformed_trigger = yes } }
						attacker = { religion_openly_baltic_or_reformed_trigger = no }
					}
					trigger_else = {
						ROOT = { religion_openly_slavic_or_reformed_trigger = yes }
						attacker = { religion_openly_slavic_or_reformed_trigger = no }
					}
				}
			}
		}

		effect = {
			piety = -200

			custom_tooltip = {
				text = summon_defensive_unit

				spawn_unit = {
					owner = ROOT
					home = capital_scope
					province = capital_scope
					disband_on_peace = yes
					maintenance_multiplier = 0.25
					attrition = 1.0

					troops = {
						archers = { 400 400 }
						light_infantry = { 1000 1000 }
						heavy_infantry = { 350 350 }
						light_cavalry = { 250 250 }
					}
				}
			}
		}

		ai_will_do = {
			factor = 0 # decisions with "is_mercenary = yes" are not calculated from script
		}
	}

}