#####################################
# STRANGE WORLDS Observation Events #
#####################################

namespace = strange_worlds

# Suspicious Prophet
situation_event = {
	id = strange_worlds.3000
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		has_biogenesis_dlc = yes
		NOT = {
			has_situation_flag = has_ongoing_observation_event_chain
		}
		owner = {
			OR = {
				has_pre_ftl_age = stone_age
				has_pre_ftl_age = bronze_age
				has_pre_ftl_age = iron_age
				has_pre_ftl_age = late_medieval_age
				has_pre_ftl_age = renaissance_age
			}
			capital_scope = {
				observation_outpost_owner = {
					is_homicidal = no
					NOT = { has_country_flag = triggered_suspicious_prophet  }
					OR = {
						AND = {
							has_megacorp = no
							has_country_flag = nomads_contacted
						}
						AND = {
							has_megacorp = yes
							exists = event_target:caravaneer_fleet3_country
							event_target:caravaneer_fleet3_country ={
								has_communications = prev
							}

						}
					}
				}
			}
			NOT = { has_country_flag = triggered_suspicious_prophet }
		}


	}
	immediate = {
		owner = {
			save_event_target_as = pre_ftl_country
			capital_scope = {
				save_event_target_as = pre_ftl_planet
				observation_outpost = {
					set_event_locked = yes
					owner = {
						country_event = { id = strange_worlds.3005 days = 360 }
					}
				}
			}
		}
		set_situation_flag = has_ongoing_observation_event_chain
	}
}

country_event = {
	id = strange_worlds.3005
	title = strange_worlds.3005.name
	desc = strange_worlds.3005.desc
	picture = GFX_evt_alien_propaganda
	show_sound = event_coronation
	is_triggered_only = yes
	location = event_target:pre_ftl_planet

	trigger = {
		exists = event_target:pre_ftl_country
		NOT = { has_country_flag = triggered_suspicious_prophet  }
	}

	immediate = {
		set_country_flag = triggered_suspicious_prophet
		event_target:pre_ftl_country = {
			set_country_flag = triggered_suspicious_prophet
		}
	}

	option = {
		name = strange_worlds.3005.a
		add_monthly_resource_mult = {
			resource = society_research
			value = @tier1researchreward
			min = @tier1researchmin
			max = @tier1researchmax
		}
		hidden_effect = {
			country_event = {
				id = strange_worlds.3010
				days = 180
			}
		}
	}
}

country_event = {
	id = strange_worlds.3010
	title = strange_worlds.3010.name
	desc = {
		trigger = {
			text = strange_worlds.3010.desc_intro
			success_text = {
				text = strange_worlds.3010.desc_no_megacorp
				AND = {
					has_megacorp = no
					has_country_flag = nomads_contacted
				}
			}
			success_text = {
				text = strange_worlds.3010.desc_megacorp
				has_megacorp = yes
				exists = event_target:caravaneer_fleet3_country
				event_target:caravaneer_fleet3_country ={
					has_communications = root
				}
			}
			text = strange_worlds.3010.desc_outro
		}
	}
	picture = GFX_evt_enlightenment_failure
	show_sound = event_coronation
	is_triggered_only = yes
	location = event_target:pre_ftl_planet

	trigger = {
		exists = event_target:pre_ftl_country
	}

	option = {
		name = strange_worlds.3010.a
		observation_breach_effect = {
			RESOLUTION = resolution_pre_ftl_stances_non_interference
		}
		hidden_effect = {
			country_event = {
				id = strange_worlds.3015
				days = 180
			}
		}
	}
	option = {
		name = strange_worlds.3010.b
		hidden_effect = {
			country_event = {
				id = strange_worlds.3020
				days = 180
			}
		}
	}
	after = {
		add_monthly_resource_mult = {
			resource = society_research
			value = @tier1researchreward
			min = @tier1researchmin
			max = @tier1researchmax
		}
	}
}

