############################
#
# Anomaly Events
# Written by Henrik Thyrwall & Maximilian Olbers
#
############################

namespace = anomaly

# ROOT = ship scope
# FROM = planet scope

### Coprolite Asteroid
ship_event = {
	id = anomaly.1
	title = "anomaly.1.name"
	desc = "anomaly.1.desc"
	picture = GFX_evt_mining_station
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

	specimen = coprolite

	option = {
		name = REMARKABLE
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "asteroid_coprolite"
					days = -1
				}
				if = {
					limit = {
						NOT = { has_deposit_for = shipclass_research_station }
					}
					clear_deposits = yes
				}
			}
		}
		from = { add_deposit = d_society_3 }
	}
}

### Pirate Treasure
ship_event = {
	id = anomaly.5
	title = "anomaly.5.name"
	desc = "anomaly.5.desc"
	picture = GFX_evt_treasure_pile
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = anomaly.5.a
		owner = {
			add_monthly_resource_mult = {
				resource = energy
				value = @tier1materialreward
				min = @tier1materialmin
				max = @tier1materialmax
			}
			pop_lcluster_event = yes
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
		}
	}
}

### Asteroid Fauna
ship_event = {
	id = anomaly.10
	title = "anomaly.10.name"
	desc = "anomaly.10.desc"
	picture = GFX_evt_mining_station
	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
			}
		}
		owner = { country_event = { id = story.2 days = 30 } }
	}

	option = {
		name = anomaly.10.a
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "asteroid_life"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_society_3
		}
		owner = {
			if = {
				limit = { has_origin = origin_evolutionary_predators }
				give_evolutionary_predator_situation_progress_and_dna = { AMOUNT = small TYPE = lithoid }
			}
		}
	}

	option = {
		exclusive_trigger = {
			owner = {
				is_lithoid_empire = yes
			}
		}
		icon = {
			icon = GFX_lithoid
			text = IS_LITHOID_EMPIRE_ICON_TIP
		}
		name = anomaly.10.b
		FROM = {
			add_deposit = d_society_6
		}
		owner = {
			if = {
				limit = { has_origin = origin_evolutionary_predators }
				give_evolutionary_predator_situation_progress_and_dna = { AMOUNT = small TYPE = lithoid }
			}
		}
	}
}

### Asteroid Fossils
ship_event = {
	id = anomaly.15
	title = "anomaly.15.name"
	desc = "anomaly.15.desc"
	picture = GFX_evt_landing_ship_2
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

	specimen = asteroid_fossils

	option = {
		name = FASCINATING
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}
	option = {
		exclusive_trigger = { owner = { has_origin = origin_evolutionary_predators } }
		name = anomaly.15.b.evopred
		owner = { give_evolutionary_predator_situation_progress_and_dna = { AMOUNT = small } }
	}
}

### Derelict Shipyard
ship_event = {
	id = anomaly.25
	title = "anomaly.25.name"
	desc = "anomaly.25.desc"
	picture = GFX_evt_mining_station
	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
			}
		 }
		owner = { country_event = { id = story.5 days = 30 } }
	}

	option = {
		name = anomaly.25.a
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "derelict_shipyard"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_engineering_3
		}
	}
}

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

	is_triggered_only = yes

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

	option = {
		name = anomaly.30.a
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "junkyard"
					days = -1
				}
			}
		}
		hidden_effect = {
			from = {
				if = {
					limit = {
						NOT = { has_deposit_for = shipclass_mining_station }
					}
					clear_deposits = yes
				}
			}
		}
		from = { add_deposit = d_minerals_3 }
		owner = {
			pop_lcluster_event = yes
		}
	}
}

### Crashed Scout Ship
ship_event = {
	id = anomaly.35
	title = "anomaly.35.name"
	desc = "anomaly.35.desc"
	picture = GFX_evt_crashed_station
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = anomaly.35.a
		owner = {
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}
}

### Automated Mining Base
ship_event = {
	id = anomaly.40
	title = "anomaly.40.name"
	desc = {
		trigger = {
			owner = { any_planet_within_border = { is_same_value = event_target:MiningPlanet } }
		}
		text = "anomaly.40.desc"
	}
	desc = {
		trigger = {
			NOT = {
				owner = { any_planet_within_border = { is_same_value = event_target:MiningPlanet } }
			}
		}
		text = "anomaly.40.desc.alt"
	}
	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 }
			save_event_target_as = MyCountry
		}
		from = {
			save_event_target_as = MiningPlanet
		}
	}

	option = {
		name = EXCELLENT
		trigger = {
			owner = {
				NOT = { any_planet_within_border = { is_same_value = event_target:MiningPlanet } }
			}
			from = {
				has_resource = {
					type = minerals
					amount > 0
				}
			}
		}
		owner = {
			add_monthly_resource_mult = {
				resource = minerals
				value = @tier1materialreward
				min = @tier1materialmin
				max = @tier1materialmax
			}
		}
	}
	option = {
		name = EXCELLENT
		trigger = {
			owner = {
				NOT = { any_planet_within_border = { is_same_value = event_target:MiningPlanet } }
			}
			from = {
				has_resource = {
					type = energy
					amount > 0
				}
			}
		}
		owner = {
			add_monthly_resource_mult = {
				resource = energy
				value = @tier1materialreward
				min = @tier1materialmin
				max = @tier1materialmax
			}
		}
	}

	option = {
		name = EXCELLENT
		trigger = {
			owner = { any_planet_within_border = { is_same_value = event_target:MiningPlanet } }
		}
		from = {
			create_mining_station = {
				owner = ROOT
			}
		}
	}
}

### Weapons Target Range
ship_event = {
	id = anomaly.50
	title = "anomaly.50.name"
	desc = "anomaly.50.desc"
	picture = GFX_evt_landing_ship_2
	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
			}
		}
		owner = { country_event = { id = story.3 days = 30 } }
	}

	option = {
		name = INTERESTING
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "target_range"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_physics_3
		}
	}
}

### Asteroid Collision
ship_event = {
	id = anomaly.55
	title = "anomaly.55.name"
	desc = "anomaly.55.desc"
	picture = GFX_evt_landing_ship_2
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = anomaly.55.a
		FROM = {
			add_deposit = d_minerals_3
		}
	}
}

### Exotic Radiation
ship_event = {
	id = anomaly.60
	title = "anomaly.60.name"
	desc = "anomaly.60.desc"
	picture = GFX_evt_mining_station
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

	option = {
		name = REMARKABLE
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}
}

### Crashed Ore Freighter
ship_event = {
	id = anomaly.65
	title = "anomaly.65.name"
	desc = "anomaly.65.desc"
	picture = GFX_evt_crashed_station
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

	immediate = {
		from = {
			if = {
				limit = {
					NOT = { has_deposit_for = shipclass_mining_station }
				}
				clear_deposits = yes
			}
		}
		owner = { country_event = { id = story.5 days = 30 } }
	}

	option = {
		name = EXCELLENT
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "ore_freighter"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_minerals_3
		}
	}
}

### Thinking Asteroid 1
ship_event = {
	id = anomaly.75
	title = "anomaly.75.name"
	desc = "anomaly.75.desc"
	picture = GFX_evt_mining_station
	show_sound = event_scanner
	location = FROM

	is_triggered_only = yes

	immediate = {
		save_event_target_as = rock_ship
		from = {
			clear_deposits = yes
			save_event_target_as = rock_brain
			star = { save_event_target_as = rock_sun }
		}
		leader = { save_event_target_as = rock_scientist }
	}

	option = {
		name = anomaly.75.a
		owner = {
			give_specimen = {
				key = mineralized_brain
				targets = { root.from }
			}
		}
		hidden_effect = { ship_event = { id = anomaly.80 days = 5 } }
	}

	option = {
		name = anomaly.75.b
		#custom_tooltip = anomaly.75.b.tooltip
		from = {
			add_deposit = d_physics_2
			add_deposit = d_society_2
		}
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "rock_brain"
					days = -1
				}
			}
		}
	}

	option = {
		name = anomaly.75.c
		custom_tooltip = anomaly.75.c.tooltip
		trigger = {
			owner = {
				is_gestalt = no
				is_lithoid_empire = yes
			}
		}
		icon = {
			icon = GFX_lithoid
			text = IS_LITHOID_EMPIRE_ICON_TIP
		}
		hidden_effect = {
			owner = { country_event = { id = anomaly.76 } }
		}
	}
}

country_event = {
	id = anomaly.76
	title = anomaly.75.name
	desc = anomaly.76.desc
	diplomatic = yes
	is_triggered_only = yes

	picture_event_data = {
		portrait = event_target:rock_scientist
		room = ethic_spaceship_room
	}

	option = {
		name = anomaly.76.a
		custom_tooltip = anomaly.76.a.tooltip
		event_target:rock_brain = {
			add_deposit = d_physics_2
			add_deposit = d_society_2
		}
		hidden_effect = {
			event_target:rock_brain = {
				add_modifier = {
					modifier = "rock_brain"
					days = -1
				}
			}
		}
	}

	option = {
		name = anomaly.76.b
		hidden_effect = {
			country_event = { id = anomaly.77 }
		}
	}
}

country_event = {
	id = anomaly.77
	title = anomaly.75.name
	desc = anomaly.77.desc
	diplomatic = yes
	is_triggered_only = yes

	picture_event_data = {
		portrait = event_target:rock_scientist
		planet_background = pc_ice_asteroid
		room = lithoid_room
	}

	option = {
		name = anomaly.77.a
		response_text = anomaly.77.a.response
		is_dialog_only = yes
	}

	option = {
		name = anomaly.77.b
		response_text = anomaly.77.b.response
		is_dialog_only = yes
	}

	option = {
		name = anomaly.77.c
		response_text = anomaly.77.c.response
		is_dialog_only = yes
	}

	option = {
		name = anomaly.77.d
		hidden_effect = {
			country_event = { id = anomaly.78 }
		}
	}
}

country_event = {
	id = anomaly.78
	title = anomaly.75.name
	desc = anomaly.78.desc
	diplomatic = yes
	is_triggered_only = yes

	picture_event_data = {
		portrait = event_target:rock_scientist
		planet_background = pc_ice_asteroid
		room = lithoid_room
	}

	immediate = {
		random_country = {
			limit = {
				OR = {
					is_country_type = fallen_empire
					is_country_type = awakened_fallen_empire
				}
				OR = {
					is_lithoid_empire = yes
					is_fanatic_xenophile = yes
				}
				NOT = { has_communications = root }
			}
			save_event_target_as = rock_fallen_empire
		}
	}

	option = {
		name = anomaly.78.a
		response_text = anomaly.78.a.response
		is_dialog_only = yes
	}

	option = {
		name = anomaly.78.b1
		response_text = anomaly.78.b1.response
		is_dialog_only = yes
		trigger = {
			exists = event_target:rock_fallen_empire
		}
	}

	option = {
		name = anomaly.78.b2
		response_text = anomaly.78.b2.response
		is_dialog_only = yes
		trigger = {
			NOT = { exists = event_target:rock_fallen_empire }
		}
	}

	option = {
		name = anomaly.78.c
		hidden_effect = {
			country_event = { id = anomaly.79 }
		}
	}
}

country_event = {
	id = anomaly.79
	title = "anomaly.75.name"
	desc = "anomaly.79.desc"
	picture = GFX_evt_mining_station
	#show_sound = event_scanner
	location = event_target:rock_brain

	is_triggered_only = yes

	option = {
		name = anomaly.79.a
		add_modifier = {
			modifier = rock_brain_decoding
			days = -1
		}
	}

	option = {
		name = galactic_features.385.reanimated
		ai_chance = {
			factor = 100
		}
		trigger = {
			is_reanimator = yes
		}

		add_modifier = {
			modifier = rock_brain_decoding
			days = -1
		}

		event_target:rock_brain = {
			enable_special_project = {
				name = "REANIMATE_ROCK_BRAIN"
				location = this
				owner = root
			}
		}
	}
}

### Thinking Asteroid 2
ship_event = {
	id = anomaly.80
	title = "anomaly.80.name"
	desc = "anomaly.80.desc"
	picture = GFX_evt_unidentified_ship
	show_sound = event_structural_collapse
	location = FROM

	is_triggered_only = yes

	option = {
		name = anomaly.80.a
		leader = {
			add_trait = {
				trait = leader_trait_carefree
			}
		}
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier2researchreward
				min = @tier2researchmin
				max = @tier2researchmax
			}
			add_monthly_resource_mult = {
				resource = energy
				value = @tier2materialreward
				min = @tier2materialmin
				max = @tier2materialmax
			}
		}
	}
}

#Reanimated Rock Brain
ship_event = {
	id = anomaly.81
	title = "distar.218.name"
	desc = "anomaly.81.desc"
	location = event_target:rock_brain

	is_triggered_only = yes

	picture = GFX_evt_necromancy
	show_sound = event_collapsing_ruins

	immediate = {
		fromfrom = { save_event_target_as = rock_brain }
		create_fleet = {
			name = "NAME_Asteroid"
			effect = {
				set_owner = root.owner
				create_ship = {
					name = "NAME_Asteroid"
					design = "NAME_Asteroid"
					prefix = no
					upgradable = no
					effect = {
						set_disabled = yes
						save_event_target_as = rock_brain_ship
					}
				}
				set_location = {
					target = event_target:rock_brain
					distance = 0
					angle = random
				}
				set_fleet_stance = passive
			}
			settings = {
				can_upgrade = no
				can_change_composition = no
				can_change_leader = no
				uses_naval_capacity = no
				spawn_debris = no
			}
		}
	}

	option = {
		name = "it_hungers"
		tooltip = { event_target:rock_brain_ship.fleet = { set_owner = root.owner } }
		hidden_effect = {
			event_target:rock_brain_ship = { set_disabled = no }
			event_target:rock_brain = { remove_planet = yes }
		}
	}
}

### Talking Planets
ship_event = {
	id = anomaly.85
	title = "anomaly.85.name"
	desc = "anomaly.85.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 = FROM

	is_triggered_only = yes

	option = {
		name = anomaly.85.a
		owner = {
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier2researchreward
				min = @tier2researchmin
				max = @tier2researchmax
			}
		}
	}

	#option = {
	#	name = anomaly.85.b
	#	owner = { save_event_target_as = ship_owner }
	#	solar_system = {
	#		every_system_planet = {
	#			set_surveyed = {
	#				surveyed = yes
	#				surveyor = event_target:ship_owner
	#			}
	#		}
	#	}
	#}
}

