# See traditions/README.txt for format

#################
# APOCALYPSE ASCENSION PERKS
#################

ap_enigmatic_engineering = {
	potential = {
		host_has_dlc = "Apocalypse"
		NOT = {
			has_ascension_perk = ap_enigmatic_engineering
			has_authority = auth_xilin_mind #希灵帝国自带该飞升效果
		}
	}
	
	possible = {
		custom_tooltip = {
			fail_text = "requires_ascension_perks_1"
			num_ascension_perks > 0
		}
	}
	
	on_enabled = {
		custom_tooltip = "no_rev_engineering"
	}
	
	modifier = {		
		ship_sensor_range_add = 2
	}
	
	ai_weight = {
		factor = 10
		modifier = {
			factor = 2
			has_ethic = ethic_materialist
		}
		modifier = {
			factor = 3
			has_ethic = ethic_fanatic_materialist
		}
	}
}


#################
# ASCENSION PATHS
#################

@ap_engineered_evolution_POINTS = 3
@ap_engineered_evolution_COST_MULT = -0.25
ap_engineered_evolution = {
	on_enabled = {
		add_research_option = tech_gene_seed_purification
		hidden_effect = {
			country_event = { id = utopia.2700 }
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = "synthetic_empire_biological_ascension"
			NOT = { has_trait = trait_mechanical }
		}	
		custom_tooltip = {
			fail_text = "requires_ascension_perks_1"
			num_ascension_perks > 0
		}
		custom_tooltip = {
			fail_text = "requires_technology_gene_tailoring"
			has_technology = tech_gene_tailoring
		}
		custom_tooltip = {
			fail_text = "requires_not_ap_the_flesh_is_weak"
			NOT = { has_ascension_perk = ap_the_flesh_is_weak }
		}
		custom_tooltip = {
			fail_text = "requires_not_ap_mind_over_matter"
			NOT = { has_ascension_perk = ap_mind_over_matter }
		}
	}
	modifier = {
		description = ap_engineered_evolution_modifier_desc
		description_parameters = {
			POINTS = @ap_engineered_evolution_POINTS
			COST_MULT = @ap_engineered_evolution_COST_MULT
		}

		BIOLOGICAL_species_trait_points_add = @ap_engineered_evolution_POINTS

		modify_species_cost_mult = @ap_engineered_evolution_COST_MULT
	}
	
	potential = {
		host_has_dlc = "Utopia"
		NOT = {
			has_ascension_perk = ap_engineered_evolution
			has_authority = "auth_machine_intelligence"
			has_authority = auth_xilin_mind #希灵政体不能直接用设计进化飞升
		}
		is_mechanical_empire = no
		is_cyborg_empire = no
	}
	
	ai_weight = {
		factor = 10
		modifier = {
			factor = 0
			num_owned_planets < 10
		}
	}
}

@ap_evolutionary_mastery_POINTS = 3
@ap_evolutionary_mastery_COST_MULT = -0.25
ap_evolutionary_mastery = {
	on_enabled = {
		add_research_option = tech_genetic_resequencing
		hidden_effect = {
			country_event = { id = utopia.2703 }
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = "synthetic_empire_biological_ascension"
			NOT = { has_trait = trait_mechanical }
		}
		custom_tooltip = {
			fail_text = "requires_ascension_perks_3"
			num_ascension_perks > 2
		}
		custom_tooltip = {
			fail_text = "requires_technology_gene_expressions"
			has_technology = tech_gene_expressions
		}
		custom_tooltip = {
			fail_text = "requires_ap_engineered_evolution"
			has_ascension_perk = ap_engineered_evolution
		}
	}
	modifier = {
		description = ap_evolutionary_mastery_modifier_desc
		description_parameters = {
			POINTS = @ap_evolutionary_mastery_POINTS
			COST_MULT = @ap_evolutionary_mastery_COST_MULT
		}

		BIOLOGICAL_species_trait_points_add = @ap_evolutionary_mastery_POINTS

		modify_species_cost_mult = @ap_evolutionary_mastery_COST_MULT
	}
	
	potential = {
		host_has_dlc = "Utopia"
		NOT = {
			has_ascension_perk = ap_evolutionary_mastery
			has_authority = "auth_machine_intelligence"
			has_authority = auth_xilin_mind #希灵政体不能直接用掌控进化飞升
		}
		is_mechanical_empire = no
		is_cyborg_empire = no		
	}
	
	ai_weight = {
		factor = 100
	}
}

