#example = {
#	icons: Needs "GFX_planet_modifier_ground_support_NAME" and "GFX_fleet_order_button_ground_support_NAME" (hardcoded, no need to define here)
#
#	# root = fleet
#	trigger = {
#		always = yes
#	}
#
#	default = yes	# Is this the default stance that new fleets will use?
#
#	stop_when_armies_dead = yes	# Will this stance continue to bombard planets where all defensive armies are dead? default = no
#	stop_when_ground_combat = yes # If yes, this stance will stop bombarding a planet when there's ground combat happening on it. default = no
#	abduct_pops = no	# Will this stance attempt to abduct pops to your own planets instead of killing them? default = no
#
#	planet_damage = 0.5		# General scale of damage to planet, default = 1.0
#	army_damage = 1.0		# General scale of damage to armies, default = 1.0
#
#	kill_pop_chance = {		# Chance that a pop is killed when planetary damage reaches 100%, default = 0
#		base = 0.25
#	}
#	min_pops_to_kill_pop = 8	# Will not kill/abduct pops if pops <= this number already, default = 0. Doesn't work for nations that doesn't have diplomatic wars!
#
#	kill_pop_amount = { min = 0 max = 200 } # gives the range for how many pops are abducted/killed with each bombardment
#	# root = fleet
#	# from = planet
#	ai_weight = {
#		weight = 1
#	}
#}

selective = {
	trigger = {
		owner = {
			OR = {
				NOT = { is_country_type = default }
				has_policy_flag = orbital_bombardment_selective
				has_policy_flag = orbital_bombardment_indiscriminate
				has_policy_flag = orbital_bombardment_armageddon
			}
		}
		NOT = {
			any_owned_ship = {
				has_ship_flag = behemoth_hatchling_ship
			}
		}
	}

	default = yes

	stop_when_armies_dead = yes
	stop_when_ground_combat = yes
	accept_surrender = yes
	abduct_pops = no

	planet_damage = 0.5
	army_damage = 1.0

	kill_pop_chance = {
		base = 0.25
	}
	min_pops_to_kill_pop = 2100
	kill_pop_amount = { min = 0 max = 200 }

	# root = fleet
	# from = planet
	ai_weight = {
		weight = 1
	}
}

indiscriminate = {
	trigger = {
		owner = {
			OR = {
				NOT = { is_country_type = default }
				has_policy_flag = orbital_bombardment_indiscriminate
				has_policy_flag = orbital_bombardment_armageddon
			}
		}
		NOT = {
			any_owned_ship = {
				has_ship_flag = behemoth_hatchling_ship
			}
		}
	}

	default = no

	stop_when_armies_dead = no
	stop_when_ground_combat = no
	accept_surrender = yes
	abduct_pops = no

	planet_damage = 1.0
	army_damage = 1.5

	kill_pop_chance = {
		base = 0.5
	}
	min_pops_to_kill_pop = 1100
	kill_pop_amount = { min = 0 max = 200 }
	# root = fleet
	# from = planet
	ai_weight = {
		weight = 5
		modifier = {
			factor = 0.01
			exists = from
			from = {
				owner = { NOT = { is_hostile = root.owner } }
				NAND = {
					controller = { is_crisis_faction = yes }
					planet_garrison_strength > 0
				}
			}
		}
	}
}

armageddon = {
	trigger = {
		OR = {
			owner = {
				OR = {
					has_policy_flag = orbital_bombardment_armageddon
					is_crisis_faction = yes
					has_crisis_perk = menp_death_from_above		# Menace Perk: Death From Above
				}
			}
			AND = {
				owner = { is_mercenary = yes }
				controller = {
					OR = {
						has_policy_flag = orbital_bombardment_armageddon
						is_crisis_faction = yes
						has_menace_perk = menp_death_from_above		# Menace Perk: Death From Above
					}
				}
			}
		}
	}

	default = no

	stop_when_armies_dead = no
	stop_when_ground_combat = no
	abduct_pops = no

	planet_damage = 1.5
	army_damage = 2.0

	kill_pop_chance = {
		base = 1.0
	}
	min_pops_to_kill_pop = 0
	kill_pop_amount = { min = 0 max = 200 }

	# root = fleet
	# from = planet
	ai_weight = {
		weight = 10
		modifier = {
			factor = 0.01
			exists = from
			from = {
				owner = { NOT = { is_hostile = root.owner } }
				NAND = {
					controller = { is_crisis_faction = yes }
					planet_garrison_strength > 0
				}
			}
			exists = owner
			owner = { is_crisis_faction = no }
		}
	}
}


