########################
# Relics - Main File
########################

r_dragon_trophy = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_dragon_trophy"
	sound = "relic_activation_ether_drake_trophy"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		country_unity_produces_mult = 0.10
	}

	score = 1000

	active_effect = {
		add_modifier = {
			modifier = "ether_drake_triumph"
			days = @triumph_duration
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_dragon_trophy
		}
	}
}

r_khans_throne = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_khans_throne"
	sound = "relic_activation_khans_throne"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
		modifier = {
			factor = 2
			is_militarist = yes
		}
		modifier = {
			factor = 3
			is_at_war = yes
		}
	}

	triggered_country_modifier = {
		potential = {
			is_nomadic = no
		}
		country_claim_influence_cost_mult = -0.20
	}
	triggered_country_modifier = {
		potential = {
			is_nomadic = yes
			NOT = {
				has_origin = origin_heirs_of_the_khan
			}
		}
		country_naval_cap_add = 200
	}

	triggered_country_modifier = {
		potential = {
			NOT = {
				has_origin = origin_heirs_of_the_khan
			}
		}
		custom_tooltip = khans_throne_passive_effect
	}
	triggered_country_modifier = {
		potential = {
			has_origin = origin_heirs_of_the_khan
		}
		country_naval_cap_add = 400
	}

	score = 3000

	active_effect = {
		add_modifier = {
			modifier = "drums_of_war"
			days = @triumph_duration
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_khans_throne
		}
	}
}

r_worm_scales = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_worm_scales"
	sound = "relic_activation_scales_of_the_worm"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		country_physics_tech_research_speed = 0.05
	}

	score = 1000

	active_effect = {
		add_modifier = {
			modifier = "worm_scales"
			days = @triumph_duration
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_worm_scales
		}
	}
}

r_rubricator = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_rubricator"
	sound = "relic_activation_the_rubricator"


	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
		produces = {
			society_research = 20
		}
	}

	ai_weight = {
		weight = 150
		modifier = {
			factor = 0.5
			has_resource = { type = minor_artifacts amount > 300 }
		}
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		weapon_archaeotech_weapon_damage_mult = 0.15
	}

	score = 1000

	active_effect = {
		custom_tooltip = relic_rubricator_active
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
			add_resource = { minor_artifacts = 2000 }
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_rubricator
		}
	}
}

r_galaxy = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_galaxy"
	sound = "relic_activation_miniature_galaxy"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
		modifier = {
			factor = 1.5
			is_materialist = yes
		}
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		all_technology_research_speed = 0.05
	}

	score = 2000

	active_effect = {
		custom_tooltip = relic_galaxy_active
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
			country_event = { id = ancrel.7007 }
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_galaxy
		}
	}
}

r_omnicodex = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_omnicodex"
	sound = "relic_activation_the_omnicodex"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
		modifier = {
			factor = 2
			is_xenophile = yes
		}
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		BIOLOGICAL_species_trait_points_add = 1
	}
	triggered_country_modifier = {
		potential = {
			is_robot_empire = yes
		}
		custom_tooltip = relic_omicodex_opinon
	}

	score = 500

	active_effect = {
		custom_tooltip = relic_omnicodex_active
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
			country_event = { id = ancrel.6000 }
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_omnicodex
		}
	}
}

r_surveyor = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_surveyor"
	sound = "relic_activation_the_surveyor"

	resources = {
		category = relics
		# Activation cost
		cost = {
			energy = 500
		}
	}

	ai_weight = {
		weight = 120
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		ship_sensor_range_add = 1
	}

	score = 200

	active_effect = {
		custom_tooltip = relic_surveyor_active
		custom_tooltip = relic_triumph_cooldown_short
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration_short
			}
			country_event = { id = story.335 }

			# Chance for additional deposits
			random_list = {
				50 = { country_event = { id = story.335 days = 720 random = 360 } }
				50 = {}
			}

			random_list = {
				20 = { country_event = { id = story.335 days = 1440 random = 360 } }
				80 = {}
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_surveyor
		}
	}
}

r_galatron = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_galatron"
	sound = "relic_activation_the_galatron"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
		produces = {
			influence = 3
		}
	}

	ai_weight = {
		weight = 200
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		diplo_weight_mult = 1.0
	}

	score = 20000

	active_effect = {
		custom_tooltip = relic_galatron_active
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
			country_event = { id = cara.970 }
			country_event = { id = action.650 }
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_galatron
		}
	}
}

r_ancient_sword = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_ancient_sword"
	sound = "relic_activation_blade_of_the_huntress"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		army_morale = 0.25
		planet_sensor_range_add = 2
		diplo_weight_mult = 0.10
	}

	score = 200

	active_effect = {
		add_modifier = {
			modifier = "ancient_sword"
			days = @triumph_duration
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_ancient_sword
		}
	}
}

r_severed_head = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_severed_head"
	sound = "relic_activation_head_of_zarqlan"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			is_nomadic = no
		}
		custom_tooltip = r_severed_head_passive
	}
	triggered_country_modifier = {
		potential = {
			is_nomadic = yes
		}
		custom_tooltip = r_severed_head_nomads_passive
	}

	score = 200

	active_effect = {
		custom_tooltip = relic_summon_pilgrims
		add_modifier = {
			modifier = severed_head_modifier
			days = @triumph_duration
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
			country_event = { id = ancrel.6131 }
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_severed_head
		}
	}
}

