########################
#
# Precursor Events
# Written by Henrik Thyrwall
#
########################

namespace = precursor

############################
# THE VULTAUM STAR ASSEMBLY
############################

# Vultaum Introduction
# via on_survey = {} | this = surveying vessel
ship_event = {
	id = precursor.1
	title = "precursor.1.name"
	desc = "precursor.1.desc"
	picture = GFX_evt_archaeological_dig
	location = from
	event_chain = vultaum_chain

	is_triggered_only = yes

	trigger = {
		owner = {
			is_ai = no
			has_precursor_intro = no
		}
		solar_system? = {
			has_star_flag = precursor_1
		}
		FROM = {
			has_anomaly = no
			is_star = no
			is_astral_scar = no
		}
	}
	weight_multiplier = {
		factor = 1
		modifier = {
			factor = @origin_shoulders_multiplier
			owner = {
				has_origin = origin_shoulders_of_giants
				has_country_flag = origin_shoulders_closure
			}
		}
	}

	immediate = {
		owner = {
			begin_event_chain = {
				event_chain = "vultaum_chain"
				target = THIS
			}
			set_country_flag = vultaum_intro
		}
	}

	option = {
		name = INTERESTING
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		owner = {
			tooltip = {
				begin_event_chain = {
					event_chain = "vultaum_chain"
					target = THIS
				}
			}
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
		}
	}
}

# Mining Base
ship_event = {
	id = precursor.5
	title = "precursor.5.name"
	desc = "precursor.5.desc"
	picture = GFX_evt_outpost
	location = FROM
	trackable = yes
	event_chain = vultaum_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = vultaum_1 }
		}
	}

	option = {
		name = FASCINATING
		from = {
			enable_special_project = {
				name = "VULTAUM_ARCHEOLOGY_1"
				location = this
				owner = root.owner
			}
		}
	}
}

# Mining Base Project Completed
ship_event = {
	id = precursor.6
	title = "precursor.completed.name"
	desc = "precursor.6.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = vultaum_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "vultaum_chain"
				counter = "vultaum_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.97 } }
		}
	}
}

# Observatory
ship_event = {
	id = precursor.10
	title = "precursor.10.name"
	desc = "precursor.10.desc"
	picture = GFX_evt_outpost
	location = FROM
	trackable = yes
	event_chain = vultaum_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = vultaum_2 }
		}
	}

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "VULTAUM_ARCHEOLOGY_2"
				location = this
				owner = root.owner
			}
		}
	}
}

# Observatory Project Completed
ship_event = {
	id = precursor.11
	title = "precursor.completed.name"
	desc = "precursor.11.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = vultaum_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "vultaum_chain"
				counter = "vultaum_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.97 } }
		}
	}
}

# Colony 1
ship_event = {
	id = precursor.15
	title = "precursor.15.name"
	desc = "precursor.15.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = vultaum_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = vultaum_3 }
		}
	}

	option = {
		name = INTRIGUING
		from = {
			enable_special_project = {
				name = "VULTAUM_ARCHEOLOGY_3"
				location = this
				owner = root.owner
			}
		}
	}
}

# Colony 1 Project Completed
ship_event = {
	id = precursor.16
	title = "precursor.completed.name"
	desc = "precursor.16.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = vultaum_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "vultaum_chain"
				counter = "vultaum_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.97 } }
		}
	}
}

# Colony 2
ship_event = {
	id = precursor.20
	title = "precursor.15.name"
	desc = "precursor.20.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = vultaum_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = vultaum_4 }
		}
	}

	option = {
		name = ASTOUNDING
		from = {
			enable_special_project = {
				name = "VULTAUM_ARCHEOLOGY_4"
				location = this
				owner = root.owner
			}
		}
	}
}

# Colony 2 Project Completed
ship_event = {
	id = precursor.21
	title = "precursor.completed.name"
	desc = "precursor.21.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = vultaum_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "vultaum_chain"
				counter = "vultaum_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.97 } }
		}
	}
}

# Colony 3
ship_event = {
	id = precursor.25
	title = "precursor.15.name"
	desc = "precursor.25.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = vultaum_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = vultaum_5 }
		}
	}

	option = {
		name = REMARKABLE
		from = {
			enable_special_project = {
				name = "VULTAUM_ARCHEOLOGY_5"
				location = this
				owner = root.owner
			}
		}
	}
}

# Colony 3 Project Completed
ship_event = {
	id = precursor.26
	title = "precursor.completed.name"
	desc = "precursor.26.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = vultaum_chain

	is_triggered_only = yes

	specimen = fossilized_vultaum_remains

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "vultaum_chain"
				counter = "vultaum_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.97 } }
		}
	}
}

# Gas Giant Base
ship_event = {
	id = precursor.30
	title = "precursor.30.name"
	desc = "precursor.30.desc"
	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
	trackable = yes
	event_chain = vultaum_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = vultaum_6 }
		}
	}

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "VULTAUM_ARCHEOLOGY_6"
				location = this
				owner = root.owner
			}
		}
	}
}

# Gas Giant Base Project Completed
ship_event = {
	id = precursor.31
	title = "precursor.completed.name"
	desc = "precursor.31.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	location = FROMFROM
	event_chain = vultaum_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "vultaum_chain"
				counter = "vultaum_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.97 } }
		}
	}
}

# Trade Post
ship_event = {
	id = precursor.35
	title = "precursor.35.name"
	desc = "precursor.35.desc"
	picture = GFX_evt_outpost
	location = FROM
	trackable = yes
	event_chain = vultaum_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = vultaum_7 }
		}
	}

	option = {
		name = FASCINATING
		from = {
			enable_special_project = {
				name = "VULTAUM_ARCHEOLOGY_7"
				location = this
				owner = root.owner
			}
		}
	}
}

# Trade Post Project Completed
ship_event = {
	id = precursor.36
	title = "precursor.completed.name"
	desc = "precursor.36.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = vultaum_chain

	is_triggered_only = yes

	specimen = vultaum_religious_pamphlet

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "vultaum_chain"
				counter = "vultaum_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.97 } }
		}
	}
}

# Satellite
ship_event = {
	id = precursor.40
	title = "precursor.40.name"
	desc = "precursor.40.desc"
	picture = GFX_evt_satellite_in_orbit
	location = FROM
	trackable = yes
	event_chain = vultaum_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = vultaum_8 }
		}
	}

	option = {
		name = CURIOUS
		from = {
			enable_special_project = {
				name = "VULTAUM_ARCHEOLOGY_8"
				location = this
				owner = root.owner
			}
		}
	}
}

# Satellite Project Completed
ship_event = {
	id = precursor.41
	title = "precursor.completed.name"
	desc = "precursor.41.desc"
	picture = GFX_evt_satellite_in_orbit
	location = FROMFROM
	event_chain = vultaum_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "vultaum_chain"
				counter = "vultaum_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.97 } }
		}
	}
}

# Splinter Colony
ship_event = {
	id = precursor.45
	title = "precursor.45.name"
	desc = "precursor.45.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = vultaum_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = vultaum_9 }
		}
	}

	option = {
		name = INTRIGUING
		from = {
			enable_special_project = {
				name = "VULTAUM_ARCHEOLOGY_9"
				location = this
				owner = root.owner
			}
		}
	}
}

# Splinter Colony Project Completed
ship_event = {
	id = precursor.46
	title = "precursor.completed.name"
	desc = "precursor.46.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = vultaum_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "vultaum_chain"
				counter = "vultaum_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.97 } }
		}
	}
}

# Virtual Reality Center
ship_event = {
	id = precursor.50
	title = "precursor.50.name"
	desc = "precursor.50.desc"
	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
	trackable = yes
	event_chain = vultaum_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = vultaum_10 }
		}
	}

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "VULTAUM_ARCHEOLOGY_10"
				location = this
				owner = owner.root
			}
		}
	}
}

# Virtual Reality Center Project Completed
ship_event = {
	id = precursor.51
	title = "precursor.completed.name"
	desc = "precursor.51.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	location = FROMFROM
	event_chain = vultaum_chain

	is_triggered_only = yes

	specimen = vultaum_vr_video_game

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "vultaum_chain"
				counter = "vultaum_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.97 } }
		}
	}
}

# Asteroid Mining Base
ship_event = {
	id = precursor.55
	title = "precursor.55.name"
	desc = "precursor.55.desc"
	picture = GFX_evt_mining_station
	location = FROM
	trackable = yes
	event_chain = vultaum_chain

	is_triggered_only = yes

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "VULTAUM_ARCHEOLOGY_11"
				location = this
				owner = root.owner
			}
		}
	}
}

# Asteroid Mining Base Completed
ship_event = {
	id = precursor.56
	title = "precursor.completed.name"
	desc = "precursor.56.desc"
	picture = GFX_evt_mining_station
	location = FROMFROM
	event_chain = vultaum_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "vultaum_chain"
				counter = "vultaum_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.97 } }
		}
	}
}

# Port to Home System events
country_event = {
	id = precursor.97
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				NOR = {
					has_global_flag = vultaum_system_discovered
					has_country_flag = vultaum_system
				}
				has_completed_event_chain_counter = {
					event_chain = "vultaum_chain"
					counter = "vultaum_artifacts"
				}
			}
			country_event = { id = precursor.98 }
		}
		else_if = {
			limit = {
				has_global_flag = vultaum_system_discovered
				NOT = { has_country_flag = vultaum_system }
				has_completed_event_chain_counter = {
					event_chain = "vultaum_chain"
					counter = "vultaum_artifacts"
				}
			}
			country_event = { id = precursor.99 }
		}
	}
}

# Vultaum Home System Discovered (HIDDEN)
country_event = {
	id = precursor.98
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		set_global_flag = vultaum_system_discovered
		set_country_flag = vultaum_system

		precursor_capital_spawn_system_effect = { PRECURSOR_FLAG = precursor_1 }
		if = {
			limit = { exists = event_target:precursor_spawn_system }
			event_target:precursor_spawn_system = {
				spawn_system = {
					min_distance = 10
					max_distance = 30
					max_jumps = 0
					initializer = "vultaumar_system"
				}
				if = {
					limit = { last_created_system = { NOT = { has_hyperlane_to = prev } } }
					add_hyperlane = {
						from = this
						to = last_created_system
					}
				}
				else = {
					add_extra_hyperlane_to_spawned_system_effect = yes
				}
			}
			country_event = { id = precursor.100 days = 2 }
		}
		else = {
			# No usable system found (e.g. nomad arkship is mid-FTL with no waystations). Retry later.
			country_event = { id = precursor.98 days = 30 }
		}
	}
}

# Vultaum Home System Discovered (Not First) (HIDDEN)
country_event = {
	id = precursor.99
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		set_country_flag = vultaum_system
		country_event = { id = precursor.100 days = 2 }
	}
}

# Vultaum Home System Discovered
country_event = {
	id = precursor.100
	title = "precursor.100.name"
	desc = "precursor.100.desc"
	picture = GFX_evt_federation_fleet
	location = event_target:vultaumar
	event_chain = vultaum_chain

	is_triggered_only = yes

	immediate = {
		random_system = {
			limit = { has_star_flag = vultaumar }
			save_event_target_as = vultaumar
			root = { set_visited = prev }
			random_system_planet = {
				limit = { has_planet_flag = vultaum_homeworld }
				save_event_target_as = vultaum_homeworld
			}
		}
		observer_event = { id = observer.56 }
	}

	option = {
		name = "precursor.100.a"
		end_event_chain = "vultaum_chain"
		begin_event_chain = {
			event_chain = "vultaum_homeworld_chain"
			target = ROOT
		}
		event_target:vultaum_homeworld = {
			enable_special_project = {
				name = "VULTAUM_HOMEWORLD_PROJECT"
				location = event_target:vultaum_homeworld
				owner = ROOT
			}
		}
	}
}

# Vultaum Homeworld
ship_event = {
	id = precursor.101
	title = "precursor.101.name"
	desc = "precursor.101.desc"
	picture = GFX_evt_archaeological_dig
	location = from
	event_chain = vultaum_homeworld_chain

	is_triggered_only = yes

	trigger = {
		fromfrom = { has_planet_flag = vultaum_homeworld }
		owner = {
			is_ai = no
			has_country_flag = vultaum_system
		}
	}

	immediate = {
		owner = {
			set_country_flag = vultaum_world_found
			set_global_flag = vultaum_homeworld_found
			if = {
				limit = { has_event_chain = vultaum_chain }
				end_event_chain = "vultaum_chain"
			}
		}
	}

	option = {
		name = "FASCINATING"
		owner = {
			if = {
				limit = { has_event_chain = "vultaum_homeworld_chain" }
				end_event_chain = "vultaum_homeworld_chain"
			}
			if = {
				limit = { has_ancrel = yes }
				add_relic = r_reality_perforator
				large_artifact_reward = yes
			}
			add_monthly_resource_mult = {
				resource = unity
				value = 120
				min = 240
				max = 9999
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier3researchreward
				min = @tier3researchmin
				max = @tier3researchmax
			}
			if = {
				limit = { has_ancrel = yes }
				custom_tooltip = vultaum_artifact_research_unlocked
			}
		}
	}
}

# Someone else got there first
ship_event = {
	id = precursor.102
	title = "precursor.102.name"

	desc = {
		text = precursor.102.desc.a
		trigger = {
			owner = {
				OR = {
					has_event_chain = vultaum_chain
					has_event_chain = vultaum_homeworld_chain
				}
			}
		}
	}
	desc = {
		text = precursor.102.desc.b
		trigger = {
			owner = {
				NOR = {
					has_event_chain = vultaum_chain
					has_event_chain = vultaum_homeworld_chain
				}
			}
		}
	}

	location = from
	picture = GFX_evt_archaeological_dig

	is_triggered_only = yes

	#trigger = {
	#	fromfrom = { has_planet_flag = vultaum_homeworld }
	#	owner = {
	#		is_ai = no
	#		NOT = { has_country_flag = vultaum_system }
	#	}
	#	has_global_flag = vultaum_homeworld_found
	#}

	immediate = {
		owner = {
			set_country_flag = vultaum_world_found
			if = {
				limit = { has_event_chain = vultaum_chain }
				end_event_chain = "vultaum_chain"
			}
			if = {
				limit = { has_event_chain = vultaum_homeworld_chain }
				end_event_chain = "vultaum_homeworld_chain"
			}
		}
	}

	option = {
		name = "UNFORTUNATE"

		if = {
			limit = { has_ancrel = yes }
			custom_tooltip = vultaum_artifact_research_unlocked
		}
	}
}

