##############################
# Democratic Election Faction
##############################
# Democratic Election factions will briefly exist during
# democratic elections to allow for multiple choices
# if only Loyalists exist.

democratic_election_faction = {
	election_header = "GFX_faction_header_yellow"
	lose_support_on_pop_leave = no

	parameters = {
		empire = {
			type = country
			valid_objects = {
				is_same_value = root
			}
		}
	}

	on_create = {
		set_name = random
	}
	
	hidden = yes
	
	attraction = {
		base = 0
		
		modifier = {
			add = 999
			
			exists = pop_faction
			pop_faction = {
				is_pop_faction_type = democratic_election_faction
			}
		}

		modifier = {
			factor = 0
			OR = {
				is_species = "ROBOT_POP_SPECIES_1"
				is_species = "ROBOT_POP_SPECIES_2"
				is_species = "ROBOT_POP_SPECIES_3"
			}
		}
	}
	
	mandate = {
		key = "mandate_emancipation2"
		parameter_transfer = {}
		weight = {
			base = 20

			modifier = {
				factor = 0.3
				parameter:empire = {
					any_owned_leader = {
						leader_of_faction = yes
						has_mandate = "mandate_emancipation2"
					}
				}
			}
		}
	}

	mandate = {
		key = "mandate_miner"
		parameter_transfer = {}
		weight = {
			base = 20

			modifier = {
				factor = 0.3
				parameter:empire = {
					any_owned_leader = {
						leader_of_faction = yes
						has_mandate = "mandate_miner"
					}
				}
			}
		}
	}

	mandate = {
		key = "mandate_orbital_researcher"
		parameter_transfer = {}
		weight = {
			base = 20

			modifier = {
				factor = 0.3
				parameter:empire = {
					any_owned_leader = {
						leader_of_faction = yes
						has_mandate = "mandate_orbital_researcher"
					}
				}
			}
		}
	}

	mandate = {
		key = "mandate_slaver"
		parameter_transfer = {}
		weight = {
			base = 20

			modifier = {
				factor = 0.3
				parameter:empire = {
					any_owned_leader = {
						leader_of_faction = yes
						has_mandate = "mandate_slaver"
					}
				}
			}

			modifier = {
				factor = 0
				parameter:empire = {
					OR = {
						has_ethic = ethic_individualist
						has_ethic = ethic_fanatic_individualist
					}
				}
			}
		}
	}
	
	mandate = {
		key = "mandate_shipwright"
		parameter_transfer = {}
		weight = {
			base = 20

			modifier = {
				factor = 0.3
				parameter:empire = {
					any_owned_leader = {
						leader_of_faction = yes
						has_mandate = "mandate_shipwright"
					}
				}
			}

			modifier = {
				factor = 1.5
				parameter:empire = {
					used_naval_capacity_percent < 0.3
				}
			}

			modifier = {
				factor = 0
				parameter:empire = {
					OR = {
						has_ethic = ethic_pacifist
						has_ethic = ethic_fanatic_pacifist
						used_naval_capacity_percent > 0.5
						#max_naval_capacity > 500
					}
				}
			}
		}
	}

	on_set_leader = { # Effect that executes when a faction wants a leader
		owner = {
			random_owned_leader = {
				limit = { leader_of_faction = no }
				root = {
					assign_leader = prev
				}
			}
		}
	}
}