#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)

#ai_weight: as standard, but note that it pre-filters by whether the country can recruit this army (measuring by whether it is an assault army, whether it has the tech prereqs, and whether it passes potential_country)

# Assault Armies
assault_army = {
	damage = 1.00
	health = 1.00
	morale = 1.00
	morale_damage = 1.00
	collateral_damage = 1.00
	war_exhaustion = 1.00
	time = 90
	icon = GFX_army_type_assault
	prerequisites = { "tech_assault_armies" }
	resources = {
		category = armies
		cost = {
			trigger = {
				from = {
					country_uses_bio_ships = no
					is_nomadic = no
				}
			}
			minerals = 100
		}
		cost = {
			trigger = {
				from = {
					country_uses_bio_ships = no
					is_nomadic = yes
				}
			}
			alloys = 50
		}
		cost = {
			trigger = {
				from = {
					country_uses_bio_ships = yes
				}
			}
			food = 100
			mult = @mineral_to_food_cost_ratio
		}

		upkeep = {
			energy = 1
		}
	}

	show_tech_unlock_if = {
		OR = {
			is_machine_empire = no
			has_valid_civic = civic_machine_assimilator
			has_origin = origin_shroud_forged
		}
		is_wilderness_empire = no
	}
	potential_country = {
		OR = {
			is_machine_empire = no
			has_valid_civic = civic_machine_assimilator
			has_origin = origin_shroud_forged
		}
		is_wilderness_empire = no
	}
	potential = {
		from = {
			OR = {
				has_trait = trait_shroud_forged
				NOR = {
					has_trait = "trait_mechanical"
					has_trait = "trait_machine_unit"
					is_sapient = no
				}
			}
		}
	}

	ai_weight = {
		base = 100
		modifier = {
			set = 0
			OR = {
				is_fallen_empire = yes
				has_technology = tech_telepathy
				has_technology = tech_gene_seed_purification
				AND = {
					is_militarist = yes
					has_technology = tech_gene_banks
				}
			}
		}
		modifier = {
			factor = 0.01 #cannot guarantee that they actually have slaves/robots to get armies from
			OR = {
				AND = {
					has_ai_personality_behaviour = slaver
					has_technology = tech_neural_implants
				}
				AND = {
					has_ai_personality_behaviour = robot_liberator
					has_technology = tech_droid_workers
				}
				has_valid_civic = civic_reanimated_armies
			}
		}
	}
}

# Slave Armies
slave_army = {
	damage = 1.00
	health = 1.00
	morale = 0.75
	morale_damage = 0.75
	collateral_damage = 1.50
	war_exhaustion = 0.50
	time = 60
	icon = GFX_army_type_slave

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

		upkeep = {
			energy = 0.5
		}
	}

	prerequisites = { "tech_neural_implants" }

	allow = {
		custom_tooltip = {
			fail_text = "requires_slave_processing_facility"
			OR = {
				has_building = building_slave_processing
				AND = {
					exists = orbital_defence
					orbital_defence = {
						exists = starbase
						starbase = {
							has_starbase_building = ring_slave_processing_facility
						}
					}
				}
			}
		}
		any_owned_pop_group = { is_enslaved = yes }
	}
	potential_country = {
		OR = {
			has_policy_flag = slavery_allowed
			has_exploited_disconnected_drones = yes
		}
		is_machine_empire = no
		is_wilderness_empire = no
	}
	potential = {
		owner = {
			any_owned_pop_group = {
				is_enslaved = yes
				is_same_species = from
			}
		}
		from = {
			NOR = {
				has_trait = "trait_mechanical"
				has_trait = "trait_machine_unit"
				is_sapient = no
			}
		}
	}

	ai_weight = {
		base = 100
		modifier = {
			set = 0
			OR = {
				is_fallen_empire = yes
				NOT = { has_ai_personality_behaviour = slaver }
				has_technology = tech_telepathy
				has_technology = tech_gene_seed_purification
				AND = {
					is_militarist = yes
					has_technology = tech_gene_banks
				}
				AND = {
					has_ai_personality_behaviour = robot_liberator
					has_technology = tech_droid_workers
				}
			}
		}
	}
}