r_odryskan_crystal = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_odryskan_crystal"
	sound = "relic_activation_intact_zro_soulstone"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 50
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		country_rare_crystals_produces_mult = 0.15
	}

	score = 3000

	active_effect = {
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
		add_monthly_resource_mult = {
			resource = energy
			value = 60
			max = 999999
		}
		if = {
			limit = { is_gestalt = no }
			custom_tooltip = r_odryskan_crystal_regular_effect
			hidden_effect = {
				random_owned_leader = {
					limit = {
						leader_class = scientist
						NOR = {
							has_trait = leader_trait_maniacal
							has_trait = leader_trait_maniacal_2
							has_trait = leader_trait_maniacal_3
						}
					}
					add_trait = {
						trait = leader_trait_maniacal
					}
				}
			}
		}
		custom_tooltip = relic_triumph_cooldown
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_odryskan_crystal
		}
	}
}

r_the_rulerchip = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_the_rulerchip"
	sound = "relic_activation_the_rulerchip"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	can_be_stolen = no

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			is_variable_set = num_rulerchip_admin
		}
		planet_jobs_produces_mult = 0.05
		mult = value:rulerchip_dead_leader_admin
		custom_tooltip = "rulerchip_intergenerational_knowledge_admin_tooltip"
		show_only_custom_tooltip = no
	}

	triggered_country_modifier = {
		potential = {
			is_variable_set = num_rulerchip_military
		}
		ship_weapon_damage = 0.05
		mult = value:rulerchip_dead_leader_military
		custom_tooltip = "rulerchip_intergenerational_knowledge_military_tooltip"
		show_only_custom_tooltip = no
	}

	triggered_country_modifier = {
		potential = {
			is_variable_set = num_rulerchip_scientific
		}
		all_technology_research_speed = 0.05
		mult = value:rulerchip_dead_leader_scientific
		custom_tooltip = "rulerchip_intergenerational_knowledge_science_tooltip"
		show_only_custom_tooltip = no
	}

	score = 0

	active_effect = {
		add_modifier = {
			modifier = "rulerchip_intergenerational_knowledge"
			days = @triumph_duration
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_the_rulerchip
		}
	}
}

r_voidspawn_myocardium = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_voidspawn_heart"
	sound = "relic_activation_scales_of_the_worm"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		ship_fire_rate_mult = 0.1
		ship_damage_reduction_mult = 0.05
	}

	score = 1000

	active_effect = {
		if = {
			limit = {
				any_owned_ship = {
					is_ship_size = behemoth_04
				}
			}
			#eat the relic
			custom_tooltip = eat_the_voidspawn
			hidden_effect = {
				remove_relic = r_voidspawn_myocardium
			}
			#apply turbobuff to Behemoth
			random_owned_ship = {
				limit = {
					is_ship_size = behemoth_04
				}
				add_modifier = {
					modifier = voidspawn_devourer
					days = -1
				}
			}
		}
		else = {
			add_modifier = {
				modifier = "voidslayers"
				days = @triumph_duration
			}
			custom_tooltip = relic_triumph_cooldown
			hidden_effect = {
				add_modifier = {
					modifier = "relic_activation_cooldown"
					days = @triumph_duration
				}
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_worm_scales
		}
	}
}

###################
### Crisis relics
###################

r_prethoryn_queen = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_prethoryn_queen"
	sound = "relic_activation_prethoryn_blood_queen"

	resources = {
		category = relics
		# Activation cost
		cost = {
			food = 10000
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		country_society_tech_research_speed = 0.5
	}
	triggered_country_modifier = {
		potential = {
			always = yes
		}
		weapon_swarm_weapon_fire_rate_mult = 0.05
		mult = brood_usage
	}

	score = 5000

	active_effect = {
		custom_tooltip = relic_queen_spawn
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
			country_event = { id = crisis.250 }
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_prethoryn_queen
		}
	}
}

r_unbidden_warlock = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_unbidden_warlock"
	sound = "relic_activation_extradimensional_warlock"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 10
		modifier = {
			factor = 30
			is_at_war = yes
		}
		modifier = {
			factor = 0
			NOR = {
				has_technology = tech_jump_drive_1
				has_technology = tech_psi_jump_drive_1
			}
		}
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		ship_speed_mult = 0.30
		ship_weapon_range_mult = 0.30
	}

	score = 5000

	active_effect = {
		add_modifier = {
			modifier = "unbidden_ritual"
			days = @triumph_duration
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_unbidden_warlock
		}
	}
}

r_contingency_core = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_contingency_core"
	sound = "relic_activation_isolated_contingency_core"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
	}

	# See 'GetContingencyCoreEffect'
	triggered_country_modifier = {
		potential = {
			is_hive_empire = no
		}
		planet_pop_assembly_mult = 1.00
		show_only_custom_tooltip = no
		custom_tooltip = relic_contingecy_core # +1 Megastructure
	}
	triggered_country_modifier = {
		potential = {
			is_hive_empire = yes
		}
		country_engineering_research_produces_mult = 1.5
		show_only_custom_tooltip = no
		custom_tooltip = relic_contingecy_core # +1 Megastructure
	}


	score = 5000

	active_effect = {
		add_modifier = {
			modifier = "contingency_calculation"
			days = @triumph_duration
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_contingency_core
		}
	}
}

r_cetanas_heart = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_cetanas_heart"
	sound = "relic_activation_isolated_contingency_core"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
			nanites = 500
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		planetary_ascension_cost_mult = -0.5
	}

	score = 5000

	active_effect = {
		if = {
			limit = { is_hive_empire = no }
			custom_tooltip = relic_cetanas_heart_active
		}
		else_if = {
			limit = { is_hive_empire = yes }
			add_modifier = {
				modifier = "cetanas_heart_hive_modifier"
				days = @triumph_duration
			}
		}

		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
			country_event = { id = crisis.10015 }
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_cetanas_heart
		}
	}
}

