####################################
# Cosmic Storms - Special Projects #
####################################

###############################
## The Weather Manipulators ###
###############################

# descramble coordinates found in arcsite The Ancient Shelter
special_project = {
    key = "INETIAN_PROJECTS_01"
    event_chain = cs_inetian_chain
    icon = "gfx/interface/icons/situation_log/situation_log_radar.dds"
    picture = GFX_evt_poor_stormshelter
    sound = yes
    cost = 500
    days_to_research = 0
    timelimit = -1
    location = no

	event_scope = planet_event

	on_success = {
		from = {
			spawn_system = {
				min_distance = 10
				max_distance = 15
				initializer = "weathermanipulators_home_system"
				hyperlane = yes
				is_discovered = yes
			}
		}
		prev = {
			owner = {
				set_visited = last_created_system
				set_country_flag = wm_digsite_coordinates_found
				country_event = { id = cstorms.135 }
			}
		}
	}

	on_fail = {
	}
}

special_project = {
    key = INETIAN_PROJECTS_02
    event_chain = cs_inetian_chain
    icon = "gfx/interface/icons/situation_log/situation_log_radar.dds"
    picture = GFX_evt_weather_manipulators
    sound = yes

    tech_department = engineering_technology
    cost = 1000
    days_to_research = 0
    timelimit = -1

    abort_trigger = {
        NOR = {
            exists = from
            has_event_chain = cs_inetian_chain
        }
    }

	event_scope = planet_event

	on_success = {
		from = {
			owner = {
				country_event = { id = cstorms.176 }
			}
		}
	}
}

special_project = {
    key = INETIAN_PROJECTS_03
    event_chain = cs_inetian_chain
    icon = "gfx/interface/icons/situation_log/situation_log_radar.dds"
    picture = GFX_evt_poor_stormshelter
    sound = yes

	tech_department = society_technology
	cost = 1500
	event_scope = country_event

    abort_trigger = {
        NOT = { has_event_chain = cs_inetian_chain }
    }

    on_success = {
        country_event = {
            id = cstorms.185
        }
    }
}

special_project = {
    key = INETIAN_PROJECTS_04
    event_chain = cs_inetian_chain
    icon = "gfx/interface/icons/situation_log/situation_log_radar.dds"
    picture = GFX_evt_cosmic_storms_shroud_storm # Replace with final art
    sound = yes

    days_to_research = 180
    location = yes
    event_scope = ship_event

    requirements = {
        shipclass_science_ship = 1
        leader = scientist
        skill > 1
    }

    abort_trigger = {
    }

    on_success = {
        ship_event = {
            id = cstorms.195
        }
    }
}

##############################################
#### The adAkkaria Convention of Benevolence #
##############################################

special_project = {
	key = project_adakkaria_tracing_history
	event_chain = cs_adAkkaria_chain
	icon = "gfx/interface/icons/situation_log/situation_log_radar.dds"
	picture = GFX_evt_cosmic_storms_fleets_of_the_thrice_damned
	sound = yes

	days_to_research = 180
	location = yes
	event_scope = ship_event

	requirements = {
		shipclass_science_ship = 1
		leader = scientist
		skill > 1
	}

	abort_trigger = {
	}

	on_success = {
		prev = {
			owner = {
				country_event = {
					id = cstorms.2185
				}
			}
		}
	}
}

special_project = {
	key = project_adakkaria_benevolent_grounds
	event_chain = cs_adAkkaria_chain
	icon = "gfx/interface/icons/situation_log/situation_log_radar.dds"
	picture = GFX_evt_ship_in_orbit_2
	sound = yes

	days_to_research = 180
	location = yes
	event_scope = ship_event

	requirements = {
		shipclass_science_ship = 1
		leader = scientist
		skill > 1
	}

	abort_trigger = {
		NOR = {
			exists = from
			has_event_chain = cs_adAkkaria_chain
		}
	}

	on_success = {
		prev = {
			owner = {
				country_event = {
					id = cstorms.2250
				}
			}
		}
	}
}

special_project = {
	key = project_adakkaria_secrets_of
	event_chain = cs_adAkkaria_chain
	icon = "gfx/interface/icons/situation_log/situation_log_radar.dds"
	picture = GFX_evt_cosmic_storms_shroud_storm
	sound = yes

	days_to_research = 180
	location = yes
	event_scope = planet_event

	abort_trigger = {
		NOR = {
			exists = from
			has_event_chain = cs_adAkkaria_chain
		}
	}

	on_success = {
		prev = {
			owner = {
				country_event = {
					id = cstorms.2365
				}
			}
		}
	}
}

##############################################
#### The Storm Chasers #
##############################################

