﻿namespace = country

country_event = {
    id = country.77000
    title = "神皇"
    desc = "陛下登临神皇之座，引导我们前进。"
    picture = GFX_evt_psionics
    is_triggered_only = yes
	show_sound = event_activating_unknown_technology
	location = root
	is_triggered_only = yes
    trigger = { is_ai = no  }
    option = {
        name = 天佑神皇，天佑帝国
		create_fleet = {
			name = "神皇化身"
			settings = {
				is_boss = no
			}			
			effect = {
				set_owner = root
				create_ship = {
					name = "神皇化身"
					design = "immortal"
					prefix = no
					upgradable = no
				}
				set_location = root.capital_scope
			}
		}
        random_owned_leader = {
            limit = { leader_class = ruler }                
            add_trait = trait_ruler_godemperor                        
        }
			immediate = {
		solar_system = {
			every_system_planet = {
				limit = {
					NOR = {
						is_asteroid = yes
						is_planet_class = pc_gas_giant
						is_planet_class = pc_ringworld_habitable
						is_planet_class = pc_ringworld_habitable_damaged
						is_planet_class = pc_ringworld_tech
						is_planet_class = pc_ringworld_tech_damaged
						is_planet_class = pc_ringworld_seam
						is_planet_class = pc_ringworld_seam_damaged
						is_planet_class = pc_habitat
						is_star = yes
					}
					planet_size > 9
					planet_size < 26
				}
				every_owned_pop = {
					limit = {
						is_robot_pop = no
						is_sapient = yes
					}
					if = {
						limit = {
							NOT = { has_trait = trait_true_psionic }
						}
						modify_species = {
							species = this
							add_trait = trait_true_psionic
						}
					}
					if = {
						limit = {
							has_trait = trait_pc_nuked_preference
						}
						modify_species = {
							species = this
							remove_trait = trait_pc_nuked_preference
						}
					}
					if = {
						limit = {
							has_trait = trait_pc_desert_preference
						}
						modify_species = {
							species = this
							remove_trait = trait_pc_desert_preference
						}
					}
					if = {
						limit = {
							has_trait = trait_pc_arid_preference
						}
						modify_species = {
							species = this
							remove_trait = trait_pc_arid_preference
						}
					}
					if = {
						limit = {
							has_trait = trait_pc_savannah_preference
						}
						modify_species = {
							species = this
							remove_trait = trait_pc_savannah_preference
						}
					}
					if = {
						limit = {
							has_trait = trait_pc_tropical_preference
						}
						modify_species = {
							species = this
							remove_trait = trait_pc_tropical_preference
						}
					}
					if = {
						limit = {
							has_trait = trait_pc_ocean_preference
						}
						modify_species = {
							species = this
							remove_trait = trait_pc_ocean_preference
						}
					}
					if = {
						limit = {
							has_trait = trait_pc_arctic_preference
						}
						modify_species = {
							species = this
							remove_trait = trait_pc_arctic_preference
						}
					}
					if = {
						limit = {
							has_trait = trait_pc_tundra_preference
						}
						modify_species = {
							species = this
							remove_trait = trait_pc_tundra_preference
						}
					}
					if = {
						limit = {
							has_trait = trait_pc_alpine_preference
						}
						modify_species = {
							species = this
							remove_trait = trait_pc_alpine_preference
						}
					}
					if = {
						limit = {
							has_trait = trait_pc_continental_preference
						}
						modify_species = {
							species = this
							remove_trait = trait_pc_continental_preference
						}
					}
					if = {
						limit = {
							has_trait = trait_pc_ai_preference
						}
						modify_species = {
							species = this
							remove_trait = trait_pc_ai_preference
						}
					}
					if = {
						limit = {
							has_trait = trait_pc_gaia_preference
						}
						modify_species = {
							species = this
							remove_trait = trait_pc_gaia_preference
						}
					}
					if = {
						limit = {
							has_trait = trait_pc_ringworld_habitable_preference
						}
						modify_species = {
							species = this
							remove_trait = trait_pc_ringworld_habitable_preference
						}
					}
					modify_species = {
						species = this
						add_trait = trait_people_of_god_preference
					}
				}
			}
			random_system_planet = {
				limit = { is_star = yes }
				# explosion ambient object
			}
		}
	}

		custom_tooltip = ALLOW_PSI_CORPS
		custom_tooltip = ALLOW_PSI_ARMIES
		country_event = { id = utopia.2655 days = 5 random = 5 }
    }
}
