###############################
# Astral Planes Leader Traits #
###############################

leader_trait_rift_warped = {
	inline_script = {
		script = trait/icon
		CLASS = scientist
		ICON = "GFX_leader_trait_rift_warped"
		RARITY = common
		COUNCIL = no
		TIER = none
	}
	self_modifier = {
		leader_lifespan_add = 50
		species_leader_exp_gain = 0.1
	}
	custom_tooltip_with_modifiers = leader_trait_ignore_leader_cap_tt
	leader_class = all
	initial = no
	randomized = no
}

leader_trait_partially_digested = {
	leader_trait_type = negative
	inline_script = {
		script = trait/icon_negative
		CLASS = leader
		ICON = "GFX_leader_trait_maimed"
		RARITY = common
		COUNCIL = yes
		TIER = none
	}
	self_modifier = {
		leader_lifespan_mult = -0.2
	}
	triggered_councilor_modifier = {
		potential = { trait_is_gestalt_check = no }
		category_biology_research_speed_mult = 0.2
	}
	leader_class = { scientist }
	initial = no
	randomized = no
}

leader_trait_obelisk_curse = {
	leader_trait_type = negative
	inline_script = {
		script =  trait/icon_negative
		CLASS = leader
		ICON = "GFX_leader_trait_obelisk_curse"
		RARITY = common
		COUNCIL = yes
		TIER = none
	}
	councilor_modifier = {
		country_energy_produces_mult = 0.1
	}
	custom_tooltip_with_modifiers = leader_trait_obelisk_curse_tt
	on_gained_effect = {
		owner = {
			country_event = {
				id = astral_rift.1960
				days = 360
				scopes = { from = prev }
			}
		}
	}
	leader_class = { scientist }
	initial = no
	randomized = no
}

leader_trait_planar_theorist = {
	inline_script = {
		script = trait/icon
		CLASS = scientist
		ICON = "GFX_leader_trait_planar_theorist"
		RARITY = common
		COUNCIL = triggered
		TIER = 1
	}
	modifier = {
		country_astral_rift_speed_mult = 0.1
	}
	triggered_councilor_modifier = {
		potential = { trait_is_gestalt_check = no }
		category_particles_research_speed_mult = 0.1
		category_particles_draw_chance_mult = 0.1
		country_resource_max_astral_threads_add = 100
	}
	triggered_planet_modifier = {
		potential = { trait_is_gestalt_check = no }
			planet_physicists_produces_mult = 0.1
			planet_physicists_society_research_produces_add = 0.1
			planet_physicists_engineering_research_produces_add = 0.1
			planet_physicists_astral_threads_upkeep_add = 0.1
			job_physicist_add = 100	
	}
	triggered_planet_modifier = {
		potential = { trait_is_gestalt_check = yes }
			planet_physicists_produces_mult = 0.1
			planet_physicists_society_research_produces_add = 0.1
			planet_physicists_engineering_research_produces_add = 0.1
			planet_physicists_astral_threads_upkeep_add = 0.1
			job_calculator_physicist_add = 100	
	}
	triggered_sector_modifier = {
		potential = {	trait_is_gestalt_check = no
						exists = owner
						owner? = { is_nomadic = no } }
		planet_physicists_produces_mult = 0.05
		planet_physicists_society_research_produces_add = 0.05
		planet_physicists_engineering_research_produces_add = 0.05
		planet_physicists_astral_threads_upkeep_add = 0.05
		job_physicist_add = 50
	}
	triggered_sector_modifier = {
		potential = {	trait_is_gestalt_check = yes
						exists = owner
						owner? = { is_nomadic = no } }
		planet_physicists_produces_mult = 0.1
		planet_physicists_society_research_produces_add = 0.1
		planet_physicists_engineering_research_produces_add = 0.1
		planet_physicists_astral_threads_upkeep_add = 0.1
		job_calculator_physicist_add = 50
	}
	leader_potential_add = {
		has_astral_planes_dlc = yes
		is_heir = no
		is_ruler = no
	}
	leader_class = { scientist }
	prerequisites = { tech_rift_sphere }
	selectable_weight = {
		weight = @class_trait_weight
		inline_script = paragon/council_weight_mult
		modifier = {
			always = yes
			factor = value:trait_selectable_weight_per_rift_completed
		}
		modifier = {
			from = {
				is_dimensional_worship_empire = yes
			}
			factor = @synergy_weight_mult
		}
		modifier = {
			from = { is_hyperspace_specialty_empire = yes }
			factor = @synergy_weight_mult
		}
		modifier = {
			from = { has_origin = origin_riftworld }
			factor = @synergy_weight_mult
		}
		modifier = {
			is_heir = yes
			factor = 0
		}
	}
	ai_weight = 100
}

