plentiful_traditions_ionized_excavation = {
	owned_planets_only = yes
	sound = event_administrative_work
	icon = decision_resources
	resources = {
		category = decisions
		cost = {
			influence = 100
		}
	}
	
	potential = {	
		can_have_habitable_deposits = yes
		owner = {
			has_tradition = tr_plentiful_industry_finish
		}
		NOT =  {
			has_modifier = modifier_plentiful_traditions_ionized_excavation
		}
	}
	
	effect = {
		planet_event = {
			id = plentiful_traditions_ionized_excavation_pedict.1
		}
		carrier_event = {
			id = plentiful_traditions_ionized_excavation_pedict.101
		}
	}	

	allow = {
		NOT =  {
			has_modifier = modifier_plentiful_traditions_ionized_excavation
		}
	}
	
	ai_weight = {
		weight = 1
		modifier = {
			factor = 0
			pop_amount < 5000
		}
	}	
}

plentiful_traditions_remnant_act = {
	owned_planets_only = yes
	sound = event_administrative_work
	icon = decision_resources
	resources = {
		category = decisions
		cost = {
			influence = 200
		}
	}
	
	potential = {
		can_have_habitable_deposits = yes
		owner = {
			# has_tradition = tr_plentiful_mysticism_finish_machine
			has_active_tradition = tr_plentiful_mysticism_finish_machine
		}
		NOT =  {
			has_modifier = modifier_plentiful_traditions_remnant_act
		}
		OR = {
			has_building = building_plentiful_traditions_sanctum_of_keys
			has_building = building_plentiful_traditions_sanctum_of_the_collective
			has_building = building_plentiful_traditions_obelisk1
			has_building = building_plentiful_traditions_obelisk2
			has_building = building_plentiful_traditions_obelisk3
			has_building = building_plentiful_traditions_pillar_of_affliction
			has_building = building_plentiful_traditions_house_of_prayer
			has_building = building_plentiful_traditions_citadel_of_motion
			has_building = building_temple
			has_building = building_holotemple
			has_building = building_citadel_of_faith
			has_building = building_sacred_nexus
			has_building = building_uplink_node
			has_building = building_network_junction
			has_building = building_system_conflux
			has_building = building_alpha_hub
		}
	}

	effect = {
		planet_event = {
			id = plentiful_traditions_remnant_act_pedict.1
		}
		carrier_event = {
			id = plentiful_traditions_remnant_act_pedict.101
		}
	}

	allow = {
		NOT =  {
			has_modifier = modifier_plentiful_traditions_remnant_act
		}
	}
		
	ai_weight = {
		weight = 1
		modifier = {
			factor = 0
			pop_amount < 5000
		}
	}	
}

plentiful_traditions_sacred_act = {
	owned_planets_only = yes
	sound = event_administrative_work
	icon = decision_resources
	resources = {
		category = decisions
		cost = {
			influence = 200
		}
	}

	potential = {
		owner = {
			# has_tradition = tr_plentiful_mysticism_finish
			has_active_tradition = tr_plentiful_mysticism_finish
		}
		NOT =  {
			has_modifier = modifier_plentiful_traditions_sacred_act
		}
		OR = {
			has_building = building_plentiful_traditions_sanctum_of_keys
			has_building = building_plentiful_traditions_sanctum_of_the_collective
			has_building = building_plentiful_traditions_obelisk1
			has_building = building_plentiful_traditions_obelisk2
			has_building = building_plentiful_traditions_obelisk3
			has_building = building_plentiful_traditions_pillar_of_affliction
			has_building = building_plentiful_traditions_house_of_prayer
			has_building = building_plentiful_traditions_citadel_of_motion
			has_building = building_temple
			has_building = building_holotemple
			has_building = building_citadel_of_faith
			has_building = building_sacred_nexus
			has_building = building_uplink_node
			has_building = building_network_junction
			has_building = building_system_conflux
			has_building = building_alpha_hub
		}
	}
	
	effect = {
		planet_event = {
			id = plentiful_traditions_sacred_act_pedict.1
		}
		carrier_event = {
			id = plentiful_traditions_sacred_act_pedict.101
		}
	}

	allow = {
		NOT =  {
			has_modifier = modifier_plentiful_traditions_sacred_act
		}
	}
	
	ai_weight = {
		weight = 1
		modifier = {
			factor = 0
			pop_amount < 5000
		}
	}	
}