# Vultaum Reality Perforator Activated
country_event = {
	id = precursor.105
	title = "precursor.105.name"
	desc = "precursor.105.desc"
	picture = GFX_evt_surreal_visions

	is_triggered_only = yes

	option = {
		name = "precursor.105.a"
		locked_random_list = {
			10 = {
				add_modifier = {
					modifier = "reality_perforator_1"
					years = 2
				}
			}
			10 = {
				add_modifier = {
					modifier = "reality_perforator_2"
					years = 2
				}
			}
			10 = {
				add_modifier = {
					modifier = "reality_perforator_3"
					years = 2
				}
			}
			10 = {
				add_modifier = {
					modifier = "reality_perforator_4"
					years = 2
				}
			}
			10 = {
				add_modifier = {
					modifier = "reality_perforator_1"
					years = 3
				}
			}
			10 = {
				add_modifier = {
					modifier = "reality_perforator_2"
					years = 3
				}
			}
			10 = {
				add_modifier = {
					modifier = "reality_perforator_3"
					years = 3
				}
			}
			10 = {
				add_modifier = {
					modifier = "reality_perforator_4"
					years = 3
				}
			}
			10 = {
				add_modifier = {
					modifier = "reality_perforator_1"
					years = 4
				}
			}
			10 = {
				add_modifier = {
					modifier = "reality_perforator_2"
					years = 4
				}
			}
			10 = {
				add_modifier = {
					modifier = "reality_perforator_3"
					years = 4
				}
			}
			10 = {
				add_modifier = {
					modifier = "reality_perforator_4"
					years = 4
				}
			}
			10 = {
				add_modifier = {
					modifier = "reality_perforator_1"
					years = 5
				}
			}
			10 = {
				add_modifier = {
					modifier = "reality_perforator_2"
					years = 5
				}
			}
			10 = {
				add_modifier = {
					modifier = "reality_perforator_3"
					years = 5
				}
			}
			10 = {
				add_modifier = {
					modifier = "reality_perforator_4"
					years = 5
				}
			}
			5 = {
				add_modifier = {
					modifier = "reality_perforator_1"
					years = 1
				}
				add_modifier = {
					modifier = "reality_perforator_2"
					years = 1
				}
				add_modifier = {
					modifier = "reality_perforator_3"
					years = 1
				}
				add_modifier = {
					modifier = "reality_perforator_4"
					years = 1
				}
			}
		}
	}
}

##################
# THE YUHT EMPIRE
##################

# Yuht Intro
# via on_survey = {} | this = surveying vessel
ship_event = {
	id = precursor.500
	title = "precursor.500.name"
	desc = "precursor.500.desc"
	picture = GFX_evt_archaeological_dig
	location = from
	event_chain = yuht_chain

	is_triggered_only = yes

	trigger = {
		exists = solar_system #Unsure why this error would occur, instant_survery?
		solar_system = {
			has_star_flag = precursor_2
		}
		owner = {
			is_ai = no
			has_precursor_intro = no
		}
		FROM = {
			has_anomaly = no
			is_star = no
			is_astral_scar = no
		}
	}
	weight_multiplier = {
		factor = 1
		modifier = {
			factor = @origin_shoulders_multiplier
			owner = {
				has_origin = origin_shoulders_of_giants
				has_country_flag = origin_shoulders_closure
			}
		}
	}

	immediate = {
		owner = {
			begin_event_chain = {
				event_chain = "yuht_chain"
				target = THIS
			}
			set_country_flag = yuht_intro
		}
	}

	option = {
		name = INTERESTING
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		owner = {
			tooltip = {
				begin_event_chain = {
					event_chain = "yuht_chain"
					target = THIS
				}
			}
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
		}
	}
}

# Hatchery World
ship_event = {
	id = precursor.505
	title = "precursor.505.name"
	desc = "precursor.505.desc"
	picture = GFX_evt_alien_nature
	location = FROM
	trackable = yes
	event_chain = yuht_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = yuht_1 }
		}
	}

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "YUHT_ARCHEOLOGY_1"
				location = this
				owner = root.owner
			}
		}
	}
}

# Hatchery World Project Completed
ship_event = {
	id = precursor.506
	title = "precursor.completed.name"
	desc = "precursor.506.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = yuht_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "yuht_chain"
				counter = "yuht_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.597 } }
		}
	}
}

# Listening Post
ship_event = {
	id = precursor.510
	title = "precursor.510.name"
	desc = "precursor.510.desc"
	picture = GFX_evt_outpost
	location = FROM
	trackable = yes
	event_chain = yuht_chain

	is_triggered_only = yes

	specimen = yuht_audio_console

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = yuht_2 }
		}
	}

	option = {
		name = INTRIGUING
		from = {
			enable_special_project = {
				name = "YUHT_ARCHEOLOGY_2"
				location = this
				owner = root.owner
			}
		}
	}
}

# Listening Post Project Completed
ship_event = {
	id = precursor.511
	title = "precursor.completed.name"
	desc = "precursor.511.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = yuht_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "yuht_chain"
				counter = "yuht_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.597 } }
		}
	}
}

# Colony 1
ship_event = {
	id = precursor.515
	title = "precursor.515.name"
	desc = "precursor.515.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = yuht_chain

	is_triggered_only = yes

	specimen = yuht_crystal_skull

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = yuht_3 }
		}
	}

	option = {
		name = CURIOUS
		from = {
			enable_special_project = {
				name = "YUHT_ARCHEOLOGY_3"
				location = this
				owner = root.owner
			}
		}
	}
}

# Colony 1 Project Completed
ship_event = {
	id = precursor.516
	title = "precursor.completed.name"
	desc = "precursor.516.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = yuht_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "yuht_chain"
				counter = "yuht_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.597 } }
		}
	}
}

# Colony 2
ship_event = {
	id = precursor.520
	title = "precursor.515.name"
	desc = "precursor.520.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = yuht_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = yuht_4 }
		}
	}

	option = {
		name = PECULIAR
		from = {
			enable_special_project = {
				name = "YUHT_ARCHEOLOGY_4"
				location = this
				owner = root.owner
			}
		}
	}
}

# Colony 2 Project Completed
ship_event = {
	id = precursor.521
	title = "precursor.completed.name"
	desc = "precursor.521.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = yuht_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "yuht_chain"
				counter = "yuht_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.597 } }
		}
	}
}

# Colony 3
ship_event = {
	id = precursor.525
	title = "precursor.515.name"
	desc = "precursor.525.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = yuht_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = yuht_5 }
		}
	}

	option = {
		name = FASCINATING
		from = {
			enable_special_project = {
				name = "YUHT_ARCHEOLOGY_5"
				location = this
				owner = root.owner
			}
		}
	}
}

# Colony 3 Project Completed
ship_event = {
	id = precursor.526
	title = "precursor.completed.name"
	desc = "precursor.526.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = yuht_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "yuht_chain"
				counter = "yuht_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.597 } }
		}
	}
}

# Satellite
ship_event = {
	id = precursor.530
	title = "precursor.530.name"
	desc = "precursor.530.desc"
	picture = GFX_evt_satellite_in_orbit
	location = FROM
	trackable = yes
	event_chain = yuht_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = yuht_6 }
		}
	}

	option = {
		name = REMARKABLE
		from = {
			enable_special_project = {
				name = "YUHT_ARCHEOLOGY_6"
				location = this
				owner = root.owner
			}
		}
	}
}

# Satellite Project Completed
ship_event = {
	id = precursor.531
	title = "precursor.completed.name"
	desc = "precursor.531.desc"
	picture = GFX_evt_satellite_in_orbit
	location = FROMFROM
	event_chain = yuht_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "yuht_chain"
				counter = "yuht_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.597 } }
		}
	}
}

# Derelict Cruiser
ship_event = {
	id = precursor.535
	title = "precursor.535.name"
	desc = "precursor.535.desc"
	picture = GFX_evt_ship_in_orbit
	location = FROM
	trackable = yes
	event_chain = yuht_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = yuht_7 }
		}
	}

	option = {
		name = INTRIGUING
		from = {
			enable_special_project = {
				name = "YUHT_ARCHEOLOGY_7"
				location = this
				owner = root.owner
			}
		}
	}
}

# Derelict Cruiser Project Completed
ship_event = {
	id = precursor.536
	title = "precursor.completed.name"
	desc = "precursor.536.desc"
	picture = GFX_evt_ship_in_orbit
	location = FROMFROM
	event_chain = yuht_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "yuht_chain"
				counter = "yuht_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.597 } }
		}
	}
}

# Colony Ship
ship_event = {
	id = precursor.540
	title = "precursor.540.name"
	desc = "precursor.540.desc"
	picture = GFX_evt_ship_in_orbit
	location = FROM
	trackable = yes
	event_chain = yuht_chain

	is_triggered_only = yes

	specimen = yuht_cryo_pod

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = yuht_8 }
		}
	}

	option = {
		name = CURIOUS
		from = {
			enable_special_project = {
				name = "YUHT_ARCHEOLOGY_8"
				location = this
				owner = root.owner
			}
		}
	}
}

# Colony Ship Project Completed
ship_event = {
	id = precursor.541
	title = "precursor.completed.name"
	desc = "precursor.541.desc"
	picture = GFX_evt_ship_in_orbit
	location = FROMFROM
	event_chain = yuht_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "yuht_chain"
				counter = "yuht_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.597 } }
		}
	}
}

# Asteroid Dwelling
ship_event = {
	id = precursor.545
	title = "precursor.545.name"
	desc = "precursor.545.desc"
	picture = GFX_evt_mining_station
	location = FROM
	trackable = yes
	event_chain = yuht_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = yuht_9 }
		}
	}

	option = {
		name = CURIOUS
		from = {
			enable_special_project = {
				name = "YUHT_ARCHEOLOGY_9"
				location = this
				owner = root.owner
			}
		}
	}
}

# Asteroid Dwelling Completed
ship_event = {
	id = precursor.546
	title = "precursor.completed.name"
	desc = "precursor.546.desc"
	picture = GFX_evt_mining_station
	location = FROMFROM
	event_chain = yuht_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "yuht_chain"
				counter = "yuht_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.597 } }
		}
	}
}

# Port to Home System events
country_event = {
	id = precursor.597
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				NOT = { has_global_flag = yuht_system_discovered }
				has_completed_event_chain_counter = {
					event_chain = "yuht_chain"
					counter = "yuht_artifacts"
				}
			}
			country_event = { id = precursor.598 }
		}
		else_if = {
			limit = {
				has_global_flag = yuht_system_discovered
				has_completed_event_chain_counter = {
					event_chain = "yuht_chain"
					counter = "yuht_artifacts"
				}
			}
			country_event = { id = precursor.599 }
		}
	}
}

# Yuht Home System Discovered (HIDDEN)
country_event = {
	id = precursor.598
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		set_global_flag = yuht_system_discovered
		set_country_flag = yuht_system
		precursor_capital_spawn_system_effect = { PRECURSOR_FLAG = precursor_2 }
		if = {
			limit = { exists = event_target:precursor_spawn_system }
			event_target:precursor_spawn_system = {
				spawn_system = {
					min_distance = 10
					max_distance = 30
					max_jumps = 0
					initializer = "yuhtaan_system"
				}
				if = {
					limit = { last_created_system = { NOT = { has_hyperlane_to = prev } } }
					add_hyperlane = {
						from = this
						to = last_created_system
					}
				}
				else = {
					add_extra_hyperlane_to_spawned_system_effect = yes
				}
			}
			country_event = { id = precursor.600 days = 2 }
		}
		else = {
			# No usable system found (e.g. nomad arkship is mid-FTL with no waystations). Retry later.
			country_event = { id = precursor.598 days = 30 }
		}
	}
}

# Yuht Home System Discovered (Not First) (HIDDEN)
country_event = {
	id = precursor.599
	hide_window = yes

	fire_only_once = yes

	is_triggered_only = yes

	immediate = {
		set_country_flag = yuht_system
		country_event = { id = precursor.600 days = 2 }
	}
}

# Yuht Home System Discovered
country_event = {
	id = precursor.600
	title = "precursor.600.name"
	desc = "precursor.600.desc"
	picture = GFX_evt_federation_fleet
	location = event_target:yuhtaan
	event_chain = yuht_chain

	is_triggered_only = yes

	immediate = {
		random_system = {
			limit = { has_star_flag = yuhtaan }
			save_event_target_as = yuhtaan
			root = { set_visited = prev }
			random_system_planet = {
				limit = { has_planet_flag = yuht_homeworld }
				save_event_target_as = yuht_homeworld
			}
		}
		observer_event = { id = observer.57 }
	}

	option = {
		name = "precursor.100.a"
		end_event_chain = "yuht_chain"
		begin_event_chain = {
			event_chain = "yuht_homeworld_chain"
			target = ROOT
		}
		event_target:yuht_homeworld = {
			enable_special_project = {
				name = "YUHT_HOMEWORLD_PROJECT"
				location = event_target:yuht_homeworld
				owner = ROOT
			}
		}
	}
}

