﻿landed_el_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_spend_money.dds"
	}
	#decision_group_type = major
	sort_order = 1000


	is_shown = {
		always = no
		#is_landed = yes
		#is_ai = no
		#is_travelling = no
		#is_imprisoned = no
		#is_incapable = no
		#is_at_war = no
		#is_in_army = no
		#is_adult = yes
		#trigger_if = {
		#	limit = {
		#		has_government = nomad_government
		#	}
		#	exists =	cp:councillor_kurultai_1
		#}
		#trigger_if = {
		#	limit = {
		#		NOT = { has_government = nomad_government }
		#	}
		#	exists = cp:councillor_steward
		#}
		#trigger_if = {
		#	limit = { exists = involved_activity }
		#	NOT = {
		#		OR = {
		#			has_activity_state = passive
		#			has_activity_state = active
		#		}
		#	}
		#}
		#NOT = { has_character_flag = el_is_employing_adventurer }
		#NOT = { has_character_flag = el_is_employing_adventurer_interac }
		#any_county = {
		#	any_county_province = {
		#	squared_distance = { target = root.capital_province value < el_squared_distance_camp }
		#		any_character_in_location = {
		#			has_government = landless_adventurer_government
		#			is_travelling = no
		#			is_at_war = no
		#			is_ai = yes
		#			is_in_army = no
		#			is_incapable = no
		#			NOT = { has_trait = infirm }
		#			is_adult = yes
		#			is_imprisoned = no
		#			NOT = { has_relation_rival = root }
		#			is_busy_in_events_unlocalised = no
		#			domicile.domicile_location = prev
		#			root = {
		#				NOT = {
		#					is_target_in_variable_list = {
		#						name = el_landed_refuted_list
		#						target = prev
		#					}
		#				}
		#			}					
		#		}
		#	}
		#}
	}
	is_valid_showing_failures_only = {
		custom_tooltip = {
			text = landed_el_decision.tt
			el_landed_available_global = yes
		}
	}		
	ai_check_interval = 0

	cooldown = { days = 365 }

	effect = {
	save_scope_as = el_employer
		custom_tooltip = landed_el_decision.tt.a
		custom_tooltip = landed_el_decision.tt.j
		
		if = {
			limit = { el_landed_available_train_knight = yes }
			custom_tooltip = el_landed_train_knight_valid_ok
		}
		if = {
			limit = {el_landed_available_tutor_child = yes }
			custom_tooltip = el_landed_tutor_child_valid_ok
		}
		if = {
			limit = {el_landed_available_des_nei = yes }
			custom_tooltip = el_landed_des_nei_valid_ok
		}
		if = {
			limit = {el_landed_available_regale_court = yes }
			custom_tooltip = el_landed_regale_court_valid_ok
		}
		if = {
			limit = {el_landed_available_imp_dom = yes }
			custom_tooltip = el_landed_imp_dom_valid_ok
		}
		if = {
			limit = {el_landed_available_con_nei = yes }
			custom_tooltip = el_landed_con_nei_valid_ok
		}
		if = {
			limit = {el_landed_available_sup_fac = yes }
			custom_tooltip = el_landed_sup_fac_valid_ok
		}
		if = {
			limit = { el_landed_available_find_sec = yes }
			custom_tooltip = el_landed_find_sec_valid_ok
		}
		
		add_character_flag = { 
			flag = el_is_employing_adventurer
			days = 365
		}
		if = {
			limit = { has_government = nomad_government }
			trigger_event = el_landed_trigger.0010
		}
		else = {
			trigger_event = el_landed_trigger.0001
		}
	}
}


