###########################
#
# Anomaly Events
# GAS GIANT CIVILIZATION
#
###########################

# Gas Giant Signal
ship_event = {
	id = anomaly.5000
	title = "anomaly.5000.name"
	desc = "anomaly.5000.desc"
	picture = GFX_evt_atmospheric_flight
	show_sound = event_alien_signal
	location = FROM
	trackable = yes

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			FROM = {
				set_planet_flag = tollok_rong
			}
		}
	}

	option = {
		name = anomaly.5000.a
		enable_special_project = {
			name = "GAS_GIANT_SIGNAL"
			location = FROM
		}
	}
	option = {
		name = anomaly.5000.b
	}
}

# Special Project Completed
ship_event = {
	id = anomaly.5001
	title = "PROJECT_COMPLETE"
	desc = "anomaly.5001.desc"
	picture = GFX_evt_physics_research
	show_sound = event_alien_signal
	location = FROMFROMFROM

	is_triggered_only = yes

	immediate = {
		from = { save_event_target_as = primitive_planet }
		owner = { country_event = { id = story.6 days = 30 } }
	}

	option = {
		name = "ONSCREEN"
		owner = {
			country_event = { id = anomaly.5003 }
		}
		hidden_effect = {
			random_galaxy_planet = {
				limit = { has_planet_flag = tollok_rong }
				set_name = "NAME_Tollok_Rong"
			}
		}
	}
}

# Special Project Failed
country_event = {
	id = anomaly.5002
	title = "PROJECT_FAILURE"
	desc = "anomaly.5002.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	show_sound = event_alien_signal
	location = FROMFROMFROM

	is_triggered_only = yes

	option = {
		name = UNFORTUNATE
	}
}

# Incoming Transmission
country_event = {
	id = anomaly.5003
	title = "anomaly.5003.name"
	desc = "anomaly.5003.desc"
	trackable = yes

	diplomatic = yes

	is_triggered_only = yes

	immediate = {
		save_event_target_as = MyCountry
	}

	picture_event_data = {
		room = no_video_feed_room
	}

	option = {
		name = anomaly.5003.a
		response_text = anomaly.5003.a.response
		is_dialog_only = yes
	}
	option = {
		name = anomaly.5003.b
		response_text = anomaly.5003.b.response
		is_dialog_only = yes
	}
	option = {
		name = anomaly.5003.c
		response_text = anomaly.5003.c.response
		is_dialog_only = yes
	}
	option = {
		name = anomaly.5003.d
		response_text = anomaly.5003.d.response
		closest_system = {
			limit = {
				OR = {
					has_owner = no
					owner = { is_same_value = root }
				}
				any_system_planet = { is_planet_class = pc_gas_giant }
			}
			min_steps = 1
			random_system_planet = {
				limit = { is_planet_class = pc_gas_giant }
				hidden_effect = {
					set_planet_flag = baldarak
					save_event_target_as = baldarak_planet
					clear_deposits = yes
				}
				enable_special_project = {
					name = "GAS_GIANT_RELOCATION"
					location = this
					owner = root
				}
			}
		}
	}
	option = {
		name = anomaly.5003.e
		response_text = anomaly.5003.e.response
	}
}

# Special Project Completed
ship_event = {
	id = anomaly.5004
	title = "PROJECT_COMPLETE"
	desc = "anomaly.5004.desc"
	picture = GFX_evt_cargoship_caravan
	show_sound = event_ship_thrusters
	location = FROMFROMFROM

	is_triggered_only = yes

	option = {
		name = anomaly.5004.a
		hidden_effect = {
			owner = {
				country_event = { id = anomaly.5006 }
			}
			random_galaxy_planet = {
				limit = { has_planet_flag = baldarak }
				set_surveyed = {
					surveyed = yes
					surveyor = root.owner
				}
				set_name = "NAME_Baldarak"
				add_modifier = {
					modifier = "gas_giant_civ"
					days = -1
				}
				clear_deposits = yes
				if = {
					limit = { has_mining_station = yes }
					mining_station = { dismantle = yes }
				}
			}
		}
		random_galaxy_planet = {
			limit = { has_planet_flag = baldarak }
			set_deposit = d_society_5
		}
	}
}

# Special Project Failed
country_event = {
	id = anomaly.5005
	title = "PROJECT_FAILURE"
	desc = "anomaly.5005.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	show_sound = event_alien_signal
	location = FROMFROM

	is_triggered_only = yes

	option = {
		name = UNFORTUNATE
	}
}

# Incoming Transmission
country_event = {
	id = anomaly.5006
	title = TRANSMISSION
	desc = "anomaly.5006.desc"

	diplomatic = yes

	is_triggered_only = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	specimen = dathnak_gas

	immediate = {
		hidden_effect = {
			set_country_flag = baldarak_settled
		}
	}

	option = {
		name = anomaly.5006.a
		trigger = {
			species = { NOT = { is_species = "Baldarak" } }
		}
		response_text = anomaly.5006.a.response
		is_dialog_only = yes
	}
	option = {
		name = anomaly.5006.a.2
		trigger = {
			species = { is_species = "Baldarak" }
		}
		response_text = anomaly.5006.a.2.response
		is_dialog_only = yes
	}
	option = {
		name = anomaly.5006.b
		response_text = anomaly.5006.b.response
	}
}

# New Colony
country_event = {
	id = anomaly.5007
	title = "anomaly.5007.name"
	desc = "anomaly.5007.desc"
	trackable = yes

	diplomatic = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	trigger = {
		has_country_flag = baldarak_settled
		NOT = { has_country_flag = new_baldarak_colony_request }
	}

	mean_time_to_happen = {
		months = 240
	}

	immediate = {
		set_country_flag = new_baldarak_colony_request
		save_event_target_as = MyCountry
	}

	option = {
		name = anomaly.5007.a
		response_text = anomaly.5007.a.response
		capital_scope = {
			closest_system = {
				limit = {
					OR = {
						has_owner = no
						owner = { is_same_value = root }
					}
					any_system_planet = {
						is_planet_class = pc_gas_giant
						NOR = {
							has_planet_flag = baldarak
							has_planet_flag = tollok_rong
						}
					}
				}
				min_steps = 1
				random_system_planet = {
					limit = {
						is_planet_class = pc_gas_giant
						NOR = {
							has_planet_flag = baldarak
							has_planet_flag = tollok_rong
						}
					}
					hidden_effect = {
						set_planet_flag = new_baldarak
						clear_deposits = yes
						if = {
							limit = { exists = orbital_station }
							orbital_station = { delete_fleet = this }
						}
						save_event_target_as = NewBaldarak
					}
					enable_special_project = {
						name = "GAS_GIANT_COLONY"
						location = event_target:NewBaldarak
						owner = event_target:MyCountry
					}
				}
			}
		}
	}

	option = {
		name = anomaly.5007.b
		response_text = anomaly.5007.b.response
	}
}

# Special Project Completed
ship_event = {
	id = anomaly.5008
	title = "PROJECT_COMPLETE"
	desc = "anomaly.5008.desc"
	picture = GFX_evt_cargoship_caravan
	show_sound = event_ship_thrusters
	location = FROMFROMFROM

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = {
				set_country_flag = new_baldarak_settled
			}
		}
	}

	option = {
		name = anomaly.5008.a
		random_galaxy_planet = {
			limit = { has_planet_flag = new_baldarak }
			hidden_effect = {
				set_name = "NAME_New_Baldarak"
				set_surveyed = {
					surveyed = yes
					surveyor = root.owner
				}
				add_modifier = {
					modifier = "gas_giant_colony"
					days = -1
				}
				clear_deposits = yes
				if = {
					limit = { has_mining_station = yes }
					mining_station = { dismantle = yes }
				}
			}
			set_deposit = d_society_3
		}
	}
}

# Chabky Raddh
country_event = {
	id = anomaly.5009
	title = "anomaly.5009.name"
	desc = "anomaly.5009.desc"
	trackable = yes

	diplomatic = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	trigger = {
		has_country_flag = new_baldarak_settled
		NOT = { has_country_flag = chabky_raddh }
	}

	immediate = {
		hidden_effect = {
			set_country_flag = chabky_raddh
		}
	}

	mean_time_to_happen = {
		months = 220
	}

	option = {
		name = anomaly.5009.a
		response_text = anomaly.5009.a.response
	}
	option = {
		name = anomaly.5009.b
		response_text = anomaly.5009.b.response
		random_galaxy_planet = {
			limit = {
				has_planet_flag = baldarak
			}
			enable_special_project = {
				name = "GAS_GIANT_LOST_CHABKY"
				location = this
				owner = root
			}
		}
	}
}

# Special Project Completed
ship_event = {
	id = anomaly.5010
	title = "PROJECT_COMPLETE"
	desc = "anomaly.5010.desc"
	picture = GFX_evt_atmospheric_flight
	show_sound = event_airlock
	location = fromfrom

	is_triggered_only = yes

	option = {
		name = anomaly.5010.a
		hidden_effect = {
			owner = {
				set_country_flag = chabky_raddh_done
			}
		}
	}
}

# Lost Contact
country_event = {
	id = anomaly.5011
	title = "anomaly.5011.name"
	desc = "anomaly.5011.desc"
	trackable = yes

	diplomatic = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	trigger = {
		has_country_flag = new_baldarak_settled
		has_country_flag = chabky_raddh_done
		NOT = { has_country_flag = new_baldarak_contact_lost }
	}

	immediate = {
		hidden_effect = {
			set_country_flag = new_baldarak_contact_lost
		}
	}

	mean_time_to_happen = {
		months = 120
	}

	option = {
		name = anomaly.5011.a
		response_text = anomaly.5011.a.response
		random_galaxy_planet = {
			limit = {
				has_planet_flag = new_baldarak
			}
			enable_special_project = {
				name = "GAS_GIANT_LOST_CONTACT"
				location = this
				owner = root
			}
		}
	}
	option = {
		name = anomaly.5011.b
		response_text = anomaly.5011.b.response
	}
}

# Special Project Completed
ship_event = {
	id = anomaly.5012
	title = "PROJECT_COMPLETE"
	desc = "anomaly.5012.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	show_sound = event_radio_chatter
	location = fromfrom

	is_triggered_only = yes

	immediate = {
		owner = {
			set_country_flag = new_baldarak_revolutionary_front
		}
	}

	option = {
		name = anomaly.5012.a
		hidden_effect = {
			owner = {
				country_event = { id = anomaly.5013 }
			}
		}
	}
}

# New Baldarak Revolutionary Front
country_event = {
	id = anomaly.5013
	title = "anomaly.5013.name"
	desc = "anomaly.5013.desc"
	trackable = yes

	diplomatic = yes

	is_triggered_only = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	option = {
		name = anomaly.5013.a
		response_text = anomaly.5013.a.response
		is_dialog_only = yes
	}
	option = {
		name = anomaly.5013.b
		response_text = anomaly.5013.b.response
		random_galaxy_planet = {
			limit = {
				has_planet_flag = baldarak
			}
			enable_special_project = {
				name = "GAS_GIANT_REVOLT"
				location = this
				owner = root
			}
		}
	}
	option = {
		name = anomaly.5013.c
		response_text = anomaly.5013.c.response
		hidden_effect = {
			country_event = { id = anomaly.5014 days = 35 random = 40 }
		}
	}
}

# Baldarak Responds
country_event = {
	id = anomaly.5014
	title = "anomaly.5014.name"
	desc = "anomaly.5014.desc"
	trackable = yes

	diplomatic = yes

	is_triggered_only = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	option = {
		name = anomaly.5014.a
		response_text = anomaly.5014.a.response
		random_galaxy_planet = {
			limit = {
				has_planet_flag = new_baldarak
			}
			enable_special_project = {
				name = "GAS_GIANT_OCCUPATION"
				location = this
				owner = root
			}
		}
	}
	option = {
		name = anomaly.5014.b
		response_text = anomaly.5014.b.response
	}
}

# Special Project Completed (Revolutionaries land on Baldarak)
ship_event = {
	id = anomaly.5015
	title = "PROJECT_COMPLETE"
	desc = "anomaly.5015.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit_3
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	show_sound = event_airlock
	location = FROMFROM

	is_triggered_only = yes

	option = {
		name = anomaly.5015.a
		hidden_effect = {
			owner = {
				country_event = { id = anomaly.5016 days = 35 random = 40 }
			}
		}
	}
}

# Revolutionaries Seize Control
country_event = {
	id = anomaly.5016
	title = "anomaly.5016.name"
	desc = "anomaly.5016.desc"

	diplomatic = yes

	is_triggered_only = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	immediate = {
		set_country_flag = baldarak_revolution_1
	}

	option = {
		name = anomaly.5016.a
	}
}

# Baldarak Announcement 1
country_event = {
	id = anomaly.5017
	title = "anomaly.5017.name"
	desc = "anomaly.5017.desc"

	diplomatic = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	trigger = {
		has_country_flag = baldarak_revolution_1
		NOT = { has_country_flag = baldarak_revolution_2 }
	}

	mean_time_to_happen = {
		months = 120
	}

	immediate = {
		set_country_flag = baldarak_revolution_2
		random_galaxy_planet = {
			limit = { has_planet_flag = baldarak }
			set_name = "NAME_Fotangia"
		}
		random_galaxy_planet = {
			limit = { has_planet_flag = new_baldarak }
			set_name = "NAME_Chabkymak"
		}
	}

	option = {
		name = "INTERESTING"
	}
	option = {
		name = anomaly.5017.b
		hidden_effect = {
			set_country_flag = dathnak_blocked
		}
	}
}