# Yuht Homeworld
ship_event = {
	id = precursor.601
	title = "precursor.601.name"
	desc = "precursor.601.desc"
	picture = GFX_evt_archaeological_dig
	location = from

	is_triggered_only = yes

	trigger = {
		fromfrom = { has_planet_flag = yuht_homeworld }
		owner = {
			is_ai = no
			has_country_flag = yuht_system
		}
	}

	immediate = {
		set_global_flag = yuht_homeworld_found
		owner = {
			set_country_flag = yuht_world_found
			end_event_chain = "yuht_homeworld_chain"
		}
	}

	after = {
		if = {
			limit = {
				has_overlord_dlc = yes
			}
			hidden_effect = {
				owner = { country_event = { id = over.50 days = 720 random = 1080 } }
			}
		}
	}

	option = {
		name = "FASCINATING"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				add_relic = r_cryo_core
				large_artifact_reward = yes
			}
			add_monthly_resource_mult = {
				resource = unity
				value = 120
				min = 240
				max = 9999
			}
			add_monthly_resource_mult = {
				resource = energy
				value = @tier4materialreward
				min = @tier4materialmin
				max = @tier4materialmax
			}
			add_monthly_resource_mult = {
				resource = minerals
				value = @tier4materialreward
				min = @tier4materialmin
				max = @tier4materialmax
			}

			if = {
				limit = { has_ancrel = yes }
				custom_tooltip = yuht_artifact_research_unlocked
			}
		}
	}
}

# Someone else got there first
ship_event = {
	id = precursor.602
	title = "precursor.602.name"

	desc = {
		text = precursor.602.desc.a
		trigger = {
			owner = {
				OR = {
					has_event_chain = yuht_chain
					has_event_chain = yuht_homeworld_chain
				}
			}
		}
	}
	desc = {
		text = precursor.602.desc.b
		trigger = {
			owner = {
				NOR = {
					has_event_chain = yuht_chain
					has_event_chain = yuht_homeworld_chain
				}
			}
		}
	}

	location = from
	picture = GFX_evt_archaeological_dig

	is_triggered_only = yes

	#trigger = {
	#	fromfrom = { has_planet_flag = yuht_homeworld }
	#	owner = {
	#		is_ai = no
	#		NOT = { has_country_flag = yuht_system }
	#	}
	#	has_global_flag = yuht_homeworld_found
	#}

	immediate = {
		owner = {
			set_country_flag = yuht_world_found
			if = {
				limit = { has_event_chain = yuht_chain }
				end_event_chain = "yuht_chain"
			}
			if = {
				limit = { has_event_chain = yuht_homeworld_chain }
				end_event_chain = "yuht_homeworld_chain"
			}
		}
	}

	option = {
		name = "UNFORTUNATE"

		owner = {
			if = {
				limit = { has_ancrel = yes }
				custom_tooltip = yuht_artifact_research_unlocked
			}
		}
	}
}

###################
# THE FIRST LEAGUE
###################

# First League Notification Event
# via on_survey = {} | this = surveying vessel
ship_event = {
	id = precursor.1000
	title = "precursor.1000.name"
	desc = "precursor.1000.desc"
	picture = GFX_evt_archaeological_dig
	location = from
	event_chain = first_league_chain

	is_triggered_only = yes

	trigger = {
		solar_system? = {
			has_star_flag = precursor_3
		}
		owner = {
			is_ai = no
			has_precursor_intro = no
		}
		FROM = {
			has_anomaly = no
			is_star = no
			is_astral_scar = no
		}
	}
	weight_multiplier = {
		factor = 1
		modifier = {
			factor = @origin_shoulders_multiplier
			owner = {
				has_origin = origin_shoulders_of_giants
				has_country_flag = origin_shoulders_closure
			}
		}
	}

	immediate = {
		owner = {
			begin_event_chain = {
				event_chain = "first_league_chain"
				target = THIS
			}
			set_country_flag = first_league_intro
		}
	}

	option = {
		name = INTERESTING
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		owner = {
			tooltip = {
				begin_event_chain = {
					event_chain = "first_league_chain"
					target = THIS
				}
			}
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
		}
	}
}

# League Naval Base
ship_event = {
	id = precursor.1005
	title = "precursor.1005.name"
	desc = "precursor.1005.desc"
	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
	trackable = yes
	event_chain = first_league_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = first_league_1 }
		}
	}

	option = {
		name = REMARKABLE
		from = {
			enable_special_project = {
				name = "FIRST_LEAGUE_ARCHEOLOGY_1"
				location = this
				owner = root.owner
			}
		}
	}
}

# League Naval Base Completed
ship_event = {
	id = precursor.1006
	title = "precursor.completed.name"
	desc = "precursor.1006.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	location = FROMFROM
	event_chain = first_league_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "first_league_chain"
				counter = "first_league_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1097 } }
		}
	}
}

# League Cruiser
ship_event = {
	id = precursor.1010
	title = "precursor.1010.name"
	desc = "precursor.1010.desc"
	picture = GFX_evt_ship_in_orbit
	location = FROM
	trackable = yes
	event_chain = first_league_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = first_league_2 }
		}
	}

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "FIRST_LEAGUE_ARCHEOLOGY_2"
				location = this
				owner = root.owner
			}
		}
	}
}

# League Cruiser Completed
ship_event = {
	id = precursor.1011
	title = "precursor.completed.name"
	desc = "precursor.1011.desc"
	picture = GFX_evt_ship_in_orbit
	location = FROMFROM
	event_chain = first_league_chain

	is_triggered_only = yes

	specimen = first_league_crew_manifest

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "first_league_chain"
				counter = "first_league_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1097 } }
		}
	}
}

# Khamdai Homeworld
ship_event = {
	id = precursor.1015
	title = "precursor.1015.name"
	desc = "precursor.1015.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = first_league_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = first_league_3 }
		}
	}

	option = {
		name = INTRIGUING
		from = {
			enable_special_project = {
				name = "FIRST_LEAGUE_ARCHEOLOGY_3"
				location = this
				owner = root.owner
			}
		}
	}
}

# Khamdai Homeworld Completed
ship_event = {
	id = precursor.1016
	title = "precursor.completed.name"
	desc = "precursor.1016.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = first_league_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "first_league_chain"
				counter = "first_league_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1097 } }
		}
	}

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

# Chassago Homeworld
ship_event = {
	id = precursor.1020
	title = "precursor.1020.name"
	desc = "precursor.1020.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = first_league_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = first_league_4 }
		}
	}

	option = {
		name = CURIOUS
		from = {
			enable_special_project = {
				name = "FIRST_LEAGUE_ARCHEOLOGY_4"
				location = this
				owner = root.owner
			}
		}
	}
}

# Chassago Homeworld Completed
ship_event = {
	id = precursor.1021
	title = "precursor.completed.name"
	desc = "precursor.1021.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = first_league_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "first_league_chain"
				counter = "first_league_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1097 } }
		}
	}
}

# Migir-Yan Homeworld
ship_event = {
	id = precursor.1025
	title = "precursor.1025.name"
	desc = "precursor.1025.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = first_league_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = first_league_5 }
		}
	}

	option = {
		name = FASCINATING
		from = {
			enable_special_project = {
				name = "FIRST_LEAGUE_ARCHEOLOGY_5"
				location = this
				owner = root.owner
			}
		}
	}
}

# Migir-Yan Homeworld Completed
ship_event = {
	id = precursor.1026
	title = "precursor.completed.name"
	desc = "precursor.1026.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = first_league_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "first_league_chain"
				counter = "first_league_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1097 } }
		}
	}
}

# V'ropak Homeworld
ship_event = {
	id = precursor.1030
	title = "precursor.1030.name"
	desc = "precursor.1030.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = first_league_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = first_league_6 }
		}
	}

	option = {
		name = PECULIAR
		from = {
			enable_special_project = {
				name = "FIRST_LEAGUE_ARCHEOLOGY_6"
				location = this
				owner = root.owner
			}
		}
	}
}

# V'ropak Homeworld Completed
ship_event = {
	id = precursor.1031
	title = "precursor.completed.name"
	desc = "precursor.1031.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = first_league_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "first_league_chain"
				counter = "first_league_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1097 } }
		}
	}
}

# League Science Base
ship_event = {
	id = precursor.1035
	title = "precursor.1035.name"
	desc = "precursor.1035.desc"
	picture = GFX_evt_outpost
	location = FROM
	trackable = yes
	event_chain = first_league_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = first_league_7 }
		}
	}

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "FIRST_LEAGUE_ARCHEOLOGY_7"
				location = this
				owner = root.owner
			}
		}
	}
}

# League Science Base Completed
ship_event = {
	id = precursor.1036
	title = "precursor.completed.name"
	desc = "precursor.1036.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = first_league_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "first_league_chain"
				counter = "first_league_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1097 } }
		}
	}
}

# Joint League Colony
ship_event = {
	id = precursor.1040
	title = "precursor.1040.name"
	desc = "precursor.1040.desc"
	picture = GFX_evt_alien_nature
	location = FROM
	trackable = yes
	event_chain = first_league_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = first_league_8 }
		}
	}

	option = {
		name = FASCINATING
		from = {
			enable_special_project = {
				name = "FIRST_LEAGUE_ARCHEOLOGY_8"
				location = this
				owner = root.owner
			}
		}
	}
}

# Joint League Colony Completed
ship_event = {
	id = precursor.1041
	title = "precursor.completed.name"
	desc = "precursor.1041.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = first_league_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "first_league_chain"
				counter = "first_league_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1097 } }
		}
	}
}

# League Trade Center
ship_event = {
	id = precursor.1045
	title = "precursor.1045.name"
	desc = "precursor.1045.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = first_league_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = first_league_9 }
		}
	}

	option = {
		name = AMAZING
		from = {
			enable_special_project = {
				name = "FIRST_LEAGUE_ARCHEOLOGY_9"
				location = this
				owner = root.owner
			}
		}
	}
}

# League Trade Center Completed
ship_event = {
	id = precursor.1046
	title = "precursor.completed.name"
	desc = "precursor.1046.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = first_league_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "first_league_chain"
				counter = "first_league_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1097 } }
		}
	}
}

# Battle Wreckage
ship_event = {
	id = precursor.1050
	title = "precursor.1050.name"
	desc = "precursor.1050.desc"
	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
	trackable = yes
	event_chain = first_league_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = first_league_10 }
		}
	}

	option = {
		name = INTRIGUING
		from = {
			enable_special_project = {
				name = "FIRST_LEAGUE_ARCHEOLOGY_10"
				location = this
				owner = root.owner
			}
		}
	}
}

# Battle Wreckage Completed
ship_event = {
	id = precursor.1051
	title = "precursor.completed.name"
	desc = "precursor.1051.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	location = FROMFROM
	event_chain = first_league_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "first_league_chain"
				counter = "first_league_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1097 } }
		}
	}
}

# Prison Complex
ship_event = {
	id = precursor.1055
	title = "precursor.1055.name"
	desc = "precursor.1055.desc"
	picture = GFX_evt_outpost
	location = FROM
	trackable = yes
	event_chain = first_league_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = first_league_11 }
		}
	}

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "FIRST_LEAGUE_ARCHEOLOGY_11"
				location = this
				owner = root.owner
			}
		}
	}
}

# Prison Complex Completed
ship_event = {
	id = precursor.1056
	title = "precursor.completed.name"
	desc = "precursor.1056.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = first_league_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "first_league_chain"
				counter = "first_league_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1097 } }
		}
	}
}

# Protected Primitive World
ship_event = {
	id = precursor.1060
	title = "precursor.1060.name"
	desc = "precursor.1060.desc"
	picture = GFX_evt_alien_nature
	location = FROM
	trackable = yes
	event_chain = first_league_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = first_league_12 }
		}
	}

	option = {
		name = REMARKABLE
		from = {
			enable_special_project = {
				name = "FIRST_LEAGUE_ARCHEOLOGY_12"
				location = this
				owner = root.owner
			}
		}
	}
}

# Protected Primitive World Completed
ship_event = {
	id = precursor.1061
	title = "precursor.completed.name"
	desc = "precursor.1061.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = first_league_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "first_league_chain"
				counter = "first_league_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1097 } }
		}
	}
}

# Blockaded World
ship_event = {
	id = precursor.1065
	title = "precursor.1065.name"
	desc = "precursor.1065.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = first_league_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = first_league_13 }
		}
	}

	option = {
		name = CURIOUS
		from = {
			enable_special_project = {
				name = "FIRST_LEAGUE_ARCHEOLOGY_13"
				location = this
				owner = root.owner
			}
		}
	}
}

# Blockaded World Completed
ship_event = {
	id = precursor.1066
	title = "precursor.completed.name"
	desc = "precursor.1066.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = first_league_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "first_league_chain"
				counter = "first_league_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1097 } }
		}
	}
}

# Smuggler Asteroid
ship_event = {
	id = precursor.1070
	title = "precursor.1070.name"
	desc = "precursor.1070.desc"
	picture = GFX_evt_mining_station
	location = FROM
	trackable = yes
	event_chain = first_league_chain

	is_triggered_only = yes

	specimen = underworld_cantina_sign

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = first_league_14 }
		}
	}

	option = {
		name = CURIOUS
		from = {
			enable_special_project = {
				name = "FIRST_LEAGUE_ARCHEOLOGY_14"
				location = this
				owner = root.owner
			}
		}
	}
}

# Smuggler Asteroid Completed
ship_event = {
	id = precursor.1071
	title = "precursor.completed.name"
	desc = "precursor.1071.desc"
	picture = GFX_evt_mining_station
	location = FROMFROM
	event_chain = first_league_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "first_league_chain"
				counter = "first_league_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1097 } }
		}
	}
}

# Port to Home System events
country_event = {
	id = precursor.1097
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				NOR = {
					has_global_flag = first_league_system_discovered
					has_country_flag = first_league_system
				}
				has_completed_event_chain_counter = {
					event_chain = "first_league_chain"
					counter = "first_league_artifacts"
				}
			}
			country_event = { id = precursor.1098 }
		}
		else_if = {
			limit = {
				has_global_flag = first_league_system_discovered
				NOT = { has_country_flag = first_league_system }
				has_completed_event_chain_counter = {
					event_chain = "first_league_chain"
					counter = "first_league_artifacts"
				}
			}
			country_event = { id = precursor.1099 }
		}
	}
}

