﻿0s_lazarus_knights_decision = {
	picture = { 
		reference = "gfx/interface/illustrations/decisions/0s_lazarus_knights_decision.dds"
	}
	decision_group_type = major
	ai_check_interval = 120
	desc = 0s_lazarus_knights_decision_desc
	ai_goal = yes
	
	is_shown = {
		root.culture = {
		    NOT = { 
			has_innovation = innovation_0s_lazaret
			}
		}

		faith = faith:catholic

		root.culture = {
			has_cultural_era_or_later = culture_era_high_medieval
		}
		highest_held_title_tier >= tier_duchy
		OR = {
			capital_province = { geographical_region = world_middle_east_jerusalem }
			has_trait = leper
			any_child = {
				has_trait = leper
			}
			any_consort = {
				has_trait = leper
			}
			primary_heir = {
				has_trait = leper
			}
			house ?= {
				any_house_member = {
					has_trait = leper
				}
			}
		}
		exists = faith.religious_head
	}
	
	is_valid = {
		piety_level >= high_piety_level
		prestige_level >= high_prestige_level
		
		faith.religious_head = {	
			opinion = {
				target = root
				value >= high_positive_opinion
			}
		}
	}

	is_valid_showing_failures_only = {
		is_landed = yes
		is_capable_adult = yes
		is_imprisoned = no
		is_at_war = no
	}
	
	cost = {
		gold = 500
		piety = 550
	}
	
	effect = {
		show_as_tooltip = {
			0s_lazarus_knights_scripted_effect = yes
		}
		add_legitimacy_effect = { LEGITIMACY = admin_convert_legitimacy_value }
		root.culture = {
			add_innovation = innovation_0s_lazaret
		}
		if = {
			limit = { exists = dynasty } 
			dynasty = {
				add_dynasty_prestige = medium_dynasty_prestige_gain 
			}
		}
		trigger_event = 0s_lazaret.0001

	}
	
	ai_will_do = { base = 100 }
}

0s_expand_outremer_decision = {
	decision_group_type = major
	title = 0s_expand_outremer_decision
	desc = 0s_expand_outremer_decision_desc
	selection_tooltip = 0s_expand_outremer_decision_tooltip
	picture = { 
		reference = "gfx/interface/illustrations/decisions/0s_expand_outremer_decision.dds"
	}
	sort_order = 80

	cooldown = { years = 10 }

	is_shown = {
		is_target_in_global_variable_list = {
			name = unavailable_unique_decisions
			target = flag:flag_created_outremer_empire
		}
		highest_held_title_tier >= tier_empire
		has_title = title:e_outremer
		faith = faith:catholic
		
		# Hides the decision entirely from EVERYONE if both paths are completed
NOT = {
        AND = {
            has_global_variable = outremer_island_expanded
            has_global_variable = outremer_continental_expanded
        }
    }
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
		is_at_war = no
	}

	cost = {
		gold = 1500
		prestige = 1000
	}

	widget = {
		gui = "decision_view_widget_generic_multichoice_with_effects"
		controller = decision_option_list_controller
		decision_to_second_step_button = "SELECT_ACTION"
		show_from_start = yes

		item = {
			value = outremer_island_expansion
			current_description = outremer_island_expansion_desc
			localization = outremer_island_expansion_name
			icon = "gfx/interface/icons/character_interactions/icon_combat.dds"
			is_valid = {
				capital_county = {
					development_level >= 45
				}
				root.culture = {
					has_innovation = innovation_sappers
				}
				custom_tooltip = {
					text = outremer_island_expansion_requirement_tt
					# Blocks the heir (and everyone else) from selecting this option again
					NOT = { exists = global_var:outremer_island_expanded }
					OR = {
						completely_controls_region = 0s_outremer_island_expansion
					}
				}
			}
			ai_chance = {
				value = 50
			}
		}

		item = {
			value = outremer_continental_expansion
			current_description = outremer_continental_expansion_desc
			localization = outremer_continental_expansion_name
			icon = "gfx/interface/icons/character_interactions/icon_coax_to_war.dds"
			is_valid = {
				has_realm_law >= crown_authority_3
				root.culture = {
					has_innovation = innovation_royal_armory
				}
				custom_tooltip = {
					text = outremer_continental_expansion_requirement_tt
					# Blocks the heir (and everyone else) from selecting this option again
					NOT = { exists = global_var:outremer_continental_expanded }
					OR = {
						completely_controls_region = 0s_outremer_continental_expansion
					}
				}
			}
			ai_chance = {
				value = 50
			}
		}
	}

	effect = {
		custom_tooltip = outremer_expansion_general_consequences_tt
		if = {
			limit = {
				root.culture = {
					NOT = { has_innovation = innovation_levantine_arsenals }
				}
			}
			root.culture = { add_innovation = innovation_levantine_arsenals }
		}

		switch = {
			trigger = yes
			scope:outremer_island_expansion = {
				custom_tooltip = outremer_island_expansion_effect_tt
				
				outremer_island_expansion_scripted_effect = yes
				
				set_global_variable = {
					name = outremer_island_expanded
					value = yes
				}
				trigger_event = outremer_flavor.0001
			}
			
			scope:outremer_continental_expansion = {
				custom_tooltip = outremer_continental_expansion_effect_tt
				
				outremer_continental_expansion_scripted_effect = yes
				
				set_global_variable = {
					name = outremer_continental_expanded
					value = yes
				}
				trigger_event = outremer_flavor.0001
			}
		}
	}

	ai_check_interval = 120
	ai_will_do = { base = 100 }
}

