# Defensive armies can't transport off the planet
# Maintenance is directly scripted here. 0.25 translates to 0.25 monthly cost (excluding other upkeep modifiers)
# Morale_damage = 1		# average morale damage of the army, default: auto (calculated from morale * MORALE_DAMAGE_MULT)
# Building spawned armies can't be built normally, but only created from pops working buildings

# Rebel Armies
rebel_army = {
	rebel = yes
	damage = 0.5
	health = 0.5
	morale = 1.0
	icon = GFX_army_type_rebel

	potential_country = {
		always = no
	}
}

# Rebel Slave Armies
rebel_slave_defense_army = {
	defensive = yes
	time = 60
	health = 0.80
	damage = 0.80
	morale = 1.80
	icon = GFX_army_type_rebel

	potential_country = {
		always = no
	}
}

# Primitive Armies
primitive_army = {
	defensive = yes
	is_pop_spawned = yes
	damage = 0.1
	health = 0.5
	morale = 0.8
	icon = GFX_army_type_primitive

	potential_country = {
		is_primitive = yes
		OR = {
			has_country_flag = bronze_age
			has_country_flag = iron_age
			has_country_flag = late_medieval_age
			has_country_flag = renaissance_age
			has_country_flag = steam_age
		}
		NOT = { has_country_flag = humans_late_medieval_age }
	}
}

# Primitive Armies - used in case a planet needs more defensive armies than their jobs could reasonably produce
primitive_additional_army = {
	defensive = yes
	damage = 0.1
	health = 0.5
	morale = 0.8
	icon = GFX_army_type_primitive
	use_armynames_from = primitive_army

	potential_country = {
		always = no
	}
}

# Industrial Armies
industrial_army = {
	defensive = yes
	is_pop_spawned = yes
	damage = 0.4
	health = 0.5
	morale = 0.8
	icon = GFX_army_type_primitive

	potential_country = {
		is_primitive = yes
		OR = {
			has_country_flag = machine_age
			has_country_flag = industrial_age
		}
	}
}

# Post-Atomic Armies
postatomic_army = {
	defensive = yes
	is_pop_spawned = yes
	damage = 0.6
	health = 1
	morale = 1
	icon = GFX_army_type_primitive

	potential_country = {
		is_primitive = yes
		OR = {
			has_country_flag = atomic_age
			has_country_flag = early_space_age
		}
	}
}

# Robot Uprising Armies
robot_uprising_army = {
	defensive = yes
	damage = 1
	morale_damage = 1
	health = 2
	has_morale = no
	icon = GFX_army_type_robot
	has_species = no

	potential_country = {
		always = no
	}
}

# Subterranean Industrial Armies
subterranean_industrial_army = {
	defensive = yes
	damage = 0.4
	health = 0.5
	morale = 0.8
	icon = GFX_army_type_primitive

	potential_country = {
		is_primitive = yes
		OR = {
			has_country_flag = machine_age
			has_country_flag = industrial_age
		}
		NOT = { has_country_flag = humans_machine_age }
	}
}

# Subterranean Post-Atomic Armies
subterranean_postatomic_army = {
	defensive = yes
	damage = 0.6
	health = 1
	morale = 1
	icon = GFX_army_type_primitive

	potential_country = {
		is_primitive = yes
		OR = {
			has_country_flag = atomic_age
			has_country_flag = early_space_age
		}
		NOT = { has_country_flag = humans_early_space_age }
	}
}

# Mutant Horror Armies
mutant_army = {
	defensive = yes
	damage = 1.5
	morale_damage = 1.5
	health = 2
	has_morale = no
	icon = GFX_army_type_xenomorph
	has_species = no

	potential_country = {
		always = no
	}
}

# Swarm Armies
swarm_army = {
	damage = 2.0
	morale_damage = 2.0
	health = 2.0
	has_morale = no
	time = 180
	icon = GFX_army_type_xenomorph
	has_species = no

	potential_country = {
		is_country_type = "swarm"
	}
}

