﻿###| Harthgate Decisions for Lords of Wessex |###

###| Credits |###

#: Developed by Edgar Harthgate
#: Original Negotiate the Danelaw Decision written Linnéa Thimrén & Ewan Cowhig Croft

###| End of Credits |###

###| Table of Contents |###																		###| Status |###

#: harthgate_decisions_major_establish_danelaw = Establish the Danelaw							#: Building
#: harthgate_decisions_major_form_england = Crown the King of all England						#: Building
#: harthgate_decisions_major_institute_cultural_reformation = Institute Cultural Reformation 	#: Building
#: harthgate_decisions_major_partition_england = Partition the Kingdom of England				#: Building

###| End of Table of Contents |###

###| Establish the Danelaw |###

harthgate_decisions_major_establish_danelaw = {
	
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_found_kingdom.dds"
	}
	desc = harthgate_decisions_major_establish_danelaw_desc
	selection_tooltip = harthgate_decisions_major_establish_danelaw_tooltip
	decision_group_type = major
	
	ai_check_interval = 120
	ai_potential = {
		always = yes
	}
	ai_will_do = {
		base = 100
	}
	
	is_shown = {
		is_ruler = yes
		is_landed = yes
		is_independent_ruler = yes
		culture = { has_cultural_pillar = heritage_north_germanic }
		highest_held_title_tier <= tier_duchy
		
		NOT = {
			exists = title:k_danelaw.holder
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_establish_the_danelaw
			}
		}
	}
		
	is_valid = {
		custom_description = {
			text = "harthgate_decisions_major_establish_danelaw_custom_text_1"
			exists = title:k_england.holder
		}
		culture = { has_cultural_pillar = heritage_north_germanic }
		completely_controls_region = custom_geographical_region_harthgate_danelaw_conquest
		prestige_level >= medium_prestige_level
	}

	is_valid_showing_failures_only = {
		is_capable_adult = yes
		is_imprisoned = no
		is_independent_ruler = yes
		is_at_war = no
	}
	
	###| Costs |###

	cost = {
		gold = 150
		prestige = 500
	}
	
	###| Effects |###

	effect = {
	
		custom_tooltip = harthgate_decisions_major_establish_danelaw_effect_tooltip
		
		show_as_tooltip = {
			harthgate_decisions_major_establish_danelaw_scripted_effect = yes
		}
		
		trigger_event = {
			id = harthgate_decisions_major_establish_danelaw.0001
		}
		
		hidden_effect = {
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_establish_the_danelaw
			}
			set_global_variable = {
				name = flag_establish_the_danelaw
				value = root
			}
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:negotiate_the_danelaw_decision
			}
		}
		
	}
		
}

###| Crown the King of all England |###

harthgate_decisions_major_form_england = {

	picture = { reference = "gfx/interface/illustrations/decisions/decision_found_kingdom.dds" }
	desc = harthgate_decisions_major_form_england_desc
	selection_tooltip = harthgate_decisions_major_form_england_tooltip
	decision_group_type = major
	
	ai_check_interval = 365
	ai_potential = { always = yes }
	ai_will_do = { base = 100 }
	
	is_shown = {
		is_ruler = yes
		is_landed = yes
		title:k_england = { is_title_created = no }
		capital_province = { geographical_region = custom_geographical_region_harthgate_england_kingdom_low }
	}
	
	is_valid = {
		is_independent_ruler = yes
		OR = {
			culture = { has_cultural_pillar = heritage_frankish }
			culture = { has_cultural_pillar = heritage_west_germanic }
			culture = { has_cultural_pillar = heritage_north_germanic }
		}
		trigger_if = {
			limit = {
				title:k_lesser_wessex_low = { is_title_created = yes }
				title:k_lesser_east_anglia_low = { is_title_created = yes }
				title:k_lesser_mercia_low = { is_title_created = yes }
				title:k_danelaw = { is_title_created = yes }
			}
			root = {
				has_title = title:k_lesser_wessex_low
				has_title = title:k_lesser_east_anglia_low
				has_title = title:k_lesser_mercia_low
			}
		}
		trigger_if = {
			limit = {
				title:k_lesser_wessex_low = { is_title_created = yes }
				title:k_lesser_east_anglia_low = { is_title_created = yes }
				title:k_lesser_mercia_low = { is_title_created = yes }
				title:k_lesser_deira_low = { is_title_created = yes }
			}		
			root = {
				has_title = title:k_lesser_wessex_low
				has_title = title:k_lesser_east_anglia_low
				has_title = title:k_lesser_mercia_low
				has_title = title:k_lesser_deira_low
			}
		}
		trigger_if = {
			limit = {
				title:k_lesser_wessex_low = { is_title_created = yes }
				title:k_lesser_east_anglia_low = { is_title_created = yes }
				title:k_lesser_mercia_low = { is_title_created = yes }
				title:k_daneland = { is_title_created = yes }
			}		
			root = {
				has_title = title:k_lesser_wessex_low
				has_title = title:k_lesser_east_anglia_low
				has_title = title:k_lesser_mercia_low
			}
		}
		trigger_if = {
			limit = {
				title:k_lesser_wessex_low = { is_title_created = no }
				title:k_lesser_east_anglia_low = { is_title_created = no }
				title:k_lesser_mercia_low = { is_title_created = no }
				title:k_lesser_deira_low = { is_title_created = no }
				title:k_danelaw = { is_title_created = no }
				title:k_daneland = { is_title_created = no }
			}
			highest_held_title_tier <= tier_duchy
			completely_controls_region = custom_geographical_region_harthgate_england_kingdom_low
		}
		prestige_level >= high_prestige_level
		piety_level >= medium_piety_level
	}
	
	is_valid_showing_failures_only = {
		is_imprisoned = no
		is_available_adult = yes
		is_at_war = no
	}
	
	cooldown = { years = 49 }
	
	cost = {
		gold = 500
		prestige = 2500
		piety = 1000
	}
	
	effect = {
		custom_tooltip = harthgate_decisions_major_form_england_tooltip
		show_as_tooltip = { harthgate_decisions_major_form_england_scripted_effect_low = yes }
		trigger_event = { id = harthgate_decisions_major_form_england_low.0001 }		
	}
}

