#Events for the historical occupation of the Soviet Union and Yugoslavia by Axis powers (no more looong Romania)

add_namespace = axiocu


#No border gore in Yugoslavia (Croatia doesn't exist or stayed loyal to Yugoslavia)
country_event = {
	id = axiocu.1
	title = axiocu.1.t
	desc = axiocu.1.d

	picture = GFX_report_event_yugoslavian_split

	fire_only_once = yes

	trigger = {
		tag = GER
		has_war_with = YUG
		GER = { is_faction_leader = yes }
		OR = { 
			has_war_with = CRO
			NOT = { country_exists = CRO }
		}		
		YUG = { has_capitulated = yes }
		is_in_faction_with = ITA #won't happen if Italy didn't join axis
		YUG = {
			AND = {
				has_war_with = ITA
				has_war_with = HUN
				#has_war_with = BUL
			}			
		}
		107 = {
			OR = {
				is_controlled_by = GER
				any_other_country = {
					controls_state = 107
					is_in_faction_with = GER
				}
			}
		}
		NOT = { has_global_flag = axis_partition_of_yougo_flag }
	}		

	mean_time_to_happen = {
		days = 2
	}

	option = {
		name = axiocu.1.a
		ai_chance = { factor = 100 }
		if = {
			limit = { YUG = { has_war_with = BUL } }
			BUL = { 
				set_state_controller = 106 
				set_state_controller = 803 
			}
		}
		if = {
			limit = { NOT = { YUG = { has_war_with = BUL } } }
			ITA = { 
				set_state_controller = 106 
				set_state_controller = 803 
			} 
		}
		ITA = { set_state_controller = 105 }
		GER = { set_state_controller = 107 }
		GER = { set_state_controller = 108 }
		GER = { set_state_controller = 764 }
		HUN = { set_state_controller = 45 }
		GER = { set_state_controller = 109 }
		ITA = { set_state_controller = 104 }
		ITA = { set_state_controller = 804 } # Herzegovina
		ITA = { set_state_controller = 103 }
		ITA = { set_state_controller = 853 } # Lubljana
		GER = { set_state_controller = 102 } # North Slovenia
		ITA = { set_state_controller = 802 } # Kosovo

		set_global_flag = axis_partition_of_yougo_flag
	}

	option = {
		name = axiocu.1.b
	}
}

#No border gore in Yugoslavia (Croatia joined axis)
country_event = {
	id = axiocu.2
	title = axiocu.2.t
	desc = axiocu.2.d

	picture = GFX_report_event_yugoslavian_split

	fire_only_once = yes

	trigger = {
		tag = GER
		has_war_with = YUG
		GER = { is_faction_leader = yes }
		YUG = { has_war_with = CRO }		
		YUG = { has_capitulated = yes }
		is_in_faction_with = ITA #won't happen if Italy didn't join axis
		YUG = {
			AND = {
				has_war_with = ITA
				has_war_with = HUN
				#has_war_with = BUL
			}			
		}
		107 = {
			OR = {
				is_controlled_by = GER
				any_other_country = {
					controls_state = 107
					is_in_faction_with = GER
				}
			}
		}
		NOT = { has_global_flag = axis_partition_of_yougo_flag }
	}		

	mean_time_to_happen = {
		days = 2
	}

	option = {
		name = axiocu.2.a
		ai_chance = { factor = 100 }
		if = {
			limit = { YUG = { has_war_with = BUL } }
			BUL = { 
				set_state_controller = 106 
				set_state_controller = 803 
			}
		}
		if = {
			limit = { NOT = { YUG = { has_war_with = BUL } } }
			ITA = { 
				set_state_controller = 106 
				set_state_controller = 803 
			} 
		}
		ITA = { set_state_controller = 105 }
		GER = { set_state_controller = 107 }
		GER = { set_state_controller = 108 }
		GER = { set_state_controller = 764 }
		HUN = { set_state_controller = 45 }
		CRO = { set_state_controller = 109 }
		ITA = { set_state_controller = 104 }
		ITA = { set_state_controller = 804 } #Herzegovina
		ITA = { set_state_controller = 103 }
		ITA = { set_state_controller = 853 } # Lubljana
		GER = { set_state_controller = 102 } # North Slovenia
		ITA = { set_state_controller = 802 } # Kosovo
		set_global_flag = axis_partition_of_yougo_flag
	}

	option = {
		name = axiocu.2.b
	}
}

