# Operational Reserves percentage at which the AI switches to the Burn (full spending) approach.
@ai_nomad_full_spending_reserve_percent = 90

### Forever Cruise - Passenger Satisfaction
situation_passenger_satisfaction = {
	picture = GFX_evt_forever_cruise
	complete_icon_frame = GFX_situation_outcome_frame_red
	complete_icon = GFX_situation_outcome_revolt
	fail_icon_frame = GFX_situation_outcome_frame_red
	fail_icon = GFX_situation_outcome_planet_negative

	category = neutral
	progress_direction = bidirectional
	permanent = yes
	situation_log_category = empire_concerns

	initial_progress = 500

	abort_trigger = {
		OR = {
			NOT = { exists = owner }
			owner = {
				NOT = { has_origin = origin_forever_cruise }
			}
		}
	}

	on_fail = {
		custom_tooltip = "situation_passenger_satisfaction_planetfall_outcome"
		# This is a permanent situation that is destroyed by the Planetfall event
		hidden_effect = {
			# This is here just to silence the error log
		}
	}

	on_progress_complete = {
		custom_tooltip = "situation_passenger_satisfaction_mutiny_outcome"
		# This is a permanent situation that is destroyed by the Mutiny event
		hidden_effect = {
			# This is here just to silence the error log
		}
	}

	stages = {
		situation_passenger_satisfaction_stage_planetfall = {
			end = 1
			on_first_enter = {
				set_situation_approach = situation_passenger_satisfaction_balanced
				set_situation_locked = yes
				situation_event = { id = nomads.1005 }
			}
			modifier = {
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = -0.75
				pop_cat_cruise_passenger_unemployment_happiness = -0.75
			}
		}
		situation_passenger_satisfaction_stage_incensed = {
			icon = GFX_situation_stage_passenger
			icon_background = GFX_situation_stage_frame_orange
			end = 100
			on_first_enter = {
				situation_event = { id = nomads.1050 }
			}
			triggered_modifier = {
				potential = {
					# Crew Approach
					current_situation_approach = situation_passenger_satisfaction_crew
				}
				# Crew Effects
				specialist_and_complex_drone_cat_bonus_workforce_mult = 0.10
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = -0.67
				pop_cat_cruise_passenger_unemployment_happiness = -0.67
			}
			triggered_modifier = {
				potential = {
					# Neutral Approach
					current_situation_approach = situation_passenger_satisfaction_balanced
				}
				# Crew Effects
				specialist_and_complex_drone_cat_bonus_workforce_mult = 0.075
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = -0.50
				pop_cat_cruise_passenger_unemployment_happiness = -0.50
			}
			triggered_modifier = {
				potential = {
					# Passenger Approach
					current_situation_approach = situation_passenger_satisfaction_passenger
				}
				# Crew Effects
				specialist_and_complex_drone_cat_bonus_workforce_mult = 0.05
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = -0.10
				pop_cat_cruise_passenger_unemployment_happiness = -0.10
			}
		}
		situation_passenger_satisfaction_stage_bored = {
			icon = GFX_situation_stage_passenger
			icon_background = GFX_situation_stage_frame_yellow
			end = 300
			on_first_enter = {
				situation_event = { id = nomads.1100 }
			}
			triggered_modifier = {
				potential = {
					# Crew Approach
					current_situation_approach = situation_passenger_satisfaction_crew
				}
				# Crew Effects
				specialist_and_complex_drone_cat_bonus_workforce_mult = 0.075
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = -0.33
				pop_cat_cruise_passenger_unemployment_happiness = -0.33
			}
			triggered_modifier = {
				potential = {
					# Neutral Approach
					current_situation_approach = situation_passenger_satisfaction_balanced
				}
				# Crew Effects
				specialist_and_complex_drone_cat_bonus_workforce_mult = 0.05
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = -0.25
				pop_cat_cruise_passenger_unemployment_happiness = -0.25
			}
			triggered_modifier = {
				potential = {
					# Passenger Approach
					current_situation_approach = situation_passenger_satisfaction_passenger
				}
				# Crew Effects
				specialist_and_complex_drone_cat_bonus_workforce_mult = 0.025
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = -0.10
				pop_cat_cruise_passenger_unemployment_happiness = -0.10
			}
		}
		situation_passenger_satisfaction_stage_steady = {
			icon = GFX_situation_stage_balanced
			icon_background = GFX_situation_stage_frame_green
			end = 700
			on_first_enter = {
				set_variable = {
					which = passenger_satisfaction_index
					value = 0
				}
				situation_event = { id = nomads.1150 }
			}
			# Variable negative (drifting towards Planetfall)
			triggered_modifier = {
				potential = {
					# Strict Itineraries Approach
					current_situation_approach = situation_passenger_satisfaction_crew
					check_variable = {
						which = passenger_satisfaction_index
						value < 0
					}
				}
				# Crew Effects
				specialist_and_complex_drone_cat_bonus_workforce_mult = 0.02
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = -0.10
				pop_cat_cruise_passenger_unemployment_happiness = -0.10
			}
			# Regular Empire Effects
			triggered_modifier = {
				potential = {
					# Deckside Carnivals Approach
					current_situation_approach = situation_passenger_satisfaction_passenger
					check_variable = {
						which = passenger_satisfaction_index
						value < 0
					}
					owner? = {
						is_gestalt = no
					}
				}
				# Crew Effects
				pop_citizen_happiness = -0.10
				# Passenger Effects
				pop_cat_cruise_passenger_political_power = 1
				pop_cat_cruise_passenger_unemployment_political_power = 1
			}
			# Gestalt Empire Effects
			triggered_modifier = {
				potential = {
					# Deckside Carnivals Approach
					current_situation_approach = situation_passenger_satisfaction_passenger
					check_variable = {
						which = passenger_satisfaction_index
						value < 0
					}
					owner? = {
						is_gestalt = yes
					}
				}
				# Crew Effects
				planet_stability_add = -5
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = 0.02
				pop_cat_cruise_passenger_unemployment_happiness = 0.02
			}
			# Variable positive (drifting towards Mutiny)
			triggered_modifier = {
				potential = {
					# Strict Itineraries Approach
					current_situation_approach = situation_passenger_satisfaction_crew
					check_variable = {
						which = passenger_satisfaction_index
						value > 0
					}
				}
				# Crew Effects
				specialist_and_complex_drone_cat_bonus_workforce_mult = 0.01
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = -0.05
				pop_cat_cruise_passenger_unemployment_happiness = -0.05
			}
			# Regular Empire Effects
			triggered_modifier = {
				potential = {
					# Deckside Carnivals Approach
					current_situation_approach = situation_passenger_satisfaction_passenger
					check_variable = {
						which = passenger_satisfaction_index
						value > 0
					}
					owner? = {
						is_gestalt = no
					}
				}
				# Crew Effects
				pop_citizen_happiness = -0.20
				# Passenger Effects
				pop_cat_cruise_passenger_political_power = 2
				pop_cat_cruise_passenger_unemployment_political_power = 2
			}
			# Gestalt Empire Effects
			triggered_modifier = {
				potential = {
					# Deckside Carnivals Approach
					current_situation_approach = situation_passenger_satisfaction_passenger
					check_variable = {
						which = passenger_satisfaction_index
						value > 0
					}
					owner? = {
						is_gestalt = yes
					}
				}
				# Crew Effects
				planet_stability_add = -10
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = 0.04
				pop_cat_cruise_passenger_unemployment_happiness = 0.04
			}
		}
		situation_passenger_satisfaction_stage_overworked = {
			icon = GFX_situation_stage_crew
			icon_background = GFX_situation_stage_frame_yellow
			end = 900
			on_first_enter = {
				situation_event = { id = nomads.1200 }
			}
			# Regular Empire Effects
			triggered_modifier = {
				potential = {
					# Crew Approach
					current_situation_approach = situation_passenger_satisfaction_crew
					owner? = {
						is_gestalt = no
					}
				}
				# Crew Effects
				pop_citizen_happiness = -0.25
				# Passenger Effects
				pop_cat_cruise_passenger_political_power = 1
				pop_cat_cruise_passenger_unemployment_political_power = 1
			}
			triggered_modifier = {
				potential = {
					# Neutral Approach
					current_situation_approach = situation_passenger_satisfaction_balanced
					owner? = {
						is_gestalt = no
					}
				}
				# Crew Effects
				pop_citizen_happiness = -0.33
				# Passenger Effects
				pop_cat_cruise_passenger_political_power = 2.5
				pop_cat_cruise_passenger_unemployment_political_power = 2.5
			}
			triggered_modifier = {
				potential = {
					# Passenger Approach
					current_situation_approach = situation_passenger_satisfaction_passenger
					owner? = {
						is_gestalt = no
					}
				}
				# Crew Effects
				pop_citizen_happiness = -0.50
				# Passenger Effects
				pop_cat_cruise_passenger_political_power = 5
				pop_cat_cruise_passenger_unemployment_political_power = 5
			}
			# Gestalt Empire Effects
			triggered_modifier = {
				potential = {
					# Crew Approach
					current_situation_approach = situation_passenger_satisfaction_crew
					owner? = {
						is_gestalt = yes
					}
				}
				# Crew Effects
				planet_stability_add = -10
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = 0.02
				pop_cat_cruise_passenger_unemployment_happiness = 0.02
			}
			triggered_modifier = {
				potential = {
					# Neutral Approach
					current_situation_approach = situation_passenger_satisfaction_balanced
					owner? = {
						is_gestalt = yes
					}
				}
				# Crew Effects
				planet_stability_add = -25
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = 0.05
				pop_cat_cruise_passenger_unemployment_happiness = 0.05
			}
			triggered_modifier = {
				potential = {
					# Passenger Approach
					current_situation_approach = situation_passenger_satisfaction_passenger
					owner? = {
						is_gestalt = yes
					}
				}
				# Crew Effects
				planet_stability_add = -33
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = 0.10
				pop_cat_cruise_passenger_unemployment_happiness = 0.10
			}
		}
		situation_passenger_satisfaction_stage_stressed = {
			icon = GFX_situation_stage_crew
			icon_background = GFX_situation_stage_frame_orange
			end = 999
			on_first_enter = {
				situation_event = { id = nomads.1250 }
			}
			# Regular Empire Effects
			triggered_modifier = {
				potential = {
					# Crew Approach
					current_situation_approach = situation_passenger_satisfaction_crew
					owner? = {
						is_gestalt = no
					}
				}
				# Crew Effects
				pop_citizen_happiness = -0.33
				# Passenger Effects
				pop_cat_cruise_passenger_political_power = 2.5
				pop_cat_cruise_passenger_unemployment_political_power = 2.5
			}
			triggered_modifier = {
				potential = {
					# Neutral Approach
					current_situation_approach = situation_passenger_satisfaction_balanced
					owner? = {
						is_gestalt = no
					}
				}
				# Crew Effects
				pop_citizen_happiness = -0.50
				# Passenger Effects
				pop_cat_cruise_passenger_political_power = 5
				pop_cat_cruise_passenger_unemployment_political_power = 5
			}
			triggered_modifier = {
				potential = {
					# Passenger Approach
					current_situation_approach = situation_passenger_satisfaction_passenger
					owner? = {
						is_gestalt = no
					}
				}
				# Crew Effects
				pop_citizen_happiness = -0.67
				# Passenger Effects
				pop_cat_cruise_passenger_political_power = 10
				pop_cat_cruise_passenger_unemployment_political_power = 10
			}
			# Gestalt Empire Effects
			triggered_modifier = {
				potential = {
					# Crew Approach
					current_situation_approach = situation_passenger_satisfaction_crew
					owner? = {
						is_gestalt = yes
					}
				}
				# Crew Effects
				planet_stability_add = -25
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = 0.05
				pop_cat_cruise_passenger_unemployment_happiness = 0.05
			}
			triggered_modifier = {
				potential = {
					# Neutral Approach
					current_situation_approach = situation_passenger_satisfaction_balanced
					owner? = {
						is_gestalt = yes
					}
				}
				# Crew Effects
				planet_stability_add = -33
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = 0.10
				pop_cat_cruise_passenger_unemployment_happiness = 0.10
			}
			triggered_modifier = {
				potential = {
					# Passenger Approach
					current_situation_approach = situation_passenger_satisfaction_passenger
					owner? = {
						is_gestalt = yes
					}
				}
				# Crew Effects
				planet_stability_add = -50
				# Passenger Effects
				pop_cat_cruise_passenger_happiness = 0.25
				pop_cat_cruise_passenger_unemployment_happiness = 0.25
			}
		}
		situation_passenger_satisfaction_stage_mutiny = {
			end = 1000
			on_first_enter = {
				set_situation_approach = situation_passenger_satisfaction_balanced
				set_situation_locked = yes
				situation_event = { id = nomads.1025 }
			}
			triggered_modifier = {
				potential = {
					owner? = {
						is_gestalt = no
					}
				}
				# Crew Effects
				pop_citizen_happiness = -0.75
			}
			triggered_modifier = {
				potential = {
					owner? = {
						is_gestalt = yes
					}
				}
				# Crew Effects
				planet_stability_add = -67
			}
		}
	}
	approach = {
		name = situation_passenger_satisfaction_crew
		icon = GFX_situation_approach_balance_sheet
		icon_background = GFX_situation_approach_bg_yellow
		allow = {
			custom_tooltip = {
				fail_text = "situation_passenger_satisfaction_planetfall"
				owner? = {
					NOT = {	has_country_flag = forever_cruise_planetfall }
				}
			}
			custom_tooltip = {
				fail_text = "situation_passenger_satisfaction_mutiny"
				owner? = {
					NOT = {	has_country_flag = forever_cruise_mutiny }
				}
			}
		}
		on_select = {
			custom_tooltip = "situation_passenger_satisfaction_crew_approach_tt"
		}
		custom_tooltip_with_modifiers = "situation_passenger_satisfaction_crew_approach_tt"
		ai_weight = {
			base = 0
		}
	}
	approach = {
		name = situation_passenger_satisfaction_balanced
		icon = GFX_situation_approach_handshake
		icon_background = GFX_situation_approach_bg_green
		allow = {
			custom_tooltip = {
				fail_text = "situation_passenger_satisfaction_planetfall"
				owner? = {
					NOT = {	has_country_flag = forever_cruise_planetfall }
				}
			}
			custom_tooltip = {
				fail_text = "situation_passenger_satisfaction_mutiny"
				owner? = {
					NOT = {	has_country_flag = forever_cruise_mutiny }
				}
			}
		}
		on_select = {
			custom_tooltip = "situation_passenger_satisfaction_balanced_approach_tt"
		}
		default = yes
		ai_weight = {
			base = 10
		}
	}
	approach = {
		name = situation_passenger_satisfaction_passenger
		icon = GFX_situation_approach_amenities
		icon_background = GFX_situation_approach_bg_yellow
		allow = {
			custom_tooltip = {
				fail_text = "situation_passenger_satisfaction_planetfall"
				owner? = {
					NOT = {	has_country_flag = forever_cruise_planetfall }
				}
			}
			custom_tooltip = {
				fail_text = "situation_passenger_satisfaction_mutiny"
				owner? = {
					NOT = {	has_country_flag = forever_cruise_mutiny }
				}
			}
		}
		on_select = {
			custom_tooltip = "situation_passenger_satisfaction_passenger_approach_tt"
		}
		custom_tooltip_with_modifiers = "situation_passenger_satisfaction_passenger_approach_tt"
		ai_weight = {
			base = 0
		}
	}
	on_monthly = {
		events = {
			nomads.1055	# Check Planetfall demands
			nomads.1255	# Check Mutiny demands
		}
	}
	monthly_progress = {
		base = 0
		# Modifiers are defined in tooltip order, most important first
		modifier = {
			add = 0.5
			desc = "situation_passenger_satisfaction_bio_trophy_needs"
			owner = { is_hospitality_servitor_empire = yes }
		}
		modifier = {
			add = value:count_cruise_passengers
			desc = "count_cruise_passengers"
		}
		modifier = {
			add = value:count_cruise_passengers_unemployment
			desc = "count_cruise_passengers_unemployment"
			owner = { is_hospitality_servitor_empire = no }
		}
		modifier = {
			add = value:count_cruise_passengers_unemployment
			desc = "count_cruise_passengers_neglected_bio_trophies"
			owner = { is_hospitality_servitor_empire = yes }
		}
		modifier = {
			mult = 0.5
			desc = "situation_passenger_satisfaction_passenger"
			check_variable = {
				which = passenger_satisfaction_index
				value < 0
			}
			NOR = {
				has_situation_flag = satisfaction_passengers_grace_period
				has_situation_flag = satisfaction_crew_grace_period
			}
			current_situation_approach = situation_passenger_satisfaction_passenger
		}
		modifier = {
			mult = 0.5
			desc = "situation_passenger_satisfaction_crew"
			check_variable = {
				which = passenger_satisfaction_index
				value > 0
			}
			NOR = {
				has_situation_flag = satisfaction_passengers_grace_period
				has_situation_flag = satisfaction_crew_grace_period
			}
			current_situation_approach = situation_passenger_satisfaction_crew
		}
		modifier = {
			mult = 0.5
			desc = "situation_passenger_satisfaction_stage_steady"
			NOR = {
				has_situation_flag = satisfaction_passengers_grace_period
				has_situation_flag = satisfaction_crew_grace_period
			}
			current_stage = situation_passenger_satisfaction_stage_steady
		}
		modifier = {
			mult = value:passenger_unity_satisfaction_mult
			desc = "building_forever_cruise_passenger_unity_situation_slowdown"
			check_variable = {
				which = passenger_satisfaction_index
				value < 0
			}
			OR = {
				current_stage = situation_passenger_satisfaction_stage_steady
				current_stage = situation_passenger_satisfaction_stage_bored
				current_stage = situation_passenger_satisfaction_stage_incensed
			}
			NOR = {
				has_situation_flag = satisfaction_passengers_grace_period
				has_situation_flag = satisfaction_crew_grace_period
			}
			owner = {
				any_owned_colony = {
					has_active_building = building_forever_cruise_passenger_unity
				}
			}
		}
		modifier = {
			mult = value:crew_industry_satisfaction_mult
			desc = "building_forever_cruise_crew_industry_situation_slowdown"
			check_variable = {
				which = passenger_satisfaction_index
				value > 0
			}
			OR = {
				current_stage = situation_passenger_satisfaction_stage_steady
				current_stage = situation_passenger_satisfaction_stage_overworked
				current_stage = situation_passenger_satisfaction_stage_stressed
			}
			NOR = {
				has_situation_flag = satisfaction_passengers_grace_period
				has_situation_flag = satisfaction_crew_grace_period
			}
			owner = {
				any_owned_colony = {
					has_active_building = building_forever_cruise_crew_industry
				}
			}
		}
		modifier = {
			mult = 0
			desc = "satisfaction_passengers_grace_period"
			has_situation_flag = satisfaction_passengers_grace_period
		}
		modifier = {
			mult = 0
			desc = "satisfaction_crew_grace_period"
			has_situation_flag = satisfaction_crew_grace_period
		}
		modifier = {
			mult = 2.0
			desc = "FE_DIFFICULTY"
			is_difficulty = 6
		}
		modifier = {
			mult = 1.75
			desc = "FE_DIFFICULTY"
			is_difficulty = 5
		}
		modifier = {
			mult = 1.5
			desc = "FE_DIFFICULTY"
			is_difficulty = 4
		}
		modifier = {
			mult = 1.25
			desc = "FE_DIFFICULTY"
			is_difficulty = 3
		}
		modifier = {
			mult = 1
			desc = "FE_DIFFICULTY"
			is_difficulty = 2
		}
		modifier = {
			mult = 0.5
			desc = "FE_DIFFICULTY"
			is_difficulty = 1
		}
		modifier = {
			mult = 0.25
			desc = "FE_DIFFICULTY"
			is_difficulty = 0
		}
		modifier = {
			mult = 0
			desc = "situation_passenger_satisfaction_planetfall"
			owner = {
				has_country_flag = forever_cruise_planetfall
			}
		}
		modifier = {
			mult = 0
			desc = "situation_passenger_satisfaction_mutiny"
			owner = {
				has_country_flag = forever_cruise_mutiny
			}
		}
	}
	triggered_modifier = {
		potential = {
			owner = { has_country_flag = deferred_maintenance }
		}
		planet_structures_upkeep_mult = 0.25
	}
	triggered_modifier = {
		potential = {
			owner = { has_country_flag = passenger_entertainment_programs }
		}
		pop_category_cruise_passenger_consumer_goods_upkeep_add = 0.25
	}
	triggered_modifier = {
		potential = {
			owner = { has_country_flag = double_crew_shifts }
		}
		arkship_action_speed = -0.25
	}
	triggered_modifier = {
		potential = {
			owner = { has_country_flag = mandatory_crew_rest }
		}
		specialist_and_complex_drone_cat_bonus_workforce_mult = -0.10
	}
	triggered_modifier = {
		potential = {
			owner = { has_country_flag = scaled_back_passenger_programs }
		}
		planet_cruise_passengers_unity_produces_mult = -0.50
	}
	triggered_modifier = {
		potential = {
			owner = { has_country_flag = empowered_crew_leaders }
		}
		leaders_upkeep_mult = 0.5
	}
	triggered_blocked_desc = {
		trigger = {
			owner = { has_country_flag = forever_cruise_planetfall }
		}
		text = "situation_passenger_satisfaction_blocked_planetfall"
	}
	triggered_blocked_desc = {
		trigger = {
			owner = { has_country_flag = forever_cruise_mutiny }
		}
		text = "situation_passenger_satisfaction_blocked_mutiny"
	}
}

