# Nuclear Anthem civic
decision_elec_districts = {
	owned_planets_only = yes
	icon = decision_divine_algorithm
	resources = {
		category = decisions
		cost = {
			energy = 100
			unity = 25
			mult = elec_aurora_capital_var
		}
	}
	potential = {
		owner = {
			OR = {
				has_civic = civic_elec_nuclear_anthem
				has_civic = civic_elec_h_nuclear_anthem
				has_origin = origin_elec_extradimensionals
			}
		}
		has_planet_flag = elec_aurora_capital
		check_variable = { which = elec_aurora_capital_var value < 90 }
	}
	effect = {
		custom_tooltip = decision_elec_districts_effects
		hidden_effect = {
			change_variable = { which = elec_aurora_capital_var value = 1 }
			add_modifier = { modifier = elec_aurora_capital_mod mult = elec_aurora_capital_var }
		}
	}
	ai_weight = { weight = 0 }
}

# Endless Horizon + Extradimensionals origin
decision_elec_ignite = {
	icon = decision_divine_algorithm
#	enactment_time = 30 # Its instant, otherwise the flag for the 2 year limitation could be avoided by starting many stars at once.
	resources = {
		category = decisions
		cost = {
			energy = 7500
			unity = 500
		}
	}
	potential = {
		exists = space_owner
		exists = from
		space_owner = { is_same_value = from }
		from = {
			OR = {
			has_origin = origin_elec_endless_horizon
			has_origin = origin_elec_extradimensionals
#			has_technology = tech_terrestrial_sculpting
			}
		}
		is_star = yes
		NOT = { is_planet_class = pc_black_hole }
	}
	allow = {
		custom_tooltip = {
			fail_text = requires_no_recent_elec_ignite
			from = { NOT = { has_country_flag = requires_no_recent_elec_explosion } }
		}
	}
	effect = {
		custom_tooltip = decision_elec_ignite_effects
		hidden_effect = {
			from = { set_timed_country_flag = { flag = requires_no_recent_elec_explosion days = 730 } }
			planet_event = { id = elec.5 }
		}
	}
	ai_weight = { weight = 0 }
}

decision_elec_eat_star = {
	icon = decision_divine_algorithm
	resources = {
		category = decisions
		cost = {
			energy = 1500
			influence = 35
		}
	}
	potential = {
		exists = space_owner
		exists = from
		space_owner = { is_same_value = from }
		from = {
			OR = {
				has_civic = civic_elec_starlifters
				has_civic = civic_elec_h_starlifters
			}
		}
		is_star = yes
		NOR = {
			is_planet_class = pc_black_hole
			is_planet_class = pc_t_star
			is_planet_class = pc_pulsar
			is_planet_class = pc_neutron_star
			has_planet_flag = got_eaten_by_electroids
		}
	}
	allow = {
		custom_tooltip = {
			fail_text = elec_recently_ate_star
			from = { NOT = { has_country_flag = elec_recently_ate_star } }
		}
		custom_tooltip = {
			fail_text = elec_cant_eat_star_with_mega
			NOR = {
				has_planet_flag = has_megastructure
				has_planet_flag = megastructure
			}
		}
	}
	effect = {
		custom_tooltip = decision_elec_eat_star_effects
		hidden_effect = {
			from = { set_timed_country_flag = { flag = elec_recently_ate_star days = 1 } } # 365
			from = { add_modifier = { modifier = elec_ate_star_mod days = 90 } }
			if = {
				limit = { planet_size > 15 }
				change_planet_size  = -1
				from = {
					add_resource = { unity = 30 mult = trigger:years_passed }
					capital_scope = { create_pop = { species = prev ethos = prev } }
				}
			}
# When it reaches size 10 or lower, the star will collapse. Average (normal) star size is between 15 - 30.
			if = {
				limit = { planet_size <= 15 }
				change_planet_size  = -1
				from = { capital_scope = { create_pop = { species = prev ethos = prev } } }
				random_list = {
					30 = {
						create_ambient_object = {
							type = "star_explosion"
							play_animation_once = yes
							location = this
						}
						last_created_ambient_object = {
							set_location = {
								target = prev
								distance = 0
								angle = random
							}
						}
						change_pc = pc_pulsar
						set_planet_flag = got_eaten_by_electroids
						solar_system = {
							set_star_flag = star_cracked
							set_star_class = sc_pulsar
						}
					}
					30 = {
						create_ambient_object = {
							type = "star_explosion"
							play_animation_once = yes
							location = this
						}
						last_created_ambient_object = {
							set_location = {
								target = prev
								distance = 0
								angle = random
							}
						}
						change_pc = pc_neutron_star
						set_planet_flag = got_eaten_by_electroids
						solar_system = {
							set_star_flag = star_cracked
							set_star_class = sc_neutron_star
						}
					}
					30 = {
						create_ambient_object = {
							type = "star_explosion"
							play_animation_once = yes
							location = this
						}
						last_created_ambient_object = {
							set_location = {
								target = prev
								distance = 0
								angle = random
							}
						}
						change_pc = pc_t_star
						set_planet_flag = got_eaten_by_electroids
						solar_system = {
							set_star_flag = star_cracked
							set_star_class = sc_t
						}
					}
					10 = {
						create_ambient_object = {
							type = "star_explosion"
							play_animation_once = yes
							location = this
						}
						last_created_ambient_object = {
							set_location = {
								target = prev
								distance = 0
								angle = random
							}
						}
						change_pc = pc_black_hole
						set_planet_flag = got_eaten_by_electroids
						solar_system = {
							set_star_flag = star_cracked
							set_star_class = sc_black_hole
						}
					}
				}
				solar_system = {
					every_system_planet = {
						limit = { is_colony = yes }
						remove_all_buildings = yes
						destroy_colony = yes
						if = {
							limit = { is_planet_class = pc_habitat }
							spawn_habitat_cracker_effect = yes
							remove_planet = yes
						}
					}
				}
			}
		}
	}
	ai_weight = { weight = 0 }
}

