conquer_danzig = {
	
	type = country

	allow = {
		tag = POL
		is_lesser_in_union = no
		is_subject = no
		not = { owns = 43 }	# Danzig
		exists = TEU
		war_with = TEU
		TEU = { owns = 43 }
	}
	abort = {
		or = {
			not = { war_with = TEU }
			is_lesser_in_union = yes
			is_subject = yes
		}
	}
	success = {
		not = { war_with = TEU }
		owns = 43
	}
	chance = {
		factor = 1000
		modifier = {
			factor = 2
			mil = 7
		}	
	}
	immediate = {
		add_temp_claim = 43
	}
	abort_effect = {
		remove_temp_claim = 43
	}
	effect = {
		add_core = 43
	}
}

conquer_warmia = {
	
	type = country

	allow = {
		tag = POL
		is_lesser_in_union = no
		is_subject = no
		not = { owns = 42 }	# Warmia
		exists = TEU
		war_with = TEU
		TEU = { owns = 42 }
	}
	abort = {
		or = {
			not = { war_with = TEU }
			is_lesser_in_union = yes
			is_subject = yes	
		}
	}
	success = {
		not = { war_with = TEU }
		owns = 42
	}
	chance = {
		factor = 1000
		modifier = {
			factor = 2
			mil = 7
		}	
	}
	immediate = {
		add_temp_claim = 42
	}
	abort_effect = {
		remove_temp_claim = 42
	}
	effect = {
		add_core = 42
	}
}

poland_mazovia_relations = {
	
	type = country

	allow = {
		tag = POL
		exists = MAZ
		not = { war_with = MAZ }
		not = { marriage_with = MAZ }
		is_lesser_in_union = no
		is_subject = no
		government = monarchy
		MAZ = {
			government = monarchy
			is_lesser_in_union = no
			is_subject = no
		}
	}
	abort = {
		or = {
			not = { exists = MAZ }
			war_with = MAZ
			is_lesser_in_union = yes
			is_subject = yes
			not = { government = monarchy }
			MAZ = {
				or = {
					not = { government = monarchy }
					is_lesser_in_union = yes
					is_subject = yes
				}
			}
		}
	}
	success = {
		marriage_with = MAZ
		relation = { who = MAZ value = 100 }
	}
	chance = {
		factor = 1000
		modifier = {
			factor = 2
			not = { relation = { who = MAZ value = 0 } }
		}
		modifier = {
			factor = 2
			not = { relation = { who = MAZ value = -100 } }
		}
	}
	effect = {
		stability = 1
	}
}

vassalize_mazovia = {
	
	type = country

	allow = {
		tag = POL
		exists = MAZ
		MAZ = {
			neighbour = this
			not = { vassal_of = POL }
			not = { num_of_cities = this }
			is_lesser_in_union = no
			is_subject = no
		}
	}
	abort = {
		or = {
			not = { exists = MAZ }
			MAZ = { is_lesser_in_union = yes }
		}
	}
	success = {
		MAZ = { vassal_of = POL }
	}
	chance = {
		factor = 1000
		modifier = {
			factor = 2
			marriage_with = MAZ
		}
		modifier = {
			factor = 2
			relation = { who = MAZ value = 100 }
		}
	}
	immediate = {
		casus_belli = {
			type = cb_vassalize_mission
			months = 120
			target = MAZ
		}
	}
	abort_effect = {
		remove_casus_belli = {
			type = cb_vassalize_mission
			target = MAZ
		}
	}
	effect = {
		prestige = 0.1
		remove_casus_belli = {
			type = cb_vassalize_mission
			target = MAZ
		}
	}
}