# Baldarak Announcement 2
country_event = {
	id = anomaly.5018
	title = "anomaly.5017.name"
	desc = "anomaly.5018.desc"

	diplomatic = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	trigger = {
		has_country_flag = baldarak_revolution_2
		NOR = {
			has_country_flag = baldarak_revolution_3
			has_country_flag = dathnak_blocked
		}
	}

	mean_time_to_happen = {
		months = 120
	}

	immediate = {
		set_country_flag = baldarak_revolution_3
	}

	option = {
		name = INTERESTING
	}
	option = {
		name = anomaly.5017.b
		hidden_effect = {
			set_country_flag = dathnak_blocked
		}
	}
}

# Baldarak Announcement 3
country_event = {
	id = anomaly.5019
	title = "anomaly.5017.name"
	desc = "anomaly.5019.desc"

	diplomatic = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	trigger = {
		has_country_flag = baldarak_revolution_3
		NOR = {
			has_country_flag = baldarak_revolution_4
			has_country_flag = dathnak_blocked
		}
	}

	mean_time_to_happen = {
		months = 120
	}

	immediate = {
		set_country_flag = baldarak_revolution_4
		random_galaxy_planet = {
			limit = { has_planet_flag = baldarak }
			set_name = "NAME_Baldarak"
		}
		random_galaxy_planet = {
			limit = { has_planet_flag = new_baldarak }
			set_name = "NAME_New_Baldarak"
		}
	}

	option = {
		name = INTERESTING
	}
}

# Special Project Completed (Expeditionary Force lands on New Baldarak)
ship_event = {
	id = anomaly.5020
	title = "PROJECT_COMPLETE"
	desc = "anomaly.5020.desc"
	picture = GFX_evt_cargoship_caravan
	show_sound = event_airlock
	location = FROMFROM

	is_triggered_only = yes

	option = {
		name = anomaly.5020.a
		hidden_effect = {
			owner = {
				country_event = { id = anomaly.5021 days = 35 random = 40 }
			}
		}
	}
}

# Expeditionary Force Seizes Control
country_event = {
	id = anomaly.5021
	title = "anomaly.5021.name"
	desc = "anomaly.5021.desc"

	diplomatic = yes

	is_triggered_only = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	immediate = {
		set_country_flag = new_baldarak_occupation_1
	}

	option = {
		name = anomaly.5021.a
	}
}

# New Baldarak Announcement 1
country_event = {
	id = anomaly.5022
	title = "anomaly.5022.name"
	desc = "anomaly.5022.desc"

	diplomatic = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	trigger = {
		has_country_flag = new_baldarak_occupation_1
		NOT = { has_country_flag = new_baldarak_occupation_2 }
	}

	mean_time_to_happen = {
		months = 120
	}

	immediate = {
		set_country_flag = new_baldarak_occupation_2
	}

	option = {
		name = INTERESTING
	}
	option = {
		name = anomaly.5017.b
	}
}

# New Baldarak Announcement 2
country_event = {
	id = anomaly.5023
	title = "anomaly.5022.name"
	desc = "anomaly.5023.desc"

	diplomatic = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	trigger = {
		has_country_flag = new_baldarak_occupation_2
		NOT = { has_country_flag = new_baldarak_occupation_3 }
	}

	mean_time_to_happen = {
		months = 120
	}

	immediate = {
		set_country_flag = new_baldarak_occupation_3
	}

	option = {
		name = INTERESTING
	}
	option = {
		name = anomaly.5017.b
	}
}

# New Baldarak Announcement 3
country_event = {
	id = anomaly.5024
	title = "anomaly.5017.name"
	desc = "anomaly.5024.desc"

	diplomatic = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	trigger = {
		has_country_flag = new_baldarak_occupation_3
		NOT = { has_country_flag = new_baldarak_occupation_4 }
	}

	mean_time_to_happen = {
		months = 120
	}

	immediate = {
		set_country_flag = new_baldarak_occupation_4
	}

	option = {
		name = INTERESTING
	}
}

# Baldarak Science Academy
country_event = {
	id = anomaly.5025
	title = "anomaly.5025.name"
	desc = "anomaly.5025.desc"

	diplomatic = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	trigger = {
		has_country_flag = new_baldarak_settled
		NOR = {
			has_country_flag = new_baldarak_contact_lost
			has_country_flag = baldarak_science_academy
		}
	}

	mean_time_to_happen = {
		months = 320
	}

	immediate = {
		set_country_flag = baldarak_science_academy
	}

	option = {
		name = anomaly.5025.a
		add_monthly_resource_mult = {
			resource = physics_research
			value = @tier3researchreward
			min = @tier3researchmin
			max = @tier3researchmax
		}
	}
}

# Spring Cleaning
country_event = {
	id = anomaly.5026
	title = "anomaly.5026.name"
	desc = "anomaly.5026.desc"

	diplomatic = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	trigger = {
		has_country_flag = new_baldarak_settled
		NOR = {
			has_country_flag = new_baldarak_contact_lost
			has_country_flag = baldarak_spring_cleaning
		}
	}

	mean_time_to_happen = {
		months = 320
	}

	immediate = {
		set_country_flag = baldarak_spring_cleaning
	}

	option = {
		name = anomaly.5026.a
		add_monthly_resource_mult = {
			resource = minerals
			value = @tier1materialreward
			min = @tier1materialmin
			max = @tier1materialmax
		}
	}
}


### Rogue Moon

#ship_event = {
#	id = anomaly.6000
#	title = anomaly.6000.name
#	desc = anomaly.6000.desc
#	picture = GFX_evt_ship_in_orbit
#	show_sound = event_alien_nature
#	location = FROM
#
#	is_triggered_only = yes
#
#	option = {
#		name = CURIOUS
#		owner = {
#			add_monthly_resource_mult = {
#				resource = physics_research
#				value = @tier2researchreward
#				min = @tier2researchmin
#				max = @tier2researchmax
#			}
#		}
#	}
#}
#
#### rogue moon base
#ship_event = {
#	id = anomaly.6001
#	title = anomaly.6000.name
#	desc = anomaly.6001.desc
#	picture = GFX_evt_ship_in_orbit
#	show_sound = event_alien_nature
#	location = FROM
#
#	is_triggered_only = yes
#
#	option = {
#		name = CURIOUS
#		owner = {
#			add_monthly_resource_mult = {
#				resource = engineering_research
#				value = @tier2researchreward
#				min = @tier2researchmin
#				max = @tier2researchmax
#			}
#		}
#	}
#}


### Surveying a modifier planet, replacing 6005
ship_event = {
	id = anomaly.6660
	title = anomaly.6005.name
	desc = {
		trigger = {
			hidden:from = {
				switch = {
					trigger = has_modifier
					hazardous_weather = { text = anomaly.6660.desc.weather }
					weak_magnetic_field = { text = anomaly.6660.desc.magnetic }
					strong_magnetic_field = { text = anomaly.6660.desc.magnetic }
					unstable_tectonics = { text = anomaly.6660.desc.tectonic }
					tidal_locked = { text = anomaly.6660.desc.tidal }
					chthonian_planet = { text = anomaly.6660.desc.resources }
					asteroid_impacts = { text = anomaly.6660.desc.impacts }
					extensive_moon_system = { text = anomaly.6660.desc.resources }
					carbon_world = { text = anomaly.6660.desc.resources }
					wild_storms = { text = anomaly.6660.desc.weather }
					low_gravity = { text = anomaly.6660.desc.gravity }
					high_gravity = { text = anomaly.6660.desc.gravity }
					#hollow_planet = { text = anomaly.6660.desc.hollow }
					dangerous_wildlife = { text = anomaly.6660.desc.wildlife }
					titanic_life = { text = anomaly.6660.desc.titan }
					mineral_rich = { text = anomaly.6660.desc.resources }
					ultra_rich = { text = anomaly.6660.desc.resources }
					asteroid_belt = { text = anomaly.6660.desc.resources }
					natural_beauty = { text = anomaly.6660.desc.beauty }
					atmospheric_aphrodisiac = { text = anomaly.6660.desc.atmosphere }
					atmospheric_hallucinogen = { text = anomaly.6660.desc.atmosphere }
					lush_planet = { text = anomaly.6660.desc.lush }
					bleak_planet = { text = anomaly.6660.desc.terrible }
					irradiated_planet = { text = anomaly.6660.desc.terrible }
					default = { text = anomaly.6660.desc.default }
				}
			}
		}
	}

	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	show_sound = event_mystic_reveal
	location = FROM

	is_triggered_only = yes

	trigger = {
		owner = {
			NOR = {
				is_tutorial_level = 0
				has_country_flag = discovered_modifier_planet
				is_machine_empire = yes
			}
		}
		from = {
			num_modifiers > 0
		}
	}

	immediate = {
		owner = { set_country_flag = discovered_modifier_planet }
	}

	option = {
		name = INTRIGUING
		custom_tooltip = anomaly.6660.a.tooltip
	}
}

#Machine Empire version
ship_event = {
	id = anomaly.6661
	title = anomaly.6005.name

	desc = {
		trigger = {
			hidden:from = {
				switch = {
					trigger = has_modifier
					hazardous_weather = { text = anomaly.6660.desc.weather }
					weak_magnetic_field = { text = anomaly.6660.desc.magnetic }
					strong_magnetic_field = { text = anomaly.6660.desc.magnetic }
					unstable_tectonics = { text = anomaly.6660.desc.tectonic }
					tidal_locked = { text = anomaly.6660.desc.tidal_mach }
					chthonian_planet = { text = anomaly.6660.desc.resources }
					asteroid_impacts = { text = anomaly.6660.desc.impacts }
					extensive_moon_system = { text = anomaly.6660.desc.resources }
					carbon_world = { text = anomaly.6660.desc.resources }
					wild_storms = { text = anomaly.6660.desc.weather }
					low_gravity = { text = anomaly.6660.desc.gravity_mach }
					high_gravity = { text = anomaly.6660.desc.gravity }
					#hollow_planet = { text = anomaly.6660.desc.hollow }
					dangerous_wildlife = { text = anomaly.6660.desc.wildlife }
					titanic_life = { text = anomaly.6660.desc.titan }
					mineral_rich = { text = anomaly.6660.desc.resources }
					ultra_rich = { text = anomaly.6660.desc.resources }
					asteroid_belt = { text = anomaly.6660.desc.resources }
					natural_beauty = { text = anomaly.6660.desc.beauty }
					atmospheric_aphrodisiac = { text = anomaly.6660.desc.atmosphere }
					atmospheric_hallucinogen = { text = anomaly.6660.desc.atmosphere_mach }
					lush_planet = { text = anomaly.6660.desc.lush_mach }
					bleak_planet = { text = anomaly.6660.desc.terrible_mach }
					irradiated_planet = { text = anomaly.6660.desc.terrible_mach }
					default = { text = anomaly.6660.desc.default }
				}
			}
		}
	}

	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	show_sound = event_mystic_reveal
	location = FROM

	is_triggered_only = yes

	trigger = {
		owner = {
			NOR = {
				is_tutorial_level = 0
				has_country_flag = discovered_modifier_planet
			}
			is_machine_empire = yes
		}
		from = {
			num_modifiers > 0
		}
	}

	immediate = {
		owner = { set_country_flag = discovered_modifier_planet }
	}

	option = {
		name = INTRIGUING
		custom_tooltip = anomaly.6660.a.tooltip
	}
}

# add deposits for mineral modifiers
ship_event = {
	id = anomaly.6662
	hide_window = yes

	is_triggered_only = yes

	trigger = {
		from = {
			NOT = {
				has_planet_flag = deposit_added
			}
			is_colonizable = no
			OR = {
				has_modifier = chthonian_planet
				has_modifier = extensive_moon_system
				#has_modifier = unstable_tectonics
				#has_modifier = ultra_rich
				#has_modifier = mineral_rich
				#has_modifier = asteroid_impacts
				has_modifier = carbon_world
				#has_modifier = asteroid_belt
			}
			NOR = {
				has_deposit = d_minerals_7
				has_deposit = d_minerals_8
				has_deposit = d_minerals_9
				has_deposit = d_minerals_10
				has_deposit = d_guardian_dragon_hoard
			}
		}
	}

	immediate = {
		from = {
			prevent_anomaly = yes
			hidden_effect = {
				from = {
					if = {
						limit = {
							NOT = { has_deposit_for = shipclass_mining_station }
						}
						clear_deposits = yes
					}
					set_planet_flag = deposit_added
					add_deposit = d_minerals_6
				}
			}
		}
	}
}

# Parvus Nanite Swarm
ship_event = {
	id = anomaly.6700
	title = "anomaly.6700.name"
	desc = "anomaly.6700.desc"
	picture = GFX_evt_gray_goo
	show_sound = event_air_raid_siren
	location = from
	event_chain = parvus_III_chain

	is_triggered_only = yes

	immediate = {
		from = {
			add_modifier = {
				modifier = nanite_swarm_modifier
				days = -1
			}
			set_carrier_flag = colony_event
			save_global_event_target_as = nanite_swarm_planet
		}
		owner = {
			begin_event_chain = {
				event_chain = parvus_III_chain
				target = this
			}
		}
	}

	option = {
		name = anomaly.6700.a
		tooltip = {
			from = {
				add_modifier = {
					modifier = nanite_swarm_modifier
				}
			}
			owner = {
				begin_event_chain = {
					event_chain = parvus_III_chain
					target = this
				}
			}
		}
		enable_special_project = {
			name = "STUDY_NANITE_SWARM"
			location = event_target:nanite_swarm_planet
			owner = root
		}
	}
}