leader_trait_planar_theorist_2 = {
	replace_traits = { "leader_trait_planar_theorist" }
	inline_script = {
		script = trait/icon
		CLASS = scientist
		ICON = "GFX_leader_trait_planar_theorist"
		RARITY = common
		COUNCIL = triggered
		TIER = 2
	}
	modifier = {
		country_astral_rift_speed_mult = 0.2
	}
	triggered_councilor_modifier = {
		potential = { trait_is_gestalt_check = no }
		category_particles_research_speed_mult = 0.2
		category_particles_draw_chance_mult = 0.2
		country_resource_max_astral_threads_add = 200
	}
	triggered_planet_modifier = {
		potential = { trait_is_gestalt_check = no }
			planet_physicists_produces_mult = 0.2
			planet_physicists_society_research_produces_add = 0.2
			planet_physicists_engineering_research_produces_add = 0.2
			planet_physicists_astral_threads_upkeep_add = 0.2
			job_physicist_add = 200	
	}
	triggered_planet_modifier = {
		potential = { trait_is_gestalt_check = yes }
			planet_physicists_produces_mult = 0.2
			planet_physicists_society_research_produces_add = 0.2
			planet_physicists_engineering_research_produces_add = 0.2
			planet_physicists_astral_threads_upkeep_add = 0.2
			job_calculator_physicist_add = 200	
	}
	triggered_sector_modifier = {
		potential = {	trait_is_gestalt_check = no
						exists = owner
						owner? = { is_nomadic = no } }
		planet_physicists_produces_mult = 0.1
		planet_physicists_society_research_produces_add = 0.1
		planet_physicists_engineering_research_produces_add = 0.1
		planet_physicists_astral_threads_upkeep_add = 0.1
		job_physicist_add = 100
	}
	triggered_sector_modifier = {
		potential = {	trait_is_gestalt_check = yes
						exists = owner
						owner? = { is_nomadic = no } }
		planet_physicists_produces_mult = 0.1
		planet_physicists_society_research_produces_add = 0.1
		planet_physicists_engineering_research_produces_add = 0.1
		planet_physicists_astral_threads_upkeep_add = 0.1
		job_calculator_physicist_add = 100
	}
	leader_class = { scientist }
	ai_weight = 100
}

leader_trait_academic_astral_rift_expert = {
	leader_trait_type = veteran
	inline_script = {
		script = trait/icon
		CLASS = scientist
		ICON = "GFX_leader_trait_academic_astral_rift_expert"
		RARITY = free_or_veteran
		COUNCIL = no
		TIER = 1
	}
	modifier = {
		ship_astral_rift_clues_add = 1
	}
	triggered_background_planet_modifier = {
		potential = {	exists = FROM
						FROM = {	exists = owner
									owner = { is_same_value = root.owner } } 
						trait_is_gestalt_check = no }
			planet_physicists_astral_threads_upkeep_add = 0.05
			planet_biologists_astral_threads_upkeep_add = 0.05
			planet_engineers_astral_threads_upkeep_add = 0.05
			planet_researchers_produces_mult = 0.025
			job_physicist_add = 15
			job_biologist_add = 15
			job_engineer_add = 15
	}
	triggered_background_planet_modifier = {
		potential = {	exists = FROM
						FROM = {	exists = owner
									owner = { is_same_value = root.owner } } 
						trait_is_gestalt_check = yes }
			planet_physicists_astral_threads_upkeep_add = 0.05
			planet_biologists_astral_threads_upkeep_add = 0.05
			planet_engineers_astral_threads_upkeep_add = 0.05
			planet_researchers_produces_mult = 0.025
			job_calculator_physicist_add = 15
			job_calculator_biologist_add = 15
			job_calculator_engineer_add = 15
	}
	leader_potential_add = {
		has_astral_planes_dlc = yes
		OR = {
			has_paragon_dlc = no
			has_trait = subclass_scientist_scholar
		}
	}
	leader_class = { scientist }
	prerequisites = { tech_rift_sphere }
	selectable_weight = {
		inline_script = paragon/subclass_free_trait_weight
		inline_script = paragon/pilot_weight_mult
		inline_script = {
			script = paragon/subclass_weight_mult
			SUBCLASS = scientist_scholar
		}
		modifier = {
			always = yes
			factor = value:trait_selectable_weight_per_rift_completed
		}
		modifier = {
			from = {
				is_dimensional_worship_empire = yes
			}
			factor = @synergy_weight_mult
		}
		modifier = {
			from = { is_hyperspace_specialty_empire = yes }
			factor = @synergy_weight_mult
		}
		modifier = {
			from = { has_origin = origin_riftworld }
			factor = @synergy_weight_mult
		}
	}
}

