KOR_saudi_volunteer_setup_effect = {
	# 처음 시작할 때 이거 넣어야 함
	KOR = { add_dynamic_modifier = { modifier = KOR_saudi_volunteer_dynamic } }
	set_variable = { KOR_saudi_deployed_troops = 0 }
	set_variable = { KOR_saudi_casualties = 0 }
	set_variable = { KOR_saudi_dissatisfaction = 0.2 }
	set_variable = { KOR_saudi_dissatisfaction_USA = 0.8 }
	KOR_saudi_volunteer_modifier_effect = yes
	every_state = {
		limit = {
			OR = {
				is_owned_by = SAU
				is_owned_by = ROC
				is_owned_by = ARR
				is_owned_by = SAR
				is_owned_by = JAH
			}
		}
		add_dynamic_modifier = { modifier = KOR_saudi_debuff_states_dynamic }
	}
}
KOR_saudi_volunteer_modifier_effect = {
	set_variable = { KOR_saudi_volunteer_stability_factor = KOR.KOR_saudi_dissatisfaction }
	multiply_variable = { KOR_saudi_volunteer_stability_factor = -1 }
	multiply_variable = { KOR_saudi_volunteer_stability_factor = 0.2 }
	set_variable = { KOR_saudi_volunteer_war_support_factor = KOR.KOR_saudi_dissatisfaction_USA }
	multiply_variable = { KOR_saudi_volunteer_war_support_factor = -1 }
	multiply_variable = { KOR_saudi_volunteer_war_support_factor = 0.2 }
}

KOR_saudi_dissatisfaction_change_effect = {
	add_to_variable = { KOR_saudi_dissatisfaction = KOR_saudi_dissatisfaction_temp }
	clamp_variable = { var = KOR_saudi_dissatisfaction min = 0 max = 1 }
	custom_effect_tooltip = KOR_saudi_dissatisfaction_change_tooltip
	KOR_saudi_volunteer_modifier_effect = yes
}

KOR_saudi_dissatisfaction_USA_change_effect = {
	add_to_variable = { KOR_saudi_dissatisfaction_USA = KOR_saudi_dissatisfaction_USA_temp }
	clamp_variable = { var = KOR_saudi_dissatisfaction_USA min = 0 max = 1 }
	custom_effect_tooltip = KOR_saudi_dissatisfaction_USA_change_tooltip
	KOR_saudi_volunteer_modifier_effect = yes
}

KOR_saudi_deployed_troops_change_effect = {
	add_to_variable = { KOR_saudi_deployed_troops = KOR_saudi_deployed_troops_temp }
	set_temp_variable = { KOR_saudi_deployed_troops_subtract_temp = KOR_saudi_deployed_troops_temp }
	multiply_temp_variable = { KOR_saudi_deployed_troops_subtract_temp = -1 }
	add_manpower = KOR_saudi_deployed_troops_subtract_temp
	custom_effect_tooltip = KOR_saudi_deployed_troops_change_tooltip
}

KOR_saudi_casualties_change_effect = {
	add_to_variable = { KOR_saudi_casualties = KOR_saudi_casualties_temp }
	custom_effect_tooltip = KOR_saudi_casualties_change_tooltip
}

KOR_coronavirus_setup_effect = {
	KOR = { 
		add_dynamic_modifier = { modifier = KOR_coronavirus_dynamic } 
		add_dynamic_modifier = { modifier = KOR_coronavirus_dissatisfaction_dynamic }
	}
	set_variable = { KOR_coronavirus_vaccine_var = 0 }
	set_variable = { KOR_coronavirus_dissatisfaction_var = 4 }
	set_variable = { KOR_coronavirus_infection_var = 5 }
	set_variable = { KOR_coronavirus_infectee = 0.03 }
	set_variable = { KOR_coronavirus_fatality = 0.05 }
	set_variable = { KOR_coronavirus_deaths_number = 0 }
	set_variable = { KOR_coronavirus_timeout_days = 50 }
	KOR_coronavirus_modifier_effect = yes
}

