##########################################################################
# Empire Policies
#
# #####
#
# AI:
# Base AI-weight is 100, if unchanged
# AI will grab whatever policy-option has the highest weight
#
# #####
#
##########################################################################

diplomatic_stance = {
	category = diplomacy
	potential = {
		OR = {
			is_country_type = default
			is_country_type = fallen_empire
			is_country_type = awakened_fallen_empire
			is_country_type = primitive
			is_country_type = awakened_marauders
			is_country_type = mirrored_country
			is_country_type = exiled
		}
	}

	allow = {
		is_at_war = no # Not allowed to change policies in this group while at war
	}

	option = {
		name = "diplo_stance_belligerent"
		icon = "GFX_diplomatic_stance_belligerent"

		potential = {
			OR = {
				is_country_type = default
				is_country_type = awakened_fallen_empire
			}
			is_nomadic = no
		}

		valid = {
			NOT = { has_valid_civic = civic_inwards_perfection }
			is_homicidal = no # They have their own variants of this
		}

		policy_flags = {
			diplo_stance_belligerent
		}

		modifier = {
			country_war_exhaustion_mult = -0.1
			country_naval_cap_mult = 0.1
			country_claim_influence_cost_mult = -0.1
			external_leader_pool_add = -1
		}

		ai_weight = {
			weight = 10

			modifier = {
				factor = 0
				NOT = { has_country_flag = has_encountered_other_empire }
			}

			# Pacifists
			modifier = { # Fanatic Pacifists will *only* go belligerent if there's a rival neighbor...
				factor = 0
				has_ethic = ethic_fanatic_pacifist
				NOT = {
					any_neighbor_country = {
						is_rival = root
					}
				}
			}
			modifier = { # Regular Pacifists have only a small chance to go belligerent unless there's a rival neighbor...
				factor = 0.5
				has_ethic = ethic_pacifist
				NOT = {
					any_neighbor_country = {
						is_rival = root
					}
				}
			}
			modifier = {
				factor = 0.5 # ...but they're still less likely to.
				is_pacifist = yes
			}

			# Angry people like to be belligerent
			modifier = {
				factor = 2.0
				has_ethic = ethic_fanatic_militarist
			}
			modifier = {
				factor = 1.5
				has_ethic = ethic_militarist
			}
			modifier = {
				factor = 1.5
				has_ethic = ethic_fanatic_authoritarian
			}
			modifier = {
				factor = 1.25
				has_ethic = ethic_authoritarian
			}
			modifier = {
				factor = 5.0 # Intentionally high value for despoilers/Nihilistic Acquisition
				is_slaver = yes
			}
			modifier = {
				factor = 1.5
				has_valid_civic = civic_nationalistic_zeal
			}
			modifier = {
				factor = 1.5
				OR = {
					has_valid_civic = civic_hive_strength_of_legions
					has_valid_civic = civic_machine_warbots
					has_valid_civic = civic_private_military_companies
					has_valid_civic = civic_warrior_culture
				}
			}

			modifier = {
				factor = 1.5
				has_ai_personality_behaviour = conqueror
			}
			modifier = {
				factor = 1.5
				has_ai_personality_behaviour = subjugator
			}

			modifier = {
				factor = 3.0 # Blocked in propagators get ANGRY
				has_ai_expansion_plan = no
				has_ai_personality_behaviour = propagator
			}
		}
	}

	option = {
		name = "diplo_stance_cooperative"
		icon = "GFX_diplomatic_stance_cooperative"

		potential = {
			OR = {
				is_country_type = default
				is_country_type = awakened_fallen_empire
				is_country_type = mirrored_country
			}
			is_nomadic = no
		}

		valid = {
			NOT = { has_valid_civic = civic_inwards_perfection }
			is_unfriendly = no # Not homicidal or barbaric despoilers
		}

		policy_flags = {
			diplo_stance_cooperative
		}

		modifier = {
			diplo_weight_mult = 0.25
			envoy_improve_relations_mult = 0.5
			country_border_friction_mult = -0.5
			operations_cost_mult = 0.25
			operations_upkeep_mult = 0.25
			external_leader_pool_add = 1
		}

		ai_weight = {
			weight = 10

			modifier = {
				factor = 0.01
				has_ascension_perk = ap_become_the_crisis
			}

			modifier = {
				factor = 0
				NOT = { has_country_flag = has_encountered_other_empire }
			}

			# Tons of Ethics modifiers!
			# Cranky people:
			modifier = {
				factor = 0
				is_fanatic_xenophobe = yes
			}
			modifier = {
				factor = 0.1
				has_ethic = ethic_xenophobe
			}
			modifier = {
				factor = 0.5
				has_ethic = ethic_fanatic_authoritarian
			}
			modifier = {
				factor = 0.75
				has_ethic = ethic_authoritarian
			}

			# Nice people:
			modifier = {
				factor = 2.0
				has_ethic = ethic_fanatic_xenophile
			}
			modifier = {
				factor = 1.5
				has_ethic = ethic_xenophile
			}
			modifier = {
				factor = 1.3
				has_valid_civic = civic_machine_exploration_protocol
			}
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_pacifist
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_pacifist
			}
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_egalitarian
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_egalitarian
			}
			modifier = {
				factor = 1.1
				has_ethic = ethic_fanatic_materialist
			}
			modifier = {
				factor = 1.05
				has_ethic = ethic_materialist
			}

			modifier = {
				factor = 1.25
				has_ai_personality_behaviour = multispecies
			}

			modifier = {
				factor = 3.0
				has_ai_personality = federation_builders
			}

			modifier = {
				factor = 3.0
				has_ai_personality = hive_mind_friend
			}

			modifier = {
				factor = 3.0
				has_country_flag = fallen_empire_hive_control
			}
		}
	}

	option = {
		name = "diplo_stance_isolationist"
		icon = "GFX_diplomatic_stance_isolationist"

		potential = {
			OR = {
				is_country_type = default
				is_country_type = awakened_fallen_empire
				is_country_type = exiled
			}
			is_nomadic = no
		}

		valid = {
			is_megacorp = no # "NO! YOU CAN'T BUY OUR STUFF!" makes the shareholders sad
			is_homicidal = no # Homicidal variants below
		}

		policy_flags = {
			diplo_stance_isolationist
		}

		modifier = {
			country_unity_produces_mult = 0.10
			diplo_weight_mult = -0.25
			diplomacy_upkeep_mult = 1
			pop_government_ethic_attraction = 0.25
			country_border_friction_mult = 2.0
			external_leader_pool_add = -2
		}

		on_enabled = {
		}

		ai_weight = {
			weight = 10

			modifier = {
				factor = 0.01
				has_ascension_perk = ap_become_the_crisis
			}

			modifier = {
				factor = 0.25 # Let the isolationists start in this if they want
				NOT = { has_country_flag = has_encountered_other_empire }
			}

			modifier = {
				factor = 0
				OR = {
					has_ai_personality = federation_builders
					has_ai_personality = fanatic_befrienders
				}
			}

			modifier = {
				factor = 100.0 # Inwards Perfection should almost always go isolationist
				has_valid_civic = civic_inwards_perfection
			}

			modifier = {
				factor = 3.0
				has_ai_personality_behaviour = isolationist
			}

			modifier = {
				factor = 2.0
				is_xenophobe = yes
				is_militarist = no
				is_authoritarian = no
			}
		}
	}

	option = {
		name = "diplo_stance_expansionist"
		icon = "GFX_diplomatic_stance_expansionist"

		potential = {
			is_wilderness_empire = no
			is_nomadic = no
			OR = {
				is_country_type = default
				is_country_type = awakened_fallen_empire
			}
		}

		valid = {
			is_homicidal = no
		}

		policy_flags = {
			diplo_stance_expansionist
		}

		modifier = {
			starbase_outpost_cost_mult = -0.10
			planet_colony_development_speed_mult = 0.15
			country_border_friction_mult = 1.0
		}

		ai_weight = {
			weight = 10

			modifier = {
				factor = 2
				NOT = { has_country_flag = has_encountered_other_empire }
			}

			modifier = {
				factor = 0.01
				has_ascension_perk = ap_become_the_crisis
			}
		}
	}

	option = {
		name = "diplo_stance_expansionist_wilderness"
		icon = "GFX_diplomatic_stance_expansionist"

		potential = {
			is_wilderness_empire = yes
			OR = {
				is_country_type = default
				is_country_type = awakened_fallen_empire
			}
		}

		valid = {
			is_homicidal = no
		}

		policy_flags = {
			diplo_stance_expansionist
		}

		modifier = {
			starbase_outpost_cost_mult = -0.10
			terraform_speed_mult = 0.15
			country_border_friction_mult = 1.0
		}

		ai_weight = {
			weight = 10

			modifier = {
				factor = 2
				NOT = { has_country_flag = has_encountered_other_empire }
			}

			modifier = {
				factor = 0.01
				has_ascension_perk = ap_become_the_crisis
			}
		}
	}

	option = {
		name = "diplo_stance_mercantile"
		icon = "GFX_diplomatic_stance_mercantile"

		potential = {
			OR = {
				is_country_type = default
				is_country_type = awakened_fallen_empire
				is_country_type = mirrored_country
			}
			is_gestalt = no
		}

		valid = {
			NOT = { has_valid_civic = civic_inwards_perfection }
			is_homicidal = no
			# some ugliness to preserve the
			# auth/civic - potential/valid divide for tooltip
			if = {
				limit = {
					has_megacorp = yes
					is_megacorp = yes
				}
				is_megacorp = yes
			}
			else_if = {
				limit = { has_megacorp = yes }
				has_civic = civic_merchant_guilds
			}
			else = { has_civic = civic_corporate_dominion }
		}

		policy_flags = {
			diplo_stance_mercantile
		}

		modifier = {
			diplo_weight_economy_mult = 0.25
			country_trade_produces_mult = 0.1
			external_leader_pool_add = 1
		}

		ai_weight = {
			weight = 10

			modifier = {
				factor = 0.01
				has_ascension_perk = ap_become_the_crisis
			}
			modifier = {
				factor = 3.0
				is_megacorp = yes # Megacorps should generally prefer this diplo stance unless their ethics get them to specialize differently
			}
			modifier = {
				factor = 1.25
				has_valid_civic = civic_free_traders
			}
			modifier = {
				factor = 10
				should_ai_focus_on_trade = yes
			}
			modifier = {
				factor = 0.65
				OR = {
					has_valid_civic = civic_private_prospectors
					has_valid_civic = civic_private_military_companies
				}
			}
		}
	}

	option = {
		name = "diplo_stance_supremacist"
		icon = "GFX_diplomatic_stance_supremacy"

		potential = {
			OR = {
				is_country_type = awakened_fallen_empire
				is_country_type = awakened_marauders
				is_country_type = default
				is_country_type = mirrored_country
			}
			is_nomadic = no
		}
		valid = {
			NOR = {
				has_valid_civic = civic_inwards_perfection
				has_modifier = humiliated
			}
			is_homicidal = no
			custom_tooltip = {
				fail_text = "requires_supremacy_traditions"
				OR = {
					has_tradition = tr_supremacy_finish
					NOT = { is_country_type = default }
				}
			}
			is_subject = no
		}

		policy_flags = {
			diplo_stance_supremacist
		}

		modifier = {
			diplo_weight_naval_mult = 1.00
			diplo_weight_economy_mult = -0.5
			diplo_weight_technology_mult = -0.5
			country_war_exhaustion_mult = -0.20
			country_naval_cap_mult = 0.20
			country_claim_influence_cost_mult = -0.1
		}

		on_enabled = {
		}

		ai_weight = {
			weight = 10

			modifier = {
				factor = 0
				NOT = { has_country_flag = has_encountered_other_empire }
			}

			modifier = {
				factor = 0
				is_pacifist = yes
			}

			modifier = {
				factor = 10
				OR = {
					is_country_type = awakened_fallen_empire
					is_country_type = awakened_marauders
				}
			}

			# Angry people want to be Supreme
			modifier = {
				factor = 2.0
				has_ethic = ethic_fanatic_militarist
			}
			modifier = {
				factor = 1.5
				has_ethic = ethic_militarist
			}
			modifier = {
				factor = 1.5
				has_ethic = ethic_fanatic_authoritarian
			}
			modifier = {
				factor = 1.25
				has_ethic = ethic_authoritarian
			}
			modifier = {
				factor = 1.25 # Despoilers/Nihilistic Acquisition intentionally get a higher multiplier for Belligerent than Supremacist
				is_slaver = yes
			}
			modifier = {
				factor = 2
				has_valid_civic = civic_nationalistic_zeal
			}
			modifier = {
				factor = 3
				OR = {
					has_valid_civic = civic_hive_strength_of_legions
					has_valid_civic = civic_machine_warbots
					has_valid_civic = civic_private_military_companies
					has_valid_civic = civic_warrior_culture
					has_country_flag = fallen_empire_hive_war
				}
			}

			modifier = {
				factor = 1.5
				has_ai_personality_behaviour = conqueror
			}
			modifier = {
				factor = 1.5
				has_ai_personality_behaviour = subjugator
			}

			modifier = { # Don't be suicidal
				factor = 0
				any_relation = {
					has_communications = root
					has_policy_flag = diplo_stance_supremacist
					is_country_type = default
					is_subject = no
					relative_power = {
						who = root
						category = fleet
						value = overwhelming
					}
				}
			}
			modifier = {
				factor = 0.25
				any_neighbor_country = {
					has_communications = root
					is_country_type = default
					is_subject = no
					relative_power = {
						who = root
						category = fleet
						value > equivalent
					}
				}
			}
		}
	}
	option = {
		name = "diplo_stance_animosity"
		icon = "GFX_diplomatic_stance_animosity"

		potential = {
			is_country_type = default
			is_nomadic = no
		}
		valid = {
			is_homicidal = no
			custom_tooltip = {
				fail_text = "requires_enmity_traditions"
				OR = {
					has_tradition = tr_enmity_finish
					NOT = { is_country_type = default }
				}
			}
			is_subject = no
		}

		policy_flags = {
			diplo_stance_animosity
		}

		modifier = {
			max_rivalries = 2
			rivalries_unity_produces_add = 10
			country_border_friction_mult = 1
			diplo_weight_rivals_mult = 0.05
		}

		ai_weight = {
			weight = 10

			modifier = {
				factor = 0
				NOT = { has_country_flag = has_encountered_other_empire }
			}

			modifier = {
				factor = 0
				OR = {
					is_fanatic_xenophile = yes
					has_valid_civic = civic_hive_empath
				}
			}

			modifier = {
				factor = 0
				num_rivals = 0
			}

			# Ambitious people who want to be rivals
			modifier = {
				factor = 2.0
				is_fanatic = yes
			}
			modifier = {
				factor = 1.5
				has_ethic = ethic_militarist
			}
			modifier = {
				factor = 1.25
				has_ethic = ethic_authoritarian
			}
			modifier = {
				factor = 2
				OR = {
					has_valid_civic = civic_nationalistic_zeal
					has_valid_civic = civic_pompous_purists
				}
			}
			modifier = {
				factor = 3
				OR = {
					has_valid_civic = civic_hive_strength_of_legions
					has_valid_civic = civic_machine_warbots
					has_valid_civic = civic_private_military_companies
					has_valid_civic = civic_warrior_culture
					has_origin = origin_payback
				}
			}

			modifier = {
				factor = 1.5
				OR = {
					has_ai_personality_behaviour = subjugator
					has_ai_personality_behaviour = opportunist
					has_ai_personality_behaviour = propagator
				}
			}
			modifier = {
				factor = 20
				has_ai_personality = metalhead
			}
		}
	}

	option = {
		name = "diplo_stance_hunger"
		icon = "GFX_diplomatic_stance_rest"

		potential = {
			OR = {
				is_hive_empire = yes
				has_menace_perk = menp_behemoth_ever_hungry
			}
		}

		valid = {
			OR = {
				has_valid_civic = civic_hive_devouring_swarm
				has_menace_perk = menp_behemoth_ever_hungry
			}
		}

		policy_flags = {
			diplo_stance_hunger
		}

		modifier = {
		}

		ai_weight = {
			weight = 100
		}
	}

	option = {
		name = "diplo_stance_extermination"
		icon = "GFX_diplomatic_stance_recompiling"

		potential = {
			is_machine_empire = yes
		}

		valid = {
			has_valid_civic = civic_machine_terminator
		}

		policy_flags = {
			diplo_stance_extermination
		}

		modifier = {
		}

		ai_weight = {
			weight = 100
		}
	}

	option = {
		name = "diplo_stance_purification"
		icon = "GFX_diplomatic_stance_withdrawn"

		valid = {
			has_valid_civic = civic_fanatic_purifiers
		}

		policy_flags = {
			diplo_stance_purification
		}

		modifier = {
		}

		ai_weight = {
			weight = 100
		}
	}

	option = {
		name = "diplo_stance_isolationist_fallen_empire"
		icon = "GFX_diplomatic_stance_isolationist"

		potential = {
			is_country_type = fallen_empire
		}

		policy_flags = {
			diplo_stance_isolationist_fallen_empire
		}

		modifier = {
		}

		ai_weight = {
			weight = 100
		}
	}

	option = {
		name = "diplo_stance_ignorant"
		icon = "GFX_diplomatic_stance_isolationist"

		potential = {
			is_country_type = primitive
			current_awareness_level < medium
			capital_scope = {
				NOT = { has_modifier = culture_shock_diplomacy }
			}
		}

		policy_flags = {
			diplo_stance_ignorant
		}

		modifier = {
		}

		ai_weight = {
			weight = 1
		}
	}

	option = {
		name = "diplo_stance_questioning"
		icon = "GFX_diplomatic_stance_expansionist"

		potential = {
			is_country_type = primitive
			current_awareness_level = medium
			capital_scope = {
				NOT = { has_modifier = culture_shock_diplomacy }
			}
		}

		policy_flags = {
			diplo_stance_questioning
		}

		modifier = {
		}

		ai_weight = {
			weight = 1
		}
	}

	option = {
		name = "diplo_stance_eager"
		icon = "GFX_diplomatic_stance_cooperative"

		potential = {
			is_country_type = primitive
			current_awareness_level >= high
			is_xenophile = yes
			capital_scope = {
				NOT = { has_modifier = culture_shock_diplomacy }
			}
		}

		policy_flags = {
			diplo_stance_eager
		}

		modifier = {
		}

		ai_weight = {
			weight = 1
		}
	}

	option = {
		name = "diplo_stance_fearful"
		icon = "GFX_diplomatic_stance_withdrawn"

		potential = {
			is_country_type = primitive
			current_awareness_level >= high
			is_xenophobe = yes
			capital_scope = {
				NOT = { has_modifier = culture_shock_diplomacy }
			}
		}

		policy_flags = {
			diplo_stance_fearful
		}

		modifier = {
		}

		ai_weight = {
			weight = 1
		}
	}

	option = {
		name = "diplo_stance_uncertain"
		icon = "GFX_diplomatic_stance_isolationist"

		potential = {
			is_country_type = primitive
			current_awareness_level >= high
			is_xenophile = no
			is_xenophobe = no
			capital_scope = {
				NOT = { has_modifier = culture_shock_diplomacy }
			}
		}

		policy_flags = {
			diplo_stance_uncertain
		}

		modifier = {
		}

		ai_weight = {
			weight = 1
		}
	}

	option = {
		name = "diplo_stance_culture_shock"
		icon = "GFX_diplomatic_stance_belligerent"

		potential = {
			is_country_type = primitive
			capital_scope = {
				has_modifier = culture_shock_diplomacy
			}
		}

		policy_flags = {
			diplo_stance_culture_shock
		}

		modifier = {
			diplo_action_acceptance_add = -100
		}

		ai_weight = {
			weight = 100
		}
	}

	option = {
		name = "diplo_stance_devastators"
		icon = "GFX_diplomatic_stance_devastators"

		potential = {
			OR = {
				has_valid_civic = civic_scorched_earth
				has_valid_civic = civic_hive_scorched_earth
			}
		}

		valid = {
			OR = {
				has_valid_civic = civic_scorched_earth
				has_valid_civic = civic_hive_scorched_earth
			}
		}

		policy_flags = {
			diplo_stance_purification
		}

		modifier = {
		}

		ai_weight = {
			weight = 100
		}
	}

	#Nomadic stance variants because triggered modifiers arent supported:

	option = {
		name = "diplo_stance_belligerent_nomad"
		icon = "GFX_diplomatic_stance_belligerent"

		potential = {
			is_nomadic = yes
		}

		valid = {
			NOT = { has_valid_civic = civic_inwards_perfection }
			is_homicidal = no # They have their own variants of this
		}

		policy_flags = {
			diplo_stance_belligerent
		}

		modifier = {
			country_war_exhaustion_mult = -0.1
			country_naval_cap_mult = 0.1
			starbase_waystations_upkeep_mult = -0.2
			starbase_waystations_modules_upkeep_mult = -0.2
			external_leader_pool_add = -1
		}

		ai_weight = {
			weight = 10

			modifier = {
				factor = 0
				NOT = { has_country_flag = has_encountered_other_empire }
			}

			# Pacifists
			modifier = { # Fanatic Pacifists will *only* go belligerent if there's a rival neighbor...
				factor = 0
				has_ethic = ethic_fanatic_pacifist
				NOT = {
					any_neighbor_country = {
						is_rival = root
					}
				}
			}
			modifier = { # Regular Pacifists have only a small chance to go belligerent unless there's a rival neighbor...
				factor = 0.5
				has_ethic = ethic_pacifist
				NOT = {
					any_neighbor_country = {
						is_rival = root
					}
				}
			}
			modifier = {
				factor = 0.5 # ...but they're still less likely to.
				is_pacifist = yes
			}

			# Angry people like to be belligerent
			modifier = {
				factor = 2.0
				has_ethic = ethic_fanatic_militarist
			}
			modifier = {
				factor = 1.5
				has_ethic = ethic_militarist
			}
			modifier = {
				factor = 1.5
				has_ethic = ethic_fanatic_authoritarian
			}
			modifier = {
				factor = 1.25
				has_ethic = ethic_authoritarian
			}
			modifier = {
				factor = 5.0 # Intentionally high value for despoilers/Nihilistic Acquisition
				is_slaver = yes
			}
			modifier = {
				factor = 1.5
				has_valid_civic = civic_nationalistic_zeal
			}
			modifier = {
				factor = 1.5
				OR = {
					has_valid_civic = civic_hive_strength_of_legions
					has_valid_civic = civic_machine_warbots
					has_valid_civic = civic_private_military_companies
					has_valid_civic = civic_warrior_culture
				}
			}

			modifier = {
				factor = 1.5
				has_ai_personality_behaviour = conqueror
			}
			modifier = {
				factor = 1.5
				has_ai_personality_behaviour = subjugator
			}

			modifier = {
				factor = 3.0 # Blocked in propagators get ANGRY
				has_ai_expansion_plan = no
				has_ai_personality_behaviour = propagator
			}
		}
	}

	option = {
		name = "diplo_stance_cooperative_nomad"
		icon = "GFX_diplomatic_stance_cooperative"

		potential = {
			is_nomadic = yes
		}

		valid = {
			NOT = { has_valid_civic = civic_inwards_perfection }
			is_unfriendly = no # Not homicidal or barbaric despoilers
		}

		policy_flags = {
			diplo_stance_cooperative
		}

		modifier = {
			diplo_weight_mult = 0.25
			envoy_improve_relations_mult = 0.5
			unlicensed_waystations_scaling_mult = -0.5
			operations_cost_mult = 0.25
			operations_upkeep_mult = 0.25
			external_leader_pool_add = 1
		}

		ai_weight = {
			weight = 10

			modifier = {
				factor = 0.01
				has_ascension_perk = ap_become_the_crisis
			}

			modifier = {
				factor = 0
				NOT = { has_country_flag = has_encountered_other_empire }
			}

			# Tons of Ethics modifiers!
			# Cranky people:
			modifier = {
				factor = 0
				is_fanatic_xenophobe = yes
			}
			modifier = {
				factor = 0.1
				has_ethic = ethic_xenophobe
			}
			modifier = {
				factor = 0.5
				has_ethic = ethic_fanatic_authoritarian
			}
			modifier = {
				factor = 0.75
				has_ethic = ethic_authoritarian
			}

			# Nice people:
			modifier = {
				factor = 2.0
				has_ethic = ethic_fanatic_xenophile
			}
			modifier = {
				factor = 1.5
				has_ethic = ethic_xenophile
			}
			modifier = {
				factor = 1.3
				has_valid_civic = civic_machine_exploration_protocol
			}
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_pacifist
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_pacifist
			}
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_egalitarian
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_egalitarian
			}
			modifier = {
				factor = 1.1
				has_ethic = ethic_fanatic_materialist
			}
			modifier = {
				factor = 1.05
				has_ethic = ethic_materialist
			}

			modifier = {
				factor = 1.25
				has_ai_personality_behaviour = multispecies
			}

			modifier = {
				factor = 3.0
				has_ai_personality = federation_builders
			}

			modifier = {
				factor = 3.0
				has_ai_personality = hive_mind_friend
			}

			modifier = {
				factor = 3.0
				has_country_flag = fallen_empire_hive_control
			}
		}
	}

	option = {
		name = "diplo_stance_isolationist_nomad"
		icon = "GFX_diplomatic_stance_isolationist"

		potential = {
			is_nomadic = yes
		}

		valid = {
			is_megacorp = no # "NO! YOU CAN'T BUY OUR STUFF!" makes the shareholders sad
			is_homicidal = no # Homicidal variants below
		}

		policy_flags = {
			diplo_stance_isolationist
		}

		modifier = {
			country_unity_produces_mult = 0.10
			diplo_weight_mult = -0.25
			diplomacy_upkeep_mult = 1
			pop_government_ethic_attraction = 0.25
			unlicensed_waystations_scaling_mult = 2
			external_leader_pool_add = -2
		}

		ai_weight = {
			weight = 10

			modifier = {
				factor = 0.01
				has_ascension_perk = ap_become_the_crisis
			}

			modifier = {
				factor = 0.25 # Let the isolationists start in this if they want
				NOT = { has_country_flag = has_encountered_other_empire }
			}

			modifier = {
				factor = 0
				OR = {
					has_ai_personality = federation_builders
					has_ai_personality = fanatic_befrienders
				}
			}

			modifier = {
				factor = 100.0 # Inwards Perfection should almost always go isolationist
				has_valid_civic = civic_inwards_perfection
			}

			modifier = {
				factor = 3.0
				has_ai_personality_behaviour = isolationist
			}

			modifier = {
				factor = 2.0
				is_xenophobe = yes
				is_militarist = no
				is_authoritarian = no
			}
		}
	}

	option = {
		name = "diplo_stance_supremacist_nomad"
		icon = "GFX_diplomatic_stance_supremacy"

		potential = {
			OR = {
				is_country_type = awakened_fallen_empire
				is_country_type = awakened_marauders
				is_country_type = default
				is_country_type = mirrored_country
			}
			is_nomadic = yes
		}
		valid = {
			NOR = {
				has_valid_civic = civic_inwards_perfection
				has_modifier = humiliated
			}
			is_homicidal = no
			custom_tooltip = {
				fail_text = "requires_supremacy_traditions"
				OR = {
					has_tradition = tr_supremacy_finish
					NOT = { is_country_type = default }
				}
			}
			is_subject = no
		}

		policy_flags = {
			diplo_stance_supremacist
		}

		modifier = {
			diplo_weight_naval_mult = 1.00
			diplo_weight_economy_mult = -0.5
			diplo_weight_technology_mult = -0.5
			country_war_exhaustion_mult = -0.20
			country_naval_cap_mult = 0.20
			starbase_waystations_upkeep_mult = -0.2
			starbase_waystations_modules_upkeep_mult = -0.2
		}

		ai_weight = {
			weight = 10

			modifier = {
				factor = 0
				NOT = { has_country_flag = has_encountered_other_empire }
			}

			modifier = {
				factor = 0
				is_pacifist = yes
			}

			modifier = {
				factor = 10
				OR = {
					is_country_type = awakened_fallen_empire
					is_country_type = awakened_marauders
				}
			}

			# Angry people want to be Supreme
			modifier = {
				factor = 2.0
				has_ethic = ethic_fanatic_militarist
			}
			modifier = {
				factor = 1.5
				has_ethic = ethic_militarist
			}
			modifier = {
				factor = 1.5
				has_ethic = ethic_fanatic_authoritarian
			}
			modifier = {
				factor = 1.25
				has_ethic = ethic_authoritarian
			}
			modifier = {
				factor = 1.25 # Despoilers/Nihilistic Acquisition intentionally get a higher multiplier for Belligerent than Supremacist
				is_slaver = yes
			}
			modifier = {
				factor = 2
				has_valid_civic = civic_nationalistic_zeal
			}
			modifier = {
				factor = 3
				OR = {
					has_valid_civic = civic_hive_strength_of_legions
					has_valid_civic = civic_machine_warbots
					has_valid_civic = civic_private_military_companies
					has_valid_civic = civic_warrior_culture
					has_country_flag = fallen_empire_hive_war
				}
			}

			modifier = {
				factor = 1.5
				has_ai_personality_behaviour = conqueror
			}
			modifier = {
				factor = 1.5
				has_ai_personality_behaviour = subjugator
			}

			modifier = { # Don't be suicidal
				factor = 0
				any_relation = {
					has_communications = root
					has_policy_flag = diplo_stance_supremacist
					is_country_type = default
					is_subject = no
					relative_power = {
						who = root
						category = fleet
						value = overwhelming
					}
				}
			}
			modifier = {
				factor = 0.25
				any_neighbor_country = {
					has_communications = root
					is_country_type = default
					is_subject = no
					relative_power = {
						who = root
						category = fleet
						value > equivalent
					}
				}
			}
		}
	}
	option = {
		name = "diplo_stance_animosity_nomad"
		icon = "GFX_diplomatic_stance_animosity"

		potential = {
			is_country_type = default
			is_nomadic = yes
		}
		valid = {
			is_homicidal = no
			custom_tooltip = {
				fail_text = "requires_enmity_traditions"
				OR = {
					has_tradition = tr_enmity_finish
					NOT = { is_country_type = default }
				}
			}
			is_subject = no
		}

		policy_flags = {
			diplo_stance_animosity
		}

		modifier = {
			max_rivalries = 2
			rivalries_unity_produces_add = 10
			unlicensed_waystations_scaling_mult = 1
			diplo_weight_rivals_mult = 0.05
		}

		ai_weight = {
			weight = 10

			modifier = {
				factor = 0
				NOT = { has_country_flag = has_encountered_other_empire }
			}

			modifier = {
				factor = 0
				OR = {
					is_fanatic_xenophile = yes
					has_valid_civic = civic_hive_empath
				}
			}

			modifier = {
				factor = 0
				num_rivals = 0
			}

			# Ambitious people who want to be rivals
			modifier = {
				factor = 2.0
				is_fanatic = yes
			}
			modifier = {
				factor = 1.5
				has_ethic = ethic_militarist
			}
			modifier = {
				factor = 1.25
				has_ethic = ethic_authoritarian
			}
			modifier = {
				factor = 2
				OR = {
					has_valid_civic = civic_nationalistic_zeal
					has_valid_civic = civic_pompous_purists
				}
			}
			modifier = {
				factor = 3
				OR = {
					has_valid_civic = civic_hive_strength_of_legions
					has_valid_civic = civic_machine_warbots
					has_valid_civic = civic_private_military_companies
					has_valid_civic = civic_warrior_culture
					has_origin = origin_payback
				}
			}

			modifier = {
				factor = 1.5
				OR = {
					has_ai_personality_behaviour = subjugator
					has_ai_personality_behaviour = opportunist
					has_ai_personality_behaviour = propagator
				}
			}
			modifier = {
				factor = 20
				has_ai_personality = metalhead
			}
		}
	}
}