annex_mazovia = {
	
	type = country

	allow = {
		tag = POL
		is_subject = no
		exists = MAZ
		MAZ = {
			vassal_of = POL
			neighbour = this
			not = { num_of_cities = this }
			religion_group = this
			owns = 257
		}
	}
	abort = {
		or = {
			not = { exists = MAZ }
			MAZ = { not = { religion_group = this } }
		}
	}
	success = {
		not = { exists = MAZ }
		owns = 257
	}
	chance = {
		factor = 1000
		modifier = {
			factor = 2
			relation = { who = MAZ value = 100 }
		}
		modifier = {
			factor = 2
			relation = { who = MAZ value = 200 }
		}
	}
	immediate = {
		add_temp_claim = 257
	}
	abort_effect = {
		remove_temp_claim = 257
	}
	effect = {
		stability = 2
	}
}

conquer_smolensk = {
	
	type = country

	allow = {
		tag = POL
		exists = RUS
		war_with = RUS
		RUS = { owns = 293 } # Smolensk
		is_lesser_in_union = no
		is_subject = no
		is_core = 293
	}
	abort = {
		or = {
			not = { war_with = RUS }
			is_lesser_in_union = yes
			is_subject = yes	
		}
	}
	success = {
		not = { war_with = RUS }
		owns = 293
	}
	chance = {
		factor = 1000
		modifier = {
			factor = 2
			mil = 7
		}	
	}
	effect = {
		prestige = 0.05
	}
}

retake_podolia = {
	
	type = country

	allow = {
		tag = POL
		is_lesser_in_union = no
		is_subject = no
		exists = TUR
		TUR = {
			or = {
				owns = 281		# Podolia
				controls = 281
			}
			neighbour = this
		}
		is_core = 281
		
	}
	abort = {
		or = {
			TUR = { not = { neighbour = this } }
			is_lesser_in_union = yes
			is_subject = yes
		}
	}
	success = {
		owns = 281
	}
	chance = {
		factor = 1000
		modifier = {
			factor = 2
			not = { relation = { who = TUR value = 0 } }
		}	
	}
	effect = {
		infamy = -5
	}
}

poland_lithuania_relations = {
	
	type = country

	allow = {
		tag = POL
		exists = LIT
		not = { war_with = LIT }
		not = { marriage_with = LIT }
		is_lesser_in_union = no
		is_subject = no
		government = monarchy
		LIT = {
			government = monarchy
			is_lesser_in_union = no
			is_subject = no
		}
	}
	abort = {
		or = {
			war_with = LIT
			is_lesser_in_union = yes
			is_subject = yes
			not = { government = monarchy }
			LIT = {
				or = {
					not = { government = monarchy }
					is_lesser_in_union = yes
					is_subject = yes
				}
			}
		}
	}
	success = {
		marriage_with = LIT
		relation = { who = LIT value = 100 }
	}
	chance = {
		factor = 1000
		modifier = {
			factor = 2
			not = { relation = { who = LIT value = 0 } }
		}
		modifier = {
			factor = 2
			not = { relation = { who = LIT value = -100 } }
		}
	}
	effect = {
		stability = 1
	}
}

vassalize_lithuania = {
	
	type = country

	allow = {
		tag = POL
		exists = LIT
		LIT = {
			neighbour = this
			not = { vassal_of = POL }
			not = { num_of_cities = this }
			is_lesser_in_union = no
			is_subject = no
		}
	}
	abort = {
		or = {
			not = { exists = LIT }
			LIT = { is_lesser_in_union = yes }
		}
	}
	success = {
		LIT = { vassal_of = POL }
	}
	chance = {
		factor = 1000
		modifier = {
			factor = 2
			relation = { who = LIT value = 100 }
		}
		modifier = {
			factor = 2
			marriage_with = LIT
		}
	}
	immediate = {
		casus_belli = {
			type = cb_vassalize_mission
			months = 120
			target = LIT
		}
	}
	abort_effect = {
		remove_casus_belli = {
			type = cb_vassalize_mission
			target = LIT
		}
	}
	effect = {
		prestige = 0.1
		remove_casus_belli = {
			type = cb_vassalize_mission
			target = LIT
		}
	}
}