###| Institute Cultural Reformation |###

harthgate_decisions_major_institute_cultural_reformation = {

	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_found_kingdom.dds"
	}
	desc = harthgate_decisions_major_institute_cultural_reformation_desc
	selection_tooltip = harthgate_decisions_major_institute_cultural_reformation_tooltip
	decision_group_type = major
	
	ai_check_interval = 120
	ai_potential = {
		always = yes
	}
	ai_will_do = {
		base = 100
	}
	
	is_shown = {
		NOT = {
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_institute_cultural_reformation
			}
		}
		is_ruler = yes
		is_landed = yes
		is_independent_ruler = yes
		culture = culture:anglo_saxon
		culture = { NOT = { has_cultural_era_or_later = culture_era_early_medieval } }
	}
	
	is_valid = {
		OR = {
			title:d_somerset = { holder = root }
			title:d_hereford = { holder = root }
			title:d_northumberland = { holder = root }
			title:k_england = { holder = root }
			title:k_lesser_wessex_low = { holder = root }
			title:k_lesser_east_anglia_low = { holder = root }
			title:k_lesser_mercia_low = { holder = root }
			title:k_lesser_deira_low = { holder = root }
		}
		OR = {
			diplomacy >= 20
			martial >= 20
			stewardship >= 20
			learning >= 20
		}
		prestige_level >= high_prestige_level
		piety_level >= medium_piety_level
	}
	
	is_valid_showing_failures_only = {
		is_capable_adult = yes
		is_imprisoned = no
		is_independent_ruler = yes
		is_at_war = no
	}
	
	cost = {
		gold = 800
		prestige = 2000
		piety = 500
	}
	
	effect = {
	
		custom_tooltip = harthgate_decisions_major_institute_cultural_reformation_effect_tooltip
		
		show_as_tooltip = {
			harthgate_decisions_major_institute_cultural_reformation_scripted_effect = yes
		}
		
		trigger_event = {
			id = harthgate_decisions_major_institute_cultural_reformation.0001
		}
		
		hidden_effect = {
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_institute_cultural_reformation
			}
			set_global_variable = {
				name = flag_institute_cultural_reformation
				value = root
			}
		}
	}
}

###| Partition the Kingdom of England |###

harthgate_decisions_major_partition_england = {

	picture = { reference = "gfx/interface/illustrations/decisions/decision_found_kingdom.dds" }
	desc = harthgate_decisions_major_partition_england_desc
	selection_tooltip = harthgate_decisions_major_partition_england_tooltip
	decision_group_type = major
	
	ai_check_interval = 120
	ai_potential = { always = yes }
	ai_will_do = { base = 100 }
	
	is_shown = {
		NOT = {
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_partition_england_low
			}
		}
		is_ruler = yes
		is_landed = yes
		highest_held_title_tier <= tier_duchy
		title:k_england = { is_title_created = no }
		capital_province = { geographical_region = custom_geographical_region_harthgate_england_kingdom_low }
	}
	
	is_valid = {
		is_independent_ruler = yes
		OR = {
			title:d_somerset = { holder = root }
			title:d_hereford = { holder = root }
			title:d_norfolk = { holder = root }
			title:d_york = { holder = root }
		}
		prestige_level >= high_prestige_level
	}
	
	is_valid_showing_failures_only = {
		is_imprisoned = no
		is_available_adult = yes
		is_at_war = no
		title:d_somerset.holder = { is_at_war = no }
		title:d_hereford.holder = { is_at_war = no }
		title:d_norfolk.holder = { is_at_war = no }
		title:d_york.holder = { is_at_war = no }
	}
	
	cost = {
		prestige = 1000
	}
	
	effect = {
		custom_tooltip = harthgate_decisions_major_partition_england_tooltip
		show_as_tooltip = { harthgate_decisions_major_partition_england_scripted_effect_low = yes }
		trigger_event = { id = harthgate_decisions_major_partition_england_low.0001 }
		
		hidden_effect = {
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:flag_partition_england_low
			}
			set_global_variable = {
				name = flag_partition_england_low
				value = root
			}
		}
	}
}