# First League Home System Discovered (HIDDEN)
country_event = {
	id = precursor.1098
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		set_global_flag = first_league_discovered
		set_country_flag = first_league_system
		precursor_capital_spawn_system_effect = { PRECURSOR_FLAG = precursor_3 }
		if = {
			limit = { exists = event_target:precursor_spawn_system }
			event_target:precursor_spawn_system = {
				spawn_system = {
					min_distance = 10
					max_distance = 30
					max_jumps = 0
					initializer = "fen_habbanis_system"
				}
				if = {
					limit = { last_created_system = { NOT = { has_hyperlane_to = prev } } }
					add_hyperlane = {
						from = this
						to = last_created_system
					}
				}
				else = {
					add_extra_hyperlane_to_spawned_system_effect = yes
				}
			}
			country_event = { id = precursor.1100 days = 2 }
		}
		else = {
			# No usable system found (e.g. nomad arkship is mid-FTL with no waystations). Retry later.
			country_event = { id = precursor.1098 days = 30 }
		}
	}
}

# First League Home System Discovered (Not First) (HIDDEN)
country_event = {
	id = precursor.1099
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		set_country_flag = first_league_system
		country_event = { id = precursor.1100 days = 2 }
	}
}

# First League Home System Discovered
country_event = {
	id = precursor.1100
	title = "precursor.1100.name"
	desc = "precursor.1100.desc"
	picture = GFX_evt_federation_fleet
	location = event_target:fen_habbanis
	event_chain = first_league_chain

	is_triggered_only = yes

	immediate = {
		random_system = {
			limit = { has_star_flag = fen_habbanis }
			save_event_target_as = fen_habbanis
			root = { set_visited = prev }
			random_system_planet = {
				limit = { has_planet_flag = first_league_homeworld }
				save_event_target_as = first_league_homeworld
			}
		}
		observer_event = { id = observer.58 }
	}

	option = {
		name = "precursor.100.a"
		end_event_chain = "first_league_chain"
		begin_event_chain = {
			event_chain = "first_league_homeworld_chain"
			target = ROOT
		}
		event_target:first_league_homeworld = {
			enable_special_project = {
				name = "FIRST_LEAGUE_HOMEWORLD_PROJECT"
				location = event_target:first_league_homeworld
				owner = ROOT
			}
		}
	}
}

# First League Homeworld
ship_event = {
	id = precursor.1101
	title = "precursor.1101.name"
	desc = "precursor.1101.desc"
	picture = GFX_evt_dead_city
	location = from
	event_chain = first_league_chain

	is_triggered_only = yes

	trigger = {
		fromfrom = { has_planet_flag = first_league_homeworld }
		owner = {
			is_ai = no
			has_country_flag = first_league_system
		}
	}

	immediate = {
		owner = {
			set_country_flag = league_world_found
			set_global_flag = first_league_homeworld_found
		}
	}

	after = {
		owner = {
			add_monthly_resource_mult = {
				resource = unity
				value = 120
				min = 240
				max = 9999
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier4researchreward
				min = @tier4researchmin
				max = @tier4researchmax
			}
			add_monthly_resource_mult = {
				resource = influence
				value = @tier4influencereward
				min = @tier4influencemin
				max = @tier4influencemax
			}

			if = {
				limit = { has_ancrel = yes }
				custom_tooltip = league_artifact_research_unlocked
			}
		}
	}

	option = {
		name = "FASCINATING"
		trigger = {
			owner = {
				has_event_chain = "first_league_homeworld_chain"
			}
		}
		owner = {
			end_event_chain = "first_league_homeworld_chain"
		}
	}

	option = {
		name = "FASCINATING"
		trigger = {
			owner = {
				NOT = {
					has_event_chain = "first_league_homeworld_chain"
				}
			}
		}
	}
}

# Someone else got there first
ship_event = {
	id = precursor.1102
	title = "precursor.1102.name"

	desc = {
		text = precursor.1102.desc.a
		trigger = {
			owner = {
				OR = {
					has_event_chain = first_league_chain
					has_event_chain = first_league_homeworld_chain
				}
			}
		}
	}
	desc = {
		text = precursor.1102.desc.b
		trigger = {
			owner = {
				NOR = {
					has_event_chain = first_league_chain
					has_event_chain = first_league_homeworld_chain
				}
			}
		}
	}

	location = from
	picture = GFX_evt_archaeological_dig

	is_triggered_only = yes

	#trigger = {
	#	fromfrom = { has_planet_flag = first_league_homeworld }
	#	owner = {
	#		is_ai = no
	#		NOT = { has_country_flag = first_league_system }
	#	}
	#	has_global_flag = first_league_homeworld_found
	#}

	immediate = {
		owner = {
			set_country_flag = league_world_found
			if = {
				limit = { has_event_chain = first_league_chain }
				end_event_chain = "first_league_chain"
			}
			if = {
				limit = { has_event_chain = first_league_homeworld_chain }
				end_event_chain = "first_league_homeworld_chain"
			}
		}
	}

	option = {
		name = "UNFORTUNATE"

		if = {
			limit = { has_ancrel = yes }
			custom_tooltip = league_artifact_research_unlocked
		}
	}
}

#########################
# THE IRASSIAN CONCORDAT
#########################

# Irassian Notification Event
# via on_survey = {} | this = surveying vessel
ship_event = {
	id = precursor.1500
	title = "precursor.1500.name"
	desc = "precursor.1500.desc"
	picture = GFX_evt_archaeological_dig
	location = from
	event_chain = irassian_chain

	is_triggered_only = yes

	trigger = {
		solar_system? = {
			has_star_flag = precursor_4
		}
		owner = {
			is_ai = no
			has_precursor_intro = no
		}
		FROM = {
			has_anomaly = no
			is_star = no
			is_astral_scar = no
		}
	}
	weight_multiplier = {
		factor = 1
		modifier = {
			factor = @origin_shoulders_multiplier
			owner = {
				has_origin = origin_shoulders_of_giants
				has_country_flag = origin_shoulders_closure
			}
		}
	}

	immediate = {
		owner = {
			set_country_flag = irassian_intro
			begin_event_chain = {
				event_chain = "irassian_chain"
				target = ROOT
			}
		}
	}

	option = {
		name = INTERESTING
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		owner = {
			tooltip = {
				begin_event_chain = {
					event_chain = "irassian_chain"
					target = ROOT
				}
			}
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
		}
	}
}

# Quarantined World
ship_event = {
	id = precursor.1505
	title = "precursor.1505.name"
	desc = "precursor.1505.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_landing_ship
		BIOSHIP_PICTURE = GFX_evt_bioship_landing
	}
	location = FROM
	trackable = yes
	event_chain = irassian_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = irassians_1 }
		}
	}

	option = {
		name = FASCINATING
		from = {
			enable_special_project = {
				name = "IRASSIAN_ARCHEOLOGY_1"
				location = this
				owner = root.owner
			}
		}
	}
}

# Quarantined World Project Completed
ship_event = {
	id = precursor.1506
	title = "precursor.completed.name"
	desc = "precursor.1506.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = irassian_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "irassian_chain"
				counter = "irassian_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1597 } }
		}
	}
}

# Purified World
ship_event = {
	id = precursor.1510
	title = "precursor.1510.name"
	desc = "precursor.1510.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = irassian_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = irassians_2 }
		}
	}

	option = {
		name = REMARKABLE
		from = {
			enable_special_project = {
				name = "IRASSIAN_ARCHEOLOGY_2"
				location = this
				owner = root.owner
			}
		}
	}
}

# Purified World Project Completed
ship_event = {
	id = precursor.1511
	title = "precursor.completed.name"
	desc = "precursor.1511.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = irassian_chain

	is_triggered_only = yes

	specimen = irassian_purge_order

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "irassian_chain"
				counter = "irassian_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1597 } }
		}
	}
}

# Scheming Client Race
ship_event = {
	id = precursor.1515
	title = "precursor.1515.name"
	desc = "precursor.1515.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = irassian_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = irassians_3 }
		}
	}

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "IRASSIAN_ARCHEOLOGY_3"
				location = this
				owner = root.owner
			}
		}
	}
}

# Scheming Client Race Project Completed
ship_event = {
	id = precursor.1516
	title = "precursor.completed.name"
	desc = "precursor.1516.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = irassian_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "irassian_chain"
				counter = "irassian_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1597 } }
		}
	}
}

# Destroyed Client Race
ship_event = {
	id = precursor.1520
	title = "precursor.1520.name"
	desc = "precursor.1520.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = irassian_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = irassians_4 }
		}
	}

	option = {
		name = INTRIGUING
		from = {
			enable_special_project = {
				name = "IRASSIAN_ARCHEOLOGY_4"
				location = this
				owner = root.owner
			}
		}
	}
}

# Destroyed Client Race Project Completed
ship_event = {
	id = precursor.1521
	title = "precursor.completed.name"
	desc = "precursor.1521.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = irassian_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "irassian_chain"
				counter = "irassian_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1597 } }
		}
	}
}

# Dead Colony
ship_event = {
	id = precursor.1525
	title = "precursor.1525.name"
	desc = "precursor.1525.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = irassian_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = irassians_5 }
		}
	}

	option = {
		name = CURIOUS
		from = {
			enable_special_project = {
				name = "IRASSIAN_ARCHEOLOGY_5"
				location = this
				owner = root.owner
			}
		}
	}
}

# Dead Colony Project Completed
ship_event = {
	id = precursor.1526
	title = "precursor.completed.name"
	desc = "precursor.1526.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = irassian_chain

	is_triggered_only = yes

	specimen = irassian_digital_atlas

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "irassian_chain"
				counter = "irassian_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1597 } }
		}
	}
}

# Dead Mining Base
ship_event = {
	id = precursor.1530
	title = "precursor.1530.name"
	desc = "precursor.1530.desc"
	picture = GFX_evt_outpost
	location = FROM
	trackable = yes
	event_chain = irassian_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = irassians_6 }
		}
	}

	option = {
		name = PECULIAR
		from = {
			enable_special_project = {
				name = "IRASSIAN_ARCHEOLOGY_6"
				location = this
				owner = root.owner
			}
		}
	}
}

# Dead Mining Base Project Completed
ship_event = {
	id = precursor.1531
	title = "precursor.completed.name"
	desc = "precursor.1531.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = irassian_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "irassian_chain"
				counter = "irassian_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1597 } }
		}
	}
}

# Point of Outbreak
ship_event = {
	id = precursor.1535
	title = "precursor.1535.name"
	desc = "precursor.1535.desc"
	picture = GFX_evt_alien_nature
	location = FROM
	trackable = yes
	event_chain = irassian_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = irassians_7 }
		}
	}

	option = {
		name = FASCINATING
		from = {
			enable_special_project = {
				name = "IRASSIAN_ARCHEOLOGY_7"
				location = this
				owner = root.owner
			}
		}
	}
}

# Point of Outbreak Project Completed
ship_event = {
	id = precursor.1536
	title = "precursor.completed.name"
	desc = "precursor.1536.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = irassian_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "irassian_chain"
				counter = "irassian_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1597 } }
		}
	}

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

# Derelict Ship
ship_event = {
	id = precursor.1540
	title = "precursor.1540.name"
	desc = "precursor.1540.desc"
	picture = GFX_evt_ship_in_orbit
	location = FROM
	trackable = yes
	event_chain = irassian_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = irassians_8 }
		}
	}

	option = {
		name = REMARKABLE
		from = {
			enable_special_project = {
				name = "IRASSIAN_ARCHEOLOGY_8"
				location = this
				owner = root.owner
			}
		}
	}
}

# Derelict Ship Project Completed
ship_event = {
	id = precursor.1541
	title = "precursor.completed.name"
	desc = "precursor.1541.desc"
	picture = GFX_evt_ship_in_orbit
	location = FROMFROM
	event_chain = irassian_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "irassian_chain"
				counter = "irassian_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1597 } }
		}
	}
}

# Disease Control Base
ship_event = {
	id = precursor.1545
	title = "precursor.1545.name"
	desc = "precursor.1545.desc"
	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
	trackable = yes
	event_chain = irassian_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = irassians_9 }
		}
	}

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "IRASSIAN_ARCHEOLOGY_9"
				location = this
				owner = root.owner
			}
		}
	}
}

# Disease Control Base Project Completed
ship_event = {
	id = precursor.1546
	title = "precursor.completed.name"
	desc = "precursor.1546.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	location = FROMFROM
	event_chain = irassian_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "irassian_chain"
				counter = "irassian_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1597 } }
		}
	}
}

# Asteroid Listening Post
ship_event = {
	id = precursor.1550
	title = "precursor.1550.name"
	desc = "precursor.1550.desc"
	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
	trackable = yes
	event_chain = irassian_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = irassians_10 }
		}
	}

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "IRASSIAN_ARCHEOLOGY_10"
				location = this
				owner = root.owner
			}
		}
	}
}

# Asteroid Listening Post Completed
ship_event = {
	id = precursor.1551
	title = "precursor.completed.name"
	desc = "precursor.1551.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	location = FROMFROM
	event_chain = irassian_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "irassian_chain"
				counter = "irassian_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1597 } }
		}
	}
}

# Gas Giant Research Station
ship_event = {
	id = precursor.1555
	title = "precursor.1555.name"
	desc = "precursor.1555.desc"
	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
	trackable = yes
	event_chain = irassian_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = irassians_11 }
		}
	}

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "IRASSIAN_ARCHEOLOGY_11"
				location = this
				owner = root.owner
			}
		}
	}
}

