﻿###########################
# NSB Polish Events
###########################

add_namespace = NSB_poland_events

#Poland demands Slovakia
country_event = {
	id = NSB_poland_events.1
	title = NSB_poland_events.1.t
	desc = NSB_poland_events.1.desc
	picture = GFX_report_event_lithuanian_ultimatum


	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Getting annexed by Poland? Sounds like a great idea!
		name = NSB_poland_events.1.a
		ai_chance = {
			base = 30
			modifier = {
				add = -25
				POL = { has_army_size = { size < 40 } }
			}
			modifier = {
				add = 100
				POL = { has_army_size = { size > 39 } }
			}
			modifier = {
				add = 20
				is_in_faction_with = POL
			}
			modifier = {
				factor = 0.1
				is_in_faction = yes
				NOT = { is_in_faction_with = POL }
			}
		}
		hidden_effect = {
			POL = {
				country_event = { hours = 2 id = NSB_poland_events.101 }
			}
		}
		if = {
			limit = {
				has_idea = CZE_divided_nation
			}
			remove_ideas = CZE_divided_nation
		}
		effect_tooltip = {
			if = {
				limit = {
					owns_state = 70
				}
				POL = { transfer_state = 70 }
			}
			if = {
				limit = {
					owns_state = 71
				}
				POL = { transfer_state = 71 }
			}
			if = {
				limit = {
					owns_state = 72
				}
				POL = { transfer_state = 72 }
			}
			if = {
				limit = {
					owns_state = 73
				}
				POL = { transfer_state = 73 }
			}
			if = {
				limit = {
					owns_state = 664
				}
				POL = { transfer_state = 664 }
			}
		}
		if = {
			limit = {
				original_tag = CZE
			}
			set_cosmetic_tag = CZE_ONLY
		}
		if = {
			limit = {
				original_tag = SLO
			}
			custom_effect_tooltip = GAME_OVER_TT
		}
	}

	option = { #No thank you
		name = NSB_poland_events.1.b
		ai_chance = {
			base = 10
			modifier = {
				POL = { has_army_size = { size > 39 } }
				factor = 0.5
			}
			modifier = {
				add = 20
				POL = { has_army_size = { size < 30 } }
			}
			modifier = {
				factor = 2
				is_in_faction = yes
				NOT = { is_in_faction_with = POL }
			}
			modifier = {
				any_other_country = {
					is_major = yes
					is_in_faction_with = ROOT
				}
				factor = 50 #I'm Slovakia and I'm in the axis
			}
			modifier = {
				any_other_country = {
					has_guaranteed = ROOT
				}
				factor = 5 #i've got friends
			}
			modifier = {
				any_other_country = {
					is_major = yes
					has_guaranteed = ROOT
				}
				factor = 5 #i've got big friends
			}
		}
		POL = {
			add_opinion_modifier = { target = PREV modifier = POL_annexation_refused }
			country_event = { hours = 2 id = NSB_poland_events.102 }
			if = { limit = { is_in_faction_with = ROOT }
				remove_from_faction = ROOT
			}
		}
	}
}
#Slovakia/Czechoslovakia says yes, gain Slovakia
country_event = {
	id = NSB_poland_events.101
	title = NSB_poland_events.101.t
	desc = NSB_poland_events.101.desc
	picture = GFX_report_event_generic_conference
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Slovakia is ceded to Poland
		name = NSB_poland_events.101.a
		ai_chance = {
			base = 10
		}
		if = {
			limit = {
				FROM = {
					original_tag = SLO
				}
			}
			annex_country = {
				target = FROM
				transfer_troops = yes
			}
		}
		else = {
			if = {
				limit = {
					FROM = { owns_state = 70 }
				}
				transfer_state = 70
			}
			if = {
				limit = {
					FROM = { owns_state = 71 }
				}
				transfer_state = 71
			}
			if = {
				limit = {
					FROM = { owns_state = 72 }
				}
				transfer_state = 72
			}
			if = {
				limit = {
					FROM = { owns_state = 73 }
				}
				transfer_state = 73
			}
			if = {
				limit = {
					FROM = { owns_state = 664 }
				}
				transfer_state = 664
			}
		}
	}
}
#Slovakia/Czechoslovakia says no, gain a wargoal
country_event = {
	id = NSB_poland_events.102
	title = NSB_poland_events.102.t
	desc = NSB_poland_events.102.desc
	picture = GFX_report_event_poland_rejects
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Getting annexed by Poland? Sounds like a great idea!
		name = NSB_poland_events.102.a
		ai_chance = {
			base = 10
		}
		create_wargoal = {
			type = annex_everything
			target = FROM
		}
	}
}

#Poland claims the throne of Hungary
country_event = {
	id = NSB_poland_events.2
	title = NSB_poland_events.2.t
	desc = NSB_poland_events.2.d
	picture = GFX_report_event_generic_rally
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Sure!
		name = NSB_poland_events.2.a
		ai_chance = {
			base = 30
			modifier = {
				add = -25
				POL = { has_army_size = { size < 40 } }
			}
			modifier = {
				add = 100
				POL = { has_army_size = { size > 39 } }
			}
			modifier = {
				add = 20
				is_in_faction_with = POL
			}
			modifier = {
				factor = 0.1
				is_in_faction = yes
			}
			modifier = {
				factor = 0
				has_completed_focus = HUN_elect_a_king
			}
		}
		POL = {
			country_event = { hours = 2 id = NSB_poland_events.201 }
		}
		effect_tooltip = {
			POL = {
				set_autonomy = {
					target = HUN
					autonomy_state = autonomy_personal_union
				}
			}
		}
	}

	option = { #No thank you
		name = NSB_poland_events.2.b
		ai_chance = {
			base = 10
			modifier = {
				POL = { has_army_size = { size > 39 } }
				factor = 0.5
			}
			modifier = {
				add = 20
				POL = { has_army_size = { size < 30 } }
			}
			modifier = {
				factor = 2
				is_in_faction = yes
				NOT = { is_in_faction_with = POL }
			}
			modifier = {
				any_other_country = {
					has_guaranteed = HUN
				}
				factor = 5 #i've got friends
			}
			modifier = {
				any_other_country = {
					is_major = yes
					has_guaranteed = HUN
				}
				factor = 5 #i've got big friends
			}
		}
		POL = {
			add_opinion_modifier = { target = PREV modifier = POL_annexation_refused }
			country_event = { hours = 2 id = NSB_poland_events.202 }
			if = { limit = { is_in_faction_with = HUN }
				remove_from_faction = HUN
			}
		}
	}
}

#Hungary says yes, Hungary becomes a puppet
country_event = {
	id = NSB_poland_events.201
	title = NSB_poland_events.201.t
	desc = NSB_poland_events.201.desc
	picture = GFX_report_event_generic_parliament
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Hungary is ceded to Poland
		name = NSB_poland_events.201.a
		ai_chance = {
			base = 10
		}
		set_autonomy = {
			target = HUN
			autonomy_state = autonomy_personal_union
		}
	}
}
#Hungary says no, gain a wargoal
country_event = {
	id = NSB_poland_events.202
	title = NSB_poland_events.202.t
	desc = NSB_poland_events.202.desc
	picture = GFX_report_event_military_planning
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Getting annexed by Poland? Sounds like a great idea!
		name = NSB_poland_events.202.a
		ai_chance = {
			base = 10
		}
		create_wargoal = {
			type = puppet_wargoal_focus
			target = FROM
		}
	}
}

#Poland proposes alliance with the Kaiser, but kaiser is not in a faction already.
country_event = {
	id = NSB_poland_events.3
	title = NSB_poland_events.3.t
	desc = NSB_poland_events.3.desc
	picture = GFX_report_event_generic_read_write
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Accept, Poland forms a faction
		name = NSB_poland_events.3.a
		ai_chance = {
			factor = 70
			modifier = {
				threat > 0.3
				add = 30
			}
		}
		add_ai_strategy = {
			type = alliance
			id = "POL"
			value = 200
		}
		FROM = { country_event = NSB_poland_events.301 }
	}
	option = { #no
		name = NSB_poland_events.3.b
		ai_chance = {
			factor = 30
			modifier = {
				has_wargoal_against = POL
				factor = 0
			}
		}
		FROM = { country_event = NSB_poland_events.302 }
	}
	option = { #Germany agrees with the caviat that Poland cedes Danzig because I'm player Germany and if I don't get Danzig the game is literally unplayable, the devs should spend less time making a Polish focus tree and more time fixing the ai.
		name = NSB_poland_events.3.c
		ai_chance = {
			factor = 0
		}
		trigger = {
			OR = {
				POL = { owns_state = 807 }
				POL = { owns_state = 85 }
			}
		}
		FROM = { country_event = NSB_poland_events.303 }
	}
}

#Germany accepts
country_event = {
	id = NSB_poland_events.301
	title = NSB_poland_events.301.t
	desc = NSB_poland_events.301.desc
	picture = GFX_report_event_generic_sign_treaty2
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Accept, Poland forms a faction
		name = NSB_poland_events.301.a
		set_rule = {
			can_create_factions = yes
		}
		create_faction = POL_GER_ALLIANCE
		add_to_faction = GER
	}
}

#Germany refuses
country_event = {
	id = NSB_poland_events.302
	title = NSB_poland_events.302.t
	desc = NSB_poland_events.302.desc
	picture = GFX_report_event_generic_rally2
	
	is_triggered_only = yes

	fire_only_once = yes

	option = {
		name = NSB_poland_events.302.a
		create_wargoal = {
			type = puppet_wargoal_focus
			target = GER
		}
	}
}

#Germany asks for Danzig in ecxhange for Alliance  
country_event = {
	id = NSB_poland_events.303
	title = NSB_poland_events.303.t
	desc = NSB_poland_events.303.desc
	picture = GFX_report_event_generic_parliament
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Accept, Poland cedes Danzig and Germany joins the faction.
		name = NSB_poland_events.303.a
		ai_chance = {
			factor = 30
			modifier = {
				add = -25
				GER = { has_army_size = { size < 40 } }
			}
			modifier = {
				add = 100
				GER = { has_army_size = { size > 39 } }
			}
		}
		set_rule = {
			can_create_factions = yes
		}
		create_faction = POL_GER_ALLIANCE
		add_to_faction = GER
		if = {
			limit = {
				owns_state = 807
			}
			807 = { add_core_of = GER }
			GER = { transfer_state = 807 }
		}
		if = {
			limit = {
				owns_state = 85
			}
			85 = { add_core_of = GER }
			GER = { transfer_state = 85 }
		}
	}

	option = { #Refuse, don't give Germany Danzig but they get a wargoal to stop players from ragequitting over Danzig. Again.
		name = germany.86.b
		ai_chance = {
			factor = 40
		}
		effect_tooltip = {
			GER = {
				create_wargoal = {
					type = take_state
					target = POL
					generator = { 85 807 }
				}
			}
		}
		hidden_effect = {
			GER = { country_event = { id = NSB_poland_events.304 days = 2 } }
		}
	}
}

country_event = {
	id = NSB_poland_events.304
	title = NSB_poland_events.304.t
	desc = NSB_poland_events.304.desc
	picture = GFX_report_event_military_planning
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Danzig or war
		name = NSB_poland_events.304.a
		ai_chance = {
			factor = 40
		}
		create_wargoal = {
			type = take_state
			target = POL
			generator = { 85 807 }
		}
	}
}