country_event = {
	id = axiocu.3
	title = axiocu.3.t
	desc = axiocu.3.d

	picture = GFX_report_event_yugoslavian_split

	fire_only_once = yes

	trigger = {
		tag = GER
		is_in_faction_with = ITA
		has_global_flag = axis_partition_of_yougo_flag
		OR = {
			YUG = { is_puppet = yes }
			AND = {
				NOT = { country_exists = YUG }
				OR = {
					GER = { owns_state = 107 }
					ITA = { owns_state = 107 }
					AND = {
						BUL = { owns_state = 107 }
						BUL = { is_in_faction_with = GER }
					}
					AND = {
						CRO = { owns_state = 107 }
						CRO = { is_in_faction_with = GER }
					}
					AND = {
						HUN = { owns_state = 107 }
						HUN = { is_in_faction_with = GER }
					}
					AND = {
						ROM = { owns_state = 107 }
						ROM = { is_in_faction_with = GER }
					}
					AND = {
						SER = { owns_state = 107 }
						SER = { is_in_faction_with = GER }
					}				
				}
			}
		}
	}

	option = {
		name = axiocu.3.a
		ai_chance = { factor = 100 }
		ITA = { transfer_state = 105 }
		ITA = { transfer_state = 853 } # Lubljana
		GER = { transfer_state = 102 } # North Slovenia
		if = {
			limit = { 
				AND = {
					has_global_flag = italy_gave_pizza_to_croatia_flag
					is_in_faction_with = CRO 
				}
			}
			CRO = { transfer_state = 109 }
			CRO = { transfer_state = 104 }
			CRO = { transfer_state = 103 }
			CRO = { transfer_state = 804 } #Herzegovina
		}
		if = {
			limit = { NOT = { is_in_faction_with = CRO } }
			GER = { transfer_state = 109 }
			ITA = { transfer_state = 104 }
			ITA = { transfer_state = 103 }
			ITA = { transfer_state = 804 } #Herzegovina			
		}
		if = {
			limit = { 
				AND = {
					NOT = { has_global_flag = italy_gave_pizza_to_croatia_flag }
					is_in_faction_with = CRO 
				}
			}
			CRO = { transfer_state = 109 }
			ITA = { transfer_state = 104 }
			ITA = { transfer_state = 103 }
			ITA = { transfer_state = 804 } #Herzegovina
		}
		if = {
			limit = { is_in_faction_with = BUL }
			BUL = { transfer_state = 106 }
			BUL = { transfer_state = 802 } #Southern Serbia	
		}
		if = {
			limit = { NOT = { is_in_faction_with = BUL } }
			ITA = { transfer_state = 106 }
			ITA = { transfer_state = 802 } #Southern Serbia	
		}
		if = {
			limit = { is_in_faction_with = HUN }
			HUN = { transfer_state = 45 }
		}
		if = {
			limit = { NOT = { is_in_faction_with = HUN } }
			GER = { transfer_state = 45 }
		}
		GER = { transfer_state = 107 }
		GER = { transfer_state = 108 }
		GER = { transfer_state = 764 }
		ITA = { transfer_state = 802 } #Kosovo
		release_puppet = SER
		release_puppet = CRO
		clr_global_flag = axis_partition_of_yougo_flag
	}			

	option = {
		name = axiocu.3.b
		clr_global_flag = axis_partition_of_yougo_flag
	}	
}