### Cunning Flora
ship_event = {
	id = anomaly.90
	title = "anomaly.90.name"
	desc = "anomaly.90.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_big_landing_ship
		BIOSHIP_PICTURE = GFX_evt_bioship_landing
	}
	show_sound = event_alien_nature
	location = FROM
	trackable = yes

	is_triggered_only = yes

	option = {
		name = anomaly.90.a
		from = {
			enable_special_project = {
				name = "DEAL_WITH_FLORA"
				location = this
				owner = root
			}
		}
		hidden_effect = { owner = { country_event = { id = story.1 days = 30 } } }
	}
}

### Cunning Flora followup
ship_event = {
	id = anomaly.91
	title = "anomaly.91.name"
	desc = "anomaly.91.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_big_landing_ship
		BIOSHIP_PICTURE = GFX_evt_bioship_landing
	}
	show_sound = event_alien_nature
	location = FROM

	is_triggered_only = yes

	option = {
		name = FASCINATING
		fromfrom = {
			add_modifier = {
				modifier = "cunning_flora"
				days = -1
			}
		}
	}

	after = {
		owner = {
			give_specimen = {
				key = cunning_flora_specimen
				targets = { root.fromfrom }
			}
		}
	}
}

### Pioneer Plaque Aliens, asteroid only
ship_event = {
	id = anomaly.95
	title = "anomaly.95.name"
	desc = "anomaly.95.desc"
	picture = GFX_evt_mining_station
	show_sound = event_scanner
	location = FROM

	is_triggered_only = yes

	specimen = aluminium_plaque

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

	option = {
		name = anomaly.95.a
		trigger = {
			owner = {
				is_xenophobe = yes
			}
		}
		owner = {
			add_monthly_resource_mult = {
				resource = influence
				value = @tier1influencereward
				min = @tier1influencemin
				max = @tier1influencemax
			}
		}
	}

	option = {
		name = anomaly.95.b
		custom_tooltip = anomaly.95.b.tooltip
		trigger = {
			any_system = {
				OR = {
					# Commonwealth of Man NPC system
					has_star_flag = com_sol
					# Tomb World
					has_star_flag = nuked_sol
					# Early Space Age Humans
					AND = {
						has_star_flag = primitive_sol
						any_system_planet = {
							exists = owner
							owner = {
								has_country_flag = humans_early_space_age
							}
						}
					}
				}
			}
		}
		leader = {
			add_experience = 200
		}
		owner = {
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
			begin_event_chain = {
				event_chain = "find_sol_chain"
				target = this
			}
		}
		hidden_effect = {
			random_system = {
				limit = {
					OR = {
						# Commonwealth of Man NPC system
						has_star_flag = com_sol
						# Tomb World
						has_star_flag = nuked_sol
						# Early Space Age Humans
						AND = {
							has_star_flag = primitive_sol
							any_system_planet = {
								exists = owner
								owner = {
									has_country_flag = humans_early_space_age
								}
							}
						}
					}
				}
				save_event_target_as = earf
				set_star_flag = sol_target
			}
			owner = {
				set_country_flag = sol_search
				create_point_of_interest = {
					id = sol.1
					name = "sol_1_poi"
					desc = sol_1_desc_neutral
					event_chain = find_sol_chain
					location = event_target:earf
				}
			}
		}
	}


	option = {
		name = anomaly.95.c
		owner = {
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
		}
	}
}

# Scope = Fleet
# From = System
# FromFrom = Country
# also owner, obv
fleet_event = {
	id = anomaly.96
	title = anomaly.96.name
	desc = {
		trigger = {
			owner = {
				NOR = {
					is_xenophobe = yes
					is_xenophile = yes
				}
			}
		}
		text = anomaly.96.desc.neutral
	}
	desc = {
		trigger = {
			owner = {
				is_xenophobe = yes
			}
		}
		text = anomaly.96.desc.phobe
	}
	desc = {
		trigger = {
			owner = {
				is_xenophile = yes
			}
		}
		text = anomaly.96.desc.phile
	}
	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_scanner
	location = FROM

	is_triggered_only = yes

	trigger = {
		from = { has_star_flag = sol_target }
		owner = { has_country_flag = sol_search }
	}

	immediate = {
		from = { remove_star_flag = sol_target }
		owner = {
			remove_country_flag = sol_search
			add_event_chain_counter = {
				event_chain = "find_sol_chain"
				counter = "found"
				amount = 1
			}
		}
	}

	option = {
		name = anomaly.96.a.neutral
		trigger = {
			owner = {
				NOR = {
					is_xenophobe = yes
					is_xenophile = yes
				}
			}
		}
		owner = {
			add_monthly_resource_mult = {
				resource = influence
				value = @tier2influencereward
				min = @tier2influencemin
				max = @tier2influencemax
			}
			end_event_chain = "find_sol_chain"
		}
	}

	option = {
		name = anomaly.96.a.phobe
		trigger = {
			owner = {
				is_xenophobe = yes
			}
		}
		owner = {
			add_monthly_resource_mult = {
				resource = influence
				value = @tier2influencereward
				min = @tier2influencemin
				max = @tier2influencemax
			}
			end_event_chain = "find_sol_chain"
			if = {
				limit = { has_specimen = aluminium_plaque }
				remove_specimen = aluminium_plaque
			}
		}
	}

	option = {
		name = anomaly.96.a.phile
		trigger = {
			owner = {
				is_xenophile = yes
			}
		}
		owner = {
			add_monthly_resource_mult = {
				resource = influence
				value = @tier2influencereward
				min = @tier2influencemin
				max = @tier2influencemax
			}
			end_event_chain = "find_sol_chain"
		}
	}
}

### Pioneer Plaque Humans, asteroid only
ship_event = {
	id = anomaly.100
	title = "anomaly.100.name"
	desc = "anomaly.100.desc"
	picture = GFX_evt_landing_ship_2
	show_sound = event_mystic_reveal
	location = FROM

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = found_pioneer }
		}
	}

	option = {
		name = anomaly.100.a
		owner = {
			add_monthly_resource_mult = {
				resource = influence
				value = @tier1influencereward
				min = @tier1influencemin
				max = @tier1influencemax
			}
		}
	}
}

### Voyager Record Aliens, asteroid only
ship_event = {
	id = anomaly.105
	title = "anomaly.105.name"
	desc = "anomaly.105.desc"
	picture = GFX_evt_unidentified_ship
	show_sound = event_radio_chatter
	location = FROM

	is_triggered_only = yes

	immediate = {
		owner = {
			set_country_flag = found_voyager
			country_event = { id = story.1 days = 30 }
		}
	}

	option = {
		name = anomaly.105.a
		trigger = {
			owner = {
				is_xenophobe = yes
			}
		}
		owner = {
			add_monthly_resource_mult = {
				resource = influence
				value = @tier1influencereward
				min = @tier1influencemin
				max = @tier1influencemax
			}
		}
	}

	option = {
		name = anomaly.105.b
		custom_tooltip = anomaly.105.b.tooltip
		trigger = {
			any_system = {
				OR = {
					# Commonwealth of Man NPC system
					has_star_flag = com_sol
					# Tomb World
					has_star_flag = nuked_sol
					# Early Space Age Humans
					AND = {
						has_star_flag = primitive_sol
						any_system_planet = {
							exists = owner
							owner = {
								has_country_flag = humans_early_space_age
							}
						}
					}
				}
			}
		}
		leader = {
			add_experience = 200
		}
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
			begin_event_chain = {
				event_chain = "find_sol_chain"
				target = this
			}
		}
		hidden_effect = {
			random_system = {
				limit = {
					OR = {
						# Commonwealth of Man NPC system
						has_star_flag = com_sol
						# Tomb World
						has_star_flag = nuked_sol
						# Early Space Age Humans
						AND = {
							has_star_flag = primitive_sol
							any_system_planet = {
								exists = owner
								owner = {
									has_country_flag = humans_early_space_age
								}
							}
						}
					}
				}
				save_event_target_as = earf
				set_star_flag = sol_target
			}
			root = {
				owner = {
					set_country_flag = sol_search
					create_point_of_interest = {
						id = sol.1
						name = "sol_1_poi"
						desc = sol_1_desc_neutral
						event_chain = find_sol_chain
						location = event_target:earf
					}
				}
			}
		}
	}


	option = {
		name = anomaly.105.c
		owner = {
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
		}
	}
}

# found sol, voyager
fleet_event = {
	id = anomaly.106
	title = anomaly.106.name
	desc = {
		text = anomaly.106.desc.neutral
	}
	desc = {
		exclusive_trigger = {
			owner = {
				is_xenophobe = yes
			}
		}
		text = anomaly.106.desc.phobe
	}
	desc = {
		exclusive_trigger = {
			owner = {
				is_xenophile = yes
			}
		}
		text = anomaly.106.desc.phile
	}
	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_scanner
	location = FROM

	is_triggered_only = yes

	trigger = {
		exists = owner
		owner = { has_country_flag = sol_search }
		from = { has_star_flag = sol_target }
	}

	immediate = {
		from = { remove_star_flag = sol_target }
		owner = {
			remove_country_flag = sol_search
			add_event_chain_counter = {
				event_chain = "find_sol_chain"
				counter = "found"
				amount = 1
			}
		}
	}

	option = {
		name = anomaly.106.a.neutral
		owner = {
			add_monthly_resource_mult = {
				resource = influence
				value = @tier1influencereward
				min = @tier1influencemin
				max = @tier1influencemax
			}
			end_event_chain = "find_sol_chain"
		}
	}

	option = {
		name = anomaly.106.a.phobe
		exclusive_trigger = {
			owner = {
				is_xenophobe = yes
			}
		}
		owner = {
			add_monthly_resource_mult = {
				resource = influence
				value = @tier1influencereward
				min = @tier1influencemin
				max = @tier1influencemax
			}
			end_event_chain = "find_sol_chain"
		}
	}

	option = {
		name = anomaly.106.a.phile
		exclusive_trigger = {
			owner = {
				is_xenophile = yes
			}
		}
		owner = {
			add_monthly_resource_mult = {
				resource = influence
				value = @tier1influencereward
				min = @tier1influencemin
				max = @tier1influencemax
			}
			end_event_chain = "find_sol_chain"
		}
	}
}

### Voyager Record Humans, continental/tropical only
ship_event = {
	id = anomaly.110
	title = "anomaly.110.name"
	desc = "anomaly.110.desc"
	picture = GFX_evt_sapient_AI
	show_sound = event_mystic_reveal
	location = FROM

	is_triggered_only = yes

	specimen = golden_phonograph_record

	immediate = {
		owner = { set_country_flag = found_voyager }
	}

	option = {
		name = anomaly.110.a
		owner = {
			add_monthly_resource_mult = {
				resource = influence
				value = @tier1influencereward
				min = @tier1influencemin
				max = @tier1influencemax
			}
		}
	}
}

### Genetic Library, asteroid only
ship_event = {
	id = anomaly.115
	title = "anomaly.115.name"
	desc = "anomaly.115.desc"
	picture = GFX_evt_society_research
	show_sound = event_laboratory_sound
	location = FROM

	is_triggered_only = yes
	auto_opens = yes

	specimen = dna_archive

	immediate = { from = { clear_deposits = yes } }

	option = {
		name = FASCINATING
	}

	option = {
		exclusive_trigger = { owner = { has_origin = origin_evolutionary_predators } }
		name = anomaly.115.b.evopred
		owner = { give_evolutionary_predator_situation_progress_and_dna = { AMOUNT = small } }
	}

	after = {
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		from = {
			add_modifier = {
				modifier = old_genetic_library
				days = -1
			}
			add_deposit = d_engineering_2
			add_deposit = d_society_2
		}
	}
}

### Monolith Museum, uninhabitable planet only
ship_event = {
	id = anomaly.120
	title = "anomaly.120.name"
	desc = "anomaly.120.desc"
	picture = GFX_evt_alien_city
	show_sound = event_scanner
	location = FROM

	is_triggered_only = yes

	option = {
		name = anomaly.120.a
		owner = {
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
		}
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
	}

	option = {
		name = anomaly.120.b
		custom_tooltip = anomaly.120.b.tooltip
		trigger = {
			owner = {
				NOR = {
					is_xenophobe = yes
					is_xenophile = yes
					is_gestalt = no
				}
			}
		}
		hidden_effect = {
			owner = {
				country_event = { id = story.5 days = 2 }
				if = {
					limit = {
						pop_ethic_amount = {
							ethic != ethic_xenophile
							amount > 1200
						}
					}
					set_country_flag = eddic_1
					country_event = { id = anomaly.121 days = 4 }
				}
				else_if = {
					limit = {
						pop_ethic_amount = {
							ethic != ethic_xenophile
							amount > 600
						}
					}
					set_country_flag = eddic_2
					country_event = { id = anomaly.121 days = 4 }
				}
			}
		}
	}

	after = {
		owner = {
			give_specimen = {
				key = cenotaph_display
				targets = { root.fromfrom }
			}
		}
	}
}

country_event = {
	id = anomaly.121
	title = anomaly.120.name
	desc = anomaly.121.desc
	picture = GFX_evt_alien_city
	show_sound = event_scanner
	location = FROMFROM

	is_triggered_only = yes

	option = {
		name = INTRIGUING
		custom_tooltip = anomaly.121.a.tooltip
		trigger = { has_country_flag = eddic_1 }
		hidden_effect = {
			remove_country_flag = eddic_1
			while = {
				count = 6
				pop_group_add_ethic_effect = {
					ETHOS = ethic_xenophile
					AMOUNT = 100
					RANDOM = 25
				}
			}
		}
	}
	option = {
		name = INTERESTING
		custom_tooltip = anomaly.121.b.tooltip
		trigger = { has_country_flag = eddic_2 }
		hidden_effect = {
			remove_country_flag = eddic_2
			while = {
				count = 3
				pop_group_add_ethic_effect = {
					ETHOS = ethic_xenophile
					AMOUNT = 100
					RANDOM = 25
				}
			}
		}
	}
}

### Derelict Star Chart, molten planet only
#ship_event = {
#	id = anomaly.125
#	title = "anomaly.125.name"
#	desc = "anomaly.125.desc"
#	picture = GFX_evt_molten
#	show_sound = event_ship_thrusters
#	location = FROM
#
#	is_triggered_only = yes
#
#	option = {
#		name = anomaly.125.a
#		solar_system = {
#			every_system_planet = {
#				set_surveyed = {
#					surveyed = yes
#					surveyor = root.owner
#				}
#			}
#		}
#	}
#}