# Rampaging Tree Armies
tree_army = {
	defensive = yes
	damage = 1.0
	morale_damage = 1.0
	health = 1.0
	has_morale = no
	icon = GFX_army_type_xenomorph
	has_species = no

	potential_country = {
		always = no
	}
}

# Enraged Colonist Armies
enraged_army = {
	defensive = yes
	damage = 0.5
	health = 0.5
	morale = 1.0
	has_morale = no
	icon = GFX_army_type_xenomorph
	has_species = no

	potential_country = {
		always = no
	}
}

# Pre-Space Ketling Armies
ketling_army = {
	defensive = yes
	damage = 0.6
	health = 1.0
	morale = 1.0
	icon = GFX_army_type_primitive

	potential_country = {
		always = no
	}
}

# Titanic life troops
# Can build on planets with titanic life if you get event + special project there
# Should be very strong and quite expensive, but cannot get attachments and can be built only in limited numbers
# Currently limited to 3. Ideally it would be X * Num of planets you have done the project one, but that is too complex for scripts
titanic_assault_army = {
	damage = 3.0
	health = 5.0
	morale = 3.0
	morale_damage = 2.0
	collateral_damage = 3.0
	war_exhaustion = 2.0
	time = 90
	icon = GFX_army_type_xenomorph
	has_species = no

	resources = {
		cost = {
			trigger = {
				from = {
					country_uses_bio_ships = no
					is_nomadic = no
				}
			}
			minerals = 300
		}
		cost = {
			trigger = {
				from = {
					country_uses_bio_ships = no
					is_nomadic = yes
				}
			}
			alloys = 150
		}
		cost = {
			trigger = {
				from = {
					country_uses_bio_ships = yes
				}
			}
			food = 300
			mult = @mineral_to_food_cost_ratio
		}

		upkeep = {
			energy = 1
		}
	}

	potential_country = {
		has_country_flag = titanic_life_soldiers
	}
	potential = {
		custom_tooltip = {
			text = titanic_troop_limit_tooltip
			planet = { has_carrier_flag = titanic_life_can_build }
		}
	}

	allow = {
		custom_tooltip = {
			text = titanic_troop_limit_tooltip
			planet = { has_carrier_flag = titanic_life_can_build }
			owner = {
				has_country_flag = titanic_life_soldiers
				NOT = {
					check_variable = {
						which = "titanic_life_soldier_count"
						value = 3
					}
				}
			}
		}
	}

	on_queued = {
		owner = {
			change_variable = {
				which = "titanic_life_soldier_count"
				value = 1
			}
		}
	}

	on_unqueued = {
		owner = {
			change_variable = {
				which = "titanic_life_soldier_count"
				value = -1
			}
		}
	}
}

# Azizian Army: Based on titanic life assault army
titanic_azizian_assault_army = {
	damage = 3.0
	health = 5.0
	morale = 2.0
	morale_damage = 2.0
	time = 90
	icon = GFX_army_type_xenomorph
	has_species = no

	resources = {
		category = armies
		cost = {
			energy = 50
		}
		cost = {
			trigger = {
				from = {
					country_uses_bio_ships = no
					is_nomadic = no
				}
			}
			minerals = 250
		}
		cost = {
			trigger = {
				from = {
					country_uses_bio_ships = no
					is_nomadic = yes
				}
			}
			alloys = 125
		}
		cost = {
			trigger = {
				from = {
					country_uses_bio_ships = yes
				}
			}
			food = 250
			mult = @mineral_to_food_cost_ratio
		}

		upkeep = {
			energy = 1
		}
	}

	potential_country = {
		has_country_flag = titanic_azizian_soldiers
	}
	potential = {
		custom_tooltip = {
			text = azizian_troop_limit_tooltip
			planet = { has_carrier_flag = titanic_azizian_can_build }
		}
	}

	allow = {
		custom_tooltip = {
			text = azizian_troop_limit_tooltip
			planet = { has_carrier_flag = titanic_azizian_can_build }
			owner = {
				has_country_flag = titanic_azizian_soldiers
				NOT = {
					 check_variable = {
						which = "titanic_azizian_soldier_count"
						value = 3
					}
				}
			}
		}
	}

	on_queued = {
		owner = {
			change_variable = {
				which = "titanic_azizian_soldier_count"
				value = 1
			}
		}
	}

	on_unqueued = {
		owner = {
			change_variable = {
				which = "titanic_azizian_soldier_count"
				value = -1
			}
		}
	}
}