#Historical occupation of the Soviet Union - part I (part II will be up if Reichkommissariats are ever fixed)
country_event = {
	id = axiocu.4
	title = axiocu.4.t
	desc = axiocu.4.d

	picture = GFX_report_event_german_troops

	fire_only_once = yes

	trigger = {
		tag = ROM
		has_war_with = SOV
		is_in_faction_with = GER
		GER = { is_faction_leader = yes }
		SOV = { has_war_with = GER }
		SOV = { NOT = { controls_state = 202 } } # will fire when soviets lose Kiev to German and Romanian invaders
		NOT = { has_country_flag = interested_in_soviet_land }
	}		

	mean_time_to_happen = {
		days = 2
	}

	option = {
		name = axiocu.4.a
		ai_chance = { factor = 100 }
		if = {
			limit = {
				192 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 192
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 192 }
		}
		if = {
			limit = {
				834 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 834
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 192 }
		}
		if = {
			limit = {
				198 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 198
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 198 }
		}
		if = {
			limit = {
				199 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 199
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 199 }
		}
		if = {
			limit = {
				89 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 89
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 89 }
		}
		if = {
			limit = {
				93 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 93
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 93 }
		}
		if = {
			limit = {
				94 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 94
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 94 }
		}
		if = {
			limit = {
				194 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 194
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 194 }
		}
		if = {
			limit = {
				201 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 201
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 201 }
		}
		if = {
			limit = {
				202 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 202
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 202 }
		}
		if = {
			limit = {
				203 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 203
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 203 }
		}
		if = {
			limit = {
				259 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 259
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 259 }
		}
		if = {
			limit = {
				197 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 197
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 197 }
		}
		if = {
			limit = {
				196 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 196
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 196 }
		}
		if = {
			limit = {
				200 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 200
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 200 }
		}
		if = {
			limit = {
				197 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 197
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 197 }
		}
		if = {
			limit = {
				226 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 226
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 226 }
		}
		if = {
			limit = {
				91 = {
					OR = {
						is_controlled_by = ROM
						any_other_country = {
							controls_state = 91
							is_in_faction_with = GER
							GER = { is_faction_leader = yes }
						}
					}
				}
			}
			GER = { set_state_controller = 91 }
		}
	}

	option = {
		name = axiocu.4.b
		set_country_flag = interested_in_soviet_land
	}
}


### It seems that the old Croatian event evaporated from the code, so here we restore it

### Germany sets up puppet Croatia - this time needs to control the province before setting it up, so Croatia doesn't appear from the thin air

#country_event = {
#	id = axiocu.5
#	title = axiocu.5.t
#	desc = axiocu.5.d
#
#	picture = GFX_report_event_yugoslavian_split
#
#	fire_only_once = yes
#
#	trigger = {
#		tag = GER
#		has_war_with = YUG #in case where Italy conquered Yugoslavia before 1941
#		NOT = { country_exists = CRO } #in case where Croatia already exists and is Yugoslavian puppet DO NOT give them lands 
#		#GER = { is_faction_leader = yes }
#		109 = {
#			AND = {
#				NOT = { is_controlled_by = YUG }
#				OR = {
#					is_controlled_by = GER
#					any_other_country = {
#						controls_state = 109
#						is_in_faction_with = GER
#					}
#				}
#			}
#		}
#	}		
#
#	mean_time_to_happen = {
#		days = 2
#	}
#
#	option = {
#		name = axiocu.5.a
#		ai_chance = { factor = 100 }
#		GER = { transfer_state = 109 }
#		release_puppet = CRO
#		set_global_flag = independent_croatia_puppeted_flag
#	}
#
#	option = {
#		name = axiocu.5.b
#	}
#}

###Italy gives pizza to German Croatia

#country_event = {
#	id = axiocu.6
#	title = axiocu.6.t
#	desc = axiocu.6.d
#
#	picture = GFX_report_event_yugoslavian_split
#
#	fire_only_once = yes
#
#	trigger = {
#		tag = ITA
#		country_exists = CRO
#		NOT = { has_war_with = CRO }
#		YUG = { has_capitulated = yes }
#		is_in_faction_with = GER #won't happen if Italy didn't join axis
#		CRO = { is_in_faction_with = GER }
#		103 = {
#			OR = {
#				is_controlled_by = ITA
#				any_other_country = {
#					controls_state = 103
#					is_in_faction_with = ITA
#				}
#			}
#		}
#		has_global_flag = independent_croatia_puppeted_flag
#		has_global_flag = axis_partition_of_yougo_flag
#	}		
#
#	mean_time_to_happen = {
#		days = 2
#	}
#
#	option = {
#		name = axiocu.6.a
#		ai_chance = { factor = 100 }
#		CRO = { transfer_state = 103 }
#		CRO = { set_state_controller = 104 }
#		CRO = { set_state_controller = 804 } #Herzegovina
#		clr_global_flag = independent_croatia_puppeted_flag
#		set_global_flag = italy_gave_pizza_to_croatia_flag
#	}
#
#	option = {
#		name = axiocu.6.b
#	}
#}


