﻿##########
#Unify Samhan/Goryeo
### Unite the Husamguk ###
tgp_korea_unify_goryeo_decision = {
	picture = {
		reference = "gfx/interface/illustrations/activity_splash_screens/tour_arrival_asia_welcome.dds"
	}
	desc = tgp_korea_unify_goryeo_decision_desc
	selection_tooltip = tgp_korea_unify_goryeo_decision_tooltip
	decision_group_type = major

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

	is_shown = {
		has_tgp_dlc_trigger = yes
		NOR = {
			exists = title:e_goryeo.holder
			exists = title:k_yongson_throne.holder
		}
		culture = {
			OR = {
				has_cultural_pillar = heritage_korean
				has_cultural_pillar = heritage_buyeo
				any_parent_culture = {
					OR = {
						has_cultural_pillar = heritage_korean
						has_cultural_pillar = heritage_buyeo
					}
				}
			}
		}
		NOT = {
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:unify_goryeo_decision
			}
		}
	}

	is_valid = {
		government_allows = administrative
		highest_held_title_tier < tier_empire
		OR = {
			has_title = title:k_silla
			has_title = title:k_goguryeo
			has_title = title:k_baekje
		}
		custom_tooltip = {
			text = tgp_korea_unify_goryeo_decision_no_other_korean_kingdoms_tt
			trigger_if = {
				limit = { exists = title:k_silla.holder }
				title:k_silla.holder = root
			}
			trigger_if = {
				limit = { exists = title:k_goguryeo.holder }
				title:k_goguryeo.holder = root
			}
			trigger_if = {
				limit = { exists = title:k_baekje.holder }
				title:k_baekje.holder = root
			}
		}
		completely_controls = title:d_bukgye
		completely_controls = title:d_gaeseong
		completely_controls = title:d_gyeongju
		completely_controls = title:d_chungju
		realm_size >= 50
	}

	is_valid_showing_failures_only = {
		is_landed = yes
		is_adult = yes
		is_available = yes
		is_independent_ruler = yes
	}

	cost = {
		piety = {
			value = massive_piety_value
		}
		gold = {
			value = 0
			if = {
				limit = {
					has_treasury = no
				}
				add = massive_gold_value
			}
		}
		treasury = {
			value = 0
			if = {
				limit = {
					has_treasury = yes
				}
				add = massive_gold_value
			}
		}
	}

	effect = {
		if = {
			limit = {
				is_ai = no
			}
			add_achievement_global_variable_effect = {
				VARIABLE = achieved_ep4_13_how_its_done_done_done_achievement
				VALUE = yes
			}
		}
		#Can only happen once
		add_to_global_variable_list = {
			name = unavailable_unique_decisions
			target = flag:unify_goryeo_decision
		}
		save_scope_as = king_of_goryeo
		show_as_tooltip = { korea_unify_goryeo_reward_effect = yes }
		trigger_event = tgp_korea_decision.9101
	}

	ai_will_do = {
		base = 100
	}
}