country_event = {
	id = strange_worlds.3015
	title = strange_worlds.3015.name
	desc = {
		trigger = {
			success_text = {
				text = strange_worlds.3015.desc_no_megacorp
				OR = {
					AND = {
						has_megacorp = no
						has_country_flag = nomads_contacted
					}

				}
			}
			success_text = {
				text = strange_worlds.3015.desc_megacorp
				has_megacorp = yes
			}
			text = strange_worlds.3015.desc_outro
		}
	}
	picture = GFX_evt_enlightenment_failure
	show_sound = event_coronation
	is_triggered_only = yes
	location = event_target:pre_ftl_planet

	trigger = {
		exists = event_target:pre_ftl_country
	}

	option = {
		name = strange_worlds.3015.a
		event_target:pre_ftl_country = {
			add_awareness = 20
			shift_ethic = ethic_fanatic_xenophobe
			pre_ftl_progresses_one_age = yes
		}
		custom_tooltip = pre_ftl_progresses_one_age_effect
		add_monthly_resource_mult = {
			resource = alloys
			value = @tier1materialreward
			min = @tier1materialmin
			max = @tier1materialmax
		}
		add_monthly_resource_mult = {
			resource = society_research
			value = @tier2researchreward
			min = @tier2researchmin
			max = @tier2researchmax
		}
		hidden_effect = {
			if = {
				limit = {
					has_megacorp = no
					has_country_flag = nomads_contacted
				}
				country_event = {
					id = strange_worlds.3025
					days = 90
				}
			}
			else_if = {
				limit = {
					has_megacorp = yes
				}
				country_event = {
					id = strange_worlds.3030
					days = 90
				}
			}
		}
	}
}


country_event = {
	id = strange_worlds.3020
	title = strange_worlds.3020.name
	desc = {
		trigger = {
			text = strange_worlds.3020.desc_intro
			success_text = {
				text = strange_worlds.3020.desc_no_megacorp
				OR = {
					AND = {
						has_megacorp = no
						has_country_flag = nomads_contacted
					}
				}
			}
			success_text = {
				text = strange_worlds.3020.desc_megacorp
				has_megacorp = yes
			}
			text = strange_worlds.3020.desc_outro
		}
	}
	picture = GFX_evt_atmospheric_flight
	show_sound = event_public_unrest
	is_triggered_only = yes
	location = event_target:pre_ftl_planet

	trigger = {
		exists = event_target:pre_ftl_country
	}

	option = {
		name = strange_worlds.3020.a
		event_target:pre_ftl_country = {
			pre_ftl_regresses_one_age = yes
		}
		custom_tooltip = pre_ftl_regresses_one_age_effect
		add_monthly_resource_mult = {
			resource = energy
			value = @tier3materialreward
			min = @tier3materialmin
			max = @tier3materialmax
		}
		if = {
			limit = {
				is_gestalt = no
			}
			add_monthly_resource_mult = {
				resource = consumer_goods
				value = @tier3materialreward
				min = @tier3materialmin
				max = @tier3materialmax
			}
		}
		else = {
			add_monthly_resource_mult = {
				resource = alloys
				value = @tier2materialreward
				min = @tier2materialmin
				max = @tier2materialmax
			}
		}
	}
}


country_event = {
	id = strange_worlds.3025
	title = strange_worlds.3025.name
	desc = strange_worlds.3025.desc
	is_triggered_only = yes
	diplomatic = yes
	custom_gui = "enclave_caravaneer_window"
	custom_gui_option = "enclave_caravaneer_option"
	picture_event_data = {
		portrait = event_target:nomad_speaker
		room = default_room
	}
	location = event_target:pre_ftl_planet

	trigger = {
		exists = event_target:pre_ftl_country
	}

	immediate = {
		event_target:nomad01_country = {
			random_controlled_fleet = {
				leader = { save_event_target_as = nomad_speaker }
			}
		}
	}

	option = {
		name = strange_worlds.3025.a
		add_monthly_resource_mult = {
			resource = alloys
			value = @tier3materialreward
			min = @tier3materialmin
			max = @tier3materialmax
		}
		add_monthly_resource_mult = {
			resource = energy
			value = @tier3materialreward
			min = @tier3materialmin
			max = @tier3materialmax
		}
		hidden_effect = {
			event_target:pre_ftl_country = {
				random_situation = {
					limit = {
						is_situation_type = pre_ftl_tech_progress_situation
					}
					remove_situation_flag = has_ongoing_observation_event_chain
				}
				capital_scope.observation_outpost? = {
					set_event_locked = no
				}
			}
		}
	}
}

country_event = {
	id = strange_worlds.3030
	title = strange_worlds.3030.name
	desc = strange_worlds.3030.desc
	is_triggered_only = yes
	diplomatic = yes
	location = event_target:pre_ftl_planet
	custom_gui = "enclave_caravaneer_window"
	custom_gui_option = "enclave_caravaneer_option"
	picture_event_data = {
		portrait = event_target:caravaneer_fleet3_country
		room = ethic_spaceship_room
		planet_background = pc_barren_cold
	}

	trigger = {
		exists = event_target:caravaneer_fleet3_country
		exists = event_target:pre_ftl_country
	}

	option = {
		name = strange_worlds.3030.a
		add_monthly_resource_mult = {
			resource = alloys
			value = @tier3materialreward
			min = @tier3materialmin
			max = @tier3materialmax
		}
		add_monthly_resource_mult = {
			resource = energy
			value = @tier3materialreward
			min = @tier3materialmin
			max = @tier3materialmax
		}
		hidden_effect = {
			event_target:pre_ftl_country = {
				random_situation = {
					limit = {
						is_situation_type = pre_ftl_tech_progress_situation
					}
					remove_situation_flag = has_ongoing_observation_event_chain
				}
				capital_scope.observation_outpost? = {
					set_event_locked = no
				}
			}
		}
	}
}

