###################
# Fancy Jobs
###################

politician = {
	category = ruler

	swappable_data = {
		default = {
			condition_string = RULER_JOB_TRIGGER
			building_icon = building_capital
			icon = politician
		}
		swap_type = {
			trigger = {
				politician_is_executive = yes
			}
			name = executive
			icon = executive
			desc = job_executive_desc
			weight = 5
		}
		swap_type = {
			trigger = {
				politician_is_science_director = yes
			}
			name = head_researcher
			icon = researcher
			desc = job_head_researcher_desc
			weight = 5
		}
		swap_type = {
			trigger = {
				politician_is_noble = yes
			}
			name = noble
			icon = noble
			desc = job_noble_desc
			weight = 10
		}
		swap_type = {
			trigger = {
				politician_is_merchant = yes
			}
			name = merchant
			icon = merchant
			desc = job_merchant_desc
			weight = 10
		}
		swap_type = {
			trigger = {
				politician_is_high_priest = yes
			}
			name = high_priest
			icon = high_priest
			desc = job_high_priest_desc
			weight = 10
		}
		swap_type = {
			trigger = {
				politician_is_technophant = yes
			}
			name = technophant
			icon = technophant
			desc = job_technophant_desc
			weight = 30
		}
		swap_type = {
			trigger = {
				politician_is_fire_oracle = yes
			}
			name = fire_oracle
			icon = fire_oracle
			desc = job_fire_oracle_desc
			weight = 25
		}
		swap_type = {
			trigger = {
				politician_is_blazewright = yes
			}
			name = blazewright
			icon = blazewright
			desc = job_blazewright_desc
			weight = 26
		}
		swap_type = {
			trigger = {
				politician_is_radiant_priest = yes
			}
			name = radiant_priest
			icon = radiant_priest
			desc = job_radiant_priest_desc
			weight = 26
		}
		swap_type = {
			trigger = {
				politician_is_pyrocrat = yes
			}
			name = pyrocrat
			icon = pyrocrat
			desc = job_pyrocrat_desc
			weight = 26
		}
		swap_type = {
			trigger = {
				politician_is_ashbroker = yes
			}
			name = ashbroker
			icon = ashbroker
			desc = job_ashbroker_desc
			weight = 26
		}
		swap_type = {
			trigger = {
				politician_is_blazing_harbinger = yes
			}
			name = blazing_harbinger
			icon = pyrocrat
			desc = job_blazing_harbinger_desc
			weight = 27
		}
		swap_type = {
			trigger = {
				politician_is_planetary_warden = yes
			}
			name = warden
			icon = enforcer
			desc = job_warden_desc
			weight = 15
		}
		swap_type = {
			trigger = {
				politician_is_noble = yes
				politician_is_science_director = yes
			}
			name = noble_researcher
			icon = noble
			desc = job_noble_researcher_desc
			weight = 20
		}
		swap_type = {
			trigger = {
				politician_is_noble = yes
				politician_is_high_priest = yes
			}
			name = sacred_noble
			icon = noble
			desc = job_sacred_noble_desc
			weight = 20
		}
		swap_type = {
			trigger = {
				politician_is_augmentation_merchant = yes
			}
			name = augmentation_merchant
			icon = augmentor
			desc = job_augmentation_merchant_desc
			weight = 20
		}
		swap_type = {
			trigger = {
				politician_is_superstitious_beliefs_high_priest = yes
			}
			name = superstitious_beliefs_high_priest
			desc = superstitious_beliefs_high_priest
			icon = superstitious_beliefs_priest
			weight = 20
		}
		swap_type = {
			trigger = {
				politician_is_superstitious_beliefs_high_priest_corporate = yes
			}
			name = superstitious_beliefs_high_priest_corporate
			desc = superstitious_beliefs_high_priest_corporate
			icon = superstitious_beliefs_priest
			weight = 20
		}
		swap_type = {
			trigger = {
				politician_is_visionary = yes
			}
			name = visionary
			desc = visionary
			icon = executive
			weight = 20
		}
		swap_type = {
			trigger = {
				politician_is_noble = yes
				politician_is_merchant = yes
			}
			name = noble_merchant
			icon = noble
			desc = job_noble_merchant_desc
			weight = 20
		}
		swap_type = {
			trigger = {
				politician_is_sacred_path_elite = yes
			}
			name = sacred_path_elite
			desc = job_sacred_path_elite_desc
			icon = sacred_path_elite
			weight = 50
		}
	}

	tags = { unity amenities }
	triggered_tags = {
		trigger = {
			OR = {
				politician_is_high_priest = yes
				politician_is_technophant = yes
				politician_is_superstitious_beliefs_high_priest = yes
				politician_is_superstitious_beliefs_high_priest_corporate = yes
				politician_is_fire_oracle = yes
				politician_is_blazewright = yes
				politician_is_radiant_priest = yes
				politician_is_pyrocrat = yes
				politician_is_ashbroker = yes
				politician_is_blazing_harbinger = yes
				politician_is_sacred_path_elite = yes
			}
		}
		tags = { psionic_aura }
	}

	possible_pre_triggers = {
		has_owner = yes
		is_enslaved = no
		is_being_purged = no
		is_being_assimilated = no
		is_sapient = yes
	}

	possible_precalc = can_fill_ruler_job

	resources = {
		category = planet_politicians
		produces = {
			unity = 5
		}
		upkeep = {
			consumer_goods = 3
		}
		##Executive
		produces = {
			trigger = {
				politician_is_executive = yes
			}
			trade = 4
		}
		##Merchant
		produces = {
			trigger = {
				colony? = {
					OR = {
						politician_is_merchant = yes
						politician_is_augmentation_merchant = yes
						politician_is_ashbroker = yes
					}
				}
			}
			unity = -1.5
			trade = 6
		}
		##Science Director
		produces = {
			trigger = {
				colony? = {
					politician_is_science_director = yes
				}
			}
			unity = -1
			physics_research = 1
			society_research = 1
			engineering_research = 1
		}
		##High Priest
		produces = {
			trigger = {
				colony? = {
					OR = {
						politician_is_high_priest = yes
						politician_is_fire_oracle = yes
					}
				}
			}
			unity = 1
		}
		# High Pilgrim
		produces = {
			trigger = {
				colony? = {
					politician_is_sacred_path_elite = yes
				}
			}
			unity = 2
		}
		##Technophant
		produces = {
			trigger = {
				colony? = {
					politician_is_technophant = yes
				}
			}
			engineering_research = 2
		}
		## Fire Cult swaps
		produces = {
			trigger = {
				colony? = {
					politician_is_blazewright = yes
					politician_is_radiant_priest = yes
				}
			}
			unity = 1.5
		}
		produces = {
			trigger = {
				colony? = {
					politician_is_blazing_harbinger = yes
				}
			}
		unity = 2
		}
		##High Astrologist
		produces = {
			trigger = {
				colony? = {
					politician_is_superstitious_beliefs_high_priest = yes
				}
			}
			unity = 1
		}
		##Fortune Broker
		produces = {
			trigger = {
				colony? = {
					politician_is_superstitious_beliefs_high_priest_corporate = yes
				}
			}
			trade = 6
		}
	}

	triggered_planet_modifier = {
		potential = {
			always = yes
		}
		planet_amenities_add = 300
		mult = value:scripted_modifier_mult|MODIFIER|pop_job_amenities_mult|
	}

	triggered_planet_modifier = {
		potential = {
			OR = {
				politician_is_fire_oracle = yes
				politician_is_blazewright = yes
				politician_is_blazing_harbinger = yes
				politician_is_radiant_priest = yes
				politician_is_pyrocrat = yes
				politician_is_ashbroker = yes
			}
		}
		planet_amenities_add = 400
		mult = value:scripted_modifier_mult|MODIFIER|pop_job_amenities_mult|
	}
	triggered_planet_modifier = {
		potential = {
			politician_is_blazing_harbinger = yes
		}
		planet_stability_add = @inf_dancer_stability
	}

	## Noble
	triggered_planet_modifier = {
		potential = {
			politician_is_noble = yes
		}
		planet_stability_add = 0.5
	}

	## Superstitious Beliefs
	triggered_planet_modifier = {
		potential = {
			OR = {
				politician_is_superstitious_beliefs_high_priest = yes
				politician_is_superstitious_beliefs_high_priest_corporate = yes
			}
		}
		planet_stability_add = 0.5
	}

	## Technophant
	triggered_planet_modifier = {
		potential = {
			owner? = { has_origin = origin_cybernetic_creed }
		}
		planet_amenities_add = 200
		mult = value:scripted_modifier_mult|MODIFIER|pop_job_amenities_mult|
	}

	## Planetary Warden
	triggered_planet_modifier = {
		potential = {
			has_designation = col_penal
		}
		planet_stability_add = 1
	}

	## Sacred Path - First Light Guidance
	triggered_planet_modifier = {
		potential = {
			politician_is_sacred_path_elite = yes
			owner? = { has_modifier = first_light_guidance }
		}
		planet_stability_add = 0.25
	}

	weight = {
		weight = @ruler_job_weight
		mult = value:scripted_modifier_job_weight_mult|MODIFIER|pop_job_amenities_mult|
		modifier = {
			factor = 0.1
			has_citizenship_rights = no
			NOT = { has_trait = trait_mechanical }
		}
		# crisis purge
		modifier = {
			factor = 0.01
			colony.controller? = {
				OR = {
					is_country_type = swarm
					is_country_type = ai_empire
				}
			}
		}
	}

	inline_script = "jobs/automodding_priority_charisma"

}