#Poland wants to buy Madagascar
country_event = {
	id = NSB_poland_events.4
	title = NSB_poland_events.4.t
	desc = NSB_poland_events.4.desc
	picture = GFX_report_event_generic_conference
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Sell the island(s) to Poland
		name = NSB_poland_events.4.a
		ai_chance = {
			base = 10
			modifier = { #Shouldn't sell Madagascar if that is all they have left.
				factor = 0
				has_capitulated = yes
				NOT = {
					any_controlled_state = {
						NOT = {
							state = 543
							state = 708
							state = 706
						}
					}
				}
			}
		}
		POL = {
			transfer_state = 543
		}
		if = {
			limit = {
				owns_state = 708
				controls_state = 708
			}
			POL = {
				transfer_state = 708
			}
		}
		if = {
			limit = {
				owns_state = 706
				controls_state = 706
			}
			POL = {
				transfer_state = 706
			}
		}
		add_timed_idea = {
			idea = POL_sold_colony_expensive
			days = 720
		}
			POL = { country_event = { id = NSB_poland_events.401 } }
	}
	option = { #Refuse to sell the islands
		name = NSB_poland_events.4.b
		ai_chance = {
			base = 10
			modifier = { #Should generally be okay with selling Madagascar if they have other territory left.
				factor = 0.5
				any_controlled_state = {
					NOT = {
						OR = {
							state = 543
							state = 708
							state = 706
						}
					}
				}
			}
		}
		hidden_effect = {
			543 = { set_state_flag = rejected_purchase_flag }
		}
		POL = { country_event = { id = NSB_poland_events.402 } }
	}
}
#Madagascar sale goes through
country_event = {
	id = NSB_poland_events.401
	title = NSB_poland_events.401.t
	desc = {
		text = NSB_poland_events.401.desc.dem
		trigger = {
			POL = { NOT = { has_government = communism } }
		}
	}
	desc = {
		text = NSB_poland_events.401.desc.com
		trigger = {
			POL = { has_government = communism }
		}
	}
	picture = GFX_report_event_generic_sign_treaty2
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Sell the island(s) to Poland
		name = NSB_poland_events.401.a
		ai_chance = {
			base = 10
		}
		transfer_state = 543
		if = {
			limit = {
				FROM = {
					owns_state = 708
					controls_state = 708
				}
			}
			transfer_state = 708
		}
		if = {
			limit = {
				FROM = {
					owns_state = 706
					controls_state = 706
				}
			}
			POL = {
				transfer_state = 706
			}
		}
	}
}
#France refuses to sell Madagascar
country_event = {
	id = NSB_poland_events.402
	title = NSB_poland_events.402.t
	desc = NSB_poland_events.402.desc
	picture = GFX_report_event_generic_parliament
	
	is_triggered_only = yes

	option = { #Sell the island(s) to Poland
		name = NSB_poland_events.402.a
		ai_chance = {
			base = 10
		}
		remove_decision_on_cooldown = POL_purchase_madagascar
	}
}

#Poland wants to buy other colonies
country_event = {
	id = NSB_poland_events.5	
	title = NSB_poland_events.4.t
	desc = NSB_poland_events.4.desc
	picture = GFX_report_event_generic_conference
	
	is_triggered_only = yes

	option = { #Sell the island(s) to Poland
		name = NSB_poland_events.4.a
		ai_chance = {
			base = 10
			modifier = { #Shouldn't sell their colony if that is all they have left.
				factor = 0
				has_capitulated = yes
				NOT = {
					any_controlled_state = {
						NOT = {
							state = POL_colony_purchase
						}
					}
				}
			}
		}
		POL = {
			transfer_state = event_target:POL_colony_purchase
		}
		if = {
			limit = {
				event_target:POL_colony_purchase = {
					state = 546
				}
			}
			add_timed_idea = {
				idea = POL_sold_colony_expensive
				days = 720
			}
		}
		else = {
			add_timed_idea = {
				idea = POL_sold_colony_cheap
				days = 720
			}
		}
		POL = { country_event = { id = NSB_poland_events.501 } }
	}
	option = { #Refuse to sell the colony
		name = NSB_poland_events.4.b
		ai_chance = {
			base = 10
			modifier = { #Should generally be okay with selling their colonies if they have other territory left.
				factor = 0.5
				any_controlled_state = {
					NOT = {
						state = POL_colony_purchase
					}
				}
			}
		}
		hidden_effect = {
			event_target:POL_colony_purchase = { set_state_flag = rejected_purchase_flag }
		}
		POL = { country_event = { id = NSB_poland_events.502 } }
	}
}
#Colony sale succeeds
country_event = {
	id = NSB_poland_events.501
	title = NSB_poland_events.401.t
	desc = {
		text = NSB_poland_events.401.desc.dem
		trigger = {
			POL = { NOT = { has_government = communism } }
		}
	}
	desc = {
		text = NSB_poland_events.401.desc.com
		trigger = {
			POL = { has_government = communism }
		}
	}
	picture = GFX_report_event_generic_read_write
	
	is_triggered_only = yes

	option = { #Sell the island(s) to Poland
		name = NSB_poland_events.401.a
		ai_chance = {
			base = 10
		}
		effect_tooltip = {
			transfer_state = event_target:POL_colony_purchase
		}
	}
}
#Colony sale fails
country_event = {
	id = NSB_poland_events.502
	title = NSB_poland_events.402.t
	desc = NSB_poland_events.402.desc
	picture = GFX_report_event_journalists_speech
	
	is_triggered_only = yes

	option = { #Decision is removed so Poland is not throwing civ factories down the drain for nothing.
		name = NSB_poland_events.402.a
		ai_chance = {
			base = 10
		}
		custom_effect_tooltip = POL_remove_colony_purchase_tt
		hidden_effect = {
			if = {
				limit = {
					event_target:POL_colony_purchase = {
						state = 701
					}
				}
				remove_decision_on_cooldown = POL_purchase_gambia
			}
			if = {
				limit = {
					event_target:POL_colony_purchase = {
						state = 773
					}
				}
				remove_decision_on_cooldown = POL_purchase_cheap_colony
			}
			if = {
				limit = {
					event_target:POL_colony_purchase = {
						state = 546
					}
				}
				remove_decision_on_cooldown = POL_purchase_cheap_colony
			}
			if = {
				limit = {
					event_target:POL_colony_purchase = {
						state = 454
					}
				}
				remove_decision_on_cooldown = POL_purchase_cheap_colony
			}
		}
	}
}

#Poland asks Liberia to become a puppet
country_event = {
	id = NSB_poland_events.6
	title = NSB_poland_events.6.t
	desc = NSB_poland_events.6.desc
	picture = GFX_report_event_generic_rally
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Liberia agrees
		name = NSB_poland_events.6.a
		ai_chance = {
			base = 10
			modifier = { 
				add = 25
				strength_ratio = {
					tag = FROM 
					ratio < 0.3	
				}
			}
			modifier = { 
				add = 15 
				has_opinion = {
					target = FROM 
					value > 40 
				}
			}
			modifier = {
				add = 25 
				any_country = {
					is_major = yes 
					is_in_faction_with = FROM 
				}
			}
			modifier = {
				factor = 0.1
				any_country = {
					is_major = yes 
					OR = { 
						has_guaranteed = ROOT 
						is_in_faction_with = ROOT
					}
					NOT = { is_in_faction_with = FROM }
				}
			}
		}
		if = {
			limit = {
				has_dlc = "Together for Victory"
			}
			POL = {
				set_autonomy = {
					target = LIB
					autonomy_state = autonomy_colony
				}
			}
		}
		else = {
			POL = {
				set_autonomy = {
					target = LIB
					autonomy_state = autonomy_puppet
				}
			}
		}
		hidden_effect = {
			news_event = {
				id = nsb_news.2
				days = 1
			}
		}
	}

	option = { #Liberia refuses
		name = NSB_poland_events.6.b
		ai_chance = {
			base = 5
		}
		effect_tooltip = {
			POL = {
				create_wargoal = {
					target = LIB
					type = puppet_wargoal_focus
				}
			}
		}
		hidden_effect = {
			POL = {
				country_event = { id = NSB_poland_events.601 }
			}
		}
	}
}

#Poland is told no by Liberia
country_event = {
	id = NSB_poland_events.601
	title = NSB_poland_events.601.t
	desc = NSB_poland_events.601.desc
	picture = GFX_report_event_generic_parliament
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Gain a wargoal on Liberia. Good luck naval invading.
		name = NSB_poland_events.601.a
		ai_chance = {
			base = 10
		}
		create_wargoal = {
			target = LIB
			type = puppet_wargoal_focus
		}
	}

	option = { #Just let it slide, gain nothing.
		name = NSB_poland_events.601.b
		ai_chance = {
			base = 10
		}
	}
}

#Poland asks France to form the Morges Pact
country_event = {
	id = NSB_poland_events.7
	title = NSB_poland_events.7.t
	desc = NSB_poland_events.7.desc
	picture = GFX_report_event_french_british_officers
	
	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			save_event_target_as = alliance_applicant
			FROM = {
				save_event_target_as = alliance_inviter
			}
		}
	}

	option = { #France agrees
		name = NSB_poland_events.7.a
		ai_chance = {
			base = 10
		}
		FROM = {
			add_to_faction = PREV
			country_event = { id = generic.6 hours = 6 }
			add_ai_strategy = {
				type = alliance
				id = FROM
				value = 200
			}
		}
		add_ai_strategy = {
			type = alliance
			id = FROM
			value = 200
		}
		hidden_effect = {
			set_country_flag = alliance_applicant@ROOT
			FROM = { set_country_flag = alliance_inviter@ROOT }
			news_event = { id = news.289 hours = 12 }
		}
	}

	option = { #France refuses
		name = NSB_poland_events.7.b
		ai_chance = {
			base = 0 #If France gets this event, they should never say no as an AI.
		}
		hidden_effect = {
			POL = {
				country_event = { id = NSB_poland_events.701 }
			}
		}
	}
}
#France says no, change to Bourgois Democracy branch
country_event = {
	id = NSB_poland_events.701
	title = NSB_poland_events.601.t
	desc = NSB_poland_events.701.desc
	picture = GFX_report_event_french_british_officers
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Switch branch
		name = NSB_poland_events.701.a
		ai_chance = {
			base = 10
		}
		dismantle_faction = yes
		uncomplete_national_focus = {
			focus = POL_morges_pact
			uncomplete_children = yes
			refund_political_power = no
		}
		complete_national_focus = POL_preserve_bougoise_democracy
	}
}

#
country_event = {
	id = NSB_poland_events.8
	title = NSB_poland_events.8.t
	desc = NSB_poland_events.8.d
	picture = GFX_report_event_royal_parade

	trigger = {
		tag = POL
		has_country_leader  = {
			character = POL_anna_andersson
			ruling_only  = yes
		}
		has_country_flag = POL_vojtek_commander
		NOT = { is_in_faction_with = SOV }
		219 = {
			controller = {
				OR = {
					tag = POL
					is_in_faction_with = POL
				}
			}
		}
	}

	mean_time_to_happen = {
		days = 1
	}

	fire_only_once = yes

	option = {
		name = NSB_poland_events.8.a
		add_political_power = -100
	}
	option = {
		name = NSB_poland_events.8.b
		promote_character = POL_wojtek
	}
}

