##########################################################################
# Decisions
##########################################################################

######################## UPGRADE DECISION ######################## 

#decision_transform_into_super_awesome = { ######## Overwrite to allow planets with t4 orbital rings to upgrade to voidsphere
#	owned_planets_only = yes
#	sound = acot_decision_sound
#
#	resources = {
#		category = decisions
#		cost = {
#			energy = 1000000
#			minerals = 1000000
#			alloys = 500000
#			unity = 500000
#			acot_sr_dark_energy = 250000
#			sr_dark_matter = 250000
#		}
#	}
#	
#	allow = {
#		NOR = {
#			has_modifier = acot_modifier_fractured_lifeforms
#			has_modifier = acot_modifier_fractured_machines
#			has_modifier = acot_modifier_fractured_mutants
#			has_modifier = acot_modifier_fractured_plants
#			has_modifier = acot_modifier_fractured_sentient_crystal
#			has_deposit = d_acot_void_chasm
#			has_deposit = d_acot_void_terrain
#			has_deposit = d_acot_void_rift
#		}
#		has_enigmatic_capital = yes
#		exists = orbital_defence
#		orbital_defence = {
#			OR = {
#				is_ship_size = acot_precusor_orbital_ring_t4
#				is_ship_size = acot_precusor_orbital_ring_t5
#			}
#		}
#	}
#
#	prerequisites = {
#		tech_acot_create_enigmapolis
#	}
#
#	potential = {
#		is_planet_class = pc_acot_enigmatic
#		NOT = {
#			has_planet_flag = has_enigmapolis_project
#		}
#	}
#	
#	effect = {
#		hidden_effect = {
#			set_planet_flag = has_enigmapolis_project
#			planet_event = { id = acot_planets.6 }
#			enable_special_project = {
#				name = ACOT_CREATE_ENIGMAPOLIS
#				location = this
#			}
#		}
#	}
#	
#	ai_weight = {
#		weight = 200
#	}
#}

decision_transform_into_ultra_awesome = {
	owned_planets_only = yes
	sound = choose_ascension_perk_01

	resources = {
		category = decisions
		cost = {
			energy = 5000000
			minerals = 5000000
			alloys = 2500000
			sm_sr_perfect_runic_energy = 250
			influence = 250
		}
	}

	allow = {
		exists = orbital_defence
		orbital_defence = {
			is_ship_size = acot_precusor_orbital_ring_t5 
		}
	}
	
	prerequisites = {
		tech_precursor_theia_design
	}

	potential = {
		is_planet_class = pc_acot_enigmopolis
		owner = {
			NOT = {
				has_country_flag = theta_soulsphere_underway
			}
		}
	}
	
	effect = {
		set_planet_flag = has_megastructure
		set_planet_flag = has_soulsphere_project
		planet_event = { id = shroud_master_soulsphere.0 }
	}
	
	ai_weight = {
		weight = 0
	}
}

decision_transform_into_ultra_awesome_2 = {
	owned_planets_only = yes
	icon = decision_transform_into_ultra_awesome
	sound = choose_ascension_perk_01

	resources = {
		category = decisions
		cost = {
			energy = 5000000
			minerals = 5000000
			alloys = 2500000
			sm_sr_perfect_runic_energy = 250
			influence = 250
		}
	}
	
	allow = {	
		NOR = {
			has_deposit = d_obsolete_ai
			has_deposit = d_obsolete_infrastructure
		}
	}

	potential = {
		owner = {
			has_country_flag = theta_soulsphere_underway
		}
		NOT = {
			has_planet_flag = sm_voidsphere_modernized
		}
		has_planet_flag = has_soulsphere_project
	}
	
	effect = {
		planet_event = { id = shroud_master_soulsphere.1 }
	}
	
	ai_weight = {
		weight = 0
	}
}