war_philosophy = {
	category = {
		diplomacy
		military
	}

	potential = {
		OR = {
			is_country_type = default
			is_country_type = fallen_empire
			is_country_type = awakened_fallen_empire
		}
	}

	allow = {
		is_at_war = no # Not allowed to change policies in this group while at war
	}

	option = {
		name = "unrestricted_wars"

		policy_flags = {
			unrestricted_wars
		}

		in_breach_of = {
			{
				key = resolution_rulesofwar_last_resort_doctrine
			}
			{
				key = resolution_rulesofwar_demobilization_initiative
			}
		}

		valid = {
			NOR = {
				has_ethic = "ethic_pacifist"
				has_ethic = "ethic_fanatic_pacifist"
				has_valid_civic = "civic_inwards_perfection"
				has_civic = "civic_crusader_spirit"
			}
		}

		ai_weight = {
			modifier = {
				factor = 10
				OR = {
					has_valid_ai_personality = no
					is_ai = no
				}
				NOT = {
					has_ethic = "ethic_pacifist"
					has_ethic = "ethic_fanatic_pacifist"
				}
			}
			modifier = {
				factor = 10
				has_valid_ai_personality = yes
				is_ai = yes
				OR = {
					has_ai_personality_behaviour = conqueror
					has_ai_personality_behaviour = subjugator
					has_ai_personality_behaviour = purger
				}
			}
			modifier = {
				factor = 10
				has_ascension_perk = ap_become_the_crisis
			}
			modifier = {
				factor = 0.1
				has_valid_ai_personality = yes
				is_ai = yes
				is_galactic_community_member = yes
				OR = {
					is_active_resolution = "resolution_rulesofwar_last_resort_doctrine"
					is_active_resolution = "resolution_rulesofwar_demobilization_initiative"
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_ethic = "ethic_pacifist"
					has_ethic = "ethic_fanatic_pacifist"
				}
			}
		}
	}

	option = {
		name = "liberation_wars"

		policy_flags = {
			liberation_wars
		}

		potential = {
			NOT = { has_ethic = ethic_gestalt_consciousness }
		}

		valid = {
			NOR = {
				has_ethic = "ethic_fanatic_pacifist"
				has_valid_civic = "civic_fanatic_purifiers"
			}
		}

		on_enabled = {
			hidden_effect = {
				check_casus_belli_valid = {
					type = cb_ideology
				}
			}
		}

		on_disabled = {
			hidden_effect = {
				check_casus_belli_valid = {
					type = cb_ideology
				}
			}
		}

		ai_weight = {
			modifier = {
				factor = 2
				OR = {
					has_valid_ai_personality = no
					is_ai = no
				}
				has_ethic = "ethic_pacifist"
			}
			modifier = {
				factor = 2
				has_valid_ai_personality = yes
				is_ai = yes
				OR = {
					has_ai_personality_behaviour = conqueror
					has_ai_personality_behaviour = subjugator
					has_ai_personality_behaviour = liberator
				}
			}
		}
	}

	option = {
		name = "no_wars"

		policy_flags = {
			no_wars
		}

		valid = {
			NOR = {
				is_fanatic_militarist = yes
				has_valid_civic = "civic_fanatic_purifiers"
				has_valid_civic = "civic_hive_devouring_swarm"
				has_valid_civic = "civic_machine_terminator"
				has_civic = "civic_crusader_spirit"
			}
		}

		ai_weight = {
			modifier = {
				factor = 5
				has_ethic = "ethic_fanatic_pacifist"
			}
			modifier = {
				factor = 0
				NOT = { has_ethic = "ethic_fanatic_pacifist" }
			}
		}
	}
}