KOR_coronavirus_modifier_effect = {
	set_temp_variable = { KOR_coronavirus_modifier_var = KOR_coronavirus_infection_var }
	divide_temp_variable = { KOR_coronavirus_modifier_var = 100 }
	multiply_temp_variable = { KOR_coronavirus_modifier_var = 0.01 }

	set_variable = { KOR_coronavirus_dissatisfaction_stability_factor = KOR.KOR_coronavirus_dissatisfaction_var }
	multiply_variable = { KOR_coronavirus_dissatisfaction_stability_factor = -1 }
	multiply_variable = { KOR_coronavirus_dissatisfaction_stability_factor = 0.003 }

	set_variable = { KOR_coronavirus_political_power_gain = KOR_coronavirus_infection_var }
	multiply_variable = { KOR_coronavirus_political_power_gain = -1 }
	multiply_variable = { KOR_coronavirus_political_power_gain = KOR_coronavirus_modifier_var }

	set_variable = { KOR_coronavirus_stability_factor = KOR_coronavirus_infection_var }
	multiply_variable = { KOR_coronavirus_stability_factor = -0.4 }
	multiply_variable = { KOR_coronavirus_stability_factor = KOR_coronavirus_modifier_var }

	set_variable = { KOR_coronavirus_expense_growth_factor = KOR_coronavirus_infection_var }
	multiply_variable = { KOR_coronavirus_expense_growth_factor = 0.3 }
	multiply_variable = { KOR_coronavirus_expense_growth_factor = KOR_coronavirus_modifier_var }
	
	set_variable = { KOR_coronavirus_society_development_monthl = KOR_coronavirus_infection_var }
	multiply_variable = { KOR_coronavirus_society_development_monthl = -0.075 }
	multiply_variable = { KOR_coronavirus_society_development_monthl = KOR_coronavirus_modifier_var }

	set_variable = { KOR_coronavirus_industrial_capacity_factory = KOR_coronavirus_infection_var }
	multiply_variable = { KOR_coronavirus_industrial_capacity_factory = -0.4 }
	multiply_variable = { KOR_coronavirus_industrial_capacity_factory = KOR_coronavirus_modifier_var }

	set_variable = { KOR_coronavirus_income_growth_factor = KOR_coronavirus_infection_var }
	multiply_variable = { KOR_coronavirus_income_growth_factor = -0.4 }
	multiply_variable = { KOR_coronavirus_income_growth_factor = KOR_coronavirus_modifier_var }
}

KOR_coronavirus_infectee_change_effect = {
	add_to_variable = { KOR_coronavirus_infectee = KOR_coronavirus_infectee_temp }
	clamp_variable = { var = KOR_coronavirus_infectee min = 0 max = 5000 }
	custom_effect_tooltip = KOR_coronavirus_infectee_change_tooltip
}

KOR_coronavirus_infection_var_change_effect = {
	add_to_variable = { KOR_coronavirus_infection_var = KOR_coronavirus_infection_temp }
	clamp_variable = { var = KOR_coronavirus_infection_var min = 0 max = 100 }
	KOR_coronavirus_modifier_effect = yes
	custom_effect_tooltip = KOR_coronavirus_infection_var_change_tooltip
	if = {
		limit = {
			AND = {
				has_country_flag = KOR_coronavirus_vaccine_researched
				check_variable = { KOR.KOR_coronavirus_infection_var = 0 }
			}
		}
		hidden_effect = { country_event = korea.4 }
	}
}

KOR_coronavirus_vaccine_var_change_effect = {
	add_to_variable = { KOR_coronavirus_vaccine_var = KOR_coronavirus_vaccine_temp }
	clamp_variable = { var = KOR_coronavirus_vaccine_var min = 0 max = 100 }
	clamp_variable = { var = KOR_coronavirus_fatality min = 0 max = 1 }
	custom_effect_tooltip = KOR_coronavirus_vaccine_var_change_tooltip
	if = {
		limit = { check_variable = { KOR_coronavirus_vaccine_var = 100 } }
		hidden_effect = { country_event = korea.3 }
	}
}

KOR_coronavirus_dissatisfaction_var_change_effect = {
	add_to_variable = { KOR_coronavirus_dissatisfaction_var = KOR_coronavirus_dissatisfaction_var_temp }
	clamp_variable = { var = KOR_coronavirus_dissatisfaction_var min = 0 max = 100 }
	KOR_coronavirus_modifier_effect = yes
	custom_effect_tooltip = KOR_coronavirus_dissatisfaction_var_change_tooltip
}