###################
### Precursor relics
###################

r_zro_crystal = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_zro_crystal"
	sound = "relic_activation_intact_zro_soulstone"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 200
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		shroud_delve_cooldown = -0.5
		custom_tooltip = relic_zro_crystal_passive
	}

	score = 1000

	active_effect = {
		custom_tooltip = relic_zro_crystal_active
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
			country_event = { id = ancrel.7006 }
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_zro_crystal
		}
	}
}

r_the_last_baol = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_baol"
	sound = "relic_activation_the_last_baol"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			is_machine_empire = no
			is_wilderness_empire = no
		}
		modifier = {
			logistic_growth_mult = 0.1
		}
	}

	triggered_country_modifier = {
		potential = {
			OR = {
				is_machine_empire = yes
				is_wilderness_empire = yes
			}
		}
		modifier = {
			logistic_growth_mult = 0.1
			country_society_research_produces_mult = 0.10
		}
	}

	score = 1000

	active_effect = {
		custom_tooltip = relic_last_baol_active_tooltip
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
			set_country_flag = not_activated_baol
			set_timed_country_flag = { flag = relic_last_baol_activated days = @triumph_duration }
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_the_last_baol
		}
	}
}

r_the_defragmentor = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_mechano_calibrator"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
		modifier = {
			factor = 1.15
			is_machine_empire = yes
		}
	}

	triggered_country_modifier = {
		potential = {
			is_machine_empire = no
		}
		modifier = {
			planet_pops_robotics_upkeep_mult = -0.10
			planet_buildings_energy_upkeep_mult = -0.10
			planet_districts_energy_upkeep_mult = -0.10
			planet_jobs_energy_upkeep_mult = -0.10
		}
	}

	triggered_country_modifier = {
		potential = {
			is_machine_empire = yes
		}
		modifier = {
			planet_pops_robotics_upkeep_mult = -0.10
			pop_housing_usage_mult = -0.10
			planet_buildings_energy_upkeep_mult = -0.10
			planet_districts_energy_upkeep_mult = -0.10
			planet_jobs_energy_upkeep_mult = -0.10
		}
	}

	score = 1000

	active_effect = {
		add_modifier = {
			modifier = "relic_defragmentor"
			days = @triumph_duration
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_the_defragmentor
		}
	}
}

r_reality_perforator = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_orb_insight"
	sound = "relic_activation_vultaum_real_perforator"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		pop_amenities_usage_mult = -0.10
	}

	score = 5000

	active_effect = {
		custom_tooltip = relic_reality_perforated
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
			country_event = { id = precursor.105 }
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_reality_perforator
		}
	}
}

r_pox_sample = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_pox_sample"
	sound = "relic_activation_javorian_pox_sample"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		leader_lifespan_add = 20
		show_only_custom_tooltip = no
		custom_tooltip = relic_javorian_pox
	}

	score = 5000

	active_effect = {
		add_modifier = {
			modifier = "javorian_pox"
			days = @triumph_duration
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_pox_sample
		}
	}
}

r_cryo_core = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_cryo_core"
	sound = "relic_activation_yuht_cryo_core"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			is_wilderness_empire = no
			is_nomadic = no
		}
		planet_colony_development_speed_mult = 2
		#custom_tooltip = r_cryo_core_effect
		weapon_type_energy_weapon_fire_rate_mult = 0.2
	}
	triggered_country_modifier = {
		potential = {
			is_wilderness_empire = yes
			is_nomadic = no
		}
		custom_tooltip = tr_expansion_colonization_fever_wilderness_desc
		show_only_custom_tooltip = no
		# see 'wilderness.500'
		weapon_type_energy_weapon_fire_rate_mult = 0.2
	}
		triggered_country_modifier = {
		potential = {
			is_nomadic = yes
		}
		megastructure_build_speed_mult = 0.50
		weapon_type_energy_weapon_fire_rate_mult = 0.2
	}

	score = 5000

	active_effect = {
		add_modifier = {
			modifier = "yuht_cryo_core"
			days = @triumph_duration
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_cryo_core
		}
	}
}

r_war_forge = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_war_forge"
	sound = "relic_activation_cybrex_war_forge"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost

		}
		cost = {
			minerals = 2000
			multiplier = cybrex_count
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		custom_tooltip = relic_cybrex_passive
	}

	score = 5000

	active_effect = {
		add_resource = {
			alloys = 1000
			mult = cybrex_count
		}
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration_veryshort
			}
		}
		custom_tooltip = "relic_triumph_cooldown_veryshort"
		hidden_effect = {
			if = {
				limit = {
					check_variable = {
						which = cybrex_count
						value <= 19
					}
				}
				change_variable = {
					which = cybrex_count
					value = 1
				}
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_war_forge
		}
	}
}

