##########################################
# ANOMALY CATEGORIES - Extreme Frontiers #
##########################################

# Pulsating Object anomaly
# PULSATING_OBJECT_CAT
PULSATING_OBJECT_TOXIC_CAT = {
	desc = anomaly_pulsating_object_desc
	level = 2
	picture = GFX_evt_atmospheric_entry

	spawn_chance = {
		modifier = {
			add = 3
			OR = {
				is_planet_class = pc_toxic
				is_planet_class = pc_gas_giant
				is_planet_class = pc_barren
				is_planet_class = pc_barren_cold
				is_planet_class = pc_frozen
				is_planet_class = pc_molten
			}
			has_shroud_dlc = yes
			has_any_strategic_resource = no
			NOT = { has_deposit_for = shipclass_mining_station }
		}
	}

	on_success = extreme_frontiers.100
}

# Molten Metal Ocean anomaly
MOLTEN_METAL_OCEAN_CAT = {
	desc = anomaly_molten_metal_ocean_desc
	level = 3
	picture = GFX_evt_molten

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_molten
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
	}

	on_success = extreme_frontiers.110
}

# Great Blue Spots anomaly
GREAT_BLUE_SPOTS_CAT = {
	desc = great_blue_spots_desc
	level = 2
	picture = GFX_evt_gas_giant

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_gas_giant
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
	}

	on_success = extreme_frontiers.120
}

# Frozen Inferno anomaly
FROZEN_INFERNO_CAT = {
	desc = frozen_inferno_desc
	level = 3
	picture = GFX_evt_ship_in_orbit

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_frozen
			has_shroud_dlc = yes
			has_deposit = no
			NOR = {
				has_modifier = frozen_terraforming_candidate
				has_deposit_for = shipclass_research_station
			}
		}
	}

	max_once = yes

	on_success = extreme_frontiers.130
}

# Poisoned Atmosphere anomaly
POISONED_ATMOSPHERE_CAT = {
	desc = poisoned_atmosphere_desc
	level = 3
	picture = GFX_evt_toxic

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_toxic
			has_shroud_dlc = yes
		}
	}

	on_success = extreme_frontiers.140
}

# Glimpse of the Core anomaly
GLIMPSE_CORE_CAT = {
	desc = glimpse_the_core_desc
	level = 5
	picture = GFX_evt_glimpse_core

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_gas_giant
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_research_station
				has_deposit = no
			}
		}
	}

	on_success = extreme_frontiers.150
}

# Optical Phenomena anomaly
OPTICAL_PHENOMENA_CAT = {
	desc = optical_phenomena_desc
	level = 6
	picture = GFX_evt_ship_in_orbit

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_frozen
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
	}

	max_once = yes

	on_success = extreme_frontiers.160
}

# Plasma Volcanoes anomaly
PLASMA_VOLCANO_CAT = {
	desc = plasma_volcano_desc
	level = 6
	picture = GFX_evt_ship_in_orbit

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_molten
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_research_station
				has_deposit = no
			}
			from.controller = { has_technology = tech_lasers_2 }
		}
	}

	max_once = yes

	on_success = extreme_frontiers.170
}

# Black Clouds anomaly
BLACK_CLOUDS_CAT = {
	desc = black_clouds_desc
	level = 5
	picture = GFX_evt_ship_in_orbit_3

	spawn_chance = {
		modifier = {
			add = 3
			OR = {
				is_planet_class = pc_toxic
				is_planet_class = pc_barren
				is_planet_class = pc_barren_cold
			}
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_research_station
				has_deposit = no
			}
		}
		modifier = {
			factor = 0
			from.leader = {
				owner_main_species = {
					OR = {
						is_robotic = yes
						is_lithoid = yes
					}
				}
			}
		}
	}

	on_success = extreme_frontiers.180
}

# Subglacial Vibrations anomaly
SUBGLACIAL_VIBRATIONS_CAT = {
	desc = subglacial_vibrations_desc
	level = 3
	picture = GFX_evt_frozen

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_frozen
			has_shroud_dlc = yes
			has_deposit = no
		}
		modifier = {
			factor = 0
			from.leader = {
				owner_main_species = { is_robotic = yes }
			}
		}
		modifier = {
			factor = 0
			from.controller = { is_ai = yes }
		}
	}

	max_once_global = yes

	on_success = extreme_frontiers.190
}

# Electric Waters anomaly
ELECTRIC_WATERS_CAT = {
	desc = electric_waters_desc
	level = 4
	picture = GFX_evt_ship_in_orbit_3

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_frozen
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
	}

	max_once = yes

	on_success = extreme_frontiers.200
}

# Obsidian Planet anomaly
OBSIDIAN_PLANET_CAT = {
	desc = obsidian_planet_desc
	level = 4
	picture = GFX_evt_ship_in_orbit_2

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_barren
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
	}

	max_once = yes

	on_success = extreme_frontiers.210
}

# Shearing Force anomaly
SHEARING_FORCE_CAT = {
	desc = shearing_force_desc
	level = 6
	picture = GFX_evt_gas_giant

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_gas_giant
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
	}

	max_once = yes

	on_success = extreme_frontiers.220
}

