﻿reclaim_britannia_decision = {
	picture = "gfx/interface/illustrations/decisions/reclaim_britannia.dds"
	major = yes

	ai_check_interval = 120

	desc = reclaim_britannia_decision_desc

	is_shown = {
		OR = {
			has_culture_group = culture_group:goidelic_group
			has_culture_group = culture_group:brythonic_group
		}

		is_landed = yes
		any_sub_realm_county = {
			de_jure_liege.de_jure_liege.de_jure_liege = title:e_britannia
			NOR = {
				culture_group = culture_group:goidelic_group
				culture_group = culture_group:brythonic_group
			}
		}
		NOT = {
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:reclaim_britannia_decision
			}
		}
	}

	is_valid = {
		completely_controls_region  = world_europe_west_britannia

		# You can have no more than 1 powerful vassal with the "wrong" culture
		custom_description = {
			text = reclaim_britannia_custom_decision
			
			trigger_if = {
				limit = {
					any_vassal = {
						is_powerful_vassal = yes
						NOR = {
							culture_group = culture_group:goidelic_group
							culture_group = culture_group:brythonic_group
						}
					}
				}
				any_vassal = {
					count <= 1
					is_powerful_vassal = yes
					NOR = {
						culture_group = culture_group:goidelic_group
						culture_group = culture_group:brythonic_group
					}
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		is_imprisoned = no
		is_available_adult = yes
		is_at_war = no
	}

	effect = {
		add_to_global_variable_list = {
			name = unavailable_unique_decisions
			target = flag:reclaim_britannia_decision
		}
		show_as_tooltip = {
			reclaim_britannia_decision_effect = yes
		}
		trigger_event = british_isles.0001
		# Send event to other players
		every_player = {
			limit = {
				NOT = { this = root }
				OR = {
					has_culture_group = culture_group:west_germanic_group
					has_culture_group = culture_group:goidelic_group
					has_culture_group = culture_group:brythonic_group
					has_culture = culture:norman
				}
			}
			trigger_event = british_isles.0002
		}
	}
	
	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}

restore_the_danelaw_decision = {
	picture = "gfx/interface/illustrations/decisions/decision_realm.dds"
	major = yes

	ai_check_interval = 120

	desc = restore_the_danelaw_decision_desc

	is_shown = {
		has_culture_group = culture_group:north_germanic_group
		is_landed = yes
		NOT = {
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:restore_the_danelaw_decision
			}
		}
	}

	is_valid = {
		completely_controls = title:d_york
		completely_controls = title:d_lancaster
		completely_controls = title:d_norfolk
		completely_controls = title:d_bedford
		completely_controls = title:d_hereford
	}

	is_valid_showing_failures_only = {
		is_imprisoned = no
		is_available_adult = yes
		is_at_war = no
	}

	effect = {
		add_to_global_variable_list = {
			name = unavailable_unique_decisions
			target = flag:restore_the_danelaw_decision
		}

		show_as_tooltip = {
			restore_the_danelaw_effect = yes
		}
		trigger_event = british_isles.1001
		save_scope_as = restorer
		# Send event to other players
		every_player = {
			limit = {
				NOT = { this = root }
				OR = {
					primary_title = {
						OR = {
							de_jure_liege = title:e_britannia
							de_jure_liege.de_jure_liege = title:e_britannia
							de_jure_liege.de_jure_liege.de_jure_liege = title:e_britannia
						}
					}
					has_culture_group = culture_group:north_germanic_group
					has_culture_group = culture_group:central_germanic_group
					has_culture_group = culture_group:west_germanic_group
					has_culture_group = culture_group:goidelic_group
					has_culture_group = culture_group:brythonic_group
					has_culture = culture:norman
				}
			}
			trigger_event = british_isles.1002
		}
	}
	
	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}

embrace_english_culture_decision = {
	picture = "gfx/interface/illustrations/decisions/decision_realm.dds"
	major = yes

	ai_check_interval = 36

	desc = embrace_english_culture_decision_desc

	is_shown = {
		is_landed = yes
		has_culture_group = culture_group:frankish_group
		OR = {	
			title:k_england = {
				any_in_de_jure_hierarchy = {
					root.primary_title = this
				}
			}
			root.primary_title = title:e_britannia
		}
		NOT = {
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:embrace_english_culture_decision
			}
		}
	}

	is_valid = {
		custom_description = {
			text = capital_in_england_region_tooltip
			capital_province = {
				geographical_region = custom_england
			}
		}
		title:k_england.holder = root
	}

	is_valid_showing_failures_only = {
		is_imprisoned = no
		is_available_adult = yes
	}

	effect = {
		add_to_global_variable_list = {
			name = unavailable_unique_decisions
			target = flag:embrace_english_culture_decision
		}
		show_as_tooltip = {
			embrace_english_culture_effect = yes
		}

		trigger_event = british_isles.2001
	}
	
	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}