ship_event = {
	id = anomaly.6705
	title = "anomaly.6705.name"
	desc = {
		trigger = {
			text = anomaly.6705.desc.start
			text = newline
			success_text = {
				text = anomaly.6705.desc.L
				owner = { has_country_flag = encountered_first_lgate }
			}
			success_text = {
				text = anomaly.6705.desc.noL
				owner = { NOT = { has_country_flag = encountered_first_lgate } }
			}
			text = anomaly.6705.desc.end
		}
	}
	picture = GFX_evt_gray_goo
	show_sound = event_mystic_reveal
	event_chain = parvus_III_chain

	is_triggered_only = yes

	option =  {
		allow = {
			owner = { has_technology = tech_self_aware_logic }
		}
		name = anomaly.6705.a
		owner = { generate_lcluster_clue = yes }
		enable_special_project = {
			name = "TAME_THE_SWARM"
			location = event_target:nanite_swarm_planet
			owner = root
		}
	}
	option =  {
		name = anomaly.6705.b
		owner = { generate_lcluster_clue = yes }
		custom_tooltip = anomaly.6705.b.tooltip
		owner = {
			switch = {
				trigger = has_technology
				tech_self_aware_logic = {
					add_monthly_resource_mult = {
						resource = physics_research
						value = @tier2researchreward
						min = @tier2researchmin
						max = @tier2researchmax
					}
				}
				tech_administrative_ai = {
					add_tech_option_or_research_effect = {
   						TECH = tech_self_aware_logic
   						PROGRESS = 0.7
   						CATEGORY = physics_research
					}
				}
				default = { give_technology = { tech = tech_administrative_ai }}
			}
			set_country_flag = studied_nanite_swarm
			end_event_chain = parvus_III_chain
		}
	}
	option =  {
		name = anomaly.6705.c
		owner = { generate_lcluster_clue = yes }
		enable_special_project = {
			name = "DESTROY_SWARM"
			location = event_target:nanite_swarm_planet
			owner = root.owner
		}
	}

	after = {
		owner = {
			country_event = { id = anomaly.6710 days = 80 random = 1000 }
		}
	}
}

country_event = {
	id = anomaly.6710
	title = "anomaly.6710.name"
	picture = GFX_evt_gray_goo
	show_sound = event_mystic_reveal
	desc = {
		trigger = {
			text = anomaly.6710.desc.start
			text = newline
			success_text = {
				text = anomaly.6710.desc.normal
				is_gestalt = no
			}
			success_text = {
				text = anomaly.6710.desc.gestalt
				is_gestalt = yes
			}
		}
	}
	fire_only_once = yes
	event_chain = parvus_III_chain
	is_triggered_only = yes

	trigger = {
		NOT = { has_country_flag = nanite_anomaly_followup }
		exists = event_target:nanite_swarm_planet
		has_country_flag = studied_nanite_swarm
		has_technology = tech_self_aware_logic
	}

	immediate = {
		set_country_flag = nanite_anomaly_followup
	}

	option =  {
		allow = {
			has_technology = tech_self_aware_logic
		}
		name = anomaly.6710.a
		enable_special_project = {
			name = "TAME_THE_SWARM"
			location = event_target:nanite_swarm_planet
			owner = root
		}
	}
	option =  {
		name = anomaly.6710.b
		enable_special_project = {
			name = "DESTROY_SWARM"
			location = event_target:nanite_swarm_planet
			owner = root
		}
	}
	option =  {
		name = anomaly.6710.c
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier5researchreward
				min = @tier5researchmin
				max = @tier5researchmax
			}
			add_resource = { influence = 200 }
			end_event_chain = parvus_III_chain
		}
	}
}

ship_event = {
	id = anomaly.6715
	title = "anomaly.6715.name"
	desc = "anomaly.6715.desc"
	picture = GFX_evt_gray_gooed_planet
	show_sound = event_laboratory_sound
	event_chain = parvus_III_chain

	is_triggered_only = yes

	option = {
		name = anomaly.6715.a
		event_target:nanite_swarm_planet = {
			remove_modifier = nanite_swarm_modifier
			add_modifier = {
				modifier = tamed_nanite_swarm_modifier
				days = -1
			}
		}
		if = {
			limit = {
				owner_species = {
					OR = {
						has_trait = trait_mechanical
						has_trait = trait_machine_unit
						has_trait = trait_pc_habitat_preference
						has_trait = trait_pc_shattered_ring_habitable_preference
						has_trait = trait_pc_ark_preference
					}
				}
			}
			event_target:nanite_swarm_planet = {
				change_pc = pc_gaia
				every_deposit = {
					limit = { is_blocker = yes }
					clear_blocker = yes
				}
			}
		}
		else = {
			event_target:nanite_swarm_planet = {
				change_pc = root.owner_species
				every_deposit = {
					limit = { is_blocker = yes }
					clear_blocker = yes
				}
			}
		}
		owner = {
			end_event_chain = parvus_III_chain
		}
	}

	after = {
		owner = {
			give_specimen = {
				key = ancient_nanites
				targets = { event_target:nanite_swarm_planet this }
			}
		}
	}
}

ship_event = {
	id = anomaly.6720
	title = "anomaly.6720.name"
	desc = "anomaly.6720.desc"
	picture = GFX_evt_death_from_above
	show_sound = event_space_battle
	event_chain = parvus_III_chain

	is_triggered_only = yes


	option = {
		name = EXCELLENT
		event_target:nanite_swarm_planet = {
			remove_modifier = nanite_swarm_modifier
			add_deposit = d_nano_corpses
		}
		owner = {
			end_event_chain = parvus_III_chain
		}
	}
}

carrier_event = {
	id = anomaly.6725
	title = "anomaly.6725.name"
	desc = "anomaly.6725.desc"
	picture = GFX_evt_dead_city
	show_sound = event_ghost_town
	event_chain = parvus_III_chain

	pre_triggers = {
		has_owner = yes
	}

	trigger = {
		has_modifier = nanite_swarm_modifier
		pop_amount > 0
	}
	mean_time_to_happen = {
		months = 6
	}

	immediate = {
		destroy_colony = yes
	}

	option = {
		name = anomaly.6725.a
	}
}

#Color of Science
ship_event = {
	id = anomaly.6740
	title = "anomaly.6740.name"
	desc = "anomaly.6740.desc"
	picture = GFX_evt_star_yellow
	show_sound = event_mystic_reveal
	location = from

	is_triggered_only = yes

	specimen = resonant_diffusion_crystal

	immediate = {
		owner = {
			set_country_flag = colorscience_divination_flag
		}
	}

	option = {
		trigger = {
			owner = {
				is_gestalt = no
			}
		}
		name = anomaly.6740.a
		hidden_effect = {
			FROM = {
				if = {
					limit = { NOT = { has_deposit_for = shipclass_research_station } }
					clear_deposits = yes
				}
			}
		}
		FROM = {
 			add_deposit = d_physics_4
		}
		owner = {
			add_modifier = {
				modifier = "new_resonance_music_art"
				years = 50
			}
		}
	}
	option = {
		trigger = {
			owner = {
				is_gestalt = yes
			}
		}
		name = anomaly.6740.a.gestalt
		hidden_effect = {
			FROM = {
				if = {
					limit = { NOT = { has_deposit_for = shipclass_research_station } }
					clear_deposits = yes
				}
			}
		}
		FROM = {
 			add_deposit = d_physics_4
		}
		owner = {
			add_modifier = {
				modifier = "new_resonance_study"
				years = 50
			}
		}
	}
	option = {
		name = anomaly.6740.b
		trigger = {
			owner = {
				NOT = {
					has_technology = tech_lasers_5
				}
			}
		}
		owner = {
			switch = {
				trigger = has_technology
				tech_lasers_4 = {
					add_tech_option_or_research_effect = {
   						TECH = tech_lasers_5
   						PROGRESS = 0.3
   						CATEGORY = physics_research
					}
				}
				tech_lasers_3 = {
					add_tech_option_or_research_effect = {
   						TECH = tech_lasers_4
   						PROGRESS = 0.4
   						CATEGORY = physics_research
					}
				}
				tech_lasers_2 = {
					add_tech_option_or_research_effect = {
   						TECH = tech_lasers_3
   						PROGRESS = 0.5
   						CATEGORY = physics_research
					}
				}
				tech_lasers_1 = {
					add_tech_option_or_research_effect = {
   						TECH = tech_lasers_2
   						PROGRESS = 0.6
   						CATEGORY = physics_research
					}
				}
				default = {
					add_tech_option_or_research_effect = {
   						TECH = tech_lasers_1
   						PROGRESS = 0.6
   						CATEGORY = physics_research
					}
				}
			}
		}
	}
}

ship_event = {
	id = anomaly.6745
	title = anomaly.6745.name
	desc = anomaly.6745.desc
	picture = GFX_evt_cold_barren
	show_sound = event_default
	location = from

	is_triggered_only = yes

	option = {
		name = anomaly.6745.a
		owner = {
			add_monthly_resource_mult = {
				resource = unity
				value = @tier1unityreward
				min = @tier1unitymin
				max = @tier1unitymax
			}
		}
	}

	option = {
		name = anomaly.6745.b
		owner = {
			add_monthly_resource_mult = {
				resource = unity
				value = @tier1unityreward
				min = @tier1unitymin
				max = @tier1unitymax
			}
		}
	}

	after = {
		from = {
			add_modifier = {
				modifier = "terraforming_candidate"
				days = -1
			}
		}
	}
}

ship_event = {
	id = anomaly.6750
	title = anomaly.6750.name
	desc = anomaly.6750.desc
	picture = GFX_evt_cold_barren
	show_sound = event_default
	location = from

	is_triggered_only = yes


	option = {
		name = INTERESTING
		from = {
			add_modifier = {
				modifier = "terraforming_candidate"
				days = -1
			}
		}
	}
}

###########################
#
# Anomaly Events
# FUMONGUS
#
###########################

# Fungal Emitters (Network Dormant)
ship_event = {
	id = anomaly.6755
	title = "anomaly.6755.name"
	desc = "anomaly.6755.desc"
	picture = GFX_evt_barren_dig_site
	show_sound = event_alien_signal
	location = FROM
	trackable = yes

	is_triggered_only = yes

	option = {
		name = anomaly.6755.a
		enable_special_project = {
			name = "FOLLOWING_FUNGI_PROJECT"
			location = FROM
		}
	}
	option = {
		name = anomaly.6755.b
		owner = {
			add_monthly_resource_mult = {
				resource = energy
				value = @tier1materialreward
				min = @tier1materialmin
				max = @tier1materialmax
			}
		}
	}
	option = {
		name = anomaly.6755.c
		owner = {
			add_monthly_resource_mult = {
				resource = unity
				value = @tier1unityreward
				min = @tier1unitymin
				max = @tier1unitymax
			}
		}
	}
}

# Fungal Emitters (Network Active)

ship_event = {
	id = anomaly.6760
	title = "anomaly.6755.name"
	desc = "anomaly.6760.desc"
	picture = GFX_evt_barren_dig_site
	show_sound = event_alien_signal
	location = FROM
	trackable = yes

	is_triggered_only = yes

	option = {
		name = anomaly.6760.a
		from = {
			enable_special_project = {
				name = "MUSHROOMING_NETWORK_PROJECT"
				location = this
				owner = root.owner
			}
		}
	}
	option = {
		name = anomaly.6760.b
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
		}
	}
}

# Fungal Emitters (Network Dismantled)

ship_event = {
	id = anomaly.6765
	title = "anomaly.6755.name"
	desc = "anomaly.6765.desc"
	picture = GFX_evt_barren_dig_site
	show_sound = event_alien_signal
	location = FROM
	trackable = yes

	is_triggered_only = yes

	option = {
		name = anomaly.6760.b
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
		}
	}
	option = {
		name = anomaly.6755.b
		owner = {
			add_monthly_resource_mult = {
				resource = energy
				value = @tier1materialreward
				min = @tier1materialmin
				max = @tier1materialmax
			}
		}
	}
	option = {
		name = anomaly.6755.c
		owner = {
			add_monthly_resource_mult = {
				resource = influence
				value = @tier1influencereward
				min = @tier1influencemin
				max = @tier1influencemax
			}
		}
	}
}

# Special Project FOLLOWING_FUNGI Completed
# System located

ship_event = {
	id = anomaly.6770
	title = "anomaly.6770.name"
	desc = "anomaly.6770.desc"
	picture = GFX_evt_ship_travel
	show_sound = event_alien_signal
	location = FROM
	trackable = yes

	is_triggered_only = yes

	immediate = {
		event_target:fumongus_planet.solar_system = {
			save_event_target_as = fumongus_system
		}
		owner = { set_visited = event_target:fumongus_system }
	}

	option = {
		name = anomaly.6770.a
		owner = {
			begin_event_chain = {
				event_chain = fumongus_chain
				target = this
			}
			create_point_of_interest = {
				id = fumongus_poi.1
				name = "fumongus_poi_1"
				desc = "fumongus_1_desc"
				event_chain = "fumongus_chain"
				location = event_target:fumongus_system
			}
		}
	}
}

#clear the situation log when entering the target system.
fleet_event = {
	id = anomaly.6775

	hide_window = yes

	is_triggered_only = yes

	trigger = {
		from = { has_star_flag = fumongus_system }
	}

	immediate = {
		owner = {
			remove_point_of_interest = "fumongus_poi.1"
			end_event_chain = "fumongus_chain"
		}
	}
}

# Unable to trace the signal

