######## Events for the Phoney War timeframe
### made by CSRZ
### in vanilla Italy always joins the Axis in 1939
### These events are meant to make Italy and the balkans more historically accurate during the Phoney War period.


add_namespace = phoney


#Event for Italy after Ethiopian war
#activate SLOG and kick Italy from faction with Germany

country_event = {
	id = phoney.1
	title = phoney.1.t
	desc = phoney.1.d

	picture = GFX_report_war_in_ethiopia_is_a_slog

	fire_only_once = yes

	trigger = {
		tag = ITA
		NOT = { has_global_flag = disable_phoney_war_setup }
		is_historical_focus_on = yes
		#has_war = no #War in Ethiopia can never end now o_O
		controls_state = 271 #Italian troops in Addis Abeba
		controls_state = 838
		controls_state = 837
		date < 1940.1.1 #failsafe for future scenarios
	}

	mean_time_to_happen = {
		days = 1
	}

	option = {
		name = phoney.1.a
		ai_chance = { 
			factor = 75
			modifier = {
				factor = 100
				is_historical_focus_on = yes
			}
		}	
		leave_faction = yes
		add_ideas = ITA_italy_unprep
		set_global_flag = italy_unprepared_for_war
	}

	option = {
		name = phoney.1.b
		ai_chance = { 
			factor = 25
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
		}
		add_stability = -0.1
	}
}

#Italy is now prepared for war - deactivate SLOG event
country_event = {
	id = phoney.2
	title = phoney.2.t
	desc = phoney.2.d

	picture = GFX_report_italy_is_ready_for_war

	fire_only_once = yes

	trigger = {
		tag = ITA
		NOT = { has_global_flag = disable_phoney_war_setup }
		is_historical_focus_on = yes
		has_global_flag = italy_unprepared_for_war
		OR = {
			date > 1940.6.1
			FRA = { surrender_progress > 0.10 }
			#has_war = yes #it's war anyway so get rid of it #Italy is at perma war
			has_war_with = FRA
			has_war_with = CHI
			has_war_with = JAP
			has_war_with = GER
			has_war_with = SOV
			has_war_with = POL
			has_war_with = ENG
			has_war_with = USA
			has_war_with = CAN
			has_war_with = MEX	
			has_war_with = SPR
			has_war_with = GRE	
			NOT = { has_government = fascism } #communist/democratic Italy must get rid of this without triggering the war
		}
	}

	mean_time_to_happen = {
		days = 1
	}

	option = {
		name = phoney.2.a
		#leave_faction = yes
		remove_ideas = ITA_italy_unprep
		clr_global_flag = italy_unprepared_for_war
		if = {
			limit = { 
				ITA = { has_government = fascism } 
				OR = {
					GER = { has_war_with = FRA }
					GER = { has_war_with = ENG }
				}
				NOT = { 
					is_in_faction_with = ENG
					is_in_faction_with = FRA
				}
			}
			country_event = {
				id = phoney.3
				days = 2
			}
		}
	}
}


#Italy declares a war on the United Kingdom and France
country_event = {
	id = phoney.3
	title = phoney.3.t
	desc = phoney.3.d

	picture = GFX_report_mussolini_speech

	is_triggered_only = yes

	option = {
		name = phoney.3.a
		ai_chance = { factor = 100 }
		if = {
			limit = { 
				GER = { has_war_with = FRA }
			}
			declare_war_on = {
    				target = FRA
				type = annex_everything
			}
		}
		if = {
			limit = { 
				GER = { has_war_with = ENG }
			}
			declare_war_on = {
    				target = ENG
				type = annex_everything
			}
		}
		news_event = {
			id = phoney.11
			hours = 3
		}
	}

	option = {
		name = phoney.3.b
		add_war_support = -0.1
	}
}