add_namespace = NSB_poland_royal_election
# Friedrich Christian
country_event = {
	id = NSB_poland_royal_election.1
	title = NSB_poland_royal_election.1.t
	desc = NSB_poland_royal_election.1.desc
	picture = GFX_report_event_royal_parade
	
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_royal_election.1.a
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				NOT = {
					OR = {
						has_country_flag = POL_AI_RANDOM_COMMONWEALTH
						has_game_rule = {
							rule = POL_ai_behavior
							option = COMMONWEALTH
						}
					}
				}
			}
		}
		set_party_name = { 
			ideology = neutrality 
			long_name = POL_wettin_party
			name = POL_wettin_party 
		}
		hidden_effect = {
			clr_country_flag = POL_searching_for_monarch_flag
		}
		promote_character = POL_friedrich_christian
		complete_national_focus = POL_fulfil_fifth_of_november
		unlock_national_focus = POL_claiming_lithuania
		hidden_effect = {
			set_country_flag = achievement_POL_elected_monarch
			news_event = {
				id = nsb_news.5
				days = 1
			}
		}
	}

	option = {
		name = NSB_poland_royal_election.1.b
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				OR = {
					has_country_flag = POL_AI_RANDOM_COMMONWEALTH
					has_game_rule = {
						rule = POL_ai_behavior
						option = COMMONWEALTH
					}
				}
			}
		}
		custom_effect_tooltip = POL_keep_looking_tt
		hidden_effect = {
			country_event = {
				id = NSB_poland_royal_election.5
				days = 35
			}
		}
	}
}
# King Michael
country_event = {
	id = NSB_poland_royal_election.2
	title = NSB_poland_royal_election.2.t
	desc = NSB_poland_royal_election.2.desc
	picture = GFX_report_event_royal_parade
	
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_royal_election.2.a
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				NOT = {
					OR = {
						has_country_flag = POL_AI_RANDOM_ROMANIA
						has_game_rule = {
							rule = POL_ai_behavior
							option = ROMANIA
						}
					}
				}
			}
		}


		ROM = {
			ROM_king_michael = {
				set_nationality = POL
			}
		}
		if = {
			limit = { POL = { has_character = ROM_king_michael } }
			POL = {
				ROM_king_michael = {
					promote_character = {
						ideology = despotism 
					} 
				}	
			}
		}

		set_party_name = { 
			ideology = neutrality 
			long_name = POL_hohenzollern_sigmaringen_long
			name = POL_hohenzollern_sigmaringen
		}
		hidden_effect = {
			clr_country_flag = POL_searching_for_monarch_flag
		}
		set_country_flag = king_michael_flag
		complete_national_focus = POL_fulfil_fifth_of_november
		unlock_national_focus = POL_hohenzollern
		hidden_effect = {
			set_country_flag = achievement_POL_elected_monarch
			news_event = {
				id = nsb_news.5
				days = 1
			}
		}
	}

	option = {
		name = NSB_poland_royal_election.2.b
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				OR = {
					has_country_flag = POL_AI_RANDOM_ROMANIA
					has_game_rule = {
						rule = POL_ai_behavior
						option = ROMANIA
					}
				}
			}
		}
		custom_effect_tooltip = POL_keep_looking_tt
		hidden_effect = {
			country_event = {
				id = NSB_poland_royal_election.3
				days = 35
			}
		}
	}
}
# Pavel Bermondt-Avalov
country_event = {
	id = NSB_poland_royal_election.3
	title = NSB_poland_royal_election.3.t
	desc = NSB_poland_royal_election.3.desc
	picture = GFX_report_event_royal_visit
	
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_royal_election.3.a
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				NOT = {
					OR = {
						has_country_flag = POL_AI_RANDOM_BERMONDT
						has_game_rule = {
							rule = POL_ai_behavior
							option = BERMONDT
						}
					}
				}
			}
		}
		add_ruling_to_fas = yes
		set_politics = {
			ruling_party = fascism
			elections_allowed = no
			long_name = bermontian_party
			name = bermontian_party 
		}
		promote_character = POL_pavel_bermondt_avalov
		hidden_effect = {
			set_cosmetic_tag = POL_KINGDOM_RUS
			clr_country_flag = POL_searching_for_monarch_flag
		}
		complete_national_focus = POL_fulfil_fifth_of_november
		unlock_national_focus = POL_cossack_king
		hidden_effect = {
			set_country_flag = achievement_POL_elected_monarch
			news_event = {
				id = nsb_news.5
				days = 1
			}
		}
	}

	option = {
		name = NSB_poland_royal_election.3.b
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				OR = {
					has_country_flag = POL_AI_RANDOM_BERMONDT
					has_game_rule = {
						rule = POL_ai_behavior
						option = BERMONDT
					}
				}
			}
		}
		custom_effect_tooltip = POL_keep_looking_tt
		hidden_effect = {
			add_to_variable = {
				var = POL_election_cycle
				value = 1
			}
			if = {
				limit = {
					check_variable = { POL_election_cycle < 2 }
				}
				country_event = {
					id = NSB_poland_royal_election.1
					days = 35
				}
			}
			else = {
				country_event = {
					id = NSB_poland_royal_election.4
					days = 35
				}
			}
		}
	}
}
# "Anastasia"
country_event = {
	id = NSB_poland_royal_election.4
	title = NSB_poland_royal_election.4.t
	desc = NSB_poland_royal_election.4.desc
	picture = GFX_report_event_royal_parade
	
	immediate = {
		hidden_effect = {
			set_country_flag = romanov_enabled
		}
	}

	is_triggered_only = yes
	
	option = {
		name = NSB_poland_royal_election.4.a
		ai_chance = {
			base = 50
		}
		load_focus_tree = {
			tree = polish_focus
			keep_completed = yes
		}
		mark_focus_tree_layout_dirty = yes
		promote_character = POL_anna_andersson
		set_cosmetic_tag = POL_KINGDOM_RUS
		set_party_name = { 
			ideology = neutrality 
			long_name = romanov_party
			name = romanov_party
		}
		complete_national_focus = POL_fulfil_fifth_of_november
		unlock_national_focus = POL_romanov
		hidden_effect = {
			set_country_flag = achievement_POL_elected_monarch
			news_event = {
				id = nsb_news.5
				days = 1
			}
		}
	}

	option = {
		name = NSB_poland_royal_election.4.b
		ai_chance = {
			base = 0
		}
		custom_effect_tooltip = POL_keep_looking_tt
		hidden_effect = {
			country_event = {
				id = NSB_poland_royal_election.1
				days = 35
			}
		}
	}
}
# The fan favourite Habsburg man™
country_event = {
	id = NSB_poland_royal_election.5
	title = NSB_poland_royal_election.5.t
	desc = NSB_poland_royal_election.5.desc
	picture = GFX_report_event_generic_parliament
	
	immediate = {
	}

	is_triggered_only = yes
	
	option = {
		name = NSB_poland_royal_election.5.a
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				NOT = {
					OR = {
						has_country_flag = POL_AI_RANDOM_HABSBURG
						has_game_rule = {
							rule = POL_ai_behavior
							option = HABSBURG
						}
						has_game_rule = {
							rule = POL_ai_behavior
							option = DEFAULT
						}
					}
				}
			}
		}
		promote_character = POL_karl_albrecht
		set_party_name = { 
			ideology = neutrality 
			long_name = POL_habsburg_party
			name = POL_habsburg_party 
		}
		unlock_national_focus = POL_habsburg
		hidden_effect = {
			set_country_flag = achievement_POL_elected_monarch
			news_event = {
				id = nsb_news.5
				days = 1
			}
		}
	}

	option = {
		name = NSB_poland_royal_election.5.b
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				OR = {
					has_country_flag = POL_AI_RANDOM_HABSBURG
					has_game_rule = {
						rule = POL_ai_behavior
						option = HABSBURG
					}
				}
			}
		}
		custom_effect_tooltip = POL_keep_looking_tt
		hidden_effect = {
			country_event = {
				id = NSB_poland_royal_election.2
				days = 35
			}
		}
	}
}


add_namespace = NSB_poland_monarchist_events

# Romania/Lithuania made aware of Poland claiming them
country_event = {
	id = NSB_poland_monarchist_events.1
	title = NSB_poland_monarchist_events.1.t
	desc = NSB_poland_monarchist_events.1.desc
	picture = GFX_report_event_generic_riot

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_monarchist_events.1.a
		ai_chance = {
			base = 10
		}
		unlock_decision_category_tooltip = POL_fight_against_monarchy_in_LIT_cat
	}
}

#Poland made aware that Lithuania/Romania has purged Monarchist support
country_event = {
	id = NSB_poland_monarchist_events.2
	title = NSB_poland_monarchist_events.2.t
	desc = NSB_poland_monarchist_events.2.desc
	picture = GFX_report_event_generic_rally2

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_monarchist_events.2.a
		ai_chance = {
			base = 10
		}
		create_wargoal = {
			type = puppet_wargoal_focus
			target = FROM
		}
	}
}

#Romania/Lithuania/Czechoslovakia given the option to refuse the coup
country_event = {
	id = NSB_poland_monarchist_events.5
	title = NSB_poland_monarchist_events.5.t
	desc = NSB_poland_monarchist_events.5.desc
	picture = GFX_report_event_generic_riot

	is_triggered_only = yes

	option = {
		name = NSB_poland_monarchist_events.5.a
		ai_chance = {
			base = 30
			modifier = {
				add = -25
				FROM = { has_army_size = { size < 40 } }
			}
			modifier = {
				add = 100
				FROM = { has_army_size = { size > 39 } }
			}
			modifier = {
				add = 20
				is_in_faction_with = FROM
			}
			modifier = {
				factor = 0.1
				is_in_faction = yes
			}
			modifier = {
				factor = 0.5
				check_variable = { monarchist_support > 50 }
			}
		}
		FROM = {
			set_autonomy = {
				target = ROOT
				autonomy_state = autonomy_personal_union
			}
		}

		hidden_effect = {
			POL_set_attempted_royal_takeover_flag = yes
			set_country_flag = POL_banned_monarchy_flag
			if = {
				limit = {
					original_tag = ROM
				}
				set_cosmetic_tag = ROM_polish_loyalists
			}
			else_if = {
				limit = {
					original_tag = LIT
				}
				set_cosmetic_tag = LIT_KINGDOM
			}
			else_if = {
				limit = {
					original_tag = CZE
				}
				CZE_karl_albrecht = {
					add_country_leader_role = {
						
						country_leader = {
							ideology=despotism
							traits = {  } # Patriot king doesn't fit when king of Bohemia. 
							expire="1965.1.1.1"
							id=-1
						}
						promote_leader = yes
					}
				}
				
			}
			news_event = { id = nsb_news.7 }
		}
	}
	
	option = {
		name = NSB_poland_monarchist_events.5.b
		ai_chance = {
			base = 10
			modifier = {
				FROM = { has_army_size = { size > 39 } }
				factor = 0.5
			}
			modifier = {
				add = 20
				FROM = { has_army_size = { size < 30 } }
			}
			modifier = {
				factor = 2
				is_in_faction = yes
				NOT = { is_in_faction_with = FROM }
			}
			modifier = {
				any_other_country = {
					has_guaranteed = PREV
				}
				factor = 5 #i've got friends
			}
			modifier = {
				any_other_country = {
					is_major = yes
					has_guaranteed = LIT
				}
				factor = 5 #i've got big friends
			}
			modifier = {
				factor = 10
				check_variable = { monarchist_support < 40 }
			}
		}
		hidden_effect = {
			set_country_flag = POL_banned_monarchy_flag
			POL_set_attempted_royal_takeover_flag = yes
		}
		POL_monarchist_civil_war_effect = yes
	}
}

#Romania/Lithuania made aware that they are now a subject of Poland
country_event = {
	id = NSB_poland_monarchist_events.3
	title = NSB_poland_monarchist_events.3.t
	desc = NSB_poland_monarchist_events.3.desc
	picture = GFX_report_event_generic_peaceful_annexation

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_monarchist_events.3.a
		ai_chance = {
			base = 10
		}
		effect_tooltip = {
			if = {
				limit = { original_tag = LIT }
				set_cosmetic_tag = LIT_MONARCHY
			}
			if = {
				limit = { original_tag = ROM }
				set_cosmetic_tag = ROM_polish_loyalists
			}
		}
	}
}

#Romania/Lithuania made aware of their civil war
country_event = {
	id = NSB_poland_monarchist_events.4
	title = NSB_poland_monarchist_events.4.t
	desc = NSB_poland_monarchist_events.4.desc
	picture = GFX_report_event_polish_tanks_01

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_monarchist_events.4.a
		ai_chance = {
			base = 10
		}
		custom_effect_tooltip = monarchist_civil_war_tt
	}
}

#Poland demands Yugoslavian annexation
country_event = {
	id = NSB_poland_monarchist_events.6
	title = NSB_poland_monarchist_events.6.t
	desc = NSB_poland_monarchist_events.6.desc
	picture = GFX_report_event_poland_rejects
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Sure!
		name = NSB_poland_monarchist_events.6.a
		ai_chance = {
			base = 30
			modifier = {
				add = -25
				POL = { has_army_size = { size < 40 } }
			}
			modifier = {
				add = -25
				strength_ratio = {
					tag = POL
					ratio < 0.75
				} #They can't beat me up
			}
			modifier = {
				add = 100
				strength_ratio = {
					tag = POL
					ratio > 1.5
				} #They can beat me up
			}
			modifier = {
				add = 20
				is_in_faction_with = POL
			}
			modifier = {
				factor = 0.1
				is_in_faction = yes
			}
		}
		POL = {
			country_event = { hours = 2 id = NSB_poland_monarchist_events.601 }
		}
		custom_effect_tooltip = GAME_OVER_TT
	}

	option = { #No thank you
		name = NSB_poland_monarchist_events.6.b
		ai_chance = {
			base = 10
			modifier = {
				POL = { has_army_size = { size > 39 } }
				factor = 0.5
			}
			modifier = {
				add = 20
				POL = { has_army_size = { size < 30 } }
			}
			modifier = {
				factor = 2
				strength_ratio = {
					tag = POL
					ratio < 0.75
				} #They can't beat me up
			}
			modifier = {
				factor = 2
				is_in_faction = yes
				NOT = { is_in_faction_with = POL }
			}
			modifier = {
				any_other_country = {
					has_guaranteed = YUG
				}
				factor = 5 #i've got friends
			}
			modifier = {
				any_other_country = {
					is_major = yes
					has_guaranteed = YUG
				}
				factor = 5 #i've got big friends
			}
		}
		POL = {
			add_opinion_modifier = { target = PREV modifier = POL_annexation_refused }
			country_event = { hours = 2 id = NSB_poland_monarchist_events.602 }
			if = { limit = { is_in_faction_with = YUG }
				remove_from_faction = YUG
			}
		}
	}
}