r_vacuum_flower = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_the_radiance"
	sound = "relic_vacuum_flower"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 200
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		country_energy_produces_mult = 0.10
	}

	score = 1000

	active_effect = {
		capital_scope.solar_system = {
			switch = {
				trigger = is_star_class
				sc_b = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_B"
							days = @triumph_duration
						}
					}
				}
				sc_a = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_A"
							days = @triumph_duration
						}
					}
				}
				sc_f = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_F"
							days = @triumph_duration
						}
					}
				}
				sc_g = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_G"
							days = @triumph_duration
						}
					}
				}
				sc_k = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_K"
							days = @triumph_duration
						}
					}
				}
				sc_m = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_M"
							days = @triumph_duration
						}
					}
				}
				sc_m_giant = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_M_giant"
							days = @triumph_duration
						}
					}
				}
				sc_t = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_T_dwarf"
							days = @triumph_duration
						}
					}
				}
				sc_black_hole = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_black_hole"
							days = @triumph_duration
						}
					}
				}
				sc_neutron_star = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_neutron"
							days = @triumph_duration
						}
					}
				}
				sc_pulsar = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_pulsar"
							days = @triumph_duration
						}
					}
				}
				sc_binary_1 = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_A"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_pulsar"
							days = @triumph_duration
						}
					}
				}
				sc_binary_2 = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_B"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_neutron"
							days = @triumph_duration
						}
					}
				}
				sc_binary_3 = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_M_giant"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_B"
							days = @triumph_duration
						}
					}
				}
				sc_binary_4 = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_M_giant"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_F"
							days = @triumph_duration
						}
					}
				}
				sc_binary_5 = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_B"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_B"
							days = @triumph_duration
						}
					}
				}
				sc_binary_6 = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_M"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_G"
							days = @triumph_duration
						}
					}
				}
				sc_binary_7 = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_K"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_F"
							days = @triumph_duration
						}
					}
				}
				sc_binary_8 = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_G"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_F"
							days = @triumph_duration
						}
					}
				}
				sc_binary_9 = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_A"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_F"
							days = @triumph_duration
						}
					}
				}
				sc_binary_10 = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_A"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_T_dwarf"
							days = @triumph_duration
						}
					}
				}
				sc_trinary_1 = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_G"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_M"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_K"
							days = @triumph_duration
						}
					}
				}
				sc_trinary_2 = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_B"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_A"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_F"
							days = @triumph_duration
						}
					}
				}
				sc_trinary_3 = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_K"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_F"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_G"
							days = @triumph_duration
						}
					}
				}
				sc_trinary_4 = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_B"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_K"
							days = @triumph_duration
						}
						add_modifier = {
							modifier = "relic_vacuum_flower_T_dwarf"
							days = @triumph_duration
						}
					}
				}
				sc_toxoid_star = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_lightbringer"
							days = @triumph_duration
						}
					}
				}
				sc_rift_star = {
					root.owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_rift_star"
							days = @triumph_duration
						}
					}
				}
			}
			if = {
				limit = { has_star_flag = gh_crisis_star }
				if = {
					limit = {
						owner = { has_ascension_perk = ap_galactic_hyperthermia }
					}
					owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_crisis_empire_star"
							days = @triumph_duration
						}
					}
				}
				else = {
					owner = {
						add_modifier = {
							modifier = "relic_vacuum_flower_crisis_star"
							days = @triumph_duration
						}
					}
				}
			}
		}
		custom_tooltip = relic_vacuum_flower_active
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_vacuum_flower
		}
	}
}

###################
### Origin Relics
###################

r_toxic_god = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_toxic_god"
	sound = "relic_activation_prethoryn_blood_queen"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 1
		modifier = {
			factor = 1000
			has_origin = origin_toxic_knights
		}
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		weapon_type_strike_craft_weapon_damage_mult = 0.15
	}

	triggered_country_modifier = {
		potential = {
			has_origin = origin_toxic_knights
			is_nomadic = yes
		}
		custom_tooltip = arkship_knights_detox_unlock_tt
	}

	score = 3000

	active_effect = {
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
		if = {
			limit = {
				NOT = { has_origin = origin_toxic_knights }
			}
			add_monthly_resource_mult = {
				resource = exotic_gases
				value = 60
				min = 1000
			}
		}
		else = {
			custom_tooltip = r_toxic_god_knights_effect
			hidden_effect = {
				change_variable = {
					which = toxic_castles_available
					value = 1
				}
			}
		}
		custom_tooltip = relic_triumph_cooldown
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_toxic_god
		}
	}
}

r_wormhole_key_fragment_1 = {
	portrait = "GFX_relic_wormhole_key_1"

	resources = {
		category = relics
	}

	triggered_country_modifier = {
		potential = { always = yes }
		country_physics_tech_research_speed = 0.05
	}

	possible = {
		custom_tooltip = {
			fail_text = "relic_cant_activate"
			always = no
		}
	}
}
r_wormhole_key_fragment_2 = {
	portrait = "GFX_relic_wormhole_key_2"

	resources = {
		category = relics
	}

	triggered_country_modifier = {
		potential = { always = yes }
		country_physics_tech_research_speed = 0.1
	}

	possible = {
		custom_tooltip = {
			fail_text = "relic_cant_activate"
			always = no
		}
	}
}
r_wormhole_key_fragment_3 = {
	portrait = "GFX_relic_wormhole_key_3"

	resources = {
		category = relics
	}

	triggered_country_modifier = {
		potential = { always = yes }
		country_physics_tech_research_speed = 0.15
	}

	possible = {
		custom_tooltip = {
			fail_text = "relic_cant_activate"
			always = no
		}
	}
}
r_wormhole_key_fragment_4 = {
	portrait = "GFX_relic_wormhole_key_4"

	resources = {
		category = relics
	}

	triggered_country_modifier = {
		potential = { always = yes }
		country_physics_tech_research_speed = 0.15
	}

	possible = {
		custom_tooltip = {
			fail_text = "relic_cant_activate"
			always = no
		}
	}
}

