Change_Papuan_Seperatism = {
	if = {
		limit = {
			check_variable = {
				boolpositivechange = 1
			}
		}
		subtract_from_variable = {
			INS_Papuan_Strength = tempvar
			tooltip = INS_papuan_positive_decrease_tooltip
		}
		clamp_variable = {
			var = INS_Papuan_Strength
			min = 0
			max = 100
		}
	}
	else_if = {
		limit = {
			check_variable = {
				boolpositivechange = 0
			}
		}
		add_to_variable = {
			INS_Papuan_Strength = tempvar
			tooltip = INS_papuan_negative_increase_tooltip
		}
		clamp_variable = {
			var = INS_Papuan_Strength
			min = 0
			max = 100
		}
	}
}

Change_Second_Confrontation_Tension = {
	if = {
		limit = {
			check_variable = {
				boolpositivechange = 1
			}
		}
		subtract_from_variable = {
			INS_confrontation_var = tempvar
			tooltip = INS_confrontation_decrease_tooltip
		}
		clamp_variable = {
			var = INS_confrontation_var
			min = 0
			max = 15
		}
	}
	else_if = {
		limit = {
			check_variable = {
				boolpositivechange = 0
			}
		}
		add_to_variable = {
			INS_confrontation_var = tempvar
			tooltip = INS_confrontation_increase_tooltip
		}
		clamp_variable = {
			var = INS_confrontation_var
			min = 0
			max = 15
		}
	}
}