### Transient Gravitational Anomaly, asteroid only
ship_event = {
	id = anomaly.130
	title = "anomaly.130.name"
	desc = "anomaly.130.desc"
	picture = GFX_evt_wormhole
	show_sound = event_space_cloud
	location = FROM

	is_triggered_only = yes
	auto_opens = yes

	trigger = {
		FROM = { is_planet_class = pc_asteroid }
	}

	option = {
		name = anomaly.130.a
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
		}
		leader = { add_experience = 100 }
	}
}

### Abandoned Playground, GEN_PLAYGROUND_CAT
# Gives society and engineering research
ship_event = {
	id = anomaly.135
	title = "anomaly.135.name"
	desc = "anomaly.135.desc"
	picture = GFX_evt_huge_monument
	show_sound = event_administrative_work
	location = FROM

	is_triggered_only = yes
	auto_opens = yes

	specimen = spiraling_attraction

	trigger = {
		FROM = {
			NOR = {
				is_planet_class = pc_asteroid
				is_planet_class = pc_gas_giant
			}
		}
	}

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

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

### Familiar Shrine, AST_SHRINE_1_CAT
ship_event = {
	id = anomaly.140
	title = "anomaly.140.name"
	desc = "anomaly.140.desc"
	picture = GFX_evt_asteroid_approaching_planet
	show_sound = event_mystic_reveal
	location = FROM
	event_chain = old_gods_chain

	is_triggered_only = yes

	immediate = {
		closest_system = {
			limit = {
				NOR = {
					has_star_flag = hostile_system
					is_same_value = root.solar_system
					is_pirate_system = yes
					any_system_planet = { is_colony = yes }
				}
				has_access_fleet = root.owner
			}
			min_steps = 1
			max_steps = 8
			set_star_flag = old_gods_system_1@root.owner
		}
		closest_system = {
			limit = {
				NOR = {
					has_star_flag = old_gods_system_1@root.owner
					has_star_flag = hostile_system
					is_same_value = root.solar_system
					is_pirate_system = yes
					any_system_planet = { is_colony = yes }
				}
				has_access_fleet = root.owner
			}
			min_steps = 2
			max_steps = 9
			set_star_flag = old_gods_system_2@root.owner
		}
		closest_system = {
			limit = {
				NOR = {
					has_star_flag = old_gods_system_1@root.owner
					has_star_flag = old_gods_system_2@root.owner
					is_same_value = root.solar_system
					has_star_flag = hostile_system
					is_pirate_system = yes
					any_system_planet = { is_colony = yes }
				}
				has_access_fleet = root.owner
			}
			min_steps = 3
			max_steps = 10
			set_star_flag = old_gods_system_3@root.owner
		}
		owner = {
			begin_event_chain = {
				event_chain = "old_gods_chain"
				target = root.owner
			}
		}
	}

	option = {
		name = "anomaly.140.a"
		custom_tooltip = "anomaly.140.a.tooltip"
		trigger = {	owner = { is_fanatic_spiritualist = no } }
		hidden_effect = {
			owner = {
				end_event_chain = old_gods_chain
			}
		}
	}

	option = {
		name = "anomaly.140.c"
		custom_tooltip = "anomaly.140.c.tooltip"
		trigger = {	owner = { is_fanatic_spiritualist = yes } }
		hidden_effect = {
			owner = {
				end_event_chain = old_gods_chain
			}
		}
	}

	option = {
		trigger = {
			any_system = { has_star_flag = old_gods_system_1@root.owner }
			any_system = { has_star_flag = old_gods_system_2@root.owner }
			any_system = { has_star_flag = old_gods_system_3@root.owner }
		}
		name = "anomaly.140.b"
		owner = {
			tooltip = {
				begin_event_chain = {
					event_chain = "old_gods_chain"
					target = root.owner
				}
			}
		}
		hidden_effect = {
			random_system = {
				limit = { has_star_flag = old_gods_system_1@root.owner }
				save_event_target_as = old_gods_system_1
			}
			random_system = {
				limit = { has_star_flag = old_gods_system_2@root.owner }
				save_event_target_as = old_gods_system_2
			}
			random_system = {
				limit = { has_star_flag = old_gods_system_3@root.owner }
				save_event_target_as = old_gods_system_3
			}
			create_point_of_interest = {
				id = old_gods_shrine_poi.1
				name = "old_gods_shrine_poi_1"
				desc = "old_gods_shrine_poi_1_desc"
				event_chain = "old_gods_chain"
				location = event_target:old_gods_system_1
			}
			create_point_of_interest = {
				id = old_gods_shrine_poi.2
				name = "old_gods_shrine_poi_2"
				desc = "old_gods_shrine_poi_2_desc"
				event_chain = "old_gods_chain"
				location = event_target:old_gods_system_2
			}
			create_point_of_interest = {
				id = old_gods_shrine_poi.3
				name = "old_gods_shrine_poi_3"
				desc = "old_gods_shrine_poi_3_desc"
				event_chain = "old_gods_chain"
				location = event_target:old_gods_system_3
			}
		}
	}
}

# Entering Old God Shrine system (HIDDEN)
#ship_event = {
#	id = anomaly.141
#	hide_window = yes
#
#	is_triggered_only = yes
#
#	trigger = {
#		owner = { has_event_chain = "old_gods_chain" }
#		FROM = {
#			OR = {
#				has_star_flag = old_gods_system_1
#				has_star_flag = old_gods_system_2
#				has_star_flag = old_gods_system_3
#			}
#		}
#	}
#
#	immediate = {
#		if = {
#			limit = { FROM = { has_star_flag = old_gods_system_1 } }
#			FROM = { remove_star_flag = old_gods_system_1 }
#			owner = { remove_point_of_interest = old_gods_shrine_poi.1 }
#			ship_event = { id = anomaly.142 }
#		}
#		if = {
#			limit = { FROM = { has_star_flag = old_gods_system_2 } }
#			FROM = { remove_star_flag = old_gods_system_2 }
#			owner = { remove_point_of_interest = old_gods_shrine_poi.2 }
#			ship_event = { id = anomaly.143 }
#		}
#		if = {
#			limit = { FROM = { has_star_flag = old_gods_system_3 } }
#			FROM = { remove_star_flag = old_gods_system_3 }
#			owner = { remove_point_of_interest = old_gods_shrine_poi.3 }
#			ship_event = { id = anomaly.144 }
#		}
#	}
#}

# OLD GODS - THE BENEFACTRESS DISCOVERED, NEEDS SOCIETY
fleet_event = {
	id = anomaly.142
	title = "anomaly.142.name"
	desc = anomaly.142.desc
	picture = GFX_evt_ship_travel
	show_sound = event_mystic_reveal
	location = event_target:shrine
	trackable = yes
	event_chain = old_gods_chain

	is_triggered_only = yes

	trigger = {
		owner = { has_event_chain = "old_gods_chain" }
		FROM = {
			has_star_flag = old_gods_system_1@root.owner
		}
	}

	immediate = {
		FROM = { remove_star_flag = old_gods_system_1@root.owner }
		owner = { remove_point_of_interest = old_gods_shrine_poi.1 }
		create_ambient_object = {
			type = "shrine_object"
			location = solar_system
		}
		last_created_ambient_object = {
			save_event_target_as = shrine
			enable_special_project = {
				name = "OLD_GODS_BENEFACTRESS_PROJECT"
				location = this
				owner = root
			}
		}
		owner = { set_country_flag = old_gods_benefactress }
	}

	option = {
		name = "anomaly.142.a"
	}
}

# OLD GODS - THE UNDAUNTED DISCOVERED, NEEDS ENGINEERING
fleet_event = {
	id = anomaly.143
	title = "anomaly.143.name"
	desc = anomaly.143.desc
	picture = GFX_evt_ship_travel
	show_sound = event_mystic_reveal
	location = event_target:shrine
	trackable = yes
	event_chain = old_gods_chain

	is_triggered_only = yes

	trigger = {
		owner = { has_event_chain = "old_gods_chain" }
		FROM = {
			has_star_flag = old_gods_system_2@root.owner
		}
	}

	immediate = {
		FROM = { remove_star_flag = old_gods_system_2@root.owner }
		owner = { remove_point_of_interest = old_gods_shrine_poi.2 }
		create_ambient_object = {
			type = "shrine_object"
			location = solar_system
		}
		last_created_ambient_object = {
			save_event_target_as = shrine
			enable_special_project = {
				name = "OLD_GODS_UNDAUNTED_PROJECT"
				location = this
				owner = root
			}
		}
		owner = { set_country_flag = old_gods_undaunted }
	}

	option = {
		name = "anomaly.143.a"
	}
}

# OLD GODS - THE PERCIPIENT DISCOVERED, NEEDS PHYSICS
fleet_event = {
	id = anomaly.144
	title = "anomaly.144.name"
	desc = anomaly.144.desc
	picture = GFX_evt_ship_travel
	show_sound = event_mystic_reveal
	location = event_target:shrine
	trackable = yes
	event_chain = old_gods_chain

	is_triggered_only = yes

	trigger = {
		owner = { has_event_chain = "old_gods_chain" }
		FROM = {
			has_star_flag = old_gods_system_3@root.owner
		}
	}

	immediate = {
		FROM = { remove_star_flag = old_gods_system_3@root.owner }
		owner = { remove_point_of_interest = old_gods_shrine_poi.3 }
		create_ambient_object = {
			type = "shrine_object"
			location = solar_system
		}
		last_created_ambient_object = {
			save_event_target_as = shrine
			enable_special_project = {
				name = "OLD_GODS_PERCIPIENT_PROJECT"
				location = this
				owner = root
			}
		}
		owner = { set_country_flag = old_gods_percipient }
	}

	option = {
		name = "anomaly.144.a"
	}
}

# OLD GODS - THE BENEFACTRESS RESEARCHED
ship_event = {
	id = anomaly.165
	title = "anomaly.165.name"
	desc = "anomaly.165.desc"
	picture = GFX_evt_mining_station
	show_sound = event_mystic_reveal
	location = fromfrom
	event_chain = old_gods_chain

	is_triggered_only = yes

	immediate = {
		owner = {
			add_event_chain_counter = {
				event_chain = "old_gods_chain"
				counter = "shrines_searched"
				amount = 1
			}
		}
	}

	option = {
		name = FASCINATING
		hidden_effect = {
			fromfrom = { destroy_ambient_object = this }
			owner = {
				if = {
					limit = {
						has_completed_event_chain_counter = {
							event_chain = old_gods_chain
							counter = shrines_searched
						}
					}
					country_event = { id = anomaly.168 }
				}
			}
		}
	}
}

# OLD GODS - THE UNDAUNTED RESEARCHED
ship_event = {
	id = anomaly.166
	title = "anomaly.166.name"
	desc = "anomaly.166.desc"
	picture = GFX_evt_mining_station
	show_sound = event_mystic_reveal
	location = fromfrom
	event_chain = old_gods_chain

	is_triggered_only = yes

	immediate = {
		owner = {
			add_event_chain_counter = {
				event_chain = "old_gods_chain"
				counter = "shrines_searched"
				amount = 1
			}
		}
	}

	option = {
		name = FASCINATING
		hidden_effect = {
			fromfrom = { destroy_ambient_object = this }
			owner = {
				if = {
					limit = {
						has_completed_event_chain_counter = {
							event_chain = old_gods_chain
							counter = shrines_searched
						}
					}
					country_event = { id = anomaly.168 }
				}
			}
		}
	}
}

# OLD GODS - THE PERCIPIENT RESEARCHED
ship_event = {
	id = anomaly.167
	title = "anomaly.167.name"
	desc = "anomaly.167.desc"
	picture = GFX_evt_mining_station
	show_sound = event_mystic_reveal
	location = fromfrom
	event_chain = old_gods_chain

	is_triggered_only = yes

	immediate = {
		owner = {
			add_event_chain_counter = {
				event_chain = "old_gods_chain"
				counter = "shrines_searched"
				amount = 1
			}
		}
	}

	option = {
		name = FASCINATING
		hidden_effect = {
			fromfrom = { destroy_ambient_object = this }
			owner = {
				if = {
					limit = {
						has_completed_event_chain_counter = {
							event_chain = "old_gods_chain"
							counter = "shrines_searched"
						}
					}
					country_event = { id = anomaly.168 }
				}
			}
		}
	}
}

# OLD GODS - CHAIN COMPLETE
country_event = {
	id = anomaly.168
	title = "anomaly.168.name"
	desc = "anomaly.168.desc"
	picture = GFX_evt_metropolis
	show_sound = event_mystic_reveal
	event_chain = old_gods_chain

	is_triggered_only = yes

	immediate = {
		set_country_flag = completed_old_gods
	}

	# Suppress the findings
	option = {
		name = "anomaly.168.a"
		custom_tooltip = "anomaly.168.a.tooltip"
		end_event_chain = "old_gods_chain"
		add_monthly_resource_mult = {
			resource = influence
			value = @tier2influencereward
			min = @tier2influencemin
			max = @tier2influencemax
		}
	}
	# Monetize this
	option = {
		name = "anomaly.168.b"
		add_monthly_resource_mult = {
			resource = energy
			value = @tier3materialreward
			min = @tier3materialmin
			max = @tier3materialmax
		}
		end_event_chain = "old_gods_chain"
	}
	# What can we learn?
	option = {
		name = "anomaly.168.c"
		add_monthly_resource_mult = {
			resource = society_research
			value = @tier3researchreward
			min = @tier3researchmin
			max = @tier3researchmax
		}
		end_event_chain = "old_gods_chain"
	}
	# Divine favor
	option = {
		name = "anomaly.168.d"
		if = {
			limit = {
				NOT = { has_ethic = "ethic_fanatic_spiritualist" }
			}
			add_monthly_resource_mult = {
				resource = unity
				value = @tier3unityreward
				min = @tier3unitymin
				max = @tier3unitymax
			}
			shift_ethic = "ethic_spiritualist"
			hidden_effect = {
				while = {
					count = 3
					pop_group_add_ethic_effect = {
						ETHOS = ethic_spiritualist
						PERCENTAGE = 0.5
						RANDOM = 0.1
					}
				}
			}
		}
		else = {
			add_monthly_resource_mult = {
				resource = unity
				value = @tier4unityreward
				min = @tier4unitymin
				max = @tier4unitymax
			}
		}
		end_event_chain = "old_gods_chain"
	}
}

### What Music They Make, HBL_MUSIC_1_CAT
ship_event = {
	id = anomaly.145
	title = "anomaly.145.name"
	desc = "anomaly.145.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 = { owner = { set_country_flag = HBL_MUSIC_1_FLAG } }

	option = {
		name = FASCINATING
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
		}
		hidden_effect = {
			owner = { country_event = { id = story.3 days = 30 } }
		}
	}

	option = {
		exclusive_trigger = { owner = { has_origin = origin_evolutionary_predators } }
		name = anomaly.145.b.evopred
		owner = {
			give_evolutionary_predator_situation_progress_and_dna = { AMOUNT = medium }
			owner = {
				add_monthly_resource_mult = {
					resource = society_research
					value = @tier3researchreward
					min = @tier3researchmin
					max = @tier3researchmax
				}
			}
			hidden_effect = {
				owner = { country_event = { id = story.3 days = 30 } }
			}
		}
	}

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

### Below Zro, GAS_ZRO_ICE_CAT
# Adds 2 Zro to gas giant
ship_event = {
	id = anomaly.150
	title = "anomaly.150.name"
	desc = "anomaly.150.desc"
	picture = GFX_evt_gas_giant
	show_sound = event_scanner
	location = FROM

	is_triggered_only = yes

	immediate = { from = { clear_deposits = yes } }

	option = {
		name = FASCINATING
		custom_tooltip = "anomaly.150.a.tooltip"
		FROM = {
			hidden_effect = {
				add_zro = yes
			}
		}
		hidden_effect = { ship_event = { id = action.941 days = 1 scopes = { from = fromfrom } } }
	}
}

### Illicit Matter, AST_ILLICIT_DARK_CAT
# Adds 2 Dark Matter to asteroid
ship_event = {
	id = anomaly.155
	title = "anomaly.155.name"
	desc = "anomaly.155.desc"
	picture = GFX_evt_mining_station
	show_sound = event_activating_unknown_technology
	location = FROM

	is_triggered_only = yes

	immediate = { from = { clear_deposits = yes } }

	option = {
		name = FASCINATING
		hidden_effect = {
			owner = { country_event = { id = story.5 days = 30 } }
			ship_event = { id = action.941 days = 1 scopes = { from = fromfrom } }
		}
		FROM = {
			custom_tooltip = anomaly.155.a.tooltip
			hidden_effect = {
				add_modifier = {
					modifier = "dark_matter_funnel"
					days = -1
				}
				add_dark_matter = yes
			}
		}
	}

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

### Purple Rain, TOX_PURPLE_RAIN_CAT
# + Happiness mod
ship_event = {
	id = anomaly.160
	title = "anomaly.160.name"
	desc = "anomaly.160.desc"
	picture = GFX_evt_alien_nature
	show_sound = event_alien_nature
	location = FROM

	is_triggered_only = yes

	option = {
		name = REMARKABLE
		owner = {
			add_modifier = {
				modifier = inspired_arts
				days = 7200
			}
		}
	}

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

# Exiled scientist
ship_event = {
	id = anomaly.170
	title = "anomaly.170.name"
	desc = "anomaly.170.desc"
	show_sound = event_airlock
	picture = GFX_evt_outpost
	location = FROM

	is_triggered_only = yes

	immediate = {
		from = {
			save_event_target_as = exile_frozen_world
		}
	}

	option = {
		name = anomaly.170.a
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
		}
		hidden_effect = {
			random_list = {
				20 = { ship_event = { id = anomaly.172 days = 5 } }
				80 = { ship_event = { id = anomaly.171 days = 5 } }
			}
		}
	}

	option = {
		name = anomaly.170.b
		custom_tooltip = "anomaly.170.b.tooltip"
		hidden_effect = {
			owner = {
				create_leader = {
					class = scientist
					species = owner_main_species
					name = "NAME_The_Exile"
					skill = 3
					event_leader = yes
					background_planet = event_target:exile_frozen_world
					custom_description = "the_exile_background"
				}
				last_created_leader = {
					add_experience = 500
				}
				create_message = {
					type = MESSAGE_RECRUITED_LEADER
					localization =  MESSAGE_RECRUITED_LEADER_DESC
					days = @toast_message_days
					target = last_created_leader
					variable = {
						type = name
						localization = LEADER
						scope = last_created_leader
					}
					variable = {
						key = "border"
						value = "GFX_border_veteran"
					}
				}
			}
		}
	}
}

# Exile followup 1
ship_event = {
	id = anomaly.171
	title = "anomaly.171.name"
	desc = "anomaly.171.desc"
	show_sound = event_mystic_reveal
	picture = GFX_evt_outpost
	location = FROMFROM

	is_triggered_only = yes

	option = {
		name = "anomaly.171.a"
	}
}

# Exile followup 2
ship_event = {
	id = anomaly.172
	title = "anomaly.172.name"
	desc = "anomaly.172.desc"
	show_sound = event_mystic_reveal
	picture = GFX_evt_outpost
	location = FROMFROM

	is_triggered_only = yes

	option = {
		name = UNFORTUNATE
	}
}

# Stellar Salt
ship_event = {
	id = anomaly.175
	title = "anomaly.175.name"
	desc = "anomaly.175.desc"
	show_sound = event_scanner
	picture = GFX_evt_outpost
	location = FROMFROM

	is_triggered_only = yes

	option = {
		name = "anomaly.175.a"
		owner = {
			add_modifier = {
				modifier = stellar_salt
				days = 7200
			}
		}
	}
}

# Nimkip
ship_event = {
	id = anomaly.180
	title = "anomaly.180.name"
	desc = "anomaly.180.desc"
	show_sound = event_alien_nature
	picture = GFX_evt_alien_nature
	location = FROMFROM

	is_triggered_only = yes

	option = {
		name = "anomaly.180.a"
		trigger = {
			owner = {
				has_technology = tech_alien_life_studies
				NOR = {
					has_country_flag = timed_trop_pets
					has_policy_flag = interference_not_allowed
				}
			}
		}
		hidden_effect = { owner = { country_event = { id = story.1 days = 30 } } }
		from = {
			while = {
				count = 2
				add_deposit = d_alien_pets_deposit
			}
		}
		hidden_effect = {
			owner = {
				set_timed_country_flag = { flag = timed_trop_pets days = 1200 }
				give_specimen = { key = crimson_nimkips }
			}
		}
	}

	option = {
		name = "anomaly.180.b"
		trigger = {
			owner = {
				OR = {
					is_xenophobe = yes
					is_militarist = yes
					has_civic = civic_machine_terminator
					has_civic = civic_fanatic_purifiers
				}
				NOR = {
					is_xenophile = yes
					has_policy_flag = interference_not_allowed
					has_country_flag = timed_trop_pets
				}
			}
		}
		custom_tooltip = "anomaly.180.b.tooltip"
		owner = {
			add_monthly_resource_mult = {
				resource = influence
				value = @tier1influencereward
				min = @tier1influencemin
				max = @tier1influencemax
			}
		}
		hidden_effect = {
			owner = {
				set_timed_country_flag = { flag = timed_trop_pets days = 1200 }
			}
		}
	}

	option = {
		name = "anomaly.180.c"
		trigger = {
			owner = { has_policy_flag = interference_not_allowed }
		}
	}

	option = {
		name = "anomaly.180.d"
		trigger = {
			owner = { NOR = { has_policy_flag = interference_not_allowed has_civic = civic_machine_terminator has_civic = civic_hive_devouring_swarm } }
		}
	}

	option = {
		name = "anomaly.180.e"
		trigger = {
			owner = {
				has_civic = civic_hive_devouring_swarm
				NOR = {
					has_policy_flag = interference_not_allowed
					has_country_flag = timed_trop_pets
				}
			}
		}
		custom_tooltip = "anomaly.180.e.tooltip"
		owner = {
			add_monthly_resource_mult = {
				resource = influence
				value = @tier1influencereward
				min = @tier1influencemin
				max = @tier1influencemax
			}
		}
		hidden_effect = {
			owner = {
				set_timed_country_flag = { flag = timed_trop_pets days = 1200 }
			}
		}
	}
}


# Planetary Projection
ship_event = {
	id = anomaly.190
	title = "anomaly.190.name"
	desc = "anomaly.190.desc"
	show_sound = event_radio_chatter
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit_3
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	location = FROM
	trackable = yes

	is_triggered_only = yes

	immediate = { from = { clear_deposits = yes } }

	option = {
		name = OK
		hidden_effect = {
			from = {
				random_moon = {
					set_carrier_flag = projecting_moon
					enable_special_project = {
						name = "PROJECTING_MOON_PROJECT"
						location = this
						owner = root
					}
				}
			}
		}
	}
}

# Planetary Projection followup
carrier_event = {
	id = anomaly.191
	title = "anomaly.191.name"
	desc = "anomaly.191.desc"
	show_sound = event_radio_chatter
	picture = GFX_evt_asteroid_approaching_planet
	location = fromfrom

	is_triggered_only = yes

	option = {
		name = INTRIGUING
		custom_tooltip = anomaly.191.a.tooltip
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		hidden_effect = {
			add_modifier = {
				modifier = projecting_moon
				days = -1
			}
			add_deposit = d_engineering_3
			set_surveyed = {
				surveyed = yes
				surveyor = event_target:ship_owner
			}
			remove_carrier_flag = projecting_moon
		}
	}
}

# Misty Shores
ship_event = {
	id = anomaly.195
	title = "anomaly.195.name"
	desc = "anomaly.195.desc"
	show_sound = event_mystic_reveal
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit_3
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	location = FROM

	is_triggered_only = yes

	option = {
		name = FASCINATING
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		leader = {
			add_experience = 200
		}
	}

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

# Old Geothermal Installation
ship_event = {
	id = anomaly.200
	title = "anomaly.200.name"
	desc = "anomaly.200.desc"
	show_sound = event_structural_collapse
	picture = GFX_evt_mining_operations
	location = FROM

	is_triggered_only = yes

	immediate = { from = { clear_deposits = yes } }

	option = {
		name = EXCELLENT
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		owner = {
			add_monthly_resource_mult = {
				resource = energy
				value = @tier2materialreward
				min = @tier2materialmin
				max = @tier2materialmax
			}
		}
		from = {
			add_deposit = d_engineering_3
		}
	}
}

# Completely Leveled
ship_event = {
	id = anomaly.205
	title = "anomaly.205.name"
	desc = "anomaly.205.desc"
	show_sound = event_structural_collapse
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	location = FROM

	is_triggered_only = yes

	immediate = {
		from = {
			every_deposit = {
				limit = { is_blocker = yes }
				clear_blocker = yes
			}
		}
	}

	option = {
		name = anomaly.205.a
		custom_tooltip = "anomaly.205.a.tooltip"
	}
}

# Dimensional Duplicate
ship_event = {
	id = anomaly.210
	title = "anomaly.210.name"
	desc = "anomaly.210.desc"
	show_sound = event_mystic_reveal
	picture = GFX_evt_ship_travel
	location = FROM

	is_triggered_only = yes

	immediate = { owner = { set_country_flag = dimensional_pocketed } }

	option = {
		name = UNFORTUNATE
		leader = {
			add_experience = 200
		}
		hidden_effect = {
			ship_event = { id = anomaly.211 days = 33 }
		}
	}
}

# Dimensional Duplicate followup
ship_event = {
	id = anomaly.211
	title = "anomaly.211.name"
	desc = {
		trigger = {
			owner = {
				country_uses_bio_ships = no
			}
		}
		text = "anomaly.211.desc"
	}
	desc = {
		trigger = {
			owner = {
				country_uses_bio_ships = yes
			}
		}
		text = "anomaly.211.desc.bio"
	}
	show_sound = event_mystic_reveal
	picture = GFX_evt_ship_travel
	location = FROMFROM

	is_triggered_only = yes

	immediate = { fromfrom = { save_event_target_as = dimensional_planet } }

	option = {
		name = anomaly.211.a
		custom_tooltip = anomaly.211.a.tooltip
		hidden_effect = {
			owner = {
				save_event_target_as = owner_country
				create_fleet = {
					name = "NAME_Other_Science_Ship"
					effect = {
						set_owner = prev
						if = {
							limit = {
								has_first_contact_dlc = yes
							}
							create_ship_design = {
								design = "NAME_From_Beyond_Ship_Cloak"
							}
						}
						else = {
							create_ship_design = {
								design = "NAME_From_Beyond_Ship"
							}
						}
						create_ship = {
							name = "NAME_From_Beyond"
							design = last_created_design
							graphical_culture = "extra_dimensional_01"
							prefix = no
							upgradable = no
							effect = {
								set_ship_flag = special_science_ship
							}
						}
						set_location = fromfrom
					}
				}
			}
		}
	}

	option = {
		name = anomaly.211.b
		trigger = {
			owner = { is_machine_empire = no }
		}
		custom_tooltip = anomaly.211.b.tooltip
		hidden_effect = {
			ship_event = { id = anomaly.212 }
		}
	}
	option = {
		name = anomaly.211.c
		trigger = {
			owner = { is_machine_empire = yes }
		}
		custom_tooltip = anomaly.211.b.tooltip
		hidden_effect = {
			ship_event = { id = anomaly.212 }
		}
	}
}

ship_event = {
	id = anomaly.212
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		create_country = {
			name = "NAME_5th_Dimensionalists"
			type = faction
			effect = {
				establish_communications_no_message = root.owner
				establish_contact = { who = root.owner location = root.fleet.solar_system }
				save_event_target_as = dimensional
				create_fleet = {
					name = "NAME_From_Beyond"
					effect = {
						set_owner = prev
						create_ship = {
							name = "NAME_Ship_of_Unknown_Origin"
							design = "NAME_Dagger"
							graphical_culture = "extra_dimensional_01"
							prefix = no
						}
						set_location = event_target:dimensional_planet
					}
				}
				set_faction_hostility = { set_hostile = yes }
			}
		}
	}
}

# Cornucopia
ship_event = {
	id = anomaly.215
	title = "anomaly.215.name"
	desc = {
		text = anomaly.215.desc
		trigger = {
			hidden:owner = {
				NOT = { has_civic = civic_machine_servitor }
			}
		}
	}
	desc = {
		text = anomaly.215.desc.serv
		trigger = {
			hidden:owner = {
				has_civic = civic_machine_servitor
			}
		}
	}

	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_big_landing_ship
		BIOSHIP_PICTURE = GFX_evt_bioship_landing
	}
	show_sound = event_alien_nature
	location = FROM

	is_triggered_only = yes
	auto_opens = yes

	option = {
		name = FANTASTIC
		from = {
			hidden_effect = {
				add_modifier = {
					modifier = "cornucopia"
					days = -1
				}
			}
			add_deposit = d_hyperfertile_valley
		}
	}

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

# Wealth of raw materials
ship_event = {
	id = anomaly.220
	title = "anomaly.220.name"
	desc = "anomaly.220.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_big_landing_ship
		BIOSHIP_PICTURE = GFX_evt_bioship_landing
	}
	show_sound = event_scanner
	location = FROM

	is_triggered_only = yes
	auto_opens = yes

	option = {
		name = FANTASTIC
		from = {
			hidden_effect = {
				add_modifier = {
					modifier = "raw_materials"
					days = -1
				}
			}
			add_deposit = d_rich_mountain
			add_deposit = d_submerged_ore_veins
		}
	}
}

# Shadow Play
ship_event = {
	id = anomaly.225
	title = "anomaly.225.name"
	desc = "anomaly.225.desc"
	picture = GFX_evt_atmospheric_flight
	show_sound = event_mystic_reveal
	location = FROM

	is_triggered_only = yes

	immediate = { from = { clear_deposits = yes } }

	option = {
		name = OK
		custom_tooltip = anomaly.225.a.tooltip
		hidden_effect = {
			from = {
				add_modifier = {
					modifier = shadow_play
					days = -1
				}
			}
			from = {
				add_deposit = d_society_4
			}
		}
	}
}

# Grimacing
ship_event = {
	id = anomaly.230
	title = "anomaly.230.name"
	desc = {
		trigger = { owner = { has_technology = tech_terrestrial_sculpting } }
		text = anomaly.230.desc.v1
	}
	desc = {
		trigger = { owner = { NOT = { has_technology = tech_terrestrial_sculpting } } }
		text = anomaly.230.desc.v2
	}
	picture = GFX_evt_cold_barren
	show_sound = event_scanner
	location = FROM

	is_triggered_only = yes

	immediate = {
		from = { clear_deposits = yes }
		owner = {
			set_country_flag = grimacing_divination_flag
		}
	}

	option = {
		name = anomaly.230.a
		custom_tooltip = anomaly.230.a.tooltip
		hidden_effect = {
			from = {
				add_modifier = {
					modifier = grimacing
					days = -1
				}

				add_deposit = d_physics_4
			}
		}
	}

	option = {
		allow = { owner = { resource_stockpile_compare = { resource = energy value >= 200 } } }
		name = anomaly.230.b
		custom_tooltip = anomaly.230.b.tooltip
		owner = { add_resource = { energy = -200 } }
		hidden_effect = {
			random_list = {
				50 = { ship_event = { id = anomaly.231 days = 5 } }
				50 = { ship_event = { id = anomaly.232 days = 5 } }
			}
		}
	}
}

# Grimacing - can enable special project
ship_event = {
	id = anomaly.231
	title = anomaly.231.name
	desc = anomaly.231.desc
	picture = GFX_evt_atmospheric_entry
	show_sound = event_laboratory_sound
	location = FROMFROM
	trackable = yes

	is_triggered_only = yes

	option = {
		name = EXCELLENT
		fromfrom = {
			enable_special_project = {
				name = "GRIMACING_PLANET_PROJECT"
				location = this
				owner = root.owner
			}
		}
	}
}

# Grimacing - failed to enable special project
ship_event = {
	id = anomaly.232
	title = anomaly.232.name
	desc = anomaly.232.desc
	picture = GFX_evt_atmospheric_entry
	show_sound = event_structural_collapse
	location = FROMFROM

	is_triggered_only = yes

	option = {
		name = UNFORTUNATE
	}
}

# Grimacing - special project followup
ship_event = {
	id = anomaly.233
	title = anomaly.233.name
	desc = anomaly.233.desc
	picture = GFX_evt_physics_research
	show_sound = event_mystic_reveal
	location = fromfrom

	is_triggered_only = yes

	immediate = {
		fromfrom = {
			change_pc = pc_arid
			reset_planet = yes
		}
	}

	option = {
		name = MARVELOUS
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
		}
	}
}