war_doctrine = {
	category = military
	potential = {
		OR = {
			AND = {
				is_country_type = default
				OR = {
					has_tradition = tr_supremacy_finish
					has_country_flag = hunger_accord
				}
			}
			is_mercenary = yes
			is_country_type = enclave_mercenary
			has_menace_perk = menp_defender_crisis_damage_4
		}
	}

	option = {
		name = "defense_in_depth_doctrine"

		valid = {
			OR = {
				AND = {
					is_country_type = default
					has_tradition = tr_supremacy_finish
				}
				is_country_type = enclave_mercenary
			}
		}

		policy_flags = {}
		modifier = {
			ship_home_territory_fire_rate_mult = 0.10
		}

		ai_weight = {
			factor = 1
		}
	}

	option = {
		name = "hit_and_run_doctrine"

		valid = {
			OR = {
				AND = {
					is_country_type = default
					has_tradition = tr_supremacy_finish
				}
				is_country_type = enclave_mercenary
			}
		}

		policy_flags = {}
		modifier = {
			ship_disengage_opportunities_add = 2
			ship_disengage_chance_mult = 0.33
			ship_emergency_ftl_mult = -0.25
		}

		ai_weight = {
			factor = 10
			modifier = {
				factor = 0
				is_pacifist = no
			}
		}
	}

	option = {
		name = "rapid_deployment_doctrine"

		valid = {
			OR = {
				AND = {
					is_country_type = default
					has_tradition = tr_supremacy_finish
				}
				is_country_type = enclave_mercenary
			}
		}

		policy_flags = {}
		modifier = {
			ship_speed_mult = 0.25
			ship_weapon_range_mult = 0.10
		}

		ai_weight = {
			factor = 10
			modifier = {
				factor = 100
				is_mercenary = yes
			}
		}
	}

	option = {
		name = "no_retreat_doctrine"

		valid = {
			OR = {
				AND = {
					is_country_type = default
					has_tradition = tr_supremacy_finish
				}
				is_country_type = enclave_mercenary
			}
			OR = {
				is_militarist = yes
				has_ethic = ethic_gestalt_consciousness
				has_civic = civic_fanatic_purifiers
			}
		}

		policy_flags = {}
		modifier = {
			ship_disengage_chance_reduction = 1
			ship_emergency_ftl_min_days_mult = 0.5
			ship_fire_rate_mult = 0.33
		}

		ai_weight = {
			factor = 100
			modifier = {
				factor = 0
				NOR = {
					has_ai_personality = honorbound_warriors
					has_ai_personality = devouring_swarm
				}
			}
		}
	}

	option = {
		name = "rip_and_tear"

		potential = {
			has_country_flag = hunger_accord
		}

		policy_flags = {
			debris_destruction
		}
		modifier = {
			ship_fire_rate_mult = 0.07
			ship_weapon_damage = 0.07
			ship_hull_mult = -0.15
		}

		ai_weight = {
			factor = 1
		}
	}

	option = {
		name = "ravenous_onslaught"

		potential = {
			has_country_flag = hunger_accord
		}

		policy_flags = {}
		modifier = {
			ship_steal_defeated_ship_chance = 0.05
			ship_disengage_chance_mult = 0.33
			ship_weapon_range_mult = -0.25
		}

		ai_weight = {
			factor = 1
		}
	}

	option = {
		name = "final_price_doctrine"

		valid = {
			has_menace_perk = menp_defender_crisis_damage_4
		}

		policy_flags = {}
		modifier = {
			ship_disengage_chance_reduction = 1
			ship_fire_rate_mult = 0.15
			damage_random_nearby_enemy_on_death = 0.5
		}

		ai_weight = {
			factor = 100
			modifier = {
				factor = 0
				NOR = {
					has_ethic = ethic_fanatic_militarist
					has_ethic = ethic_fanatic_authoritarian
				}
			}
		}
	}

	option = {
		name = "force_preservation_doctrine"

		valid = {
			has_menace_perk = menp_defender_crisis_damage_4
		}

		policy_flags = {}
		modifier = {
			ship_disengage_chance_mult = 0.5
			ship_damage_reduction_mult = 0.1
			ship_weapon_range_mult = 0.1
		}

		ai_weight = {
			factor = 10
			modifier = {
				factor = 0
				NOR = {
					has_ethic = ethic_pacifist
					has_ethic = ethic_fanatic_pacifist
					has_ethic = ethic_xenophile
					has_ethic = ethic_fanatic_xenophile
				}
			}
		}
	}
}

