decisions = {

	conscript_merchant_ships = {
		only_playable = yes
		#is_high_prio = yes
		ai_check_interval = 12

		potential = {
			is_playable = yes
			NOT = {
				has_earmarked_regiments = conscripted_merchant_ships
			}
			ai = no
			war = yes
		}
		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
			modifier = {
				factor = 0
				any_realm_province = { port = yes }
			}
			modifier = {
				factor = 0
				NOT = {
					any_war = {
						OR = {
							defender = { character = ROOT }
							attacker = { character = ROOT }
						}
					}
				}
			}
		}
	}
	
	raise_tribal_units = {
		only_playable = yes
		is_high_prio = yes
		is_mercenary = yes
		ai_check_interval = 12

		potential = {
			NOT = {
				has_dlc = "Legacy of Rome"
			}
			is_playable = yes
			is_tribal = yes
			is_landed = yes
			OR = {
				ai = no
				any_war = {
					OR = {
						any_defender = {
							character = ROOT
							is_primary_war_defender = yes
						}
						any_attacker = {
							character = ROOT
							is_primary_war_attacker = yes
						}
					}
				}
			}
		}
		allow = {
			war = yes
			prestige = 500
		}
		effect = {
			prestige = -500
			if = {
				limit = {
					OR = {
						religion = tengri_pagan
						religion = tengri_pagan_reformed
						culture_group = altaic
					}
				}
				capital_scope = {
					PREV = {
						spawn_unit = {
							owner = ROOT
							province = PREV
							home = PREV
							troops = {
								archers = { 500 500 }
								light_infantry = { 1500 1500 }
								light_cavalry = { 500 500 }
							}
							attrition = 1.0
							disband_on_peace = yes
							maintenance_multiplier = 0.5
						}
					}
				}
				break = yes
			}
			capital_scope = {
				PREV = {
					spawn_unit = {
						owner = ROOT
						province = PREV
						home = PREV
						troops = {
							archers = { 500 500 }
							light_infantry = { 1500 1500 }
							heavy_infantry = { 300 300 }
							light_cavalry = { 200 200 }
						}
						attrition = 1.0
						disband_on_peace = yes
						maintenance_multiplier = 0.5
					}
				}
			}
		}
		ai_will_do = {
			factor = 0 # decisions with the "is_mercenary" will not be calculated from the script
		}
	}

	raise_defensive_unit = {
		only_playable = yes
		is_high_prio = yes
		is_mercenary = yes
		ai_check_interval = 12

		potential = {
			has_dlc = "The Old Gods"
			NOT = {
				has_dlc = "Legacy of Rome"
			}
			is_playable = yes
			is_tribal = yes
			is_landed = yes
			
			
			OR = {
				religion = dryad_religion
				religion = druidic
			}
		}

		allow = {
			war = yes
			
			custom_tooltip = {
				text = raise_defensive_unit_tooltip

				hidden_tooltip = {
					any_war = {
						any_defender = {
							character = ROOT
							is_primary_war_defender = yes
						}

						#Defending against heathen
						OR = {
							AND = {
								ROOT = {
									religion = dryad_religion
								}
								attacker = {
									NOT = { religion = dryad_religion }
								}
							}
							AND = {
								ROOT = {
									religion = druidic
								}
								attacker = {
									NOT = { religion = druidic }
								}
							}
						}
					}
				}
			}
			piety = 200	
		}

		effect = {
			custom_tooltip = { text = summon_defensive_unit }
			piety = -200

			hidden_tooltip = {
				capital_scope = {
					ROOT = {
						spawn_unit = {
							owner = ROOT
							home = PREV
							province = PREV
							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 }
							}
						}
					}
				}
			}
		}

		revoke_allowed = {
			always = no
		}

		ai_will_do = {
			factor = 0
		}
	}	
}