# Gas Giant Research Station Completed
ship_event = {
	id = precursor.1556
	title = "precursor.completed.name"
	desc = "precursor.1556.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	location = FROMFROM
	event_chain = irassian_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "irassian_chain"
				counter = "irassian_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.1597 } }
		}
	}
}

# Port to Home System events
country_event = {
	id = precursor.1597
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				NOR = {
					has_global_flag = irassian_system_discovered
					has_country_flag = irassian_system
				}
				has_completed_event_chain_counter = {
					event_chain = "irassian_chain"
					counter = "irassian_artifacts"
				}
			}
			country_event = { id = precursor.1598 }
		}
		else_if = {
			limit = {
				has_global_flag = irassian_system_discovered
				NOT = { has_country_flag = irassian_system }
				has_completed_event_chain_counter = {
					event_chain = "irassian_chain"
					counter = "irassian_artifacts"
				}
			}
			country_event = { id = precursor.1599 }
		}
	}
}

# Irassian Home System Discovered (HIDDEN)
country_event = {
	id = precursor.1598
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		set_global_flag = irassia_discovered
		set_country_flag = irassian_system
		precursor_capital_spawn_system_effect = { PRECURSOR_FLAG = precursor_4 }
		if = {
			limit = { exists = event_target:precursor_spawn_system }
			event_target:precursor_spawn_system = {
				spawn_system = {
					min_distance = 10
					max_distance = 30
					max_jumps = 0
					initializer = "irass_system"
				}
				if = {
					limit = { last_created_system = { NOT = { has_hyperlane_to = prev } } }
					add_hyperlane = {
						from = this
						to = last_created_system
					}
				}
				else = {
					add_extra_hyperlane_to_spawned_system_effect = yes
				}
			}
			country_event = { id = precursor.1600 days = 2 }
		}
		else = {
			# No usable system found (e.g. nomad arkship is mid-FTL with no waystations). Retry later.
			country_event = { id = precursor.1598 days = 30 }
		}
	}
}

# Irassian Home System Discovered (Not First) (HIDDEN)
country_event = {
	id = precursor.1599
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		set_country_flag = irassian_system
		country_event = { id = precursor.1600 days = 2 }
	}
}

# Irassian Home System Discovered
country_event = {
	id = precursor.1600
	title = "precursor.1600.name"
	desc = "precursor.1600.desc"
	picture = GFX_evt_federation_fleet
	location = event_target:irass
	event_chain = irassian_chain

	is_triggered_only = yes

	immediate = {
		random_system = {
			limit = { has_star_flag = irass }
			save_event_target_as = irass
			root = { set_visited = prev }
			random_system_planet = {
				limit = { has_planet_flag = irassian_homeworld }
				save_event_target_as = irassian_homeworld
			}
		}
		observer_event = { id = observer.59 }
	}

	option = {
		name = "precursor.100.a"
		end_event_chain = "irassian_chain"
		begin_event_chain = {
			event_chain = "irassian_homeworld_chain"
			target = ROOT
		}
		event_target:irassian_homeworld = {
			enable_special_project = {
				name = "IRASSIAN_HOMEWORLD_PROJECT"
				location = event_target:irassian_homeworld
				owner = ROOT
			}
		}
	}
}

# Irassian Homeworld
ship_event = {
	id = precursor.1601
	title = "precursor.1601.name"
	desc = "precursor.1601.desc"
	picture = GFX_evt_dead_city
	location = from
	event_chain = irassian_chain

	is_triggered_only = yes

	trigger = {
		fromfrom = { has_planet_flag = irassian_homeworld }
		owner = {
			is_ai = no
			has_country_flag = irassian_system
		}
	}

	immediate = {
		owner = {
			set_country_flag = irassian_world_found
			set_global_flag = irassian_homeworld_found
			if = {
				limit = { has_event_chain = irassian_chain }
				end_event_chain = "irassian_chain"
			}
			if = {
				limit = { has_event_chain = irassian_homeworld_chain }
				end_event_chain = irassian_homeworld_chain
			}
		}
	}

	option = {
		name = "FASCINATING"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				add_relic = r_pox_sample
				large_artifact_reward = yes
			}
			add_monthly_resource_mult = {
				resource = unity
				value = 120
				min = 240
				max = 9999
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier4researchreward
				min = @tier4researchmin
				max = @tier4researchmax
			}
			add_monthly_resource_mult = {
				resource = minerals
				value = @tier4materialreward
				min = @tier4materialmin
				max = @tier4materialmax
			}

			if = {
				limit = { has_ancrel = yes }
				custom_tooltip = irassian_artifact_research_unlocked
			}
		}
	}
}

# Someone else got there first
ship_event = {
	id = precursor.1602
	title = "precursor.1602.name"

	desc = {
		text = precursor.1602.desc.a
		trigger = {
			owner = {
				OR = {
					has_event_chain = irassian_chain
					has_event_chain = irassian_homeworld_chain
				}
			}
		}
	}
	desc = {
		text = precursor.1602.desc.b
		trigger = {
			owner = {
				NOR = {
					has_event_chain = irassian_chain
					has_event_chain = irassian_homeworld_chain
				}
			}
		}
	}

	location = from
	picture = GFX_evt_archaeological_dig

	is_triggered_only = yes

	#trigger = {
	#	fromfrom = { has_planet_flag = irassian_homeworld }
	#	owner = {
	#		is_ai = no
	#		NOT = { has_country_flag = irassian_system }
	#	}
	#	has_global_flag = irassian_homeworld_found
	#}

	immediate = {
		owner = {
			set_country_flag = irassian_world_found
			if = {
				limit = { has_event_chain = irassian_chain }
				end_event_chain = "irassian_chain"
			}
			if = {
				limit = { has_event_chain = irassian_homeworld_chain }
				end_event_chain = "irassian_homeworld_chain"
			}
		}
	}

	option = {
		name = "UNFORTUNATE"

		owner = {
			if = {
				limit = { has_ancrel = yes }
				custom_tooltip = irassian_artifact_research_unlocked
			}
		}
	}
}

#############
# THE CYBREX
#############

# Cybrex Notification Event
# via on_survey = {} | this = surveying vessel
ship_event = {
	id = precursor.2000
	title = "precursor.2000.name"
	desc = "precursor.2000.desc"
	picture = GFX_evt_archaeological_dig
	location = from
	event_chain = cybrex_chain

	is_triggered_only = yes

	trigger = {
		solar_system? = {
			has_star_flag = precursor_5
		}
		owner = {
			is_ai = no
			has_precursor_intro = no
		}
		FROM = {
			has_anomaly = no
			is_star = no
			is_astral_scar = no
		}
	}
	weight_multiplier = {
		factor = 1
		modifier = {
			factor = @origin_shoulders_multiplier
			owner = {
				has_origin = origin_shoulders_of_giants
				has_country_flag = origin_shoulders_closure
			}
		}
	}

	immediate = {
		owner = {
			set_country_flag = cybrex_intro
			begin_event_chain = {
				event_chain = "cybrex_chain"
				target = ROOT
			}
		}
	}

	option = {
		name = INTERESTING
		hidden_effect = { owner = { country_event = { id = story.5 days = 30 } } }
		owner = {
			tooltip = {
				begin_event_chain = {
					event_chain = "cybrex_chain"
					target = ROOT
				}
			}
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
		}
	}
}

# Kuur Homeworld
ship_event = {
	id = precursor.2005
	title = "precursor.2005.name"
	desc = "precursor.2005.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = cybrex_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = cybrex_1 }
		}
	}

	option = {
		name = FASCINATING
		from = {
			enable_special_project = {
				name = "CYBREX_ARCHEOLOGY_1"
				location = this
				owner = root.owner
			}
		}
	}
}

# Kuur Homeworld Project Completed
ship_event = {
	id = precursor.2006
	title = "precursor.completed.name"
	desc = "precursor.2006.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = cybrex_chain

	is_triggered_only = yes

	specimen = kuurian_cybrex_blueprints

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "cybrex_chain"
				counter = "cybrex_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.2103 } }
		}
	}
}

# Indimak Homeworld
ship_event = {
	id = precursor.2010
	title = "precursor.2010.name"
	desc = "precursor.2010.desc"
	picture = GFX_evt_dead_city
	location = FROM
	trackable = yes
	event_chain = cybrex_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = cybrex_2 }
		}
	}

	option = {
		name = REMARKABLE
		from = {
			enable_special_project = {
				name = "CYBREX_ARCHEOLOGY_2"
				location = this
				owner = root.owner
			}
		}
	}
}

# Indimak Homeworld Project Completed
ship_event = {
	id = precursor.2011
	title = "precursor.completed.name"
	desc = "precursor.2011.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = cybrex_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "cybrex_chain"
				counter = "cybrex_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.2103 } }
		}
	}
}

# Broken Warform
ship_event = {
	id = precursor.2015
	title = "precursor.2015.name"
	desc = "precursor.2015.desc"
	picture = GFX_evt_ship_in_orbit
	location = FROM
	trackable = yes
	event_chain = cybrex_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = cybrex_3 }
		}
	}

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "CYBREX_ARCHEOLOGY_3"
				location = this
				owner = root.owner
			}
		}
	}
}

# Broken Warform Project Completed
ship_event = {
	id = precursor.2016
	title = "precursor.completed.name"
	desc = "precursor.2016.desc"
	picture = GFX_evt_ship_in_orbit
	location = FROMFROM
	event_chain = cybrex_chain

	is_triggered_only = yes

	specimen = derelict_cybrex_warform

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "cybrex_chain"
				counter = "cybrex_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.2103 } }
		}
	}
}

# Cybrex Invasion
ship_event = {
	id = precursor.2020
	title = "precursor.2020.name"
	desc = "precursor.2020.desc"
	picture = GFX_evt_city_ruins
	location = FROM
	trackable = yes
	event_chain = cybrex_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = cybrex_4 }
		}
	}

	option = {
		name = INTRIGUING
		from = {
			enable_special_project = {
				name = "CYBREX_ARCHEOLOGY_4"
				location = this
				owner = root.owner
			}
		}
	}
}

# Cybrex Invasion Project Completed
ship_event = {
	id = precursor.2021
	title = "precursor.completed.name"
	desc = "precursor.2021.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = cybrex_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "cybrex_chain"
				counter = "cybrex_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.2103 } }
		}
	}
}

# Cybrex Colony
ship_event = {
	id = precursor.2025
	title = "precursor.2025.name"
	desc = "precursor.2025.desc"
	picture = GFX_evt_dead_city
	location = FROM
	trackable = yes
	event_chain = cybrex_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = cybrex_5 }
		}
	}

	option = {
		name = CURIOUS
		from = {
			enable_special_project = {
				name = "CYBREX_ARCHEOLOGY_5"
				location = this
				owner = root.owner
			}
		}
	}
}

# Cybrex Colony Project Completed
ship_event = {
	id = precursor.2026
	title = "precursor.completed.name"
	desc = "precursor.2026.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = cybrex_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "cybrex_chain"
				counter = "cybrex_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.2103 } }
		}
	}
}

# Cybrex Listening Post
ship_event = {
	id = precursor.2030
	title = "precursor.2030.name"
	desc = "precursor.2030.desc"
	picture = GFX_evt_mining_station
	location = FROM
	trackable = yes
	event_chain = cybrex_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = cybrex_6 }
		}
	}

	option = {
		name = PECULIAR
		from = {
			enable_special_project = {
				name = "CYBREX_ARCHEOLOGY_6"
				location = this
				owner = root.owner
			}
		}
	}
}

# Cybrex Listening Post Project Completed
ship_event = {
	id = precursor.2031
	title = "precursor.completed.name"
	desc = "precursor.2031.desc"
	picture = GFX_evt_mining_station
	location = FROMFROM
	event_chain = cybrex_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "cybrex_chain"
				counter = "cybrex_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.2103 } }
		}
	}
}

# Cybrex Refinery
ship_event = {
	id = precursor.2035
	title = "precursor.2035.name"
	desc = "precursor.2035.desc"
	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
	trackable = yes
	event_chain = cybrex_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = cybrex_7 }
		}
	}

	option = {
		name = FASCINATING
		from = {
			enable_special_project = {
				name = "CYBREX_ARCHEOLOGY_7"
				location = this
				owner = root.owner
			}
		}
	}
}

# Cybrex Refinery Project Completed
ship_event = {
	id = precursor.2036
	title = "precursor.completed.name"
	desc = "precursor.2036.desc"
	inline_script = {
		script = events/biogenesis_event_art
		OWNER = owner
		REGULAR_PICTURE = GFX_evt_ship_in_orbit
		BIOSHIP_PICTURE = GFX_evt_bio_ships_orbiting
	}
	location = FROMFROM
	event_chain = cybrex_chain

	is_triggered_only = yes

	specimen = cybrex_mining_column

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "cybrex_chain"
				counter = "cybrex_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.2103 } }
		}
	}
}

# Battle Debris
ship_event = {
	id = precursor.2040
	title = "precursor.2040.name"
	desc = "precursor.2040.desc"
	picture = GFX_evt_small_space_battle
	location = FROM
	trackable = yes
	event_chain = cybrex_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = cybrex_8 }
		}
	}

	option = {
		name = REMARKABLE
		from = {
			enable_special_project = {
				name = "CYBREX_ARCHEOLOGY_8"
				location = this
				owner = root.owner
			}
		}
	}
}

# Battle Debris Project Completed
ship_event = {
	id = precursor.2041
	title = "precursor.completed.name"
	desc = "precursor.2041.desc"
	picture = GFX_evt_small_space_battle
	location = FROMFROM
	event_chain = cybrex_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "cybrex_chain"
				counter = "cybrex_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.2103 } }
		}
	}
}

# Cybrex Base Remains
ship_event = {
	id = precursor.2045
	title = "precursor.2045.name"
	desc = "precursor.2045.desc"
	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
	trackable = yes
	event_chain = cybrex_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = cybrex_9 }
		}
	}

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "CYBREX_ARCHEOLOGY_9"
				location = this
				owner = root.owner
			}
		}
	}
}