#Can't be built, is spawned on Titanic life planets after special project + event. Partly as reward, partly to ensure having this on multiple planets is always useful.
titanic_guardian_army = {
	defensive = yes
	damage = 2.0
	health = 8.0
	morale = 3.0
	morale_damage = 2.0
	time = 5
	icon = GFX_army_type_xenomorph
	has_species = no

	resources = {
		category = armies
		upkeep = {
			energy = 1
		}
	}

	potential_country = {
		always = no
	}
}

# Given as a reward from the Shroud
shroud_army = {
	damage = 5.0
	health = 7.0
	has_morale = no
	morale_damage = 2.0
	war_exhaustion = 5.0
	time = 5
	icon = GFX_army_type_psionic
	has_species = no

	resources = {
		category = armies
		produces = {
			energy = 1
		}
	}

	potential_country = {
		always = no
	}
}

# Gray Nanite Army
gray_army = {
	damage = 10.0
	health = 18.0
	has_morale = no
	morale_damage = 6.0
	collateral_damage = 5.0
	war_exhaustion = 4.0
	time = 5
	resources = {
		category = armies
		produces = {
			energy = 1
		}
	}
	has_species = no
	icon = GFX_army_type_machine_assault

	potential_country = {
		always = no
	}
}

# Mega-Warform
care_defensive_protocols = {
	defensive = yes
	damage = 4.0
	health = 6.0
	has_morale = no
	morale_damage = 1.5
	collateral_damage = 4.0
	war_exhaustion = 4.0
	time = 500
	has_species = no

	icon = GFX_army_type_machine_assault

	potential_country = {
		always = no
	}
}

# Sentinels
sentinel_army = {
	defensive = yes
	damage = 4
	morale_damage = 5
	health = 7
	has_morale = no
	icon = GFX_army_type_machine_assault
	has_species = no

	potential_country = {
		always = no
	}
}

# Improved Mega-Warform, unlocked by War Forge relic
cybrex_warform = {
	damage = 5.0
	health = 7.0
	has_morale = no
	morale_damage = 2
	collateral_damage = 5.0
	war_exhaustion = 4.0
	time = 500
	has_species = no

	icon = GFX_army_type_machine_assault

	resources = {
		category = armies
		cost = {
			alloys = 250
		}

		upkeep = {
			energy = 8
		}
	}

	potential_country = {
		has_relic = r_war_forge
	}
	potential = {
		custom_tooltip = {
			planet = { is_capital = yes }
		}
	}
	ai_weight = {
		base = 50
	}
}

# Imperial Legions

imperial_legion = {
	damage = 2.5
	health = 3.0
	morale = 3.0
	morale_damage = 1.0
	collateral_damage = 0.75
	war_exhaustion = 3.0
	time = 150
	icon = GFX_army_type_imperial
	has_species = no

	resources = {
		category = armies
		cost = {
			trigger = {
				from = {
					country_uses_bio_ships = no
					is_nomadic = no
				}
			}
			minerals = 300
		}
		cost = {
			trigger = {
				from = {
					country_uses_bio_ships = no
					is_nomadic = yes
				}
			}
			alloys = 150
		}
		cost = {
			trigger = {
				from = {
					country_uses_bio_ships = yes
				}
			}
			food = 300
			mult = @mineral_to_food_cost_ratio
		}

		upkeep = {
			energy = 3
		}
	}

	potential_country = {
		is_galactic_emperor = yes
		is_active_resolution = "resolution_emperor_imperial_legions"
	}

	allow = {
	}

	on_queued = {
	}

	on_unqueued = {
	}

	ai_weight = {
		base = 500
	}
}