knight_commander = {
	category = ruler

	swappable_data = {
		default = {
			condition_string = RULER_JOB_TRIGGER
			building_icon = building_order_keep
		}
	}

	tags = { unity research amenities soldier }

	possible_pre_triggers = {
		has_owner = yes
		is_enslaved = no
		is_being_purged = no
		is_being_assimilated = no
		is_sapient = yes
	}

	possible_precalc = can_fill_ruler_job
	possible = {
		hidden_trigger = { exists = owner }
		owner = {
			is_gestalt = no
		}
	}

	resources = {
		category = planet_knights
		produces = {
			trigger = { exists = owner }
			unity = 2
			mult = value:knight_commander_unity_output_modifier
		}
		produces = {
			trigger = { exists = owner }
			physics_research = 1
			engineering_research = 1
			society_research = 1
			mult = value:knight_commander_research_output_modifier
		}
		produces = {
			trigger = {
				owner? = { has_country_flag = cosmogenesis_knights }
			}
			advanced_logic = 1
			mult = value:knight_commander_research_output_modifier
		}
		upkeep = {
			alloys = 200
		}
	}

	triggered_planet_modifier = {
		potential = {
			always = yes
		}
		planet_amenities_add = 50000
		mult = value:scripted_modifier_mult|MODIFIER|pop_job_amenities_mult|
	}

	country_modifier = {
		country_naval_cap_add = 600
	}

	weight = {
		weight = @high_prio_specialist_job_weight
	}

	inline_script = "jobs/automodding_priority_charisma"

}

