###########################################
#
# Society decisions for jewish society
#
###########################################

society_decisions = { #only available to members of a society
	request_to_rank_up_within_jewish_order = { #this is the new rank up decision if you want one, you do not need this if you use de default one
		only_playable = yes
		
		hide_in_decisions_list = yes # This is shown in the Society View
		
		ai_check_interval = 12
		
		potential = {
			hidden_tooltip = {
				society_rank <= 3
				days_in_society > 365
				is_in_society = yes
				OR = { #Players can always rank up (if they have the power), AI won't if there is no room
					ai = no
					AND = {
						ai = yes
						society_can_rank_up = yes
					}
				}
			}
		}

		allow = {
			#Rank requirements. IMPORTANT!!! If you change the requirements, the customizable loc keys "GetSocietyRankUpTooltip" 1, 2, 3, and 4 must be updated, as it displays these requirements.
			custom_tooltip = { # Sufficient currency
				text = request_to_rank_up_within_jewish_order_tt
				OR = {
					AND = {
						society_rank == 1
						society_currency >= 750
					}
					AND = {
						society_rank == 2
						society_currency >= 1000
					}
					AND = {
						society_rank == 3
						society_currency >= 2000
					}
				}
			}

			custom_tooltip = {
				text = must_not_have_sent_request_already_tooltip 
				NOT = { has_character_flag = has_sent_request_to_rank_up }
			}

			custom_tooltip = {
				text = must_be_allowed_to_rank_up_tooltip 
				days_at_current_society_rank >= 1095 #IMPORTANT! Update tooltip.
			}

			custom_tooltip = {
				text = must_have_grandmaster_tooltip #You must have a grand master
				any_society_member = {
					is_society_grandmaster = yes
					same_society_as = ROOT
				}
			}
		}

		effect = {
			#Rank up cost
			if = {
				limit = { society_rank == 1 }
				change_society_currency = -750
			}
			if = {
				limit = { society_rank == 2 }
				change_society_currency = -1000
			}
			if = {
				limit = { society_rank == 3 }
				change_society_currency = -2000
			}

			#Perform rank up
			hidden_tooltip = {
				save_event_target_as = rank_up_target #mark the character as the one ranking up
				set_character_flag = has_sent_request_to_rank_up
				character_event = { id = JEWSOCI.120 days = 20 random = 10 } # sends hidden delayed event to self, which then sends request to Leader of the society
				
			}
		}

		revoke_allowed = {
			always = no
		}
		
		ai_will_do = {
			factor = 1
		}
	}
}