special_project = {
    key = PROJECT_TEMPEST_BREWING
    event_scope = country_event
    picture = GFX_evt_origin_stormchasers_specialproject
    tech_department = physics_technology
    cost = 1000

    on_success = {
        owner = {
            random_situation = {
                limit = {
                    is_situation_type = situation_stormfall
                }
                situation_event = { id = cstorms.3105 }
            }
        }
     }
}

# Storm Frenzy

special_project = {
	key = PROJECT_SOW_THE_BIG_ONE
	event_scope = country_event
	event_chain = cs_stormfrenzy_chain
	picture = GFX_evt_origin_stormchasers_specialproject

	tech_department = physics_technology
	cost = 8000

	requirements = {
		shipclass_science_ship = 1
		leader = scientist
	}

	abort_trigger = {
		NOR = {
			exists = from
			has_event_chain = cs_stormfrenzy_chain
		}
	}

	on_success = {
		country_event = {
			id = cstorms.3222
		}
	 }
}

special_project = {
	key = PROJECT_DARK_SEEDING
	event_scope = country_event
	event_chain = cs_stormfrenzy_chain
	picture = GFX_evt_origin_stormchasers_specialproject
	cost = 10000
	tech_department = physics_technology

	requirements = {
		shipclass_science_ship = 1
		leader = scientist
	}

	abort_trigger = {
		NOR = {
			exists = from
			has_event_chain = cs_stormfrenzy_chain
		}
	}

	on_success = {
		country_event = {
			id = cstorms.3224
		}
	}
}

special_project = {
	key = PROJECT_EVERY_ITEM_ON_THE_MENU
	event_scope = country_event
	event_chain = cs_stormfrenzy_chain
	picture = GFX_evt_origin_stormchasers_specialproject
	days_to_research = 600
	tech_department = physics_technology

	requirements = {
		shipclass_science_ship = 1
		leader = scientist
	}

	abort_trigger = {
		NOR = {
			exists = from
			has_event_chain = cs_stormfrenzy_chain
		}
	}

	on_success = {
		country_event = {
			id = cstorms.3227
		}
	}
}

special_project = { #Triggered if player doesn't have enough resources
	key = PROJECT_EVERY_ITEM_ON_THE_MENU_REPEAT
	event_scope = country_event
	event_chain = cs_stormfrenzy_chain
	picture = GFX_evt_origin_stormchasers_specialproject
	days_to_research = 180
	tech_department = physics_technology

	abort_trigger = {
		NOR = {
			exists = from
			has_event_chain = cs_stormfrenzy_chain
		}
	}

	on_success = {
		country_event = {
			id = cstorms.3226
		}
	}
}
######################
#### Collided Planet #
######################

special_project = {
    key = project_cosmic_storms_collidedplanet_stabilize
    event_scope = planet_event
    event_chain = cs_collided_planet_chain
    picture = GFX_evt_cosmic_storms_collided_planets

    tech_department = society_technology
    cost = 5000

    location = yes
    timelimit = @collided_planet_days_before_collapse

    abort_trigger = {
        NOR = {
            exists = event_target:collided_planets
            is_same_value = event_target:collided_planets.owner
        }
    }

    on_success = {
        random_list = {
            95 = { # Success: terraform choice
                carrier_event = {
                    id = cstorms.1220
                }
            }
            5 = { # Great Success: Gaia planet
                carrier_event = {
                    id = cstorms.1225
                }
            }
        }
    }
}


special_project = {
    key = project_cosmic_storms_collidedplanet_harmonize
    event_scope = planet_event
    event_chain = cs_collided_planet_chain
    picture = GFX_evt_cosmic_storms_collided_planets

    tech_department = society_technology
    cost = 5000

    location = yes

    timelimit = @collided_planet_days_before_collapse

    abort_trigger = {
        NOR = {
            exists = event_target:collided_planets
            is_same_value = event_target:collided_planets.owner
        }
    }

    on_success = {
        random_list = {
            33 = { # Success! Gaia planet
                carrier_event = {
                    id = cstorms.1225
                }
            }
            63 = {
                carrier_event = {
                    id = cstorms.1230
                }
            }
            4 = {
                carrier_event = {
                    id = cstorms.1235
                }
            }
        }
     }
}

##########################
#### Crimson Crawlers ####
##########################

special_project = {
	key = project_cosmic_storms_crimson_crawlers
	event_chain = cs_crimson_crawlers_chain
	event_scope = planet_event
	picture = GFX_evt_crimson_crawlers
	days_to_research = 180
	tech_department = society_technology
	cost = 0
	location = Yes

	requirements = {
		shipclass_science_ship = 1
		leader = scientist
	}

	on_success = {
		from.owner = {
			country_event = {
				id = cstorms.1260
			}
		}
	}
}

###########################
#### But they are cute ####
###########################