Increase_Party_Popularity = {
	if = {
		limit = { check_variable = { parties = 1 } }
		add_to_variable = { INS_Party_PSI_Popularity = partyvar }
		clamp_variable = { var = INS_Party_PSI_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_PSI_increase_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 2 } }
		add_to_variable = { INS_Party_PDIP_Popularity = partyvar }
		clamp_variable = { var = INS_Party_PDIP_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_PDIP_increase_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 3 } }
		add_to_variable = { INS_Party_NasDem_Popularity = partyvar }
		clamp_variable = { var = INS_Party_NasDem_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_NasDem_increase_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 4 } }
		add_to_variable = { INS_Party_PKB_Popularity = partyvar }
		clamp_variable = { var = INS_Party_PKB_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_PKB_increase_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 5 } }
		add_to_variable = { INS_Party_PPP_Popularity = partyvar }
		clamp_variable = { var = INS_Party_PPP_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_PPP_increase_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 6 } }
		add_to_variable = { INS_Party_Demokrat_Popularity = partyvar }
		clamp_variable = { var = INS_Party_Demokrat_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_Demokrat_increase_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 7 } }
		add_to_variable = { INS_Party_PAN_Popularity = partyvar }
		clamp_variable = { var = INS_Party_PAN_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_PAN_increase_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 8 } }
		add_to_variable = { INS_Party_Golkar_Popularity = partyvar }
		clamp_variable = { var = INS_Party_Golkar_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_Golkar_increase_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 9 } }
		add_to_variable = { INS_Party_Gerindra_Popularity = partyvar }
		clamp_variable = { var = INS_Party_Gerindra_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_Gerindra_increase_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 10 } }
		add_to_variable = { INS_Party_PKS_Popularity = partyvar }
		clamp_variable = { var = INS_Party_PKS_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_PKS_increase_tooltip
		
		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 11 } }
		add_to_variable = { INS_Group_Labor_Popularity = partyvar }
		clamp_variable = { var = INS_Group_Labor_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Group_Labor_increase_tooltip
	}
	else_if = {
		limit = { check_variable = { parties = 12 } }
		add_to_variable = { INS_Group_FPI_Popularity = partyvar }
		clamp_variable = { var = INS_Group_FPI_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Group_FPI_increase_tooltip
	}
	else_if = {
		limit = { check_variable = { parties = 13 } }
		add_to_variable = { INS_Group_Police_Popularity = partyvar }
		clamp_variable = { var = INS_Group_Police_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Group_Police_increase_tooltip
	}
	else_if = {
		limit = { check_variable = { parties = 14 } }
		add_to_variable = { INS_Group_Army_Popularity = partyvar }
		clamp_variable = { var = INS_Group_Army_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Group_Army_increase_tooltip
	}
}

INS_Run_DPR_Election = {
	set_temp_variable = { var = total_support value = 0 } #threshold support 10%

	if = { limit = { check_variable = { var = INS_Party_PSI_Popularity value > 10 } }
		add_to_temp_variable = { var = total_support value = INS_Party_PSI_Popularity }
	}
	if = { limit = { check_variable = { var = INS_Party_PDIP_Popularity value > 10 } }
		add_to_temp_variable = { var = total_support value = INS_Party_PDIP_Popularity }
	}
	if = { limit = { check_variable = { var = INS_Party_NasDem_Popularity value > 10 } }
		add_to_temp_variable = { var = total_support value = INS_Party_NasDem_Popularity }
	}
	if = { limit = { check_variable = { var = INS_Party_PKB_Popularity value > 10 } }
		add_to_temp_variable = { var = total_support value = INS_Party_PKB_Popularity }
	}
	if = { limit = { check_variable = { var = INS_Party_PPP_Popularity value > 10 } }
		add_to_temp_variable = { var = total_support value = INS_Party_PPP_Popularity }
	}
	if = { limit = { check_variable = { var = INS_Party_Demokrat_Popularity value > 10 } }
		add_to_temp_variable = { var = total_support value = INS_Party_Demokrat_Popularity }
	}
	if = { limit = { check_variable = { var = INS_Party_PAN_Popularity value > 10 } }
		add_to_temp_variable = { var = total_support value = INS_Party_PAN_Popularity }
	}
	if = { limit = { check_variable = { var = INS_Party_Golkar_Popularity value > 10 } }
		add_to_temp_variable = { var = total_support value = INS_Party_Golkar_Popularity }
	}
	if = { limit = { check_variable = { var = INS_Party_Gerindra_Popularity value > 10 } }
		add_to_temp_variable = { var = total_support value = INS_Party_Gerindra_Popularity }
	}
	if = { limit = { check_variable = { var = INS_Party_PKS_Popularity value > 10 } }
		add_to_temp_variable = { var = total_support value = INS_Party_PKS_Popularity }
	}

	# PSI
	if = { limit = { check_variable = { var = INS_Party_PSI_Popularity value > 10 } }
		set_temp_variable = { var = seat_temp value = INS_Party_PSI_Popularity }
		divide_temp_variable = { var = seat_temp value = total_support }
		multiply_temp_variable = { var = seat_temp value = INS_Total_DPR_Seat }
		set_variable = { var = INS_Party_PSI_Seat value = seat_temp }
		round_variable = INS_Party_PSI_Seat
	}
	else = { set_variable = { var = INS_Party_PSI_Seat value = 0 } }
	# PDIP
	if = { limit = { check_variable = { var = INS_Party_PDIP_Popularity value > 10 } }
		set_temp_variable = { var = seat_temp value = INS_Party_PDIP_Popularity }
		divide_temp_variable = { var = seat_temp value = total_support }
		multiply_temp_variable = { var = seat_temp value = INS_Total_DPR_Seat }
		set_variable = { var = INS_Party_PDIP_Seat value = seat_temp }
		round_variable = INS_Party_PDIP_Seat
	}
	else = { set_variable = { var = INS_Party_PDIP_Seat value = 0 } }
	# NasDem
	if = { limit = { check_variable = { var = INS_Party_NasDem_Popularity value > 10 } }
		set_temp_variable = { var = seat_temp value = INS_Party_NasDem_Popularity }
		divide_temp_variable = { var = seat_temp value = total_support }
		multiply_temp_variable = { var = seat_temp value = INS_Total_DPR_Seat }
		set_variable = { var = INS_Party_NasDem_Seat value = seat_temp }
		round_variable = INS_Party_NasDem_Seat
	}
	else = { set_variable = { var = INS_Party_NasDem_Seat value = 0 } }
	# PKB
	if = { limit = { check_variable = { var = INS_Party_PKB_Popularity value > 10 } }
		set_temp_variable = { var = seat_temp value = INS_Party_PKB_Popularity }
		divide_temp_variable = { var = seat_temp value = total_support }
		multiply_temp_variable = { var = seat_temp value = INS_Total_DPR_Seat }
		set_variable = { var = INS_Party_PKB_Seat value = seat_temp }
		round_variable = INS_Party_PKB_Seat
	}
	else = { set_variable = { var = INS_Party_PKB_Seat value = 0 } }
	# PPP
	if = { limit = { check_variable = { var = INS_Party_PPP_Popularity value > 10 } }
		set_temp_variable = { var = seat_temp value = INS_Party_PPP_Popularity }
		divide_temp_variable = { var = seat_temp value = total_support }
		multiply_temp_variable = { var = seat_temp value = INS_Total_DPR_Seat }
		set_variable = { var = INS_Party_PPP_Seat value = seat_temp }
		round_variable = INS_Party_PPP_Seat
	}
	else = { set_variable = { var = INS_Party_PPP_Seat value = 0 } }
	# Demokrat
	if = { limit = { check_variable = { var = INS_Party_Demokrat_Popularity value > 10 } }
		set_temp_variable = { var = seat_temp value = INS_Party_Demokrat_Popularity }
		divide_temp_variable = { var = seat_temp value = total_support }
		multiply_temp_variable = { var = seat_temp value = INS_Total_DPR_Seat }
		set_variable = { var = INS_Party_Demokrat_Seat value = seat_temp }
		round_variable = INS_Party_Demokrat_Seat
	}
	else = { set_variable = { var = INS_Party_Demokrat_Seat value = 0 } }
	# PAN
	if = { limit = { check_variable = { var = INS_Party_PAN_Popularity value > 10 } }
		set_temp_variable = { var = seat_temp value = INS_Party_PAN_Popularity }
		divide_temp_variable = { var = seat_temp value = total_support }
		multiply_temp_variable = { var = seat_temp value = INS_Total_DPR_Seat }
		set_variable = { var = INS_Party_PAN_Seat value = seat_temp }
		round_variable = INS_Party_PAN_Seat
	}
	else = { set_variable = { var = INS_Party_PAN_Seat value = 0 } }
	# Golkar
	if = { limit = { check_variable = { var = INS_Party_Golkar_Popularity value > 10 } }
		set_temp_variable = { var = seat_temp value = INS_Party_Golkar_Popularity }
		divide_temp_variable = { var = seat_temp value = total_support }
		multiply_temp_variable = { var = seat_temp value = INS_Total_DPR_Seat }
		set_variable = { var = INS_Party_Golkar_Seat value = seat_temp }
		round_variable = INS_Party_Golkar_Seat
	}
	else = { set_variable = { var = INS_Party_Golkar_Seat value = 0 } }
	# Gerindra
	if = { limit = { check_variable = { var = INS_Party_Gerindra_Popularity value > 10 } }
		set_temp_variable = { var = seat_temp value = INS_Party_Gerindra_Popularity }
		divide_temp_variable = { var = seat_temp value = total_support }
		multiply_temp_variable = { var = seat_temp value = INS_Total_DPR_Seat }
		set_variable = { var = INS_Party_Gerindra_Seat value = seat_temp }
		round_variable = INS_Party_Gerindra_Seat
	}
	else = { set_variable = { var = INS_Party_Gerindra_Seat value = 0 } }
	# PKS
	if = { limit = { check_variable = { var = INS_Party_PKS_Popularity value > 10 } }
		set_temp_variable = { var = seat_temp value = INS_Party_PKS_Popularity }
		divide_temp_variable = { var = seat_temp value = total_support }
		multiply_temp_variable = { var = seat_temp value = INS_Total_DPR_Seat }
		set_variable = { var = INS_Party_PKS_Seat value = seat_temp }
		round_variable = INS_Party_PKS_Seat
	}
	else = { set_variable = { var = INS_Party_PKS_Seat value = 0 } }


	set_temp_variable = { var = total_seats value = 0 }
	add_to_temp_variable = { var = total_seats value = INS_Party_PDIP_Seat }
	add_to_temp_variable = { var = total_seats value = INS_Party_Golkar_Seat }
	add_to_temp_variable = { var = total_seats value = INS_Party_Gerindra_Seat }
	add_to_temp_variable = { var = total_seats value = INS_Party_NasDem_Seat }
	add_to_temp_variable = { var = total_seats value = INS_Party_PKB_Seat }
	add_to_temp_variable = { var = total_seats value = INS_Party_PPP_Seat }
	add_to_temp_variable = { var = total_seats value = INS_Party_PAN_Seat }
	add_to_temp_variable = { var = total_seats value = INS_Party_Demokrat_Seat }
	add_to_temp_variable = { var = total_seats value = INS_Party_PKS_Seat }
	add_to_temp_variable = { var = total_seats value = INS_Party_PSI_Seat }

	while_loop_effect = {
		limit = { 
			check_variable = { 
				var = total_seats 
				value = INS_Total_DPR_Seat
				compare = less_than
			}
		}
		random_list = {
			1 = { add_to_variable = { var = INS_Party_PDIP_Seat value = 1 } }
			1 = { add_to_variable = { var = INS_Party_PKS_Seat value = 1 } }
			1 = { add_to_variable = { var = INS_Party_Gerindra_Seat value = 1 } }
		}
		add_to_temp_variable = { var = total_seats value = 1 }
	}

	while_loop_effect = {
		limit = { 
			check_variable = { 
				var = total_seats 
				value = INS_Total_DPR_Seat
				compare = greater_than
			}
		}
		random_list = {
			1 = { subtract_from_variable = { var = INS_Party_PDIP_Seat value = 1 } }
			1 = { subtract_from_variable = { var = INS_Party_PKS_Seat value = 1 } }
			1 = { subtract_from_variable = { var = INS_Party_Gerindra_Seat value = 1 } }
		}
		subtract_from_variable = { var = total_seats value = 1 }
	}
}

INS_Gov_Opp_Balancing = {
	# Hitung Total Popularity
	set_temp_variable = { var = totalpopvar value = 0 }
	set_temp_variable = { var = govpopvar value = 0 }
	set_temp_variable = { var = oppopopvar value = 0 }

	# Tambahkan semua popularitas partai
	add_to_temp_variable = { var = totalpopvar value = INS_Party_PSI_Popularity }
	add_to_temp_variable = { var = totalpopvar value = INS_Party_PDIP_Popularity }
	add_to_temp_variable = { var = totalpopvar value = INS_Party_NasDem_Popularity }
	add_to_temp_variable = { var = totalpopvar value = INS_Party_PKB_Popularity }
	add_to_temp_variable = { var = totalpopvar value = INS_Party_PPP_Popularity }
	add_to_temp_variable = { var = totalpopvar value = INS_Party_Demokrat_Popularity }
	add_to_temp_variable = { var = totalpopvar value = INS_Party_PAN_Popularity }
	add_to_temp_variable = { var = totalpopvar value = INS_Party_Golkar_Popularity }
	add_to_temp_variable = { var = totalpopvar value = INS_Party_Gerindra_Popularity }
	add_to_temp_variable = { var = totalpopvar value = INS_Party_PKS_Popularity }

	# Tambahkan popularity partai pemerintah/oposisi
	if = {
		limit = { check_variable = { var = INS_Party_PSI_Loyalty value = 1 compare = less_than } }
		add_to_temp_variable = { var = oppopopvar value = INS_Party_PSI_Popularity }
	}
	else = { add_to_temp_variable = { var = govpopvar value = INS_Party_PSI_Popularity } }
	
	if = {
		limit = { check_variable = { var = INS_Party_PDIP_Loyalty value = 1 compare = less_than } }
		add_to_temp_variable = { var = oppopopvar value = INS_Party_PDIP_Popularity }
	}
	else = { add_to_temp_variable = { var = govpopvar value = INS_Party_PDIP_Popularity } }
		
	if = {
		limit = { check_variable = { var = INS_Party_NasDem_Loyalty value = 1 compare = less_than } }
		add_to_temp_variable = { var = oppopopvar value = INS_Party_NasDem_Popularity }
	}
	else = { add_to_temp_variable = { var = govpopvar value = INS_Party_NasDem_Popularity } }
			
	if = {
		limit = { check_variable = { var = INS_Party_PKB_Loyalty value = 1 compare = less_than } }
		add_to_temp_variable = { var = oppopopvar value = INS_Party_PKB_Popularity }
	}
	else = { add_to_temp_variable = { var = govpopvar value = INS_Party_PKB_Popularity } }
			
	if = {
		limit = { check_variable = { var = INS_Party_PPP_Loyalty value = 1 compare = less_than } }
		add_to_temp_variable = { var = oppopopvar value = INS_Party_PPP_Popularity }
	}
	else = { add_to_temp_variable = { var = govpopvar value = INS_Party_PPP_Popularity } }

	if = {
		limit = { check_variable = { var = INS_Party_Demokrat_Loyalty value = 1 compare = less_than } }
		add_to_temp_variable = { var = oppopopvar value = INS_Party_Demokrat_Popularity }
	}
	else = { add_to_temp_variable = { var = govpopvar value = INS_Party_Demokrat_Popularity } }

	if = {
		limit = { check_variable = { var = INS_Party_PAN_Loyalty value = 1 compare = less_than } }
		add_to_temp_variable = { var = oppopopvar value = INS_Party_PAN_Popularity }
	}
	else = { add_to_temp_variable = { var = govpopvar value = INS_Party_PAN_Popularity } }

	if = {
		limit = { check_variable = { var = INS_Party_Golkar_Loyalty value = 1 compare = less_than } }
		add_to_temp_variable = { var = oppopopvar value = INS_Party_Golkar_Popularity }
	}
	else = { add_to_temp_variable = { var = govpopvar value = INS_Party_Golkar_Popularity } }

	if = {
		limit = { check_variable = { var = INS_Party_Gerindra_Loyalty value = 1 compare = less_than } }
		add_to_temp_variable = { var = oppopopvar value = INS_Party_Gerindra_Popularity }
	}
	else = { add_to_temp_variable = { var = govpopvar value = INS_Party_Gerindra_Popularity } }

	if = {
		limit = { check_variable = { var = INS_Party_PKS_Loyalty value = 1 compare = less_than } }
		add_to_temp_variable = { var = oppopopvar value = INS_Party_PKS_Popularity }
	}
	else = { add_to_temp_variable = { var = govpopvar value = INS_Party_PKS_Popularity } }

	# Hitung persentase Government Support
	set_variable = { var = INS_Government_Popularity value = govpopvar }
	divide_variable = {
		var = INS_Government_Popularity
		value = totalpopvar
	}
	multiply_variable = {
		var = INS_Government_Popularity
		value = 100
	}

	# Hitung persentase Opposition Support
	set_variable = { var = INS_Opposition_Popularity value = oppopopvar }
	divide_variable = {
		var = INS_Opposition_Popularity
		value = totalpopvar
	}
	multiply_variable = {
		var = INS_Opposition_Popularity
		value = 100
	}
}

Decrease_Party_Popularity = {
	if = {
		limit = { check_variable = { parties = 1 } }
		subtract_from_variable = { INS_Party_PSI_Popularity = partyvar }
		clamp_variable = { var = INS_Party_PSI_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_PSI_decrease_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 2 } }
		subtract_from_variable = { INS_Party_PDIP_Popularity = partyvar }
		clamp_variable = { var = INS_Party_PDIP_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_PDIP_decrease_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 3 } }
		subtract_from_variable = { INS_Party_NasDem_Popularity = partyvar }
		clamp_variable = { var = INS_Party_NasDem_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_NasDem_decrease_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 4 } }
		subtract_from_variable = { INS_Party_PKB_Popularity = partyvar }
		clamp_variable = { var = INS_Party_PKB_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_PKB_decrease_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 5 } }
		subtract_from_variable = { INS_Party_PPP_Popularity = partyvar }
		clamp_variable = { var = INS_Party_PPP_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_PPP_decrease_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 6 } }
		subtract_from_variable = { INS_Party_Demokrat_Popularity = partyvar }
		clamp_variable = { var = INS_Party_Demokrat_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_Demokrat_decrease_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 7 } }
		subtract_from_variable = { INS_Party_PAN_Popularity = partyvar }
		clamp_variable = { var = INS_Party_PAN_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_PAN_decrease_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 8 } }
		subtract_from_variable = { INS_Party_Golkar_Popularity = partyvar }
		clamp_variable = { var = INS_Party_Golkar_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_Golkar_decrease_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 9 } }
		subtract_from_variable = { INS_Party_Gerindra_Popularity = partyvar }
		clamp_variable = { var = INS_Party_Gerindra_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_Gerindra_decrease_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 10 } }
		subtract_from_variable = { INS_Party_PKS_Popularity = partyvar }
		clamp_variable = { var = INS_Party_PKS_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Party_PKS_decrease_tooltip

		INS_Gov_Opp_Balancing = yes
	}
	else_if = {
		limit = { check_variable = { parties = 11 } }
		subtract_from_variable = { INS_Group_Labor_Popularity = partyvar }
		clamp_variable = { var = INS_Group_Labor_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Group_Labor_decrease_tooltip
	}
	else_if = {
		limit = { check_variable = { parties = 12 } }
		subtract_from_variable = { INS_Group_FPI_Popularity = partyvar }
		clamp_variable = { var = INS_Group_FPI_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Group_FPI_decrease_tooltip
	}
	else_if = {
		limit = { check_variable = { parties = 13 } }
		subtract_from_variable = { INS_Group_Police_Popularity = partyvar }
		clamp_variable = { var = INS_Group_Police_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Group_Police_decrease_tooltip
	}
	else_if = {
		limit = { check_variable = { parties = 14 } }
		subtract_from_variable = { INS_Group_Army_Popularity = partyvar }
		clamp_variable = { var = INS_Group_Army_Popularity min = 0 max = 100 }
		custom_effect_tooltip = INS_Group_Army_decrease_tooltip
	}
}

Add_Anies_Islamic_Legitimacy = {
	if = {
		limit = {
			check_variable = {
				boolpositivechange = 1
			}
		}
		if = {
			limit = {
				check_variable = { sidevar = 1 }
			}
			add_to_variable = {
				var = INS_islamic_legit_var
				value = tempvar
			}
			clamp_variable = { var = INS_islamic_legit_var min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_islamic_positive_tooltip
		}
		else_if = {
			limit = {
				check_variable = { sidevar = 2 }
			}
			add_to_variable = {
				var = INS_islamic_moderate_group_var
				value = tempvar
			}
			clamp_variable = { var = INS_islamic_moderate_group_var min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_islamic_moderate_positive_tooltip
		}
		else_if = {
			limit = {
				check_variable = { sidevar = 3 }
			}
			add_to_variable = {
				var = INS_islamic_radical_group_var
				value = tempvar
			}
			clamp_variable = { var = INS_islamic_radical_group_var min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_islamic_radical_positive_tooltip
		}
	}
	else_if = {
		limit = {
			check_variable = {
				boolpositivechange = 0
			}
		}
		if = {
			limit = {
				check_variable = { sidevar = 1 }
			}
			subtract_from_variable = {
				var = INS_islamic_legit_var
				value = tempvar
			}
			clamp_variable = { var = INS_islamic_legit_var min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_islamic_negative_tooltip
		}
		else_if = {
			limit = {
				check_variable = { sidevar = 2 }
			}
			subtract_from_variable = {
				var = INS_islamic_moderate_group_var
				value = tempvar
			}
			clamp_variable = { var = INS_islamic_moderate_group_var min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_islamic_moderate_negative_tooltip
		}
		else_if = {
			limit = {
				check_variable = { sidevar = 3 }
			}
			subtract_from_variable = {
				var = INS_islamic_radical_group_var
				value = tempvar
			}
			clamp_variable = { var = INS_islamic_radical_group_var min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_islamic_radical_negative_tooltip
		}
	}
}

Add_Anies_Federalization_Progress = {
	if = {
		limit = {
			check_variable = {
				boolpositivechange = 1
			}
		}
		if = {
			limit = { check_variable = { provincevar = 672 } }
			add_to_variable = {
				var = INS_federal_sumatra_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_sumatra_var min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_positive_tooltip
			Totaling_Anies_Federalization_Progress = yes 
		}
		else_if = {
			limit = { check_variable = { provincevar = 335 } }
			add_to_variable = {
				var = INS_federal_java_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_java_var	min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_positive_tooltip
			Totaling_Anies_Federalization_Progress = yes
		}
		else_if = {
			limit = { check_variable = { provincevar = 667 } }
			add_to_variable = {
				var = INS_federal_lessersunda_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_lessersunda_var	min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_positive_tooltip
			Totaling_Anies_Federalization_Progress = yes
		}
		else_if = {
			limit = { check_variable = { provincevar = 334 } }
			add_to_variable = {
				var = INS_federal_kalimantan_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_kalimantan_var	min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_positive_tooltip
			Totaling_Anies_Federalization_Progress = yes
		}
		else_if = {
			limit = { check_variable = { provincevar = 673 } }
			add_to_variable = {
				var = INS_federal_sulawesi_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_sulawesi_var	min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_positive_tooltip
			Totaling_Anies_Federalization_Progress = yes
		}
		else_if = {
			limit = { check_variable = { provincevar = 668 } }
			add_to_variable = {
				var = INS_federal_moluccas_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_moluccas_var	min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_positive_tooltip
			Totaling_Anies_Federalization_Progress = yes
		}
		else_if = {
			limit = { check_variable = { provincevar = 738 } }
			add_to_variable = {
				var = INS_federal_aru_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_aru_var	min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_positive_tooltip
			Totaling_Anies_Federalization_Progress = yes
		}
		else_if = {
			limit = { check_variable = { provincevar = 669 } }
			add_to_variable = {
				var = INS_federal_westpapua_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_westpapua_var	min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_positive_tooltip
			Totaling_Anies_Federalization_Progress = yes
		}
	}
	else_if = {
		limit = {
			check_variable = {
				boolpositivechange = 0
			}
		}
		if = {
			limit = { check_variable = { provincevar = 672 } }
			subtract_from_variable = {
				var = INS_federal_sumatra_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_sumatra_var min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_negative_tooltip
			Totaling_Anies_Federalization_Progress = yes
		}
		else_if = {
			limit = { check_variable = { provincevar = 335 } }
			subtract_from_variable = {
				var = INS_federal_java_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_java_var	min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_negative_tooltip
			Totaling_Anies_Federalization_Progress = yes
		}
		else_if = {
			limit = { check_variable = { provincevar = 667 } }
			subtract_from_variable = {
				var = INS_federal_lessersunda_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_lessersunda_var	min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_negative_tooltip
			Totaling_Anies_Federalization_Progress = yes
		}
		else_if = {
			limit = { check_variable = { provincevar = 334 } }
			subtract_from_variable = {
				var = INS_federal_kalimantan_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_kalimantan_var	min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_negative_tooltip
			Totaling_Anies_Federalization_Progress = yes
		}
		else_if = {
			limit = { check_variable = { provincevar = 673 } }
			subtract_from_variable = {
				var = INS_federal_sulawesi_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_sulawesi_var	min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_negative_tooltip
			Totaling_Anies_Federalization_Progress = yes
		}
		else_if = {
			limit = { check_variable = { provincevar = 668 } }
			subtract_from_variable = {
				var = INS_federal_moluccas_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_moluccas_var	min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_negative_tooltip
			Totaling_Anies_Federalization_Progress = yes
		}
		else_if = {
			limit = { check_variable = { provincevar = 738 } }
			subtract_from_variable = {
				var = INS_federal_aru_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_aru_var	min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_negative_tooltip
			Totaling_Anies_Federalization_Progress = yes
		}
		else_if = {
			limit = { check_variable = { provincevar = 669 } }
			subtract_from_variable = {
				var = INS_federal_westpapua_var
				value = tempvar
			}
			clamp_variable = { var = INS_federal_westpapua_var	min = 0 max = 100 }
			custom_effect_tooltip = INS_anies_toward_liberal_negative_tooltip
			Totaling_Anies_Federalization_Progress = yes
		}
	}
}

Totaling_Anies_Federalization_Progress = {
	set_temp_variable       = { INS_federal_total_raw = 0 }
	add_to_temp_variable    = { var = INS_federal_total_raw  value = INS_federal_sumatra_var }
	add_to_temp_variable    = { var = INS_federal_total_raw  value = INS_federal_java_var }
	add_to_temp_variable    = { var = INS_federal_total_raw  value = INS_federal_lessersunda_var }
	add_to_temp_variable    = { var = INS_federal_total_raw  value = INS_federal_kalimantan_var }
	add_to_temp_variable    = { var = INS_federal_total_raw  value = INS_federal_sulawesi_var }
	add_to_temp_variable    = { var = INS_federal_total_raw  value = INS_federal_moluccas_var }
	add_to_temp_variable    = { var = INS_federal_total_raw  value = INS_federal_aru_var }
	add_to_temp_variable    = { var = INS_federal_total_raw  value = INS_federal_westpapua_var }

	#perhitungan
	set_variable = { var = INS_Toward_Liberal_Value value = INS_federal_total_raw }
	divide_variable = {
		var = INS_Toward_Liberal_Value
		value = 8
	}
}

Add_Anies_Power = {
	if = {
		limit = { check_variable = { var = power_points value = 0 compare = less_than } }
		custom_effect_tooltip = INS_Anies_decrease_tooltip
	}
	else = { custom_effect_tooltip = INS_Anies_increase_tooltip }

    add_to_variable = { var = INS_Anies_Power_Value value = power_points }
	clamp_variable = { var = INS_Anies_Power_Value min = 0 max = 100 }

	if = { limit = { has_country_flag = INS_Near_Election_2024_flag } 
		set_temp_variable = { var = total_opponents value = INS_Prabowo_Power_Value }
		add_to_temp_variable = { var = total_opponents value = INS_Ganjar_Power_Value }

		if = { limit = { check_variable = { var = total_opponents value = 0 compare = greater_than } }
			set_temp_variable = { var = temp_share value = INS_Prabowo_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			subtract_from_variable = { var = INS_Prabowo_Power_Value value = temp_share }

			set_temp_variable = { var = temp_share value = INS_Ganjar_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			subtract_from_variable = { var = INS_Ganjar_Power_Value value = temp_share }
		}
	}
	else = {
		set_temp_variable = { var = total_opponents value = INS_Prabowo_Power_Value }
		add_to_temp_variable = { var = total_opponents value = INS_Ganjar_Power_Value }
		add_to_temp_variable = { var = total_opponents value = INS_Jokowi_Power_Value }

		if = { limit = { check_variable = { var = total_opponents value = 0 compare = greater_than } }
			set_temp_variable = { var = temp_share value = INS_Prabowo_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			subtract_from_variable = { var = INS_Prabowo_Power_Value value = temp_share }

			set_temp_variable = { var = temp_share value = INS_Ganjar_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			subtract_from_variable = { var = INS_Ganjar_Power_Value value = temp_share }

			set_temp_variable = { var = temp_share value = INS_Jokowi_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			subtract_from_variable = { var = INS_Jokowi_Power_Value value = temp_share }
		}
	}
}

Add_Prabowo_Power = {
	if = {
		limit = { check_variable = { var = power_points value = 0 compare = less_than } }
		custom_effect_tooltip = INS_Prabowo_decrease_tooltip
	}
	else = { custom_effect_tooltip = INS_Prabowo_increase_tooltip }

    add_to_variable = { var = INS_Prabowo_Power_Value value = power_points }
	clamp_variable = { var = INS_Prabowo_Power_Value min = 0 max = 100 }

	if = { limit = { has_country_flag = INS_Near_Election_2024_flag } 
		set_temp_variable = { var = total_opponents value = INS_Anies_Power_Value }
		add_to_temp_variable = { var = total_opponents value = INS_Ganjar_Power_Value }

		if = { limit = { check_variable = { var = total_opponents value = 0 compare = greater_than } }
			set_temp_variable = { var = temp_share value = INS_Anies_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			subtract_from_variable = { var = INS_Anies_Power_Value value = temp_share }

			set_temp_variable = { var = temp_share value = INS_Ganjar_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			subtract_from_variable = { var = INS_Ganjar_Power_Value value = temp_share }
		}
	}
	else = {
		set_temp_variable = { var = total_opponents value = INS_Anies_Power_Value }
		add_to_temp_variable = { var = total_opponents value = INS_Ganjar_Power_Value }
		add_to_temp_variable = { var = total_opponents value = INS_Jokowi_Power_Value }

		if = { limit = { check_variable = { var = total_opponents value = 0 compare = greater_than } }
			set_temp_variable = { var = temp_share value = INS_Anies_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			subtract_from_variable = { var = INS_Anies_Power_Value value = temp_share }

			set_temp_variable = { var = temp_share value = INS_Ganjar_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			subtract_from_variable = { var = INS_Ganjar_Power_Value value = temp_share }

			set_temp_variable = { var = temp_share value = INS_Jokowi_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			subtract_from_variable = { var = INS_Jokowi_Power_Value value = temp_share }
		}
	}
}

Add_Ganjar_Power = {
	if = {
		limit = { check_variable = { var = power_points value = 0 compare = less_than } }
		custom_effect_tooltip = INS_Ganjar_decrease_tooltip
	}
	else = { custom_effect_tooltip = INS_Ganjar_increase_tooltip }

    add_to_variable = { var = INS_Ganjar_Power_Value value = power_points }
	clamp_variable = { var = INS_Ganjar_Power_Value min = 0 max = 100 }

	
	if = { limit = { has_country_flag = INS_Near_Election_2024_flag } 
		set_temp_variable = { var = total_opponents value = INS_Anies_Power_Value }
		add_to_temp_variable = { var = total_opponents value = INS_Prabowo_Power_Value }

		if = { limit = { check_variable = { var = total_opponents value = 0 compare = greater_than } }
			set_temp_variable = { var = temp_share value = INS_Anies_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			subtract_from_variable = { var = INS_Anies_Power_Value value = temp_share }

			set_temp_variable = { var = temp_share value = INS_Prabowo_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			subtract_from_variable = { var = INS_Prabowo_Power_Value value = temp_share }
		}
	}
	else = {
		set_temp_variable = { var = total_opponents value = INS_Anies_Power_Value }
		add_to_temp_variable = { var = total_opponents value = INS_Prabowo_Power_Value }
		add_to_temp_variable = { var = total_opponents value = INS_Jokowi_Power_Value }

		if = { limit = { check_variable = { var = total_opponents value = 0 compare = greater_than } }
			set_temp_variable = { var = temp_share value = INS_Anies_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			subtract_from_variable = { var = INS_Anies_Power_Value value = temp_share }

			set_temp_variable = { var = temp_share value = INS_Prabowo_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			subtract_from_variable = { var = INS_Prabowo_Power_Value value = temp_share }

			set_temp_variable = { var = temp_share value = INS_Jokowi_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			subtract_from_variable = { var = INS_Jokowi_Power_Value value = temp_share }
		}
	}
}

Add_Jokowi_Power = {
	if = {
		limit = { check_variable = { var = power_points value = 0 compare = less_than  } }
		custom_effect_tooltip = INS_Jokowi_decrease_tooltip
	}
	else = { custom_effect_tooltip = INS_Jokowi_increase_tooltip }

    add_to_variable = { var = INS_Jokowi_Power_Value value = power_points }
	if = {
		limit = { check_variable = { var = INS_Jokowi_Power_Value value = 100 compare = greater_than } }
		set_variable = { var = INS_Jokowi_Power_Value value = 100 }
	}
    else_if = { 
        limit = { check_variable = { var = INS_Jokowi_Power_Value value = 0 compare = less_than } }
        set_variable = { var = INS_Jokowi_Power_Value value = 0 }
    }

    set_temp_variable = { var = total_opponents value = INS_Anies_Power_Value }
    add_to_temp_variable = { var = total_opponents value = INS_Prabowo_Power_Value }
    add_to_temp_variable = { var = total_opponents value = INS_Ganjar_Power_Value }

    if = { limit = { check_variable = { var = total_opponents value = 0 compare = greater_than } }
        set_temp_variable = { var = temp_share value = INS_Anies_Power_Value }
        divide_temp_variable = { var = temp_share value = total_opponents }
        multiply_temp_variable = { var = temp_share value = power_points }
        subtract_from_variable = { var = INS_Anies_Power_Value value = temp_share }

        set_temp_variable = { var = temp_share value = INS_Prabowo_Power_Value }
        divide_temp_variable = { var = temp_share value = total_opponents }
        multiply_temp_variable = { var = temp_share value = power_points }
        subtract_from_variable = { var = INS_Prabowo_Power_Value value = temp_share }

        set_temp_variable = { var = temp_share value = INS_Ganjar_Power_Value }
        divide_temp_variable = { var = temp_share value = total_opponents }
        multiply_temp_variable = { var = temp_share value = power_points }
        subtract_from_variable = { var = INS_Ganjar_Power_Value value = temp_share }
    }
}

INS_Random_Party_Influence = {
	if = {
		limit = { check_variable = { yoursituation = 1 } } # jokowi period / side oposition

		random_list = {
			45 = {
				set_temp_variable = { partyvar = 1 }

				set_temp_variable = { parties = 2 }
				Increase_Party_Popularity = yes
				set_temp_variable = { parties = 9 }
				Increase_Party_Popularity = yes
				set_temp_variable = { parties = 8 }
				Increase_Party_Popularity = yes
				set_temp_variable = { parties = 3 }
				Increase_Party_Popularity = yes
				set_temp_variable = { parties = 4 }
				Increase_Party_Popularity = yes
				set_temp_variable = { parties = 5 }
				Increase_Party_Popularity = yes
				set_temp_variable = { parties = 7 }
				Increase_Party_Popularity = yes
			}
			45 = {
				set_temp_variable = { partyvar = 1 }
				
				set_temp_variable = { parties = 6 }
				Decrease_Party_Popularity = yes
				set_temp_variable = { parties = 10 }
				Decrease_Party_Popularity = yes
			}
			10 = {
				custom_effect_tooltip = INS_DPR_Nothing_Happens_tooltip
			}
		}
	}
	else_if = {
		limit = { check_variable = { yoursituation = 2 } } # anies period

		random_list = {
			45 ={
				set_temp_variable = { partyvar = 1 }

				set_temp_variable = { parties = 2 }
				Increase_Party_Popularity = yes

				if = {
					limit = { check_variable = { INS_Party_Demokrat_Loyalty = 0 } }
					set_temp_variable = { parties = 6 }
					Increase_Party_Popularity = yes
				}
				else_if = {
					limit = { check_variable = { INS_Party_PKB_Loyalty = 0 } }
					set_temp_variable = { parties = 4 }
					Increase_Party_Popularity = yes
				}

				if = {
					limit = { check_variable = { INS_Party_PAN_Loyalty = 0 } }
					set_temp_variable = { parties = 7 }
					Increase_Party_Popularity = yes
				}
				if = {
					limit = { check_variable = { INS_Party_PPP_Loyalty = 0 } }
					set_temp_variable = { parties = 5 }
					Increase_Party_Popularity = yes
				}

				set_temp_variable = { parties = 8 }
				Increase_Party_Popularity = yes
				set_temp_variable = { parties = 9 }
				Increase_Party_Popularity = yes
			}
			45 = {
				set_temp_variable = { partyvar = 1 }

				set_temp_variable = { parties = 3 }
				Decrease_Party_Popularity = yes

				if = {
					limit = { check_variable = { INS_Party_Demokrat_Loyalty = 1 } }
					set_temp_variable = { parties = 6 }
					Decrease_Party_Popularity = yes
				}
				else_if = {
					limit = { check_variable = { INS_Party_PKB_Loyalty = 1 } }
					set_temp_variable = { parties = 4 }
					Decrease_Party_Popularity = yes
				}
				
				set_temp_variable = { parties = 10 }
				Decrease_Party_Popularity = yes
			}
			10 = {
				custom_effect_tooltip = INS_DPR_Nothing_Happens_tooltip
			}
		}
	}
}

INS_Syncroning_Power_Value = {
	if = {
		limit = {
			check_variable = {
				stage_var  = 1
			}
		}
		set_temp_variable = { var = total_opponents value = 0 }
		add_to_temp_variable = { var = total_opponents value = INS_Anies_Power_Value }
		add_to_temp_variable = { var = total_opponents value = INS_Ganjar_Power_Value }
		add_to_temp_variable = { var = total_opponents value = INS_Prabowo_Power_Value }

		set_temp_variable = { var = power_points value = INS_Jokowi_Power_Value }

		subtract_from_variable = { var = INS_Jokowi_Power_Value value = INS_Jokowi_Power_Value }

		if = {
			limit = { check_variable = { var = total_opponents value > 0 } }

			set_temp_variable = { var = temp_share value = INS_Anies_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			add_to_variable = { var = INS_Anies_Power_Value value = temp_share }

			set_temp_variable = { var = temp_share value = INS_Ganjar_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			add_to_variable = { var = INS_Ganjar_Power_Value value = temp_share }

			set_temp_variable = { var = temp_share value = INS_Prabowo_Power_Value }
			divide_temp_variable = { var = temp_share value = total_opponents }
			multiply_temp_variable = { var = temp_share value = power_points }
			add_to_variable = { var = INS_Prabowo_Power_Value value = temp_share }
		}
	}
	else_if = {
		limit = {
			check_variable = {
				stage_var  = 2
			}
		}
		if = {
			limit = {
				check_variable = {
					candidatevar = 1 #anies v prabowo
				}
			}
			set_temp_variable = { var = total_opponents value = 0 }
			add_to_temp_variable = { var = total_opponents value = INS_Anies_Power_Value }
			add_to_temp_variable = { var = total_opponents value = INS_Prabowo_Power_Value }

			set_temp_variable = { var = power_points value = INS_Ganjar_Power_Value }

			subtract_from_variable = { var = INS_Ganjar_Power_Value value = INS_Ganjar_Power_Value }

			if = {
				limit = { check_variable = { var = total_opponents value > 0 } }

				set_temp_variable = { var = temp_share value = INS_Anies_Power_Value }
				divide_temp_variable = { var = temp_share value = total_opponents }
				multiply_temp_variable = { var = temp_share value = power_points }
				add_to_variable = { var = INS_Anies_Power_Value value = temp_share }

				set_temp_variable = { var = temp_share value = INS_Prabowo_Power_Value }
				divide_temp_variable = { var = temp_share value = total_opponents }
				multiply_temp_variable = { var = temp_share value = power_points }
				add_to_variable = { var = INS_Prabowo_Power_Value value = temp_share }
			}
		}
		else_if = {
			limit = {
				check_variable = {
					candidatevar = 2 #anies v ganjar
				}
			}
			set_temp_variable = { var = total_opponents value = 0 }
			add_to_temp_variable = { var = total_opponents value = INS_Anies_Power_Value }
			add_to_temp_variable = { var = total_opponents value = INS_Ganjar_Power_Value }

			set_temp_variable = { var = power_points value = INS_Prabowo_Power_Value }

			subtract_from_variable = { var = INS_Prabowo_Power_Value value = INS_Prabowo_Power_Value }

			if = {
				limit = { check_variable = { var = total_opponents value > 0 } }

				set_temp_variable = { var = temp_share value = INS_Anies_Power_Value }
				divide_temp_variable = { var = temp_share value = total_opponents }
				multiply_temp_variable = { var = temp_share value = power_points }
				add_to_variable = { var = INS_Anies_Power_Value value = temp_share }
				
				set_temp_variable = { var = temp_share value = INS_Ganjar_Power_Value }
				divide_temp_variable = { var = temp_share value = total_opponents }
				multiply_temp_variable = { var = temp_share value = power_points }
				add_to_variable = { var = INS_Ganjar_Power_Value value = temp_share }
			}
		}
		else_if = {
			limit = {
				check_variable = {
					candidatevar = 3 #prabowo v ganjar
				}
			}
			set_temp_variable = { var = total_opponents value = 0 }
			add_to_temp_variable = { var = total_opponents value = INS_Prabowo_Power_Value }
			add_to_temp_variable = { var = total_opponents value = INS_Ganjar_Power_Value }

			set_temp_variable = { var = power_points value = INS_Anies_Power_Value }

			subtract_from_variable = { var = INS_Anies_Power_Value value = INS_Anies_Power_Value }

			if = {
				limit = { check_variable = { var = total_opponents value > 0 } }

				set_temp_variable = { var = temp_share value = INS_Prabowo_Power_Value }
				divide_temp_variable = { var = temp_share value = total_opponents }
				multiply_temp_variable = { var = temp_share value = power_points }
				add_to_variable = { var = INS_Prabowo_Power_Value value = temp_share }
				
				set_temp_variable = { var = temp_share value = INS_Ganjar_Power_Value }
				divide_temp_variable = { var = temp_share value = total_opponents }
				multiply_temp_variable = { var = temp_share value = power_points }
				add_to_variable = { var = INS_Ganjar_Power_Value value = temp_share }
			}
		}
	}
}