annex_lithuania = {
	
	type = country

	allow = {
		tag = POL
		is_subject = no
		exists = LIT
		LIT = {
			vassal_of = POL
			neighbour = this
			not = { num_of_cities = this }
			religion_group = this
			owns = 272			# Vilnius
		}
	}
	abort = {
		or = {
			not = { exists = LIT }
			LIT = { not = { religion_group = this } }
		}
	}
	success = {
		not = { exists = LIT }
		owns = 272
	}
	chance = {
		factor = 1000
		modifier = {
			factor = 2
			relation = { who = LIT value = 100 }
		}
		modifier = {
			factor = 2
			relation = { who = LIT value = 200 }
		}
	}
	effect = {
		stability = 2
		infamy = -10
	}
}

vassalize_the_teutonic_order = {
	
	type = country

	allow = {
		tag = POL
		exists = TEU
		TEU = {
			neighbour = this
			not = { vassal_of = POL }
			not = { num_of_cities = this }
			is_lesser_in_union = no
			is_subject = no
		}
	}
	abort = {
		or = {
			not = { exists = TEU }
			TEU = { is_lesser_in_union = yes }
		}
	}
	success = {
		TEU = { vassal_of = POL }
	}
	chance = {
		factor = 1000
		modifier = {
			factor = 2
			not = { relation = { who = TEU value = 0 } }
		}
	}
	immediate = {
		casus_belli = {
			type = cb_vassalize_mission
			months = 120
			target = TEU
		}
	}
	abort_effect = {
		remove_casus_belli = {
			type = cb_vassalize_mission
			target = TEU
		}
	}
	effect = {
		prestige = 0.1
		remove_casus_belli = {
			type = cb_vassalize_mission
			target = TEU
		}
	}
}

retake_minsk = {
	
	type = country

	allow = {
		tag = POL
		exists = RUS
		war_with = RUS
		RUS = {
			or = {
				owns = 276			# Minsk
				controls = 276
			}
		}
		is_core = 276
	}
	abort = {}
	success = {
		owns = 276
		controls = 276
	}
	chance = {
		factor = 1000
		modifier = {
			factor = 2
			mil = 7
		}	
	}
	effect = {
		prestige = 0.05
	}
}

fortify_the_southern_border = {
	
	type = country

	allow = {
		tag = POL
		land_tech = 25
		year = 1750
		owns = 261
		owns = 262
		or = {
			261 = { not = { has_building = fort3 } }
			262 = { not = { has_building = fort3 } }
		}
		exists = HAB
		HAB = { neighbour = this }
	}
	abort = {
		HAB = { not = { neighbour = this } }
	}
	success = {
		261 = { has_building = fort3 }
		262 = { has_building = fort3 }
	}
	chance = {
		factor = 1000
		modifier = {
			factor = 2
			not = { relation = { who = HAB value = 0 } }
		}
	}
	effect = {
		army_tradition = 0.4
		stability = 1
	}
}

defend_polands_western_border = {
	
	type = country

	allow = {
		tag = POL
		owns = 254
		owns = 255
		owns = 258
		owns = 259
		year = 1750
		exists = PRU
		war_with = PRU
	}
	abort = {
		not = { war_with = PRU }
	}
	success = {
		not = { war_with = PRU }
		owns = 254
		owns = 255
		owns = 258
		owns = 259
	}
	chance = {
		factor = 1000
		modifier = {
			factor = 2
			mil = 7
		}	
	}
	effect = {
		war_exhaustion = -5
		stability = 1
	}
}

defend_polands_northern_border = {
	
	type = country

	allow = {
		tag = POL
		owns = 272
		owns = 275
		owns = 292
		year = 1750
		exists = RUS
		war_with = RUS
	}
	abort = {
		not = { war_with = RUS }
	}
	success = {
		not = { war_with = RUS }
		owns = 272
		owns = 275
		owns = 292
	}
	chance = {
		factor = 1000
		modifier = {
			factor = 2
			mil = 7
		}	
	}
	effect = {
		stability = 3
	}
}