KOR_coronavirus_infectee_effect = {
	if = {
		limit = { 
			AND = {
				check_variable = { KOR_coronavirus_infection_var = 0 } 
				NOT = { has_country_flag = KOR_coronavirus_vaccine_researched }
			}
		}
		set_temp_variable = { KOR_coronavirus_infectee_temp = 5 }
		KOR_coronavirus_infectee_change_effect = yes
	}
	else_if = {
		limit = { 
			AND = { 
				check_variable = { KOR_coronavirus_infection_var > 0 }
				check_variable = { KOR_coronavirus_infection_var < 26 }
				NOT = { has_country_flag = KOR_coronavirus_vaccine_researched }
			} 
		}
		set_temp_variable = { KOR_coronavirus_infectee_temp = 10 }
		KOR_coronavirus_infectee_change_effect = yes
	}
	else_if = {
		limit = { 
			AND = { 
				check_variable = { KOR_coronavirus_infection_var > 25 }
				check_variable = { KOR_coronavirus_infection_var < 51 }
				NOT = { has_country_flag = KOR_coronavirus_vaccine_researched }
			} 
		}
		set_temp_variable = { KOR_coronavirus_infectee_temp = 50 }
		KOR_coronavirus_infectee_change_effect = yes
	}
	else_if = {
		limit = { 
			AND = { 
				check_variable = { KOR_coronavirus_infection_var > 51 }
				check_variable = { KOR_coronavirus_infection_var < 76 }
				NOT = { has_country_flag = KOR_coronavirus_vaccine_researched }
			} 
		}
		set_temp_variable = { KOR_coronavirus_infectee_temp = 150 }
		KOR_coronavirus_infectee_change_effect = yes
	}
	else_if = {
		limit = { 
			AND = {
				check_variable = { KOR_coronavirus_infection_var > 76 }
				NOT = { has_country_flag = KOR_coronavirus_vaccine_researched }
			}
		}
		set_temp_variable = { KOR_coronavirus_infectee_temp = 300 }
		KOR_coronavirus_infectee_change_effect = yes
	}
	
	if = {
		limit = { has_country_flag = KOR_coronavirus_vaccine_researched }
		set_temp_variable = { KOR_coronavirus_infectee_temp = -50 }
		KOR_coronavirus_infectee_change_effect = yes
	}
}

KOR_national_assembly_setup_effect = {
	clear_array = KOR_national_assmebly_seat_array
	clear_array = KOR_national_assmebly_member_array
	add_to_array = { KOR_national_assmebly_seat_array = 300 }
	add_to_array = { KOR_national_assmebly_seat_array = 0 }
	add_to_array = { KOR_national_assmebly_seat_array = 0 }
	add_to_array = { KOR_national_assmebly_seat_array = 0 }
	add_to_array = { KOR_national_assmebly_seat_array = 0 }
	add_to_array = { KOR_national_assmebly_seat_array = 0 }
	add_to_array = { KOR_national_assmebly_seat_array = 0 }
	add_to_array = { KOR_national_assmebly_seat_array = 0 }
	add_to_array = { KOR_national_assmebly_seat_array = 0 }

	add_to_array = { KOR_national_assmebly_member_array = 1 }
	add_to_array = { KOR_national_assmebly_member_array = 2 }
	add_to_array = { KOR_national_assmebly_member_array = 3 }
	add_to_array = { KOR_national_assmebly_member_array = 4 }
	add_to_array = { KOR_national_assmebly_member_array = 5 }
	add_to_array = { KOR_national_assmebly_member_array = 6 }
	add_to_array = { KOR_national_assmebly_member_array = 7 }
	add_to_array = { KOR_national_assmebly_member_array = 8 }
	add_to_array = { KOR_national_assmebly_member_array = 9 }
}

KOR_decrease_oil_shock_effect = {
	if = {
		limit = {
			has_idea = KOR_oil_shock4
		}
		remove_ideas = KOR_oil_shock4
	}
	else_if = {
		limit = {
			has_idea = KOR_oil_shock3
		}
		swap_ideas = {
			remove_idea = KOR_oil_shock3
			add_idea = KOR_oil_shock4
		}
	}
	else_if = {
		limit = {
			has_idea = KOR_oil_shock2
		}
		swap_ideas = {
			remove_idea = KOR_oil_shock2
			add_idea = KOR_oil_shock3
		}
	}
	else_if = {
		limit = {
			has_idea = KOR_oil_shock1
		}
		swap_ideas = {
			remove_idea = KOR_oil_shock1
			add_idea = KOR_oil_shock2
		}
	}
}

KOR_president_election_setup_effect = {
	set_variable = { KOR.KOR_president_election_yoon_support = 0.5 }
	set_variable = { KOR.KOR_president_election_lee_support = 0.5 }
}