#decision_acot_redeploy_voidsphere_halo = {
#	owned_planets_only = yes
#	sound = event_construction
#	icon = decision_transform_into_super_awesome
#
#	enactment_time = 360
#
#	resources = {
#		category = decisions
#		cost = {
#			alloys = 500000
#			acot_sr_dark_energy = 50000
#			sr_dark_matter = 50000
#		}
#	}
#	
#	allow = {
#	}
#
#	potential = {
#		is_planet_class = pc_acot_enigmopolis
#		OR = {
#			NOT = {
#				exists = orbital_defence
#			}
#			exists = orbital_defence
#			orbital_defence = {
#				NOT = {
#					is_ship_size = acot_precusor_orbital_ring_t4
#				}
#			}
#		}
#	}
#	
#
#	effect = {
#		custom_tooltip = decision_acot_redeploy_voidsphere_halo_effect
#		hidden_effect = {
#			if = {
#				limit = {
#					exists = orbital_defence
#				}
#				orbital_defence = {
#					delete_fleet = this
#				}
#			}
#			create_starbase = {
#				size = acot_precusor_orbital_ring_t4
#				owner = from
#				effect = { }
#			}
#		}
#	}
#	
#	ai_weight = {
#		weight = 200
#	}
#}

decision_acot_redeploy_soulsphere_halo = {
	owned_planets_only = yes
	sound = event_construction
	icon = decision_transform_into_super_awesome

	enactment_time = 360

	resources = {
		category = decisions
		cost = {
			alloys = 1000000
			sm_sr_perfect_runic_energy = 200
		}
	}
	
	allow = {
	}

	potential = {
		is_planet_class = pc_acot_soulsphere
		OR = {
			NOT = {
				exists = orbital_defence
			}
			exists = orbital_defence
			orbital_defence = {
				NOT = {
					is_ship_size = acot_precusor_orbital_ring_t5
				}
			}
		}
	}
	

	effect = {
		custom_tooltip = decision_acot_redeploy_voidsphere_halo_effect
		hidden_effect = {
			if = {
				limit = {
					exists = orbital_defence
				}
				orbital_defence = {
					delete_fleet = this
				}
			}
			create_starbase = {
				size = acot_precusor_orbital_ring_t5
				owner = from
				effect = { }
			}
		}
	}
	
	ai_weight = {
		weight = 200
	}
}

decision_voidsphere_dimension_travel = { #### overwrite so that soul sphere can deploy
	owned_planets_only = yes
	sound = event_mystic_reveal

	resources = {
		category = decisions
		cost = {
			trigger = {
				is_planet_class = pc_acot_enigmopolis
			}
			unity = 500000
			acot_sr_dark_energy = 25000
			sr_dark_matter = 25000
		}
		cost = {
			trigger = {
				is_planet_class = pc_acot_soulsphere
			}
			unity = 500000
			sm_sr_perfect_runic_energy = 50
		}
	}
	
	allow = {
		if = {
			limit = {
				is_planet_class = pc_acot_enigmopolis
			}
			num_districts = {
				type = district_acot_enigmapolis_forge
				value >= 1
			}
			custom_tooltip = {
				fail_text = decision_voidsphere_dimension_travel_error_no_portal
				check_variable = {
					which = acot_voidsphere_portal_count
					value >= 1
				}
			}
		}
		else_if = {
			limit = {
				is_planet_class = pc_acot_soulsphere
			}
			num_districts = {
				type = district_acot_soulsphere_forge
				value >= 1
			}
			custom_tooltip = {
				fail_text = decision_voidsphere_dimension_travel_error_no_portal
				check_variable = {
					which = acot_voidsphere_portal_count
					value >= 1
				}
			}
		}
	}

	prerequisites = {
		tech_acot_enigmapolis_forge
	}

	potential = {
		OR = {
			is_planet_class = pc_acot_enigmopolis
			is_planet_class = pc_acot_soulsphere
		}
		NOT = {
			has_planet_flag = acot_void_sphere_ongoing_travel
		}
	}
	
	on_queued = {
		set_planet_flag = acot_void_sphere_ongoing_travel
	}

	on_unqueued = {
		remove_planet_flag = acot_void_sphere_ongoing_travel
	}

	effect = {
		custom_tooltip = decision_voidsphere_dimension_travel_effect
		set_planet_flag = acot_void_sphere_ongoing_travel
		hidden_effect = {
			save_event_target_as = void_sphere_planet
			planet_event = { id = acot_planets.9 }
		}
	}
	
	ai_weight = {
		weight = 200
	}
}