#integrate Banovina for Yugoslavia
#country_event = {
#	id = phoney.10
#	title = phoney.10.t
#	desc = phoney.10.d
#
#	picture = GFX_report_banovina_into_yugoslavia
#
#	fire_only_once = yes
#
#	trigger = {
#		tag = YUG
#		CRO = { is_subject_of = YUG }
#		has_completed_focus = YUG_establish_the_banovina_of_croatia
#	}
#
#	mean_time_to_happen = {
#		days = 2
#	}
#
#	option = {
#		name = phoney.10.a
#		ai_chance = { factor = 100 }
#		annex_country = {
#   			target = CRO
#   			transfer_troops = yes
#		}
#		add_political_power = -50
#	}
#
#	option = {
#		name = phoney.10.b
#		add_stability = -0.5
#	}
#}


#News event - Mussolini's Speech
news_event = {
	id = phoney.11
	title = phoney.11.t
	desc = phoney.11.d
	picture = GFX_news_event_mussolini_speech
	
	major = yes
	
	#fire_only_once = yes

	is_triggered_only =  yes 

	option = {
		name = phoney.11.a
		trigger = {
			OR = {
				has_government = fascism
			}
		}
	}

	option = {
		name = phoney.11.b
		trigger = {
			NOT = {
				has_government = fascism
			}
		}
	}	
}

#break alliance with Germany for Yugoslavia if April 1941
#German response - declare war
#NOT COMPLETED - edited the ai_strategy_plans instead so that Yugoslavia never joins the Axis on historical focus (possible future expansion)

#News event - Yugoslavia breaks pact of steel
#
#news_event = {
#	id = phoney.12
#	title = phoney.12.t
#	desc = phoney.12.d
#	picture = GFX_news_event_yugoslavia_breaks_pact_of_steel
#	
#	major = yes
#	
#	#fire_only_once = yes
#
#	is_triggered_only =  yes 
#
#	option = {
#		name = phoney.12.a
#		trigger = {
#			OR = {
#				has_government = fascism
#			}
#		}
#	}
#
#	option = {
#		name = phoney.12.b
#		trigger = {
#			NOT = {
#				has_government = fascism
#			}
#		}
#	}	
#}

#Yugolsavia quits the Axis
#country_event = {
#	id = phoney.13
#	title = phoney.13.t
#	desc = phoney.13.d
#
#	picture = GFX_report_yugoslavia_breaks_pact_of_steel
#
#	fire_only_once = yes
#
#	trigger = {
#		tag = YUG
#		NOT = { has_global_flag = disable_phoney_war_setup }
#		is_in_faction_with = GER
#		GER = { has_government = fascism }
#		GER = { is_faction_leader = yes }
#		is_subject = no
#		GER = { is_subject = no }
#		date < 1941.6.6 #before Germans invade the Soviet Union
#	}
#
#	mean_time_to_happen = {
#		days = 2
#	}
#
#	option = {
#		name = phoney.13.a
#		ai_chance = { 
#			factor = 50
#			modifier = {
#				factor = 100
#				is_historical_focus_on = yes
#			}
#		}
#		leave_faction = yes
#		add_political_power = -50
#		white_peace = ENG
#		news_event = {
#			id = phoney.12
#			hours = 3
#		}
#	}
#
#	option = {
#		name = phoney.13.b
#		ai_chance = { 
#			factor = 50
#			modifier = {
#				factor = 0
#				is_historical_focus_on = yes
#			}
#		}
#	}
#}




#Communist takeover in Yugoslavia

news_event = {
	id = phoney.19
	title = phoney.19.t
	desc = phoney.19.d
	picture = GFX_news_event_tito_yugoslavia
	
	major = yes
	
	fire_only_once = yes

	is_triggered_only =  yes 

	option = {
		name = phoney.19.a
		trigger = {
			OR = {
				has_government = communism
			}
		}
	}

	option = {
		name = phoney.19.b
		trigger = {
			NOT = {
				has_government = communism
			}
		}
	}	
}