landed_el_decision_rew = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_spend_money.dds"
	}
	#decision_group_type = major
	sort_order = 1000


	is_shown = {
		has_ep3_dlc_trigger = yes
		is_ai = no
		OR = {
			el_landed_check_player_status = yes
			el_landed_adventurer_check_employer_base_remove = yes
		}
	}
	is_valid_showing_failures_only = {
	}		
	ai_check_interval = 0

	cooldown = { days = 0 }
	widget = {
		gui = "decision_view_widget_option_list_generic"
		controller = decision_option_list_controller
		decision_to_second_step_button = el_landed_pre_event.0001.j
		show_from_start = yes
		
		item = {
			value = el_landed_item_select
			is_valid = {
				custom_tooltip = {
					text = landed_el_decision_rework.tt
					el_landed_max_contract_trigger = yes
				}
			}
			current_description = el_landed_item_select_desc
			localization = landed_el_decision_rew_confirm
			icon = "gfx/interface/icons/character_interactions/contract.dds"
		}
		item = {
			value = el_landed_item_remove
			is_valid = {
				custom_tooltip = {
					text = el_landed_item_remove_tt
					el_landed_adventurer_check_employer_base_remove = yes
				}
			}
			current_description = el_landed_item_remove_desc
			localization = landed_el_decision_rew_remove_confirm
			icon = "gfx/interface/icons/character_interactions/contract_refute.dds"
		}
	}
	effect = {
	save_scope_as = el_employer
		switch = {
			trigger = yes
			scope:el_landed_item_select = {
				custom_tooltip = landed_el_decision_rew.tt.a
				custom_tooltip = landed_el_decision_rew.tt.b
				custom_tooltip = landed_el_decision.tt.c
				custom_tooltip = landed_el_decision.tt.d	
				
				if = {
					limit = {
						el_landed_adventurer_check_employer_base = yes
					}
					custom_tooltip = landed_el_decision.tt.k
				}
				if = {
					limit = { 
						has_character_flag = el_landed_propose_train_knight
					}
					custom_tooltip = el_landed_train_knight_valid_ok
				}
				if = {
					limit = {
						has_character_flag = el_landed_propose_tutor_child
					}
					custom_tooltip = el_landed_tutor_child_valid_ok
				}
				if = {
					limit = {
						has_character_flag = el_landed_propose_des_nei				
					}
					custom_tooltip = el_landed_des_nei_valid_ok
				}
				if = {
					limit = {
						has_character_flag = el_landed_propose_regale_court
					}
					custom_tooltip = el_landed_regale_court_valid_ok
				}
				if = {
					limit = {
						has_character_flag = el_landed_propose_imp_dom
					}
					custom_tooltip = el_landed_imp_dom_valid_ok
				}
				if = {
					limit = {
						has_character_flag = el_landed_propose_con_nei
					}
					custom_tooltip = el_landed_con_nei_valid_ok
				}
				if = {
					limit = {
						has_character_flag = el_landed_propose_sup_fac
					}
					custom_tooltip = el_landed_sup_fac_valid_ok
				}
				if = {
					limit = { 
						has_character_flag = el_landed_propose_find_sec
					}
					custom_tooltip = el_landed_find_sec_valid_ok
				}
				
				custom_tooltip = landed_el_decision.tt.j
				
				if = {
					limit = { 
						el_landed_trigger_train_knight = yes 
						NOT = { has_character_flag = el_landed_propose_train_knight }
					}
					custom_tooltip = el_landed_train_knight_valid_ok
				}
				if = {
					limit = {
						el_landed_trigger_tutor_child = yes 
						NOT = { has_character_flag = el_landed_propose_tutor_child }
					}
					custom_tooltip = el_landed_tutor_child_valid_ok
				}
				if = {
					limit = {
						el_landed_trigger_des_nei = yes
						NOT = { has_character_flag = el_landed_propose_des_nei }				
					}
					custom_tooltip = el_landed_des_nei_valid_ok
				}
				if = {
					limit = {
						el_landed_trigger_regale_court = yes 
						NOT = { has_character_flag = el_landed_propose_regale_court }
					}
					custom_tooltip = el_landed_regale_court_valid_ok
				}
				if = {
					limit = {
						el_landed_trigger_imp_dom = yes
						NOT = { has_character_flag = el_landed_propose_imp_dom }
					}
					custom_tooltip = el_landed_imp_dom_valid_ok
				}
				if = {
					limit = {
						el_landed_trigger_con_nei = yes 
						NOT = { has_character_flag = el_landed_propose_con_nei }
					}
					custom_tooltip = el_landed_con_nei_valid_ok
				}
				if = {
					limit = {
						el_landed_trigger_sup_fac = yes 
						NOT = { has_character_flag = el_landed_propose_sup_fac }
					}
					custom_tooltip = el_landed_sup_fac_valid_ok
				}
				if = {
					limit = { 
						el_landed_trigger_find_sec = yes 
						NOT = { has_character_flag = el_landed_propose_find_sec }
					}
					custom_tooltip = el_landed_find_sec_valid_ok
				}
				trigger_event = el_landed_pre_event.0001
			}
			scope:el_landed_item_remove = {
				custom_tooltip = landed_el_decision_rew_remove.tt.a
		
				if = {
					limit = {
						el_landed_adventurer_check_employer_base = yes
					}
					custom_tooltip = landed_el_decision.tt.k
				}
				if = {
					limit = { 
						has_character_flag = el_landed_propose_train_knight
					}
					custom_tooltip = el_landed_train_knight_valid_ok
				}
				if = {
					limit = {
						has_character_flag = el_landed_propose_tutor_child
					}
					custom_tooltip = el_landed_tutor_child_valid_ok
				}
				if = {
					limit = {
						has_character_flag = el_landed_propose_des_nei				
					}
					custom_tooltip = el_landed_des_nei_valid_ok
				}
				if = {
					limit = {
						has_character_flag = el_landed_propose_regale_court
					}
					custom_tooltip = el_landed_regale_court_valid_ok
				}
				if = {
					limit = {
						has_character_flag = el_landed_propose_imp_dom
					}
					custom_tooltip = el_landed_imp_dom_valid_ok
				}
				if = {
					limit = {
						has_character_flag = el_landed_propose_con_nei
					}
					custom_tooltip = el_landed_con_nei_valid_ok
				}
				if = {
					limit = {
						has_character_flag = el_landed_propose_sup_fac
					}
					custom_tooltip = el_landed_sup_fac_valid_ok
				}
				if = {
					limit = { 
						has_character_flag = el_landed_propose_find_sec
					}
					custom_tooltip = el_landed_find_sec_valid_ok
				}
				trigger_event = el_landed_pre_event.0010
			}
		}
	}
}