dystopian_enforcer = {
	category = ruler

	swappable_data = {
		default = {
			condition_string = BATTLE_THRALL_JOB_TRIGGER
			building_icon = building_precinct_house
			icon = enforcer
		}
		swap_type = {
			trigger = {
				enforcer_is_educator_trigger = yes
			}
			name = educator
			desc = educator
			icon = educator
			building_icon = building_state_academy
			condition_string = BATTLE_THRALL_JOB_TRIGGER
			weight = 10
		}
	}

	tags = { crime enforcer }

	possible_pre_triggers = {
		has_owner = yes
		is_being_purged = no
		is_being_assimilated = no
		is_sapient = yes
	}

	possible = {
		battle_thrall_job_check_trigger = yes
	}

	inline_script = "jobs/job_enforcer"

	weight = {
		weight = @specialist_job_weight

		modifier = {
			owner = { has_active_tradition = tr_domination_judgment_corps }
		}
		modifier = {
			factor = 50
		}
		modifier = {
			factor = 0.2
			has_citizenship_rights = no
			NOT = { has_trait = trait_mechanical }
		}
		modifier = {
			factor = 2
			has_trait = trait_resilient
		}
		modifier = {
			factor = 2
			has_trait = trait_very_strong
		}
		modifier = {
			factor = 1.5
			has_trait = trait_strong
		}
		modifier = {
			factor = 10
			is_enslaved = yes
			has_slavery_type = { type = slavery_military }
		}
		modifier = {
			factor = 0.50
			has_trait = trait_weak
		}
		modifier = {
			factor = 0.1
			can_take_servant_job = yes
		}
		modifier = {
			factor = 1.1
			has_trait = trait_cybernetic
		}
		modifier = {
			factor = 2
			has_trait = trait_presapient_earthbound
		}
		modifier = {
			factor = 1.1
			has_trait = trait_limited_regeneration
		}
		modifier = {
			factor = 0.8
			is_enslaved = yes
			has_slavery_type = { type = slavery_indentured }
		}
		modifier = {
			factor = 2
			has_trait = trait_lithoid
		}
	}

}

