﻿
# The Pomeranian arbitration/plebiscite

add_namespace = deluge_pomerania

# Germany is at peace and France is asked to arbitrate ownership of Pomerania
# Pomerania first gets the opportunity to rebel

country_event = {
	id = deluge_pomerania.14
	title = deluge_pomerania14title
	desc = deluge_pomerania14desc
	
	picture = GFX_deluge_port
	
	fire_only_once = yes
	
	trigger = {
		tag = POM
		has_global_flag = german_civil_war_ended
		is_subject_of = FRA
		FRA = {
			NOT = {
				OR = {
					has_war_with = WGR
					has_war_with = GER
					has_war_with = DDR
					has_war_with = POL
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1
	}
	
	option = {
		name = deluge_pomerania14opta
		
		FRA = { country_event = { id = deluge_pomerania.1 } }
		
		ai_chance = {
			factor = 10
		}
	}
	
	option = {
		name = deluge_pomerania14optb
				
		FRA = {
			end_puppet = POM
		}
		
		add_popularity = {
			ideology = neutrality
			popularity = -1
		}
		
		if = {
			limit = {
				has_idea = deluge_pomeranian_populism_idea
			}
			set_politics = {
				ruling_party = communism
				elections_allowed = yes
			}
		}
		
		if = {
			limit = {
				has_idea = deluge_kashubian_nationalism_idea
			}
			set_politics = {
				ruling_party = fascism
				elections_allowed = yes
			}
		}
		
		if = {
			limit = {
				has_idea = deluge_mandate_institutions_idea
			}
			set_politics = {
				ruling_party = democratic
				elections_allowed = yes
			}
		}
		
		create_faction = "factionPomeranianBloc"
		
		if = {
			limit = { WGR = { owns_state = 64 } }
			WGR = {
				add_state_core = 62
				add_state_core = 63
				add_state_core = 85
				create_wargoal = {
					type = take_core_state
					target = POM
					generator = { 62 63 85 }
				}
			}
		}

		if = {
			limit = { GER = { owns_state = 64 } }
			GER = {
				add_state_core = 62
				add_state_core = 63
				add_state_core = 85
				create_wargoal = {
					type = take_core_state
					target = POM
					generator = { 62 63 85 }
				}
			}
		}

		if = {
			limit = { DDR = { owns_state = 64 } }
			DDR = {
				add_state_core = 62
				add_state_core = 63
				add_state_core = 85
				create_wargoal = {
					type = take_core_state
					target = POM
					generator = { 62 63 85 }
				}
			}
		}
		
		if = {
			limit = { country_exists = POL }
			POL = {
				add_state_core = 62
				add_state_core = 63
				add_state_core = 85
				create_wargoal = {
					type = take_core_state
					target = POM
					generator = { 62 63 85 }
				}
			}
		}
		
		news_event = { days = 1 id = deluge_pomerania.13 }

		ai_chance = {
			factor = 1
		}
	}
}
	

# Pomerania accepts the possibility of being annexed and France decides what to do next

country_event = {
	id = deluge_pomerania.1
	title = deluge_pomerania1title
	desc = deluge_pomerania1desc
	
	picture = GFX_deluge_port
	
	is_triggered_only = yes
	
	option = {
		name = deluge_pomerania1opta # Allow a plebiscite
		
		add_named_threat = { threat = -3 name = deluge_french_plebiscite_threat }
		
		hidden_effect = {
			news_event = { days = 1 id = deluge_pomerania.7 }
		}
		ai_chance = {
			factor = 3
			modifier = {
				factor = 10
				has_government = democratic
			}
			modifier = {
				factor = 5
				has_government = communism
			}
			modifier = {
				factor = 2
				has_government = neutrality
			}
		}
	}
	
	option = {
		name = deluge_pomerania1optb # Award to Germany
		
		trigger = {
			OR = {
				country_exists = WGR
				country_exists = GER
				country_exists = DDR
			}
		}
		
		if = {
			limit = { WGR = { owns_state = 64 } }
			WGR = { country_event = { id = deluge_pomerania.3 } }
		}

		if = {
			limit = { GER = { owns_state = 64 } }
			GER = { country_event = { id = deluge_pomerania.3 } }
		}

		if = {
			limit = { DDR = { owns_state = 64 } }
			DDR = { country_event = { id = deluge_pomerania.3 } }
		}

		ai_chance = {
			factor = 1
			modifier = {
				factor = 10
				has_government = communism
				WGR = {
					owns_state = 64
					has_government = communism
				}
			}
			modifier = {
				factor = 10
				has_government = communism
				GER = {
					owns_state = 64
					has_government = communism
				}
			}
			modifier = {
				factor = 10
				has_government = communism
				DDR = {
					owns_state = 64
					has_government = communism
				}
			}
			modifier = {
				factor = 10
				has_government = neutrality
				WGR = {
					owns_state = 64
					has_government = neutrality
				}
			}
			modifier = {
				factor = 10
				has_government = neutrality
				GER = {
					owns_state = 64
					has_government = neutrality
				}
			}
			modifier = {
				factor = 10
				has_government = neutrality
				DDR = {
					owns_state = 64
					has_government = neutrality
				}
			}
			modifier = {
				factor = 10
				has_government = democratic
				WGR = {
					owns_state = 64
					has_government = democratic
				}
			}
			modifier = {
				factor = 10
				has_government = democratic
				GER = {
					owns_state = 64
					has_government = democratic
				}
			}
			modifier = {
				factor = 10
				has_government = democratic
				DDR = {
					owns_state = 64
					has_government = democratic
				}
			}
			modifier = {
				factor = 10
				has_government = fascism
				WGR = {
					owns_state = 64
					has_government = fascism
				}
			}
			modifier = {
				factor = 10
				has_government = fascism
				GER = {
					owns_state = 64
					has_government = fascism
				}
			}
			modifier = {
				factor = 10
				has_government = fascism
				DDR = {
					owns_state = 64
					has_government = fascism
				}
			}
		}
	}
	
	option = {
		name = deluge_pomerania1optc # Award to Poland
		
		trigger = {
			country_exists = POL
		}
		
		POL = { country_event = { id = deluge_pomerania.5 } }

		ai_chance = {
			factor = 1
			modifier = {
				factor = 10
				has_government = democratic
				POL = { has_government = democratic }
			}
			modifier = {
				factor = 10
				has_government = neutrality
				POL = { has_government = neutrality }
			}
			modifier = {
				factor = 10
				has_government = communism
				POL = { has_government = communism }
			}
			modifier = {
				factor = 10
				has_government = fascism
				POL = { has_government = fascism }
			}
		}
	}
	
	option = {
		name = deluge_pomerania1optd # Split Pomerania between Germany and Poland

		trigger = {
			country_exists = POL
			OR = {
				country_exists = WGR
				country_exists = GER
				country_exists = DDR
			}
		}
		
		hidden_effect = {
			news_event = { days = 1 id = deluge_pomerania.2 }
		}
		
		ai_chance = {
			factor = 1
			modifier = {
				factor = 10
				has_government = fascism
				NOT = { POL = { has_government = fascism } }
				NOT = {
					DDR = {
						owns_state = 64
						has_government = fascism
					}
				}
				NOT = { 
					WGR = {
						owns_state = 64
						has_government = fascism
					}
				}
				NOT = {
					GER = {
						owns_state = 64
						has_government = fascism
					}
				}
			}
			modifier = {
				factor = 5
				has_government = neutrality
				NOT = { POL = { has_government = neutrality } }
				NOT = { 
					DDR = {
						owns_state = 64
						has_government = neutrality
					}
				}
				NOT = { 
					WGR = {
						owns_state = 64
						has_government = neutrality
					}
				}
				NOT = {
					GER = {
						owns_state = 64
						has_government = neutrality
					}
				}
			}
			modifier = {
				factor = 2
				has_government = democratic
				NOT = { POL = { has_government = democratic } }
				NOT = {
					DDR = {
						owns_state = 64
						has_government = democratic
					}
				}
				NOT = {
					WGR = {
						owns_state = 64
						has_government = democratic
					}
				}
				NOT = {
					GER = {
						owns_state = 64
						has_government = democratic
					}
				}
			}
			modifier = {
				factor = 10
				has_government = communism
				NOT = { POL = { has_government = communism } }
				NOT = { 
					DDR = {
						owns_state = 64
						has_government = communism
					}
				}
				NOT = { 
					WGR = {
						owns_state = 64
						has_government = communism
					}
				}
				NOT = {
					GER = {
						owns_state = 64
						has_government = communism
					}
				}
			}
		}
	}
}

# Germany and Poland get cores and seize their respective portions

news_event = {
	id = deluge_pomerania.2
	title = deluge_pomerania2title
	desc = deluge_pomerania2desc

	picture = GFX_deluge_public_funeral
	
	major = yes
	
	is_triggered_only = yes
		
	option = {
		name = deluge_pomerania2opta
		trigger = {
			NOT = {
				TAG = FRA
				TAG = POL
				TAG = WGR
				TAG = DDR
				TAG = GER
			}
		}
	}
	option = {
		name = deluge_pomerania2optb
		
		trigger = { TAG = POL }
		
		add_state_core = 62
		add_state_core = 63
		add_state_core = 85
		
		hidden_effect = {
			POM = {
				if = {
					limit = { democratic > 0.5 }
					set_politics = {
						ruling_party = democratic
						elections_allowed = yes
					}
				}
				if = {
					limit = { communism > 0.5 }
					set_politics = {
						ruling_party = communism
						elections_allowed = yes
					}
				}
				if = {
					limit = { fascism > 0.5 }
					set_politics = {
						ruling_party = fascism
						elections_allowed = no
					}
				}
				if = {
					limit = {
						NOT = {
							OR = { 
								democratic > 0.5 
								communism > 0.5 
								fascism > 0.5 
							}
						}
					}
					add_popularity = {
						ideology = democratic
						popularity = 0.5
					}
					set_politics = {
						ruling_party = democratic
						elections_allowed = yes
					}
				}
			}
		}
		
		POM = {
			if = {
				limit = { WGR = { owns_state = 64 } }
				WGR = { transfer_state = 62 }
			}
			if = {
				limit = { GER = { owns_state = 64 } }
				GER = { transfer_state = 62 }
			}
			if = {
				limit = { DDR = { owns_state = 64 } }
				DDR = { transfer_state = 62 }
			}
		}
		
		annex_country = { target = POM transfer_troops = no }
		
	}
	option = {
		name = deluge_pomerania2optc
		
		trigger = {
			OR = {
				TAG = WGR
				TAG = DDR
				TAG = GER
			}
			country_exists = ROOT
		}
		
		add_state_core = 62
		add_state_core = 63
		add_state_core = 85
		
	}
	option = {
		name = deluge_pomerania2optd
		trigger = { TAG = FRA }
	}
}

# Germany is awarded Pomerania

country_event = {
	id = deluge_pomerania.3
	title = deluge_pomerania3title
	desc = deluge_pomerania3desc
	
	picture = GFX_deluge_port
	
	is_triggered_only = yes	
	
	option = {
		name = deluge_pomerania3opt
		
		add_state_core = 62
		add_state_core = 63
		add_state_core = 85
		
		hidden_effect = {
			POM = {
				if = {
					limit = { democratic > 0.5 }
					set_politics = {
						ruling_party = democratic
						elections_allowed = yes
					}
				}
				if = {
					limit = { communism > 0.5 }
					set_politics = {
						ruling_party = communism
						elections_allowed = yes
					}
				}
				if = {
					limit = { fascism > 0.5 }
					set_politics = {
						ruling_party = fascism
						elections_allowed = no
					}
				}
				if = {
					limit = {
						NOT = {
							OR = { 
								democratic > 0.5 
								communism > 0.5 
								fascism > 0.5 
							}
						}
					}
					add_popularity = {
						ideology = democratic
						popularity = 0.5
					}
					set_politics = {
						ruling_party = democratic
						elections_allowed = yes
					}
				}
			}
		}
		
		annex_country = { target = POM transfer_troops = no }
		
		hidden_effect = {
			news_event = { days = 1 id = deluge_pomerania.4 }
		}
	}
}

# World is informed of the German award and Poland gets cores and a CB

news_event = {
	id = deluge_pomerania.4
	title = deluge_pomerania4title
	desc = deluge_pomerania4desc

	picture = GFX_deluge_public_funeral
	
	major = yes
	
	is_triggered_only = yes
		
	option = {
		name = deluge_pomerania4opta
		trigger = {
			NOT = {
				OR = {
					TAG = FRA
					TAG = POL
					TAG = WGR
					TAG = DDR
					TAG = GER
				}
			}
		}
	}
	option = {
		name = deluge_pomerania4optb
		
		trigger = { TAG = POL }
		
		add_state_core = 62
		add_state_core = 63
		add_state_core = 85
		
		if = {
			limit = { WGR = { owns_state = 64 } }
			create_wargoal = {
				type = take_core_state
				target = WGR
				generator = { 62 63 85 }
			}
		}

		if = {
			limit = { GER = { owns_state = 64 } }
			create_wargoal = {
				type = take_core_state
				target = GER
				generator = { 62 63 85 }
			}
		}

		if = {
			limit = { DDR = { owns_state = 64 } }
			create_wargoal = {
				type = take_core_state
				target = DDR
				generator = { 62 63 85 }
			}
		}
	}
	option = {
		name = deluge_pomerania4optc
		trigger = {
			OR = {
				TAG = FRA
				TAG = WGR
				TAG = DDR
				TAG = GER
			}
		}
	}
}

# Poland is awarded Pomerania

country_event = {
	id = deluge_pomerania.5
	title = deluge_pomerania5title
	desc = deluge_pomerania5desc
	
	picture = GFX_deluge_port
	
	is_triggered_only = yes	
	
	option = {
		name = deluge_pomerania5opt
		
		add_state_core = 62
		add_state_core = 63
		add_state_core = 85
		
		hidden_effect = {
			POM = {
				if = {
					limit = { democratic > 0.5 }
					set_politics = {
						ruling_party = democratic
						elections_allowed = yes
					}
				}
				if = {
					limit = { communism > 0.5 }
					set_politics = {
						ruling_party = communism
						elections_allowed = yes
					}
				}
				if = {
					limit = { fascism > 0.5 }
					set_politics = {
						ruling_party = fascism
						elections_allowed = no
					}
				}
				if = {
					limit = {
						NOT = {
							OR = { 
								democratic > 0.5 
								communism > 0.5 
								fascism > 0.5 
							}
						}
					}
					add_popularity = {
						ideology = democratic
						popularity = 0.5
					}
					set_politics = {
						ruling_party = democratic
						elections_allowed = yes
					}
				}
			}
		}
		
		annex_country = { target = POM transfer_troops = no }
		
		hidden_effect = {
			news_event = { days = 1 id = deluge_pomerania.6 }
		}
	}
}

# World is informed of the Polish award and Germany gets cores and a CB

news_event = {
	id = deluge_pomerania.6
	title = deluge_pomerania6title
	desc = deluge_pomerania6desc

	picture = GFX_deluge_public_funeral
	
	major = yes
	
	is_triggered_only = yes
		
	option = {
		name = deluge_pomerania6opta
		trigger = {
			NOT = {
				OR = {
					TAG = FRA
					TAG = POL
					TAG = WGR
					TAG = DDR
					TAG = GER
				}
			}
		}
	}
	option = {
		name = deluge_pomerania6optb
		
		trigger = {
			OR = {
				TAG = WGR
				TAG = DDR
				TAG = GER
			}
			country_exists = ROOT
		}
		
		add_state_core = 62
		add_state_core = 63
		add_state_core = 85
		
		create_wargoal = {
			type = take_core_state
			target = POL
			generator = { 62 63 85 }
		}
	}
	option = {
		name = deluge_pomerania6optc
		trigger = {
			OR = {
				TAG = FRA
				TAG = POL
			}
		}
	}
}

# World is announced of the start of the plebiscite campaign

news_event = {
	id = deluge_pomerania.7
	title = deluge_pomerania7title
	desc = deluge_pomerania7desc

	picture = GFX_deluge_public_funeral
	
	major = yes
	
	is_triggered_only = yes

	option = {
		name = deluge_pomerania7opta
		trigger = {
			TAG = FRA
		}
		set_global_flag = france_starts_pomeranian_plebiscite
	}
	option = {
		name = deluge_pomerania7optb
		
		trigger = {
			OR = {
				TAG = POL
				TAG = WGR
				TAG = DDR
				TAG = GER
			}
			country_exists = ROOT
		}
	}
	option = {
		name = deluge_pomerania7optc
		trigger = {
			NOT = {
				OR = {
					TAG = FRA
					TAG = POL
					TAG = WGR
					TAG = DDR
					TAG = GER
				}
			}
		}
	}
}

# Outcome: join Poland

country_event = {
	id = deluge_pomerania.8
	title = deluge_pomerania8title
	desc = deluge_pomerania8desc
	
	picture = GFX_deluge_port
	
	fire_only_once = yes
	
	trigger = {
		TAG = POM
		has_global_flag = france_starts_pomeranian_plebiscite
		NOT = { has_global_flag = pomeranian_plebiscite_results_announced }
		country_exists = POL
	}
	
	mean_time_to_happen = {
		days = 100
		modifier = {
			factor = 0.1
			has_idea = deluge_mandate_institutions_idea
			POL = { has_government = democratic }
		}
		modifier = {
			factor = 0.5
			democratic > 0.35
			POL = { has_government = democratic }
		}
		modifier = {
			factor = 0.2
			democratic > 0.45
			POL = { has_government = democratic }
		}
		modifier = {
			factor = 0.1
			has_idea = deluge_kashubian_nationalism_idea
			POL = { has_government = fascism }
		}
		modifier = {
			factor = 0.5
			fascism > 0.35
			POL = { has_government = fascism }
		}
		modifier = {
			factor = 0.2
			fascism > 0.45
			POL = { has_government = fascism }
		}
		modifier = {
			factor = 0.1
			has_idea = deluge_pomeranian_populism_idea
			POL = { has_government = communism }
		}
		modifier = {
			factor = 0.5
			communism > 0.35
			POL = { has_government = communism }
		}
		modifier = {
			factor = 0.2
			communism > 0.45
			POL = { has_government = communism }
		}
		modifier = {
			factor = 0.5
			neutrality > 0.35
			POL = { has_government = neutrality }
		}
		modifier = {
			factor = 0.2
			neutrality > 0.45
			POL = { has_government = neutrality }
		}
	}
	
	immediate = { 
		set_global_flag = pomeranian_plebiscite_results_announced
	}
	
	option = {
		name = deluge_pomerania8opt
		
		hidden_effect = {
			news_event = { days = 1 id = deluge_pomerania.9 }
		}
	}
}

# Poland annexes Pomerania, Germany gets cores but no CB

news_event = {
	id = deluge_pomerania.9
	title = deluge_pomerania9title
	desc = deluge_pomerania9desc

	picture = GFX_deluge_public_funeral
	
	major = yes
	
	is_triggered_only = yes

	option = {
		name = deluge_pomerania9opta
		
		trigger = {
			TAG = POL
		}
		
		hidden_effect = {
			POM = {
				if = {
					limit = { democratic > 0.5 }
					set_politics = {
						ruling_party = democratic
						elections_allowed = yes
					}
				}
				if = {
					limit = { communism > 0.5 }
					set_politics = {
						ruling_party = communism
						elections_allowed = yes
					}
				}
				if = {
					limit = { fascism > 0.5 }
					set_politics = {
						ruling_party = fascism
						elections_allowed = no
					}
				}
				if = {
					limit = {
						NOT = {
							OR = { 
								democratic > 0.5 
								communism > 0.5 
								fascism > 0.5 
							}
						}
					}
					add_popularity = {
						ideology = democratic
						popularity = 0.5
					}
					set_politics = {
						ruling_party = democratic
						elections_allowed = yes
					}
				}
			}
		}
		
		add_state_core = 62
		add_state_core = 63
		add_state_core = 85
		
		annex_country = { target = POM transfer_troops = no }
		
	}
	option = {
		name = deluge_pomerania9optb
		trigger = {
			TAG = FRA
		}
	}
	option = {
		name = deluge_pomerania9optc
		
		trigger = {
			OR = {
				TAG = WGR
				TAG = DDR
				TAG = GER
			}
			country_exists = ROOT
		}
		add_state_core = 62
		add_state_core = 63
		add_state_core = 85
	}
	option = {
		name = deluge_pomerania9optd
		trigger = {
			NOT = {
				OR = {
					TAG = FRA
					TAG = POL
					TAG = WGR
					TAG = DDR
					TAG = GER
				}
			}
		}
	}
}

# Outcome: join Germany

country_event = {
	id = deluge_pomerania.10
	title = deluge_pomerania10title
	desc = deluge_pomerania10desc
	
	picture = GFX_deluge_port
	
	fire_only_once = yes
	
	trigger = {
		TAG = POM
		has_global_flag = france_starts_pomeranian_plebiscite
		NOT = { has_global_flag = pomeranian_plebiscite_results_announced }
		OR = {
			country_exists = WGR
			country_exists = GER
			country_exists = DDR
		}
	}
	
	mean_time_to_happen = {
		days = 100
		modifier = {
			factor = 0.1
			has_idea = deluge_mandate_institutions_idea
			OR = {
				WGR = {
					owns_state = 64
					has_government = democratic
				}
				GER = {
					owns_state = 64
					has_government = democratic
				}
				DDR = {
					owns_state = 64
					has_government = democratic
				}
			}
		}
		modifier = {
			factor = 0.5
			democratic > 0.35
			OR = {
				WGR = {
					owns_state = 64
					has_government = democratic
				}
				GER = {
					owns_state = 64
					has_government = democratic
				}
				DDR = {
					owns_state = 64
					has_government = democratic
				}
			}
		}
		modifier = {
			factor = 0.2
			democratic > 0.45
			OR = {
				WGR = {
					owns_state = 64
					has_government = democratic
				}
				GER = {
					owns_state = 64
					has_government = democratic
				}
				DDR = {
					owns_state = 64
					has_government = democratic
				}
			}
		}
		modifier = {
			factor = 0.1
			has_idea = deluge_kashubian_nationalism_idea
			OR = {
				WGR = {
					owns_state = 64
					has_government = fascism
				}
				GER = {
					owns_state = 64
					has_government = fascism
				}
				DDR = {
					owns_state = 64
					has_government = fascism
				}
			}
		}
		modifier = {
			factor = 0.5
			fascism > 0.35
			OR = {
				WGR = {
					owns_state = 64
					has_government = fascism
				}
				GER = {
					owns_state = 64
					has_government = fascism
				}
				DDR = {
					owns_state = 64
					has_government = fascism
				}
			}
		}
		modifier = {
			factor = 0.2
			fascism > 0.45
			OR = {
				WGR = {
					owns_state = 64
					has_government = fascism
				}
				GER = {
					owns_state = 64
					has_government = fascism
				}
				DDR = {
					owns_state = 64
					has_government = fascism
				}
			}
		}
		modifier = {
			factor = 0.1
			has_idea = deluge_pomeranian_populism_idea
			OR = {
				WGR = {
					owns_state = 64
					has_government = communism
				}
				GER = {
					owns_state = 64
					has_government = communism
				}
				DDR = {
					owns_state = 64
					has_government = communism
				}
			}
		}
		modifier = {
			factor = 0.5
			communism > 0.35
			OR = {
				WGR = {
					owns_state = 64
					has_government = communism
				}
				GER = {
					owns_state = 64
					has_government = communism
				}
				DDR = {
					owns_state = 64
					has_government = communism
				}
			}
		}
		modifier = {
			factor = 0.2
			communism > 0.45
			OR = {
				WGR = {
					owns_state = 64
					has_government = communism
				}
				GER = {
					owns_state = 64
					has_government = communism
				}
				DDR = {
					owns_state = 64
					has_government = communism
				}
			}
		}
		modifier = {
			factor = 0.5
			neutrality > 0.35
			OR = {
				WGR = {
					owns_state = 64
					has_government = neutrality
				}
				GER = {
					owns_state = 64
					has_government = neutrality
				}
				DDR = {
					owns_state = 64
					has_government = neutrality
				}
			}
		}
		modifier = {
			factor = 0.2
			neutrality > 0.45
			OR = {
				WGR = {
					owns_state = 64
					has_government = neutrality
				}
				GER = {
					owns_state = 64
					has_government = neutrality
				}
				DDR = {
					owns_state = 64
					has_government = neutrality
				}
			}
		}
	}
	
	immediate = { 
		set_global_flag = pomeranian_plebiscite_results_announced
	}
	
	option = {
		name = deluge_pomerania10opt
		
		hidden_effect = {
			news_event = { days = 1 id = deluge_pomerania.11 }
		}
	}
}

# Germany annexes Pomerania, Poland gets cores but no CB

news_event = {
	id = deluge_pomerania.11
	title = deluge_pomerania11title
	desc = deluge_pomerania11desc

	picture = GFX_deluge_public_funeral
	
	major = yes
	
	is_triggered_only = yes

	option = {
		name = deluge_pomerania11opta
		
		trigger = {
			OR = {
				TAG = WGR
				TAG = DDR
				TAG = GER
			}
			owns_state = 64
		}
		
		hidden_effect = {
			POM = {
				if = {
					limit = { democratic > 0.5 }
					set_politics = {
						ruling_party = democratic
						elections_allowed = yes
					}
				}
				if = {
					limit = { communism > 0.5 }
					set_politics = {
						ruling_party = communism
						elections_allowed = yes
					}
				}
				if = {
					limit = { fascism > 0.5 }
					set_politics = {
						ruling_party = fascism
						elections_allowed = no
					}
				}
				if = {
					limit = {
						NOT = {
							OR = { 
								democratic > 0.5 
								communism > 0.5 
								fascism > 0.5 
							}
						}
					}
					add_popularity = {
						ideology = democratic
						popularity = 0.5
					}
					set_politics = {
						ruling_party = democratic
						elections_allowed = yes
					}
				}
			}
		}
		
		add_state_core = 62
		add_state_core = 63
		add_state_core = 85
		
		annex_country = { target = POM transfer_troops = no }
		
	}
	option = {
		name = deluge_pomerania11optb
		trigger = {
			TAG = FRA
		}
	}
	option = {
		name = deluge_pomerania11optc
		
		trigger = {
			TAG = POL
		}
		add_state_core = 62
		add_state_core = 63
		add_state_core = 85
	}
	option = {
		name = deluge_pomerania11optd
		trigger = {
			NOT = {
				OR = {
					TAG = FRA
					TAG = POL
					TAG = WGR
					TAG = DDR
					TAG = GER
				}
			}
		}
	}
}

# Starting event to set the ideology of a future independent Pomerania

country_event = {
	id = deluge_pomerania.12
	title = deluge_pomerania12title
	desc = deluge_pomerania12desc
	
	picture = GFX_deluge_port
	
	fire_only_once = yes
	
	trigger = {
		TAG = POM
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		name = deluge_pomerania12opta
		
		add_ideas = deluge_pomeranian_populism_idea
		
		ai_chance = {
			factor = 1
		}
	}
	
	option = {
		name = deluge_pomerania12optb
		
		add_ideas = deluge_mandate_institutions_idea
		
		ai_chance = {
			factor = 1
		}
	}
	
	option = {
		name = deluge_pomerania12optc
		
		add_ideas = deluge_kashubian_nationalism_idea
		
		ai_chance = {
			factor = 1
		}
	}
}

# News even for Pomerania's unilateral declaration of independence

news_event = {
	id = deluge_pomerania.13
	title = deluge_pomerania13title
	
	desc = {
		text = deluge_pomerania13desccommunism
		trigger = { FROM = { has_idea = deluge_pomeranian_populism_idea } }
	}
	desc = {
		text = deluge_pomerania13descdemocratic
		trigger = { FROM = { has_idea = deluge_mandate_institutions_idea } }
	}
	desc = {
		text = deluge_pomerania13descfascism
		trigger = { FROM = { has_idea = deluge_kashubian_nationalism_idea } }
	}

	picture = GFX_deluge_public_funeral
	
	major = yes
	
	is_triggered_only = yes

	option = {
		name = deluge_pomerania13opta
		trigger = {
			TAG = POM
		}
	}
	option = {
		name = deluge_pomerania13optb
		trigger = {
			TAG = FRA
		}
	}
	option = {
		name = deluge_pomerania13optc
		
		trigger = {
			OR = {
				TAG = POL
				TAG = WGR
				TAG = DDR
				TAG = GER
			}
		}
	}
	option = {
		name = deluge_pomerania13optd
		trigger = {
			NOT = {
				OR = {
					TAG = FRA
					TAG = POL
					TAG = WGR
					TAG = DDR
					TAG = GER
					TAG = POM
				}
			}
		}
	}
}

# Outcome: split down the middle

country_event = {
	id = deluge_pomerania.15
	title = deluge_pomerania15title
	desc = deluge_pomerania15desc
	
	picture = GFX_deluge_port
	
	fire_only_once = yes
	
	trigger = {
		TAG = POM
		has_global_flag = france_starts_pomeranian_plebiscite
		NOT = { has_global_flag = pomeranian_plebiscite_results_announced }
		country_exists = POL
		OR = {
			country_exists = WGR
			country_exists = GER
			country_exists = DDR
		}
	}
	
	mean_time_to_happen = {
		days = 100
		modifier = {
			factor = 0.1
			has_idea = deluge_mandate_institutions_idea
			NOT = {
				OR = {
					POL = { has_government = democratic }
					DDR = {
						owns_state = 64
						has_government = democratic
					}
					GER = {
						owns_state = 64
						has_government = democratic
					}
					WGR = {
						owns_state = 64
						has_government = democratic
					}
				}
			}
		}
		modifier = {
			factor = 0.1
			has_idea = deluge_kashubian_nationalism_idea
			NOT = {
				OR = {
					POL = { has_government = fascism }
					DDR = {
						owns_state = 64
						has_government = fascism
					}
					GER = {
						owns_state = 64
						has_government = fascism
					}
					WGR = {
						owns_state = 64
						has_government = fascism
					}
				}
			}
		}
		modifier = {
			factor = 0.1
			has_idea = deluge_pomeranian_populism_idea
			NOT = {
				OR = {
					POL = { has_government = communism }
					DDR = {
						owns_state = 64
						has_government = communism
					}
					GER = {
						owns_state = 64
						has_government = communism
					}
					WGR = {
						owns_state = 64
						has_government = communism
					}
				}
			}
		}
	}
	
	immediate = { 
		set_global_flag = pomeranian_plebiscite_results_announced
	}
	
	option = {
		name = deluge_pomerania15opt
		
		hidden_effect = {
			news_event = { days = 1 id = deluge_pomerania.16 }
		}
	}
}

# Germany and Poland get cores and seize their respective portions

news_event = {
	id = deluge_pomerania.16
	title = deluge_pomerania16title
	desc = deluge_pomerania16desc

	picture = GFX_deluge_public_funeral
	
	major = yes
	
	is_triggered_only = yes
		
	option = {
		name = deluge_pomerania16opta
		trigger = {
			NOT = {
				TAG = FRA
				TAG = POL
				TAG = WGR
				TAG = DDR
				TAG = GER
			}
		}
	}
	option = {
		name = deluge_pomerania16optb
		
		trigger = { TAG = POL }
		
		add_state_core = 62
		add_state_core = 63
		add_state_core = 85
		
		hidden_effect = {
			POM = {
				if = {
					limit = { democratic > 0.5 }
					set_politics = {
						ruling_party = democratic
						elections_allowed = yes
					}
				}
				if = {
					limit = { communism > 0.5 }
					set_politics = {
						ruling_party = communism
						elections_allowed = yes
					}
				}
				if = {
					limit = { fascism > 0.5 }
					set_politics = {
						ruling_party = fascism
						elections_allowed = no
					}
				}
				if = {
					limit = {
						NOT = {
							OR = { 
								democratic > 0.5 
								communism > 0.5 
								fascism > 0.5 
							}
						}
					}
					add_popularity = {
						ideology = democratic
						popularity = 0.5
					}
					set_politics = {
						ruling_party = democratic
						elections_allowed = yes
					}
				}
			}
		}
		
		POM = {
			if = {
				limit = { WGR = { owns_state = 64 } }
				WGR = { transfer_state = 62 }
			}
			if = {
				limit = { GER = { owns_state = 64 } }
				GER = { transfer_state = 62 }
			}
			if = {
				limit = { DDR = { owns_state = 64 } }
				DDR = { transfer_state = 62 }
			}
		}
		
		annex_country = { target = POM transfer_troops = no }
		
	}
	option = {
		name = deluge_pomerania16optc
		
		trigger = {
			OR = {
				TAG = WGR
				TAG = DDR
				TAG = GER
			}
			country_exists = ROOT
		}
		
		add_state_core = 62
		add_state_core = 63
		add_state_core = 85
		
	}
	option = {
		name = deluge_pomerania16optd
		trigger = { TAG = FRA }
	}
}