#Yugoslavia says yes
country_event = {
	id = NSB_poland_monarchist_events.601
	title = NSB_poland_monarchist_events.601.t
	desc = NSB_poland_monarchist_events.601.desc
	picture = GFX_report_event_generic_conference
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Awesome!
		name = NSB_poland_monarchist_events.601.a
		ai_chance = {
			base = 30
		}
		annex_country = { target = FROM transfer_troops = no }
	}
}

#Yugoslavia says no
country_event = {
	id = NSB_poland_monarchist_events.602
	title = NSB_poland_monarchist_events.602.t
	desc = NSB_poland_monarchist_events.602.desc
	picture = GFX_report_event_poland_rejects
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #How 'bout I do anyway
		name = NSB_poland_monarchist_events.602.a
		ai_chance = {
			base = 30
		}
		create_wargoal = {
			type = annex_everything
			target = FROM
		}
	}
}

add_namespace = pavel_events

#Release Don Republic
country_event = {
	id = pavel_events.1
	title = pavel_events.1.t
	desc = pavel_events.1.desc
	picture = GFX_report_event_generic_military_parade
	
	fire_only_once = yes
	is_triggered_only = yes
	
	immediate = {
		hidden_effect = {
			218 = { add_core_of = DON }
			245 = { add_core_of = DON }
			238 = { add_core_of = DON }
			217 = { add_core_of = DON }
			265 = { add_core_of = DON }
			237 = { add_core_of = DON }
			236 = { add_core_of = DON }
		}
	}

	option = {
		name = pavel_events.1.a
		ai_chance = {
			base = 10
		}
		
		DON = {
			transfer_state = 218
			transfer_state = 245
			transfer_state = 238
			transfer_state = 217
			transfer_state = 265
			if = {
				limit = {
					PREV = { controls_state = 236 }
				}
				transfer_state = 236
			}
			if = {
				limit = {
					PREV = { controls_state = 237 }
				}
				transfer_state = 237
			}
			custom_effect_tooltip = spawn_cossacks_tt
			hidden_effect = {
				load_oob = "DON_cossack_host"
				set_politics = {
					ruling_party = fascism
				}
				add_popularity = {
					ideology = fascism
					popularity = 0.5
				}
			}
		}
		add_to_faction = DON
		# Make sure Don Republic is added to the Soviet war.
		if = {
			limit = {
				has_war_with = SOV
			}
			DON = {
				add_to_war = {
					targeted_alliance = PREV 
					enemy = SOV
					hostility_reason = asked_to_join
				}
			}
		}
	}
	
	option = {
		name = pavel_events.1.b
		ai_chance = {
			base = 10
		}
		
		DON = {
			transfer_state = 218
			transfer_state = 245
			transfer_state = 238
			transfer_state = 217
			transfer_state = 265
			if = {
				limit = {
					PREV = { controls_state = 236 }
				}
				transfer_state = 236
			}
			if = {
				limit = {
					PREV = { controls_state = 237 }
				}
				transfer_state = 237
			}
			custom_effect_tooltip = spawn_cossacks_tt
			hidden_effect = {
				load_oob = "DON_cossack_host"
			}
		}
		add_to_faction = DON
		puppet = DON
		# Make sure Don Republic is added to the Soviet war.
		if = {
			limit = {
				has_war_with = SOV
			}
			DON = {
				add_to_war = {
					targeted_alliance = PREV 
					enemy = SOV
					hostility_reason = asked_to_join
				}
			}
		}
	}
}

#Release Kuban Republic
country_event = {
	id = pavel_events.2
	title = pavel_events.2.t
	desc = pavel_events.2.desc
	picture = GFX_report_event_generic_military_parade
	
	fire_only_once = yes
	is_triggered_only = yes
	
	immediate = {
		hidden_effect = {
			234 = { add_core_of = KUB }
			235 = { add_core_of = KUB }
			233 = { add_core_of = KUB }
			232 = { add_core_of = KUB }
			137 = { add_core_of = KUB }
		}
	}

	option = {
		name = pavel_events.2.a
		ai_chance = {
			base = 10
		}
		
		KUB = {
			transfer_state = 234
			transfer_state = 235
			transfer_state = 233
			transfer_state = 232
			if = {
				limit = {
					PREV = { controls_state = 137 }
				}
				transfer_state = 137
			}
			custom_effect_tooltip = spawn_cossacks_tt
			hidden_effect = {
				load_oob = "KUB_cossack_host"
				set_politics = {
					ruling_party = fascism
				}
				add_popularity = {
					ideology = fascism
					popularity = 0.5
				}
			}
		}
		add_to_faction = KUB
		# Make sure Kuban Republic is added to the Soviet war.
		if = {
			limit = {
				has_war_with = SOV
			}
			KUB = {
				add_to_war = {
					targeted_alliance = PREV 
					enemy = SOV
					hostility_reason = asked_to_join
				}
			}
		}
	}
	
	option = {
		name = pavel_events.2.b
		ai_chance = {
			base = 10
		}
		
		KUB = {
			transfer_state = 234
			transfer_state = 235
			transfer_state = 233
			transfer_state = 232
			if = {
				limit = {
					PREV = { controls_state = 137 }
				}
				transfer_state = 137
			}
			custom_effect_tooltip = spawn_cossacks_tt
			hidden_effect = {
				load_oob = "KUB_cossack_host"
			}
		}
		add_to_faction = KUB
		puppet = KUB
		# Make sure Kuban Republic is added to the Soviet war.
		if = {
			limit = {
				has_war_with = SOV
			}
			KUB = {
				add_to_war = {
					targeted_alliance = PREV 
					enemy = SOV
					hostility_reason = asked_to_join
				}
			}
		}
	}
}

#Demand Pomerania and Silesia, event for Germany
country_event = {
	id = pavel_events.3
	title = pavel_events.3.t
	desc = pavel_events.3.desc
	picture = GFX_report_event_generic_panzer_attack
	
	fire_only_once = yes
	is_triggered_only = yes
	
	immediate = {
	}

	option = { #Cede the territory
		name = pavel_events.3.a
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				NOT = {
					OR = {
						is_puppet_of = POL
						is_in_faction_with = POL
					}
				}
				POL = {
					surrender_progress > 0.09
				}
			}
			modifier = {
				factor = 0
				any_other_country = {
					is_in_faction_with = ROOT
					has_war_with = POL
				}
			}
			modifier = {
				factor = 0
				any_other_country = { #Puppets shouldn't cede territory
					NOT = {
						tag = POL
					}
					has_subject = ROOT
				}
			}
		}
		effect_tooltip = {
			if = {
				limit = { owns_state = 67 }
				FROM = {
					transfer_state = 67
					67 = { add_core_of = PREV }
				}
			}
			if = {
				limit = { owns_state = 66 }
				FROM = {
					transfer_state = 66
					66 = { add_core_of = PREV }
				}
			}
			if = {
				limit = { owns_state = 68 }
				FROM = {
					transfer_state = 68
					68 = { add_core_of = PREV }
				}
			}
			if = {
				limit = { owns_state = 63 }
				FROM = {
					transfer_state = 63
					63 = { add_core_of = PREV }
				}
			}
			if = {
				limit = { owns_state = 5 }
				FROM = {
					transfer_state = 5
					5 = { add_core_of = PREV }
				}
			}
			if = {
				limit = { owns_state = 763 }
				FROM = {
					transfer_state = 763
					763 = { add_core_of = PREV }
				}
			}
		}
		hidden_effect = {
			FROM = {
				country_event = { id = pavel_events.301 }
			}
		}
	}
	
	option = { #Don't cede the territory
		name = pavel_events.3.b
		ai_chance = {
			base = 90 #Germany should be unlikely to cede territory to Poland
			modifier = {
				factor = 0.5
				strength_ratio = {
					tag = POL
					ratio > 1
				}
			}
			modifier = { #If Germany has basically no army and they're not in a faction, they shouldn't really refuse.
				factor = 0
				strength_ratio = {
					tag = POL
					ratio > 10
				}
				is_in_faction = no
			}
			modifier = { #German subjects shouldn't give up territory.
				factor = 0
				is_subject = yes
				NOT = { is_subject_of = POL }
			}
			modifier = {
				factor = 0
				OR = {
					is_in_faction_with = POL
					is_subject_of = POL
				}
			}
		}
		effect_tooltip = {
			FROM = {
				create_wargoal = {
					type = take_state_focus
					target = GER
					generator = { 67 66 68 63 5 763 }
				}
			}
		}
		hidden_effect = {
			FROM = {
				country_event = { id = pavel_events.302 }
			}
		}
	}
}
#Poland is informed, given the territory
country_event = {
	id = pavel_events.301
	title = pavel_events.301.t
	desc = pavel_events.301.desc
	picture = GFX_report_event_generic_peaceful_annexation
	
	fire_only_once = yes
	is_triggered_only = yes
	
	immediate = {
	}

	option = {
		name = pavel_events.301.a
		ai_chance = {
			base = 10
		}
		if = {
			limit = { FROM = { owns_state = 67 } }
			transfer_state = 67
			67 = { add_core_of = PREV }
		}
		if = {
			limit = { FROM = { owns_state = 66 } }
			transfer_state = 66
			66 = { add_core_of = PREV }
		}
		if = {
			limit = { FROM = { owns_state = 68 } }
			transfer_state = 68
			68 = { add_core_of = PREV }
		}
		if = {
			limit = { FROM = { owns_state = 63 } }
			transfer_state = 63
			63 = { add_core_of = PREV }
		}
		if = {
			limit = { FROM = { owns_state = 5 } }
			transfer_state = 5
			5 = { add_core_of = PREV }
		}
		if = {
			limit = { FROM = { owns_state = 763 } }
			transfer_state = 763
			763 = { add_core_of = PREV }
		}
	}
}
#Poland informed of German rejection, gain wargoal
country_event = {
	id = pavel_events.302
	title = pavel_events.302.t
	desc = pavel_events.302.desc
	picture = GFX_report_event_military_planning
	
	fire_only_once = yes
	is_triggered_only = yes
	
	immediate = {
	}
	
	option = {
		name = pavel_events.302.a
		ai_chance = {
			base = 10
		}
		create_wargoal = {
			type = take_state_focus
			target = GER
			generator = { 67 66 68 63 5 763 }
		}
	}
}

add_namespace = NSB_poland_communist_events
#Event for deciding if the KPP should be anti or pro USSR
country_event = {
	id = NSB_poland_communist_events.1
	title = NSB_poland_communist_events.1.t
	desc = NSB_poland_communist_events.1.desc
	picture = GFX_report_event_sanation_left_victory

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_communist_events.1.a
		ai_chance = {
			base = 55
			modifier = {
				add = 10 
				has_opinion = {
					target = SOU 
					value < 50
				}
			}
		}
		#custom_effect_tooltip = anti_soviet_path_tt
		set_politics = {
			ruling_party = communism
			elections_allowed = no
		}
		promote_character = POL_maria_koszutska
	}

	option = {
		name = NSB_poland_communist_events.1.b
		trigger = {
			SOU = {
				exists = yes 
				NOT = { has_completed_focus = SOV_beaten_but_not_defeated }
			}
		}
		ai_chance = {
			base = 45
		}
		#custom_effect_tooltip = pro_soviet_path_tt
		if = {
			limit = {
				has_cosmetic_tag = POL_PEASANT
			}
			drop_cosmetic_tag = yes
		}
		set_politics = {
			ruling_party = communism
			elections_allowed = no
		}
		promote_character = POL_wladyslaw_gomulka
	}
}