#anded_el_decision_rew_remove = {
#	picture = {
#		reference = "gfx/interface/illustrations/decisions/decision_spend_money.dds"
#	}
#	#decision_group_type = major
#	sort_order = 1000
#
#
#	is_shown = {
#		is_ai = no
#		el_landed_adventurer_check_employer_base_remove = yes
#	}
#	is_valid_showing_failures_only = {
#	}		
#	ai_check_interval = 0
#
#	cooldown = { days = 0 }
#
#	effect = {
#	save_scope_as = el_employer
#		custom_tooltip = landed_el_decision_rew_remove.tt.a
#		
#		if = {
#			limit = {
#				el_landed_adventurer_check_employer_base = yes
#			}
#			custom_tooltip = landed_el_decision.tt.k
#		}
#		if = {
#			limit = { 
#				has_character_flag = el_landed_propose_train_knight
#			}
#			custom_tooltip = el_landed_train_knight_valid_ok
#		}
#		if = {
#			limit = {
#				has_character_flag = el_landed_propose_tutor_child
#			}
#			custom_tooltip = el_landed_tutor_child_valid_ok
#		}
#		if = {
#			limit = {
#				has_character_flag = el_landed_propose_des_nei				
#			}
#			custom_tooltip = el_landed_des_nei_valid_ok
#		}
#		if = {
#			limit = {
#				has_character_flag = el_landed_propose_regale_court
#			}
#			custom_tooltip = el_landed_regale_court_valid_ok
#		}
#		if = {
#			limit = {
#				has_character_flag = el_landed_propose_imp_dom
#			}
#			custom_tooltip = el_landed_imp_dom_valid_ok
#		}
#		if = {
#			limit = {
#				has_character_flag = el_landed_propose_con_nei
#			}
#			custom_tooltip = el_landed_con_nei_valid_ok
#		}
#		if = {
#			limit = {
#				has_character_flag = el_landed_propose_sup_fac
#			}
#			custom_tooltip = el_landed_sup_fac_valid_ok
#		}
#		if = {
#			limit = { 
#				has_character_flag = el_landed_propose_find_sec
#			}
#			custom_tooltip = el_landed_find_sec_valid_ok
#		}
#		trigger_event = el_landed_pre_event.0010
#	}
#