# from = country
# this = species

slavery_normal = {
	pop_group_modifier = {
		pop_bonus_workforce_mult = 0.10
		pop_happiness = -0.30
	}

	in_breach_of = {
		{
			key = resolution_greatergood_greater_than_ourselves
		}
	}

	potential = {
		from = { NOT = { has_ethic = ethic_gestalt_consciousness } }
	}

	allow = {
		hidden_trigger = { always = yes } #triggers covered in citizenship_slavery and potential trigger
		is_sapient = yes
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 0.5
			from = {
				is_galactic_community_member = yes
			}
			OR = {
				is_active_resolution = "resolution_greatergood_greater_than_ourselves"
				is_active_resolution = "resolution_greatergood_balance_in_the_middle"
				is_active_resolution = "resolution_greatergood_universal_prosperity_mandate"
			}
		}
		modifier = {
			factor = 5
			has_trait = trait_syncretic_proles
		}
		modifier = {
			factor = 1.2
			has_trait = trait_strong
		}
		modifier = {
			factor = 1.5
			has_trait = trait_very_strong
		}
	}
}

slavery_domestic = {
	pop_group_modifier = {
		pop_happiness = -0.20
	}

	potential = {
		from = { NOT = { has_ethic = ethic_gestalt_consciousness } }
		is_disconnected_drone_pop = no
	}

	allow = {
		hidden_trigger = { always = yes }
		is_sapient = yes
	}
	ai_will_do = {
		factor = 3
		modifier = {
			factor = 0
			NOR = {
				AND = {
					from = {
						is_galactic_community_member = yes
					}
					OR = {
						is_active_resolution = "resolution_greatergood_greater_than_ourselves"
						is_active_resolution = "resolution_greatergood_balance_in_the_middle"
						is_active_resolution = "resolution_greatergood_universal_prosperity_mandate"
					}
				}
			}
		}
		modifier = {
			factor = 100
			from = { is_fallen_empire_xenophobe = yes }
		}
	}
}

slavery_military = {
	modifier = {
		army_damage_mult = 0.2
		soldier_jobs_bonus_workforce_mult = 0.05
	}

	pop_group_modifier = {
		pop_happiness = -0.20
	}

	potential = {
		from = { NOT = { has_ethic = ethic_gestalt_consciousness } }
		is_disconnected_drone_pop = no
	}

	allow = {
		hidden_trigger = { always = yes }
		is_sapient = yes
	}
	ai_will_do = {
		factor = 5
		modifier = {
			factor = 0
			NOT = { has_trait = trait_very_strong }
		}
	}
}

slavery_indentured = {
	pop_group_modifier = {
		pop_happiness = -0.20
		pop_political_power = 0.50
	}

	potential = {
		from = { NOT = { has_ethic = ethic_gestalt_consciousness } }
		is_disconnected_drone_pop = no
	}

	allow = {
		hidden_trigger = { always = yes }
		is_sapient = yes
	}
	ai_can_colonize = yes #otherwise, AI will not colonise with enslaved species

	ai_will_do = {
		factor = 30
		modifier = {
			factor = 10
			from = { has_valid_civic = civic_indentured_assets }
		}
		modifier = { # Syncretic Slaver Guild starts need their primary species to be in Indentured Service to avoid unemployment at game start.
			factor = 10
			from = {
				has_valid_civic = civic_slaver_guilds
				has_origin = origin_syncretic_evolution
			}
			is_same_species = owner_main_species
		}
		modifier = {
			factor = 0
			has_trait = trait_syncretic_proles
		}
	}
}

slavery_matrix = {
	pop_group_modifier = {
		pop_happiness = -0.40
	}

	pop_tooltip = MATRIX_LIVESTOCK
	pop_status_frame = 6

	potential = {
		from = { is_machine_empire = yes }
		NOT = { from = { has_valid_civic = civic_machine_guided_sapience } }
		has_citizenship_type = { country = from type = citizenship_slavery }
	}

	in_breach_of = {
		{
			key = resolution_greatergood_greater_than_ourselves
		}
	}

	allow = {
		hidden_trigger = { always = yes }
	}

	ai_will_do = {
		factor = 50
	}
}

slavery_livestock = {
	pop_group_modifier = {
		pop_happiness = -0.40
	}

	pop_tooltip = LIVESTOCK
	pop_status_frame = 6

	potential = {
		OR = {
			from = { is_machine_empire = no }
			AND = {
				from = { is_machine_empire = yes }
				from = { has_valid_civic = civic_machine_guided_sapience }
			}
		}
		has_citizenship_type = { country = from type = citizenship_slavery }
	}

	in_breach_of = {
		{
			key = resolution_greatergood_greater_than_ourselves
		}
	}

	allow = {
		hidden_trigger = { exists = from }
		custom_tooltip = {
			fail_text = CANNOT_LIVESTOCK_MATRIX_MACHINES
			NOR = {
				has_trait = trait_mechanical
				has_trait = trait_machine_unit
			}
		}
		custom_tooltip = {
			fail_text = empire_not_xenophobe
			from = {
				OR = {
					is_xenophobe = yes
					has_ethic = ethic_gestalt_consciousness
				}
			}
		}
		custom_tooltip = {
			fail_text = noxious_stock
			NOT = { has_trait = trait_noxious }
		}
	}
	ai_will_do = {
		factor = 3
		modifier = {
			factor = 0
			NOR = {
				has_trait = trait_delicious
				from = { is_hive_empire = yes }
			}
		}
		modifier = {
			factor = 0.5
			from = {
				is_galactic_community_member = yes
			}
			OR = {
				is_active_resolution = "resolution_greatergood_greater_than_ourselves"
				is_active_resolution = "resolution_greatergood_balance_in_the_middle"
				is_active_resolution = "resolution_greatergood_universal_prosperity_mandate"
			}
		}
	}
}
slavery_matrix_guided_sapience = {
	pop_group_modifier = {
		pop_happiness = 0.10
	}

	pop_tooltip = MATRIX_LIVESTOCK_GUIDED
	pop_status_frame = 6

	potential = {
		has_machine_age_dlc = yes
		from = { is_machine_empire = yes }
		from = { has_valid_civic = civic_machine_guided_sapience }
		has_citizenship_type = { country = from type = citizenship_slavery }
	}

	in_breach_of = {
		{
			key = resolution_greatergood_greater_than_ourselves
		}
	}

	allow = {
		hidden_trigger = { always = yes }
	}

	ai_will_do = {
		factor = 50
	}
}

slavery_orderly = {
	potential = {
		from = {
			NOT = { has_ethic = ethic_gestalt_consciousness }
			is_twisted_experimenters_empire = yes
		}
	}

	allow = {
		is_sapient = yes
	}

	in_breach_of = {
		{
			key = resolution_greatergood_greater_than_ourselves
		}
	}

	ai_will_do = {
		factor = 1
		modifier = {
			factor = 0.5
			from = {
				is_galactic_community_member = yes
			}
			OR = {
				is_active_resolution = "resolution_greatergood_greater_than_ourselves"
				is_active_resolution = "resolution_greatergood_balance_in_the_middle"
				is_active_resolution = "resolution_greatergood_universal_prosperity_mandate"
			}
		}
		modifier = {
			factor = 5
			has_trait = trait_syncretic_proles
		}
		modifier = {
			factor = 1.2
			has_trait = trait_strong
		}
		modifier = {
			factor = 1.5
			has_trait = trait_very_strong
		}
	}
}