# A Core Conspiracy

situation_core_conspiracy = {
	picture = GFX_evt_glitchy_matrix
	initial_progress = 50
	progress_direction = bidirectional
	complete_icon_frame = GFX_situation_outcome_frame_blue
	complete_icon = GFX_situation_outcome_unknown
	fail_icon_frame = GFX_situation_outcome_frame_blue
	fail_icon = GFX_situation_outcome_unknown
	situation_log_category = developments
	on_start = {
		set_situation_locked = yes
		owner = { set_country_flag = nomadic_narrative_situation }
	}

	monthly_progress = {
		modifier = {
			desc = string_current_approach
			current_situation_approach = approach_caeli
			add = 1
		}
		modifier = {
			desc = string_current_approach
			current_situation_approach = approach_steris
			subtract = 1
		}
		modifier = {
			desc = speed_up_core_conspiracy
			has_situation_flag = speed_up_flag
			factor = 1.5
		}
		modifier = {
			desc = slow_down_core_conspiracy
			has_situation_flag = slow_down_flag
			divide = 2
		}
	}

	approach = {
		name = approach_steris
		icon = GFX_situation_approach_flight
		icon_background = GFX_situation_approach_bg_green
		on_select = {
			custom_tooltip = approach_outcome_steris
			set_situation_flag = siding_steris
			remove_situation_flag = siding_caeli
		}
		resources = {
			category = situations
			upkeep = {
				energy = 15
			}
			upkeep = {
				unity = 5
			}
		}
	}

	approach = {
		name = approach_caeli
		icon = GFX_situation_approach_amenities
		icon_background = GFX_situation_approach_bg_green
		on_select = {
			custom_tooltip = approach_outcome_caeli
			set_situation_flag = siding_caeli
			remove_situation_flag = siding_steris
		}
		resources = {
			category = situations
			upkeep = {
				energy = 5
			}
			upkeep = {
				unity = 15
			}
		}
	}

	on_fail = { #steris
		custom_tooltip = approach_outcome_steris
		hidden_effect = {
			situation_event = { id = arkship.725 }
		}
	}

	stages = {
		stage_3 = { #steris
			icon = GFX_situation_stage_3
			icon_background = GFX_situation_stage_frame_red
			end = 20
			on_first_enter = {
				situation_event = { id = arkship.716 }
			}
			custom_tooltip = approach_outcome_steris
		}

		stage_2 = { #steris
			icon = GFX_situation_stage_2
			icon_background = GFX_situation_stage_frame_green
			end = 40
			on_first_enter = {
				situation_event = { id = arkship.705 }
				set_situation_flag = siding_steris
			}
			custom_tooltip = approach_outcome_steris
		}

		stage_1 = {
			icon = GFX_situation_stage_1
			icon_background = GFX_situation_stage_frame_blue
			end = 60
		}

		stage_2_alt = { #caeli
			icon = GFX_situation_stage_2
			icon_background = GFX_situation_stage_frame_green
			end = 80
			on_first_enter = {
				situation_event = { id = arkship.710 }
			}
			custom_tooltip = approach_outcome_caeli
		}

		stage_3_alt = { #caeli
			icon = GFX_situation_stage_3
			icon_background = GFX_situation_stage_frame_red
			end = 100
			on_first_enter = {
				situation_event = { id = arkship.721 }
			}
			custom_tooltip = approach_outcome_caeli
		}
	}

	on_progress_complete = { #caeli
		custom_tooltip = approach_outcome_caeli
		hidden_effect = {
			situation_event = { id = arkship.730 }
		}
	}

	# Events
	on_monthly = {
		events = {
			arkship.715
			arkship.717
			arkship.720
			arkship.722
		}
		random_events = {
			30 = 0          # No event this month
			1 = arkship.750 # Random event supporting caeli
			1 = arkship.755 # Random event supporting caeli
			1 = arkship.770 # Random event supporting caeli
			1 = arkship.760 # Random event supporting steris
			1 = arkship.765 # Random event supporting steris
			1 = arkship.775 # Random event supporting steris
			1 = arkship.780 # Random event supporting steris
		}
	}

	on_abort = {
		owner = {
			hidden_effect = { country_event = { id = arkship.1 days = @long_arkship_event_delay_days random = @long_arkship_event_delay_random } }
		}
	}

	abort_trigger = {
		OR = {
			NOT = { exists = target.owner }
			target.owner = { NOT = { is_same_value = root.owner } }
		}
	}
}