subjugation_war_terms = {
	category = diplomacy
	potential = {
		is_subject = no
		OR = {
			is_country_type = default
			is_country_type = fallen_empire
			is_country_type = awakened_fallen_empire
		}
	}

	option = {
		name = "oppressive_terms"

		policy_flags = {
			oppressive_terms
		}

		potential = {
			is_megacorp = no
		}

		on_enabled = {
			hidden_effect = { #this is to remember the player's pick if they are subjugated
				if = {
					limit = { is_ai = no }
					set_country_flag = oppressive_terms_preference
					remove_country_flag = benevolent_terms_preference
					remove_country_flag = balanced_terms_preference
				}
			}
		}

		ai_weight = {
			weight = 10

			# Nice people who would never pick this.
			modifier = {
				factor = 0.1
				has_ethic = ethic_fanatic_xenophile
			}
			modifier = {
				factor = 0.5
				has_ethic = ethic_xenophile
			}
			modifier = {
				factor = 0.1
				has_ethic = ethic_fanatic_pacifist
			}
			modifier = {
				factor = 0.5
				has_ethic = ethic_pacifist
			}

			# Bad people who likely would.
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_xenophobe
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_xenophobe
			}
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_authoritarian
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_authoritarian
			}
			modifier = {
				factor = 10
				has_country_flag = oppressive_terms_preference
			}
		}
	}

	option = {
		name = "balanced_terms"

		policy_flags = {
			balanced_terms
		}

		potential = {
			is_megacorp = no
		}

		on_enabled = {
			hidden_effect = {
				if = {
					limit = { is_ai = no }
					set_country_flag = balanced_terms_preference
					remove_country_flag = benevolent_terms_preference
					remove_country_flag = oppressive_terms_preference
				}
			}
		}

		ai_weight = {
			weight = 10

			# Rational people who would like this.
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_egalitarian
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_egalitarian
			}
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_materialist
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_materialist
			}
			modifier = {
				factor = 10
				has_country_flag = balanced_terms_preference
			}
		}
	}

	option = {
		name = "benevolent_terms"

		policy_flags = {
			benevolent_terms
		}

		potential = {
			is_megacorp = no
		}

		on_enabled = {
			hidden_effect = {
				if = {
					limit = { is_ai = no }
					set_country_flag = benevolent_terms_preference
					remove_country_flag = balanced_terms_preference
					remove_country_flag = oppressive_terms_preference
				}
			}
		}

		ai_weight = {
			weight = 10

			# Bad people who probably not pick this.
			modifier = {
				factor = 0.1
				has_ethic = ethic_fanatic_xenophobe
			}
			modifier = {
				factor = 0.5
				has_ethic = ethic_xenophobe
			}
			modifier = {
				factor = 0.1
				has_ethic = ethic_fanatic_authoritarian
			}
			modifier = {
				factor = 0.5
				has_ethic = ethic_authoritarian
			}

			# Nice people who probably would.
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_xenophile
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_xenophile
			}
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_pacifist
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_pacifist
			}
			modifier = {
				factor = 10
				has_country_flag = benevolent_terms_preference
			}
		}
	}

	option = {
		name = "oppressive_corporate_terms"

		policy_flags = {
			oppressive_terms
		}

		potential = {
			is_megacorp = yes
		}

		on_enabled = {
			hidden_effect = { #this is to remember the player's pick if they are subjugated
				if = {
					limit = { is_ai = no }
					set_country_flag = oppressive_terms_preference
					remove_country_flag = benevolent_terms_preference
					remove_country_flag = balanced_terms_preference
				}
			}
		}

		ai_weight = {
			weight = 10

			# Nice people who would never pick this.
			modifier = {
				factor = 0.1
				has_ethic = ethic_fanatic_xenophile
			}
			modifier = {
				factor = 0.5
				has_ethic = ethic_xenophile
			}
			modifier = {
				factor = 0.1
				has_ethic = ethic_fanatic_pacifist
			}
			modifier = {
				factor = 0.5
				has_ethic = ethic_pacifist
			}

			# Bad people who likely would.
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_xenophobe
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_xenophobe
			}
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_authoritarian
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_authoritarian
			}
			modifier = {
				factor = 10
				has_country_flag = oppressive_terms_preference
			}
		}
	}

	option = {
		name = "balanced_corporate_terms"

		policy_flags = {
			balanced_terms
		}

		on_enabled = {
			hidden_effect = {
				if = {
					limit = { is_ai = no }
					set_country_flag = balanced_terms_preference
					remove_country_flag = benevolent_terms_preference
					remove_country_flag = oppressive_terms_preference
				}
			}
		}

		potential = {
			is_megacorp = yes
		}

		ai_weight = {
			weight = 10

			# Rational people who would like this.
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_egalitarian
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_egalitarian
			}
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_materialist
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_materialist
			}
			modifier = {
				factor = 10
				has_country_flag = balanced_terms_preference
			}
		}
	}

	option = {
		name = "benevolent_corporate_terms"

		policy_flags = {
			benevolent_terms
		}

		potential = {
			is_megacorp = yes
		}

		on_enabled = {
			hidden_effect = {
				if = {
					limit = { is_ai = no }
					set_country_flag = benevolent_terms_preference
					remove_country_flag = balanced_terms_preference
					remove_country_flag = oppressive_terms_preference
				}
			}
		}

		ai_weight = {
			weight = 10

			# Bad people who probably not pick this.
			modifier = {
				factor = 0.1
				has_ethic = ethic_fanatic_xenophobe
			}
			modifier = {
				factor = 0.5
				has_ethic = ethic_xenophobe
			}
			modifier = {
				factor = 0.1
				has_ethic = ethic_fanatic_authoritarian
			}
			modifier = {
				factor = 0.5
				has_ethic = ethic_authoritarian
			}

			# Nice people who probably would.
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_xenophile
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_xenophile
			}
			modifier = {
				factor = 1.3
				has_ethic = ethic_fanatic_pacifist
			}
			modifier = {
				factor = 1.15
				has_ethic = ethic_pacifist
			}
			modifier = {
				factor = 10
				has_country_flag = benevolent_terms_preference
			}
		}
	}
}

orbital_bombardment = {
	category = military

	potential = {
		OR = {
			is_country_type = default
			is_country_type = vol
		}
	}

	option = {
		name = "orbital_bombardment_selective"
		policy_flags = {
			orbital_bombardment_selective
		}

		valid = {
			NOT = {
				has_event_chain = contract_raid_planet_chain
			}
		}

		ai_weight = {
			modifier = {
				factor = 0
				NOR = {
					has_ethic = "ethic_pacifist"
					has_ethic = "ethic_fanatic_pacifist"
				}
				NOT = {
					is_galactic_community_member = yes
					OR = {
						is_active_resolution = "resolution_rulesofwar_independent_tribunals"
						is_active_resolution = "resolution_rulesofwar_last_resort_doctrine"
						is_active_resolution = "resolution_rulesofwar_demobilization_initiative"
					}
				}
			}
		}
	}
	option = {
		name = "orbital_bombardment_indiscriminate"

		in_breach_of = {
			{
				key = resolution_rulesofwar_independent_tribunals
			}
			{
				key = resolution_rulesofwar_last_resort_doctrine
			}
			{
				key = resolution_rulesofwar_demobilization_initiative
			}
		}

		policy_flags = {
			orbital_bombardment_indiscriminate
		}
		modifier = {}

		valid = {
			NOR = {
				has_ethic = "ethic_pacifist"
				has_ethic = "ethic_fanatic_pacifist"
			}
		}
		ai_weight = {
			modifier = {
				factor = 0.1
				is_galactic_community_member = yes
				OR = {
					is_active_resolution = "resolution_rulesofwar_independent_tribunals"
					is_active_resolution = "resolution_rulesofwar_last_resort_doctrine"
					is_active_resolution = "resolution_rulesofwar_demobilization_initiative"
				}
			}
		}
	}
	option = {
		name = "orbital_bombardment_armageddon"

		in_breach_of = {
			{
				key = resolution_rulesofwar_independent_tribunals
			}
			{
				key = resolution_rulesofwar_last_resort_doctrine
			}
			{
				key = resolution_rulesofwar_demobilization_initiative
			}
		}

		potential = {
			OR = {
				has_valid_civic = civic_fanatic_purifiers
				has_valid_civic = civic_machine_terminator
			}
		}

		policy_flags = {
			orbital_bombardment_armageddon
		}
		modifier = {}

		ai_weight = {
			modifier = {
				factor = 10
				OR = {
					has_valid_civic = civic_fanatic_purifiers
					has_valid_civic = civic_machine_terminator
				}
			}
			modifier = {
				factor = 10
				has_ascension_perk = ap_become_the_crisis
			}
		}
	}

	option = {
		name = "orbital_bombardment_devastation"

		in_breach_of = {
			{
				key = resolution_rulesofwar_independent_tribunals
			}
			{
				key = resolution_rulesofwar_last_resort_doctrine
			}
			{
				key = resolution_rulesofwar_demobilization_initiative
			}
		}

		potential = {
			OR = {
				has_valid_civic = civic_scorched_earth
				has_valid_civic = civic_hive_scorched_earth
			}
		}

		policy_flags = {
			orbital_bombardment_devastation
		}
		modifier = {}

		ai_weight = {
			modifier = {
				factor = 10
				OR = {
					has_valid_civic = civic_scorched_earth
					has_valid_civic = civic_hive_scorched_earth
				}
			}
			modifier = {
				factor = 10
				has_ascension_perk = ap_become_the_crisis
			}
		}
	}
}

orbital_bombardment_accept_surrender = {
	category = military

	potential = {
		is_homicidal = no
	}

	option = {
		name = "orbital_bombardment_surrender_forbidden"

		policy_flags = {
			orbital_bombardment_surrender_forbidden
		}
		modifier = {}

		ai_weight = {
			base = 0
		}
	}

	option = {
		name = "orbital_bombardment_surrender_allowed"

		potential = {
			is_homicidal = no #locked to "forbidden"
		}

		policy_flags = {
			orbital_bombardment_surrender_allowed
		}
	}
}

interference = {
	category = diplomacy

	potential = {
		has_met_primitives = yes
	}

	option = {
		name = "interference_not_allowed"

		policy_flags = {
			interference_not_allowed
		}

		on_enabled = {
			hidden_effect = {
				set_country_flag = encountered_first_primitive
			}
		}

		in_breach_of = {
			{
				key = resolution_galacticstudies_advanced_xenostudies
			}
			{
				key = resolution_galacticstudies_ethical_guideline_refactoring
			}
			{
				key = resolution_galacticstudies_extradimensional_experimentation
			}
			{
				key = resolution_pre_ftl_stances_equal_standing
			}
			{
				key = resolution_pre_ftl_stances_exploitation
			}
		}

		valid = {
			OR = {
				custom_tooltip = {
					text = is_a_signatory_vassal
					any_agreement = { agreement_preset = preset_signatory }
				}
				is_active_resolution = resolution_pre_ftl_stances_non_interference
				NOR = {
					has_ethic = "ethic_fanatic_xenophobe"
					has_valid_civic = "civic_fanatic_purifiers"
					has_valid_civic = "civic_hive_devouring_swarm"
					has_valid_civic = "civic_machine_terminator"
				}
			}
		}

		ai_weight = {
			modifier = {
				factor = 0.1
				is_galactic_community_member = yes
				OR = {
					is_active_resolution = "resolution_galacticstudies_advanced_xenostudies"
					is_active_resolution = "resolution_galacticstudies_ethical_guideline_refactoring"
					is_active_resolution = "resolution_galacticstudies_extradimensional_experimentation"
					is_active_resolution = "resolution_pre_ftl_stances_equal_standing"
					is_active_resolution = "resolution_pre_ftl_stances_exploitation"
				}
			}
		}
	}

	option = {
		name = "interference_subtle"

		policy_flags = {
			interference_subtle
		}

		on_enabled = {
			hidden_effect = { set_country_flag = encountered_first_primitive }
		}

		valid = {
			OR = {
				custom_tooltip = {
					text = is_a_signatory_vassal
					any_agreement = { agreement_preset = preset_signatory }
				}
				NOR = {
					has_ethic = "ethic_fanatic_xenophobe"
					has_valid_civic = "civic_fanatic_purifiers"
					has_valid_civic = "civic_hive_devouring_swarm"
					has_valid_civic = "civic_machine_terminator"
				}
			}
		}

		ai_weight = {
			modifier = {
				factor = 2
				has_valid_ai_personality = yes
				has_ai_personality_behaviour = infiltrator
			}
			modifier = {
				factor = 0
				has_valid_ai_personality = yes
				NOT = {
					has_ai_personality_behaviour = infiltrator
				}
			}
		}
	}

	option = {
		name = "interference_active"

		policy_flags = {
			interference_active
		}

		in_breach_of = {
			{
				key = resolution_pre_ftl_stances_non_interference
			}
		}

		on_enabled = {
			hidden_effect = { set_country_flag = encountered_first_primitive }
		}

		valid = {
			NOR = {
				custom_tooltip = {
					text = is_a_signatory_vassal
					any_agreement = { agreement_preset = preset_signatory }
				}
				has_valid_civic = "civic_fanatic_purifiers"
				has_valid_civic = "civic_hive_devouring_swarm"
			}
		}

		ai_weight = {
			modifier = {
				factor = 2
				has_valid_ai_personality = yes
				OR = {
					has_ai_personality_behaviour = infiltrator
					has_ai_personality_behaviour = dominator
				}
			}
			modifier = {
				factor = 0
				has_valid_ai_personality = yes
				NOR = {
					has_ai_personality_behaviour = infiltrator
					has_ai_personality_behaviour = dominator
				}
			}
			modifier = {
				factor = 0.1
				is_galactic_community_member = yes
				OR = {
					is_active_resolution = "resolution_galacticstudies_advanced_xenostudies"
					is_active_resolution = "resolution_galacticstudies_ethical_guideline_refactoring"
					is_active_resolution = "resolution_galacticstudies_extradimensional_experimentation"
					is_active_resolution = "resolution_pre_ftl_stances_non_interference"
				}
			}
		}
	}
	option = {
		name = "interference_aggressive"

		in_breach_of = {
			{
				key = resolution_pre_ftl_stances_non_interference
			}
			{
				key = resolution_pre_ftl_stances_equal_standing
			}
		}

		valid = {
			custom_tooltip = {
				success_text = is_not_a_signatory_vassal_success
				fail_text = is_not_a_signatory_vassal_fail
				NOT = { any_agreement = { agreement_preset = preset_signatory } }
			}
			NOR = {
				has_ethic = "ethic_pacifist"
				has_ethic = "ethic_fanatic_pacifist"
				has_ethic = "ethic_xenophile"
				has_ethic = "ethic_fanatic_xenophile"
				has_valid_civic = civic_machine_exploration_protocol
			}
		}
		on_enabled = {
			hidden_effect = { set_country_flag = encountered_first_primitive }
		}
		policy_flags = {
			interference_aggressive
		}
		modifier = {}
		ai_weight = {
			modifier = {
				factor = 3
				has_valid_ai_personality = yes
				has_ai_personality_behaviour = dominator
			}
			modifier = {
				factor = 0
				has_valid_ai_personality = yes
				NOT = {
					has_ai_personality_behaviour = dominator
				}
			}
			modifier = {
				factor = 0
				OR = {
					has_ethic = "ethic_pacifist"
					has_ethic = "ethic_fanatic_pacifist"
				}
			}
			modifier = {
				factor = 0.1
				is_galactic_community_member = yes
				OR = {
					is_active_resolution = "resolution_pre_ftl_stances_non_interference"
					is_active_resolution = "resolution_pre_ftl_stances_equal_standing"
				}
			}
		}
	}
}