# Crate Expectation
situation_event = {
	id = strange_worlds.3035
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		NOT = {
			has_situation_flag = has_ongoing_observation_event_chain
		}
		owner = {
			OR = {
				has_pre_ftl_age = stone_age
				has_pre_ftl_age = bronze_age
				has_pre_ftl_age = iron_age
				has_pre_ftl_age = late_medieval_age
			}
			NOT = { has_country_flag = triggered_crate_expectations }
			capital_scope = {
				observation_outpost = {
					has_mission = specimen_collection
					owner = {
						NOT = { has_country_flag = triggered_crate_expectations }
					}
				}
			}
		}
	}

	immediate = {
		owner = {
			save_event_target_as = pre_ftl_country
			capital_scope = {
				save_event_target_as = pre_ftl_planet
				observation_outpost = {
					set_event_locked = yes
					owner = {
						country_event = {
							id = strange_worlds.3040
						}
					}
				}
			}
		}
		set_situation_flag = has_ongoing_observation_event_chain
	}
}

country_event = {
	id = strange_worlds.3040
	title = strange_worlds.3040.name
	desc = strange_worlds.3040.desc
	picture = GFX_evt_savannah
	show_sound = event_administrative_work
	is_triggered_only = yes
	location = event_target:pre_ftl_planet

	trigger = {
		exists = event_target:pre_ftl_country
	}

	immediate = {
		set_country_flag = triggered_crate_expectations
		event_target:pre_ftl_country = {
			set_country_flag = triggered_crate_expectations
		}
	}

	option = {
		name = strange_worlds.3040.a

		event_target:pre_ftl_country = {
			add_awareness = 10
		}
		if = {
			limit = {
				OR = {
					is_lithoid = yes
					is_machine_empire = yes
				}
			}
			add_resource = {
				energy = -10
			}
		}
		else = {
			add_resource = {
				food = -10
			}
		}
		hidden_effect = {
			country_event = {
				id = strange_worlds.3045
				days = 180
			}
		}
	}
}

country_event = {
	id = strange_worlds.3045
	title = strange_worlds.3045.name
	desc = {
		trigger = {
			text = strange_worlds.3045.desc_common
			success_text = {
				text = strange_worlds.3045.desc_non_homicidal
				is_homicidal = no
			}
			success_text = {
				text = strange_worlds.3045.desc_homicidal
				is_homicidal = yes
			}
		}
	}
	picture = GFX_evt_alien_cavemen
	show_sound = event_pre_ftl_civilization
	is_triggered_only = yes
	location = event_target:pre_ftl_planet

	trigger = {
		exists = event_target:pre_ftl_country
		event_target:pre_ftl_country = {
			capital_scope = {
				has_observation_outpost = yes
			}
		}
	}

	option = {
		trigger = {
			is_homicidal = no
		}
		name = {
			trigger = {
				success_text = {
					text = strange_worlds.3045.a_normal
					is_megacorp = no
				}
				success_text = {
					text = strange_worlds.3045.a_megacorp
					is_megacorp = yes
				}
			}
		}
		hidden_effect = {
			country_event = {
				id = strange_worlds.3050
				days = 180
			}
		}
	}
	option = {
		trigger = {
			is_homicidal = no
		}
		name = {
			trigger = {
				success_text = {
					text = strange_worlds.3045.b_normal
					is_megacorp = no
				}
				success_text = {
					text = strange_worlds.3045.b_megacorp
					is_megacorp = yes
				}
			}
		}
		observation_breach_effect = {
			RESOLUTION = resolution_pre_ftl_stances_non_interference
		}
		add_resource = {
			food = -500
		}
		event_target:pre_ftl_country = {
			hidden_effect = {
				set_country_flag = trigger_canceled_service
				capital_scope = {
					observation_outpost = {
						set_fleet_flag = crate_expectation_production
					}
				}
			}
			custom_tooltip = strange_worlds.3045.ct
		}
	}
	option = {
		trigger = {
			is_homicidal = yes
		}
		name = strange_worlds.3045.c
		event_target:pre_ftl_country = {
			shift_ethic = ethic_xenophobe
			pre_ftl_regresses_one_age = yes
			custom_tooltip = pre_ftl_regresses_one_age_effect
		}
		observation_breach_effect = {
			RESOLUTION = resolution_pre_ftl_stances_non_interference
		}
	}
	after = {
		add_resource = {
			minerals = 500
		}
		event_target:pre_ftl_country = {
			add_awareness = 10
		}
	}
}

