﻿ptt_become_seljuk_decision = {
	
	picture = {
		reference = "gfx/interface/illustrations/decisions/fp3/fp3_decision_concession.dds"
	}
	decision_group_type = major
	ai_check_interval = 0
	sort_order = 30

	title = ptt_become_seljuk_decision_name

	desc = ptt_become_seljuk_decision_desc

	selection_tooltip = ptt_become_seljuk_decision_tooltip

	is_shown = {
		has_fp3_dlc_trigger = yes
		NOT = {
			has_mpo_dlc_trigger = yes
		}
		culture = { has_cultural_pillar = heritage_turkic }
		
		NOT = {
			exists = global_var:ptt_seljuk_invasion_happened
		}
	}

	is_valid = {
		
		is_independent_ruler = yes
		trigger_if = {
			limit = { exists = struggle:persian_struggle }
			custom_tooltip = {
				text = ptt_become_seljuk_involvement_req
				struggle:persian_struggle = {
					is_faith_involved_in_struggle = prev.faith
				}
			}
		}
		trigger_else = {
			custom_description = {
				text = faith_is_reformed
				subject = root
				faith = { NOT = { has_doctrine_parameter = unreformed } }
			}
		}
		
		OR = {
			government_has_flag = government_is_clan
			has_realm_law = tribal_authority_3
			
		}
		highest_held_title_tier = tier_duchy
		prestige_level >= 3
		calc_true_if = {
			amount >= 2
			OR = {
				has_trait = brave
				has_trait = zealous
				has_trait = diligent
				has_trait = ambitious
			}
			OR = {
				has_trait = education_martial_3
				has_trait = education_martial_4
			}
			NOR = {
				has_trait = craven
				has_trait = shy
				has_trait = paranoid
			}
		}
	}	

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}
	
	cost = {
		prestige = 200
	}

	effect = {
		
		#Get organized
		if = {
			limit = { government_has_flag = government_is_tribal }
			#Feudalize
			convert_whole_realm_to_feudalism_effect = yes
			hidden_effect = {
				every_vassal = {
					trigger_event = {
						id = major_decisions.0002
						days = 3
					}
				}
			}
		}
		
		ptt_ext_intermezzo_become_seljuks_effect = yes
		
		trigger_event = ptt_become_seljuk.1

		#Can only be done once
		set_global_variable = {
			name = ptt_seljuk_invasion_happened
			value = yes
		}
	}
}


ptt_become_seljuk_decision_nomad = {
	
	picture = {
		reference = "gfx/interface/illustrations/decisions/fp3/fp3_decision_concession.dds"
	}
	decision_group_type = nomad_major
	ai_check_interval = 0
	sort_order = 30

	title = ptt_become_seljuk_decision_name

	desc = ptt_become_seljuk_decision_desc

	selection_tooltip = ptt_become_seljuk_decision_tooltip
	
	confirm_text = ptt_become_seljuk_decision_confirm

	is_shown = {
		has_fp3_dlc_trigger = yes
		has_mpo_dlc_trigger = yes
		culture = { has_cultural_pillar = heritage_turkic }
		
		NOT = {
			exists = global_var:ptt_seljuk_invasion_happened
		}
	}

	is_valid = {
		
		is_independent_ruler = yes
		trigger_if = {
			limit = { exists = struggle:persian_struggle }
			custom_tooltip = {
				text = ptt_become_seljuk_involvement_req
				struggle:persian_struggle = {
					is_faith_involved_in_struggle = prev.faith
				}
			}
		}
		trigger_else = {
			custom_description = {
				text = faith_is_reformed
				subject = root
				faith = { NOT = { has_doctrine_parameter = unreformed } }
			}
		}
		
		government_has_flag = government_is_nomadic
		OR = {
			has_realm_law = nomadic_authority_3
			has_realm_law = nomadic_authority_4
			has_realm_law = nomadic_authority_5
		}
		prestige_level >= 3
		OR = {
		calc_true_if = {
			amount >= 2
			OR = {
				has_trait = brave
				has_trait = zealous
				has_trait = diligent
				has_trait = ambitious
			}
			OR = {
				has_trait = education_martial_3
				has_trait = education_martial_4
			}
			NOR = {
				has_trait = craven
				has_trait = shy
				has_trait = paranoid
			}
		}
		custom_tooltip = {
			text = mpo_desperate_stance_decision_tt
			any_character_situation = {
				any_situation_sub_region = {
					has_sub_region_phase_parameter = the_great_steppe_desperate_stance_decision
					any_situation_sub_region_participant_group = {
						participant_group_type = nomad_rulers_capital
						participant_group_has_character = root
					}
				}
			}
		}
		}
	}	

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}
	
	cost = {
		prestige = 200
	}

	effect = {
		
		ptt_ext_intermezzo_become_seljuks_effect = yes
		
		trigger_event = ptt_become_seljuk.1

		#Can only be done once
		set_global_variable = {
			name = ptt_seljuk_invasion_happened
			value = yes
		}
	}
}