#########################
# Zinara Site
#########################

namespace = WL_LV_ancrel_zinara

# An Ancient Tomb
event = {
  id = WL_LV_ancrel_zinara.1
	hide_window = yes
	is_triggered_only = yes

  trigger = {
  	NOT = {
			any_planet = { has_planet_flag = WL_lv_zinara_random_generated }
  		any_country = {
  			OR = {
					has_country_flag = WL_lv_discovered_ancient_tomb
					has_country_flag = WL_lv_tomb_of_zinara
					has_country_flag = WL_lv_temple_of_zinara_found 
					has_country_flag = zinara
				}
  		}
  	}
  }

  immediate = {
  	random_list = {
  		10 = {
				modifier = {
					factor = 10
					has_global_flag = WL_lv_zinara_existence
				}
  			random_planet = {
  				limit = {
						NOT = { exists = archaeological_site }
						is_capital = no
  					OR = {
							is_planet_class = pc_molten
							is_planet_class = pc_toxic
							is_planet_class = pc_frozen
							is_planet_class = pc_broken
							is_planet_class = pc_asteroid
							is_planet_class = pc_shattered
							is_planet_class = pc_barren
							is_planet_class = pc_barren_cold
						}
  				}
  				planet_event = { id = WL_LV_ancrel_zinara.10 days = 30 random = 60 }
  			}
  		}
			90 = {}
  	}
  }
}

# Discovery event

planet_event = {
  id = WL_LV_ancrel_zinara.10
	title = WL_LV_ancrel_zinara.10.name
	desc = WL_LV_ancrel_zinara.10.desc
	picture = GFX_evt_satellite_in_orbit
	show_sound = event_whispering
	hide_window = no

  is_triggered_only = yes

  immediate = {
  	THIS = { save_global_event_target_as = WL_lv_eternal_tomb_planet }
		solar_system = { set_star_flag = WL_lv_eternal_tomb_system }
  }

  option = {
		name = WL_LV_ancrel_zinara.10.a
		create_archaeological_site = WL_lv_the_eternal_spirit_site
		add_modifier = { modifier = WL_lv_strange_energy_site_planet }
		set_planet_size = 20
		change_pc = pc_shrouded
		set_planet_flag = WL_lv_zinara_random_generated
	}
}

# Archaeology Site
# Stage 1
fleet_event = {
	id = WL_LV_ancrel_zinara.11
	title = WL_LV_ancrel_zinara.11.name
	desc = WL_LV_ancrel_zinara.11.desc
	picture = GFX_evt_shrouded
	show_sound = event_big_door_opening
	location = from

	archaeology = yes

	is_triggered_only = yes

	immediate = {
		from = { set_site_progress_locked = yes }
	}

	after = { 
		from = { set_site_progress_locked = no } 
	}

	option = {
		name = CURIOUS
		small_artifact_reward = yes
	}
}

# Stage 2
fleet_event = {
	id = WL_LV_ancrel_zinara.12
	title = WL_LV_ancrel_zinara.12.name
	desc = WL_LV_ancrel_zinara.12.desc 
	picture = GFX_evt_huge_monument
	show_sound = event_whispering
	location = from

	archaeology = yes

	is_triggered_only = yes

	immediate = {
		from = { set_site_progress_locked = yes }
	}

	after = { 
		from = { set_site_progress_locked = no } 
	}

	option = {
		name = CURIOUS
		small_artifact_reward = yes
	}
}

# Stage 3
fleet_event = {
	id = WL_LV_ancrel_zinara.13
	title = WL_LV_ancrel_zinara.13.name
	desc = WL_LV_ancrel_zinara.13.desc
	picture = GFX_evt_zro_3
	show_sound = event_whispering
	location = from

	archaeology = yes

	is_triggered_only = yes

	immediate = {
		from = { set_site_progress_locked = yes }
	}

	after = { 
		from = { set_site_progress_locked = no } 
	}

	option = {
		name = CURIOUS
		small_artifact_reward = yes
	}
}

# Stage 4
fleet_event = {
	id = WL_LV_ancrel_zinara.14
	title = WL_LV_ancrel_zinara.14.name
	desc = WL_LV_ancrel_zinara.14.desc
	picture = GFX_evt_alien_planet
	show_sound = event_whispering
	location = from

	archaeology = yes

	is_triggered_only = yes

	immediate = {
		from = { set_site_progress_locked = yes }
	}

	after = { 
		from = { set_site_progress_locked = no } 
	}

	option = {
		name = CURIOUS
		small_artifact_reward = yes
	}
}

# Stage 5
fleet_event = {
	id = WL_LV_ancrel_zinara.15
	title = WL_LV_ancrel_zinara.15.name
	desc = WL_LV_ancrel_zinara.15.desc
	picture = GFX_evt_psionics
	show_sound = event_whispering
	location = from

	archaeology = yes

	is_triggered_only = yes
	
	immediate = {
		owner = { 
		country_event = { id = WL_lv_zinara_project_events.9000 }
		country_event = { id = WL_lv_zinara_project_events.9001 days = 3600 }
		set_country_flag = the_eternal_spirit_awaken 
		} 
		event_target:WL_lv_eternal_tomb_planet = { 
			remove_modifier = WL_lv_strange_energy_site_planet
			set_planet_size = 12
		}
		from = { set_site_progress_locked = yes }
	}

	after = { 
		from = { set_site_progress_locked = no } 
	}

	option = {
		name = REMARKABLE
#		custom_tooltip = WL_LV_ancrel_zinara.15.tooltip
		owner = {
			add_relic = r_WL_lv_zinara
			add_resource = { rare_crystals = 500 }
			large_artifact_reward = yes
		}

		if = {
			limit = {
				owner = {
					NOT = { 
						has_technology = tech_rare_crystals
					}
				}
			}
			owner = {
				# Gives unique building
				give_technology = { tech = tech_rare_crystals } 
			}
		}
		
		#Fire notif event
		every_country = {
			limit = {
				OR = {  
					is_country_type = default
					is_country_type = fallen_empire
					is_country_type = awakened_fallen_empire
				}
				NOT = { has_communications = event_target:zinara_country_target}
			}
			country_event = { id = WL_lv_Zinara_contact_events.1200 days = 3 }
		}
	}
}