leader_trait_academic_astral_rift_expert_2 = {
	leader_trait_type = veteran
	replace_traits = { "leader_trait_academic_astral_rift_expert" }
	inline_script = {
		script = trait/icon
		CLASS = scientist
		ICON = "GFX_leader_trait_academic_astral_rift_expert"
		RARITY = free_or_veteran
		COUNCIL = no
		TIER = 2
	}
	modifier = {
		ship_astral_rift_clues_add = 2
	}
	triggered_background_planet_modifier = {
		potential = {	exists = FROM
						FROM = {	exists = owner
									owner = { is_same_value = root.owner } } 
						trait_is_gestalt_check = no }
			planet_physicists_astral_threads_upkeep_add = 0.1
			planet_biologists_astral_threads_upkeep_add = 0.1
			planet_engineers_astral_threads_upkeep_add = 0.1
			planet_researchers_produces_mult = 0.05
			job_physicist_add = 30
			job_biologist_add = 30
			job_engineer_add = 30
	}
	triggered_background_planet_modifier = {
		potential = {	exists = FROM
						FROM = {	exists = owner
									owner = { is_same_value = root.owner } } 
						trait_is_gestalt_check = yes }
			planet_physicists_astral_threads_upkeep_add = 0.1
			planet_biologists_astral_threads_upkeep_add = 0.1
			planet_engineers_astral_threads_upkeep_add = 0.1
			planet_researchers_produces_mult = 0.05
			job_calculator_physicist_add = 30
			job_calculator_biologist_add = 30
			job_calculator_engineer_add = 30
	}
	leader_class = { scientist }
}

leader_trait_academic_astral_rift_expert_3 = {
	leader_trait_type = veteran
	replace_traits = { "leader_trait_academic_astral_rift_expert_2" }
	inline_script = {
		script = trait/icon
		CLASS = scientist
		ICON = "GFX_leader_trait_academic_astral_rift_expert"
		RARITY = veteran
		COUNCIL = no
		TIER = 3
	}
	modifier = {
		ship_astral_rift_clues_add = 3
	}
	triggered_background_planet_modifier = {
		potential = {	exists = FROM
						FROM = {	exists = owner
									owner = { is_same_value = root.owner } } 
						trait_is_gestalt_check = no }
			planet_physicists_astral_threads_upkeep_add = 0.15
			planet_biologists_astral_threads_upkeep_add = 0.15
			planet_engineers_astral_threads_upkeep_add = 0.15
			planet_researchers_produces_mult = 0.075
			job_physicist_add = 45
			job_biologist_add = 45
			job_engineer_add = 45
	}
	triggered_background_planet_modifier = {
		potential = {	exists = FROM
						FROM = {	exists = owner
									owner = { is_same_value = root.owner } } 
						trait_is_gestalt_check = yes }
			planet_physicists_astral_threads_upkeep_add = 0.15
			planet_biologists_astral_threads_upkeep_add = 0.15
			planet_engineers_astral_threads_upkeep_add = 0.15
			planet_researchers_produces_mult = 0.075
			job_calculator_physicist_add = 45
			job_calculator_biologist_add = 45
			job_calculator_engineer_add = 45
	}
	leader_potential_add = {
		has_paragon_dlc = yes
	}
	leader_class = { scientist }
}

leader_trait_foreign_consciousness = {
	leader_trait_type = destiny
	inline_script = {
		script =  trait/icon
		CLASS = scientist
		ICON = "GFX_leader_trait_foreign_consciousness"
		RARITY = paragon
		COUNCIL = no
		TIER = none
	}
	on_gained_effect = {
		owner = {
			country_event = { id = timeline.50 } # Timeline First Leader with Destiny Trait
		}
	}
	modifier = {
		ship_astral_rift_speed_mult = 0.2
		ship_astral_rift_clues_add = 2
	}
	planet_modifier = {
		planet_jobs_physics_research_produces_mult  = 0.2
	}
	sector_modifier = {
		planet_jobs_physics_research_produces_mult  = 0.1
	}
	leader_class = { scientist }
	initial = no
	randomized = no
	background_icon = "GFX_leader_background_destiny_1"
}

leader_trait_black_light_blinded = {
	leader_trait_type = negative
	inline_script = {
		script =  trait/icon_negative
		CLASS = leader
		ICON = "GFX_leader_trait_black_light_blinded"
		RARITY = common
		COUNCIL = no
		TIER = none
	}
	modifier = {
		science_ship_survey_speed = -0.5
		ship_astral_rift_speed_mult = -0.5
		ship_astral_rift_clues_add = -2
		ship_archaeological_site_excavation_speed_mult = -0.5
		ship_archaeological_site_clues_add = -2
	}
	leader_class = { scientist }
	initial = no
	randomized = no
}