KOR_president_election_calculate_effect = {
	if = {
		limit = { check_variable = { president_faction_target = 1 } }
		multiply_temp_variable = { KOR_president_election_yoon_support_temp = -1 }
		add_to_variable = { KOR_president_election_lee_support = KOR_president_election_yoon_support_temp }
	}
	else_if = {
		limit = { check_variable = { president_faction_target = 2 } }
		multiply_temp_variable = { KOR_president_election_lee_support_temp = -1 }
		add_to_variable = { KOR_president_election_yoon_support = KOR_president_election_lee_support_temp }
	}
	set_temp_variable = { president_election_total_popularity = 0 }
	clamp_variable = { var = KOR_president_election_yoon_support min = 0 max = 1 }
	add_to_temp_variable = { total_popularity = KOR_president_election_yoon_support }
	clamp_variable = { var = KOR_president_election_lee_support min = 0 max = 1 }
	add_to_temp_variable = { total_popularity = KOR_president_election_lee_support }
	if = {
		limit = { check_variable = { president_election_total_popularity > 1 } }
		set_temp_variable = { scale_factor_percent = 100 }
        divide_temp_variable = { scale_factor_percent = president_election_total_popularity }

		multiply_variable = { KOR_president_election_yoon_support = scale_factor_percent }
        divide_variable = { KOR_president_election_yoon_support = 100 }

		subtract_from_temp_variable = { president_election_total_popularity = KOR_president_election_yoon_support }
        set_variable = { KOR_president_election_lee_support = president_election_total_popularity }

		set_temp_variable = { final_check_sum = KOR_president_election_yoon_support }

        add_to_temp_variable = { final_check_sum = KOR_president_election_yoon_support }
        if = {
            limit = { check_variable = { final_check_sum < 100 } }
            set_temp_variable = { remainder = 100 }
            subtract_from_temp_variable = { remainder = final_check_sum }
            add_to_variable = { KOR_president_election_yoon_support = remainder }
        }
	}
	multiply_temp_variable = { KOR_president_election_yoon_support_temp = -1 }
	multiply_temp_variable = { KOR_president_election_lee_support_temp = -1 }
}

KOR_president_election_yoon_support_change_effect = {
	set_temp_variable = { president_faction_target = 1 }
	add_to_variable = { KOR_president_election_yoon_support = KOR_president_election_yoon_support_temp }
	KOR_president_election_calculate_effect = yes
	custom_effect_tooltip = KOR_president_election_yoon_support_change_tooltip
}

KOR_president_election_lee_support_change_effect = {
	set_temp_variable = { president_faction_target = 2 }
	add_to_variable = { KOR_president_election_lee_support = KOR_president_election_lee_support_temp }
	KOR_president_election_calculate_effect = yes
	custom_effect_tooltip = KOR_president_election_lee_support_change_tooltip
}

KOR_clear_defeat_flag_effect = {
	clr_country_flag = KOR_yoon_taiwan_war_defeat
	clr_country_flag = KOR_yoon_under_martial_law
	clr_country_flag = KOR_yoon_winter_republic
}

KOR_clear_victory_flag_effect = {
	clr_country_flag = KOR_yoon_taiwan_war_victory
	clr_country_flag = KOR_yoon_second_election_victory
}



add_temp_unit_leader_role = {
	hidden_effect = {
		if = {
			limit = { is_unit_leader = no }
			add_corps_commander_role = {
				skill = 1
				traits = { just_visiting }
				visible = { always = no }
			}
			set_character_flag = temp_unit_leader
		}
	}
}

remove_temp_unit_leader_role = {
	hidden_effect = {
		if = {
			limit = { has_character_flag = temp_unit_leader }
			remove_unit_leader_role = yes
			clr_character_flag = temp_unit_leader
		}
	}
}

KOR_remove_replaced_advisor_1_effects = {
	custom_effect_tooltip = {
		localization_key = KOR_replace_ascended_advisor_tt
		CHARACTER = [GetKorAscendedAdvisorName1]
		TRAIT = [GetTFRKORAscendedAdvisorTrait1]
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_1 = 2 }
		}
		remove_ideas = KOR_Hong_joon_pyo_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_1 = 3 }
		}
		remove_ideas = KOR_yoon_sang_hyun_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_1 = 4 }
		}
		remove_ideas = KOR_choo_kyung_ho_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_1 = 5 }
		}
		remove_ideas = KOR_ahn_cheol_soo_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_1 = 6 }
		}
		remove_ideas = KOR_kim_chong_in_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_1 = 7 }
		}
		remove_ideas = KOR_lee_sang_min_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_1 = 8 }
		}
		remove_ideas = KOR_yoo_seong_min_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_1 = 9 }
		}
		remove_ideas = KOR_han_dong_hoon_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_1 = 10 }
		}
		remove_ideas = KOR_chang_Je_won_ns
	}

}