r_wormhole_key = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_wormhole_key_5"
	sound = "par_ui_keides_relic"


	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		country_physics_tech_research_speed = 0.20
		ship_jumpdrive_cooldown_mult = -0.25
	}

	score = 2500

	active_effect = {
		add_modifier = {
			modifier = "paragon_relic_wormhole_key"
			days = 100
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
		set_timed_country_flag = {
			flag = jump_drive_allowed
			days = 100
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_wormhole_key
		}
	}
}

r_core_of_the_reckoning = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_core_of_the_reckoning"
	sound = "relic_activation_core_of_the_reckoning"

	resources = {
		category = relics
		# Activation cost
		cost = {
			sr_zro = 500
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		planet_jobs_produces_mult = 0.25
		station_gatherers_produces_mult = 0.25
		station_researchers_produces_mult = 0.25
		country_naval_cap_mult = 0.25
		ships_upkeep_mult = -0.25
		country_base_influence_produces_add = 1
		country_starbase_capacity_add = 1
		mult = value:core_of_the_reckoning_mult
	}

	score = 5000

	active_effect = {
		custom_tooltip = core_of_reckoning_active_effect_tt
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			change_variable = {
				which = available_banish_decisions
				value = 1
			}
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_core_of_the_reckoning
		}
	}
}

##########################
### Astral Planes Relics
##########################

r_ever_spinning_top = {
	activation_duration = @triumph_duration_short
	portrait = "GFX_ever_spinning_top"
	sound = "relic_activation_spinning_top"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		country_energy_produces_mult = 0.1
	}

	score = 3000

	active_effect = {
		add_modifier = {
			modifier = "ever_spinning_top_modifier"
			days = @triumph_duration_short
		}
		custom_tooltip = relic_triumph_cooldown_short
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration_short
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_ever_spinning_top
		}
	}
}

r_celestial_tear = {
	activation_duration = @triumph_duration
	portrait = "GFX_celestial_tear"
	sound = "relic_activation_celestial_tear"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 10
		modifier = {
			factor = 10
			has_resource = { type = astral_threads amount < 100 }
		}
	}

	triggered_country_modifier = {
		potential = {
			is_nomadic = no
		}
		custom_tooltip = celestial_tear_acquisition_tt
	}

	triggered_country_modifier = {
		potential = {
			is_nomadic = yes
		}
		custom_tooltip = celestial_tear_acquisition_nomads_tt
	}

	score = 3000

	active_effect = {
		owner = {
			add_resource_astral_threads = { VALUE = 1000 }
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_celestial_tear
		}
	}
}

r_plasmic_core = {
	activation_duration = @triumph_duration
	portrait = "GFX_plasmic_core"
	sound = "relic_activation_plasmic_core"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			is_robot_empire = no
		}
		logistic_growth_mult = 0.1
	}
	triggered_country_modifier = {
		potential = {
			is_robot_empire = yes
		}
		species_leader_exp_gain = 0.1
	}

	score = 3000

	active_effect = {
		if = {
			limit = {
				OR = {
					is_robot_empire = yes
					is_wilderness_empire = yes
				}
			}
			custom_tooltip = machine_plasmic_core_effect
			hidden_effect = {
				random_owned_leader = {
					add_trait = {
						trait = random_common
					}
					add_trait = {
						trait = random_common
					}
					add_trait = {
						trait = random_common
					}
				}
			}
		}
		else_if = {
			limit = {
				NOT = { has_origin = origin_evolutionary_predators }
			}
			custom_tooltip = plasmic_core_effect
			hidden_effect = {
				random_owned_colony = {
					limit = {
						any_owned_pop_group = {
							is_robot_pop_group = no
							NOT = { pop_group_has_trait = trait_plasmic }
						}
					}
					every_owned_pop_group = {
						limit = {
							is_robot_pop_group = no
						}
						modify_species = {
							species = this
							add_trait = trait_plasmic
							portrait = this
						}
					}
				}
			}
		}
		else = {
			custom_tooltip = plasmic_core_effect_evopred
			hidden_effect = {
				set_country_flag = consumed_plasmic_dna
				random_situation = {
					limit = {
						is_situation_type = evolutionary_predators_situation
					}
					add_situation_progress = value:evopred_50
				}
			}
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		custom_tooltip = {
			fail_text = "plasmic_core_no_suitable_planet"
			OR = {
				is_robot_empire = yes
				is_wilderness_empire = yes
				has_origin = origin_evolutionary_predators
				any_owned_colony = {
					any_owned_pop_group = {
						is_robot_pop_group = no
						NOT = { pop_group_has_trait = trait_plasmic }
					}
				}
			}
		}
		inline_script = {
			script = relics/activation_checks
			RELIC = r_plasmic_core
		}
	}
}

r_infinity_root = {
	activation_duration = @triumph_duration
	portrait = "GFX_infinity_root"
	sound = "ap_rift_event_14_writhing_plants_vine"

	resources = {
		category = relics
		# Activation cost
		cost = {
			astral_threads = 100
		}
	}

	ai_weight = {
		weight = 10
		modifier = {
			add = 10
			count_owned_leader = {
				count <= 4
				limit = {
					leader_class = scientist
				}
			}
		}
		modifier = {
			add = 20
			count_owned_leader = {
				count <= 3
				limit = {
					leader_class = scientist
				}
			}
		}
		modifier = {
			add = 60
			count_owned_leader = {
				count <= 2
				limit = {
					leader_class = scientist
				}
			}
		}
		modifier = {
			factor = 10
			count_owned_leader = {
				count <= 1
				limit = {
					leader_class = scientist
				}
			}
		}
	}

	triggered_country_modifier = {
		potential = {
			has_country_flag = infinity_root_v1
		}
		country_food_produces_mult = 0.1
	}
	triggered_country_modifier = {
		potential = {
			has_country_flag = infinity_root_v2
		}
		country_food_produces_mult = 0.2
	}

	score = 3000

	active_effect = {
		create_leader = {
			name = random
			species = event_target:infinity_root_leader_species
			class = scientist
			set_age = 1
			randomize_traits = no
			custom_description = infinity_root_leader_desc
			traits = {
				1 = leader_trait_eager
				2 = leader_trait_adaptable
			}
			effect = {
				set_skill = 3
				set_leader_flag = should_not_have_upkeep
			}
		}
		custom_tooltip = infinity_root_active_effect_tt
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_infinity_root
		}
	}
}