enlightenment = {
	category = diplomacy

	potential = {
		has_met_primitives = yes
	}

	option = {
		name = "enlightenment_not_allowed"

		policy_flags = {
			enlightenment_not_allowed
		}

		ai_weight = {
			weight = 1
		}
	}

	option = {
		name = "enlightenment_covert_only"

		policy_flags = {
			enlightenment_covert_only
		}

		valid = {
			NOT = { has_policy_flag = interference_not_allowed }
			NOR = {
				has_ethic = "ethic_fanatic_xenophobe"
				has_valid_civic = "civic_fanatic_purifiers"
				has_valid_civic = "civic_hive_devouring_swarm"
				has_valid_civic = "civic_machine_terminator"
			}
		}

		ai_weight = {
			weight = 1
		}
	}

	option = {
		name = "enlightenment_allowed"

		policy_flags = {
			enlightenment_allowed
		}
		modifier = {}

		valid = {
			NOT = { has_policy_flag = interference_not_allowed }
			NOR = {
				has_ethic = "ethic_fanatic_xenophobe"
				has_valid_civic = "civic_fanatic_purifiers"
				has_valid_civic = "civic_hive_devouring_swarm"
				has_valid_civic = "civic_machine_terminator"
			}
		}

		ai_weight = {
			modifier = {
				factor = 2
				has_valid_ai_personality = yes
				has_ai_personality_behaviour = uplifter
			}
			modifier = {
				factor = 0
				has_valid_ai_personality = yes
				NOT = { has_ai_personality_behaviour = uplifter }
			}
			modifier = {
				factor = 0
				is_xenophobe = yes
			}
		}
	}
}

resettlement = {
	category = society
	potential = {
		NOT = { has_ethic = "ethic_gestalt_consciousness" }
	}

	option = {
		name = "resettlement_not_allowed"

		policy_flags = {
			resettlement_not_allowed
		}

		modifier = {
			planet_resettlement_unemployed_mult = 1
		}
	}

	option = {
		name = "resettlement_allowed"

		policy_flags = {
			resettlement_allowed
		}
		modifier = {}

		ai_weight = {
			factor = 10
			modifier = {
				factor = 0
				is_egalitarian = yes
			}
		}
	}
}

appropriation = {
	category = society
	potential = {
		has_comms_with_alien_empire = yes
		is_nomadic = no
	}

	option = {
		name = "appropriation_not_allowed"

		policy_flags = {
			appropriation_not_allowed
		}

		ai_weight = {
			modifier = {
				factor = 10
				has_ai_personality_behaviour = multispecies
			}
		}
	}

	option = {
		name = "appropriation_allowed"

		policy_flags = {
			appropriation_allowed
		}
		modifier = {}

		ai_weight = {
			modifier = {
				factor = 10
				NOT = { has_ai_personality_behaviour = multispecies }
			}
			modifier = {
				factor = 10
				is_gestalt = yes
			}
		}
	}
}

leader_enhancement = {
	category = society

	potential = {
		has_technology = tech_selected_lineages
	}

	option = {
		name = "leader_enhancement_natural_selection"

		policy_flags = {
			leader_enhancement_natural_selection
		}

		in_breach_of = {
			{
				key = resolution_galacticstudies_ethical_guideline_refactoring
				trigger = {
					OR = {
						has_technology = tech_selected_lineages
						has_technology = tech_capacity_boosters
					}
				}
			}
			{
				key = resolution_galacticstudies_extradimensional_experimentation
				trigger = {
					OR = {
						has_technology = tech_selected_lineages
						has_technology = tech_capacity_boosters
					}
				}
			}
		}

		on_enabled = {
			# custom_tooltip = "policy_allow_slavery_effect_disable"
		}

		modifier = {}

	}

	option = {
		name = "leader_enhancement_selected_lineages"

		policy_flags = {
			leader_enhancement_selected_lineages
		}
		modifier = {
			leader_initial_skill = 1
			leader_lifespan_add = 10
			leaders_cost_mult = 1
			leaders_upkeep_mult = 0.5
		}

		in_breach_of = {
			{
				key = resolution_galacticstudies_ethical_guideline_refactoring
				trigger = {
					has_technology = tech_capacity_boosters
				}
			}
			{
				key = resolution_galacticstudies_extradimensional_experimentation
				trigger = {
					has_technology = tech_capacity_boosters
				}
			}
		}

		valid = {
			NOT = { has_ethic = "ethic_fanatic_egalitarian" }
		}

		ai_weight = {
			factor = 2
			modifier = {
				factor = 0
				OR = {
					has_ethic = "ethic_egalitarian"
					has_ethic = "ethic_fanatic_egalitarian"
				}
				NOT = {
					has_valid_ai_personality = yes
					is_ai = yes
					is_galactic_community_member = yes
					OR = {
						is_active_resolution = "resolution_galacticstudies_ethical_guideline_refactoring"
						is_active_resolution = "resolution_galacticstudies_extradimensional_experimentation"
					}
				}
			}
		}

		prerequisites = { tech_selected_lineages }
	}

	option = {
		name = "leader_enhancement_capacity_boosters"

		policy_flags = {
			leader_enhancement_capacity_boosters
		}
		modifier = {
			leader_initial_skill = 2
			leader_lifespan_add = 20
			leaders_cost_mult = 2
			leaders_upkeep_mult = 1
		}

		valid = {
			NOR = {
				has_ethic = "ethic_egalitarian"
				has_ethic = "ethic_fanatic_egalitarian"
			}
		}

		prerequisites = { tech_capacity_boosters }

		ai_weight = {
			factor = 3
		}
	}
}

first_contact_protocol = {
	category = diplomacy

	potential = {
		always = yes
	}

	option = {
		name = "first_contact_proactive"

		policy_flags = {
			first_contact_proactive
		}

		modifier = {
			first_contact_speed_mult = 0.1
		}

		on_enabled = {
		}

		valid = {
			is_homicidal = no
			is_xenophobe = no
			NOT = { has_origin = origin_payback }
		}

		ai_weight = {
			modifier = {
				factor = 2
				is_pacifist = yes
			}
			modifier = {
				factor = 2
				is_xenophile = yes
			}
			modifier = {
				factor = 2
				has_valid_civic = civic_machine_servitor
			}
		}
	}

	option = {
		name = "first_contact_cautious"

		policy_flags = {
			first_contact_cautious
		}

		modifier = {
			first_contact_defense_add = 2
		}

		on_enabled = {
		}

		valid = {
			is_homicidal = no
		}

		ai_weight = {
			modifier = {
				factor = 1.5
				always = yes #Liu Cixin is right
			}
			modifier = {
				factor = 2
				has_origin = origin_payback
			}
			modifier = {
				factor = 3
				has_origin = origin_wilderness
			}
		}
	}

	option = {
		name = "first_contact_attack_allowed"

		policy_flags = {
			first_contact_attack_allowed
		}
		modifier = {}

		valid = {
			is_pacifist = no
			OR = {
				is_xenophile = no
				is_homicidal = yes
			}
		}

		ai_weight = {
			modifier = {
				factor = 2
				is_militarist = yes
			}
			modifier = {
				factor = 2
				is_xenophobe = yes
			}
			modifier = {
				factor = 2
				is_gestalt = yes
			}
		}
	}
}

border_policy = {
	category = diplomacy

	potential = {
		is_nomadic = no
	}

	option = {
		name = "border_policy_open"

		policy_flags = {
			border_policy_open
		}

		potential = {
			OR = {
				is_country_type = default
				is_country_type = mirrored_country
				is_primitive = yes
			}
		}

		valid = {
			OR = {
				is_nomadic = yes
				NOR = {
					has_valid_civic = civic_machine_terminator
					has_valid_civic = civic_hive_devouring_swarm
					has_valid_civic = civic_fanatic_purifiers
				}
				is_primitive = yes
			}
		}
	}

	option = {
		name = "border_policy_closed"

		policy_flags = {
			border_policy_closed
		}
		modifier = {}

		potential = {
			is_nomadic = no
		}

		valid = {
			is_primitive = no
		}

		ai_weight = {
			factor = 10
			modifier = {
				factor = 0
				is_megacorp = yes
			}
			modifier = {
				factor = 0
				has_valid_ai_personality = yes
				NOR = {
					has_ai_personality_behaviour = isolationist
					has_ai_personality_behaviour = attack_neutrals
				}
			}
			modifier = {
				factor = 0
				has_valid_ai_personality = no
				is_xenophobe = no
			}
			modifier = {
				factor = 10
				has_crisis_level = crisis_level_5
			}
		}
	}
}

food_policy = {
	category = economy
	potential = {
		always = no
	}

	option = {
		name = "food_policy_rationing"

		modifier = {
			planet_pops_organics_food_upkeep_mult = -0.25
			planet_pops_organics_minerals_upkeep_mult = -0.25
			logistic_growth_mult = -0.1
			biological_pop_happiness = -0.1
			lithoid_pop_happiness = -0.1
		}

		ai_weight = {
			factor = 0
		}
	}

	option = {
		name = "food_policy_normal"

		modifier = {}

		ai_weight = {
			factor = 1
		}
	}

	option = {
		name = "food_policy_generous"

		modifier = {
			planet_pops_organics_food_upkeep_mult = 0.25
			planet_pops_organics_minerals_upkeep_mult = 0.25
			biological_pop_happiness = 0.05
			lithoid_pop_happiness = 0.05
			logistic_growth_mult = 0.1
		}

		ai_weight = {
			factor = 0
		}
	}
}

food_policy_gestalt = {
	category = economy
	potential = {
		always = no
	}

	option = {
		name = "food_policy_gestalt_rationing"

		modifier = {
			planet_pops_organics_food_upkeep_mult = -0.25
			logistic_growth_mult = -0.15
		}

		ai_weight = {
			factor = 0
		}
	}

	option = {
		name = "food_policy_gestalt_normal"

		modifier = {}

		ai_weight = {
			factor = 1
		}
	}

	option = {
		name = "food_policy_gestalt_generous"

		modifier = {
			planet_pops_organics_food_upkeep_mult = 0.5
			logistic_growth_mult = 0.33
		}

		ai_weight = {
			factor = 0
		}
	}
}

@research_policy_speed = 0.10
@research_policy_draw_chance = 0.25