# Lasers through ice
ship_event = {
	id = anomaly.235
	title = anomaly.235.name
	desc = {
		trigger = { owner = { has_technology = tech_lasers_2 } }
		text = anomaly.235.desc.v1
	}
	desc = {
		trigger = { owner = { NOT = { has_technology = tech_lasers_2 } } }
		text = anomaly.235.desc.v2
	}
	picture = GFX_evt_frozen
	show_sound = event_space_battle
	location = FROM

	is_triggered_only = yes

	immediate = {
		owner = {
			set_country_flag = lightshow_divination_flag
		}
	}

	option = {
		name = INTERESTING
		trigger = { owner = { has_technology = tech_lasers_2 } }
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		leader = { add_experience = 100 }
	}

	option = {
		name = anomaly.235.b
		trigger = { owner = { NOT = { has_technology = tech_lasers_2 } } }
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		owner = { give_technology = { tech = tech_lasers_2 } }
	}
}

# Deceptive Gas Giant
ship_event = {
	id = anomaly.240
	title = anomaly.240.name
	desc = anomaly.240.desc
	picture = GFX_evt_warm_barren
	show_sound = event_mystic_reveal
	location = FROM

	is_triggered_only = yes

	immediate = {
		from = {
			clear_planet_modifiers = yes
			change_pc = pc_barren
			reset_planet = yes
			change_planet_size = 25
		}
	}

	option = {
		name = REMARKABLE
		custom_tooltip = anomaly.240.a.tooltip
		leader = {
			add_experience = 200
		}
	}
}

