##########################################################################
# Planet edicts
##########################################################################

# Variables:
#  name, the name of the edict, also serves as localisation key.
#  influence_cost, the base influence cost of activating the edict.
#  potential, planet or country trigger to decide whether the edict should be shown.
#  allow, planet or country trigger to decide if whether this edict can be activated.
#  effect, an effect that is executed when this trigger activates.
#  prerequisites, tech requirements for this trigger.
#  ai_will_do, determines AI scoring for edict
#  modifier, a list of modifiers
#  length, number of days the trigger is active.

# Sets the edict-cost for all edicts with this variable


planet_edict = {
	name = "family_planning_major"
	cost = { influence = 0 }
	length = 0
	
	show_tech_unlock_if = { has_authority = auth_xilin_mind }
	
#	modifier = {
#		pop_happiness = -0.10
#	}
	
	prerequisites = { 
		"tech_planetary_unification"
	}
	
	potential = {	
		owner = {
			has_authority = auth_xilin_mind
		}
	}
	
	allow = {
	}
	
	ai_weight = {
		weight = 0	
	}	
	
	effect = {
    if = {
	  		limit = { NOT = { has_modifier = m_family_planning_major } }
	  		add_modifier = { modifier =  "m_family_planning_major"  days = -1 }
	  		else = {
	  				remove_modifier = m_family_planning_major
	  		}
	  }
	}
}

planet_edict = {
	name = "family_planning_minor"
	cost = { influence = 0 }
	length = 0
	
	show_tech_unlock_if = { has_authority = auth_xilin_mind }
	
#	modifier = {
#		pop_happiness = -0.10
#	}
	
	prerequisites = { 
		"tech_planetary_unification"
	}
	
	potential = {	
		owner = {
			has_authority = auth_xilin_mind
		}
	}
	
	allow = {
	}
	
	ai_weight = {
		weight = 0	
	}	
	
	effect = {
    if = {
	  		limit = { NOT = { has_modifier = m_family_planning_minor} }
	  		add_modifier = { modifier =  "m_family_planning_minor"  days = -1 }
	  		else = {
	  				remove_modifier = m_family_planning_minor
	  		}
	  }
	}
}

planet_edict = {
	name = "cultivation_of_mother_life_tree"
	cost = { unity = 10000 }
	length = 0
		
	potential = {	
		has_building = building_life_tree	
		owner = {
			has_modifier = m_cultivation_of_mother_life_tree
			NOT = { has_modifier = m_collect_active_of_emotion }
		}
	}
	
	allow = {
	}
	
	ai_weight = {
		weight = 1	
		#AIͳŻ
		modifier = {
			factor = 0
			owner = {
					num_ascension_perks > 7
			}		
		}
	}	
	
	effect = {
	  owner = {
	  		 #add_unity = -10000
	  		 add_modifier = { modifier =  "m_collect_active_of_emotion"  days = 3600 }
	  }  
    enable_special_project = {
				name = "PRO_CULTIVATION_OF_MOTHER_LIFE_TREE"
				location = this
				owner = root.owner
		}
	}
}

#˿ڿ
planet_edict = {
	name = "tree_spirit_population_control"
	cost = { influence = 0 }
	length = 0
	
	#show_tech_unlock_if = { has_authority = auth_xilin_mind }
	
#	modifier = {
#		pop_happiness = -0.10
#	}
	
	#prerequisites = { 
	#	"tech_planetary_unification"
	#}
	
	potential = {	
		#֮ԣ˿ڳɳ˿ڴﵽ1/3
		owner = {
			OR = { 
				has_modifier = m_kala_gift
				has_valid_civic = civic_harmonious_tree
			}  
		}
		OR = {
				has_building = building_life_tree	
				has_building = building_mother_life_tree  
				has_building = building_hive_synapse
		}
		grown_harmonize_hive_is_enough = yes
		#û˿ڿ
	  NOT = { has_modifier = m_tree_spirit_population_control }
	}
	
	allow = {	  
	}
	
	ai_weight = {
		weight = 2
	}	
	
	effect = {
    if = {
	  		limit = { NOT = { has_modifier = m_tree_spirit_population_control } }
	  		add_modifier = { modifier =  "m_tree_spirit_population_control"  days = -1 }
	  }
	}
}

#ȡ˿ڿ
planet_edict = {
	name = "cancle_tree_spirit_population_control"
	cost = { influence = 0 }
	length = 0
	
	#show_tech_unlock_if = { has_authority = auth_xilin_mind }
	
#	modifier = {
#		pop_happiness = -0.10
#	}
	
	#prerequisites = { 
	#	"tech_planetary_unification"
	#}
	
	potential = {	
		#֮
		owner = { 
			OR = { 
				has_modifier = m_kala_gift
				has_valid_civic = civic_harmonious_tree
			} 
		}
		OR = {
				has_building = building_life_tree	
				has_building = building_mother_life_tree  
				has_building = building_hive_synapse
		}
		#˿ڿ
	  has_modifier = m_tree_spirit_population_control
	}
	
	allow = {	  
	}
	
	ai_weight = {
		weight = 0
		modifier = {
			factor = 10
			owner = {
					grown_harmonize_hive_is_enough = no
			}		
		}
	}	
	
	effect = {
    if = {
	  		limit = {  has_modifier = m_tree_spirit_population_control }
	  		remove_modifier = m_tree_spirit_population_control
	  }
	}
}