ship_event = {
	id = anomaly.6780
	title = "anomaly.6770.name"
	desc = "anomaly.6780.desc"
	picture = GFX_evt_ship_travel
	show_sound = event_alien_signal
	location = FROM
	trackable = yes

	is_triggered_only = yes

	option = {
		name = INTRIGUING
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
		}
	}
}

# Special Project MUSHROOMING_NETWORK Completed

country_event = {
	id = anomaly.6785
	title = "anomaly.6785.name"
	desc = "anomaly.6785.desc"
	picture = GFX_evt_spymaster
	show_sound = event_alien_signal
	location = FROM
	trackable = yes

	is_triggered_only = yes

	specimen = mutated_fumongus

	option = {
		name = EXCELLENT
		owner = {
			remove_modifier = mycelial_network_modifier

			add_modifier = {
				modifier = mycelial_network_modifier_improved
				days = -1
			}
		}
	}
}

###########################
#
# Anomaly Events
# LOST SOUL by Brian Campbell
#
###########################

ship_event = {
	id = anomaly.6786
	title = anomaly.6786.name
	desc = anomaly.6786.desc
	picture = GFX_evt_star_neutron
	show_sound = event_ship_bridge
	location = FROM
	trackable = yes

	is_triggered_only = yes

	immediate = {
		from = {
			if = {
				limit = {
					NOT = { has_deposit_for = shipclass_mining_station }
				}
				clear_deposits = yes
			}
		}
	}

	option = {
		name = anomaly.6786.a
		FROM = {
			add_deposit = d_minerals_3
			custom_tooltip = anomaly.6786.a.tooltip
		}
		hidden_effect = {
			ship_event = { id = anomaly.6787 days = 5 }
		}
	}

	option = {
		name = anomaly.6786.b
		custom_tooltip = anomaly.6786.b.tooltip
	}
}

ship_event = {
	id = anomaly.6787
	title = anomaly.6787.name
	desc = anomaly.6787.desc
	picture = GFX_evt_star_neutron
	show_sound = event_ship_bridge
	location = FROM
	is_triggered_only = yes
	trackable = yes

	specimen = castaway_robot

	option = {
		name = "FASCINATING"
	}
}

# TEMPORAL PRISM

ship_event = {
	id = anomaly.6788
	title = "anomaly.6788.name"
	desc = "anomaly.6788.desc"
	picture = GFX_evt_clocks
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

	immediate = {
		from = {
			if = {
				limit = {
					NOT = { has_deposit_for = shipclass_research_station }
				}
				clear_deposits = yes
			}
		}
	}

	option = {
		name = FASCINATING
		FROM = {
			add_deposit = d_physics_3
		}
	}
}

## Ghost Ship ##

ship_event = {
	id = "anomaly.6791"
	title = "anomaly.6791.name"
	desc = "anomaly.6791.desc"
	picture = GFX_evt_ghost_ship
	show_sound = evn_ove_ghost_ships
	location = FROM
	trackable = yes

	is_triggered_only = yes

	immediate = {
		owner = {
			set_country_flag = met_ubume
			if = {
				limit = {
					has_psionic_species_trait = yes
				}
				set_country_flag = ubume_psionic
			}
		}
	}

	option = {
		name = "anomaly.6791.a"
		from = {
			enable_special_project = {
				name = "GHOST_SHIP_PROJECT"
				location = this
				owner = root.owner
			}
		}
	}
}

ship_event = {
	id = "anomaly.6792"
	title = "anomaly.6792.name"
	desc = {
		trigger = {
			owner = {
				has_psionic_species_trait = no
			}
		}
		text = "anomaly.6792.desc"
	}
	desc = {
		trigger = {
			owner = {
				has_psionic_species_trait = yes
				is_robot_empire = no
				is_gestalt = no
			}
		}
		text = "anomaly.6792.alt.desc"
	}
	desc = {
		trigger = {
			owner = {
				has_psionic_species_trait = yes
				OR = {
					is_robot_empire = yes
					is_gestalt = yes
				}
			}
		}
		text = "anomaly.6792.alt_hive_robot.desc"
	}
	picture = GFX_evt_ghost_ship
	show_sound = evn_ove_ghost_ships
	location = FROM
	trackable = yes

	is_triggered_only = yes

	option = {
		trigger = {
			owner = {
				is_psionic_species = no
			}
		}
		name = "anomaly.6792.a"
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier2researchreward
				min = @tier2researchmin
				max = @tier2researchmax
			}
		}
	}

	option = {
		trigger = {
			owner = {
				is_psionic_species = yes
			}
		}
		name = "anomaly.6792.b"
		owner = {
			hidden_effect = {
				country_event = {
					id = anomaly.6795
					days = 360
				}
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier2researchreward
				min = @tier2researchmin
				max = @tier2researchmax
			}
		}
	}
}

# Ghost Ship follow-up event - for latent psionics

country_event = {
	id = "anomaly.6793"
	title = "anomaly.6793.name"
	desc = {
		trigger = {
			is_gestalt = no
			is_robot_empire = no
		}
		text = "anomaly.6793.desc"
	}
	desc = {
		trigger = {
			OR = {
				is_gestalt = yes
				is_robot_empire = yes
			}
		}
		text = "anomaly.6793.desc.hive_robot"
	}
	picture = GFX_evt_ship_in_orbit
	show_sound = event_default
	location = event_target:hillos_country
	trackable = yes

	is_triggered_only = yes

	trigger = {
		owner = {
			has_country_flag = met_ubume
			is_psionic = yes
			NOR = {
				has_country_flag = ubume_talking
				has_country_flag = ubume_psionic
			}
		}
	}

	immediate = {
		set_country_flag = ubume_talking
	}

	option = {
		name = REMARKABLE
		event_target:hillos_asteroid = {
			enable_special_project = {
				name = "GHOST_SHIP_PROJECT_02"
				location = this
				owner = root
			}
		}
	}
}

country_event = {
	id = "anomaly.6794"
	title = "anomaly.6794.name"
	desc = {
		trigger = {
			is_gestalt = no
			is_robot_empire = no
		}
		text = "anomaly.6794.desc"
	}
	desc = {
		trigger = {
			OR = {
				is_gestalt = yes
				is_robot_empire = yes
			}
		}
		text = "anomaly.6794.desc.hive_robot"
	}

	picture = GFX_evt_space_debris
	show_sound = event_default
	location = event_target:hillos_country
	trackable = yes

	is_triggered_only = yes

	option = {
		name = {
			trigger = {
				is_gestalt = no
				is_robot_empire = no
			}
			text = "anomaly.6794.a"
		}
		name = {
			trigger = {
				OR = {
					is_gestalt = yes
					is_robot_empire = yes
				}
			}
			text = "anomaly.6794.a.hive_robot"
		}
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier2researchreward
				min = @tier2researchmin
				max = @tier2researchmax
			}
		}
	}
}

country_event = {
	id = "anomaly.6795"
	title = "anomaly.6794.name"
	desc = {
		trigger = {
			is_gestalt = no
			is_robot_empire = no
		}
		text = "anomaly.6795.desc"
	}
	desc = {
		trigger = {
			OR = {
				is_gestalt = yes
				is_robot_empire = yes
			}
		}
		text = "anomaly.6795.desc.hive_robot"
	}

	picture = GFX_evt_space_debris
	show_sound = event_default
	location = event_target:hillos_country
	trackable = yes

	is_triggered_only = yes

	option = {
		name = "anomaly.6795.a"
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier2researchreward
				min = @tier2researchmin
				max = @tier2researchmax
			}
		}
	}
}

###########################
#
# Anomaly Events
# By Victor Haeggman
#
###########################

ship_event = {
	id = anomaly.6800
	title = "anomaly.6800.name"
	desc = "anomaly.6800.desc"
	picture = GFX_evt_junkheap
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

	immediate = {
		owner = { country_event = { id = story.5 days = 30 } }
	}

	option = {
		name = anomaly.6800.a
		owner = {
			switch = {
				trigger = has_technology
				tech_afterburners_1 = {
					add_tech_option_or_research_effect = {
   						TECH = tech_afterburners_2
   						PROGRESS = 0.5
   						CATEGORY = engineering_research
					}
				}
				default = {
   					give_technology = { tech = tech_afterburners_1 }
				}
			}
		}
	}
	option = {
		name = anomaly.6800.b
		hidden_effect = {
			from = {
				if = {
					limit = {
						NOT = { has_deposit_for = shipclass_mining_station }
					}
					clear_deposits = yes
				}
				add_modifier = {
					modifier = "ship_graveyard"
					days = -1
				}
			}
		}
		from = { add_deposit = d_alloys_3 }
	}
}

ship_event = {
	id = anomaly.6805
	title = "anomaly.6805.name"
	desc = "anomaly.6805.desc"
	picture = GFX_evt_glitchy_matrix
	show_sound = event_airlock
	location = FROM

	is_triggered_only = yes

	immediate = {
		owner = { country_event = { id = story.5 days = 30 } }
	}

	option = {
		name = anomaly.6805.a
		owner = {
			add_modifier = {
				modifier = "asteroid_relay_stations"
				days = -1
			}
			give_specimen = { key = ancient_sensor }
		}
	}
	option = {
		name = anomaly.6805.b
		owner = {
			add_modifier = {
				modifier = "asteroid_encryption"
				days = -1
			}
		}
	}
}

ship_event = { #Giant Alien Spiders are no Joke
	id = anomaly.6810
	title = "anomaly.6810.name"
	desc = "anomaly.6810.desc"
	picture = GFX_evt_mining_station
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

	immediate = {
		owner = { country_event = { id = story.5 days = 30 } }
	}

	option = {
		name = anomaly.6810.a
		random_list = {
			50 = {
				kill_leader = { class = scientist show_notification = yes }
			}
			50 = {
				owner = {
					switch = {
						trigger = has_technology
						tech_hyper_drive_2 = {
							add_tech_option_or_research_effect = {
   								TECH = tech_hyper_drive_3
   								PROGRESS = 0.3
   								CATEGORY = physics_research
							}
						}
						tech_hyper_drive_1 = {
							add_tech_option_or_research_effect = {
   								TECH = tech_hyper_drive_2
   								PROGRESS = 0.5
   								CATEGORY = physics_research
							}
						}
						default = {
   							give_technology = { tech = tech_hyper_drive_1 }
						}
					}
					create_message = {
						type = MESSAGE_TYPE_HYPERDRIVE_SECURED
						localization = MESSAGE_HYPERDRIVE_SECURED
						days = 30
						target = root
					}
				}
			}
		}
	}

	option = {
		name = anomaly.6810.b
		owner = { add_resource = { influence = 50 } }
	}
	option = {
		name = anomaly.6810.c
		trigger = {
			OR = {
				has_leviathans = yes
				has_distar = yes
			}
			owner = {
				is_species_class = ART
				is_homicidal = no
			}
			solar_system = {
				NOR = {
					has_star_flag = enclave
					has_star_flag = lcluster
					has_star_flag = sealed_system
					has_star_flag = surveillance_supercomputer_system
				}
			}
		}
		hidden_effect = {
			if = {
				limit = {
					owner = { species_portrait = art16 }
				}
				create_species = {
					name = random
					class = ART
					portrait = art13
					traits = {
						ideal_planet_class = pc_habitat
						trait = random_traits
					}
				}
			}
			else = {
				create_species = {
					name = random
					class = ART
					portrait = art16
					traits = {
						ideal_planet_class = pc_habitat
						trait = random_traits
					}
				}
			}
			last_created_species = {
				save_event_target_as = giant_alien_curators
			}
			solar_system = { set_star_flag = enclave }
			owner = {
				country_event = {
					id = anomaly.6815
					scopes = { from = prev }
				}
			}
		}
	}
	option = {
		trigger = {
			owner = {
				OR = {
					has_void_dweller_origin = yes
					has_technology = tech_habitat_1
				}
			}
		}
		name = anomaly.6810.d
		custom_tooltip = anomaly.6810.d.tooltip
		owner = {
			switch = {
				trigger = has_technology
				tech_hyper_drive_2 = {
					add_tech_option_or_research_effect = {
   						TECH = tech_hyper_drive_3
   						PROGRESS = 0.3
   						CATEGORY = physics_research
					}
				}
				tech_hyper_drive_1 = {
					add_tech_option_or_research_effect = {
   						TECH = tech_hyper_drive_2
   						PROGRESS = 0.5
   						CATEGORY = physics_research
					}
				}
				default = {
   					give_technology = { tech = tech_hyper_drive_1 }
				}
			}
		}
	}
	option = {
		trigger = {
			owner = {
				has_origin = origin_evolutionary_predators
			}
		}
		name =  anomaly.6810.e.evopred
		owner = { give_evolutionary_predator_situation_progress_and_dna = { AMOUNT = small TYPE = arthropoid } }
	}
}

country_event = {
	id = anomaly.6815
	title = anomaly.6815.name
	desc = anomaly.6815.desc
	is_triggered_only = yes
	diplomatic = yes
	custom_gui = "enclave_curator_window"

	picture_event_data = {
		portrait = event_target:giant_alien_curators
		room = enclave_curator_room
	}

	option = {
		name = anomaly.6815.a
		hidden_effect = {
			country_event = {
				id = anomaly.6820
				scopes = { from = from.solar_system }
			}
		}
	}
}