#Event for Baltic States being offered to become a Polish subject
country_event = {
	id = NSB_poland_communist_events.2
	title = NSB_poland_communist_events.2.t
	desc = NSB_poland_communist_events.2.desc
	picture = GFX_report_event_lithuanian_ultimatum

	fire_only_once = yes
	is_triggered_only = yes

	option = { #Yes, become puppet
		name = NSB_poland_communist_events.2.a
		ai_chance = {
			base = 30
			modifier = {
				add = -25
				POL = { has_army_size = { size < 40 } }
			}
			modifier = {
				add = 100
				POL = { has_army_size = { size > 39 } }
			}
			modifier = {
				add = 20
				is_in_faction_with = POL
			}
			modifier = {
				factor = 0.1
				is_in_faction = yes
			}
		}
		effect_tooltip = {
			FROM = { puppet = ROOT }
		}
		hidden_effect = {
			FROM = { country_event = NSB_poland_communist_events.201 }
		}
	}
	
	option = { #No, Poland gets wargoal
		name = NSB_poland_communist_events.2.b
		ai_chance = {
			base = 10
			modifier = {
				POL = { has_army_size = { size > 39 } }
				factor = 0.5
			}
			modifier = {
				add = 20
				POL = { has_army_size = { size < 30 } }
			}
			modifier = {
				factor = 2
				is_in_faction = yes
				NOT = { is_in_faction_with = POL }
			}
			modifier = {
				any_other_country = {
					has_guaranteed = LIT
				}
				factor = 5 #i've got friends
			}
			modifier = {
				any_other_country = {
					is_major = yes
					has_guaranteed = LIT
				}
				factor = 5 #i've got big friends
			}
		}
		effect_tooltip = {
			FROM = {
				create_wargoal = {
					type = puppet_wargoal_focus
					target = ROOT
				}
			}
		}
		hidden_effect = {
			FROM = { country_event = NSB_poland_communist_events.202 }
		}
	}
}

#Poland informed they said yes
country_event = {
	id = NSB_poland_communist_events.201
	title = NSB_poland_communist_events.201.t
	desc = NSB_poland_communist_events.201.desc
	picture = GFX_report_event_generic_peaceful_annexation

	fire_only_once = yes
	is_triggered_only = yes

	option = { #Yes, become puppet
		name = NSB_poland_communist_events.201.a
		puppet = FROM
	}
}

#Poland informed they said no
country_event = {
	id = NSB_poland_communist_events.202
	title = NSB_poland_communist_events.202.t
	desc = NSB_poland_communist_events.202.desc
	picture = GFX_report_event_polish_tanks_01

	fire_only_once = yes
	is_triggered_only = yes

	option = { #Gain wargoal
		name = NSB_poland_communist_events.202.a
		create_wargoal = {
			type = puppet_wargoal_focus
			target = ROOT
		}
	}
}

#Event for Baltic States being annexed by Poland
country_event = {
	id = NSB_poland_communist_events.3
	title = NSB_poland_communist_events.3.t
	desc = NSB_poland_communist_events.3.desc
	picture = GFX_report_event_generic_peaceful_annexation

	fire_only_once = yes
	is_triggered_only = yes

	option = { #Yes, become annexed
		name = NSB_poland_communist_events.3.a
		ai_chance = {
			base = 30
			modifier = {
				add = -25
				POL = { has_army_size = { size < 40 } }
			}
			modifier = {
				add = 100
				POL = { has_army_size = { size > 39 } }
			}
			modifier = {
				add = 20
				is_in_faction_with = POL
			}
			modifier = {
				factor = 0.1
				is_in_faction = yes
			}
		}
		effect_tooltip = {
			FROM = { annex_country = { target = ROOT transfer_troops = yes } }
		}
		hidden_effect = {
			FROM = { country_event = NSB_poland_communist_events.301 }
		}
		custom_effect_tooltip = GAME_OVER_TT
	}
	
	option = { #No, Poland gets wargoal
		name = NSB_poland_communist_events.3.b
		ai_chance = {
			base = 10
			modifier = {
				POL = { has_army_size = { size > 39 } }
				factor = 0.5
			}
			modifier = {
				add = 20
				POL = { has_army_size = { size < 30 } }
			}
			modifier = {
				factor = 2
				is_in_faction = yes
				NOT = { is_in_faction_with = POL }
			}
			modifier = {
				any_other_country = {
					has_guaranteed = ROOT
				}
				factor = 5 #i've got friends
			}
			modifier = {
				any_other_country = {
					is_major = yes
					has_guaranteed = ROOT
				}
				factor = 5 #i've got big friends
			}
			modifier = {
				is_subject_of = POL
				factor = 0 #Subjects shouldn't refuse
			}
		}
		effect_tooltip = {
			FROM = {
				create_wargoal = {
					type = annex_everything
					target = ROOT
				}
			}
		}
		hidden_effect = {
			FROM = { country_event = NSB_poland_communist_events.302 }
		}
	}
}

#Baltic State is annexed
country_event = {
	id = NSB_poland_communist_events.301
	title = NSB_poland_communist_events.301.t
	desc = NSB_poland_communist_events.301.desc
	picture = GFX_report_event_poland_rejects

	fire_only_once = yes
	is_triggered_only = yes

	option = { #Yes, become annexed
		name = NSB_poland_communist_events.301.a
		ai_chance = {
			base = 10
		}
		annex_country = { target = FROM transfer_troops = yes }
	}
}

#Poland gains a wargoal
country_event = {
	id = NSB_poland_communist_events.302
	title = NSB_poland_communist_events.302.t
	desc = NSB_poland_communist_events.302.desc
	picture = GFX_report_event_generic_peaceful_annexation

	fire_only_once = yes
	is_triggered_only = yes

	option = { #Yes, become annexed
		name = NSB_poland_communist_events.302.a
		ai_chance = {
			base = 10
		}
		if = {
			limit = {
				ROOT = { is_faction_leader = yes }
				FROM = {
					is_in_faction_with = ROOT
				}
			}
			remove_from_faction = FROM
		}
		if = {
			limit = {
				FROM = {
					is_subject_of = ROOT
				}
			}
			set_autonomy = {
				target = FROM
				autonomy_state = autonomy_free
			}
		}
		create_wargoal = {
			type = annex_everything
			target = ROOT
		}
	}
}

#Soviet event; Poland wants to surrender Eastern Poland and become a Soviet puppet
country_event = {
	id = NSB_poland_communist_events.4
	title = NSB_poland_communist_events.4.t
	desc = NSB_poland_communist_events.4.desc
	picture = GFX_report_event_sanation_left_victory

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_communist_events.4.a
		ai_chance = {
			base = 50 #Why would they say no?
			modifier = { #They are at war with someone I'm not
				factor = 0.5
				any_other_country = {
					is_major = yes
					has_war_with = POL
					NOT = { has_war_with = ROOT }
				}
			}
			modifier = { #They are at war with the Allies and I am not
				factor = 0.1
				any_other_country = {
					is_major = yes
					has_government = democratic
					has_war_with = POL
					NOT = { has_war_with = ROOT }
				}
			}
			modifier = { #I have already signed Molotov-Ribbentrop
				factor = 0.2
				has_global_flag = sov_yes_pact
			}
			modifier = { #I refused Molotov-Ribbentrop
				factor = 2
				has_global_flag = sov_no_pact
			}
		}
		hidden_effect = { POL = { country_event = NSB_poland_communist_events.401 } }
		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 = { add_core_of = SOV }
		if = {
			limit = { POL = { owns_state = 96 controls_state = 96 } }
			transfer_state = 96
		}
		if = {
			limit = { POL = { owns_state = 95 controls_state = 95 } }
			transfer_state = 95
		}
		if = {
			limit = { POL = { owns_state = 94 controls_state = 94 } }
			transfer_state = 94
		}
		if = {
			limit = { POL = { owns_state = 93 controls_state = 93 } }
			transfer_state = 93
		}
		if = {
			limit = { POL = { owns_state = 91 controls_state = 91 } }
			transfer_state = 91
		}
		if = {
			limit = { POL = { owns_state = 89 controls_state = 89 } }
			transfer_state = 89
		}
		if = {
			limit = { POL = { owns_state = 97 controls_state = 97 } }
			transfer_state = 97
		}
		if = {
			limit = { POL = { owns_state = 784 controls_state = 784 } }
			transfer_state = 784
			784 = { add_core_of = SOV }
		}
		set_autonomy = {
			target = POL
			autonomy_state = autonomy_puppet
		}
	}

	option = {
		name = NSB_poland_communist_events.4.b
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				POL = {
					is_ai = no
				}
			}
			modifier = {
				factor = 0
				NOT = { has_global_flag = sov_yes_pact }
			}
		}
		hidden_effect = { POL = { country_event = NSB_poland_communist_events.402 } }
	}
}

#Poland informed Soviets are okay with them becoming a puppet
country_event = {
	id = NSB_poland_communist_events.401
	title = NSB_poland_communist_events.401.t
	desc = NSB_poland_communist_events.401.desc
	picture = GFX_report_event_sanation_left_victory

	fire_only_once = yes
	is_triggered_only = yes
	
	option = { #Poland is told what the effects are again
		name = NSB_poland_communist_events.401.a
		ai_chance = {
			base = 10
		}
		effect_tooltip = {
			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 = { add_core_of = SOV }
			SOV = {
				if = {
					limit = { POL = { owns_state = 96 controls_state = 96 } }
					transfer_state = 96
				}
				if = {
					limit = { POL = { owns_state = 95 controls_state = 95 } }
					transfer_state = 95
				}
				if = {
					limit = { POL = { owns_state = 94 controls_state = 94 } }
					transfer_state = 94
				}
				if = {
					limit = { POL = { owns_state = 93 controls_state = 93 } }
					transfer_state = 93
				}
				if = {
					limit = { POL = { owns_state = 91 controls_state = 91 } }
					transfer_state = 91
				}
				if = {
					limit = { POL = { owns_state = 89 controls_state = 89 } }
					transfer_state = 89
				}
				if = {
					limit = { POL = { owns_state = 97 controls_state = 97 } }
					transfer_state = 97
				}
				if = {
					limit = { POL = { owns_state = 784 controls_state = 784 } }
					transfer_state = 784
					784 = { add_core_of = SOV }
				}
				set_autonomy = {
					target = POL
					autonomy_state = autonomy_puppet
				}
			}
		}
	}
}

#Poland informed Soviets said no, move to Maria Koszutska's path
country_event = {
	id = NSB_poland_communist_events.402
	title = NSB_poland_communist_events.402.t
	desc = NSB_poland_communist_events.402.desc
	picture = GFX_report_event_sanation_left_victory

	fire_only_once = yes
	is_triggered_only = yes
	
	option = { #Poland moves to the independent Communist path
		name = NSB_poland_communist_events.402.a
		ai_chance = {
			base = 10
		}
		#Switch focus path to Maria's path
		uncomplete_national_focus = {
			focus = POL_surrender_the_east
			uncomplete_children = yes
			refund_political_power = no
		}
		complete_national_focus = POL_polish_path_to_socialism
	}
}

#Soviet event; Poland declares independence
country_event = {
	id = NSB_poland_communist_events.5
	title = NSB_poland_communist_events.5.t
	desc = NSB_poland_communist_events.5.desc
	picture = GFX_report_event_poland_rejects

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_communist_events.5.a
		ai_chance = {
			base = 50 #They shouldn't usually accept this
			modifier = { #Oh they may actually be able to beat me
				factor = 0.5
				strength_ratio = {
					tag = POL
					ratio > 1
				}
			}
			modifier = { #Oh they may actually be able to beat me
				factor = 0.75
				strength_ratio = {
					tag = POL
					ratio > 2
				}
			}
			modifier = { #Oh they can definitely beat me
				factor = 0.1
				strength_ratio = {
					tag = POL
					ratio > 10
				}
			}
		}
		hidden_effect = {
			POL = { 
				country_event = NSB_poland_communist_events.501
				leave_faction = yes
			}
		}
		effect_tooltip = {
			set_autonomy = {
				target = POL
				autonomy_state = autonomy_free
			}
			POL = { leave_faction = yes }
			declare_war_on = {
				target = POL
				type = annex_everything
			}
		}
	}

	option = {
		name = NSB_poland_communist_events.5.b
		ai_chance = {
			base = 10
		}
		hidden_effect = { POL = { country_event = NSB_poland_communist_events.502 } }
		effect_tooltip = {
			set_autonomy = {
				target = POL
				autonomy_state = autonomy_free
			}
		}
	}
}