# Cybrex Base Remains Project Completed
ship_event = {
	id = precursor.2046
	title = "precursor.completed.name"
	desc = "precursor.2046.desc"
	picture = GFX_evt_archaeological_dig
	location = FROMFROM
	event_chain = cybrex_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "cybrex_chain"
				counter = "cybrex_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.2103 } }
		}
	}
}

# Organic Remains
ship_event = {
	id = precursor.2050
	title = "precursor.2050.name"
	desc = "precursor.2050.desc"
	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
	trackable = yes
	event_chain = cybrex_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = cybrex_10 }
		}
	}

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "CYBREX_ARCHEOLOGY_10"
				location = this
				owner = root.owner
			}
		}
	}
}

# Organic Remains Project Completed
ship_event = {
	id = precursor.2051
	title = "precursor.completed.name"
	desc = "precursor.2051.desc"
	picture = GFX_evt_society_research
	location = FROMFROM
	event_chain = cybrex_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "cybrex_chain"
				counter = "cybrex_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.2103 } }
		}
	}
}

# Cybrex Research Station
ship_event = {
	id = precursor.2055
	title = "precursor.2055.name"
	desc = "precursor.2055.desc"
	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
	trackable = yes
	event_chain = cybrex_chain

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			owner = { set_country_flag = cybrex_11 }
		}
	}

	option = {
		name = INTERESTING
		from = {
			enable_special_project = {
				name = "CYBREX_ARCHEOLOGY_11"
				location = this
				owner = root.owner
			}
		}
	}
}

# Cybrex Research Station Project Completed
ship_event = {
	id = precursor.2056
	title = "precursor.completed.name"
	desc = "precursor.2056.desc"
	picture = GFX_evt_cybernetics
	location = FROMFROM
	event_chain = cybrex_chain

	is_triggered_only = yes

	option = {
		name = "precursor.completed.a"
		owner = {
			if = {
				limit = { has_ancrel = yes }
				small_artifact_reward = yes
			}
			add_event_chain_counter = {
				event_chain = "cybrex_chain"
				counter = "cybrex_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = { country_event = { id = precursor.2103 } }
		}
	}
}

# Port to Home System events
country_event = {
	id = precursor.2103
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				has_completed_event_chain_counter = {
					event_chain = "cybrex_chain"
					counter = "cybrex_artifacts"
				}
				NOR = {
					has_global_flag = cybrex_system_discovered
					has_country_flag = cybrex_system
				}
			}
			country_event = { id = precursor.2098 }
		}
		else_if = {
			limit = {
				has_completed_event_chain_counter = {
					event_chain = "cybrex_chain"
					counter = "cybrex_artifacts"
				}
				has_global_flag = cybrex_system_discovered
				NOT = { has_country_flag = cybrex_system }
			}
			country_event = { id = precursor.2099 }
		}
	}
}

# Cybrex Home System Discovered (HIDDEN)
country_event = {
	id = precursor.2098
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		set_global_flag = cybrex_system_discovered
		set_country_flag = cybrex_system
		precursor_capital_spawn_system_effect = { PRECURSOR_FLAG = precursor_5 }
		if = {
			limit = { exists = event_target:precursor_spawn_system }
			event_target:precursor_spawn_system = {
				spawn_system = {
					min_distance = 10
					max_distance = 30
					max_jumps = 0
					initializer = "cybrex_system"
				}
				if = {
					limit = { last_created_system = { NOT = { has_hyperlane_to = prev } } }
					add_hyperlane = {
						from = this
						to = last_created_system
					}
				}
				else = {
					add_extra_hyperlane_to_spawned_system_effect = yes
				}
			}
			country_event = { id = precursor.2100 days = 2 }
		}
		else = {
			# No usable system found (e.g. nomad arkship is mid-FTL with no waystations). Retry later.
			country_event = { id = precursor.2098 days = 30 }
		}
	}
}

# Cybrex Home System Discovered (Not First) (HIDDEN)
country_event = {
	id = precursor.2099
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		set_country_flag = cybrex_system
		country_event = { id = precursor.2100 days = 2 }
	}
}

# Cybrex Home System Discovered
country_event = {
	id = precursor.2100
	title = "precursor.2100.name"
	desc = "precursor.2100.desc"
	picture = GFX_evt_federation_fleet
	location = event_target:cybrex
	event_chain = cybrex_chain

	is_triggered_only = yes

	immediate = {
		random_system = {
			limit = { has_star_flag = cybrex }
			save_event_target_as = cybrex
			root = { set_visited = prev }
			random_system_megastructure = {
				save_event_target_as = cybrex_homeworld
			}
		}
		observer_event = { id = observer.60 }
	}

	option = {
		name = "precursor.100.a"
		end_event_chain = "cybrex_chain"
		begin_event_chain = {
			event_chain = "cybrex_homeworld_chain"
			target = ROOT
		}
		event_target:cybrex_homeworld = {
			enable_special_project = {
				name = "CYBREX_HOMEWORLD_PROJECT"
				location = event_target:cybrex_homeworld
				owner = ROOT
			}
		}
	}
}

# Cybrex Homeworld
ship_event = {
	id = precursor.2101
	title = "precursor.2101.name"
	desc = "precursor.2101.desc"
	picture = GFX_evt_dead_city
	location = from
	event_chain = cybrex_chain

	is_triggered_only = yes

	trigger = {
		owner = {
			has_country_flag = cybrex_system
			NOT = { has_country_flag = cybrex_world_found }
		}
		solar_system? = { has_star_flag = cybrex }
	}

	immediate = {
		owner = {
			set_country_flag = cybrex_world_found
			if = {
				limit = { has_event_chain = cybrex_chain }
				set_country_flag = cybrex_end1
			}
			if = {
				limit = { has_event_chain = cybrex_homeworld_chain }
				set_country_flag = cybrex_end2
			}
		}
		set_global_flag = cybrex_homeworld_found
	}

	after = {
		owner = {
			if = {
				limit = { has_event_chain = "cybrex_chain" }
				end_event_chain = "cybrex_chain"
			}
			if = {
				limit = { has_event_chain = "cybrex_homeworld_chain" }
				end_event_chain = "cybrex_homeworld_chain"
			}
		}
	}

	option = {
		name = "FASCINATING"
		trigger = {
			owner = {
				has_country_flag = cybrex_end1
			}
		}
		owner = {
			if = {
				limit = { has_ancrel = yes }
				add_relic = r_war_forge
				hidden_effect = {
					if = {
						limit = {
							NOT = {
								is_variable_set = cybrex_count
							}
						}
						set_variable = {
							which = cybrex_count
							value = 1
						}
					}
				}
				large_artifact_reward = yes
			}
			add_monthly_resource_mult = {
				resource = unity
				value = 120
				min = 240
				max = 9999
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier4researchreward
				min = @tier4researchmin
				max = @tier4researchmax
			}
			add_monthly_resource_mult = {
				resource = energy
				value = @tier4materialreward
				min = @tier4materialmin
				max = @tier4materialmax
			}
			if = {
				limit = { has_ancrel = yes }
				custom_tooltip = cybrex_artifact_research_unlocked
			}
		}
	}

	option = {
		name = "FASCINATING"
		trigger = {
			owner = {
				has_country_flag = cybrex_end2
			}
		}
		owner = {
			if = {
				limit = { has_ancrel = yes }
				add_relic = r_war_forge
				hidden_effect = {
					if = {
						limit = {
							NOT = {
								is_variable_set = cybrex_count
							}
						}
						set_variable = {
							which = cybrex_count
							value = 1
						}
					}
				}
				large_artifact_reward = yes
			}
			add_monthly_resource_mult = {
				resource = unity
				value = 120
				min = 240
				max = 9999
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier4researchreward
				min = @tier4researchmin
				max = @tier4researchmax
			}
			add_monthly_resource_mult = {
				resource = energy
				value = @tier4materialreward
				min = @tier4materialmin
				max = @tier4materialmax
			}
			if = {
				limit = { has_ancrel = yes }
				custom_tooltip = cybrex_artifact_research_unlocked
			}
		}
	}

	option = {
		name = "FASCINATING"
		trigger = {
			owner = {
				NOR = {
					has_country_flag = cybrex_end1
					has_country_flag = cybrex_end2
				}
			}
		}
		owner = {
			if = {
				limit = { has_ancrel = yes }
				add_relic = r_war_forge
				hidden_effect = {
					if = {
						limit = {
							NOT = {
								is_variable_set = cybrex_count
							}
						}
						set_variable = {
							which = cybrex_count
							value = 1
						}
					}
				}
				large_artifact_reward = yes
			}
			add_monthly_resource_mult = {
				resource = unity
				value = 120
				min = 240
				max = 9999
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier4researchreward
				min = @tier4researchmin
				max = @tier4researchmax
			}
			add_monthly_resource_mult = {
				resource = energy
				value = @tier4materialreward
				min = @tier4materialmin
				max = @tier4materialmax
			}
			if = {
				limit = { has_ancrel = yes }
				custom_tooltip = cybrex_artifact_research_unlocked
			}

		}
	}
}

# Someone else got there first
ship_event = {
	id = precursor.2102
	title = "precursor.2102.name"

	desc = {
		text = precursor.2102.desc.a
		trigger = {
			owner = {
				OR = {
					has_event_chain = cybrex_chain
					has_event_chain = cybrex_homeworld_chain
				}
			}
		}
	}
	desc = {
		text = precursor.2102.desc.b
		trigger = {
			owner = {
				NOR = {
					has_event_chain = cybrex_chain
					has_event_chain = cybrex_homeworld_chain
				}
			}
		}
	}

	location = from
	picture = GFX_evt_archaeological_dig

	is_triggered_only = yes

	#trigger = {
	#	owner = {
	#		is_ai = no
	#		NOR = {
	#			has_country_flag = cybrex_system
	#			has_country_flag = cybrex_world_found
	#		}
	#	}
	#	solar_system = { has_star_flag = cybrex }
	#}

	immediate = {
		owner = { set_country_flag = cybrex_world_found }
	}

	after = {
		owner = {
			if = {
				limit = { has_event_chain = cybrex_chain }
				end_event_chain = "cybrex_chain"
			}
			if = {
				limit = { has_event_chain = cybrex_homeworld_chain }
				end_event_chain = "cybrex_homeworld_chain"
			}
		}
	}

	option = {
		name = "UNFORTUNATE"

		owner = {
			if = {
				limit = { has_ancrel = yes }
				custom_tooltip = cybrex_artifact_research_unlocked
			}
		}
	}
}

##############################
# PRECURSOR ARTIFACT CATCH-UP
##############################

# New Precursor Anomaly Found
# via on_five_year_pulse_country = {}
country_event = {
	id = precursor.301
	title = "precursor.301.name"
	desc = {
		trigger = {
			NOR = {
				is_machine_empire = yes
				is_hive_empire = yes
			}
		}
		text = precursor.301.a.desc
	}
	desc = {
		trigger = {
			NOR = {
				is_machine_empire = yes
				is_hive_empire = yes
			}
		}
		text = precursor.301.b.desc
	}
	desc = {
		trigger = {
			NOR = {
				is_machine_empire = yes
				is_hive_empire = yes
			}
		}
		text = precursor.301.c.desc
	}
	desc = {
		trigger = {
			NOR = {
				is_machine_empire = yes
				is_hive_empire = yes
			}
		}
		text = precursor.301.d.desc
	}
	desc = {
		trigger = {
			is_machine_empire = yes
		}
		text = precursor.301.e.desc
	}
	desc = {
		trigger = {
			is_hive_empire = yes
		}
		text = precursor.301.f.desc
	}
	picture = GFX_evt_archaeological_dig
	location = event_target:precursor_planet
	trackable = yes
	is_triggered_only = yes

	trigger = {
		is_ai = no
		years_passed > 50
		NOT = { has_country_flag = ongoing_precursor_artifact }
		OR = {
			AND = {
				has_event_chain = "vultaum_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = vultaum_chain
						counter = vultaum_artifacts
					}
				}
				has_accessible_precursor_system = { PRECURSOR_FLAG = precursor_1 }
			}
			AND = {
				has_event_chain = "yuht_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = yuht_chain
						counter = yuht_artifacts
					}
				}
				has_accessible_precursor_system = { PRECURSOR_FLAG = precursor_2 }
			}
			AND = {
				has_event_chain = "first_league_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = first_league_chain
						counter = first_league_artifacts
					}
				}
				has_accessible_precursor_system = { PRECURSOR_FLAG = precursor_3 }
			}
			AND = {
				has_event_chain = "irassian_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = irassian_chain
						counter = irassian_artifacts
					}
				}
				has_accessible_precursor_system = { PRECURSOR_FLAG = precursor_4 }
			}
			AND = {
				has_event_chain = "cybrex_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = cybrex_chain
						counter = cybrex_artifacts
					}
				}
				has_accessible_precursor_system = { PRECURSOR_FLAG = precursor_5 }
			}
		}
	}

	weight_multiplier = {
		factor = 1
		# NOTE: although gestalts are ineligible for the other events in this series, that actually increases their odds of receiving this one (as opposed to nothing at all). This is because 'on_actions' do not count weightings for random_events whose triggers will fail. The same therefore applies to regular empires who have already triggered the one-off events in this series.
		modifier = {
			factor = 0.9
			is_gestalt = yes
		}
		modifier = {
			factor = 1.25
			years_passed > 100
		}
		modifier = {
			factor = 0.75
			has_country_flag = recent_new_precursor
		}
		modifier = {
			factor = 1.5
			has_origin = origin_shoulders_of_giants
			has_country_flag = origin_shoulders_closure
		}
	}

	immediate = {
		# Reduce odds of firing in (relatively) quick succession
		set_timed_country_flag = {
			flag = recent_new_precursor
			years = 9
		}
		# Spawn a Special Project
		switch = {
			trigger = has_event_chain
			vultaum_chain = {
				if = {
					limit = { has_accessible_precursor_system = { PRECURSOR_FLAG = precursor_1 } }
					spawn_precursor_anomaly_effect = {
						PRECURSOR_FLAG = precursor_1
						PROJECT_NAME = VULTAUM_ARTIFACT_FOUND
					}
				}
			}
			yuht_chain = {
				if = {
					limit = { has_accessible_precursor_system = { PRECURSOR_FLAG = precursor_2 } }
					spawn_precursor_anomaly_effect = {
						PRECURSOR_FLAG = precursor_2
						PROJECT_NAME = YUHT_ARTIFACT_FOUND
					}
				}
			}
			first_league_chain = {
				if = {
					limit = { has_accessible_precursor_system = { PRECURSOR_FLAG = precursor_3 } }
					spawn_precursor_anomaly_effect = {
						PRECURSOR_FLAG = precursor_3
						PROJECT_NAME = LEAGUE_ARTIFACT_FOUND
					}
				}
			}
			irassian_chain = {
				if = {
					limit = { has_accessible_precursor_system = { PRECURSOR_FLAG = precursor_4 } }
					spawn_precursor_anomaly_effect = {
						PRECURSOR_FLAG = precursor_4
						PROJECT_NAME = IRASSIAN_ARTIFACT_FOUND
					}
				}
			}
			cybrex_chain = {
				if = {
					limit = { has_accessible_precursor_system = { PRECURSOR_FLAG = precursor_5 } }
					spawn_precursor_anomaly_effect = {
						PRECURSOR_FLAG = precursor_5
						PROJECT_NAME = CYBREX_ARTIFACT_FOUND
					}
				}
			}
		}
	}

	option = {
		name = precursor.301.a
		custom_tooltip = new_precursor_project
	}
}