plentiful_traditions_plentiful_deeds = {
	owned_planets_only = yes
	sound = event_administrative_work
	icon = decision_resources
	resources = {
		category = decisions
		cost = {
			influence = 75
		}
	}
	
	potential = {
		OR = {
			has_building = "building_plentiful_traditions_trading_terminal"
			has_building = "building_plentiful_traditions_advanced_trading_terminal"
		}
		owner = {
			OR = {
				has_active_tradition = tr_plentiful_aspiration_gestalt_finish
				has_active_tradition = tr_plentiful_aspiration_finish
			}
		}
	}

	effect = {
		planet_event = {
			id = plentiful_traditions_plentiful_deeds_pedict.1
		}
		carrier_event = {
			id = plentiful_traditions_plentiful_deeds_pedict.101
		}
#		every_country = {
#			limit = {
#					is_primitive = no
#					has_communications = root.owner
#					NOR = {
#						is_same_value = root.owner
#						is_same_species = root.owner
#					}
#				}
#				distance = {
#					source = ROOT
#					max_distance <= 350
#				}
#			}
#			hidden_effect = {
#				every_owned_planet = {
#					add_opinion_modifier = {
#						who = root.owner
#						modifier = opinion_plentiful_deeds
#					}
#				}
#			}
#		}
	}

	allow = { } #kann ja ruhig mehrfach genutzt werden...

	ai_weight = {
		weight = 1
		modifier = {
			factor = 0
			NOT = {
				owner = {
					any_country = {
						is_primitive = no
						NOT = {
							is_same_value = prev
							is_same_species = root.owner
							opinion = {
								who = root.owner
								value = 0
							}
						}
						any_owned_planet = {
							distance = {
								source = root
								max_distance <= 350
							}
						}
					}
				}
			}
		}
	}
}



# Industrial Mining Excavation
decision_excavation = {
	owned_planets_only = yes
	icon = decision_mining_station

	enactment_time = 1000
	resources = {
		category = decisions
		cost = {
			influence = 150
			minerals = 5000
		}
	}
	
	potential = {
		habitable_structure = no
		can_have_habitable_deposits = yes
		owner = {
			has_ascension_perk = ap_plentiful_traditions_industrial_mining_excavation
		}
	}
	
	effect = {
		if = {
			limit = {
				NOT = {
					has_deposit = d_plentiful_traditions_planet_minerals5
				}
				has_deposit = d_plentiful_traditions_planet_minerals4
			}
			add_deposit = d_plentiful_traditions_planet_minerals5
			remove_deposit = d_plentiful_traditions_planet_minerals4
			break = yes
		}
		if = {
			limit = {
				NOT = {
					has_deposit = d_plentiful_traditions_planet_minerals4
				}
				has_deposit = d_plentiful_traditions_planet_minerals3
			}
			add_deposit = d_plentiful_traditions_planet_minerals4
			remove_deposit = d_plentiful_traditions_planet_minerals3
			break = yes
		}
		if = {
			limit = {
				NOT = {
					has_deposit = d_plentiful_traditions_planet_minerals3
				}
				has_deposit = d_plentiful_traditions_planet_minerals2
			}
			add_deposit = d_plentiful_traditions_planet_minerals3
			remove_deposit = d_plentiful_traditions_planet_minerals2
			break = yes
		}
		if = {
			limit = {
				NOT = {
					has_deposit = d_plentiful_traditions_planet_minerals2
				}
				has_deposit = d_plentiful_traditions_planet_minerals1
			}
			add_deposit = d_plentiful_traditions_planet_minerals2
			remove_deposit = d_plentiful_traditions_planet_minerals1
			break = yes
		}
		if = {
			limit = {
				NOT = {
					has_deposit = d_plentiful_traditions_planet_minerals1
				}
			}
			add_deposit = d_plentiful_traditions_planet_minerals1
			break = yes
		}
	}
	
	ai_weight = {
		weight = 1
		modifier = {
			factor = 0
			free_district_slots > 0
		}
	}
}