giant_undead_army = {
	damage = 3.00
	health = 7.00
	has_morale = no
	collateral_damage = 3.5
	morale_damage = 3
	war_exhaustion = 0.50
	icon = GFX_army_type_undead
	pop_limited = no
	prerequisites = { "tech_assault_armies" }
	show_tech_unlock_if = {
		always = no
	}
	resources = {
		category = armies

		upkeep = {
			energy = 1.5
		}
	}


	potential_country = {
		always = no
	}
}

# Ice Armies
ice_army = {
	defensive = yes
	damage = 1.5
	morale_damage = 1.5
	health = 2
	has_morale = no
	icon = GFX_army_type_xenomorph
	has_species = no

	potential_country = {
		always = no
	}
}


# Mercenary Armies
mercenary_army = {
	damage = 1.10
	health = 1.00
	morale = 0.50
	morale_damage = 1.00
	collateral_damage = 2.50
	war_exhaustion = 0.50

	icon = GFX_army_type_assault
	resources = {
		category = armies

		upkeep = {
			energy = 2
		}
	}

	potential = {
		always = no
	}
}

# Mechanized Mercenary Armies
mecha_army = {
	damage = 2.20
	health = 1.80
	morale = 1.00
	morale_damage = 1.00
	collateral_damage = 3.00
	war_exhaustion = 0.50

	icon = GFX_army_type_assault

	resources = {
		category = armies

		upkeep = {
			energy = 5
		}
	}

	potential = {
		always = no
	}
}

# Crystal Kraken
crystal_kraken_army = {
	defensive = yes
	damage = 35
	morale_damage = 50
	health = 55
	has_morale = no
	icon = GFX_army_type_undead
	has_species = no

	potential = {
		always = no
	}
}

# Zroni Legacy - Shroud Creatures
shroud_monstrosities = {
	defensive = yes
	damage = 15.00
	health = 15.00
	morale_damage = 2.00
	collateral_damage = 5.00

	icon = GFX_army_type_psionic
	has_species = no
	has_morale = no

	resources = {
		category = armies
	}

	potential = {
		always = no
	}
}

# Subterranean Invasion Defense Force
subterranean_defense_army = {
	defensive = yes
	damage = 0.8
	health = 1
	morale = 1
	icon = GFX_army_type_primitive

	potential = {
		always = no
	}
}

new_world_order_defensive_army = {
	defensive = yes
	damage = 0.1
	health = 20.0
	morale = 6.0
	morale_damage = 0.1
	time = 5
	icon = GFX_army_type_primitive
	has_species = no

	resources = {
		category = armies
		upkeep = {
			energy = 1
		}
	}

	potential_country = {
		always = no
	}
}

new_world_order_offensive_army = {
	defensive = no
	damage = 0.1
	health = 20.0
	morale = 6.0
	morale_damage = 0.1
	time = 5
	icon = GFX_army_type_assault
	has_species = no

	resources = {
		category = armies
		upkeep = {
			energy = 1
		}
	}

	potential_country = {
		always = no
	}
}

# Thorn Army
# Spawned by WEEDS_ARMY_PROJECT, (Fruitful Partnership Origin)
fruitful_army = {
	defensive = yes
	damage = 2.0
	morale_damage = 2.0
	collateral_damage = 5.0
	war_exhaustion = 0.25
	health = 2.0
	has_morale = no
	icon = GFX_army_type_xenomorph

	potential_country = {
		always = no
	}
}

# behemoth Armies
# Spawned when a planet is being bombed by a small behemoth
behemoth_army = {
	defensive = yes

	damage = 6.0
	morale_damage = 6.0
	collateral_damage = 6.0
	war_exhaustion = 0
	health = 10.0
	has_morale = no
	icon = GFX_army_type_behemoth
	has_species = no

	potential_country = {
		always = no
	}
}

# Stormwardens, given by the Mindwarden Enclave
mindwarden_army = {
	damage = 1.10
	health = 1.00
	morale = 0.50
	morale_damage = 1.00
	collateral_damage = 2.50
	war_exhaustion = 0.50

	icon = GFX_army_type_assault
	resources = {
		category = armies

		upkeep = {
			energy = 2
		}
	}

	army_modifier = {
		army_damage_against_psionic_mult = 1
	}

	potential = {
		always = no
	}
}