# Missing Mass anomaly
MISSING_MASS_CAT = {
	desc = missing_mass_desc
	level = 4
	picture = GFX_evt_ship_in_orbit_3

	spawn_chance = {
		modifier = {
			add = 3
			OR = {
				is_planet_class = pc_barren
				is_planet_class = pc_barren_cold
			}
			has_shroud_dlc = yes
			has_deposit = no
		}
	}

	on_success = extreme_frontiers.230
}

# Life in Darkness anomaly
LIFE_IN_DARKNESS_CAT = {
	desc = life_in_darkness_desc
	level = 2
	picture = GFX_evt_ship_in_orbit_2

	spawn_chance = {
		modifier = {
			add = 3
			OR = {
				is_planet_class = pc_barren
				is_planet_class = pc_barren_cold
			}
			has_shroud_dlc = yes
			has_deposit = no
			is_terraforming_candidate = no
		}
	}

	on_success = extreme_frontiers.240
}

# Rainbow Rivers anomaly
RAINBOW_RIVERS_CAT = {
	desc = rainbow_rivers_desc
	level = 4
	picture = GFX_evt_ship_in_orbit_2

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_toxic
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_research_station
				has_deposit = no
			}
		}
	}

	max_once = yes

	on_success = extreme_frontiers.250
}

# Gaseous Metals anomaly
GASEOUS_METALS_CAT = {
	desc = gaseous_metals_desc
	level = 6
	picture = GFX_evt_toxic

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_toxic
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
		modifier = {
			factor = 0
			from.controller = {
				country_uses_bio_ships = yes
			}
		}
	}

	on_success = extreme_frontiers.260
}

# Carborn Allotropes
CARBON_ALLOTROPES_CAT = {
	desc = carbon_allotropes_desc
	level = 5
	picture = GFX_evt_cold_barren

	spawn_chance = {
		modifier = {
			add = 3
			OR = {
				is_planet_class = pc_barren
				is_planet_class = pc_barren_cold
			}
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
		modifier = {
			factor = 0
			num_modifiers > 1
		}
	}

	on_spawn = {
		add_modifier = { modifier = carbon_world }
		from = {
			ship_event = {
				id = anomaly.6662 # add the minerals deposit
				scopes = {
					from = root
				}
			}
		}
	}

	on_success = extreme_frontiers.270
}

# Diamond Dust anomaly
DIAMOND_DUST_CAT = {
	desc = diamond_dust_desc
	level = 5
	picture = GFX_evt_ship_travel

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_gas_giant
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_research_station
				has_deposit = no
			}
		}
	}

	max_once = yes

	on_success = extreme_frontiers.280
}

# Extreme Geological Tension anomaly
GEOLOGICAL_TENSION_CAT = {
	desc = geological_tension_desc
	level = 3
	picture = GFX_evt_molten

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_molten
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
	}

	on_success = extreme_frontiers.290
}

# Layered Atmosphere anomaly
LAYERED_ATMOSPHERE_CAT = {
	desc = layered_atmosphere_desc
	level = 6
	picture = GFX_evt_gas_giant

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_gas_giant
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
	}

	max_once = yes

	on_success = extreme_frontiers.300
}

# Solidified Plasma Trails anomaly
PLASMA_TRAILS_CAT = {
	desc = plasma_trails_desc
	level = 5
	picture = GFX_evt_ship_in_orbit_3

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_frozen
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
	}

	max_once = yes

	on_success = extreme_frontiers.310
}

# Crystalline Plains anomaly
CRYSTALLINE_PLAINS_CAT = {
	desc = crystalline_plains_desc
	level = 5
	picture = GFX_evt_ship_in_orbit

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_frozen
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
	}

	max_once = yes

	on_success = extreme_frontiers.320
}

# Supermassive Giant anomaly
SUPERMASSIVE_GIANT_CAT = {
	desc = supermassive_giant_desc
	level = 3
	picture = GFX_evt_gas_giant

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_gas_giant
			has_shroud_dlc = yes
		}
		# has_modifier = extensive_moon_system
		# A planet with this modifier is prevented from spawning other anomalies.
		# Instead we check the same conditions as the modifier spawn and then spawn the modifier
		modifier = {
			factor = trigger:num_moons
		}
	}

	on_spawn = {
		add_modifier = { modifier = extensive_moon_system }
		from = {
			ship_event = {
				id = anomaly.6662 # add the minerals deposit
				scopes = {
					from = root
				}
			}
		}
	}

	on_success = extreme_frontiers.330
}

# Invisible Planet anomaly
INVISIBLE_PLANET_CAT = {
	desc = invisible_planet_desc
	level = 6
	picture = GFX_evt_star_chart

	spawn_chance = {
		modifier = {
			add = 3
			OR = {
				is_planet_class = pc_barren
				is_planet_class = pc_barren_cold
				is_planet_class = pc_frozen
				is_planet_class = pc_molten
			}
			solar_system = {
				num_planets_in_system >= 2
			}
			has_shroud_dlc = yes
		}
	}

	on_success = extreme_frontiers.340
}