leader_trait_sanitary_drone = {
	inline_script = {
		script =  trait/icon
		CLASS = leader
		ICON = "GFX_leader_trait_custom_AI_assistant"
		RARITY = common
		COUNCIL = triggered
		TIER = none
	}
	modifier = {
		ship_anomaly_research_speed_mult = 0.05
		ship_astral_rift_clues_add = 1
	}
	triggered_councilor_modifier = {
		potential = { trait_is_gestalt_check = no }
		category_biology_research_speed_mult = 0.1
		country_astral_rift_speed_mult = 0.2
	}
	leader_class = { scientist }
	initial = no
	randomized = no
}

leader_trait_spacebender = {
	leader_trait_type = destiny
	inline_script = {
		script = trait/icon
		CLASS = commander
		ICON = GFX_leader_trait_spacebender
		RARITY = paragon
		COUNCIL = no
		TIER = none
	}
	on_gained_effect = {
		owner = {
			country_event = { id = timeline.50 } # Timeline First Leader with Destiny Trait
		}
	}
	inline_script = {
		script = paragon/leader_resource_produces
		RESOURCE = astral_threads
		AMOUNT = 10
	}
	modifier = {
		ship_ftl_jumpdrive_range_mult = 0.5
		ship_jumpdrive_cooldown_mult = -0.9
	}
	leader_potential_add = {
		has_astral_planes_dlc = yes
	}
	custom_tooltip_with_modifiers = leader_trait_spacebender_effect
	leader_class = { commander }
	initial = no
	randomized = no
	background_icon = "GFX_leader_background_destiny_1"
}

leader_trait_energy_weapon_specialist = {
	leader_trait_type = veteran
	inline_script = {
		script = trait/icon
		CLASS = commander
		ICON = GFX_leader_trait_energy_weapon_specialist
		RARITY = veteran
		COUNCIL = no
		TIER = none
	}
	leader_potential_add = {
		has_astral_planes_dlc = yes
	}
	fleet_modifier = {
		weapon_type_energy_weapon_damage_mult = 0.1
		weapon_type_energy_weapon_fire_rate_mult = 0.1
	}
	leader_class = { commander }
	initial = no
	randomized = no
}

leader_trait_blorg_insight = {
	leader_trait_type = destiny
	inline_script = {
		script = trait/icon
		CLASS = official
		ICON = GFX_leader_trait_blorg_insight
		RARITY = paragon
		COUNCIL = yes
		TIER = none
	}
	on_gained_effect = {
		owner = {
			country_event = { id = timeline.50 } # Timeline First Leader with Destiny Trait
		}
	}
	councilor_modifier = {
		intel_decryption_add = 2
		add_base_country_intel = 15
		diplo_weight_mult = -0.05
	}

	initial = no
	randomized = no
	immortal_leaders = yes
	custom_tooltip_with_modifiers = blorg_insight_effect
	leader_class = { official }
	background_icon = "GFX_leader_background_destiny_1"
}

################################
# Astral Planes Species Traits #
################################

trait_plasmic = {
	cost = 0
	initial = no
	randomized = no
	species_potential_add = {
		always = no
	}
	species_possible_merge_add = {
		always = no
	}
	species_possible_remove = {
		OR = {
			can_remove_beneficial_genetic_traits = yes
			can_remove_pop_growth_genetic_traits = yes
		}
	}
	allowed_archetypes = { BIOLOGICAL LITHOID }
	tags = { organic positive pop_growth housing habitability special }

	modifier = {
		logistic_growth_mult = 0.15
		pop_housing_usage_mult = -0.10
		pop_environment_tolerance = 0.15
	}
	ai_weight = {
		weight = 0
	}
	slave_cost = {
		energy = 2500
	}
}

trait_exd = {
	cost = 0

	sorting_priority = 20

	initial = yes
	randomized = no
	species_potential_add = {
		always = no
	}
	species_possible_remove = {
		always = no
	}
	species_possible_merge_add = {
		always = no
	}

	allowed_archetypes = { OTHER }
	tags = { organic positive upkeep production research special }
	species_class = { EXD }
	ai_weight = {
		weight = 0
	}

	icon = "gfx/interface/icons/traits/trait_exd.dds"

	custom_tooltip_with_modifiers = TRAIT_EXD_EFFECT

	modifier = {
		leader_lifespan_mult = 0.5
		pop_environment_tolerance = 0.50
		logistic_growth_mult = -0.25
		planet_pops_upkeep_mult = 0.50
	}

	resources = {
		category = planet_pops
		produces = {
			trigger = {
				is_slave_or_better = yes
			}
			physics_research = 0.5
		}
		# Energy Upkeep
		upkeep = {
			trigger = {
				is_being_purged = no
				is_sapient = yes
			}
			energy = @living_standard_energy_normal
		}
	}
}
