#############################
##
## Pop Events
##
## Written by Henrik Thyrwall
##
#############################
#
namespace = pop
#
#### Pop Self Modification
#pop_event = {
#	id = "pop.1"
#	title = "pop.1.name"
#	desc = "pop.1.desc"
#	picture = GFX_evt_cybernetics
#	fire_only_once = yes
#	is_triggered_only = yes
#
#	pre_triggers = {
#		has_owner = yes
#		is_enslaved = no
#		is_being_purged = no
#		is_being_assimilated = no
#		has_planet = yes
#		is_sapient = yes
#	}
#
#	trigger = {
#		is_exact_same_species = owner
#		is_robot_pop_group = no
#		happiness < 0.5
#		NOR = {
#			has_trait = trait_necrophage
#			has_trait = trait_clone_soldier_infertile
#			has_trait = trait_clone_soldier_infertile_full_potential
#			has_trait = trait_malleable_genes
#		}
#		planet = {
#			NOT = { is_planet_class = pc_habitat }
#			habitability = {
#				who = root
#				value < 0.4
#			}
#			is_capital = no
#			has_owner = yes
#			owner = {
#				is_country_type = default
#				has_technology = "tech_gene_tailoring"
#				NOT = { has_country_flag = pop_modification }
#				prev = {
#					is_ideal_planet_class = {
#						who = prev
#						status = no
#					}
#					controller = { is_same_value = prevprev }
#				}
#				is_wilderness_empire = no
#			}
#			count_owned_pop_amount = {
#				limit = {
#					is_exact_same_species = ROOT
#					is_enslaved = no
#					is_being_purged = no
#				}
#				count >= 400
#			}
#		}
#	}
#
#	immediate = {
#		planet = {
#			owner = { set_country_flag = pop_modification }
#			set_carrier_flag = pop_modification
#			create_species = {
#				is_mod = yes
#				name = this
#				plural = this
#				class = this
#				portrait = this
#				traits = {
#					trait = trait_self_modified
#					trait = random_traits
#				}
#				homeworld = this
#			}
#			if = {
#				limit = {
#					owner = {
#						has_trait = trait_necrophage
#					}
#				}
#				last_created_species = {
#					modify_species = {
#						species = this
#						add_trait = trait_necrophage
#						change_scoped_species = no
#					}
#				}
#			}
#		}
#
#		if = {
#			limit = {
#				planet = {
#					count_owned_pop_amount = {
#						limit = {
#							is_same_species = ROOT
#						}
#						count <= 500
#					}
#				}
#			}
#			planet = {
#				weighted_random_owned_pop_group = {
#					limit = {
#						NOT = { is_pop = ROOT }
#						is_same_species = ROOT
#						is_enslaved = no
#						is_being_purged = no
#						is_robot_pop_group = no
#					}
#					change_species = last_created_species
#					set_pop_group_flag = modified_pop_1
#				}
#				weighted_random_owned_pop_group = {
#					limit = {
#						NOT = { is_pop = ROOT }
#						is_same_species = ROOT
#						is_enslaved = no
#						is_being_purged = no
#						is_robot_pop_group = no
#					}
#					change_species = last_created_species
#					set_pop_group_flag = modified_pop_1
#				}
#				weighted_random_owned_pop_group = {
#					limit = {
#						NOR = {
#							is_pop = ROOT
#							has_pop_group_flag = modified_pop_1
#						}
#						is_same_species = ROOT
#						is_enslaved = no
#						is_being_purged = no
#						is_robot_pop_group = no
#					}
#					save_event_target_as = non_modified_pop_1
#				}
#				every_owned_pop_group = {
#					limit = {
#						NOT = { is_pop = ROOT }
#						is_same_species = ROOT
#						is_enslaved = no
#						is_being_purged = no
#						is_robot_pop_group = no
#					}
#					set_pop_group_flag = non_modified_pop_1
#				}
#				weighted_random_owned_pop_group = {
#					limit = {
#						is_pop = ROOT
#						is_enslaved = no
#						is_being_purged = no
#						is_robot_pop_group = no
#					}
#					change_species = last_created_species
#					save_event_target_as = modified_pop_1
#					set_pop_group_flag = modified_pop_1
#				}
#			}
#		}
#		if = {
#			limit = {
#				planet = {
#					count_owned_pop_amount = {
#						limit = {
#							is_same_species = ROOT
#						}
#						count >= 700
#					}
#				}
#			}
#			planet = {
#				weighted_random_owned_pop_group = {
#					limit = {
#						NOT = { is_pop = ROOT }
#						is_same_species = ROOT
#						is_enslaved = no
#						is_being_purged = no
#						is_robot_pop_group = no
#					}
#					change_species = last_created_species
#					set_pop_group_flag = modified_pop_1
#				}
#				weighted_random_owned_pop_group = {
#					limit = {
#						NOT = { is_pop = ROOT }
#						is_same_species = ROOT
#						is_enslaved = no
#						is_being_purged = no
#						is_robot_pop_group = no
#					}
#					change_species = last_created_species
#					set_pop_group_flag = modified_pop_1
#				}
#				weighted_random_owned_pop_group = {
#					limit = {
#						NOT = { is_pop = ROOT }
#						is_same_species = ROOT
#						is_enslaved = no
#						is_being_purged = no
#						is_robot_pop_group = no
#					}
#					change_species = last_created_species
#					set_pop_group_flag = modified_pop_1
#				}
#				weighted_random_owned_pop_group = {
#					limit = {
#						NOT = { is_pop = ROOT }
#						is_same_species = ROOT
#						is_enslaved = no
#						is_being_purged = no
#						is_robot_pop_group = no
#					}
#					change_species = last_created_species
#					set_pop_group_flag = modified_pop_1
#				}
#				weighted_random_owned_pop_group = {
#					limit = {
#						NOT = { is_pop = ROOT }
#						is_same_species = ROOT
#						is_enslaved = no
#						is_being_purged = no
#						is_robot_pop_group = no
#					}
#					save_event_target_as = non_modified_pop_1
#				}
#				every_owned_pop_group = {
#					limit = {
#						NOT = { is_pop = ROOT }
#						is_same_species = ROOT
#						is_enslaved = no
#						is_being_purged = no
#						is_robot_pop_group = no
#					}
#					set_pop_group_flag = non_modified_pop_1
#				}
#				weighted_random_owned_pop_group = {
#					limit = {
#						is_pop = ROOT
#						is_enslaved = no
#						is_being_purged = no
#						is_robot_pop_group = no
#					}
#					save_event_target_as = modified_pop_1
#					set_pop_group_flag = modified_pop_1
#					change_species = last_created_species
#				}
#			}
#		}
#	}
#
#	option = {
#		name = "OK"
#	}
#}
#
## Rising Tensions (HIDDEN)
#pop_group_event = {
#	id = pop.2
#	hide_window = yes
#
#	fire_only_once = yes
#	is_triggered_only = yes
#
#	trigger = {
#		planet = {
#			has_carrier_flag = pop_modification
#			exists = owner
#			owner = { has_country_flag = pop_modification }
#		}
#		has_pop_group_flag = modified_pop_1
#		is_enslaved = no
#		is_being_purged = no
#		NOR = {
#			has_ethic = ethic_fanatic_pacifist
#			has_ethic = ethic_pacifist
#			has_ethic = ethic_xenophile
#			has_ethic = ethic_fanatic_xenophile
#		}
#		planet = {
#			any_owned_pop_group = {
#				NOT = { is_pop = ROOT }
#				is_exact_same_species = owner
#				is_enslaved = no
#				is_being_purged = no
#				is_robot_pop_group = no
#			}
#		}
#	}
#
#	immediate = {
#		save_event_target_as = modified_pop_1
#		planet = {
#			set_carrier_flag = popmod_rising_tensions
#			weighted_random_owned_pop_group = {
#				limit = {
#					NOT = { is_pop = ROOT }
#					is_exact_same_species = owner
#					is_enslaved = no
#					is_being_purged = no
#				}
#				save_event_target_as = non_modified_pop_1
#			}
#		}
#		planet = {
#			carrier_event = { id = pop.3 }
#		}
#	}
#}
#
## Rising Tensions
#carrier_event = {
#	id = pop.3
#	title = "pop.3.name"
#	desc = "pop.3.desc"
#	picture = GFX_evt_nuclear_explosion
#
#	is_triggered_only = yes
#
#	option = {
#		name = WORRYING
#		custom_tooltip = pop.3.a.tooltip
#		hidden_effect = {
#			every_owned_pop_group = {
#				limit = {
#					is_same_species = FROM
#					has_any_ethic = yes
#					NOT = { has_ethic = ethic_xenophobe }
#				}
#				pop_group_transfer_ethic = {
#					POP_GROUP = this
#					ETHOS = ethic_xenophobe
#					PERCENTAGE = 1 # 100%
#				}
#			}
#			every_owned_pop_group = {
#				limit = {
#					is_same_species = owner
#					has_any_ethic = yes
#					NOT = { has_ethic = ethic_xenophobe }
#				}
#				pop_group_transfer_ethic = {
#					POP_GROUP = this
#					ETHOS = ethic_xenophobe
#					PERCENTAGE = 1 # 100%
#				}
#			}
#		}
#	}
#}
#
## Increased Fertility (HIDDEN)
#pop_group_event = {
#	id = pop.5
#	hide_window = yes
#	is_triggered_only = yes
#
#	fire_only_once = yes
#
#	trigger = {
#		planet = {
#			has_carrier_flag = pop_modification
#			has_carrier_flag = popmod_rising_tensions
#			NOT = { has_carrier_flag = popmod_fertility }
#			owner = { has_country_flag = pop_modification }
#		}
#		has_pop_group_flag = modified_pop_1
#		is_enslaved = no
#		is_being_purged = no
#		planet = {
#			any_owned_pop_group = {
#				NOT = { is_pop = ROOT }
#				is_same_species = owner
#				is_enslaved = no
#				is_being_purged = no
#				is_robot_pop_group = no
#			}
#		}
#	}
#
#	immediate = {
#		save_event_target_as = modified_pop_1
#		planet = {
#			set_carrier_flag = popmod_fertility
#			weighted_random_owned_pop_group = {
#				limit = {
#					NOT = { is_pop = ROOT }
#					is_same_species = owner
#					is_enslaved = no
#					is_being_purged = no
#					is_robot_pop_group = no
#				}
#				save_event_target_as = non_modified_pop_1
#			}
#		}
#		planet = {
#			carrier_event = { id = pop.6 }
#		}
#	}
#}
#
## Increased Fertility
#carrier_event = {
#	id = pop.6
#	title = "pop.6.name"
#	desc = "pop.6.desc"
#	picture = GFX_evt_cybernetics
#
#	is_triggered_only = yes
#
#	option = {
#		name = WORRYING
#		custom_tooltip = pop.6.tooltip
#		hidden_effect = {
#			modify_species = {
#				species = FROM
#				add_trait = trait_rapid_breeders
#			}
#		}
#	}
#}
#
## Pureblood attack against Mutants (HIDDEN)
#pop_group_event = {
#	id = pop.7
#	hide_window = yes
#
#	fire_only_once = yes
#	is_triggered_only = yes
#
#	trigger = {
#		planet = {
#			has_carrier_flag = pop_modification
#			has_carrier_flag = popmod_rising_tensions
#			owner = { has_country_flag = pop_modification }
#		}
#		has_pop_group_flag = modified_pop_1
#		is_enslaved = no
#		is_being_purged = no
#		planet = {
#			any_owned_pop_group = {
#				NOT = { is_pop = ROOT }
#				is_same_species = owner
#				is_enslaved = no
#				is_being_purged = no
#				is_robot_pop_group = no
#			}
#		}
#	}
#
#	immediate = {
#		save_event_target_as = modified_pop_1
#		planet = {
#			weighted_random_owned_pop_group = {
#				limit = {
#					NOT = { is_pop = ROOT }
#					is_same_species = owner
#					is_enslaved = no
#					is_being_purged = no
#					is_robot_pop_group = no
#				}
#				save_event_target_as = non_modified_pop_1
#			}
#		}
#		planet = {
#			carrier_event = { id = pop.8 }
#		}
#	}
#}
#
## Pureblood attack against Mutants
#carrier_event = {
#	id = pop.8
#	title = "pop.8.name"
#	desc = "pop.8.desc"
#	picture = GFX_evt_cybernetics
#
#	is_triggered_only = yes
#	fire_only_once = yes
#
#	option = {
#		name = WORRYING
#		FROM = { kill_pop = yes }
#	}
#}
#
## Mutant attack against Purebloods (HIDDEN)
#pop_group_event = {
#	id = pop.9
#	hide_window = yes
#	is_triggered_only = yes
#
#	fire_only_once = yes
#
#	trigger = {
#		planet = {
#			has_carrier_flag = pop_modification
#			has_carrier_flag = popmod_rising_tensions
#			owner = { has_country_flag = pop_modification }
#		}
#		has_pop_group_flag = non_modified_pop_1
#		is_enslaved = no
#		is_being_purged = no
#		planet = {
#			any_owned_pop_group = {
#				has_pop_group_flag = modified_pop_1
#				is_enslaved = no
#				is_being_purged = no
#				is_robot_pop_group = no
#			}
#		}
#	}
#
#	immediate = {
#		save_event_target_as = non_modified_pop_1
#		planet = {
#			weighted_random_owned_pop_group = {
#				limit = {
#					has_pop_group_flag = modified_pop_1
#					is_enslaved = no
#					is_being_purged = no
#					is_robot_pop_group = no
#				}
#				save_event_target_as = modified_pop_1
#			}
#		}
#		planet = {
#			carrier_event = { id = pop.10 }
#		}
#	}
#}
#
## Mutant attack against Purebloods
#carrier_event = {
#	id = pop.10
#	title = "pop.10.name"
#	desc = { text = pop.10a.desc }
#	desc = { text = pop.10b.desc }
#	picture = GFX_evt_cybernetics
#
#	is_triggered_only = yes
#	fire_only_once = yes
#
#	option = {
#		name = WORRYING
#		FROM = { kill_pop = yes }
#	}
#}
#
## Mutant representative (HIDDEN)
#pop_group_event = {
#	id = pop.11
#	hide_window = yes
#	is_triggered_only = yes
#
#	fire_only_once = yes
#
#	trigger = {
#		planet = {
#			has_carrier_flag = pop_modification
#			has_carrier_flag = popmod_rising_tensions
#			owner = { has_country_flag = pop_modification }
#		}
#		has_pop_group_flag = modified_pop_1
#		is_enslaved = no
#		is_being_purged = no
#		planet = {
#			any_owned_pop_group = {
#				NOT = { is_pop = ROOT }
#				is_same_species = owner
#				is_enslaved = no
#				is_being_purged = no
#				is_robot_pop_group = no
#			}
#		}
#	}
#
#	immediate = {
#		save_event_target_as = modified_pop_1
#		planet = {
#			weighted_random_owned_pop_group = {
#				limit = {
#					NOT = { is_pop = ROOT }
#					is_same_species = owner
#					is_enslaved = no
#					is_being_purged = no
#					is_robot_pop_group = no
#				}
#				save_event_target_as = non_modified_pop_1
#			}
#		}
#		planet = {
#			carrier_event = { id = pop.12 }
#		}
#	}
#}
#
## Mutant representative
#carrier_event = {
#	id = pop.12
#	title = "pop.12.name"
#	desc = "pop.12.desc"
#	picture = GFX_evt_cybernetics
#
#	is_triggered_only = yes
#	fire_only_once = yes
#
#	option = {
#		name = WORRYING
#	}
#}
#
## Increased Strength (HIDDEN)
#pop_group_event = {
#	id = pop.13
#	hide_window = yes
#	is_triggered_only = yes
#
#	fire_only_once = yes
#
#	trigger = {
#		planet = {
#			has_carrier_flag = pop_modification
#			has_carrier_flag = popmod_rising_tensions
#			NOT = { has_carrier_flag = popmod_strength }
#			owner = { has_country_flag = pop_modification }
#		}
#		has_pop_group_flag = modified_pop_1
#		is_enslaved = no
#		is_being_purged = no
#		planet = {
#			any_owned_pop_group = {
#				NOR = {
#					is_pop = ROOT
#					has_trait = trait_strong
#				}
#				is_same_species = owner
#				is_enslaved = no
#				is_being_purged = no
#				is_robot_pop_group = no
#			}
#		}
#	}
#
#	immediate = {
#		save_event_target_as = modified_pop_1
#		planet = {
#			set_carrier_flag = popmod_strength
#			weighted_random_owned_pop_group = {
#				limit = {
#					NOR = {
#						is_pop = ROOT
#						has_trait = trait_strong
#					}
#					is_same_species = owner
#					is_enslaved = no
#					is_being_purged = no
#					is_robot_pop_group = no
#				}
#				save_event_target_as = non_modified_pop_1
#			}
#		}
#		planet = {
#			carrier_event = { id = pop.14 }
#		}
#	}
#}
#
## Increased Strength
#carrier_event = {
#	id = pop.14
#	title = "pop.14.name"
#	desc = "pop.14.desc"
#	picture = GFX_evt_cybernetics
#
#	is_triggered_only = yes
#
#	option = {
#		name = WORRYING
#		custom_tooltip = pop.14.tooltip
#		hidden_effect = {
#			modify_species = {
#				species = FROM
#				add_trait = trait_strong
#			}
#		}
#	}
#}