#Poland told Soviets are declaring war
country_event = {
	id = NSB_poland_communist_events.501
	title = NSB_poland_communist_events.501.t
	desc = NSB_poland_communist_events.501.desc
	picture = GFX_report_event_polish_tanks_01

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_communist_events.501.a
		ai_chance = {
			base = 50
		}
		leave_faction = yes
		FROM = {
			declare_war_on = {
				target = POL
				type = annex_everything
			}
		}
	}
}

#Poland told former overlord accepts their independence
country_event = {
	id = NSB_poland_communist_events.502
	title = NSB_poland_communist_events.502.t
	desc = NSB_poland_communist_events.502.desc
	picture = GFX_report_event_sanation_left_victory

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_communist_events.502.a
		ai_chance = {
			base = 10
		}
	}
	
	option = {
		name = NSB_poland_communist_events.502.b
		ai_chance = {
			base = 0
		}
		leave_faction = yes
	}
}

#Poland asks for East Poland
country_event = {
	id = NSB_poland_communist_events.6
	title = NSB_poland_communist_events.6.t
	desc = NSB_poland_communist_events.6.desc
	picture = GFX_report_event_sanation_left_victory

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_communist_events.6.a
		ai_chance = {
			base = 50 #They should usually be okay with this for the player
			modifier = {
				factor = 0
				POL = { is_ai = yes }
			}
		}
		hidden_effect = {
			FROM = {
				country_event = NSB_poland_communist_events.601
			}
		}
		effect_tooltip = {
			96 = { add_core_of = POL }
			95 = { add_core_of = POL }
			94 = { add_core_of = POL }
			93 = { add_core_of = POL }
			91 = { add_core_of = POL }
			89 = { add_core_of = POL }
			97 = { add_core_of = POL }
			POL = {
				if = {
					limit = { ROOT = { owns_state = 96 controls_state = 96 } }
					transfer_state = 96
				}
				if = {
					limit = { ROOT = { owns_state = 95 controls_state = 95 } }
					transfer_state = 95
				}
				if = {
					limit = { ROOT = { owns_state = 94 controls_state = 94 } }
					transfer_state = 94
				}
				if = {
					limit = { ROOT = { owns_state = 93 controls_state = 93 } }
					transfer_state = 93
				}
				if = {
					limit = { ROOT = { owns_state = 91 controls_state = 91 } }
					transfer_state = 91
				}
				if = {
					limit = { ROOT = { owns_state = 89 controls_state = 89 } }
					transfer_state = 89
				}
				if = {
					limit = { ROOT = { owns_state = 97 controls_state = 97 } }
					transfer_state = 97
				}
				#Lithuanian states
				if = {
					limit = { ROOT = { owns_state = 784 controls_state = 784 } }
					transfer_state = 784
					784 = { add_core_of = POL }
				}
				if = {
					limit = { ROOT = { owns_state = 11 controls_state = 11 } }
					transfer_state = 11
				}
				if = {
					limit = { ROOT = { owns_state = 188 controls_state = 188 } }
					transfer_state = 188
				}
				if = {
					limit = { ROOT = { owns_state = 189 controls_state = 189 } }
					transfer_state = 189
				}
				if = {
					limit = { ROOT = { owns_state = 814 controls_state = 814 } }
					transfer_state = 814
				}
				if = {
					limit = { ROOT = { owns_state = 815 controls_state = 815 } }
					transfer_state = 815
				}
			}
		}
	}

	option = {
		name = NSB_poland_communist_events.6.b
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				POL = { is_ai = no }
			}
		}
		hidden_effect = { POL = { country_event = NSB_poland_communist_events.602 } }
	}
}

#Soviets said yes, Poland gets East Poland
country_event = {
	id = NSB_poland_communist_events.601
	title = NSB_poland_communist_events.601.t
	desc = NSB_poland_communist_events.601.desc
	picture = GFX_report_event_generic_peaceful_annexation

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_communist_events.601.a
		ai_chance = {
			base = 10
		}
		96 = { add_core_of = POL }
		95 = { add_core_of = POL }
		94 = { add_core_of = POL }
		93 = { add_core_of = POL }
		91 = { add_core_of = POL }
		89 = { add_core_of = POL }
		97 = { add_core_of = POL }
		if = {
			limit = { FROM = { owns_state = 96 controls_state = 96 } }
			transfer_state = 96
		}
		if = {
			limit = { FROM = { owns_state = 95 controls_state = 95 } }
			transfer_state = 95
		}
		if = {
			limit = { FROM = { owns_state = 94 controls_state = 94 } }
			transfer_state = 94
		}
		if = {
			limit = { FROM = { owns_state = 93 controls_state = 93 } }
			transfer_state = 93
		}
		if = {
			limit = { FROM = { owns_state = 91 controls_state = 91 } }
			transfer_state = 91
		}
		if = {
			limit = { FROM = { owns_state = 89 controls_state = 89 } }
			transfer_state = 89
		}
		if = {
			limit = { FROM = { owns_state = 97 controls_state = 97 } }
			transfer_state = 97
		}
		#Lithuanian states
		if = {
			limit = { FROM = { owns_state = 784 controls_state = 784 } }
			transfer_state = 784
			784 = { add_core_of = POL }
		}
		if = {
			limit = { FROM = { owns_state = 11 controls_state = 11 } }
			transfer_state = 11
		}
		if = {
			limit = { FROM = { owns_state = 188 controls_state = 188 } }
			transfer_state = 188
		}
		if = {
			limit = { FROM = { owns_state = 189 controls_state = 189 } }
			transfer_state = 189
		}
		if = {
			limit = { FROM = { owns_state = 814 controls_state = 814 } }
			transfer_state = 814
		}
		if = {
			limit = { FROM = { owns_state = 815 controls_state = 815 } }
			transfer_state = 815
		}
	}
}

#Soviets said no, Poland gets nothing
country_event = {
	id = NSB_poland_communist_events.602
	title = NSB_poland_communist_events.602.t
	desc = NSB_poland_communist_events.602.desc
	picture = GFX_report_event_sanation_left_victory

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_communist_events.602.a
		ai_chance = {
			base = 10
		}
	}
	
	option = { #No Eastern Poland? I declare independence!
		name = NSB_poland_communist_events.602.b
		ai_chance = { #The AI shouldn't do this
			base = 0
		}
		uncomplete_national_focus = {
			focus = POL_greater_polish_SSR
			uncomplete_children = yes
			refund_political_power = no
		}
		complete_national_focus = POL_com_independence
	}
}

add_namespace = NSB_poland_democratic_events
#Event for deciding if Poland should be lead by Wincenty Witos or Stanisław Mikołajczyk
country_event = {
	id = NSB_poland_democratic_events.1
	title = NSB_poland_democratic_events.1.t
	desc = NSB_poland_democratic_events.1.desc
	picture = GFX_report_event_sanation_revolt

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_poland_democratic_events.1.a
		ai_chance = {
			base = 10
		}
		if = {
			limit = {
				has_cosmetic_tag = POL_PEASANT
			}
			drop_cosmetic_tag = yes
		}
		promote_character = POL_wincenty_witos
	}

	option = {
		name = NSB_poland_democratic_events.1.b
		ai_chance = {
			base = 40
		}
		promote_character = POL_stanislaw_mikolajczyk
	}
}

add_namespace = NSB_polish_fascist_events

#German event; Poland wants to surrender Western Poland and become a German puppet
country_event = {
	id = NSB_polish_fascist_events.1
	title = NSB_polish_fascist_events.1.t
	desc = NSB_polish_fascist_events.1.desc
	picture = GFX_report_event_danzig_joins_nazis

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_polish_fascist_events.1.a
		ai_chance = {
			base = 50 #Why would they say no?
			modifier = { #They are at war with someone I'm not
				factor = 0.5
				any_other_country = {
					is_major = yes
					has_war_with = POL
					NOT = { has_war_with = ROOT }
				}
			}
			modifier = { #They are at war with the Allies and I am not
				factor = 0.1
				any_other_country = {
					is_major = yes
					has_government = democratic
					has_war_with = POL
					NOT = { has_war_with = ROOT }
				}
			}
			modifier = { #I have already signed Molotov-Ribbentrop
				factor = 0.2
				has_global_flag = sov_yes_pact
			}
			modifier = { #Soviets refused MR Pact
				factor = 2
				has_global_flag = sov_no_pact
			}
		}
		hidden_effect = { POL = { country_event = NSB_polish_fascist_events.101 } }
		if = {
			limit = {
				has_global_flag = sov_yes_pact
			}
			SOV = { country_event = germany.16 }
			clr_global_flag = sov_yes_pact
			diplomatic_relation = {
				country = SOV
				relation = non_aggression_pact
				active = no
			}		
			SOV = {
				add_state_claim = 96
				add_state_claim = 95
				add_state_claim = 94
				add_state_claim = 93
				add_state_claim = 91
				add_state_claim = 97
				add_state_claim = 89
				add_state_claim = 784
				effect_tooltip = {
					create_wargoal = {
						type = annex_everything
						target = GER
					}
				}
			}
		}
		POL_become_german_puppet_effect = yes
		set_global_flag = beck_ribbentrop_signed
	}

	option = {
		name = NSB_polish_fascist_events.1.b
		ai_chance = {
			base = 10
			modifier = {
				factor = 0 #If the player is doing this, the AI should always say yes.
				POL = {
					is_ai = no
				}
			}
		}
		hidden_effect = { POL = { country_event = NSB_polish_fascist_events.102 } }
	}
}

#Inform Poland of Germany saying yes
country_event = {
	id = NSB_polish_fascist_events.101
	title = NSB_polish_fascist_events.101.t
	desc = NSB_polish_fascist_events.101.desc
	picture = GFX_report_event_nazis_in_danzig

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_polish_fascist_events.101.a
		ai_chance = {
			base = 10
		}
		effect_tooltip = {
			POL_become_german_puppet_effect = yes
		}
	}
}

#Inform Poland of Germany saying no
country_event = {
	id = NSB_polish_fascist_events.102
	title = NSB_polish_fascist_events.102.t
	desc = NSB_polish_fascist_events.102.desc
	picture = GFX_report_event_poland_rejects

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_polish_fascist_events.102.a
		ai_chance = {
			base = 10
		}
		uncomplete_national_focus = {
			focus = POL_beck_ribbentrop
			uncomplete_children = yes
			refund_political_power = no
		}
		complete_national_focus = POL_reassert_silesian_claims
	}
}
#German event; Poland wants to invade Lithuania
country_event = {
	id = NSB_polish_fascist_events.2		
	title = NSB_polish_fascist_events.2.t
	desc = NSB_polish_fascist_events.2.desc
	picture = GFX_report_event_lithuanian_ultimatum

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_polish_fascist_events.2.a
		trigger = {
			LIT = {
				exists = yes
			}
		}
		ai_chance = {
			base = 50
			modifier = { #Lithuania is in a faction
				factor = 0.75
				LIT = {
					is_in_faction = yes
				}
			}
			modifier = { #Lithuania is in a big faction
				factor = 0.5
				LIT = {
					is_in_faction = yes
				}
				any_other_country = {
					is_major = yes
					is_in_faction_with = LIT
				}
			}
		}
		LIT = { country_event = NSB_polish_fascist_events.201 }
		custom_effect_tooltip = if_they_accept_tt
		effect_tooltip = {
			POL_divide_lithuania_effect = yes
		}
	}
	
	option = { #I have already annexed Lithuania
		name = NSB_polish_fascist_events.2.b
		trigger = { #If Lithuania does not exist, just divide the occupation
			LIT = {
				exists = no
			}
		}
		ai_chance = {
			base = 50
		}
		hidden_effect = { POL = { country_event = NSB_polish_fascist_events.203 } }
		effect_tooltip = {
			POL_divide_lithuania_effect = yes
		}
	}

	option = { #No
		name = NSB_polish_fascist_events.2.c
		ai_chance = {
			base = 10
			modifier = {
				factor = 0 #If the player is doing this, the AI should always say yes.
				POL = {
					is_ai = no
				}
			}
		}
		hidden_effect = { POL = { country_event = NSB_polish_fascist_events.202 } }
	}
}