# Request Laudabiliter - by Flavio
england_request_laudabiliter_decision = {
	picture = "gfx/interface/illustrations/decisions/decision_misc.dds"

	desc = england_request_laudabiliter_decision_desc
	selection_tooltip = england_request_laudabiliter_decision_tooltip
	major = yes
	ai_goal = yes

	is_shown = {
		is_ruler = yes
		is_landed = yes
		root.faith = faith:catholic
		exists = faith:catholic.religious_head
		faith:catholic.religious_head = {
			has_title = title:k_papal_state
		}
		NOT = {  # Can only do it once.
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_england_requested_laudabiliter
			}
		}
		highest_held_title_tier >= 4 # Kings and Emperors only.
		OR = {
			has_culture_group = culture_group:frankish_group
			has_culture_group = culture_group:west_germanic_group
			has_culture_group = culture_group:north_germanic_group
		}
		# The ruler picking the decision should not already control Ireland.
		NOT = {
			completely_controls_region = custom_roman_hibernia
		}
		# The ruler asking it must be a King or Emperor in some way related to Britain.
		OR = {
			has_title = title:k_england
			has_title = title:k_scotland
			has_title = title:k_wales
			has_title = title:k_brittany
			has_title = title:k_france
			has_title = title:e_britannia
			has_title = title:e_france
		}
		has_government = feudal_government
	}
	
	is_valid = {
		piety_level >= 3
		piety >= 2000
		gold >= 1000
		root.faith.religious_head = {
			opinion = {
				target = root
				value >= very_high_positive_opinion
			}
		}
		# Must control core territories of England already.
		completely_controls = title:d_bedford
		completely_controls = title:d_hereford
		completely_controls = title:d_lancaster
		completely_controls = title:d_york
	}

	is_valid_showing_failures_only = {
		is_capable_adult = yes
		is_imprisoned = no
		is_independent_ruler = yes
		is_at_war = no
	}

	cost = {
		gold = 1000
		piety = 2000
	}

	effect = {
		show_as_tooltip = {
			house = {
				add_house_modifier = {
					modifier = ireland_laudabiliter_modifier
					years = 100
				}
			}
		}
		custom_tooltip = laudabiliter_decision_effects_tooltip
		trigger_event = {
			id = british_isles.3001
		}
		hidden_effect = {
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_england_requested_laudabiliter
			}
		}
	}
	
	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 15
		ai_value_modifier = {
			ai_boldness = 1.0
		}
	}
}

#Restore Dumnonia to the map - by Ewan Cowhig Croft
restore_dumnonia_decision = {
	picture = "gfx/interface/illustrations/decisions/decision_destiny_goal.dds"
	major = yes

	ai_check_interval = 120

	desc = restore_dumnonia_decision_desc
	selection_tooltip = restore_dumnonia_decision_tooltip

	is_shown = {
		is_ruler = yes
		is_landed = yes
		exists = dynasty # Everyone should have a dynasty, but in case they don't...
		OR = {
			OR = {
				has_title = title:d_cornwall
				has_title = title:c_cornwall
				has_title = title:c_devon
			}
			dynasty = dynasty:1029001	#The Cornish royal house is always able to get away with these shenanigans.
			culture = culture:cornish	#Cornish characters are always able to dream.
		}
		OR = {	#Must be a culture at least traditionally interlinked with Cornwall.
			dynasty = dynasty:1029001	#The Cornish royal house is at it again.
			culture_group = culture_group:brythonic_group
		}
		NOT = {	#You can only do it once.
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_restored_dumnonia
			}
		}
		OR = {
			has_government = feudal_government
			has_government = republic_government
			has_government = clan_government
		}
		highest_held_title_tier <= tier_duchy
	}

	is_valid = {
		is_independent_ruler = yes
		dynasty.dynasty_prestige_level >= medium_dynasty_prestige_level
		has_title = title:d_cornwall
		completely_controls = title:d_cornwall
		any_realm_province = { #You must have some realm support for your claims.
			culture_group = culture_group:brythonic_group
		}
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}

	effect = {
		show_as_tooltip = {
			restore_dumnonia_decision_scripted_effect = yes
		}
		save_scope_as = founder
		trigger_event = {
			id = british_isles.4001
		}
		#Notify other players.
		every_player = {
			limit = {
				NOT = { this = root }
				is_within_diplo_range = { CHARACTER = root }
			}
			trigger_event = british_isles.4002
		}
		hidden_effect = {
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_restored_dumnonia
			}
		}
	}

	cost = {
		gold = 300
	}

	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}