ap_the_flesh_is_weak = {
	on_enabled = {
		custom_tooltip = "flesh_is_weak_tooltip"
		hidden_effect = {
			country_event = { id = utopia.2500 }
		}
	}
	modifier = {
		pop_robot_upkeep_mult = -0.10
		pop_robot_build_speed_mult = 0.33
	}	
	possible = {
		custom_tooltip = {
			fail_text = "synthetic_empire_synthetic_ascension"
			NOT = { has_trait = trait_mechanical }
		}
		custom_tooltip = {
			fail_text = "hive_mind_biological_ascension_only2"
			NOT = { has_authority = auth_hive_mind }
		}
		custom_tooltip = {
			fail_text = "requires_ascension_perks_1"
			num_ascension_perks > 0
		}
		custom_tooltip = {
			fail_text = "requires_technology_droid_workers"
			has_technology = tech_droid_workers
		}
		custom_tooltip = {
			fail_text = "requires_not_ap_engineered_evolution"
			NOT = { has_ascension_perk = ap_engineered_evolution }
		}
		custom_tooltip = {
			fail_text = "requires_not_ap_mind_over_matter"
			NOT = { has_ascension_perk = ap_mind_over_matter }
		}
	}
	
	potential = {
		host_has_dlc = "Utopia"
		NOT = {
			has_ascension_perk = ap_the_flesh_is_weak
			has_authority = "auth_machine_intelligence"
			has_authority = auth_xilin_mind #希灵政体不能直接用血肉苦弱飞升
			#和谐国家不能用机械飞升
			has_valid_civic = civic_harmonious
			has_valid_civic = civic_harmonious_tree
			has_modifier = m_kala_gift
		}
		is_mechanical_empire = no		
	}
	
	ai_weight = {
		factor = 20
		modifier = {
			factor = 0.1
			NOR = {
				has_ethic = ethic_materialist
				has_ethic = ethic_fanatic_materialist
			}
		}
		modifier = {
			factor = 0
			num_owned_planets < 10
		}		
	}
}

ap_synthetic_evolution = {
	on_enabled = {
		custom_tooltip = "synthetic_evolution_tooltip"
		hidden_effect = {
			country_event = { id = utopia.2550 }
		}
	}
	modifier = {
		pop_robot_upkeep_mult = -0.10
		ROBOT_species_trait_points_add = 1
	}		
	possible = {
		custom_tooltip = {
			fail_text = "synthetic_empire_synthetic_ascension"
			NOT = { has_trait = trait_mechanical }
		}
		custom_tooltip = {
			fail_text = "hive_mind_biological_ascension_only2"
			NOT = { has_authority = auth_hive_mind }
		}
		custom_tooltip = {
			fail_text = "requires_ascension_perks_3"
			num_ascension_perks > 2
		}
		custom_tooltip = {
			fail_text = "requires_technology_synthetic_workers"
			has_technology = tech_synthetic_workers
		}
		custom_tooltip = {
			fail_text = "requires_technology_synthetic_leaders"
			has_technology = tech_synthetic_leaders
		}
		custom_tooltip = {
			fail_text = "requires_ap_the_flesh_is_weak"
			has_ascension_perk = ap_the_flesh_is_weak
		}
		custom_tooltip = {
			fail_text = "requires_finished_cybernetics_project"
			NOT = { has_special_project = FLESH_IS_WEAK_PROJECT }
		}
	}
	
	potential = {
		host_has_dlc = "Utopia"
		NOT = {
			has_ascension_perk = ap_synthetic_evolution
			has_authority = "auth_machine_intelligence"
			has_authority = auth_xilin_mind #希灵政体不能直接用合成进化飞升
			#和谐国家不能用机械飞升
			has_valid_civic = civic_harmonious
			has_valid_civic = civic_harmonious_tree
			has_modifier = m_kala_gift
		}
		is_mechanical_empire = no
	}
	
	ai_weight = {
		factor = 100
	}
}