# Vultaum Artifact Recovered
ship_event = {
	id = precursor.302
	title = "precursor.302.name"
	desc = {
		trigger = {
			NOR = {
				owner = { is_machine_empire = yes }
				owner = { is_hive_empire = yes }
			}
		}
		text = precursor.302.a.desc
	}
	desc = {
		trigger = {
			owner = { is_machine_empire = yes }
		}
		text = precursor.302.b.desc
	}
	desc = {
		trigger = {
			owner = { is_hive_empire = yes }
		}
		text = precursor.302.c.desc
	}
	picture = GFX_evt_archaeological_dig
	location = event_target:precursor_planet
	event_chain = vultaum_chain

	is_triggered_only = yes

	immediate = {
		owner = { set_country_flag = vultaum_artifact_recoverer }
	}

	after = {
		hidden_effect = {
			owner = { remove_country_flag = vultaum_artifact_recoverer }
		}
	}

	option = {
		name = INTERESTING
		owner = {
			add_event_chain_counter = {
				event_chain = "vultaum_chain"
				counter = "vultaum_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = physics_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = {
				country_event = { id = precursor.97 }
				remove_country_flag = ongoing_precursor_artifact
			}
		}
	}
}

# Yuht Artifact Recovered
ship_event = {
	id = precursor.303
	title = "precursor.303.name"
	desc = {
		trigger = {
			NOR = {
				owner = { is_machine_empire = yes }
				owner = { is_hive_empire = yes }
			}
		}
		text = precursor.302.a.desc
	}
	desc = {
		trigger = {
			owner = { is_machine_empire = yes }
		}
		text = precursor.302.b.desc
	}
	desc = {
		trigger = {
			owner = { is_hive_empire = yes }
		}
		text = precursor.302.c.desc
	}
	picture = GFX_evt_archaeological_dig
	location = event_target:precursor_planet
	event_chain = yuht_chain

	is_triggered_only = yes

	immediate = {
		owner = { set_country_flag = yuht_artifact_recoverer }
	}

	after = {
		hidden_effect = {
			owner = { remove_country_flag = yuht_artifact_recoverer }
		}
	}

	option = {
		name = INTERESTING
		owner = {
			add_event_chain_counter = {
				event_chain = "yuht_chain"
				counter = "yuht_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = {
				country_event = { id = precursor.597 }
				remove_country_flag = ongoing_precursor_artifact
			}
		}
	}
}

# First League Artifact Recovered
ship_event = {
	id = precursor.304
	title = "precursor.304.name"
	desc = {
		trigger = {
			NOR = {
				owner = { is_machine_empire = yes }
				owner = { is_hive_empire = yes }
			}
		}
		text = precursor.302.a.desc
	}
	desc = {
		trigger = {
			owner = { is_machine_empire = yes }
		}
		text = precursor.302.b.desc
	}
	desc = {
		trigger = {
			owner = { is_hive_empire = yes }
		}
		text = precursor.302.c.desc
	}
	picture = GFX_evt_archaeological_dig
	location = event_target:precursor_planet
	event_chain = first_league_chain

	is_triggered_only = yes

	immediate = {
		owner = { set_country_flag = first_league_artifact_recoverer }
	}

	after = {
		hidden_effect = {
			owner = { remove_country_flag = first_league_artifact_recoverer }
		}
	}

	option = {
		name = INTERESTING
		owner = {
			add_event_chain_counter = {
				event_chain = "first_league_chain"
				counter = "first_league_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = engineering_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = {
				country_event = { id = precursor.1097 }
				remove_country_flag = ongoing_precursor_artifact
			}
		}
	}
}

# Irassian Artifact Recovered
ship_event = {
	id = precursor.305
	title = "precursor.305.name"
	desc = {
		trigger = {
			NOR = {
				owner = { is_machine_empire = yes }
				owner = { is_hive_empire = yes }
			}
		}
		text = precursor.302.a.desc
	}
	desc = {
		trigger = {
			owner = { is_machine_empire = yes }
		}
		text = precursor.302.b.desc
	}
	desc = {
		trigger = {
			owner = { is_hive_empire = yes }
		}
		text = precursor.302.c.desc
	}
	picture = GFX_evt_archaeological_dig
	location = event_target:precursor_planet
	event_chain = irassian_chain

	is_triggered_only = yes

	immediate = {
		owner = { set_country_flag = irassian_artifact_recoverer }
	}

	after = {
		hidden_effect = {
			owner = { remove_country_flag = irassian_artifact_recoverer }
		}
	}

	option = {
		name = INTERESTING
		owner = {
			add_event_chain_counter = {
				event_chain = "irassian_chain"
				counter = "irassian_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = {
				country_event = { id = precursor.1597 }
				remove_country_flag = ongoing_precursor_artifact
			}
		}
	}
}

# Cybrex Artifact Recovered
ship_event = {
	id = precursor.306
	title = "precursor.306.name"
	desc = {
		trigger = {
			NOR = {
				owner = { is_machine_empire = yes }
				owner = { is_hive_empire = yes }
			}
		}
		text = precursor.302.a.desc
	}
	desc = {
		trigger = {
			owner = { is_machine_empire = yes }
		}
		text = precursor.302.b.desc
	}
	desc = {
		trigger = {
			owner = { is_hive_empire = yes }
		}
		text = precursor.302.c.desc
	}
	picture = GFX_evt_archaeological_dig
	location = event_target:precursor_planet
	event_chain = cybrex_chain

	is_triggered_only = yes

	immediate = {
		owner = { set_country_flag = cybrex_artifact_recoverer }
	}

	after = {
		hidden_effect = {
			owner = { remove_country_flag = cybrex_artifact_recoverer }
		}
	}

	option = {
		name = INTERESTING
		owner = {
			add_event_chain_counter = {
				event_chain = "cybrex_chain"
				counter = "cybrex_artifacts"
				amount = 1
			}
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier1researchreward
				min = @tier1researchmin
				max = @tier1researchmax
			}
			hidden_effect = {
				country_event = { id = precursor.2103 }
				remove_country_flag = ongoing_precursor_artifact
			}
		}
	}
}

# Private Collector has Artifact
country_event = {
	id = precursor.310
	title = "precursor.310.name"
	desc = "precursor.310.desc"
	picture = GFX_evt_archaeological_dig
	location = event_target:collector_home
	is_triggered_only = yes

	trigger = {
		is_ai = no
		years_passed > 50
		NOR = {
			has_country_flag = ongoing_precursor_artifact
			has_country_flag = precursor_collector_fired
			has_ethic = ethic_gestalt_consciousness
		}
		OR = {
			AND = {
				has_event_chain = "vultaum_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = vultaum_chain
						counter = vultaum_artifacts
					}
				}
			}
			AND = {
				has_event_chain = "yuht_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = yuht_chain
						counter = yuht_artifacts
					}
				}
			}
			AND = {
				has_event_chain = "first_league_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = first_league_chain
						counter = first_league_artifacts
					}
				}
			}
			AND = {
				has_event_chain = "irassian_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = irassian_chain
						counter = irassian_artifacts
					}
				}
			}
			AND = {
				has_event_chain = "cybrex_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = cybrex_chain
						counter = cybrex_artifacts
					}
				}
			}
		}
	}

	weight_multiplier = {
		factor = 1
		modifier = {
			factor = 1.25
			years_passed > 100
		}
		modifier = {
			factor = 0.75
			has_country_flag = recent_new_precursor
		}
		modifier = {
			factor = 1.5
			has_origin = origin_shoulders_of_giants
			has_country_flag = origin_shoulders_closure
		}
	}

	immediate = {
		# Reduce odds of firing in (relatively) quick succession
		set_timed_country_flag = {
			flag = recent_new_precursor
			years = 9
		}
		# Choose a relevant artifact
		set_country_flag = precursor_collector_fired
		random_owned_planet = { save_event_target_as = collector_home }
		if = {
			limit = { has_event_chain = "vultaum_chain" }
			set_country_flag = vultaum_artifact_recoverer
			break = yes
		}
		if = {
			limit = { has_event_chain = "yuht_chain" }
			set_country_flag = yuht_artifact_recoverer
			break = yes
		}
		if = {
			limit = { has_event_chain = "first_league_chain" }
			set_country_flag = first_league_artifact_recoverer
			break = yes
		}
		if = {
			limit = { has_event_chain = "irassian_chain" }
			set_country_flag = irassian_artifact_recoverer
			break = yes
		}
		if = {
			limit = { has_event_chain = "cybrex_chain" }
			set_country_flag = cybrex_artifact_recoverer
			break = yes
		}
	}

	option = {
		name = precursor.310.a
		allow = { resource_stockpile_compare = { resource = energy value >= 500 } }
		custom_tooltip = buy_precursor_artifact
		add_resource = { energy = -500 }
		collector_surrenders_artifact = yes
	}
	option = {
		name = precursor.310.b
		allow = { resource_stockpile_compare = { resource = influence value >= 100 } }
		custom_tooltip = seize_precursor_artifact
		add_resource = { influence = -100 }
		collector_surrenders_artifact = yes
	}
	option = {
		name = precursor.310.c
		custom_tooltip = leave_precursor_artifact
	}

	after = {
		hidden_effect = {
			remove_country_flag = vultaum_artifact_recoverer
			remove_country_flag = yuht_artifact_recoverer
			remove_country_flag = first_league_artifact_recoverer
			remove_country_flag = irassian_artifact_recoverer
			remove_country_flag = cybrex_artifact_recoverer
		}
	}
}