# Clone Armies
clone_army = {
	damage = 1.00
	health = 1.00
	morale = 1.00
	collateral_damage = 1.25
	war_exhaustion = 0.50
	time = 30
	icon = GFX_army_type_clone
	pop_limited = no

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

		upkeep = {
			energy = 0.75
		}
	}

	prerequisites = { "tech_gene_banks" }

	show_tech_unlock_if = {
		OR = {
			is_machine_empire = no
			has_civic = civic_machine_assimilator
		}
	}

	potential_country = {
		OR = {
			is_machine_empire = no
			has_civic = civic_machine_assimilator
		}
		is_wilderness_empire = no
	}
	potential = {
		from = {
			NOR = {
				has_trait = "trait_mechanical"
				has_trait = "trait_machine_unit"
				is_sapient = no
			}
		}
	}

	ai_weight = {
		base = 100
		modifier = {
			set = 0
			OR = {
				is_fallen_empire = yes
				has_technology = tech_telepathy
				has_technology = tech_gene_seed_purification
				NAND = {
					is_militarist = yes
					has_technology = tech_gene_banks
				}
			}
		}
		modifier = {
			factor = 2
			has_origin = origin_clone_army
		}
	}
}

# Robotic Armies
robotic_army = {
	damage = 1.00
	health = 2.00
	morale_damage = 1.00
	collateral_damage = 1.5
	war_exhaustion = 0.50
	has_morale = no
	time = 90
	icon = GFX_army_type_robot
	has_species = yes

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

		upkeep = {
			energy = 1.5
		}
	}

	potential_country = {
		is_machine_empire = no
		is_wilderness_empire = no
	}
	potential = {
		from = { has_trait = "trait_mechanical" }
	}

	prerequisites = { "tech_droid_workers" }

	allow = {
		owner = { NOT = { has_policy_flag = robots_outlawed } }
	}

	ai_weight = {
		base = 100
		modifier = {
			set = 0
			OR = {
				NOT = { has_policy_flag = robots_outlawed }
				has_technology = tech_telepathy
				has_technology = tech_gene_seed_purification
				NAND = {
					has_ai_personality_behaviour = robot_liberator
					has_technology = tech_droid_workers
				}
			}
			is_fallen_empire = no
		}
		modifier = {
			set = 0
			is_fallen_empire = yes
			NOT = { is_fanatic_materialist = yes }
		}
	}
}

# Psionic Armies
psionic_army = {
	damage = 2.0
	morale_damage = 1.5
	health = 1.75
	morale = 2.5
	collateral_damage = 0.5
	war_exhaustion = 3.0
	time = 120
	icon = GFX_army_type_psionic

	resources = {
		category = armies
		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 = 2.5
		}
	}

	prerequisites = { "tech_telepathy" }
	potential_country = {
		OR = {
			is_machine_empire = no
			has_origin = origin_shroud_forged
		}
		is_wilderness_empire = no
	}
	potential = {
		from = {
			has_psionic_species_trait = yes
			OR = {
				has_trait = trait_shroud_forged
				NOR = {
					has_trait = "trait_mechanical"
					has_trait = "trait_machine_unit"
					is_sapient = no
				}
			}
		}
	}

	ai_weight = {
		base = 100
		modifier = {
			set = 0
			OR = {
				NOT = { has_technology = tech_telepathy }
				has_technology = tech_gene_seed_purification
			}
		}
		modifier = {
			set = 0
			is_fallen_empire = yes
			NOT = { is_fanatic_spiritualist = yes }
		}
	}
}

# Xenomorph Armies
xenomorph_army = {
	damage = 2.0
	morale_damage = 2.0
	collateral_damage = 5.0
	war_exhaustion = 0.25
	health = 2.0
	has_morale = no
	time = 100
	icon = GFX_army_type_xenomorph
	has_species = no

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

		upkeep = {
			energy = 2
		}
	}

	potential_country = {
		is_machine_empire = no
		is_wilderness_empire = no
	}

	prerequisites = { "tech_morphogenetic_field_mastery" }

	ai_weight = {
		base = 10
		modifier = {
			factor = 10
			is_fallen_empire = yes
			has_ethic = ethic_fanatic_xenophobe
		}
		modifier = {
			set = 0
			OR = {
				is_pacifist = yes
				is_xenophile = yes
			}
		}
	}
}