country_event = {
	id = phoney.20
	title = phoney.20.t
	desc = phoney.20.d

	picture = GFX_report_tito_yugoslavia

	fire_only_once = yes

	trigger = {
		tag = YUG
		NOT = { has_global_flag = disable_phoney_war_setup }
		date > 1943.1.1
		has_war_with = GER
	}

	mean_time_to_happen = {
		days = 2
	}

	option = {
		name = phoney.20.a
		ai_chance = { 
			factor = 0
			modifier = {
				factor = 100
				is_historical_focus_on = yes
			}
		}
		YUG = { 
			set_popularities = {
				democratic = 5
				neutrality = 5
				fascism = 0
				communism = 90
			}
		}
		YUG = {
			set_politics = {
				ruling_party = communism
				elections_allowed = no
			}
		}
		news_event = {
			id = phoney.19
			hours = 3
		}
	}

	option = {
		name = phoney.20.b
		ai_chance = { 
			factor = 100
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
		}
	}
}



#block Romania from joining the war too early
country_event = {
	id = phoney.21
	title = phoney.21.t
	desc = phoney.21.d

	picture = GFX_report_unprepared_for_war_generic

	fire_only_once = yes

	trigger = {
		tag = ROM
		NOT = { has_global_flag = disable_phoney_war_setup }
		is_historical_focus_on = yes
		AND = {
			FRA = { has_war_with = GER }
			ENG = { has_war_with = GER }
		}
		date < 1940.11.11
		date > 1939.1.1
	}

	mean_time_to_happen = {
		days = 2
	}

	option = {
		name = phoney.21.a
		ai_chance = { factor = 100 }
		add_ideas = generic_unprep
		set_country_flag = not_prepared_for_war_general_flag
	}

	option = {
		name = phoney.21.b
	}
}

#unlock Romania
country_event = {
	id = phoney.22
	title = phoney.22.t
	desc = phoney.22.d

	picture = GFX_report_unprepared_for_war_generic

	fire_only_once = yes

	trigger = {
		tag = ROM
		NOT = { has_global_flag = disable_phoney_war_setup }
		#is_historical_focus_on = yes #not needed - just clear it on date
		has_country_flag = not_prepared_for_war_general_flag
		OR = {
			has_war = yes
			date > 1940.11.21 #set 10 days later to prevent a bug where it fires before the lock event
		}
	}

	mean_time_to_happen = {
		days = 2 #21 november + 2 = 23 november 1940 - the day Romania joined Axis
	}

	option = {
		name = phoney.22.a
		remove_ideas = generic_unprep
		clr_country_flag = not_prepared_for_war_general_flag
	}
}


#block Hungary from joining the war too early
country_event = {
	id = phoney.23
	title = phoney.23.t
	desc = phoney.23.d

	picture = GFX_report_unprepared_for_war_generic

	fire_only_once = yes

	trigger = {
		tag = HUN
		NOT = { has_global_flag = disable_phoney_war_setup }
		is_historical_focus_on = yes
		AND = {
			FRA = { has_war_with = GER }
			ENG = { has_war_with = GER }
		}
		date < 1940.1.1
		date > 1939.1.1
	}

	mean_time_to_happen = {
		days = 2
	}

	option = {
		name = phoney.23.a
		ai_chance = { factor = 100 }
		add_ideas = generic_unprep
		set_country_flag = not_prepared_for_war_general_flag
	}

	option = {
		name = phoney.23.b
	}
}

#unlock Hungary
country_event = {
	id = phoney.24
	title = phoney.24.t
	desc = phoney.24.d

	picture = GFX_report_unprepared_for_war_generic

	fire_only_once = yes

	trigger = {
		tag = HUN
		NOT = { has_global_flag = disable_phoney_war_setup }
		#is_historical_focus_on = yes #not needed - just clear it on date
		has_country_flag = not_prepared_for_war_general_flag
		OR = {
			date > 1940.1.10 #set 10 days later to prevent a bug where it fires before the lock event
			has_war = yes
		}
	}

	mean_time_to_happen = {
		days = 2
	}

	option = {
		name = phoney.24.a
		remove_ideas = generic_unprep
		clr_country_flag = not_prepared_for_war_general_flag
	}
}

#meant for 1939 scenario where Romania immediately joins Axis through focus tree, but no one plays 1939 scenario, so let's freeze it for now
#country_event = {
#	id = phoney.29
#
#	trigger = {
#		tag = ROM
#		is_ai = yes
#		is_historical_focus_on = yes
#		date < 1940.1.1
#		is_in_faction_with = GER
#	}
#
#	fire_only_once = yes
#
#	mean_time_to_happen = {
#		days = 1
#	}
#
#	hidden = yes
#
#	immediate = {
#		leave_faction = yes
#		set_country_flag = ai_romania_kicked_from_axis_for_a_bit
#	}
#}