### Nomad Mineral Situation
situation_nomad_economy = {
	picture = GFX_evt_waystation
	situation_log_category = empire_concerns

	category = neutral

	initial_progress	= 10000
	total_progress		= {
		base = 0
		add = owner.value:nomad_max_operational_reserves
	}

	override_finisher_title = situation_nomad_economy_capacity_title
	override_finisher_desc = nomad_max_reserves_breakdown
	override_progress_current_desc = situation_nomad_economy_reserves_current

	abort_trigger = {
		OR = {
			NOT = { exists = owner }
			owner = {
				is_nomadic = no
			}
		}
	}

	on_start = {
		set_situation_approach = situation_nomad_economy_smooth_spending
	}

	on_fail = {}

	on_progress_complete = {}

	permanent = yes
	show_in_outliner = no

	stages = {
		situation_nomad_economy_stage_critical = {
			icon = GFX_situation_stage_1
			icon_background = GFX_situation_stage_frame_red
			color = warning_red
			section_weight = 5
			modifier = {
				ship_fire_rate_mult = -0.5
				ship_shield_mult = -0.5
				ship_armor_mult = -0.5
				planet_stability_add = -5
				country_physics_research_produces_mult = -0.75
				country_society_research_produces_mult = -0.75
				country_engineering_research_produces_mult = -0.75
				country_unity_produces_mult = -0.75
				country_alloys_produces_mult = -0.75
			}
			triggered_modifier = {
				potential = {
					owner = {
						any_owned_species = {
							is_archetype = LITHOID
						}
					}
				}
				modifier = {
					lithoid_pop_happiness = -0.25
					lithoid_logistic_growth_mult = -0.75
					lithoid_pop_bonus_workforce_mult = -0.75
				}
			}
			triggered_modifier = {
				potential = {
					owner = {
						any_owned_species = {
							is_robotic = yes
						}
					}
				}
				modifier = {
					robotic_pop_bonus_workforce_mult = -0.75
				}
			}
		}
		situation_nomad_economy_stage_1_struggle = {
			icon = GFX_situation_stage_2
			icon_background = GFX_situation_stage_frame_orange
			color = light_orange
			section_weight = 20
			modifier = {
				ship_fire_rate_mult = -0.25
				ship_shield_mult = -0.25
				ship_armor_mult = -0.25
				planet_stability_add = -3
			}
		}
		situation_nomad_economy_stage_2_stable = {
			icon = GFX_situation_stage_3
			icon_background = GFX_situation_stage_frame_blue
			color = white
			section_weight = {
				base = 50
				modifier = {
					owner? = {
						OR = {
							has_valid_civic = civic_shared_burden
							is_worker_coop_empire = yes
						}
					}
					factor = 1.5
				}
			}
			modifier = {
				planet_stability_add = 5
			}
		}
		situation_nomad_economy_stage_3_thriving = {
			icon = GFX_situation_stage_4
			icon_background = GFX_situation_stage_frame_green
			color = light_green
			section_weight = 25
			modifier = {
				planet_stability_add = 10
				all_technology_research_speed = 0.1
			}
		}
	}

	approach = {
		name = situation_nomad_economy_stringent_budget
		icon = GFX_situation_approach_nomad_neutral
		icon_background = GFX_situation_approach_bg_yellow
		on_select = {
			custom_tooltip = "situation_nomad_economy_stringent_budget_tt"
			hidden_effect = {
				owner = {
					country_event = {
						id = nomads.37
					}
				}
			}
		}
		default = yes
		ai_weight = {
			base = 0
			modifier = {
				add = 50
				owner = {
					any_situation = {
						is_situation_type = situation_nomad_economy
						nomad_in_reserve_crisis = yes
					}
				}
			}
		}

		modifier = {
			planet_jobs_upkeep_mult = -0.5
			specialist_and_complex_drone_cat_bonus_workforce_mult = -0.5
		}
	}

	approach = {
		name = situation_nomad_economy_smooth_spending
		icon = GFX_situation_approach_nomad_good
		icon_background = GFX_situation_approach_bg_green
		on_select = {
			custom_tooltip = "situation_nomad_economy_smooth_spending_tt"
		}
		ai_weight = {
			base = 10
		}
		modifier = {
		}
	}

	approach = {
		name = situation_nomad_economy_full_spending
		icon = GFX_situation_approach_nomad_very_good
		icon_background = GFX_situation_approach_bg_green
		allow = {
			custom_tooltip = {
				fail_text = no_situation_progress
				owner = {
					any_situation = {
						is_situation_type = situation_nomad_economy
						NOT = { nomad_in_reserve_crisis = yes }
					}
				}
			}
		}
		on_select = {
			custom_tooltip = "situation_nomad_economy_full_spending_tt"
		}
		ai_weight = {
			base = 0
			modifier = {
				add = 50
				owner = {
					any_situation = {
						is_situation_type = situation_nomad_economy
						situation_progress_percent >= @ai_nomad_full_spending_reserve_percent
					}
				}
			}
		}
		modifier = {
			planet_building_build_speed_mult = 0.5
			specialist_and_complex_drone_cat_bonus_workforce_mult = 0.5
		}
	}

	approach = {
		name = situation_nomad_economy_harvest_everything
		icon = GFX_situation_approach_nomad_emergency
		icon_background = GFX_situation_approach_bg_yellow
		potential = {
			owner? = {
				is_star_seeker_empire = yes
			}
		}
		allow = {
			custom_tooltip = {
				fail_text = no_arkship_is_encamped
				owner = {
					any_owned_ship = {
						is_arkship_ship = yes
						is_system_locked = yes
					}
				}
			}
			custom_tooltip = {
				fail_text = no_situation_progress
				owner = {
					# A running Festival stays valid even if its reserve drain dips into the crisis band; starting one still cannot.
					OR = {
						has_country_flag = celebration_active
						any_situation = {
							is_situation_type = situation_nomad_economy
							NOT = { nomad_in_reserve_crisis = yes }
						}
					}
				}
			}
		}
		on_select = {
			custom_tooltip = "situation_nomad_economy_harvest_everything_tt"
		}
		modifier = {
			pop_bonus_workforce_mult = 1
			planet_jobs_produces_mult = 1
			logistic_growth_mult = 1
			diplo_weight_economy_mult = -0.75
		}
		ai_weight = {
			base = 0
		}
	}
	on_monthly = {
		events = {
			nomads.38		# Festival duration countdown
		}
	}
	monthly_progress = {
		base = 0
		# Modifiers are defined in tooltip order, most important first
		modifier = {
			subtract = value:nomad_celebration_upkeep
			desc = "Celebration_Approach"
			current_situation_approach = situation_nomad_economy_harvest_everything
		}
	}
	triggered_blocked_desc = {
		trigger = {
			current_stage = situation_nomad_economy_stage_critical
		}
		text = situation_nomad_economy_critical_reserves_desc
	}
}

