﻿### Recruit [ROOT.Char.Custom('GetCourtierTypePlural')|U] from Yurt ###
recruit_from_nomadic_capital_decision = {
	ai_check_interval_by_tier = {
		barony = 0
		county = 0
		duchy = 12
		kingdom = 12
		empire = 12
		hegemony = 12
	}
	picture = {
		reference = "gfx/interface/illustrations/activity_splash_screens/tour_arrival_tribal_welcome.dds"
	}
	sort_order = 100
	decision_group_type = nomad_minor
	
	cooldown = { years = 2 }

	is_shown = {
		government_has_flag = government_is_nomadic
		exists = domicile
	}

	is_valid = {
	}

	is_valid_showing_failures_only = {
	}

	desc = recruit_from_nomadic_capital_decision_desc

	cost = {
		herd = {
			value = domicile.minor_herd_value
		}
	}

	widget = {
		gui = "decision_view_widget_option_list_generic"
		controller = decision_option_list_controller
		decision_to_second_step_button = "CHOOSE_NOMAD_COURTIER_DECISION_NEXT_STEP_BUTTON"

		item = {
			value = recruit_hunters_decision
			current_description = recruit_hunters_decision
			localization = recruit_hunters_decision
			icon = "gfx/interface/icons/regimenttypes/armenian_archers.dds"
			ai_chance = {
				value = 100
			}
		}

		item = {
			value = recruit_knights_decision
			current_description = recruit_knights_decision
			localization = recruit_knights_decision
			icon = "gfx/interface/icons/casus_bellis/migration_cb.dds"
			is_valid = {
				domicile ?= {
					has_domicile_building_or_higher = character_warfare_yurt_03
				}
			}
			ai_chance = {
				value = 100
			}
		}

		item = {
			value = recruit_commanders_decision
			current_description = recruit_commanders_decision
			localization = recruit_commanders_decision
			icon = "gfx/interface/icons/regimenttypes/kheshig.dds"
			is_valid = {
				domicile ?= {
					has_domicile_building_or_higher = character_warfare_yurt_03
				}
			}
			ai_chance = {
				value = 100
			}
		}

		item = {
			value = recruit_shepherds_decision
			current_description = recruit_shepherds_decision
			localization = recruit_shepherds_decision
			icon = "gfx/interface/icons/government_types/herder_government.dds"
			ai_chance = {
				value = 0
			}
		}

		item = {
			value = recruit_brides_decision
			current_description = recruit_brides_decision
			localization = recruit_brides_decision
			is_valid = {
				custom_tooltip = {
					text = faith_dominant_gender_male_or_equal_tt
					faith_dominant_gender_male_or_equal = yes
				}
			}
			icon = "gfx/interface/icons/marriage.dds"
			ai_chance = {
				value = 0
				if = {
					limit = {
						is_male = yes
						is_married = no
					}
					add = 100
				}
			}
		}

		item = {
			value = recruit_husbands_decision
			current_description = recruit_husbands_decision
			localization = recruit_husbands_decision
			is_valid = {
				custom_tooltip = {
					text = faith_dominant_gender_female_or_equal_tt
					faith_dominant_gender_female_or_equal = yes
				}
			}
			icon = "gfx/interface/icons/marriage.dds"
			ai_chance = {
				value = 0
				if = {
					limit = {
						is_female = yes
						is_married = no
					}
					add = 100
				}
			}
		}
	}

	effect = {
		custom_tooltip = recruit_from_nomadic_capital_decision_tooltip
		hidden_effect = {
			if = {
				limit = { scope:recruit_hunters_decision = yes }
				recruit_three_nomadic_capital_characters_effect = {
					NOMAD_TEMPLATE_CHARACTER = nomadic_hunter_template
				}
			}
			else_if = {
				limit = { scope:recruit_commanders_decision = yes }
				recruit_three_nomadic_capital_characters_effect = {
					NOMAD_TEMPLATE_CHARACTER = nomadic_commander_template
				}
			}
			else_if = {
				limit = { scope:recruit_shepherds_decision = yes }
				recruit_three_nomadic_capital_characters_effect = {
					NOMAD_TEMPLATE_CHARACTER = seasoned_pastor_character
				}
			}
			else_if = {
				limit = { scope:recruit_brides_decision = yes }
				recruit_three_nomadic_capital_characters_effect = {
					NOMAD_TEMPLATE_CHARACTER = nomadic_bride_template
				}
			}
			else_if = {
				limit = { scope:recruit_husbands_decision = yes }
				recruit_three_nomadic_capital_characters_effect = {
					NOMAD_TEMPLATE_CHARACTER = nomadic_husband_template
				}
			}
			else_if = {
				limit = { scope:recruit_knights_decision = yes }
				recruit_three_nomadic_capital_characters_effect = {
					NOMAD_TEMPLATE_CHARACTER = nomadic_knight_template
				}
			}
		}
		close_view = {
			view = decisions
			player = root
		}
	}
	
	ai_potential = {
		government_has_flag = government_is_nomadic
		highest_held_title_tier >= tier_duchy
		exists = domicile
		OR = {
			AND = {
				is_at_war = no
				any_courtier = {
					count < 10
				}
			}
			NOT = { exists = cp:councillor_kurultai_1 }
			NOT = { exists = cp:councillor_kurultai_2 }
			NOT = { exists = cp:councillor_kurultai_3 }
			NOT = { exists = cp:councillor_kurultai_4 }
		}
	}
	
	ai_will_do = { base = 100 }
}