#country_event = {
#	id = phoney.30
#
#	trigger = {
#		tag = ROM
#		is_ai = yes
#		GER = { is_ai = yes }
#		date > 1940.10.10
#		has_country_flag = ai_romania_kicked_from_axis_for_a_bit
#	}
#
#	fire_only_once = yes
#
#	mean_time_to_happen = {
#		days = 1
#	}
#
#	hidden = yes
#
#	immediate = {
#		GER = { add_to_faction = ROM }
#		clr_country_flag = ai_romania_kicked_from_axis_for_a_bit
#	}
#}

#Luxembourg - on historical shouldn't join Allies that quickly
country_event = {
	id = phoney.31

	trigger = {
		tag = LUX
		NOT = { has_global_flag = disable_phoney_war_setup }
		is_ai = yes
		is_historical_focus_on = yes
		date < 1940.4.4
	}

	fire_only_once = yes

	mean_time_to_happen = {
		days = 1
	}

	hidden = yes

	immediate = {
		add_ideas = generic_unprep
	}
}

country_event = {
	id = phoney.32

	trigger = {
		tag = LUX
		NOT = { has_global_flag = disable_phoney_war_setup }
		date > 1940.5.5
	}

	fire_only_once = yes

	mean_time_to_happen = {
		days = 1
	}

	hidden = yes

	immediate = {
		remove_ideas = generic_unprep
	}
}

#Germany dows Benelux on historical dates
country_event = {
	id = phoney.33

	trigger = {
		tag = GER
		NOT = { has_global_flag = disable_phoney_war_setup }
		has_government = fascism
		is_ai = yes
		is_historical_focus_on = yes
		date < 1940.6.20
		date > 1940.5.5
		has_war_with = FRA
		NOT = {
			is_in_faction_with = HOL
			is_in_faction_with = BEL
			is_in_faction_with = LUX
		}
	}

	fire_only_once = yes

	mean_time_to_happen = {
		days = 1
	}

	#hidden = yes

	immediate = {
		GER = {
			declare_war_on = {
   				target = BEL
				type = annex_everything
			}
			declare_war_on = {
   				target = LUX
				type = annex_everything
			}
			declare_war_on = {
   				target = HOL
				type = annex_everything
			}
		}
	}
}

#Germany dows Denmark and Norway on historical dates
country_event = {
	id = phoney.34

	trigger = {
		tag = GER
		NOT = { has_global_flag = disable_phoney_war_setup }
		has_government = fascism
		is_ai = yes
		is_historical_focus_on = yes
		date < 1940.5.20
		date > 1940.4.1
		has_war_with = ENG
		NOT = {
			is_in_faction_with = DEN
			is_in_faction_with = NOR
		}
	}

	fire_only_once = yes

	mean_time_to_happen = {
		days = 1
	}

	#hidden = yes

	immediate = {
		declare_war_on = {
   			target = NOR
			type = annex_everything
		}
		declare_war_on = {
   			target = DEN
			type = annex_everything
		}
	}
}

#Italy is good ally and returns northern French provinces to Germany when on historical focus