KOR_remove_replaced_advisor_2_effects = {
	custom_effect_tooltip = {
		localization_key = KOR_replace_ascended_advisor_tt
		CHARACTER = [GetKorAscendedAdvisorName2]
		TRAIT = [GetTFRKORAscendedAdvisorTrait2]
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_2 = 2 }
		}
		remove_ideas = KOR_Hong_joon_pyo_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_2 = 3 }
		}
		remove_ideas = KOR_yoon_sang_hyun_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_2 = 4 }
		}
		remove_ideas = KOR_choo_kyung_ho_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_2 = 5 }
		}
		remove_ideas = KOR_ahn_cheol_soo_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_2 = 6 }
		}
		remove_ideas = KOR_kim_chong_in_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_2 = 7 }
		}
		remove_ideas = KOR_lee_sang_min_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_2 = 8 }
		}
		remove_ideas = KOR_yoo_seong_min_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_2 = 9 }
		}
		remove_ideas = KOR_han_dong_hoon_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_2 = 10 }
		}
		remove_ideas = KOR_chang_Je_won_ns
	}

}

KOR_remove_replaced_advisor_3_effects = {
	custom_effect_tooltip = {
		localization_key = KOR_replace_ascended_advisor_tt
		CHARACTER = [GetKorAscendedAdvisorName3]
		TRAIT = [GetTFRKORAscendedAdvisorTrait3]
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_3 = 2 }
		}
		remove_ideas = KOR_Hong_joon_pyo_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_3 = 3 }
		}
		remove_ideas = KOR_yoon_sang_hyun_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_3 = 4 }
		}
		remove_ideas = KOR_choo_kyung_ho_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_3 = 5 }
		}
		remove_ideas = KOR_ahn_cheol_soo_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_3 = 6 }
		}
		remove_ideas = KOR_kim_chong_in_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_3 = 7 }
		}
		remove_ideas = KOR_lee_sang_min_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_3 = 8 }
		}
		remove_ideas = KOR_yoo_seong_min_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_3 = 9 }
		}
		remove_ideas = KOR_han_dong_hoon_ns
	}
	if = {
		limit = { 
			check_variable = { TFR_KOR_ascended_advisor_3 = 10 }
		}
		remove_ideas = KOR_chang_Je_won_ns
	}

}

KOR_add_replace_adviosr_effects = {
	# 홍준표
	if = {
		limit = {
			check_variable = { TFR_KOR_ascending_advisor = 2 }
		}
		add_ideas = KOR_Hong_joon_pyo_ns
	}
	# 윤상현
	if = {
		limit = {
			check_variable = { TFR_KOR_ascending_advisor = 3 }
		}
		add_ideas = KOR_yoon_sang_hyun_ns
	}
	# 추경호
	if = {
		limit = {
			check_variable = { TFR_KOR_ascending_advisor = 4 }
		}
		add_ideas = KOR_choo_kyung_ho_ns
	}
	# 안철수
	if = {
		limit = {
			check_variable = { TFR_KOR_ascending_advisor = 5 }
		}
		add_ideas = KOR_ahn_cheol_soo_ns
	}
	# 김종인
	if = {
		limit = {
			check_variable = { TFR_KOR_ascending_advisor = 6 }
		}
		add_ideas = KOR_kim_chong_in_ns
	}
	# 이상민
	if = {
		limit = {
			check_variable = { TFR_KOR_ascending_advisor = 7 }
		}
		add_ideas = KOR_lee_sang_min_ns
	}
	# 유승민
	if = {
		limit = {
			check_variable = { TFR_KOR_ascending_advisor = 8 }
		}
		add_ideas = KOR_yoo_seong_min_ns
	}
	# 한동훈
	if = {
		limit = {
			check_variable = { TFR_KOR_ascending_advisor = 9 }
		}
		add_ideas = KOR_han_dong_hoon_ns
	}
	# 장제원
	if = {
		limit = {
			check_variable = { TFR_KOR_ascending_advisor = 10 }
		}
		add_ideas = KOR_chang_Je_won_ns
	}
	# 장제원
	if = {
		limit = {
			check_variable = { TFR_KOR_ascending_advisor = 11 }
		}
		add_ideas = KOR_lee_jun_seok_ns
	}
}