# Eden overrun
ship_event = {
	id = anomaly.245
	title = anomaly.245.name
	desc = anomaly.245.desc
	picture = GFX_evt_animal_wildlife
	show_sound = event_alien_nature
	location = from

	is_triggered_only = yes

	trigger = { from = { is_planet_class = pc_gaia } }

	immediate = {
		from = {
			add_deposit = d_dangerous_wildlife_blocker
		}
	}

	option = {
		name = UNFORTUNATE
		leader = {
			add_experience = 200
		}
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier4researchreward
				min = @tier4researchmin
				max = @tier4researchmax
			}
		}
	}
}

# Olfactory Document
ship_event = {
	id = anomaly.250
	title = anomaly.250.name
	desc = anomaly.250.desc
	picture = GFX_evt_archaeological_dig
	show_sound = event_scanner
	location = from
	trackable = yes

	is_triggered_only = yes

	option = {
		name = anomaly.250.a
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		from = {
			enable_special_project = {
				name = "OLFACTORY_PROJECT"
				location = this
				owner = root
			}
		}
	}
}

# Olfactory followup
ship_event = {
	id = anomaly.251
	title = anomaly.251.name
	desc = anomaly.251.desc
	picture = GFX_evt_archaeological_dig
	show_sound = event_default
	location = fromfrom

	is_triggered_only = yes

	specimen = scent_based_information_device

	option = {
		name = INTERESTING
		leader = {
			add_experience = 100
		}
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
		}
	}
}

# Ultimate weapon
ship_event = {
	id = anomaly.255
	title = anomaly.255.name
	desc = anomaly.255.desc
	picture = GFX_evt_ancient_records
	show_sound = event_planetary_riot
	location = from
	trackable = yes

	is_triggered_only = yes

	specimen = warning_monolith

	option = {
		name = anomaly.255.a
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
	}

	option = {
		name = anomaly.255.b
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		from = {
			enable_special_project = {
				name = ULTIMATE_WEAPON_PROJECT
				location = this
				owner = root
			}
		}
	}
}

# Ultimate Weapon followup 1 - starting weapon
ship_event = {
	id = anomaly.256
	title = anomaly.256.name
	desc = anomaly.256.desc
	picture = GFX_evt_alien_city
	show_sound = event_default
	location = fromfrom

	is_triggered_only = yes

	immediate = {
		owner = {
			inverted_switch = {
				trigger = has_technology
				tech_mass_drivers_2 = { root = { set_ship_flag = mass2 } }
					tech_missiles_2 = { root = { set_ship_flag = miss2 } }
						tech_lasers_2 = { root = { set_ship_flag = lase2 } }
				tech_mass_drivers_3 = { root = { set_ship_flag = mass3 } }
					tech_missiles_3 = { root = { set_ship_flag = miss3 } }
						tech_lasers_3 = { root = { set_ship_flag = lase3 } }
				tech_mass_drivers_4 = { root = { set_ship_flag = mass4 } }
					tech_missiles_4 = { root = { set_ship_flag = miss4 } }
						tech_lasers_4 = { root = { set_ship_flag = lase4 } }
				tech_mass_drivers_5 = { root = { set_ship_flag = mass5 } }
					tech_missiles_5 = { root = { set_ship_flag = miss5 } }
						tech_lasers_5 = { root = { set_ship_flag = lase5 } }
			}
		}
	}

	option = {
		name = anomaly.256.a
		trigger = {			has_ship_flag = mass2 }
		hidden_effect = { remove_ship_flag = mass2 }
		owner = { give_technology = { tech = tech_mass_drivers_2 } }
	}
	option = {
		name = anomaly.256.a
		trigger = { has_ship_flag =			mass3 }
		hidden_effect = { remove_ship_flag = mass3 }
		owner = { give_technology = { tech = tech_mass_drivers_3 } }
	}
	option = {
		name = anomaly.256.a
		trigger = { has_ship_flag =			mass4 }
		hidden_effect = { remove_ship_flag = mass4 }
		owner = { give_technology = { tech = tech_mass_drivers_4 } }
	}
	option = {
		name = anomaly.256.a
		trigger = { has_ship_flag =			mass5 }
		hidden_effect = { remove_ship_flag = mass5 }
		owner = { give_technology = { tech = tech_mass_drivers_5 } }
	}
	option = {
		name = anomaly.256.a
		trigger = {			has_ship_flag = miss2 }
		hidden_effect = { remove_ship_flag = miss2 }
		owner = { give_technology = { tech = tech_missiles_2 } }
	}
	option = {
		name = anomaly.256.a
		trigger = { has_ship_flag =			miss3 }
		hidden_effect = { remove_ship_flag = miss3 }
		owner = { give_technology = { tech = tech_missiles_3 } }
	}
	option = {
		name = anomaly.256.a
		trigger = { has_ship_flag =			miss4 }
		hidden_effect = { remove_ship_flag = miss4 }
		owner = { give_technology = { tech = tech_missiles_4 } }
	}
	option = {
		name = anomaly.256.a
		trigger = { has_ship_flag =			miss5 }
		hidden_effect = { remove_ship_flag = miss5 }
		owner = { give_technology = { tech = tech_missiles_5 } }
	}
	option = {
		name = anomaly.256.a
		trigger = {			has_ship_flag = lase2 }
		hidden_effect = { remove_ship_flag = lase2 }
		owner = { give_technology = { tech = tech_lasers_2 } }
	}
	option = {
		name = anomaly.256.a
		trigger = { has_ship_flag =			lase3 }
		hidden_effect = { remove_ship_flag = lase3 }
		owner = { give_technology = { tech = tech_lasers_3 } }
	}
	option = {
		name = anomaly.256.a
		trigger = { has_ship_flag =			lase4 }
		hidden_effect = { remove_ship_flag = lase4 }
		owner = { give_technology = { tech = tech_lasers_4 } }
	}
	option = {
		name = anomaly.256.a
		trigger = { has_ship_flag =			lase5 }
		hidden_effect = { remove_ship_flag = lase5 }
		owner = { give_technology = { tech = tech_lasers_5 } }
	}
	option = {
		name = anomaly.256.b
		trigger = {
			NOR = {
				has_ship_flag = mass2
				has_ship_flag = mass3
				has_ship_flag = mass4
				has_ship_flag = mass5
				has_ship_flag = miss2
				has_ship_flag = miss3
				has_ship_flag = miss4
				has_ship_flag = miss5
				has_ship_flag = lase2
				has_ship_flag = lase3
				has_ship_flag = lase4
				has_ship_flag = lase5
			}
		}
	}
}

# Ultimate Weapon followup 2 - exotic weapon
ship_event = {
	id = anomaly.257
	title = anomaly.257.name
	desc = anomaly.257.desc
	picture = GFX_evt_alien_city
	show_sound = event_mystic_reveal
	location = fromfrom

	is_triggered_only = yes

	option = {
		name = anomaly.257.a
		trigger = {
			owner = {
				has_technology = tech_energy_lance_1
				has_technology = tech_kinetic_artillery_1
				has_technology = tech_swarmer_missiles_1
			}
		}
		leader = {
			add_experience = 200
		}
	}

	option = {
		name = anomaly.257.b
		trigger = {
			owner = {
				NOT = { has_technology = tech_energy_lance_1 }
			}
		}
		owner = { give_technology = { tech = tech_energy_lance_1 } }
		leader = { add_experience = 200 }
	}

	option = {
		name = anomaly.257.c
		trigger = {
			owner = {
				NOT = { has_technology = tech_kinetic_artillery_1 }
			}
		}
		owner = { give_technology = { tech = tech_kinetic_artillery_1 } }
		leader = { add_experience = 200 }
	}

	option = {
		name = anomaly.257.d
		trigger = {
			owner = {
				NOT = { has_technology = tech_swarmer_missiles_1 }
			}
		}
		owner = { give_technology = { tech = tech_swarmer_missiles_1 } }
		leader = { add_experience = 200 }
	}
}

# Ultimate Weapon followup 3 - nothing
ship_event = {
	id = anomaly.258
	title = anomaly.258.name
	desc = anomaly.258.desc
	picture = GFX_evt_alien_city
	show_sound = event_default
	location = fromfrom

	is_triggered_only = yes

	option = {
		name = UNFORTUNATE
	}
}

# Abandoned Mining Operation on Arctic planet
ship_event = {
	id = anomaly.260
	title = anomaly.260.name
	desc = anomaly.260.desc
	picture = GFX_evt_outpost
	show_sound = event_activating_unknown_technology
	location = from
	is_triggered_only = yes

	option = {
		name = anomaly.260.a
		custom_tooltip = anomaly.260.a.tooltip
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		owner = {
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier2researchreward
				min = @tier2researchmin
				max = @tier2researchmax
			}
		}
		hidden_effect = {
			from = {
				add_deposit = d_ancient_mining_site
			}
		}
	}
}