# Gene Warrior Armies
gene_warrior_army = {
	damage = 2.0
	health = 2.5
	morale = 2.5
	morale_damage = 1.0
	collateral_damage = 0.75
	war_exhaustion = 3.0
	time = 150
	icon = GFX_army_type_gene_warrior

	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
		}
	}

	prerequisites = { "tech_gene_seed_purification" }
	potential_country = {
		is_machine_empire = no
		is_wilderness_empire = no
	}
	potential = {
		from = {
			NOR = {
				has_trait = "trait_mechanical"
				has_trait = "trait_machine_unit"
				is_sapient = no
			}
		}
	}

	ai_weight = {
		base = 100
		modifier = {
			set = 0
			is_fallen_empire = yes
			is_fanatic_xenophile = no
		}
	}
}

# Wilderness Pre-sapient Army
wilderness_pre_sapient_assault_army = {
	defensive = no
	is_pop_spawned = no
	health = 3.25
	damage = 1.50
	morale = 0.5
	morale_damage = 1.25
	has_morale = yes
	collateral_damage = 5.0
	war_exhaustion = 0.0
	icon = GFX_wilderness_army_type_assault
	prerequisites = { "tech_assault_armies" }
	has_species = no
	pop_limited = no
	resources = {
		category = armies
		cost = {
			food = 200
		}
		upkeep = {
			food = 1
			energy = 1
		}
	}
	time = 90
	show_tech_unlock_if = {
		is_wilderness_empire = yes
	}
	potential = {
		exists = owner
		owner = {
			is_wilderness_empire = yes
		}
	}
}

# Abominations
abomination_army = {
	damage = 1.33334 			# 2.00 - 4.00
	health = 1.5				# 300
	morale = 1.5				# 300
	morale_damage = 1.5			# 3.00 - 6.00
	collateral_damage = 2.50
	war_exhaustion = 0.50
	time = 100
	icon = GFX_army_type_slave

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

	prerequisites = { "tech_neural_implants" }

	show_tech_unlock_if = {
		is_twisted_experimenters_empire = yes
	}

	potential_country = {
		is_twisted_experimenters_empire = yes
		OR = {
			has_policy_flag = slavery_allowed
			has_exploited_disconnected_drones = yes
		}
		is_machine_empire = no
	}
	potential = {
		owner = {
			any_owned_pop_group = {
				is_enslaved = yes
				is_same_species = from
			}
		}
		from = {
			NOR = {
				has_trait = "trait_mechanical"
				has_trait = "trait_machine_unit"
				is_sapient = no
			}
		}
	}

	allow = {
		custom_tooltip = {
			fail_text = "requires_slave_processing_facility"
			OR = {
				has_building = building_slave_processing
				AND = {
					exists = orbital_defence
					orbital_defence = {
						exists = starbase
						starbase = {
							has_starbase_building = ring_slave_processing_facility
						}
					}
				}
			}
		}
		any_owned_pop_group = { is_enslaved = yes }
	}

	ai_weight = {
		base = 100
		modifier = {
			set = 0
			OR = {
				is_fallen_empire = yes
				NOT = { has_ai_personality_behaviour = slaver }
				has_technology = tech_telepathy
				has_technology = tech_gene_seed_purification
				AND = {
					is_militarist = yes
					has_technology = tech_gene_banks
				}
				AND = {
					has_ai_personality_behaviour = robot_liberator
					has_technology = tech_droid_workers
				}
			}
		}
	}
}

### Machine Empire Armies

# Hunter-Killer Armies
machine_assault_1 = {
	damage = 1.00
	health = 1.00
	has_morale = no
	morale_damage = 1.00
	collateral_damage = 2.0
	war_exhaustion = 0.5
	time = 90
	has_species = yes

	icon = GFX_army_type_machine_assault

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

		upkeep = {
			energy = 1
		}
	}

	potential_country = {
		is_machine_empire = yes
	}
	potential = {
		from = {
			has_trait = "trait_machine_unit"
		}
	}

	show_tech_unlock_if = {
		is_machine_empire = yes
	}

	prerequisites = { "tech_assault_armies" }

	ai_weight = {
		base = 100
		modifier = {
			set = 0
			has_technology = tech_adaptive_combat_algorithms
		}
	}
}

