namespace = asp

#beyond earth - purity #https://gall.dcinside.com/mgallery/board/view/?id=stellaris&no=8326

#beyond earth
fleet_event = {
	id = asp.70
	title = "asp.70.name"
	desc = "asp.70.desc"
	picture = GFX_evt_city_ruins
	show_sound = event_ghost_town
	
	archaeology = yes
	is_triggered_only = yes
	
	immediate = {
		from = { set_site_progress_locked = yes }
	}

	after = {
		from = { set_site_progress_locked = no }
	}

	option = {
		name = asp.70.a
		small_artifact_reward = yes
	}
}
#sign of civilization
fleet_event = {
	id = asp.71
	title = "asp.71.name"
	desc = "asp.71.desc"
	picture = GFX_evt_nuclear_explosion
	show_sound = event_super_explosion
	
	archaeology = yes
	is_triggered_only = yes
	
	immediate = {
		from = { set_site_progress_locked = yes }
	}

	after = {
		from = { set_site_progress_locked = no }
	}

	option = {
		name = DIG
		small_artifact_reward = yes
	}
}
#exodus gate
fleet_event = {
	id = asp.72
	title = "asp.72.name"
	desc = "asp.72.desc"
	picture = GFX_evt_asp.72
	show_sound = event_mystic_reveal
	
	archaeology = yes
	is_triggered_only = yes
	
	immediate = {
		from = { set_site_progress_locked = yes }
	}

	after = {
		from = { set_site_progress_locked = no }
	}

	option = {
		name = asp.72.a
		medium_artifact_reward = yes
	}
}
#new sol
fleet_event = {
	id = asp.73
	title = "asp.73.name"
	desc = "asp.73.desc"
	picture = GFX_evt_drifting_gateway
	show_sound = event_energy_field
	
	archaeology = yes
	is_triggered_only = yes
	
	immediate = {
		from = { set_site_progress_locked = yes }
	}

	after = {
		from = { set_site_progress_locked = no }
		if = {
			limit = { owner = { has_policy_flag = aspmod_archaeology_cleanup_active } }
			destroy_archaeological_site = from
		}
	}

	option = {
		name = asp.73.a
		custom_tooltip = asp.73.a.tooltip
		hidden_effect = {
			every_megastructure = {
				limit = { is_megastructure_type = ASP_site_beyond_earth_purity_gateway }
				activate_gateway = this
			}
			# Legacy global target ASP_site_beyond_earth_purity_1_system is intentionally no longer created.
		}
	}
}
#promised land
fleet_event = {
	id = asp.74
	title = "asp.74.name"
	desc = "asp.74.desc"
	picture = GFX_evt_city_planet
	show_sound = event_pre_ftl_civilization
	
	archaeology = yes
	is_triggered_only = yes

	trigger = {
		exists = event_target:ASP_site_beyond_earth_purity_planet_2
	}
	
	immediate = {
		from = { set_site_progress_locked = yes }
	}

	after = {
		from = { set_site_progress_locked = no }
	}

	option = {
		name = asp.74.a
		custom_tooltip = asp.74.a.tooltip
		trigger = {
			owner = {
				OR = {
					has_ethic = ethic_xenophobe
					has_ethic = ethic_fanatic_xenophobe
				}
			}
		}
		if = {
			limit = { owner = { is_ai = no } }
			event_target:ASP_site_beyond_earth_purity_planet_2 = {
				enable_special_project = {
					name = ASP_BEYOND_EARTH_PURITY_PROJECT
					location = this
					owner = root.owner
				}
			}
			else = { random_owned_ship = { ship_event = { id = asp.75 } } }
		}
	}
	option = {
		name = asp.74.b
		custom_tooltip = asp.74.a.tooltip
		trigger = { owner = { has_ethic = ethic_gestalt_consciousness } }
		if = {
			limit = { owner = { is_ai = no } }
			event_target:ASP_site_beyond_earth_purity_planet_2 = {
				enable_special_project = {
					name = ASP_BEYOND_EARTH_PURITY_PROJECT
					location = this
					owner = root.owner
				}
			}
			else = { random_owned_ship = { ship_event = { id = asp.75 } } }
		}
	}
	option = {
		name = asp.74.c
		custom_tooltip = asp.74.c.tooltip
		trigger = {
			owner = {
				NOR = {
					has_ethic = ethic_xenophobe
					has_ethic = ethic_fanatic_xenophobe
					has_ethic = ethic_gestalt_consciousness
				}
			}
		}
		if = {
			limit = { owner = { is_ai = no } }
			event_target:ASP_site_beyond_earth_purity_planet_2 = {
				enable_special_project = {
					name = ASP_BEYOND_EARTH_PURITY_PROJECT_2
					location = this
					owner = root.owner
				}
			}
			else = { random_owned_ship = { ship_event = { id = asp.76 } } }
		}
	}
}
#ASP_BEYOND_EARTH_PURITY_PROJECT
ship_event = {
	id = asp.75
	title = "asp.75.name"
	desc = "asp.75.desc"
	picture = GFX_evt_ground_combat
	is_triggered_only = yes

	trigger = {
		exists = event_target:ASP_site_beyond_earth_purity_planet_2
	}

	after = { #excuted right after the option is selected
		hidden_effect = {
			event_target:ASP_site_beyond_earth_purity_planet_2 = {
				change_pc = pc_city
				create_colony = { owner = prev.owner }
				if = {
					limit = { has_global_flag = asp_beyond_earth_purity_story_human_unlocked }
					create_species = {
						class = "HUM"
						portrait = "human"
						name = "PRESCRIPTED_species_name_humans2"
						plural = "PRESCRIPTED_species_plural_humans2"
						adjective = "PRESCRIPTED_species_adjective_humans2"
						namelist = "HUMAN2"
						traits = {
							trait = "trait_pc_continental_preference"
							trait = "trait_adaptive"
							trait = "trait_nomadic"
							trait = "trait_wasteful"
						}
					}
					else = {
						create_species = {
							class = random_non_machine
							portrait = random
							name = random
							traits = {
								trait = "trait_pc_continental_preference"
								trait = "trait_adaptive"
								trait = "trait_nomadic"
								trait = "trait_wasteful"
							}
						}
					}
				}
				while = {
					create_pop_group = { species = last_created_species }
					count = 7
				}
				if = {
					limit = { root.owner = { has_authority = auth_machine_intelligence } }
					add_building = building_machine_capital
				}
				else_if = {
					limit = { root.owner = { has_authority = auth_hive_mind } }
					add_building = building_hive_capital
				}
				else = { add_building = building_capital }
				add_district = district_arcology_housing
				add_modifier = { modifier = aspmod_promised_land days = -1 }
				while = {
					add_deposit = d_ruined_arcology
					count = 10
				}
			}
			clear_global_event_target = ASP_site_beyond_earth_purity_planet_2
			clear_global_event_target = ASP_site_beyond_earth_purity_1_system
		}
	}

	option = {
		name = asp.75.a
		custom_tooltip = asp.75.a.tooltip
		owner = { add_resource = { influence = 500 } }
		custom_tooltip = asp.75.b.tooltip
		hidden_effect = {
			event_target:ASP_site_beyond_earth_purity_planet_2 = { set_planet_flag = ASP_site_beyond_earth_purity_2_dig_stopped }
		}
	}
	option = {
		name = asp.75.b
		custom_tooltip = asp.75.a.tooltip
		custom_tooltip = asp.75.c.tooltip
	}
}
#ASP_BEYOND_EARTH_PURITY_PROJECT_2
ship_event = {
	id = asp.76
	title = "asp.76.name"
	desc = "asp.76.desc"
	picture = GFX_evt_asp.76
	is_triggered_only = yes

	trigger = {
		exists = event_target:ASP_site_beyond_earth_purity_planet_2
	}

	after = { #excuted right after the option is selected
		hidden_effect = {
			event_target:ASP_site_beyond_earth_purity_planet_2 = {
				change_pc = pc_city
				create_colony = { owner = prev.owner }
				if = {
					limit = { has_global_flag = asp_beyond_earth_purity_story_human_unlocked }
					create_species = {
						class = "HUM"
						portrait = "human"
						name = "PRESCRIPTED_species_name_humans2"
						plural = "PRESCRIPTED_species_plural_humans2"
						adjective = "PRESCRIPTED_species_adjective_humans2"
						namelist = "HUMAN2"
						traits = {
							trait = "trait_pc_continental_preference"
							trait = "trait_adaptive"
							trait = "trait_nomadic"
							trait = "trait_wasteful"
						}
					}
					else = {
						create_species = {
							class = random_non_machine
							portrait = random
							name = random
							traits = {
								trait = "trait_pc_continental_preference"
								trait = "trait_adaptive"
								trait = "trait_nomadic"
								trait = "trait_wasteful"
							}
						}
					}
				}
				while = {
					create_pop_group = { species = last_created_species }
					count = 7
				}
				if = {
					limit = { root.owner = { has_authority = auth_machine_intelligence } }
					add_building = building_machine_capital
				}
				else_if = {
					limit = { root.owner = { has_authority = auth_hive_mind } }
					add_building = building_hive_capital
				}
				else = { add_building = building_capital }
				add_district = district_arcology_housing
				add_modifier = { modifier = aspmod_promised_land days = -1 }
				while = {
					add_deposit = d_ruined_arcology
					count = 10
				}
			}
			clear_global_event_target = ASP_site_beyond_earth_purity_planet_2
			clear_global_event_target = ASP_site_beyond_earth_purity_1_system
		}
	}

	option = {
		name = asp.76.a
		custom_tooltip = asp.75.a.tooltip
		owner = { add_resource = { influence = 250 } }
		custom_tooltip = asp.75.b.tooltip
		hidden_effect = {
			event_target:ASP_site_beyond_earth_purity_planet_2 = { set_planet_flag = ASP_site_beyond_earth_purity_2_dig_stopped }
		}
	}
	option = {
		name = asp.76.b
		custom_tooltip = asp.75.a.tooltip
		custom_tooltip = asp.75.c.tooltip
	}
}
#the replicator
fleet_event = {
	id = asp.77
	title = "asp.77.name"
	desc = "asp.77.desc"
	picture = GFX_evt_analyzing_artifacts
	show_sound = relic_activation_cybrex_war_forge
	
	archaeology = yes
	is_triggered_only = yes
	
	immediate = {
		from = { set_site_progress_locked = yes }
	}

	after = {
		from = { set_site_progress_locked = no }
		if = {
			limit = { owner = { has_policy_flag = aspmod_archaeology_cleanup_active } }
			destroy_archaeological_site = from
		}
	}

	option = {
		name = asp.77.a
		owner = { add_relic = r_aspmod_the_replicator }
	}
}