KOR_martial_law_countdown_change_effect = {
	add_to_variable = { KOR_martial_law_countdown_var = KOR_martial_law_countdown_var_temp }
	clamp_variable = { var = KOR_martial_law_countdown_var min = 0 max = 100 }
	custom_effect_tooltip = KOR_martial_law_countdown_change_tooltip
}

KOR_korea_yoon_delete_change_effect = {
	add_to_variable = { KOR_korea_yoon_delete_var = KOR_korea_yoon_delete_var_temp }
	clamp_variable = { var = KOR_korea_yoon_delete_var min = 0 max = 100 }
	custom_effect_tooltip = KOR_korea_yoon_delete_change_tooltip
}

KOR_korea_yoon_delete_hunjae_change_effect = {
	add_to_variable = { KOR_korea_yoon_delete_hunjae_var = KOR_korea_yoon_delete_hunjae_var_temp }
	clamp_variable = { var = KOR_korea_yoon_delete_hunjae_var min = 0 max = 100 }
	custom_effect_tooltip = KOR_korea_yoon_delete_hunjae_change_tooltip
}

KOR_aging_population_good_effect = {
	if = {
		limit = {
			has_idea = KOR_aging_population_idea
		}
		swap_ideas = {
			add_idea = KOR_aging_population_idea_2
			remove_idea = KOR_aging_population_idea
		}
	}
	else_if = {
		limit = {
			has_idea = KOR_aging_population_idea_2
		}
		swap_ideas = {
			add_idea = KOR_aging_population_idea_3
			remove_idea = KOR_aging_population_idea_2
		}
	}
	else_if = {
		limit = {
			has_idea = KOR_aging_population_idea_3
		}
		swap_ideas = {
			add_idea = KOR_aging_population_idea_4
			remove_idea = KOR_aging_population_idea_3
		}
	}
	else_if = {
		limit = {
			has_idea = KOR_aging_population_idea_4
		}
		swap_ideas = {
			add_idea = KOR_aging_population_idea_5
			remove_idea = KOR_aging_population_idea_4
		}
	}
	else_if = {
		limit = {
			has_idea = KOR_aging_population_idea_5
		}
		add_political_power = 150
		add_stability = 0.1
	}
}

KOR_aging_population_bad_effect = {
	if = {
		limit = {
			has_idea = KOR_aging_population_idea
		}
		add_political_power = -150
		add_stability = -0.1
	}
	else_if = {
		limit = {
			has_idea = KOR_aging_population_idea_2
		}
		swap_ideas = {
			add_idea = KOR_aging_population_idea
			remove_idea = KOR_aging_population_idea_2
		}
	}
	else_if = {
		limit = {
			has_idea = KOR_aging_population_idea_3
		}
		swap_ideas = {
			add_idea = KOR_aging_population_idea_2
			remove_idea = KOR_aging_population_idea_3
		}
	}
	else_if = {
		limit = {
			has_idea = KOR_aging_population_idea_4
		}
		swap_ideas = {
			add_idea = KOR_aging_population_idea_3
			remove_idea = KOR_aging_population_idea_4
		}
	}
	else_if = {
		limit = {
			has_idea = KOR_aging_population_idea_5
		}
		swap_ideas = {
			add_idea = KOR_aging_population_idea_4
			remove_idea = KOR_aging_population_idea_5
		}
	}
}
KOR_aging_population_check_up_effect = {
	clamp_variable = {
		var = KOR_korea_no_sex_var
		min = 0
		max = 50
	}
	if = {
		limit = {
			OR = {
				check_variable = { KOR_korea_no_sex_var = 10 }
				check_variable = { KOR_korea_no_sex_var = 20 }
				check_variable = { KOR_korea_no_sex_var = 30 }
				check_variable = { KOR_korea_no_sex_var = 40 }
				check_variable = { KOR_korea_no_sex_var = 50 }
			}
		}
		KOR_aging_population_good_effect = yes
	}
}

launch_big_nuke = {
	# goto_province = 13692
	create_entity = { 
		entity = nuke_big_entity
		id = 1
		province = 13692
		min_zoom = -1
		scale = 10
	}
	set_entity_animation = {
		id = 1
		animation = "attack"
	}
}

launch_mini_nuke = {
	# goto_province = 14242
	create_entity = { 
		entity = nuke_entity
		id = 2
		x = 40
		y = -10
		province = 14242
		min_zoom = -1
		scale = 0.4
	}
	set_entity_animation = {
		id = 2
		animation = "attack"
	}
}