# Battle Frames
machine_assault_2 = {
	damage = 1.5
	health = 2.5
	has_morale = no
	morale_damage = 1.5
	collateral_damage = 2.0
	war_exhaustion = 1.0
	time = 120
	has_species = yes

	icon = GFX_army_type_machine_assault

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

		upkeep = {
			energy = 2
		}
	}

	potential_country = {
		is_machine_empire = yes
	}
	potential = {
		from = {
			has_trait = "trait_machine_unit"
		}
	}

	prerequisites = { "tech_adaptive_combat_algorithms" }

	ai_weight = {
		base = 100
	}
}

# Mega-Warform
machine_assault_3 = {
	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

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

		upkeep = {
			energy = 8
		}
	}

	potential_country = {
		is_machine_empire = yes
	}

	prerequisites = { "tech_biomechanics" }

	ai_weight = {
		base = 50
	}
}

# Undead Armies
undead_army = {
	damage = 1.00
	health = 1.00
	has_morale = no
	collateral_damage = 1.25
	morale_damage = 1.75
	war_exhaustion = 0.50
	time = 60
	icon = GFX_army_type_undead
	pop_limited = no
	disband_if_species_lacks_rights = no #i.e. if you resurrect your enemies, you get to keep these armies, even if you are a purifier
	prerequisites = { "tech_assault_armies" }

	resources = {
		category = armies
		cost = {
			energy = 100
		}

		upkeep = {
			energy = 0.75
		}
	}

	show_tech_unlock_if = {
		has_valid_civic = civic_reanimated_armies
	}

	potential_country = { has_valid_civic = civic_reanimated_armies }
	potential = {
		from = {
			NOR = {
				has_trait = "trait_mechanical"
				has_trait = "trait_machine_unit"
				is_sapient = no
			}
		}
		planet = {
			has_active_building = building_dread_encampment
		}
	}

	ai_weight = {
		base = 100
	}
}

# Warplings
warpling_army = {
	damage = 5.0
	morale_damage = 2.0
	collateral_damage = 0.50
	war_exhaustion = 0.50
	health = 2.5
	has_morale = no
	time = 100
	icon = GFX_army_type_xenomorph
	has_species = no

	resources = {
		category = armies
		cost = {
			astral_threads = 100
		}
		upkeep = {
			energy = 1
			astral_threads = 0.1
		}
	}

	potential_country = {
		has_astral_planes_dlc = yes
		has_country_flag = unlocked_warplings
	}

	ai_weight = {
		base = 100
	}
}

# Flamestorm Troopers Armies
flamestorm_troopers_army = {
	damage = 2.0
	health = 3.0
	morale = 3.0
	morale_damage = 3.0
	collateral_damage = 5.0
	war_exhaustion = 0.5
	time = 150
	icon = GFX_army_type_flamestorm

	resources = {
		category = armies
		cost = {
			astral_threads = 100
		}

		upkeep = {
			energy = 3
		}
	}

	potential_country = {
		has_astral_planes_dlc = yes
		has_country_flag = unlocked_flamestorm_troopers
	}

	ai_weight = {
		base = 100
		modifier = {
			set = 0
			is_fallen_empire = yes
		}
	}
}

### Machine Empire Armies

# IM Armies
individual_machine_assault_1 = {
	damage = 1.00
	health = 1.00
	morale = 1.00
	morale_damage = 1.00
	collateral_damage = 2.0
	war_exhaustion = 0.5
	time = 90
	has_species = yes

	icon = GFX_army_type_machine_assault

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

		upkeep = {
			energy = 1
		}
	}

	potential_country = {
		is_individual_machine = yes
	}
	potential = {
		from = {
			has_trait = "trait_machine_unit"
		}
	}

	show_tech_unlock_if = {
		is_individual_machine = yes
	}

	prerequisites = { "tech_assault_armies" }

	ai_weight = {
		base = 100
		modifier = {
			set = 0
			has_technology = tech_adaptive_combat_algorithms
		}
	}
}