# Crater drag race
ship_event = {
	id = anomaly.265
	title = anomaly.265.name
	desc = anomaly.265.desc
	picture = GFX_evt_archaeological_dig
	show_sound = event_ship_thrusters
	location = from

	is_triggered_only = yes

	immediate = { from = { clear_deposits = yes } }

	option = {
		name = anomaly.265.a
		custom_tooltip = anomaly.265.a.tooltip
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		hidden_effect = {
			from = {
				add_modifier = {
					modifier = skid_marks
					days = -1
				}
				add_deposit = d_engineering_6
			}
		}
	}
}

# Artificial Impact
ship_event = {
	id = anomaly.270
	title = anomaly.270.name
	desc = anomaly.270.desc
	picture = GFX_evt_asteroid_approaching_planet
	show_sound = event_default
	location = from

	is_triggered_only = yes

	immediate = { from = { clear_deposits = yes } }

	option = {
		name = anomaly.270.a
		custom_tooltip = anomaly.270.a.tooltip
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		hidden_effect = {
			from = {
				add_modifier = {
					modifier = dust_circuits
					days = -1
				}
				add_deposit = d_engineering_3
			}
		}
	}
}

# Abandoned Thrusters
ship_event = {
	id = anomaly.275
	title = anomaly.275.name
	desc = anomaly.275.desc
	picture = GFX_evt_archaeological_dig
	show_sound = event_ship_thrusters
	location = from

	is_triggered_only = yes

	option = {
		name = anomaly.275.a
		trigger = { owner = { is_fanatic_xenophobe = no } }
		owner = {
			if = {
				limit = { NOT = { has_technology = tech_thrusters_2 } }
				give_technology = { tech = tech_thrusters_2 }
			}
			else = {
				add_monthly_resource_mult = {
					resource = unity
					value = @tier1unityreward
					min = @tier1unitymin
					max = @tier1unitymax
				}
			}
			give_specimen = { key = planet_pushing_thruster }
		}
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
	}

	option = {
		name = anomaly.275.b
		trigger = { owner = { is_fanatic_xenophobe = yes } }
		owner = {
			add_monthly_resource_mult = {
				resource = unity
				value = @tier1influencereward
				min = @tier1influencemin
				max = @tier1influencemax
			}
		}
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
	}
}

# Unusual Tectonics
ship_event = {
	id = anomaly.285
	title = anomaly.285.name
	desc = anomaly.285.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

	is_triggered_only = yes

	immediate = { from = { clear_deposits = yes } }

	option = {
		name = anomaly.285.a
		custom_tooltip = anomaly.285.a.tooltip
		hidden_effect = {
			from = {
				add_modifier = {
					modifier = unusual_tectonics
					days = -1
				}
				add_deposit = d_engineering_2
				add_deposit = d_physics_2
			}
		}
	}
}

# Irradiating rock for fun and profit
ship_event = {
	id = anomaly.290
	title = anomaly.290.name
	desc = anomaly.290.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_ship_bridge
	location = from
	trackable = yes

	is_triggered_only = yes

	immediate = {
		from = {
			clear_deposits = yes
		}
	}

	option = {
		name = anomaly.290.a
		owner = { give_specimen = { key = reactive_rock } }
	}

	option = {
		name = anomaly.290.b
		trigger = { owner = { resource_stockpile_compare = { resource = energy value >= 1000 } } }
		owner = { add_resource = { energy = -1000 } }
		from = {
			enable_special_project = {
				name = "REFINE_ROCK_PROJECT"
				location = this
				owner = root
			}
		}
	}
}

# Special project followup
ship_event = {
	id = anomaly.292
	title = anomaly.290.name
	desc = anomaly.292.desc
	picture = GFX_evt_underground_civilization
	show_sound = event_default
	location = fromfrom

	is_triggered_only = yes

	option = {
		name = EXCELLENT
		fromfrom = {
			add_deposit = d_minerals_6
		}
	}
}

# Gravity emitters
ship_event = {
	id = anomaly.295
	title = anomaly.295.name
	desc = anomaly.295.desc
	picture = GFX_evt_unidentified_ship
	show_sound = event_activating_unknown_technology

	is_triggered_only = yes

	option = {
		name = anomaly.295.a
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
		}
	}
}

### Atmospheric Ecosystem
ship_event = {
	id = anomaly.300
	title = "anomaly.300.name"
	desc = "anomaly.300.desc"
	picture = GFX_evt_atmospheric_flight
	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
			}
		}
		owner = {
			set_country_flag = atmoseco_divination_flag
			country_event = { id = story.2 days = 30 }
		}
	}

	option = {
		name = FASCINATING
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "atmospheric_ecosystem"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_society_3
		}
	}
}

### Abandoned Cargo Pod
ship_event = {
	id = anomaly.305
	title = "anomaly.305.name"
	desc = "anomaly.305.desc"
	picture = GFX_evt_atmospheric_flight
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = anomaly.305.a
		owner = {
			add_monthly_resource_mult = {
				resource = alloys
				value = @tier1materialreward
				min = @tier1materialmin
				max = @tier1materialmax
			}
		}
	}
	option = {
		trigger = { owner = { is_gestalt = no } }
		name = anomaly.305.b
		owner = {
			add_monthly_resource_mult = {
				resource = energy
				value = @tier1materialreward
				min = @tier1materialmin
				max = @tier1materialmax
			}
		}
	}
	option = {
		name = anomaly.305.c
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			give_specimen = { key = alien_jewelry }
		}
	}
	option = {
		trigger = { has_ancrel = yes }
		name = anomaly.305.d
		owner = {
			add_resource = { minor_artifacts = 10 }
			give_specimen = { key = alien_jewelry }
		}
	}
}

### Social Experiment
ship_event = {
	id = anomaly.310
	title = "anomaly.310.name"
	desc = "anomaly.310.desc"
	picture = GFX_evt_gas_giant_station
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = INTRIGUING
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}
	option = {
		exclusive_trigger = { owner = { has_origin = origin_evolutionary_predators } }
		name = anomaly.310.b.evopred
		owner = {
			give_evolutionary_predator_situation_progress_and_dna = { AMOUNT = small }
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}
}

### Aerostat Colonies
ship_event = {
	id = anomaly.315
	title = "anomaly.315.name"
	desc = "anomaly.315.desc"
	picture = GFX_evt_gas_giant_station
	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
			}
		}
		owner = { country_event = { id = story.5 days = 30 } }
	}

	option = {
		name = FASCINATING
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "aerostat_colonies"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_engineering_3
		}
	}
}

### Debris Field
ship_event = {
	id = anomaly.320
	title = "anomaly.320.name"
	desc = "anomaly.320.desc"
	picture = GFX_evt_ruined_system
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

	immediate = {
		from = {
			if = {
				limit = {
					NOT = { has_deposit_for = shipclass_mining_station }
				}
				clear_deposits = yes
			}
		}
		owner = { country_event = { id = story.5 days = 30 } }
	}

	option = {
		name = INTERESTING
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "debris_field"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_minerals_3
		}
	}
}

### Crushed Cruiser
ship_event = {
	id = anomaly.325
	title = "anomaly.325.name"
	desc = "anomaly.325.desc"
	picture = GFX_evt_atmospheric_flight
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = anomaly.325.a
		owner = {
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}
}

### Extreme Storms
ship_event = {
	id = anomaly.330
	title = "anomaly.330.name"
	desc = "anomaly.330.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_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = INTERESTING
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "extreme_storms"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_physics_3
		}
	}
}

### Energy Signature
ship_event = {
	id = anomaly.335
	title = "anomaly.335.name"
	desc = "anomaly.335.desc"
	picture = GFX_evt_gas_giant_station
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

	option = {
		name = FASCINATING
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}
}

### Precious Moon
ship_event = {
	id = anomaly.340
	title = "anomaly.340.name"
	desc = "anomaly.340.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_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = anomaly.340.a
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "precious_moon"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_energy_3
		}
	}
}

### Asteroid Collision
ship_event = {
	id = anomaly.600
	title = "anomaly.600.name"
	desc = "anomaly.600.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit_2
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = anomaly.600.a
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "asteroid_collision"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_minerals_3
		}
	}
}

### Warp Impact
ship_event = {
	id = anomaly.605
	title = "anomaly.605.name"
	desc = "anomaly.605.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_ship_bridge
	location = FROM

	is_triggered_only = yes

	option = {
		name = REMARKABLE
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}
}

### Microsingularity
ship_event = {
	id = anomaly.610
	title = "anomaly.610.name"
	desc = "anomaly.610.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_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
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "microsingularity"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_physics_3
		}
	}
}

### Magnetic Reversal
ship_event = {
	id = anomaly.615
	title = "anomaly.615.name"
	desc = "anomaly.615.desc"
	picture = GFX_evt_ship_travel
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

	option = {
		name = INTRIGUING
		owner = {
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}
}

### Mummified Pilot
ship_event = {
	id = anomaly.625
	title = "anomaly.625.name"
	desc = "anomaly.625.desc"
	picture = GFX_evt_ship_in_orbit
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = anomaly.625.a
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}

	option = {
		exclusive_trigger = { owner = { has_origin = origin_evolutionary_predators } }
		name = anomaly.625.b.evopred
		owner = {
			give_evolutionary_predator_situation_progress_and_dna = { AMOUNT = small TYPE = mammalian }
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}
}

### Ancient Life Pod
ship_event = {
	id = anomaly.630
	title = "anomaly.630.name"
	desc = "anomaly.630.desc"
	picture = GFX_evt_scanning_remains
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = {
			text = INTERESTING
			trigger = {
				owner = { is_homicidal = no }
			}
		}
		name = {
			text = DISGUSTING
			trigger = {
				owner = { is_homicidal = yes }
			}
		}
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}

	option = {
		exclusive_trigger = { owner = { has_origin = origin_evolutionary_predators } }
		name = anomaly.625.b.evopred
		owner = {
			give_evolutionary_predator_situation_progress_and_dna = { AMOUNT = small TYPE = reptilian }
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}
}

### Alien Writing
ship_event = {
	id = anomaly.635
	title = "anomaly.635.name"
	desc = "anomaly.635.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_ship_bridge
	location = FROM

	is_triggered_only = yes

	immediate = {
		from = {
			if = {
				limit = {
					NOT = { has_deposit_for = shipclass_research_station }
				}
				clear_deposits = yes
			}
		}
		owner = { country_event = { id = story.5 days = 30 } }
	}

	option = {
		name = FASCINATING
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "alien_writing"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_society_3
		}
	}

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

### Solar Sailer
ship_event = {
	id = anomaly.650
	title = "anomaly.650.name"
	desc = "anomaly.650.desc"
	picture = GFX_evt_ship_travel
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = anomaly.650.a
		owner = {
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}

	after = {
		owner = {
			give_specimen = {
				key = torn_solar_sail
				targets = { root.from root.from.solar_system }
			}
		}
	}
}

### Glancing Hit
ship_event = {
	id = anomaly.655
	title = "anomaly.655.name"
	desc = "anomaly.655.desc"
	picture = GFX_evt_ship_travel
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = INCREDIBLE
		owner = {
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
		}
	}

	after = {
		owner = {
			give_specimen = {
				key = intergalactic_projectile
				targets = { root.from this }
			}
		}
	}
}

### Towed Asteroid
ship_event = {
	id = anomaly.660
	title = "anomaly.660.name"
	desc = "anomaly.660.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_ship_bridge
	location = FROM

	is_triggered_only = yes

	immediate = {
		from = {
			if = {
				limit = {
					NOT = { has_deposit_for = shipclass_research_station }
				}
				clear_deposits = yes
			}
		}
		owner = { country_event = { id = story.5 days = 30 } }
	}

	option = {
		name = INTERESTING
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "towed_asteroid"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_engineering_3
		}
	}
	option = {
		trigger = { owner = { has_origin = origin_lithoid } }
		name = anomaly.660.b
		owner = { add_modifier = { modifier = asteroid_thrusters days = -1 } }
	}
}

### Nuclear Devastation (Toxic)
ship_event = {
	id = anomaly.670
	title = "anomaly.670.name"
	desc = "anomaly.670.desc"
	picture = GFX_evt_city_ruins
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = anomaly.670.a
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "nuclear_devastation"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_society_2
			add_deposit = d_engineering_2
		}
	}
}

# Gamma-Ray Burst
ship_event = {
	id = anomaly.680
	title = "anomaly.680.name"
	desc = "anomaly.680.desc"
	picture = GFX_evt_dead_city
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

	specimen = gamma_resistant_flora

	immediate = {
		FROM = { set_planet_flag = nuked_planet_anomalies_disabled }
	}

	option = {
		name = FASCINATING
		FROM = {
			add_blocker = { type = d_radioactive_ruins }
			add_blocker = { type = d_radioactive_ruins }
		}
	}
}

### Runaway Greenhouse Effect
ship_event = {
	id = anomaly.685
	title = "anomaly.685.name"
	desc = "anomaly.685.desc"
	picture = GFX_evt_dead_city
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = anomaly.670.a
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "greenhouse_effect"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_society_2
			add_deposit = d_physics_2
		}
	}
}

### Ammonia Biosphere
ship_event = {
	id = anomaly.690
	title = "anomaly.690.name"
	desc = "anomaly.690.desc"
	picture = GFX_evt_alien_nature
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

	specimen = ammoniaphytus

	immediate = {
		from = {
			if = {
				limit = {
					NOT = { has_deposit_for = shipclass_research_station }
				}
				clear_deposits = yes
			}
		}
		owner = { country_event = { id = story.1 days = 2 } }
	}

	option = {
		name = FASCINATING
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "ammonia_biosphere"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_society_3
		}
	}
}

### Silicon Life Forms
ship_event = {
	id = anomaly.695
	title = "anomaly.695.name"
	desc = "anomaly.695.desc"
	picture = GFX_evt_underground_civilization
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

	immediate = {
		from = {
			if = {
				limit = {
					NOT = { has_deposit_for = shipclass_mining_station }
				}
				clear_deposits = yes
			}
		}
		owner = { country_event = { id = story.2 days = 30 } }
	}

	option = {
		name = INTRIGUING
		hidden_effect = {
			FROM = {
				add_modifier = {
					modifier = "silicon_lifeforms"
					days = -1
				}
			}
		}
		FROM = {
			add_deposit = d_minerals_3
		}
	}
}

#### Wildcat Miners
#ship_event = {
#	id = anomaly.700
#	title = "anomaly.700.name"
#	desc = "anomaly.700.desc"
#	picture = GFX_evt_outpost
#	show_sound = event_ship_bridge
#	location = FROM
#
#	is_triggered_only = yes
#
#	option = {
#		name = INTERESTING
#		FROM = {
#			create_mining_station = {
#				owner = ROOT
#			}
#		}
#	}
#}