country_event = {
	id = anomaly.6820
	title = anomaly.6815.name
	desc = anomaly.6820.desc
	is_triggered_only = yes
	diplomatic = yes
	custom_gui = "enclave_curator_window"

	picture_event_data = {
		portrait = event_target:giant_alien_curators
		room = enclave_curator_room
	}

	option = {
		name = anomaly.6820.a
		if = {
			limit = {
				exists = event_target:curator_enclave_country
				NOT = { has_communications = event_target:curator_enclave_country }
			}
			establish_communications = event_target:curator_enclave_country
			event_target:curator_enclave_country = {
				establish_communications = root
			}
		}
		switch = {
			trigger = has_technology
			tech_hyper_drive_2 = {
				add_tech_option_or_research_effect = {
   					TECH = tech_hyper_drive_3
   					PROGRESS = 0.3
   					CATEGORY = physics_research
				}
			}
			tech_hyper_drive_1 = {
				add_tech_option_or_research_effect = {
   					TECH = tech_hyper_drive_2
   					PROGRESS = 0.5
   					CATEGORY = physics_research
				}
			}
			default = {
   				give_technology = { tech = tech_hyper_drive_1 }
			}
		}
	}

	after = {
		give_specimen = {
			key = curator_survey
			targets = { from }
		}
	}
}

ship_event = {
	id = anomaly.6825
	title = "anomaly.6825.name"
	desc = {
		trigger = {
			text = anomaly.6825.desc.start
			text = newline
			success_text = {
				text = anomaly.6825.desc.nofood
				owner = { country_uses_food = no }
			}
			success_text = {
				text = anomaly.6825.desc.food
				owner = { country_uses_food = yes }
			}
		}
	}
	picture = GFX_evt_hive
	show_sound = event_crystal_ship
	location = FROM

	is_triggered_only = yes

	immediate = {
		owner = { country_event = { id = story.1 days = 30 } }
		from = {
			clear_deposits = yes
		}
	}

	option = {
		name = CURIOUS
		from = { add_deposit = d_society_4 }
	}
	option = {
		trigger = {
			owner = { country_uses_food = yes }
		}
		name = anomaly.6825.b
		from = { add_deposit = d_food_3 }
		hidden_effect = {
			from = { set_planet_flag = edible_crystals }
			owner = { set_country_flag = discovered_edible_crystals }
		}
	}

	after = {
		owner = {
			give_specimen = {
				key = planet_crystalose
				targets = { root.from }
			}
		}
	}
}

ship_event = {
	id = anomaly.6830

	trigger = {
		from = { has_planet_flag = edible_crystals }
		owner = { has_country_flag = discovered_edible_crystals }
	}
	fire_only_once = yes
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		owner = { country_event = { id = anomaly.6835 days = 1800 random = 100 } }
	}
}

country_event = {
	id = anomaly.6835
	title = "anomaly.6835.name"
	desc = "anomaly.6835.desc"
	picture = GFX_evt_hive
	show_sound = event_crystal_ship

	is_triggered_only = yes

	option = {
		name = anomaly.6835.a
		custom_tooltip = anomaly.6835.a.tooltip
		hidden_effect = {
			while = {
				count = 3
				random_planet_within_border = {
					limit = {
						is_asteroid = yes
						NOR = {
							has_deposit_for = shipclass_mining_station
							has_deposit_for = shipclass_research_station
						}
					}
					add_deposit = d_food_3
				}
			}
		}
	}
	option = {
		name = anomaly.6835.b
		add_monthly_resource_mult = {
			resource = unity
			value = @tier2unityreward
			min = @tier2unitymin
			max = @tier2unitymax
		}
	}
}

ship_event = {
	id = anomaly.6840
	title = "anomaly.6840.name"
	desc = "anomaly.6840.desc"
	picture = GFX_evt_gas_giant
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

	option = {
		name = anomaly.6840.a
		owner = {
			add_resource = {
				minerals = 1200
			}
		}
		from = {
			set_ring = yes
		}
	}
	option = {
		name = anomaly.6840.b
		hidden_effect = {
			from = {
				if = {
					limit = {
						NOT = { has_deposit_for = shipclass_mining_station }
					}
					clear_deposits = yes
				}
			}
		}
		from = { add_deposit = d_minerals_5 }
	}
}

ship_event = {
	id = anomaly.6845
	title = "anomaly.6845.name"
	desc = "anomaly.6845.desc"
	picture = {
		trigger = {
			owner = { values_others = yes }
		}
		picture = GFX_evt_worrying_signal
	}
	picture = {
		trigger = {
			owner = { values_others = no }
		}
		picture = GFX_evt_gas_giant
	}
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

	immediate = {
		from = { clear_deposits = yes }
	}

	option = {
		trigger = { owner = { values_others = no } }
		name = FASCINATING
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier2researchreward
				min = @tier2researchmin
				max = @tier2researchmax
			}
		}
	}
	option = {
		trigger = {
			owner = {
				OR = {
					is_unfriendly = no
					is_xenophobe = no
				}
			}
		}
		name = anomaly.6845.a
		enable_special_project = {
			name = "GAS_RESTORATION"
			location = FROM
		}
		if = {
			limit = { owner = { values_others = yes } }
			owner = {
				add_modifier = {
					modifier = gas_cascade_sad
					days = -1
				}
			}
		}
	}
}

ship_event = {
	id = anomaly.6850
	title = "anomaly.6850.name"
		desc = {
		trigger = {
			text = anomaly.6850.desc
			text = newline
			success_text = {
				text = anomaly.6850.desc.valuesothers
				owner = { values_others = yes }
			}
		}
	}
	picture = {
		trigger = {
			owner = { values_others = yes }
		}
		picture = GFX_evt_gas_giant
	}
	picture = {
		trigger = {
			owner = { values_others = no }
		}
		picture = GFX_evt_news_room
	}
	show_sound = event_celebration
	location = FROM

	is_triggered_only = yes

	option = {
		name = anomaly.6850.a
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier4researchreward
				min = @tier4researchmin
				max = @tier4researchmax
			}
		}
		fromfromfrom = {
			set_deposit = d_society_6
			hidden_effect = {
				add_modifier = {
					modifier = "atmospheric_ecosystem"
					days = -1
				}
			}
		}
		owner = {
			if = { limit = { has_modifier = gas_cascade_sad }
				remove_modifier = gas_cascade_sad
				add_modifier = { modifier = gas_cascade_happy years = 5 }
			}
		}
	}
}

ship_event = {
	id = anomaly.6855
	title = "anomaly.6855.name"
	desc = {
		trigger = {
			owner = { is_gestalt = no }
		}
		text = "anomaly.6855.desc.regular"
	}
	desc = {
		trigger = {
			owner = { is_gestalt = yes }
		}
		text = "anomaly.6855.desc.gestalt"
	}

	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	show_sound = event_red_alert
	location = FROM

	is_triggered_only = yes
	immediate = {
		set_disabled = yes
		this.Leader = {
			save_global_event_target_as = trapped_in_storm
			exile_leader_as = trapped_in_storm
		}
	}
	option = {
		name = anomaly.6855.a
		enable_special_project = {
			name = "RESCUE_STORM"
			location = this
		}
	}
	option = {
		name = anomaly.6855.b
		custom_tooltip = anomaly.6855.b.tooltip
		hidden_effect = {
			destroy_fleet = this.fleet
		}
		from = { set_deposit = d_physics_7 }
	}
}

ship_event = {
	id = anomaly.6860
	title = "anomaly.6860.name"
	desc = "anomaly.6860.desc"
	picture = GFX_evt_inhabited_solar_system
	show_sound = event_default
	location = FROMFROM

	immediate = {
		fromfrom = {
			set_disabled = no
		}
		fromfrom.fleet = {
			leader = { unassign_leader = this }
			set_leader = event_target:trapped_in_storm
		}
	}

	is_triggered_only = yes
	option = {
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
		}
		name = anomaly.6860.a
		if = {
			limit = {
				owner = {
					is_gestalt = yes
				}
			}
			owner = {
				random_owned_leader = {
					limit = {
						is_councilor_type = councilor_gestalt_cognitive
					}
					add_expertise_trait_effect = {
						TRAIT = leader_trait_expertise_field_manipulation
					}
				}
			}
		}
		else = {
			event_target:trapped_in_storm = {
				add_expertise_trait_effect = {
					TRAIT = leader_trait_expertise_field_manipulation
				}
			}
		}
		fromfromfrom = {
			set_deposit = d_energy_6
		}
	}
}

ship_event = {
	id = anomaly.6865
	title = "anomaly.6865.name"
	desc = "anomaly.6865.desc"
	picture = GFX_evt_gas_giant_station
	show_sound = event_bad_omen
	location = FROM

	is_triggered_only = yes

	option = {
		name = anomaly.6865.a
		owner = {
			add_modifier = {
				modifier = unexplained_insights
				years = 10
			}
			give_specimen = { key = loopmail targets = { this } }
			hidden_effect = {
				country_event = { id = anomaly.6870 days = 3600 }
			}
		}
	}
	option = {
		name = anomaly.6865.b
		owner = { add_resource = { influence = 100 } }
	}
}

country_event = {
	id = anomaly.6870
	title = "anomaly.6870.name"
	desc = "anomaly.6870.desc"
	picture = GFX_evt_wormhole
	show_sound = event_celebration
	is_triggered_only = yes
	option = {
		name = anomaly.6870.a
		remove_modifier = unexplained_insights
		add_modifier = { modifier = closed_loop years = 10 }
	}
}

ship_event = {
	id = anomaly.6875
	title = "anomaly.6875.name"
	desc = "anomaly.6875.desc"
	picture = GFX_evt_hive
	show_sound = event_ship_bridge
	location = from
	is_triggered_only = yes
	immediate = {
		solar_system = {
			spawn_planet = {
				class = pc_crystal_asteroid
				location = from
				orbit_location = yes
				orbit_distance_offset = 10
				orbit_angle_offset = 5
				size = 2
				init_effect = {
					save_event_target_as = sleeping_crystal
					set_planet_flag = sleeping_crystal
					set_name = "NAME_Trapped_Asteroid"
					set_surveyed = {
						surveyed = yes
						surveyor = root.owner
					}
				}
			}
		}
	}
	option = {
		name = anomaly.6875.a
		event_target:sleeping_crystal = {
			set_deposit = d_rare_crystals_2
		}
		owner = {
			if = {
				limit = {
					NOT = {
						has_country_flag = rare_crystals_found
					}
				}
				set_country_flag = rare_crystals_found
				root.owner = {
					create_strategic_resource_message = {
						RESOURCE_TYPE = MESSAGE_STRATEGIC_RESOURCE_FOUND_RARE_CRYSTALS
						RESOURCE_DESC = MESSAGE_STRATEGIC_RESOURCE_FOUND_RARE_CRYSTALS_SHORT_DESC
					}
				}
			}
		}
	}
}

ship_event = {
	id = anomaly.6880
	title = "anomaly.6880.name"
	desc = "anomaly.6880.desc"
	picture = GFX_evt_hive
	show_sound = event_ship_bridge
	is_triggered_only = yes
	fire_only_once = yes
	location = from

	trigger = {
		from = { has_planet_flag = sleeping_crystal }
	}

	immediate = {
		from = {
			clear_deposits = yes
		}
	}

	option = {
		name = anomaly.6880.a
		owner = { add_resource = { minerals = 100 } }
		from = {
			set_deposit = d_rare_crystals_4
			tooltip = {
				mining_station = {
					dismantle = yes
				}
			}
		}
	}
	option = {
		ai_chance = {
			factor = 100
		}
		name = anomaly.6880.b
		enable_special_project = {
			name = "STUDY_SLEEPING_CRYSTAL"
			location = from
		}
		from = {
			tooltip = {
				mining_station = {
					dismantle = yes
				}
			}
		}
	}

	after = {
		from = {
			remove_planet_flag = sleeping_crystal
			set_planet_flag = annoyed_crystal
		}
	}
}

ship_event = {
	id = anomaly.6885
	title = "anomaly.6885.name"
	desc = "anomaly.6885.desc"
	picture = GFX_evt_hive
	show_sound = event_crystal_ship
	is_triggered_only = yes
	fire_only_once = yes
	location = from

	trigger = {
		from = { has_planet_flag = annoyed_crystal }
		NOT = { from = { has_planet_flag = sleeping_crystal } }
	}

	immediate = {
		create_crystal_country = yes
		event_target:crystal_country = {
			create_fleet = {
				name = "NAME_Crystalline_Entity"
				effect = {
					set_owner = event_target:crystal_country
					create_ship = {
						name = "NAME_Annoyed_Crystal"
						design = "NAME_Large_Crystal_Entity_Yellow_Elite"
					}
					set_location = from
					set_fleet_stance = aggressive
					set_aggro_range_measure_from = self
					set_aggro_range = 150
					save_event_target_as = annoyed_crystal
				}
			}
		}
	}
	option = {
		name = BATTLESTATIONS
	}
}

ship_event = {
	id = anomaly.6890
	title = "anomaly.6890.name"
	desc = "anomaly.6890.desc"
	picture = GFX_evt_hive
	show_sound = event_crystal_ship
	is_triggered_only = yes

	specimen = crystal_nest_fragments

	immediate = {
		fromfromfrom = { clear_deposits = yes }
	}

	option = {
		name = anomaly.6890.a
		fromfromfrom = { set_deposit = d_society_5 }
		owner = {
			add_tech_option_or_research_effect = {
   				TECH = tech_crystal_armor_1
   				PROGRESS = 0.5
   				CATEGORY = engineering_research
			}
		}
	}
}