country_event = {
	id = strange_worlds.3050
	title = strange_worlds.3050.name
	desc = strange_worlds.3050.desc
	picture = GFX_evt_alien_cavemen
	show_sound = event_pre_ftl_civilization
	is_triggered_only = yes
	location = event_target:pre_ftl_planet

	trigger = {
		exists = event_target:pre_ftl_country
		event_target:pre_ftl_country = {
			capital_scope = {
				has_observation_outpost = yes
			}
		}
	}

	option = {
		name = strange_worlds.3050.a
		event_target:pre_ftl_country = {
			country_add_ethic = ethic_fanatic_xenophobe
			add_awareness = 10
			hidden_effect = {
				random_situation = {
					limit = {
						is_situation_type = pre_ftl_tech_progress_situation
					}
					remove_situation_flag = has_ongoing_observation_event_chain
				}
				capital_scope.observation_outpost? = {
					set_event_locked = no
				}
			}
		}
		add_monthly_resource_mult = {
			resource = society_research
			value = @tier2researchreward
			min = @tier2researchmin
			max = @tier2researchmax
		}
	}
}

country_event = {
	id = strange_worlds.3055
	picture = GFX_evt_alien_cavemen
	is_triggered_only = yes
	hide_window = yes

	trigger = {
		has_pre_ftl_age = renaissance_age
		has_country_flag = trigger_canceled_service
		capital_scope = {
			has_observation_outpost = yes
		}
	}

	immediate = {
		save_event_target_as = pre_ftl_country
		remove_country_flag = trigger_canceled_service
		capital_scope = {
			save_event_target_as = pre_ftl_planet
			observation_outpost = {
				owner = {
					country_event = {
						id = strange_worlds.3060
						days = 180
					}
				}
			}
		}
	}
}

country_event = {
	id = strange_worlds.3060
	title = strange_worlds.3060.name
	desc =  strange_worlds.3060.desc
	picture = GFX_evt_medieval_alien_civilization
	show_sound = event_pre_ftl_civilization
	location = event_target:pre_ftl_planet
	is_triggered_only = yes

	trigger = {
		exists = event_target:pre_ftl_country
		event_target:pre_ftl_planet = {
			has_observation_outpost = yes
		}
	}

	option = {
		name = strange_worlds.3060.a
		event_target:pre_ftl_country = {
			add_awareness = 10
			hidden_effect = {
				capital_scope = {
					observation_outpost = {
						remove_fleet_flag = crate_expectation_production
					}
				}
				random_situation = {
					limit = {
						is_situation_type = pre_ftl_tech_progress_situation
					}
					remove_situation_flag = has_ongoing_observation_event_chain
				}
				capital_scope.observation_outpost? = {
					set_event_locked = no
				}
			}
			custom_tooltip = strange_worlds.3060.ct
		}
		add_monthly_resource_mult = {
			resource = society_research
			value = @tier2researchreward
			min = @tier2researchmin
			max = @tier2researchmax
		}
	}
}

# Ladders to Heaven
situation_event = {
	id = strange_worlds.3065
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		NOT = {
			has_situation_flag = has_ongoing_observation_event_chain
		}
		owner = {
			pre_ftl_victorian_era = yes
			NOT = { has_country_flag = triggered_heaven_ladder }
			capital_scope = {
				observation_outpost_owner = {
					NOT = { has_country_flag = triggered_heaven_ladder }
				}
			}
		}
	}

	immediate = {
		owner = {
			save_event_target_as = pre_ftl_country
			capital_scope = {
				save_event_target_as = pre_ftl_planet
				observation_outpost = {
					set_event_locked = yes
					owner = {
						country_event = { id = strange_worlds.3070 }
					}
				}
			}
		}
		set_situation_flag = has_ongoing_observation_event_chain
	}
}