physics_research_policy = {
	category = research
	potential = {
		has_ascension_perk = ap_technological_ascendancy
	}
	option = {
		name = "research_policy_no_focus"

		modifier = {
			country_physics_tech_research_speed = @research_policy_speed
		}

		ai_weight = {
			factor = 10
		}
	}

	option = {
		name = "research_policy_field_manipulation"

		modifier = {
			category_field_manipulation_research_speed_mult = @research_policy_speed
			category_field_manipulation_draw_chance_mult = @research_policy_draw_chance
		}

		ai_weight = {
			factor = 0
		}
	}

	option = {
		name = "research_policy_particles"

		modifier = {
			category_particles_research_speed_mult = @research_policy_speed
			category_particles_draw_chance_mult = @research_policy_draw_chance
		}

		ai_weight = {
			factor = 0
		}
	}

	option = {
		name = "research_policy_computing"

		modifier = {
			category_computing_research_speed_mult = @research_policy_speed
			category_computing_draw_chance_mult = @research_policy_draw_chance
		}

		ai_weight = {
			factor = 0
		}
	}
}

society_research_policy = {
	category = research
	potential = {
		has_ascension_perk = ap_technological_ascendancy
	}

	option = {
		name = "research_policy_no_focus"

		modifier = {
			country_society_tech_research_speed = @research_policy_speed
		}

		ai_weight = {
			factor = 10
		}
	}

	option = {
		name = "research_policy_new_worlds"

		modifier = {
			category_new_worlds_research_speed_mult = @research_policy_speed
			category_new_worlds_draw_chance_mult = @research_policy_draw_chance
		}

		ai_weight = {
			factor = 0
		}
	}

	option = {
		name = "research_policy_statecraft"

		modifier = {
			category_statecraft_research_speed_mult = @research_policy_speed
			category_statecraft_draw_chance_mult = @research_policy_draw_chance
		}

		ai_weight = {
			factor = 0
		}
	}

	option = {
		name = "research_policy_biology"

		modifier = {
			category_biology_research_speed_mult = @research_policy_speed
			category_biology_draw_chance_mult = @research_policy_draw_chance
		}

		ai_weight = {
			factor = 0
		}
	}

	option = {
		name = "research_policy_military_theory"

		modifier = {
			category_military_theory_research_speed_mult = @research_policy_speed
			category_military_theory_draw_chance_mult = @research_policy_draw_chance
		}

		ai_weight = {
			factor = 0
		}
	}
}

engineering_research_policy = {
	category = research
	potential = {
		has_ascension_perk = ap_technological_ascendancy
	}

	option = {
		name = "research_policy_no_focus"

		modifier = {
			country_engineering_tech_research_speed = @research_policy_speed
		}

		ai_weight = {
			factor = 10
		}
	}

	option = {
		name = "research_policy_materials"

		modifier = {
			category_materials_research_speed_mult = @research_policy_speed
			category_materials_draw_chance_mult = @research_policy_draw_chance
		}

		ai_weight = {
			factor = 0
		}
	}

	option = {
		name = "research_policy_propulsion"

		modifier = {
			category_propulsion_research_speed_mult = @research_policy_speed
			category_propulsion_draw_chance_mult = @research_policy_draw_chance
		}

		ai_weight = {
			factor = 0
		}
	}

	option = {
		name = "research_policy_voidcraft"

		modifier = {
			category_voidcraft_research_speed_mult = @research_policy_speed
			category_voidcraft_draw_chance_mult = @research_policy_draw_chance
		}

		ai_weight = {
			factor = 0
		}
	}

	option = {
		name = "research_policy_industry"

		modifier = {
			category_industry_research_speed_mult = @research_policy_speed
			category_industry_draw_chance_mult = @research_policy_draw_chance
		}

		ai_weight = {
			factor = 0
		}
	}
}

research_restriction_policy = {
	category = research
	potential = {
		OR = {
			is_country_type = default
			is_country_type = fallen_empire
			is_country_type = awakened_fallen_empire
		}
	}

	option = {
		name = research_restriction_dangerous_encouraged
		modifier = {
			dangerous_tech_draw_chance_mult = @research_policy_draw_chance
			rare_tech_draw_chance_mult = 0.05
			planet_researchers_upkeep_mult = 0.10
		}

		potential = {
			is_galactic_community_member = yes
			OR = {
				is_active_resolution = "resolution_galacticstudies_ethical_guideline_refactoring"
				is_active_resolution = "resolution_galacticstudies_extradimensional_experimentation"
			}
		}

		policy_flags = {
			research_restriction_dangerous_encouraged
		}

		ai_weight = {
			factor = 1
			modifier = {
				factor = 10
				has_valid_ai_personality = yes
				is_ai = yes
				is_galactic_community_member = yes
				OR = {
					is_active_resolution = "resolution_galacticstudies_ethical_guideline_refactoring"
					is_active_resolution = "resolution_galacticstudies_extradimensional_experimentation"
				}
				OR = {
					is_materialist = yes
					has_ascension_perk = ap_cosmogenesis
				}
			}
		}
	}

	option = {
		name = research_restriction_no_restriction

		policy_flags = {
			research_restriction_no_restriction
		}

		modifier = {

		}

		ai_weight = {
			factor = 5
		}
	}

	option = {
		name = research_restriction_dangerous_forbidden
		modifier = {
			dangerous_tech_draw_chance_mult = -1
			rare_tech_draw_chance_mult = -0.20
		}

		policy_flags = {
			research_restriction_dangerous_forbidden
		}

		ai_weight = {
			factor = 0
		}
	}
}

economic_policy = {
	category = economy
	potential = {
		NOT = { has_ethic = ethic_gestalt_consciousness }
	}

	option = {
		name = "economic_policy_civilian"

		modifier = {
			planet_jobs_consumer_goods_produces_mult = 0.25
			planet_jobs_alloys_produces_mult = -0.25
		}

		ai_weight = {
			factor = 0
		}
	}

	option = {
		name = "economic_policy_balanced"

		modifier = {}

		ai_weight = {
			factor = 1
			modifier = {
				factor = 10
				has_valid_ai_personality = yes
				is_ai = yes
				is_galactic_community_member = yes
				is_active_resolution = "resolution_rulesofwar_demobilization_initiative"
			}
		}
	}

	option = {
		name = "economic_policy_military"

		in_breach_of = {
			{
				key = resolution_rulesofwar_demobilization_initiative
			}
		}

		modifier = {
			planet_jobs_consumer_goods_produces_mult = -0.25
			planet_jobs_alloys_produces_mult = 0.25
		}

		policy_flags = {
			economic_policy_military
		}

		ai_weight = {
			factor = 2
			modifier = {
				factor = 0
				is_authoritarian = no
				NOT = { has_ascension_perk = ap_become_the_crisis }
			}
		}
	}
}

trade_policy = {
	category = economy
	potential = {
		NOT = { has_ethic = ethic_gestalt_consciousness }
	}

	option = {
		name = "trade_policy_default"

		potential = {
			is_worker_coop_empire = no
		}

		on_enabled = {
			hidden_effect = {
				set_trade_conversions = {
					trade = 0.5
					energy = 0.5
				}
			}
		}

		on_disabled = {
			hidden_effect = {
				set_trade_conversions = { }
			}
		}

		ai_weight = {
			factor = 0
		}
	}

	option = {
		name = "trade_policy_consumer_goods"
		potential = {
			OR = {
				has_federation = no
				AND = {
					has_federation = yes
					federation = { NOT = { has_federation_perk = trade_federation_passive } }
				}
			}
			has_tradition = tr_mercantile_adaptive_economic_policies
			is_worker_coop_empire = no
		}

		on_enabled = {
			set_trade_conversions = {
				trade = 0.5
				consumer_goods = 0.25
			}
		}

		policy_flags = {
			trade_conversion_consumer_goods
		}

		modifier = {}

		ai_weight = {
			factor = 1
		}
	}

	option = {
		name = "trade_policy_unity"
		potential = {
			OR = {
				has_federation = no
				AND = {
					has_federation = yes
					federation = {
						NOR = {
							has_federation_perk = trade_federation_passive
							has_federation_perk = unity_trade_1
						}
					}
				}
			}
			has_tradition = tr_mercantile_adaptive_economic_policies
			is_worker_coop_empire = no
		}

		on_enabled = {
			set_trade_conversions = {
				trade = 0.50
				unity = 0.125
			}
		}

		policy_flags = {
			trade_conversion_unity
		}

		modifier = {
		}

		ai_weight = {
			factor = 0
		}
	}

	option = {
		name = "trade_policy_trade_league"
		potential = {
			has_federation = yes
			federation = { has_federation_perk = trade_federation_passive }
		}
		on_enabled = {
			set_trade_conversions = {
				trade = 0.50
				energy = 0.15
				consumer_goods = 0.15
				unity = 0.075
			}
		}

		policy_flags = {
			trade_conversion_trade_league
		}

		modifier = {
		}

		ai_weight = {
			factor = 1000
		}
	}

	option = {
		name = "trade_policy_holy_covenant"
		potential = {
			has_federation = yes
			federation = { has_federation_perk = unity_trade_1 }
		}

		on_enabled = {
			set_trade_conversions = {
				trade = 0.50
				unity = 0.1875
			}
		}

		policy_flags = {
			trade_conversion_holy_covenant
		}

		modifier = {
		}

		ai_weight = {
			factor = 1000
		}
	}

	option = {
		name = "trade_policy_mutual_aid"
		potential = {
			is_worker_coop_empire = yes
		}

		on_enabled = {
			set_trade_conversions = {
				trade = 0.25
				energy = 0.20
				minerals = 0.20
				food = 0.20
				unity = 0.075
			}
		}

		policy_flags = {
			trade_conversion_mutual_aid
		}

		modifier = {
		}

		ai_weight = {
			factor = 1000
		}
	}

#	option = {
#		name = "trade_policy_research"
#
#		potential = {
#			is_worker_coop_empire = no
#		}
#
#		on_enabled = {
#			set_trade_conversions = {
#				physics_research = 0.1
#				society_research = 0.1
#				engineering_research = 0.1
#			}
#		}
#
#		ai_weight = {
#			factor = 0
#		}
#	}
}

logistics_policy = {
	category = economy
	potential = {
		is_gestalt = yes
	}

	option = {
		name = "logistics_policy_gestalt"

		potential = {
			is_gestalt = yes
		}

		on_enabled = {
			hidden_effect = {
				set_trade_conversions = {
					trade = 1
				}
			}
		}

		on_disabled = {
			hidden_effect = {
				set_trade_conversions = { }
			}
		}

		ai_weight = {
			factor = 0
		}
	}
}

drone_policy = {
	category = economy
	potential = {
		has_ethic = ethic_gestalt_consciousness
		is_wilderness_empire = no # see 'symbiont_policy'
	}

	option = {
		name = "drone_policy_balanced"

		modifier = {}

		ai_weight = {
			factor = 1
		}
	}

	option = {
		name = "drone_policy_worker"

		modifier = {
			planet_jobs_simple_drone_produces_mult = 0.2
			planet_jobs_complex_drone_produces_mult = -0.2
		}

		ai_weight = {
			factor = 0
		}
	}

	option = {
		name = "drone_policy_thinker"

		modifier = {
			planet_jobs_simple_drone_produces_mult = -0.2
			planet_jobs_complex_drone_produces_mult = 0.2
		}

		ai_weight = {
			factor = 0
		}
	}
}

symbiont_policy = {
	category = economy
	potential = {
		is_wilderness_empire = yes
	}

	option = {
		name = "symbiont_policy_balanced"

		modifier = {}

		ai_weight = {
			factor = 1
		}
	}

	option = {
		name = "symbiont_policy_worker"

		modifier = {
			planet_jobs_simple_drone_produces_mult = 0.2
			planet_jobs_complex_drone_produces_mult = -0.2
		}

		ai_weight = {
			factor = 0
		}
	}

	option = {
		name = "symbiont_policy_thinker"

		modifier = {
			planet_jobs_simple_drone_produces_mult = -0.2
			planet_jobs_complex_drone_produces_mult = 0.2
		}

		ai_weight = {
			factor = 0
		}
	}
}