ship_event = {
	id = anomaly.6895
	title = "anomaly.6895.name"
	desc = {
		trigger = { owner = { is_catalytic_empire = no } }
		text = "anomaly.6895.desc.catano"
	}
	desc = {
		trigger = { owner = { is_catalytic_empire = yes } }
		text = "anomaly.6895.desc.catayes"
	}
	picture = GFX_evt_toxic
	show_sound = event_ancient_drone
	is_triggered_only = yes
	location = from

	immediate = {
		from = { clear_deposits = yes }
	}

	option = {
		name = CURIOUS
		from = { set_deposit = d_engineering_4 }
		owner = {
			give_specimen = {
				key = toxic_bio_engine
				targets = { root.from }
			}
		}
	}
	option = {
		trigger = { owner = { is_catalytic_empire = no } }
		name = anomaly.6895.b
		from = { set_deposit = d_alloys_3 }
		owner = {
			give_specimen = {
				key = toxic_bio_engine
				targets = { root.from }
			}
		}
	}
	option = {
		trigger = { owner = { is_catalytic_empire = yes } }
		name = anomaly.6895.c
		from = { set_deposit = d_alloys_5 }
		owner = {
			give_specimen = {
				key = toxic_bio_engine
				targets = { root.from }
			}
		}
	}
	option = {
		trigger = {
			owner = {
				OR = {
					has_valid_civic = civic_agrarian_idyll
					is_spiritualist = yes
					is_xenophobe = yes
				}
			}
		}
		name = anomaly.6895.d
		from = { set_deposit = d_society_4 }
	}
}

ship_event = {
	id = anomaly.6900
	title = "anomaly.6900.name"
	desc = "anomaly.6900.desc"
	picture = GFX_evt_frozen
	show_sound = event_alien_signal
	is_triggered_only = yes
	location = from

	immediate = {
		from = { clear_deposits = yes }
	}
	option = {
		name = anomaly.6900.a
		custom_tooltip = anomaly.6900.a.tooltip
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
		}
	}
	option = {
		name = anomaly.6900.b
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
			if = {
				limit = { has_ancrel = yes }
				add_resource = { minor_artifacts = 30 }
			}
		}
	}
	option = {
		trigger = {
			owner = {
				OR = {
					AND = {
						has_event_chain = "vultaum_chain"
						NOT = {
							has_completed_event_chain_counter = {
								event_chain = vultaum_chain
								counter = vultaum_artifacts
							}
						}
					}
					AND = {
						has_event_chain = "yuht_chain"
						NOT = {
							has_completed_event_chain_counter = {
								event_chain = yuht_chain
								counter = yuht_artifacts
							}
						}
					}
					AND = {
						has_event_chain = "first_league_chain"
						NOT = {
							has_completed_event_chain_counter = {
								event_chain = first_league_chain
								counter = first_league_artifacts
							}
						}
					}
					AND = {
						has_event_chain = "irassian_chain"
						NOT = {
							has_completed_event_chain_counter = {
								event_chain = irassian_chain
								counter = irassian_artifacts
							}
						}
					}
					AND = {
						has_event_chain = "cybrex_chain"
						NOT = {
							has_completed_event_chain_counter = {
								event_chain = cybrex_chain
								counter = cybrex_artifacts
							}
						}
					}
				}
			}
		}
		name = anomaly.6900.c
		owner = { collector_surrenders_artifact = yes }
	}
	option = {
		name = anomaly.6900.d
		owner = {
			add_monthly_resource_mult = {
				resource = unity
				value = @tier3unityreward
				min = @tier3unitymin
				max = @tier3unitymax
			}
		}
	}
	option = {
		name = anomaly.6900.evopred
		trigger = { owner = { has_origin = origin_evolutionary_predators } }
		owner = {
			give_evolutionary_predator_situation_progress_and_dna = { AMOUNT = large }
		}
	}
	option = {
		name = anomaly.6900.e
		from = { set_deposit = d_engineering_4 }
	}
}

ship_event = {
	id = anomaly.6905
	title = "anomaly.6905.name"
	desc = anomaly.6905.desc
	location = from
	picture = {
		trigger = {
			From = { is_planet_class = pc_molten }
		}
		picture = GFX_evt_molten
	}
	picture = {
		trigger = {
			From = { is_planet_class = pc_toxic }
		}
		picture = GFX_evt_toxic
	}
	picture = {
		trigger = {
			From = { is_planet_class = pc_barren }
		}
		picture = GFX_evt_warm_barren
	}
	picture = {
		trigger = {
			From = { is_planet_class = pc_barren_cold }
		}
		picture = GFX_evt_cold_barren
	}
	picture = {
		trigger = {
			From = { is_planet_class = pc_frozen }
		}
		picture = GFX_evt_frozen
	}
	show_sound = event_ship_bridge
	is_triggered_only = yes

	immediate = {
		from = { clear_deposits = yes }
	}
	option = {
		name = anomaly.6905.a
		from = { set_deposit = d_society_4 }
	}
	option = {
		name = anomaly.6905.b
		enable_special_project = {
			name = "CRACK_THE_EGG"
			location = from
		}
	}
	option = {
		trigger = { owner = { has_valid_civic = civic_hive_devouring_swarm } }
		name = anomaly.6905.c
		from = { set_deposit = d_food_10 }
		if = {
			limit = {
				owner = { has_origin = origin_evolutionary_predators }
			}
			owner = { give_evolutionary_predator_situation_progress_and_dna = { AMOUNT = medium } }
		}
	}
}

ship_event = {
	id = anomaly.6910
	title = "anomaly.6910.name"
	desc = {
		trigger = {
			text = anomaly.6910.desc.start
			success_text = {
				text = anomaly.6910.desc.hatchling
				owner = { has_country_flag = encountered_hatchling }
			}
		}
	}
	picture = GFX_evt_circuitry_modification
	location = fromfromfrom

	is_triggered_only = yes

	option = {
		name = FASCINATING
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier4researchreward
				min = @tier4researchmin
				max = @tier4researchmax
			}
		}
		fromfromfrom = {
			set_deposit = d_society_8
		}
	}

	option = {
		exclusive_trigger = { owner = { has_origin = origin_evolutionary_predators } }
		name = anomaly.6910.b.evopred
		owner = {
			give_evolutionary_predator_situation_progress_and_dna = { AMOUNT = large }
		}
		fromfromfrom = {
			set_deposit = d_society_8
		}
	}

	after = {
		owner = {
			give_specimen = {
				key = enormous_scrambled_albumen
				targets = { root.fromfromfrom }
			}
		}
	}
}

ship_event = {
	id = anomaly.6915
	title = "anomaly.6915.name"
	desc = {
		trigger = { owner = { is_gestalt = no } }
		text = "anomaly.6915.desc.regular"
	}
	desc = {
		trigger = { owner = { is_gestalt = yes } }
		text = "anomaly.6915.desc.gestalt"
	}
	picture = GFX_evt_space_monster
	show_sound = event_red_alert
	is_triggered_only = yes
	location = fromfromfrom

	immediate = {
		fleet = { destroy_fleet = this }
	}

	option = {
		name = UNFORTUNATE
		fromfromfrom = {
			set_deposit = d_society_6
		}
	}

	option = {
		exclusive_trigger = { owner = { has_origin = origin_evolutionary_predators } }
		name = anomaly.6910.b.evopred
		owner = {
			give_evolutionary_predator_situation_progress_and_dna = { AMOUNT = medium }
		}
		fromfromfrom = {
			set_deposit = d_society_6
		}
	}
}

##########################
#
# Anomaly Events
# ANCIENT VENDING MACHINE
#
##########################

ship_event = {
	id = anomaly.7000
	title = "anomaly.7000.name"
	desc = "anomaly.7000.desc"
	picture = GFX_evt_asteroid_field
	location = FROM

	is_triggered_only = yes

	option = {
		name = "anomaly.7000.a"
		allow = {
			owner = {
				resource_stockpile_compare = {
					resource = energy
					value >= 200
				}
			}
		}

		owner = {
			add_resource = { energy = -200 }
		}

		hidden_effect = {
			owner = {
				country_event = { id = anomaly.7010 }
			}
		}
	}

	option = {
		name = "anomaly.7000.b"
	}
}

# get something from the vending machine
country_event = {
	id = anomaly.7010
	title = "anomaly.7010.name"

	desc = {
		trigger = {
			has_country_flag = vending_machine_contents_full
			is_megacorp = yes
		}
		text = anomaly.7010.desc.full.megacorp
	}
	desc = {
		trigger = {
			has_country_flag = vending_machine_contents_full
			OR = {
				is_robot_empire = yes
				is_lithoid_empire = yes
			}
		}
		text = anomaly.7010.desc.full.nonbio
	}
	desc = {
		trigger = {
			has_country_flag = vending_machine_contents_full
			NOR = {
				is_robot_empire = yes
				is_lithoid_empire = yes
				is_megacorp = yes
			}
		}
		text = anomaly.7010.desc.full.bio
	}
	desc = {
		trigger = {
			has_country_flag = vending_machine_contents_empty
		}
		text = anomaly.7010.desc.empty
	}
	desc = {
		trigger = {
			has_country_flag = vending_machine_contents_rot
			OR = {
				is_robot_empire = yes
				is_lithoid_empire = yes
			}
		}
		text = anomaly.7010.desc.rot.nonbio
	}
	desc = {
		trigger = {
			has_country_flag = vending_machine_contents_rot
			NOR = {
				is_robot_empire = yes
				is_lithoid_empire = yes
			}
		}
		text = anomaly.7010.desc.rot.bio
	}

	picture = GFX_evt_enigmatic_cache
	show_sound = event_activating_unknown_technology
	location = FROM

	is_triggered_only = yes

	immediate = {
		random_list = {
			10 = { set_country_flag = vending_machine_contents_full }
			60 = { set_country_flag = vending_machine_contents_empty }
			30 = { set_country_flag = vending_machine_contents_rot }
		}
	}

	after = {
		hidden_effect = {
			remove_country_flag = vending_machine_contents_full
			remove_country_flag = vending_machine_contents_empty
			remove_country_flag = vending_machine_contents_rot
		}
	}

	option = {
		name = anomaly.7010.a
		trigger = {
			has_country_flag = vending_machine_contents_full
			is_megacorp = yes
		}

		add_monthly_resource_mult = {
			resource = energy
			value = @tier2materialreward
			min = @tier2materialmin
			max = @tier2materialmax
		}
	}

	option = {
		name = FASCINATING
		switch = {
			trigger = has_country_flag
			vending_machine_contents_full = {
				if = {
					limit = {
						NOR = {
						is_robot_empire = yes
						is_lithoid_empire = yes
						}
					}

					add_modifier = {
						modifier = taste_the_stars
						days = 7200
					}
				}
				else = {
					add_resource = { exotic_gases = 100 }
				}
			}
			vending_machine_contents_empty = {
				if = {
					limit = { has_ancrel = yes }
					custom_tooltip = minor_artifacts_found
					add_resource = { minor_artifacts = 10 }
				}
				else = {
					add_resource = { alloys = 200 }
				}
			}
			vending_machine_contents_rot = {
				add_monthly_resource_mult = {
				resource = society_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
			}
		}
	}
}

# space shanty anomaly trigger

ship_event = {
	id = anomaly.7020
	title = anomaly.7020.name
	desc = anomaly.7020.desc
	picture = GFX_evt_star_neutron
	show_sound = event_ship_bridge
	location = FROM
	trackable = yes

	is_triggered_only = yes

	immediate = {
		from = { clear_deposits = yes }
	}

	option = {
		name = anomaly.7020.a
		from = { create_archaeological_site = site_space_shanty_dig }
	}
}

# rage sage anomaly trigger

ship_event = {
	id = anomaly.7030
	title = anomaly.7030.name
	desc = anomaly.7030.desc
	picture = GFX_evt_physics_cache
	show_sound = event_ship_bridge
	location = FROM
	trackable = yes

	is_triggered_only = yes


	immediate = {
		from = { clear_deposits = yes }
	}

	option = {
		name = anomaly.7030.desc.a
		from = { create_archaeological_site = site_rage_sage_dig }
	}
}

# Tiyanki Meat Asteroid
ship_event = {
	id = anomaly.7100
	title = "anomaly.7100.name"
	desc = {
		trigger = {
			owner = {
				OR = {
					has_communications = event_target:tiyanki_garrison_country
					has_communications = event_target:tiyanki_country
				}
			}
		}
		text = "anomaly.7100.desc"
	}
	desc = {
		trigger = {
			owner = {
				NOR = {
					has_communications = event_target:tiyanki_garrison_country
					has_communications = event_target:tiyanki_country
				}
			}
		}
		text = "anomaly.7100.alt.desc"
	}
	picture = GFX_evt_ice_asteroids
	show_sound = event_laboratory_sound
	location = FROM

	is_triggered_only = yes

	option = {
		name = FASCINATING
		from = { set_deposit = d_society_3 }
	}
}

# singing planet event

ship_event = {
	id = anomaly.7101
	title = "anomaly.7101.name"
	desc = {
		trigger = {
			owner = { is_gestalt = no }
		}
		text = anomaly.7101.standard.desc
	}
	desc = {
		trigger = {
			owner = { is_machine_empire = yes }
		}
		text = anomaly.7101.machines.desc
	}
	desc = {
		trigger = {
			owner = { is_hive_empire = yes }
		}
		text = anomaly.7101.hive.desc
	}
	picture = GFX_evt_mysterious_signal
	show_sound = event_sensor_ping
	location = FROM
	trackable = yes

	is_triggered_only = yes

	option = {
		trigger = {
			owner = {
				NOT = { has_ethic = ethic_gestalt_consciousness }
			}
		}
		name = anomaly.7101.a
		FROM = {
			add_deposit = d_vast_unity_deposit
		}
	}
	option = {
		trigger = {
			owner = {
				is_machine_empire = yes
			}
		}
		name = anomaly.7101.b
		FROM = {
			add_deposit = d_physics_6
		}
	}
	option = {
		trigger = {
			owner = {
				is_hive_empire = yes
			}
		}
		name = anomaly.7101.c
		FROM = {
			add_deposit = d_vast_unity_deposit
		}
		custom_tooltip = "anomaly.7101.c.desc"
		owner = {
			add_modifier = {
				modifier = harmonious_tune
				days = 7200
			}
		}
	}
}

### Heat from Below
ship_event = {
	id = anomaly.3140
	title = "anomaly.3140.name"
	desc = "anomaly.3140.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	show_sound = event_scanner
	location = FROM
	trackable = yes

	is_triggered_only = yes

	option = {
		name = INTRIGUING
		hidden_effect = {
			ship_event = { id = anomaly.3141 days = 30 }
		}
		FROM = {
			add_modifier = {
				modifier = "subterranean_ocean"
				days = -1
			}
			if = {
				limit = {
					has_deposit_for = shipclass_mining_station
				}
				hidden_effect = { clear_deposits = yes }
			}
			add_deposit = d_society_3
		}
	}
	option = {
		name = anomaly.3140.a
		owner = {
			add_monthly_resource_mult = {
				resource = unity
				value = @tier2unityreward
				min = @tier2unitymin
				max = @tier2unitymax
			}
		}
	}
}

### The Depths of Alien Life
ship_event = {
	id = anomaly.3141
	title = "anomaly.3141.name"
	desc = "anomaly.3141.desc"
	picture = GFX_evt_microscopic_life
	show_sound = event_scanner
	location = FROM
	trackable = yes

	is_triggered_only = yes

	option = {
		name = FASCINATING
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier2researchreward
				min = @tier2researchmin
				max = @tier2researchmax
			}
		}
	}
}