### Summon Fair Courtiers ###
summon_fair_courtiers_decision = {
	ai_check_interval_by_tier = {
		barony = 0
		county = 0
		duchy = 0
		kingdom = 48
		empire = 48
		hegemony = 48
	}
	picture = {
		 reference = "gfx/interface/illustrations/event_scenes/mpo_city_steppe.dds"
	}
	sort_order = 100
	decision_group_type = courtier
	
	cooldown = { years = 2 }

	is_shown = {
		any_sub_realm_barony = {
			title_province = {
				has_building = pleasure_dome
			}
		}
	}

	is_valid_showing_failures_only = {
		is_available = yes
	}

	desc = summon_fair_courtiers_decision_desc

	cost = {
		prestige = {
			value = minor_prestige_value
		}
	}

	widget = {
		gui = "decision_view_widget_option_list_generic"
		controller = decision_option_list_controller
		decision_to_second_step_button = "CHOOSE_SUMMON_FAIR_COURTIERS_DECISION_NEXT_STEP_BUTTON"

		item = {
			value = summon_maidens_decision
			current_description = summon_maidens_decision
			localization = summon_maidens_decision
			icon = "gfx/interface/icons/traits/beauty_good_2.dds"
			ai_chance = {
				value = 0
				if = {
					limit = {
						is_male = yes
						is_married = no
					}
					add = 100
				}
			}
		}

		item = {
			value = call_men_decision
			current_description = call_men_decision
			localization = call_men_decision
			icon = "gfx/interface/icons/traits/beauty_good_2.dds"
			ai_chance = {
				value = 0
				if = {
					limit = {
						is_female = yes
						is_married = no
					}
					add = 100
				}
			}
		}
	}

	effect = {
		custom_tooltip = summon_fair_courtiers_decision_tooltip
		hidden_effect = {
			if = {
				limit = { scope:summon_maidens_decision = yes }
				summon_three_fair_courtiers_effect = {
					NOMAD_TEMPLATE_CHARACTER = beautiful_maiden_character
				}
			}
			else_if = {
				limit = { scope:call_men_decision = yes }
				summon_three_fair_courtiers_effect = {
					NOMAD_TEMPLATE_CHARACTER = beautiful_man_character
				}
			}
		}
		close_view = {
			view = decisions
			player = root
		}
	}
	
	ai_potential = {
		any_courtier = {
			count < 10
		}
	}
}
###########################################
	##Create Cossack kingdom Decision##
	## By: Björn S
###########################################

## The Choice of creating a new culture and kingdom
create_cossack_kingdom_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/fp2_decision_struggle_hostility.dds"
	}
	desc = create_cossack_kingdom_decision_desc
	selection_tooltip = create_cossack_kingdom_decision_tooltip
	decision_group_type = adventurer


## Player is a landless adventurer or have the veteran adventurer trait + a culture suitable for the area.
## Player also have to have the right cultural heritage.
	is_shown = {
		is_playable_character = yes
		OR = {
		is_landless_adventurer = yes
		has_trait = adventurer
		}
		culture = { 
			OR = {
				has_cultural_pillar = heritage_turkic
				has_cultural_pillar = heritage_east_slavic 
				has_cultural_pillar = heritage_west_slavic
				has_cultural_pillar = heritage_south_slavic
				has_cultural_pillar = heritage_tungusic
			}
		}
## Not repeatable
		NOT = {
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_create_cossack_kingdom
			}
		}

	}

	is_valid = {
		prestige_level >= high_prestige_level
		has_trait = adventurer
		has_government = nomad_government
		is_independent_ruler = yes
		AND = {
			completely_controls = title:d_tana
			completely_controls = title:d_don_valley
			OR = {
				completely_controls = title:d_itil
				completely_controls = title:d_red_levedia
				completely_controls = title:d_levedia
			}
		}
	}
	
	cost = {
		prestige = 1000
		gold = 300
	}


	is_valid_showing_failures_only = {
		is_landed = yes
		is_capable_adult = yes
		is_imprisoned = no
	}


	effect = {
		show_as_tooltip = { 
			create_cossack_scripted_effect = yes
		}
		hidden_effect = {
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_create_cossack_kingdom
			}
		}
		trigger_event = major_decisions.3600
	}
		
	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}

	ai_check_interval_by_tier = {
		barony = 0
		county = 0
		duchy = 120
		kingdom = 0
		empire = 0
		hegemony = 0
	}
}