ap_mind_over_matter = {
	on_enabled = {
		custom_tooltip = "mind_over_matter_tooltip"
		hidden_effect = {
			country_event = { id = utopia.2600 }
		}
		add_research_option = tech_telepathy
	}
	possible = {	
		custom_tooltip = {
			fail_text = "synthetic_empire_psionic_ascension"
			NOT = { has_trait = trait_mechanical }
		}
		custom_tooltip = {
			fail_text = "hive_mind_biological_ascension_only1"
			NOT = { has_authority = auth_hive_mind }
		}
		custom_tooltip = {
			fail_text = "requires_ascension_perks_1"
			num_ascension_perks > 0
		}
		custom_tooltip = {
			fail_text = "requires_technology_psionic_theory"
			has_technology = tech_psionic_theory
		}
		custom_tooltip = {
			fail_text = "requires_not_ap_engineered_evolution"
			NOT = { has_ascension_perk = ap_engineered_evolution }
		}
		custom_tooltip = {
			fail_text = "requires_not_ap_the_flesh_is_weak"
			NOT = { has_ascension_perk = ap_the_flesh_is_weak }
		}
	}
	
	potential = {
		host_has_dlc = "Utopia"
		NOT = {
			has_ascension_perk = ap_mind_over_matter
			has_authority = "auth_machine_intelligence"
			has_authority = auth_xilin_mind #希灵政体不能直接用心胜于物飞升
		}
		is_mechanical_empire = no
		is_cyborg_empire = no
	}
	
	ai_weight = {
		factor = 20
		modifier = {
			factor = 0.1
			NOR = {
				has_ethic = ethic_spiritualist
				has_ethic = ethic_fanatic_spiritualist
			}
		}	
		modifier = {
			factor = 0
			num_owned_planets < 10
		}		
	}
}

ap_transcendence = {
	on_enabled = {
		custom_tooltip = "transcendence_tooltip"
		hidden_effect = {
			country_event = { id = utopia.2650 }
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = "synthetic_empire_psionic_ascension"
			NOT = { has_trait = trait_mechanical }
		}
		custom_tooltip = {
			fail_text = "hive_mind_biological_ascension_only1"
			NOT = { has_authority = auth_hive_mind }
		}
		custom_tooltip = {
			fail_text = "requires_ascension_perks_3"
			num_ascension_perks > 2
		}
		custom_tooltip = {
			fail_text = "requires_ap_mind_over_matter"
			has_ascension_perk = ap_mind_over_matter
		}
	}
	
	potential = {
		host_has_dlc = "Utopia"
		NOT = {
			has_ascension_perk = ap_transcendence
			has_authority = "auth_machine_intelligence"
			has_authority = auth_xilin_mind #希灵政体不能直接用飞升
		}
		is_mechanical_empire = no
		is_cyborg_empire = no		
	}
	
	ai_weight = {
		factor = 100
	}
}

#################
# GENERIC ASCENSION PERKS
#################

#和谐蜂群国家无需地形塑造飞升,就可改造盖亚世界
ap_world_shaper = {
	possible = {
		custom_tooltip = {
			fail_text = "requires_technology_tech_climate_restoration"
			has_technology = tech_climate_restoration
		}	
		custom_tooltip = {
			fail_text = "requires_ascension_perks_2"
			num_ascension_perks > 1
		}
	}

	modifier = {
		terraforming_cost_mult = -0.25
	}
	
	on_enabled = {
		custom_tooltip = "allow_gaia"
	}
	
	potential = {
		NOT = {
			has_ascension_perk = ap_world_shaper
			#和谐蜂群国家无需地形塑造飞升
			has_valid_civic = civic_harmonious
		}
	}
	
	ai_weight = {
		factor = 10
		modifier = {
			factor = 0.1
			has_authority = auth_machine_intelligence
			NOT = { has_ascension_perk = ap_machine_worlds }
		}
	}
}

ap_consecrated_worlds = {
	on_enabled = {
		custom_tooltip = "allow_edict_consectrated_worlds"
		custom_tooltip = "describe_edict_consectrated_worlds"
	}
	
	potential = {
		NOT = {
			has_ascension_perk = ap_consecrated_worlds
		}
		OR = {
			has_ethic = ethic_spiritualist
			has_ethic = ethic_fanatic_spiritualist
			has_authority = auth_xilin_mind #希灵帝国允许行星祝圣
		}
	}
	
	ai_weight = {
		factor = 10
	}
}


ap_shared_destiny = {
	modifier = {
		subject_integration_influence_cost_mult = -0.5
	}
	
	potential = {
		NOR = {
			has_valid_civic = civic_fanatic_purifiers
			has_valid_civic = civic_hive_devouring_swarm
			has_valid_civic = civic_inwards_perfection
			has_valid_civic = civic_machine_terminator
			#希灵帝国不能合并附庸
			has_authority = auth_xilin_mind
		}
		NOT = {
			has_ascension_perk = ap_shared_destiny
		}
	}
	
	ai_weight = {
		factor = 5
	}
}



