decision_xit_secure_ovomorph_cluster = {
	owned_planets_only = yes
	sound = event_default
	icon = decision_animal_wildlife
	enactment_time = 120

	resources = {
		category = decisions
		cost = {
			energy = 1000
			unity = 100
		}
	}

	potential = {
		has_deposit = d_xit_dormant_ovomorph_cluster
		exists = owner
		owner = {
			NOT = { xit_is_xenomorph_safe_owner = yes }
		}
	}

	allow = {
		owner = {
			has_technology = tech_alien_life_studies
		}
	}

	effect = {
		add_modifier = { modifier = xit_ovomorph_quarantine_zone days = -1 }
		owner = {
			if = {
				limit = {
					is_country_type = default
					has_technology = tech_alien_life_studies
					NOT = { has_technology = tech_xit_xenomorph_biosecurity }
				}
				add_research_option = tech_xit_xenomorph_biosecurity
			}
		}
		if = {
			limit = { owner = { OR = { has_tradition = tr_xit_biosecurity_rapid_purge_teams has_tradition = tr_xit_containment_rapid_purge_teams } } }
			random_list = {
				85 = {
					owner = {
						add_resource = {
							society_research = 500
						}
					}
				}
				12 = {
					add_modifier = { modifier = xit_containment_strain days = 720 }
				}
				3 = {
					add_modifier = { modifier = xit_xenomorph_infestation days = 720 }
				}
			}
		}
		else = {
			random_list = {
				70 = {
					owner = {
						add_resource = {
							society_research = 500
						}
					}
				}
				20 = {
					add_modifier = { modifier = xit_containment_strain days = 720 }
				}
				10 = {
					add_modifier = { modifier = xit_xenomorph_infestation days = 720 }
				}
			}
		}
	}

	ai_weight = {
		weight = 20
		modifier = {
			factor = 1.5
			has_modifier = xit_xenomorph_infestation
		}
		modifier = {
			factor = 2.5
			has_modifier = xit_xenomorph_outbreak
		}
		modifier = {
			factor = 4
			has_modifier = xit_xenomorph_overrun
		}
		modifier = {
			factor = 6
			has_modifier = xit_xenomorph_terminal_collapse
		}
	}
}

decision_xit_destroy_ovomorph_cluster = {
	owned_planets_only = yes
	sound = event_default
	icon = decision_banish
	enactment_time = 180

	resources = {
		category = decisions
		cost = {
			energy = 2500
			unity = 250
		}
	}

	potential = {
		has_deposit = d_xit_dormant_ovomorph_cluster
		exists = owner
		owner = {
			NOT = { xit_is_xenomorph_safe_owner = yes }
		}
	}

	allow = {
		owner = {
			has_technology = tech_alien_life_studies
		}
	}

	effect = {
		remove_deposit = d_xit_dormant_ovomorph_cluster
		if = {
			limit = { owner = { OR = { has_tradition = tr_xit_biosecurity_rapid_purge_teams has_tradition = tr_xit_containment_rapid_purge_teams } } }
			random_list = {
				85 = {
					owner = {
						add_resource = {
							society_research = 300
						}
					}
				}
				12 = {
					add_modifier = { modifier = xit_containment_strain days = 720 }
					add_deposit = d_xit_dormant_ovomorph_cluster
				}
				3 = {
					add_modifier = { modifier = xit_xenomorph_infestation days = 720 }
					add_deposit = d_xit_dormant_ovomorph_cluster
					if = {
						limit = {
							any_owned_pop_group = {
								species = { has_trait = trait_xenomorph }
							}
						}
						planet_event = { id = xit_infection.2 }
					}
				}
			}
		}
		else = {
			random_list = {
				65 = {
					owner = {
						add_resource = {
							society_research = 300
						}
					}
				}
				25 = {
					add_modifier = { modifier = xit_containment_strain days = 1080 }
					add_deposit = d_xit_dormant_ovomorph_cluster
				}
				10 = {
					add_modifier = { modifier = xit_xenomorph_infestation days = 720 }
					add_deposit = d_xit_dormant_ovomorph_cluster
					if = {
						limit = {
							any_owned_pop_group = {
								species = { has_trait = trait_xenomorph }
							}
						}
						planet_event = { id = xit_infection.2 }
					}
				}
			}
		}
	}

	ai_weight = {
		weight = 25
		modifier = {
			factor = 2
			has_modifier = xit_xenomorph_infestation
		}
		modifier = {
			factor = 4
			has_modifier = xit_xenomorph_outbreak
		}
		modifier = {
			factor = 6.4
			has_modifier = xit_xenomorph_overrun
		}
		modifier = {
			factor = 9.6
			has_modifier = xit_xenomorph_terminal_collapse
		}
	}
}