# The Grand Refurbishment

situation_grand_refurbishment = {
	picture = GFX_evt_arkship_crisis
	category = neutral
	situation_log_category = developments
	complete_icon_frame = GFX_situation_outcome_frame_green
	complete_icon = GFX_situation_outcome_positive

	on_start = {
		owner = {
			set_variable = {
				which = refurbishment_corners_cut
				value = 0
			}
			set_variable = {
				which = refurbishment_low_morale_count
				value = 0
			}
			set_variable = {
				which = refurbishment_construction_fatigue_count
				value = 0
			}
			set_country_flag = nomadic_narrative_situation
		}
	}

	monthly_progress = {
		base = 0
		modifier = {
			desc = approach_refurbishment_minimal
			current_situation_approach = approach_refurbishment_minimal
			add = 0.5
		}
		modifier = {
			desc = approach_refurbishment_standard
			current_situation_approach = approach_refurbishment_standard
			add = 1.5
		}
		modifier = {
			desc = approach_refurbishment_intensive
			current_situation_approach = approach_refurbishment_intensive
			add = 3
		}
		modifier = {
			mult = 0
			desc = situation_grand_refurbishment_paused_desc
			has_situation_flag = situation_grand_refurbishment_pause
		}
	}

	approach = {
		name = approach_refurbishment_minimal
		icon = GFX_situation_approach_handshake
		icon_background = GFX_situation_approach_bg_yellow
		on_select = {
			custom_tooltip = approach_outcome_refurbishment_minimal
		}
		resources = {
			category = situations
			upkeep = { energy = 5 }
			upkeep = { alloys = 5 }
		}
	}

	approach = {
		name = approach_refurbishment_standard
		icon = GFX_situation_approach_amenities
		icon_background = GFX_situation_approach_bg_yellow
		default = yes
		on_select = {
			custom_tooltip = approach_outcome_refurbishment_standard
		}
		resources = {
			category = situations
			upkeep = { energy = 10 }
			upkeep = { alloys = 10 }
		}
	}

	approach = {
		name = approach_refurbishment_intensive
		icon = GFX_situation_approach_alloys
		icon_background = GFX_situation_approach_bg_yellow
		on_select = {
			custom_tooltip = approach_outcome_refurbishment_intensive
		}
		resources = {
			category = situations
			upkeep = { energy = 20 }
			upkeep = { alloys = 20 }
		}
	}

	stages = {
		stage_refurbishment_generator = { # Power Generation Overhaul
			icon = GFX_situation_stage_1
			icon_background = GFX_situation_stage_frame_green
			end = 50
			target_modifier = {
				planet_district_ark_generator_build_speed_mult = -0.75
				planet_technician_produces_mult = -0.15
			}
		}

		stage_refurbishment_farming = { # Agricultural Systems Overhaul
			icon = GFX_situation_stage_2
			icon_background = GFX_situation_stage_frame_green
			end = 100
			target_modifier = {
				planet_district_ark_basic_build_speed_mult = -0.75
				planet_farmers_produces_mult = -0.15
			}
			on_first_enter = {
				target = {
					remove_modifier = refurbishment_low_morale
					remove_modifier = refurbishment_low_morale_2
					remove_modifier = refurbishment_low_morale_3
					remove_modifier = refurbishment_allowances_granted
				}
				situation_event = { id = arkship.1305 }
			}
		}

		stage_refurbishment_military = { # Defense Section Overhaul
			icon = GFX_situation_stage_3
			icon_background = GFX_situation_stage_frame_green
			end = 150
			target_modifier = {
				planet_district_ark_military_build_speed_mult = -0.75
				ship_armor_mult = -0.10
				ship_weapon_damage = -0.10
			}
			on_first_enter = {
				target = {
					remove_modifier = refurbishment_construction_fatigue
					remove_modifier = refurbishment_construction_fatigue_2
				}
				situation_event = { id = arkship.1310 }
			}
		}

		stage_refurbishment_city = { # Residential District Overhaul
			icon = GFX_situation_stage_4
			icon_background = GFX_situation_stage_frame_green
			end = 200
			target_modifier = {
				planet_district_ark_city_build_speed_mult = -0.75
				planet_housing_mult = -0.15
				worker_and_simple_drone_cat_bonus_workforce_mult = -0.12
			}
			on_first_enter = {
				target = {
					remove_modifier = refurbishment_power_restoration
					remove_modifier = refurbishment_extended_displacement
					remove_modifier = refurbishment_low_morale
					remove_modifier = refurbishment_low_morale_2
					remove_modifier = refurbishment_low_morale_3
				}
				situation_event = { id = arkship.1315 }
			}
		}
	}

	on_progress_complete = {
		custom_tooltip = situation_grand_refurbishment_complete.tt
		hidden_effect = {
			target = {
				remove_modifier = refurbishment_ongoing
				remove_modifier = refurbishment_administrative_burden
				remove_modifier = refurbishment_administrative_burden_gestalt
				remove_modifier = refurbishment_rework_zone
				remove_modifier = refurbishment_inspection_hold
				remove_modifier = refurbishment_bypass_routing
				remove_modifier = refurbishment_low_morale
				remove_modifier = refurbishment_low_morale_2
				remove_modifier = refurbishment_low_morale_3
			}
			situation_event = { id = arkship.1380 }
		}
	}

	on_monthly = {
		random_events = {
			50 = 0				# No event this month
			10 = arkship.1320 	# Stage 1: Sector Allocation Disputes
			10 = arkship.1325 	# Stage 1: Something Behind the Wall
			10 = arkship.1330 	# Stage 1: Disruption Allowances
			10 = arkship.1335 	# Stage 2: The Second Shift
			10 = arkship.1340 	# Stage 2: Conduit Failure
			10 = arkship.1345 	# Stage 2: The Major Concern
			10 = arkship.1350 	# Stage 3: First Section Online
			10 = arkship.1355 	# Stage 3: The Repair List
			10 = arkship.1360 	# Stage 3: Coming Home
			10 = arkship.1365 	# Stage 4: The Long Wait
			10 = arkship.1370 	# Stage 4: Unauthorized Modifications
			10 = arkship.1375 	# Stage 4: The Final Deck
		}
	}

	on_abort = {
		# Strip every modifier the situation can apply to the arkship so a new owner (e.g. one that conquered the
		# arkship) is not left stuck with situation modifiers and no situation to remove them. This handles the case
		# where the former owner survives the loss of the arkship; if the former owner is destroyed instead, on_abort
		# does not run in a valid scope, so the same cleanup is also driven from on_colony_transfer (via arkship.1450).
		target = {
			remove_grand_refurbishment_arkship_modifiers_effect = yes
		}
		owner = {
			hidden_effect = { country_event = { id = arkship.1 days = @long_arkship_event_delay_days random = @long_arkship_event_delay_random } }
		}
	}

	abort_trigger = {
		OR = {
			NOT = {
				exists = target.owner
			}
			target.owner = {
				NOT = {
					is_same_value = root.owner
				}
			}
		}
	}
}