pox = {
	trigger = {
		owner = {
			OR = {
				has_relic = r_pox_sample
				AND = {
					owner = { is_mercenary = yes }
					root.controller = {
						has_relic = r_pox_sample
					}
				}
			}
			OR = {
				NOT = { is_country_type = default }
				has_policy_flag = orbital_bombardment_indiscriminate
				has_policy_flag = orbital_bombardment_armageddon
			}
		}
		NOT = {
			any_owned_ship = {
				has_ship_flag = behemoth_hatchling_ship
			}
		}
	}

	default = no

	stop_when_armies_dead = no
	stop_when_ground_combat = no
	abduct_pops = no

	planet_damage = 0.2
	army_damage = 1.5

	kill_pop_chance = { # Should only target organics
		base = 1.5
		modifier = {
		 	factor = 0
		 	species = {
		 		is_robotic_species = yes
		 	}
		}
	}
	min_pops_to_kill_pop = 0
	kill_pop_amount = { min = 0 max = 200 }

	# root = fleet
	# from = planet
	ai_weight = {
		weight = 10
		modifier = {
			factor = 0.01
			exists = from
			from = {
				owner = { NOT = { is_hostile = root.owner } }
			}
		}
	}
}

raiding = {
	trigger = {
		OR = {
			owner = { has_ascension_perk = ap_nihilistic_acquisition }
			owner = { has_valid_civic = civic_barbaric_despoilers }
			owner = { has_origin = origin_slavers }
			owner = { has_origin = origin_khan_successor }
			owner = { is_country_type = debt_collectors }
			AND = {
				owner = { is_mercenary = yes }
				controller = {
					OR = {
						has_ascension_perk = ap_nihilistic_acquisition
						has_valid_civic = civic_barbaric_despoilers
						has_origin = origin_slavers
						has_origin = origin_khan_successor
					}
				}
			}
		}
		NOT = {
			any_owned_ship = {
				has_ship_flag = behemoth_hatchling_ship
			}
		}
	}

	default = no

	stop_when_armies_dead = no
	stop_when_ground_combat = no
	abduct_pops = yes

	planet_damage = 0.5
	army_damage = 0.5

	kill_pop_chance = {
		base = 0.15
	}
	min_pops_to_kill_pop = 200
	kill_pop_amount = { min = 0 max = 200 }

	# root = fleet
	# from = planet
	ai_weight = {
		weight = 8
		modifier = {
			factor = 0
			exists = from
			from = {
				OR = {
					pop_amount < 200
					owner = { NOT = { is_hostile = root.owner } }
				}
			}
			NOT = {
				owner = { has_origin = origin_slavers }
			}
		}
		modifier = {
			factor = 0.01
			exists = from
			from = {
				owner = { has_claim = root.solar_system }
			}
			NOT = {
				owner = { has_origin = origin_slavers }
			}
		}
		modifier = {
			factor = 100
			owner = { has_origin = origin_slavers }
		}
	}
}

seed_bombing = {
	trigger = {
		AND = {
			owner = { has_origin = origin_fruitful }
			controller = { has_origin = origin_fruitful }
		}
	}

	default = no

	stop_when_armies_dead = no
	stop_when_ground_combat = no
	abduct_pops = no

	planet_damage = 1.0
	army_damage = 0.5

	kill_pop_chance = {
		base = 0
	}
	min_pops_to_kill_pop = 2100
	kill_pop_amount = { min = 0 max = 200 }

	# root = fleet
	# from = planet
	ai_weight = {
		weight = 50
		modifier = {
			factor = 0.01
			exists = from
			from = {
				owner = { NOT = { is_hostile = root.owner } }
				NAND = {
					controller = { is_crisis_faction = yes }
					planet_garrison_strength > 0
				}
			}
		}
	}
}

voidworm_invasion = {
	trigger = {
		is_ship_size = voidworms_titan
		owner = {
			NOT = { has_country_flag = voidworm_crisis_active }
		}
	}

	default = no

	stop_when_armies_dead = no
	stop_when_ground_combat = no
	abduct_pops = no

	planet_damage = {
		base = 1.0
		modifier = {
			factor = 2
			owner = {
				is_country_type = voidworms
			}
		}
		modifier = {
			factor = 0
			planet_devastation > 25
		}
		modifier = {
			factor = owner.value:scripted_modifier_mult|MODIFIER|voidworms_planet_orbital_bombardment_damage|
			exists = owner
		}
	}
	army_damage = 1.0

	kill_pop_chance = {
		base = 0.5
	}

	min_pops_to_kill_pop = 1000
	kill_pop_amount = { min = 0 max = 200 }

	ai_weight = {
		weight = 1000
	}
}