r_time_crystal = {
	activation_duration = @triumph_duration
	portrait = "GFX_time_crystal"
	sound = "ap_rift_event_15_time_crystal"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 10
		modifier = {
			factor = 10
			count_owned_leader = {
				count = 0
				limit = {
					leader_class = scientist
					has_base_skill > @paragon_trait_level
				}
			}
		}
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		leader_lifespan_add = 10
	}

	score = 3000

	active_effect = {
		every_owned_leader = {
			add_experience = 800
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_time_crystal
		}
	}
}

r_daedalus_seal = {
	activation_duration = @triumph_duration_short
	portrait = "GFX_daedalus_seal"
	sound = "ap_rift_event_2_highfreq_activation"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
		produces = {
			astral_threads = 1
		}
	}

	triggered_country_modifier = {
		potential = {
			is_nomadic = no
		}
		custom_tooltip = daedalus_seal_acquisition_tt
		dimensional_lock_duration_mult = 0.25
	}

	score = 3000

	active_effect = {
		if = {
			limit = {
				is_nomadic = yes
			}
			custom_tooltip = daedalus_seal_active_effect_nomads_tt
			custom_tooltip = relic_triumph_cooldown_short
			hidden_effect = {
				every_bypass = {
					limit = {
						OR = {
							is_bypass_type = wormhole
							is_bypass_type = lgate
							is_bypass_type = shroud_tunnel
						}
						solar_system = {
							any_fleet_in_system = {
								owner = {
									is_same_value = root.owner
								}
								is_arkship_fleet = yes
							}
						}
					}
					lock_bypass = {
						country = root.owner
						duration = 1440 # 25% is added to this via the passive lock duration increase
					}
				}
				add_modifier = {
					modifier = "relic_activation_cooldown"
					days = @triumph_duration_short
				}
			}
		}
		else = {
			custom_tooltip = daedalus_seal_active_effect_tt
			custom_tooltip = relic_triumph_cooldown_short
			hidden_effect = {
				every_bypass = {
					limit = {
						OR = {
							is_bypass_type = wormhole
							is_bypass_type = lgate
							is_bypass_type = shroud_tunnel
						}
						solar_system = {
							has_owner = yes
							owner = {
								is_same_value = root.owner
							}
						}
					}
					lock_bypass = {
						country = owner
						duration = 1440 # 25% is added to this via the passive lock duration increase
					}
				}
				add_modifier = {
					modifier = "relic_activation_cooldown"
					days = @triumph_duration_short
				}
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_daedalus_seal
		}
		custom_tooltip = {
			fail_text = "daedalus_seal_no_bypasses_fail"
			OR = {
				any_bypass = {
					solar_system = {
						any_fleet_in_system = {
							owner = {
								is_same_value = root.owner
							}
							is_arkship_fleet = yes
						}
					}
				}
				any_bypass = {
					solar_system = {
						has_owner = yes
						owner = {
							is_same_value = root.owner
						}
					}
				}
			}
		}
	}

	ai_weight = {
		weight = 10
		modifier = {
			factor = 10
			is_militarist = yes
		}
		modifier = {
			factor = 100
			is_at_war = yes
		}
		modifier = {
			factor = 0
			count_bypass = {
				count = 0
				limit = {
					solar_system = {
						has_owner = yes
						owner = {
							is_same_value = root.owner
						}
					}
				}
			}
		}
	}
}

r_the_lost_patron = {
	activation_duration = @triumph_duration
	portrait = "GFX_the_lost_patron"
	sound = "relic_activation_lost_patron"

	resources = {
		category = relics
		# Activation cost
		cost = {
			sr_zro = 500
		}
	}

	score = 3000

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		custom_tooltip = the_lost_patron_passive_effect
	}

	active_effect = {
		if = {
			limit = {
				NOT = { has_country_flag = has_activated_the_lost_patron }
			}
			custom_tooltip = the_lost_patron_before_activation_tt
			hidden_effect = {
				set_country_flag = has_activated_the_lost_patron
				country_event = { id = shroud.6780 }
			}
		}
		else = {
			custom_tooltip = the_lost_patron_after_activation_effect_tt
			custom_tooltip = relic_triumph_cooldown
			hidden_effect = {
				change_variable = {
					which = available_dreamscaping_decisions
					value = 1
				}
				add_modifier = {
					modifier = "relic_activation_cooldown"
					days = @triumph_duration
				}
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_the_lost_patron
		}
	}

	ai_weight = {
		weight = 100
	}
}

@continuum_active_reward_months = 12