# Native Environment civic - nebula exists
decision_elec_native_environment = {
	owned_planets_only = yes
	sound = event_administrative_work
	icon = decision_strategic_resources
	resources = {
		category = decisions
		cost = {
			trigger = {
				num_pops < 10
			}
			sr_dark_matter = 100
		}
		cost = {
			trigger = {
				num_pops >= 10
				num_pops < 20
			}
			sr_dark_matter = 200
		}
		cost = {
			trigger = {
				num_pops >= 20
				num_pops < 30
			}
			sr_dark_matter = 300
		}
		cost = {
			trigger = {
				num_pops >= 30
				num_pops < 40
			}
			sr_dark_matter = 400
		}
		cost = {
			trigger = {
				num_pops >= 40
				num_pops < 50
			}
			sr_dark_matter = 500
		}
		cost = {
			trigger = {
				num_pops >= 50
				num_pops < 60
			}
			sr_dark_matter = 600
		}
		cost = {
			trigger = {
				num_pops >= 60
				num_pops < 70
			}
			sr_dark_matter = 700
		}
		cost = {
			trigger = {
				num_pops >= 70
				num_pops < 85
			}
			sr_dark_matter = 800
		}
		cost = {
			trigger = {
				num_pops >= 85
				num_pops < 100
			}
			sr_dark_matter = 900
		}
		cost = {
			trigger = {
				num_pops >= 100
			}
			sr_dark_matter = 1000
		}
	}
	potential = {
		is_inside_nebula = yes
		is_planet_class = pc_elec_aurora
		owner = {
			OR = {
				has_civic = civic_elec_native_environment
				has_civic = civic_elec_h_native_environment
			}
		}
	}
	allow = { NOT = { has_modifier = elec_dark_matter_boost } }
	effect = { add_modifier = { modifier = "elec_dark_matter_boost" days = 3600 } }
	ai_weight = { weight = 1 }
}

# Native Environment civic - nebula does not exist yet
decision_elec_native_nebula = {
	owned_planets_only = yes
	enactment_time = 730
	icon = decision_divine_algorithm
	resources = {
		category = decisions
		cost = {
			energy = 3500
			exotic_gases = 750
		}
	}
	potential = {
		is_inside_nebula = no
		is_planet_class = pc_elec_aurora
		owner = {
			OR = {
				has_civic = civic_elec_native_environment
				has_civic = civic_elec_h_native_environment
			}
		}
	}
	effect = {
		custom_tooltip = decision_elec_native_nebula_effects
		hidden_effect = {
			solar_system = {
				create_nebula = { radius = 30 }
			}
		}
	}
	ai_weight = { weight = 0 }
}