voidworm_invasion_crisis = {
	trigger = {
		owner = {
			is_country_type = voidworms_crisis
			has_country_flag = voidworm_crisis_active
		}
		is_ship_size = voidworms_titan
	}

	default = no

	stop_when_armies_dead = no
	stop_when_ground_combat = no
	abduct_pops = no

	planet_damage = {
		base = 2.0
		modifier = {
			factor = 0
			planet_devastation > 25
		}
		modifier = {
			factor = owner.value:scripted_modifier_mult|MODIFIER|voidworms_planet_orbital_bombardment_damage|
			exists = owner
		}
	}
	army_damage = 1.0

	kill_pop_chance = {
		base = 0.5
	}

	min_pops_to_kill_pop = 0
	kill_pop_amount = { min = 0 max = 200 }

	ai_weight = {
		weight = 1000
	}
}

frenzied_voidworm_invasion = {
	trigger = {
		owner = {
			is_country_type = frenzied_voidworms
		}
	}
	default = no
	planet_damage = 1.0
	ai_weight = {
		weight = 1000
	}
}

behemoth_invasion = {
	trigger = {
		any_owned_ship = {
			has_ship_flag = behemoth_hatchling_ship
		}
	}

	default = no

	stop_when_armies_dead = no
	stop_when_ground_combat = no
	abduct_pops = no

	planet_damage = 3.0
	army_damage = 1.0

	kill_pop_chance = {
		base = 2.0
	}
	# Also spawns hostile armies on planet - see biocrisis.80
	min_pops_to_kill_pop = 0

	# root = fleet
	# from = planet
	ai_weight = {
		weight = 1000
	}
}

firestorm = {
	trigger = {
		owner = {
			OR = {
				has_policy_flag = orbital_bombardment_devastation
				has_menace_perk = menp_hyperthermia_flames
			}
		}
	}

	default = no
	stop_when_armies_dead = no
	abduct_pops = no
	planet_damage = 1.25
	army_damage = 1.25
	kill_pop_chance = { base = 1.00 }
	min_pops_to_kill_pop = 0
	kill_pop_amount = { min = 0 max = 200 }

	# root = fleet
	# from = planet
	ai_weight = {
		weight = 10
		modifier = {
			factor = 0.01
			exists = from
			from = {
				owner = { NOT = { is_hostile = root.owner } }
				NAND = {
					controller = { is_crisis_faction = yes }
					planet_garrison_strength > 0
				}
			}
			exists = owner
			owner = { is_crisis_faction = no }
		}
	}
}

seismic_bombing = {
	trigger = { owner = { has_policy_flag = orbital_bombardment_devastation } }

	default = no
	stop_when_armies_dead = no
	abduct_pops = no
	planet_damage = 1.5
	army_damage = 2.0
	kill_pop_chance = { base = 1.25 }
	min_pops_to_kill_pop = 0
	kill_pop_amount = { min = 0 max = 200 }

	# root = fleet
	# from = planet
	ai_weight = {
		weight = 10
		modifier = {
			factor = 0.01
			exists = from
			from = {
				owner = { NOT = { is_hostile = root.owner } }
				NAND = {
					controller = { is_crisis_faction = yes }
					planet_garrison_strength > 0
				}
			}
			exists = owner
			owner = { is_crisis_faction = no }
		}
	}
}

plundering = {
	trigger = {
		owner = { has_valid_civic = civic_void_reavers }
		NOT = {
			any_owned_ship = {
				has_ship_flag = behemoth_hatchling_ship
			}
		}
	}

	default = no

	stop_when_armies_dead = no
	stop_when_ground_combat = no

	planet_damage = 1
	army_damage = 0.25

	kill_pop_chance = {
		base = 0.1
	}
	min_pops_to_kill_pop = 200
	kill_pop_amount = { min = 0 max = 200 }

	# root = fleet
	# from = planet
	ai_weight = {
		weight = 8
		modifier = { # AI doesn't plunder backwater planets with no resources
			factor = 0
			exists = from
			from = {
				has_upgraded_capital = no
			}
		}
	}
}