### Intemporal Orb
ship_event = {
	id = anomaly.7105
	title = "anomaly.7105.name"
	desc = "anomaly.7105.desc"
	picture = GFX_evt_ancient_records
	show_sound = event_sensor_ping
	location = FROM
	trackable = yes

	is_triggered_only = yes

	option = {
		trigger = {
			owner = {
				NOT = {
					has_valid_civic = civic_hive_devouring_swarm
				}
			}
		}
		name = anomaly.7105.a.standard
		hidden_effect = {
			ship_event = { id = anomaly.7115 days = 30 random = 10 }
		}
	}
	option = {
		trigger = {
			owner = {
				has_valid_civic = civic_hive_devouring_swarm
			}
		}
		name = anomaly.7105.a.devouring
		hidden_effect = {
			ship_event = { id = anomaly.7115 days = 30 random = 10 }
		}
	}
	option = {
		name = anomaly.7105.b
		hidden_effect = {
			ship_event = { id = anomaly.7110 days = 30 random = 10 }
		}
	}
}

ship_event = {
	id = anomaly.7110
	title = "anomaly.7110.name"
	desc = "anomaly.7110.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	show_sound = event_sensor_ping
	location = from
	trackable = yes

	is_triggered_only = yes

	option = {
		name = PECULIAR
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier2researchreward
				min = @tier2researchmin
				max = @tier2researchmax
			}
		}
	}
}

ship_event = {
	id = anomaly.7115
	title = "anomaly.7115.name"
	desc = {
		# Non-hive empire, non-immortal leader, non-heir leader
		trigger = {
			owner = {
				is_hive_empire = no
			}
			leader = {
				AND = {
					is_immortal = no
					is_heir = no
				}
			}
		}
		text = "anomaly.7115.desc.regular"
	}
	desc = {
		# Non-hive empire and either immortal leader or heir
		trigger = {
			owner = {
				is_hive_empire = no
			}
			leader = {
				OR = {
					is_immortal = yes
					is_heir = yes
				}
			}
		}
		text = "anomaly.7115.desc.immortal"
	}
	desc = {
		# Hive empire, but not devouring swarm
		trigger = {
			owner = {
				is_hive_empire = yes
				NOT = {
					has_valid_civic = civic_hive_devouring_swarm
				}
			}
		}
		text = "anomaly.7115.desc.hive"
	}
	desc = {
		# Devouring swarm
		trigger = {
			owner = {
				has_valid_civic = civic_hive_devouring_swarm
			}
		}
		text = "anomaly.7115.desc.devouring"
	}
	picture = GFX_evt_surreal_visions
	show_sound = event_sensor_ping
	location = FROM
	trackable = yes

	is_triggered_only = yes

	immediate = {
		if = {
			# Immortal leader or heir, but not hive
			limit = {
				owner = {
					is_hive_empire = no
				}
				leader = {
					OR = {
						is_immortal = yes
						is_heir = yes
					}
				}
			}
			owner = {
				create_leader = {
					class = scientist
					species = owner_main_species
					name = random
					skill = 1
					event_leader = no
				}
				last_created_leader = {
					save_event_target_as = intemporal_leader
					exile_leader_as = intemporal_leader
				}
			}
		}
		else = {
			leader = {
				save_event_target_as = intemporal_leader
			}
		}
	}
	option = {
		# Exile leader
		name = anomaly.7115.a
		if = {
			limit = {
				owner = {
					is_hive_empire = no
				}
				leader = {
					OR = {
						is_immortal = yes
						is_heir = yes
					}
				}
			}
			custom_tooltip = anomaly.7115.a.immortal.tt # Immortal or heir
		}
		else = {
			custom_tooltip = anomaly.7115.a.regular.tt
		}
		hidden_effect = {
			event_target:intemporal_leader = {
				save_event_target_as = intemporal_explorer
				exile_leader_as = intemporal_explorer
				set_immortal = yes
			}
			owner = {
				country_event = { id = anomaly.7120 days = 36000 random = 180 }
			}
		}
	}
	option = {
		# Existing scientist stays in empire
		trigger = {
			leader = {
				AND = {
					is_immortal = no
					is_heir = no
				}
			}
		}
		name = anomaly.7115.b.regular
		custom_tooltip = anomaly.7115.b.regular.tt
		event_target:intemporal_leader = {
			add_trait = {
				trait = leader_trait_intemporal
			}
		}
	}
	option = {
		# New scientist added to empire
		trigger = {
			leader = {
				OR = {
					is_immortal = yes
					is_heir = yes
				}
			}
		}
		name = anomaly.7115.b.immortal
		custom_tooltip = anomaly.7115.b.immortal.tt
		owner = {
			clone_leader = {
				target = event_target:intemporal_leader
				class = scientist
			}
			last_created_leader = {
				save_event_target_as = intemporal_leader
			}
		}
		event_target:intemporal_leader = {
			add_trait = {
				trait = leader_trait_intemporal
			}
		}
	}
}

country_event = {
	id = anomaly.7120
	title = "anomaly.7120.name"
	desc = {
		trigger = {
			is_hive_empire = no
		}
		text = "anomaly.7120.desc.regular"

	}
	desc = {
		trigger = {
			is_hive_empire = yes
		}
		text = "anomaly.7120.desc.hive"
	}
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit_3
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	show_sound = event_ship_thrusters
	location = owner.capital_scope # not in science ship anymore
	trackable = yes

	is_triggered_only = yes

	option = {
		name = FASCINATING
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier4researchreward
				min = @tier4researchmin
				max = @tier4researchmax
			}
		}
	}
}

### Data Diamond
# This = ship
# From = planet
ship_event = {
	id = anomaly.3145
	title = "anomaly.3145.name"
	desc = "anomaly.3145.desc"
	picture = GFX_evt_frozen
	show_sound = event_scanner
	location = ROOT

	is_triggered_only = yes

	immediate = {
		FROM = {
			set_planet_flag = data_diamond_planet
		}
	}

	option = {
		name = anomaly.3145.a
		hidden_effect = {
			enable_special_project = {
				name = "DATA_DIAMOND_PROJECT"
				location = FROM
			}
		}
	}
}


#Follow up event + Choice
# This = ship
ship_event = {
	id = anomaly.3150
	title = "anomaly.3150.name"
	desc = "anomaly.3150.desc"
	picture = GFX_evt_surreal_visions
	show_sound = event_mystic_reveal_light
	location = ROOT

	is_triggered_only = yes

	option = {
		name = anomaly.3150.a
		custom_tooltip = anomaly.3150.a.tooltip
		hidden_effect = {
			random_galaxy_planet = {
				limit = {
					has_planet_flag = data_diamond_planet

				}
				add_deposit = d_physics_1
				add_deposit = d_society_1
				add_deposit = d_engineering_1
			}
		}
	}

	option = {
		name = anomaly.3150.b
		custom_tooltip = anomaly.3150.b.tooltip
		hidden_effect = {
			ship_event = { id = anomaly.3165 days = 1 }
		}
	}

	option = {
		name = anomaly.3150.c
		custom_tooltip = anomaly.3150.c.tooltip
		hidden_effect = {
			random_galaxy_planet = {
				limit = {
					has_planet_flag = data_diamond_planet

				}
				set_deposit = d_rare_crystals_3
				carrier_event = { id = anomaly.3155 }
			}
			if = {
				limit = {
					owner = {
						NOT = {
							has_technology = tech_mine_rare_crystals
						}
					}
				}
				owner = {
					add_research_option = tech_mine_rare_crystals
					add_tech_progress = {
						tech = tech_mine_rare_crystals
						progress = 0.1
					}
				}
			}
		}
	}
}

# Jumps back to the planet at first so you can get distar.305
# This = planet
# From = ship
carrier_event = {
	id = anomaly.3155
	hide_window = yes

	is_triggered_only = yes

	trigger = {
		has_planet_flag = data_diamond_planet
	}

	immediate = {
		from = {
			ship_event = { id = anomaly.3160 days = 1 }
		}
	}
}

# Fires distar.305 from correct place
# This = ship
# From = planet
ship_event = {
	id = anomaly.3160
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		ship_event = { id = action.941 days = 1 scopes = { from = fromfrom } }
	}
}

#Scientist Dies to save the Data
# This = ship
ship_event = {
	id = anomaly.3165
	title = "anomaly.3165.name"
	desc = "anomaly.3165.desc"
	picture = GFX_evt_emergency_workers
	show_sound = event_bad_omen
	location = ROOT

	is_triggered_only = yes

	option = {
		name = anomaly.3165.a
		from = {
			kill_leader = {
				class = scientist show_notification = no
			}
		}
		hidden_effect = {
			random_galaxy_planet = {
				limit = {
					has_planet_flag = data_diamond_planet
				}
				add_deposit = d_physics_5
				add_deposit = d_society_5
				add_deposit = d_engineering_5
			}
		}
	}
}

### Rapid Desertification
# This = ship
# From = planet
ship_event = {
	id = anomaly.7135
	title = "anomaly.7135.name"
	desc = "anomaly.7135.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_landing_ship
		BIOSHIP_PICTURE = GFX_evt_bioship_landing
	}
	show_sound = event_alien_nature
	location = FROM

	is_triggered_only = yes

	immediate = {
		FROM = {
			save_event_target_as = desertling_planet
			add_modifier = {
				modifier = "alien_infestation"
				days = -1
			}
		}
	}
	option = {
		name = anomaly.7135.a
		enable_special_project = {
			name = "RAPID_DESERTIFICATION_PROJECT"
			location = from
			owner = root.owner
		}
	}
	option = {
		name = anomaly.7135.b
		custom_tooltip = anomaly.7135.b.tooltip
		hidden_effect = {
			owner = { country_event = { id = anomaly.7145 days = 480 random = 30 }  }
		}
	}
}

country_event = {
	id = anomaly.7140
	title = "anomaly.7140.name"
	desc = "anomaly.7140.desc"
	picture = GFX_evt_desert
	show_sound = event_alien_nature
	location = event_target:desertling_planet

	is_triggered_only = yes

	option = {
		name = anomaly.7140.a
		custom_tooltip = anomaly.7140.a.tooltip
		trigger = {
			owner = {
				is_xenophobe = no
			}
		}
		owner = {
			every_owned_planet = {
				limit = {
					pop_amount > 100
				}
				add_modifier = {
					modifier = "adopted_aliens"
					days = 3620
				}
				hidden_effect = {
					set_carrier_flag = desertling_fauna
				}
			}
			random_owned_planet = {
			limit = {
				NOT = {
					has_carrier_flag = rampant_desertlings
				}
				pop_amount > 100
			}
			save_event_target_as = rampant_desertlings
		}
		}
		hidden_effect = {
			random_list = {
				60 = { owner = { country_event = { id = colony.7160 days = 3620 } } }
				40 = { event_target:rampant_desertlings = { carrier_event = { id = colony.7166 days = 3620 } } }
			}
		}
	}
	option = {
		name = anomaly.7140.b
		custom_tooltip = anomaly.7140.b.tooltip
		enable_special_project = {
			name = "POPULATION_CONTROL_PROJECT"
			location = event_target:desertling_planet
		}
	}
	option = {
		name = anomaly.7140.c
		custom_tooltip = anomaly.7140.c.tooltip
		trigger = {
			owner = {
				is_pacifist = no
				is_xenophile = no
			}
		}
		hidden_effect = {
			owner = { country_event = { id = anomaly.7155 days = 180 } }
		}
	}
	option = {
		name = anomaly.7140.d
		custom_tooltip = anomaly.7140.d.tooltip
		trigger = {
			owner = {
				has_policy_flag = slavery_allowed
				#has_policy_flag = pre_sapients_eat
				is_xenophobe = yes
			}
		}
		hidden_effect = {
			create_species = {
				name = "rapid_desertification_species"
				class = "MAM"
				portrait = "mam_rat"
				sapient = no
				traits = {
					trait = trait_presapient_unintelligent
					trait = trait_delicious
					trait = trait_pc_desert_preference
				}
				homeworld = event_target:desertling_planet
			}
			owner = {
				every_owned_planet = {
					create_pop_group = { species = last_created_species }
					create_pop_group = {
						species = last_created_species
						effect = { save_event_target_as = rapid_desertification_pop_group }
					}
				}
			}
		}
		hidden_effect = {
			event_target:rapid_desertification_pop_group = {
				set_citizenship_type = {
					type = citizenship_slavery
					cooldown = yes
				}
				set_slavery_type = {
					type = slavery_livestock country = prev
				}
			}
			owner = {
				random_owned_planet = {
					limit = {
						pop_amount > 100
					}
				save_event_target_as = rampant_desertlings
				}
			}
			random_list = {
				70 = {}
				30 = { event_target:rampant_desertlings = { carrier_event = { id = colony.7166 days = 3620 } } }
			}
		}
	}
}