r_continuum = {
	activation_duration = @triumph_duration
	portrait = "GFX_continuum"
	sound = "relic_activation_continuum"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = @activation_cost
		}
	}

	ai_weight = {
		weight = 10
		modifier = {
			add = 10
			has_negative_income_with_stockpile = { RESOURCE = energy }
		}
		modifier = {
			add = 10
			has_negative_income_with_stockpile = { RESOURCE = minerals }
		}
		modifier = {
			add = 10
			has_negative_income_with_stockpile = { RESOURCE = food }
		}
		modifier = {
			add = 10
			has_negative_income_with_stockpile = { RESOURCE = alloys }
		}
		modifier = {
			add = 10
			has_negative_income_with_stockpile = { RESOURCE = consumer_goods }
		}
		modifier = {
			add = 10
			has_negative_income_with_stockpile = { RESOURCE = exotic_gases }
		}
		modifier = {
			add = 10
			has_negative_income_with_stockpile = { RESOURCE = rare_crystals }
		}
		modifier = {
			add = 10
			has_negative_income_with_stockpile = { RESOURCE = volatile_motes }
		}
		modifier = {
			add = 100
			has_actual_deficit = { RESOURCE = energy }
		}
		modifier = {
			add = 100
			has_actual_deficit = { RESOURCE = minerals }
		}
		modifier = {
			add = 100
			has_actual_deficit = { RESOURCE = food }
		}
		modifier = {
			add = 100
			has_actual_deficit = { RESOURCE = alloys }
		}
		modifier = {
			add = 100
			has_actual_deficit = { RESOURCE = consumer_goods }
		}
		modifier = {
			add = 100
			has_actual_deficit = { RESOURCE = exotic_gases }
		}
		modifier = {
			add = 100
			has_actual_deficit = { RESOURCE = rare_crystals }
		}
		modifier = {
			add = 100
			has_actual_deficit = { RESOURCE = volatile_motes }
		}
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		country_energy_produces_mult = 0.05
		country_minerals_produces_mult = 0.05
		country_food_produces_mult = 0.05
		country_alloys_produces_mult = 0.05
		country_consumer_goods_produces_mult = 0.05
		country_physics_tech_research_speed = 0.05
		country_society_tech_research_speed = 0.05
		country_engineering_tech_research_speed = 0.05
	}

	score = 3000

	active_effect = {
		add_monthly_resource_mult_if_produced = {
			RESOURCE = energy
			VALUE = @continuum_active_reward_months
		}
		add_monthly_resource_mult_if_produced = {
			RESOURCE = minerals
			VALUE = @continuum_active_reward_months
		}
		add_monthly_resource_mult_if_produced = {
			RESOURCE = food
			VALUE = @continuum_active_reward_months
		}
		add_monthly_resource_mult_if_produced = {
			RESOURCE = alloys
			VALUE = @continuum_active_reward_months
		}
		add_monthly_resource_mult_if_produced = {
			RESOURCE = consumer_goods
			VALUE = @continuum_active_reward_months
		}
		add_monthly_resource_mult_if_produced = {
			RESOURCE = physics_research
			VALUE = @continuum_active_reward_months
		}
		add_monthly_resource_mult_if_produced = {
			RESOURCE = society_research
			VALUE = @continuum_active_reward_months
		}
		add_monthly_resource_mult_if_produced = {
			RESOURCE = engineering_research
			VALUE = @continuum_active_reward_months
		}
		add_monthly_resource_mult_if_produced = {
			RESOURCE = exotic_gases
			VALUE = @continuum_active_reward_months
		}
		add_monthly_resource_mult_if_produced = {
			RESOURCE = rare_crystals
			VALUE = @continuum_active_reward_months
		}
		add_monthly_resource_mult_if_produced = {
			RESOURCE = volatile_motes
			VALUE = @continuum_active_reward_months
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_continuum
		}
	}
}

r_eternal_throne = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_eternal_throne"
	sound = "relic_activation_eternal_throne"

	resources = {
		category = relics
		# Activation cost
		cost = {
			astral_threads = 333
		}
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		custom_tooltip = eternal_throne_active_effect_tt
	}

	score = 3000

	active_effect = {
		add_modifier = {
			modifier = eternal_throne_modifier
			days = 3600
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_eternal_throne
		}
	}

	ai_weight = {
		weight = 10
		modifier = {
			factor = 100
			has_resource = { type = unity amount < @activation_cost }
		}
	}
}

r_weather_manipulator = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_weather_manipulation"
	sound = "relic_activation_weather_manipulator"

	resources = {
		category = relics
		# Activation cost
		cost = {
			unity = 3000
		}
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		country_physics_research_produces_mult = 0.15
	}

	score = 1000

	active_effect = {
		custom_tooltip = storm_relic_repelling_field_modifier_tt
		capital_scope = {
			hidden_effect = {
				add_modifier = {
					modifier = storm_relic_repelling_field_modifier
					months = 36
				}
			}
			create_cosmic_storm_influence_field = {
				center = this.solar_system
				radius = {
					base = 300
					modifier = {
						mult = value:storm_size_multiplier
					}
				}
				is_timed_influence_field = yes
			}
		}

		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_weather_manipulator
		}
	}

	ai_weight = {
		weight = 10
		modifier = {
			factor = 10
			num_cosmic_storms_encountered > 3
		}

		modifier = {
			factor = 0
			 has_origin = origin_storm_chasers
		}
	}
}

#Cosmic Storm Relics