country_event = {
	id = phoney.35

	trigger = {
		tag = ITA
		NOT = { has_global_flag = disable_phoney_war_setup }
		date < 1942.1.1
		is_ai = yes
		is_historical_focus_on = yes
		OR = {
			7 = { is_controlled_by = ITA }
			36 = { is_controlled_by = ITA }
			16 = { is_controlled_by = ITA }
			785 = { is_controlled_by = ITA }
			29 = { is_controlled_by = ITA }
			34 = { is_controlled_by = ITA }
			6 = { is_controlled_by = ITA }
			35 = { is_controlled_by = ITA }
			29 = { is_controlled_by = ITA }
			18 = { is_controlled_by = ITA }
			17 = { is_controlled_by = ITA }
			28 = { is_controlled_by = ITA }
			27 = { is_controlled_by = ITA }
			24 = { is_controlled_by = ITA }
			15 = { is_controlled_by = ITA }
			14 = { is_controlled_by = ITA }
			30 = { is_controlled_by = ITA }
			23 = { is_controlled_by = ITA }
			19 = { is_controlled_by = ITA }
			806 = { is_controlled_by = ITA }
		}
		has_war_with = FRA
		FRA = { has_capitulated = yes }
		is_in_faction_with = GER
		GER = { has_war_with = FRA }
	}

	fire_only_once = yes

	mean_time_to_happen = {
		days = 1
	}

	hidden = yes

	immediate = {
		if = {
			limit = {
				7 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 7
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 7 }
		}
		if = {
			limit = {
				36 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 36
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 36 }
		}
		if = {
			limit = {
				35 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 35
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 35 }
		}
		if = {
			limit = {
				6 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 6
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 6 }
		}
		if = {
			limit = {
				34 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 34
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 34 }
		}
		if = {
			limit = {
				29 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 29
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 29 }
		}
		if = {
			limit = {
				785 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 785
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 785 }
		}
		if = {
			limit = {
				16 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 16
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 16 }
		}
		if = {
			limit = {
				18 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 18
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 18 }
		}
		if = {
			limit = {
				28 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 28
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 28 }
		}
		if = {
			limit = {
				17 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 17
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 17 }
		}
		if = {
			limit = {
				27 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 27
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 27 }
		}
		if = {
			limit = {
				24 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 24
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 24 }
		}
		if = {
			limit = {
				15 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 15
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 15 }
		}
		if = {
			limit = {
				14 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 14
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 14 }
		}
		if = {
			limit = {
				30 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 30
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 30 }
		}
		if = {
			limit = {
				23 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 23
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 23 }
		}
		if = {
			limit = {
				19 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 19
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 19 }
		}
		if = {
			limit = {
				806 = {
					OR = {
						is_controlled_by = ITA
						any_other_country = {
							controls_state = 806
							is_in_faction_with = ITA
						}
					}
				}
			}
			GER = { set_state_controller = 806 }
		}
	}
}

#Germany dows Yugoslavia on historical dates
country_event = {
	id = phoney.36

	trigger = {
		tag = GER
		NOT = { has_global_flag = disable_phoney_war_setup }
		is_ai = yes
		is_historical_focus_on = yes
		date < 1941.6.1
		date > 1941.4.1
		has_war_with = ENG
		has_government = fascism
		NOT = {
			is_in_faction_with = YUG
		}
	}

	fire_only_once = yes

	mean_time_to_happen = {
		days = 1
	}

	#hidden = yes

	immediate = {
		declare_war_on = {
   			target = YUG
			type = annex_everything
		}
	}
}

#Germany dows the Soviet Union on historical dates
country_event = {
	id = phoney.37

	trigger = {
		tag = GER
		NOT = { has_global_flag = disable_phoney_war_setup }
		is_ai = yes
		is_historical_focus_on = yes
		date > 1941.6.21
		date < 1941.7.21
		has_war_with = ENG
		has_government = fascism
		NOT = {
			is_in_faction_with = SOV
		}
	}

	fire_only_once = yes

	mean_time_to_happen = {
		days = 1
	}

	#hidden = yes

	immediate = {
		declare_war_on = {
   			target = SOV
			type = annex_everything
		}
		add_timed_idea = {
			idea = GER_barbarossa
			days = 150
		}
	}
}

#Japan dows the USA on historical dates
country_event = {
	id = phoney.38

	trigger = {
		tag = JAP
		NOT = { has_global_flag = disable_phoney_war_setup }
		is_ai = yes
		is_historical_focus_on = yes
		date > 1941.12.5
		date < 1942.1.5
		has_government = fascism
		NOT = {
			is_in_faction_with = USA
		}
	}

	fire_only_once = yes

	mean_time_to_happen = {
		days = 1
	}

	#hidden = yes

	immediate = {
		declare_war_on = {
   			target = USA
			type = annex_everything
		}
	}
}