### Ancient Survey Marker
ship_event = {
	id = anomaly.705
	title = "anomaly.705.name"
	desc = "anomaly.705.desc"
	picture = GFX_evt_outpost
	show_sound = event_ship_bridge
	location = FROM

	is_triggered_only = yes

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

	option = {
		name = FASCINATING
		hidden_effect = {
			from = {
				if = {
					limit = {
						NOT = { has_deposit_for = shipclass_mining_station }
					}
					clear_deposits = yes
				}
			}
		}
		from = { add_deposit = d_minerals_4 }
	}

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



############################
#
# Anomaly Events
# Written by Miranda van den Brink
#
############################

namespace = anomaly

# ROOT = ship scope
# FROM = planet scope


# Limbo - from anomaly_events_2
ship_event = {
	id = anomaly.185
	title = "anomaly.185.name"
	desc = "anomaly.185.desc"
	show_sound = event_radio_chatter
	picture = GFX_evt_landing_ship_2
	location = from
	trackable = yes

	is_triggered_only = yes

	option = {
		name = OK
		from = {
			enable_special_project = {
				name = "LIMBO_1_PROJECT"
				location = this
				owner = root
			}
		}
	}
}

# Limbo project 1 followup - anomaly_events_2
ship_event = {
	id = anomaly.186
	title = "anomaly.186.name"
	desc = {
		text = anomaly.186.desc.v1
		trigger = {
			hidden:owner = {
				is_individual_machine = no
				OR = {
					has_policy_flag = ai_outlawed
					is_spiritualist = yes
					NOT = {
						has_technology = tech_synthetic_workers
					}
				}
			}
		}
	}

	desc = {
		text = anomaly.186.desc.v3
		trigger = {
			hidden:owner = {
				has_technology = tech_synthetic_workers
				is_individual_machine = no
				NOR = {
					has_policy_flag = ai_outlawed
					is_spiritualist = yes
				}
			}
		}
	}

	desc = {
		text = anomaly.186.desc.v4
		trigger = {
			hidden:owner = {
				is_individual_machine = yes
			}
		}
	}

	picture = GFX_evt_sapient_AI
	show_sound = event_radio_chatter
	location = fromfrom
	is_triggered_only = yes
	trackable = yes

	option = {
		name = "anomaly.186.a"
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		owner = {
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier4researchreward
				min = @tier4researchmin
				max = @tier4researchmax
			}
		}
	}

	option = {
		name = "anomaly.186.b"
		trigger = {
			owner = {
				NOT = { has_origin = origin_synthetic_fertility }
				is_individual_machine = no
				OR = {
					NOT = {
						has_technology = tech_synthetic_workers
					}
					has_policy_flag = ai_outlawed
					is_spiritualist = yes
				}
			}
		}

		owner = {
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
			give_specimen = {
				key = alien_brain_scans
				targets = { root.fromfrom }
			}
		}
		hidden_effect = {
			fromfrom = { set_carrier_flag = limbo_planet }
			owner = {
				set_country_flag = limbo_downloaded
			}
		}
	}

	option = {
		name = "anomaly.186.c"
		trigger = {
			owner = {
				NOT = { has_origin = origin_synthetic_fertility }
				OR = {
					has_technology = tech_synthetic_workers
					is_individual_machine = yes
				}
				NOT = {
					has_policy_flag = ai_outlawed
				}
				NOT = {
					is_individual_machine = no
					is_spiritualist = yes
				}
			}
		}

		allow = {
			owner = { NOT = { has_policy_flag = ai_outlawed } }
		}

		owner = {
			capital_scope = {
				enable_special_project = {
					name = "LIMBO_2_PROJECT"
					location = this
					owner = root.owner
				}
			}
			give_specimen = {
				key = alien_brain_scans
				targets = { root.fromfrom }
			}
		}
	}

	option = {
		name = "anomaly.186.e"
		custom_tooltip = anomaly.186.e.tt
		trigger = {
			owner = {
				has_origin = origin_synthetic_fertility
			}
		}

		allow = {
			owner = {
				has_origin = origin_synthetic_fertility
			}
		}

		owner = {
			hidden_effect = {
				change_variable = {
					which = num_dead_identities
					value = 500
				}
			}
			give_specimen = {
				key = alien_brain_scans
				targets = { root.fromfrom }
			}
		}
	}
}

# The synths make a colony, inside or outside of the player's borders
country_event = {
	id = anomaly.189
	title = "anomaly.189.name"
	desc = "anomaly.189.desc"
	picture = GFX_evt_synth_organic_relations
	show_sound = event_radio_chatter
	location = FROM

	is_triggered_only = yes

	immediate = {
		random_planet_within_border = {
			limit = {
				habitable_planet = yes
				is_colony = no
				has_anomaly = no
				is_capital = no
			}
			save_event_target_as = new_colony
		}
	}

	# build a colony within our borders option
	option = {
		name = anomaly.189.a
		custom_tooltip = anomaly.189.a.tooltip
		trigger = {
			NOT = { has_policy_flag = ai_outlawed }
			any_planet_within_border = {
				habitable_planet = yes
				is_colony = no
				has_anomaly = no
				is_capital = no
			}
		}
		allow = {
			NOT = { has_policy_flag = ai_outlawed }
			any_planet_within_border = {
				habitable_planet = yes
				is_colony = no
				has_anomaly = no
				is_capital = no
			}
		}
		hidden_effect = {
			event_target:new_colony = {
				set_owner = root
				set_controller = root
				prevent_anomaly = yes
				create_species = {
					name = "NAME_Awoken_Robot"
					plural = "NAME_Awoken_Robot"
					class = ROBOT
					namelist = FUN3
					portrait = "default_robot"
					traits = {
						trait = "trait_mechanical"
					}
				}
				while = {
					count = 3
					create_pop_group = {
						species = last_created_species
					}
				}
			}
		}
	}

	# They're on their own (the droids colonize a planet outside the borders if available or "just disappear")
	option = {
		name = anomaly.189.b
		custom_tooltip = anomaly.189.b.tooltip

		trigger = {
			NOT = { has_policy_flag = ai_outlawed }
			any_system = {
				NOR = {
					exists = space_owner
					has_star_flag = hostile_system
					has_star_flag = guardian
					has_star_flag = enclave
				}
				any_system_planet = {
					habitable_planet = yes
					has_anomaly = no
					is_colony = no
					is_capital = no
				}
			}
		}
		allow = {
			NOT = { has_policy_flag = ai_outlawed }
			any_system = {
				NOR = {
					exists = space_owner
					has_star_flag = hostile_system
					has_star_flag = guardian
					has_star_flag = enclave
				}
				any_system_planet = {
					habitable_planet = yes
					has_anomaly = no
					is_colony = no
					is_capital = no
				}
			}
		}
		hidden_effect = {
			country_event = { id = anomaly.1197 }
		}
	}

	#dismantle the robots for parts
	option = {
		name = anomaly.189.c
		custom_tooltip = anomaly.186.a.alt.tooltip
		trigger = { has_policy_flag = ai_servitude }
		add_resource = { minerals = 200 }
	}
}

# continuation of option anomaly.189.b
country_event = {
	id = anomaly.1197
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				any_system = {
					NOR = {
						exists = space_owner
						has_star_flag = hostile_system
						has_star_flag = guardian
						has_star_flag = enclave
						has_star_flag = primitive_system
					}
					any_system_planet = {
						habitable_planet = yes
						has_anomaly = no
						is_colony = no
						is_capital = no
						NOR = {
							exists = owner
							exists = controller
						}
					}
				}
			}
			random_system = {
				limit = {
					NOR = {
						exists = space_owner
						has_star_flag = hostile_system
						has_star_flag = guardian
						has_star_flag = enclave
						has_star_flag = primitive_system
					}
					any_system_planet = {
						habitable_planet = yes
						has_anomaly = no
						is_colony = no
						is_capital = no
						NOR = {
							exists = owner
							exists = controller
						}
					}
				}

				random_system_planet = {
					limit = {
						habitable_planet = yes
						has_owner = no
						is_capital = no
					}
					save_event_target_as = colonized_planet
					set_surveyed = {
						surveyed = yes
						surveyor = root
					}
					prevent_anomaly = yes
					create_species = {
						name = "NAME_Awoken_Robot"
						plural = "NAME_Awoken_Robot"
						class = ROBOT
						namelist = FUN3
						portrait = "default_robot"
						traits = {
							trait = "trait_mechanical"
						}
					}
					create_country = {
						name = "NAME_Awoken"
						name_list = FUN3
						species = last_created_species
						type = default
						ethos = {
							ethic = ethic_fanatic_materialist
							ethic = ethic_xenophile
						}
						authority = random
						civics = random
						flag = {
							icon = {
								category = "blocky"
								file = "flag_blocky_21.dds"
							}
							background = {
								category = "backgrounds"
								file = "new_dawn.dds"
							}
							colors = {
								"black"
								"dark_blue"
								"null"
								"null"
							}
						}
						exclude_day_zero_contact = root
						effect = {
							establish_communications_no_message = root
							root = {
								every_federation_ally = {
									establish_communications = prevprev
								}
							}
							set_country_flag = limbo_country
							set_country_flag = synthetic_empire
							species = {
								change_species_characteristics = { portrait = "sd_fun_robot" }
							}
							create_leader = {
								class = random_ruler
								species = owner_main_species
								name = random
								skill = 5
							}
							set_leader = last_created_leader
							copy_techs_from = {
								target = root
								except = {
									# Food
									tech_gene_crops
									tech_nano_vitality_crops
									tech_nutrient_replication
									# Misc
									tech_frontier_health
									tech_frontier_hospital
									tech_telepathy
									tech_precognition_interface
									tech_psi_jump_drive_1
									tech_galactic_markets
									tech_subdermal_stimulation
									tech_global_research_initiative
									tech_neural_implants
									tech_psionic_theory
									# Genetics
									tech_genome_mapping
									tech_vitality_boosters
									tech_epigenetic_triggers
									tech_cloning
									tech_gene_banks
									tech_gene_seed_purification
									tech_morphogenetic_field_mastery
									tech_gene_tailoring
									tech_glandular_acclimation
									tech_gene_expressions
									tech_selected_lineages
									tech_capacity_boosters
									# Horizon Signal
									tech_akx_worm_1
									tech_akx_worm_2
									tech_akx_worm_3
								}
							}
							IF = {
								limit = {
									root = {
										has_technology = tech_maulers
									}
								}
								give_technology = { tech = tech_corvettes }
								give_technology = { tech = tech_torpedoes_1 }
							}
							IF = {
								limit = {
									root = {
										has_technology = tech_weavers
									}
								}
								give_technology = { tech = tech_destroyers }
							}
							IF = {
								limit = {
									root = {
										has_technology = tech_stingers
									}
								}
								give_technology = { tech = tech_battleships }
							}
							IF = {
								limit = {
									root = {
										has_technology = tech_harbingers
									}
								}
								give_technology = { tech = tech_cruisers }
							}
						}
					}
					set_owner = last_created_country
					set_capital = yes
					while = {
						count = 6
						create_pop_group = {
							species = last_created_species
						}
					}
#					add_building = building_research_lab_1
#					add_building = building_foundry_1
#					add_building = building_factory_1
					add_district = district_generator
					add_district = district_generator
					add_district = district_mining
					add_district = district_mining
					add_district = district_city
					add_district = district_city
					root = { country_event = { id = anomaly.1196 days = 10 } }
				}
			}
		}
		else_if = {
			# There are no colonizable planets outside the player's borders
			country_event = { id = anomaly.1195 days = 40 }
		}
	}
}

country_event = {
	id = anomaly.1190
	title = "anomaly.1190.name"
	desc = "anomaly.1190.desc"
	show_sound = event_mystic_reveal
	picture = GFX_evt_robot_assembly_plant
	location = from

	is_triggered_only = yes

	option = {
		name = anomaly.1190.a
		add_monthly_resource_mult = {
			resource = engineering_research
			value = @tier3researchreward
			min = @tier3researchmin
			max = @tier3researchmax
		}
		add_monthly_resource_mult = {
			resource = society_research
			value = @tier3researchreward
			min = @tier3researchmin
			max = @tier3researchmax
		}
	}
}

# Triggers event chain when players who previously didn't have the synth/droid tech gets it.

country_event = {
	id = anomaly.1193
	hide_window = yes

	is_triggered_only = yes

	trigger = {
		last_increased_tech = "tech_synthetic_workers"
		has_country_flag = limbo_downloaded
		NOT = {
			has_policy_flag = ai_outlawed
		}
	}

	immediate = { country_event = { id = anomaly.1194 days = 20 random = 20 } }
}

country_event = {
	id = anomaly.1194
	title = "anomaly.1194.name"
	desc = "anomaly.1194.desc"
	show_sound = event_mystic_reveal
	picture = GFX_evt_robot_assembly_plant
	location = capital_scope
	trackable = yes

	is_triggered_only = yes

	trigger = {
		NOR = {
			has_policy_flag = ai_outlawed
			has_country_flag = project_limbo_2_enabled
		}
	}

	immediate = {
		set_country_flag = project_limbo_2_enabled
	}

	option = {
		name = anomaly.1194.a
		trigger = {
			NOT = { has_policy_flag = ai_outlawed }
		}
		capital_scope = {
			enable_special_project = {
				name = "LIMBO_2_PROJECT"
				location = this
				owner = root
			}
		}
	}

	# Ends the event chain
	option = {
		name = anomaly.186.a
		custom_tooltip = anomaly.186.a.alt.tooltip
		add_monthly_resource_mult = {
			resource = engineering_research
			value = @tier4researchreward
			min = @tier4researchmin
			max = @tier4researchmax
		}
		hidden_effect = {
			remove_country_flag = limbo_downloaded
			remove_country_flag = project_limbo_2_enabled
		}
	}
}

# Notification: The synths are gone without a trace. Ends the event chain.
country_event = {
	id = anomaly.1195
	title = "anomaly.1195.name"
	desc = "anomaly.1195.desc"
	show_sound = event_mystic_reveal
	picture = GFX_evt_sapient_AI
	location = capital_scope

	is_triggered_only = yes

	option = {
		name = OK
	}
}