# Neighbor Offers to Sell Artifact
country_event = {
	id = precursor.311
	title = TRANSMISSION
	desc = "precursor.311.desc"
	diplomatic = yes
	picture_event_data = {
		portrait = event_target:artifact_seller
		room = event_target:artifact_seller.ruler
	}
	is_triggered_only = yes

	trigger = {
		is_ai = no
		years_passed > 50
		NOR = {
			has_country_flag = ongoing_precursor_artifact
			has_country_flag = precursor_seller_fired
			has_ethic = ethic_gestalt_consciousness
			AND = {
				exists = event_target:artifact_seller
				has_relation_flag = {
					who = event_target:artifact_seller
					flag = precursor_artifact_deal
				}
			}
		}
		OR = {
			AND = {
				has_event_chain = "vultaum_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = vultaum_chain
						counter = vultaum_artifacts
					}
				}
				any_neighbor_country = {
					has_communications = root
					is_country_type = default
					is_subject = no
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
						is_hostile_to = root
						is_domineering_to = root
						is_unfriendly_to = root
					}
					any_system_within_border = { has_star_flag = precursor_1 }
				}
			}
			AND = {
				has_event_chain = "yuht_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = yuht_chain
						counter = yuht_artifacts
					}
				}
				any_neighbor_country = {
					has_communications = root
					is_country_type = default
					is_subject = no
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
						is_hostile_to = root
						is_domineering_to = root
						is_unfriendly_to = root
					}
					any_system_within_border = { has_star_flag = precursor_2 }
				}
			}
			AND = {
				has_event_chain = "first_league_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = first_league_chain
						counter = first_league_artifacts
					}
				}
				any_neighbor_country = {
					has_communications = root
					is_country_type = default
					is_subject = no
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
						is_hostile_to = root
						is_domineering_to = root
						is_unfriendly_to = root
					}
					any_system_within_border = { has_star_flag = precursor_3 }
				}
			}
			AND = {
				has_event_chain = "irassian_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = irassian_chain
						counter = irassian_artifacts
					}
				}
				any_neighbor_country = {
					has_communications = root
					is_country_type = default
					is_subject = no
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
						is_hostile_to = root
						is_domineering_to = root
						is_unfriendly_to = root
					}
					any_system_within_border = { has_star_flag = precursor_4 }
				}
			}
			AND = {
				has_event_chain = "cybrex_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = cybrex_chain
						counter = cybrex_artifacts
					}
				}
				any_neighbor_country = {
					has_communications = root
					is_country_type = default
					is_subject = no
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
						is_hostile_to = root
						is_domineering_to = root
						is_unfriendly_to = root
					}
					any_system_within_border = { has_star_flag = precursor_5 }
				}
			}
		}
	}

	weight_multiplier = {
		factor = 1
		modifier = {
			factor = 1.25
			years_passed > 100
		}
		modifier = {
			factor = 0.75
			has_country_flag = recent_new_precursor
		}
		modifier = {
			factor = 1.5
			has_origin = origin_shoulders_of_giants
			has_country_flag = origin_shoulders_closure
		}
	}

	immediate = {
		set_country_flag = precursor_seller_fired
		# Reduce odds of firing in (relatively) quick succession
		set_timed_country_flag = {
			flag = recent_new_precursor
			years = 9
		}
		# Choose a relevant artifact
		if = {
			limit = { has_event_chain = "vultaum_chain" }
			set_country_flag = vultaum_artifact_recoverer
			random_neighbor_country = {
				limit = {
					has_communications = root
					is_country_type = default
					is_subject = no
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
						is_hostile_to = root
						is_domineering_to = root
						is_unfriendly_to = root
					}
					any_system_within_border = { has_star_flag = precursor_1 }
				}
				save_event_target_as = artifact_seller
			}
			break = yes
		}
		if = {
			limit = { has_event_chain = "yuht_chain" }
			set_country_flag = yuht_artifact_recoverer
			random_neighbor_country = {
				limit = {
					has_communications = root
					is_country_type = default
					is_subject = no
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
						is_hostile_to = root
						is_domineering_to = root
						is_unfriendly_to = root
					}
					any_system_within_border = { has_star_flag = precursor_2 }
				}
				save_event_target_as = artifact_seller
			}
			break = yes
		}
		if = {
			limit = { has_event_chain = "first_league_chain" }
			set_country_flag = first_league_artifact_recoverer
			random_neighbor_country = {
				limit = {
					has_communications = root
					is_country_type = default
					is_subject = no
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
						is_hostile_to = root
						is_domineering_to = root
						is_unfriendly_to = root
					}
					any_system_within_border = { has_star_flag = precursor_3 }
				}
				save_event_target_as = artifact_seller
			}
			break = yes
		}
		if = {
			limit = { has_event_chain = "irassian_chain" }
			set_country_flag = irassian_artifact_recoverer
			random_neighbor_country = {
				limit = {
					has_communications = root
					is_country_type = default
					is_subject = no
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
						is_hostile_to = root
						is_domineering_to = root
						is_unfriendly_to = root
					}
					any_system_within_border = { has_star_flag = precursor_4 }
				}
				save_event_target_as = artifact_seller
			}
			break = yes
		}
		if = {
			limit = { has_event_chain = "cybrex_chain" }
			set_country_flag = cybrex_artifact_recoverer
			random_neighbor_country = {
				limit = {
					has_communications = root
					is_country_type = default
					is_subject = no
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
						is_hostile_to = root
						is_domineering_to = root
						is_unfriendly_to = root
					}
					any_system_within_border = { has_star_flag = precursor_5 }
				}
				save_event_target_as = artifact_seller
			}
			break = yes
		}
		set_relation_flag = {
			who = event_target:artifact_seller
			flag = precursor_artifact_deal
		}
	}

	option = {
		name = "precursor.311.a"
		response_text = precursor.311.a.reply
		allow = {
			resource_stockpile_compare = { resource = energy value >= 1000 }
		}
		custom_tooltip = purchase_artifact
		add_resource = { energy = -1000 }
		hidden_effect = {
			event_target:artifact_seller = {
				add_resource = { energy = 1000 }
			}
		}
		collector_surrenders_artifact = yes
	}
	option = {
		name = "precursor.311.b"
		response_text = precursor.311.b.reply
		trigger = {
			has_valid_civic = civic_corporate_dominion
		}
		allow = {
			resource_stockpile_compare = { resource = energy value >= 500 }
		}
		custom_tooltip = purchase_artifact
		add_resource = { energy = -500 }
		hidden_effect = {
			event_target:artifact_seller = {
				add_resource = { energy = 500 }
			}
		}
		collector_surrenders_artifact = yes
	}
	option = {
		name = "precursor.311.c"
		trigger = {
			has_valid_civic = civic_warrior_culture
		}
		hidden_effect = {
			random_list = {
				10 = { # Refuses
					modifier = {
						factor = 50
						relative_power = {
							who = event_target:artifact_seller
							category = fleet
							value = inferior
						}
					}
					modifier = {
						factor = 50
						relative_power = {
							who = event_target:artifact_seller
							category = fleet
							value = pathetic
						}
					}
					modifier = {
						factor = 50
						event_target:artifact_seller = { has_valid_civic = civic_warrior_culture }
					}
					country_event = { id = precursor.312 }
				}
				10 = { # Folds
					modifier = {
						factor = 50
						relative_power = {
							who = event_target:artifact_seller
							category = fleet
							value = superior
						}
					}
					modifier = {
						factor = 50
						relative_power = {
							who = event_target:artifact_seller
							category = fleet
							value = overwhelming
						}
					}
					country_event = { id = precursor.313 }
				}
			}
		}
		custom_tooltip = coerce_artifact
	}
	option = {
		name = "precursor.311.d"
	}

	after = {
		hidden_effect = {
			remove_country_flag = vultaum_artifact_recoverer
			remove_country_flag = yuht_artifact_recoverer
			remove_country_flag = first_league_artifact_recoverer
			remove_country_flag = irassian_artifact_recoverer
			remove_country_flag = cybrex_artifact_recoverer
		}
	}
}
# Rejects Threat (Warrior Culture)
country_event = {
	id = precursor.312
	title = TRANSMISSION
	desc = "precursor.312.desc"

	diplomatic = yes

	picture_event_data = {
		portrait = event_target:artifact_seller
		room = event_target:artifact_seller
	}

	is_triggered_only = yes

	option = {
		name = "precursor.312.d"
		event_target:artifact_seller = {
			add_opinion_modifier = {
				who = root
				modifier = opinion_threatened_artifact
			}
		}
	}
}
# Folds to threat (Warrior Culture)
country_event = {
	id = precursor.313
	title = TRANSMISSION
	desc = "precursor.313.desc"

	diplomatic = yes

	picture_event_data = {
		portrait = event_target:artifact_seller
		room = event_target:artifact_seller
	}

	is_triggered_only = yes

	option = {
		name = "precursor.313.d"
		collector_surrenders_artifact = yes
	}
}

# Neighbor Gifts Artifact
country_event = {
	id = precursor.314
	title = TRANSMISSION
	desc = "precursor.314.desc"
	diplomatic = yes
	picture_event_data = {
		portrait = event_target:artifact_giver
		room = event_target:artifact_giver.ruler
	}
	is_triggered_only = yes

	trigger = {
		is_ai = no
		years_passed > 50
		NOR = {
			has_country_flag = ongoing_precursor_artifact
			has_country_flag = precursor_giver_fired
			has_ethic = ethic_gestalt_consciousness
			AND = {
				exists = event_target:artifact_giver
				has_relation_flag = {
					who = event_target:artifact_giver
					flag = precursor_artifact_deal
				}
			}
		}
		OR = {
			AND = {
				has_event_chain = "vultaum_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = vultaum_chain
						counter = vultaum_artifacts
					}
				}
				any_neighbor_country = {
					has_communications = root
					is_country_type = default
					is_subject = no
					OR = {
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
					}
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
					}
					any_system_within_border = { has_star_flag = precursor_1 }
				}
			}
			AND = {
				has_event_chain = "yuht_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = yuht_chain
						counter = yuht_artifacts
					}
				}
				any_neighbor_country = {
					has_communications = root
					is_country_type = default
					is_subject = no
					OR = {
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
					}
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
					}
					any_system_within_border = { has_star_flag = precursor_2 }
				}
			}
			AND = {
				has_event_chain = "first_league_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = first_league_chain
						counter = first_league_artifacts
					}
				}
				any_neighbor_country = {
					has_communications = root
					is_country_type = default
					is_subject = no
					OR = {
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
					}
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
					}
					any_system_within_border = { has_star_flag = precursor_3 }
				}
			}
			AND = {
				has_event_chain = "irassian_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = irassian_chain
						counter = irassian_artifacts
					}
				}
				any_neighbor_country = {
					has_communications = root
					is_country_type = default
					is_subject = no
					OR = {
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
					}
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
					}
					any_system_within_border = { has_star_flag = precursor_4 }
				}
			}
			AND = {
				has_event_chain = "cybrex_chain"
				NOT = {
					has_completed_event_chain_counter = {
						event_chain = cybrex_chain
						counter = cybrex_artifacts
					}
				}
				any_neighbor_country = {
					has_communications = root
					is_country_type = default
					is_subject = no
					OR = {
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
					}
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
					}
					any_system_within_border = { has_star_flag = precursor_5 }
				}
			}
		}
	}

	immediate = {
		set_country_flag = precursor_giver_fired
		# Reduce odds of firing in (relatively) quick succession
		set_timed_country_flag = {
			flag = recent_new_precursor
			years = 9
		}
		# Choose a relevant artifact
		if = {
			limit = { has_event_chain = "vultaum_chain" }
			set_country_flag = vultaum_artifact_recoverer
			random_neighbor_country = {
				limit = {
					has_communications = root
					is_country_type = default
					is_subject = no
					OR = {
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
					}
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
					}
					any_system_within_border = { has_star_flag = precursor_1 }
				}
				save_event_target_as = artifact_giver
			}
			break = yes
		}
		if = {
			limit = { has_event_chain = "yuht_chain" }
			set_country_flag = yuht_artifact_recoverer
			random_neighbor_country = {
				limit = {
					has_communications = root
					is_country_type = default
					is_subject = no
					OR = {
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
					}
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
					}
					any_system_within_border = { has_star_flag = precursor_2 }
				}
				save_event_target_as = artifact_giver
			}
			break = yes
		}
		if = {
			limit = { has_event_chain = "first_league_chain" }
			set_country_flag = first_league_artifact_recoverer
			random_neighbor_country = {
				limit = {
					has_communications = root
					is_country_type = default
					is_subject = no
					OR = {
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
					}
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
					}
					any_system_within_border = { has_star_flag = precursor_3 }
				}
				save_event_target_as = artifact_giver
			}
			break = yes
		}
		if = {
			limit = { has_event_chain = "irassian_chain" }
			set_country_flag = irassian_artifact_recoverer
			random_neighbor_country = {
				limit = {
					has_communications = root
					is_country_type = default
					is_subject = no
					OR = {
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
					}
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
					}
					any_system_within_border = { has_star_flag = precursor_4 }
				}
				save_event_target_as = artifact_giver
			}
			break = yes
		}
		if = {
			limit = { has_event_chain = "cybrex_chain" }
			set_country_flag = cybrex_artifact_recoverer
			random_neighbor_country = {
				limit = {
					has_communications = root
					is_country_type = default
					is_subject = no
					OR = {
						is_protective_to = root
						is_friendly_to = root
						is_loyal_to = root
					}
					NOR = {
						has_ethic = ethic_gestalt_consciousness
						is_at_war_with = root
						is_same_value = root
					}
					any_system_within_border = { has_star_flag = precursor_5 }
				}
				save_event_target_as = artifact_giver
			}
			break = yes
		}
		set_relation_flag = {
			who = event_target:artifact_giver
			flag = precursor_artifact_deal
		}
	}

	after = {
		hidden_effect = {
			remove_country_flag = vultaum_artifact_recoverer
			remove_country_flag = yuht_artifact_recoverer
			remove_country_flag = first_league_artifact_recoverer
			remove_country_flag = irassian_artifact_recoverer
			remove_country_flag = cybrex_artifact_recoverer
		}
	}

	option = {
		name = "precursor.314.a"
		collector_surrenders_artifact = yes
	}
}

# Precursor Anomaly Spawned via Minor Artifact Action
country_event = {
	id = precursor.320
	title = "precursor.301.name"
	desc = "precursor.320.desc"

	picture = GFX_evt_archaeological_dig
	location = event_target:precursor_planet
	trackable = yes

	is_triggered_only = yes

	immediate = {
		switch = {
			trigger = has_event_chain
			vultaum_chain = {
				if = {
					limit = { has_accessible_precursor_system = { PRECURSOR_FLAG = precursor_1 } }
					spawn_precursor_anomaly_effect = {
						PRECURSOR_FLAG = precursor_1
						PROJECT_NAME = VULTAUM_ARTIFACT_FOUND
					}
				}
			}
			yuht_chain = {
				if = {
					limit = { has_accessible_precursor_system = { PRECURSOR_FLAG = precursor_2 } }
					spawn_precursor_anomaly_effect = {
						PRECURSOR_FLAG = precursor_2
						PROJECT_NAME = YUHT_ARTIFACT_FOUND
					}
				}
			}
			first_league_chain = {
				if = {
					limit = { has_accessible_precursor_system = { PRECURSOR_FLAG = precursor_3 } }
					spawn_precursor_anomaly_effect = {
						PRECURSOR_FLAG = precursor_3
						PROJECT_NAME = LEAGUE_ARTIFACT_FOUND
					}
				}
			}
			irassian_chain = {
				if = {
					limit = { has_accessible_precursor_system = { PRECURSOR_FLAG = precursor_4 } }
					spawn_precursor_anomaly_effect = {
						PRECURSOR_FLAG = precursor_4
						PROJECT_NAME = IRASSIAN_ARTIFACT_FOUND
					}
				}
			}
			cybrex_chain = {
				if = {
					limit = { has_accessible_precursor_system = { PRECURSOR_FLAG = precursor_5 } }
					spawn_precursor_anomaly_effect = {
						PRECURSOR_FLAG = precursor_5
						PROJECT_NAME = CYBREX_ARTIFACT_FOUND
					}
				}
			}
		}
	}

	option = {
		name = precursor.301.a
		custom_tooltip = new_precursor_project
	}
}