country_event = {
	id = strange_worlds.3070
	title = strange_worlds.3070.name
	desc =  strange_worlds.3070.desc
	picture = GFX_evt_spy_orb
	show_sound = event_yellow_alert
	location = event_target:pre_ftl_planet
	is_triggered_only = yes

	trigger = {
		exists = event_target:pre_ftl_country
	}

	immediate = {
		set_country_flag = triggered_heaven_ladder
		event_target:pre_ftl_country = {
			set_country_flag = triggered_heaven_ladder
		}
	}

	option = {
		name = strange_worlds.3070.a
		event_target:pre_ftl_country = {
			add_awareness = 10
		}
		hidden_effect = {
			country_event = {
				id = strange_worlds.3075
				days = 360
			}
		}
	}
}

country_event = {
	id = strange_worlds.3075
	title = strange_worlds.3075.name
	desc = {
		trigger = {
			text = strange_worlds.3075.desc_common
			success_text = {
				text = strange_worlds.3075.desc_non_homicidal
				is_homicidal = no
			}
			success_text = {
				text = strange_worlds.3075.desc_homicidal
				is_homicidal = yes
			}
		}
	}
	picture = GFX_evt_stairway_to_heavens
	show_sound = event_planetary_riot
	location = event_target:pre_ftl_planet
	is_triggered_only = yes

	trigger = {
		exists = event_target:pre_ftl_country
	}

	option = {
		name = strange_worlds.3075.a
		add_resource = {
			energy = 200
		}
		observation_breach_effect = {
			RESOLUTION = resolution_pre_ftl_stances_non_interference
		}
		event_target:pre_ftl_country = {
			add_awareness = 20
		}
		hidden_effect = {
			country_event = {
				id = strange_worlds.3080
				days = 360
			}
		}
	}
	option = {
		name = strange_worlds.3075.b
		hidden_effect = {
			event_target:pre_ftl_country = {
				capital_scope = {
					observation_outpost = {
						set_fleet_flag = heaven_ladder_production_boost
						custom_tooltip = strange_worlds.3075.b_ct
					}
				}
			}
			country_event = {
				id = strange_worlds.3085
				days = 360
			}
		}
	}
	after = {
		add_monthly_resource_mult = {
			resource = society_research
			value = @tier2researchreward
			min = @tier2researchmin
			max = @tier2researchmax
		}
	}
}

country_event = {
	id = strange_worlds.3080
	title = strange_worlds.3080.name
	desc =  strange_worlds.3080.desc
	picture = GFX_evt_spy_orb
	show_sound = event_yellow_alert
	location = event_target:pre_ftl_planet
	is_triggered_only = yes

	trigger = {
		exists = event_target:pre_ftl_country
	}

	option = {
		name = strange_worlds.3080.a
		hidden_effect = {
			event_target:pre_ftl_country = {
				random_situation = {
					limit = {
						is_situation_type = pre_ftl_tech_progress_situation
					}
					add_situation_progress = 960
				}
				shift_ethic = ethic_materialist
			}
		}
		custom_tooltip = strange_worlds.3080.a_ct
		add_monthly_resource_mult = {
			resource = society_research
			value = @tier3researchreward
			min = @tier3researchmin
			max = @tier3researchmax
		}
		hidden_effect = {
			event_target:pre_ftl_country = {
				random_situation = {
					limit = {
						is_situation_type = pre_ftl_tech_progress_situation
					}
					remove_situation_flag = has_ongoing_observation_event_chain
				}
				capital_scope.observation_outpost? = {
					set_event_locked = no
				}
			}
		}
	}
}

country_event = {
	id = strange_worlds.3085
	title = strange_worlds.3085.name
	desc =  strange_worlds.3085.desc
	picture = GFX_evt_open_revolt
	show_sound = event_death_cult
	location = event_target:pre_ftl_planet
	is_triggered_only = yes

	trigger = {
		exists = event_target:pre_ftl_country
	}

	option = {
		name = strange_worlds.3085.a
		event_target:pre_ftl_country = {
			if = {
				limit = {
					root = {
						has_first_contact_dlc = yes
					}
				}
				add_modifier = {
					modifier = ladder_wars_pre_ftl
				}
			}
			shift_ethic = ethic_xenophobe
			pre_ftl_regresses_one_age = yes
			custom_tooltip = pre_ftl_regresses_one_age_effect
			custom_tooltip = strange_worlds.3085.a_ct
			hidden_effect = {
				capital_scope = {
					observation_outpost = {
						remove_fleet_flag = heaven_ladder_production_boost
						set_event_locked = no
					}
				}
				random_situation = {
					limit = {
						is_situation_type = pre_ftl_tech_progress_situation
					}
					remove_situation_flag = has_ongoing_observation_event_chain
				}
			}
		}
		add_monthly_resource_mult = {
			resource = society_research
			value = @tier3researchreward
			min = @tier3researchmin
			max = @tier3researchmax
		}
	}
}