# IM Armies 2
individual_machine_assault_2 = {
	damage = 1.5
	health = 2.5
	morale = 1.5
	morale_damage = 1.5
	collateral_damage = 2.0
	war_exhaustion = 1.0
	time = 120
	has_species = yes

	icon = GFX_army_type_machine_assault

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

		upkeep = {
			energy = 2
		}
	}

	potential_country = {
		is_individual_machine = yes
	}
	potential = {
		from = {
			has_trait = "trait_machine_unit"
		}
	}

	prerequisites = { "tech_adaptive_combat_algorithms" }

	ai_weight = {
		base = 100
	}
}

# IM Armies 3
individual_machine_assault_3 = {
	damage = 4.0
	health = 6.0
	morale = 2.0
	morale_damage = 1.5
	collateral_damage = 4.0
	war_exhaustion = 4.0
	time = 500
	has_species = no

	icon = GFX_army_type_machine_assault

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

		upkeep = {
			energy = 8
		}
	}

	potential_country = {
		is_individual_machine = yes
	}

	prerequisites = { "tech_biomechanics" }

	ai_weight = {
		base = 50
	}
}

# Perfected Clone Armies
perfected_clone_army = {
	damage = 1.5				# 2.25 - 4.50
	health = 1.5				# 300
	morale = 1.5				# 300
	morale_damage = 1			# 1.50 - 3.00
	collateral_damage = 0.50	# 50%
	war_exhaustion = 0.25		# 25%
	time = 30
	icon = GFX_army_type_clone
	pop_limited = no

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

		upkeep = {
			energy = 1
		}
	}

	show_tech_unlock_if = {
		OR = {
			has_active_tradition = tr_cloning_somatic_synthesization
			has_active_tradition = tr_cloning_somatic_synthesization_clone_army
		}
	}

	potential_country = {
		OR = {
			has_active_tradition = tr_cloning_somatic_synthesization
			has_active_tradition = tr_cloning_somatic_synthesization_clone_army
		}
	}
	potential = {
		from = {
			NOR = {
				has_trait = "trait_mechanical"
				has_trait = "trait_machine_unit"
				is_sapient = no
			}
		}
	}

	ai_weight = {
		base = 100
		modifier = {
			set = 0
			is_fallen_empire = yes
		}
		modifier = {
			factor = 2
			has_origin = origin_clone_army
		}
	}
}

# Ember Legion
ember_legion = {
	damage = 2.0
	morale_damage = 2.25
	collateral_damage = 1.25
	war_exhaustion = 0.25
	health = 2.5
	has_morale = yes
	time = 180
	icon = GFX_army_type_ember
	has_species = yes

	resources = {
		category = armies
		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 = 2 }
	}

	potential_country = { has_civic = civic_pyrolatry }
	potential = {
		from = {
			NOR = {
				has_trait = "trait_mechanical"
				has_trait = "trait_machine_unit"
				is_sapient = no
			}
		}
		planet = {
			habitability = {
				who = from
				value <= @inf_ember_legion_max_habitability
			}
		}
	}

	ai_weight = {
		base = 10
		modifier = {
			factor = 10
			has_ethic = ethic_fanatic_xenophobe
		}
		modifier = {
			set = 0
			OR = {
				is_pacifist = yes
				is_xenophile = yes
			}
		}
	}
}

# Living Metal Imbued Army
# Note: This army is available for regular and machine empires
lm_imbued_army = {
	damage = 2.0
	morale_damage = 2.0
	collateral_damage = 1.25
	war_exhaustion = 0.25
	health = 2.5
	has_morale = no
	time = 180
	icon = GFX_army_type_robot
	has_species = yes

	resources = {
		category = armies
		cost = { sr_living_metal = 150 }
		upkeep = {
			energy = 2
			minerals = 1
		}
	}

	potential_country = { is_galvanic_empire = yes }
	potential = {
		OR = {
			from = { has_trait = "trait_infernal" }
			owner = { has_valid_civic = civic_machine_galvanic_symbiosis }
		}
	}

	ai_weight = {
		base = 10
		modifier = {
			factor = 5
			has_ethic = ethic_fanatic_xenophobe
		}
		modifier = {
			factor = 2
			owner = {
				has_monthly_income = {
					resource = sr_living_metal
					value > 30
				}
			}
		}
		modifier = {
			factor = 5
			is_genocidal_infernal = yes
		}
	}
}
