form_new_nations_category = {

	form_independent_east_germany = {

		icon = generic_form_nation

		#debug#allowed = {
		#	controls_state = 64
		#}

		available = {
			# is_subject = no
			controls_state = 64 #Berlin
		}

		visible = {
			NOT = { original_tag = GER }
			NOT = { original_tag = DDR }
			NOT = { original_tag = WGR }			
			NOT = { has_global_flag = DDR_idea }
			NOT = { has_global_flag = form_united_germany_flag }
			NOT = { has_global_flag = form_european_union_flag }
			controls_state = 64			
		}

		complete_effect = {
			set_global_flag = DDR_idea
			60 = { add_core_of = DDR }
			61 = { add_core_of = DDR }
			64 = { add_core_of = DDR }
			65 = { add_core_of = DDR }
			62 = { add_core_of = DDR }
		}

		ai_will_do = {
			factor = 0
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
		}
	}

	form_independent_west_germany = {

		icon = generic_form_nation

		#debug#allowed = {
		#	controls_state = 55
		#}

		available = {
			# is_subject = no
			controls_state = 55 #Frankfurt
		}

		visible = {
			NOT = { original_tag = GER }
			NOT = { original_tag = DDR }
			NOT = { original_tag = WGR }			
			NOT = { has_global_flag = WGR_idea }
			NOT = { has_global_flag = form_united_germany_flag }
			NOT = { has_global_flag = form_european_union_flag }
			controls_state = 55			
		}

		complete_effect = {
			set_global_flag = WGR_idea
				51 = { add_core_of = WGR }
				42 = { add_core_of = WGR }
				56 = { add_core_of = WGR }
				57 = { add_core_of = WGR }
				55 = { add_core_of = WGR }
				50 = { add_core_of = WGR }
				59 = { add_core_of = WGR }
				58 = { add_core_of = WGR }
				54 = { add_core_of = WGR }
				52 = { add_core_of = WGR }
				53 = { add_core_of = WGR }
		}

		ai_will_do = {
			factor = 0
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
		}
	}


	form_konigsberg = {

		icon = generic_form_nation

		allowed = {
			original_tag = GER
		}

		available = {
			controls_state = 763
		}

		visible = {
			original_tag = GER
			OR = {
				has_global_flag = form_kaliningrad_flag
				has_global_flag = form_krolewiec_flag
				has_global_flag = form_czech_kralovec_flag
				has_global_flag = form_karaliaucius_lit_flag
				has_global_flag = form_karaliaucius_lat_flag
				has_global_flag = form_karaliaucius_est_flag
			}
		}

		complete_effect = {
			set_province_name = { id = 6332 name = "Konigsberg" }
			763 = { add_core_of = ROOT }
			hidden_effect = {
				clr_global_flag = form_kaliningrad_flag
				clr_global_flag = form_krolewiec_flag
				clr_global_flag = form_czech_kralovec_flag
				clr_global_flag = form_karaliaucius_lit_flag
				clr_global_flag = form_karaliaucius_lat_flag
				clr_global_flag = form_karaliaucius_est_flag
			}
			763 = {
				if = {
					limit = { is_core_of = SOV }
					remove_core_of = SOV
				}
				if = {
					limit = { is_core_of = POL }
					remove_core_of = POL
				}
				if = {
					limit = { is_core_of = CZE }
					remove_core_of = CZE
				}
				if = {
					limit = { is_core_of = LIT }
					remove_core_of = LIT
				}
				if = {
					limit = { is_core_of = LAT }
					remove_core_of = LAT
				}
				if = {
					limit = { is_core_of = EST }
					remove_core_of = EST
				}
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	form_czech_kralovec = {

		icon = generic_form_nation

		allowed = {
			original_tag = CZE
		}

		available = {
			controls_state = 763
		}

		visible = {
			original_tag = CZE
			controls_state = 763
			NOT = { has_global_flag = form_czech_kralovec_flag }
		}

		complete_effect = {
			set_province_name = { id = 6332 name = "Kralovec" }
			763 = { add_core_of = ROOT }
			hidden_effect = {
				clr_global_flag = form_kaliningrad_flag
				clr_global_flag = form_krolewiec_flag
				set_global_flag = form_czech_kralovec_flag
				clr_global_flag = form_karaliaucius_lit_flag
				clr_global_flag = form_karaliaucius_lat_flag
				clr_global_flag = form_karaliaucius_est_flag
			}
			763 = {
				if = {
					limit = { is_core_of = SOV }
					remove_core_of = SOV
				}
				if = {
					limit = { is_core_of = POL }
					remove_core_of = POL
				}
				if = {
					limit = { is_core_of = GER }
					remove_core_of = GER
				}
				if = {
					limit = { is_core_of = LIT }
					remove_core_of = LIT
				}
				if = {
					limit = { is_core_of = LAT }
					remove_core_of = LAT
				}
				if = {
					limit = { is_core_of = EST }
					remove_core_of = EST
				}
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	pol_integrates_Krolewiec = {

		icon = generic_form_nation

		allowed = {
			original_tag = POL
		}

		available = {
			controls_state = 763
		}

		visible = {
			original_tag = POL
			NOT = { has_global_flag = form_krolewiec_flag }
		}

		complete_effect = {
			set_province_name = { id = 6332 name = "Krolewiec" }
			763 = { add_core_of = ROOT }
			hidden_effect = {
				set_global_flag = form_krolewiec_flag
				clr_global_flag = form_kaliningrad_flag
				clr_global_flag = form_czech_kralovec_flag
				clr_global_flag = form_karaliaucius_lit_flag
				clr_global_flag = form_karaliaucius_lat_flag
				clr_global_flag = form_karaliaucius_est_flag
			}
			763 = {
				if = {
					limit = { is_core_of = SOV }
					remove_core_of = SOV
				}
				if = {
					limit = { is_core_of = CZE }
					remove_core_of = CZE
				}
				if = {
					limit = { is_core_of = GER }
					remove_core_of = GER
				}
				if = {
					limit = { is_core_of = LIT }
					remove_core_of = LIT
				}
				if = {
					limit = { is_core_of = LAT }
					remove_core_of = LAT
				}
				if = {
					limit = { is_core_of = EST }
					remove_core_of = EST
				}
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	lit_integrates_Krolewiec = {

		icon = generic_form_nation

		allowed = {
			original_tag = LIT
		}

		available = {
			controls_state = 763
		}

		visible = {
			original_tag = LIT
			NOT = { has_global_flag = form_karaliaucius_lit_flag }
		}

		complete_effect = {
			set_province_name = { id = 6332 name = "Karaliaucius" }
			763 = { add_core_of = ROOT }
			hidden_effect = {
				set_global_flag = form_karaliaucius_lit_flag
				clr_global_flag = form_karaliaucius_lat_flag
				clr_global_flag = form_karaliaucius_est_flag
				clr_global_flag = form_krolewiec_flag
				clr_global_flag = form_kaliningrad_flag
				clr_global_flag = form_czech_kralovec_flag
			}
			763 = {
				if = {
					limit = { is_core_of = SOV }
					remove_core_of = SOV
				}
				if = {
					limit = { is_core_of = CZE }
					remove_core_of = CZE
				}
				if = {
					limit = { is_core_of = GER }
					remove_core_of = GER
				}
				if = {
					limit = { is_core_of = POL }
					remove_core_of = POL
				}
				if = {
					limit = { is_core_of = LAT }
					remove_core_of = LAT
				}
				if = {
					limit = { is_core_of = EST }
					remove_core_of = EST
				}
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	lat_integrates_Krolewiec = {

		icon = generic_form_nation

		allowed = {
			original_tag = LAT
		}

		available = {
			controls_state = 763
		}

		visible = {
			original_tag = LAT
			NOT = { has_global_flag = form_karaliaucius_lat_flag }
		}

		complete_effect = {
			set_province_name = { id = 6332 name = "Karaliaucius" }
			763 = { add_core_of = ROOT }
			hidden_effect = {
				clr_global_flag = form_karaliaucius_lit_flag
				set_global_flag = form_karaliaucius_lat_flag
				clr_global_flag = form_karaliaucius_est_flag
				clr_global_flag = form_krolewiec_flag
				clr_global_flag = form_kaliningrad_flag
				clr_global_flag = form_czech_kralovec_flag
			}
			763 = {
				if = {
					limit = { is_core_of = SOV }
					remove_core_of = SOV
				}
				if = {
					limit = { is_core_of = CZE }
					remove_core_of = CZE
				}
				if = {
					limit = { is_core_of = GER }
					remove_core_of = GER
				}
				if = {
					limit = { is_core_of = POL }
					remove_core_of = POL
				}
				if = {
					limit = { is_core_of = LIT }
					remove_core_of = LIT
				}
				if = {
					limit = { is_core_of = EST }
					remove_core_of = EST
				}
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	est_integrates_Krolewiec = {

		icon = generic_form_nation

		allowed = {
			original_tag = EST
		}

		available = {
			controls_state = 763
		}

		visible = {
			original_tag = EST
			NOT = { has_global_flag = form_karaliaucius_est_flag }
		}

		complete_effect = {
			set_province_name = { id = 6332 name = "Karaliaucius" }
			763 = { add_core_of = ROOT }
			hidden_effect = {
				clr_global_flag = form_karaliaucius_lit_flag
				clr_global_flag = form_karaliaucius_lat_flag
				set_global_flag = form_karaliaucius_est_flag
				clr_global_flag = form_krolewiec_flag
				clr_global_flag = form_kaliningrad_flag
				clr_global_flag = form_czech_kralovec_flag
			}
			763 = {
				if = {
					limit = { is_core_of = SOV }
					remove_core_of = SOV
				}
				if = {
					limit = { is_core_of = CZE }
					remove_core_of = CZE
				}
				if = {
					limit = { is_core_of = GER }
					remove_core_of = GER
				}
				if = {
					limit = { is_core_of = POL }
					remove_core_of = POL
				}
				if = {
					limit = { is_core_of = LIT }
					remove_core_of = LIT
				}
				if = {
					limit = { is_core_of = LAT }
					remove_core_of = LAT
				}
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}
}

form_soviet_union_category = {

	form_kaliningrad = {

		icon = generic_form_nation

		allowed = {
			original_tag = SOV
		}

		available = {
			controls_state = 763
		}

		visible = {
			original_tag = SOV
			has_government = communism
			NOT = { has_global_flag = form_kaliningrad_flag }
		}

		complete_effect = {
			set_province_name = { id = 6332 name = "Kaliningrad" }
			763 = { add_core_of = ROOT }
			hidden_effect = {
				set_global_flag = form_kaliningrad_flag
				clr_global_flag = form_krolewiec_flag
				clr_global_flag = form_czech_kralovec_flag
				clr_global_flag = form_karaliaucius_lit_flag
				clr_global_flag = form_karaliaucius_lat_flag
				clr_global_flag = form_karaliaucius_est_flag
			}
			763 = {
				if = {
					limit = { is_core_of = POL }
					remove_core_of = POL
				}
				if = {
					limit = { is_core_of = CZE }
					remove_core_of = CZE
				}
				if = {
					limit = { is_core_of = GER }
					remove_core_of = GER
				}
				if = {
					limit = { is_core_of = LIT }
					remove_core_of = LIT
				}
				if = {
					limit = { is_core_of = EST }
					remove_core_of = EST
				}
				if = {
					limit = { is_core_of = LAT }
					remove_core_of = LAT
				}
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_lithuanian_soviet_border = {

		icon = generic_form_nation

		allowed = {
			original_tag = SOV
			has_dlc = "Waking the Tiger"
		}

		available = {
			controls_state = 11
			NOT = { country_exists = LIT }
		}

		visible = {
			original_tag = SOV
			has_government = communism
			NOT = { has_global_flag = new_lithuanian_soviet_border_flag }
		}

		complete_effect = {
			11 = { add_core_of = ROOT }
			189 = { add_core_of = ROOT }
			188 = { add_core_of = ROOT }
			784 = { add_core_of = ROOT } #Vilnus
			814 = { add_core_of = ROOT }
			815 = { add_core_of = ROOT }
			hidden_effect = {
				set_global_flag = new_lithuanian_soviet_border_flag
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_latvian_soviet_border = {

		icon = generic_form_nation

		allowed = {
			original_tag = SOV
			has_dlc = "Waking the Tiger"
		}

		available = {
			controls_state = 12
			NOT = { country_exists = LAT }
		}

		visible = {
			original_tag = SOV
			has_government = communism
			NOT = { has_global_flag = new_latvian_soviet_border_flag }
		}

		complete_effect = {
			12 = { add_core_of = ROOT }
			190 = { add_core_of = ROOT }
			808 = { add_core_of = ROOT }
			809 = { add_core_of = ROOT }
			810 = { add_core_of = ROOT }
			hidden_effect = {
				set_global_flag = new_latvian_soviet_border_flag
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_estonian_soviet_border = {

		icon = generic_form_nation

		allowed = {
			original_tag = SOV
			has_dlc = "Waking the Tiger"
		}

		available = {
			controls_state = 13
			NOT = { country_exists = EST }
		}

		visible = {
			original_tag = SOV
			has_government = communism
			NOT = { has_global_flag = new_estonian_soviet_border_flag }
		}

		complete_effect = {
			13 = { add_core_of = ROOT }
			191 = { add_core_of = ROOT }
			811 = { add_core_of = ROOT }
			812 = { add_core_of = ROOT }
			813 = { add_core_of = ROOT }
			hidden_effect = {
				set_global_flag = new_estonian_soviet_border_flag
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_finnish_soviet_border = {

		icon = generic_form_nation

		allowed = {
			original_tag = SOV
		}

		available = {
			date > 1944.1.1
			OR = {
				AND = {
					owns_state = 722
					owns_state = 147
					owns_state = 146
					NOT = { has_war_with = FIN }	
				}
				FIN = { is_puppet_of = SOV }
				owns_state = 111
			}	
		}

		visible = {
			original_tag = SOV
			has_government = communism
			NOT = { has_global_flag = new_finnish_soviet_border_flag }
		}

		complete_effect = {
			146 = { add_core_of = SOV }
			147 = { add_core_of = SOV }
			722 = { add_core_of = SOV }
			146 = { remove_core_of = FIN }
			147 = { remove_core_of = FIN }
			722 = {	remove_core_of = FIN }
			if = {
				limit = { FIN = { owns_state = 722 } }
				transfer_state = 722
			}
			if = {
				limit = { FIN = { owns_state = 147 } }
				transfer_state = 147
			}
			if = {
				limit = { FIN = { owns_state = 146 } }
				transfer_state = 146
			}
			release = FIN
			end_puppet = FIN
			FIN = { leave_faction = yes }
			FIN = { white_peace = SOV }
			FIN = { white_peace = GER }
			FIN = { white_peace = JAP }
			FIN = { white_peace = ENG }
			FIN = { white_peace = USA }			
			FIN = { 
				set_popularities = {
					democratic = 50
					neutrality = 35
					fascism = 0
					communism = 15
				}
			}
			FIN = {
				set_politics = {
					ruling_party = democratic
					elections_allowed = yes
				}
			}
			hidden_effect = {
				set_global_flag = new_finnish_soviet_border_flag
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_polish_soviet_border = {
	
		icon = generic_form_nation
	
		allowed = {
			original_tag = SOV
		}
	
		available = {
			OR = {
				AND = {
					owns_state = 784
					owns_state = 96
					owns_state = 95
					owns_state = 94
					owns_state = 93
					owns_state = 91
					owns_state = 89
					#owns_state = 97
					OR = {
						NOT = { country_exists = POL }	
						POL = { has_capitulated = no } #exists, but not as soviet puppet and not occupied by Germany
					}
				}
				POL = { is_puppet_of = SOV }
			}	
		}
	
		visible = {
			original_tag = SOV
			has_government = communism
			NOT = { has_global_flag = new_polish_soviet_border_flag }
		}
	
		complete_effect = {
			784 = { add_core_of = SOV }
			96 = { add_core_of = SOV }
			95 = { add_core_of = SOV }
			94 = { add_core_of = SOV }
			93 = { add_core_of = SOV }
			91 = { add_core_of = SOV }
			89 = { add_core_of = SOV }
			97 = { remove_core_of = SOV }
			784 = { remove_core_of = POL }
			96 = { remove_core_of = POL }
			95 = { remove_core_of = POL }
			94 = { remove_core_of = POL }
			93 = { remove_core_of = POL }
			91 = { remove_core_of = POL }
			89 = { remove_core_of = POL }
			97 = { add_core_of = POL }
			if = {
				limit = {
					AND = {
						country_exists = POL
					}
				}
				SOV = {
					if = {
						limit = { POL = { owns_state = 784 } }
						transfer_state = 784
					}
					if = {
						limit = { POL = { owns_state = 96 } }
						transfer_state = 96
					}
					if = {
						limit = { POL = { owns_state = 95 } }
						transfer_state = 95
					}
					if = {
						limit = { POL = { owns_state = 94 } }
						transfer_state = 94
					}
					if = {
						limit = { POL = { owns_state = 93 } }
						transfer_state = 93
					}
					if = {
						limit = { POL = { owns_state = 91 } }
						transfer_state = 91
					}
					if = {
						limit = { POL = { owns_state = 89 } }
						transfer_state = 89
					}
				}
				POL = {
					if = {
						limit = { SOV = { owns_state = 97 } }
						transfer_state = 97
					}
					if = {
						limit = { SOV = { owns_state = 5 } }
						transfer_state = 5
					}
					if = {
						limit = { SOV = { owns_state = 63 } }
						transfer_state = 63
					}
					if = {
						limit = { SOV = { owns_state = 68 } }
						transfer_state = 68
					}
					if = {
						limit = { SOV = { owns_state = 66 } }
						transfer_state = 66
					}
					if = {
						limit = { SOV = { owns_state = 807 } }
						transfer_state = 807
					}
					if = {
						limit = { SOV = { owns_state = 67 } }
						transfer_state = 67
					}
					if = {
						limit = { SOV = { owns_state = 762 } }
						transfer_state = 762
					}
				}
			}
			hidden_effect = {
				set_global_flag = new_polish_soviet_border_flag
				POL = {
					set_party_name = { 
						ideology = communism 
    						long_name = polska_partia_robotnicza_long 
    						name = polska_partia_robotnicza 
					}
				}
			}
		}
	
		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}


	new_romanian_soviet_border = {
	
		icon = generic_form_nation
	
		allowed = {
			original_tag = SOV
		}
	
		available = {
			OR = {
				ROM = { is_puppet_of = SOV }
			}	
		}
	
		visible = {
			original_tag = SOV
			has_government = communism
			NOT = { has_global_flag = new_romanian_soviet_border_flag }
		}
	
		complete_effect = {
			80 = { 
				add_core_of = SOV 
				add_core_of = UKR
				remove_core_of = ROM
			}
			78 = { 
				add_core_of = SOV 
				remove_core_of = ROM
			}
			766 = { 
				add_core_of = SOV 
				add_core_of = UKR
				remove_core_of = ROM
				remove_core_of = MOL
			}
			77 = { 
				add_core_of = BUL 
				remove_core_of = ROM
			}
			if = {
				limit = {
					AND = {
						country_exists = BUL
					}
				}
				BUL = {
					if = {
						limit = { ROM = { owns_state = 77 } }
						transfer_state = 77
					}
				}
			}
			if = {
				limit = {
					AND = {
						NOT = { country_exists = UKR }
					}
				}
				SOV = {
					if = {
						limit = { ROM = { owns_state = 80 } }
						transfer_state = 80
					}
					if = {
						limit = { ROM = { owns_state = 766 } }
						transfer_state = 766
					}
				}
			}
			if = {
				limit = {
					AND = {
						country_exists = UKR
					}
				}
				UKR = {
					if = {
						limit = { ROM = { owns_state = 80 } }
						transfer_state = 80
					}
					if = {
						limit = { ROM = { owns_state = 766 } }
						transfer_state = 766
					}
				}
			}
			if = {
				limit = {
					AND = {
						NOT = { country_exists = MOL }
					}
				}
				SOV = {
					if = {
						limit = { ROM = { owns_state = 78 } }
						transfer_state = 78
					}
				}
			}
			hidden_effect = {
				set_global_flag = new_romanian_soviet_border_flag
			}
		}
	
		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_hungarian_soviet_border = {
	
		icon = generic_form_nation
	
		allowed = {
			original_tag = SOV
		}
	
		available = {
			OR = {
				HUN = { is_puppet_of = SOV }
			}	
		}
	
		visible = {
			original_tag = SOV
			has_government = communism
			NOT = { has_global_flag = new_hungarian_soviet_border_flag }
		}
	
		complete_effect = {
			73 = { 
				add_core_of = SOV 
				add_core_of = UKR
				remove_core_of = HUN
			}
			664 = { 
				remove_core_of = HUN
				add_core_of = SLO
			}
			70 = {
				add_core_of = SLO				
			}
			71 = {
				add_core_of = SLO
			}
			764 = { 
				remove_core_of = HUN
			}
			45 = { 
				remove_core_of = HUN
			}
			82 = { 
				remove_core_of = HUN
			}
			84 = { 
				remove_core_of = HUN
			}
			83 = { 
				remove_core_of = HUN
			}
			76 = { 
				remove_core_of = HUN
			}
			if = {
				limit = {
					AND = {
						country_exists = ROM
					}
				}
				ROM = {
					if = {
						limit = { HUN = { owns_state = 82 } }
						transfer_state = 82
					}
					if = {
						limit = { HUN = { owns_state = 83 } }
						transfer_state = 83
					}
					if = {
						limit = { HUN = { owns_state = 84 } }
						transfer_state = 84
					}
					if = {
						limit = { HUN = { owns_state = 76 } }
						transfer_state = 76
					}
				}
			}
			if = {
				limit = {
					AND = {
						country_exists = YUG
					}
				}
				YUG = {
					if = {
						limit = { HUN = { owns_state = 764 } }
						transfer_state = 764
					}
					if = {
						limit = { HUN = { owns_state = 45 } }
						transfer_state = 45
					}
				}
			}
			if = {
				limit = {
					AND = {
						country_exists = CZE
					}
				}
				CZE = {
					if = {
						limit = { HUN = { owns_state = 664 } }
						transfer_state = 664
					}
					if = {
						limit = { HUN = { owns_state = 70 } }
						transfer_state = 70
					}
					if = {
						limit = { HUN = { owns_state = 71 } }
						transfer_state = 71
					}
				}
			}
			if = {
				limit = {
					AND = {
						NOT = { country_exists = UKR }
					}
				}
				SOV = {
					if = {
						limit = { HUN = { owns_state = 73 } }
						transfer_state = 73
					}
				}
			}
			if = {
				limit = {
					AND = {
						country_exists = UKR
					}
				}
				UKR = {
					if = {
						limit = { HUN = { owns_state = 73 } }
						transfer_state = 73
					}
				}
			}
			hidden_effect = {
				set_global_flag = new_hungarian_soviet_border_flag
			}
		}
	
		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_czechoslovakian_soviet_border = {
	
		icon = generic_form_nation
	
		allowed = {
			original_tag = SOV
		}
	
		available = {
			OR = {
				CZE = { is_puppet_of = SOV }
			}	
		}
	
		visible = {
			original_tag = SOV
			has_government = communism
			NOT = { has_global_flag = new_czechoslovakian_soviet_border_flag }
		}
	
		complete_effect = {
			73 = { 
				add_core_of = SOV 
				add_core_of = UKR
				remove_core_of = CZE
				remove_core_of = SLO
			}
			72 = {
				add_core_of = CZE				
				remove_core_of = POL
			}
			664 = { 
				add_core_of = SLO
			}
			70 = {
				add_core_of = SLO				
			}
			71 = {
				add_core_of = SLO
			}
			CZE = {
				annex_country = {
					target = SLO
					transfer_troops = yes
				}
			}
			if = {
				limit = {
					AND = {
						country_exists = UKR
					}
				}
				UKR = {
					if = {
						limit = { CZE = { owns_state = 73 } }
						transfer_state = 73
					}
				}
			}
			if = {
				limit = {
					AND = {
						NOT = { country_exists = UKR }
					}
				}
				SOV = {
					if = {
						limit = { CZE = { owns_state = 73 } }
						transfer_state = 73
					}
				}
			}
			if = {
				limit = {
					AND = {
						country_exists = POL
					}
				}
				CZE = {
					if = {
						limit = { POL = { owns_state = 72 } }
						transfer_state = 72
					}
				}
			}
			if = {
				limit = {
					AND = {
						country_exists = HUN
					}
				}
				CZE = {
					if = {
						limit = { HUN = { owns_state = 664 } }
						transfer_state = 664
					}
					if = {
						limit = { HUN = { owns_state = 70 } }
						transfer_state = 70
					}
					if = {
						limit = { HUN = { owns_state = 71 } }
						transfer_state = 71
					}
				}
			}
			hidden_effect = {
				set_global_flag = new_czechoslovakian_soviet_border_flag
			}
		}
	
		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_japan_soviet_border = {
	
		icon = generic_form_nation
	
		allowed = {
			original_tag = SOV
		}
	
		available = {
			OR = {
				AND = {
					owns_state = 537
					owns_state = 555
				}
				JAP = { is_puppet_of = SOV }
			}
		}
	
		visible = {
			original_tag = SOV
			has_government = communism
			NOT = { has_global_flag = new_japan_soviet_border_flag }
		}
	
		complete_effect = {
			537 = { 
				add_core_of = SOV 
				remove_core_of = JAP
			}
			555 = { 
				remove_core_of = JAP
				add_core_of = SOV
			}
			hidden_effect = {
				set_global_flag = new_japan_soviet_border_flag
			}
		}
	
		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}
}

form_russian_empire_category = {

	form_korolgrad = {

		icon = generic_form_nation

		allowed = {
			original_tag = SOV
			has_dlc = "Waking the Tiger"
		}

		available = {
			controls_state = 763
		}

		visible = {
			original_tag = SOV
			NOT = { has_government = communism }
			NOT = { has_global_flag = form_kaliningrad_flag }
		}

		complete_effect = {
			set_province_name = { id = 6332 name = "Korolgrad" }
			763 = { add_core_of = ROOT }
			hidden_effect = {
				set_global_flag = form_kaliningrad_flag
				clr_global_flag = form_krolewiec_flag
				clr_global_flag = form_czech_kralovec_flag
			}
			763 = {
				if = {
					limit = { is_core_of = POL }
					remove_core_of = POL
				}
				if = {
					limit = { is_core_of = CZE }
					remove_core_of = CZE
				}
				if = {
					limit = { is_core_of = GER }
					remove_core_of = GER
				}
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_lithuanian_russian_border = {

		icon = generic_form_nation

		allowed = {
			original_tag = SOV
			has_dlc = "Waking the Tiger"
		}

		available = {
			controls_state = 11
			NOT = { country_exists = LIT }
		}

		visible = {
			original_tag = SOV
			NOT = { has_government = communism }
			NOT = { has_global_flag = new_lithuanian_soviet_border_flag }
		}

		complete_effect = {
			11 = { add_core_of = ROOT }
			189 = { add_core_of = ROOT }
			188 = { add_core_of = ROOT }
			784 = { add_core_of = ROOT } #Vilnus
			814 = { add_core_of = ROOT }
			815 = { add_core_of = ROOT }
			hidden_effect = {
				set_global_flag = new_lithuanian_soviet_border_flag
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_latvian_russian_border = {

		icon = generic_form_nation

		allowed = {
			original_tag = SOV
			has_dlc = "Waking the Tiger"
		}

		available = {
			controls_state = 12
			NOT = { country_exists = LAT }
		}

		visible = {
			original_tag = SOV
			NOT = { has_government = communism }
			NOT = { has_global_flag = new_latvian_soviet_border_flag }
		}

		complete_effect = {
			12 = { add_core_of = ROOT }
			190 = { add_core_of = ROOT }
			808 = { add_core_of = ROOT }
			809 = { add_core_of = ROOT }
			810 = { add_core_of = ROOT }
			hidden_effect = {
				set_global_flag = new_latvian_soviet_border_flag
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_estonian_russian_border = {

		icon = generic_form_nation

		allowed = {
			original_tag = SOV
			has_dlc = "Waking the Tiger"
		}

		available = {
			controls_state = 13
			NOT = { country_exists = EST }
		}

		visible = {
			original_tag = SOV
			NOT = { has_government = communism }
			NOT = { has_global_flag = new_estonian_soviet_border_flag }
		}

		complete_effect = {
			13 = { add_core_of = ROOT }
			191 = { add_core_of = ROOT }
			811 = { add_core_of = ROOT }
			812 = { add_core_of = ROOT }
			813 = { add_core_of = ROOT }
			hidden_effect = {
				set_global_flag = new_estonian_soviet_border_flag
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_finnish_russian_border = {

		icon = generic_form_nation

		allowed = {
			original_tag = SOV
		}

		available = {
			OR = {
				AND = {
					owns_state = 722
					owns_state = 147
					owns_state = 146
					NOT = { has_war_with = FIN }	
				}
				FIN = { is_puppet_of = SOV }
				owns_state = 111
			}	
		}

		visible = {
			original_tag = SOV
			NOT = { has_government = communism }
			NOT = { has_global_flag = new_finnish_soviet_border_flag }
		}

		complete_effect = {
			146 = { add_core_of = SOV }
			147 = { add_core_of = SOV }
			722 = { add_core_of = SOV }
			146 = { remove_core_of = FIN }
			147 = { remove_core_of = FIN }
			722 = {	remove_core_of = FIN }
			if = {
				limit = { FIN = { owns_state = 722 } }
				transfer_state = 722
			}
			if = {
				limit = { FIN = { owns_state = 147 } }
				transfer_state = 147
			}
			if = {
				limit = { FIN = { owns_state = 146 } }
				transfer_state = 146
			}
			release = FIN
			end_puppet = FIN
			FIN = { leave_faction = yes }
			FIN = { white_peace = SOV }
			FIN = { white_peace = GER }
			FIN = { white_peace = JAP }
			FIN = { white_peace = ENG }
			FIN = { white_peace = USA }			
			FIN = { 
				set_popularities = {
					democratic = 50
					neutrality = 35
					fascism = 0
					communism = 15
				}
			}
			FIN = {
				set_politics = {
					ruling_party = democratic
					elections_allowed = yes
				}
			}
			hidden_effect = {
				set_global_flag = new_finnish_soviet_border_flag
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_polish_russian_border = {
	
		icon = generic_form_nation
	
		allowed = {
			original_tag = SOV
		}
	
		available = {
			OR = {
				AND = {
					owns_state = 784
					owns_state = 96
					owns_state = 95
					owns_state = 94
					owns_state = 93
					owns_state = 91
					owns_state = 89
					#owns_state = 97
					OR = {
						NOT = { country_exists = POL }	
						POL = { has_capitulated = no } #exists, but not as soviet puppet and not occupied by Germany
					}
				}
				POL = { is_puppet_of = SOV }
			}	
		}
	
		visible = {
			original_tag = SOV
			NOT = { has_government = communism }
			NOT = { has_global_flag = new_polish_soviet_border_flag }
		}
	
		complete_effect = {
			784 = { add_core_of = SOV }
			96 = { add_core_of = SOV }
			95 = { add_core_of = SOV }
			94 = { add_core_of = SOV }
			93 = { add_core_of = SOV }
			91 = { add_core_of = SOV }
			89 = { add_core_of = SOV }
			97 = { remove_core_of = SOV }
			784 = { remove_core_of = POL }
			96 = { remove_core_of = POL }
			95 = { remove_core_of = POL }
			94 = { remove_core_of = POL }
			93 = { remove_core_of = POL }
			91 = { remove_core_of = POL }
			89 = { remove_core_of = POL }
			97 = { add_core_of = POL }
			if = {
				limit = {
					AND = {
						country_exists = POL
					}
				}
				SOV = {
					if = {
						limit = { POL = { owns_state = 784 } }
						transfer_state = 784
					}
					if = {
						limit = { POL = { owns_state = 96 } }
						transfer_state = 96
					}
					if = {
						limit = { POL = { owns_state = 95 } }
						transfer_state = 95
					}
					if = {
						limit = { POL = { owns_state = 94 } }
						transfer_state = 94
					}
					if = {
						limit = { POL = { owns_state = 93 } }
						transfer_state = 93
					}
					if = {
						limit = { POL = { owns_state = 91 } }
						transfer_state = 91
					}
					if = {
						limit = { POL = { owns_state = 89 } }
						transfer_state = 89
					}
				}
				POL = {
					if = {
						limit = { SOV = { owns_state = 97 } }
						transfer_state = 97
					}
					if = {
						limit = { SOV = { owns_state = 5 } }
						transfer_state = 5
					}
					if = {
						limit = { SOV = { owns_state = 63 } }
						transfer_state = 63
					}
					if = {
						limit = { SOV = { owns_state = 68 } }
						transfer_state = 68
					}
					if = {
						limit = { SOV = { owns_state = 66 } }
						transfer_state = 66
					}
					if = {
						limit = { SOV = { owns_state = 807 } }
						transfer_state = 807
					}
					if = {
						limit = { SOV = { owns_state = 67 } }
						transfer_state = 67
					}
					if = {
						limit = { SOV = { owns_state = 762 } }
						transfer_state = 762
					}
				}
			}
			hidden_effect = {
				set_global_flag = new_polish_soviet_border_flag
				POL = {
					set_party_name = { 
						ideology = communism 
    						long_name = polska_partia_robotnicza_long 
    						name = polska_partia_robotnicza 
					}
				}
			}
		}
	
		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}


	new_romanian_russian_border = {
	
		icon = generic_form_nation
	
		allowed = {
			original_tag = SOV
		}
	
		available = {
			OR = {
				ROM = { is_puppet_of = SOV }
			}	
		}
	
		visible = {
			original_tag = SOV
			NOT = { has_government = communism }
			NOT = { has_global_flag = new_romanian_soviet_border_flag }
		}
	
		complete_effect = {
			80 = { 
				add_core_of = SOV 
				add_core_of = UKR
				remove_core_of = ROM
			}
			78 = { 
				add_core_of = SOV 
				remove_core_of = ROM
			}
			766 = { 
				add_core_of = SOV 
				add_core_of = UKR
				remove_core_of = ROM
				remove_core_of = MOL
			}
			77 = { 
				add_core_of = BUL 
				remove_core_of = ROM
			}
			if = {
				limit = {
					AND = {
						country_exists = BUL
					}
				}
				BUL = {
					if = {
						limit = { ROM = { owns_state = 77 } }
						transfer_state = 77
					}
				}
			}
			if = {
				limit = {
					AND = {
						NOT = { country_exists = UKR }
					}
				}
				SOV = {
					if = {
						limit = { ROM = { owns_state = 80 } }
						transfer_state = 80
					}
					if = {
						limit = { ROM = { owns_state = 766 } }
						transfer_state = 766
					}
				}
			}
			if = {
				limit = {
					AND = {
						country_exists = UKR
					}
				}
				UKR = {
					if = {
						limit = { ROM = { owns_state = 80 } }
						transfer_state = 80
					}
					if = {
						limit = { ROM = { owns_state = 766 } }
						transfer_state = 766
					}
				}
			}
			if = {
				limit = {
					AND = {
						NOT = { country_exists = MOL }
					}
				}
				SOV = {
					if = {
						limit = { ROM = { owns_state = 78 } }
						transfer_state = 78
					}
				}
			}
			hidden_effect = {
				set_global_flag = new_romanian_soviet_border_flag
			}
		}
	
		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_hungarian_russian_border = {
	
		icon = generic_form_nation
	
		allowed = {
			original_tag = SOV
		}
	
		available = {
			OR = {
				HUN = { is_puppet_of = SOV }
			}	
		}
	
		visible = {
			original_tag = SOV
			NOT = { has_government = communism }
			NOT = { has_global_flag = new_hungarian_soviet_border_flag }
		}
	
		complete_effect = {
			73 = { 
				add_core_of = SOV 
				add_core_of = UKR
				remove_core_of = HUN
			}
			664 = { 
				remove_core_of = HUN
				add_core_of = SLO
			}
			70 = {
				add_core_of = SLO				
			}
			71 = {
				add_core_of = SLO
			}
			764 = { 
				remove_core_of = HUN
			}
			45 = { 
				remove_core_of = HUN
			}
			82 = { 
				remove_core_of = HUN
			}
			84 = { 
				remove_core_of = HUN
			}
			83 = { 
				remove_core_of = HUN
			}
			76 = { 
				remove_core_of = HUN
			}
			if = {
				limit = {
					AND = {
						country_exists = ROM
					}
				}
				ROM = {
					if = {
						limit = { HUN = { owns_state = 82 } }
						transfer_state = 82
					}
					if = {
						limit = { HUN = { owns_state = 83 } }
						transfer_state = 83
					}
					if = {
						limit = { HUN = { owns_state = 84 } }
						transfer_state = 84
					}
					if = {
						limit = { HUN = { owns_state = 76 } }
						transfer_state = 76
					}
				}
			}
			if = {
				limit = {
					AND = {
						country_exists = YUG
					}
				}
				YUG = {
					if = {
						limit = { HUN = { owns_state = 764 } }
						transfer_state = 764
					}
					if = {
						limit = { HUN = { owns_state = 45 } }
						transfer_state = 45
					}
				}
			}
			if = {
				limit = {
					AND = {
						country_exists = CZE
					}
				}
				CZE = {
					if = {
						limit = { HUN = { owns_state = 664 } }
						transfer_state = 664
					}
					if = {
						limit = { HUN = { owns_state = 70 } }
						transfer_state = 70
					}
					if = {
						limit = { HUN = { owns_state = 71 } }
						transfer_state = 71
					}
				}
			}
			if = {
				limit = {
					AND = {
						NOT = { country_exists = UKR }
					}
				}
				SOV = {
					if = {
						limit = { HUN = { owns_state = 73 } }
						transfer_state = 73
					}
				}
			}
			if = {
				limit = {
					AND = {
						country_exists = UKR
					}
				}
				UKR = {
					if = {
						limit = { HUN = { owns_state = 73 } }
						transfer_state = 73
					}
				}
			}
			hidden_effect = {
				set_global_flag = new_hungarian_soviet_border_flag
			}
		}
	
		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_czechoslovakian_russian_border = {
	
		icon = generic_form_nation
	
		allowed = {
			original_tag = SOV
		}
	
		available = {
			OR = {
				CZE = { is_puppet_of = SOV }
			}	
		}
	
		visible = {
			original_tag = SOV
			NOT = { has_government = communism }
			NOT = { has_global_flag = new_czechoslovakian_soviet_border_flag }
		}
	
		complete_effect = {
			73 = { 
				add_core_of = SOV 
				add_core_of = UKR
				remove_core_of = CZE
				remove_core_of = SLO
			}
			72 = {
				add_core_of = CZE				
				remove_core_of = POL
			}
			664 = { 
				add_core_of = SLO
			}
			70 = {
				add_core_of = SLO				
			}
			71 = {
				add_core_of = SLO
			}
			CZE = {
				annex_country = {
					target = SLO
					transfer_troops = yes
				}
			}
			if = {
				limit = {
					AND = {
						country_exists = UKR
					}
				}
				UKR = {
					if = {
						limit = { CZE = { owns_state = 73 } }
						transfer_state = 73
					}
				}
			}
			if = {
				limit = {
					AND = {
						NOT = { country_exists = UKR }
					}
				}
				SOV = {
					if = {
						limit = { CZE = { owns_state = 73 } }
						transfer_state = 73
					}
				}
			}
			if = {
				limit = {
					AND = {
						country_exists = POL
					}
				}
				CZE = {
					if = {
						limit = { POL = { owns_state = 72 } }
						transfer_state = 72
					}
				}
			}
			if = {
				limit = {
					AND = {
						country_exists = HUN
					}
				}
				CZE = {
					if = {
						limit = { HUN = { owns_state = 664 } }
						transfer_state = 664
					}
					if = {
						limit = { HUN = { owns_state = 70 } }
						transfer_state = 70
					}
					if = {
						limit = { HUN = { owns_state = 71 } }
						transfer_state = 71
					}
				}
			}
			hidden_effect = {
				set_global_flag = new_czechoslovakian_soviet_border_flag
			}
		}
	
		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}

	new_japan_russian_border = {
	
		icon = generic_form_nation
	
		allowed = {
			original_tag = SOV
		}
	
		available = {
			OR = {
				AND = {
					owns_state = 537
					owns_state = 555
				}
				JAP = { is_puppet_of = SOV }
			}
		}
	
		visible = {
			original_tag = SOV
			NOT = { has_government = communism }
			NOT = { has_global_flag = new_japan_soviet_border_flag }
		}
	
		complete_effect = {
			537 = { 
				add_core_of = SOV 
				remove_core_of = JAP
			}
			555 = { 
				remove_core_of = JAP
				add_core_of = SOV
			}
			hidden_effect = {
				set_global_flag = new_japan_soviet_border_flag
			}
		}
	
		ai_will_do = {
			factor = 200
			modifier = {
				factor = 200
				is_historical_focus_on = yes
			}
		}
	}
}