#Lithuania recieves the demand
country_event = {
	id = NSB_polish_fascist_events.201
	title = NSB_polish_fascist_events.201.t
	desc = NSB_polish_fascist_events.201.desc
	picture = GFX_report_event_lithuanian_ultimatum

	fire_only_once = yes
	is_triggered_only = yes

	option = { #Sure!
		name = NSB_polish_fascist_events.201.a
		ai_chance = {
			base = 30
			modifier = {
				add = -25
				POL = { has_army_size = { size < 40 } }
			}
			modifier = {
				add = 100
				POL = { has_army_size = { size > 39 } }
			}
			modifier = {
				add = -25
				GER = { has_army_size = { size < 40 } }
			}
			modifier = {
				add = 100
				GER = { has_army_size = { size > 39 } }
			}
			modifier = {
				factor = 0.1
				is_in_faction = yes
			}
		}
		hidden_effect = {
			POL = { country_event = NSB_polish_fascist_events.203 }
			GER = { country_event = NSB_polish_fascist_events.203 }
		}
		POL_divide_lithuania_effect = yes
		custom_effect_tooltip = GAME_OVER_TT
	}

	option = { #No thank you
		name = NSB_polish_fascist_events.201.b
		ai_chance = {
			base = 10
			modifier = {
				POL = { has_army_size = { size > 39 } }
				factor = 0.5
			}
			modifier = {
				add = 20
				POL = { has_army_size = { size < 30 } }
			}
			modifier = {
				GER = { has_army_size = { size > 39 } }
				factor = 0.5
			}
			modifier = {
				add = 20
				GER = { has_army_size = { size < 30 } }
			}
			modifier = {
				any_other_country = {
					has_guaranteed = LIT
				}
				factor = 5 #i've got friends
			}
			modifier = {
				any_other_country = {
					is_major = yes
					has_guaranteed = LIT
				}
				factor = 5 #i've got big friends
			}
		}
		hidden_effect = {
			GER = {
				add_opinion_modifier = { target = PREV modifier = POL_annexation_refused }
				country_event = NSB_polish_fascist_events.204
			}
			POL = {
				add_opinion_modifier = { target = PREV modifier = POL_annexation_refused }
				country_event = NSB_polish_fascist_events.204
			}
		}
		POL_lithuania_wargoal_claims_effect = yes
	}
}

#Inform Poland of Germany saying no
country_event = {
	id = NSB_polish_fascist_events.202
	title = NSB_polish_fascist_events.202.t
	desc = NSB_polish_fascist_events.202.desc
	picture = GFX_report_event_generic_conference

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_polish_fascist_events.202.a
		ai_chance = {
			base = 10
		}
	}
}

#Inform Poland/Germany of Lithuania saying yes
country_event = {
	id = NSB_polish_fascist_events.203
	title = NSB_polish_fascist_events.203.t
	desc = NSB_polish_fascist_events.203.desc
	picture = GFX_report_event_lithuanian_ultimatum

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_polish_fascist_events.203.a
		ai_chance = {
			base = 10
		}
		effect_tooltip = {
			POL_divide_lithuania_effect = yes
		}
	}
}

#Inform Poland/Germany of Lithuania saying no
country_event = {
	id = NSB_polish_fascist_events.204
	title = NSB_polish_fascist_events.204.t
	desc = NSB_polish_fascist_events.204.desc
	picture = GFX_report_event_military_planning

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_polish_fascist_events.204.a
		ai_chance = {
			base = 10
		}
		effect_tooltip = {
			POL_lithuania_wargoal_claims_effect = yes
		}
	}
}

#Poland asks Germany to become more autonomous
country_event = {
	id = NSB_polish_fascist_events.3
	title = NSB_polish_fascist_events.3.t
	desc = NSB_polish_fascist_events.3.desc
	picture = GFX_report_event_danzig_joins_nazis

	fire_only_once = yes
	is_triggered_only = yes
	
	option = { #Yes 
		name = NSB_polish_fascist_events.3.a
		ai_chance = {
			base = 10
		}
		set_autonomy = {
			target = POL
			autonomy_state = autonomy_satellite
		}
		hidden_effect = {
			POL = { country_event = { id = NSB_polish_fascist_events.301 hours = 3 }  }
		}
	}
	
	option = { #No, Poland is Ours  
		name = NSB_polish_fascist_events.3.b
		ai_chance = {
			base = 0 #The AI should basically always say yes
		}
		hidden_effect = {
			POL = { country_event = { id = NSB_polish_fascist_events.302  hours = 3 } }
		}
	}
}

#Poland becomes more autonomous
country_event = {
	id = NSB_polish_fascist_events.301
	title = NSB_polish_fascist_events.301.t
	desc = NSB_polish_fascist_events.301.desc
	picture = GFX_report_event_generic_communist_congress

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_polish_fascist_events.301.a
		ai_chance = {
			base = 10
		}
		effect_tooltip = {
			GER = {
				set_autonomy = {
					target = POL
					autonomy_state = autonomy_satellite
				}
			}
		}
	}
}

#Poland is told no to being more autonomous
country_event = {
	id = NSB_polish_fascist_events.302
	title = NSB_polish_fascist_events.302.t
	desc = NSB_polish_fascist_events.302.desc
	picture = GFX_report_event_nazis_in_danzig

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = NSB_polish_fascist_events.302.a #Accept it, nothing happens
		ai_chance = {
			base = 40
		}
		
	}
	
	option = {
		name = NSB_polish_fascist_events.302.b #Screw Germany, I'm going to reach out to the resistance
		ai_chance = {
			base = 20
		}
		uncomplete_national_focus = {
			focus = POL_request_autonomous_status
			uncomplete_children = no
			refund_political_power = no
		}
		complete_national_focus = POL_reach_out_to_underground_state
	}
}

#Poland tries to decide post-war borders
country_event = {
	id = NSB_polish_fascist_events.4
	title = NSB_polish_fascist_events.4.t
	desc = {
		text = NSB_polish_fascist_events.4.desc.rejected
		trigger = {
			OR = {
				has_global_flag = POL_rejected_baltics
				has_global_flag = POL_rejected_belarus_ukraine
				has_global_flag = POL_rejected_black_sea
			}
		}
	}
	desc = {
		text = NSB_polish_fascist_events.4.desc.first
		trigger = {
			NOT = { has_global_flag = POL_rejected_baltics }
			NOT = { has_global_flag = POL_rejected_belarus_ukraine }
			NOT = { has_global_flag = POL_rejected_black_sea }
		}
	}
	picture = GFX_report_event_generic_conference

	is_triggered_only = yes
	
	option = {
		name = NSB_polish_fascist_events.4.a #We want to move up into the Baltic
		ai_chance = {
			base = 40
		}
		trigger = {
			NOT = { has_global_flag = POL_rejected_baltics }
		}
		set_country_flag = asking_for_baltics_flag
		overlord = { country_event = { id = NSB_polish_fascist_events.401 hours = 5 }}
		custom_effect_tooltip = if_they_accept_tt
		custom_effect_tooltip = form_country_estonia_coring_states_tt
		custom_effect_tooltip = form_country_latvia_coring_states_tt
		custom_effect_tooltip = form_country_lithuania_coring_states_tt
	}
	
	option = {
		name = NSB_polish_fascist_events.4.b #We want to move east into Belarus and Ukraine
		ai_chance = {
			base = 60
		}
		trigger = {
			NOT = { has_global_flag = POL_rejected_belarus_ukraine }
		}
		set_country_flag = asking_for_belarus_and_ukraine_flag
		overlord = { country_event = { id = NSB_polish_fascist_events.401 hours = 5 }}
		custom_effect_tooltip = if_they_accept_tt
		custom_effect_tooltip = form_country_ukraine_coring_states_tt
		custom_effect_tooltip = form_country_belarus_coring_states_tt
	}
	
	option = {
		name = NSB_polish_fascist_events.4.c #We want to move south into the Black Sea
		ai_chance = {
			base = 20
		}
		trigger = {
			NOT = { has_global_flag = POL_rejected_black_sea }
		}
		set_country_flag = asking_for_black_sea_flag
		overlord = { country_event = { id = NSB_polish_fascist_events.401 hours = 5 } }
		custom_effect_tooltip = if_they_accept_tt
		custom_effect_tooltip = form_country_ukraine_coring_states_tt
		custom_effect_tooltip = core_black_sea_tt
	}
}

#Germany deliberates on post-war borders
country_event = {
	id = NSB_polish_fascist_events.401
	title = NSB_polish_fascist_events.4.t
	desc = {
		text = NSB_polish_fascist_events.401.desc.baltics
		trigger = {
			FROM = { has_country_flag = asking_for_baltics_flag } 
		}
	}
	desc = { 
		text = NSB_polish_fascist_events.401.desc.ukraine
		trigger ={
			FROM = { has_country_flag = asking_for_belarus_and_ukraine_flag }
		}
	}
	desc = {
		text = NSB_polish_fascist_events.401.desc.blacksea
		trigger = {
			FROM = { has_country_flag = asking_for_black_sea_flag }
		}
	}
	picture = GFX_report_event_generic_conference

	is_triggered_only = yes
	
	option = {
		name = NSB_polish_fascist_events.401.a #Germany agrees to post-war borders
		ai_chance = {
			base = 40
		}
		FROM = {
			country_event = { id = NSB_polish_fascist_events.402 hours = 8 }
		}
	}
	
	option = {
		name = NSB_polish_fascist_events.401.b #We disagree
		ai_chance = {
			base = 60
		}
		trigger = { #Can't say no if it's the last option
			OR = {
				AND = {
					NOT = { has_global_flag = POL_rejected_baltics }
					NOT = { has_global_flag = POL_rejected_belarus_ukraine }
				}
				AND = {
					NOT = { has_global_flag = POL_rejected_baltics }
					NOT = { has_global_flag = POL_rejected_black_sea }
				}
				AND = {
					NOT = { has_global_flag = POL_rejected_belarus_ukraine }
					NOT = { has_global_flag = POL_rejected_black_sea }
				} 
			}
		}
		hidden_effect = {
			if = {
				limit = {
					FROM = {
						has_country_flag = asking_for_baltics_flag
					}
				}
				set_global_flag = POL_rejected_baltics
			}
			if = {
				limit = {
					FROM = {
						has_country_flag = asking_for_belarus_and_ukraine_flag
					}
				}
				set_global_flag = POL_rejected_belarus_ukraine
			}
			if = {
				limit = {
					FROM = {
						has_country_flag = asking_for_black_sea_flag
					}
				}
				set_global_flag = POL_rejected_black_sea
			}
			FROM = {
				clr_country_flag = asking_for_baltics_flag
				clr_country_flag = asking_for_belarus_and_ukraine_flag
				clr_country_flag = asking_for_black_sea_flag
				country_event = { id = NSB_polish_fascist_events.4 hours = 3}
			}
		}
	}
}
country_event = {
	id = NSB_polish_fascist_events.402
	title = NSB_poland_communist_events.401.t
	desc = NSB_polish_fascist_events.402.desc
	picture = GFX_report_event_generic_peaceful_annexation

	is_triggered_only = yes
	
	option = {
		name = NSB_polish_fascist_events.402.a #Germany agrees to post-war borders
		ai_chance = {
			base = 40
		}
		if = {
			limit = {
				has_country_flag = asking_for_baltics_flag
			}
			custom_effect_tooltip = form_country_estonia_coring_states_tt
			custom_effect_tooltip = form_country_latvia_coring_states_tt
			custom_effect_tooltip = form_country_lithuania_coring_states_tt
			hidden_effect = {
				#Estonia
				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 }
				# Latvia
				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 }
				# Lithuania
				11 = { add_core_of = ROOT }
				189 = { add_core_of = ROOT }
				188 = { add_core_of = ROOT }
				784 = { add_core_of = ROOT }
				814 = { add_core_of = ROOT }
				815 = { add_core_of = ROOT }
			}
		}
		else_if = {
			limit = {
				has_country_flag = asking_for_belarus_and_ukraine_flag
			}
			custom_effect_tooltip = form_country_ukraine_coring_states_tt
			custom_effect_tooltip = form_country_belarus_coring_states_tt
			hidden_effect = {
				every_state = {
					limit = {
						OR = {
							is_core_of = BLR
							is_core_of = UKR
						}
					}
					add_core_of = POL
				}
			}
		}
		else_if = {
			limit = {
				has_country_flag = asking_for_black_sea_flag
			}
			custom_effect_tooltip = form_country_ukraine_coring_states_tt
			custom_effect_tooltip = core_black_sea_tt
			hidden_effect = {
				every_state = {
					limit = {
						is_core_of = UKR
					}
					add_core_of = POL
				}
				137 = { add_core_of = POL }
				218 = { add_core_of = POL }
				234 = { add_core_of = POL }
				233 = { add_core_of = POL }
				231 = { add_core_of = POL }
				238 = { add_core_of = POL }
				235 = { add_core_of = POL }
				232 = { add_core_of = POL }
				230 = { add_core_of = POL }
				229 = { add_core_of = POL }
				821 = { add_core_of = POL }
				826 = { add_core_of = POL }
				827 = { add_core_of = POL }
				828 = { add_core_of = POL }

			}
		}
	}
}