r_the_tempest_invocator = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_the_tempest_exsoulcillator"
	sound = "relic_activation_vultaum_real_perforator"

	resources = {
		category = relics
		# Activation cost
		cost = {
			energy = 50000
		}
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		country_unity_produces_mult = 0.1
		ships_upkeep_mult = -0.15
	}

	score = 1000

	active_effect = {
		custom_tooltip = r_the_tempest_invocator_active_effect_tt

		set_country_flag = "started_placing_storm"

		start_storm_area_placing = {
			sacrifice_leader_with_ui = yes
			cosmic_storm = nexus_storm
			immediate = yes

			reticle_radius = {
				base = 100
				modifier = {
					mult = value:storm_area_placing_reticle_radius_multiplier
				}
			}

			max_range = {
				base = 1500
				modifier = {
					mult = value:storm_area_placing_max_range_multiplier
				}
			}

			on_confirm = {
				add_modifier = {
					modifier = tempest_invocator_active_modifier
					days = 3600
				}
				custom_tooltip = relic_triumph_cooldown

				hidden_effect = {
					add_modifier = {
						modifier = "relic_activation_cooldown"
						days = @triumph_duration
					}
					set_country_flag = used_tempest_invocator_relic_achievement
				}

				remove_country_flag = "started_placing_storm"
			}

			on_cancel = {
				add_resource = {
					energy = 50000
				}

				remove_country_flag = "started_placing_storm"
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_the_tempest_invocator
		}

		custom_tooltip = {
			fail_text = r_the_tempest_invocator_started_placing_fail_tt
			NOT = { has_country_flag = "started_placing_storm" }
		}

		custom_tooltip = {
			fail_text = r_the_tempest_invocator_requirement_fail_tt
			any_owned_leader = {
				leader_class = scientist
			}
		}
	}
}

# Origin Cosmic Dawn
r_pyroglyphic_codex = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_pyroglyphic_codex"
	sound = "relic_activation_generic"
	can_be_stolen = no

	resources = {
		category = relics
		cost = {
			energy = 10000
		}
	}

	triggered_country_modifier = {
		potential = { always = yes }
		country_unity_produces_mult = 0.10
	}

	score = 1000

	active_effect = {
		add_modifier = {
			modifier = pyroglyphic_codex_mod
			years = 10
		}
		custom_tooltip = r_pyroglyphic_codex_effect_tt
		hidden_effect = {
			if = {
				limit = {
					NOT = { has_country_flag = pyroglyphic_codex }
				}
				set_country_flag = pyroglyphic_codex
				capital_scope = { #effects applied only the first time the relic is used
					add_modifier = { modifier = infernal_library }
				}
			}
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
		custom_tooltip = relic_triumph_cooldown
	}

	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_pyroglyphic_codex
		}
	}
}

# Hyperthermia Crisis Path
r_crystallized_singularity = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_crystallized_singularity"
	sound = "relic_activation_generic"
	can_be_stolen = no

	resources = {
		category = relics
		cost = {
			unity = @activation_cost
		}
		produces = {
			trigger = { has_country_flag = relic_cs_trigger }
			energy = 1
			mult = value:percent_monthly_resource_income|RESOURCE|physics_research|PERCENT|10|
		}
	}

	triggered_country_modifier = {
		potential = { always = yes }
		country_physics_tech_research_speed = 0.10
	}

	score = 1500

	active_effect = {
		add_modifier = {
			modifier = crystallized_singularity_mod
			years = 10
		}
		custom_tooltip = r_crystallized_singularity_effect_tt
		if = {
			limit = {
				NOR = {
					has_civic = civic_hive_devouring_swarm
					has_civic = civic_fanatic_purifiers
					has_civic = civic_machine_terminator
				}
			}
			custom_tooltip = r_crystallized_singularity_ls_effect_tt
		}
		hidden_effect = {
			set_timed_country_flag = {
				flag = relic_cs_trigger
				days = @triumph_duration
			}
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
			if = {
				limit = {
					NOR = {
						has_civic = civic_hive_devouring_swarm
						has_civic = civic_fanatic_purifiers
						has_civic = civic_machine_terminator
					}
				}
				set_variable = { which = gh_life_seeder_var value = 3 }
			}
		}
		custom_tooltip = relic_triumph_cooldown
	}

	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_crystallized_singularity
		}
	}
}

# Champion's Forge Live! Trophy

r_cfl_trophy = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_cfl_trophy"
	sound = "relic_cfl_trophy"

	resources = {
		category = relics
		# Activation cost
		cost = {
			influence = 200
		}
	}

	can_be_stolen = no

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		diplo_weight_naval_mult = 0.3
	}

	score = 200

	active_effect = {
		add_modifier = {
			modifier = "cfl_trophy"
			days = @triumph_duration
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_cfl_trophy
		}
	}
}

r_tarnished_cfl_trophy = {
	activation_duration = @triumph_duration
	portrait = "GFX_relic_tarnished_cfl_trophy"
	sound = "relic_tarnished_cfl_trophy"

	resources = {
		category = relics
		# Activation cost
		cost = {
			influence = 200
		}
	}

	ai_weight = {
		weight = 100
	}

	triggered_country_modifier = {
		potential = {
			always = yes
		}
		diplo_weight_naval_mult = 0.25
	}

	triggered_country_modifier = {
		potential = {
			has_country_flag = champions_forge_destroyer
		}
		custom_tooltip = champions_forge_destroyer_trophy_opinion
	}

	score = 200

	active_effect = {
		add_modifier = {
			modifier = "tarnished_cfl_trophy"
			days = @triumph_duration
		}
		custom_tooltip = relic_triumph_cooldown
		hidden_effect = {
			add_modifier = {
				modifier = "relic_activation_cooldown"
				days = @triumph_duration
			}
		}
	}

	# Possible check for activation
	possible = {
		inline_script = {
			script = relics/activation_checks
			RELIC = r_tarnished_cfl_trophy
		}
	}
}