### Arkship Lithoid Consume Planet
# Started by nomads.4750. Owner = consuming empire, Target = uncolonized planet.
# Aborts if the arkship leaves orbit for 6 months (tracked via arkship_absent_grace timed flag).
situation_arkship_lithoid_consume_planet = {
	complete_icon_frame = GFX_situation_outcome_frame_green
	complete_icon = GFX_situation_exploding_planet
	situation_log_category = empire_concerns

	inline_script = "situations/consume_world_planet_pictures"

	stages = {
		stage_1 = {
			icon = GFX_situation_stage_1
			icon_background = GFX_situation_stage_frame_green
			end = 1000
			custom_tooltip = stage_feed_feed_feed
		}
	}

	category = positive
	initial_progress = 0

	on_progress_complete = {
		custom_tooltip = terravore_consume_finish_tooltip
		hidden_effect = {
			situation_event = { id = nomads.4760 }
		}
	}
	on_monthly = {
		events = {
			nomads.4755
		}
	}
	on_abort = {
		owner = {
			every_owned_fleet = {
				limit = { has_fleet_flag = consuming_world_arkship@root.target }
				remove_fleet_flag = consuming_world_arkship@root.target
			}
		}
		target = {
			remove_planet_flag = being_devoured
			remove_modifier = being_devoured_modifier
			remove_planet_flag = arkship_absent_grace
			remove_carrier_flag = colony_event
		}
	}

	approach = {
		name = approach_devour
		on_select = { custom_tooltip = terravore_devour_effect }
		default = yes
		icon = GFX_situation_approach_amenities
		icon_background = GFX_situation_approach_bg_green
		ai_weight = { base = 10 }
	}

	monthly_progress = {
		base = 0
		modifier = {
			add = value:terravore_progress
			desc = string_terravore_progress
		}
		modifier = {
			desc = string_arkship_absent_grace
			mult = 0
			target = { has_planet_flag = arkship_absent_grace }
		}
	}

	triggered_blocked_desc = {
		trigger = {
			target = { has_planet_flag = arkship_absent_grace }
		}
		text = situation_arkship_consuming_world_absent_desc
	}

	abort_trigger = {
		OR = {
			NOT = { exists = target }
			target = {
				NOR = {
					has_planet_flag = arkship_absent_grace
					any_fleet_in_orbit = {
						has_fleet_flag = consuming_world_arkship@root.target
					}
				}
			}
		}
	}
}