decision_xit_planetary_containment_campaign = {
	owned_planets_only = yes
	sound = event_default
	icon = decision_banish
	enactment_time = 180

	resources = {
		category = decisions
		cost = {
			energy = 2000
			unity = 200
		}
	}

	potential = {
		is_colony = yes
		exists = owner
		owner = {
			NOT = { xit_is_xenomorph_safe_owner = yes }
		}
		OR = {
			has_modifier = xit_xenomorph_infestation
			has_modifier = xit_xenomorph_outbreak
			has_modifier = xit_xenomorph_overrun
			has_modifier = xit_xenomorph_terminal_collapse
			has_carrier_flag = xit_xenomorph_terminal_warning
		}
	}

	allow = {
		has_ground_combat = no
		owner = {
			OR = {
				has_technology = tech_xit_xenomorph_biosecurity
				OR = { has_tradition = tr_xit_biosecurity_adopt has_tradition = tr_xit_containment_command_adopt }
				has_ascension_perk = ap_xit_extragalactic_biosecurity_mandate
			}
		}
	}

	effect = {
		if = {
			limit = {
				OR = {
					has_modifier = xit_xenomorph_terminal_collapse
					has_modifier = xit_xenomorph_overrun
					has_carrier_flag = xit_xenomorph_terminal_warning
				}
			}
			random_list = {
				45 = {
					remove_modifier = xit_xenomorph_terminal_collapse
					remove_modifier = xit_xenomorph_overrun
					remove_carrier_flag = xit_xenomorph_terminal_collapse_started
					remove_carrier_flag = xit_xenomorph_outbreak_owner_assigned
					remove_carrier_flag = xit_xenomorph_terminal_warning
					remove_carrier_flag = xit_xenomorph_terminal_warning_mature
					remove_carrier_flag = xit_xenomorph_colony_overrun
					add_modifier = { modifier = xit_xenomorph_outbreak days = 1800 }
					add_modifier = { modifier = xit_containment_strain days = 720 }
				}
				35 = {
					remove_carrier_flag = xit_xenomorph_terminal_warning
					remove_carrier_flag = xit_xenomorph_terminal_warning_mature
					add_modifier = { modifier = xit_xenomorph_overrun days = -1 }
					add_modifier = { modifier = xit_containment_strain days = 1080 }
					add_planet_devastation = 5
				}
				20 = {
					add_modifier = { modifier = xit_containment_strain days = 1800 }
					add_planet_devastation = 15
				}
			}
		}
		else_if = {
			limit = { has_modifier = xit_xenomorph_outbreak }
			random_list = {
				55 = {
					remove_modifier = xit_xenomorph_outbreak
					remove_carrier_flag = xit_xenomorph_outbreak_started
					add_modifier = { modifier = xit_xenomorph_infestation days = 1080 }
					add_modifier = { modifier = xit_ovomorph_quarantine_zone days = 1800 }
				}
				30 = {
					add_modifier = { modifier = xit_containment_strain days = 720 }
					add_modifier = { modifier = xit_xenomorph_outbreak days = 1800 }
				}
				15 = {
					add_modifier = { modifier = xit_containment_strain days = 1080 }
					add_planet_devastation = 10
				}
			}
		}
		else_if = {
			limit = { has_modifier = xit_xenomorph_infestation }
			random_list = {
				60 = {
					remove_modifier = xit_xenomorph_infestation
					add_modifier = { modifier = xit_ovomorph_quarantine_zone days = 1800 }
				}
				30 = {
					add_modifier = { modifier = xit_containment_strain days = 720 }
				}
				10 = {
					add_modifier = { modifier = xit_xenomorph_outbreak days = 1800 }
					add_planet_devastation = 10
				}
			}
		}
	}

	ai_weight = {
		weight = 5
		modifier = {
			factor = 2
			has_modifier = xit_xenomorph_infestation
		}
		modifier = {
			factor = 8
			has_modifier = xit_xenomorph_outbreak
		}
		modifier = {
			factor = 15
			has_modifier = xit_xenomorph_overrun
		}
		modifier = {
			factor = 25
			has_carrier_flag = xit_xenomorph_terminal_warning
		}
		modifier = {
			factor = 30
			has_modifier = xit_xenomorph_terminal_collapse
		}
		modifier = {
			factor = 1.5
			owner = { OR = { has_tradition = tr_xit_biosecurity_rapid_purge_teams has_tradition = tr_xit_containment_rapid_purge_teams } }
		}
		modifier = {
			factor = 1.5
			owner = { has_ascension_perk = ap_xit_extragalactic_biosecurity_mandate }
		}
	}
}

decision_xit_cultivate_ovomorph_cluster = {
	owned_planets_only = yes
	sound = event_default
	icon = decision_incubate_wind_creatures
	enactment_time = 180

	resources = {
		category = decisions
		cost = {
			food = 1500
			unity = 250
		}
	}

	potential = {
		has_deposit = d_xit_dormant_ovomorph_cluster
		exists = owner
		owner = {
			xit_is_xenomorph_safe_owner = yes
		}
	}

	allow = {
		NOT = { has_building = building_xenomorph_ovomorph_chamber }
	}

	effect = {
		remove_deposit = d_xit_dormant_ovomorph_cluster
		add_building = building_xenomorph_ovomorph_chamber
	}

	ai_weight = {
		weight = 50
	}
}