# Notification: the synths have colonized a planet
country_event = {
	id = anomaly.1196
	title = "anomaly.1196.name"
	desc = "anomaly.1196.desc"
	show_sound = event_mystic_reveal
	picture = GFX_evt_robot_assembly_plant
	location = event_target:colonized_planet

	is_triggered_only = yes

	option = {
		name = OK
	}
}

# If the players have synth tech and colonizable planets inside but not outside their borders the robots offer to colonize a planet inside their borders, and the players can reject them upon which they leave without a trace.
country_event = {
	id = anomaly.1198
	title = "anomaly.1198.name"
	desc = "anomaly.1198.desc"
	show_sound = event_mystic_reveal
	picture = GFX_evt_synth_organic_relations
	location = event_target:potential_target

	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				any_planet_within_border = {
					habitable_planet = yes
					is_colony = no
					has_anomaly = no
					is_capital = no
					NOR = {
						exists = owner
						exists = controller
					}
				}
			}
			random_planet_within_border = {
				limit = {
					habitable_planet = yes
					is_colony = no
					has_anomaly = no
					is_capital = no
					NOR = {
						exists = owner
						exists = controller
					}
				}
				save_event_target_as = potential_target
			}
		}
		else_if = {
			capital_scope = {
				save_event_target_as = potential_target
			}
		}
	}

	option = {
		name = anomaly.189.a
		custom_tooltip = anomaly.189.a.tooltip
		trigger = {
			any_planet_within_border = {
				habitable_planet = yes
				is_colony = no
				has_anomaly = no
				is_capital = no
				NOR = {
					exists = owner
					exists = controller
				}
			}
			NOT = {
				has_policy_flag = ai_outlawed
			}
		}
		allow = {
			NOT = {
				has_policy_flag = ai_outlawed
			}
			any_planet_within_border = {
				habitable_planet = yes
				is_colony = no
				has_anomaly = no
				is_capital = no
				NOR = {
					exists = owner
					exists = controller
				}
			}
		}
		hidden_effect = {
			if = {
				limit = {
					capital_scope = {
						is_same_value = event_target:potential_target
					}
				}
				random_planet_within_border = {
					limit = {
						habitable_planet = yes
						is_colony = no
						has_anomaly = no
						is_capital = no
						NOR = {
							exists = owner
							exists = controller
						}
					}
					save_event_target_as = potential_target
				}
			}
			event_target:potential_target = {
				set_owner = root
				set_controller = root
				prevent_anomaly = yes
				create_species = {
					name = "NAME_Awoken_Robot"
					plural = "NAME_Awoken_Robot"
					class = ROBOT
					namelist = FUN3
					portrait = "default_robot"
					traits = {
						trait = "trait_mechanical"
					}
				}
				while = {
					count = 3
					create_pop_group = {
						species = last_created_species
					}
				}
			}
		}
	}

	option = {
		name = anomaly.1198.a
		custom_tooltip = anomaly.189.b.tooltip
		hidden_effect = { country_event = { id = anomaly.1195 days = 40 } }
	}

	# dismantle the robots for parts
	option = {
		name = anomaly.189.c
		custom_tooltip = anomaly.186.a.alt.tooltip
		trigger = { has_policy_flag = ai_servitude }
		add_resource = { minerals = 200 }
	}
}

# If the players have synth tech and colonizable planets outside but not inside their borders they tell the players they are eternally grateful but they'd like to strike out on their own and rebuild their empire again.
country_event = {
	id = anomaly.1199
	title = "anomaly.1199.name"
	desc = "anomaly.1199.desc"
	show_sound = event_mystic_reveal
	picture = GFX_evt_synth_organic_relations
	location = capital_scope

	is_triggered_only = yes

	#dismantle the robots for parts
	option = {
		name = anomaly.189.c
		custom_tooltip = anomaly.186.a.alt.tooltip
		trigger = { has_policy_flag = ai_servitude }
		add_resource = { minerals = 200 }
	}

	option = {
		name = anomaly.1199.a
		custom_tooltip = anomaly.189.b.tooltip
		trigger = {
			NOT = {
				has_policy_flag = ai_outlawed
			}
			any_system = {
				NOR = {
					exists = space_owner
					has_star_flag = hostile_system
					has_star_flag = guardian
					has_star_flag = enclave
					has_star_flag = primitive_system
				}
				any_system_planet = {
					habitable_planet = yes
					has_anomaly = no
					#is_colony = no
					#is_capital = no
					NOR = {
						exists = owner
						exists = controller
					}
				}
			}
		}
		allow = {
			NOT = {
				has_policy_flag = ai_outlawed
			}
			any_system = {
				NOR = {
					exists = space_owner
					has_star_flag = hostile_system
					has_star_flag = guardian
					has_star_flag = enclave
					has_star_flag = primitive_system
				}
				any_system_planet = {
					habitable_planet = yes
					has_anomaly = no
					#is_colony = no
					#is_capital = no
					NOR = {
						exists = owner
						exists = controller
					}
				}
			}
		}

		hidden_effect = {
			random_system = {
				limit = {
					NOR = {
						exists = space_owner
						has_star_flag = hostile_system
						has_star_flag = guardian
						has_star_flag = enclave
						has_star_flag = primitive_system
					}
					any_system_planet = {
						habitable_planet = yes
						has_anomaly = no
						is_colony = no
						is_capital = no
						NOR = {
							exists = owner
							exists = controller
						}
					}
				}
				random_system_planet = {
					limit = {
						habitable_planet = yes
						has_owner = no
						has_anomaly = no
						is_colony = no
						is_capital = no
					}
					save_event_target_as = colonized_planet
					set_surveyed = {
						surveyed = yes
						surveyor = root
					}
					prevent_anomaly = yes
					create_species = {
						name = "NAME_Awoken_Robot"
						plural = "NAME_Awoken_Robot"
						class = ROBOT
						namelist = FUN3
						portrait = "default_robot"
						traits = {
							trait = "trait_mechanical"
						}
					}
					create_country = {
						name = "NAME_Awoken"
						name_list = FUN3
						species = last_created_species
						type = default
						ethos = {
							ethic = ethic_fanatic_materialist
							ethic = ethic_xenophile
						}
						authority = random
						civics = random
						auto_delete = no
						flag = {
							icon = {
								category = "blocky"
								file = "flag_blocky_21.dds"
							}
							background = {
								category = "backgrounds"
								file = "new_dawn.dds"
							}
							colors = {
								"black"
								"dark_blue"
								"null"
								"null"
							}
						}
						exclude_day_zero_contact = root
						effect = {
							establish_communications_no_message = root
							root = {
								every_federation_ally = {
									establish_communications = prevprev
								}
							}
							add_trust = {
								amount = 10
								who = root
							}
							save_event_target_as = awoken_country
							set_country_flag = limbo_country
							set_country_flag = synthetic_empire
							species = {
								change_species_characteristics = { portrait = "sd_fun_robot" }
							}
							create_leader = {
								class = random_ruler
								species = owner_main_species
								name = random
								skill = 5
							}
							set_leader = last_created_leader
							copy_techs_from = {
								target = root
								except = {
									# Food
									tech_gene_crops
									tech_nano_vitality_crops
									tech_nutrient_replication
									# Misc
									tech_frontier_health
									tech_frontier_hospital
									tech_telepathy
									tech_precognition_interface
									tech_psi_jump_drive_1
									tech_galactic_markets
									tech_subdermal_stimulation
									tech_global_research_initiative
									tech_neural_implants
									tech_psionic_theory
									# Genetics
									tech_genome_mapping
									tech_vitality_boosters
									tech_epigenetic_triggers
									tech_cloning
									tech_gene_banks
									tech_gene_seed_purification
									tech_morphogenetic_field_mastery
									tech_gene_tailoring
									tech_glandular_acclimation
									tech_gene_expressions
									tech_selected_lineages
									tech_capacity_boosters
									# Horizon Signal
									tech_akx_worm_1
									tech_akx_worm_2
									tech_akx_worm_3
								}
							}
							IF = {
								limit = {
									root = {
										has_technology = tech_maulers
									}
								}
								give_technology = { tech = tech_corvettes }
								give_technology = { tech = tech_torpedoes_1 }
							}
							IF = {
								limit = {
									root = {
										has_technology = tech_weavers
									}
								}
								give_technology = { tech = tech_destroyers }
							}
							IF = {
								limit = {
									root = {
										has_technology = tech_stingers
									}
								}
								give_technology = { tech = tech_battleships }
							}
							IF = {
								limit = {
									root = {
										has_technology = tech_harbingers
									}
								}
								give_technology = { tech = tech_cruisers }
							}
						}
					}
					set_owner = event_target:awoken_country
					set_capital = yes
					while = {
						count = 6
						create_pop_group = {
							species = last_created_species
						}
					}
#					add_building = building_research_lab_1
#					add_building = building_foundry_1
#					add_building = building_factory_1
					add_district = district_generator
					add_district = district_generator
					add_district = district_mining
					add_district = district_mining
					add_district = district_city
					add_district = district_city
					create_army = {
						name = "NAME_Awoken_Army"
						owner = event_target:awoken_country
						species = event_target:awoken_country
						type = "defense_army"
					}
					root = { country_event = { id = anomaly.1196 days = 10 } }
				}
			}
		}
	}
}

# Nomad: synths want their own world near the empire's waystation network
country_event = {
	id = anomaly.1200
	title = "anomaly.1196.name"
	desc = "anomaly.1200.desc"
	show_sound = event_mystic_reveal
	picture = GFX_evt_synth_organic_relations
	location = capital_scope

	is_triggered_only = yes

	#dismantle the robots for parts
	option = {
		name = anomaly.189.c
		custom_tooltip = anomaly.186.a.alt.tooltip
		trigger = { has_policy_flag = ai_servitude }
		add_resource = { minerals = 200 }
	}

	option = {
		name = anomaly.1200.a
		custom_tooltip = anomaly.189.b.tooltip
		trigger = {
			NOT = { has_policy_flag = ai_outlawed }
			any_owned_nonprimary_starbase = {
				is_waystation_starbase = yes
				solar_system = {
					NOT = { exists = space_owner }
					any_system_planet = {
						is_colonizable = yes
						is_colony = no
						has_anomaly = no
						NOT = { exists = owner }
						NOT = { exists = controller }
					}
				}
			}
		}
		allow = {
			NOT = { has_policy_flag = ai_outlawed }
			any_owned_nonprimary_starbase = {
				is_waystation_starbase = yes
				solar_system = {
					NOT = { exists = space_owner }
					any_system_planet = {
						is_colonizable = yes
						is_colony = no
						has_anomaly = no
						NOT = { exists = owner }
						NOT = { exists = controller }
					}
				}
			}
		}
		hidden_effect = {
			random_owned_nonprimary_starbase = {
				limit = {
					is_waystation_starbase = yes
					solar_system = {
						NOT = { exists = space_owner }
						any_system_planet = {
							is_colonizable = yes
							is_colony = no
							NOT = { exists = owner }
							NOT = { exists = controller }
						}
					}
				}
				solar_system = {
					random_system_planet = {
						limit = {
							is_colonizable = yes
							is_colony = no
							has_owner = no
							has_anomaly = no
							is_capital = no
						}
						save_event_target_as = colonized_planet
						set_surveyed = {
							surveyed = yes
							surveyor = root
						}
						prevent_anomaly = yes
						create_species = {
							name = "NAME_Awoken_Robot"
							plural = "NAME_Awoken_Robot"
							class = ROBOT
							namelist = FUN3
							portrait = "default_robot"
							traits = {
								trait = "trait_mechanical"
							}
						}
						create_country = {
							name = "NAME_Awoken"
							name_list = FUN3
							species = last_created_species
							type = default
							ethos = {
								ethic = ethic_fanatic_materialist
								ethic = ethic_xenophile
							}
							authority = random
							civics = random
							auto_delete = no
							flag = {
								icon = {
									category = "blocky"
									file = "flag_blocky_21.dds"
								}
								background = {
									category = "backgrounds"
									file = "new_dawn.dds"
								}
								colors = {
									"black"
									"dark_blue"
									"null"
									"null"
								}
							}
							exclude_day_zero_contact = root
							effect = {
								establish_communications_no_message = root
								root = {
									every_federation_ally = {
										establish_communications = prevprev
									}
								}
								add_trust = {
									amount = 10
									who = root
								}
								save_event_target_as = awoken_country
								set_country_flag = limbo_country
								set_country_flag = synthetic_empire
								species = {
									change_species_characteristics = { portrait = "sd_fun_robot" }
								}
								create_leader = {
									class = random_ruler
									species = owner_main_species
									name = random
									skill = 5
								}
								set_leader = last_created_leader
								copy_techs_from = {
									target = root
									except = {
										tech_gene_crops
										tech_nano_vitality_crops
										tech_nutrient_replication
										tech_frontier_health
										tech_frontier_hospital
										tech_telepathy
										tech_precognition_interface
										tech_psi_jump_drive_1
										tech_galactic_markets
										tech_subdermal_stimulation
										tech_global_research_initiative
										tech_neural_implants
										tech_psionic_theory
										tech_genome_mapping
										tech_vitality_boosters
										tech_epigenetic_triggers
										tech_cloning
										tech_gene_banks
										tech_gene_seed_purification
										tech_morphogenetic_field_mastery
										tech_gene_tailoring
										tech_glandular_acclimation
										tech_gene_expressions
										tech_selected_lineages
										tech_capacity_boosters
										tech_akx_worm_1
										tech_akx_worm_2
										tech_akx_worm_3
									}
								}
								IF = {
									limit = { root = { has_technology = tech_maulers } }
									give_technology = { tech = tech_corvettes }
									give_technology = { tech = tech_torpedoes_1 }
								}
								IF = {
									limit = { root = { has_technology = tech_weavers } }
									give_technology = { tech = tech_destroyers }
								}
								IF = {
									limit = { root = { has_technology = tech_stingers } }
									give_technology = { tech = tech_battleships }
								}
								IF = {
									limit = { root = { has_technology = tech_harbingers } }
									give_technology = { tech = tech_cruisers }
								}
							}
						}
						set_owner = event_target:awoken_country
						set_capital = yes
						while = {
							count = 6
							create_pop_group = {
								species = last_created_species
							}
						}
						add_district = district_generator
						add_district = district_generator
						add_district = district_mining
						add_district = district_mining
						add_district = district_city
						add_district = district_city
						create_army = {
							name = "NAME_Awoken_Army"
							owner = event_target:awoken_country
							species = event_target:awoken_country
							type = "defense_army"
						}
						root = { country_event = { id = anomaly.1196 days = 10 } }
					}
				}
			}
		}
	}
}
