namespace = ASPmod

### Archaeology: The Ship of Theseus

# Stage 1 - The Residential Area
fleet_event = {
	id = ASPmod.40
	title = "ASPmod.40.name"
	desc = "ASPmod.40.desc"
	picture = GFX_evt_relic_world
	show_sound = event_dig_site

	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
	}
}

# Stage 2 - Native's Fossil
fleet_event = {
	id = ASPmod.41
	title = "ASPmod.41.name"
	desc = "ASPmod.41.desc"
	picture = GFX_evt_scanning_remains
	show_sound = event_dangerous_animals

	archaeology = yes

	is_triggered_only = yes

	immediate = {
		from = { set_site_progress_locked = yes }
	}

	after = {
		from = { set_site_progress_locked = no }
	}

	option = {
		name = DIG
		trigger = {
			owner = {
				NOR = {
					has_ethic = ethic_xenophobe
					has_ethic = ethic_fanatic_xenophobe
				}
			}
		}
		small_artifact_reward = yes
	}
	option = {
		name = "ASPmod.41.option"
		trigger = {
			owner = {
				OR = {
					has_ethic = ethic_xenophobe
					has_ethic = ethic_fanatic_xenophobe
				}
			}
		}
		small_artifact_reward = yes
	}
}

# Stage 3 - Biotechnology
fleet_event = {
	id = ASPmod.42
	title = "ASPmod.42.name"
	desc = "ASPmod.42.desc"
	picture = GFX_evt_clones
	show_sound = event_laboratory_sound

	archaeology = yes

	is_triggered_only = yes

	immediate = {
		from = { set_site_progress_locked = yes }
	}

	after = {
		from = { set_site_progress_locked = no }
	}

	option = {
		name = "ASPmod.42.option.a"
		trigger = {
			owner = {
				OR = {
					has_ethic = ethic_xenophobe
					has_ethic = ethic_fanatic_xenophobe
				}
			}
		}
		small_artifact_reward = yes
		owner = {
			add_resource = { unity = 1000 }
		}
	}
	option = {
		name = "ASPmod.42.option.b"
		trigger = {
			owner = {
				OR = {
					has_ethic = ethic_xenophile
					has_ethic = ethic_fanatic_xenophile
				}
			}
		}
		small_artifact_reward = yes
		owner = {
			add_resource = { unity = 1000 }
		}
	}
	option = {
		name = "ASPmod.42.option.c"
		trigger = {
			owner = {
				OR = {
					has_ethic = ethic_authoritarian
					has_ethic = ethic_fanatic_authoritarian
				}
			}
		}
		small_artifact_reward = yes
		owner = {
			add_resource = { influence = 50 }
		}
	}
	option = {
		name = "ASPmod.42.option.d"
		small_artifact_reward = yes
	}
}

# Stage 4 - Genetic Change
fleet_event = {
	id = ASPmod.43
	title = "ASPmod.43.name"
	desc = "ASPmod.43.desc"
	picture = GFX_evt_genetic_modification
	show_sound = event_bad_omen

	archaeology = yes

	is_triggered_only = yes

	immediate = {
		from = { set_site_progress_locked = yes }
	}

	after = {
		from = { set_site_progress_locked = no }
	}

	option = {
		name = "ASPmod.43.option"
		small_artifact_reward = yes
	}
}

# Stage 5 - The Truth
fleet_event = {
	id = ASPmod.44
	title = "ASPmod.44.name"
	desc = "ASPmod.44.desc"
	picture = GFX_evt_society_research
	show_sound = event_door_opening

	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 = "ASPmod.44.option.a"
		trigger = {
			owner = {
				OR = {
					has_ethic = ethic_xenophobe
					has_ethic = ethic_fanatic_xenophobe
				}
			}
		}
		small_artifact_reward = yes
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier2researchreward
				min = @tier2researchreward
				max = @tier2researchreward
			}
			add_modifier = {
				modifier = ASP_small_xenophile_bonus
				days = 3600
			}
		}
		from.planet = {
			add_modifier = {
				modifier = ASP_middle_xenophile_bonus
				days = 3600
			}
		}
	}
	option = {
		name = "ASPmod.44.option.b"
		trigger = {
			owner = {
				OR = {
					has_ethic = ethic_xenophobe
					has_ethic = ethic_fanatic_xenophobe
				}
			}
		}
		allow = {
			owner = {
				resource_stockpile_compare = { resource = minerals value >= 200 }
			}
		}
		small_artifact_reward = yes
		owner = {
			add_resource = { minerals = -200 }
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier2researchreward
				min = @tier2researchreward
				max = @tier2researchreward
			}
			add_monthly_resource_mult = {
				resource = unity
				value = 180
				min = 1200
				max = 3500
			}
		}
	}
	option = {
		name = "ASPmod.44.option.c"
		trigger = {
			owner = {
				OR = {
					has_ethic = ethic_xenophile
					has_ethic = ethic_fanatic_xenophile
				}
			}
		}
		small_artifact_reward = yes
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier2researchreward
				min = @tier2researchreward
				max = @tier2researchreward
			}
			add_modifier = {
				modifier = ASP_small_xenophile_bonus
				days = 3600
			}
		}
		from.planet = {
			add_modifier = {
				modifier = ASP_middle_xenophile_bonus
				days = 3600
			}
		}
	}
	option = {
		name = "ASPmod.44.option.d"
		trigger = {
			owner = {
				has_ascension_perk = ap_synthetic_evolution
			}
		}
		small_artifact_reward = yes
		owner = {
			add_monthly_resource_mult = {
				resource = engineering_research
				value = 180
				min = 1200
				max = 3500
			}
		}
	}
	option = {
		name = "ASPmod.44.option.e"
		trigger = { owner = { has_ascension_perk = ap_engineered_evolution } }
		small_artifact_reward = yes
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = 180
				min = 1200
				max = 3500
			}
		}
	}
	option = {
		name = "ASPmod.44.option.f"
		custom_tooltip = "ASPmod.44.option.f.tooltip"
		trigger = {
			owner = {
				NOR = {
					has_ethic = ethic_xenophile
					has_ethic = ethic_fanatic_xenophile
					has_ethic = ethic_gestalt_consciousness
				}
			}
		}
		small_artifact_reward = yes
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier2researchreward
				min = @tier2researchreward
				max = @tier2researchreward
			}
			add_resource = { influence = 200 }
			add_modifier = {
				modifier = ASP_big_xenophile_bonus
				days = 3600
			}
		}
		hidden_effect = {
			owner = {
				while = {
					count = 20
					weighted_random_owned_pop_group = {
						limit = {
							NOR = {
								has_ethic = ethic_xenophile
								has_trait = trait_mechanical
							}
						}
						pop_group_transfer_ethic = {
							POP_GROUP = this
							ETHOS = ethic_xenophile
							PERCENTAGE = 0.1
						}
					}
				}
			}
		}
	}
	option = {
		name = "ASPmod.44.option.g"
		small_artifact_reward = yes
		owner = {
			add_monthly_resource_mult = {
				resource = society_research
				value = @tier2researchreward
				min = @tier2researchreward
				max = @tier2researchreward
			}
			add_modifier = {
				modifier = ASP_small_xenophile_bonus
				days = 3600
			}
		}
		from.planet = {
			add_modifier = {
				modifier = ASP_middle_xenophile_bonus
				days = 3600
			}
		}
	}
}