### Arkship Nanotech Consume Planet
# Started by nomads.4800. Owner = consuming empire, Target = uncolonized planet.
# Aborts if the arkship leaves orbit for 6 months (tracked via arkship_absent_grace timed flag).
situation_arkship_nanotech_consume_planet = {
	complete_icon_frame = GFX_situation_outcome_frame_green
	complete_icon = GFX_situation_exploding_planet
	situation_log_category = developments

	inline_script = "situations/consume_world_planet_pictures"

	stages = {
		stage_1 = {
			icon = GFX_situation_stage_1
			icon_background = GFX_situation_stage_frame_green
			end = 1000
			custom_tooltip = stage_slushify
		}
	}

	category = positive
	initial_progress = 0

	on_progress_complete = {
		custom_tooltip = nanotech_consume_finish_tooltip
		hidden_effect = {
			situation_event = { id = nomads.4810 }
		}
	}
	on_monthly = {
		events = {
			nomads.4805
		}
	}
	on_abort = {
		owner = {
			every_owned_fleet = {
				limit = { has_fleet_flag = consuming_world_arkship@root.target }
				remove_fleet_flag = consuming_world_arkship@root.target
			}
		}
		target = {
			remove_planet_flag = being_devoured
			remove_modifier = being_devoured_modifier_nanotech
			remove_planet_flag = arkship_absent_grace
			remove_carrier_flag = colony_event
		}
	}

	approach = {
		name = approach_devour
		on_select = { custom_tooltip = nanotech_devour_effect }
		default = yes
		icon = GFX_situation_approach_amenities
		icon_background = GFX_situation_approach_bg_green
		ai_weight = { base = 10 }
	}

	monthly_progress = {
		base = 0
		modifier = {
			add = value:terravore_progress
			desc = string_terravore_progress
		}
		modifier = {
			desc = string_arkship_absent_grace
			mult = 0
			target = { has_planet_flag = arkship_absent_grace }
		}
	}

	triggered_blocked_desc = {
		trigger = {
			target = { has_planet_flag = arkship_absent_grace }
		}
		text = situation_arkship_consuming_world_absent_desc
	}

	abort_trigger = {
		OR = {
			NOT = { exists = target }
			target = {
				NOR = {
					has_planet_flag = arkship_absent_grace
					any_fleet_in_orbit = {
						has_fleet_flag = consuming_world_arkship@root.target
					}
				}
			}
		}
	}
}