special_project = {
	key = project_cosmic_storms_but_they_are_cute
	event_chain = cs_but_they_are_cute_chain
	event_scope = ship_event
	picture = GFX_evt_but_they_are_cute
	days_to_research = 60
	tech_department = society_technology
	cost = 0
	location = Yes

	requirements = {
		shipclass_science_ship = 1
		leader = scientist
	}

	on_success = {
		from = {
			ship_event = { id = cstorms.1505 }
		}
	}
}

####################
#### Stormbound ####
####################

special_project = {
	key = project_cosmic_storms_stormbound
	event_scope = ship_event
	event_chain = cs_stormbound_chain
	picture = GFX_evt_cosmic_storms_stormbound

	tech_department = physics_technology
	cost = 0

	days_to_research = 1
	location = yes

	fail_trigger = {
		fromfrom.solar_system = { NOT = { has_star_flag = storm_system } }
	}

	requirements = {
		shipclass_science_ship = 1
		leader = scientist
	}

	on_success = {
		root = {
			ship_event = { id = cstorms.1320 }
		}
	}

	on_fail = {
		solar_system = { system_event = { id = cstorms.1325 } }
	}
}

####################
# Eye of the Storm #
####################

# One Project per type since each project has a different picture
special_project = {
	inline_script = {
		script = cosmic_storms/EyeOfTheStormSpecialProjects
		TYPE = gravity_storm
	}
}
special_project = {
	inline_script = {
		script = cosmic_storms/EyeOfTheStormSpecialProjects
		TYPE = celestial_storm
	}
}
special_project = {
	inline_script = {
		script = cosmic_storms/EyeOfTheStormSpecialProjects
		TYPE = electric_storm
	}
}
special_project = {
	inline_script = {
		script = cosmic_storms/EyeOfTheStormSpecialProjects
		TYPE = particle_storm
	}
}
special_project = {
	inline_script = {
		script = cosmic_storms/EyeOfTheStormSpecialProjects
		TYPE = solar_storm
	}
}
special_project = {
	inline_script = {
		script = cosmic_storms/EyeOfTheStormSpecialProjects
		TYPE = magnetic_storm
	}
}
special_project = {
	inline_script = {
		script = cosmic_storms/EyeOfTheStormSpecialProjects
		TYPE = shroud_storm
	}
}
special_project = {
	inline_script = {
		script = cosmic_storms/EyeOfTheStormSpecialProjects
		TYPE = nexus_storm
	}
}

##################
# Storm in a Box #
##################

special_project = {
	key = STORM_IN_A_BOX_INVESTIGATE_PROJECT
	days_to_research = 360
	timelimit = -1
	picture = GFX_evt_astral_rift_psionic_stranger_2
	icon = "gfx/interface/icons/situation_log/situation_log_quest.dds"

	event_scope = ship_event

	requirements = {
		shipclass_science_ship = 1
		leader = scientist
	}

	on_success = {
		ship_event = { id = cstorms.1820 }
	}
}

special_project = {
	key = STORM_IN_A_BOX_TRAP_PROJECT
	days_to_research = 180
	timelimit = -1
	picture = GFX_evt_astral_rift_psionic_stranger_2
	icon = "gfx/interface/icons/situation_log/situation_log_quest.dds"

	event_scope = ship_event

	requirements = {
		shipclass_science_ship = 1
		leader = scientist
	}

	on_success = {
		ship_event = { id = cstorms.1825 }
	}
}

special_project = {
	key = "CLEAR_DUSTY_PIPES_PROJECT"
	cost = 1000
	tech_department = society_technology
	icon = "gfx/interface/icons/situation_log/situation_log_planet.dds"
	picture = GFX_evt_cosmic_storms_celestial_storm

	event_scope = planet_event

	on_success = {
		carrier_event = { id = cstorms.1765 }
	}
}

special_project = {
	key = FORENSIC_DISSECTION_PROJECT
	days_to_research = 180
	timelimit = -1
	picture = GFX_evt_astral_rift_ancient_battlegrounds_leviathan
	icon = "gfx/interface/icons/situation_log/situation_log_quest.dds"

	event_scope = ship_event

	requirements = {
		shipclass_science_ship = 1
		leader = scientist
	}

	on_success = {
		ship_event = { id = cstorms.5085 }
	}
}

special_project = {
	key = REUNITE_POD_PROJECT
	days_to_research = 180
	timelimit = 720
	picture = GFX_evt_tiyanki_family
	icon = "gfx/interface/icons/situation_log/situation_log_quest.dds"

	event_scope = ship_event

	requirements = {
		shipclass_science_ship = 1
		leader = scientist
	}

	on_success = {
		ship_event = { id = cstorms.5095 }
	}
}