# Transformation Mastery
decision_transformation_mastery = {
	owned_planets_only = yes
	icon = decision_drilling_for_gas

	enactment_time = 360
	resources = {
		category = decisions
		cost = {
			influence = 333
			energy = 5000
			exotic_gases = 500
		}
	}
	
	potential = {
		habitable_structure = no
		owner = {
			has_ascension_perk = ap_plentiful_traditions_transformation
		}
		NOT = { has_modifier = modifier_transformation_mastery }
	}
	
	effect = {
		add_modifier = {
			modifier = modifier_transformation_mastery
			days = -1
		}
	}
	
	ai_weight = {
		weight = 1
		modifier = {
			factor = 0
			free_district_slots > 0
		}
	}
}

# Bunker System
decision_bunker_system = {
	owned_planets_only = yes
	icon = decision_unity_symbol

	enactment_time = 360
	resources = {
		category = decisions
		cost = {
			influence = 25
			minerals = 2000
			energy = 1000
			volatile_motes = 25
		}
	}
	
	potential = {
		habitable_structure = no
		can_have_habitable_deposits = yes
		NOT = {
			has_deposit = d_plentiful_traditions_planet_bunker
			is_planet_class = pc_machine
			is_planet_class = pc_hive
			is_planet_class = pc_city
		}
		owner = {
			has_ascension_perk = ap_plentiful_traditions_bunker_mentality
		}
	}
	
	effect = {
		add_deposit = d_plentiful_traditions_planet_bunker
	}

	allow = {
		NOT =  {
			has_deposit = d_plentiful_traditions_planet_bunker_broken
		}
		OR = {
			is_ideal_planet_class = { who = root.owner status = yes }
			AND = {
				is_planet_class = pc_city
				NOT = { 
					owner = { is_hive_empire = yes }
					owner = { is_machine_empire = yes }
				}
			}
			AND = {
				is_planet_class = pc_hive
				owner = { is_hive_empire = yes }
			}
			AND = {
				is_planet_class = pc_machine
				owner = { is_machine_empire = yes }
			}
		}
	}

	ai_weight = {
		weight = 1
		modifier = {
			factor = 0
			free_district_slots > 0
		}
	}
}

# Bunker System
decision_bunker_system_addition = {
	owned_planets_only = yes
	icon = decision_unity_symbol

	enactment_time = 360
	resources = {
		category = decisions
		cost = {
			influence = 25
			minerals = 2000
			energy = 1000
			volatile_motes = 25
		}
	}
	
	potential = {
		OR = {
			is_planet_class = pc_machine
			is_planet_class = pc_hive
			is_planet_class = pc_city
		}
		NOT = {
			has_deposit = d_plentiful_traditions_planet_bunker
		}
		owner = {
			has_ascension_perk = ap_plentiful_traditions_bunker_mentality
		}
	}
	
	effect = {
		add_deposit = d_plentiful_traditions_planet_bunker
	}

	allow = {
		NOT =  {
			has_deposit = d_plentiful_traditions_planet_bunker_broken
		}
		OR = {
			AND = {
				is_planet_class = pc_city
				NOT = { 
					owner = { is_hive_empire = yes }
					owner = { is_machine_empire = yes }
				}
			}
			AND = {
				is_planet_class = pc_hive
				owner = { is_hive_empire = yes }
			}
			AND = {
				is_planet_class = pc_machine
				owner = { is_machine_empire = yes }
			}
		}
	}

	ai_weight = {
		weight = 1
		modifier = {
			factor = 0
			free_district_slots > 0
		}
	}
}