country_event = {
	id = NSB_polish_fascist_events.5
	title = NSB_polish_fascist_events.5.t
	desc = NSB_polish_fascist_events.5.desc
	picture = GFX_report_event_generic_rally
	
	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			save_event_target_as = alliance_applicant
			FROM = {
				save_event_target_as = alliance_inviter
			}
		}
	}

	option = {
		name = NSB_polish_fascist_events.5.a
		ai_chance = {
			factor = 100
			modifier = {
				factor = 2
				has_same_ideology = yes
			}
			modifier = {
				factor = 4
				has_country_flag = delegation_recieved_flag
			}
			modifier = {
				factor = 0.3
				has_same_ideology = no
			}
			modifier = {
				factor = 2
				fascism > 0.4
			}
		}
		FROM = {
			add_to_faction = PREV
		}
		add_popularity = {
			ideology = fascism
			popularity = 0.35
		}
		if = {
			limit = {
				FROM = {
					has_elections = yes
				}
			}
			set_politics = {
				ruling_party = fascism
				elections_allowed = yes
			}
		}
		else = {
			set_politics = {
				ruling_party = fascism
				elections_allowed = no
			}
		}
		if = {
			limit = {
				has_focus_tree = netherlands_focus
			}
			if = {
				limit = { has_completed_focus = HOL_maintain_trade_neutrality }
				uncomplete_national_focus = {
					focus = HOL_maintain_trade_neutrality
					uncomplete_children = yes
				}
				unlock_national_focus = HOL_cave_to_the_germans
			}
			if = {
				limit = { has_completed_focus = HOL_cave_to_the_british }
				uncomplete_national_focus = {
					focus = HOL_cave_to_the_british
					uncomplete_children = yes
				}
				unlock_national_focus = HOL_cave_to_the_germans
			}
		}
		hidden_effect = {
			set_country_flag = alliance_applicant@ROOT
			FROM = { set_country_flag = alliance_inviter@ROOT }
			FROM = {
				country_event = generic.6
			}
			news_event = { id = news.289 hours = 12 }
		}
		add_ai_strategy = {
			type = alliance
			id = POL
			value = 200
		}
	}
	option = {
		name = NSB_polish_fascist_events.5.b
		ai_chance = {
			factor = 50
			
			modifier = {
				factor = 2
				fascism < 0.2
			}
			modifier = {
				factor = 2
				has_same_ideology = no
			}
			modifier = {
				factor = 0.5
				has_opinion = {
					target = FROM
					value > 65
				}
			}
			
			modifier = {
				factor = 0.5
				has_opinion = {
					target = FROM
					value > 35
				}
			}
			
			modifier = {
				factor = 0.5
				has_opinion = {
					target = FROM
					value > 5
				}
			}
			
			modifier = {
				factor = 2.0
				has_opinion = {
					target = FROM
					value < 35
				}
			}
			
			modifier = {
				factor = 2.0
				has_opinion = {
					target = FROM
					value < 65
				}
			}
			
			modifier = {
				factor = 0.1
				has_war = yes
				FROM = {
					has_war = no
				}
			}
			
			modifier = {
				factor = 0.5
				FROM = {
					is_major = yes
				}
			}

			modifier = {
				factor = 10
				FROM = {
					OR = {
						is_subject = yes
						AND = {
							is_in_faction = yes
							is_faction_leader = no
						}
					}
				}
			}
		}
		FROM = {
			country_event = { id = poland.1602 }
		}
	}
}

#Piasecki taking control of the government
country_event = {
	id = NSB_polish_fascist_events.6
	title = NSB_polish_fascist_events.6.t
	desc = NSB_polish_fascist_events.6.desc
	picture = GFX_report_event_sanation_revolt
	
	is_triggered_only = yes

	fire_only_once = no

	option = {
		name = NSB_polish_fascist_events.6.a
		ai_chance = {
			factor = 10
		}
		add_stability = -0.1
		set_politics = {
			ruling_party = fascism
			elections_allowed = no
		}
	}
}
#National-Democrats winning the "election"
country_event = {
	id = NSB_polish_fascist_events.7
	title = NSB_polish_fascist_events.7.t
	desc = NSB_polish_fascist_events.7.desc
	picture = GFX_report_event_election_vote
	
	is_triggered_only = yes

	fire_only_once = no

	option = {
		name = NSB_polish_fascist_events.7.a
		ai_chance = {
			factor = 10
		}
		set_politics = {
			ruling_party = fascism
			elections_allowed = yes
			election_frequency = 60
			long_name = POL_natdem_party_long
			name = POL_natdem_party 
		}
		promote_character = POL_roman_dmowski
	}
}

add_namespace = POL_habsburg_events

#Hungarian event: Poland demands the return of Otto von Habsburg
country_event = {
	id = POL_habsburg_events.1
	title = POL_habsburg_events.1.t
	desc = POL_habsburg_events.1.desc
	picture = GFX_report_event_military_planning

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = POL_habsburg_events.1.a
		ai_chance = {
			base = 30
			modifier = {
				add = -25
				POL = { has_army_size = { size < 40 } }
			}
			modifier = {
				add = 100
				POL = { has_army_size = { size > 39 } }
			}
			modifier = {
				add = 20
				is_in_faction_with = POL
			}
			modifier = {
				factor = 0.1
				is_in_faction = yes
			}
			modifier = {
				factor = 0.1 #They don't border me, I'm not scared
				NOT = {
					any_controlled_state = {
						any_neighbor_state = {
							is_controlled_by = POL
						}
					}
				}
			}
		}
		hidden_effect = { POL = { country_event = POL_habsburg_events.101 } }
		promote_character = HUN_otto_von_habsburg
		add_ruling_to_neu = yes
		set_politics = {
			ruling_party = neutrality
			elections_allowed = no
			name = HUN_legitimists_party
			long_name = HUN_legitimists_party_long
		}
		if = { #Switch to the Habsburg branch
			limit = {
				has_focus_tree = hungarian_focus
			}
			if = {
				limit = {
					has_completed_focus = HUN_economic_intervention
				}
				uncomplete_national_focus = {
					focus = HUN_economic_intervention
					uncomplete_children = yes
				}
			}
			if = {
				limit = {
					has_completed_focus = HUN_elect_a_democratic_king
				}
				uncomplete_national_focus = {
					focus = HUN_elect_a_democratic_king
					uncomplete_children = yes
				}
			}
			if = {
				limit = {
					has_completed_focus = HUN_elect_a_fascist_king
				}
				uncomplete_national_focus = {
					focus = HUN_elect_a_fascist_king
					uncomplete_children = yes
				}
			}
			if = {
				limit = {
					NOT = { has_completed_focus = HUN_balanced_budget }
				}
				complete_national_focus = HUN_balanced_budget
			}
			if = {
				limit = {
					NOT = { has_completed_focus = HUN_elect_a_king }
				}
				complete_national_focus = HUN_elect_a_king
			}
			unlock_national_focus = HUN_invite_the_habsburg_prince
			if = {
				limit = {
					NOT = { has_completed_focus = HUN_strengthen_the_monarchists }
				}
				complete_national_focus = HUN_strengthen_the_monarchists
			}
			swap_ideas = {
				add_idea = HUN_habsburg_restored
				remove_idea = HUN_hungarian_monarchy_2
			}
		}
	}

	option = {
		name = POL_habsburg_events.1.b
		ai_chance = {
			base = 10
			modifier = {
				POL = { has_army_size = { size > 39 } }
				factor = 0.5
			}
			modifier = {
				add = 20
				POL = { has_army_size = { size < 30 } }
			}
			modifier = {
				factor = 2
				is_in_faction = yes
				NOT = { is_in_faction_with = POL }
			}
			modifier = {
				any_other_country = {
					has_guaranteed = HUN
				}
				factor = 5 #i've got friends
			}
			modifier = {
				any_other_country = {
					is_major = yes
					has_guaranteed = HUN
				}
				factor = 5 #i've got big friends
			}
			modifier = {
				factor = 0.1 #They don't border me, I'm not scared
				any_controlled_state = {
					any_neighbor_state = {
						is_controlled_by = POL
					}
				}
			}
		}
		hidden_effect = { POL = { country_event = POL_habsburg_events.102 } }
	}
}

#Hungary accepts
country_event = {
	id = POL_habsburg_events.101
	title = POL_habsburg_events.101.t
	desc = POL_habsburg_events.101.desc
	picture = GFX_report_event_generic_parliament

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = POL_habsburg_events.101.a
		ai_chance = {
			base = 30
		}
		custom_effect_tooltip = HUN_crowned_habsburg_tt
	}
}

#Hungary says no
country_event = {
	id = POL_habsburg_events.102
	title = POL_habsburg_events.102.t
	desc = POL_habsburg_events.102.desc
	picture = GFX_report_event_polish_tanks_01

	fire_only_once = yes
	is_triggered_only = yes
	
	option = {
		name = POL_habsburg_events.102.a
		ai_chance = {
			base = 30
		}
		create_wargoal = {
			type = puppet_wargoal_focus
			target = HUN
		}
	}
}

#Poland asks Austria to join Habsburg faction
country_event = {
	id = POL_habsburg_events.2
	title = POL_habsburg_events.2.t
	desc = POL_habsburg_events.2.desc
	picture = GFX_report_event_royal_parade
	
	is_triggered_only = yes

	fire_only_once = yes

	immediate = {
		hidden_effect = {
			save_event_target_as = alliance_applicant
			FROM = {
				save_event_target_as = alliance_inviter
			}
		}
	}

	option = { #Hungary agrees
		name = POL_habsburg_events.2.a
		ai_chance = {
			base = 10
		}
		FROM = {
			add_to_faction = PREV
			country_event = { id = generic.6 hours = 6 }
			add_ai_strategy = {
				type = alliance
				id = FROM
				value = 200
			}
		}
		add_ai_strategy = {
			type = alliance
			id = FROM
			value = 200
		}
		hidden_effect = {
			set_country_flag = alliance_applicant@ROOT
			FROM = { set_country_flag = alliance_inviter@ROOT }
			news_event = { id = news.289 hours = 12 }
		}
	}

	option = { #Hungary refuses
		name = POL_habsburg_events.2.b
		ai_chance = {
			base = 0 #If Hungary gets this event, they should never say no as an AI.
		}
		hidden_effect = {
			POL = {
				country_event = { id = POL_habsburg_events.201 }
			}
		}
	}
}
#Hungary says no, change to allied focus
country_event = {
	id = POL_habsburg_events.201
	title = POL_habsburg_events.201.t
	desc = POL_habsburg_events.201.desc
	picture = GFX_report_event_royal_visit
	
	is_triggered_only = yes

	fire_only_once = yes

	option = { #Switch branch
		name = POL_habsburg_events.201.a
		ai_chance = {
			base = 10
		}
		dismantle_faction = yes
		uncomplete_national_focus = {
			focus = POL_align_with_habsburgs
			uncomplete_children = yes
			refund_political_power = no
		}
		complete_national_focus = POL_trust_in_the_west
	}
}