dystopian_telepath = {
	category = ruler
	can_be_automated = no

	swappable_data = {
		default = {
			condition_string = RULER_JOB_TRIGGER
			building_icon = building_psi_corps
			icon = telepath
		}
		swap_type = {
			trigger = {
				enforcer_is_educator_trigger = yes
			}
			name = educator_telepath
			desc = educator_telepath
			icon = telepath
			building_icon = building_psi_corps
			condition_string = RULER_JOB_TRIGGER
			weight = 10
		}
	}

	inline_script = "jobs/job_telepath"

	possible_precalc = can_fill_ruler_job

	weight = {
		weight = @specialist_job_weight
		mult = 2
		modifier = {
			factor = 0.2
			has_citizenship_rights = no
		}
		modifier = {
			factor = 0.1
			is_enslaved = yes
			has_slavery_type = { type = slavery_indentured }
		}
	}

}

# Fake jobs for leader backgrounds
head_researcher = {
	category = ruler

	swappable_data = {
		default = {
			condition_string = RULER_JOB_TRIGGER
			building_icon = building_institute
			icon = researcher
		}
	}
	possible = {
		always = no
	}
}

high_priest = {
	category = ruler

	swappable_data = {
		default = {
			condition_string = RULER_JOB_TRIGGER
			building_icon = building_citadel_of_faith
		}
	}

	possible = {
		always = no
	}
}

noble = {
	category = ruler

	swappable_data = {
		default = {
			condition_string = RULER_JOB_TRIGGER
			building_icon = building_palace
		}
	}

	possible = {
		always = no
	}
}

merchant = {
	category = ruler

	swappable_data = {
		default = {
			condition_string = RULER_JOB_TRIGGER
			building_icon = building_galactic_stock_exchange
		}
	}

	possible = {
		always = no
	}
}

executive = {
	category = ruler

	swappable_data = {
		default = {
			condition_string = RULER_JOB_TRIGGER
			building_icon = building_capital
		}
	}

	possible = {
		always = no
	}
}

warden = {
	category = ruler
	swappable_data = {
		default = {
			condition_string = RULER_JOB_TRIGGER
			building_icon = building_capital
			icon = enforcer
		}
	}

	possible = {
		always = no
	}
}
