namespace = game_start

### Hidden Game Start Event
event = {
	id = game_start.1
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		every_country = {
			limit = { is_ai = no }
			country_event = { id = country.900 days = 360 random = 60 }
		}
		
		### SPAWN UNIQUE SYSTEMS
		# If any Empire is Commonwealth and UN is unplayed
		if = {
			limit = {
				any_country = { has_country_flag = human_2 }
				NOT = { any_country = { has_country_flag = human_1 } }
			}
			random_system = {
				spawn_system = { initializer = "com_sol_system" }
			}
			else = {
				# If there are no Sols
				if = {
					limit = {
						NOT = {
							any_system = {
								has_star_flag = sol
							}
						}
					}
					random_list = {
						60 = { }
						30 = {
							random_system = {
								spawn_system = { initializer = "special_init_03" }
							}
						}
						10 = {
							random_system = {
								spawn_system = { initializer = "special_init_04" }
							}
						}
					}
				}
			}
		}
	}
}

event = {
	id = game_start.2
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		every_country = {
			limit = { exists = capital_scope }
			capital_scope = {
				solar_system = {
					every_system_planet = {
						if = {
							limit = { has_modifier = hazardous_weather }
							remove_modifier = hazardous_weather
						}
						if = {
							limit = { has_modifier = dangerous_wildlife }
							remove_modifier = dangerous_wildlife
						}
						if = {
							limit = { has_modifier = weak_magnetic_field }
							remove_modifier = weak_magnetic_field
						}
						if = {
							limit = { has_modifier = strong_magnetic_field }
							remove_modifier = strong_magnetic_field
						}
						if = {
							limit = { has_modifier = unstable_tectonics }
							remove_modifier = unstable_tectonics
						}
						if = {
							limit = { has_modifier = tidal_locked }
							remove_modifier = tidal_locked
						}
						if = {
							limit = { has_modifier = chthonian_planet }
							remove_modifier = chthonian_planet
						}
						if = {
							limit = { has_modifier = asteroid_impacts }
							remove_modifier = asteroid_impacts
						}
						if = {
							limit = { has_modifier = extensive_moon_system }
							remove_modifier = extensive_moon_system
						}
						if = {
							limit = { has_modifier = carbon_world }
							remove_modifier = carbon_world
						}
						if = {
							limit = { has_modifier = wild_storms }
							remove_modifier = wild_storms
						}
						if = {
							limit = { has_modifier = low_gravity }
							remove_modifier = low_gravity
						}
						if = {
							limit = { has_modifier = high_gravity }
							remove_modifier = high_gravity
						}
						#if = {
						#	limit = { has_modifier = hollow_planet }
						#	remove_modifier = hollow_planet
						#}
						if = {
							limit = { has_modifier = mineral_rich }
							remove_modifier = mineral_rich
						}
						if = {
							limit = { has_modifier = ultra_rich }
							remove_modifier = ultra_rich
						}
						if = {
							limit = { has_modifier = mineral_poor }
							remove_modifier = mineral_poor
						}
						if = {
							limit = { has_modifier = titanic_life }
							remove_modifier = titanic_life
						}
						if = {
							limit = { has_modifier = mineral_poor }
							remove_modifier = mineral_poor
						}
						if = {
							limit = { has_modifier = asteroid_belt }
							remove_modifier = asteroid_belt
						}
						if = {
							limit = { has_modifier = natural_beauty }
							remove_modifier = natural_beauty
						}
						if = {
							limit = { has_modifier = atmospheric_aphrodisiac }
							remove_modifier = atmospheric_aphrodisiac
						}
						if = {
							limit = { has_modifier = atmospheric_hallucinogen }
							remove_modifier = atmospheric_hallucinogen
						}
						if = {
							limit = { has_modifier = lush_planet }
							remove_modifier = lush_planet
						}
						if = {
							limit = { has_modifier = bleak_planet }
							remove_modifier = bleak_planet
						}
						if = {
							limit = { has_modifier = irradiated_planet }
							remove_modifier = irradiated_planet
						}
					}
				}
			}
		}
	}
}

### Hidden Game Start Event that resets tutorial for advisor trigger purposes
event = {
	id = game_start.3
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		every_country = {
			limit = { is_ai = no }
			country_event = { id = tutorial.104 }
		}
	}
}

### Countdown to Horrid Swarm
event = {
	id = game_start.4
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		every_country = {
			limit = { is_ai = no }
			random_list = {
				10 = { country_event = { id = crisis.10 days = 43200 random = 500 } } # 120 years
				20 = { country_event = { id = crisis.10 days = 54000 random = 500 } } # 150 years
				30 = { country_event = { id = crisis.10 days = 72000 random = 500 } } # 200 years
				15 = { country_event = { id = crisis.10 days = 90000 random = 500 } } # 250 years
				25 = { } # No Prethoryn Invasion
			}
		}
	}
}