artificial_intelligence_policy = {
	category = society
	potential = {
		NOT = { has_ethic = ethic_gestalt_consciousness }
		OR = {
			has_origin = origin_synthetic_fertility
			can_set_ai_policy = yes
			has_country_flag = synthetic_empire
			is_individual_machine = yes
		}
	}

	option = {
		name = "ai_outlawed"

		potential = {
			is_individual_machine = no
		}
		valid = {
			NOR = {
				is_materialist = yes
				has_origin = origin_synthetic_fertility
				custom_tooltip = {
					success_text = is_a_synthetic_empire
					has_country_flag = synthetic_empire
				}
				is_individual_machine = yes
			}
		}

		policy_flags = {
			ai_outlawed
		}

		in_breach_of = {
			{
				key = resolution_galacticstudies_advanced_xenostudies
			}
			{
				key = resolution_galacticstudies_ethical_guideline_refactoring
			}
			{
				key = resolution_galacticstudies_extradimensional_experimentation
			}
		}

		ai_weight = {
			modifier = {
				factor = 0
				is_materialist = yes
			}
			modifier = {
				factor = 5
				is_spiritualist = yes
				NOT = { has_origin = origin_cybernetic_creed }
			}
			modifier = {
				factor = 0.1
				has_valid_ai_personality = yes
				is_ai = yes
				is_galactic_community_member = yes
				OR = {
					is_active_resolution = "resolution_galacticstudies_advanced_xenostudies"
					is_active_resolution = "resolution_galacticstudies_ethical_guideline_refactoring"
					is_active_resolution = "resolution_galacticstudies_extradimensional_experimentation"
				}
			}
		}
	}

	option = {
		name = "ai_servitude"

		potential = {
			is_individual_machine = no
		}

		valid = {
			NOT = {	has_origin = origin_synthetic_fertility }
			custom_tooltip = {
				fail_text = is_a_synthetic_empire_fail
				NOT = { has_country_flag = synthetic_empire }
			}
			is_individual_machine = no
		}

		policy_flags = {
			ai_servitude
		}

		ai_weight = {
			modifier = {
				factor = 5
				has_valid_ai_personality = yes
				has_ai_personality_behaviour = robot_exploiter
			}
			modifier = {
				factor = 2
				has_valid_ai_personality = yes
				has_ai_personality_behaviour = robot_liberator
			}
			modifier = {
				factor = 0
				is_spiritualist = yes
				NOT = { has_origin = origin_cybernetic_creed }
				NOT = {
					has_valid_ai_personality = yes
					is_ai = yes
					is_galactic_community_member = yes
					OR = {
						is_active_resolution = "resolution_galacticstudies_advanced_xenostudies"
						is_active_resolution = "resolution_galacticstudies_ethical_guideline_refactoring"
						is_active_resolution = "resolution_galacticstudies_extradimensional_experimentation"
					}
				}
			}
		}
	}

	option = {
		name = "ai_full_rights"

		valid = {
			OR = {
				custom_tooltip = {
					fail_text = is_a_synthetic_empire
					has_country_flag = synthetic_empire
				}
				if = {
					limit = {
						NOT = { has_origin = origin_cybernetic_creed }
					}
					is_spiritualist = no
				}
				is_individual_machine = yes
			}
			NOT = { has_policy_flag = robots_outlawed }
		}

		policy_flags = {
			ai_full_rights
		}

		in_breach_of = {
			{
				key = resolution_divinity_a_defined_purpose
			}
		}

		modifier = {}

		ai_weight = {
			modifier = {
				factor = 0.5
				is_materialist = no
				NOR = {
					is_synthetic_empire = yes
					has_technology = tech_synthetic_workers
				}
			}
			modifier = {
				factor = 5
				has_valid_ai_personality = yes
				has_ai_personality_behaviour = robot_liberator
			}
			modifier = {
				factor = 0
				is_spiritualist = yes
				NOT = { has_origin = origin_cybernetic_creed }
			}
		}
	}
}

robot_pop_policy = {
	category = society
	potential = {
		OR = {
			NOR = {
				has_ethic = ethic_gestalt_consciousness
				is_individual_machine = yes
			}
			has_origin = origin_nomadic_purger
		}
	}

	option = {
		name = "robot_pops_outlawed"

		valid = {
			OR = {
				has_origin = origin_nomadic_purger
				AND = {
					is_materialist = no
					NOR = {
						has_origin = origin_synthetic_fertility
						has_policy_flag = ai_full_rights
					}
					is_individual_machine = no
				}
			}
		}

		policy_flags = {
			robots_outlawed
		}

		on_enabled = {
			hidden_effect = {
				every_owned_species = {
					limit = { is_robotic_species = yes }
					set_citizenship_type = {
						type = citizenship_purge
						country = root
					}
				}
			}
		}

		ai_weight = {
			factor = 1
			modifier = {
				factor = 10
				has_valid_ai_personality = yes
				NOR = {
					has_ai_personality_behaviour = robot_exploiter
					has_ai_personality_behaviour = robot_liberator
				}
			}
			modifier = {
				factor = 10
				has_ethic = "ethic_fanatic_spiritualist"
			}
		}
	}

	option = {
		name = "robot_pops_allowed"

		potential = {
			NOT = { has_origin = origin_nomadic_purger }
		}

		policy_flags = {
			robots_allowed
		}

		on_enabled = {
			hidden_effect = {
				country_event = {
					id = action.56 # Failsafe if you don't have a robot species to assemble.
				}
			}
		}

		ai_weight = {
			factor = 2
			modifier = {
				factor = 0
				has_ethic = "ethic_fanatic_spiritualist"
			}
		}
	}
}

# Specifically for pre_sapients policies, you can have a pre_sapient_purge = purge_type parameter to determine how a policy purges presapients
pre_sapients = {
	category = society
	potential = {
		OR = {
			has_country_flag = found_presapients
			any_planet_within_border = {
				any_owned_pop_group = {
					is_sapient = no
				}
			}
			is_guided_sapience_empire = yes
		}
	}
	option = {
		name = "pre_sapients_protect"

		potential = {
			NOR = {
				has_valid_civic = civic_machine_terminator
				has_valid_civic = civic_hive_devouring_swarm
				has_valid_civic = civic_fanatic_purifiers
			}
		}

		on_enabled = {
			hidden_effect = {
				set_country_flag = found_presapients
			}
		}

		policy_flags = {
			pre_sapients_protect
		}

		ai_weight = {
			factor = 10
			modifier = {
				factor = 0
				values_others = no
			}
		}
	}

	option = {
		name = "pre_sapients_allow"

		potential = {
			NOR = {
				has_valid_civic = civic_machine_terminator
				has_valid_civic = civic_hive_devouring_swarm
				has_valid_civic = civic_fanatic_purifiers
				is_guided_sapience_empire = yes
			}
		}

		on_enabled = {
			hidden_effect = {
				set_country_flag = found_presapients
			}
		}

		policy_flags = {
			pre_sapients_allow
		}

		ai_weight = {
			factor = 10
		}
	}

	option = {
		name = "pre_sapients_eat"
		pre_sapient_purge = purge_processing

		potential = {
			is_synthetic_empire = no
			NOR = {
				has_valid_civic = civic_fanatic_purifiers
				is_guided_sapience_empire = yes
			}
		}

		on_enabled = {
			hidden_effect = {
				set_country_flag = found_presapients
			}
		}

		valid = {
			NOR = {
				has_ethic = "ethic_xenophile"
				has_ethic = "ethic_fanatic_xenophile"
			}
		}

		policy_flags = {
			pre_sapients_eat
		}

		modifier = {}

		ai_weight = {
			factor = 10
			modifier = {
				factor = 0
				NOT = { has_valid_civic = civic_hive_devouring_swarm }
			}
		}
	}

	option = {
		name = "pre_sapients_purge"
		pre_sapient_purge = purge_normal

		valid = {
			NOR = {
				has_ethic = "ethic_xenophile"
				has_ethic = "ethic_fanatic_xenophile"
				is_guided_sapience_empire = yes
			}
		}

		on_enabled = {
			hidden_effect = {
				set_country_flag = found_presapients
			}
		}

		policy_flags = {
			pre_sapients_purge
		}

		modifier = {}

		ai_weight = {
			factor = 10
			modifier = {
				factor = 0
				is_country_type = default
				NOR = {
					has_valid_civic = civic_machine_terminator
					has_valid_civic = civic_fanatic_purifiers
				}
			}
		}
	}
}

disconnected_drones = {
	category = society
	potential = {
		has_biogenesis_dlc = yes
		is_regular_empire = yes
		OR = {
			any_owned_colony = {
				any_owned_pop_group = {
					is_hive_species = yes
				}
			}
			any_playable_country = {
				is_hive_empire = yes
				has_communications = root
			}
		}
	}

	option = {
		name = "disconnected_drones_sustain"

		potential = {
			NOT = {
				has_valid_civic = civic_fanatic_purifiers
			}
		}

		on_enabled = {
			hidden_effect = {
				every_owned_species = {
					limit = {
						OR = {
							has_citizenship_type = {
								type = citizenship_exploited_drone
								country = root
							}
							has_citizenship_type = {
								type = citizenship_symbiotic_drone
								country = root
							}
						}
					}
					set_citizenship_type = {
						type = citizenship_protected_drone
						country = root
					}
				}
			}
		}

		policy_flags = {
			disconnected_drones_sustain
		}

		ai_weight = {
			factor = 10
			modifier = {
				factor = 0
				values_others = no
			}
		}
	}

	option = {
		name = "disconnected_drones_purge"

		valid = {
			is_xenophile = no
		}

		on_enabled = {
			hidden_effect = {
				every_owned_species = {
					limit = {
						OR = {
							has_citizenship_type = {
								type = citizenship_protected_drone
								country = root
							}
							has_citizenship_type = {
								type = citizenship_symbiotic_drone
								country = root
							}
							has_citizenship_type = {
								type = citizenship_exploited_drone
								country = root
							}
						}
					}
					set_citizenship_type = {
						type = citizenship_purge
						country = root
					}
				}
			}
		}

		policy_flags = {
			disconnected_drones_purge
		}

		ai_weight = {
			factor = 10
			modifier = {
				factor = 0
				is_homicidal = no
			}
		}
	}
}

debris = {
	category = research
	potential = {
		has_encountered_other_species = yes
		OR = {
			is_country_type = default
			is_country_type = fallen_empire
			is_country_type = awakened_fallen_empire
		}
	}

	option = {
		name = "research_debris"

		potential = {
			is_scavenger = no
		}

		policy_flags = {
			research_debris
		}

		ai_weight = {
			factor = 1
			modifier = {
				factor = 0
				is_nomadic = yes
			}
		}
	}
	option = {
		name = "scavenge_debris"

		potential = {
			is_scavenger = no
		}

		policy_flags = {
			scavenge_debris
		}

		ai_weight = {
			factor = 1
			modifier = {
				factor = 10
				is_nomadic = yes
			}
		}
	}

	option = {
		name = "scavenge_and_research_debris"

		potential = {
			is_scavenger = yes
		}

		policy_flags = {
			scavenge_and_research_debris
		}
	}
}

refugees = {
	category = society
	potential = {
		has_encountered_other_species = yes
		is_country_type = default
		OR = {
			NOT = { has_ethic = "ethic_gestalt_consciousness" }
			has_valid_civic = civic_machine_servitor
		}
	}

	option = {
		name = "refugees_not_allowed"

		valid = {
			is_xenophile = no
		}

		policy_flags = {
			refugees_not_allowed
		}
	}

	option = {
		name = "refugees_only_citizens"

		potential = {
			NOT = { has_ethic = "ethic_gestalt_consciousness" }
		}

		policy_flags = {
			refugees_only_citizens
		}

		valid = {
			NOT = {
				is_hive_empire = yes
			}
		}

		ai_weight = {
			factor = 5
		}
	}

	option = {
		name = "refugees_allowed"

		policy_flags = {
			refugees_allowed
		}

		valid = {
			is_xenophobe = no
		}

		ai_weight = {
			factor = 10
			modifier = {
				factor = 0
				NOR = {
					is_xenophile = yes
					has_valid_civic = civic_machine_servitor
					AND = {
						has_valid_ai_personality = yes
						NOT = { has_ai_personality_behaviour = multispecies }
					}
				}
			}
		}
	}
}

population_controls = {
	category = society
	potential = {
		NOT = { has_ethic = "ethic_gestalt_consciousness" }
	}

	option = {
		name = "population_controls_not_allowed"

		on_enabled = {
			hidden_effect = { every_owned_planet = { remove_modifier = planet_population_control } }
		}

		policy_flags = {
			population_controls_not_allowed
		}
	}

	option = {
		name = "population_controls_allowed"

		on_enabled = {
			hidden_effect = { every_owned_planet = { remove_modifier = planet_growth_discouraged } }
		}

		policy_flags = {
			population_controls_allowed
		}

		modifier = {
			refugee_attraction = -0.10
		}

		ai_weight = {
			factor = 10
			modifier = {
				factor = 0
				OR = {
					is_egalitarian = yes
					is_xenophile = yes
				}
			}
		}
	}
}

slavery = {
	category = society
	potential = {
		NOT = { has_ethic = "ethic_gestalt_consciousness" }
	}

	option = {
		name = "slavery_not_allowed"

		valid = {
			NOR = {
				has_valid_civic = civic_slaver_guilds
				has_valid_civic = civic_indentured_assets
			}
		}

		policy_flags = {
			slavery_not_allowed
		}

		on_enabled = {
			hidden_effect = { every_owned_planet = { remove_modifier = slave_colony } }
		}

		modifier = {
			slave_market_cost_mult = 1
		}
	}

	option = {
		name = "slavery_allowed"

		valid = {
			custom_tooltip = {
				success_text = is_not_a_signatory_vassal_success
				fail_text = is_not_a_signatory_vassal_fail
				NOT = { any_agreement = { agreement_preset = preset_signatory } }
			}
			custom_tooltip = {
				fail_text = is_broken_shackles_origin
				NOT = { has_origin = origin_broken_shackles }
			}
			OR = {
				is_authoritarian = yes
				is_xenophobe = yes
			}
		}

		modifier = {
			refugee_attraction = -0.40
		}

		policy_flags = {
			slavery_allowed
		}
		modifier = {}

		ai_weight = {
			factor = 10
			modifier = {
				factor = 0
				has_valid_ai_personality = yes
				NOT = { has_ai_personality_behaviour = slaver }
			}
			modifier = {
				factor = 0
				has_valid_ai_personality = no
				NOR = {
					is_authoritarian = yes
					is_xenophobe = yes
				}
			}
			# special case for harmonious collectives
			modifier = {
				factor = 0
				has_valid_ai_personality = no
				is_ai = yes
				NOR = {
					is_xenophobe = yes
					is_militarist = yes
				}
				OR = {
					has_ethic = "ethic_pacifist"
					has_ethic = "ethic_fanatic_pacifist"
					has_ethic = "ethic_xenophile"
					has_ethic = "ethic_fanatic_xenophile"
				}
				OR = {
					has_ethic = "ethic_authoritarian"
					has_ethic = "ethic_fanatic_authoritarian"
				}
				NOR = {
					has_valid_civic = "civic_slaver_guilds"
					has_trait = "trait_decadent"
					has_trait = "trait_robot_decadent"
				}
			}
		}
	}
}