country_event = {
	id = anomaly.7145
	title = "anomaly.7145.name"
	desc = { # If planet is owned
		trigger = {
			event_target:desertling_planet = {
				pop_amount > 0
			}
		}
		text = anomaly.7145.desc
	}
	desc = {
		trigger = { # If planet is not owned
			event_target:desertling_planet = {
				pop_amount = 0
			}
		}
		text = anomaly.7145.b.desc
	}
	picture = GFX_evt_warm_barren
	show_sound = event_wind_ruins
	location = event_target:desertling_planet

	is_triggered_only = yes

	option = { # If planet is not owned
		name = anomaly.7145.a
		trigger = {
			values_others = yes
			event_target:desertling_planet = {
				pop_amount = 0
			}
		}
		event_target:desertling_planet = {
			change_pc = pc_barren
			remove_modifier = alien_infestation
		}
	}

	option = { # If planet is owned
		name = anomaly.7145.b
		trigger = {
			event_target:desertling_planet = {
				pop_amount > 0
			}
		}
		event_target:desertling_planet = {
			change_pc = pc_barren
			remove_modifier = alien_infestation
			destroy_colony = yes
		}
	}

	option = { # If planet is not owned
		name = ACKNOWLEDGED
		trigger = {
			values_others = no
			event_target:desertling_planet = {
				pop_amount = 0
			}
		}
		event_target:desertling_planet = {
			change_pc = pc_barren
			remove_modifier = alien_infestation
		}
	}
}

country_event = {
	id = anomaly.7146
	title = "anomaly.7145.name"
	desc = {
		trigger = { # If planet is owned
			event_target:desertling_planet = {
				pop_amount > 0
			}
		}
		text = anomaly.7145.desc
	}
	desc = {
		trigger = { # If planet is not owned
			event_target:desertling_planet = {
				pop_amount = 0
			}
		}
		text = anomaly.7145.b.desc
	}
	picture = GFX_evt_warm_barren
	show_sound = event_wind_ruins
	location = event_target:desertling_planet

	is_triggered_only = yes

	option = { # If planet is not owned
		name = anomaly.7145.a
		trigger = {
			values_others = yes
			event_target:desertling_planet = {
				pop_amount = 0
			}
		}
		event_target:desertling_planet = {
			change_pc = pc_barren
			remove_modifier = alien_infestation
		}
	}

	option = { # If planet is owned
		name = anomaly.7145.b
		trigger = {
			event_target:desertling_planet = {
				pop_amount > 0
			}
		}
		event_target:desertling_planet = {
			change_pc = pc_barren
			remove_modifier = alien_infestation
			destroy_colony = yes
		}
	}

	option = { # If planet is not owned
		name = ACKNOWLEDGED
		trigger = {
			values_others = no
			event_target:desertling_planet = {
				pop_amount = 0
			}
		}
		event_target:desertling_planet = {
			change_pc = pc_barren
			remove_modifier = alien_infestation
		}
	}
}

country_event = {
	id = anomaly.7150
	title = "anomaly.7150.name"
	desc = "anomaly.7150.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit_3
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	show_sound = event_mystic_reveal
	location = event_target:desertling_planet

	is_triggered_only = yes

	option = {
		name = anomaly.7150.a
		event_target:desertling_planet =  {
			remove_modifier = alien_infestation
			add_modifier = {
				modifier = "lush_planet"
				days = -1
			}
			add_deposit = d_green_hills
			add_deposit = d_bountiful_plains
		}
	}
}

country_event = {
	id = anomaly.7155
	title = "anomaly.7155.name"
	desc = "anomaly.7155.desc"
	picture = GFX_evt_zro_5
	show_sound = event_ground_battle
	location = event_target:desertling_planet

	is_triggered_only = yes

	option = {
		name = anomaly.7155.a
		owner = { add_resource = { food = 500 } }
		event_target:desertling_planet = {
			remove_modifier = alien_infestation
			add_deposit = d_red_desert
		}
	}
}

ship_event = {
	id = anomaly.7200
	title = anomaly.7200.name
	desc = anomaly.7200.desc
	picture = GFX_evt_shrouded_planet
	show_sound = event_mystic_reveal
	location = from

	is_triggered_only = yes

	option = {
		name = anomaly.7200.a
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier2researchreward
				min = @tier2researchmin
				max = @tier2researchmax
			}
		}
		hidden_effect = {
			from.solar_system = {
				every_system_planet = {
					switch = {
						trigger = has_carrier_flag
						planet_Ariph = {
							change_pc = pc_molten
							add_deposit = d_alloys_2
						}
						planet_Hari_XXIV = {
							change_pc = pc_molten
							add_deposit = d_alloys_2
						}
						planet_Risasi = {
							change_pc = pc_asteroid
							add_deposit = d_rare_crystals_2
						}
						planet_Aridder = {
							change_pc = pc_frozen
							add_deposit = d_minerals_2
						}
						planet_Echo = {
							change_pc = pc_barren
							add_deposit = d_energy_2
						}
						planet_Rover = {
							change_pc = pc_toxic
							add_deposit = d_exotic_gases_1
						}
						planet_Jasepe = {
							change_pc = pc_barren
							add_deposit = d_minerals_3
						}
						planet_Blaxe = {
							change_pc = pc_gas_giant
							add_deposit = d_energy_3
						}
						planet_Glavi = {
							change_pc = pc_gas_giant
							add_deposit = d_exotic_gases_1
						}
						planet_Salvold = {
							change_pc = pc_barren_cold
							add_deposit = d_minerals_2
						}
						planet_Frince = {
							change_pc = pc_frozen
							add_deposit = d_minerals_2
						}
						star_seddom = {
							set_planet_size = 33
							add_deposit = d_energy_5
						}
					}
				}
				random_ambient_object = {
					limit = {
						has_ambient_object_flag = breachsealer_breach
					}
					destroy_ambient_object = this
				}
			}
		}
	}
}

### Geocentric Experiment
# This = ship
# From = planet
ship_event = {
	id = anomaly.8000
	title = "anomaly.8000.name"
	desc = "anomaly.8000.desc"
	picture = GFX_evt_physics_research
	show_sound = event_energy_field
	location = FROM

	is_triggered_only = yes

	option = {
		name = INTERESTING
		FROM = {
			add_deposit = d_geocentric_experiment
		}
		custom_tooltip = anomaly.8000.tt
		hidden_effect = {
			from.solar_system = {
				every_system_planet = {
					limit = {
						has_planet_flag = gravity_stabilizer
					}
					add_deposit = d_dark_matter_deposit_1
					add_deposit = d_physics_1
				}
			}
		}
	}
	option = {
		name = anomaly.8000.b
		custom_tooltip = anomaly.8000.b.tt
		hidden_effect = {
			from.solar_system = {
				destroy_star_system = yes
				set_star_class = sc_m
				every_system_planet = {
					limit = { is_star = yes }
					change_pc = pc_m_star
				}
				every_system_planet = {
					limit = {
						has_planet_flag = gravity_stabilizer
					}
					change_pc = pc_shattered
				}
			}
		}
		owner = {
			add_resource = {
				sr_dark_matter = 500
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier5researchreward
				min = @tier5researchmin
				max = @tier5researchmax
			}
		}
	}

	after = {
		owner = {
			add_research_option = tech_mine_dark_matter
		}
	}
}

# Mysterious Rock Formation
ship_event = {
	id = anomaly.2000
	title = "anomaly.2000.name"
	desc = {
        trigger = {
            owner = { is_hive_empire = no }
        }
        text = anomaly.2000.default.desc
	}
	desc = {
        trigger = {
            owner = { is_hive_empire = yes }
        }
        text = anomaly.2000.hive.desc
	}
	picture = GFX_evt_desert
	show_sound = event_ship_thrusters
	location = FROM

	is_triggered_only = yes

	immediate = {
    	from = { clear_deposits = yes }
	}

	 option = {
		name = anomaly.2000.a
		enable_special_project = {
			name = "GROTESQUE_ROCK_PROJECT"
			location = from
			owner = root
		}
	}
	option = {
		name = anomaly.2000.b
		leader = { add_experience = 100 }
	}
}

# Grotesque Rock Special Project Completed 1
ship_event = {
	id = anomaly.2005
	title = "PROJECT_COMPLETE"
	picture = GFX_evt_astral_rift_bleached_planet_3
	show_sound = event_mystic_reveal
	location = FROMFROM
	desc = "anomaly.2005.desc"
	is_triggered_only = yes
	 option = {
		name = anomaly.2005.a
		leader = { add_experience = 200 }
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier2researchreward
				min = @tier2researchmin
				max = @tier2researchmax
			}
		}
	}
}

# Grotesque Rock Special Project Completed 2
ship_event = {
	id = anomaly.2006
	title = "PROJECT_COMPLETE"
	desc = "anomaly.2006.desc"
	picture = GFX_evt_desert
	show_sound = event_ship_thrusters
	location = FROMFROM
	 is_triggered_only = yes
	 option = {
		name = anomaly.2006.a
		leader = { add_experience = 50 }
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}
}

# Icy Flowers
ship_event = {
    id = anomaly.2010
    title = "anomaly.2010.name"
	desc = "anomaly.2010.desc"
    picture = GFX_evt_astral_rift_tropical_habitat
    show_sound = event_ship_bridge
    location = FROM
    is_triggered_only = yes
    immediate = {
        from = { clear_deposits = yes }
    }

    option = {
        name = anomaly.2010.a
        	enable_special_project = {
			name = "BOTANICAL_GARDEN_PROJECT"
			location = FROM
			owner = root
		}
    }
    option = {
        name = anomaly.2010.b
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
    }
}

# Botanical Garden Special Project Completed 1
ship_event = {
	id = anomaly.2015
    title = "PROJECT_COMPLETE"
    picture = GFX_evt_astral_rift_tropical_habitat
    show_sound = event_mystic_reveal
    location = FROMFROM
 	desc = "anomaly.2015.desc"
    is_triggered_only = yes
     option = {
        name = anomaly.2015.a
        leader = { add_experience = 200 }
        owner = {
            add_monthly_resource_mult = {
                resource = society_research
                value = @tier2researchreward
                min = @tier2researchmin
                max = @tier2researchmax
            }
        }
    }
}

# Botanical Garden Special Project Completed 2
ship_event = {
	id = anomaly.2020
	title = "PROJECT_COMPLETE"
	desc = "anomaly.2020.desc"
	picture = GFX_evt_frozen
	show_sound = event_ship_thrusters
	location = FROMFROM

	is_triggered_only = yes

	option = {
		name = anomaly.2020.a
		leader = { add_experience = 50 }
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}
}

# The Adjudicator

ship_event = {
	id = anomaly.9000
	title = anomaly.9000.name
	desc = anomaly.9000.desc
	picture = GFX_evt_asteroid_field
	show_sound = event_default
	location = from

	is_triggered_only = yes

	immediate = {
	}

	option = {
		name = anomaly.9000.a
		ship_event = {
			id = anomaly.9001
		}
	}
}

ship_event = {
	id = anomaly.9001
	title = anomaly.9001.name
	desc = anomaly.9001.desc

	diplomatic = yes

	is_triggered_only = yes

	picture_event_data = {
		room = no_video_feed_room
	}

	immediate = {
		leader = {
			save_event_target_as = old_life
		}
	}

	option = {
		name = anomaly.9001.a
		response_text = anomaly.9001.a.response
		is_dialog_only = yes
	}
	option = {
		name = anomaly.9001.b
		response_text = anomaly.9001.b.response
		is_dialog_only = yes
	}
	option = {
		name = anomaly.9001.c
		response_text = anomaly.9001.c.response
		leader = {
			owner = {
				clone_leader = {
					target = event_target:old_life
					name = random
					effect = {
						save_event_target_as = new_life
					}
				}
			}
		}
		fleet = {
			assign_leader = event_target:new_life
		}
		event_target:old_life = {
			kill_leader = {
				show_notification = no
			}
		}
	}
}

ship_event = {
	id = anomaly.9002
	title = anomaly.9002.name
	desc = anomaly.9002.desc
	picture = GFX_evt_asteroid_field
	show_sound = event_default
	location = from

	is_triggered_only = yes

	immediate = {
	}

	option = {
		name = anomaly.9002.a
		from = {
			set_deposit = d_physics_6
		}
		leader = {
			add_trait = {
				trait = leader_trait_traumatized
			}
		}
	}
}