#Italy is able to annex Montenegro and Albania after the war in Yugoslavia
#Albania event
country_event = {
	id = axiocu.11
	title = axiocu.11.t
	desc = axiocu.11.d
	picture = GFX_report_event_yugoslavian_split

	fire_only_once = yes
	
	trigger = {
		tag = ITA
		has_government = fascism
		country_exists = ALB
		has_global_flag = axis_partition_of_yougo_flag
		ALB = { is_subject_of = ITA }
	}

	mean_time_to_happen = {
		days = 2
	}

	option = {
		name = axiocu.11.a
		ai_chance = { factor = 100 }
		ALB = {
			country_event = { id = axiocu.12 }
		}
	}

	option = {
		name = axiocu.11.b
	}
}

country_event = {
	id = axiocu.12
	title = axiocu.12.t
	desc = axiocu.12.d
	picture = GFX_report_event_yugoslavian_split
	
	is_triggered_only = yes
	
	option = { # Accept
		name = axiocu.12.a
		ai_chance = { factor = 100 }
		ITA = {
			country_event = { id = axiocu.14 }
		}
		custom_effect_tooltip = GAME_OVER_TT
	}
	option = { # Refuse
		name = axiocu.12.b
		ITA = {
			country_event = { id = axiocu.13 }
		}
	}
}

# Albania declines the offer of annexation
country_event = {
	id = axiocu.13
	title = axiocu.13.t
	desc = axiocu.13.d
	picture = GFX_report_event_yugoslavian_split
	
	is_triggered_only = yes
	
	option = {
		name = axiocu.13.a
	}
}

# Albania accepts the offer of annexation
country_event = {
	id = axiocu.14
	title = axiocu.14.t
	desc = axiocu.14.d
	picture = GFX_report_event_yugoslavian_split
	
	is_triggered_only = yes
	
	option = {
		name = axiocu.14.a
		annex_country = {
    			target = ALB
   			transfer_troops = no
		}
	}
}

#Montenegro event
country_event = {
	id = axiocu.21
	title = axiocu.21.t
	desc = axiocu.21.d
	picture = GFX_report_event_yugoslavian_split

	fire_only_once = yes
	
	trigger = {
		tag = ITA
		has_government = fascism
		country_exists = MNT
		has_global_flag = axis_partition_of_yougo_flag
		MNT = { is_subject_of = ITA }
	}

	mean_time_to_happen = {
		days = 2
	}

	option = {
		name = axiocu.21.a
		ai_chance = { factor = 100 }
		MNT = {
			country_event = { id = axiocu.22 }
		}
	}

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

country_event = {
	id = axiocu.22
	title = axiocu.22.t
	desc = axiocu.22.d
	picture = GFX_report_event_yugoslavian_split
	
	is_triggered_only = yes
	
	option = { # Accept
		name = axiocu.22.a
		ai_chance = { factor = 100 }
		ITA = {
			country_event = { id = axiocu.24 }
		}
		custom_effect_tooltip = GAME_OVER_TT
	}
	option = { # Refuse
		name = axiocu.22.b
		ITA = {
			country_event = { id = axiocu.23 }
		}
	}
}

# MNT declines the offer of annexation
country_event = {
	id = axiocu.23
	title = axiocu.23.t
	desc = axiocu.23.d
	picture = GFX_report_event_yugoslavian_split
	
	is_triggered_only = yes
	
	option = {
		name = axiocu.23.a
	}
}

# MNT accepts the offer of annexation
country_event = {
	id = axiocu.24
	title = axiocu.24.t
	desc = axiocu.24.d
	picture = GFX_report_event_yugoslavian_split
	
	is_triggered_only = yes
	
	option = {
		name = axiocu.24.a
		annex_country = {
    			target = MNT
   			transfer_troops = no
		}
	}
}