purge = {
	category = society
	option = {
		name = "purge_not_allowed"

		valid = {
			NOT = { has_ethic = ethic_gestalt_consciousness }
			NOR = {
				has_valid_civic = "civic_fanatic_purifiers"
				has_valid_civic = "civic_scorched_earth"
				has_origin = origin_nomadic_purger
			}
		}

		policy_flags = {
			purge_not_allowed
		}

		on_enabled = {
			if = {
				limit = {
					is_nomadic = yes
					OR = {
						has_policy_flag = nomad_total_war_purge
						has_policy_flag = nomad_total_war_displace
					}
				}
				set_policy = {
					policy = nomad_total_war
					option = nomad_total_war_subject
					cooldown = yes
				}
			}
		}
	}

	option = {
		name = "purge_displacement_only"

		policy_flags = {
			purge_displacement_only
		}

		modifier = {
			refugee_attraction = -0.25
		}

		valid = {
			is_xenophile = no
			is_homicidal = no
			NAND = {
				has_origin = origin_nomadic_purger
				overlord? = {
					has_policy_flag = nomad_total_war_purge
				}
			}
		}

		on_enabled = {
			if = {
				limit = {
					is_nomadic = yes
					has_policy_flag = nomad_total_war_purge
				}
				set_policy = {
					policy = nomad_total_war
					option = nomad_total_war_displace
					cooldown = yes
				}
			}
		}

		ai_weight = {
			factor = 5
			modifier = {
				factor = 10
				has_ethic = ethic_gestalt_consciousness
				values_others = yes
			}
			modifier = {
				factor = 0
				has_valid_ai_personality = yes
				has_ai_personality_behaviour = multispecies
			}
		}
	}

	option = {
		name = "purge_allowed"

		in_breach_of = {
			{
				key = resolution_rulesofwar_reverence_for_life
			}
			{
				key = resolution_rulesofwar_independent_tribunals
			}
			{
				key = resolution_rulesofwar_last_resort_doctrine
			}
			{
				key = resolution_rulesofwar_demobilization_initiative
			}
		}

		policy_flags = {
			purge_allowed
		}
		modifier = {
			refugee_attraction = -0.90
		}

		valid = {
			custom_tooltip = {
				success_text = is_not_a_signatory_vassal_success
				fail_text = is_not_a_signatory_vassal_fail
				NOT = { any_agreement = { agreement_preset = preset_signatory } }
			}
			custom_tooltip = {
				fail_text = is_broken_shackles_origin
				NOT = { has_origin = origin_broken_shackles }
			}
			OR = {
				has_ethic = ethic_gestalt_consciousness
				is_xenophobe = yes
				has_crisis_perk = menp_undertaker	# Unlocked with Crisis Level 1
				AND = {
					custom_tooltip = {
						text = civic_tooltip_not_xenophile
						is_xenophile = no
					}
					has_purity_imperfection_remediation_tradition = yes
				}
			}
			NAND = {
				has_origin = origin_nomadic_purger
				overlord? = {
					has_policy_flag = nomad_total_war_displace
				}
			}
		}

		ai_weight = {
			factor = 10
			modifier = {
				factor = 40
				has_ethic = ethic_gestalt_consciousness
				values_others = no
			}
			modifier = {
				factor = 0
				is_pacifist = yes
			}
			modifier = {
				factor = 0
				has_valid_ai_personality = yes
				NOR = {
					has_ai_personality_behaviour = purger
					has_ethic = ethic_gestalt_consciousness
					AND = {
						has_origin = origin_necrophage
						is_xenophobe = yes
					}
				}
			}
			modifier = {
				factor = 0.1
				has_valid_ai_personality = yes
				is_ai = yes
				is_galactic_community_member = yes
				OR = {
					is_active_resolution = "resolution_rulesofwar_reverence_for_life"
					is_active_resolution = "resolution_rulesofwar_independent_tribunals"
					is_active_resolution = "resolution_rulesofwar_last_resort_doctrine"
					is_active_resolution = "resolution_rulesofwar_demobilization_initiative"
				}
			}
			modifier = {
				factor = 10
				has_ascension_perk = ap_become_the_crisis
			}
			modifier = {
				factor = 1000
				has_origin = origin_necrophage
				is_xenophobe = yes
			}
		}
	}
}

nomad_total_war = {
	category = diplomacy
	potential = {
		is_nomadic = yes
	}
	option = {
		name = "nomad_total_war_subject"

		valid = {
			is_homicidal = no
		}

		policy_flags = {
			nomad_total_war_subject
		}
		ai_weight = {
			factor = 1
			modifier = {
				add = 5
				has_valid_ai_personality = yes
				has_ai_personality_behaviour = subjugator
			}
			modifier = {
				add = 5
				has_valid_ai_personality = yes
				has_ai_personality_behaviour = conqueror # Since Nomads can't hold land this is the best alternative option
			}
			modifier = {
				factor = 0
				has_valid_ai_personality = yes
				has_ai_personality_behaviour = purger
			}
		}
	}

	option = {
		name = "nomad_total_war_displace"

		policy_flags = {
			nomad_total_war_displace
		}

		modifier = {}

		valid = {
			is_xenophile = no
			is_homicidal = no
			custom_tooltip = {
				fail_text = nomad_total_war_requires_purge_not_banned
				NOT = { has_policy_flag = purge_not_allowed }
			}
		}

		ai_weight = {
			factor = 5
			modifier = {
				factor = 0
				has_valid_ai_personality = yes
				has_ai_personality_behaviour = multispecies
			}
		}
	}

	option = {
		name = "nomad_total_war_purge"

		in_breach_of = {
			{
				key = resolution_rulesofwar_reverence_for_life
			}
			{
				key = resolution_rulesofwar_independent_tribunals
			}
			{
				key = resolution_rulesofwar_last_resort_doctrine
			}
			{
				key = resolution_rulesofwar_demobilization_initiative
			}
		}

		policy_flags = {
			nomad_total_war_purge
		}
		modifier = {}

		valid = {
			custom_tooltip = {
				success_text = is_not_a_signatory_vassal_success
				fail_text = is_not_a_signatory_vassal_fail
				NOT = { any_agreement = { agreement_preset = preset_signatory } }
			}
			custom_tooltip = {
				fail_text = is_broken_shackles_origin
				NOT = { has_origin = origin_broken_shackles }
			}
			OR = {
				has_ethic = ethic_gestalt_consciousness
				is_xenophobe = yes
				has_crisis_perk = menp_undertaker	# Unlocked with Crisis Level 1
				AND = {
					custom_tooltip = {
						text = civic_tooltip_not_xenophile
						is_xenophile = no
					}
					has_purity_imperfection_remediation_tradition = yes
				}
			}
			custom_tooltip = {
				fail_text = nomad_total_war_requires_purge_allowed
				OR = {
					is_homicidal = yes
					has_policy_flag = purge_allowed
				}
			}
		}

		ai_weight = {
			factor = 10
			modifier = {
				factor = 40
				has_ethic = ethic_gestalt_consciousness
				values_others = no
			}
			modifier = {
				factor = 0
				OR = {
					is_pacifist = yes
					values_others = yes
				}
			}
			modifier = {
				factor = 0
				has_valid_ai_personality = yes
				NOR = {
					has_ai_personality_behaviour = purger
					has_ethic = ethic_gestalt_consciousness
					AND = {
						has_origin = origin_necrophage
						is_xenophobe = yes
					}
				}
			}
			modifier = {
				factor = 0.1
				has_valid_ai_personality = yes
				is_ai = yes
				is_galactic_community_member = yes
				OR = {
					is_active_resolution = "resolution_rulesofwar_reverence_for_life"
					is_active_resolution = "resolution_rulesofwar_independent_tribunals"
					is_active_resolution = "resolution_rulesofwar_last_resort_doctrine"
					is_active_resolution = "resolution_rulesofwar_demobilization_initiative"
				}
			}
			modifier = {
				factor = 10
				has_ascension_perk = ap_become_the_crisis
			}
			modifier = {
				factor = 1000
				has_origin = origin_necrophage
				is_xenophobe = yes
			}
		}
	}
}

knightly_duties = {
	category = society
	potential = {
		is_country_type = default
		has_origin = origin_toxic_knights
		NOT = { has_country_flag = quest_abandoned }
	}

	option = {
		name = "questing_knights"

		policy_flags = {
			toxic_knights_questing
		}

		modifier = {
			science_ship_survey_speed = 0.15
			ship_anomaly_generation_chance_mult = 0.05
		}

		ai_weight = {
			factor = 5 #This should make sure AIs stick to this policy
		}
	}

	option = {
		name = "military_knights"

		potential = {
			owner = { is_nomadic = no }
		}

		policy_flags = {
			toxic_knights_military
		}

		modifier = {
			ship_home_territory_fire_rate_mult = 0.2
			ship_fire_rate_mult = 0.10
			army_damage_mult = 0.10
		}
	}

	option = {
		name = "military_knights_nomad"

		potential = {
			owner = { is_nomadic = yes }
		}

		policy_flags = {
			toxic_knights_military
		}

		modifier = {
			ship_fire_rate_mult = 0.15
			army_damage_mult = 0.10
		}
	}

	option = {
		name = "diplomats_knights"

		policy_flags = {
			toxic_knights_diplomats
		}

		modifier = {
			diplo_weight_mult = 0.10
		}
	}

	option = {
		name = "herald_knights"

		potential = {
			owner = { has_country_flag = toxoids_7090_a }
		}

		policy_flags = {
			toxic_knights_herald
		}

		modifier = {
			edicts_cost_mult = -0.15
			edicts_upkeep_mult = -0.15
		}
	}
}

relentless_industrialists_policy = {
	category = economy
	potential = {
		is_country_type = default
		is_relentless_industrialist_empire = yes
		has_country_flag = relentless_industrialists_situation_finished
	}

	#Fires when the policy group first becomes available
	on_activate = {
		set_policy_cooldown = relentless_industrialists_policy
	}

	option = {
		name = relentless_industrialists_full_steam_ahead

		policy_flags = {
			relentless_industrialists_full_steam_ahead
		}

		ai_weight = {
			weight = 1
			modifier = {
				factor = 5
				has_country_flag = relentless_industrialists_full_steam_ahead
			}
		}
	}
	option = {
		name = relentless_industrialists_study

		policy_flags = {
			relentless_industrialists_study
		}

		on_enabled = {
			if = {
				limit = {
					NOT = { has_country_flag = relentless_industrialists_study_completed }
				}
				enable_special_project = {
					name = RELENTLESS_INDUSTRIALISTS_STUDY_PROJECT
				}
			}
		}

		ai_weight = {
			weight = 1
			modifier = {
				factor = 5
				has_country_flag = relentless_industrialists_study_completed
			}
		}
	}
	option = {
		name = relentless_industrialists_cleanup

		policy_flags = {
			relentless_industrialists_cleanup
		}

		ai_weight = {
			weight = 1
			modifier = {
				factor = 5
				has_country_flag = relentless_industrialists_cleanup
			}
		}
	}
}

# eternal_vigilance_policy = {
# 	potential = {
# 		is_country_type = default
# 		has_ascension_perk = ap_eternal_vigilance
# 	}
#
# 	option = {
# 		name = eternal_vigilance_full_spending
#
# 		policy_flags = {
# 			eternal_vigilance_full_spending
# 		}
#
# 		ai_weight = {
# 			weight = 20
# 			modifier = { #Seems like a good idea if you have the energy to spend
# 				factor = 5
# 				has_monthly_income = {
# 					resource = energy
# 					value > 500
# 				}
# 			}
# 			modifier = { #Uhoh we are close to a deficit we probably shouldn't
# 				factor = 0
# 				has_monthly_income = {
# 					resource = energy
# 					value < 50
# 				}
# 			}
# 		}
# 	}
# 	option = {
# 		name = eternal_vigilance_half_spending
#
# 		policy_flags = {
# 			eternal_vigilance_half_spending
# 		}
#
# 		ai_weight = { #This is the option if you are doing just fine on the economy front
# 			weight = 75
# 		}
# 	}
# 	option = {
# 		name = eternal_vigilance_no_spending
#
# 		policy_flags = {
# 			eternal_vigilance_no_spending
# 		}
#
# 		ai_weight = {
# 			weight = 20
# 			modifier = { #Seems like a bad idea if you have the energy to spend
# 				factor = 0
# 				has_monthly_income = {
# 					resource = energy
# 					value > 500
# 				}
# 			}
# 			modifier = { #Uhoh we are close to a deficit we probably shouldn't spend more
# 				factor = 5
# 				has_monthly_income = {
# 					resource = energy
# 					value < 50
# 				}
# 			}
# 		}
# 	}
# }