# Survival Pod anomaly
# SURVIVAL_POD_CAT
SURVIVAL_POD_WARM_CAT = {
	picture = GFX_evt_warm_barren
	desc = survival_pod_desc
	level = 8

	spawn_chance = {
		modifier = {
			add = 3
			OR = {
				is_planet_class = pc_barren
				is_planet_class = pc_barren_cold
			}
			has_shroud_dlc = yes
			NOT = { exists = event_target:survivalist_scru }
		}
	}

	max_once_global = yes

	on_success = extreme_frontiers.350
}

# Infernal Tornadoes anomaly
INFERNAL_TORNADOES_CAT = {
	desc = infernal_tornadoes_desc
	level = 6
	picture = GFX_evt_molten

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_molten
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
	}

	max_once = yes

	on_success = extreme_frontiers.360
}

# Magma Megafauna anomaly
MAGMA_MEGAFAUNA_CAT = {
	desc = magma_megafauna_desc
	level = 4
	picture = GFX_evt_ship_in_orbit

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_molten
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
			from.controller = { has_technology = tech_volatile_motes }
		}
	}

	max_once = yes

	on_success = extreme_frontiers.370
}

# Planet Thrusters anomaly
PLANET_THRUSTERS_CAT = {
	desc = planet_thrusters_desc
	level = 5
	picture = GFX_evt_gas_giant_station

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_gas_giant
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
	}

	on_success = extreme_frontiers.380
}

# Backwards Orbit anomaly
BACKWARDS_ORBIT_CAT = {
	desc = backwards_orbit_desc
	level = 3
	picture = GFX_evt_ship_in_orbit_3

	spawn_chance = {
		modifier = {
			add = 3
			OR = {
				is_planet_class = pc_toxic
				is_planet_class = pc_barren
				is_planet_class = pc_barren_cold
				is_planet_class = pc_molten
				is_planet_class = pc_frozen
			}
			solar_system = {
				num_planets_in_system >= 3
				any_neighbor_system = {
					is_surveyed = {
						who = from.controller
						status = yes
					}
				}
			}
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_research_station
				has_deposit = no
			}
		}
	}

	on_success = extreme_frontiers.390
}

# Vapor Plumes anomaly
VAPOR_PLUMES_CAT = {
	desc = vapor_plumes_desc
	level = 2
	picture = GFX_evt_ship_in_orbit_2

	spawn_chance = {
		modifier = {
			add = 3
			OR = {
				is_planet_class = pc_barren_cold
				is_planet_class = pc_frozen
			}
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_research_station
				has_deposit = no
			}
		}
	}

	on_success = extreme_frontiers.400
}

# Fibrous Atmosphere anomaly
FIBROUS_ATMOSPHERE_CAT = {
	desc = fibrous_atmosphere_desc
	level = 5
	picture = GFX_evt_gas_giant

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_gas_giant
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
	}

	max_once = yes

	on_success = extreme_frontiers.410
}

# Exploding Skies anomaly
EXPLODING_SKIES_CAT = {
	desc = exploding_skies_desc
	level = 6
	picture = GFX_evt_ship_in_orbit_2

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_toxic
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
		}
	}

	max_once = yes

	on_success = extreme_frontiers.420
}

# Chthonian Preservation anomaly
CHTHONIAN_PRESERVATION_CAT = {
	desc = chthonian_preservation_desc
	level = 5
	picture = GFX_evt_ship_in_orbit_2

	spawn_chance = {
		modifier = {
			add = 3
			is_planet_class = pc_molten
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_mining_station
				has_deposit = no
			}
			from.controller = {
				has_encountered_tiyanki = yes
				is_catalytic_empire = no
			}
		}
		# has_modifier = chthonian_planet
		# A planet with this modifier is prevented from spawning other anomalies.
		# Instead we check the same conditions as the modifier spawn and then spawn the modifier
	}

	max_once = yes

	on_spawn = {
		add_modifier = { modifier = chthonian_planet }
		from = {
			ship_event = {
				id = anomaly.6662 # add the minerals deposit
				scopes = {
					from = root
				}
			}
		}
	}

	on_success = extreme_frontiers.430
}

# Orbital Resonance anomaly
ORBITAL_RESONANCE_CAT = {
	desc = orbital_resonance_desc
	level = 2
	picture = GFX_evt_star_chart

	spawn_chance = {
		modifier = {
			add = 3
			OR = {
				is_planet_class = pc_barren
				is_planet_class = pc_barren_cold
				is_planet_class = pc_frozen
				is_planet_class = pc_molten
				is_planet_class = pc_gas_giant
				is_planet_class = pc_toxic
			}
			solar_system = {
				num_planets_in_system >= 3
			}
			has_shroud_dlc = yes
			OR = {
				has_deposit_for = shipclass_research_station
				has_deposit = no
			}
		}
	}

	on_success = extreme_frontiers.440
}
